mirror of https://github.com/hak5/openwrt.git
ralink: speed selection was broken in spi-mt7621
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 47073lede-17.01
parent
cb9723f09c
commit
9e1268b168
|
@ -25,7 +25,7 @@
|
||||||
obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o
|
obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/drivers/spi/spi-mt7621.c
|
+++ b/drivers/spi/spi-mt7621.c
|
||||||
@@ -0,0 +1,479 @@
|
@@ -0,0 +1,480 @@
|
||||||
+/*
|
+/*
|
||||||
+ * spi-mt7621.c -- MediaTek MT7621 SPI controller driver
|
+ * spi-mt7621.c -- MediaTek MT7621 SPI controller driver
|
||||||
+ *
|
+ *
|
||||||
|
@ -117,12 +117,12 @@
|
||||||
+{
|
+{
|
||||||
+ u32 master = mt7621_spi_read(rs, MT7621_SPI_MASTER);
|
+ u32 master = mt7621_spi_read(rs, MT7621_SPI_MASTER);
|
||||||
+
|
+
|
||||||
+ master &= ~(0xfff << 16);
|
|
||||||
+ master |= 1 << 16;
|
|
||||||
+ master |= 7 << 29;
|
+ master |= 7 << 29;
|
||||||
+ master |= 1 << 2;
|
+ master |= 1 << 2;
|
||||||
+ if (duplex)
|
+ if (duplex)
|
||||||
+ master |= 1 << 10;
|
+ master |= 1 << 10;
|
||||||
|
+ else
|
||||||
|
+ master &= ~(1 << 10);
|
||||||
+
|
+
|
||||||
+ mt7621_spi_write(rs, MT7621_SPI_MASTER, master);
|
+ mt7621_spi_write(rs, MT7621_SPI_MASTER, master);
|
||||||
+}
|
+}
|
||||||
|
@ -322,6 +322,8 @@
|
||||||
+
|
+
|
||||||
+ for (i = 0; i < t->len; i++, len++)
|
+ for (i = 0; i < t->len; i++, len++)
|
||||||
+ data[len / 4] |= buf[i] << (8 * (len & 3));
|
+ data[len / 4] |= buf[i] << (8 * (len & 3));
|
||||||
|
+ if (speed > t->speed_hz)
|
||||||
|
+ speed = t->speed_hz;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (WARN_ON(rx_len > 16)) {
|
+ if (WARN_ON(rx_len > 16)) {
|
||||||
|
@ -354,7 +356,6 @@
|
||||||
+ for (i = 0; i < rx_len; i += 4)
|
+ for (i = 0; i < rx_len; i += 4)
|
||||||
+ data[i / 4] = mt7621_spi_read(rs, MT7621_SPI_DATA4 + i);
|
+ data[i / 4] = mt7621_spi_read(rs, MT7621_SPI_DATA4 + i);
|
||||||
+
|
+
|
||||||
+ //m->actual_length = len + rx_len;
|
|
||||||
+ m->actual_length = rx_len;
|
+ m->actual_length = rx_len;
|
||||||
+
|
+
|
||||||
+ len = 0;
|
+ len = 0;
|
||||||
|
|
Loading…
Reference in New Issue