Skip to contentSkip to conversation

mmc: sdhci: sdhci-msm: Add more debug logs

RFC PATCH In review Ritesh Harjani 2 participants 11 messages Dec 30, 2016 – Jan 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover mmc: sdhci: sdhci-msm: Add more debug logs

Below is a small set of patches which provide useful info for debugging issues.

Patch 1 :- This provide callback mechanism for platform drivers to dump their necessary register info at the time of sdhci_dumpregs.

Patch 2 :- This implements this callback (->platform_dumpregs) for sdhci-msm.

Patch 3 :- Adds more logs for data errors to aid debugging.

Ritesh Harjani (1):
mmc: sdhci: Add more debug info in case of data error

Sahitya Tummala (2):
mmc: sdhci: Add platform_dumpregs callback support to sdhci_ops.
mmc: sdhci-msm: Implement platform_dumpregs callback in sdhci-msm

 drivers/mmc/host/sdhci-msm.c | 34 ++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sdhci.c     | 24 ++++++++++++++++++++++--
 drivers/mmc/host/sdhci.h     |  1 +
 3 files changed, 57 insertions(+), 2 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project.
#1 lore raw

RFC PATCH 1/3 mmc: sdhci: Add platform_dumpregs callback support to sdhci_ops.

From: Sahitya Tummala <[email protected]>

Add new host operation ->platform_dumpregs to provide a mechanism through which host drivers can dump platform specific registers in addition to SDHC registers during error conditions.

---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 4 insertions(+)
drivers/mmc/host/sdhci.c +3 -0
index 2390980..73a8918 100644
@@ -101,6 +101,9 @@ static void sdhci_dumpregs(struct sdhci_host *host)
 			       readl(host->ioaddr + SDHCI_ADMA_ADDRESS));
 	}
 
+	if (host->ops->platform_dumpregs)
+		host->ops->platform_dumpregs(host);
+
 	pr_err(DRIVER_NAME ": ===========================================\n");
 }
 
drivers/mmc/host/sdhci.h +1 -0
index 0b66f21..400f3a1 100644
@@ -564,6 +564,7 @@ struct sdhci_ops {
 					 struct mmc_card *card,
 					 unsigned int max_dtr, int host_drv,
 					 int card_drv, int *drv_type);
+	void	(*platform_dumpregs)(struct sdhci_host *host);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project.
#2 lore raw

Re: [RFC PATCH 1/3] mmc: sdhci: Add platform_dumpregs callback support to sdhci_ops.

Quoted 7 lines · Ritesh Harjani

From: Sahitya Tummala <[email protected]>

Add new host operation ->platform_dumpregs to provide a mechanism through which host drivers can dump platform specific registers in addition to SDHC registers during error conditions.

Quoted 7 lines
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 4 insertions(+)

This change and 2/3 look like they can be squished together into one patch. At least that is how I did it,

https://patchwork.kernel.org/patch/9442449/

-jeremy

Quoted 30 lines
drivers/mmc/host/sdhci.c +3 -0
index 2390980..73a8918 100644
@@ -101,6 +101,9 @@ static void sdhci_dumpregs(struct sdhci_host *host)
 			       readl(host->ioaddr + SDHCI_ADMA_ADDRESS));
 	}
 
+	if (host->ops->platform_dumpregs)
+		host->ops->platform_dumpregs(host);
+
 	pr_err(DRIVER_NAME ": ===========================================\n");
 }
 
drivers/mmc/host/sdhci.h +1 -0
index 0b66f21..400f3a1 100644
@@ -564,6 +564,7 @@ struct sdhci_ops {
 					 struct mmc_card *card,
 					 unsigned int max_dtr, int host_drv,
 					 int card_drv, int *drv_type);
+	void	(*platform_dumpregs)(struct sdhci_host *host);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project.
#3 lore raw

Re: [RFC PATCH 1/3] mmc: sdhci: Add platform_dumpregs callback support to sdhci_ops.

Hi Jeremy,

Thanks for the review.

Quoted 16 lines · Jeremy McNicoll
Quoted 7 lines · Ritesh Harjani

From: Sahitya Tummala <[email protected]>

Add new host operation ->platform_dumpregs to provide a mechanism through which host drivers can dump platform specific registers in addition to SDHC registers during error conditions.

Quoted 7 lines
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 4 insertions(+)
Quoted 2 lines

This change and 2/3 look like they can be squished together into one patch. At least that is how I did it,

I felt it is better this way to keep sdhci and sdhci-msm patches separate. This patch provides mechanism and patch 3/3 provides implementation of ->platform_dumpregs in sdhci-msm.

Regards
Ritesh

Quoted 36 lines

https://patchwork.kernel.org/patch/9442449/

-jeremy

Quoted 30 lines
drivers/mmc/host/sdhci.c +3 -0
index 2390980..73a8918 100644
@@ -101,6 +101,9 @@ static void sdhci_dumpregs(struct sdhci_host *host)
 			       readl(host->ioaddr + SDHCI_ADMA_ADDRESS));
 	}
 
+	if (host->ops->platform_dumpregs)
+		host->ops->platform_dumpregs(host);
+
 	pr_err(DRIVER_NAME ": ===========================================\n");
 }
 
drivers/mmc/host/sdhci.h +1 -1
index 0b66f21..400f3a1 100644
@@ -564,6 +564,7 @@ struct sdhci_ops {
 					 struct mmc_card *card,
 					 unsigned int max_dtr, int host_drv,
 					 int card_drv, int *drv_type);
+	void	(*platform_dumpregs)(struct sdhci_host *host);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

Re: [RFC PATCH 1/3] mmc: sdhci: Add platform_dumpregs callback support to sdhci_ops.

Quoted 21 lines · Ritesh Harjani

Hi Jeremy,

Thanks for the review.

Quoted 16 lines · Jeremy McNicoll
Quoted 14 lines · Ritesh Harjani

From: Sahitya Tummala <[email protected]>

Add new host operation ->platform_dumpregs to provide a mechanism through which host drivers can dump platform specific registers in addition to SDHC registers during error conditions.

---
drivers/mmc/host/sdhci.c | 3 +++
drivers/mmc/host/sdhci.h | 1 +

2 files changed, 4 insertions(+)
Quoted 7 lines
Quoted 2 lines

This change and 2/3 look like they can be squished together into one patch. At least that is how I did it,

I felt it is better this way to keep sdhci and sdhci-msm patches separate. This patch provides mechanism and patch 3/3 provides implementation of ->platform_dumpregs in sdhci-msm.

Alright, lets go with that approach.

-jeremy

Quoted 44 lines

Regards
Ritesh

Quoted 36 lines

https://patchwork.kernel.org/patch/9442449/

-jeremy

Quoted 30 lines
drivers/mmc/host/sdhci.c +3 -0
index 2390980..73a8918 100644
@@ -101,6 +101,9 @@ static void sdhci_dumpregs(struct sdhci_host *host)
 			       readl(host->ioaddr + SDHCI_ADMA_ADDRESS));
 	}
 
+	if (host->ops->platform_dumpregs)
+		host->ops->platform_dumpregs(host);
+
 	pr_err(DRIVER_NAME ": ===========================================\n");
 }
 
drivers/mmc/host/sdhci.h +1 -1
index 0b66f21..400f3a1 100644
@@ -564,6 +564,7 @@ struct sdhci_ops {
 					 struct mmc_card *card,
 					 unsigned int max_dtr, int host_drv,
 					 int card_drv, int *drv_type);
+	void	(*platform_dumpregs)(struct sdhci_host *host);
 };
 
 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#5 lore raw

RFC PATCH 2/3 mmc: sdhci-msm: Implement platform_dumpregs callback in sdhci-msm

In reply to Ritesh Harjani

From: Sahitya Tummala <[email protected]>

Implement ->platform_dumpregs host operation to print the platform specific registers in addition to standard SDHC register during error conditions.

---
 drivers/mmc/host/sdhci-msm.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/mmc/host/sdhci-msm.c +34 -0
index 32879b8..1241dbd 100644
@@ -29,6 +29,11 @@
 #define CORE_VERSION_MAJOR_MASK		(0xf << CORE_VERSION_MAJOR_SHIFT)
 #define CORE_VERSION_MINOR_MASK		0xff
 
+#define CORE_MCI_DATA_CNT	0x30
+#define CORE_MCI_STATUS		0x34
+#define CORE_MCI_FIFO_CNT	0x44
+#define CORE_MCI_STATUS2	0x6c
+
 #define CORE_HC_MODE		0x78
 #define HC_MODE_EN		0x1
 #define CORE_POWER		0x0
@@ -77,6 +82,10 @@
 #define CORE_HC_SELECT_IN_HS400	(6 << 19)
 #define CORE_HC_SELECT_IN_MASK	(7 << 19)
 
+#define CORE_VENDOR_SPEC_FUNC2		0x110
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR0	0x114
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR1	0x118
+
 #define CORE_CSR_CDC_CTLR_CFG0		0x130
 #define CORE_SW_TRIG_FULL_CALIB		BIT(16)
 #define CORE_HW_AUTOCAL_ENA		BIT(17)
@@ -658,6 +667,30 @@ static int sdhci_msm_hs400_dll_calibration(struct sdhci_host *host)
 	return ret;
 }
 
+static void sdhci_msm_dumpregs(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+
+	pr_err("----------- PLATFORM REGISTER DUMP -----------\n");
+
+	pr_err("Data cnt: 0x%08x | Fifo cnt: 0x%08x | Int sts: 0x%08x | Int sts2: 0x%08x\n",
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_DATA_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_FIFO_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS2));
+	pr_err("DLL cfg:  0x%08x | DLL sts:  0x%08x | SDCC ver: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_DLL_CONFIG),
+	       readl_relaxed(host->ioaddr + CORE_DLL_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_VERSION));
+	pr_err("Vndr func: 0x%08x | Vndr adma err : addr0: 0x%08x addr1: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC),
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR0),
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR1));
+	pr_err("Vndr func2: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_FUNC2));
+}
+
 static int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
 {
 	int tuning_seq_cnt = 3;
@@ -1035,6 +1068,7 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
 	.set_bus_width = sdhci_set_bus_width,
 	.set_uhs_signaling = sdhci_msm_set_uhs_signaling,
 	.voltage_switch = sdhci_msm_voltage_switch,
+	.platform_dumpregs = sdhci_msm_dumpregs,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project.
#6 lore raw

Re: [RFC PATCH 2/3] mmc: sdhci-msm: Implement platform_dumpregs callback in sdhci-msm

Quoted 57 lines · Ritesh Harjani

From: Sahitya Tummala <[email protected]>

Implement ->platform_dumpregs host operation to print the platform specific registers in addition to standard SDHC register during error conditions.

---
 drivers/mmc/host/sdhci-msm.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/mmc/host/sdhci-msm.c +23 -0
index 32879b8..1241dbd 100644
@@ -29,6 +29,11 @@
 #define CORE_VERSION_MAJOR_MASK		(0xf << CORE_VERSION_MAJOR_SHIFT)
 #define CORE_VERSION_MINOR_MASK		0xff
 
+#define CORE_MCI_DATA_CNT	0x30
+#define CORE_MCI_STATUS		0x34
+#define CORE_MCI_FIFO_CNT	0x44
+#define CORE_MCI_STATUS2	0x6c
+
 #define CORE_HC_MODE		0x78
 #define HC_MODE_EN		0x1
 #define CORE_POWER		0x0
@@ -77,6 +82,10 @@
 #define CORE_HC_SELECT_IN_HS400	(6 << 19)
 #define CORE_HC_SELECT_IN_MASK	(7 << 19)
 
+#define CORE_VENDOR_SPEC_FUNC2		0x110
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR0	0x114
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR1	0x118
+
 #define CORE_CSR_CDC_CTLR_CFG0		0x130
 #define CORE_SW_TRIG_FULL_CALIB		BIT(16)
 #define CORE_HW_AUTOCAL_ENA		BIT(17)
@@ -658,6 +667,30 @@ static int sdhci_msm_hs400_dll_calibration(struct sdhci_host *host)
 	return ret;
 }
 
+static void sdhci_msm_dumpregs(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+
+	pr_err("----------- PLATFORM REGISTER DUMP -----------\n");
+
+	pr_err("Data cnt: 0x%08x | Fifo cnt: 0x%08x | Int sts: 0x%08x | Int sts2: 0x%08x\n",
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_DATA_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_FIFO_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS2));
+	pr_err("DLL cfg:  0x%08x | DLL sts:  0x%08x | SDCC ver: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_DLL_CONFIG),

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_hs400_dll_calibration(struct sdhci_host *host) · line 693

Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +10 -0
+	       readl_relaxed(host->ioaddr + CORE_DLL_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_VERSION));
+	pr_err("Vndr func: 0x%08x | Vndr adma err : addr0: 0x%08x addr1: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC),
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR0),
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR1));
+	pr_err("Vndr func2: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_FUNC2));
+}
+

Why did you omit the printing of CORE_TESTBUS_CONFIG like that of
https://patchwork.kernel.org/patch/9442449/

and sdhci_dump_state() was dropped too. Being able to dump the rpm_info was very handy for issues I was running into.

-jeremy

Quoted 15 lines
drivers/mmc/host/sdhci-msm.c +1 -0
 static int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
 {
 	int tuning_seq_cnt = 3;
@@ -1035,6 +1068,7 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
 	.set_bus_width = sdhci_set_bus_width,
 	.set_uhs_signaling = sdhci_msm_set_uhs_signaling,
 	.voltage_switch = sdhci_msm_voltage_switch,
+	.platform_dumpregs = sdhci_msm_dumpregs,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project.
#7 lore raw

Re: [RFC PATCH 2/3] mmc: sdhci-msm: Implement platform_dumpregs callback in sdhci-msm

Hi Jeremy,

Quoted 63 lines · Jeremy McNicoll
Quoted 62 lines · Ritesh Harjani

From: Sahitya Tummala <[email protected]>

Implement ->platform_dumpregs host operation to print the platform specific registers in addition to standard SDHC register during error conditions.

---
 drivers/mmc/host/sdhci-msm.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/mmc/host/sdhci-msm.c +28 -0
index 32879b8..1241dbd 100644
@@ -29,6 +29,11 @@
 #define CORE_VERSION_MAJOR_MASK		(0xf << CORE_VERSION_MAJOR_SHIFT)
 #define CORE_VERSION_MINOR_MASK		0xff
 
+#define CORE_MCI_DATA_CNT	0x30
+#define CORE_MCI_STATUS		0x34
+#define CORE_MCI_FIFO_CNT	0x44
+#define CORE_MCI_STATUS2	0x6c
+
 #define CORE_HC_MODE		0x78
 #define HC_MODE_EN		0x1
 #define CORE_POWER		0x0
@@ -77,6 +82,10 @@
 #define CORE_HC_SELECT_IN_HS400	(6 << 19)
 #define CORE_HC_SELECT_IN_MASK	(7 << 19)
 
+#define CORE_VENDOR_SPEC_FUNC2		0x110
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR0	0x114
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR1	0x118
+
 #define CORE_CSR_CDC_CTLR_CFG0		0x130
 #define CORE_SW_TRIG_FULL_CALIB		BIT(16)
 #define CORE_HW_AUTOCAL_ENA		BIT(17)
@@ -658,6 +667,30 @@ static int sdhci_msm_hs400_dll_calibration(struct sdhci_host *host)
 	return ret;
 }
 
+static void sdhci_msm_dumpregs(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+
+	pr_err("----------- PLATFORM REGISTER DUMP -----------\n");
+
+	pr_err("Data cnt: 0x%08x | Fifo cnt: 0x%08x | Int sts: 0x%08x | Int sts2: 0x%08x\n",
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_DATA_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_FIFO_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS2));
+	pr_err("DLL cfg:  0x%08x | DLL sts:  0x%08x | SDCC ver: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_DLL_CONFIG),
+	       readl_relaxed(host->ioaddr + CORE_DLL_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_VERSION));
+	pr_err("Vndr func: 0x%08x | Vndr adma err : addr0: 0x%08x addr1: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC),
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR0),
Quoted 8 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_hs400_dll_calibration(struct sdhci_host *host) · line 693

Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +5 -0
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR1));
+	pr_err("Vndr func2: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_FUNC2));
+}
+

Why did you omit the printing of CORE_TESTBUS_CONFIG like that of
https://patchwork.kernel.org/patch/9442449/

Actually testbus registers aren't something we analyze every-time. So I have skipped it for now. We can add it later if and when required.

Quoted 3 lines

and sdhci_dump_state() was dropped too. Being able to dump the rpm_info was very handy for issues I was running into.

Sure, let me add that info as well.

Quoted 18 lines

-jeremy

Quoted 15 lines
drivers/mmc/host/sdhci-msm.c +1 -1
 static int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
 {
 	int tuning_seq_cnt = 3;
@@ -1035,6 +1068,7 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
 	.set_bus_width = sdhci_set_bus_width,
 	.set_uhs_signaling = sdhci_msm_set_uhs_signaling,
 	.voltage_switch = sdhci_msm_voltage_switch,
+	.platform_dumpregs = sdhci_msm_dumpregs,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
--

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#8 lore raw

Re: [RFC PATCH 2/3] mmc: sdhci-msm: Implement platform_dumpregs callback in sdhci-msm

Quoted 74 lines · Ritesh Harjani

Hi Jeremy,

Quoted 63 lines · Jeremy McNicoll
Quoted 62 lines · Ritesh Harjani

From: Sahitya Tummala <[email protected]>

Implement ->platform_dumpregs host operation to print the platform specific registers in addition to standard SDHC register during error conditions.

---
drivers/mmc/host/sdhci-msm.c | 34 ++++++++++++++++++++++++++++++++++

1 file changed, 34 insertions(+)
drivers/mmc/host/sdhci-msm.c +28 -0
index 32879b8..1241dbd 100644
@@ -29,6 +29,11 @@
 #define CORE_VERSION_MAJOR_MASK		(0xf << CORE_VERSION_MAJOR_SHIFT)
 #define CORE_VERSION_MINOR_MASK		0xff
 
+#define CORE_MCI_DATA_CNT	0x30
+#define CORE_MCI_STATUS		0x34
+#define CORE_MCI_FIFO_CNT	0x44
+#define CORE_MCI_STATUS2	0x6c
+
 #define CORE_HC_MODE		0x78
 #define HC_MODE_EN		0x1
 #define CORE_POWER		0x0
@@ -77,6 +82,10 @@
 #define CORE_HC_SELECT_IN_HS400	(6 << 19)
 #define CORE_HC_SELECT_IN_MASK	(7 << 19)
 
+#define CORE_VENDOR_SPEC_FUNC2		0x110
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR0	0x114
+#define CORE_VENDOR_SPEC_ADMA_ERR_ADDR1	0x118
+
 #define CORE_CSR_CDC_CTLR_CFG0		0x130
 #define CORE_SW_TRIG_FULL_CALIB		BIT(16)
 #define CORE_HW_AUTOCAL_ENA		BIT(17)
@@ -658,6 +667,30 @@ static int sdhci_msm_hs400_dll_calibration(struct sdhci_host *host)
 	return ret;
 }
 
+static void sdhci_msm_dumpregs(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+
+	pr_err("----------- PLATFORM REGISTER DUMP -----------\n");
+
+	pr_err("Data cnt: 0x%08x | Fifo cnt: 0x%08x | Int sts: 0x%08x | Int sts2: 0x%08x\n",
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_DATA_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_FIFO_CNT),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_STATUS2));
+	pr_err("DLL cfg:  0x%08x | DLL sts:  0x%08x | SDCC ver: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_DLL_CONFIG),
+	       readl_relaxed(host->ioaddr + CORE_DLL_STATUS),
+	       readl_relaxed(msm_host->core_mem + CORE_MCI_VERSION));
+	pr_err("Vndr func: 0x%08x | Vndr adma err : addr0: 0x%08x addr1: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC),
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR0),
Quoted 8 lines

drivers/mmc/host/sdhci-msm.c static int sdhci_msm_hs400_dll_calibration(struct sdhci_host *host) · line 693

Quoted 5 lines
drivers/mmc/host/sdhci-msm.c +5 -0
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_ADMA_ERR_ADDR1));
+	pr_err("Vndr func2: 0x%08x\n",
+	       readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC_FUNC2));
+}
+

Why did you omit the printing of CORE_TESTBUS_CONFIG like that of
https://patchwork.kernel.org/patch/9442449/

Quoted 3 lines

Actually testbus registers aren't something we analyze every-time. So I have skipped it for now. We can add it later if and when required.

Sounds reasonable.

Quoted 6 lines
Quoted 4 lines

and sdhci_dump_state() was dropped too. Being able to dump the rpm_info was very handy for issues I was running into.

Sure, let me add that info as well.

Great, as it was useful when I was debugging SDHCI enablement.

-jeremy

Quoted 22 lines
Quoted 18 lines

-jeremy

Quoted 15 lines
drivers/mmc/host/sdhci-msm.c +1 -1
 static int sdhci_msm_execute_tuning(struct sdhci_host *host, u32 opcode)
 {
 	int tuning_seq_cnt = 3;
@@ -1035,6 +1068,7 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
 	.set_bus_width = sdhci_set_bus_width,
 	.set_uhs_signaling = sdhci_msm_set_uhs_signaling,
 	.voltage_switch = sdhci_msm_voltage_switch,
+	.platform_dumpregs = sdhci_msm_dumpregs,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
--

The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#9 lore raw

RFC PATCH 3/3 mmc: sdhci: Add more debug info in case of data error

In reply to Ritesh Harjani

print error log message and dump sdhc registers for debugging purpose in case of data errors (except when tuning commands generate CRC/timeout/end bit errors).

---
 drivers/mmc/host/sdhci.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +19 -2
index 73a8918..2e51e49 100644
@@ -2616,9 +2616,26 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
 			host->ops->adma_workaround(host, intmask);
 	}
 
-	if (host->data->error)
+	if (host->data->error) {
+		bool pr_msg = true;
+
+		if (intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT |
+		    SDHCI_INT_DATA_END_BIT)) {
+			command = SDHCI_GET_CMD(sdhci_readw(host,
+							    SDHCI_COMMAND));
+			if (command == MMC_SEND_TUNING_BLOCK_HS200 ||
+			    command == MMC_SEND_TUNING_BLOCK)
+				pr_msg = false;
+		}
+		if (pr_msg) {
+			pr_err("%s: data txfr (0x%08x) error: %d\n",
+			       mmc_hostname(host->mmc), intmask,
+			       host->data->error);
+			sdhci_dumpregs(host);
+		}
+
 		sdhci_finish_data(host);
-	else {
+	} else {
 		if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL))
 			sdhci_transfer_pio(host);
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project.
Tested-by on the v1 series
#10 lore raw
In reply to Ritesh Harjani
Quoted 14 lines · Ritesh Harjani

Below is a small set of patches which provide useful info for debugging issues.

Patch 1 :- This provide callback mechanism for platform drivers to dump their necessary register info at the time of sdhci_dumpregs.

Patch 2 :- This implements this callback (->platform_dumpregs) for sdhci-msm.

Patch 3 :- Adds more logs for data errors to aid debugging.

Ritesh Harjani (1):
mmc: sdhci: Add more debug info in case of data error

Quoted 9 lines

Sahitya Tummala (2):
mmc: sdhci: Add platform_dumpregs callback support to sdhci_ops.
mmc: sdhci-msm: Implement platform_dumpregs callback in sdhci-msm

 drivers/mmc/host/sdhci-msm.c | 34 ++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sdhci.c     | 24 ++++++++++++++++++++++--
 drivers/mmc/host/sdhci.h     |  1 +
 3 files changed, 57 insertions(+), 2 deletions(-)

This series was part of my SDHCI enablement on my Nexus 5X and everything still seems to work ok.

Quoted 4 lines
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project.