From 4d31cb895ee28b760f3913da77b3e2eff41a38cc Mon Sep 17 00:00:00 2001 From: Hiago De Franco Date: Wed, 8 Nov 2023 15:29:15 -0300 Subject: u-boot-toradex: Add patches for fastboot support This commit introduces patches to the defconfig of Apalis/Colibri iMX6, Colibri iMX7 and Colibri iMX6ULL to enable fastboot support and adds a logic to the bootcmd to select SDP or Fastboot based on the configs enabled. Related-to: TEI-1136 Signed-off-by: Hiago De Franco (cherry picked from commit 266bdf4d7b1ce31bcbc35dd92f52ca45c60eadba) --- ...bri-imx6-imx6ull-imx7-defconfig-Enable-fa.patch | 112 +++++++++++++++++ ...s-colibri-imx6-imx6ull-imx7-Add-fastboot-.patch | 133 +++++++++++++++++++++ recipes-bsp/u-boot/u-boot-toradex_2022.07.bb | 2 + 3 files changed, 247 insertions(+) create mode 100644 recipes-bsp/u-boot/u-boot-toradex/0001-apalis-colibri-imx6-imx6ull-imx7-defconfig-Enable-fa.patch create mode 100644 recipes-bsp/u-boot/u-boot-toradex/0002-board-apalis-colibri-imx6-imx6ull-imx7-Add-fastboot-.patch diff --git a/recipes-bsp/u-boot/u-boot-toradex/0001-apalis-colibri-imx6-imx6ull-imx7-defconfig-Enable-fa.patch b/recipes-bsp/u-boot/u-boot-toradex/0001-apalis-colibri-imx6-imx6ull-imx7-defconfig-Enable-fa.patch new file mode 100644 index 0000000..5a5b78b --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-toradex/0001-apalis-colibri-imx6-imx6ull-imx7-defconfig-Enable-fa.patch @@ -0,0 +1,112 @@ +From f52289095544611a0f58050d2890ab9c61d77196 Mon Sep 17 00:00:00 2001 +From: Hiago De Franco +Date: Mon, 30 Oct 2023 15:16:20 -0300 +Subject: [PATCH 1/2] apalis/colibri imx6/imx6ull/imx7: defconfig: Enable + fastboot support + +Add fastboot support for Apalis iMX6, Colibri iMX6, Colibri iMX6ULL and +Colibri iMX7 boards. Remove CONFIG_FASTBOOT_BUF_SIZE from +colibri_imx7_emmc_defconfig to get the default value of 0x7000000 instead +of 0x10000000, to make it consistent with the other boards. + +Upstream-Status: Submitted [https://lore.kernel.org/u-boot/20231109162401.38941-1-hiago.franco@toradex.com/T/#t] + +Signed-off-by: Hiago De Franco +--- + configs/apalis_imx6_defconfig | 3 +++ + configs/colibri-imx6ull-emmc_defconfig | 3 +++ + configs/colibri-imx6ull_defconfig | 3 +++ + configs/colibri_imx6_defconfig | 3 +++ + configs/colibri_imx7_defconfig | 3 +++ + configs/colibri_imx7_emmc_defconfig | 4 ++-- + 6 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig +index ea4ad276e7..13cbbb58bd 100644 +--- a/configs/apalis_imx6_defconfig ++++ b/configs/apalis_imx6_defconfig +@@ -77,6 +77,9 @@ CONFIG_BOUNCE_BUFFER=y + CONFIG_DWC_AHSATA=y + CONFIG_BOOTCOUNT_LIMIT=y + CONFIG_BOOTCOUNT_ENV=y ++CONFIG_USB_FUNCTION_FASTBOOT=y ++CONFIG_FASTBOOT_BUF_ADDR=0x14420000 ++CONFIG_FASTBOOT_UUU_SUPPORT=y + CONFIG_DM_I2C=y + CONFIG_SPL_SYS_I2C_LEGACY=y + CONFIG_SYS_I2C_MXC=y +diff --git a/configs/colibri-imx6ull-emmc_defconfig b/configs/colibri-imx6ull-emmc_defconfig +index eb4b6a79ea..f0d32b3623 100644 +--- a/configs/colibri-imx6ull-emmc_defconfig ++++ b/configs/colibri-imx6ull-emmc_defconfig +@@ -54,6 +54,9 @@ CONFIG_TFTP_TSIZE=y + CONFIG_BOUNCE_BUFFER=y + CONFIG_BOOTCOUNT_LIMIT=y + CONFIG_BOOTCOUNT_ENV=y ++CONFIG_USB_FUNCTION_FASTBOOT=y ++CONFIG_FASTBOOT_BUF_ADDR=0x81100000 ++CONFIG_FASTBOOT_UUU_SUPPORT=y + CONFIG_DM_I2C=y + CONFIG_SYS_I2C_MXC=y + CONFIG_SUPPORT_EMMC_BOOT=y +diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig +index d0825472b2..deba619376 100644 +--- a/configs/colibri-imx6ull_defconfig ++++ b/configs/colibri-imx6ull_defconfig +@@ -64,6 +64,9 @@ CONFIG_BOOTCOUNT_LIMIT=y + CONFIG_BOOTCOUNT_ENV=y + CONFIG_DFU_NAND=y + CONFIG_SYS_DFU_DATA_BUF_SIZE=0x1000000 ++CONFIG_USB_FUNCTION_FASTBOOT=y ++CONFIG_FASTBOOT_BUF_ADDR=0x81100000 ++CONFIG_FASTBOOT_UUU_SUPPORT=y + CONFIG_DM_I2C=y + CONFIG_SYS_I2C_MXC=y + CONFIG_FSL_USDHC=y +diff --git a/configs/colibri_imx6_defconfig b/configs/colibri_imx6_defconfig +index 4f38d5cb48..0b2997198b 100644 +--- a/configs/colibri_imx6_defconfig ++++ b/configs/colibri_imx6_defconfig +@@ -76,6 +76,9 @@ CONFIG_TFTP_BLOCKSIZE=16352 + CONFIG_BOUNCE_BUFFER=y + CONFIG_BOOTCOUNT_LIMIT=y + CONFIG_BOOTCOUNT_ENV=y ++CONFIG_USB_FUNCTION_FASTBOOT=y ++CONFIG_FASTBOOT_BUF_ADDR=0x14420000 ++CONFIG_FASTBOOT_UUU_SUPPORT=y + CONFIG_DM_I2C=y + CONFIG_SPL_SYS_I2C_LEGACY=y + CONFIG_SYS_I2C_MXC=y +diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig +index 973afc1a2b..7532848ca2 100644 +--- a/configs/colibri_imx7_defconfig ++++ b/configs/colibri_imx7_defconfig +@@ -62,6 +62,9 @@ CONFIG_BOUNCE_BUFFER=y + CONFIG_BOOTCOUNT_LIMIT=y + CONFIG_BOOTCOUNT_ENV=y + CONFIG_DFU_NAND=y ++CONFIG_USB_FUNCTION_FASTBOOT=y ++CONFIG_FASTBOOT_BUF_ADDR=0x81100000 ++CONFIG_FASTBOOT_UUU_SUPPORT=y + CONFIG_DM_I2C=y + CONFIG_SYS_I2C_MXC=y + CONFIG_FSL_USDHC=y +diff --git a/configs/colibri_imx7_emmc_defconfig b/configs/colibri_imx7_emmc_defconfig +index 01b1cb8b55..b5485669c6 100644 +--- a/configs/colibri_imx7_emmc_defconfig ++++ b/configs/colibri_imx7_emmc_defconfig +@@ -53,9 +53,9 @@ CONFIG_TFTP_BLOCKSIZE=16352 + CONFIG_BOOTCOUNT_LIMIT=y + CONFIG_BOOTCOUNT_ENV=y + CONFIG_USB_FUNCTION_FASTBOOT=y +-CONFIG_FASTBOOT_BUF_ADDR=0x82000000 +-CONFIG_FASTBOOT_BUF_SIZE=0x10000000 ++CONFIG_FASTBOOT_BUF_ADDR=0x81100000 + CONFIG_FASTBOOT_FLASH=y ++CONFIG_FASTBOOT_UUU_SUPPORT=y + CONFIG_FASTBOOT_FLASH_MMC_DEV=0 + CONFIG_FASTBOOT_CMD_OEM_FORMAT=y + CONFIG_DM_I2C=y +-- +2.42.0 + diff --git a/recipes-bsp/u-boot/u-boot-toradex/0002-board-apalis-colibri-imx6-imx6ull-imx7-Add-fastboot-.patch b/recipes-bsp/u-boot/u-boot-toradex/0002-board-apalis-colibri-imx6-imx6ull-imx7-Add-fastboot-.patch new file mode 100644 index 0000000..d46cbfc --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-toradex/0002-board-apalis-colibri-imx6-imx6ull-imx7-Add-fastboot-.patch @@ -0,0 +1,133 @@ +From c0ee1a5b26f9cddc55c86740fae7b7e658281640 Mon Sep 17 00:00:00 2001 +From: Hiago De Franco +Date: Tue, 7 Nov 2023 09:43:34 -0300 +Subject: [PATCH 2/2] board: apalis/colibri imx6/imx6ull/imx7: Add fastboot + bootcmd support + +This commit adds support for Fastboot boot commands by checking both +CONFIG_CMD_USB_SDP and CONFIG_USB_FUNCTION_FASTBOOT. If either of these +configurations is set, it indicates that the board is in recovery mode +and can use either SDP or Fastboot. + +The default option remains the SDP command, but if +CONFIG_CMD_FASTBOOT is set, it changes to 'fastboot usb 0' as +the boot command. + +Upstream-Status: Submitted [https://lore.kernel.org/u-boot/20231109162401.38941-1-hiago.franco@toradex.com/T/#t] + +Signed-off-by: Hiago De Franco +--- + board/toradex/apalis_imx6/apalis_imx6.c | 13 ++++++++----- + board/toradex/colibri-imx6ull/colibri-imx6ull.c | 13 ++++++++----- + board/toradex/colibri_imx6/colibri_imx6.c | 13 ++++++++----- + board/toradex/colibri_imx7/colibri_imx7.c | 14 +++++++++----- + 4 files changed, 33 insertions(+), 20 deletions(-) + +diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c +index 8d2642f25d..da6b20607d 100644 +--- a/board/toradex/apalis_imx6/apalis_imx6.c ++++ b/board/toradex/apalis_imx6/apalis_imx6.c +@@ -700,13 +700,16 @@ int board_late_init(void) + env_set("board_rev", env_str); + #endif /* CONFIG_BOARD_LATE_INIT */ + +-#ifdef CONFIG_CMD_USB_SDP +- if (is_boot_from_usb()) { +- printf("Serial Downloader recovery mode, using sdp command\n"); ++ if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) { + env_set("bootdelay", "0"); +- env_set("bootcmd", "sdp 0"); ++ if (IS_ENABLED(CONFIG_CMD_USB_SDP)) { ++ printf("Serial Downloader recovery mode, using sdp command\n"); ++ env_set("bootcmd", "sdp 0"); ++ } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) { ++ printf("Fastboot recovery mode, using fastboot command\n"); ++ env_set("bootcmd", "fastboot usb 0"); ++ } + } +-#endif /* CONFIG_CMD_USB_SDP */ + + return 0; + } +diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c +index ba4e0df2c2..982618e248 100644 +--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c ++++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c +@@ -187,13 +187,16 @@ int board_late_init(void) + add_board_boot_modes(board_boot_modes); + #endif + +-#ifdef CONFIG_CMD_USB_SDP +- if (is_boot_from_usb()) { +- printf("Serial Downloader recovery mode, using sdp command\n"); ++ if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) { + env_set("bootdelay", "0"); +- env_set("bootcmd", "sdp 0"); ++ if (IS_ENABLED(CONFIG_CMD_USB_SDP)) { ++ printf("Serial Downloader recovery mode, using sdp command\n"); ++ env_set("bootcmd", "sdp 0"); ++ } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) { ++ printf("Fastboot recovery mode, using fastboot command\n"); ++ env_set("bootcmd", "fastboot usb 0"); ++ } + } +-#endif /* CONFIG_CMD_USB_SDP */ + + #if defined(CONFIG_DM_VIDEO) + setup_lcd(); +diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c +index ab2ab587ff..923999a120 100644 +--- a/board/toradex/colibri_imx6/colibri_imx6.c ++++ b/board/toradex/colibri_imx6/colibri_imx6.c +@@ -620,13 +620,16 @@ int board_late_init(void) + env_set("board_rev", env_str); + #endif + +-#ifdef CONFIG_CMD_USB_SDP +- if (is_boot_from_usb()) { +- printf("Serial Downloader recovery mode, using sdp command\n"); ++ if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) { + env_set("bootdelay", "0"); +- env_set("bootcmd", "sdp 0"); ++ if (IS_ENABLED(CONFIG_CMD_USB_SDP)) { ++ printf("Serial Downloader recovery mode, using sdp command\n"); ++ env_set("bootcmd", "sdp 0"); ++ } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) { ++ printf("Fastboot recovery mode, using fastboot command\n"); ++ env_set("bootcmd", "fastboot usb 0"); ++ } + } +-#endif /* CONFIG_CMD_USB_SDP */ + + return 0; + } +diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c +index 53c0b44152..df03cf7cf3 100644 +--- a/board/toradex/colibri_imx7/colibri_imx7.c ++++ b/board/toradex/colibri_imx7/colibri_imx7.c +@@ -357,13 +357,17 @@ int board_late_init(void) + setup_lcd(); + #endif + +-#if defined(CONFIG_CMD_USB_SDP) +- if (is_boot_from_usb()) { +- printf("Serial Downloader recovery mode, using sdp command\n"); ++ if (IS_ENABLED(CONFIG_USB) && is_boot_from_usb()) { + env_set("bootdelay", "0"); +- env_set("bootcmd", "sdp 0"); ++ if (IS_ENABLED(CONFIG_CMD_USB_SDP)) { ++ printf("Serial Downloader recovery mode, using sdp command\n"); ++ env_set("bootcmd", "sdp 0"); ++ } else if (IS_ENABLED(CONFIG_CMD_FASTBOOT)) { ++ printf("Fastboot recovery mode, using fastboot command\n"); ++ env_set("bootcmd", "fastboot usb 0"); ++ } + } +-#endif ++ + if (is_emmc) + env_set("variant", "-emmc"); + else +-- +2.42.0 + diff --git a/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb b/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb index c1f091e..33cddc5 100644 --- a/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb +++ b/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb @@ -25,4 +25,6 @@ TDX_PATCHES = " \ file://0001-arm-imx-add-u-boot-nand.imx-to-boot-from-NAND-withou.patch \ file://0001-arm-mach-imx-Makefile-Extend-u-boot-nand.imx-padding.patch \ file://0001-arm-dts-Makefile-Prevent-build-errors-from-other-imx.patch \ + file://0001-apalis-colibri-imx6-imx6ull-imx7-defconfig-Enable-fa.patch \ + file://0002-board-apalis-colibri-imx6-imx6ull-imx7-Add-fastboot-.patch \ " -- cgit v1.2.3