Skip to contentSkip to conversation

am335x_evm: support for booting via USB

PATCH New Ilya Yanok 2 participants 13 messages Dec 31, 2012 – Feb 5, 2013 Arm (32-bit)

lore
Share & tools
lore

Ilya Yanok

author
#0 lore raw

cover 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(-)
Signature · 1 line
1.8.0.2
author
#1 lore raw

PATCH 1/5 spl: support for booting via usbeth

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.

---
 common/spl/spl.c | 5 +++++
 spl/Makefile     | 2 ++
 2 files changed, 7 insertions(+)
common/spl/spl.c +5 -0
index ff9ba7b..6a5a136 100644
@@ -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();
spl/Makefile +2 -0
index 6dbb105..3333cde 100644
@@ -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
Signature · 1 line
1.8.0.2
author
#2 lore raw

PATCH 2/5 am33xx: support for booting via usbeth

In reply to Ilya Yanok

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).

---
 arch/arm/cpu/armv7/omap-common/boot-common.c | 3 +++
 arch/arm/include/asm/arch-am33xx/spl.h       | 1 +
 2 files changed, 4 insertions(+)
arch/arm/cpu/armv7/omap-common/boot-common.c +3 -0
index 0f19141..99dc9d8 100644
@@ -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)
arch/arm/include/asm/arch-am33xx/spl.h +1 -0
index 644ff35..e961ce0 100644
@@ -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
Signature · 1 line
1.8.0.2
#3 lore raw

PATCH 2/5 am33xx: support for booting via usbeth

Quoted 3 lines · Ilya Yanok

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]

arch/arm/cpu/armv7/omap-common/boot-common.c void spl_board_init(void) · line 59

Quoted 7 lines
arch/arm/cpu/armv7/omap-common/boot-common.c +3 -0
@@ -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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130102/305e62fc/attachment.pgp>
#4 lore raw

PATCH 2/5 am33xx: support for booting via usbeth

In reply to Ilya Yanok
Quoted 5 lines · Ilya Yanok

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).

On further review, I drop my previous objection.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130205/b15eabb0/attachment.pgp>
author
#5 lore raw

PATCH 3/5 am335x_evm: enable support for booting via USB

In reply to Ilya Yanok

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.

---
 board/ti/am335x/board.c      | 3 ++-
 include/configs/am335x_evm.h | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
board/ti/am335x/board.c +2 -1
index f0eca54..5728c9a 100644
@@ -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);
include/configs/am335x_evm.h +8 -0
index ab9549b..2da863d 100644
@@ -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 */
Signature · 1 line
1.8.0.2
#6 lore raw

PATCH 3/5 am335x_evm: enable support for booting via USB

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Ilya Yanok

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]

Quoted 3 lines

+#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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQ5E1IAAoJENk4IS6UOR1WWd4P/R5LN98R0TFyRaynMgaUMUHp yxl8HclxesZ521AXKQ+laazCbwA+5n+yOr9UIkdNj7Cw9VJ+nh5PacecXhKO6Jdc TOGsSzy/yQAofmPjqndKoys1ICNlBo9xUYTG2j4AedJaa4ogYEICJxyrq77dGEMw d+PktUKf2BCp6ui3vERiLUycoqdf/GU6fcTftodX97B+MNO/JBGTIPXzw5zsYljQ SSR2he7JM6CN0YBNqbO8cssdDSd65VMi5rFy7viZWsd6qYhHaKI10lvdLNVryPRl aCPNj8qOCYvswKHk028OQuiUQEOUIw2fRqEXNGfJbhYkk8ePaTsrdiwOHUWMjMlW gF5Two5eX8SUobkirqwGYt3V5uGuumS3ZLPw4lAuZpmLBbzmlLvPw4EooOT1CSoS AW/Je0dQ87PqOcQkcci97V5Cp2Hef1VLMAh7cAYA+AUQ6nNDwqU7dwZUjFTeDZQB 2MHOURgcOKRyMmni21M1GyLWwfTrv7Q47PIqEl31cmFW05xVoQ06Km8TwsCK8L66 a0H99UuSO1gTsOHRAogUKDdH3gebwtQkDaMTUzH/4FTJWnvMNvGPuzM8Q7BdmAYg V/heDO7yR0LJtfNiBiC3KxbVmw980Un5TZAXpH2CFNc1+3DyW3MYyXGhsHNnd4hn fLdgBqd1xQj+B1osy6Ol
=FtLs
-----END PGP SIGNATURE-----

author
#7 lore raw

PATCH 4/5 spl: add possibility to force boot device

In reply to Ilya Yanok

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.

---
 common/spl/spl.c | 4 ++++
 1 file changed, 4 insertions(+)
common/spl/spl.c +4 -0
index 6a5a136..37f4d38 100644
@@ -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
Signature · 1 line
1.8.0.2
#8 lore raw

PATCH 4/5 spl: add possibility to force boot device

Quoted 6 lines · Ilya Yanok

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.

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130205/3c104c96/attachment.pgp>
author
#9 lore raw

PATCH 5/5 am335x_evm: add new config with forced USB booting

In reply to Ilya Yanok

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.

---
 boards.cfg | 1 +
 1 file changed, 1 insertion(+)
boards.cfg +1 -0
index 91504c0..e7c66a9 100644
@@ -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
Signature · 1 line
1.8.0.2
#10 lore raw

PATCH 5/5 am335x_evm: add new config with forced USB booting

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 13 lines · Ilya Yanok

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.

--- boards.cfg | 1 + 1 file changed, 1 insertion(+)

boards.cfg index 91504c0..e7c66a9 100644 renamed from boards.cfg +0 -1
--- a/boards.cfg +++ b/boards.cfg @@ -229,6 +229,7 @@

integratorap_cm946es arm arm946es integrator

Quoted 8 lines

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

Quoted 1 line

don't like the name here as fixed hardware will be widely available at some point. How about am335x_evm_force_usbboot ?

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQ5E2aAAoJENk4IS6UOR1WeFYP/0DFrm0Ia6nhFIyB9NLNdpHK 5um5sKhe3z5W1QX4W5T0Bm/sJtG7+YAUwy2A+GRzwbGxFz5/dXOeqvSRcB2hMS7/ mX+Clh0gJSWN/M+9rHTxJzP47cDcxuukXDQ9V6clCcTS6oP/OqkiywxeTl+XipC3 mOTlKTpo6i9TnnewXKWWaEt3xturbAYeqKxMBU2c1ynHeczADUPmScY88+7OV61T Ysn+po7ylXc8gSOuffLbWURYdv46Sl3kCCgPIbN77gyYJKBjsssoGNTndEPCRX5z 8XEEg+DXzuzf6AztWmjis62LsySBsic8TEzj2QoZ+VJTuMgsWnJU8L4NVkYH+mwB sj7/xz7gKLIjF3/2upSJ6khoWtlzoRzMRMoQ7oLOYxhEVufQM5mznXRNcAsjUu03 eHysQPNxFTGWLE5SVlplKd8PJXtuxDCHwahFdpAaaE+TxYWYwIzaFXf+EO1PCH8j 3oNFNu66xFiYG/xb4gU+vLpw5HQCHkV2AS1g+11ucuB40sFhTi+56CIQCHbitu94 ZBM0YJ5/S87hO7cwM9bGq6+HlmTZ1oYuowKC4B0wTok5ZSyCwWNgyuqXR0vYV9ip Iojp2ix/QTMHwZC43h+UnccTePMvc6E4FdyCqAOhcSxF1amY7KNDj3S9YaMAdyYs 2DMThy1sPhRpS+dSTOOj
=SSkH
-----END PGP SIGNATURE-----

#11 lore raw

PATCH 5/5 am335x_evm: add new config with forced USB booting

In reply to Ilya Yanok
Quoted 6 lines · Ilya Yanok

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.

And with 4/5 dropped, this one is also dropped. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130205/94f43316/attachment.pgp>
#12 lore raw

PATCH 1/1 am335x_evm: Add am335x_evm_usbspl boot target

In reply to Ilya Yanok

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.

---
 boards.cfg                   |    1 +
 include/configs/am335x_evm.h |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
boards.cfg +1 -0
index b519bc4..fb0b9ac 100644
@@ -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
include/configs/am335x_evm.h +6 -1
index 391f705..f35ab82 100644
@@ -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 */
Signature · 1 line
1.7.9.5