[U-Boot] [PATCH 0/5] am335x_evm: support for booting via USB

These series add support for booting via USB on TI AM335X based boards. Tested on BeagleBone.
Ilya Yanok (5): spl: support for booting via usbeth am33xx: support for booting via usbeth am335x_evm: enable support for booting via USB spl: add possibility to force boot device am335x_evm: add new config with forced USB booting
arch/arm/cpu/armv7/omap-common/boot-common.c | 3 +++ arch/arm/include/asm/arch-am33xx/spl.h | 1 + board/ti/am335x/board.c | 3 ++- boards.cfg | 1 + common/spl/spl.c | 9 +++++++++ include/configs/am335x_evm.h | 8 ++++++++ spl/Makefile | 2 ++ 7 files changed, 26 insertions(+), 1 deletion(-)

In case of usbeth booting just call net_load_image("usb_ether"). This patch also adds CONFIG_SPL_USBETH_SUPPORT and CONFIG_SPL_MUSB_NEW_SUPPORT config options to enable linking of SPL against USB gagdet support and new MUSB driver resp.
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com --- common/spl/spl.c | 5 +++++ spl/Makefile | 2 ++ 2 files changed, 7 insertions(+)
diff --git a/common/spl/spl.c b/common/spl/spl.c index ff9ba7b..6a5a136 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -221,6 +221,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2) #endif break; #endif +#ifdef CONFIG_SPL_USBETH_SUPPORT + case BOOT_DEVICE_USBETH: + spl_net_load_image("usb_ether"); + break; +#endif default: debug("SPL: Un-supported Boot Device\n"); hang(); diff --git a/spl/Makefile b/spl/Makefile index 6dbb105..3333cde 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -81,6 +81,8 @@ LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/memory.o LIBS-$(CONFIG_SPL_NET_SUPPORT) += net/libnet.o LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/libnet.o LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/libphy.o +LIBS-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/libusb_musb-new.o +LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/libusb_gadget.o
ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) LIBS-y += $(CPUDIR)/omap-common/libomap-common.o

This patch adds BOOT_DEVICE define for USB booting and fixes spl_board_init function to call arch_misc_init (this is the place there musb is initialized).
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com --- arch/arm/cpu/armv7/omap-common/boot-common.c | 3 +++ arch/arm/include/asm/arch-am33xx/spl.h | 1 + 2 files changed, 4 insertions(+)
diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c index 0f19141..99dc9d8 100644 --- a/arch/arm/cpu/armv7/omap-common/boot-common.c +++ b/arch/arm/cpu/armv7/omap-common/boot-common.c @@ -54,6 +54,9 @@ void spl_board_init(void) #ifdef CONFIG_SPL_NAND_SUPPORT gpmc_init(); #endif +#if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT) + arch_misc_init(); +#endif }
int board_mmc_init(bd_t *bis) diff --git a/arch/arm/include/asm/arch-am33xx/spl.h b/arch/arm/include/asm/arch-am33xx/spl.h index 644ff35..e961ce0 100644 --- a/arch/arm/include/asm/arch-am33xx/spl.h +++ b/arch/arm/include/asm/arch-am33xx/spl.h @@ -29,6 +29,7 @@ #define BOOT_DEVICE_MMC2 9 /* eMMC or daughter card */ #define BOOT_DEVICE_SPI 11 #define BOOT_DEVICE_UART 65 +#define BOOT_DEVICE_USBETH 68 #define BOOT_DEVICE_CPGMAC 70 #define BOOT_DEVICE_MMC2_2 0xFF #endif

On Mon, Dec 31, 2012 at 08:32:40PM +0400, Ilya Yanok wrote:
This patch adds BOOT_DEVICE define for USB booting and fixes spl_board_init function to call arch_misc_init (this is the place there musb is initialized).
[snip]
@@ -54,6 +54,9 @@ void spl_board_init(void) #ifdef CONFIG_SPL_NAND_SUPPORT gpmc_init(); #endif +#if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)
- arch_misc_init();
+#endif
I don't think we need both tests here. As I said in the DFU thread, arch_misc_init is where everyone should be doing the "just register things" side of gadget USB hook-up. Clocking and pinmux are elsewhere anyhow.

On Mon, Dec 31, 2012 at 06:32:40AM -0000, Ilya Yanok wrote:
This patch adds BOOT_DEVICE define for USB booting and fixes spl_board_init function to call arch_misc_init (this is the place there musb is initialized).
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com
On further review, I drop my previous objection.

This adds necessary config options to enable usb booting and fixes board_eth_init() function to take into account that we may have USB ether support in SPL now.
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com --- board/ti/am335x/board.c | 3 ++- include/configs/am335x_evm.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index f0eca54..5728c9a 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -425,7 +425,8 @@ int board_eth_init(bd_t *bis) n += rv; #endif try_usbether: -#if defined(CONFIG_USB_ETHER) && !defined(CONFIG_SPL_BUILD) +#if defined(CONFIG_USB_ETHER) && \ + (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT)) rv = usb_eth_initialize(bis); if (rv < 0) printf("Error %d registering USB_ETHER\n", rv); diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index ab9549b..2da863d 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -238,6 +238,8 @@ #define CONFIG_SPL_SPI_CS 0 #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 #define CONFIG_SYS_SPI_U_BOOT_SIZE 0x40000 +#define CONFIG_SPL_MUSB_NEW_SUPPORT +#define CONFIG_SPL_USBETH_SUPPORT #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"
/* @@ -279,6 +281,8 @@ #ifdef CONFIG_MUSB_GADGET #define CONFIG_USB_ETHER #define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00" +#define CONFIG_USBNET_DEV_ADDR "de:ad:be:af:00:01" #endif /* CONFIG_MUSB_GADGET */
/* Unsupported features */ @@ -301,4 +305,8 @@ #define CONFIG_PHYLIB #define CONFIG_PHY_SMSC
+#ifdef CONFIG_SPL_BUILD +/* disable host part of MUSB in SPL */ +#undef CONFIG_MUSB_HOST +#endif #endif /* ! __CONFIG_AM335X_EVM_H */

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12/31/12 11:32, Ilya Yanok wrote:
This adds necessary config options to enable usb booting and fixes board_eth_init() function to take into account that we may have USB ether support in SPL now.
[snip]
+#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00" +#define CONFIG_USBNET_DEV_ADDR "de:ad:be:af:00:01" #endif /* CONFIG_MUSB_GADGET */
We need to re-work this, ala the vendor tree, to use the same MAC as the cpsw ethernet device uses, to match the ROM behavior.
- -- Tom

Sometimes (for debugging purposes mostly but also to overcome some hardware limitations) it's desirable to be able to force boot device to some fixed value. This patch adds this possibility via CONFIG_SPL_FORCE_BOOT_DEVICE option.
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com --- common/spl/spl.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/common/spl/spl.c b/common/spl/spl.c index 6a5a136..37f4d38 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -177,7 +177,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_board_init(); #endif
+#ifdef CONFIG_SPL_FORCE_BOOT_DEVICE + boot_device = CONFIG_SPL_FORCE_BOOT_DEVICE; +#else boot_device = spl_boot_device(); +#endif debug("boot device - %d\n", boot_device); switch (boot_device) { #ifdef CONFIG_SPL_RAM_DEVICE

On Mon, Dec 31, 2012 at 06:32:42AM -0000, Ilya Yanok wrote:
Sometimes (for debugging purposes mostly but also to overcome some hardware limitations) it's desirable to be able to force boot device to some fixed value. This patch adds this possibility via CONFIG_SPL_FORCE_BOOT_DEVICE option.
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com
I don't like this, so I'm going to drop it. It does provide a proof of concept to allow earlier testing of USB SPL support, but fixed hardware exists now.

Currently AM335X hardware has bug in it's ROM code that prevents USB booting from working normally. So we have to load SPL via serial console instead. But it's feasible to use USB for loading the main U-Boot image. This patch adds additional am335x_evm configuration for this.
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com
--- boards.cfg | 1 + 1 file changed, 1 insertion(+)
diff --git a/boards.cfg b/boards.cfg index 91504c0..e7c66a9 100644 --- a/boards.cfg +++ b/boards.cfg @@ -229,6 +229,7 @@ integratorap_cm946es arm arm946es integrator armltd integratorcp_cm946es arm arm946es integrator armltd - integratorcp:CM946ES ca9x4_ct_vxp arm armv7 vexpress armltd am335x_evm arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1 +am335x_evm_usbboot arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,SPL_FORCE_BOOT_DEVICE=BOOT_DEVICE_USBETH am335x_evm_uart1 arm armv7 am335x ti am33xx am335x_evm:SERIAL2,CONS_INDEX=2 am335x_evm_uart2 arm armv7 am335x ti am33xx am335x_evm:SERIAL3,CONS_INDEX=3 am335x_evm_uart3 arm armv7 am335x ti am33xx am335x_evm:SERIAL4,CONS_INDEX=4

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12/31/12 11:32, Ilya Yanok wrote:
Currently AM335X hardware has bug in it's ROM code that prevents USB booting from working normally. So we have to load SPL via serial console instead. But it's feasible to use USB for loading the main U-Boot image. This patch adds additional am335x_evm configuration for this.
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com
--- boards.cfg | 1 + 1 file changed, 1 insertion(+)
diff --git a/boards.cfg b/boards.cfg index 91504c0..e7c66a9 100644 --- a/boards.cfg +++ b/boards.cfg @@ -229,6 +229,7 @@ integratorap_cm946es arm arm946es integrator armltd integratorcp_cm946es arm arm946es integrator armltd - integratorcp:CM946ES ca9x4_ct_vxp arm armv7 vexpress armltd am335x_evm arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1 +am335x_evm_usbboot arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,SPL_FORCE_BOOT_DEVICE=BOOT_DEVICE_USBETH
I
don't like the name here as fixed hardware will be widely available at some point. How about am335x_evm_force_usbboot ?
- -- Tom

On Mon, Dec 31, 2012 at 06:32:43AM -0000, Ilya Yanok wrote:
Currently AM335X hardware has bug in it's ROM code that prevents USB booting from working normally. So we have to load SPL via serial console instead. But it's feasible to use USB for loading the main U-Boot image. This patch adds additional am335x_evm configuration for this.
Signed-off-by: Ilya Yanok ilya.yanok@cogentembedded.com
And with 4/5 dropped, this one is also dropped. Thanks!

With USB SPL support, we need to trim out some features in order to fit within our memory constraints. To allow for the most re-use of the resulting binary, we drop out CPSW ethernet and UART support, along with the extra environment settings as those are unused by SPL.
Signed-off-by: Tom Rini trini@ti.com --- boards.cfg | 1 + include/configs/am335x_evm.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/boards.cfg b/boards.cfg index b519bc4..fb0b9ac 100644 --- a/boards.cfg +++ b/boards.cfg @@ -236,6 +236,7 @@ am335x_evm_uart2 arm armv7 am335x ti am335x_evm_uart3 arm armv7 am335x ti am33xx am335x_evm:SERIAL4,CONS_INDEX=4 am335x_evm_uart4 arm armv7 am335x ti am33xx am335x_evm:SERIAL5,CONS_INDEX=5 am335x_evm_uart5 arm armv7 am335x ti am33xx am335x_evm:SERIAL6,CONS_INDEX=6 +am335x_evm_usbspl arm armv7 am335x ti am33xx am335x_evm:SERIAL1,CONS_INDEX=1,SPL_USBETH_SUPPORT highbank arm armv7 highbank - highbank mx51_efikamx arm armv7 mx51_efikamx genesi mx5 mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKAMX,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_mx.cfg mx51_efikasb arm armv7 mx51_efikamx genesi mx5 mx51_efikamx:MACH_TYPE=MACH_TYPE_MX51_EFIKASB,IMX_CONFIG=board/genesi/mx51_efikamx/imximage_sb.cfg diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index 391f705..f35ab82 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -239,7 +239,6 @@ #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 #define CONFIG_SYS_SPI_U_BOOT_SIZE 0x40000 #define CONFIG_SPL_MUSB_NEW_SUPPORT -#define CONFIG_SPL_USBETH_SUPPORT #define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"
#define CONFIG_SPL_BOARD_INIT @@ -320,6 +319,12 @@ #ifdef CONFIG_SPL_BUILD /* disable host part of MUSB in SPL */ #undef CONFIG_MUSB_HOST +/* Disable SPI and CPSW ethernet support so we can fit. */ +#ifdef CONFIG_SPL_USBETH_SUPPORT +#undef CONFIG_SPL_ETH_SUPPORT +#undef CONFIG_SPL_YMODEM_SUPPORT +#undef CONFIG_EXTRA_ENV_SETTINGS +#endif #endif
/* Unsupported features */
participants (2)
-
Ilya Yanok
-
Tom Rini