diff mbox

[U-Boot,V2,1/9] spl: replace CONFIG_SPL_SPI_* with CONFIG_SF_DEFAULT_*

Message ID 1407416736-14639-2-git-send-email-nikita@compulab.co.il
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Nikita Kiryanov Aug. 7, 2014, 1:05 p.m. UTC
Currently, CONFIG_SPL_SPI_* #defines are used for controlling SPI boot in
SPL. These #defines do not allow the user to select SPI mode for the SPI flash
(there's no CONFIG_SPL_SPI_MODE, so the SPI mode is hardcoded in
spi_spl_load.c), and duplicate information already provided by
CONFIG_SF_DEFAULT_* #defines.

Kill CONFIG_SPL_SPI_*, and use CONFIG_SF_DEFAULT_* instead.

Cc: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Vitaly Andrianov <vitalya@ti.com>
Cc: Lars Poeschel <poeschel@lemonage.de>
Cc: Bo Shen <voice.shen@atmel.com>
Cc: Hannes Petermaier <hannes.petermaier@br-automation.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V2:
	- New patch replacing "spl: improve spi configuration".

 common/cmd_sf.c                        | 13 -------------
 drivers/mtd/spi/spi_spl_load.c         |  6 ++++--
 include/configs/am335x_evm.h           |  2 --
 include/configs/da850evm.h             |  4 ----
 include/configs/dra7xx_evm.h           |  2 --
 include/configs/ks2_evm.h              |  2 --
 include/configs/pcm051.h               |  2 --
 include/configs/sama5d3xek.h           |  2 --
 include/configs/siemens-am33x-common.h |  2 --
 include/configs/tseries.h              |  2 --
 include/configs/zynq-common.h          |  2 --
 include/spi_flash.h                    | 13 +++++++++++++
 12 files changed, 17 insertions(+), 35 deletions(-)

Comments

Marek Vasut Aug. 7, 2014, 1:49 p.m. UTC | #1
On Thursday, August 07, 2014 at 03:05:28 PM, Nikita Kiryanov wrote:
> Currently, CONFIG_SPL_SPI_* #defines are used for controlling SPI boot in
> SPL. These #defines do not allow the user to select SPI mode for the SPI
> flash (there's no CONFIG_SPL_SPI_MODE, so the SPI mode is hardcoded in
> spi_spl_load.c), and duplicate information already provided by
> CONFIG_SF_DEFAULT_* #defines.
> 
> Kill CONFIG_SPL_SPI_*, and use CONFIG_SF_DEFAULT_* instead.
> 
> Cc: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> Cc: Vitaly Andrianov <vitalya@ti.com>
> Cc: Lars Poeschel <poeschel@lemonage.de>
> Cc: Bo Shen <voice.shen@atmel.com>
> Cc: Hannes Petermaier <hannes.petermaier@br-automation.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Marek Vasut <marex@denx.de>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>

Oh, right. This doesn't collide with the Kconfig work, does it ?

Otherwise, I see this as OK,

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Nikita Kiryanov Aug. 10, 2014, 3:19 p.m. UTC | #2
On 07/08/14 16:49, Marek Vasut wrote:
> On Thursday, August 07, 2014 at 03:05:28 PM, Nikita Kiryanov wrote:
>> Currently, CONFIG_SPL_SPI_* #defines are used for controlling SPI boot in
>> SPL. These #defines do not allow the user to select SPI mode for the SPI
>> flash (there's no CONFIG_SPL_SPI_MODE, so the SPI mode is hardcoded in
>> spi_spl_load.c), and duplicate information already provided by
>> CONFIG_SF_DEFAULT_* #defines.
>>
>> Kill CONFIG_SPL_SPI_*, and use CONFIG_SF_DEFAULT_* instead.
>>
>> Cc: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
>> Cc: Tom Rini <trini@ti.com>
>> Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
>> Cc: Lokesh Vutla <lokeshvutla@ti.com>
>> Cc: Vitaly Andrianov <vitalya@ti.com>
>> Cc: Lars Poeschel <poeschel@lemonage.de>
>> Cc: Bo Shen <voice.shen@atmel.com>
>> Cc: Hannes Petermaier <hannes.petermaier@br-automation.com>
>> Cc: Michal Simek <monstr@monstr.eu>
>> Cc: Marek Vasut <marex@denx.de>
>> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
>
> Oh, right. This doesn't collide with the Kconfig work, does it ?

It does not.
(No "config CONFIG_SPL_SPI_*", nor "config CONFIG_SF_DEFAULT_*" in any 
Kconfig files)

>
> Otherwise, I see this as OK,
>
> Reviewed-by: Marek Vasut <marex@denx.de>
>
> Best regards,
> Marek Vasut
>
Marek Vasut Aug. 10, 2014, 8:39 p.m. UTC | #3
On Sunday, August 10, 2014 at 05:19:38 PM, Nikita Kiryanov wrote:
> On 07/08/14 16:49, Marek Vasut wrote:
> > On Thursday, August 07, 2014 at 03:05:28 PM, Nikita Kiryanov wrote:
> >> Currently, CONFIG_SPL_SPI_* #defines are used for controlling SPI boot
> >> in SPL. These #defines do not allow the user to select SPI mode for the
> >> SPI flash (there's no CONFIG_SPL_SPI_MODE, so the SPI mode is hardcoded
> >> in spi_spl_load.c), and duplicate information already provided by
> >> CONFIG_SF_DEFAULT_* #defines.
> >> 
> >> Kill CONFIG_SPL_SPI_*, and use CONFIG_SF_DEFAULT_* instead.
> >> 
> >> Cc: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
> >> Cc: Tom Rini <trini@ti.com>
> >> Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> >> Cc: Lokesh Vutla <lokeshvutla@ti.com>
> >> Cc: Vitaly Andrianov <vitalya@ti.com>
> >> Cc: Lars Poeschel <poeschel@lemonage.de>
> >> Cc: Bo Shen <voice.shen@atmel.com>
> >> Cc: Hannes Petermaier <hannes.petermaier@br-automation.com>
> >> Cc: Michal Simek <monstr@monstr.eu>
> >> Cc: Marek Vasut <marex@denx.de>
> >> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> > 
> > Oh, right. This doesn't collide with the Kconfig work, does it ?
> 
> It does not.
> (No "config CONFIG_SPL_SPI_*", nor "config CONFIG_SF_DEFAULT_*" in any
> Kconfig files)

Coolness, now it's up to Jagan to pick this stuff up I guess :)

Thanks,

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index b4ceb71..c60e8d1 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -13,19 +13,6 @@ 
 
 #include <asm/io.h>
 
-#ifndef CONFIG_SF_DEFAULT_SPEED
-# define CONFIG_SF_DEFAULT_SPEED	1000000
-#endif
-#ifndef CONFIG_SF_DEFAULT_MODE
-# define CONFIG_SF_DEFAULT_MODE		SPI_MODE_3
-#endif
-#ifndef CONFIG_SF_DEFAULT_CS
-# define CONFIG_SF_DEFAULT_CS		0
-#endif
-#ifndef CONFIG_SF_DEFAULT_BUS
-# define CONFIG_SF_DEFAULT_BUS		0
-#endif
-
 static struct spi_flash *flash;
 
 
diff --git a/drivers/mtd/spi/spi_spl_load.c b/drivers/mtd/spi/spi_spl_load.c
index 1954b7e..59cca0f 100644
--- a/drivers/mtd/spi/spi_spl_load.c
+++ b/drivers/mtd/spi/spi_spl_load.c
@@ -56,8 +56,10 @@  void spl_spi_load_image(void)
 	 * Load U-Boot image from SPI flash into RAM
 	 */
 
-	flash = spi_flash_probe(CONFIG_SPL_SPI_BUS, CONFIG_SPL_SPI_CS,
-				CONFIG_SF_DEFAULT_SPEED, SPI_MODE_3);
+	flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
+				CONFIG_SF_DEFAULT_CS,
+				CONFIG_SF_DEFAULT_SPEED,
+				CONFIG_SF_DEFAULT_MODE);
 	if (!flash) {
 		puts("SPI probe failed.\n");
 		hang();
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 35ae0e6..750aedd 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -381,8 +381,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS		0
-#define CONFIG_SPL_SPI_CS		0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
 
 #define CONFIG_ENV_IS_IN_SPI_FLASH
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index b279409..bd94b04 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -157,8 +157,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS 0
-#define CONFIG_SPL_SPI_CS 0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x8000
 #define CONFIG_SYS_SPI_U_BOOT_SIZE	0x30000
 #endif
@@ -377,8 +375,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS 0
-#define CONFIG_SPL_SPI_CS 0
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 8d0a0eb..0f91ef8 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -115,8 +115,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
-#define CONFIG_SPL_SPI_BUS             0
-#define CONFIG_SPL_SPI_CS              0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS     0x40000
 
 #define CONFIG_SUPPORT_EMMC_BOOT
diff --git a/include/configs/ks2_evm.h b/include/configs/ks2_evm.h
index 43db581..51926f7 100644
--- a/include/configs/ks2_evm.h
+++ b/include/configs/ks2_evm.h
@@ -58,8 +58,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS		0
-#define CONFIG_SPL_SPI_CS		0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	CONFIG_SPL_PAD_TO
 #define CONFIG_SPL_FRAMEWORK
 
diff --git a/include/configs/pcm051.h b/include/configs/pcm051.h
index 9af3efd..9bbd093 100644
--- a/include/configs/pcm051.h
+++ b/include/configs/pcm051.h
@@ -233,8 +233,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS		0
-#define CONFIG_SPL_SPI_CS		0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
 #define CONFIG_SYS_SPI_U_BOOT_SIZE	0x40000
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/am33xx/u-boot-spl.lds"
diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h
index da27180..6f13542 100644
--- a/include/configs/sama5d3xek.h
+++ b/include/configs/sama5d3xek.h
@@ -288,8 +288,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS		0
-#define CONFIG_SPL_SPI_CS		0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x8400
 
 #endif
diff --git a/include/configs/siemens-am33x-common.h b/include/configs/siemens-am33x-common.h
index 53816a6..510c9af 100644
--- a/include/configs/siemens-am33x-common.h
+++ b/include/configs/siemens-am33x-common.h
@@ -168,8 +168,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS		0
-#define CONFIG_SPL_SPI_CS		0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
 
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/am33xx/u-boot-spl.lds"
diff --git a/include/configs/tseries.h b/include/configs/tseries.h
index 1fd6e32..2497a1e 100644
--- a/include/configs/tseries.h
+++ b/include/configs/tseries.h
@@ -222,8 +222,6 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
-#define CONFIG_SPL_SPI_BUS		0
-#define CONFIG_SPL_SPI_CS		0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
 #undef CONFIG_ENV_IS_NOWHERE
 #define CONFIG_ENV_IS_IN_SPI_FLASH
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index 690cacb..12c8f45 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -305,9 +305,7 @@ 
 #define CONFIG_SPL_SPI_SUPPORT
 #define CONFIG_SPL_SPI_LOAD
 #define CONFIG_SPL_SPI_FLASH_SUPPORT
-#define CONFIG_SPL_SPI_BUS	0
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x100000
-#define CONFIG_SPL_SPI_CS	0
 #endif
 
 /* for booting directly linux */
diff --git a/include/spi_flash.h b/include/spi_flash.h
index 2db53c7..43f7f2c 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -19,6 +19,19 @@ 
 #include <linux/types.h>
 #include <linux/compiler.h>
 
+#ifndef CONFIG_SF_DEFAULT_SPEED
+	#define CONFIG_SF_DEFAULT_SPEED		1000000
+#endif
+#ifndef CONFIG_SF_DEFAULT_MODE
+	#define CONFIG_SF_DEFAULT_MODE		SPI_MODE_3
+#endif
+#ifndef CONFIG_SF_DEFAULT_CS
+	#define CONFIG_SF_DEFAULT_CS		0
+#endif
+#ifndef CONFIG_SF_DEFAULT_BUS
+	#define CONFIG_SF_DEFAULT_BUS		0
+#endif
+
 /* sf param flags */
 #define SECT_4K		1 << 1
 #define SECT_32K	1 << 2