From 03f98b75e47ef9df890d92b4989fdd209ba55734 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Wed, 25 Sep 2019 20:40:56 +0200 Subject: rockchip: misc: read the correct number of bytes from the efuse Originally the cpuid var the value gets read into was defined as u8 cpuid[RK3399_CPUID_LEN]; hence the sizeof(cpuid) would return the correct the correct number of array elements. With the move to a separate function cpuid becomes a pointer and sizeof(cpuid) hence returns the pointer size - 8 in the arm64 case. We do have the actual id length available as function param so use it for actual amount of bytes to read. Fixes: 04825384999f ("rockchip: rk3399: derive ethaddr from cpuid") Signed-off-by: Heiko Stuebner Reviewed-by: Philipp Tomsich Reviewed-by: Kever Yang --- arch/arm/mach-rockchip/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c index fdb763c..c0e4fdb 100644 --- a/arch/arm/mach-rockchip/misc.c +++ b/arch/arm/mach-rockchip/misc.c @@ -70,7 +70,7 @@ int rockchip_cpuid_from_efuse(const u32 cpuid_offset, } /* read the cpu_id range from the efuses */ - ret = misc_read(dev, cpuid_offset, cpuid, sizeof(cpuid)); + ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length); if (ret) { debug("%s: reading cpuid from the efuses failed\n", __func__); -- cgit v1.1 From d46b548290042a248216cbaed99964dc77a26bf4 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Thu, 26 Sep 2019 21:15:15 +0200 Subject: rockchip: make_fit_atf.py: fix .its generation for a single atf image The commit 619f002db864 ("rockchip: make_fit_atf.py: fix loadables property set error") fixed the double-loading of the primary atf-image, but didn't take into account that there may be rare atf images with only that main section present. Right now this will result in a broken its due to the loadables section not getting closed correctly, so fix that by adapting the guards around the loop. The guards now protect against 0 segments when the bl31 binary doesn't contain any section and 1 segment when only a core atf section is present. Fixes: 619f002db864 ("rockchip: make_fit_atf.py: fix loadables property set error") Signed-off-by: Heiko Stuebner Reviewed-by: Kever Yang --- arch/arm/mach-rockchip/make_fit_atf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py index b9a1988..585edcf 100755 --- a/arch/arm/mach-rockchip/make_fit_atf.py +++ b/arch/arm/mach-rockchip/make_fit_atf.py @@ -82,7 +82,7 @@ def append_conf_section(file, cnt, dtname, segments): file.write('\t\t\tdescription = "%s";\n' % dtname) file.write('\t\t\tfirmware = "atf_1";\n') file.write('\t\t\tloadables = "uboot"') - if segments != 0: + if segments > 1: file.write(',') for i in range(1, segments): file.write('"atf_%d"' % (i + 1)) @@ -90,7 +90,7 @@ def append_conf_section(file, cnt, dtname, segments): file.write(',') else: file.write(';\n') - if segments == 0: + if segments <= 1: file.write(';\n') file.write('\t\t\tfdt = "fdt_1";\n') file.write('\t\t};\n') -- cgit v1.1