[U-Boot] [PATCH v7 52/87] configs: sandbox: Enable SPI-NOR sandbox driver

Jagan Teki jteki at openedev.com
Tue Mar 22 08:38:04 CET 2016


- CONFIG_DM_SPI_FLASH
+ CONFIG_MTD
+ CONFIG_MTD_M25P80
+ CONFIG_MTD_SPI_NOR
+ CONFIG_SPI_NOR_SANDBOX

Replace CONFIG_SPI_FLASH with CONFIG_MTD_SPI_NOR

Cc: Simon Glass <sjg at chromium.org>
Cc: Bin Meng <bmeng.cn at gmail.com>
Signed-off-by: Jagan Teki <jteki at openedev.com>
---
 arch/Kconfig                  |  2 +-
 configs/sandbox_defconfig     |  5 +++--
 drivers/mtd/spi-nor/sandbox.c |  2 +-
 include/spi_flash.h           | 14 +++++++-------
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index ec12013..2c58b9a 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -87,11 +87,11 @@ config SANDBOX
 	select SYS_GENERIC_BOARD
 	select SUPPORT_OF_CONTROL
 	select DM
-	select DM_SPI_FLASH
 	select DM_SERIAL
 	select DM_I2C
 	select DM_SPI
 	select DM_GPIO
+	select MTD
 
 config SH
 	bool "SuperH architecture"
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index d69c9fc..6873d7a 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -40,8 +40,9 @@ CONFIG_CROS_EC=y
 CONFIG_CROS_EC_SANDBOX=y
 CONFIG_RESET=y
 CONFIG_DM_MMC=y
-CONFIG_SPI_FLASH_SANDBOX=y
-CONFIG_SPI_FLASH=y
+CONFIG_SPI_NOR_SANDBOX=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_M25P80=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_GIGADEVICE=y
diff --git a/drivers/mtd/spi-nor/sandbox.c b/drivers/mtd/spi-nor/sandbox.c
index 8bd06f4..a3ffea2 100644
--- a/drivers/mtd/spi-nor/sandbox.c
+++ b/drivers/mtd/spi-nor/sandbox.c
@@ -536,7 +536,7 @@ static const struct dm_spi_emul_ops sandbox_sf_emul_ops = {
 	.xfer          = sandbox_sf_xfer,
 };
 
-#ifdef CONFIG_SPI_FLASH
+#ifdef CONFIG_MTD_SPI_NOR
 static int sandbox_cmdline_cb_spi_sf(struct sandbox_state *state,
 				     const char *arg)
 {
diff --git a/include/spi_flash.h b/include/spi_flash.h
index f77a9c9..712ad61 100644
--- a/include/spi_flash.h
+++ b/include/spi_flash.h
@@ -148,6 +148,13 @@ static inline int spi_flash_protect(spi_flash_t *info, u32 ofs,
 
 #ifdef CONFIG_DM_MTD_SPI_NOR
 
+struct sandbox_state;
+
+int sandbox_sf_bind_emul(struct sandbox_state *state, int busnum, int cs,
+			 struct udevice *bus, int of_offset, const char *spec);
+
+void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs);
+
 int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs,
 			   unsigned int max_hz, unsigned int spi_mode,
 			   struct udevice **devp);
@@ -273,13 +280,6 @@ void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs);
 
 #elif !defined(CONFIG_MTD_SPI_NOR)
 
-struct sandbox_state;
-
-int sandbox_sf_bind_emul(struct sandbox_state *state, int busnum, int cs,
-			 struct udevice *bus, int of_offset, const char *spec);
-
-void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs);
-
 struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		unsigned int max_hz, unsigned int spi_mode);
 
-- 
1.9.1



More information about the U-Boot mailing list