Skip to contentSkip to conversation

spi: Add SPI driver for MT76xx SoCs

PATCH Superseded Stefan Roese 1 participant 1 message Aug 15, 2018

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 spi: Add SPI driver for MT76xx SoCs

This patch adds the SPI driver for the MediaTek MT7688 SoC (and derivates). Its been tested on the LinkIt Smart 7688 and the Gardena Smart Gateway with and SPI NOR on CS0 and on the Gardena Smart Gateway additionally with an SPI NAND on CS1.

Note that the SPI controller only supports a max transfer size of 32 bytes. This driver implementes a workaround to enable bigger xfer sizes to speed up the transfer especially for the SPI NAND support.

---
v3:
- Drop IO wrappers completely as suggested by Daniel
- Read "clock-frequency" DT property instead of using CONFIG_SYS_MIPS_TIMER_FREQ

v2:
- Add some macros instead of hardcoded numbers
- Move compatible DT struct down in the file

 drivers/spi/Kconfig      |   8 +
 drivers/spi/Makefile     |   1 +
 drivers/spi/mt76xx_spi.c | 312 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/spi/mt76xx_spi.c
drivers/spi/Kconfig +8 -0
index 9fbd26740d..6c4e50d3e9 100644
@@ -116,6 +116,14 @@ config ICH_SPI
 	  access the SPI NOR flash on platforms embedding this Intel
 	  ICH IP core.
 
+config MT76XX_SPI
+	bool "MediaTek MT76XX SPI driver"
+	depends on ARCH_MT7620
+	help
+	  Enable the MT76XX SPI driver. This driver can be used to access
+	  the SPI NOR flash on platforms embedding these MediaTek
+	  SPI cores.
+
 config MVEBU_A3700_SPI
 	bool "Marvell Armada 3700 SPI driver"
 	select CLK_ARMADA_3720
drivers/spi/Makefile +1 -0
index bdb5b5a02f..3d13ba1b21 100644
@@ -33,6 +33,7 @@ obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
+obj-$(CONFIG_MT76XX_SPI) += mt76xx_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
 obj-$(CONFIG_MXC_SPI) += mxc_spi.o
 obj-$(CONFIG_MXS_SPI) += mxs_spi.o
drivers/spi/mt76xx_spi.c new file +312 -0

312 lines not on this page · raw message

Signature · 1 line
2.18.0