diff mbox series

[V5,10/26] mmc: sdhci-uhs2: dump UHS-II registers

Message ID 20221019110647.11076-11-victor.shih@genesyslogic.com.tw
State New
Headers show
Series Add support UHS-II for GL9755 | expand

Commit Message

Victor Shih Oct. 19, 2022, 11:06 a.m. UTC
From: AKASHI Takahiro <takahiro.akashi@linaro.org>

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

Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 drivers/mmc/host/sdhci-uhs2.c | 30 ++++++++++++++++++++++++++++++
 drivers/mmc/host/sdhci-uhs2.h |  4 ++++
 drivers/mmc/host/sdhci.c      |  3 +++
 3 files changed, 37 insertions(+)

Comments

Adrian Hunter Nov. 1, 2022, 5:13 p.m. UTC | #1
On 19/10/22 14:06, Victor Shih wrote:
> From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> 
> Dump UHS-II specific registers, if available, in sdhci_dumpregs()
> for informative/debugging use.
> 
> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  drivers/mmc/host/sdhci-uhs2.c | 30 ++++++++++++++++++++++++++++++
>  drivers/mmc/host/sdhci-uhs2.h |  4 ++++
>  drivers/mmc/host/sdhci.c      |  3 +++
>  3 files changed, 37 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> index f29d3a4ed43c..08905ed081fb 100644
> --- a/drivers/mmc/host/sdhci-uhs2.c
> +++ b/drivers/mmc/host/sdhci-uhs2.c
> @@ -18,6 +18,36 @@
>  #define DRIVER_NAME "sdhci_uhs2"
>  #define DBG(f, x...) \
>  	pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x)
> +#define SDHCI_UHS2_DUMP(f, x...) \
> +	pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
> +
> +void sdhci_uhs2_dump_regs(struct sdhci_host *host)
> +{
> +	if (!host->mmc || !(host->mmc->flags & MMC_UHS2_SUPPORT))

!host->mmc is not possible

> +		return;
> +
> +	SDHCI_UHS2_DUMP("==================== UHS2 ==================\n");
> +	SDHCI_UHS2_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_UHS2_DUMP("Cmd:       0x%08x | Trn mode: 0x%08x\n",
> +			sdhci_readw(host, SDHCI_UHS2_COMMAND),
> +			sdhci_readw(host, SDHCI_UHS2_TRANS_MODE));
> +	SDHCI_UHS2_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_UHS2_DUMP("Dev Int Code:  0x%08x\n",
> +			sdhci_readb(host, SDHCI_UHS2_DEV_INT_CODE));
> +	SDHCI_UHS2_DUMP("Reset:     0x%08x | Timer:    0x%08x\n",
> +			sdhci_readw(host, SDHCI_UHS2_SW_RESET),
> +			sdhci_readw(host, SDHCI_UHS2_TIMER_CTRL));
> +	SDHCI_UHS2_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_UHS2_DUMP("ErrSigEn:  0x%08x\n",
> +			sdhci_readl(host, SDHCI_UHS2_ERR_INT_SIG_EN));
> +}
> +EXPORT_SYMBOL_GPL(sdhci_uhs2_dump_regs);
>  
>  /*****************************************************************************\
>   *                                                                           *
> diff --git a/drivers/mmc/host/sdhci-uhs2.h b/drivers/mmc/host/sdhci-uhs2.h
> index 5610affebdf3..afdb05d6056b 100644
> --- a/drivers/mmc/host/sdhci-uhs2.h
> +++ b/drivers/mmc/host/sdhci-uhs2.h
> @@ -207,4 +207,8 @@
>  #define SDHCI_UHS2_EMBED_CTRL	0xE6
>  #define SDHCI_UHS2_VENDOR	0xE8
>  
> +struct sdhci_host;
> +
> +void sdhci_uhs2_dump_regs(struct sdhci_host *host);
> +
>  #endif /* __SDHCI_UHS2_H */
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index fef03de85b99..2cdd183c8ada 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -110,6 +110,9 @@ void sdhci_dumpregs(struct sdhci_host *host)
>  		}
>  	}
>  
> +	if (host->ops->dump_uhs2_regs)
> +		host->ops->dump_uhs2_regs(host);
> +
>  	if (host->ops->dump_vendor_regs)
>  		host->ops->dump_vendor_regs(host);
>
Victor Shih Dec. 13, 2022, 8:45 a.m. UTC | #2
Hi, Adrian

On Wed, Nov 2, 2022 at 1:13 AM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 19/10/22 14:06, Victor Shih wrote:
> > From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >
> > Dump UHS-II specific registers, if available, in sdhci_dumpregs()
> > for informative/debugging use.
> >
> > Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  drivers/mmc/host/sdhci-uhs2.c | 30 ++++++++++++++++++++++++++++++
> >  drivers/mmc/host/sdhci-uhs2.h |  4 ++++
> >  drivers/mmc/host/sdhci.c      |  3 +++
> >  3 files changed, 37 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
> > index f29d3a4ed43c..08905ed081fb 100644
> > --- a/drivers/mmc/host/sdhci-uhs2.c
> > +++ b/drivers/mmc/host/sdhci-uhs2.c
> > @@ -18,6 +18,36 @@
> >  #define DRIVER_NAME "sdhci_uhs2"
> >  #define DBG(f, x...) \
> >       pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x)
> > +#define SDHCI_UHS2_DUMP(f, x...) \
> > +     pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
> > +
> > +void sdhci_uhs2_dump_regs(struct sdhci_host *host)
> > +{
> > +     if (!host->mmc || !(host->mmc->flags & MMC_UHS2_SUPPORT))
>
> !host->mmc is not possible
>

I will update it in the patch#9 of the new [PATCH V6].

> > +             return;
> > +
> > +     SDHCI_UHS2_DUMP("==================== UHS2 ==================\n");
> > +     SDHCI_UHS2_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_UHS2_DUMP("Cmd:       0x%08x | Trn mode: 0x%08x\n",
> > +                     sdhci_readw(host, SDHCI_UHS2_COMMAND),
> > +                     sdhci_readw(host, SDHCI_UHS2_TRANS_MODE));
> > +     SDHCI_UHS2_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_UHS2_DUMP("Dev Int Code:  0x%08x\n",
> > +                     sdhci_readb(host, SDHCI_UHS2_DEV_INT_CODE));
> > +     SDHCI_UHS2_DUMP("Reset:     0x%08x | Timer:    0x%08x\n",
> > +                     sdhci_readw(host, SDHCI_UHS2_SW_RESET),
> > +                     sdhci_readw(host, SDHCI_UHS2_TIMER_CTRL));
> > +     SDHCI_UHS2_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_UHS2_DUMP("ErrSigEn:  0x%08x\n",
> > +                     sdhci_readl(host, SDHCI_UHS2_ERR_INT_SIG_EN));
> > +}
> > +EXPORT_SYMBOL_GPL(sdhci_uhs2_dump_regs);
> >
> >  /*****************************************************************************\
> >   *                                                                           *
> > diff --git a/drivers/mmc/host/sdhci-uhs2.h b/drivers/mmc/host/sdhci-uhs2.h
> > index 5610affebdf3..afdb05d6056b 100644
> > --- a/drivers/mmc/host/sdhci-uhs2.h
> > +++ b/drivers/mmc/host/sdhci-uhs2.h
> > @@ -207,4 +207,8 @@
> >  #define SDHCI_UHS2_EMBED_CTRL        0xE6
> >  #define SDHCI_UHS2_VENDOR    0xE8
> >
> > +struct sdhci_host;
> > +
> > +void sdhci_uhs2_dump_regs(struct sdhci_host *host);
> > +
> >  #endif /* __SDHCI_UHS2_H */
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index fef03de85b99..2cdd183c8ada 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -110,6 +110,9 @@ void sdhci_dumpregs(struct sdhci_host *host)
> >               }
> >       }
> >
> > +     if (host->ops->dump_uhs2_regs)
> > +             host->ops->dump_uhs2_regs(host);
> > +
> >       if (host->ops->dump_vendor_regs)
> >               host->ops->dump_vendor_regs(host);
> >
>

Thanks, Victor Shih
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-uhs2.c b/drivers/mmc/host/sdhci-uhs2.c
index f29d3a4ed43c..08905ed081fb 100644
--- a/drivers/mmc/host/sdhci-uhs2.c
+++ b/drivers/mmc/host/sdhci-uhs2.c
@@ -18,6 +18,36 @@ 
 #define DRIVER_NAME "sdhci_uhs2"
 #define DBG(f, x...) \
 	pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x)
+#define SDHCI_UHS2_DUMP(f, x...) \
+	pr_err("%s: " DRIVER_NAME ": " f, mmc_hostname(host->mmc), ## x)
+
+void sdhci_uhs2_dump_regs(struct sdhci_host *host)
+{
+	if (!host->mmc || !(host->mmc->flags & MMC_UHS2_SUPPORT))
+		return;
+
+	SDHCI_UHS2_DUMP("==================== UHS2 ==================\n");
+	SDHCI_UHS2_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_UHS2_DUMP("Cmd:       0x%08x | Trn mode: 0x%08x\n",
+			sdhci_readw(host, SDHCI_UHS2_COMMAND),
+			sdhci_readw(host, SDHCI_UHS2_TRANS_MODE));
+	SDHCI_UHS2_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_UHS2_DUMP("Dev Int Code:  0x%08x\n",
+			sdhci_readb(host, SDHCI_UHS2_DEV_INT_CODE));
+	SDHCI_UHS2_DUMP("Reset:     0x%08x | Timer:    0x%08x\n",
+			sdhci_readw(host, SDHCI_UHS2_SW_RESET),
+			sdhci_readw(host, SDHCI_UHS2_TIMER_CTRL));
+	SDHCI_UHS2_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_UHS2_DUMP("ErrSigEn:  0x%08x\n",
+			sdhci_readl(host, SDHCI_UHS2_ERR_INT_SIG_EN));
+}
+EXPORT_SYMBOL_GPL(sdhci_uhs2_dump_regs);
 
 /*****************************************************************************\
  *                                                                           *
diff --git a/drivers/mmc/host/sdhci-uhs2.h b/drivers/mmc/host/sdhci-uhs2.h
index 5610affebdf3..afdb05d6056b 100644
--- a/drivers/mmc/host/sdhci-uhs2.h
+++ b/drivers/mmc/host/sdhci-uhs2.h
@@ -207,4 +207,8 @@ 
 #define SDHCI_UHS2_EMBED_CTRL	0xE6
 #define SDHCI_UHS2_VENDOR	0xE8
 
+struct sdhci_host;
+
+void sdhci_uhs2_dump_regs(struct sdhci_host *host);
+
 #endif /* __SDHCI_UHS2_H */
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index fef03de85b99..2cdd183c8ada 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -110,6 +110,9 @@  void sdhci_dumpregs(struct sdhci_host *host)
 		}
 	}
 
+	if (host->ops->dump_uhs2_regs)
+		host->ops->dump_uhs2_regs(host);
+
 	if (host->ops->dump_vendor_regs)
 		host->ops->dump_vendor_regs(host);