ramips: disable spi full duplex on mt7621
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
parent
bc5283381c
commit
6e0ae87a98
1 changed files with 18 additions and 6 deletions
|
@ -11,8 +11,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
3 files changed, 487 insertions(+)
|
3 files changed, 487 insertions(+)
|
||||||
create mode 100644 drivers/spi/spi-mt7621.c
|
create mode 100644 drivers/spi/spi-mt7621.c
|
||||||
|
|
||||||
--- a/drivers/spi/Kconfig
|
Index: linux-4.14.37/drivers/spi/Kconfig
|
||||||
+++ b/drivers/spi/Kconfig
|
===================================================================
|
||||||
|
--- linux-4.14.37.orig/drivers/spi/Kconfig
|
||||||
|
+++ linux-4.14.37/drivers/spi/Kconfig
|
||||||
@@ -569,6 +569,12 @@ config SPI_RT2880
|
@@ -569,6 +569,12 @@ config SPI_RT2880
|
||||||
help
|
help
|
||||||
This selects a driver for the Ralink RT288x/RT305x SPI Controller.
|
This selects a driver for the Ralink RT288x/RT305x SPI Controller.
|
||||||
|
@ -26,8 +28,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
config SPI_S3C24XX
|
config SPI_S3C24XX
|
||||||
tristate "Samsung S3C24XX series SPI"
|
tristate "Samsung S3C24XX series SPI"
|
||||||
depends on ARCH_S3C24XX
|
depends on ARCH_S3C24XX
|
||||||
--- a/drivers/spi/Makefile
|
Index: linux-4.14.37/drivers/spi/Makefile
|
||||||
+++ b/drivers/spi/Makefile
|
===================================================================
|
||||||
|
--- linux-4.14.37.orig/drivers/spi/Makefile
|
||||||
|
+++ linux-4.14.37/drivers/spi/Makefile
|
||||||
@@ -60,6 +60,7 @@ obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mp
|
@@ -60,6 +60,7 @@ obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mp
|
||||||
obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
|
obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
|
||||||
obj-$(CONFIG_SPI_MPC52xx) += spi-mpc52xx.o
|
obj-$(CONFIG_SPI_MPC52xx) += spi-mpc52xx.o
|
||||||
|
@ -36,9 +40,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
obj-$(CONFIG_SPI_MXS) += spi-mxs.o
|
obj-$(CONFIG_SPI_MXS) += spi-mxs.o
|
||||||
obj-$(CONFIG_SPI_NUC900) += spi-nuc900.o
|
obj-$(CONFIG_SPI_NUC900) += spi-nuc900.o
|
||||||
obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o
|
obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o
|
||||||
|
Index: linux-4.14.37/drivers/spi/spi-mt7621.c
|
||||||
|
===================================================================
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/drivers/spi/spi-mt7621.c
|
+++ linux-4.14.37/drivers/spi/spi-mt7621.c
|
||||||
@@ -0,0 +1,488 @@
|
@@ -0,0 +1,494 @@
|
||||||
+/*
|
+/*
|
||||||
+ * spi-mt7621.c -- MediaTek MT7621 SPI controller driver
|
+ * spi-mt7621.c -- MediaTek MT7621 SPI controller driver
|
||||||
+ *
|
+ *
|
||||||
|
@ -131,9 +137,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+
|
+
|
||||||
+ master |= 7 << 29;
|
+ master |= 7 << 29;
|
||||||
+ master |= 1 << 2;
|
+ master |= 1 << 2;
|
||||||
|
+#ifdef CONFIG_SOC_MT7620
|
||||||
+ if (duplex)
|
+ if (duplex)
|
||||||
+ master |= 1 << 10;
|
+ master |= 1 << 10;
|
||||||
+ else
|
+ else
|
||||||
|
+#endif
|
||||||
+ master &= ~(1 << 10);
|
+ master &= ~(1 << 10);
|
||||||
+
|
+
|
||||||
+ mt7621_spi_write(rs, MT7621_SPI_MASTER, master);
|
+ mt7621_spi_write(rs, MT7621_SPI_MASTER, master);
|
||||||
|
@ -308,6 +316,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
+#ifdef CONFIG_SOC_MT7620
|
||||||
+static int mt7621_spi_transfer_full_duplex(struct spi_master *master,
|
+static int mt7621_spi_transfer_full_duplex(struct spi_master *master,
|
||||||
+ struct spi_message *m)
|
+ struct spi_message *m)
|
||||||
+{
|
+{
|
||||||
|
@ -392,15 +401,18 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||||
+
|
+
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
|
+#endif
|
||||||
+
|
+
|
||||||
+static int mt7621_spi_transfer_one_message(struct spi_master *master,
|
+static int mt7621_spi_transfer_one_message(struct spi_master *master,
|
||||||
+ struct spi_message *m)
|
+ struct spi_message *m)
|
||||||
+{
|
+{
|
||||||
+ struct spi_device *spi = m->spi;
|
+ struct spi_device *spi = m->spi;
|
||||||
|
+#ifdef CONFIG_SOC_MT7620
|
||||||
+ int cs = spi->chip_select;
|
+ int cs = spi->chip_select;
|
||||||
+
|
+
|
||||||
+ if (cs)
|
+ if (cs)
|
||||||
+ return mt7621_spi_transfer_full_duplex(master, m);
|
+ return mt7621_spi_transfer_full_duplex(master, m);
|
||||||
|
+#endif
|
||||||
+ return mt7621_spi_transfer_half_duplex(master, m);
|
+ return mt7621_spi_transfer_half_duplex(master, m);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
|
Loading…
Reference in a new issue