public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [uBoot] [Patch v2 1/4] spl: common: Properly ignore spl/Makefile in .gitignore
@ 2014-01-16 17:23 Dan Murphy
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 2/4] spl: common: Move FAT funcs to a common file Dan Murphy
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Dan Murphy @ 2014-01-16 17:23 UTC (permalink / raw)
  To: u-boot

The spl directory is ignored by git as these objects are created
during spl creation.  The only file not created is the Makefile.

This file can be modified and checked in via git.

Due to the order of rule precedence having the whole directory
ignored first then indicating not to ignore the Makefile is not correct
the message to force adding the Makefile is still shown.

So reorder the .gitignore for the Makefile and indicate that the Makefile
does not need to be ignored first and then indicate everything else in spl
should be ignored after wards.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---

v2 - No change just a rebase - http://patchwork.ozlabs.org/patch/309263/

 .gitignore |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 3b14c25..7f006c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,8 +57,8 @@
 /errlog
 /reloc_off
 
-/spl/
 !/spl/Makefile
+/spl/*
 /tpl/
 
 /include/generated/
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [uBoot] [Patch v2 2/4] spl: common: Move FAT funcs to a common file
  2014-01-16 17:23 [U-Boot] [uBoot] [Patch v2 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Dan Murphy
@ 2014-01-16 17:23 ` Dan Murphy
  2014-01-27 14:56   ` [U-Boot] [U-Boot, v2, " Tom Rini
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 3/4] spl: common: Support for USB MSD FAT image loading Dan Murphy
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Dan Murphy @ 2014-01-16 17:23 UTC (permalink / raw)
  To: u-boot

Move the FAT functions to a common location for reuse.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---

v2 - No change just a rebase - http://patchwork.ozlabs.org/patch/309264/

 common/spl/Makefile  |    1 +
 common/spl/spl_fat.c |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++
 common/spl/spl_mmc.c |   68 ++++-------------------------------
 include/spl.h        |    5 +++
 4 files changed, 108 insertions(+), 62 deletions(-)
 create mode 100644 common/spl/spl_fat.c

diff --git a/common/spl/Makefile b/common/spl/Makefile
index 5c0637b..c8d5963 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -16,4 +16,5 @@ 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_FAT_SUPPORT) += spl_fat.o
 endif
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
new file mode 100644
index 0000000..9b40584
--- /dev/null
+++ b/common/spl/spl_fat.c
@@ -0,0 +1,96 @@
+/*
+ * (C) Copyright 2014
+ * Texas Instruments, <www.ti.com>
+ *
+ * Dan Murphy <dmurphy@ti.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ * FAT Image Functions copied from spl_mmc.c
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/u-boot.h>
+#include <fat.h>
+#include <image.h>
+
+static int fat_registered;
+
+#ifdef CONFIG_SPL_FAT_SUPPORT
+static int spl_register_fat_device(block_dev_desc_t *block_dev, int partition)
+{
+	int err = 0;
+
+	if (fat_registered)
+		return err;
+
+	err = fat_register_device(block_dev, partition);
+	if (err) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+		printf("spl: fat register err - %d\n", err);
+#endif
+		hang();
+	}
+
+	fat_registered = 1;
+
+	return err;
+}
+
+int spl_load_image_fat(block_dev_desc_t *block_dev,
+						int partition,
+						const char *filename)
+{
+	int err;
+	struct image_header *header;
+
+	err = spl_register_fat_device(block_dev, partition);
+	if (err <= 0)
+		goto end;
+
+	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
+						sizeof(struct image_header));
+
+	err = file_fat_read(filename, header, sizeof(struct image_header));
+	if (err <= 0)
+		goto end;
+
+	spl_parse_image_header(header);
+
+	err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
+
+end:
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+	if (err <= 0)
+		printf("spl: error reading image %s, err - %d\n",
+		       filename, err);
+#endif
+
+	return (err <= 0);
+}
+
+#ifdef CONFIG_SPL_OS_BOOT
+int spl_load_image_fat_os(block_dev_desc_t *block_dev, int partition)
+{
+	int err;
+
+	err = spl_register_fat_device(block_dev, partition);
+	if (err <= 0)
+		return -1;
+
+	err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME,
+			    (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
+	if (err <= 0) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+		printf("spl: error reading image %s, err - %d\n",
+		       CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
+#endif
+		return -1;
+	}
+
+	return spl_load_image_fat(block_dev, partition,
+			CONFIG_SPL_FAT_LOAD_KERNEL_NAME);
+}
+#endif
+#endif
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index fc2f226..13fbff0 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -10,7 +10,6 @@
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <mmc.h>
-#include <fat.h>
 #include <version.h>
 #include <image.h>
 
@@ -69,54 +68,6 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
 }
 #endif
 
-#ifdef CONFIG_SPL_FAT_SUPPORT
-static int mmc_load_image_fat(struct mmc *mmc, const char *filename)
-{
-	int err;
-	struct image_header *header;
-
-	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
-						sizeof(struct image_header));
-
-	err = file_fat_read(filename, header, sizeof(struct image_header));
-	if (err <= 0)
-		goto end;
-
-	spl_parse_image_header(header);
-
-	err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
-
-end:
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-	if (err <= 0)
-		printf("spl: error reading image %s, err - %d\n",
-		       filename, err);
-#endif
-
-	return (err <= 0);
-}
-
-#ifdef CONFIG_SPL_OS_BOOT
-static int mmc_load_image_fat_os(struct mmc *mmc)
-{
-	int err;
-
-	err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME,
-			    (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
-	if (err <= 0) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-		printf("spl: error reading image %s, err - %d\n",
-		       CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
-#endif
-		return -1;
-	}
-
-	return mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_KERNEL_NAME);
-}
-#endif
-
-#endif
-
 void spl_mmc_load_image(void)
 {
 	struct mmc *mmc;
@@ -148,24 +99,17 @@ void spl_mmc_load_image(void)
 		if (spl_start_uboot() || mmc_load_image_raw_os(mmc))
 #endif
 		err = mmc_load_image_raw(mmc,
-					 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
 #ifdef CONFIG_SPL_FAT_SUPPORT
 	} else if (boot_mode == MMCSD_MODE_FAT) {
 		debug("boot mode - FAT\n");
-
-		err = fat_register_device(&mmc->block_dev,
-					  CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION);
-		if (err) {
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-			printf("spl: fat register err - %d\n", err);
-#endif
-			hang();
-		}
-
 #ifdef CONFIG_SPL_OS_BOOT
-		if (spl_start_uboot() || mmc_load_image_fat_os(mmc))
+		if (spl_start_uboot() || spl_load_image_fat_os(&mmc->block_dev,
+								CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION))
 #endif
-		err = mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+		err = spl_load_image_fat(&mmc->block_dev,
+					CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION,
+					CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
 #endif
 	} else {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
diff --git a/include/spl.h b/include/spl.h
index 2bd6e16..cd5cd26 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -11,6 +11,7 @@
 #include <linux/compiler.h>
 #include <asm/spl.h>
 
+
 /* Boot type */
 #define MMCSD_MODE_UNDEFINED	0
 #define MMCSD_MODE_RAW		1
@@ -60,6 +61,10 @@ void spl_spi_load_image(void);
 /* Ethernet SPL functions */
 void spl_net_load_image(const char *device);
 
+/* SPL FAT image functions */
+int spl_load_image_fat(block_dev_desc_t *block_dev, int partition, const char *filename);
+int spl_load_image_fat_os(block_dev_desc_t *block_dev, int partition);
+
 #ifdef CONFIG_SPL_BOARD_INIT
 void spl_board_init(void);
 #endif
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [uBoot] [Patch v2 3/4] spl: common: Support for USB MSD FAT image loading
  2014-01-16 17:23 [U-Boot] [uBoot] [Patch v2 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Dan Murphy
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 2/4] spl: common: Move FAT funcs to a common file Dan Murphy
@ 2014-01-16 17:23 ` Dan Murphy
  2014-01-27 14:56   ` [U-Boot] [U-Boot, v2, " Tom Rini
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 4/4] arm: am43xx: Add USB spl boot support Dan Murphy
  2014-01-20 23:00 ` [U-Boot] [U-Boot, v2, 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Tom Rini
  3 siblings, 1 reply; 8+ messages in thread
From: Dan Murphy @ 2014-01-16 17:23 UTC (permalink / raw)
  To: u-boot

Add SPL support to be able to detect a USB Mass Storage device
connected to a USB host.  Once a USB Mass storage device is detected
the SPL will load the u-boot.img from a FAT partition to target address.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---

v2 - Updated spl.h after rebase because the #define did not get placed
where it needed to be placed - http://patchwork.ozlabs.org/patch/309265/

 arch/arm/include/asm/arch-am33xx/spl.h |   14 ++++++--
 common/Makefile                        |    4 +++
 common/spl/Makefile                    |    1 +
 common/spl/spl.c                       |    5 +++
 common/spl/spl_fat.c                   |   16 ++++-----
 common/spl/spl_usb.c                   |   58 ++++++++++++++++++++++++++++++++
 include/spl.h                          |    3 ++
 spl/Makefile                           |    2 ++
 8 files changed, 92 insertions(+), 11 deletions(-)
 create mode 100644 common/spl/spl_usb.c

diff --git a/arch/arm/include/asm/arch-am33xx/spl.h b/arch/arm/include/asm/arch-am33xx/spl.h
index 5cd1e95..2df4114 100644
--- a/arch/arm/include/asm/arch-am33xx/spl.h
+++ b/arch/arm/include/asm/arch-am33xx/spl.h
@@ -19,6 +19,7 @@
 #define BOOT_DEVICE_MMC1	7
 #define BOOT_DEVICE_MMC2	8
 #define BOOT_DEVICE_SPI		10
+#define BOOT_DEVICE_USB     13
 #define BOOT_DEVICE_UART	65
 #define BOOT_DEVICE_CPGMAC	71
 #else
@@ -38,9 +39,16 @@
 #endif
 #define BOOT_DEVICE_MMC2_2      0xFF
 
-#if defined(CONFIG_AM33XX) || defined(CONFIG_AM43XX)
-#define MMC_BOOT_DEVICES_START	BOOT_DEVICE_MMC1
-#define MMC_BOOT_DEVICES_END	BOOT_DEVICE_MMC2
+#if defined(CONFIG_AM33XX)
+#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1
+#define MMC_BOOT_DEVICES_END   BOOT_DEVICE_MMC2
+#elif defined(CONFIG_AM43XX)
+#define MMC_BOOT_DEVICES_START BOOT_DEVICE_MMC1
+#ifdef CONFIG_SPL_USB_SUPPORT
+#define MMC_BOOT_DEVICES_END   BOOT_DEVICE_USB
+#else
+#define MMC_BOOT_DEVICES_END   BOOT_DEVICE_MMC2
+#endif
 #elif defined(CONFIG_TI81XX)
 #define MMC_BOOT_DEVICES_START	BOOT_DEVICE_MMC2
 #define MMC_BOOT_DEVICES_END	BOOT_DEVICE_MMC1
diff --git a/common/Makefile b/common/Makefile
index d12cba5..4d99ecd 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -197,6 +197,10 @@ obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o
 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o
 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o
+ifdef CONFIG_SPL_USB_HOST_SUPPORT
+obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
+obj-$(CONFIG_USB_STORAGE) += usb_storage.o
+endif
 ifneq ($(CONFIG_SPL_NET_SUPPORT),y)
 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
diff --git a/common/spl/Makefile b/common/spl/Makefile
index c8d5963..65a1484f 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -16,5 +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
 obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
 endif
diff --git a/common/spl/spl.c b/common/spl/spl.c
index da31457..0645cee 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -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();
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index 9b40584..1e532d5 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -28,7 +28,7 @@ static int spl_register_fat_device(block_dev_desc_t *block_dev, int partition)
 	err = fat_register_device(block_dev, partition);
 	if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-		printf("spl: fat register err - %d\n", err);
+		printf("%s: fat register err - %d\n", __func__, err);
 #endif
 		hang();
 	}
@@ -46,7 +46,7 @@ int spl_load_image_fat(block_dev_desc_t *block_dev,
 	struct image_header *header;
 
 	err = spl_register_fat_device(block_dev, partition);
-	if (err <= 0)
+	if (err)
 		goto end;
 
 	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
@@ -63,8 +63,8 @@ int spl_load_image_fat(block_dev_desc_t *block_dev,
 end:
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 	if (err <= 0)
-		printf("spl: error reading image %s, err - %d\n",
-		       filename, err);
+		printf("%s: error reading image %s, err - %d\n",
+		       __func__, filename, err);
 #endif
 
 	return (err <= 0);
@@ -76,15 +76,15 @@ int spl_load_image_fat_os(block_dev_desc_t *block_dev, int partition)
 	int err;
 
 	err = spl_register_fat_device(block_dev, partition);
-	if (err <= 0)
-		return -1;
+	if (err)
+		return err;
 
 	err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME,
 			    (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0);
 	if (err <= 0) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-		printf("spl: error reading image %s, err - %d\n",
-		       CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
+		printf("%s: error reading image %s, err - %d\n",
+		       __func__, CONFIG_SPL_FAT_LOAD_ARGS_NAME, err);
 #endif
 		return -1;
 	}
diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c
new file mode 100644
index 0000000..53a9043
--- /dev/null
+++ b/common/spl/spl_usb.c
@@ -0,0 +1,58 @@
+/*
+ * (C) Copyright 2014
+ * Texas Instruments, <www.ti.com>
+ *
+ * Dan Murphy <dmurphy@ti.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ * Derived work from spl_mmc.c
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <asm/u-boot.h>
+#include <usb.h>
+#include <fat.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_USB_STORAGE
+static int usb_stor_curr_dev = -1; /* current device */
+#endif
+
+void spl_usb_load_image(void)
+{
+	int err;
+	block_dev_desc_t *stor_dev;
+
+	usb_stop();
+	err = usb_init();
+	if (err) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+		printf("%s: usb init failed: err - %d\n", __func__, err);
+#endif
+		hang();
+	}
+
+#ifdef CONFIG_USB_STORAGE
+	/* try to recognize storage devices immediately */
+	usb_stor_curr_dev = usb_stor_scan(1);
+	stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
+#endif
+
+	debug("boot mode - FAT\n");
+
+#ifdef CONFIG_SPL_OS_BOOT
+		if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
+								CONFIG_SYS_USB_FAT_BOOT_PARTITION))
+#endif
+		err = spl_load_image_fat(stor_dev,
+				CONFIG_SYS_USB_FAT_BOOT_PARTITION,
+				CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+
+		if (err) {
+			puts("Error loading USB device\n");
+			hang();
+		}
+}
diff --git a/include/spl.h b/include/spl.h
index cd5cd26..5e24856 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -61,6 +61,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);
+
 /* SPL FAT image functions */
 int spl_load_image_fat(block_dev_desc_t *block_dev, int partition, const char *filename);
 int spl_load_image_fat_os(block_dev_desc_t *block_dev, int partition);
diff --git a/spl/Makefile b/spl/Makefile
index 5e5472d..476b782 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -82,6 +82,8 @@ LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/
 LIBS-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/
 LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/
 LIBS-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/
+LIBS-$(CONFIG_SPL_USB_HOST_SUPPORT) += drivers/usb/host/
+LIBS-$(CONFIG_OMAP_USB_PHY) += drivers/usb/phy/
 
 ifneq (,$(CONFIG_MX23)$(CONFIG_MX35)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
 LIBS-y += arch/$(ARCH)/imx-common/
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [uBoot] [Patch v2 4/4] arm: am43xx: Add USB spl boot support
  2014-01-16 17:23 [U-Boot] [uBoot] [Patch v2 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Dan Murphy
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 2/4] spl: common: Move FAT funcs to a common file Dan Murphy
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 3/4] spl: common: Support for USB MSD FAT image loading Dan Murphy
@ 2014-01-16 17:23 ` Dan Murphy
  2014-01-27 14:57   ` [U-Boot] [U-Boot,v2,4/4] " Tom Rini
  2014-01-20 23:00 ` [U-Boot] [U-Boot, v2, 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Tom Rini
  3 siblings, 1 reply; 8+ messages in thread
From: Dan Murphy @ 2014-01-16 17:23 UTC (permalink / raw)
  To: u-boot

Add the USB host boot support for the am43xx evm
Add the macros to boot from a usb drive in uBoot

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---

v2 - This is the first time for this patch just enabled AM43xx

 include/configs/am43xx_evm.h |   46 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 40 insertions(+), 6 deletions(-)

diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index 4de495a..f45deeb 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -69,6 +69,11 @@
 
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/omap-common/u-boot-spl.lds"
 
+/* SPL USB Support */
+#define CONFIG_SPL_USB_SUPPORT
+#define CONFIG_SPL_USB_HOST_SUPPORT
+#define CONFIG_SYS_USB_FAT_BOOT_PARTITION		1
+
 #define CONFIG_CMD_USB
 #define CONFIG_USB_HOST
 #define CONFIG_USB_XHCI
@@ -94,26 +99,34 @@
 	"mmcdev=0\0" \
 	"mmcroot=/dev/mmcblk0p2 rw\0" \
 	"mmcrootfstype=ext4 rootwait\0" \
+	"usbroot=/dev/sda2 rw\0" \
+	"usbrootfstype=ext4 rootwait\0" \
+	"usbdev=0\0" \
 	"ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \
 	"ramrootfstype=ext2\0" \
 	"mmcargs=setenv bootargs console=${console} " \
 		"${optargs} " \
 		"root=${mmcroot} " \
 		"rootfstype=${mmcrootfstype}\0" \
+	"usbargs=setenv bootargs console=${console} " \
+		"${optargs} " \
+		"root=${usbroot} " \
+		"rootfstype=${usbrootfstype}\0" \
 	"bootenv=uEnv.txt\0" \
-	"loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
+	"loadbootenv=load ${devtype} ${devnum} ${loadaddr} ${bootenv}\0" \
 	"importbootenv=echo Importing environment from mmc ...; " \
 		"env import -t $loadaddr $filesize\0" \
 	"ramargs=setenv bootargs console=${console} " \
 		"${optargs} " \
 		"root=${ramroot} " \
 		"rootfstype=${ramrootfstype}\0" \
-	"loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
-	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"loadramdisk=load ${devtype} ${devnum} ${rdaddr} ramdisk.gz\0" \
+	"loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+	"loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
 	"mmcboot=mmc dev ${mmcdev}; " \
+		"setenv devnum ${mmcdev}; " \
 		"if mmc rescan; then " \
-			"echo SD/MMC found on device ${mmcdev};" \
+			"echo SD/MMC found on device ${devnum};" \
 			"if run loadbootenv; then " \
 				"echo Loaded environment from ${bootenv};" \
 				"run importbootenv;" \
@@ -129,6 +142,26 @@
 				"bootz ${loadaddr} - ${fdtaddr}; " \
 			"fi;" \
 		"fi;\0" \
+	"usbboot=" \
+		"setenv devnum ${usbdev}; " \
+		"setenv devtype usb; " \
+		"usb start ${usbdev}; " \
+		"if usb dev ${usbdev}; then " \
+			"if run loadbootenv; then " \
+				"echo Loaded environment from ${bootenv};" \
+				"run importbootenv;" \
+			"fi;" \
+			"if test -n $uenvcmd; then " \
+				"echo Running uenvcmd ...;" \
+				"run uenvcmd;" \
+			"fi;" \
+			"if run loadimage; then " \
+				"run loadfdt; " \
+				"echo Booting from usb ${usbdev}...; " \
+				"run usbargs;" \
+				"bootz ${loadaddr} - ${fdtaddr}; " \
+			"fi;" \
+		"fi\0" \
 	"findfdt="\
 		"if test $board_name = AM43EPOS; then " \
 			"setenv fdtfile am43x-epos-evm.dtb; fi; " \
@@ -139,7 +172,8 @@
 
 #define CONFIG_BOOTCOMMAND \
 	"run findfdt; " \
-	"run mmcboot;"
+	"run mmcboot;" \
+	"run usbboot;"
 
 #endif
 #endif	/* __CONFIG_AM43XX_EVM_H */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [U-Boot, v2, 1/4] spl: common: Properly ignore spl/Makefile in .gitignore
  2014-01-16 17:23 [U-Boot] [uBoot] [Patch v2 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Dan Murphy
                   ` (2 preceding siblings ...)
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 4/4] arm: am43xx: Add USB spl boot support Dan Murphy
@ 2014-01-20 23:00 ` Tom Rini
  3 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2014-01-20 23:00 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 16, 2014 at 11:23:28AM -0600, Dan Murphy wrote:

> The spl directory is ignored by git as these objects are created
> during spl creation.  The only file not created is the Makefile.
> 
> This file can be modified and checked in via git.
> 
> Due to the order of rule precedence having the whole directory
> ignored first then indicating not to ignore the Makefile is not correct
> the message to force adding the Makefile is still shown.
> 
> So reorder the .gitignore for the Makefile and indicate that the Makefile
> does not need to be ignored first and then indicate everything else in spl
> should be ignored after wards.
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Applied to u-boot/master, thanks!

-- 
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/20140120/4df617d9/attachment.pgp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [U-Boot, v2, 2/4] spl: common: Move FAT funcs to a common file
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 2/4] spl: common: Move FAT funcs to a common file Dan Murphy
@ 2014-01-27 14:56   ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2014-01-27 14:56 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 16, 2014 at 11:23:29AM -0600, Dan Murphy wrote:

> Move the FAT functions to a common location for reuse.
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Applied to u-boot/master, thanks!

-- 
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/20140127/6d1d170d/attachment.pgp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [U-Boot, v2, 3/4] spl: common: Support for USB MSD FAT image loading
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 3/4] spl: common: Support for USB MSD FAT image loading Dan Murphy
@ 2014-01-27 14:56   ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2014-01-27 14:56 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 16, 2014 at 11:23:30AM -0600, Dan Murphy wrote:

> Add SPL support to be able to detect a USB Mass Storage device
> connected to a USB host.  Once a USB Mass storage device is detected
> the SPL will load the u-boot.img from a FAT partition to target address.
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Applied to u-boot/master, thanks!

-- 
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/20140127/5f840a53/attachment.pgp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [U-Boot,v2,4/4] arm: am43xx: Add USB spl boot support
  2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 4/4] arm: am43xx: Add USB spl boot support Dan Murphy
@ 2014-01-27 14:57   ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2014-01-27 14:57 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 16, 2014 at 11:23:31AM -0600, Dan Murphy wrote:

> Add the USB host boot support for the am43xx evm
> Add the macros to boot from a usb drive in uBoot
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>

Applied to u-boot/master, thanks!

-- 
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/20140127/ee76b8b6/attachment.pgp>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-27 14:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16 17:23 [U-Boot] [uBoot] [Patch v2 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Dan Murphy
2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 2/4] spl: common: Move FAT funcs to a common file Dan Murphy
2014-01-27 14:56   ` [U-Boot] [U-Boot, v2, " Tom Rini
2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 3/4] spl: common: Support for USB MSD FAT image loading Dan Murphy
2014-01-27 14:56   ` [U-Boot] [U-Boot, v2, " Tom Rini
2014-01-16 17:23 ` [U-Boot] [uBoot] [Patch v2 4/4] arm: am43xx: Add USB spl boot support Dan Murphy
2014-01-27 14:57   ` [U-Boot] [U-Boot,v2,4/4] " Tom Rini
2014-01-20 23:00 ` [U-Boot] [U-Boot, v2, 1/4] spl: common: Properly ignore spl/Makefile in .gitignore Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox