Skip to contentSkip to conversation

spi: Add SPI driver for MT76xx SoCs

PATCH Superseded Stefan Roese 2 participants 5 messages Aug 16, 2018 – Oct 4, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 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.

---
v5:
- Move file name and function / macro names to mt7621 instead of the generic mt76xx name as the MT7620 has a different SPI controller integrated (as explained by Piotr)
- Added an more extensive text about the supported SoC versions to the Kconfig help text

v4:
- Rename functions and macros from mt7621 to mt76xx to better reflect the SoC usage and match the driver name

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/mt7621_spi.c | 312 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 drivers/spi/mt7621_spi.c
drivers/spi/Kconfig +8 -0
index 9fbd26740d..2197d9fc3f 100644
@@ -116,6 +116,14 @@ config ICH_SPI
 	  access the SPI NOR flash on platforms embedding this Intel
 	  ICH IP core.
 
+config MT7621_SPI
+	bool "MediaTek MT7621 SPI driver"
+	depends on ARCH_MT7620
+	help
+	  Enable the MT7621 SPI driver. This driver can be used to access
+	  the SPI NOR flash on platforms embedding this Ralink / MediaTek
+	  SPI core, like MT7621/7628/7688.
+
 config MVEBU_A3700_SPI
 	bool "Marvell Armada 3700 SPI driver"
 	select CLK_ARMADA_3720
drivers/spi/Makefile +1 -0
index bdb5b5a02f..67957175ff 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_MT7621_SPI) += mt7621_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/mt7621_spi.c new file +312 -0

312 lines not on this page · raw message

Signature · 1 line
2.18.0
#1 lore raw

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

Quoted 10 lines · Stefan Roese

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.

Quoted 7 lines

---

Applied to u-boot-spi/master

#2 lore raw

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

Hi Jagan,

Quoted 19 lines · Jagan Teki
Quoted 10 lines · Stefan Roese

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.

Quoted 7 lines

---

Quoted 1 line

Applied to u-boot-spi/master

I'm missing this one in current master. Did you perhaps to push it upstream with your latest patches (SPI NAND etc)?

Thanks,
Stefan

#3 lore raw

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

Quoted 23 lines · Stefan Roese

Hi Jagan,

Quoted 19 lines · Jagan Teki
Quoted 17 lines · Stefan Roese

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.

---

Quoted 4 lines
Quoted 1 line

Applied to u-boot-spi/master

I'm missing this one in current master. Did you perhaps to push it upstream with your latest patches (SPI NAND etc)?

I packed this via spi-nand changes but forgot to include on PR, will send it in next PR. sorry.

#4 lore raw

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

Quoted 24 lines · Jagan Teki
Quoted 23 lines · Stefan Roese

Hi Jagan,

Quoted 19 lines · Jagan Teki
Quoted 17 lines · Stefan Roese

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.

---

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Applied to u-boot-spi/master

I'm missing this one in current master. Did you perhaps to push it upstream with your latest patches (SPI NAND etc)?

I packed this via spi-nand changes but forgot to include on PR, will send it in next PR. sorry.

Thanks, no problem.

Thanks,
Stefan