Re: [U-Boot] [PATCH v2 07/27] spl: Convert boot_device into a struct

2016-09-27 Thread Tom Rini
On Sat, Sep 24, 2016 at 06:19:57PM -0600, Simon Glass wrote:

> At present some spl_xxx_load_image() functions take a parameter and some
> don't. Of those that do, most take an integer but one takes a string.
> 
> Convert this parameter into a struct so that we can pass all functions the
> same thing. This will allow us to use a common function signature.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/27] spl: Convert boot_device into a struct

2016-09-24 Thread Simon Glass
At present some spl_xxx_load_image() functions take a parameter and some
don't. Of those that do, most take an integer but one takes a string.

Convert this parameter into a struct so that we can pass all functions the
same thing. This will allow us to use a common function signature.

Signed-off-by: Simon Glass 
---

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 | 37 ++---
 common/spl/spl_mmc.c |  6 ++---
 common/spl/spl_nand.c|  2 +-
 common/spl/spl_net.c |  6 ++---
 common/spl/spl_nor.c |  2 +-
 common/spl/spl_onenand.c |  2 +-
 common/spl/spl_sata.c|  2 +-
 common/spl/spl_ubi.c |  6 ++---
 common/spl/spl_usb.c |  2 +-
 common/spl/spl_ymodem.c  |  2 +-
 drivers/mtd/spi/spi_spl_load.c   |  2 +-
 drivers/mtd/spi/sunxi_spi_spl.c  |  2 +-
 include/spl.h| 40 
 16 files changed, 70 insertions(+), 47 deletions(-)

diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 6d9518d..8a385a2 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -133,7 +133,7 @@ static int gpio_init(void)
return 0;
 }
 
-int spl_board_load_image(void)
+int spl_board_load_image(struct spl_boot_device *bootdev)
 {
debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr);
return_to_fel(fel_stash.sp, fel_stash.lr);
diff --git a/arch/arm/mach-uniphier/boot-mode/spl_board.c 
b/arch/arm/mach-uniphier/boot-mode/spl_board.c
index 63ab41c..4eadc2f 100644
--- a/arch/arm/mach-uniphier/boot-mode/spl_board.c
+++ b/arch/arm/mach-uniphier/boot-mode/spl_board.c
@@ -65,7 +65,7 @@ int uniphier_rom_get_mmc_funcptr(int (**send_cmd)(u32, u32),
return 0;
 }
 
-int spl_board_load_image(void)
+int spl_board_load_image(struct spl_boot_device *bootdev)
 {
int (*send_cmd)(u32 cmd, u32 arg);
int (*card_blockaddr)(u32 rca);
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index e8349c0..4cee293 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -38,7 +38,7 @@ void spl_board_announce_boot_device(void)
printf("%s\n", fname);
 }
 
-int spl_board_load_image(void)
+int spl_board_load_image(struct spl_boot_device *bootdev)
 {
char fname[256];
int ret;
diff --git a/common/spl/spl.c b/common/spl/spl.c
index cb96ef3..3716e6a 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -185,7 +185,7 @@ static ulong spl_ram_load_read(struct spl_load_info *load, 
ulong sector,
return count;
 }
 
-static int spl_ram_load_image(void)
+static int spl_ram_load_image(struct spl_boot_device *bootdev)
 {
struct image_header *header;
 
@@ -346,66 +346,71 @@ static inline void announce_boot_device(u32 boot_device) 
{ }
 
 static int spl_load_image(u32 boot_device)
 {
+   struct spl_boot_device bootdev;
+
+   bootdev.boot_device = boot_device;
+   bootdev.boot_device_name = NULL;
+
switch (boot_device) {
 #ifdef CONFIG_SPL_RAM_DEVICE
case BOOT_DEVICE_RAM:
-   return spl_ram_load_image();
+   return spl_ram_load_image();
 #endif
 #ifdef CONFIG_SPL_MMC_SUPPORT
case BOOT_DEVICE_MMC1:
case BOOT_DEVICE_MMC2:
case BOOT_DEVICE_MMC2_2:
-   return spl_mmc_load_image(boot_device);
+   return spl_mmc_load_image();
 #endif
 #ifdef CONFIG_SPL_UBI
case BOOT_DEVICE_NAND:
case BOOT_DEVICE_ONENAND:
-   return spl_ubi_load_image(boot_device);
+   return spl_ubi_load_image();
 #else
 #ifdef CONFIG_SPL_NAND_SUPPORT
case BOOT_DEVICE_NAND:
-   return spl_nand_load_image();
+   return spl_nand_load_image();
 #endif
 #ifdef CONFIG_SPL_ONENAND_SUPPORT
case BOOT_DEVICE_ONENAND:
-   return spl_onenand_load_image();
+   return spl_onenand_load_image();
 #endif
 #endif
 #ifdef CONFIG_SPL_NOR_SUPPORT
case BOOT_DEVICE_NOR:
-   return spl_nor_load_image();
+   return spl_nor_load_image();
 #endif
 #ifdef CONFIG_SPL_YMODEM_SUPPORT
case BOOT_DEVICE_UART:
-   return spl_ymodem_load_image();
+   return spl_ymodem_load_image();
 #endif
 #if defined(CONFIG_SPL_SPI_SUPPORT) || defined(CONFIG_SPL_SPI_FLASH_SUPPORT)
case BOOT_DEVICE_SPI:
-   return spl_spi_load_image();
+   return spl_spi_load_image();
 #endif
 #ifdef CONFIG_SPL_ETH_SUPPORT
case BOOT_DEVICE_CPGMAC:
 #ifdef CONFIG_SPL_ETH_DEVICE
-   return