Re: [FIX PATCH v1] Fix: common: usb_hub: Reset only USB3.0 hub
Hello Shantur, On 2024-02-08 15:17, Dragan Simic wrote: On 2024-02-08 15:10, Shantur Rathore wrote: On Thu, Feb 8, 2024 at 1:44 PM Dragan Simic wrote: On 2024-02-08 14:33, Marek Vasut wrote: > On 2/8/24 12:30, Shantur Rathore wrote: >> On Wed, Feb 7, 2024 at 1:07 PM Marek Vasut wrote: >>> On 2/7/24 11:23, Shantur Rathore wrote: USB 3.0 spec requires hub to reset device while enumeration. Some USB 2.0 hubs / devices don't handle this well and after implementation of reset some USB 2.0 disks weren't detected on Allwinner based boards. Resetting only when hub is USB 3.0 fixes it. >>> >>> It would be good to include as many details about the faulty hardware >>> in >>> the commit message as possible, so that when someone else runs into >>> this, they would have all that information available. >>> Tested-by: Andre Przywara Signed-off-by: Shantur Rathore --- common/usb_hub.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/usb_hub.c b/common/usb_hub.c index 3fb7e14d10..2e054eb935 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -174,8 +174,10 @@ static void usb_hub_power_on(struct usb_hub_device *hub) debug("enabling power on all ports\n"); for (i = 0; i < dev->maxchild; i++) { - usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_RESET); - debug("Reset : port %d returns %lX\n", i + 1, dev->status); + if (usb_hub_is_superspeed(dev)) { >>> >>> Should this condition be "all which are lower than superspeed" >>> instead , >>> so when the next generation of USB comes, this problem won't trigger >>> ? >>> >>> What does Linux do btw ? >> >> As of now Linux checks if the hub is superspeed >> https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.c#L2859 >> >> which is >> return hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS; // >> USB_HUB_PR_SS = 3 >> >> This holds true for newer SuperSpeedPlus hubs as well. >> https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.h#L155 >> >> We can change the check to be bDeviceProtocol > 2 but who knows if >> things change in the newer version of spec. >> I am open to suggestions. > > Please just include the ^ in the commit description. Use link to > git.kernel.org , not some mirror . This is extremely useful > information and, well, you already wrote the V2 commit message > addition in this answer. Shantur, if that would be easier or quicker for you, I can write a quite detailed patch description for you, in exchange for a "Helped-by" tag in the v2 patch submission. :) That would be really kind of you Dragan. Sure, I'll write the summary and send it over. I am down with the flu so that would really help me as my brain is working at 15% capacity. Oh, I'm really sorry to hear that. :( I hope you'll get better soon, and I know very well what's it like; I've also been sick recently, as a result of some kind of flu that unfortunately found its way into my lungs, and it took me about a month to get back to about 90% of my usual mental capacity. I'm still not back to exactly 100%. :/ I really hope you'll recover much faster. I hope you're feeling better. Below are the patch subject and description that I prepared for you, please have a look. --- >8 - >8 - >8 - >8 --- [PATCH v2] common: usb-hub: Reset USB 3.0 hubs only Additional testing of the changes introduced in commit 33e06dcbe57a ("common: usb-hub: Reset hub port before scanning") revealed that some USB 3.0 flash drives didn't work in U-Boot on some Allwinner SoCs that support USB 2.0 only. More precisely, some tested USB 3.0 flash drives failed to be detected and work on an OrangePi Zero 3 with Allwinner H616 SoC, which supports USB 2.0 only, while the same USB flash drives worked just fine on a Pine64 H64 with Allwinner H6 SoC, which supports both USB 2.0 and 3.0. Resetting USB 3.0 hubs only has been tested to work as expected, resolving the previous issues on the Allwinner H616, while not introducing any new issues on other Allwinner SoCs. Thus, let's fix it that way. According to the USB 3.0 specification, resetting a USB 3.0 port is required when an attached USB device transitions between different states, such as when it resumes from suspend. Though, the Linux kernel performs additional USB 3.0 port resets upon initial USB device attachment, presumably to ensure proper state of the USB 3.0 hub port and proper USB mode negotiation during the initial USB device attachment and enumeration. Such USB port resets don't seem to exist for USB 2.0 hubs, according the USB 2.0 specification. The resets seem to be added to the USB 3.0 specification as part of the port and device mode negotiation. The Linux kernel also resets USB 3.0 (i.e. SuperSpeed) hubs only, as visible in file
[PATCH 4/4] rockchip: rk3399: regenerate defconfigs
From: Chen-Yu Tsai Regenerate RK3399 defconfigs after adding imply statements. Signed-off-by: Chen-Yu Tsai --- configs/chromebook_bob_defconfig | 2 -- configs/chromebook_kevin_defconfig| 2 -- configs/firefly-rk3399_defconfig | 2 -- configs/nanopi-r4s-rk3399_defconfig | 2 -- configs/pinebook-pro-rk3399_defconfig | 2 -- configs/pinephone-pro-rk3399_defconfig| 2 -- configs/puma-rk3399_defconfig | 2 -- configs/roc-pc-mezzanine-rk3399_defconfig | 2 -- configs/roc-pc-rk3399_defconfig | 2 -- configs/rock-4c-plus-rk3399_defconfig | 3 --- configs/rock-4se-rk3399_defconfig | 3 --- configs/rock-pi-4-rk3399_defconfig| 3 --- configs/rock-pi-4c-rk3399_defconfig | 3 --- configs/rock-pi-n10-rk3399pro_defconfig | 1 - configs/rock960-rk3399_defconfig | 1 - configs/rockpro64-rk3399_defconfig| 2 -- 16 files changed, 34 deletions(-) diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig index b5a5ae737e52..bffa0d33b75c 100644 --- a/configs/chromebook_bob_defconfig +++ b/configs/chromebook_bob_defconfig @@ -27,7 +27,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-gru-bob.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_EARLY_INIT_R=y -CONFIG_MISC_INIT_R=y CONFIG_BLOBLIST=y CONFIG_BLOBLIST_ADDR=0x10 CONFIG_BLOBLIST_SIZE=0x1000 @@ -68,7 +67,6 @@ CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_I2C_MUX=y CONFIG_CROS_EC_KEYB=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y diff --git a/configs/chromebook_kevin_defconfig b/configs/chromebook_kevin_defconfig index 20913d2cf0fe..e14fc358c504 100644 --- a/configs/chromebook_kevin_defconfig +++ b/configs/chromebook_kevin_defconfig @@ -28,7 +28,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-gru-kevin.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_EARLY_INIT_R=y -CONFIG_MISC_INIT_R=y CONFIG_BLOBLIST=y CONFIG_BLOBLIST_ADDR=0x10 CONFIG_BLOBLIST_SIZE=0x1000 @@ -69,7 +68,6 @@ CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_I2C_MUX=y CONFIG_CROS_EC_KEYB=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig index b7c8e95b7b89..b01b1a327896 100644 --- a/configs/firefly-rk3399_defconfig +++ b/configs/firefly-rk3399_defconfig @@ -20,7 +20,6 @@ CONFIG_PCI=y CONFIG_DEBUG_UART=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-firefly.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x2e000 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -46,7 +45,6 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y diff --git a/configs/nanopi-r4s-rk3399_defconfig b/configs/nanopi-r4s-rk3399_defconfig index cacaab14d21f..18a1e68aa049 100644 --- a/configs/nanopi-r4s-rk3399_defconfig +++ b/configs/nanopi-r4s-rk3399_defconfig @@ -17,7 +17,6 @@ CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_DEBUG_UART=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopi-r4s.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x2e000 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -42,7 +41,6 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_ROCKCHIP_OTP=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig index de357415fbe4..6b83daf07945 100644 --- a/configs/pinebook-pro-rk3399_defconfig +++ b/configs/pinebook-pro-rk3399_defconfig @@ -26,7 +26,6 @@ CONFIG_BOOTDELAY=3 CONFIG_USE_PREBOOT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -61,7 +60,6 @@ CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_SPL_MMC_IO_VOLTAGE=y CONFIG_MMC_UHS_SUPPORT=y diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig index d08224fe536b..96316c4b303f 100644 --- a/configs/pinephone-pro-rk3399_defconfig +++ b/configs/pinephone-pro-rk3399_defconfig @@ -25,7 +25,6 @@ CONFIG_BOOTDELAY=3 CONFIG_USE_PREBOOT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinephone-pro.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -60,7 +59,6 @@ CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_LED=y CONFIG_LED_GPIO=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y diff --git
[PATCH 3/4] rockchip: rk3328: regenerate defconfigs
From: Chen-Yu Tsai Regenerate RK3328 defconfigs after adding imply statements. Signed-off-by: Chen-Yu Tsai --- configs/evb-rk3328_defconfig | 2 -- configs/nanopi-r2c-plus-rk3328_defconfig | 2 -- configs/nanopi-r2c-rk3328_defconfig | 2 -- configs/nanopi-r2s-rk3328_defconfig | 2 -- configs/orangepi-r1-plus-lts-rk3328_defconfig | 2 -- configs/orangepi-r1-plus-rk3328_defconfig | 2 -- configs/roc-cc-rk3328_defconfig | 2 -- configs/rock-pi-e-rk3328_defconfig| 2 -- configs/rock64-rk3328_defconfig | 2 -- 9 files changed, 18 deletions(-) diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig index 995bfd0558b1..004cbd33e80a 100644 --- a/configs/evb-rk3328_defconfig +++ b/configs/evb-rk3328_defconfig @@ -30,7 +30,6 @@ CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-evb.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -71,7 +70,6 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_PHY_MOTORCOMM=y diff --git a/configs/nanopi-r2c-plus-rk3328_defconfig b/configs/nanopi-r2c-plus-rk3328_defconfig index 1cb0ed855398..2f0d253b4b7c 100644 --- a/configs/nanopi-r2c-plus-rk3328_defconfig +++ b/configs/nanopi-r2c-plus-rk3328_defconfig @@ -31,7 +31,6 @@ CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2c-plus.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -73,7 +72,6 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_PHY_MOTORCOMM=y diff --git a/configs/nanopi-r2c-rk3328_defconfig b/configs/nanopi-r2c-rk3328_defconfig index 59801328deda..ca13eb873a72 100644 --- a/configs/nanopi-r2c-rk3328_defconfig +++ b/configs/nanopi-r2c-rk3328_defconfig @@ -31,7 +31,6 @@ CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2c.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -73,7 +72,6 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_PHY_MOTORCOMM=y diff --git a/configs/nanopi-r2s-rk3328_defconfig b/configs/nanopi-r2s-rk3328_defconfig index 61914b1650d2..619707436130 100644 --- a/configs/nanopi-r2s-rk3328_defconfig +++ b/configs/nanopi-r2s-rk3328_defconfig @@ -31,7 +31,6 @@ CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2s.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -73,7 +72,6 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_PHY_MOTORCOMM=y diff --git a/configs/orangepi-r1-plus-lts-rk3328_defconfig b/configs/orangepi-r1-plus-lts-rk3328_defconfig index 968110c8cd6f..8e9a9411a763 100644 --- a/configs/orangepi-r1-plus-lts-rk3328_defconfig +++ b/configs/orangepi-r1-plus-lts-rk3328_defconfig @@ -34,7 +34,6 @@ CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-orangepi-r1-plus-lts.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -78,7 +77,6 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SPI_FLASH_SFDP_SUPPORT=y diff --git a/configs/orangepi-r1-plus-rk3328_defconfig b/configs/orangepi-r1-plus-rk3328_defconfig index 7038f09f202c..240fcdeb221f 100644 --- a/configs/orangepi-r1-plus-rk3328_defconfig +++ b/configs/orangepi-r1-plus-rk3328_defconfig @@ -34,7 +34,6 @@ CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-orangepi-r1-plus.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x4 CONFIG_SPL_PAD_TO=0x7f8000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y @@ -78,7 +77,6 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_MISC=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SPI_FLASH_SFDP_SUPPORT=y
[PATCH 2/4] rockchip: rk3399: Read cpuid and generate MAC address from efuse
From: Chen-Yu Tsai The rockchip-efuse driver supports the efuse found on RK3399. This hardware block is part of the SoC and contains the CPUID, which can be used to generate stable serial numbers and MAC addresses. Enable the driver and reading cpuid by default for RK3399. Signed-off-by: Chen-Yu Tsai --- arch/arm/mach-rockchip/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 20670fb57376..2558d956b8c6 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -269,6 +269,8 @@ config ROCKCHIP_RK3399 imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT imply BOOTSTD_FULL imply CMD_BOOTCOUNT if BOOTCOUNT_LIMIT + imply ROCKCHIP_EFUSE + imply MISC_INIT_R help The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72 and quad-core Cortex-A53. -- 2.39.2
[PATCH 1/4] rockchip: rk3328: Read cpuid and generate MAC address from efuse
From: Chen-Yu Tsai The rockchip-efuse driver supports the efuse found on RK3328. This hardware block is part of the SoC and contains the CPUID, which can be used to generate stable serial numbers and MAC addresses. Enable the driver and reading cpuid by default for RK3328. Signed-off-by: Chen-Yu Tsai --- arch/arm/mach-rockchip/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index 1bc7ee904275..20670fb57376 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -189,6 +189,8 @@ config ROCKCHIP_RK3328 select ENABLE_ARM_SOC_BOOT0_HOOK select DEBUG_UART_BOARD_INIT select SYS_NS16550 + imply ROCKCHIP_EFUSE + imply MISC_INIT_R help The Rockchip RK3328 is a ARM-based SoC with a quad-core Cortex-A53. including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two -- 2.39.2
[PATCH 0/4] rockchip: Read cpuid and generate MAC address from efuse for RK3328 and RK3399
From: Chen-Yu Tsai Hi folks, This series enables ROCKCHIP_EFUSE and MISC_INIT_R by default for RK3328 and RK3399 so that the cpuid is read from the efuse and used to generate a serial number and MAC addresses for all boards. This stacks on top of the recent defconfig update series [1] from Jonas. [1] https://lore.kernel.org/u-boot/20240207000301.3270722-1-jo...@kwiboo.se/ Chen-Yu Tsai (4): rockchip: rk3328: Read cpuid and generate MAC address from efuse rockchip: rk3399: Read cpuid and generate MAC address from efuse rockchip: rk3328: regenerate defconfigs rockchip: rk3399: regenerate defconfigs arch/arm/mach-rockchip/Kconfig| 4 configs/chromebook_bob_defconfig | 2 -- configs/chromebook_kevin_defconfig| 2 -- configs/evb-rk3328_defconfig | 2 -- configs/firefly-rk3399_defconfig | 2 -- configs/nanopi-r2c-plus-rk3328_defconfig | 2 -- configs/nanopi-r2c-rk3328_defconfig | 2 -- configs/nanopi-r2s-rk3328_defconfig | 2 -- configs/nanopi-r4s-rk3399_defconfig | 2 -- configs/orangepi-r1-plus-lts-rk3328_defconfig | 2 -- configs/orangepi-r1-plus-rk3328_defconfig | 2 -- configs/pinebook-pro-rk3399_defconfig | 2 -- configs/pinephone-pro-rk3399_defconfig| 2 -- configs/puma-rk3399_defconfig | 2 -- configs/roc-cc-rk3328_defconfig | 2 -- configs/roc-pc-mezzanine-rk3399_defconfig | 2 -- configs/roc-pc-rk3399_defconfig | 2 -- configs/rock-4c-plus-rk3399_defconfig | 3 --- configs/rock-4se-rk3399_defconfig | 3 --- configs/rock-pi-4-rk3399_defconfig| 3 --- configs/rock-pi-4c-rk3399_defconfig | 3 --- configs/rock-pi-e-rk3328_defconfig| 2 -- configs/rock-pi-n10-rk3399pro_defconfig | 1 - configs/rock64-rk3328_defconfig | 2 -- configs/rock960-rk3399_defconfig | 1 - configs/rockpro64-rk3399_defconfig| 2 -- 26 files changed, 4 insertions(+), 52 deletions(-) -- 2.39.2
Re: [PATCH 00/15] rockchip: rk3328: Update defconfigs, DTs and enable boot from SPI
On 2/6/24 7:02 PM, Jonas Karlman wrote: This series contains miscellaneous updates to defconfigs, syncs latest device trees from linux, fixes an issue loading FIT from SD-card when running SPL from eMMC and enables building a bootable SPI image on RK3328 boards. I am also adding myself as a reviewer for the three RK3328 boards I own. Patch 1-7 updates boards to enable similar Kconfig options and use a common order for from where to try and load FIT. Patch 8 fix loading FIT from SD-card when booting from eMMC by using pinctrl for emmc and sdmmc in SPL. Patch 9-10 makes rockchip gpio and rng driver compatible with linux. Patch 11 sync latest rk3328 device tree files from linux v6.8-rc1. Patch 12 reverts an old commit that added duplicated code. Patch 13-15 enables building u-boot-rockchip-spi.bin for boards with SPI flash. This series depends on the "rockchip: Fix ethernet on Radxa ROCK Pi E v1.21" series at [1]. [1] https://patchwork.ozlabs.org/cover/1887729/ Jonas Karlman (15): rockchip: rk3328: Update default u-boot,spl-boot-order prop rockchip: rk3328-evb: Update defconfig rockchip: rk3328-rock64: Update defconfig rockchip: rk3328-roc-cc: Update defconfig rockchip: rk3328-rock-pi-e: Update defconfig rockchip: rk3328-nanopi-r2: Update defconfig rockchip: rk3328-orangepi-r1-plus: Update defconfig rockchip: rk3328: Fix loading FIT from SD-card when booting from eMMC gpio: rockchip: Use gpio alias id as gpio bank id rng: rockchip: Use same compatible as linux rockchip: rk3328: Sync device tree from linux v6.8-rc1 Revert "rockchip: Allow booting from SPI" rockchip: rk3328: Add support to build bootable SPI image rockchip: rk3328-rock64: Enable boot from SPI NOR flash rockchip: rk3328-orangepi-r1-plus: Enable boot from SPI NOR flash arch/arm/dts/rk3328-evb-u-boot.dtsi | 4 + arch/arm/dts/rk3328-evb.dts | 1 + .../dts/rk3328-nanopi-r2c-plus-u-boot.dtsi| 6 -- arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi| 28 -- arch/arm/dts/rk3328-nanopi-r2s.dts| 3 +- .../rk3328-orangepi-r1-plus-lts-u-boot.dtsi | 36 ++- arch/arm/dts/rk3328-orangepi-r1-plus-lts.dts | 4 +- .../dts/rk3328-orangepi-r1-plus-u-boot.dtsi | 36 ++- arch/arm/dts/rk3328-orangepi-r1-plus.dts | 1 + arch/arm/dts/rk3328-roc-cc-u-boot.dtsi| 22 + arch/arm/dts/rk3328-roc-cc.dts| 3 +- arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi | 17 arch/arm/dts/rk3328-rock-pi-e.dts | 55 +++ arch/arm/dts/rk3328-rock64-u-boot.dtsi| 30 ++ arch/arm/dts/rk3328-rock64.dts| 1 + arch/arm/dts/rk3328-u-boot.dtsi | 99 +++ arch/arm/dts/rk3328.dtsi | 64 +--- arch/arm/dts/rk3399-u-boot.dtsi | 2 +- arch/arm/mach-rockchip/rk3328/rk3328.c| 1 + arch/arm/mach-rockchip/spl-boot-order.c | 3 - board/rockchip/evb_rk3328/MAINTAINERS | 11 +++ board/rockchip/evb_rk3328/README | 70 - configs/evb-rk3328_defconfig | 16 ++- configs/nanopi-r2c-plus-rk3328_defconfig | 11 ++- configs/nanopi-r2c-rk3328_defconfig | 11 ++- configs/nanopi-r2s-rk3328_defconfig | 11 ++- configs/orangepi-r1-plus-lts-rk3328_defconfig | 20 +++- configs/orangepi-r1-plus-rk3328_defconfig | 20 +++- configs/roc-cc-rk3328_defconfig | 9 +- configs/rock-pi-e-rk3328_defconfig| 10 +- configs/rock64-rk3328_defconfig | 15 ++- doc/board/rockchip/rockchip.rst | 9 +- drivers/gpio/rk_gpio.c| 7 +- drivers/rng/rockchip_rng.c| 10 +- 34 files changed, 351 insertions(+), 295 deletions(-) delete mode 100644 board/rockchip/evb_rk3328/README nice cleanup, great work
Re: [PATCH V3 04/11] board: ti: am62x: Set fdtfile from C code instead of findfdt script
On Tue, Jan 30, 2024 at 07:06:08AM -0600, Nishanth Menon wrote: > Stop using the findfdt script and switch to setting the fdtfile from > C code. > > While at this, replace findfdt in environment with a warning as it is > no longer needed > > Reviewed-by: Jonathan Humphreys > Reviewed-by: Roger Quadros > Signed-off-by: Nishanth Menon > --- > Changes in V3: > - none other than picking up reviews. > > V2: https://lore.kernel.org/r/20240109191506.3820908-4...@ti.com > > board/ti/am62x/am62x.env| 1 - > board/ti/am62x/evm.c| 8 > configs/am62x_evm_a53_defconfig | 1 + > 3 files changed, 9 insertions(+), 1 deletion(-) This introduces: +(am62x_evm_a53) board/ti/am62x/evm.c: In function 'board_late_init': +(am62x_evm_a53) board/ti/am62x/evm.c:60:9: error: implicit declaration of function 'ti_set_fdt_env' [-Werror=implicit-function-declaration] +(am62x_evm_a53)60 | ti_set_fdt_env(NULL, NULL); +(am62x_evm_a53) | ^~ +(am62x_evm_a53) cc1: all warnings being treated as errors +(am62x_evm_a53) make[2]: *** [scripts/Makefile.build:257: board/ti/am62x/evm.o] Error 1 +(am62x_evm_a53) make[1]: *** [Makefile:1859: board/ti/am62x] Error 2 +(am62x_evm_a53) make: *** [Makefile:177: sub-make] Error 2 -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 1/3] imx93: Use a header for imx9_probe_mu declaration
On Fri, Feb 9, 2024 at 1:05 PM Mathieu Othacehe wrote: > > Put imx9_probe_mu declaration in a new mu.h header file. > > Signed-off-by: Mathieu Othacehe > --- > arch/arm/include/asm/arch-imx9/mu.h | 13 + > board/freescale/imx93_evk/spl.c | 2 +- > board/phytec/phycore_imx93/spl.c| 2 +- > 3 files changed, 15 insertions(+), 2 deletions(-) > create mode 100644 arch/arm/include/asm/arch-imx9/mu.h > > diff --git a/arch/arm/include/asm/arch-imx9/mu.h > b/arch/arm/include/asm/arch-imx9/mu.h > new file mode 100644 > index 000..b8604992914 > --- /dev/null > +++ b/arch/arm/include/asm/arch-imx9/mu.h > @@ -0,0 +1,13 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Copyright (C) 2024 Mathieu Othacehe > + */ > + > +#ifndef __ARCH_IMX9_MU_H > +#define __ARCH_IMX9_MU_H > + > +#include > + > +int imx9_probe_mu(void *ctx, struct event *event); > + > +#endif > diff --git a/board/freescale/imx93_evk/spl.c b/board/freescale/imx93_evk/spl.c > index be9c24fc0d9..a98ed69db88 100644 > --- a/board/freescale/imx93_evk/spl.c > +++ b/board/freescale/imx93_evk/spl.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -91,7 +92,6 @@ int power_init_board(void) > } > #endif > > -extern int imx9_probe_mu(void *ctx, struct event *event); > void board_init_f(ulong dummy) > { > int ret; > diff --git a/board/phytec/phycore_imx93/spl.c > b/board/phytec/phycore_imx93/spl.c > index da4b9e53594..dabc5316f33 100644 > --- a/board/phytec/phycore_imx93/spl.c > +++ b/board/phytec/phycore_imx93/spl.c > @@ -7,6 +7,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -99,7 +100,6 @@ int power_init_board(void) > return 0; > } > > -extern int imx9_probe_mu(void *ctx, struct event *event); > void board_init_f(ulong dummy) > { > int ret; > -- > 2.41.0 > Reviewed-by: Igor Opaniuk -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk Senior Software Engineer, Embedded & Security E: igor.opan...@foundries.io W: www.foundries.io
[PATCH] clk: renesas: Fix broken clocks on all Gen2 boards
To prepare support for multiple register layouts pointers to register tables where added to struct cpg_mssr_info. These pointers are suppose to be filled in at probe time and no intended change in behavior was intended. However the new pointers where only filled in by some paths of the driver implemented in clk-rcar-gen3.c. The path implemented in clk-rcar-gen2.c was not updated leaving the pointers uninitialized leading to a crash when trying to probe the clocks. Fix this by filling in the pointers in the Gen2 code path with the values used before they where moved to struct cpg_mssr_info. Fixes: d413214fb748 ("clk: renesas: Add register pointers into struct cpg_mssr_info") Signed-off-by: Niklas Söderlund --- drivers/clk/renesas/clk-rcar-gen2.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/clk/renesas/clk-rcar-gen2.c b/drivers/clk/renesas/clk-rcar-gen2.c index 66ffef96b695..89f2d9667469 100644 --- a/drivers/clk/renesas/clk-rcar-gen2.c +++ b/drivers/clk/renesas/clk-rcar-gen2.c @@ -298,6 +298,15 @@ int gen2_clk_probe(struct udevice *dev) if (!priv->cpg_pll_config->extal_div) return -EINVAL; + if (info->reg_layout == CLK_REG_LAYOUT_RCAR_GEN2_AND_GEN3) { + priv->info->status_regs = mstpsr; + priv->info->control_regs = smstpcr; + priv->info->reset_regs = srcr; + priv->info->reset_clear_regs = srstclr; + } else { + return -EINVAL; + } + ret = clk_get_by_name(dev, "extal", >clk_extal); if (ret < 0) return ret; -- 2.43.0
Re: [PATCH 0/2] imx93_var_som: Enable AHAB support
> This is what I am concerned about: this hang causes the board to brick > and can no > longer be recovered since it has the fuse programmed to close the device, > right? Once the board is closed you can only boot from signed images. If the signed image is not working (hanging during relocation for instance), then you can always boot from a new one. All the interfaces: SD-card, UART, USB are still usable. I have tried many u-boot versions on my closed board until I had something working. So, no you do not end-up with a brick unless you cannot sign your image properly anymore. Or maybe I missed your point? Thanks, Mathieu
Re: [GIT PULL] Please pull u-boot-dfu-20240209
On Fri, Feb 09, 2024 at 02:40:37PM +0100, Mattijs Korpershoek wrote: > Hi Tom, > > Here are some developments for master including: > > - sparse error checking fix when using raw chunks > - 2 new additions (AVB, AB) of myself to the MAINTAINERS file > > The CI job is at > https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/19573 > > Thanks, > Mattijs > > The following changes since commit a4650bf65e4b7d3ef04c90ba8031374428e4a682: > > ti: keystone2: Move common Kconfig selections to under ARCH_KEYSTONE > (2024-02-08 14:42:56 -0500) > > are available in the Git repository at: > > https://source.denx.de/u-boot/custodians/u-boot-dfu.git > tags/u-boot-dfu-20240209 > > for you to fetch changes up to 766f04a297e892d5106f7f7ac8b43c69bd8a6007: > > lib: sparse: Fix error checking for write_sparse_chunk_raw (2024-02-09 > 09:42:04 +0100) > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] Added FDT PAD memory size while reserving memory for FDT to avoid some memory corruption issue
On Fri, Feb 09, 2024 at 07:45:10PM +0530, Selvakumar Velandi wrote: > The FDT relocation is not disabled. I am adding the FDT PADDING bytes while > doing FDT reservation in the board_f file. > Also update the FDT length based on the new allocation, instead of blindly > increasing the size. > Currently the size is getting increased even for the relocation disabled > scenario also. > So without increasing the physical memory for the disable relocation use > case, the fdt total size is updated. thus causing memory corruption Please explain on what system you're seeing this with, and how things are configured and what else is required to trigger this problem. Your changes to boot/image-fdt.c change things so that we don't pad the non-relocated device tree (but we need to, we still change the bootargs and so forth). And the changes to common/board_f.c look like we're trying to do that instead, earlier? But we should not have a kernel corruption problem unless: - We aren't relocating the device tree - We aren't relocating the device tree far enough away from the kernel, but this shouldn't be a problem on arm64 and riscv where the Image header structure tells us how big the BSS is to be and we obey that. -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 1/7] common: avb_verify: don't call mmc_switch_part for SD
On 2024-02-09 20:20, Igor Opaniuk wrote: From: Igor Opaniuk mmc_switch_part() is used for switching between hw partitions on eMMC (boot0, boot1, user, rpmb). There is no need to do that for SD card. Reviewed-by: Mattijs Korpershoek Signed-off-by: Igor Opaniuk Looking good to me. Reviewed-by: Dragan Simic --- Changes in v2: - Mattijs Korpershoek R-b tag applied common/avb_verify.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index 48ba8db51e5..59f2c25e0de 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -358,9 +358,11 @@ static struct mmc_part *get_partition(AvbOps *ops, const char *partition) goto err; } - ret = mmc_switch_part(part->mmc, part_num); - if (ret) - goto err; + if (IS_MMC(part->mmc)) { + ret = mmc_switch_part(part->mmc, part_num); + if (ret) + goto err; + } mmc_blk = mmc_get_blk_desc(part->mmc); if (!mmc_blk) {
[PATCH v2 7/7] doc: android: avb: sync usage details
From: Igor Opaniuk Sync usage info with the one cmd/avb.c. Signed-off-by: Igor Opaniuk --- Changes in v2: - Address Mattijs comment about usage info, sync with cmd/avb.c doc/android/avb2.rst | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/android/avb2.rst b/doc/android/avb2.rst index a072119574f..4aca7a5c660 100644 --- a/doc/android/avb2.rst +++ b/doc/android/avb2.rst @@ -38,16 +38,22 @@ AVB 2.0 U-Boot shell commands Provides CLI interface to invoke AVB 2.0 verification + misc. commands for different testing purposes:: -avb init - initialize avb 2.0 for -avb verify - run verification process using hash data from vbmeta structure +avb init - initialize avb 2 for avb read_rb - read rollback index at location avb write_rb - write rollback index to avb is_unlocked - returns unlock status of the device -avb get_uuid - read and print uuid of partition +avb get_uuid - read and print uuid of partition avb read_part - read bytes from -partition to buffer +partition to buffer +avb read_part_hex- read bytes from +partition and print to stdout avb write_part - write bytes to - by using data from + by using data from +avb read_pvalue - read a persistent value +avb write_pvalue - write a persistent value +avb verify [slot_suffix] - run verification process using hash data +from vbmeta structure +[slot_suffix] - _a, _b, etc (if vbmeta partition is slotted) Partitions tampering (example) -- -- 2.34.1
[PATCH v2 6/7] cmd: avb: rework do_avb_verify_part
From: Igor Opaniuk Use existing str_avb_slot_error() function for obtaining verification fail reason details. Take into account device lock state for setting correct androidboot.verifiedbootstate kernel cmdline parameter. Reviewed-by: Mattijs Korpershoek Signed-off-by: Igor Opaniuk --- Changes in v2: - Mattijs Korpershoek R-b tag applied cmd/avb.c | 50 +- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/cmd/avb.c b/cmd/avb.c index 62a3ee18e7f..8fbd48ee5a2 100644 --- a/cmd/avb.c +++ b/cmd/avb.c @@ -250,6 +250,7 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, const char * const requested_partitions[] = {"boot", NULL}; AvbSlotVerifyResult slot_result; AvbSlotVerifyData *out_data; + enum avb_boot_state boot_state; char *cmdline; char *extra_args; char *slot_suffix = ""; @@ -287,18 +288,23 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE, _data); - switch (slot_result) { - case AVB_SLOT_VERIFY_RESULT_OK: - /* Until we don't have support of changing unlock states, we -* assume that we are by default in locked state. -* So in this case we can boot only when verification is -* successful; we also supply in cmdline GREEN boot state -*/ + /* +* LOCKED devices with custom root of trust setup is not supported (YELLOW) +*/ + if (slot_result == AVB_SLOT_VERIFY_RESULT_OK) { printf("Verification passed successfully\n"); - /* export additional bootargs to AVB_BOOTARGS env var */ + /* +* ORANGE state indicates that device may be freely modified. +* Device integrity is left to the user to verify out-of-band. +*/ + if (unlocked) + boot_state = AVB_ORANGE; + else + boot_state = AVB_GREEN; - extra_args = avb_set_state(avb_ops, AVB_GREEN); + /* export boot state to AVB_BOOTARGS env var */ + extra_args = avb_set_state(avb_ops, boot_state); if (extra_args) cmdline = append_cmd_line(out_data->cmdline, extra_args); @@ -308,30 +314,8 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, env_set(AVB_BOOTARGS, cmdline); res = CMD_RET_SUCCESS; - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: - printf("Verification failed\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_IO: - printf("I/O error occurred during verification\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_OOM: - printf("OOM error occurred during verification\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA: - printf("Corrupted dm-verity metadata detected\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_UNSUPPORTED_VERSION: - printf("Unsupported version of avbtool was used\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: - printf("Rollback index check failed\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: - printf("Public key was rejected\n"); - break; - default: - printf("Unknown error occurred\n"); + } else { + printf("Verification failed, reason: %s\n", str_avb_slot_error(slot_result)); } if (out_data) -- 2.34.1
[PATCH v2 5/7] common: avb_verify: add str_avb_io_error/str_avb_slot_error
From: Igor Opaniuk Introduce str_avb_io_error() and str_avb_slot_error() functions, that provide a pointer to AVB runtime error message. Reviewed-by: Mattijs Korpershoek Signed-off-by: Igor Opaniuk --- Changes in v2: - Mattijs Korpershoek R-b tag applied common/avb_verify.c | 49 include/avb_verify.h | 3 ++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index ed58239cf8a..cff9117d92f 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -119,6 +119,55 @@ static const unsigned char avb_root_pub[1032] = { 0xd8, 0x7e, }; +const char *str_avb_io_error(AvbIOResult res) +{ + switch (res) { + case AVB_IO_RESULT_OK: + return "Requested operation was successful"; + case AVB_IO_RESULT_ERROR_IO: + return "Underlying hardware encountered an I/O error"; + case AVB_IO_RESULT_ERROR_OOM: + return "Unable to allocate memory"; + case AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION: + return "Requested partition does not exist"; + case AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION: + return "Bytes requested is outside the range of partition"; + case AVB_IO_RESULT_ERROR_NO_SUCH_VALUE: + return "Named persistent value does not exist"; + case AVB_IO_RESULT_ERROR_INVALID_VALUE_SIZE: + return "Named persistent value size is not supported"; + case AVB_IO_RESULT_ERROR_INSUFFICIENT_SPACE: + return "Buffer is too small for the requested operation"; + default: + return "Unknown AVB error"; + } +} + +const char *str_avb_slot_error(AvbSlotVerifyResult res) +{ + switch (res) { + case AVB_SLOT_VERIFY_RESULT_OK: + return "Verification passed successfully"; + case AVB_SLOT_VERIFY_RESULT_ERROR_OOM: + return "Allocation of memory failed"; + case AVB_SLOT_VERIFY_RESULT_ERROR_IO: + return "I/O error occurred while trying to load data"; + case AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: + return "Digest didn't match or signature checks failed"; + case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: + return "Rollback index is less than its stored value"; + case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: + return "Public keys are not accepted"; + case AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA: + return "Metadata is invalid or inconsistent"; + case AVB_SLOT_VERIFY_RESULT_ERROR_UNSUPPORTED_VERSION: + return "Metadata requires a newer version of libavb"; + case AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_ARGUMENT: + return "Invalid arguments are used"; + default: + return "Unknown AVB slot verification error"; + } +} /** * * Boot states support (GREEN, YELLOW, ORANGE, RED) and dm_verity diff --git a/include/avb_verify.h b/include/avb_verify.h index 2fb850044d9..5d998b5a302 100644 --- a/include/avb_verify.h +++ b/include/avb_verify.h @@ -52,7 +52,8 @@ char *avb_set_enforce_verity(const char *cmdline); char *avb_set_ignore_corruption(const char *cmdline); char *append_cmd_line(char *cmdline_orig, char *cmdline_new); - +const char *str_avb_io_error(AvbIOResult res); +const char *str_avb_slot_error(AvbSlotVerifyResult res); /** * * I/O helper inline functions -- 2.34.1
[PATCH v2 4/7] cmd: avb: rework prints
From: Igor Opaniuk Simplify and add more context for prints where it's needed. Signed-off-by: Igor Opaniuk --- Changes in v2: - Drop AVB_OPS_CHECK macro and leave previous check cmd/avb.c | 123 +- 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/cmd/avb.c b/cmd/avb.c index ce8b63873f2..62a3ee18e7f 100644 --- a/cmd/avb.c +++ b/cmd/avb.c @@ -11,6 +11,7 @@ #include #define AVB_BOOTARGS "avb_bootargs" + static struct AvbOps *avb_ops; int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) @@ -28,8 +29,10 @@ int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) avb_ops = avb_ops_alloc(mmc_dev); if (avb_ops) return CMD_RET_SUCCESS; + else + printf("Can't allocate AvbOps"); - printf("Failed to initialize avb2\n"); + printf("Failed to initialize AVB\n"); return CMD_RET_FAILURE; } @@ -41,10 +44,11 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc, s64 offset; size_t bytes, bytes_read = 0; void *buffer; + int ret; if (!avb_ops) { - printf("AVB 2.0 is not initialized, please run 'avb init'\n"); - return CMD_RET_USAGE; + printf("AVB is not initialized, please run 'avb init '\n"); + return CMD_RET_FAILURE; } if (argc != 5) @@ -55,14 +59,15 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc, bytes = hextoul(argv[3], NULL); buffer = (void *)hextoul(argv[4], NULL); - if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, -buffer, _read) == -AVB_IO_RESULT_OK) { + ret = avb_ops->read_from_partition(avb_ops, part, offset, + bytes, buffer, _read); + if (ret == AVB_IO_RESULT_OK) { printf("Read %zu bytes\n", bytes_read); return CMD_RET_SUCCESS; } - printf("Failed to read from partition\n"); + printf("Failed to read from partition '%s', err = %d\n", + part, ret); return CMD_RET_FAILURE; } @@ -74,10 +79,11 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc, s64 offset; size_t bytes, bytes_read = 0; char *buffer; + int ret; if (!avb_ops) { - printf("AVB 2.0 is not initialized, please run 'avb init'\n"); - return CMD_RET_USAGE; + printf("AVB is not initialized, please run 'avb init '\n"); + return CMD_RET_FAILURE; } if (argc != 4) @@ -94,8 +100,9 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc, } memset(buffer, 0, bytes); - if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, buffer, -_read) == AVB_IO_RESULT_OK) { + ret = avb_ops->read_from_partition(avb_ops, part, offset, + bytes, buffer, _read); + if (ret == AVB_IO_RESULT_OK) { printf("Requested %zu, read %zu bytes\n", bytes, bytes_read); printf("Data: "); for (int i = 0; i < bytes_read; i++) @@ -107,7 +114,8 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } - printf("Failed to read from partition\n"); + printf("Failed to read from partition '%s', err = %d\n", + part, ret); free(buffer); return CMD_RET_FAILURE; @@ -120,9 +128,10 @@ int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc, s64 offset; size_t bytes; void *buffer; + int ret; if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); + printf("AVB is not initialized, please run 'avb init '\n"); return CMD_RET_FAILURE; } @@ -134,13 +143,15 @@ int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc, bytes = hextoul(argv[3], NULL); buffer = (void *)hextoul(argv[4], NULL); - if (avb_ops->write_to_partition(avb_ops, part, offset, bytes, buffer) == - AVB_IO_RESULT_OK) { + ret = avb_ops->write_to_partition(avb_ops, part, offset, + bytes, buffer); + if (ret == AVB_IO_RESULT_OK) { printf("Wrote %zu bytes\n", bytes); return CMD_RET_SUCCESS; } - printf("Failed to write in partition\n"); + printf("Failed to write in partition '%s', err = %d\n", + part, ret); return CMD_RET_FAILURE; } @@ -150,9 +161,10 @@ int do_avb_read_rb(struct cmd_tbl *cmdtp, int flag, int argc, { size_t index; u64
[PATCH v2 3/7] common: avb_verify: rework error/debug prints
From: Igor Opaniuk Make error prints more verbose with additional context. Also s/print/debug/g for prints, which might be relevant only for debugging purposes. Reviewed-by: Mattijs Korpershoek Signed-off-by: Igor Opaniuk --- Changes in v2: - Mattijs Korpershoek R-b tag applied common/avb_verify.c | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index 938a5383b5d..ed58239cf8a 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -279,9 +279,9 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part, * Reading fails on unaligned buffers, so we have to * use aligned temporary buffer and then copy to destination */ - if (unaligned) { - printf("Handling unaligned read buffer..\n"); + debug("%s: handling unaligned read buffer, addr = 0x%p\n", + __func__, buffer); tmp_buf = get_sector_buf(); buf_size = get_sector_buf_size(); if (sectors > buf_size / part->info.blksz) @@ -320,7 +320,8 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, if (unaligned) { tmp_buf = get_sector_buf(); buf_size = get_sector_buf_size(); - printf("Handling unaligned wrire buffer..\n"); + debug("%s: handling unaligned read buffer, addr = 0x%p\n", + __func__, buffer); if (sectors > buf_size / part->info.blksz) sectors = buf_size / part->info.blksz; @@ -348,30 +349,35 @@ static struct mmc_part *get_partition(AvbOps *ops, const char *partition) dev_num = get_boot_device(ops); part->mmc = find_mmc_device(dev_num); if (!part->mmc) { - printf("No MMC device at slot %x\n", dev_num); + printf("%s: no MMC device at slot %x\n", __func__, dev_num); goto err; } - if (mmc_init(part->mmc)) { - printf("MMC initialization failed\n"); + ret = mmc_init(part->mmc); + if (ret) { + printf("%s: MMC initialization failed, err = %d\n", + __func__, ret); goto err; } if (IS_MMC(part->mmc)) { ret = mmc_switch_part(part->mmc, part_num); - if (ret) + if (ret) { + printf("%s: MMC part switch failed, err = %d\n", + __func__, ret); goto err; + } } mmc_blk = mmc_get_blk_desc(part->mmc); if (!mmc_blk) { - printf("Error - failed to obtain block descriptor\n"); + printf("%s: failed to obtain block descriptor\n", __func__); goto err; } ret = part_get_info_by_name(mmc_blk, partition, >info); if (ret < 0) { - printf("Can't find partition '%s'\n", partition); + printf("%s: can't find partition '%s'\n", __func__, partition); goto err; } @@ -684,7 +690,7 @@ static AvbIOResult read_rollback_index(AvbOps *ops, { #ifndef CONFIG_OPTEE_TA_AVB /* For now we always return 0 as the stored rollback index. */ - printf("%s not supported yet\n", __func__); + debug("%s: rollback protection is not implemented\n", __func__); if (out_rollback_index) *out_rollback_index = 0; @@ -730,7 +736,7 @@ static AvbIOResult write_rollback_index(AvbOps *ops, { #ifndef CONFIG_OPTEE_TA_AVB /* For now this is a no-op. */ - printf("%s not supported yet\n", __func__); + debug("%s: rollback protection is not implemented\n", __func__); return AVB_IO_RESULT_OK; #else @@ -766,8 +772,7 @@ static AvbIOResult read_is_device_unlocked(AvbOps *ops, bool *out_is_unlocked) { #ifndef CONFIG_OPTEE_TA_AVB /* For now we always return that the device is unlocked. */ - - printf("%s not supported yet\n", __func__); + debug("%s: device locking is not implemented\n", __func__); *out_is_unlocked = true; -- 2.34.1
[PATCH v2 2/7] avb: move SPDX license identifiers to the first line
From: Igor Opaniuk Move SPDX license identifiers to the first line, so it conforms to license placement rule [1]: Placement: The SPDX license identifier in kernel files shall be added at the first possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX identifier goes into the second line. [1] https://www.kernel.org/doc/Documentation/process/license-rules.rst Reviewed-by: Mattijs Korpershoek Signed-off-by: Igor Opaniuk --- Changes in v2: - Fix typo in commit message - Mattijs Korpershoek R-b tag applied cmd/avb.c | 4 +--- common/avb_verify.c| 3 +-- include/avb_verify.h | 4 +--- test/py/tests/test_android/test_avb.py | 3 +-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmd/avb.c b/cmd/avb.c index 783f51b8169..ce8b63873f2 100644 --- a/cmd/avb.c +++ b/cmd/avb.c @@ -1,8 +1,6 @@ - +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2018, Linaro Limited - * - * SPDX-License-Identifier:GPL-2.0+ */ #include diff --git a/common/avb_verify.c b/common/avb_verify.c index 59f2c25e0de..938a5383b5d 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -1,7 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2018, Linaro Limited - * - * SPDX-License-Identifier:GPL-2.0+ */ #include diff --git a/include/avb_verify.h b/include/avb_verify.h index 1e787ba6668..2fb850044d9 100644 --- a/include/avb_verify.h +++ b/include/avb_verify.h @@ -1,8 +1,6 @@ - +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2018, Linaro Limited - * - * SPDX-License-Identifier:GPL-2.0+ */ #ifndef_AVB_VERIFY_H diff --git a/test/py/tests/test_android/test_avb.py b/test/py/tests/test_android/test_avb.py index 238b48c90fa..865efbca4de 100644 --- a/test/py/tests/test_android/test_avb.py +++ b/test/py/tests/test_android/test_avb.py @@ -1,6 +1,5 @@ -# Copyright (c) 2018, Linaro Limited -# # SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2018, Linaro Limited # # Android Verified Boot 2.0 Test -- 2.34.1
[PATCH v2 1/7] common: avb_verify: don't call mmc_switch_part for SD
From: Igor Opaniuk mmc_switch_part() is used for switching between hw partitions on eMMC (boot0, boot1, user, rpmb). There is no need to do that for SD card. Reviewed-by: Mattijs Korpershoek Signed-off-by: Igor Opaniuk --- Changes in v2: - Mattijs Korpershoek R-b tag applied common/avb_verify.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index 48ba8db51e5..59f2c25e0de 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -358,9 +358,11 @@ static struct mmc_part *get_partition(AvbOps *ops, const char *partition) goto err; } - ret = mmc_switch_part(part->mmc, part_num); - if (ret) - goto err; + if (IS_MMC(part->mmc)) { + ret = mmc_switch_part(part->mmc, part_num); + if (ret) + goto err; + } mmc_blk = mmc_get_blk_desc(part->mmc); if (!mmc_blk) { -- 2.34.1
[PATCH v2 0/7] AVB: cosmetic adjustments/improvements
This is the first patch series for incoming major improvements for AVB implementation, that include: - Simplify and add more context for debug/error prints where it's needed. - Move SPDX license identifiers to the first line, so it conforms to license placement rule. - Use mmc_switch_part() only for eMMC. - Rework do_avb_verify_part, take into account device lock state for setting correct androidboot.verifiedbootstate. - Adjust AVB documentation, sync usage info with the one cmd/avb.c. Igor Opaniuk (7): common: avb_verify: don't call mmc_switch_part for SD avb: move SPDX license identifiers to the first line common: avb_verify: rework error/debug prints cmd: avb: rework prints common: avb_verify: add str_avb_io_error/str_avb_slot_error cmd: avb: rework do_avb_verify_part doc: android: avb: sync usage details cmd/avb.c | 173 + common/avb_verify.c| 89 ++--- doc/android/avb2.rst | 16 ++- include/avb_verify.h | 7 +- test/py/tests/test_android/test_avb.py | 3 +- 5 files changed, 178 insertions(+), 110 deletions(-) -- 2.34.1
Re: [PATCH v2 2/2] smbios: fill wake-up type
On Fri, Feb 09, 2024 at 07:37:28PM +0100, Heinrich Schuchardt wrote: > On 2/9/24 19:12, Tom Rini wrote: > > On Fri, Feb 09, 2024 at 04:51:15PM +0100, Heinrich Schuchardt wrote: > > > > > We should not use the reserved value 0x00 for the wake up type but > > > use 0x02 (Unknown). > > > > > > Signed-off-by: Heinrich Schuchardt > > [snip] > > > @@ -108,6 +108,16 @@ struct __packed smbios_type0 { > > > char eos[SMBIOS_STRUCT_EOS_BYTES]; > > > }; > > > +#define SMBIOS_WAKEUP_TYPE_RESERVED 0x00 > > > +#define SMBIOS_WAKEUP_TYPE_OTHER 0x01 > > > +#define SMBIOS_WAKEUP_TYPE_UNKNOWN 0x02 > > > +#define SMBIOS_WAKEUP_TYPE_APM_TIME 0x03 > > > +#define SMBIOS_WAKEUP_TYPE_MODEM_RING0x04 > > > +#define SMBIOS_WAKEUP_TYPE_LAN_REMOTE0x05 > > > +#define SMBIOS_WAKEUP_TYPE_POWER_SWITCH 0x06 > > > +#define SMBIOS_WAKEUP_TYPE_PCI_PME 0x07 > > > +#define SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED 0x08 > > > > Shouldn't we do this as an enum these days? > > > > The field in the SMBIOS is of type u8 and cannot be an enum. Defining an > enum would only make a difference if we had a function using it. > > Do you want me to resend the patch with an enum? Since I think this is going to be the start of adding ore and similar values (which to be clear, is good), yes please lets get in the habit of generally using enums here. Thanks. -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 09/20] rockchip: merge misc.c into board.c
Hello Mark, On 2024-02-09 19:36, Mark Kettenis wrote: Date: Fri, 09 Feb 2024 18:58:01 +0100 From: Dragan Simic Please, see my comments below. On 2024-02-09 10:50, Quentin Schulz wrote: > From: Quentin Schulz > > 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. The patches I'm going to send, which exclude the unneeded code from the U-Boot images for the Pinebook Pro and the Pinebook Pro, change the code that this patch moves around. Perhaps it would be better to have the move of the code and the subsequent changes to it performed in a separate series, to make checking and accepting the patches simpler as a group, and to perhaps make it a bit more clear what actually happened to anyone going through the repository history later. Thus, I was wondering would you, please, be fine with excluding this patch from this series and letting me submit it, with proper attribution tags, of course, as part of the series I'll submit in the next couple of days? I'm not covinced your patches are a good idea. Unless we're running into space constraints, or if there are noticable slowdowns in the boot process because of the extra code, I really don't see what the benefit of further differentiation between rk3399 boards would be. It just makes testing things harder. Oh, I fully understand your position, but please let's also keep in mind that the subject of those patches are actual devices with pretty much fixed hardware configurations, instead of targeting development boards whose actual hardware configurations, at least in theory, depend on the user. In addition to preventing the unneeded code from entering the U-Boot images, my patches would also prevent useless "ethaddr" and "eth1addr" from appearing in the saved environments on those devices. I think that's useful and may actually prevent some confusion when the saved environment is checked by the users on those devices. The smaller the number of special snow flakes, the better! I'd agree that having fewer special cases helps, but again, handling the specifics of some devices also has its benefits. Additionally, perhaps simply the fact that those are actual devices makes them some kind of special snowflakes. :) > Cc: Quentin Schulz > Reviewed-by: Kever Yang > Signed-off-by: Quentin Schulz > --- > arch/arm/include/asm/arch-rockchip/misc.h | 5 -- > arch/arm/mach-rockchip/Makefile | 1 - > arch/arm/mach-rockchip/board.c| 125 > +++ > arch/arm/mach-rockchip/misc.c | 135 > -- > 4 files changed, 125 insertions(+), 141 deletions(-) > > diff --git a/arch/arm/include/asm/arch-rockchip/misc.h > b/arch/arm/include/asm/arch-rockchip/misc.h > index 4155af8c3b0..ef37ff1661a 100644 > --- a/arch/arm/include/asm/arch-rockchip/misc.h > +++ b/arch/arm/include/asm/arch-rockchip/misc.h > @@ -6,9 +6,4 @@ > * Rohan Garg > */ > > -int rockchip_cpuid_from_efuse(const u32 cpuid_offset, > -const u32 cpuid_length, > -u8 *cpuid); > -int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length); > -int rockchip_setup_macaddr(void); > void rockchip_capsule_update_board_setup(void); > diff --git a/arch/arm/mach-rockchip/Makefile > b/arch/arm/mach-rockchip/Makefile > index 1dc92066bbf..c07bdaee4c3 100644 > --- a/arch/arm/mach-rockchip/Makefile > +++ b/arch/arm/mach-rockchip/Makefile > @@ -23,7 +23,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) > # meaning "turn it off". > obj-y += boot_mode.o > obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o > -obj-$(CONFIG_MISC_INIT_R) += misc.o > endif > > ifeq ($(CONFIG_TPL_BUILD),) > diff --git a/arch/arm/mach-rockchip/board.c > b/arch/arm/mach-rockchip/board.c > index d5cb59c10fa..80b4514852f 100644 > --- a/arch/arm/mach-rockchip/board.c > +++ b/arch/arm/mach-rockchip/board.c > @@ -1,20 +1,32 @@ > // SPDX-License-Identifier: GPL-2.0+ > /* > * (C) Copyright 2019 Rockchip Electronics Co., Ltd. > + * > + * Copyright (C) 2019 Collabora Inc - https://www.collabora.com/ > + * Rohan Garg > + * > + * Based on puma-rk3399.c: > + * (C) Copyright 2017 Theobroma Systems Design und Consulting > GmbH > */ > #include > #include > #include > +#include > #include > #include > #include > +#include > #include > #include > #include > +#include > +#include > #include > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -297,6 +309,119 @@ int fastboot_set_reboot_flag(enum > fastboot_reboot_reason reason) > #endif > > #ifdef CONFIG_MISC_INIT_R > +int rockchip_setup_macaddr(void) > +{ > +#if CONFIG_IS_ENABLED(HASH) && CONFIG_IS_ENABLED(SHA256) > + int ret; > + const char *cpuid = env_get("cpuid#"); > + u8 hash[SHA256_SUM_LEN]; > + int size =
Re: [PATCH v2 2/2] smbios: fill wake-up type
On 2/9/24 19:12, Tom Rini wrote: On Fri, Feb 09, 2024 at 04:51:15PM +0100, Heinrich Schuchardt wrote: We should not use the reserved value 0x00 for the wake up type but use 0x02 (Unknown). Signed-off-by: Heinrich Schuchardt [snip] @@ -108,6 +108,16 @@ struct __packed smbios_type0 { char eos[SMBIOS_STRUCT_EOS_BYTES]; }; +#define SMBIOS_WAKEUP_TYPE_RESERVED 0x00 +#define SMBIOS_WAKEUP_TYPE_OTHER 0x01 +#define SMBIOS_WAKEUP_TYPE_UNKNOWN 0x02 +#define SMBIOS_WAKEUP_TYPE_APM_TIME0x03 +#define SMBIOS_WAKEUP_TYPE_MODEM_RING 0x04 +#define SMBIOS_WAKEUP_TYPE_LAN_REMOTE 0x05 +#define SMBIOS_WAKEUP_TYPE_POWER_SWITCH0x06 +#define SMBIOS_WAKEUP_TYPE_PCI_PME 0x07 +#define SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED 0x08 Shouldn't we do this as an enum these days? The field in the SMBIOS is of type u8 and cannot be an enum. Defining an enum would only make a difference if we had a function using it. Do you want me to resend the patch with an enum? Best regards Heinrich
Re: [PATCH v2 09/20] rockchip: merge misc.c into board.c
> Date: Fri, 09 Feb 2024 18:58:01 +0100 > From: Dragan Simic > > Hello Quentin, > > Please, see my comments below. > > On 2024-02-09 10:50, Quentin Schulz wrote: > > From: Quentin Schulz > > > > 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. > > The patches I'm going to send, which exclude the unneeded code > from the U-Boot images for the Pinebook Pro and the Pinebook Pro, > change the code that this patch moves around. > > Perhaps it would be better to have the move of the code and the > subsequent changes to it performed in a separate series, to make > checking and accepting the patches simpler as a group, and to > perhaps make it a bit more clear what actually happened to anyone > going through the repository history later. > > Thus, I was wondering would you, please, be fine with excluding > this patch from this series and letting me submit it, with proper > attribution tags, of course, as part of the series I'll submit > in the next couple of days? Hello Dragan, I'm not covinced your patches are a good idea. Unless we're running into space constraints, or if there are noticable slowdowns in the boot process because of the extra code, I really don't see what the benefit of further differentiation between rk3399 boards would be. It just makes testing things harder. The smaller the number of special snow flakes, the better! > > Cc: Quentin Schulz > > Reviewed-by: Kever Yang > > Signed-off-by: Quentin Schulz > > --- > > arch/arm/include/asm/arch-rockchip/misc.h | 5 -- > > arch/arm/mach-rockchip/Makefile | 1 - > > arch/arm/mach-rockchip/board.c| 125 > > +++ > > arch/arm/mach-rockchip/misc.c | 135 > > -- > > 4 files changed, 125 insertions(+), 141 deletions(-) > > > > diff --git a/arch/arm/include/asm/arch-rockchip/misc.h > > b/arch/arm/include/asm/arch-rockchip/misc.h > > index 4155af8c3b0..ef37ff1661a 100644 > > --- a/arch/arm/include/asm/arch-rockchip/misc.h > > +++ b/arch/arm/include/asm/arch-rockchip/misc.h > > @@ -6,9 +6,4 @@ > > * Rohan Garg > > */ > > > > -int rockchip_cpuid_from_efuse(const u32 cpuid_offset, > > - const u32 cpuid_length, > > - u8 *cpuid); > > -int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length); > > -int rockchip_setup_macaddr(void); > > void rockchip_capsule_update_board_setup(void); > > diff --git a/arch/arm/mach-rockchip/Makefile > > b/arch/arm/mach-rockchip/Makefile > > index 1dc92066bbf..c07bdaee4c3 100644 > > --- a/arch/arm/mach-rockchip/Makefile > > +++ b/arch/arm/mach-rockchip/Makefile > > @@ -23,7 +23,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) > > # meaning "turn it off". > > obj-y += boot_mode.o > > obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o > > -obj-$(CONFIG_MISC_INIT_R) += misc.o > > endif > > > > ifeq ($(CONFIG_TPL_BUILD),) > > diff --git a/arch/arm/mach-rockchip/board.c > > b/arch/arm/mach-rockchip/board.c > > index d5cb59c10fa..80b4514852f 100644 > > --- a/arch/arm/mach-rockchip/board.c > > +++ b/arch/arm/mach-rockchip/board.c > > @@ -1,20 +1,32 @@ > > // SPDX-License-Identifier: GPL-2.0+ > > /* > > * (C) Copyright 2019 Rockchip Electronics Co., Ltd. > > + * > > + * Copyright (C) 2019 Collabora Inc - https://www.collabora.com/ > > + * Rohan Garg > > + * > > + * Based on puma-rk3399.c: > > + * (C) Copyright 2017 Theobroma Systems Design und Consulting > > GmbH > > */ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > @@ -297,6 +309,119 @@ int fastboot_set_reboot_flag(enum > > fastboot_reboot_reason reason) > > #endif > > > > #ifdef CONFIG_MISC_INIT_R > > +int rockchip_setup_macaddr(void) > > +{ > > +#if CONFIG_IS_ENABLED(HASH) && CONFIG_IS_ENABLED(SHA256) > > + int ret; > > + const char *cpuid = env_get("cpuid#"); > > + u8 hash[SHA256_SUM_LEN]; > > + int size = sizeof(hash); > > + u8 mac_addr[6]; > > + > > + /* Only generate a MAC address, if none is set in the environment */ > > + if (env_get("ethaddr")) > > + return 0; > > + > > + if (!cpuid) { > > + debug("%s: could not retrieve 'cpuid#'\n", __func__); > > + return -1; > > + } > > + > > + ret = hash_block("sha256", (void *)cpuid, strlen(cpuid), hash, > > ); > > + if (ret) { > > + debug("%s: failed to calculate SHA256\n", __func__); > > + return -1; > > + } > > + > > + /* Copy 6 bytes of the hash to base the MAC address on */ > > + memcpy(mac_addr, hash, 6); > > + >
Re: [PATCH v2 1/2] imx: imxrt1050-evk: Add support for SPI flash booting
On Fri, Feb 9, 2024 at 3:27 PM Jesse T wrote: > These errors also happen on master. There are no errors in master, otherwise they would not pass the CI build. > I will submit a patch to fix these soon. Just to clarify: on master we do get the following warnings (not errors): arch/arm/dts/imxrt1170-evk.dtb: Warning (reg_format): /memory/ocram@2024:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1) arch/arm/dts/imxrt1170-evk.dtb: Warning (reg_format): /memory/sdram@8000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1) arch/arm/dts/imxrt1170-evk.dtb: Warning (avoid_default_addr_size): /memory/ocram@2024: Relying on default #address-cells value arch/arm/dts/imxrt1170-evk.dtb: Warning (avoid_default_addr_size): /memory/ocram@2024: Relying on default #size-cells value arch/arm/dts/imxrt1170-evk.dtb: Warning (avoid_default_addr_size): /memory/sdram@8000: Relying on default #address-cells value arch/arm/dts/imxrt1170-evk.dtb: Warning (avoid_default_addr_size): /memory/sdram@8000: Relying on default #size-cells value SHIPPED dts/dt.dtb The error I was referring to was: make imxrt1020-evk_defconfig make 1221+binman: Device tree 'u-boot.dtb' does not have a 'binman' node 1222+make[1]: *** [Makefile:1125: .binman_stamp] Error 1 1223+make: *** [Makefile:177: sub-make] Error 2 If you can fix both the warnings and the errors, that would be great. Thanks
Re: [PATCH v2 1/2] imx: imxrt1050-evk: Add support for SPI flash booting
On Thu, Feb 8, 2024 at 8:08 AM Fabio Estevam wrote: > > Hi Jesse, > > On Tue, Feb 6, 2024 at 1:40 PM Jesse Taube wrote: > > > > Add support for booting the imxrt1050-evk from spi. > > Add imximage config and the ability for SPL to boot from NOR. > > > > Signed-off-by: Jesse Taube > > This causes the following build failure when building imxrt1020-evk_defconfig: These errors also happen on master. I will submit a patch to fix these soon. > > arm: + imxrt1020-evk > 1221+binman: Device tree 'u-boot.dtb' does not have a 'binman' node > 1222+make[1]: *** [Makefile:1125: .binman_stamp] Error 1 > 1223+make: *** [Makefile:177: sub-make] Error 2 > 1224w+arch/arm/dts/imxrt1170-evk.dtb: Warning (reg_format): > /memory/ocram@2024:reg: property has invalid length (8 bytes) > (#address-cells == 2, #size-cells == 1) > 1225w+arch/arm/dts/imxrt1170-evk.dtb: Warning (reg_format): > /memory/sdram@8000:reg: property has invalid length (8 bytes) > (#address-cells == 2, #size-cells == 1) > 1226w+arch/arm/dts/imxrt1170-evk.dtb: Warning > (avoid_default_addr_size): /memory/ocram@2024: Relying on default > #address-cells value > 1227w+arch/arm/dts/imxrt1170-evk.dtb: Warning > (avoid_default_addr_size): /memory/ocram@2024: Relying on default > #size-cells value > 1228w+arch/arm/dts/imxrt1170-evk.dtb: Warning > (avoid_default_addr_size): /memory/sdram@8000: Relying on default > #address-cells value > 1229w+arch/arm/dts/imxrt1170-evk.dtb: Warning > (avoid_default_addr_size): /memory/sdram@8000: Relying on default > #size-cells value > 1230 arm: w+ topic_miamiplus > > Please fix and resend. > > Also, there was a whitespace warning when applying this series. I don't get any when applying to master(a4650bf65e) > > Please make sure to run checkpatch on the patches. I did Thanks, Jesse Taube
Re: [PATCH v2 2/2] smbios: fill wake-up type
On Fri, Feb 09, 2024 at 04:51:15PM +0100, Heinrich Schuchardt wrote: > We should not use the reserved value 0x00 for the wake up type but > use 0x02 (Unknown). > > Signed-off-by: Heinrich Schuchardt [snip] > @@ -108,6 +108,16 @@ struct __packed smbios_type0 { > char eos[SMBIOS_STRUCT_EOS_BYTES]; > }; > > +#define SMBIOS_WAKEUP_TYPE_RESERVED 0x00 > +#define SMBIOS_WAKEUP_TYPE_OTHER 0x01 > +#define SMBIOS_WAKEUP_TYPE_UNKNOWN 0x02 > +#define SMBIOS_WAKEUP_TYPE_APM_TIME 0x03 > +#define SMBIOS_WAKEUP_TYPE_MODEM_RING0x04 > +#define SMBIOS_WAKEUP_TYPE_LAN_REMOTE0x05 > +#define SMBIOS_WAKEUP_TYPE_POWER_SWITCH 0x06 > +#define SMBIOS_WAKEUP_TYPE_PCI_PME 0x07 > +#define SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED 0x08 Shouldn't we do this as an enum these days? -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 10/20] rockchip: transform rockchip_capsule_update_board_setup into a weak function symbol
On 2024-02-09 10:50, Quentin Schulz wrote: From: Quentin Schulz There's only one user of rockchip_capsule_update_board_setup, which is in board.c, and only one board defines it, so instead of having a header only for one function symbol, let's just use a weak symbol instead. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz Looking good to me. Reviewed-by: Dragan Simic --- arch/arm/include/asm/arch-rockchip/misc.h | 9 - arch/arm/mach-rockchip/board.c| 5 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/misc.h b/arch/arm/include/asm/arch-rockchip/misc.h deleted file mode 100644 index ef37ff1661a..000 --- a/arch/arm/include/asm/arch-rockchip/misc.h +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * RK3399: Architecture common definitions - * - * Copyright (C) 2019 Collabora Inc - https://www.collabora.com/ - * Rohan Garg - */ - -void rockchip_capsule_update_board_setup(void); diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 80b4514852f..4f666aee706 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) @@ -148,6 +147,10 @@ void set_dfu_alt_info(char *interface, char *devstr) env_set("dfu_alt_info", buf); } +__weak void rockchip_capsule_update_board_setup(void) +{ +} + static void gpt_capsule_update_setup(void) { int p, i, ret;
Re: [PATCH v2 09/20] rockchip: merge misc.c into board.c
Hello Quentin, Please, see my comments below. On 2024-02-09 10:50, Quentin Schulz wrote: From: Quentin Schulz 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. The patches I'm going to send, which exclude the unneeded code from the U-Boot images for the Pinebook Pro and the Pinebook Pro, change the code that this patch moves around. Perhaps it would be better to have the move of the code and the subsequent changes to it performed in a separate series, to make checking and accepting the patches simpler as a group, and to perhaps make it a bit more clear what actually happened to anyone going through the repository history later. Thus, I was wondering would you, please, be fine with excluding this patch from this series and letting me submit it, with proper attribution tags, of course, as part of the series I'll submit in the next couple of days? Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- arch/arm/include/asm/arch-rockchip/misc.h | 5 -- arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/board.c| 125 +++ arch/arm/mach-rockchip/misc.c | 135 -- 4 files changed, 125 insertions(+), 141 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/misc.h b/arch/arm/include/asm/arch-rockchip/misc.h index 4155af8c3b0..ef37ff1661a 100644 --- a/arch/arm/include/asm/arch-rockchip/misc.h +++ b/arch/arm/include/asm/arch-rockchip/misc.h @@ -6,9 +6,4 @@ * Rohan Garg */ -int rockchip_cpuid_from_efuse(const u32 cpuid_offset, - const u32 cpuid_length, - u8 *cpuid); -int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length); -int rockchip_setup_macaddr(void); void rockchip_capsule_update_board_setup(void); diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 1dc92066bbf..c07bdaee4c3 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -23,7 +23,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # meaning "turn it off". obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o -obj-$(CONFIG_MISC_INIT_R) += misc.o endif ifeq ($(CONFIG_TPL_BUILD),) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index d5cb59c10fa..80b4514852f 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -1,20 +1,32 @@ // SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2019 Rockchip Electronics Co., Ltd. + * + * Copyright (C) 2019 Collabora Inc - https://www.collabora.com/ + * Rohan Garg + * + * Based on puma-rk3399.c: + * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH */ #include #include #include +#include #include #include #include +#include #include #include #include +#include +#include #include #include #include #include +#include +#include #include #include #include @@ -297,6 +309,119 @@ int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) #endif #ifdef CONFIG_MISC_INIT_R +int rockchip_setup_macaddr(void) +{ +#if CONFIG_IS_ENABLED(HASH) && CONFIG_IS_ENABLED(SHA256) + int ret; + const char *cpuid = env_get("cpuid#"); + u8 hash[SHA256_SUM_LEN]; + int size = sizeof(hash); + u8 mac_addr[6]; + + /* Only generate a MAC address, if none is set in the environment */ + if (env_get("ethaddr")) + return 0; + + if (!cpuid) { + debug("%s: could not retrieve 'cpuid#'\n", __func__); + return -1; + } + + ret = hash_block("sha256", (void *)cpuid, strlen(cpuid), hash, ); + if (ret) { + debug("%s: failed to calculate SHA256\n", __func__); + return -1; + } + + /* Copy 6 bytes of the hash to base the MAC address on */ + memcpy(mac_addr, hash, 6); + + /* Make this a valid MAC address and set it */ + mac_addr[0] &= 0xfe; /* clear multicast bit */ + mac_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ + eth_env_set_enetaddr("ethaddr", mac_addr); + + /* Make a valid MAC address for ethernet1 */ + mac_addr[5] ^= 0x01; + eth_env_set_enetaddr("eth1addr", mac_addr); +#endif + return 0; +} + +int rockchip_cpuid_from_efuse(const u32 cpuid_offset, + const u32 cpuid_length, + u8 *cpuid) +{ +#if IS_ENABLED(CONFIG_ROCKCHIP_EFUSE) || IS_ENABLED(CONFIG_ROCKCHIP_OTP) + struct udevice *dev; + int ret; + + /* retrieve the device */ +#if IS_ENABLED(CONFIG_ROCKCHIP_EFUSE) + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(rockchip_efuse), );
Re: [PATCH v2 06/20] rockchip: pine64: rockpro64: migrate to rockchip_early_misc_init_r
On 2024-02-09 10:50, Quentin Schulz wrote: From: Quentin Schulz Only setup_iodomain() differs from the original misc_init_r from Rockchip mach code, so let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz Looking good to me. Reviewed-by: Dragan Simic --- board/pine64/rockpro64_rk3399/rockpro64-rk3399.c | 20 ++-- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c index d79084614f1..d0a694ead1d 100644 --- a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c +++ b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c @@ -11,7 +11,6 @@ #include #include #include -#include #define GRF_IO_VSEL_BT565_SHIFT 0 #define PMUGRF_CON0_VSEL_SHIFT 8 @@ -31,26 +30,11 @@ static void setup_iodomain(void) rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - setup_iodomain(); - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; - - ret = rockchip_setup_macaddr(); - - return ret; + return 0; } #endif
Re: [PATCH v2 05/20] rockchip: pine64: pinephone-pro: migrate to rockchip_early_misc_init_r
On 2024-02-09 10:50, Quentin Schulz wrote: From: Quentin Schulz Compared to the original misc_init_r from Rockchip mach code, setup_iodomain() is added and rockchip_setup_macaddr() is not called. It is assumed adding rockchip_setup_macaddr() back is fine. Let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip (the side effect being that rockchip_setup_macaddr() is back). Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz Looking good to me. Thank you for including the changes suggested in my earlier review. Reviewed-by: Dragan Simic --- .../pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 17 ++--- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c index b6ccbb9c1c4..de75ee329d8 100644 --- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #define GRF_IO_VSEL_BT565_GPIO2AB 1 @@ -56,23 +55,11 @@ static void setup_iodomain(void) rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - setup_iodomain(); - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; + return 0; - return ret; } #endif
Re: [PATCH v2 04/20] rockchip: pine64: pinebook-pro: migrate to rockchip_early_misc_init_r
On 2024-02-09 10:50, Quentin Schulz wrote: From: Quentin Schulz Compared to the original misc_init_r from Rockchip mach code, setup_iodomain() is added and rockchip_setup_macaddr() is not called. It is assumed adding rockchip_setup_macaddr() back is fine. Let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip (the side effect being that rockchip_setup_macaddr() is back). Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz Looking good to me. Thank you for including the changes suggested in my earlier review. Reviewed-by: Dragan Simic --- board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c index 4ad780767ea..2408a367305 100644 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -54,23 +53,10 @@ static void setup_iodomain(void) rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - setup_iodomain(); - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; - - return ret; + return 0; } #endif
Re: [PATCH v2 01/20] rockchip: avoid out-of-bounds when computing cpuid
On 2024-02-09 10:49, Quentin Schulz wrote: From: Quentin Schulz 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 Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz Looking good to me. Reviewed-by: Dragan Simic --- arch/arm/mach-rockchip/misc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c index 7d03f0c2b67..15397cff009 100644 --- a/arch/arm/mach-rockchip/misc.c +++ b/arch/arm/mach-rockchip/misc.c @@ -102,7 +102,7 @@ int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length) int i; memset(cpuid_str, 0, sizeof(cpuid_str)); - for (i = 0; i < 16; i++) + for (i = 0; i < cpuid_length; i++) sprintf(_str[i * 2], "%02x", cpuid[i]); debug("cpuid: %s\n", cpuid_str); @@ -111,13 +111,13 @@ int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length) * Mix the cpuid bytes using the same rules as in * ${linux}/drivers/soc/rockchip/rockchip-cpuinfo.c */ - for (i = 0; i < 8; i++) { + for (i = 0; i < cpuid_length / 2; i++) { low[i] = cpuid[1 + (i << 1)]; high[i] = cpuid[i << 1]; } - serialno = crc32_no_comp(0, low, 8); - serialno |= (u64)crc32_no_comp(serialno, high, 8) << 32; + serialno = crc32_no_comp(0, low, cpuid_length / 2); + serialno |= (u64)crc32_no_comp(serialno, high, cpuid_length / 2) << 32; snprintf(serialno_str, sizeof(serialno_str), "%016llx", serialno); oldid = env_get("cpuid#");
Re: [AVB/AB] Overhaul plans
Hello Mattijs, On Fri, Feb 9, 2024 at 11:30 AM Mattijs Korpershoek wrote: > > Hi Igor, > > On ven., févr. 09, 2024 at 11:14, Igor Opaniuk wrote: > > > Hi everyone, > > > > I'm currently planning a big overhaul of the current implementation of > > AVB/AB in U-Boot during the 2024 year, which I have barely touched since > > 2019. I used to believe that it was stillborn, but looks like it's > > being actively used > > now by some SoC vendors and Google folks [1][2]. > > This is great news! I am not aware of any development related to the > above but I'm looking forward to this. > > I can't speak for all vendors but I know that TI uses both the AVB and > AB implementation on their AM62x Android solution. Amlogic also uses it. > > > > > This is what I have in my todo list: > > * Backport latest libavb from AOSP upstream and add support for > >Verified Boot 1.3.0 version > > * Sync include/android_bootloader_message.h with AOSP upstream > > * Check and backport fixes for AVB in AOSP U-Boot fork if needed [1] > > * Get acquainted with a current state of A/B support in AOSP and > >backport all needed changes > > * Re-factor libavb, switch to U-Boot existing implementation of > >rsa/sha256/sha512 > > * Add SHA512 implementation that leverage ARMv8 CE > >(pull it from Linux) > > * Enable hw acceleration of SHA256/SHA512 that supports ARMv8 > >Crypto Extensions to speed up verification process on ARMv8-based boards. > > * AVB support for NAND storage > > I know that this has been send but I don't think Alistair has send any > follow-up on this: > https://patchwork.ozlabs.org/project/uboot/patch/20220926220211.868968-1-ade...@google.com/ > > > > > If someone is already working on anything from the above list - > > please feel free to reach out to me, so we can avoid duplication of effort. > > > > Any comments/suggestions are welcome! Thanks! > > From my understanding, the AOSP version of U-Boot has quite a different > bootflow since it relies on the (out-of-tree) boot_android command [3] Correct, but it turned out that they are using some parts of the existing avb implementation in that out-of-tree "boot_android" cmd + the made some adjustments on top of it, that we might be interested in : $ git log --grep=ANDROID --oneline | grep avb ea8f0bb45e ANDROID: Add avb_verify unit tests c9f88bf213 ANDROID: Adding function comments to avb_verify c5599e4a9f Merge "ANDROID: avb_verify: Handle failed malloc in get_partition()" 3aeeae4426 ANDROID: avb_verify: Handle failed malloc in get_partition() 2910c1042c Merge "ANDROID: avb_pubkey: Use bin2c instead of ld" 30fbf100b6 Merge "ANDROID: avb: Extract avb_pubkey_is_trusted()" 296361e80c ANDROID: avb_pubkey: Use bin2c instead of ld 5af2c6d968 ANDROID: avb: Extract avb_pubkey_is_trusted() f74b3f5815 ANDROID: avb_verify: Don't Return ERROR_IO for mismatch in pubkey sizes d6615cd233 Merge "ANDROID: Qualify avb_find_main_pubkey() parameters as const" 9c8470ed6b ANDROID: Qualify avb_find_main_pubkey() parameters as const af808f4b04 ANDROID: avb_find_main_pubkey returns CMD_RET_* 2070f02c75 ANDROID: remove erraneous avb logs Btw, my initial intention (back in 2018) was to make avb implementation boot-command agnostic, as at the time of implementing it different board/SoC vendors used different approaches for booting AOSP; moreover, iirc AOSP-specific cmd (boota/boot_android or whatever it's called now) didn't manage to land to the U-Boot mainline despite multiple attempts by different contributors. > > [3] > https://android.googlesource.com/platform/external/u-boot/+/refs/heads/main/cmd/boot_android.c > > Please keep me in the loop with your progress. If you want, you can > reach me on IRC as well (libera: #u-boot, nick: mkorpershoek) Sure, will keep you posted! > > > > > [1] https://android.googlesource.com/platform/external/u-boot > > [2] https://source.android.com/docs/devices/cuttlefish/bootloader-dev > > [3] > > https://android.googlesource.com/platform/bootable/recovery/+/main/bootloader_message/include/bootloader_message/bootloader_message.h > > > > -- > > Best regards - Atentamente - Meilleures salutations > > > > Igor Opaniuk > > > > mailto: igor.opan...@gmail.com > > skype: igor.opanyuk > > http://ua.linkedin.com/in/iopaniuk Regards, Igor -- Best regards - Atentamente - Meilleures salutations Igor Opaniuk mailto: igor.opan...@gmail.com skype: igor.opanyuk http://ua.linkedin.com/in/iopaniuk
Re: [PATCH v3 27/36] dts: msm8916: replace with upstream DTS
On 02/02/2024 08:38, Sumit Garg wrote: > On Tue, 30 Jan 2024 at 19:35, Caleb Connolly > wrote: >> >> Drop the U-Boot specific dragonboard410c.dts in favour of the upstream >> msm8916-sbc.dts. No additional changes are needed to this DTS for U-Boot >> support. >> >> Taken from kernel tag v6.7 >> >> Reviewed-by: Neil Armstrong >> Signed-off-by: Caleb Connolly >> --- >> arch/arm/dts/Makefile |2 +- >> arch/arm/dts/apq8016-sbc-u-boot.dtsi| 11 + >> arch/arm/dts/apq8016-sbc.dts| 729 + >> arch/arm/dts/dragonboard410c-uboot.dtsi | 44 - >> arch/arm/dts/dragonboard410c.dts| 221 --- >> arch/arm/dts/msm8916.dtsi | 2702 >> +++ >> configs/dragonboard410c_defconfig |2 +- >> 7 files changed, 3444 insertions(+), 267 deletions(-) >> >> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile >> index 92a4465f5f41..4c8b29b983a4 100644 >> --- a/arch/arm/dts/Makefile >> +++ b/arch/arm/dts/Makefile >> @@ -628,7 +628,7 @@ dtb-$(CONFIG_TARGET_SL28) += >> fsl-ls1028a-kontron-sl28.dtb \ >> >> dtb-$(CONFIG_TARGET_TEN64) += fsl-ls1088a-ten64.dtb >> >> -dtb-$(CONFIG_ARCH_SNAPDRAGON) += dragonboard410c.dtb \ >> +dtb-$(CONFIG_ARCH_SNAPDRAGON) += apq8016-sbc.dtb \ >> dragonboard820c.dtb \ >> sdm845-db845c.dtb \ >> sdm845-samsung-starqltechn.dtb \ >> diff --git a/arch/arm/dts/apq8016-sbc-u-boot.dtsi >> b/arch/arm/dts/apq8016-sbc-u-boot.dtsi >> new file mode 100644 >> index ..838e629a8ade >> --- /dev/null >> +++ b/arch/arm/dts/apq8016-sbc-u-boot.dtsi >> @@ -0,0 +1,11 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Copyright (c) 2024, Linaro Ltd. >> + */ >> + >> +/ { >> + /* When running as a first-stage bootloader this isn't filled in >> automatically */ >> + memory@8000 { >> + reg = <0 0x8000 0 0x3da0>; >> + }; >> +}; > > With U-Boot booting as the first stage bootloader, we have to enable > the serial driver prior to relocation. Although we have > DM_FLAG_PRE_RELOC for clock and the serial driver, what about the > pinctrl driver required to configure UART specific pins prior to > relocation? Without following change we get broken U-Boot log without > header prints: Ohhh nice! This makes a whole lot of sense. Thanks for figuring this out. I finally got my hands on some db410c's (thanks Neil!) and can confirm this fixes the issue. I tried using DM_FLAG_PRE_RELOC on the pinctrl driver but it doesn't seem like that's enough to get pinctrl going. I'll pick your patch below. > > diff --git a/arch/arm/dts/apq8016-sbc-u-boot.dtsi > b/arch/arm/dts/apq8016-sbc-u-boot.dtsi > index 838e629a8ade..0a21732be6cb 100644 > --- a/arch/arm/dts/apq8016-sbc-u-boot.dtsi > +++ b/arch/arm/dts/apq8016-sbc-u-boot.dtsi > @@ -9,3 +9,11 @@ > reg = <0 0x8000 0 0x3da0>; > }; > }; > + > + { > + bootph-all; > + > + blsp-uart2-default-state { > + bootph-all; > + }; > +}; > > Fixes broken U-Boot log: > > S - Flash Throughput, 82000 KB/s (1503304 Bytes, 18330 us) > S - DDR Frequency, 400 MHz > Core: 135 devices, 20 uclasses, devicetree: board > MMC: mmc@7824900: 0, mmc@7864900: 1 > Loading Environment from MMC... OK > In:serial@78b > Out: serial@78b > Err: serial@78b > ## Error: Can't overwrite "serial#" > ## Error inserting "serial#" variable, errno=1 > Net: No ethernet found. > Hit any key to stop autoboot: 0 > dragonboard410c => > > -Sumit -- // Caleb (they/them)
[PATCH v2 1/2] cmd: smbios: type 1 wake-up time, family
Correct type 1 output * render wake up time as string * print family string * remove duplicate serial number output Signed-off-by: Heinrich Schuchardt --- v2: no change --- cmd/smbios.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cmd/smbios.c b/cmd/smbios.c index 66f6b761378..d3bd8b12a67 100644 --- a/cmd/smbios.c +++ b/cmd/smbios.c @@ -14,6 +14,18 @@ DECLARE_GLOBAL_DATA_PTR; +static const char * const wakeup_type_strings[] = { + "Reserved", /* 0x00 */ + "Other",/* 0x01 */ + "Unknown", /* 0x02 */ + "APM Timer",/* 0x03 */ + "Modem Ring", /* 0x04 */ + "Lan Remote", /* 0x05 */ + "Power Switch", /* 0x06 */ + "PCI PME#", /* 0x07 */ + "AC Power Restored",/* 0x08 */ +}; + /** * smbios_get_string() - get SMBIOS string from table * @@ -72,6 +84,14 @@ void smbios_print_str(const char *label, void *table, u8 index) printf("\t%s: %s\n", label, smbios_get_string(table, index)); } +const char *smbios_wakeup_type_str(u8 wakeup_type) +{ + if (wakeup_type >= ARRAY_SIZE(wakeup_type_strings)) + /* Values over 0x08 are reserved. */ + wakeup_type = 0; + return wakeup_type_strings[wakeup_type]; +} + static void smbios_print_type1(struct smbios_type1 *table) { printf("System Information\n"); @@ -81,11 +101,12 @@ static void smbios_print_type1(struct smbios_type1 *table) smbios_print_str("Serial Number", table, table->serial_number); if (table->length >= 0x19) { printf("\tUUID: %pUl\n", table->uuid); - smbios_print_str("Wake Up Type", table, table->serial_number); + printf("\tWake-up Type: %s\n", + smbios_wakeup_type_str(table->wakeup_type)); } if (table->length >= 0x1b) { - smbios_print_str("Serial Number", table, table->serial_number); smbios_print_str("SKU Number", table, table->sku_number); + smbios_print_str("Family", table, table->family); } } -- 2.43.0
[PATCH v2 2/2] smbios: fill wake-up type
We should not use the reserved value 0x00 for the wake up type but use 0x02 (Unknown). Signed-off-by: Heinrich Schuchardt --- v2: use wake-up type 'Unknown' as our default add more SMBIOS wake-up type constants --- include/smbios.h | 10 ++ lib/smbios.c | 1 + 2 files changed, 11 insertions(+) diff --git a/include/smbios.h b/include/smbios.h index 3df8827b60d..990e37b4d2b 100644 --- a/include/smbios.h +++ b/include/smbios.h @@ -108,6 +108,16 @@ struct __packed smbios_type0 { char eos[SMBIOS_STRUCT_EOS_BYTES]; }; +#define SMBIOS_WAKEUP_TYPE_RESERVED0x00 +#define SMBIOS_WAKEUP_TYPE_OTHER 0x01 +#define SMBIOS_WAKEUP_TYPE_UNKNOWN 0x02 +#define SMBIOS_WAKEUP_TYPE_APM_TIME0x03 +#define SMBIOS_WAKEUP_TYPE_MODEM_RING 0x04 +#define SMBIOS_WAKEUP_TYPE_LAN_REMOTE 0x05 +#define SMBIOS_WAKEUP_TYPE_POWER_SWITCH0x06 +#define SMBIOS_WAKEUP_TYPE_PCI_PME 0x07 +#define SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED 0x08 + struct __packed smbios_type1 { u8 type; u8 length; diff --git a/lib/smbios.c b/lib/smbios.c index c83af730a91..b190b010f30 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -394,6 +394,7 @@ static int smbios_write_type1(ulong *current, int handle, } else { t->serial_number = smbios_add_prop(ctx, "serial", NULL); } + t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN; t->sku_number = smbios_add_prop(ctx, "sku", NULL); t->family = smbios_add_prop(ctx, "family", NULL); -- 2.43.0
[PATCH v2 0/2] smbios: fill wake-up type
We should not use the reserved value 0x00 for the wake up type but use 0x06 (Power Switch). Correctly display wake-up type in smbios command. Display SMBIOS type 1 field family in smbios command. v2: use wake-up type 0x02 as our default Heinrich Schuchardt (2): cmd: smbios: type 1 wake-up time, family smbios: fill wake-up type cmd/smbios.c | 25 +++-- include/smbios.h | 10 ++ lib/smbios.c | 1 + 3 files changed, 34 insertions(+), 2 deletions(-) -- 2.43.0
[PATCH] button: qcom-pmic: demote "unknown button" message to debug
This message isn't an error (there can be a watchdog subnode for example) but it shouldn't be printed unless this driver is being debugged. Demote it to a debug print. Signed-off-by: Caleb Connolly --- drivers/button/button-qcom-pmic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/button/button-qcom-pmic.c b/drivers/button/button-qcom-pmic.c index 34a976d1e6c6..e6702139ca2d 100644 --- a/drivers/button/button-qcom-pmic.c +++ b/drivers/button/button-qcom-pmic.c @@ -133,7 +133,7 @@ static int button_qcom_pmic_bind(struct udevice *parent) } else if (NODE_IS_RESIN(node)) { uc_plat->label = "vol_down"; } else { - printf("Unknown button node '%s' should be 'pwrkey' or 'resin'\n", + debug("Unknown button node '%s' should be 'pwrkey' or 'resin'\n", ofnode_get_name(node)); device_unbind(dev); } -- 2.43.0
[PATCH] doc/develop/codingstyle.rst: Clarify include section
Rework the section about includes slightly. We should not be using common.h anywhere, so remove that from examples and ask people to send patches removing it when found. Doing this also means we need to reword other parts of this section. Be clearer about using alphabetical ordering. Signed-off-by: Tom Rini --- doc/develop/codingstyle.rst | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/doc/develop/codingstyle.rst b/doc/develop/codingstyle.rst index b25bfbd271f0..cdf5aedfcbb0 100644 --- a/doc/develop/codingstyle.rst +++ b/doc/develop/codingstyle.rst @@ -108,30 +108,29 @@ expected size, or that particular members appear at the right offset. Include files - -You should follow this ordering in U-Boot. The common.h header (which is going -away at some point) should always be first, followed by other headers in order, -then headers with directories, then local files: +You should follow this ordering in U-Boot. In all cases, they should be listed +in alphabetical order. First comes headers which are located directly in our +top-level include diretory. This excludes the common.h header file which is to +be removed. Second are headers within subdirectories, Finally directory-local +includes should be listed. See this example: .. code-block:: C - #include #include #include #include #include - #include + #include #include #include #include "local.h" -Within that order, sort your includes. - -It is important to include common.h first since it provides basic features used -by most files, e.g. CONFIG options. - For files that need to be compiled for the host (e.g. tools), you need to use -``#ifndef USE_HOSTCC`` to avoid including common.h since it includes a lot of -internal U-Boot things. See common/image.c for an example. +``#ifndef USE_HOSTCC`` to avoid including U-Boot specific include files. See +common/image.c for an example. + +If you encounter ccode which still uses a patch to remove that and +replace it with any required include files directly is much appreciated. If your file uses driver model, include in the C file. Do not include dm.h in a header file. Try to use forward declarations (e.g. ``struct -- 2.34.1
Re: [PATCH 0/2] imx93_var_som: Enable AHAB support
On Fri, Feb 9, 2024 at 11:25 AM Mathieu Othacehe wrote: > Once the board is closed you can only boot from signed images. If the > signed image is not working (hanging during relocation for instance), > then you can always boot from a new one. All the interfaces: SD-card, > UART, USB are still usable. > > I have tried many u-boot versions on my closed board until I had > something working. So, no you do not end-up with a brick unless you > cannot sign your image properly anymore. Thanks for the clarification. I will apply your v2 soon.
Re: [PATCH] Added FDT PAD memory size while reserving memory for FDT to avoid some memory corruption issue
The FDT relocation is not disabled. I am adding the FDT PADDING bytes while doing FDT reservation in the board_f file. Also update the FDT length based on the new allocation, instead of blindly increasing the size. Currently the size is getting increased even for the relocation disabled scenario also. So without increasing the physical memory for the disable relocation use case, the fdt total size is updated. thus causing memory corruption On Fri, Feb 9, 2024 at 7:10 PM Tom Rini wrote: > On Fri, Feb 09, 2024 at 01:22:08PM +0530, Selvakumar Velandi wrote: > > Hi, > > > > Issue: > > Linux kernel getting crash after loading kernel in VM system using RISCV > > QEMU. > > > > RootCause: > > Memory corruption in uboot FDT memory while launching a VM system in > RISCV > > QEMU. > > > > Fix: > > In the board_f.c file the FDT memory region is reserved without FDT > padding > > bytes. uboot will add some params like bootargs while launching linux. > > While relocate the FDT, if its decided as run in the Fixed memory > location > > i.e fdy_high is set as -1, then the padding bytes not added while > > relocating the FDT, > > Do not disable fdt relocation. The RISC-V platforms which do this today > are broken. > > -- > Tom > -- *** This communication is confidential, may be privileged and is meant only for the intended recipient and purpose. No part of this email or any files transmitted with it can be shared, copied, forwarded or published online or offline, without prior written consent of the sender. If you are not the intended recipient, please preserve the confidentiality, delete the e-mail and attachments, if any from your system and inform the sender immediately. ***
Re: [PATCH v2 13/20] rockchip: migrate hardware.h inclusion into appropriate files
On 2/9/24 10:50, Quentin Schulz wrote: > From: Quentin Schulz > > hardware.h is only defining macros which are "wrappers" around writel(). > > writel() is however not available in hardware.h, needs to be > included. This means in order to use the wrappers in hardware.h, one > also needs to include the header. > > However, this cannot be done currently because hardware.h is included in > include/configs files, which are implicitly included by every code file > by default, which makes the compilation of arch/arm/cpu/armv8/u-boot.lds > fail because ALIGN (the ARM assembly directive) got redefined by some > of the include files coming from . > > Because nothing in the include/configs file actually use hardware.h, > let's remove the inclusion of hardware.h from the include/configs files > and explicitly add it wherever it is required. > > This prepares for the next commit where will be included in > hardware.h. > > Cc: Quentin Schulz > Reviewed-by: Kever Yang > Signed-off-by: Quentin Schulz > --- > arch/arm/mach-rockchip/rk3066/rk3066.c | 1 + > drivers/ram/rockchip/dmc-rk3368.c | 1 + > drivers/ram/rockchip/sdram_rk3188.c| 1 + > drivers/ram/rockchip/sdram_rk3288.c| 1 + > include/configs/rk3036_common.h| 1 - > include/configs/rk3066_common.h| 1 - > include/configs/rk3188_common.h| 1 - > include/configs/rk322x_common.h| 1 - > include/configs/rk3288_common.h| 1 - > include/configs/rk3368_common.h| 1 - > include/configs/rv1108_common.h| 1 - > 11 files changed, 4 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/mach-rockchip/rk3066/rk3066.c > b/arch/arm/mach-rockchip/rk3066/rk3066.c > index 78c7d894f90..6661b788295 100644 > --- a/arch/arm/mach-rockchip/rk3066/rk3066.c > +++ b/arch/arm/mach-rockchip/rk3066/rk3066.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > > #define GRF_BASE 0x20008000 > > diff --git a/drivers/ram/rockchip/dmc-rk3368.c > b/drivers/ram/rockchip/dmc-rk3368.c > index f36be941a38..74d8aed571c 100644 > --- a/drivers/ram/rockchip/dmc-rk3368.c > +++ b/drivers/ram/rockchip/dmc-rk3368.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include >From codingstyle.rst: You should follow this ordering in U-Boot. The common.h header (which is going away at some point) should always be first, followed by other headers in order, then headers with directories, then local files. Within that order, sort your includes. > #include > #include > #include > diff --git a/drivers/ram/rockchip/sdram_rk3188.c > b/drivers/ram/rockchip/sdram_rk3188.c > index ad9f936df55..16a68885f1f 100644 > --- a/drivers/ram/rockchip/sdram_rk3188.c > +++ b/drivers/ram/rockchip/sdram_rk3188.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include dito > #include > #include > > diff --git a/drivers/ram/rockchip/sdram_rk3288.c > b/drivers/ram/rockchip/sdram_rk3288.c > index c99118fd612..ec6bdcb2015 100644 > --- a/drivers/ram/rockchip/sdram_rk3288.c > +++ b/drivers/ram/rockchip/sdram_rk3288.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include dito > #include > #include > #include > diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h > index c2abd14e114..0bf9e8b9a2e 100644 > --- a/include/configs/rk3036_common.h > +++ b/include/configs/rk3036_common.h > @@ -5,7 +5,6 @@ > #ifndef __CONFIG_RK3036_COMMON_H > #define __CONFIG_RK3036_COMMON_H > > -#include > #include "rockchip-common.h" > > #define CFG_SYS_HZ_CLOCK 2400 > diff --git a/include/configs/rk3066_common.h b/include/configs/rk3066_common.h > index d70c8f77d48..6a3b6900463 100644 > --- a/include/configs/rk3066_common.h > +++ b/include/configs/rk3066_common.h > @@ -6,7 +6,6 @@ > #ifndef __CONFIG_RK3066_COMMON_H > #define __CONFIG_RK3066_COMMON_H > > -#include > #include "rockchip-common.h" > > #define CFG_IRAM_BASE0x1008 > diff --git a/include/configs/rk3188_common.h b/include/configs/rk3188_common.h > index a8cee1e44d4..98f2c25f3cf 100644 > --- a/include/configs/rk3188_common.h > +++ b/include/configs/rk3188_common.h > @@ -6,7 +6,6 @@ > #ifndef __CONFIG_RK3188_COMMON_H > #define __CONFIG_RK3188_COMMON_H > > -#include > #include "rockchip-common.h" > > #define CFG_IRAM_BASE0x1008 > diff --git a/include/configs/rk322x_common.h b/include/configs/rk322x_common.h > index 15f77df3e17..bab4ca015f7 100644 > --- a/include/configs/rk322x_common.h > +++ b/include/configs/rk322x_common.h > @@ -5,7 +5,6 @@ > #ifndef __CONFIG_RK322X_COMMON_H > #define __CONFIG_RK322X_COMMON_H > > -#include > #include "rockchip-common.h" > > #define CFG_SYS_HZ_CLOCK 2400 > diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h > index 3063076a97a..0c449e31099 100644 > --- a/include/configs/rk3288_common.h > +++ b/include/configs/rk3288_common.h > @@
Re: [PATCH v2 13/20] rockchip: migrate hardware.h inclusion into appropriate files
Hi Johan, On 2/9/24 14:07, Johan Jonker wrote: [...] From codingstyle.rst: You should follow this ordering in U-Boot. The common.h header (which is going away at some point) should always be first, followed by other headers in order, then headers with directories, then local files. Within that order, sort your includes. Good catch indeed. I'll avoid resending a 20-patch series today though. I have the following diff that can be applied on top of that commit: """ diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index 74d8aed571c..859fc47030f 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -17,10 +17,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c index 16a68885f1f..d23d4231798 100644 --- a/drivers/ram/rockchip/sdram_rk3188.c +++ b/drivers/ram/rockchip/sdram_rk3188.c @@ -22,10 +22,10 @@ #include #include #include +#include #include #include #include -#include #include #include diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c index ec6bdcb2015..3177051dd12 100644 --- a/drivers/ram/rockchip/sdram_rk3288.c +++ b/drivers/ram/rockchip/sdram_rk3288.c @@ -22,10 +22,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include """ You'll note that drivers/ram/rockchip/dmc-rk3368.c currently already doesn't follow the coding style :) @Kever, up to you if you want me to send a v3 for that or if you can apply the diff above yourself before merging. Cheers, Quentin
[GIT PULL] Please pull u-boot-dfu-20240209
Hi Tom, Here are some developments for master including: - sparse error checking fix when using raw chunks - 2 new additions (AVB, AB) of myself to the MAINTAINERS file The CI job is at https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/19573 Thanks, Mattijs The following changes since commit a4650bf65e4b7d3ef04c90ba8031374428e4a682: ti: keystone2: Move common Kconfig selections to under ARCH_KEYSTONE (2024-02-08 14:42:56 -0500) are available in the Git repository at: https://source.denx.de/u-boot/custodians/u-boot-dfu.git tags/u-boot-dfu-20240209 for you to fetch changes up to 766f04a297e892d5106f7f7ac8b43c69bd8a6007: lib: sparse: Fix error checking for write_sparse_chunk_raw (2024-02-09 09:42:04 +0100) u-boot-dfu-20240209 - sparse error checking fix when using raw chunks - 2 new additions (AVB, AB) of myself to the MAINTAINERS file Mattijs Korpershoek (2): MAINTAINERS: add Mattijs for Android AB MAINTAINERS: add Mattijs for Android AVB Sean Anderson (1): lib: sparse: Fix error checking for write_sparse_chunk_raw MAINTAINERS| 2 ++ lib/image-sparse.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
Re: [PATCH] Added FDT PAD memory size while reserving memory for FDT to avoid some memory corruption issue
On Fri, Feb 09, 2024 at 01:22:08PM +0530, Selvakumar Velandi wrote: > Hi, > > Issue: > Linux kernel getting crash after loading kernel in VM system using RISCV > QEMU. > > RootCause: > Memory corruption in uboot FDT memory while launching a VM system in RISCV > QEMU. > > Fix: > In the board_f.c file the FDT memory region is reserved without FDT padding > bytes. uboot will add some params like bootargs while launching linux. > While relocate the FDT, if its decided as run in the Fixed memory location > i.e fdy_high is set as -1, then the padding bytes not added while > relocating the FDT, Do not disable fdt relocation. The RISC-V platforms which do this today are broken. -- Tom signature.asc Description: PGP signature
[PATCH] rockchip: ringneck-px30: put STM32_RST line in input mode instead of output
From: Quentin Schulz The STM32_RST line is routed to the ATtiny microcontroller PA0/RESET/UPDI pin. By driving the PX30 SoC pin as GPIO output high, we prevent external UPDI to be used for flashing without first putting this pin as GPIO input, an extra step we could avoid in userspace. There's an external hardware pull-up strong enough to keep the STM32_RST state high on ATtiny side but weak enough it can be overridden by external UPDI. This also means it is safe to use for the STM32 variant, where STM32_RST line will be in the same state as if output high was used. The Q7 standard specifies that MFG_NC1 and MFG_NC2 (used for UPDI for Ringneck) pins should neither be driven by the carrierboard, nor have pull-up or pull-down resistors. This means this commit is safe to use regardless of the carrierboard this module would be connected to (provided it follows the Q7 standard). Fixes: 6acdd63e8771 ("rockchip: ringneck-px30: always reset STM32 companion controller on boot") Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- board/theobroma-systems/ringneck_px30/ringneck-px30.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/theobroma-systems/ringneck_px30/ringneck-px30.c b/board/theobroma-systems/ringneck_px30/ringneck-px30.c index ff7e414303d..2ab1e7a12fa 100644 --- a/board/theobroma-systems/ringneck_px30/ringneck-px30.c +++ b/board/theobroma-systems/ringneck_px30/ringneck-px30.c @@ -76,9 +76,9 @@ void spl_board_init(void) mdelay(1); - ret = gpio_direction_output(STM32_RST, 1); + ret = gpio_direction_input(STM32_RST); if (ret) { - debug("Failed to configure STM32_RST as output high\n"); + debug("Failed to configure STM32_RST as input\n"); return; } } --- base-commit: a4650bf65e4b7d3ef04c90ba8031374428e4a682 change-id: 20240209-ringneck-stm32-rst-input-ca1cdfa67ff5 Best regards, -- Quentin Schulz
Re: [PATCH 3/3] doc: board: Add minimal documentation for Sielaff i.MX6 Solo board
Hi Frieder, On Thu, Feb 8, 2024 at 1:59 PM Frieder Schrempf wrote: > +Burn the flash.bin to SD card at an offset of 1 KiB: > + > +.. code-block:: bash > + > + $ dd if=flash.bin of=/dev/sd[x] bs=1K seek=1 conv=notrunc I see that you used binman to create the flash.bin file. You could simply use the standard u-boot-with-spl.imx instead: $ sha256sum flash.bin a0a4536876f2957ef88776036f13c6604a9f7e7fd78a236e8ea7322c2ae3e4cf flash.bin $ sha256sum u-boot-with-spl.imx a0a4536876f2957ef88776036f13c6604a9f7e7fd78a236e8ea7322c2ae3e4cf u-boot-with-spl.imx As you can see they have the same content. I would suggest dropping the binman generation and just flash u-boot-with-spl.imx.
Re: [PATCH 1/2] board: imx93_var_som: Probe ELE MU
Hello, > Please put this prototype into a header file. > > Currently, it appears in 3 imx93 spl.c files. Fixed in the v2 :) Thanks, Mathieu
[PATCH v2 3/3] configs: imx93_var_som: Enable AHAB support
Enable AHAB support in the imx93_var_som configuration. Signed-off-by: Mathieu Othacehe --- configs/imx93_var_som_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/imx93_var_som_defconfig b/configs/imx93_var_som_defconfig index cc0c5a79bc1..14922f2a3e2 100644 --- a/configs/imx93_var_som_defconfig +++ b/configs/imx93_var_som_defconfig @@ -12,6 +12,7 @@ CONFIG_IMX_CONFIG="arch/arm/mach-imx/imx9/imximage.cfg" CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="imx93-var-som-symphony" CONFIG_SPL_TEXT_BASE=0x2049A000 +CONFIG_AHAB_BOOT=y CONFIG_TARGET_IMX93_VAR_SOM=y CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_SPL_SERIAL=y -- 2.41.0
[PATCH v2 2/3] board: imx93_var_som: Probe ELE MU
Probing the MU is needed to prevent this error in the SPL: ele dev is not initialized Authenticate container hdr failed, return -19, resp 0x0 IND = INVALID ele dev is not initialized Error: release container failed, resp 0x0! IND = INVALID SPL: failed to boot from all boot devices Signed-off-by: Mathieu Othacehe --- board/variscite/imx93_var_som/spl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/board/variscite/imx93_var_som/spl.c b/board/variscite/imx93_var_som/spl.c index 502e599b91a..e6db4eb562b 100644 --- a/board/variscite/imx93_var_som/spl.c +++ b/board/variscite/imx93_var_som/spl.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -114,9 +115,9 @@ void board_init_f(ulong dummy) preloader_console_init(); - ret = arch_cpu_init(); + ret = imx9_probe_mu(NULL, NULL); if (ret) { - printf("Fail to init Sentinel API\n"); + printf("Fail to init ELE API\n"); } else { printf("SOC: 0x%x\n", gd->arch.soc_rev); printf("LC: 0x%x\n", gd->arch.lifecycle); -- 2.41.0
[PATCH v2 1/3] imx93: Use a header for imx9_probe_mu declaration
Put imx9_probe_mu declaration in a new mu.h header file. Signed-off-by: Mathieu Othacehe --- arch/arm/include/asm/arch-imx9/mu.h | 13 + board/freescale/imx93_evk/spl.c | 2 +- board/phytec/phycore_imx93/spl.c| 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/asm/arch-imx9/mu.h diff --git a/arch/arm/include/asm/arch-imx9/mu.h b/arch/arm/include/asm/arch-imx9/mu.h new file mode 100644 index 000..b8604992914 --- /dev/null +++ b/arch/arm/include/asm/arch-imx9/mu.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2024 Mathieu Othacehe + */ + +#ifndef __ARCH_IMX9_MU_H +#define __ARCH_IMX9_MU_H + +#include + +int imx9_probe_mu(void *ctx, struct event *event); + +#endif diff --git a/board/freescale/imx93_evk/spl.c b/board/freescale/imx93_evk/spl.c index be9c24fc0d9..a98ed69db88 100644 --- a/board/freescale/imx93_evk/spl.c +++ b/board/freescale/imx93_evk/spl.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -91,7 +92,6 @@ int power_init_board(void) } #endif -extern int imx9_probe_mu(void *ctx, struct event *event); void board_init_f(ulong dummy) { int ret; diff --git a/board/phytec/phycore_imx93/spl.c b/board/phytec/phycore_imx93/spl.c index da4b9e53594..dabc5316f33 100644 --- a/board/phytec/phycore_imx93/spl.c +++ b/board/phytec/phycore_imx93/spl.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -99,7 +100,6 @@ int power_init_board(void) return 0; } -extern int imx9_probe_mu(void *ctx, struct event *event); void board_init_f(ulong dummy) { int ret; -- 2.41.0
[PATCH v2 0/3] imx93_var_som: Enable AHAB support
Hello, In this v2, I moved imx93_probe_mu to a dedicated header. Thanks, Mathieu Changelog: v2: Move imx93_probe_mu declaration to a header file Link to the previous revision: v1: https://lists.denx.de/pipermail/u-boot/2024-February/545528.html Mathieu Othacehe (3): imx93: Use a header for imx9_probe_mu declaration board: imx93_var_som: Probe ELE MU configs: imx93_var_som: Enable AHAB support arch/arm/include/asm/arch-imx9/mu.h | 13 + board/freescale/imx93_evk/spl.c | 2 +- board/phytec/phycore_imx93/spl.c| 2 +- board/variscite/imx93_var_som/spl.c | 5 +++-- configs/imx93_var_som_defconfig | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 arch/arm/include/asm/arch-imx9/mu.h -- 2.41.0
[PATCH] configs: am64x_evm_r5_defconfig: enlarge simple malloc pool
With the default size the stack grows into the malloc, pool leading to stack corruption and boot failure. Signed-off-by: Thomas Weißschuh --- Note: Maybe this should be increased for a broader set of devices. --- configs/am64x_evm_r5_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/am64x_evm_r5_defconfig b/configs/am64x_evm_r5_defconfig index 56df6a4a19..707fe506f3 100644 --- a/configs/am64x_evm_r5_defconfig +++ b/configs/am64x_evm_r5_defconfig @@ -42,6 +42,7 @@ CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_STACK_R=y +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x40 CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_SYS_MALLOC=y CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y --- base-commit: a4650bf65e4b7d3ef04c90ba8031374428e4a682 change-id: 20240209-am64x_evm_r5_defconfig-malloc-simple-len-b1e36478e431 Best regards, -- Thomas Weißschuh
Re: [PATCH 0/2] imx93_var_som: Enable AHAB support
Hello Fabio, > Just wanted to make sure I understand: if someone programs the fuse to > close the board, > it will fail to boot U-Boot proper and this means that the board is > bricked. Is this correct? No. I fused the board and with this series applied and the three HAFDBS commits reverted, I can boot just fine on that board. Without reverting those commits, the SPL is working fine and u-boot hangs at relocation. It is 100% reproducible on my board. > Is the boot failure related to some malloc size needing to be increased? I tried that it has no influence. Thanks, Mathieu
[PATCH] Added FDT PAD memory size while reserving memory for FDT to avoid some memory corruption issue
Hi, Issue: Linux kernel getting crash after loading kernel in VM system using RISCV QEMU. RootCause: Memory corruption in uboot FDT memory while launching a VM system in RISCV QEMU. Fix: In the board_f.c file the FDT memory region is reserved without FDT padding bytes. uboot will add some params like bootargs while launching linux. While relocate the FDT, if its decided as run in the Fixed memory location i.e fdy_high is set as -1, then the padding bytes not added while relocating the FDT, but the size is blindly added with padding bytes without reserving the physical memory in the FDT header in the image_fdt.c file. Please find the attached patch file to fix the issue. Please review and revert your comments. Regards, SelvakumarVelandi Krutrim SI designs -- *** This communication is confidential, may be privileged and is meant only for the intended recipient and purpose. No part of this email or any files transmitted with it can be shared, copied, forwarded or published online or offline, without prior written consent of the sender. If you are not the intended recipient, please preserve the confidentiality, delete the e-mail and attachments, if any from your system and inform the sender immediately. *** From f128c309a0481363952f7196180f83ce37663191 Mon Sep 17 00:00:00 2001 From: Selvakumar Velandi Date: Wed, 7 Feb 2024 12:16:59 +0530 Subject: [PATCH] [PATCH] RISCV QEMU: Add PAD size during the FDT memory reservation and update the FDT size also. --- boot/image-fdt.c | 10 -- common/board_f.c | 12 +++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/boot/image-fdt.c b/boot/image-fdt.c index 75bdd55f32..cac5dc10b4 100644 --- a/boot/image-fdt.c +++ b/boot/image-fdt.c @@ -178,8 +178,7 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) } /* position on a 4K boundary before the alloc_current */ - /* Pad the FDT by a specified amount */ - of_len = *of_size + CONFIG_SYS_FDT_PAD; + of_len = *of_size; /* If fdt_high is set use it to select the relocation address */ fdt_high = env_get("fdt_high"); @@ -193,6 +192,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) lmb_reserve(lmb, map_to_sysmem(of_start), of_len); disable_relocation = 1; } else if (desired_addr) { + /* Pad the FDT by a specified amount */ + of_len += CONFIG_SYS_FDT_PAD; addr = lmb_alloc_base(lmb, of_len, 0x1000, desired_addr); of_start = map_sysmem(addr, of_len); @@ -201,6 +202,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) goto error; } } else { + /* Pad the FDT by a specified amount */ + of_len += CONFIG_SYS_FDT_PAD; addr = lmb_alloc(lmb, of_len, 0x1000); of_start = map_sysmem(addr, of_len); } @@ -209,6 +212,9 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size) low = env_get_bootm_low(); of_start = NULL; + /* Pad the FDT by a specified amount */ + of_len += CONFIG_SYS_FDT_PAD; + for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) { start = gd->bd->bi_dram[bank].start; size = gd->bd->bi_dram[bank].size; diff --git a/common/board_f.c b/common/board_f.c index 442b8349d0..aab74fb44d 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -572,7 +572,12 @@ static int reserve_fdt(void) * section, then it will be relocated with other data. */ if (gd->fdt_blob) { - gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob), 32); + /* + * Reserve the FDT with padded bytes to of breathing room in case + * the device tree needs to be expanded later. + * Update the size in fdt header during relocate. + */ + gd->fdt_size = ALIGN((fdt_totalsize(gd->fdt_blob) + CONFIG_SYS_FDT_PAD), 32); gd->start_addr_sp = reserve_stack_aligned(gd->fdt_size); gd->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size); @@ -669,6 +674,11 @@ static int reloc_fdt(void) memcpy(gd->new_fdt, gd->fdt_blob, fdt_totalsize(gd->fdt_blob)); gd->fdt_blob = gd->new_fdt; + /* + * Size maybe updated with padded bytes in new fdt reservation + * So update the FDT size also. + */ + fdt_set_totalsize(gd->fdt_blob, gd->fdt_size); } } -- 2.34.1
Re: [PATCH 0/2] imx93_var_som: Enable AHAB support
Hi Mathieu, On Fri, Feb 9, 2024 at 5:05 AM Mathieu Othacehe wrote: > No. I fused the board and with this series applied and the three HAFDBS > commits reverted, I can boot just fine on that board. Yes, this part I understood. > Without reverting those commits, the SPL is working fine and u-boot > hangs at relocation. It is 100% reproducible on my board. This is what I am concerned about: this hang causes the board to brick and can no longer be recovered since it has the fuse programmed to close the device, right?
Re: [AVB/AB] Overhaul plans
Hi Igor, On ven., févr. 09, 2024 at 11:14, Igor Opaniuk wrote: > Hi everyone, > > I'm currently planning a big overhaul of the current implementation of > AVB/AB in U-Boot during the 2024 year, which I have barely touched since > 2019. I used to believe that it was stillborn, but looks like it's > being actively used > now by some SoC vendors and Google folks [1][2]. This is great news! I am not aware of any development related to the above but I'm looking forward to this. I can't speak for all vendors but I know that TI uses both the AVB and AB implementation on their AM62x Android solution. > > This is what I have in my todo list: > * Backport latest libavb from AOSP upstream and add support for >Verified Boot 1.3.0 version > * Sync include/android_bootloader_message.h with AOSP upstream > * Check and backport fixes for AVB in AOSP U-Boot fork if needed [1] > * Get acquainted with a current state of A/B support in AOSP and >backport all needed changes > * Re-factor libavb, switch to U-Boot existing implementation of >rsa/sha256/sha512 > * Add SHA512 implementation that leverage ARMv8 CE >(pull it from Linux) > * Enable hw acceleration of SHA256/SHA512 that supports ARMv8 >Crypto Extensions to speed up verification process on ARMv8-based boards. > * AVB support for NAND storage I know that this has been send but I don't think Alistair has send any follow-up on this: https://patchwork.ozlabs.org/project/uboot/patch/20220926220211.868968-1-ade...@google.com/ > > If someone is already working on anything from the above list - > please feel free to reach out to me, so we can avoid duplication of effort. > > Any comments/suggestions are welcome! Thanks! >From my understanding, the AOSP version of U-Boot has quite a different bootflow since it relies on the (out-of-tree) boot_android command [3] [3] https://android.googlesource.com/platform/external/u-boot/+/refs/heads/main/cmd/boot_android.c Please keep me in the loop with your progress. If you want, you can reach me on IRC as well (libera: #u-boot, nick: mkorpershoek) > > [1] https://android.googlesource.com/platform/external/u-boot > [2] https://source.android.com/docs/devices/cuttlefish/bootloader-dev > [3] > https://android.googlesource.com/platform/bootable/recovery/+/main/bootloader_message/include/bootloader_message/bootloader_message.h > > -- > Best regards - Atentamente - Meilleures salutations > > Igor Opaniuk > > mailto: igor.opan...@gmail.com > skype: igor.opanyuk > http://ua.linkedin.com/in/iopaniuk
[AVB/AB] Overhaul plans
Hi everyone, I'm currently planning a big overhaul of the current implementation of AVB/AB in U-Boot during the 2024 year, which I have barely touched since 2019. I used to believe that it was stillborn, but looks like it's being actively used now by some SoC vendors and Google folks [1][2]. This is what I have in my todo list: * Backport latest libavb from AOSP upstream and add support for Verified Boot 1.3.0 version * Sync include/android_bootloader_message.h with AOSP upstream * Check and backport fixes for AVB in AOSP U-Boot fork if needed [1] * Get acquainted with a current state of A/B support in AOSP and backport all needed changes * Re-factor libavb, switch to U-Boot existing implementation of rsa/sha256/sha512 * Add SHA512 implementation that leverage ARMv8 CE (pull it from Linux) * Enable hw acceleration of SHA256/SHA512 that supports ARMv8 Crypto Extensions to speed up verification process on ARMv8-based boards. * AVB support for NAND storage If someone is already working on anything from the above list - please feel free to reach out to me, so we can avoid duplication of effort. Any comments/suggestions are welcome! Thanks! [1] https://android.googlesource.com/platform/external/u-boot [2] https://source.android.com/docs/devices/cuttlefish/bootloader-dev [3] https://android.googlesource.com/platform/bootable/recovery/+/main/bootloader_message/include/bootloader_message/bootloader_message.h -- Best regards - Atentamente - Meilleures salutations Igor Opaniuk mailto: igor.opan...@gmail.com skype: igor.opanyuk http://ua.linkedin.com/in/iopaniuk
[PATCH v5] misc: fs-loader: Use fw_storage_interface instead of storage_interface
The fs-loader driver reads env storage_interface and uses it to load firmware file into memory using the medium set by env. Update the driver to use env fw_storage_interface as this variable is only used to load firmwares. This is to keep all variables used by fs-loader driver with 'fw_' prefix. All other variables have 'fw_' prefix except for storage_interface. The env storage_interface will act as fallback so that the existing implementations do not break. Also update the FS Loader documentation accordingly. Signed-off-by: MD Danish Anwar --- Cc: Sean Anderson Changes from v4 to v5: *) Modified commit message to make the motive cleared for this commit. *) Added RB tag of Ravi. *) Rebased on the latest u-boot/master [commit a4650bf65e4b7d3ef04c90ba8031374428e4a682] v4: https://lore.kernel.org/all/20240130062627.2344282-1-danishan...@ti.com/ doc/develop/driver-model/fs_firmware_loader.rst | 5 - drivers/misc/fs_loader.c| 5 - 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/develop/driver-model/fs_firmware_loader.rst b/doc/develop/driver-model/fs_firmware_loader.rst index 149b8b436e..410cc1442d 100644 --- a/doc/develop/driver-model/fs_firmware_loader.rst +++ b/doc/develop/driver-model/fs_firmware_loader.rst @@ -98,8 +98,11 @@ through the U-Boot environment variable during run time. For examples: +fw_storage_interface: + Firmware storage interface, it can be "mmc", "usb", "sata" or "ubi". storage_interface: - Storage interface, it can be "mmc", "usb", "sata" or "ubi". + Storage interface, it can be "mmc", "usb", "sata" or "ubi". This acts + as a fallback if fw_storage_interface is not set. fw_dev_part: Block device number and its partition, it can be "0:1". fw_ubi_mtdpart: diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c index 1ffc199ba1..3798dab5b6 100644 --- a/drivers/misc/fs_loader.c +++ b/drivers/misc/fs_loader.c @@ -153,7 +153,10 @@ static int fw_get_filesystem_firmware(struct udevice *dev) char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume; int ret; - storage_interface = env_get("storage_interface"); + storage_interface = env_get("fw_storage_interface"); + if (!storage_interface) + storage_interface = env_get("storage_interface"); + dev_part = env_get("fw_dev_part"); ubi_mtdpart = env_get("fw_ubi_mtdpart"); ubi_volume = env_get("fw_ubi_volume"); -- 2.34.1
Re: [PATCH v1 4/7] cmd: avb: rework prints
Hi Mattijs, On Thu, Feb 8, 2024 at 3:00 PM Mattijs Korpershoek wrote: > > Hi Igor, > > Thank you for the patch. > > On mar., févr. 06, 2024 at 23:31, Igor Opaniuk > wrote: > > > From: Igor Opaniuk > > > > Introduce AVB_OPS_CHECK macro for checking AvbOps before using > > it to avoid code duplication. > > Simplify and add more context for prints where it's needed. > > > > Signed-off-by: Igor Opaniuk > > --- > > > > cmd/avb.c | 156 -- > > 1 file changed, 80 insertions(+), 76 deletions(-) > > > > diff --git a/cmd/avb.c b/cmd/avb.c > > index ce8b63873f2..ae0012c0e79 100644 > > --- a/cmd/avb.c > > +++ b/cmd/avb.c > > @@ -11,6 +11,14 @@ > > #include > > > > #define AVB_BOOTARGS "avb_bootargs" > > + > > +#define AVB_OPS_CHECK(avb_ops) do { \ > > + if (!(avb_ops)) { \ > > + printf("AVB is not initialized, please run 'avb init > > '\n"); \ > > + return CMD_RET_FAILURE; \ > > + } \ > > +} while (false) > > + > checkpatch.pl --u-boot seems to complain about this: > WARNING: Macros with flow control statements should be avoided > #25: FILE: cmd/avb.c:15: > > This seems documented in the kernel coding style as well. > https://www.kernel.org/doc/html/latest/process/coding-style.html#macros-enums-and-rtl > > I'd argue that in this case, it's not better or worse in terme of > readability but i'd prefer to stick to the rules in this case. > > The error handling (using ret) and the better prints seem fine though. > Could we drop the AVB_OPS_CHECK macro for v2? Yeah, I was just trying to find a tradeoff between readability/code duplication and coding style. Will drop it in v2. Thanks! > > > static struct AvbOps *avb_ops; > > > > int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const > > argv[]) > > @@ -28,8 +36,10 @@ int do_avb_init(struct cmd_tbl *cmdtp, int flag, int > > argc, char *const argv[]) > > avb_ops = avb_ops_alloc(mmc_dev); > > if (avb_ops) > > return CMD_RET_SUCCESS; > > + else > > + printf("Can't allocate AvbOps"); > > > > - printf("Failed to initialize avb2\n"); > > + printf("Failed to initialize AVB\n"); > > > > return CMD_RET_FAILURE; > > } > > @@ -41,11 +51,9 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, > > int argc, > > s64 offset; > > size_t bytes, bytes_read = 0; > > void *buffer; > > + int ret; > > > > - if (!avb_ops) { > > - printf("AVB 2.0 is not initialized, please run 'avb init'\n"); > > - return CMD_RET_USAGE; > > - } > > + AVB_OPS_CHECK(avb_ops); > > > > if (argc != 5) > > return CMD_RET_USAGE; > > @@ -55,14 +63,15 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, > > int argc, > > bytes = hextoul(argv[3], NULL); > > buffer = (void *)hextoul(argv[4], NULL); > > > > - if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, > > - buffer, _read) == > > - AVB_IO_RESULT_OK) { > > + ret = avb_ops->read_from_partition(avb_ops, part, offset, > > +bytes, buffer, _read); > > + if (ret == AVB_IO_RESULT_OK) { > > printf("Read %zu bytes\n", bytes_read); > > return CMD_RET_SUCCESS; > > } > > > > - printf("Failed to read from partition\n"); > > + printf("Failed to read from partition '%s', err = %d\n", > > +part, ret); > > > > return CMD_RET_FAILURE; > > } > > @@ -74,11 +83,9 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int > > flag, int argc, > > s64 offset; > > size_t bytes, bytes_read = 0; > > char *buffer; > > + int ret; > > > > - if (!avb_ops) { > > - printf("AVB 2.0 is not initialized, please run 'avb init'\n"); > > - return CMD_RET_USAGE; > > - } > > + AVB_OPS_CHECK(avb_ops); > > > > if (argc != 4) > > return CMD_RET_USAGE; > > @@ -94,8 +101,9 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int > > flag, int argc, > > } > > memset(buffer, 0, bytes); > > > > - if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, buffer, > > - _read) == AVB_IO_RESULT_OK) { > > + ret = avb_ops->read_from_partition(avb_ops, part, offset, > > +bytes, buffer, _read); > > + if (ret == AVB_IO_RESULT_OK) { > > printf("Requested %zu, read %zu bytes\n", bytes, bytes_read); > > printf("Data: "); > > for (int i = 0; i < bytes_read; i++) > > @@ -107,7 +115,8 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int > > flag, int argc, > > return CMD_RET_SUCCESS; > > } > > > > - printf("Failed to read from partition\n"); > > + printf("Failed to read from partition '%s', err = %d\n", > > +
[PATCH v2 20/20] rockchip: ringneck_px30: update website link
From: Quentin Schulz The original link returns a custom 404, so let's point to a link that works today instead. Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- board/theobroma-systems/ringneck_px30/MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/theobroma-systems/ringneck_px30/MAINTAINERS b/board/theobroma-systems/ringneck_px30/MAINTAINERS index 601830fe45b..97baf334d02 100644 --- a/board/theobroma-systems/ringneck_px30/MAINTAINERS +++ b/board/theobroma-systems/ringneck_px30/MAINTAINERS @@ -8,4 +8,4 @@ F: doc/board/theobroma-systems/ F: include/configs/ringneck_px30.h F: arch/arm/dts/px30-ringneck* F: configs/ringneck-px30_defconfig -W: https://www.theobroma-systems.com/px30-uq7#tech-spec +W: https://theobroma-systems.com/product/ringneck-som-px30-uq7/ -- 2.43.0
Re: [PATCH v1 7/7] doc: android: avb: add slot_suffix param details
Hi Mattijs, On Thu, Feb 8, 2024 at 3:12 PM Mattijs Korpershoek wrote: > > Hi Igor, > > Thank you for the patch. > > On mar., févr. 06, 2024 at 23:31, Igor Opaniuk > wrote: > > > From: Igor Opaniuk > > > > Add info about slot_suffix param for avb verify. > > > > Signed-off-by: Igor Opaniuk > > --- > > > > doc/android/avb2.rst | 8 +--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/doc/android/avb2.rst b/doc/android/avb2.rst > > index a072119574f..c0b2bedb831 100644 > > --- a/doc/android/avb2.rst > > +++ b/doc/android/avb2.rst > > @@ -39,15 +39,17 @@ Provides CLI interface to invoke AVB 2.0 verification + > > misc. commands for > > different testing purposes:: > > > > avb init - initialize avb 2.0 for > > -avb verify - run verification process using hash data from vbmeta > > structure > > +avb verify [slot_suffix] - run verification process using hash data > > +from vbmeta structure. Provide [slot_suffix] if vbmeta partition > > +is slotted > > Any particular reason for this to not be exactly the wording as in cmd/avb.c? > > "avb verify [slot_suffix] - run verification process using hash > data\n" > "from vbmeta structure\n" > "[slot_suffix] - _a, _b, etc (if vbmeta partition is slotted)\n" > > It looks good, but I think it would be better if both are the same for > consistency, since both texts are user facing. Will fix it in v2, thanks! > > > avb read_rb - read rollback index at location > > avb write_rb - write rollback index to > > avb is_unlocked - returns unlock status of the device > > avb get_uuid - read and print uuid of partition > > avb read_part - read bytes from > > -partition to buffer > > +partition to buffer > > avb write_part - write bytes to > > - by using data from > > + by using data from > > > > Partitions tampering (example) > > -- > > -- > > 2.34.1 -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk Senior Software Engineer, Embedded & Security E: igor.opan...@foundries.io W: www.foundries.io
[PATCH v2 19/20] rockchip: ringneck_px30: migrate README to doc/board in rST format
From: Quentin Schulz This migrates the plaintext README in board/theobroma-systems/ringneck_px30 to doc/board/theobroma-systems and while doing so, update the instructions and rewrite it in rST. Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- board/theobroma-systems/ringneck_px30/MAINTAINERS | 1 + board/theobroma-systems/ringneck_px30/README | 70 + doc/board/theobroma-systems/index.rst | 1 + doc/board/theobroma-systems/ringneck_px30.rst | 95 +++ 4 files changed, 98 insertions(+), 69 deletions(-) diff --git a/board/theobroma-systems/ringneck_px30/MAINTAINERS b/board/theobroma-systems/ringneck_px30/MAINTAINERS index 06e1beaab14..601830fe45b 100644 --- a/board/theobroma-systems/ringneck_px30/MAINTAINERS +++ b/board/theobroma-systems/ringneck_px30/MAINTAINERS @@ -4,6 +4,7 @@ M: Klaus Goger S: Maintained F: board/theobroma-systems/ringneck_px30 F: board/theobroma-systems/common +F: doc/board/theobroma-systems/ F: include/configs/ringneck_px30.h F: arch/arm/dts/px30-ringneck* F: configs/ringneck-px30_defconfig diff --git a/board/theobroma-systems/ringneck_px30/README b/board/theobroma-systems/ringneck_px30/README index e756b3a8ffc..915baf4a9a0 100644 --- a/board/theobroma-systems/ringneck_px30/README +++ b/board/theobroma-systems/ringneck_px30/README @@ -1,69 +1 @@ -Introduction - - -The PX30-uQ7 (Ringneck) SoM is a µQseven-compatible (40mmx70mm, MXM-230 -connector) system-on-module from Theobroma Systems[1], featuring the -Rockchip PX30. - -It provides the following feature set: - * up to 4GB DDR4 - * up to 128GB on-module eMMC (with 8-bit 1.8V interface) - * SD card (on a baseboard) via edge connector - * Fast Ethernet with on-module TI DP83825I PHY - * MIPI-DSI/LVDS - * MIPI-CSI - * USB -- 1x USB 2.0 dual-role -- 3x USB 2.0 host - * on-module companion controller (STM32 Cortex-M0 or ATtiny), implementing: -- low-power RTC functionality (ISL1208 emulation) -- fan controller (AMC6821 emulation) -- USB<->CAN bridge controller (STM32 only) - * on-module Espressif ESP32 for Bluetooth + 2.4GHz WiFi - * on-module NXP SE05x Secure Element - -Here is the step-by-step to boot to U-Boot on px30. - -Get the Source and build ATF binary -=== - - > git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git - -Compile the ATF -=== - - > cd trusted-firmware-a - > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=px30 bl31 - > cp build/px30/release/bl31/bl31.elf ../u-boot/bl31.elf - -Compile the U-Boot -== - - > cd ../u-boot - > make CROSS_COMPILE=aarch64-linux-gnu- ringneck-px30_defconfig all - -Flash the image -=== - -Copy u-boot-rockchip.bin to offset 32k for SD/eMMC. - -SD-Card - - > dd if=u-boot-rockchip.bin of=/dev/sdb seek=64 - -eMMC - - -rkdeveloptool allows to flash the on-board eMMC via the USB OTG interface with -help of the Rockchip loader binary. - - > git clone https://github.com/rockchip-linux/rkdeveloptool - > cd rkdeveloptool - > autoreconf -i && ./configure && make - > git clone https://github.com/rockchip-linux/rkbin.git - > cd rkbin - > ./tools/boot_merger RKBOOT/PX30MINIALL.ini - > cd .. - > ./rkdeveloptool db rkbin/px30_loader_v1.16.131.bin - > ./rkdeveloptool wl 64 ../u-boot-rockchip.bin +See doc/board/theobroma-systems/ringneck_px30.rst. diff --git a/doc/board/theobroma-systems/index.rst b/doc/board/theobroma-systems/index.rst index 0720128ad52..b4da2616c37 100644 --- a/doc/board/theobroma-systems/index.rst +++ b/doc/board/theobroma-systems/index.rst @@ -8,3 +8,4 @@ Theobroma Systems jaguar_rk3588 puma_rk3399 + ringneck_px30 diff --git a/doc/board/theobroma-systems/ringneck_px30.rst b/doc/board/theobroma-systems/ringneck_px30.rst new file mode 100644 index 000..c16b9ed17ed --- /dev/null +++ b/doc/board/theobroma-systems/ringneck_px30.rst @@ -0,0 +1,95 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +PX30-uQ7 Ringneck += + +The PX30-uQ7 (Ringneck) SoM is a µQseven-compatible (40mmx70mm, MXM-230 +connector) system-on-module from Theobroma Systems, featuring the Rockchip PX30. + +It provides the following feature set: + + * up to 4GB DDR4 + * up to 128GB on-module eMMC (with 8-bit 1.8V interface) + * SD card (on a baseboard) via edge connector + * Fast Ethernet with on-module TI DP83825I PHY + * MIPI-DSI/LVDS + * MIPI-CSI + * USB + +- 1x USB 2.0 dual-role +- 3x USB 2.0 host + + * on-module companion controller (STM32 Cortex-M0 or ATtiny), implementing: + +- low-power RTC functionality (ISL1208 emulation) +- fan controller (AMC6821 emulation) +- USB<->CAN bridge controller (STM32 only) + + * on-module Espressif ESP32 for Bluetooth + 2.4GHz WiFi + * on-module NXP SE05x Secure Element + +Here is the step-by-step to boot to U-Boot on PX30-uQ7 Ringneck from Theobroma +Systems. + +Get the
[PATCH v2 18/20] rockchip: rk3399-puma: migrate README to doc/board in rST format
From: Quentin Schulz This migrates the plaintext README in board/theobroma-systems/puma_rk3399 to doc/board/theobroma-systems and while doing so, update the instructions and rewrite it in rST. Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- board/theobroma-systems/puma_rk3399/MAINTAINERS | 1 + board/theobroma-systems/puma_rk3399/README | 90 + doc/board/theobroma-systems/index.rst | 1 + doc/board/theobroma-systems/puma_rk3399.rst | 126 4 files changed, 129 insertions(+), 89 deletions(-) diff --git a/board/theobroma-systems/puma_rk3399/MAINTAINERS b/board/theobroma-systems/puma_rk3399/MAINTAINERS index 23701b3f0ed..7e84a5be262 100644 --- a/board/theobroma-systems/puma_rk3399/MAINTAINERS +++ b/board/theobroma-systems/puma_rk3399/MAINTAINERS @@ -4,6 +4,7 @@ M: Klaus Goger S: Maintained F: board/theobroma-systems/puma_rk3399 F: board/theobroma-systems/common +F: doc/board/theobroma-systems F: include/configs/puma_rk3399.h F: arch/arm/dts/rk3399-puma* F: configs/puma-rk3399_defconfig diff --git a/board/theobroma-systems/puma_rk3399/README b/board/theobroma-systems/puma_rk3399/README index 649aa3c543d..39c9d618866 100644 --- a/board/theobroma-systems/puma_rk3399/README +++ b/board/theobroma-systems/puma_rk3399/README @@ -1,89 +1 @@ -Introduction - - -The RK3399-Q7 (Puma) is a system-on-module featuring the Rockchip -RK3399 in a Qseven-compatible form-factor. - -RK3399-Q7 features: - * CPU: ARMv8 64bit Big-Little architecture, - * Big: dual-core Cortex-A72 - * Little: quad-core Cortex-A53 - * IRAM: 200KB - * DRAM: 4GB-128MB dual-channel - * eMMC: onboard eMMC - * SD/MMC - * GbE (onboard Micrel KSZ9031) Gigabit ethernet PHY - * USB: - * USB3.0 dual role port - * 2x USB3.0 host, 1x USB2.0 host via onboard USB3.0 hub - * Display: HDMI/eDP/MIPI - * Camera: 2x CSI (one on the edge connector, one on the Q7 specified CSI ZIF) - * NOR Flash: onboard SPI NOR - * Companion Controller: onboard additional Cortex-M0 microcontroller - * RTC - * fan controller - * CAN - -Here is the step-by-step to boot to U-Boot on rk3399. - -Get the Source and build ATF binary -=== - - > git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git - -Compile the ATF -=== - - > cd trusted-firmware-a - > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31 - > cp build/rk3399/release/bl31/bl31.elf ../u-boot/bl31.elf - -Compile the U-Boot -== - - > cd ../u-boot - > make CROSS_COMPILE=aarch64-linux-gnu- puma-rk3399_defconfig all - -Flash the image -=== - -Copy u-boot-rockchip.bin to offset 32k for SD/eMMC. -Copy u-boot-rockchip-spi.bin to offset 0 for NOR-flash. - -SD-Card - - > dd if=u-boot-rockchip.bin of=/dev/sdb seek=64 - -eMMC - - -rkdeveloptool allows to flash the on-board eMMC via the USB OTG interface with -help of the Rockchip loader binary. - - > git clone https://github.com/rockchip-linux/rkdeveloptool - > cd rkdeveloptool - > autoreconf -i && ./configure && make - > git clone https://github.com/rockchip-linux/rkbin.git - > cd rkbin - > ./tools/boot_merger RKBOOT/RK3399MINIALL.ini - > cd .. - > ./rkdeveloptool db rkbin/rk3399_loader_v1.25.126.bin - > ./rkdeveloptool wl 64 ../u-boot-rockchip.bin - -NOR-Flash -- - -rkdeveloptool allows to flash the on-board SPI via the USB OTG interface with -help of the Rockchip loader binary. - - > git clone https://github.com/rockchip-linux/rkdeveloptool - > cd rkdeveloptool - > autoreconf -i && ./configure && make - > git clone https://github.com/rockchip-linux/rkbin.git - > cd rkbin - > ./tools/boot_merger RKBOOT/RK3399MINIALL_SPINOR.ini - > cd .. - > ./rkdeveloptool db rkbin/rk3399_loader_spinor_v1.25.114.bin - > ./rkdeveloptool ef - > ./rkdeveloptool wl 0 ../u-boot-rockchip-spi.bin +See doc/board/theobroma-systems/puma_rk3399.rst. diff --git a/doc/board/theobroma-systems/index.rst b/doc/board/theobroma-systems/index.rst index 945f7a2f976..0720128ad52 100644 --- a/doc/board/theobroma-systems/index.rst +++ b/doc/board/theobroma-systems/index.rst @@ -7,3 +7,4 @@ Theobroma Systems :maxdepth: 2 jaguar_rk3588 + puma_rk3399 diff --git a/doc/board/theobroma-systems/puma_rk3399.rst b/doc/board/theobroma-systems/puma_rk3399.rst new file mode 100644 index 000..5bc6385e451 --- /dev/null +++ b/doc/board/theobroma-systems/puma_rk3399.rst @@ -0,0 +1,126 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +RK3399-Q7 Puma +== + +The RK3399-Q7 (Puma) is a system-on-module featuring the Rockchip +RK3399 in a Qseven-compatible form-factor. + +RK3399-Q7 features: + + * CPU: ARMv8 64bit Big-Little architecture, + + * Big: dual-core Cortex-A72 + * Little:
[PATCH v2 17/20] rockchip: puma-rk3399: MAINTAINERS: use glob for dtses
From: Quentin Schulz There are multiple Device Trees in U-Boot git repo for Puma, so let's make the MAINTAINERS entry match them all. Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- board/theobroma-systems/puma_rk3399/MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/theobroma-systems/puma_rk3399/MAINTAINERS b/board/theobroma-systems/puma_rk3399/MAINTAINERS index 93f570fc4f9..23701b3f0ed 100644 --- a/board/theobroma-systems/puma_rk3399/MAINTAINERS +++ b/board/theobroma-systems/puma_rk3399/MAINTAINERS @@ -5,7 +5,7 @@ S: Maintained F: board/theobroma-systems/puma_rk3399 F: board/theobroma-systems/common F: include/configs/puma_rk3399.h -F: arch/arm/dts/rk3399-puma.dts +F: arch/arm/dts/rk3399-puma* F: configs/puma-rk3399_defconfig W: https://www.theobroma-systems.com/rk3399-q7/tech-specs T: git git://git.theobroma-systems.com/puma-u-boot.git -- 2.43.0
[PATCH v2 16/20] board: rockchip: add Theobroma-Systems RK3588 Jaguar SBC
From: Quentin Schulz JAGUAR is a Single-Board Computer (SBC) based around the rk3588 SoC and is targeting Autonomous Mobile Robots (AMR). It features: * LPDDR4X (up to 16GB) * 1Gbps Ethernet on RJ45 connector (KSZ9031 or KSZ9131) * PCIe 3.0 4-lane on M.2 M-key connector * PCIe 2.1 1-lane on M.2 E-key * USB 2.0 on M.2 E-key * 2x USB3 OTG type-c ports with DP Alt-Mode * USB2 host port * HDMI output * 2x camera connectors, each exposing: * 2-lane MIPI-CSI * 1v2, 1v8, 2v8 power rails * I2C bus * GPIOs * PPS input * CAN * RS485 UART * FAN connector * SD card slot * eMMC (up to 256GB) * RTC backup battery * Companion microcontroller * ISL1208 RTC emulation * AMC6821 PWM emulation * On/off buzzer control * Secure Element * 80-pin Mezzanine connector for daughterboards: * GPIOs * 1Gbps Ethernet * PCIe 2.1 1-lane * 2x 2-lane MIPI-CSI * ADC channel * I2C bus * PWM * UART * SPI * SDIO * CAN * I2S * 1v8, 3v3, 5v0, dc-in (12-24V) power rails The Device Tree comes from next-20240110 Linux kernel. Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3588-jaguar-u-boot.dtsi | 38 + arch/arm/dts/rk3588-jaguar.dts | 803 + arch/arm/mach-rockchip/rk3588/Kconfig | 28 + board/theobroma-systems/jaguar_rk3588/Kconfig | 16 + board/theobroma-systems/jaguar_rk3588/MAINTAINERS | 13 + board/theobroma-systems/jaguar_rk3588/Makefile | 10 + .../jaguar_rk3588/jaguar_rk3588.c | 52 ++ configs/jaguar-rk3588_defconfig| 115 +++ doc/board/index.rst| 1 + doc/board/rockchip/rockchip.rst| 1 + doc/board/theobroma-systems/index.rst | 9 + doc/board/theobroma-systems/jaguar_rk3588.rst | 100 +++ include/configs/jaguar_rk3588.h| 15 + 14 files changed, 1202 insertions(+) diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 3beb8f1b9d4..7c103655e1d 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -193,6 +193,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3588) += \ rk3588-edgeble-neu6a-io.dtb \ rk3588-edgeble-neu6b-io.dtb \ rk3588-evb1-v10.dtb \ + rk3588-jaguar.dtb \ rk3588-nanopc-t6.dtb \ rk3588s-orangepi-5.dtb \ rk3588-orangepi-5-plus.dtb \ diff --git a/arch/arm/dts/rk3588-jaguar-u-boot.dtsi b/arch/arm/dts/rk3588-jaguar-u-boot.dtsi new file mode 100644 index 000..a0207c265c9 --- /dev/null +++ b/arch/arm/dts/rk3588-jaguar-u-boot.dtsi @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2023 Theobroma Systems Design und Consulting GmbH + */ + +#include "rk3588-u-boot.dtsi" +#include +#include +#include +#include + +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", , + }; +}; + +_pwrseq { + bootph-all; +}; + +_reset { + bootph-all; +}; + + { + bootph-all; +}; + + { + bootph-all; +}; + + { + /* U-Boot currently cannot handle anything below HS200 for eMMC on RK3588 */ + /delete-property/ mmc-ddr-1_8v; + /delete-property/ cap-mmc-highspeed; +}; diff --git a/arch/arm/dts/rk3588-jaguar.dts b/arch/arm/dts/rk3588-jaguar.dts new file mode 100644 index 000..4ce70fb75a3 --- /dev/null +++ b/arch/arm/dts/rk3588-jaguar.dts @@ -0,0 +1,803 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2023 Theobroma Systems Design und Consulting GmbH + */ + +/dts-v1/; +#include +#include +#include +#include +#include +#include "rk3588.dtsi" + +/ { + model = "Theobroma Systems RK3588-SBC Jaguar"; + compatible = "tsd,rk3588-jaguar", "rockchip,rk3588"; + + adc-keys { + compatible = "adc-keys"; + io-channels = < 0>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <180>; + poll-interval = <100>; + + /* Can be controlled through SW2 but also GPIO1 on CP2102 on P20 */ + button-bios-disable { + label = "BIOS_DISABLE"; + linux,code = ; + press-threshold-microvolt = <0>; + }; + }; + + aliases { + ethernet0 = + mmc0 = + mmc1 = + rtc0 = _twi; + }; + + chosen { + stdout-path = "serial2:115200n8"; + }; + + /* DCIN is 12-24V but standard is 12V */ + dc_12v: dc-12v-regulator { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1200>; + regulator-max-microvolt = <1200>; + }; + +
[PATCH v2 15/20] rockchip: rk3588: bind MMC controllers in U-Boot proper pre-reloc
From: Quentin Schulz Since commit 9e644284ab81 ("dm: core: Report bootph-pre-ram/sram node as pre-reloc after relocation"), bootph-pre-ram doesn't make U-Boot proper bind the device before relocation. While this is usually not much of an issue, it is when there's a lookup for devices by code running before the relocation. Such is the case of env_init() which calls env_driver_lookup() which calls env_get_location() which is a weak symbol and may call arch_env_get_location() also a weak symbol. Those are two functions that may traverse UCLASS to find some devices (e.g. board/theobroma-systems/common/common.c:arch_env_get_location()). This allows something in the env_init() call stack to be able to use uclasses for SD and eMMC controller on RK3588S/RK3588. This aligns the behavior with what seems to be all SoCs except RK356x family. Additionally, if any other env function (e.g. env_load) were to be used before relocation, this is also required as otherwise it wouldn't be able to find the MMC device(s). Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- arch/arm/dts/rk3588s-u-boot.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/rk3588s-u-boot.dtsi b/arch/arm/dts/rk3588s-u-boot.dtsi index bf3b1ea8a3c..3f194e8ffbd 100644 --- a/arch/arm/dts/rk3588s-u-boot.dtsi +++ b/arch/arm/dts/rk3588s-u-boot.dtsi @@ -187,12 +187,12 @@ }; { - bootph-pre-ram; + bootph-all; u-boot,spl-fifo-mode; }; { - bootph-pre-ram; + bootph-all; u-boot,spl-fifo-mode; }; -- 2.43.0
[PATCH v2 14/20] rockchip: include asm/io.h directly in asm/arch-rockchip/hardware.h
From: Quentin Schulz The different macros use writel which is defined in asm/io.h, so let's include the header so users of hardware.h do not need to include asm/io.h as well. While at it, remove asm/io.h includes wherever asm/arch-rockchip/hardware.h is included already. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- arch/arm/include/asm/arch-rockchip/hardware.h| 2 ++ arch/arm/mach-rockchip/cpu-info.c| 1 - arch/arm/mach-rockchip/px30/px30.c | 1 - arch/arm/mach-rockchip/rk3036/rk3036.c | 1 - arch/arm/mach-rockchip/rk3036/sdram_rk3036.c | 1 - arch/arm/mach-rockchip/rk3066/rk3066.c | 1 - arch/arm/mach-rockchip/rk3188/rk3188.c | 1 - arch/arm/mach-rockchip/rk322x/rk322x.c | 1 - arch/arm/mach-rockchip/rk3288/rk3288.c | 1 - arch/arm/mach-rockchip/rk3308/rk3308.c | 1 - arch/arm/mach-rockchip/rk3328/rk3328.c | 1 - arch/arm/mach-rockchip/rk3368/rk3368.c | 1 - arch/arm/mach-rockchip/rk3399/rk3399.c | 1 - arch/arm/mach-rockchip/rk3568/rk3568.c | 1 - arch/arm/mach-rockchip/rk3588/rk3588.c | 1 - arch/arm/mach-rockchip/rv1126/rv1126.c | 1 - board/elgin/elgin_rv1108/elgin_rv1108.c | 1 - board/firefly/firefly-rk3308/roc_cc_rk3308.c | 1 - board/google/gru/gru.c | 1 - board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c | 1 - board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 1 - board/pine64/rockpro64_rk3399/rockpro64-rk3399.c | 1 - board/rockchip/evb_rv1108/evb_rv1108.c | 1 - board/theobroma-systems/puma_rk3399/puma-rk3399.c| 1 - board/vamrs/rock960_rk3399/rock960-rk3399.c | 1 - drivers/clk/rockchip/clk_pll.c | 1 - drivers/clk/rockchip/clk_px30.c | 1 - drivers/clk/rockchip/clk_rk3036.c| 1 - drivers/clk/rockchip/clk_rk3066.c| 1 - drivers/clk/rockchip/clk_rk3128.c| 1 - drivers/clk/rockchip/clk_rk3188.c| 1 - drivers/clk/rockchip/clk_rk322x.c| 1 - drivers/clk/rockchip/clk_rk3288.c| 1 - drivers/clk/rockchip/clk_rk3308.c| 1 - drivers/clk/rockchip/clk_rk3328.c| 1 - drivers/clk/rockchip/clk_rk3368.c| 1 - drivers/clk/rockchip/clk_rk3399.c| 1 - drivers/clk/rockchip/clk_rk3568.c| 1 - drivers/clk/rockchip/clk_rk3588.c| 1 - drivers/clk/rockchip/clk_rv1108.c| 1 - drivers/clk/rockchip/clk_rv1126.c| 1 - drivers/gpio/rk_gpio.c | 1 - drivers/net/gmac_rockchip.c | 1 - drivers/ram/rockchip/dmc-rk3368.c| 1 - drivers/ram/rockchip/sdram_px30.c| 1 - drivers/ram/rockchip/sdram_rk3066.c | 1 - drivers/ram/rockchip/sdram_rk3188.c | 1 - drivers/ram/rockchip/sdram_rk322x.c | 1 - drivers/ram/rockchip/sdram_rk3288.c | 1 - drivers/ram/rockchip/sdram_rk3399.c | 1 - drivers/ram/rockchip/sdram_rv1126.c | 1 - drivers/rng/rockchip_rng.c | 1 - drivers/sysreset/sysreset_rockchip.c | 1 - drivers/video/rockchip/dw_mipi_dsi_rockchip.c| 1 - drivers/video/rockchip/rk3288_hdmi.c | 1 - drivers/video/rockchip/rk3288_mipi.c | 1 - drivers/video/rockchip/rk3288_vop.c | 1 - drivers/video/rockchip/rk3399_hdmi.c | 1 - drivers/video/rockchip/rk3399_mipi.c | 1 - drivers/video/rockchip/rk3399_vop.c | 1 - drivers/video/rockchip/rk_edp.c | 1 - drivers/video/rockchip/rk_hdmi.c | 1 - drivers/video/rockchip/rk_lvds.c | 1 - 63 files changed, 2 insertions(+), 62 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/hardware.h b/arch/arm/include/asm/arch-rockchip/hardware.h index 62e8bed8f31..e4662a2d52d 100644 --- a/arch/arm/include/asm/arch-rockchip/hardware.h +++ b/arch/arm/include/asm/arch-rockchip/hardware.h @@ -6,6 +6,8 @@ #ifndef _ASM_ARCH_HARDWARE_H #define _ASM_ARCH_HARDWARE_H +#include + #define RK_CLRSETBITS(clr, set)clr) | (set)) << 16) | (set)) #define RK_SETBITS(set)RK_CLRSETBITS(0, set) #define RK_CLRBITS(clr)
[PATCH v2 13/20] rockchip: migrate hardware.h inclusion into appropriate files
From: Quentin Schulz hardware.h is only defining macros which are "wrappers" around writel(). writel() is however not available in hardware.h, needs to be included. This means in order to use the wrappers in hardware.h, one also needs to include the header. However, this cannot be done currently because hardware.h is included in include/configs files, which are implicitly included by every code file by default, which makes the compilation of arch/arm/cpu/armv8/u-boot.lds fail because ALIGN (the ARM assembly directive) got redefined by some of the include files coming from . Because nothing in the include/configs file actually use hardware.h, let's remove the inclusion of hardware.h from the include/configs files and explicitly add it wherever it is required. This prepares for the next commit where will be included in hardware.h. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- arch/arm/mach-rockchip/rk3066/rk3066.c | 1 + drivers/ram/rockchip/dmc-rk3368.c | 1 + drivers/ram/rockchip/sdram_rk3188.c| 1 + drivers/ram/rockchip/sdram_rk3288.c| 1 + include/configs/rk3036_common.h| 1 - include/configs/rk3066_common.h| 1 - include/configs/rk3188_common.h| 1 - include/configs/rk322x_common.h| 1 - include/configs/rk3288_common.h| 1 - include/configs/rk3368_common.h| 1 - include/configs/rv1108_common.h| 1 - 11 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-rockchip/rk3066/rk3066.c b/arch/arm/mach-rockchip/rk3066/rk3066.c index 78c7d894f90..6661b788295 100644 --- a/arch/arm/mach-rockchip/rk3066/rk3066.c +++ b/arch/arm/mach-rockchip/rk3066/rk3066.c @@ -7,6 +7,7 @@ #include #include #include +#include #define GRF_BASE 0x20008000 diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index f36be941a38..74d8aed571c 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c index ad9f936df55..16a68885f1f 100644 --- a/drivers/ram/rockchip/sdram_rk3188.c +++ b/drivers/ram/rockchip/sdram_rk3188.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c index c99118fd612..ec6bdcb2015 100644 --- a/drivers/ram/rockchip/sdram_rk3288.c +++ b/drivers/ram/rockchip/sdram_rk3288.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h index c2abd14e114..0bf9e8b9a2e 100644 --- a/include/configs/rk3036_common.h +++ b/include/configs/rk3036_common.h @@ -5,7 +5,6 @@ #ifndef __CONFIG_RK3036_COMMON_H #define __CONFIG_RK3036_COMMON_H -#include #include "rockchip-common.h" #define CFG_SYS_HZ_CLOCK 2400 diff --git a/include/configs/rk3066_common.h b/include/configs/rk3066_common.h index d70c8f77d48..6a3b6900463 100644 --- a/include/configs/rk3066_common.h +++ b/include/configs/rk3066_common.h @@ -6,7 +6,6 @@ #ifndef __CONFIG_RK3066_COMMON_H #define __CONFIG_RK3066_COMMON_H -#include #include "rockchip-common.h" #define CFG_IRAM_BASE 0x1008 diff --git a/include/configs/rk3188_common.h b/include/configs/rk3188_common.h index a8cee1e44d4..98f2c25f3cf 100644 --- a/include/configs/rk3188_common.h +++ b/include/configs/rk3188_common.h @@ -6,7 +6,6 @@ #ifndef __CONFIG_RK3188_COMMON_H #define __CONFIG_RK3188_COMMON_H -#include #include "rockchip-common.h" #define CFG_IRAM_BASE 0x1008 diff --git a/include/configs/rk322x_common.h b/include/configs/rk322x_common.h index 15f77df3e17..bab4ca015f7 100644 --- a/include/configs/rk322x_common.h +++ b/include/configs/rk322x_common.h @@ -5,7 +5,6 @@ #ifndef __CONFIG_RK322X_COMMON_H #define __CONFIG_RK322X_COMMON_H -#include #include "rockchip-common.h" #define CFG_SYS_HZ_CLOCK 2400 diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h index 3063076a97a..0c449e31099 100644 --- a/include/configs/rk3288_common.h +++ b/include/configs/rk3288_common.h @@ -6,7 +6,6 @@ #ifndef __CONFIG_RK3288_COMMON_H #define __CONFIG_RK3288_COMMON_H -#include #include "rockchip-common.h" #define CFG_SYS_HZ_CLOCK 2400 diff --git a/include/configs/rk3368_common.h b/include/configs/rk3368_common.h index ccb5369b901..d488f8d477a 100644 --- a/include/configs/rk3368_common.h +++ b/include/configs/rk3368_common.h @@ -8,7 +8,6 @@ #include "rockchip-common.h" -#include #include #define CFG_SYS_SDRAM_BASE 0 diff --git a/include/configs/rv1108_common.h b/include/configs/rv1108_common.h index 3bf70a0e0ae..ff28236a21d 100644 ---
[PATCH v2 12/20] rockchip: rk3588: add constants for some register address spaces
From: Quentin Schulz It's one thing to have the register mapped via a well-defined struct but it's another to be able to make use of it. For that to happen, one needs to cast the physical address memory of the beginning of the register address space with the struct. Since this cannot change, let's hardcode it in the include files so that users do not need to duplicate this line of code in their own implementation. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- arch/arm/include/asm/arch-rockchip/cru_rk3588.h | 2 ++ arch/arm/include/asm/arch-rockchip/ioc_rk3588.h | 6 ++ arch/arm/mach-rockchip/rk3588/rk3588.c | 4 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3588.h b/arch/arm/include/asm/arch-rockchip/cru_rk3588.h index 7f4a9085392..a4507e5fdd7 100644 --- a/arch/arm/include/asm/arch-rockchip/cru_rk3588.h +++ b/arch/arm/include/asm/arch-rockchip/cru_rk3588.h @@ -63,6 +63,8 @@ struct rk3588_pll { unsigned int reserved0[3]; }; +#define CRU_BASE 0xfd7c + struct rk3588_cru { struct rk3588_pll pll[18]; unsigned int reserved0[16];/* Address Offset: 0x0240 */ diff --git a/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h b/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h index 5a656f850c7..7ad98466c39 100644 --- a/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h +++ b/arch/arm/include/asm/arch-rockchip/ioc_rk3588.h @@ -5,6 +5,8 @@ #ifndef _ASM_ARCH_IOC_RK3588_H #define _ASM_ARCH_IOC_RK3588_H +#define BUS_IOC_BASE 0xfd5f8000 + struct rk3588_bus_ioc { unsigned int reserved[3]; /* Address Offset: 0x */ unsigned int gpio0b_iomux_sel_h; /* Address Offset: 0x000C */ @@ -48,6 +50,8 @@ struct rk3588_bus_ioc { check_member(rk3588_bus_ioc, gpio4d_iomux_sel_h, 0x009C); +#define PMU1_IOC_BASE 0xfd5f + struct rk3588_pmu1_ioc { unsigned int gpio0a_iomux_sel_l; /* Address Offset: 0x */ unsigned int gpio0a_iomux_sel_h; /* Address Offset: 0x0004 */ @@ -70,6 +74,8 @@ struct rk3588_pmu1_ioc { check_member(rk3588_pmu1_ioc, xin_con, 0x0040); +#define PMU2_IOC_BASE 0xfd5f4000 + struct rk3588_pmu2_ioc { unsigned int gpio0b_iomux_sel_h; /* Address Offset: 0x */ unsigned int gpio0c_iomux_sel_l; /* Address Offset: 0x0004 */ diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c index c5eeda9d751..53ee9f1cebc 100644 --- a/arch/arm/mach-rockchip/rk3588/rk3588.c +++ b/arch/arm/mach-rockchip/rk3588/rk3588.c @@ -26,10 +26,6 @@ #define FW_SYSM_MST26_REG 0xa8 #define FW_SYSM_MST27_REG 0xac -#define PMU1_IOC_BASE 0xfd5f -#define PMU2_IOC_BASE 0xfd5f4000 - -#define BUS_IOC_BASE 0xfd5f8000 #define BUS_IOC_GPIO2A_IOMUX_SEL_L 0x40 #define BUS_IOC_GPIO2B_IOMUX_SEL_L 0x48 #define BUS_IOC_GPIO2D_IOMUX_SEL_L 0x58 -- 2.43.0
[PATCH v2 11/20] rockchip: rk3588: fix non-working SD controller if booting from other media
From: Quentin Schulz Rockchip SoCs have some jtag/sdmmc autoswitching that simply doesn't work really well.[00] The Linux kernel disables it for all SoCs[01], so U-Boot needs to do the same in order to fix issues related to SD card on RK3588. This autoswitching is enabled (by default) via the force_jtag bitfield in SYS_GRF_SOC_CON6 in the TRM part1. The conditions to enter forced JTAG mode are the following: - force_jtag is 1 - GPIO4_D2 is muxed for SDMMC function - GPIO3_D3 is muxed for SDMMC function - SDMMC_DET is inactive SDMMC_DET may be put in the inactive mode by HW design (e.g. because the detection pin is unused (e.g. card-detect-less designs), or another GPIO is used instead, and SDMMC_DET is pulled-low by default). For some reason, when booting from SD card, everything's fine. But when we don't boot from SD card, U-Boot needs to set it up correctly to allow accessing SD cards, at the very least for RK3588-Jaguar (card-detect-less design with SDMMC_DET pulled-low in HW). Therefore, let's disable the JTAG mode for the SDMMC pins so that the SD controller can be used either as a fallback mechanism to find U-Boot proper when the boot medium used to load TPL/SPL cannot find U-Boot proper, or to be used in U-Boot CLI. Note that soc_con[0] is reserved. But considering that it's way more user-friendly to access soc_con1 from the TRM with soc_con[1] than soc_con[0], and that soc_con0 would actually be located at 4 bytes before soc_con1, let's just make soc_con0 part of the soc_con array. [00] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c9b75d51c940c25587a2ad72ec7ec60490abfb6c [01] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/soc/rockchip/grf.c Cc: Quentin Schulz Signed-off-by: Quentin Schulz --- arch/arm/include/asm/arch-rockchip/grf_rk3588.h | 24 arch/arm/mach-rockchip/rk3588/rk3588.c | 7 +++ 2 files changed, 31 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk3588.h b/arch/arm/include/asm/arch-rockchip/grf_rk3588.h index e0694068bb1..f0ecff97f0b 100644 --- a/arch/arm/include/asm/arch-rockchip/grf_rk3588.h +++ b/arch/arm/include/asm/arch-rockchip/grf_rk3588.h @@ -32,4 +32,28 @@ struct rk3588_pmu1grf { check_member(rk3588_pmu1grf, sd_detect_cnt, 0x03b0); +#define SYS_GRF_BASE 0xfd58c000 + +struct rk3588_sysgrf { + unsigned int wdt_con0; + unsigned int reserved0[(0x0010 - 0x) / 4 - 1]; + unsigned int uart_con[2]; + unsigned int reserved1[(0x00c0 - 0x0014) / 4 - 1]; + unsigned int gic_con0; + unsigned int reserved2[(0x0200 - 0x00c0) / 4 - 1]; + unsigned int memcfg_con[32]; + unsigned int reserved3[(0x0300 - 0x027c) / 4 - 1]; + /* soc_con0 is reserved */ + unsigned int soc_con[14]; + unsigned int reserved4[(0x0380 - 0x0334) / 4 - 1]; + unsigned int soc_status[4]; + unsigned int reserved5[(0x0500 - 0x038c) / 4 - 1]; + unsigned int otp_key08; + unsigned int otp_key0d; + unsigned int otp_key0e; + unsigned int reserved6[(0x0600 - 0x0508) / 4 - 1]; + unsigned int chip_id; +}; + +check_member(rk3588_sysgrf, chip_id, 0x0600); #endif /*__SOC_ROCKCHIP_RK3588_GRF_H__ */ diff --git a/arch/arm/mach-rockchip/rk3588/rk3588.c b/arch/arm/mach-rockchip/rk3588/rk3588.c index 38e95a6e2b2..c5eeda9d751 100644 --- a/arch/arm/mach-rockchip/rk3588/rk3588.c +++ b/arch/arm/mach-rockchip/rk3588/rk3588.c @@ -11,6 +11,7 @@ #include #include #include +#include #define FIREWALL_DDR_BASE 0xfe03 #define FW_DDR_MST5_REG0x54 @@ -35,6 +36,8 @@ #define BUS_IOC_GPIO2D_IOMUX_SEL_H 0x5c #define BUS_IOC_GPIO3A_IOMUX_SEL_L 0x60 +#define SYS_GRF_FORCE_JTAG BIT(14) + /** * Boot-device identifiers used by the BROM on RK3588 when device is booted * from SPI flash. IOMUX used for SPI flash affect the value used by the BROM @@ -134,6 +137,7 @@ void rockchip_stimer_init(void) int arch_cpu_init(void) { #ifdef CONFIG_SPL_BUILD + static struct rk3588_sysgrf * const sys_grf = (void *)SYS_GRF_BASE; int secure_reg; /* Set the SDMMC eMMC crypto_ns FSPI access secure area */ @@ -168,6 +172,9 @@ int arch_cpu_init(void) secure_reg = readl(FIREWALL_SYSMEM_BASE + FW_SYSM_MST27_REG); secure_reg &= 0x; writel(secure_reg, FIREWALL_SYSMEM_BASE + FW_SYSM_MST27_REG); + + /* Disable JTAG exposed on SDMMC */ + rk_clrreg(_grf->soc_con[6], SYS_GRF_FORCE_JTAG); #endif return 0; -- 2.43.0
[PATCH v2 10/20] rockchip: transform rockchip_capsule_update_board_setup into a weak function symbol
From: Quentin Schulz There's only one user of rockchip_capsule_update_board_setup, which is in board.c, and only one board defines it, so instead of having a header only for one function symbol, let's just use a weak symbol instead. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- arch/arm/include/asm/arch-rockchip/misc.h | 9 - arch/arm/mach-rockchip/board.c| 5 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/misc.h b/arch/arm/include/asm/arch-rockchip/misc.h deleted file mode 100644 index ef37ff1661a..000 --- a/arch/arm/include/asm/arch-rockchip/misc.h +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * RK3399: Architecture common definitions - * - * Copyright (C) 2019 Collabora Inc - https://www.collabora.com/ - * Rohan Garg - */ - -void rockchip_capsule_update_board_setup(void); diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 80b4514852f..4f666aee706 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION) @@ -148,6 +147,10 @@ void set_dfu_alt_info(char *interface, char *devstr) env_set("dfu_alt_info", buf); } +__weak void rockchip_capsule_update_board_setup(void) +{ +} + static void gpt_capsule_update_setup(void) { int p, i, ret; -- 2.43.0
[PATCH v2 09/20] rockchip: merge misc.c into board.c
From: Quentin Schulz 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 Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- arch/arm/include/asm/arch-rockchip/misc.h | 5 -- arch/arm/mach-rockchip/Makefile | 1 - arch/arm/mach-rockchip/board.c| 125 +++ arch/arm/mach-rockchip/misc.c | 135 -- 4 files changed, 125 insertions(+), 141 deletions(-) diff --git a/arch/arm/include/asm/arch-rockchip/misc.h b/arch/arm/include/asm/arch-rockchip/misc.h index 4155af8c3b0..ef37ff1661a 100644 --- a/arch/arm/include/asm/arch-rockchip/misc.h +++ b/arch/arm/include/asm/arch-rockchip/misc.h @@ -6,9 +6,4 @@ * Rohan Garg */ -int rockchip_cpuid_from_efuse(const u32 cpuid_offset, - const u32 cpuid_length, - u8 *cpuid); -int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length); -int rockchip_setup_macaddr(void); void rockchip_capsule_update_board_setup(void); diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile index 1dc92066bbf..c07bdaee4c3 100644 --- a/arch/arm/mach-rockchip/Makefile +++ b/arch/arm/mach-rockchip/Makefile @@ -23,7 +23,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) # meaning "turn it off". obj-y += boot_mode.o obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o -obj-$(CONFIG_MISC_INIT_R) += misc.o endif ifeq ($(CONFIG_TPL_BUILD),) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index d5cb59c10fa..80b4514852f 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -1,20 +1,32 @@ // SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2019 Rockchip Electronics Co., Ltd. + * + * Copyright (C) 2019 Collabora Inc - https://www.collabora.com/ + * Rohan Garg + * + * Based on puma-rk3399.c: + * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH */ #include #include #include +#include #include #include #include +#include #include #include #include +#include +#include #include #include #include #include +#include +#include #include #include #include @@ -297,6 +309,119 @@ int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) #endif #ifdef CONFIG_MISC_INIT_R +int rockchip_setup_macaddr(void) +{ +#if CONFIG_IS_ENABLED(HASH) && CONFIG_IS_ENABLED(SHA256) + int ret; + const char *cpuid = env_get("cpuid#"); + u8 hash[SHA256_SUM_LEN]; + int size = sizeof(hash); + u8 mac_addr[6]; + + /* Only generate a MAC address, if none is set in the environment */ + if (env_get("ethaddr")) + return 0; + + if (!cpuid) { + debug("%s: could not retrieve 'cpuid#'\n", __func__); + return -1; + } + + ret = hash_block("sha256", (void *)cpuid, strlen(cpuid), hash, ); + if (ret) { + debug("%s: failed to calculate SHA256\n", __func__); + return -1; + } + + /* Copy 6 bytes of the hash to base the MAC address on */ + memcpy(mac_addr, hash, 6); + + /* Make this a valid MAC address and set it */ + mac_addr[0] &= 0xfe; /* clear multicast bit */ + mac_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ + eth_env_set_enetaddr("ethaddr", mac_addr); + + /* Make a valid MAC address for ethernet1 */ + mac_addr[5] ^= 0x01; + eth_env_set_enetaddr("eth1addr", mac_addr); +#endif + return 0; +} + +int rockchip_cpuid_from_efuse(const u32 cpuid_offset, + const u32 cpuid_length, + u8 *cpuid) +{ +#if IS_ENABLED(CONFIG_ROCKCHIP_EFUSE) || IS_ENABLED(CONFIG_ROCKCHIP_OTP) + struct udevice *dev; + int ret; + + /* retrieve the device */ +#if IS_ENABLED(CONFIG_ROCKCHIP_EFUSE) + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(rockchip_efuse), ); +#elif IS_ENABLED(CONFIG_ROCKCHIP_OTP) + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(rockchip_otp), ); +#endif + if (ret) { + debug("%s: could not find efuse device\n", __func__); + return -1; + } + + /* read the cpu_id range from the efuses */ + ret = misc_read(dev, cpuid_offset, cpuid, cpuid_length); + if (ret < 0) { + debug("%s: reading cpuid from the efuses failed\n", + __func__); + return -1; + } +#endif + return 0; +} + +int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length) +{ + u8 low[cpuid_length / 2], high[cpuid_length / 2]; + char cpuid_str[cpuid_length * 2 + 1]; + u64
[PATCH v2 08/20] rockchip: theobroma-systems: ringneck: migrate to rockchip_early_misc_init_r
From: Quentin Schulz Only setup_boottargets differs from the original misc_init_r from Rockchip mach code, so let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- .../theobroma-systems/ringneck_px30/ringneck-px30.c | 20 +--- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/board/theobroma-systems/ringneck_px30/ringneck-px30.c b/board/theobroma-systems/ringneck_px30/ringneck-px30.c index ff7e414303d..bfebfe5136d 100644 --- a/board/theobroma-systems/ringneck_px30/ringneck-px30.c +++ b/board/theobroma-systems/ringneck_px30/ringneck-px30.c @@ -4,29 +4,11 @@ */ #include -#include #include #include "../common/common.h" -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; - - ret = rockchip_setup_macaddr(); - if (ret) - return ret; - setup_boottargets(); return 0; -- 2.43.0
[PATCH v2 07/20] rockchip: theobroma-systems: puma: migrate to rockchip_early_misc_init_r
From: Quentin Schulz Only setup_iodomain() and setup_boottargets differ from the original misc_init_r from Rockchip mach code, so let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- board/theobroma-systems/puma_rk3399/puma-rk3399.c | 20 +--- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index a82f97b2d54..98a818b135d 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -10,7 +10,6 @@ #include #include #include -#include #include "../common/common.h" static void setup_iodomain(void) @@ -27,25 +26,8 @@ static void setup_iodomain(void) rk_setreg(>io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; - - ret = rockchip_setup_macaddr(); - if (ret) - return ret; - setup_iodomain(); setup_boottargets(); -- 2.43.0
[PATCH v2 06/20] rockchip: pine64: rockpro64: migrate to rockchip_early_misc_init_r
From: Quentin Schulz Only setup_iodomain() differs from the original misc_init_r from Rockchip mach code, so let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- board/pine64/rockpro64_rk3399/rockpro64-rk3399.c | 20 ++-- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c index d79084614f1..d0a694ead1d 100644 --- a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c +++ b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c @@ -11,7 +11,6 @@ #include #include #include -#include #define GRF_IO_VSEL_BT565_SHIFT 0 #define PMUGRF_CON0_VSEL_SHIFT 8 @@ -31,26 +30,11 @@ static void setup_iodomain(void) rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - setup_iodomain(); - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; - - ret = rockchip_setup_macaddr(); - - return ret; + return 0; } #endif -- 2.43.0
[PATCH v2 05/20] rockchip: pine64: pinephone-pro: migrate to rockchip_early_misc_init_r
From: Quentin Schulz Compared to the original misc_init_r from Rockchip mach code, setup_iodomain() is added and rockchip_setup_macaddr() is not called. It is assumed adding rockchip_setup_macaddr() back is fine. Let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip (the side effect being that rockchip_setup_macaddr() is back). Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- .../pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 17 ++--- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c index b6ccbb9c1c4..de75ee329d8 100644 --- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #define GRF_IO_VSEL_BT565_GPIO2AB 1 @@ -56,23 +55,11 @@ static void setup_iodomain(void) rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - setup_iodomain(); - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; + return 0; - return ret; } #endif -- 2.43.0
[PATCH v2 04/20] rockchip: pine64: pinebook-pro: migrate to rockchip_early_misc_init_r
From: Quentin Schulz Compared to the original misc_init_r from Rockchip mach code, setup_iodomain() is added and rockchip_setup_macaddr() is not called. It is assumed adding rockchip_setup_macaddr() back is fine. Let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip (the side effect being that rockchip_setup_macaddr() is back). Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c index 4ad780767ea..2408a367305 100644 --- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c +++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -54,23 +53,10 @@ static void setup_iodomain(void) rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - setup_iodomain(); - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; - - return ret; + return 0; } #endif -- 2.43.0
[PATCH v2 03/20] rockchip: google: gru: migrate to rockchip_early_misc_init_r
From: Quentin Schulz Only setup_iodomain() differs from the original misc_init_r from Rockchip mach code, so let's use rockchip_early_misc_init_r instead of reimplementing the whole misc_init_r from Rockchip. Cc: Quentin Schulz Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- board/google/gru/gru.c | 20 ++-- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c index fbcf845e87d..ecbf702b035 100644 --- a/board/google/gru/gru.c +++ b/board/google/gru/gru.c @@ -11,7 +11,6 @@ #include #include #include -#include #define GRF_IO_VSEL_BT656_SHIFT 0 #define GRF_IO_VSEL_AUDIO_SHIFT 1 @@ -85,24 +84,9 @@ static void setup_iodomain(void) 1 << PMUGRF_CON0_VOL_SHIFT)); } -int misc_init_r(void) +int rockchip_early_misc_init_r(void) { - const u32 cpuid_offset = 0x7; - const u32 cpuid_length = 0x10; - u8 cpuid[cpuid_length]; - int ret; - setup_iodomain(); - ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); - if (ret) - return ret; - - ret = rockchip_cpuid_set(cpuid, cpuid_length); - if (ret) - return ret; - - ret = rockchip_setup_macaddr(); - - return ret; + return 0; } -- 2.43.0
[PATCH v2 00/20] rockchip: add support for Theobroma JAGUAR SBC-RK3588-AMR
This adds all the necessary bits for adding support for Theobroma's new SBC. JAGUAR is a Single-Board Computer (SBC) based around the rk3588 SoC and is targeting Autonomous Mobile Robots (AMR). It features: * LPDDR4X (up to 16GB) * 1Gbps Ethernet on RJ45 connector (KSZ9031 or KSZ9131) * PCIe 3.0 4-lane on M.2 M-key connector * PCIe 2.1 1-lane on M.2 E-key * USB 2.0 on M.2 E-key * 2x USB3 OTG type-c ports with DP Alt-Mode * USB2 host port * HDMI output * 2x camera connectors, each exposing: * 2-lane MIPI-CSI * 1v2, 1v8, 2v8 power rails * I2C bus * GPIOs * PPS input * CAN * RS485 UART * FAN connector * SD card slot * eMMC (up to 256GB) * RTC backup battery * Companion microcontroller * ISL1208 RTC emulation * AMC6821 PWM emulation * On/off buzzer control * Secure Element * 80-pin Mezzanine connector for daughterboards: * GPIOs * 1Gbps Ethernet * PCIe 2.1 1-lane * 2x 2-lane MIPI-CSI * ADC channel * I2C bus * PWM * UART * SPI * SDIO * CAN * I2S * 1v8, 3v3, 5v0, dc-in (12-24V) power rails While at it, do some code cleanup and factoring out for Rockchip SoCs. This also fixes issues with the SDMMC controller on all RK3588 boards being muxed into JTAG automatically and breaking SD card support. This also binds the MMC controllers from RK3588 in U-Boot proper before relocation so that it's available for env_init(), be there any need for it (there's for Theobroma's RK3588 based products), and match all (except the RK356x family) Rockchip SoCs behavior. Special attention should be brought to the rockchip_early_misc_init_r migration for Pinephone Pro and Pinebook Pro since they now also call rockchip_setup_macaddr() which they didn't until now. This also do a few non-code changes for Ringneck PX30 and Puma RK3399. Signed-off-by: Quentin Schulz --- Changes in v2: - added missing dtb Make target in arch/arm/dts/Makefile - added some Rb - reworded some commit logs - fixed typo in pinebook/pinephone commits missing the -pro suffix - added removal of DDR52 and HS mode for eMMC following discussions from https://lore.kernel.org/u-boot/20240204205312.2342868-1-jo...@kwiboo.se/ - migrated plaintext board/theobroma-systems/jaguar_rk3588/README from earlier version to doc/board/theobroma-systems/jaguar_rk3588.rst in rST format - added commit for migration of plaintext board/theobroma-systems/puma_rk3399/README to doc/board/theobroma-systems/puma_rk3399.rst in rST format - added commit for migration of plaintext board/theobroma-systems/ringneck_px30/README to doc/board/theobroma-systems/ringneck_px30.rst in rST format - updated DTS in MAINTAINERS entry for Puma to match all Puma DTSes - updated product URL in ringneck's MAINTAINERS entry to work around HTTP404 - Link to v1: https://lore.kernel.org/r/20240123-jaguar-v1-0-1eec1c349...@theobroma-systems.com --- Quentin Schulz (20): rockchip: avoid out-of-bounds when computing cpuid rockchip: add weak function symbol called at the beginning of misc_init_r rockchip: google: gru: migrate to rockchip_early_misc_init_r rockchip: pine64: pinebook-pro: migrate to rockchip_early_misc_init_r rockchip: pine64: pinephone-pro: migrate to rockchip_early_misc_init_r rockchip: pine64: rockpro64: migrate to rockchip_early_misc_init_r rockchip: theobroma-systems: puma: migrate to rockchip_early_misc_init_r rockchip: theobroma-systems: ringneck: migrate to rockchip_early_misc_init_r rockchip: merge misc.c into board.c rockchip: transform rockchip_capsule_update_board_setup into a weak function symbol rockchip: rk3588: fix non-working SD controller if booting from other media rockchip: rk3588: add constants for some register address spaces rockchip: migrate hardware.h inclusion into appropriate files rockchip: include asm/io.h directly in asm/arch-rockchip/hardware.h rockchip: rk3588: bind MMC controllers in U-Boot proper pre-reloc board: rockchip: add Theobroma-Systems RK3588 Jaguar SBC rockchip: puma-rk3399: MAINTAINERS: use glob for dtses rockchip: rk3399-puma: migrate README to doc/board in rST format rockchip: ringneck_px30: migrate README to doc/board in rST format rockchip: ringneck_px30: update website link arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3588-jaguar-u-boot.dtsi | 38 + arch/arm/dts/rk3588-jaguar.dts | 803 + arch/arm/dts/rk3588s-u-boot.dtsi | 4 +- arch/arm/include/asm/arch-rockchip/cru_rk3588.h| 2 + arch/arm/include/asm/arch-rockchip/grf_rk3588.h| 24 + arch/arm/include/asm/arch-rockchip/hardware.h | 2 + arch/arm/include/asm/arch-rockchip/ioc_rk3588.h| 6 + arch/arm/include/asm/arch-rockchip/misc.h | 14 - arch/arm/mach-rockchip/Makefile| 1 - arch/arm/mach-rockchip/board.c
[PATCH v2 02/20] rockchip: add weak function symbol called at the beginning of misc_init_r
From: Quentin Schulz Most Rockchip boards who override misc_init_r do it only to call another function and keep the rest unchanged. Therefore to allow for less duplication, let's just add a weak function symbol that is called inside misc_init_r. Cc: Quentin Schulz Reviewed-by: Kever Yang Reviewed-by: Dragan Simic Signed-off-by: Quentin Schulz --- arch/arm/mach-rockchip/board.c | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index 2620530e03f..d5cb59c10fa 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -297,6 +297,11 @@ int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) #endif #ifdef CONFIG_MISC_INIT_R +__weak int rockchip_early_misc_init_r(void) +{ + return 0; +} + __weak int misc_init_r(void) { const u32 cpuid_offset = CFG_CPUID_OFFSET; @@ -304,6 +309,10 @@ __weak int misc_init_r(void) u8 cpuid[cpuid_length]; int ret; + ret = rockchip_early_misc_init_r(); + if (ret) + return ret; + ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); if (ret) return ret; -- 2.43.0
[PATCH v2 01/20] rockchip: avoid out-of-bounds when computing cpuid
From: Quentin Schulz 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 Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- arch/arm/mach-rockchip/misc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c index 7d03f0c2b67..15397cff009 100644 --- a/arch/arm/mach-rockchip/misc.c +++ b/arch/arm/mach-rockchip/misc.c @@ -102,7 +102,7 @@ int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length) int i; memset(cpuid_str, 0, sizeof(cpuid_str)); - for (i = 0; i < 16; i++) + for (i = 0; i < cpuid_length; i++) sprintf(_str[i * 2], "%02x", cpuid[i]); debug("cpuid: %s\n", cpuid_str); @@ -111,13 +111,13 @@ int rockchip_cpuid_set(const u8 *cpuid, const u32 cpuid_length) * Mix the cpuid bytes using the same rules as in * ${linux}/drivers/soc/rockchip/rockchip-cpuinfo.c */ - for (i = 0; i < 8; i++) { + for (i = 0; i < cpuid_length / 2; i++) { low[i] = cpuid[1 + (i << 1)]; high[i] = cpuid[i << 1]; } - serialno = crc32_no_comp(0, low, 8); - serialno |= (u64)crc32_no_comp(serialno, high, 8) << 32; + serialno = crc32_no_comp(0, low, cpuid_length / 2); + serialno |= (u64)crc32_no_comp(serialno, high, cpuid_length / 2) << 32; snprintf(serialno_str, sizeof(serialno_str), "%016llx", serialno); oldid = env_get("cpuid#"); -- 2.43.0
[PATCH 2/4] ARM: dts: at91: sama7g54_curiosity: Add initial device tree of the board
Add initial device tree of the SAMA7G54 Curiosity board. Signed-off-by: Mihai Sain --- arch/arm/dts/Makefile | 3 + .../dts/at91-sama7g54_curiosity-u-boot.dtsi | 59 + arch/arm/dts/at91-sama7g54_curiosity.dts | 246 ++ 3 files changed, 308 insertions(+) create mode 100644 arch/arm/dts/at91-sama7g54_curiosity-u-boot.dtsi create mode 100644 arch/arm/dts/at91-sama7g54_curiosity.dts diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 3beb8f1b9d..65b955280a 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1263,6 +1263,9 @@ dtb-$(CONFIG_TARGET_OMAP4_SDP4430) += \ dtb-$(CONFIG_TARGET_SAMA7G5EK) += \ at91-sama7g5ek.dtb +dtb-$(CONFIG_TARGET_SAMA7G54_CURIOSITY) += \ + at91-sama7g54_curiosity.dtb + dtb-$(CONFIG_TARGET_SAMA5D2_PTC_EK) += \ at91-sama5d2_ptc_ek.dtb diff --git a/arch/arm/dts/at91-sama7g54_curiosity-u-boot.dtsi b/arch/arm/dts/at91-sama7g54_curiosity-u-boot.dtsi new file mode 100644 index 00..04d7d9e522 --- /dev/null +++ b/arch/arm/dts/at91-sama7g54_curiosity-u-boot.dtsi @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * at91-sama7g54_curiosity-u-boot.dtsi - Device Tree file for SAMA7G5 SoC u-boot properties. + * + * Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain + * + */ + +/ { + chosen { + bootph-all; + }; +}; + +_rc { + bootph-all; +}; + +_xtal { + bootph-all; +}; + + { + bootph-all; +}; + +_flx3_default { + bootph-all; +}; + +_sdmmc1_default { + bootph-all; +}; + + { + bootph-all; +}; + + { + bootph-all; +}; + + { + bootph-all; +}; + +_rc_osc { + bootph-all; +}; + +_xtal { + bootph-all; +}; + + { + bootph-all; +}; diff --git a/arch/arm/dts/at91-sama7g54_curiosity.dts b/arch/arm/dts/at91-sama7g54_curiosity.dts new file mode 100644 index 00..dfe06bd1f9 --- /dev/null +++ b/arch/arm/dts/at91-sama7g54_curiosity.dts @@ -0,0 +1,246 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * at91-sama7g54_curiosity.dts - Device Tree file for SAMA7G54 CURIOSITY board + * + * Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain + * + */ +/dts-v1/; +#include "sama7g5-pinfunc.h" +#include "sama7g5.dtsi" +#include +#include +#include + +/ { + model = "Microchip SAMA7G54 Curiosity"; + compatible = "microchip,sama7g54_curiosity", "microchip,sama7g5", "microchip,sama7"; + + chosen { + bootargs = "console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait"; + stdout-path = "serial0:115200n8"; + }; + + aliases { + serial0 = + i2c0 = + }; + + clocks { + slow_xtal { + clock-frequency = <32768>; + }; + + main_xtal { + clock-frequency = <2400>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <_led_gpio_default>; + status = "okay"; + + led-red { + label = "red"; + gpios = < PIN_PD13 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led-green { + label = "green"; + gpios = < PIN_PD14 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + led-blue { + label = "blue"; + gpios = < PIN_PB15 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + }; + + memory { + device_type = "memory"; + reg = <0x6000 0x1000>; // 256MB DDR3L-1066 16-bit + }; +}; + + { + pinctrl-names = "default"; + pinctrl-0 = <_nand_default>; + status = "okay"; + + nand_controller: nand-controller { + status = "okay"; + + nand@3 { + reg = <0x3 0x0 0x80>; + atmel,rb = <0>; + nand-bus-width = <8>; + nand-ecc-mode = "hw"; + nand-ecc-strength = <8>; + nand-ecc-step-size = <512>; + nand-on-flash-bbt; + status = "okay"; + }; + }; +}; + + { + pinctrl-names = "default"; + pinctrl-0 = <_qspi1_default>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0x0>; + spi-max-frequency = <1>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + m25p,fast-read; + status = "okay"; + }; +}; + + { +
[PATCH 3/4] board: at91: sama7g54_curiosity: Add initial board support
Add initial support for SAMA7G54 Curiosity board. Hardware: SoC: SAMA7G54D2G SiP 1000 MHz DRAM: DDR3 256 MiB PMIC: MCP16502 Debug: UART3 Flash: QSPI NOR 8 MiB, SLC NAND 512 MiB M.2 slot for wireless Mikrobus connectors x 2 SD-Card connectors x 1 USB 2.0 x 3 Signed-off-by: Mihai Sain --- arch/arm/mach-at91/Kconfig| 10 ++ board/atmel/sama7g54_curiosity/Kconfig| 15 board/atmel/sama7g54_curiosity/MAINTAINERS| 9 + board/atmel/sama7g54_curiosity/Makefile | 7 .../sama7g54_curiosity/sama7g54_curiosity.c | 36 +++ 5 files changed, 77 insertions(+) create mode 100644 board/atmel/sama7g54_curiosity/Kconfig create mode 100644 board/atmel/sama7g54_curiosity/MAINTAINERS create mode 100644 board/atmel/sama7g54_curiosity/Makefile create mode 100644 board/atmel/sama7g54_curiosity/sama7g54_curiosity.c diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index c5fd869272..8a8ac53e4f 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -286,6 +286,15 @@ config TARGET_SAMA7G5EK select BOARD_EARLY_INIT_F select BOARD_LATE_INIT +config TARGET_SAMA7G54_CURIOSITY + bool "SAMA7G54 CURIOSITY board" + select SAMA7G5 + select CPU_V7A + help + The SAMA7G54 Curiosity embeds SAMA7G54D2G SiP (System in Package) + with 2Gbit DDR3-SDRAM, 64Mbit QSPI nor-flash with MAC-address, + 4Gbit SLC nand-flash, MCP16502 PMIC, 2 x Mikrobus connectors, + 1 x SD-Card connector, 1 x M.2 slot, 3 x USB config TARGET_TAURUS bool "Support taurus" @@ -366,6 +375,7 @@ source "board/atmel/at91sam9x5ek/Kconfig" source "board/atmel/sam9x60ek/Kconfig" source "board/atmel/sam9x60_curiosity/Kconfig" source "board/atmel/sama7g5ek/Kconfig" +source "board/atmel/sama7g54_curiosity/Kconfig" source "board/atmel/sama5d2_ptc_ek/Kconfig" source "board/atmel/sama5d2_xplained/Kconfig" source "board/atmel/sama5d27_som1_ek/Kconfig" diff --git a/board/atmel/sama7g54_curiosity/Kconfig b/board/atmel/sama7g54_curiosity/Kconfig new file mode 100644 index 00..3e60d96712 --- /dev/null +++ b/board/atmel/sama7g54_curiosity/Kconfig @@ -0,0 +1,15 @@ +if TARGET_SAMA7G54_CURIOSITY + +config SYS_BOARD + default "sama7g54_curiosity" + +config SYS_VENDOR + default "atmel" + +config SYS_SOC + default "at91" + +config SYS_CONFIG_NAME + default "sama7g54_curiosity" + +endif diff --git a/board/atmel/sama7g54_curiosity/MAINTAINERS b/board/atmel/sama7g54_curiosity/MAINTAINERS new file mode 100644 index 00..b9f1a271c0 --- /dev/null +++ b/board/atmel/sama7g54_curiosity/MAINTAINERS @@ -0,0 +1,9 @@ +SAMA7G54 CURIOSITY BOARD +M: Mihai Sain +S: Maintained +F: board/atmel/sama7g54_curiosity.c +F: include/configs/sama7g54_curiosity.h +F: configs/sama7g54_curiosity_mmc_defconfig +F: configs/sama7g54_curiosity_nandflash_defconfig +F: configs/sama7g54_curiosity_qspiflash_defconfig +F: arch/arm/dts/at91-sama7g54_curiosity* diff --git a/board/atmel/sama7g54_curiosity/Makefile b/board/atmel/sama7g54_curiosity/Makefile new file mode 100644 index 00..bc77655f35 --- /dev/null +++ b/board/atmel/sama7g54_curiosity/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries +# +# Author: Mihai Sain + +obj-y += sama7g54_curiosity.o diff --git a/board/atmel/sama7g54_curiosity/sama7g54_curiosity.c b/board/atmel/sama7g54_curiosity/sama7g54_curiosity.c new file mode 100644 index 00..33cd0903d2 --- /dev/null +++ b/board/atmel/sama7g54_curiosity/sama7g54_curiosity.c @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries + * + * Author: Mihai Sain + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +int board_init(void) +{ + // Address of boot parameters + gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; + + return 0; +} + +int dram_init_banksize(void) +{ + return fdtdec_setup_memory_banksize(); +} + +int dram_init(void) +{ + return fdtdec_setup_mem_size_base(); +} -- 2.43.0
[PATCH 4/4] configs: at91: sama7g54_curiosity: Add initial default configs
Add default configuration for nand-flash to boot the linux kernel. Add default configuration for qspi-flash to boot the linux kernel. Add default configuration for sdcard to boot the linux kernel. Configs are synced with savedefconfig. Signed-off-by: Mihai Sain --- configs/sama7g54_curiosity_mmc_defconfig | 123 ++ .../sama7g54_curiosity_nandflash_defconfig| 122 + .../sama7g54_curiosity_qspiflash_defconfig| 122 + include/configs/sama7g54_curiosity.h | 17 +++ 4 files changed, 384 insertions(+) create mode 100644 configs/sama7g54_curiosity_mmc_defconfig create mode 100644 configs/sama7g54_curiosity_nandflash_defconfig create mode 100644 configs/sama7g54_curiosity_qspiflash_defconfig create mode 100644 include/configs/sama7g54_curiosity.h diff --git a/configs/sama7g54_curiosity_mmc_defconfig b/configs/sama7g54_curiosity_mmc_defconfig new file mode 100644 index 00..0eb0a512fa --- /dev/null +++ b/configs/sama7g54_curiosity_mmc_defconfig @@ -0,0 +1,123 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TEXT_BASE=0x66f0 +CONFIG_SYS_MALLOC_LEN=0x100 +CONFIG_SYS_MALLOC_F_LEN=0x4 +CONFIG_TARGET_SAMA7G54_CURIOSITY=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x60044000 +CONFIG_SF_DEFAULT_SPEED=5000 +CONFIG_ENV_SECT_SIZE=0x1000 +CONFIG_DM_GPIO=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama7g54_curiosity" +CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_RESET=y +CONFIG_SYS_LOAD_ADDR=0x6200 +CONFIG_SYS_MEMTEST_START=0x6000 +CONFIG_SYS_MEMTEST_END=0x6800 +CONFIG_ENV_VARS_UBOOT_CONFIG=y +CONFIG_FIT=y +# CONFIG_BOOTSTD is not set +CONFIG_SYS_BOOTM_LEN=0x200 +CONFIG_NAND_BOOT=y +CONFIG_QSPI_BOOT=y +CONFIG_SD_BOOT=y +CONFIG_BOOTDELAY=3 +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait" +CONFIG_USE_BOOTCOMMAND=y +CONFIG_BOOTCOMMAND="fatload mmc 1:1 0x6100 at91-sama7g54_curiosity.dtb; fatload mmc 1:1 0x6200 zImage; bootz 0x6200 - 0x6100" +CONFIG_LOGLEVEL=6 +CONFIG_BOARD_TYPES=y +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_CPU=y +CONFIG_CMD_BOOTZ=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MEM_SEARCH=y +CONFIG_CMD_MX_CYCLIC=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_STRINGS=y +CONFIG_CMD_CLK=y +CONFIG_CMD_DM=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +# CONFIG_CMD_LOADB is not set +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_LSBLK=y +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_NAND=y +CONFIG_CMD_NAND_TRIMFFS=y +CONFIG_CMD_NAND_LOCK_UNLOCK=y +CONFIG_CMD_NAND_TORTURE=y +CONFIG_CMD_SF_TEST=y +CONFIG_CMD_CAT=y +CONFIG_CMD_XXD=y +CONFIG_CMD_RTC=y +CONFIG_CMD_TIME=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_CMD_MTDPARTS_SPREAD=y +CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y +CONFIG_MTDIDS_DEFAULT="nand0=nand0,nor0=nor0" +CONFIG_MTDPARTS_DEFAULT="mtdparts=nand0:256k(bootstrap-nand)ro,1M(u-boot-nand)ro,256k(env-nand)ro,512k(dtb-nand)ro,6M(kernel-nand)ro,-(rootfs-nand)ro;nor0:256k(bootstrap-nor)ro,1M(u-boot-nor)ro,256k(env-nor)ro,512k(dtb-nor)ro,6M(kernel-nor)ro" +CONFIG_OF_CONTROL=y +# CONFIG_OF_TAG_MIGRATE is not set +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_FAT_DEVICE_AND_PART="1:1" +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_USE_HOSTNAME=y +CONFIG_HOSTNAME="SAMA7G54" +CONFIG_VERSION_VARIABLE=y +# CONFIG_NET is not set +CONFIG_CLK=y +CONFIG_CLK_CCF=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_GENERIC_CLK=y +CONFIG_AT91_SAM9X60_PLL=y +CONFIG_CPU=y +CONFIG_ATMEL_PIO4=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_SYS_I2C_AT91=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_ATMEL_EBI=y +CONFIG_MFD_ATMEL_SMC=y +CONFIG_I2C_EEPROM=y +CONFIG_MICROCHIP_FLEXCOM=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_ATMEL=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_DM_NAND_ATMEL=y +CONFIG_SYS_NAND_ONFI_DETECTION=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPI_FLASH_SST=y +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set +CONFIG_SPI_FLASH_MTD=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_AT91PIO4=y +CONFIG_RESET_AT91=y +CONFIG_DM_RTC=y +CONFIG_RTC_EMULATION=y +CONFIG_DM_SERIAL=y +CONFIG_ATMEL_USART=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_QSPI=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_AT91=y +CONFIG_TIMER=y +CONFIG_MCHP_PIT64B_TIMER=y +CONFIG_FAT_WRITE=y +CONFIG_CMD_DHRYSTONE=y +# CONFIG_EFI_LOADER is not set +CONFIG_PHANDLE_CHECK_SEQ=y diff --git a/configs/sama7g54_curiosity_nandflash_defconfig b/configs/sama7g54_curiosity_nandflash_defconfig new file mode 100644 index 00..331bb8d0fe --- /dev/null +++ b/configs/sama7g54_curiosity_nandflash_defconfig @@ -0,0 +1,122 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TEXT_BASE=0x66f0 +CONFIG_SYS_MALLOC_LEN=0x100 +CONFIG_SYS_MALLOC_F_LEN=0x4 +CONFIG_TARGET_SAMA7G54_CURIOSITY=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x60044000
[PATCH 1/4] ARM: dts: at91: sama7g5: add flexcom 10 node
Add flexcom 10 node for usage on the SAMA7G54 Curiosity board. Signed-off-by: Mihai Sain --- arch/arm/dts/sama7g5.dtsi | 26 ++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/dts/sama7g5.dtsi b/arch/arm/dts/sama7g5.dtsi index 746a5ba347..01e880aabe 100644 --- a/arch/arm/dts/sama7g5.dtsi +++ b/arch/arm/dts/sama7g5.dtsi @@ -871,6 +871,32 @@ }; }; + flx10: flexcom@e282 { + compatible = "atmel,sama5d2-flexcom"; + reg = <0xe282 0x200>; + clocks = < PMC_TYPE_PERIPHERAL 48>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0xe282 0x800>; + status = "disabled"; + + i2c10: i2c@600 { + compatible = "microchip,sama7g5-i2c", "microchip,sam9x60-i2c"; + reg = <0x600 0x200>; + interrupts = ; + #address-cells = <1>; + #size-cells = <0>; + clocks = < PMC_TYPE_PERIPHERAL 48>; + atmel,fifo-size = <32>; + dmas = < AT91_XDMAC_DT_PERID(25)>, + < AT91_XDMAC_DT_PERID(26)>; + dma-names = "rx", "tx"; + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "disabled"; + }; + }; + flx11: flexcom@e2824000 { compatible = "atmel,sama5d2-flexcom"; reg = <0xe2824000 0x200>; -- 2.43.0
[PATCH 0/4] Add initial support for Microchip SAMA7G54 Curiosity board
This patch series adds initial support for Microchip SAMA7G54 Curiosity board. Mihai Sain (4): ARM: dts: at91: sama7g5: add flexcom 10 node ARM: dts: at91: sama7g54_curiosity: Add initial device tree of the board board: at91: sama7g54_curiosity: Add initial board support configs: at91: sama7g54_curiosity: Add initial default configs arch/arm/dts/Makefile | 3 + .../dts/at91-sama7g54_curiosity-u-boot.dtsi | 59 + arch/arm/dts/at91-sama7g54_curiosity.dts | 246 ++ arch/arm/dts/sama7g5.dtsi | 26 ++ arch/arm/mach-at91/Kconfig| 10 + board/atmel/sama7g54_curiosity/Kconfig| 15 ++ board/atmel/sama7g54_curiosity/MAINTAINERS| 9 + board/atmel/sama7g54_curiosity/Makefile | 7 + .../sama7g54_curiosity/sama7g54_curiosity.c | 36 +++ configs/sama7g54_curiosity_mmc_defconfig | 123 + .../sama7g54_curiosity_nandflash_defconfig| 122 + .../sama7g54_curiosity_qspiflash_defconfig| 122 + include/configs/sama7g54_curiosity.h | 17 ++ 13 files changed, 795 insertions(+) create mode 100644 arch/arm/dts/at91-sama7g54_curiosity-u-boot.dtsi create mode 100644 arch/arm/dts/at91-sama7g54_curiosity.dts create mode 100644 board/atmel/sama7g54_curiosity/Kconfig create mode 100644 board/atmel/sama7g54_curiosity/MAINTAINERS create mode 100644 board/atmel/sama7g54_curiosity/Makefile create mode 100644 board/atmel/sama7g54_curiosity/sama7g54_curiosity.c create mode 100644 configs/sama7g54_curiosity_mmc_defconfig create mode 100644 configs/sama7g54_curiosity_nandflash_defconfig create mode 100644 configs/sama7g54_curiosity_qspiflash_defconfig create mode 100644 include/configs/sama7g54_curiosity.h -- 2.43.0
Re: [PATCH v4] misc: fs-loader: Use fw_storage_interface instead of storage_interface
On 08/02/24 5:28 pm, Roger Quadros wrote: > > > On 08/02/2024 07:19, MD Danish Anwar wrote: >> Hi Sean, >> >> On 07/02/24 11:14 pm, Sean Anderson wrote: >>> On 1/30/24 01:26, MD Danish Anwar wrote: The fs-loader driver reads env storage_interface and uses it to load firmware file into memory using the medium set by env. Update the driver to use env fw_storage_interface as this variable is only used to load firmwares. The env storage_interface will act as fallback so that the existing implementations do not break. Also update the FS Loader documentation accordingly. >>> >>> So why do you want to do this? I don't see what the point of renaming the >>> variable is, since you are not e.g. adding any new functionality, and we >>> have to pay for the rename in code size. >>> >> >> I am upstreaming TI's ICSSG driver for u-boot and during code review >> Roger Quadros commented asking to rename this >> variable [1]. I think the motive here was to keep all variables used by >> fs-loader driver with 'fw_' prefix. All other variables had 'fw_' prefix >> except for storage_interface. > > Can you please mention this motive in the Commit message? > Sure Roger, I will resend the patch after updating commit message. >> >> [1] >> https://lore.kernel.org/all/4721f3b9-f823-47f3-b4f3-ed40002af...@kernel.org/ >> >>> --Sean >> > -- Thanks and Regards, Danish
Re: [PATCH v1 6/7] cmd: avb: rework do_avb_verify_part
Hi Igor, Thank you for the patch. On mar., févr. 06, 2024 at 23:31, Igor Opaniuk wrote: > From: Igor Opaniuk > > Use existing str_avb_slot_error() function for obtaining > verification fail reason details. > Take into account device lock state for setting correct > androidboot.verifiedbootstate kernel cmdline parameter. > > Signed-off-by: Igor Opaniuk Reviewed-by: Mattijs Korpershoek Nitpick: the error handling migration could have been part of PATCH 5/7 but it's fine to keep as is. > --- > > cmd/avb.c | 50 +- > 1 file changed, 17 insertions(+), 33 deletions(-) > > diff --git a/cmd/avb.c b/cmd/avb.c > index ae0012c0e79..e5fc202121f 100644 > --- a/cmd/avb.c > +++ b/cmd/avb.c > @@ -239,6 +239,7 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, > const char * const requested_partitions[] = {"boot", NULL}; > AvbSlotVerifyResult slot_result; > AvbSlotVerifyData *out_data; > + enum avb_boot_state boot_state; > char *cmdline; > char *extra_args; > char *slot_suffix = ""; > @@ -273,18 +274,23 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, > AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE, > _data); > > - switch (slot_result) { > - case AVB_SLOT_VERIFY_RESULT_OK: > - /* Until we don't have support of changing unlock states, we > - * assume that we are by default in locked state. > - * So in this case we can boot only when verification is > - * successful; we also supply in cmdline GREEN boot state > - */ > + /* > + * LOCKED devices with custom root of trust setup is not supported > (YELLOW) > + */ > + if (slot_result == AVB_SLOT_VERIFY_RESULT_OK) { > printf("Verification passed successfully\n"); > > - /* export additional bootargs to AVB_BOOTARGS env var */ > + /* > + * ORANGE state indicates that device may be freely modified. > + * Device integrity is left to the user to verify out-of-band. > + */ > + if (unlocked) > + boot_state = AVB_ORANGE; > + else > + boot_state = AVB_GREEN; > > - extra_args = avb_set_state(avb_ops, AVB_GREEN); > + /* export boot state to AVB_BOOTARGS env var */ > + extra_args = avb_set_state(avb_ops, boot_state); > if (extra_args) > cmdline = append_cmd_line(out_data->cmdline, > extra_args); > @@ -294,30 +300,8 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, > env_set(AVB_BOOTARGS, cmdline); > > res = CMD_RET_SUCCESS; > - break; > - case AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: > - printf("Verification failed\n"); > - break; > - case AVB_SLOT_VERIFY_RESULT_ERROR_IO: > - printf("I/O error occurred during verification\n"); > - break; > - case AVB_SLOT_VERIFY_RESULT_ERROR_OOM: > - printf("OOM error occurred during verification\n"); > - break; > - case AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA: > - printf("Corrupted dm-verity metadata detected\n"); > - break; > - case AVB_SLOT_VERIFY_RESULT_ERROR_UNSUPPORTED_VERSION: > - printf("Unsupported version of avbtool was used\n"); > - break; > - case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: > - printf("Rollback index check failed\n"); > - break; > - case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: > - printf("Public key was rejected\n"); > - break; > - default: > - printf("Unknown error occurred\n"); > + } else { > + printf("Verification failed, reason: %s\n", > str_avb_slot_error(slot_result)); > } > > if (out_data) > -- > 2.34.1
Re: [PATCH v4] remoteproc: uclass: Add methods to load firmware to rproc and boot rproc
On 07/02/24 6:27 pm, Anwar, Md Danish wrote: > On 2/7/2024 6:05 PM, Roger Quadros wrote: >> >> >> On 07/02/2024 09:15, MD Danish Anwar wrote: >>> Hi Roger >>> >>> On 06/02/24 7:11 pm, Roger Quadros wrote: On 06/02/2024 07:31, MD Danish Anwar wrote: > > > On 05/02/24 6:07 pm, Roger Quadros wrote: >> >> >> On 05/02/2024 12:20, MD Danish Anwar wrote: >>> >>> >>> On 05/02/24 3:36 pm, Roger Quadros wrote: On 02/02/2024 18:40, Anwar, Md Danish wrote: > Hi Roger, > > On 2/2/2024 4:49 PM, Roger Quadros wrote: >> >> >> On 30/01/2024 08:33, MD Danish Anwar wrote: >>> Add APIs to set a firmware_name to a rproc and boot the rproc with >>> the >>> same firmware. >>> > > > > >> How does caller know what firmware size to set to? >> This should already be private to the rproc as it knows >> how large is its program memory. >> > > Caller is trying to boot the rproc with a firmware binary. Caller > should > know the size of binary that it wants to load to rproc core. Caller > will > specify the binary size to rproc_boot(). Based on the size provided by > caller, rproc_boot() will then allocate that much memory and call > request_firmware_into_buf() with the size and allocated buffer. If the > caller doesn't provide minimum size rproc_load() will fail. Caller only knows the filename. It need not know more details. >>> >>> Caller is trying to load a file of it's choice to a rproc. Caller should >>> know the size of file it is trying to load or atleast the max size that >>> the firmware file could be of. >>> >>> Also see my comment below about rproc_boot() API. > > rproc_load() calls respective driver ops, for example: pru_load(). > pru_load() [1] API checks the required size of firmware to load by > casting the buffer into Elf32_Ehdr and Elf32_Phdr and returns error if > size provided by caller is less than this. > > > if (offset + filesz > size) { > dev_dbg(dev, "truncated fw: need 0x%x avail 0x%zx\n", > offset + filesz, size); > ret = -EINVAL; > break; > } > >>> + * >>> + * Boot a remote processor (i.e. load its firmware, power it on, >>> ...). >>> + * >>> + * This function first loads the firmware set in the uclass pdata >>> of Remote >>> + * processor to a buffer and then loads firmware to the remote >>> processor >>> + * using rproc_load(). >>> + * >>> + * Return: 0 on success, and an appropriate error value otherwise >>> + */ >>> +int rproc_boot(struct udevice *rproc_dev, size_t fw_size); >> >> Was wondering if you need separate API for rproc_set_firmware or we >> can just >> pass firmware name as argument to rproc_boot()? >> > > Technically we can. But when we discussed this approach first in v1, > you > had asked to keep the APIs similar to upstream linux. Upstream linux > has > these two APIs so I kept it that way. If you want I can drop the first > API. Please let me know. Sure you can keep it as it is in Linux, but there, rproc_boot doesn't take fw_size argument. So wondering why you should have it in u-boot. >>> >>> For loading firmware to a rproc core in u-boot, it's first neccassry to >>> load the firmware into buffer and then load that buffer into rproc core >>> using rproc_load() API. Now to load the firmware to a buffer ther is an >>> API request_firmware_into_buf(). This API takes size of firmware as one >>> of it's argument. So in order to call this API from rproc_boot() we need >>> to pass fw_size to rproc_boot() >>> >>> Other u-boot drivers using request_firmware_into_buf() are also passing >>> size of firmware from their driver. >> >> But in your driver you didn't use size of firmware but some 64K >> https://lore.kernel.org/all/20240124064930.1787929-8-danishan...@ti.com/ >> > > Yes, in driver I am hardcoding the size to 64K. That's because I know > the size of ICSSG firmwares are less than 64K. Instead of hardcoding I What if you enable debugging symbols in the firmware file. Won't it exceed 64KB? It is not a good idea to assume any firmware file size as it will eventually break sometime in the future and will be a pain to debug. > can also define macro or provide a config option where we set the size > and the driver will read
[PATCH] configs: khadas-vim3*_android: fix AVB oom error
When booting Android with AVB enabled, an OOM is observed: => avb init ${mmcdev} => avb verify _a ## Android Verified Boot 2.0 version 1.1.0 read_is_device_unlocked not supported yet read_rollback_index not supported yet avb_util.c:182: ERROR: Failed to allocate memory. OOM error occurred during verification A custom malloc length of 128MB is required as documented in commit 285a83b12bdf ("configs: meson64_android: increase SYS_MALLOC_LEN to 128M for AVB") However, this 128M custom malloc length was not ported to Kconfig in commit 7cfbba36e9f8 ("Convert CONFIG_SYS_MALLOC_LEN to Kconfig") Add it back to fix AVB verification on VIM3/VIM3L. Fixes: 7cfbba36e9f8 ("Convert CONFIG_SYS_MALLOC_LEN to Kconfig") Co-developed-by: Guillaume La Roque Signed-off-by: Guillaume La Roque Signed-off-by: Mattijs Korpershoek --- configs/khadas-vim3_android_ab_defconfig | 1 + configs/khadas-vim3_android_defconfig | 1 + configs/khadas-vim3l_android_ab_defconfig | 1 + configs/khadas-vim3l_android_defconfig| 1 + 4 files changed, 4 insertions(+) diff --git a/configs/khadas-vim3_android_ab_defconfig b/configs/khadas-vim3_android_ab_defconfig index b41c2660fff0..ee62fe36d414 100644 --- a/configs/khadas-vim3_android_ab_defconfig +++ b/configs/khadas-vim3_android_ab_defconfig @@ -3,6 +3,7 @@ CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3_android" CONFIG_ARCH_MESON=y CONFIG_TEXT_BASE=0x0100 +CONFIG_SYS_MALLOC_LEN=0x0800 CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000 diff --git a/configs/khadas-vim3_android_defconfig b/configs/khadas-vim3_android_defconfig index 88197f5f5e99..cecbe5061793 100644 --- a/configs/khadas-vim3_android_defconfig +++ b/configs/khadas-vim3_android_defconfig @@ -3,6 +3,7 @@ CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3_android" CONFIG_ARCH_MESON=y CONFIG_TEXT_BASE=0x0100 +CONFIG_SYS_MALLOC_LEN=0x0800 CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000 diff --git a/configs/khadas-vim3l_android_ab_defconfig b/configs/khadas-vim3l_android_ab_defconfig index 3381d2e92701..ec4e0dc72e22 100644 --- a/configs/khadas-vim3l_android_ab_defconfig +++ b/configs/khadas-vim3l_android_ab_defconfig @@ -3,6 +3,7 @@ CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android" CONFIG_ARCH_MESON=y CONFIG_TEXT_BASE=0x0100 +CONFIG_SYS_MALLOC_LEN=0x0800 CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000 diff --git a/configs/khadas-vim3l_android_defconfig b/configs/khadas-vim3l_android_defconfig index 3fa587ef1db5..206f8defca6b 100644 --- a/configs/khadas-vim3l_android_defconfig +++ b/configs/khadas-vim3l_android_defconfig @@ -3,6 +3,7 @@ CONFIG_SYS_BOARD="vim3" CONFIG_SYS_CONFIG_NAME="khadas-vim3l_android" CONFIG_ARCH_MESON=y CONFIG_TEXT_BASE=0x0100 +CONFIG_SYS_MALLOC_LEN=0x0800 CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x2000 --- base-commit: 076529725f16f07a5cb2d5feba25d62b5f5a5872 change-id: 20240209-vim3-avb-malloc-aa3de534d6a0 Best regards, -- Mattijs Korpershoek
Re: [PATCH] xilinx: zynqmp: Add the missing function prototype
On 2/7/24 12:30, Michal Simek wrote: On 2/7/24 09:33, Venkatesh Yadav Abbarapu wrote: Add missing prototype to fix the below sparse warning warning: no previous prototype for 'spl_spi_get_uboot_offs' [-Wmissing-prototypes] Signed-off-by: Venkatesh Yadav Abbarapu --- board/xilinx/zynqmp/zynqmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 9f50090720..ba49eb7be2 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include good. Please send it to upstream. :-) this is already upstreamed. Applied with also Fixes: 2c8a09219cdb ("arm64: zynqmp: Add multiboot support for SPL/SPI offset calculation") Thanks, Michal