summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorDhruva Gole <d-gole@ti.com>2023-05-03 14:34:02 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2023-05-04 18:15:21 -0500
commit692b0a62ca444f28edaac4670720a58a4fcfa46a (patch)
tree38f7e72124c8973cd06a578bafc1a31da286f51f /drivers/spi
parent8eae6cc058f19c50af1c1d649345008ac992e866 (diff)
spi: spi-mem: perform odd len check only while writing data
commit db58dc5438ec674cad438a606edc155d06914adc upstream. in spi_mem_dtr_supports_op we have a check for allowing only even number of bytes to be r/w. Odd bytes writing can be a concern while writing data to a flash for example because 8 DTR mode doesn't support it. However, reading ODD Bytes even though may not be physically possible we can still allow for it because it will not have serious implications on any critical registers being overwritten since they are just reads. Cc: Vaishnav Achath <vaishnav.a@ti.com> Cc: Pratyush Yadav <pratyush@kernel.org> Cc: Vignesh Raghavendra <vigneshr@ti.com> Tested-by: Nikhil M Jain <n-jain1@ti.com> Signed-off-by: Dhruva Gole <d-gole@ti.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-mem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 57a36f31a5..b7eca58359 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -185,7 +185,7 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave,
* Transactions of odd length do not make sense for 8D-8D-8D mode
* because a byte is transferred in just half a cycle.
*/
- if (op->data.dir != SPI_MEM_NO_DATA &&
+ if (op->data.dir != SPI_MEM_NO_DATA && op->data.dir != SPI_MEM_DATA_IN &&
op->data.buswidth == 8 && op->data.nbytes % 2)
return false;