drivers: spi: Add qspi flash controller
Subsystems (2)
PATCH v10 1/1 drivers: spi: Add qspi flash controller
The patch add basic support for the quad spi controller.
QSPI is a kind of spi module that allows single, dual and quad read access to external spi devices. The module has a memory mapped interface which provide direct interface for accessing data form external spi devices.
The patch will configure controller clocks, device control register and for defining low level transfer apis which will be used by the spi framework to transfer data to the slave spi device(flash in this case).
Test details:
-------------
Tested this on dra7 board.
Test1: Ran mtd_stesstest for 40000 iterations.
- All iterations went through without failure.
Test2: Use mtd utilities:
- flash_erase to erase the flash device
- mtd_debug read to read data back.
- mtd_debug write to write to the data flash.
diff between the write and read data shows zero.
---v9->v10:
- Few miscellaneous cleanup
- Add switch instead of ifelse.
Left 3 warnings(80 characters) for better readibilty of code. These was posted till now as a two patch series. Dropping the 2nd patch as of now, will add once the support for multiple data lines are added in SPI framework(the patch is under review).
Documentation/devicetree/bindings/spi/ti_qspi.txt | 22 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/spi-ti-qspi.c | 561 +++++++++++++++++++++ 4 files changed, 592 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/ti_qspi.txt create mode 100644 drivers/spi/spi-ti-qspi.c
Documentation/devicetree/bindings/spi/ti_qspi.txt new file +22 -0
@@ -0,0 +1,22 @@ +TI QSPI controller. + +Required properties: +- compatible : should be "ti,dra7xxx-qspi". +- reg: Should contain QSPI registers location and length. +- #address-cells, #size-cells : Must be present if the device has sub-nodes +- ti,hwmods: Name of the hwmod associated to the QSPI + +Recommended properties: +- spi-max-frequency: Definition as per + Documentation/devicetree/bindings/spi/spi-bus.txt + +Example: + +qspi: qspi@4b300000 { + compatible = "ti,dra7xxx-qspi"; + reg = <0x4b300000 0x100>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <25000000>; + ti,hwmods = "qspi"; +};
drivers/spi/Kconfig +8 -0
@@ -285,6 +285,14 @@ config SPI_OMAP24XX SPI master controller for OMAP24XX and later Multichannel SPI (McSPI) modules. +config SPI_TI_QSPI + tristate "DRA7xxx QSPI controller support" + depends on ARCH_OMAP2PLUS || COMPILE_TEST + help + QSPI master controller for DRA7xxx used for flash devices. + This device supports single, dual and quad read support, while + it only supports single write mode. + config SPI_OMAP_100K tristate "OMAP SPI 100K" depends on ARCH_OMAP850 || ARCH_OMAP730
drivers/spi/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SPI_OCTEON) += spi-octeon.o obj-$(CONFIG_SPI_OMAP_UWIRE) += spi-omap-uwire.o obj-$(CONFIG_SPI_OMAP_100K) += spi-omap-100k.o obj-$(CONFIG_SPI_OMAP24XX) += spi-omap2-mcspi.o +obj-$(CONFIG_SPI_TI_QSPI) += spi-ti-qspi.o obj-$(CONFIG_SPI_ORION) += spi-orion.o obj-$(CONFIG_SPI_PL022) += spi-pl022.o obj-$(CONFIG_SPI_PPC4xx) += spi-ppc4xx.o
drivers/spi/spi-ti-qspi.c new file +561 -0
561 lines not on this page · raw message
Signature · 1 line
1.7.1
Hi,
Quoted 6 lines · Sourav Poddar
drivers/spi/spi-ti-qspi.c new file +6
-0+static int qspi_transfer_msg (struct ti_qspi *qspi,struct spi_transfer *t) +{ +int ret; + +if (t->tx_buf) { + ret =qspi_write_msg (qspi, t);
drivers/spi/spi-ti-qspi.c line 320
Quoted 10 lines
drivers/spi/spi-ti-qspi.c new file +10
-0+if (ret) { +dev_dbg (qspi->dev,"Error while writing\n" ); +return ret; + } + } + +if (t->rx_buf) { + ret =qspi_read_msg (qspi, t); +if (ret) { +dev_dbg (qspi->dev,"Error while writing\n" );
*READING*
other than that:
Signature · 1 line
balbi
Quoted 12 lines · Felipe Balbi
Hi,
Quoted 9 lines · Sourav Poddar
drivers/spi/spi-ti-qspi.c new file +9
-0+static int qspi_transfer_msg (struct ti_qspi *qspi,struct spi_transfer *t) +{ +int ret; + +if (t->tx_buf) { + ret =qspi_write_msg (qspi, t); +if (ret) { +dev_dbg (qspi->dev,"Error while writing\n" ); +return ret;
Quoted 9 lines
drivers/spi/spi-ti-qspi.c line 320
Quoted 7 lines
drivers/spi/spi-ti-qspi.c new file +7
-0+ } + } + +if (t->rx_buf) { + ret =qspi_read_msg (qspi, t); +if (ret) { +dev_dbg (qspi->dev,"Error while writing\n" );*READING*
hmm..got missed while folding local changes:(.
Will submit an updated patch.
Quoted 5 lines
other than that:
Acked-by Felipe Balbi<[email protected]>Reviewed-by Felipe Balbi<[email protected]>
Thanks!