Skip to contentSkip to conversation

Sandbox: Add spi driver to sandbox

PATCH New viktor.krivak at gmail.com 3 participants 3 messages Oct 4, 2012 – Oct 9, 2012 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Sandbox: Add spi driver to sandbox

From: Viktor Krivak <[email protected]>

---
Simple spi driver which only cache input data and send them back on next call. Usefull for high level testing in sandbox.

 drivers/spi/Makefile      |    1 +
 drivers/spi/sandbox.c     |  162 +++++++++++++++++++++++++++++++++++++++++++++
 include/configs/sandbox.h |    3 +
 3 files changed, 166 insertions(+)
 create mode 100644 drivers/spi/sandbox.c
drivers/spi/Makefile +1 -0
index f0b82c6..a3b44fd 100644
@@ -46,6 +46,7 @@ COBJS-$(CONFIG_SH_SPI) += sh_spi.o
 COBJS-$(CONFIG_FSL_ESPI) += fsl_espi.o
 COBJS-$(CONFIG_TEGRA_SPI) += tegra_spi.o
 COBJS-$(CONFIG_XILINX_SPI) += xilinx_spi.o
+COBJS-$(CONFIG_SANDBOX_SPI) += sandbox.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/spi/sandbox.c new file +162 -0

162 lines not on this page · raw message

include/configs/sandbox.h +3 -0
index 9c431bf..0ea4438 100644
@@ -38,6 +38,9 @@
 #define CONFIG_SANDBOX_GPIO
 #define CONFIG_SANDBOX_GPIO_COUNT	20
 
+#define CONFIG_CMD_SPI
+#define CONFIG_SANDBOX_SPI
+
 /*
  * Size of malloc() pool, although we don't actually use this yet.
  */
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 Sandbox: Add spi driver to sandbox

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · viktor.krivak at gmail.com

From: Viktor Krivak <[email protected]>

[snip]

Quoted 5 lines

+#ifndef CONFIG_SANDBOX_SPI_BUS_NUM + #define
CONFIG_SANDBOX_SPI_BUS_NUM 1 +#endif + +#ifndef
CONFIG_SANDBOX_SPI_CS_NUM + #define CONFIG_SANDBOX_SPI_CS_NUM 1
+#endif + +#ifndef CONFIG_SANDBOX_SPI_BUFFER_LEN + #define
CONFIG_SANDBOX_SPI_BUFFER_LEN 32 +#endif

Please just define these in the config file and fail to build when unset.

[snip]

Quoted 4 lines

+/* + * spi_cs_is_valid() - Check if bus and cs are valid number +
* + * @bus: Bus id + * @cs: Chip select id + * + * Compare bus and
cs against defined constant. Return 0 if everything is ok + * and other value on error. + */

Almost kernel-doc style, but that needs /**, please update globally.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQbgxVAAoJENk4IS6UOR1Wo18P/jrHcuWPckQ+gLsxbT1lZXaV 3iNeozB6rZOvrrMhbt8HKn83GclUrA8Od6NCMtW9U0DRBPn1mEJL1HlUe4TwYlPO rtRQhvTQdaly1M9TFKCs4KKbedrJuypiQf9ToLW6qkHDC4ocDPg81Rsp2PtBdqB7 joFwd2xlpSAyaBxJpRk0+K98Qt6MxwU/C1c6pdZCgWCyaFAspg5VSEtX+Y6y3oG/ x1z9E8y/dVJqCyuMdXWch3fLsMFLFB/iFCyfgg649cNC40xuHc7rRO2rAdNDU9u7 wZ3aS/35Nm0iFL7JRL1sgcswUrPu0eqK24b+Mq+anfp+4z8vk0oh5pXYN0qi9uEW QCB0jqNzhJQS0ZzZI6hY40DGzGXHdYHNB56BUlR/TW19QYFjeLNJAizbTFsTxC3v u1U5u+vmZqoXo3VaX9G5WoxDpHYSLGMOon8B8aeU7BuBKLMZL+BE10Sfd2ubesto AHG9nXPSkDfnyOmZXsG3RrdNNo0x9klGnKrUKC1tROaDKzqvcVH6M8WrHRBU7nX4 5khTph/tZZ+ZShBAMa1EGA5E9htqswDi2P6S4CUIIHD4DrAInY/S0/3Y/Z7Bv2IJ r3okMqawaHOpwTklFHxJVFtlZIBnCHHlVD8BiUfAFR0IyOz5gMYuekPkrAJ8Mo4E AGH8N0JH/AmaFFpxvmF4
=bGe/
-----END PGP SIGNATURE-----

#2 lore raw

PATCH 1/1 Sandbox: Add spi driver to sandbox

In reply to viktor.krivak at gmail.com

Hi,

Quoted 7 lines · On Thu, Oct 4, 2012 at 3:14 AM, <[email protected]> wrote:

From: Viktor Krivak <[email protected]>

---
Simple spi driver which only cache input data and send them back on next call. Usefull for high level testing in sandbox.

Quoted 6 lines
 drivers/spi/Makefile      |    1 +
 drivers/spi/sandbox.c     |  162 +++++++++++++++++++++++++++++++++++++++++++++
 include/configs/sandbox.h |    3 +
 3 files changed, 166 insertions(+)
 create mode 100644 drivers/spi/sandbox.c

Please can you take a look at Mike's work here also? He seems to have done a similar thing.

http://patchwork.ozlabs.org/patch/146127/
http://patchwork.ozlabs.org/patch/146128/
http://patchwork.ozlabs.org/patch/146129/

Regards,
SImon