[U-Boot] [PATCH 0/4] am57xx: Add fastboot support

This patch series adds fastboot support for AM57x EVM boards.
As AM57x EVM USB controller index is 1 (as opposed to regular 0), some changes had to be done to deal with this.
Sam Protsenko (4): fastboot: Add CONFIG_FASTBOOT_USB_DEV option ti_omap5_common: Respect USB controller number in fastboot configs: am57xx: Enable download gadget configs: am57xx: Enable fastboot
cmd/fastboot/Kconfig | 8 ++++++++ configs/am57xx_evm_defconfig | 18 ++++++++++++++++++ configs/am57xx_evm_nodt_defconfig | 18 ++++++++++++++++++ configs/am57xx_hs_evm_defconfig | 18 ++++++++++++++++++ include/configs/ti_omap5_common.h | 6 +++++- 5 files changed, 67 insertions(+), 1 deletion(-)

Some boards (like AM57x EVM) has USB OTG controller other than 0. So in order to use correct controller number in compiled environment we should define CONFIG_FASTBOOT_USB_DEV option.
For example, when doing "fastboot reboot-bootloader" we want to enter fastboot mode automatically. But to do so we need to provide controller number to "fastboot" command. If this procedure is defined in some config which is common to bunch of boards, and boards have different USB controller numbers, we can't just hardcode "fastboot 0" in the environment. We need to use configurable option, which this patch adds.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- cmd/fastboot/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig index 5d2facc..d555d0a 100644 --- a/cmd/fastboot/Kconfig +++ b/cmd/fastboot/Kconfig @@ -41,6 +41,14 @@ config FASTBOOT_BUF_SIZE downloads. This buffer should be as large as possible for a platform. Define this to the size available RAM for fastboot.
+config FASTBOOT_USB_DEV + int "USB controller number" + default 0 + help + Some boards have USB OTG controller other than 0. Define this + option so it can be used in compiled environment (e.g. in + CONFIG_BOOTCOMMAND). + config FASTBOOT_FLASH bool "Enable FASTBOOT FLASH command" help

On Thu, Oct 20, 2016 at 06:58:28PM +0300, Sam Protsenko wrote:
Some boards (like AM57x EVM) has USB OTG controller other than 0. So in order to use correct controller number in compiled environment we should define CONFIG_FASTBOOT_USB_DEV option.
For example, when doing "fastboot reboot-bootloader" we want to enter fastboot mode automatically. But to do so we need to provide controller number to "fastboot" command. If this procedure is defined in some config which is common to bunch of boards, and boards have different USB controller numbers, we can't just hardcode "fastboot 0" in the environment. We need to use configurable option, which this patch adds.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com

On "fastboot reboot-bootloader" we check "dofastboot" variable and do "fastboot 0" command in U-Boot if it's 1. But there are boards which have USB controller number other than 0, so it should be respected when performing "fastboot" command.
This patch reuses CONFIG_FASTBOOT_USB_DEV option toprovide correct USB controller number to "fastboot" command.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- include/configs/ti_omap5_common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index 29b7d96..144a880 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -110,11 +110,15 @@ DFUARGS \ NETARGS \
+#ifndef CONFIG_FASTBOOT_USB_DEV +#define CONFIG_FASTBOOT_USB_DEV 0 +#endif #define CONFIG_BOOTCOMMAND \ "if test ${dofastboot} -eq 1; then " \ "echo Boot fastboot requested, resetting dofastboot ...;" \ "setenv dofastboot 0; saveenv;" \ - "echo Booting into fastboot ...; fastboot 0;" \ + "echo Booting into fastboot ...; " \ + "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \ "fi;" \ "run findfdt; " \ "run envboot; " \

On Thu, Oct 20, 2016 at 06:58:29PM +0300, Sam Protsenko wrote:
On "fastboot reboot-bootloader" we check "dofastboot" variable and do "fastboot 0" command in U-Boot if it's 1. But there are boards which have USB controller number other than 0, so it should be respected when performing "fastboot" command.
This patch reuses CONFIG_FASTBOOT_USB_DEV option toprovide correct USB controller number to "fastboot" command.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
include/configs/ti_omap5_common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index 29b7d96..144a880 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -110,11 +110,15 @@ DFUARGS \ NETARGS \
+#ifndef CONFIG_FASTBOOT_USB_DEV +#define CONFIG_FASTBOOT_USB_DEV 0 +#endif
We don't need this hunk, it will always be defined now.

On Fri, Oct 21, 2016 at 2:19 PM, Tom Rini trini@konsulko.com wrote:
On Thu, Oct 20, 2016 at 06:58:29PM +0300, Sam Protsenko wrote:
On "fastboot reboot-bootloader" we check "dofastboot" variable and do "fastboot 0" command in U-Boot if it's 1. But there are boards which have USB controller number other than 0, so it should be respected when performing "fastboot" command.
This patch reuses CONFIG_FASTBOOT_USB_DEV option toprovide correct USB controller number to "fastboot" command.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
include/configs/ti_omap5_common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index 29b7d96..144a880 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -110,11 +110,15 @@ DFUARGS \ NETARGS \
+#ifndef CONFIG_FASTBOOT_USB_DEV +#define CONFIG_FASTBOOT_USB_DEV 0 +#endif
We don't need this hunk, it will always be defined now.
Tom,
I fixed that and resent the whole patchset. Please reexamine v2.
Thanks.
-- Tom

Enable USB download gadget (needed for fastboot support) and all dependencies.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- configs/am57xx_evm_defconfig | 9 +++++++++ configs/am57xx_evm_nodt_defconfig | 9 +++++++++ configs/am57xx_hs_evm_defconfig | 9 +++++++++ 3 files changed, 27 insertions(+)
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index 5acd4e7..89e927e 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -59,5 +59,14 @@ CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_OMAP=y +CONFIG_USB_DWC3_PHY_OMAP=y CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="Texas Instruments" +CONFIG_G_DNL_VENDOR_NUM=0x0451 +CONFIG_G_DNL_PRODUCT_NUM=0xd022 CONFIG_SPL_OF_LIBFDT=y diff --git a/configs/am57xx_evm_nodt_defconfig b/configs/am57xx_evm_nodt_defconfig index 9588a55..73e541d 100644 --- a/configs/am57xx_evm_nodt_defconfig +++ b/configs/am57xx_evm_nodt_defconfig @@ -36,5 +36,14 @@ CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_OMAP=y +CONFIG_USB_DWC3_PHY_OMAP=y CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="Texas Instruments" +CONFIG_G_DNL_VENDOR_NUM=0x0451 +CONFIG_G_DNL_PRODUCT_NUM=0xd022 CONFIG_OF_LIBFDT=y diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index a80e882..b25e21b 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -54,5 +54,14 @@ CONFIG_TI_QSPI=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_OMAP=y +CONFIG_USB_DWC3_PHY_OMAP=y CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="Texas Instruments" +CONFIG_G_DNL_VENDOR_NUM=0x0451 +CONFIG_G_DNL_PRODUCT_NUM=0xd022 CONFIG_SPL_OF_LIBFDT=y

On Thu, Oct 20, 2016 at 06:58:30PM +0300, Sam Protsenko wrote:
Enable USB download gadget (needed for fastboot support) and all dependencies.
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com

Signed-off-by: Sam Protsenko semen.protsenko@linaro.org --- configs/am57xx_evm_defconfig | 9 +++++++++ configs/am57xx_evm_nodt_defconfig | 9 +++++++++ configs/am57xx_hs_evm_defconfig | 9 +++++++++ 3 files changed, 27 insertions(+)
diff --git a/configs/am57xx_evm_defconfig b/configs/am57xx_evm_defconfig index 89e927e..888a2fd 100644 --- a/configs/am57xx_evm_defconfig +++ b/configs/am57xx_evm_defconfig @@ -16,6 +16,15 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_DMA_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_HUSH_PARSER=y +CONFIG_FASTBOOT=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_CMD_FASTBOOT=y +CONFIG_ANDROID_BOOT_IMAGE=y +CONFIG_FASTBOOT_BUF_ADDR=0x82000000 +CONFIG_FASTBOOT_BUF_SIZE=0x2f000000 +CONFIG_FASTBOOT_USB_DEV=1 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=1 CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y diff --git a/configs/am57xx_evm_nodt_defconfig b/configs/am57xx_evm_nodt_defconfig index 73e541d..9da40bb 100644 --- a/configs/am57xx_evm_nodt_defconfig +++ b/configs/am57xx_evm_nodt_defconfig @@ -9,6 +9,15 @@ CONFIG_SPL=y CONFIG_SPL_DMA_SUPPORT=y CONFIG_SPL_OS_BOOT=y CONFIG_HUSH_PARSER=y +CONFIG_FASTBOOT=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_CMD_FASTBOOT=y +CONFIG_ANDROID_BOOT_IMAGE=y +CONFIG_FASTBOOT_BUF_ADDR=0x82000000 +CONFIG_FASTBOOT_BUF_SIZE=0x2f000000 +CONFIG_FASTBOOT_USB_DEV=1 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=1 CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y diff --git a/configs/am57xx_hs_evm_defconfig b/configs/am57xx_hs_evm_defconfig index b25e21b..e27b214 100644 --- a/configs/am57xx_hs_evm_defconfig +++ b/configs/am57xx_hs_evm_defconfig @@ -17,6 +17,15 @@ CONFIG_SPL=y CONFIG_SPL_STACK_R=y CONFIG_SPL_DMA_SUPPORT=y CONFIG_HUSH_PARSER=y +CONFIG_FASTBOOT=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_CMD_FASTBOOT=y +CONFIG_ANDROID_BOOT_IMAGE=y +CONFIG_FASTBOOT_BUF_ADDR=0x82000000 +CONFIG_FASTBOOT_BUF_SIZE=0x2f000000 +CONFIG_FASTBOOT_USB_DEV=1 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=1 CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMLS is not set CONFIG_CMD_ASKENV=y

On Thu, Oct 20, 2016 at 06:58:31PM +0300, Sam Protsenko wrote:
Signed-off-by: Sam Protsenko semen.protsenko@linaro.org
Reviewed-by: Tom Rini trini@konsulko.com
participants (2)
-
Sam Protsenko
-
Tom Rini