]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: spi-mem: Introduce a default ->exec_op() debug log
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 20 Mar 2025 11:56:44 +0000 (12:56 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 20 Mar 2025 12:37:11 +0000 (12:37 +0000)
Many spi-mem controller drivers have a very similar debug log at the
beginning of their ->exec_op() callback implementation. This debug log is
effectively useful, so let's create one that is complete and concise
enough, so developers no longer need to write their own. The verbosity
being high, VERBOSE_DEBUG will be required in this case.

Remove the debug log from individual drivers and propose a common one.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://patch.msgid.link/20250320115644.2231240-1-miquel.raynal@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-aspeed-smc.c
drivers/spi/spi-mem.c
drivers/spi/spi-mtk-snfi.c
drivers/spi/spi-npcm-fiu.c
drivers/spi/spi-stm32-qspi.c
drivers/spi/spi-zynq-qspi.c
drivers/spi/spi-zynqmp-gqspi.c

index e9beae95ddedaf39fb57e87ffceb705e87a3f3a8..62a11142bd63c9ccbf91ffa557fe5e776421d7e7 100644 (file)
@@ -303,13 +303,6 @@ static int do_aspeed_spi_exec_op(struct spi_mem *mem, const struct spi_mem_op *o
        u32 ctl_val;
        int ret = 0;
 
-       dev_dbg(aspi->dev,
-               "CE%d %s OP %#x mode:%d.%d.%d.%d naddr:%#x ndummies:%#x len:%#x",
-               chip->cs, op->data.dir == SPI_MEM_DATA_IN ? "read" : "write",
-               op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
-               op->dummy.buswidth, op->data.buswidth,
-               op->addr.nbytes, op->dummy.nbytes, op->data.nbytes);
-
        addr_mode = readl(aspi->regs + CE_CTRL_REG);
        addr_mode_backup = addr_mode;
 
index a9f0f47f4759b0e1ce22348e713a3b42cfb8ea9c..a31a1db07aa4d2703844b2c5c0cca2bbb8166068 100644 (file)
@@ -377,6 +377,17 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
        /* Make sure the operation frequency is correct before going futher */
        spi_mem_adjust_op_freq(mem, (struct spi_mem_op *)op);
 
+       dev_vdbg(&mem->spi->dev, "[cmd: 0x%02x][%dB addr: %#8llx][%2dB dummy][%4dB data %s] %d%c-%d%c-%d%c-%d%c @ %uHz\n",
+                op->cmd.opcode,
+                op->addr.nbytes, (op->addr.nbytes ? op->addr.val : 0),
+                op->dummy.nbytes,
+                op->data.nbytes, (op->data.nbytes ? (op->data.dir == SPI_MEM_DATA_IN ? " read" : "write") : "     "),
+                op->cmd.buswidth, op->cmd.dtr ? 'D' : 'S',
+                op->addr.buswidth, op->addr.dtr ? 'D' : 'S',
+                op->dummy.buswidth, op->dummy.dtr ? 'D' : 'S',
+                op->data.buswidth, op->data.dtr ? 'D' : 'S',
+                op->max_freq ? op->max_freq : mem->spi->max_speed_hz);
+
        ret = spi_mem_check_op(op);
        if (ret)
                return ret;
index fdbea9dffb62ca54d5dd9c5b1f9e9050b0c5cc48..e82ee6dcf4986e217f0b1c4fbf61fc129b390798 100644 (file)
@@ -1284,9 +1284,6 @@ static int mtk_snand_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 {
        struct mtk_snand *ms = spi_controller_get_devdata(mem->spi->controller);
 
-       dev_dbg(ms->dev, "OP %02x ADDR %08llX@%d:%u DATA %d:%u", op->cmd.opcode,
-               op->addr.val, op->addr.buswidth, op->addr.nbytes,
-               op->data.buswidth, op->data.nbytes);
        if (mtk_snand_is_page_ops(op)) {
                if (op->data.dir == SPI_MEM_DATA_IN)
                        return mtk_snand_read_page_cache(ms, op);
index 958bab27a08130dabb9cc959bd68c28438d953cc..67cc1d86de425e70f6a7cb457cf288fe8df4e231 100644 (file)
@@ -550,11 +550,6 @@ static int npcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
        int ret = 0;
        u8 *buf;
 
-       dev_dbg(fiu->dev, "cmd:%#x mode:%d.%d.%d.%d addr:%#llx len:%#x\n",
-               op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
-               op->dummy.buswidth, op->data.buswidth, op->addr.val,
-               op->data.nbytes);
-
        if (fiu->spix_mode || op->addr.nbytes > 4)
                return -EOPNOTSUPP;
 
index 540b6948b24db0553fbac738212c7625331654f6..9691197bbf5ad979771af4cacfa758fd246ab297 100644 (file)
@@ -362,11 +362,6 @@ static int stm32_qspi_send(struct spi_device *spi, const struct spi_mem_op *op)
        u32 ccr, cr;
        int timeout, err = 0, err_poll_status = 0;
 
-       dev_dbg(qspi->dev, "cmd:%#x mode:%d.%d.%d.%d addr:%#llx len:%#x\n",
-               op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
-               op->dummy.buswidth, op->data.buswidth,
-               op->addr.val, op->data.nbytes);
-
        cr = readl_relaxed(qspi->io_base + QSPI_CR);
        cr &= ~CR_PRESC_MASK & ~CR_FSEL;
        cr |= FIELD_PREP(CR_PRESC_MASK, flash->presc);
index 2bd25c75f881d62a7ed195bd17a813f9f8789162..5232483c4a3a8ff7b6dc4ca226c911910142f042 100644 (file)
@@ -540,10 +540,6 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
        int err = 0, i;
        u8 *tmpbuf;
 
-       dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
-               op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
-               op->dummy.buswidth, op->data.buswidth);
-
        zynq_qspi_chipselect(mem->spi, true);
        zynq_qspi_config_op(xqspi, mem->spi, op);
 
index 1b0c8ea7afa8fdc6777a88724f68d704a4d9f907..595b6dc108450c4cd76a4f369b717085440a2433 100644 (file)
@@ -1052,10 +1052,6 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,
        u16 opcode = op->cmd.opcode;
        u64 opaddr;
 
-       dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
-               op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
-               op->dummy.buswidth, op->data.buswidth);
-
        mutex_lock(&xqspi->op_lock);
        zynqmp_qspi_config_op(xqspi, op);
        zynqmp_qspi_chipselect(mem->spi, false);