aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-rockchip/misc.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-05rockchip: misc: protect serial# from getting overwrittenHeiko Stuebner1-1/+10
serial# is one of the vendor properties and thus protected from being overwritten if already set. If env_set is called anyway this result in some nasty warnings, so check for presence before trying that. In the same direction check for the presence of cpuid# and compare it to the actual hardware and emit a warning if they don't match. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-12-05rockchip: misc: don't fail if eth_addr already setHeiko Stuebner1-1/+1
rockchip_setup_macaddr() runs from an initcall, so returning an error code will make that initcall fail thus breaking the boot process. And if an ethernet address is already set this is definitly not a cause for that, so just return success in that case. Fixes: 04825384999f ("rockchip: rk3399: derive ethaddr from cpuid"); Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-12-02crc32: Use the crc.h header for crc functionsSimon Glass1-0/+1
Drop inclusion of crc.h in common.h and use the correct header directly instead. With this we can drop the conflicting definition in fw_env.h and rely on the crc.h header, which is already included. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2019-11-17rockchip: misc: read cpuid either from efuse or otpHeiko Stuebner1-1/+6
Newer Rockchip socs use a different ip block to handle one-time- programmable memory, so depending on what got enabled get the cpuid from either source. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-09-28rockchip: misc: read the correct number of bytes from the efuseHeiko Stuebner1-1/+1
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 <heiko@sntech.de> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
2019-08-23rockchip: rk3399: derive ethaddr from cpuidRohan Garg1-0/+114
Generate a MAC address based on the cpuid available in the efuse block: Use the first 6 byte of the cpuid's SHA256 hash and set the locally administered bits. Also ensure that the multicast bit is cleared. The MAC address is only generated and set if there is no ethaddr present in the saved environment. This is based off of Klaus Goger's work in 8adc9d Signed-off-by: Rohan Garg <rohan.garg@collabora.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>