diff mbox series

[v2,02/10] spi: spi-mem: Add debug message for spi-mem ops

Message ID 20210402230515.177825-3-seanga2@gmail.com
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series spi: dw: Add support for DUAL/QUAD/OCTAL modes | expand

Commit Message

Sean Anderson April 2, 2021, 11:05 p.m. UTC
This prints some basic metadata about the SPI memory op. This information
may be used to debug SPI drivers (e.g. determining the expected SPI mode).
It is also helpful for verifying that the data on the wire matches the data
intended to be transmitted (e.g. with a logic analyzer). The opcode is
printed with a format of %02Xh to match the notation commonly used in flash
datasheets.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
---

(no changes since v2)

Changes in v2:
- Add more information to exec_op debug message

 drivers/spi/spi-mem.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index c095ae9505..6772367ef7 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -220,6 +220,13 @@  int spi_mem_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)
 	int ret;
 	int i;
 
+	dev_dbg(slave->dev,
+		"exec %02Xh %u-%u-%u addr=%llx dummy cycles=%u data bytes=%u\n",
+		op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
+		op->data.buswidth, op->addr.val,
+		op->dummy.buswidth ? op->dummy.nbytes * 8 / op->dummy.buswidth : 0,
+		op->data.nbytes);
+
 	if (!spi_mem_supports_op(slave, op))
 		return -ENOTSUPP;