* [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro
@ 2016-11-30 22:30 Simon Glass
2016-11-30 22:30 ` [U-Boot] [PATCH v2 2/8] spl: Add a name to the SPL load-image methods Simon Glass
` (7 more replies)
0 siblings, 8 replies; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
A double underscore is normally reserved for compiler predefines. Use a
single underscore instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
include/spl.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/spl.h b/include/spl.h
index e080a82..11bdc2d 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -172,15 +172,15 @@ struct spl_image_loader {
ll_entry_declare(struct spl_image_loader, __name, spl_image_loader)
/*
- * __priority is the priority of this method, 0 meaning it will be the top
+ * _priority is the priority of this method, 0 meaning it will be the top
* choice for this device, 9 meaning it is the bottom choice.
- * __boot_device is the BOOT_DEVICE_... value
- * __method is the load_image function to call
+ * _boot_device is the BOOT_DEVICE_... value
+ * _method is the load_image function to call
*/
-#define SPL_LOAD_IMAGE_METHOD(__priority, __boot_device, __method) \
- SPL_LOAD_IMAGE(__method ## __priority ## __boot_device) = { \
- .boot_device = __boot_device, \
- .load_image = __method, \
+#define SPL_LOAD_IMAGE_METHOD(_priority, _boot_device, _method) \
+ SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
+ .boot_device = _boot_device, \
+ .load_image = _method, \
}
/* SPL FAT image functions */
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH v2 2/8] spl: Add a name to the SPL load-image methods
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
@ 2016-11-30 22:30 ` Simon Glass
2016-12-12 13:36 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 3/8] spl: Move the loading code into its own function Simon Glass
` (6 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
It is useful to name each method so that we can print out this name when
using the method. Currently this happens using a separate function. In
preparation for unifying this, add a name to each method.
The name is only available if we have libcommon support (i.e can use
printf()).
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
arch/arm/mach-sunxi/board.c | 2 +-
arch/arm/mach-uniphier/boot-mode/spl_board.c | 2 +-
arch/sandbox/cpu/spl.c | 2 +-
common/spl/spl.c | 4 ++--
common/spl/spl_mmc.c | 6 +++---
common/spl/spl_nand.c | 2 +-
common/spl/spl_net.c | 5 +++--
common/spl/spl_nor.c | 2 +-
common/spl/spl_onenand.c | 3 ++-
common/spl/spl_sata.c | 2 +-
common/spl/spl_spi.c | 2 +-
common/spl/spl_ubi.c | 4 ++--
common/spl/spl_usb.c | 2 +-
common/spl/spl_ymodem.c | 2 +-
drivers/mtd/spi/sunxi_spi_spl.c | 2 +-
include/spl.h | 15 ++++++++++++++-
16 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 0f8ead9..205236d 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -142,7 +142,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
return 0;
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
+SPL_LOAD_IMAGE_METHOD("FEL", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
#endif
void s_init(void)
diff --git a/arch/arm/mach-uniphier/boot-mode/spl_board.c b/arch/arm/mach-uniphier/boot-mode/spl_board.c
index 854ab05..ba84087 100644
--- a/arch/arm/mach-uniphier/boot-mode/spl_board.c
+++ b/arch/arm/mach-uniphier/boot-mode/spl_board.c
@@ -127,4 +127,4 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
return 0;
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
+SPL_LOAD_IMAGE_METHOD("eMMC", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 1ad7fb6..632446b 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -51,7 +51,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
/* Hopefully this will not return */
return os_spl_to_uboot(fname);
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
+SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
void spl_board_init(void)
{
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 32b9f1e..9c11ab1 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -221,10 +221,10 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
return 0;
}
#if defined(CONFIG_SPL_RAM_DEVICE)
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
+SPL_LOAD_IMAGE_METHOD("RAM", 0, BOOT_DEVICE_RAM, spl_ram_load_image);
#endif
#if defined(CONFIG_SPL_DFU_SUPPORT)
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
+SPL_LOAD_IMAGE_METHOD("USB DFU", 0, BOOT_DEVICE_DFU, spl_ram_load_image);
#endif
#endif
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 0b681c2..f326827 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -352,6 +352,6 @@ static int spl_mmc_load_image(struct spl_image_info *spl_image,
return err;
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);
+SPL_LOAD_IMAGE_METHOD("MMC1", 0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
+SPL_LOAD_IMAGE_METHOD("MMC2", 0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
+SPL_LOAD_IMAGE_METHOD("MMC2_2", 0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index d1abda6..cd39f9b 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -151,4 +151,4 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
}
#endif
/* Use priorty 1 so that Ubi can override this */
-SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_NAND, spl_nand_load_image);
+SPL_LOAD_IMAGE_METHOD("NAND", 1, BOOT_DEVICE_NAND, spl_nand_load_image);
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index f4b4bc4..0fba017 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -51,7 +51,8 @@ int spl_net_load_image_cpgmac(struct spl_image_info *spl_image,
return spl_net_load_image(spl_image, bootdev);
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_CPGMAC, spl_net_load_image_cpgmac);
+SPL_LOAD_IMAGE_METHOD("eth device", 0, BOOT_DEVICE_CPGMAC,
+ spl_net_load_image_cpgmac);
#endif
#ifdef CONFIG_SPL_USBETH_SUPPORT
@@ -62,5 +63,5 @@ int spl_net_load_image_usb(struct spl_image_info *spl_image,
return spl_net_load_image(spl_image, bootdev);
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);
+SPL_LOAD_IMAGE_METHOD("USB eth", 0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);
#endif
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 6bfa399..d07ca84 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -71,4 +71,4 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
return 0;
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NOR, spl_nor_load_image);
+SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);
diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
index f076e2c..fc98e9c 100644
--- a/common/spl/spl_onenand.c
+++ b/common/spl/spl_onenand.c
@@ -36,4 +36,5 @@ static int spl_onenand_load_image(struct spl_image_info *spl_image,
return 0;
}
/* Use priorty 1 so that Ubi can override this */
-SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_ONENAND, spl_onenand_load_image);
+SPL_LOAD_IMAGE_METHOD("OneNAND", 1, BOOT_DEVICE_ONENAND,
+ spl_onenand_load_image);
diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index a3c07cd..5476206 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -57,4 +57,4 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
return 0;
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SATA, spl_sata_load_image);
+SPL_LOAD_IMAGE_METHOD("SATA", 0, BOOT_DEVICE_SATA, spl_sata_load_image);
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 78b8cd1..cd1d6b2 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -125,4 +125,4 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
return err;
}
/* Use priorty 1 so that boards can override this */
-SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_SPI, spl_spi_load_image);
+SPL_LOAD_IMAGE_METHOD("SPI", 1, BOOT_DEVICE_SPI, spl_spi_load_image);
diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c
index c03910b..24633f4 100644
--- a/common/spl/spl_ubi.c
+++ b/common/spl/spl_ubi.c
@@ -78,5 +78,5 @@ out:
return ret;
}
/* Use priorty 0 so that Ubi will override NAND and ONENAND methods */
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NAND, spl_ubi_load_image);
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_ONENAND, spl_ubi_load_image);
+SPL_LOAD_IMAGE_METHOD("NAND", 0, BOOT_DEVICE_NAND, spl_ubi_load_image);
+SPL_LOAD_IMAGE_METHOD("OneNAND", 0, BOOT_DEVICE_ONENAND, spl_ubi_load_image);
diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c
index e37966e..567a450 100644
--- a/common/spl/spl_usb.c
+++ b/common/spl/spl_usb.c
@@ -65,4 +65,4 @@ static int spl_usb_load_image(struct spl_image_info *spl_image,
return 0;
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USB, spl_usb_load_image);
+SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_usb_load_image);
diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
index 957894d..ff8085b 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -132,4 +132,4 @@ end_stream:
printf("Loaded %d bytes\n", size);
return 0;
}
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_UART, spl_ymodem_load_image);
+SPL_LOAD_IMAGE_METHOD("UART", 0, BOOT_DEVICE_UART, spl_ymodem_load_image);
diff --git a/drivers/mtd/spi/sunxi_spi_spl.c b/drivers/mtd/spi/sunxi_spi_spl.c
index 7502314..e70064c 100644
--- a/drivers/mtd/spi/sunxi_spi_spl.c
+++ b/drivers/mtd/spi/sunxi_spi_spl.c
@@ -284,4 +284,4 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
return 0;
}
/* Use priorty 0 to override the default if it happens to be linked in */
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SPI, spl_spi_load_image);
+SPL_LOAD_IMAGE_METHOD("sunxi SPI" 0, BOOT_DEVICE_SPI, spl_spi_load_image);
diff --git a/include/spl.h b/include/spl.h
index 11bdc2d..3470733 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -152,10 +152,14 @@ struct spl_boot_device {
/**
* Holds information about a way of loading an SPL image
*
+ * @name: User-friendly name for this method (e.g. "MMC")
* @boot_device: Boot device that this loader supports
* @load_image: Function to call to load image
*/
struct spl_image_loader {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ const char *name;
+#endif
uint boot_device;
/**
* load_image() - Load an SPL image
@@ -177,11 +181,20 @@ struct spl_image_loader {
* _boot_device is the BOOT_DEVICE_... value
* _method is the load_image function to call
*/
-#define SPL_LOAD_IMAGE_METHOD(_priority, _boot_device, _method) \
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
+ .name = _name, \
.boot_device = _boot_device, \
.load_image = _method, \
}
+#else
+#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
+ SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
+ .boot_device = _boot_device, \
+ .load_image = _method, \
+ }
+#endif
/* SPL FAT image functions */
int spl_load_image_fat(struct spl_image_info *spl_image,
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH v2 3/8] spl: Move the loading code into its own function
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
2016-11-30 22:30 ` [U-Boot] [PATCH v2 2/8] spl: Add a name to the SPL load-image methods Simon Glass
@ 2016-11-30 22:30 ` Simon Glass
2016-12-12 13:37 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 4/8] spl: Pass the loader into spl_load_image() Simon Glass
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
Create a boot_from_devices() function to handle trying each device. This
helps to reduce the size of the already-large board_init_r() function.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Drop incorrect use of ARRAY_SIZE in boot_from_devices()
- Add a function comment to boot_from_devices()
common/spl/spl.c | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 9c11ab1..f97d5b4 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -374,12 +374,36 @@ static int spl_load_image(struct spl_image_info *spl_image, u32 boot_device)
bootdev.boot_device = boot_device;
bootdev.boot_device_name = NULL;
- if (loader)
- return loader->load_image(spl_image, &bootdev);
+ return loader->load_image(spl_image, &bootdev);
+}
+
+/**
+ * boot_from_devices() - Try loading an booting U-Boot from a list of devices
+ *
+ * @spl_image: Place to put the image details if successful
+ * @spl_boot_list: List of boot devices to try
+ * @count: Number of elements in spl_boot_list
+ * @return 0 if OK, -ve on error
+ */
+static int boot_from_devices(struct spl_image_info *spl_image,
+ u32 spl_boot_list[], int count)
+{
+ int i;
+
+ for (i = 0; i < count && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
+ struct spl_image_loader *loader;
+
+ announce_boot_device(spl_boot_list[i]);
+ loader = spl_ll_find_loader(spl_boot_list[i]);
#if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
- puts("SPL: Unsupported Boot Device!\n");
+ if (!loader)
+ puts("SPL: Unsupported Boot Device!\n");
#endif
+ if (loader && !spl_load_image(spl_image, spl_boot_list[i]))
+ return 0;
+ }
+
return -ENODEV;
}
@@ -393,7 +417,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
BOOT_DEVICE_NONE,
};
struct spl_image_info spl_image;
- int i;
debug(">>spl:board_init_r()\n");
@@ -420,15 +443,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
memset(&spl_image, '\0', sizeof(spl_image));
board_boot_order(spl_boot_list);
- for (i = 0; i < ARRAY_SIZE(spl_boot_list) &&
- spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
- announce_boot_device(spl_boot_list[i]);
- if (!spl_load_image(&spl_image, spl_boot_list[i]))
- break;
- }
- if (i == ARRAY_SIZE(spl_boot_list) ||
- spl_boot_list[i] == BOOT_DEVICE_NONE) {
+ if (boot_from_devices(&spl_image, spl_boot_list,
+ ARRAY_SIZE(spl_boot_list))) {
puts("SPL: failed to boot from all boot devices\n");
hang();
}
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH v2 4/8] spl: Pass the loader into spl_load_image()
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
2016-11-30 22:30 ` [U-Boot] [PATCH v2 2/8] spl: Add a name to the SPL load-image methods Simon Glass
2016-11-30 22:30 ` [U-Boot] [PATCH v2 3/8] spl: Move the loading code into its own function Simon Glass
@ 2016-11-30 22:30 ` Simon Glass
2016-12-12 13:39 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 5/8] spl: Drop announce_boot_device() Simon Glass
` (4 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
Rather than have this function figure out the correct loader again, pass
it in as a parameter.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
common/spl/spl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index f97d5b4..062b6cf 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -367,12 +367,12 @@ static struct spl_image_loader *spl_ll_find_loader(uint boot_device)
return NULL;
}
-static int spl_load_image(struct spl_image_info *spl_image, u32 boot_device)
+static int spl_load_image(struct spl_image_info *spl_image,
+ struct spl_image_loader *loader)
{
struct spl_boot_device bootdev;
- struct spl_image_loader *loader = spl_ll_find_loader(boot_device);
- bootdev.boot_device = boot_device;
+ bootdev.boot_device = loader->boot_device;
bootdev.boot_device_name = NULL;
return loader->load_image(spl_image, &bootdev);
@@ -400,7 +400,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
if (!loader)
puts("SPL: Unsupported Boot Device!\n");
#endif
- if (loader && !spl_load_image(spl_image, spl_boot_list[i]))
+ if (loader && !spl_load_image(spl_image, loader))
return 0;
}
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH v2 5/8] spl: Drop announce_boot_device()
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
` (2 preceding siblings ...)
2016-11-30 22:30 ` [U-Boot] [PATCH v2 4/8] spl: Pass the loader into spl_load_image() Simon Glass
@ 2016-11-30 22:30 ` Simon Glass
2016-12-12 13:40 ` [U-Boot] [U-Boot,v2,5/8] " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 6/8] spl: sunxi: Drop spl_board_announce_boot_device() Simon Glass
` (3 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
This task can be handled by inline code now. Drop this function.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
common/spl/spl.c | 86 ++------------------------------------------------------
1 file changed, 3 insertions(+), 83 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 062b6cf..b2eaeda 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -269,87 +269,6 @@ __weak void board_boot_order(u32 *spl_boot_list)
spl_boot_list[0] = spl_boot_device();
}
-#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
-__weak void spl_board_announce_boot_device(void) { }
-#endif
-
-#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-struct boot_device_name {
- u32 boot_dev;
- const char *name;
-};
-
-struct boot_device_name boot_name_table[] = {
-#ifdef CONFIG_SPL_RAM_DEVICE
- { BOOT_DEVICE_RAM, "RAM" },
-#endif
-#ifdef CONFIG_SPL_MMC_SUPPORT
- { BOOT_DEVICE_MMC1, "MMC1" },
- { BOOT_DEVICE_MMC2, "MMC2" },
- { BOOT_DEVICE_MMC2_2, "MMC2_2" },
-#endif
-#ifdef CONFIG_SPL_NAND_SUPPORT
- { BOOT_DEVICE_NAND, "NAND" },
-#endif
-#ifdef CONFIG_SPL_ONENAND_SUPPORT
- { BOOT_DEVICE_ONENAND, "OneNAND" },
-#endif
-#ifdef CONFIG_SPL_NOR_SUPPORT
- { BOOT_DEVICE_NOR, "NOR" },
-#endif
-#ifdef CONFIG_SPL_YMODEM_SUPPORT
- { BOOT_DEVICE_UART, "UART" },
-#endif
-#if defined(CONFIG_SPL_SPI_SUPPORT) || defined(CONFIG_SPL_SPI_FLASH_SUPPORT)
- { BOOT_DEVICE_SPI, "SPI" },
-#endif
-#ifdef CONFIG_SPL_ETH_SUPPORT
-#ifdef CONFIG_SPL_ETH_DEVICE
- { BOOT_DEVICE_CPGMAC, "eth device" },
-#else
- { BOOT_DEVICE_CPGMAC, "net" },
-#endif
-#endif
-#ifdef CONFIG_SPL_USBETH_SUPPORT
- { BOOT_DEVICE_USBETH, "USB eth" },
-#endif
-#ifdef CONFIG_SPL_USB_SUPPORT
- { BOOT_DEVICE_USB, "USB" },
-#endif
-#ifdef CONFIG_SPL_DFU_SUPPORT
- { BOOT_DEVICE_DFU, "USB DFU" },
-#endif
-#ifdef CONFIG_SPL_SATA_SUPPORT
- { BOOT_DEVICE_SATA, "SATA" },
-#endif
- /* Keep this entry last */
- { BOOT_DEVICE_NONE, "unknown boot device" },
-};
-
-static void announce_boot_device(u32 boot_device)
-{
- int i;
-
- puts("Trying to boot from ");
-
-#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
- if (boot_device == BOOT_DEVICE_BOARD) {
- spl_board_announce_boot_device();
- puts("\n");
- return;
- }
-#endif
- for (i = 0; i < ARRAY_SIZE(boot_name_table) - 1; i++) {
- if (boot_name_table[i].boot_dev == boot_device)
- break;
- }
-
- printf("%s\n", boot_name_table[i].name);
-}
-#else
-static inline void announce_boot_device(u32 boot_device) { }
-#endif
-
static struct spl_image_loader *spl_ll_find_loader(uint boot_device)
{
struct spl_image_loader *drv =
@@ -394,10 +313,11 @@ static int boot_from_devices(struct spl_image_info *spl_image,
for (i = 0; i < count && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
struct spl_image_loader *loader;
- announce_boot_device(spl_boot_list[i]);
loader = spl_ll_find_loader(spl_boot_list[i]);
#if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
- if (!loader)
+ if (loader)
+ printf("Trying to boot from %s", loader->name);
+ else
puts("SPL: Unsupported Boot Device!\n");
#endif
if (loader && !spl_load_image(spl_image, loader))
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH v2 6/8] spl: sunxi: Drop spl_board_announce_boot_device()
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
` (3 preceding siblings ...)
2016-11-30 22:30 ` [U-Boot] [PATCH v2 5/8] spl: Drop announce_boot_device() Simon Glass
@ 2016-11-30 22:30 ` Simon Glass
2016-12-12 13:40 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 7/8] spl: uniphier: " Simon Glass
` (2 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
This function is not used anymore. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
arch/arm/mach-sunxi/board.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 205236d..aa11493 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -247,15 +247,6 @@ u32 spl_boot_device(void)
return -1; /* Never reached */
}
-/*
- * Properly announce BOOT_DEVICE_BOARD as "FEL".
- * Overrides weak function from common/spl/spl.c
- */
-void spl_board_announce_boot_device(void)
-{
- printf("FEL");
-}
-
/* No confirmation data available in SPL yet. Hardcode bootmode */
u32 spl_boot_mode(const u32 boot_device)
{
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH v2 7/8] spl: uniphier: Drop spl_board_announce_boot_device()
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
` (4 preceding siblings ...)
2016-11-30 22:30 ` [U-Boot] [PATCH v2 6/8] spl: sunxi: Drop spl_board_announce_boot_device() Simon Glass
@ 2016-11-30 22:30 ` Simon Glass
2016-12-12 13:41 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 8/8] spl: sandbox: " Simon Glass
2016-12-12 13:36 ` [U-Boot] [U-Boot, v2, 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Tom Rini
7 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
This function is not used anymore. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
arch/arm/mach-uniphier/boot-mode/spl_board.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/arm/mach-uniphier/boot-mode/spl_board.c b/arch/arm/mach-uniphier/boot-mode/spl_board.c
index ba84087..a6b6686 100644
--- a/arch/arm/mach-uniphier/boot-mode/spl_board.c
+++ b/arch/arm/mach-uniphier/boot-mode/spl_board.c
@@ -12,11 +12,6 @@
#include "../soc-info.h"
-void spl_board_announce_boot_device(void)
-{
- printf("eMMC");
-}
-
struct uniphier_romfunc_table {
void *mmc_send_cmd;
void *mmc_card_blockaddr;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [PATCH v2 8/8] spl: sandbox: Drop spl_board_announce_boot_device()
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
` (5 preceding siblings ...)
2016-11-30 22:30 ` [U-Boot] [PATCH v2 7/8] spl: uniphier: " Simon Glass
@ 2016-11-30 22:30 ` Simon Glass
2016-12-12 13:41 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-12-12 13:36 ` [U-Boot] [U-Boot, v2, 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Tom Rini
7 siblings, 1 reply; 16+ messages in thread
From: Simon Glass @ 2016-11-30 22:30 UTC (permalink / raw)
To: u-boot
This function is not used anymore. Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2: None
arch/sandbox/cpu/spl.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index 632446b..7cc76d4 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -25,19 +25,6 @@ u32 spl_boot_device(void)
return BOOT_DEVICE_BOARD;
}
-void spl_board_announce_boot_device(void)
-{
- char fname[256];
- int ret;
-
- ret = os_find_u_boot(fname, sizeof(fname));
- if (ret) {
- printf("(%s not found, error %d)\n", fname, ret);
- return;
- }
- printf("%s\n", fname);
-}
-
static int spl_board_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
@@ -45,8 +32,10 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
int ret;
ret = os_find_u_boot(fname, sizeof(fname));
- if (ret)
+ if (ret) {
+ printf("(%s not found, error %d)\n", fname, ret);
return ret;
+ }
/* Hopefully this will not return */
return os_spl_to_uboot(fname);
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot, v2, 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
` (6 preceding siblings ...)
2016-11-30 22:30 ` [U-Boot] [PATCH v2 8/8] spl: sandbox: " Simon Glass
@ 2016-12-12 13:36 ` Tom Rini
7 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:36 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:49PM -0700, Simon Glass wrote:
> A double underscore is normally reserved for compiler predefines. Use a
> single underscore instead.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/db0e02ff/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot, v2, 2/8] spl: Add a name to the SPL load-image methods
2016-11-30 22:30 ` [U-Boot] [PATCH v2 2/8] spl: Add a name to the SPL load-image methods Simon Glass
@ 2016-12-12 13:36 ` Tom Rini
0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:36 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:50PM -0700, Simon Glass wrote:
> It is useful to name each method so that we can print out this name when
> using the method. Currently this happens using a separate function. In
> preparation for unifying this, add a name to each method.
>
> The name is only available if we have libcommon support (i.e can use
> printf()).
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/dc407e8d/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot, v2, 3/8] spl: Move the loading code into its own function
2016-11-30 22:30 ` [U-Boot] [PATCH v2 3/8] spl: Move the loading code into its own function Simon Glass
@ 2016-12-12 13:37 ` Tom Rini
0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:37 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:51PM -0700, Simon Glass wrote:
> Create a boot_from_devices() function to handle trying each device. This
> helps to reduce the size of the already-large board_init_r() function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/733d9285/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot, v2, 4/8] spl: Pass the loader into spl_load_image()
2016-11-30 22:30 ` [U-Boot] [PATCH v2 4/8] spl: Pass the loader into spl_load_image() Simon Glass
@ 2016-12-12 13:39 ` Tom Rini
0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:39 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:52PM -0700, Simon Glass wrote:
> Rather than have this function figure out the correct loader again, pass
> it in as a parameter.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/5182b91d/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot,v2,5/8] spl: Drop announce_boot_device()
2016-11-30 22:30 ` [U-Boot] [PATCH v2 5/8] spl: Drop announce_boot_device() Simon Glass
@ 2016-12-12 13:40 ` Tom Rini
0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:40 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:53PM -0700, Simon Glass wrote:
> This task can be handled by inline code now. Drop this function.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/c034e311/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot, v2, 6/8] spl: sunxi: Drop spl_board_announce_boot_device()
2016-11-30 22:30 ` [U-Boot] [PATCH v2 6/8] spl: sunxi: Drop spl_board_announce_boot_device() Simon Glass
@ 2016-12-12 13:40 ` Tom Rini
0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:40 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:54PM -0700, Simon Glass wrote:
> This function is not used anymore. Drop it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/9edc3014/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot, v2, 7/8] spl: uniphier: Drop spl_board_announce_boot_device()
2016-11-30 22:30 ` [U-Boot] [PATCH v2 7/8] spl: uniphier: " Simon Glass
@ 2016-12-12 13:41 ` Tom Rini
0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:41 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:55PM -0700, Simon Glass wrote:
> This function is not used anymore. Drop it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/b6beb717/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [U-Boot] [U-Boot, v2, 8/8] spl: sandbox: Drop spl_board_announce_boot_device()
2016-11-30 22:30 ` [U-Boot] [PATCH v2 8/8] spl: sandbox: " Simon Glass
@ 2016-12-12 13:41 ` Tom Rini
0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2016-12-12 13:41 UTC (permalink / raw)
To: u-boot
On Wed, Nov 30, 2016 at 03:30:56PM -0700, Simon Glass wrote:
> This function is not used anymore. Drop it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161212/db7fd402/attachment.sig>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-12-12 13:41 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 22:30 [U-Boot] [PATCH v2 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Simon Glass
2016-11-30 22:30 ` [U-Boot] [PATCH v2 2/8] spl: Add a name to the SPL load-image methods Simon Glass
2016-12-12 13:36 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 3/8] spl: Move the loading code into its own function Simon Glass
2016-12-12 13:37 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 4/8] spl: Pass the loader into spl_load_image() Simon Glass
2016-12-12 13:39 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 5/8] spl: Drop announce_boot_device() Simon Glass
2016-12-12 13:40 ` [U-Boot] [U-Boot,v2,5/8] " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 6/8] spl: sunxi: Drop spl_board_announce_boot_device() Simon Glass
2016-12-12 13:40 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 7/8] spl: uniphier: " Simon Glass
2016-12-12 13:41 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-11-30 22:30 ` [U-Boot] [PATCH v2 8/8] spl: sandbox: " Simon Glass
2016-12-12 13:41 ` [U-Boot] [U-Boot, v2, " Tom Rini
2016-12-12 13:36 ` [U-Boot] [U-Boot, v2, 1/8] spl: Use a single underscore in the SPL_LOAD_IMAGE_METHOD() macro Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox