Skip to contentSkip to conversation

spi: spi-mem: s/dummy/data buswidth check in dtr_supports_op()

PATCH In review Dhruva Gole 2 participants 2 messages Feb 20, 2023 – Feb 27, 2023 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-mem: s/dummy/data buswidth check in dtr_supports_op()

This should have been op->data.buswidth instead as we check for octal bus width for the data related ops
Also add explanation for why there is checks for 8D even data bytes

Cc Pratyush Yadav <[email protected]>

---

Address Pratyush Yadav's comments from here:
https://lore.kernel.org/u-boot/[email protected]/

 drivers/spi/spi-mem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-mem.c +5 -1
index 8e8995fc537f..57a36f31a5d3 100644
@@ -181,8 +181,12 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave,
 	if (op->dummy.nbytes && op->dummy.buswidth == 8 && op->dummy.nbytes % 2)
 		return false;
 
+	/*
+	 * 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 &&
-	    op->dummy.buswidth == 8 && op->data.nbytes % 2)
+	    op->data.buswidth == 8 && op->data.nbytes % 2)
 		return false;
 
 	return spi_mem_check_buswidth(slave, op);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dhruva Gole

This should have been op->data.buswidth instead as we check for octal bus width for the data related ops
Also add explanation for why there is checks for 8D even data bytes

Cc Pratyush Yadav <[email protected]>
Quoted 29 lines

---

Address Pratyush Yadav's comments from here:
https://lore.kernel.org/u-boot/[email protected]/

 drivers/spi/spi-mem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-mem.c +5 -2
index 8e8995fc537f..57a36f31a5d3 100644
@@ -181,8 +181,12 @@ bool spi_mem_dtr_supports_op(struct spi_slave *slave,
        if (op->dummy.nbytes && op->dummy.buswidth == 8 && op->dummy.nbytes % 2)
                return false;
 
+       /*
+        * 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 &&
-           op->dummy.buswidth == 8 && op->data.nbytes % 2)
+           op->data.buswidth == 8 && op->data.nbytes % 2)
                return false;
 
        return spi_mem_check_buswidth(slave, op);
--

2.25.1

Signature · 12 lines
Regards,
Pratyush Yadav



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879