Skip to contentSkip to conversation

Adding spl_usb code to common area

RFC New Dan Murphy 1 participant 3 messages Dec 5, 2013 Arm (32-bit)

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

This patch series adds the support to initialize the USB host controller scan for a USB mass storage device and load a file.

Currently only FAT image load is supported but I left the RAW image loading code in the file to further develop this.

This work was derived from the spl_mmc.c code

author
#1 lore raw

RFC 1/2 common: spl: add USB mass storage as a boot device

Add the ability to load a u-boot off a USB mass storage device from the SPL

---
 common/Makefile      |    2 +
 common/spl/Makefile  |    2 +
 common/spl/spl.c     |    5 ++
 common/spl/spl_usb.c |  179 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/spl.h        |    7 ++
 spl/Makefile         |    2 +
 6 files changed, 197 insertions(+)
 create mode 100644 common/spl/spl_usb.c
common/Makefile +2 -0
index 74404be..5b062c0 100644
@@ -203,6 +203,8 @@ obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
+obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
+obj-$(CONFIG_USB_STORAGE) += usb_storage.o
 else
 obj-y += env_nowhere.o
 endif
common/spl/Makefile +2 -0
index 5c0637b..9261ea9 100644
@@ -16,4 +16,6 @@ obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
 obj-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o
 obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
 obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
+obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
+
 endif
common/spl/spl.c +5 -0
index da31457..0645cee 100644
@@ -205,6 +205,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		spl_net_load_image("usb_ether");
 		break;
 #endif
+#ifdef CONFIG_SPL_USB_SUPPORT
+	case BOOT_DEVICE_USB:
+		spl_usb_load_image();
+		break;
+#endif
 	default:
 		debug("SPL: Un-supported Boot Device\n");
 		hang();
common/spl/spl_usb.c new file +179 -0

179 lines not on this page · raw message

include/spl.h +7 -0
index 2bd6e16..5730ec7 100644
@@ -16,6 +16,10 @@
 #define MMCSD_MODE_RAW		1
 #define MMCSD_MODE_FAT		2
 
+#define USB_MODE_UNDEFINED	0
+#define USB_MODE_RAW		1
+#define USB_MODE_FAT		2
+
 struct spl_image_info {
 	const char *name;
 	u8 os;
@@ -60,6 +64,9 @@ void spl_spi_load_image(void);
 /* Ethernet SPL functions */
 void spl_net_load_image(const char *device);
 
+/* USB SPL functions */
+void spl_usb_load_image(void);
+
 #ifdef CONFIG_SPL_BOARD_INIT
 void spl_board_init(void);
 #endif
spl/Makefile +2 -0
index 29d7818..26de0d3 100644
@@ -86,6 +86,8 @@ LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/
 LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/
 LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/
 LIBS-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/
+LIBS-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/
+LIBS-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/
 LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/
 LIBS-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/
 
Signature · 1 line
1.7.9.5
author
#2 lore raw

RFC 2/2 arm: am437x: Enable the USB boot device

In reply to Dan Murphy

Enable the USB host boot support for the AM437 evm

---
 arch/arm/include/asm/arch-am33xx/spl.h |    1 +
 include/configs/am43xx_evm.h           |    7 +++++++
 2 files changed, 8 insertions(+)
arch/arm/include/asm/arch-am33xx/spl.h +1 -0
index 95de9aa..166ff24 100644
@@ -20,6 +20,7 @@
 #if defined(CONFIG_AM33XX) || defined(CONFIG_AM43XX)
 #define BOOT_DEVICE_MMC1	8
 #define BOOT_DEVICE_MMC2	9	/* eMMC or daughter card */
+#define BOOT_DEVICE_USB		13
 #elif defined(CONFIG_TI814X)
 #define BOOT_DEVICE_MMC1	9
 #define BOOT_DEVICE_MMC2	8	/* ROM only supports 2nd instance */
include/configs/am43xx_evm.h +7 -0
index d9b6c16..eb3377c 100644
@@ -129,6 +129,13 @@
 #define CONFIG_SYS_SPL_MALLOC_START	0x80a08000
 #define CONFIG_SYS_SPL_MALLOC_SIZE	0x100000
 
+#define CONFIG_SYS_USB_FAT_BOOT_PARTITION		1
+#define CONFIG_SYS_USB_MODE_U_BOOT_SECTOR 0x300
+
+/* SPL USB Support */
+#define CONFIG_SPL_USB_SUPPORT
+#define CONFIG_SPL_USB_HOST_SUPPORT
+
 /* Unsupported features */
 #undef CONFIG_USE_IRQ
 
Signature · 1 line
1.7.9.5