Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63938 )
Change subject: soc/amd/common/block/spi: Pretty print SPI status ......................................................................
soc/amd/common/block/spi: Pretty print SPI status
I find it difficult to constantly decode the registers when reading them. Let's print out something that's easier to parse.
BUG=b:228289365 TEST=boot guybrush and see status codes printed
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I6c9d98cf43f340cf50e12c93b4c35187de9bb750 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63938 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Rob Barnes robbarnes@google.com Reviewed-by: Fred Reitberger reitbergerfred@gmail.com Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/common/block/spi/fch_spi_ctrl.c 1 file changed, 12 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved Rob Barnes: Looks good to me, approved Fred Reitberger: Looks good to me, but someone else must approve
diff --git a/src/soc/amd/common/block/spi/fch_spi_ctrl.c b/src/soc/amd/common/block/spi/fch_spi_ctrl.c index e8f20f3..519503d 100644 --- a/src/soc/amd/common/block/spi/fch_spi_ctrl.c +++ b/src/soc/amd/common/block/spi/fch_spi_ctrl.c @@ -39,6 +39,7 @@ { u8 dump_size; uintptr_t addr; + u32 status;
if (!CONFIG(SOC_AMD_COMMON_BLOCK_SPI_DEBUG)) return; @@ -55,7 +56,17 @@ }
printk(BIOS_DEBUG, "Cntrl0: %x\n", spi_read32(SPI_CNTRL0)); - printk(BIOS_DEBUG, "Status: %x\n", spi_read32(SPI_STATUS)); + + status = spi_read32(SPI_STATUS); + printk(BIOS_DEBUG, "Status: %x\n", status); + printk(BIOS_DEBUG, + " Busy: %u, FIFO Read Pointer: %u, FIFO Write Pointer: %u, Done Bytes: %u\n", + !!(status & SPI_BUSY), + (status >> SPI_FIFO_RD_PTR_SHIFT) & SPI_FIFO_RD_PTR_MASK, + (status >> SPI_FIFO_WR_PTR_SHIFT) & SPI_FIFO_WR_PTR_MASK, + (status >> SPI_DONE_BYTE_COUNT_SHIFT) & SPI_DONE_BYTE_COUNT_MASK); + + printk(BIOS_DEBUG, "CmdCode: %x\n", spi_read8(SPI_CMD_CODE));
addr = spi_get_bar() + SPI_FIFO;
@@ -63,7 +74,6 @@ case SPI_DUMP_STATE_BEFORE_CMD: dump_size = spi_read8(SPI_TX_BYTE_COUNT); printk(BIOS_DEBUG, "TxByteCount: %x\n", dump_size); - printk(BIOS_DEBUG, "CmdCode: %x\n", spi_read8(SPI_CMD_CODE)); break; case SPI_DUMP_STATE_AFTER_CMD: dump_size = spi_read8(SPI_RX_BYTE_COUNT);