]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: spi-mem: perform odd len check only while writing data
authorDhruva Gole <d-gole@ti.com>
Wed, 1 Mar 2023 07:43:46 +0000 (13:13 +0530)
committerJagan Teki <jagan@amarulasolutions.com>
Tue, 25 Apr 2023 17:26:14 +0000 (22:56 +0530)
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>
drivers/spi/spi-mem.c

index 57a36f31a5d3d8624547e491590d64c2c167d05d..b7eca5835956fb8af01fcc74b6a45cc353343781 100644 (file)
@@ -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;