diff mbox

[U-Boot,05/14] sandbox: Move CONFIG_SANDBOX_SPI to Kconfig

Message ID 1425673154-28383-6-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass March 6, 2015, 8:19 p.m. UTC
Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 configs/sandbox_defconfig |  1 +
 drivers/spi/Kconfig       | 25 +++++++++++++++++++++++++
 include/configs/sandbox.h |  1 -
 3 files changed, 26 insertions(+), 1 deletion(-)

Comments

Simon Glass April 9, 2015, 3:02 a.m. UTC | #1
On 6 March 2015 at 13:19, Simon Glass <sjg@chromium.org> wrote:
> Move this over to Kconfig and tidy up.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  configs/sandbox_defconfig |  1 +
>  drivers/spi/Kconfig       | 25 +++++++++++++++++++++++++
>  include/configs/sandbox.h |  1 -
>  3 files changed, 26 insertions(+), 1 deletion(-)

I merged in the fix to the Kconfig which appears in the next patch. It
was in the wrong place.

Applied to u-boot-dm/next.
diff mbox

Patch

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 8a5ae79..0e3cb7f 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -17,3 +17,4 @@  CONFIG_SANDBOX_GPIO=y
 CONFIG_SYS_VSNPRINTF=y
 CONFIG_SANDBOX_SERIAL=y
 CONFIG_SYS_I2C_SANDBOX=y
+CONFIG_SANDBOX_SPI=y
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 7ae2727..c50d7ba 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -10,3 +10,28 @@  config DM_SPI
 	  as 'parent data' to every slave on each bus. Slaves
 	  typically use driver-private data instead of extending the
 	  spi_slave structure.
+
+config CONFIG_SANDBOX_SPI
+	bool "Sandbox SPI driver"
+	depends on SANDBOX && DM
+	help
+	  Enable SPI support for sandbox. This is an emulation of a real SPI
+	  bus. Devices can be attached to the bus using the device tree
+	  which specifies the driver to use. As an example, see this device
+	  tree fragment from sandbox.dts. It shows that the SPI bus has a
+	  single flash device on chip select 0 which is emulated by the driver
+	  for "sandbox,spi-flash", which is in drivers/mtd/spi/sandbox.c.
+
+	  spi@0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+		compatible = "sandbox,spi";
+		cs-gpios = <0>, <&gpio_a 0>;
+		flash@0 {
+			reg = <0>;
+			compatible = "spansion,m25p16", "sandbox,spi-flash";
+			spi-max-frequency = <40000000>;
+			sandbox,filename = "spi.bin";
+		};
+	};
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index fd76056..fddb810a 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -76,7 +76,6 @@ 
 #define CONFIG_ENV_IS_NOWHERE
 
 /* SPI - enable all SPI flash types for testing purposes */
-#define CONFIG_SANDBOX_SPI
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_SF_TEST
 #define CONFIG_CMD_SPI