
Currently we can define CONFIG_SPL_SPI_<any parameter except SPI MODE>. Define CONFIG_SPL_SPI_MODE option, and provide a default value for backwards compatibility. Default values are also provided for the rest of the spi_flash_probe parameters (like we do in cmd_sf), to help with config file brevity.
Cc: Jagannadha Sutradharudu Teki jagannadh.teki@gmail.com Cc: Tom Rini trini@ti.com Signed-off-by: Nikita Kiryanov nikita@compulab.co.il --- README | 7 +++++++ drivers/mtd/spi/spi_spl_load.c | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/README b/README index f704eb3..d7c55f8 100644 --- a/README +++ b/README @@ -2910,6 +2910,13 @@ CBFS (Coreboot Filesystem) support CONFIG_SF_DEFAULT_MODE (see include/spi.h) CONFIG_SF_DEFAULT_SPEED in Hz
+ The following defaults may be provided by the platform to + override SPL defaults for SPI. + + CONFIG_SPL_SPI_MODE SPI mode Default SPI_MODE3 + CONFIG_SPL_SPI_CS Chip-select Default 0 + CONFIG_SPL_SPI_BUS Bus identifier Default 0 + CONFIG_CMD_SF_TEST
Define this option to include a destructive SPI flash diff --git a/drivers/mtd/spi/spi_spl_load.c b/drivers/mtd/spi/spi_spl_load.c index 1954b7e..b270b82 100644 --- a/drivers/mtd/spi/spi_spl_load.c +++ b/drivers/mtd/spi/spi_spl_load.c @@ -13,6 +13,19 @@ #include <spi_flash.h> #include <spl.h>
+#ifndef CONFIG_SF_DEFAULT_SPEED +# define CONFIG_SF_DEFAULT_SPEED 1000000 +#endif +#ifndef CONFIG_SPL_SPI_MODE +# define CONFIG_SPL_SPI_MODE SPI_MODE_3 +#endif +#ifndef CONFIG_SPL_SPI_CS +# define CONFIG_SPL_SPI_CS 0 +#endif +#ifndef CONFIG_SPL_SPI_BUS +# define CONFIG_SPL_SPI_BUS 0 +#endif + #ifdef CONFIG_SPL_OS_BOOT /* * Load the kernel, check for a valid header we can parse, and if found load @@ -57,7 +70,7 @@ void spl_spi_load_image(void) */
flash = spi_flash_probe(CONFIG_SPL_SPI_BUS, CONFIG_SPL_SPI_CS, - CONFIG_SF_DEFAULT_SPEED, SPI_MODE_3); + CONFIG_SF_DEFAULT_SPEED, CONFIG_SPL_SPI_MODE); if (!flash) { puts("SPI probe failed.\n"); hang();