spi: SuperH MSIOF SPI Master driver V2
PATCH 1/1 spi: SuperH MSIOF SPI Master driver V2
From: Magnus Damm <[email protected]>
This patch is V2 of SPI Master support for the SuperH MSIOF. Full duplex, spi mode 0-3, active high cs, 3-wire and lsb first should all be supported, but the driver has so far only been tested with "mmc_spi".
The MSIOF hardware comes with 32-bit FIFOs for receive and transmit, and this driver simply breaks the SPI messages into FIFO-sized chunks. The MSIOF hardware manages the pins for clock, receive and transmit (sck/miso/mosi), but the chip select pin is managed by software and must be configured as a regular GPIO pin by the board code.
Performance wise there is still room for improvement, but on a Ecovec board with the built-in sh7724 MSIOF0 this driver gets Mini-sd read speeds of about half a megabyte per second.
Future work include better clock setup and merging of 8-bit transfers into 32-bit words to reduce interrupt load and improve throughput.
---
Changes since V1:
- added timeout handling code
- const, size_t, WARN_ON(), BUG() fixes
- use spi_bitbang_setup_transfer()
- cosmetic stuff
drivers/spi/Kconfig | 7 drivers/spi/Makefile | 1 drivers/spi/spi_sh_msiof.c | 691 ++++++++++++++++++++++++++++++++++++++++++ include/linux/spi/sh_msiof.h | 10 4 files changed, 709 insertions(+)
drivers/spi/Kconfig +7 -0
@@ -220,6 +220,13 @@ config SPI_S3C24XX_GPIO the inbuilt hardware cannot provide the transfer mode, or where the board is using non hardware connected pins. +config SPI_SH_MSIOF + tristate "SuperH MSIOF SPI controller" + depends on SUPERH && HAVE_CLK + select SPI_BITBANG + help + SPI driver for SuperH MSIOF blocks. + config SPI_SH_SCI tristate "SuperH SCI SPI controller" depends on SUPERH
drivers/spi/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24x obj-$(CONFIG_SPI_TXX9) += spi_txx9.o obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o +obj-$(CONFIG_SPI_SH_MSIOF) += spi_sh_msiof.o obj-$(CONFIG_SPI_STMP3XXX) += spi_stmp.o # ... add above this line ...
drivers/spi/spi_sh_msiof.c new file +691 -0
691 lines not on this page · raw message
include/linux/spi/sh_msiof.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef __SPI_SH_MSIOF_H__ +#define __SPI_SH_MSIOF_H__ + +struct sh_msiof_spi_info { +int tx_fifo_override; +int rx_fifo_override; +u16 num_chipselect; +}; + +#endif /* __SPI_SH_MSIOF_H__ */