Skip to contentSkip to conversation

SPI: add CSR SiRFprimaII SPI controller driver

PATCH Superseded Barry Song 2 participants 2 messages Dec 14, 2011 SPI

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v2 1/1 SPI: add CSR SiRFprimaII SPI controller driver

From: Zhiwu Song <[email protected]>

CSR SiRFprimaII has two SPIs (SPI0 and SPI1). Features:
* Master and slave modes
* 8-/12-/16-/32-bit data unit
* 256 bytes receive data FIFO and 256 bytes transmit data FIFO
* Multi-unit frame
* Configurable SPI_EN (chip select pin) active state
* Configurable SPI_CLK polarity
* Configurable SPI_CLK phase
* Configurable MSB/LSB first

---
-v2:
fix bundle of minor issues Wolfram Sang pointed out; use Wolfram Sang's new devm_request_mem_region api, refer to:
https://lkml.org/lkml/2011/10/25/226

 drivers/spi/Kconfig          |    7 +
 drivers/spi/Makefile         |    1 +
 drivers/spi/spi-sirf.c       |  629 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/spi/spi-sirf.h |   27 ++
 4 files changed, 664 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/spi-sirf.c
 create mode 100644 include/linux/spi/spi-sirf.h
drivers/spi/Kconfig +7 -0
index a1fd73d..3dccd54 100644
@@ -325,6 +325,13 @@ config SPI_SH_SCI
 	help
 	  SPI driver for SuperH SCI blocks.
 
+config SPI_SIRF
+        tristate "CSR SiRFprimaII SPI controller"
+	depends on ARCH_PRIMA2
+	select SPI_BITBANG
+        help
+          SPI driver for CSR SiRFprimaII SoCs
+
 config SPI_STMP3XXX
 	tristate "Freescale STMP37xx/378x SPI/SSP controller"
 	depends on ARCH_STMP3XXX && SPI_MASTER
drivers/spi/Makefile +1 -0
index 61c3261..e919846 100644
@@ -51,6 +51,7 @@ obj-$(CONFIG_SPI_S3C64XX)		+= spi-s3c64xx.o
 obj-$(CONFIG_SPI_SH)			+= spi-sh.o
 obj-$(CONFIG_SPI_SH_MSIOF)		+= spi-sh-msiof.o
 obj-$(CONFIG_SPI_SH_SCI)		+= spi-sh-sci.o
+obj-$(CONFIG_SPI_SIRF)		+= spi-sirf.o
 obj-$(CONFIG_SPI_STMP3XXX)		+= spi-stmp.o
 obj-$(CONFIG_SPI_TEGRA)			+= spi-tegra.o
 obj-$(CONFIG_SPI_TI_SSP)		+= spi-ti-ssp.o
drivers/spi/spi-sirf.c new file +629 -0

629 lines not on this page · raw message

include/linux/spi/spi-sirf.h new file +27 -0
new file mode 100644
index 0000000..0e647b0
@@ -0,0 +1,27 @@
+/*
+ * include/linux/spi/spi_sirfsoc.h
+ *
+ * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+#ifndef __SIRFSOC_SPI_H__
+#define __SIRFSOC_SPI_H__
+
+struct sirfsoc_spi_ctrldata {
+	int cs_type;
+	void (*chip_select) (void);
+	void (*chip_deselect) (void);
+	int cs_hold_clk;
+};
+
+#define CS_HW_CTRL	1
+#define CS_RISC_IO	2
+#define CS_GPIO		3
+#define CS_SW_CTRL	4
+
+#define CS_HOLD_1	0
+#define CS_HOLD_2	1
+
+#endif
Signature · 6 lines
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
#1 lore raw

PATCH v2 1/1 SPI: add CSR SiRFprimaII SPI controller driver

2011/12/14 Barry Song <[email protected]>:

Quoted 12 lines

From: Zhiwu Song <[email protected]>

CSR SiRFprimaII has two SPIs (SPI0 and SPI1). Features:
* Master and slave modes
* 8-/12-/16-/32-bit data unit
* 256 bytes receive data FIFO and 256 bytes transmit data FIFO
* Multi-unit frame
* Configurable SPI_EN (chip select pin) active state
* Configurable SPI_CLK polarity
* Configurable SPI_CLK phase
* Configurable MSB/LSB first

Quoted 7 lines

---
?-v2:
?fix bundle of minor issues Wolfram Sang pointed out; ?use Wolfram Sang's new devm_request_mem_region api, refer to:
?https://lkml.org/lkml/2011/10/25/226

sorry. due to some misoperations and typos in it, pls ignore it and read "[PATCH v2 RESEND] SPI: add CSR SiRFprimaII SPI controller driver" instead.

-barry