summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-10-13 23:41:53 -0600
committerSimon Glass <sjg@chromium.org>2014-10-22 10:36:46 -0600
commitc60e1f254747ac650f8290e5debcf8ad1567584b (patch)
tree08f5d2749d213bb008f84caaf9350479aa5ef234 /drivers
parentd7af6a485126a0d08a0a9a56721e42a3e78b5b53 (diff)
downloadu-boot-imx-c60e1f254747ac650f8290e5debcf8ad1567584b.zip
u-boot-imx-c60e1f254747ac650f8290e5debcf8ad1567584b.tar.gz
u-boot-imx-c60e1f254747ac650f8290e5debcf8ad1567584b.tar.bz2
dm: sandbox: Add a SPI emulation uclass
U-Boot includes a SPI emulation driver already but it is not explicit, and is hidden in the SPI flash code. Conceptually with sandbox's SPI implementation we have a layer which creates SPI bus transitions and a layer which interprets them, currently only for SPI flash. The latter is actually an emulation, and it should be possible to add more than one emulation - not just SPI flash. Add a SPI emulation uclass so that other emulations can be plugged in to support different types of emulated devices on difference buses/chip selects. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/Makefile1
-rw-r--r--drivers/spi/spi-emul-uclass.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index d1f1dd0..a1de028 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -8,6 +8,7 @@
# There are many options which enable SPI, so make this library available
ifdef CONFIG_DM_SPI
obj-y += spi-uclass.o
+obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
else
obj-y += spi.o
endif
diff --git a/drivers/spi/spi-emul-uclass.c b/drivers/spi/spi-emul-uclass.c
new file mode 100644
index 0000000..b436a0e
--- /dev/null
+++ b/drivers/spi/spi-emul-uclass.c
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2014 Google, Inc
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <spi.h>
+#include <spi_flash.h>
+
+UCLASS_DRIVER(spi_emul) = {
+ .id = UCLASS_SPI_EMUL,
+ .name = "spi_emul",
+};