aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-rockchip/misc.c
AgeCommit message (Collapse)AuthorFilesLines
2024-03-13rockchip: merge misc.c into board.cQuentin Schulz1-135/+0
The functions aren't used anywhere else than in board.c, therefore, let's not expose them anymore at all. This merges misc.c and board.c together and removes the functions from the misc.h header file. Cc: Quentin Schulz <foss+uboot@0leil.net> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
2024-03-13rockchip: avoid out-of-bounds when computing cpuidQuentin Schulz1-4/+4
The expected length of the cpuid, as passed with cpuid_length, determines the size of cpuid_str string. Therefore, care should be taken to make sure nothing is accessing data out-of-bounds. Instead of using hardcoded values, derive them from cpuid_length. Cc: Quentin Schulz <foss+uboot@0leil.net> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Dragan Simic <dsimic@manjaro.org> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
2023-04-21rockchip: misc: fix misc_read() return checkJohn Keeping1-1/+1
misc_read() is documented to return the number of bytes read or a negative error value. The Rockchip drivers currently do not implement this correctly and instead return zero on success or a negative error value. In preparation for fixing the drivers, fix the condition here to only error on negative values. Suggested-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-02-28rockchip: misc: Set eth1addr mac addressJonas Karlman1-1/+5
Set eth1addr in addition to ethaddr. Also allow fdt fixup of ethernet mac addresses when CMD_NET is disabled. Set ethaddr and eth1addr based on HASH and SHA256 options. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2023-02-10Correct SPL uses of ROCKCHIP_OTPSimon Glass1-2/+2
This converts 2 usages of this option to the non-SPL form, since there is no SPL_ROCKCHIP_OTP defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10Correct SPL uses of ROCKCHIP_EFUSESimon Glass1-2/+2
This converts 2 usages of this option to the non-SPL form, since there is no SPL_ROCKCHIP_EFUSE defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-09Correct SPL use of CMD_NETSimon Glass1-1/+1
This converts 1 usage of this option to the non-SPL form, since there is no SPL_CMD_NET defined in Kconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-05dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()Simon Glass1-2/+2
In the spirit of using the same base name for all of these related macros, rename this to have the operation at the end. This is not widely used so the impact is fairly small. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop image.h from common headerSimon Glass1-0/+1
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
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>