Skip to contentSkip to conversation

spl: common: Properly ignore spl/Makefile in .gitignore

PATCH Superseded Dan Murphy 1 participant 4 messages Jan 10, 2014 – Jan 13, 2014 Arm (32-bit)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/3 spl: common: Properly ignore spl/Makefile in .gitignore

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.

---
 .gitignore |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.gitignore +1 -1
index 3b14c25..7f006c8 100644
@@ -57,8 +57,8 @@
 /errlog
 /reloc_off
 
-/spl/
 !/spl/Makefile
+/spl/*
 /tpl/
 
 /include/generated/
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/3 spl: common: Move FAT funcs to a common file

Move the FAT functions to a common location for reuse.

---
 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
common/spl/Makefile +1 -0
index 5c0637b..c8d5963 100644
@@ -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
common/spl/spl_fat.c new file +96 -0

96 lines not on this page · raw message

common/spl/spl_mmc.c +6 -62

91 lines not on this page · raw message

include/spl.h +5 -0
index 2bd6e16..cd5cd26 100644
@@ -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
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 3/3 spl: common: Support for USB MSD FAT image loading

In reply to Dan Murphy

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.

---
 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
arch/arm/include/asm/arch-am33xx/spl.h +11 -3
index 95de9aa..cd1d88d 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 */
@@ -31,9 +32,16 @@
 #define BOOT_DEVICE_MMC2_2      0xFF
 #endif
 
-#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
common/Makefile +4 -0
index d12cba5..4d99ecd 100644
@@ -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
common/spl/Makefile +1 -0
index c8d5963..65a1484f 100644
@@ -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
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_fat.c +8 -8
index 9b40584..1e532d5 100644
@@ -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;
 	}
common/spl/spl_usb.c new file +58 -0

58 lines not on this page · raw message

include/spl.h +3 -0
index cd5cd26..5e24856 100644
@@ -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);
spl/Makefile +2 -0
index 1e88d74..06edcf0 100644
@@ -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/
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH 3/3 spl: common: Support for USB MSD FAT image loading

Quoted 22 lines · Dan Murphy

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.

---
 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
arch/arm/include/asm/arch-am33xx/spl.h +0 -0
index 95de9aa..cd1d88d 100644

arch/arm/include/asm/arch-am33xx/spl.h line 23

Quoted 4 lines
arch/arm/include/asm/arch-am33xx/spl.h +1 -0
@@ -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

After a rebase it appears this does not get merged to the right spot.

I can submit a V2 if the maintainer wants me to or it can be a fix up once applied.

<snip>

Signature · 2 lines
------------------
Dan Murphy