Skip to content

Commit ad44888

Browse files
miquelraynalbroonie
authored andcommitted
spi: spi-mem: Introduce a default ->exec_op() debug log
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>
1 parent 48303ef commit ad44888

File tree

7 files changed

+11
-28
lines changed

7 files changed

+11
-28
lines changed

drivers/spi/spi-aspeed-smc.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,6 @@ static int do_aspeed_spi_exec_op(struct spi_mem *mem, const struct spi_mem_op *o
303303
u32 ctl_val;
304304
int ret = 0;
305305

306-
dev_dbg(aspi->dev,
307-
"CE%d %s OP %#x mode:%d.%d.%d.%d naddr:%#x ndummies:%#x len:%#x",
308-
chip->cs, op->data.dir == SPI_MEM_DATA_IN ? "read" : "write",
309-
op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
310-
op->dummy.buswidth, op->data.buswidth,
311-
op->addr.nbytes, op->dummy.nbytes, op->data.nbytes);
312-
313306
addr_mode = readl(aspi->regs + CE_CTRL_REG);
314307
addr_mode_backup = addr_mode;
315308

drivers/spi/spi-mem.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,17 @@ int spi_mem_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
377377
/* Make sure the operation frequency is correct before going futher */
378378
spi_mem_adjust_op_freq(mem, (struct spi_mem_op *)op);
379379

380+
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",
381+
op->cmd.opcode,
382+
op->addr.nbytes, (op->addr.nbytes ? op->addr.val : 0),
383+
op->dummy.nbytes,
384+
op->data.nbytes, (op->data.nbytes ? (op->data.dir == SPI_MEM_DATA_IN ? " read" : "write") : " "),
385+
op->cmd.buswidth, op->cmd.dtr ? 'D' : 'S',
386+
op->addr.buswidth, op->addr.dtr ? 'D' : 'S',
387+
op->dummy.buswidth, op->dummy.dtr ? 'D' : 'S',
388+
op->data.buswidth, op->data.dtr ? 'D' : 'S',
389+
op->max_freq ? op->max_freq : mem->spi->max_speed_hz);
390+
380391
ret = spi_mem_check_op(op);
381392
if (ret)
382393
return ret;

drivers/spi/spi-mtk-snfi.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,9 +1284,6 @@ static int mtk_snand_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
12841284
{
12851285
struct mtk_snand *ms = spi_controller_get_devdata(mem->spi->controller);
12861286

1287-
dev_dbg(ms->dev, "OP %02x ADDR %08llX@%d:%u DATA %d:%u", op->cmd.opcode,
1288-
op->addr.val, op->addr.buswidth, op->addr.nbytes,
1289-
op->data.buswidth, op->data.nbytes);
12901287
if (mtk_snand_is_page_ops(op)) {
12911288
if (op->data.dir == SPI_MEM_DATA_IN)
12921289
return mtk_snand_read_page_cache(ms, op);

drivers/spi/spi-npcm-fiu.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,6 @@ static int npcm_fiu_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
550550
int ret = 0;
551551
u8 *buf;
552552

553-
dev_dbg(fiu->dev, "cmd:%#x mode:%d.%d.%d.%d addr:%#llx len:%#x\n",
554-
op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
555-
op->dummy.buswidth, op->data.buswidth, op->addr.val,
556-
op->data.nbytes);
557-
558553
if (fiu->spix_mode || op->addr.nbytes > 4)
559554
return -EOPNOTSUPP;
560555

drivers/spi/spi-stm32-qspi.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,6 @@ static int stm32_qspi_send(struct spi_device *spi, const struct spi_mem_op *op)
362362
u32 ccr, cr;
363363
int timeout, err = 0, err_poll_status = 0;
364364

365-
dev_dbg(qspi->dev, "cmd:%#x mode:%d.%d.%d.%d addr:%#llx len:%#x\n",
366-
op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
367-
op->dummy.buswidth, op->data.buswidth,
368-
op->addr.val, op->data.nbytes);
369-
370365
cr = readl_relaxed(qspi->io_base + QSPI_CR);
371366
cr &= ~CR_PRESC_MASK & ~CR_FSEL;
372367
cr |= FIELD_PREP(CR_PRESC_MASK, flash->presc);

drivers/spi/spi-zynq-qspi.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,6 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
540540
int err = 0, i;
541541
u8 *tmpbuf;
542542

543-
dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
544-
op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
545-
op->dummy.buswidth, op->data.buswidth);
546-
547543
zynq_qspi_chipselect(mem->spi, true);
548544
zynq_qspi_config_op(xqspi, mem->spi, op);
549545

drivers/spi/spi-zynqmp-gqspi.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,10 +1052,6 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,
10521052
u16 opcode = op->cmd.opcode;
10531053
u64 opaddr;
10541054

1055-
dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
1056-
op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
1057-
op->dummy.buswidth, op->data.buswidth);
1058-
10591055
mutex_lock(&xqspi->op_lock);
10601056
zynqmp_qspi_config_op(xqspi, op);
10611057
zynqmp_qspi_chipselect(mem->spi, false);

0 commit comments

Comments
 (0)