Add NXP LPC32XX SPI driver
Subsystems (3)
PATCH 1/2 Add NXP LPC32XX SPI driver
This SPI device is found at least on NXP LPC32XX ARM family. It has 64 entry FIFO and is quite fast when using only IRQ.
The driver uses generic SPI and OF frameworks to minimize its size.
It is tested in HW (SPI flash with JFFS2).
--- .../devicetree/bindings/spi/spi_lpc32xx.txt | 32 +++ drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/spi-lpc32xx.c | 265 ++++++++++++++++++++ 4 files changed, 306 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi_lpc32xx.txt create mode 100644 drivers/spi/spi-lpc32xx.c
Documentation/devicetree/bindings/spi/spi_lpc32xx.txt new file +32 -0
@@ -0,0 +1,32 @@ +NXP LPC32XX SPI controller + +Required properties: +- compatible : "nxp,lpc3220-spi" +- reg : Offset and length of the register set for the device +- interrupts : Should contain SPI controller interrupt +- cs-gpios : should specify GPIOs used for chipselects. + The gpios will be referred to as reg = <index> in the SPI child nodes. + +SPI slave nodes must be children of the SPI master node and can +contain the following properties. + + spi-max-frequency = <hz>; + spi-cpol; + spi-cpha; + +Example: + spi1: spi@20088000 { + status="okay"; + interrupts = <55 0>; + #address-cells = <1>; + #size-cells = <0>; + num-cs = <1>; + cs-gpios = <&gpio 3 5 1>; + m25p80@1 { + compatible = "st,m25p80"; + reg = <0>; + spi-max-frequency = <1000000>; + spi-cpol; + spi-cpha; + }; + };
drivers/spi/Kconfig +8 -0
@@ -375,6 +375,14 @@ config SPI_ORION help This enables using the SPI master controller on the Orion chips. +config SPI_LPC32XX + tristate "NXP LPC32XX SPI controller" + depends on ARCH_LPC32XX + help + This selects SPI controller found on NXP LPC32XX SoC. There + are also ARM AMBA PL022 SSP controllers, but NXP's SPI one + has 64 entry FIFOs as opossed to 8 entry in SSP. + config SPI_PL022 tristate "ARM AMBA PL022 SSP controller" depends on ARM_AMBA
drivers/spi/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_SPI_GPIO) += spi-gpio.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o +obj-$(CONFIG_SPI_LPC32XX) += spi-lpc32xx.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-lpc32xx.c new file +265 -0
265 lines not on this page · raw message
Signature · 1 line
1.7.10.4
(This hit my box with lkml mesages without lkml in the To: header. What happened here?)
drivers/spi/spi-lpc32xx.c line 17
Quoted 9 lines · Martin Devera
drivers/spi/spi-lpc32xx.c new file +6
-0+#include <linux/io.h> +#include <linux/clk.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/of_gpio.h> +#include <linux/spi/spi.h>
(I wonder which of these, indirectly, pulls in <linux/module.h>.)
drivers/spi/spi-lpc32xx.c
Quoted 3 lines
drivers/spi/spi-lpc32xx.c new file +2
-0+#define DRIVER_NAME "spi-lpc32xx" +MODULE_ALIAS ("platform:" DRIVER_NAME );
This alias seems only useful if there's a corresponding struct platform_device. Ie, a struct platform_device with a .name of "spi -lpc32xx", which will fire off a "MODALIAS=platform:spi-lpc32xx" uevent when it's created.
I couldn't find that platform_device. Did I miss something? Or is there another way this alias is useful?
Thanks,
Paul Bolle
Quoted 2 lines · Paul Bolle
(This hit my box with lkml mesages without lkml in the To: header. What happened here?)
Ahh, have to check my sending script ..
Quoted 12 lines · Martin Devera
drivers/spi/spi-lpc32xx.c
Quoted 6 lines
drivers/spi/spi-lpc32xx.c new file +2
-0+#define DRIVER_NAME "spi-lpc32xx" +MODULE_ALIAS ("platform:" DRIVER_NAME );This alias seems only useful if there's a corresponding struct
platform_device. Ie, a structplatform_devicewith a .name of "spi -lpc32xx", which will fire off a "MODALIAS=platform:spi-lpc32xx" uevent when it's created.
My fault, thanks for spotting. It is leftover from driver I used as template...
In any case, I has other comments from Joachim Eastwood thus I plan to do more cleanup and resubmit the driver later..
thanks,
Martin