aboutsummaryrefslogtreecommitdiffstats
path: root/testing/linux-elm/revert-spi-mt65xx.c.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/linux-elm/revert-spi-mt65xx.c.patch')
-rw-r--r--testing/linux-elm/revert-spi-mt65xx.c.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/linux-elm/revert-spi-mt65xx.c.patch b/testing/linux-elm/revert-spi-mt65xx.c.patch
new file mode 100644
index 0000000000..8c7ad60abd
--- /dev/null
+++ b/testing/linux-elm/revert-spi-mt65xx.c.patch
@@ -0,0 +1,37 @@
+Author: Milan P. Stanić <mps@arvanta.net>
+Date: Thu Jul 29 18:43:30 2021 +0000
+
+revert 09b8cc7810587257e5f82080884001301e1a1ba9 commit
+with this commit cros_ec keyboard is not detected on MT8173 elm chromebook
+and doesn't work
+reverting this commit fixed it
+
+--- a/drivers/spi/spi-mt65xx.c
++++ b/drivers/spi/spi-mt65xx.c
+@@ -427,23 +427,13 @@
+ mtk_spi_setup_packet(master);
+
+ cnt = xfer->len / 4;
+- if (xfer->tx_buf)
+- iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
+-
+- if (xfer->rx_buf)
+- ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt);
++ iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
+
+ remainder = xfer->len % 4;
+ if (remainder > 0) {
+ reg_val = 0;
+- if (xfer->tx_buf) {
+- memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder);
+- writel(reg_val, mdata->base + SPI_TX_DATA_REG);
+- }
+- if (xfer->rx_buf) {
+- reg_val = readl(mdata->base + SPI_RX_DATA_REG);
+- memcpy(xfer->rx_buf + (cnt * 4), &reg_val, remainder);
+- }
++ memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder);
++ writel(reg_val, mdata->base + SPI_TX_DATA_REG);
+ }
+
+ mtk_spi_enable_transfer(master);