From: Sean Anderson Date: Fri, 26 Feb 2021 07:56:03 -0500 Subject: [PATCH v2 05/14] spi: spi-mem: Add debug message for spi-mem ops In-Reply-To: References: <20210205041119.145784-1-seanga2@gmail.com> <20210205041119.145784-6-seanga2@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/26/21 5:12 AM, Jagan Teki wrote: > On Fri, Feb 5, 2021 at 9:41 AM Sean Anderson wrote: >> >> 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 >> Reviewed-by: Pratyush Yadav >> --- >> >> Changes in v2: >> - Add more information to exec_op debug message >> >> drivers/spi/spi-mem.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> 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); > > This looks unnecessary to me, we have debug prints at the end of the > function, which indeed sufficient. > This is insufficient. First, that information is printed after the op is executed. This is too late if one is trying to debug (e.g.) a hang in the spi driver. It's also missing opcode, widths, address, and dummy bytes. The only duplicated info here is nbytes. Since this is debugging information, I think we should print what is most useful for people debugging this subsystem. --Sean