Skip to content

Commit d1c536e

Browse files
Russell Kingstorulf
authored andcommitted
mmc: sdhci: improve ADMA error reporting
ADMA errors are potentially data corrupting events; although we print the register state, we do not usefully print the ADMA descriptors. Worse than that, we print them by referencing their virtual address which is meaningless when the register state gives us the DMA address of the failing descriptor. Print the ADMA descriptors giving their DMA addresses rather than their virtual addresses, and print them using SDHCI_DUMP() rather than DBG(). We also do not show the correct value of the interrupt status register; the register dump shows the current value, after we have cleared the pending interrupts we are going to service. What is more useful is to print the interrupts that _were_ pending at the time the ADMA error was encountered. Fix that too. Signed-off-by: Russell King <[email protected]> Acked-by: Adrian Hunter <[email protected]> Cc: [email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 3c6a691 commit d1c536e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,25 +2874,29 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask, u32 *intmask_p)
28742874
static void sdhci_adma_show_error(struct sdhci_host *host)
28752875
{
28762876
void *desc = host->adma_table;
2877+
dma_addr_t dma = host->adma_addr;
28772878

28782879
sdhci_dumpregs(host);
28792880

28802881
while (true) {
28812882
struct sdhci_adma2_64_desc *dma_desc = desc;
28822883

28832884
if (host->flags & SDHCI_USE_64_BIT_DMA)
2884-
DBG("%p: DMA 0x%08x%08x, LEN 0x%04x, Attr=0x%02x\n",
2885-
desc, le32_to_cpu(dma_desc->addr_hi),
2885+
SDHCI_DUMP("%08llx: DMA 0x%08x%08x, LEN 0x%04x, Attr=0x%02x\n",
2886+
(unsigned long long)dma,
2887+
le32_to_cpu(dma_desc->addr_hi),
28862888
le32_to_cpu(dma_desc->addr_lo),
28872889
le16_to_cpu(dma_desc->len),
28882890
le16_to_cpu(dma_desc->cmd));
28892891
else
2890-
DBG("%p: DMA 0x%08x, LEN 0x%04x, Attr=0x%02x\n",
2891-
desc, le32_to_cpu(dma_desc->addr_lo),
2892+
SDHCI_DUMP("%08llx: DMA 0x%08x, LEN 0x%04x, Attr=0x%02x\n",
2893+
(unsigned long long)dma,
2894+
le32_to_cpu(dma_desc->addr_lo),
28922895
le16_to_cpu(dma_desc->len),
28932896
le16_to_cpu(dma_desc->cmd));
28942897

28952898
desc += host->desc_sz;
2899+
dma += host->desc_sz;
28962900

28972901
if (dma_desc->cmd & cpu_to_le16(ADMA2_END))
28982902
break;
@@ -2968,7 +2972,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
29682972
!= MMC_BUS_TEST_R)
29692973
host->data->error = -EILSEQ;
29702974
else if (intmask & SDHCI_INT_ADMA_ERROR) {
2971-
pr_err("%s: ADMA error\n", mmc_hostname(host->mmc));
2975+
pr_err("%s: ADMA error: 0x%08x\n", mmc_hostname(host->mmc),
2976+
intmask);
29722977
sdhci_adma_show_error(host);
29732978
host->data->error = -EIO;
29742979
if (host->ops->adma_workaround)

0 commit comments

Comments
 (0)