Skip to contentSkip to conversation

mmc: sdhci: UHS-II support, dump UHS-II registers

RFC PATCH In review Ben Chuang 3 participants 3 messages Jul 10, 2020 – Sep 15, 2020

Subsystems (2)
lore
Share & tools
lore

Ben Chuang

author
#0 lore raw

RFC PATCH v3 10/21 mmc: sdhci: UHS-II support, dump UHS-II registers

From: AKASHI Takahiro <[email protected]>

Dump UHS-II specific registers, if available, in sdhci_dumpregs() for informative/debugging use.

---
 drivers/mmc/host/sdhci.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/mmc/host/sdhci.c +24 -0
index 37b1158c1c0c..c2f6923d296c 100644
@@ -111,6 +111,30 @@ void sdhci_dumpregs(struct sdhci_host *host)
 		}
 	}
 
+	if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
+	    host->mmc && host->mmc->flags & MMC_UHS2_SUPPORT) {
+		SDHCI_DUMP("==================== UHS2 ==================\n");
+		SDHCI_DUMP("Blk Size:  0x%08x | Blk Cnt:  0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_BLOCK_SIZE),
+			   sdhci_readl(host, SDHCI_UHS2_BLOCK_COUNT));
+		SDHCI_DUMP("Cmd:       0x%08x | Trn mode: 0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_COMMAND),
+			   sdhci_readw(host, SDHCI_UHS2_TRANS_MODE));
+		SDHCI_DUMP("Int Stat:  0x%08x | Dev Sel : 0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_DEV_INT_STATUS),
+			   sdhci_readb(host, SDHCI_UHS2_DEV_SELECT));
+		SDHCI_DUMP("Dev Int Code:  0x%08x\n",
+			   sdhci_readb(host, SDHCI_UHS2_DEV_INT_CODE));
+		SDHCI_DUMP("Reset:     0x%08x | Timer:    0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_SW_RESET),
+			   sdhci_readw(host, SDHCI_UHS2_TIMER_CTRL));
+		SDHCI_DUMP("ErrInt:    0x%08x | ErrIntEn: 0x%08x\n",
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_STATUS),
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_STATUS_EN));
+		SDHCI_DUMP("ErrSigEn:  0x%08x\n",
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_SIG_EN));
+	}
+
 	if (host->ops->dump_vendor_regs)
 		host->ops->dump_vendor_regs(host);
 
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 33 lines · Ben Chuang

From: AKASHI Takahiro <[email protected]>

Dump UHS-II specific registers, if available, in sdhci_dumpregs() for informative/debugging use.

---
 drivers/mmc/host/sdhci.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/mmc/host/sdhci.c +14 -0
index 37b1158c1c0c..c2f6923d296c 100644
@@ -111,6 +111,30 @@ void sdhci_dumpregs(struct sdhci_host *host)
 		}
 	}
 
+	if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
+	    host->mmc && host->mmc->flags & MMC_UHS2_SUPPORT) {
+		SDHCI_DUMP("==================== UHS2 ==================\n");
+		SDHCI_DUMP("Blk Size:  0x%08x | Blk Cnt:  0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_BLOCK_SIZE),
+			   sdhci_readl(host, SDHCI_UHS2_BLOCK_COUNT));
+		SDHCI_DUMP("Cmd:       0x%08x | Trn mode: 0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_COMMAND),
+			   sdhci_readw(host, SDHCI_UHS2_TRANS_MODE));
+		SDHCI_DUMP("Int Stat:  0x%08x | Dev Sel : 0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_DEV_INT_STATUS),
+			   sdhci_readb(host, SDHCI_UHS2_DEV_SELECT));
+		SDHCI_DUMP("Dev Int Code:  0x%08x\n",
+			   sdhci_readb(host, SDHCI_UHS2_DEV_INT_CODE));

drivers/mmc/host/sdhci.c void sdhci_dumpregs(struct sdhci_host *host) · line 137

Quoted 10 lines
drivers/mmc/host/sdhci.c +10 -0
+		SDHCI_DUMP("Reset:     0x%08x | Timer:    0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_SW_RESET),
+			   sdhci_readw(host, SDHCI_UHS2_TIMER_CTRL));
+		SDHCI_DUMP("ErrInt:    0x%08x | ErrIntEn: 0x%08x\n",
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_STATUS),
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_STATUS_EN));
+		SDHCI_DUMP("ErrSigEn:  0x%08x\n",
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_SIG_EN));
+	}
+

Let's make this a host op instead ie.

	if (host->ops->dump_uhs2_regs)
		host->ops->dump_uhs2_regs(host);
Quoted 4 lines
drivers/mmc/host/sdhci.c +0 -0
 	if (host->ops->dump_vendor_regs)
 		host->ops->dump_vendor_regs(host);
 
#2 lore raw
Quoted 47 lines · Adrian Hunter
Quoted 33 lines · Ben Chuang

From: AKASHI Takahiro <[email protected]>

Dump UHS-II specific registers, if available, in sdhci_dumpregs() for informative/debugging use.

---
 drivers/mmc/host/sdhci.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/mmc/host/sdhci.c +14 -0
index 37b1158c1c0c..c2f6923d296c 100644
@@ -111,6 +111,30 @@ void sdhci_dumpregs(struct sdhci_host *host)
 		}
 	}
 
+	if (IS_ENABLED(CONFIG_MMC_SDHCI_UHS2) &&
+	    host->mmc && host->mmc->flags & MMC_UHS2_SUPPORT) {
+		SDHCI_DUMP("==================== UHS2 ==================\n");
+		SDHCI_DUMP("Blk Size:  0x%08x | Blk Cnt:  0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_BLOCK_SIZE),
+			   sdhci_readl(host, SDHCI_UHS2_BLOCK_COUNT));
+		SDHCI_DUMP("Cmd:       0x%08x | Trn mode: 0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_COMMAND),
+			   sdhci_readw(host, SDHCI_UHS2_TRANS_MODE));
+		SDHCI_DUMP("Int Stat:  0x%08x | Dev Sel : 0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_DEV_INT_STATUS),
+			   sdhci_readb(host, SDHCI_UHS2_DEV_SELECT));
+		SDHCI_DUMP("Dev Int Code:  0x%08x\n",
+			   sdhci_readb(host, SDHCI_UHS2_DEV_INT_CODE));

drivers/mmc/host/sdhci.c void sdhci_dumpregs(struct sdhci_host *host) · line 137

Quoted 10 lines
drivers/mmc/host/sdhci.c +10 -0
+		SDHCI_DUMP("Reset:     0x%08x | Timer:    0x%08x\n",
+			   sdhci_readw(host, SDHCI_UHS2_SW_RESET),
+			   sdhci_readw(host, SDHCI_UHS2_TIMER_CTRL));
+		SDHCI_DUMP("ErrInt:    0x%08x | ErrIntEn: 0x%08x\n",
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_STATUS),
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_STATUS_EN));
+		SDHCI_DUMP("ErrSigEn:  0x%08x\n",
+			   sdhci_readl(host, SDHCI_UHS2_ERR_INT_SIG_EN));
+	}
+

Let's make this a host op instead ie.

Quoted 2 lines
	if (host->ops->dump_uhs2_regs)
		host->ops->dump_uhs2_regs(host);

Sure.

-Takahiro Akashi

Quoted 5 lines
Quoted 4 lines
drivers/mmc/host/sdhci.c +0 -0
 	if (host->ops->dump_vendor_regs)
 		host->ops->dump_vendor_regs(host);