Skip to contentSkip to conversation

spi: new controller driver for efm32 SoCs

PATCH Applied Uwe Kleine-König 2 participants 2 messages Aug 8, 2013 – Aug 9, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v4 2/2 spi: new controller driver for efm32 SoCs

---
Changes since v3 sent with Message-Id:[email protected]:
- simplify efm32_spi_{rx,tx}_u8
- drop check about unidirectional transfers, the driver is able to cope with these

 .../devicetree/bindings/spi/efm32-spi.txt          |  34 ++
 drivers/spi/Kconfig                                |   7 +
 drivers/spi/Makefile                               |   1 +
 drivers/spi/spi-efm32.c                            | 517 +++++++++++++++++++++
 include/linux/platform_data/efm32-spi.h            |  14 +
 5 files changed, 573 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/efm32-spi.txt
 create mode 100644 drivers/spi/spi-efm32.c
 create mode 100644 include/linux/platform_data/efm32-spi.h
Documentation/devicetree/bindings/spi/efm32-spi.txt new file +34 -0
new file mode 100644
index 0000000..a590ca5
@@ -0,0 +1,34 @@
+* Energy Micro EFM32 SPI
+
+Required properties:
+- #address-cells: see spi-bus.txt
+- #size-cells: see spi-bus.txt
+- compatible: should be "efm32,spi"
+- reg: Offset and length of the register set for the controller
+- interrupts: pair specifying rx and tx irq
+- clocks: phandle to the spi clock
+- cs-gpios: see spi-bus.txt
+- location: Value to write to the ROUTE register's LOCATION bitfield to configure the pinmux for the device, see datasheet for values.
+
+Example:
+
+spi1: spi@0x4000c400 { /* USART1 */
+	#address-cells = <1>;
+	#size-cells = <0>;
+	compatible = "efm32,spi";
+	reg = <0x4000c400 0x400>;
+	interrupts = <15 16>;
+	clocks = <&cmu 20>;
+	cs-gpios = <&gpio 51 1>; // D3
+	location = <1>;
+	status = "ok";
+
+	ks8851@0 {
+		compatible = "ks8851";
+		spi-max-frequency = <6000000>;
+		reg = <0>;
+		interrupt-parent = <&boardfpga>;
+		interrupts = <4>;
+		status = "ok";
+	};
+};
drivers/spi/Kconfig +7 -0
index 89cbbab..f84a77c 100644
@@ -157,6 +157,13 @@ config SPI_DAVINCI
 	help
 	  SPI master controller for DaVinci/DA8x/OMAP-L/AM1x SPI modules.
 
+config SPI_EFM32
+	tristate "EFM32 SPI controller"
+	depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST)
+	select SPI_BITBANG
+	help
+	  Driver for the spi controller found on Energy Micro's EFM32 SoCs.
+
 config SPI_EP93XX
 	tristate "Cirrus Logic EP93xx SPI controller"
 	depends on ARCH_EP93XX
drivers/spi/Makefile +1 -0
index 33f9c09..4a1cfb2 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_SPI_DESIGNWARE)		+= spi-dw.o
 obj-$(CONFIG_SPI_DW_MMIO)		+= spi-dw-mmio.o
 obj-$(CONFIG_SPI_DW_PCI)		+= spi-dw-midpci.o
 spi-dw-midpci-objs			:= spi-dw-pci.o spi-dw-mid.o
+obj-$(CONFIG_SPI_EFM32)			+= spi-efm32.o
 obj-$(CONFIG_SPI_EP93XX)		+= spi-ep93xx.o
 obj-$(CONFIG_SPI_FALCON)		+= spi-falcon.o
 obj-$(CONFIG_SPI_FSL_CPM)		+= spi-fsl-cpm.o
drivers/spi/spi-efm32.c new file +517 -0

517 lines not on this page · raw message

include/linux/platform_data/efm32-spi.h new file +14 -0
new file mode 100644
index 0000000..31b19ca
@@ -0,0 +1,14 @@
+#ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__
+#define __LINUX_PLATFORM_DATA_EFM32_SPI_H__
+
+#include <linux/types.h>
+
+/**
+ * struct efm32_spi_pdata
+ * @location: pinmux location for the I/O pins (to be written to the ROUTE
+ * 	register)
+ */
+struct efm32_spi_pdata {
+	u8 location;
+};
+#endif /* ifndef __LINUX_PLATFORM_DATA_EFM32_SPI_H__ */
Signature · 1 line
1.8.4.rc0