diff mbox

[11/17] mmc: SDHI: add SoC specific workaround via HW version

Message ID 871u2jz33t.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Kuninori Morimoto Nov. 14, 2013, 10:31 a.m. UTC
One of Renesas SDHI chip needs workaround to use it,
and, we can judge it based on chip version.
This patch adds very quick-hack workaround method,
since we still don't know how many chips
need workaround in the future.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
 include/linux/mmc/tmio.h          |    1 +
 2 files changed, 12 insertions(+)

Comments

Sergei Shtylyov Nov. 14, 2013, 2:03 p.m. UTC | #1
Hello.

On 14-11-2013 14:31, Kuninori Morimoto wrote:

> One of Renesas SDHI chip needs workaround to use it,
> and, we can judge it based on chip version.
> This patch adds very quick-hack workaround method,
> since we still don't know how many chips
> need workaround in the future.

> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
>   include/linux/mmc/tmio.h          |    1 +
>   2 files changed, 12 insertions(+)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index f1e35a7..d241d86 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -33,6 +33,8 @@
>
>   #include "tmio_mmc.h"
>
> +#define EXT_ACC           0xe4
> +

    Why not #define it in the tmio.h? It already contains SDHI specific 
register, CTL_DMA_ENABLE...

[...]
> diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
> index a1c1f32..84d9053 100644
> --- a/include/linux/mmc/tmio.h
> +++ b/include/linux/mmc/tmio.h
> @@ -33,6 +33,7 @@
>   #define CTL_SDIO_IRQ_MASK 0x38
>   #define CTL_DMA_ENABLE 0xd8
>   #define CTL_RESET_SD 0xe0
> +#define CTL_VERSION 0xe2
>   #define CTL_SDIO_REGS 0x100
>   #define CTL_CLK_AND_WAIT_CTL 0x138
>   #define CTL_RESET_SDIO 0x1e0

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kuninori Morimoto Nov. 15, 2013, 12:16 a.m. UTC | #2
Hi

> > One of Renesas SDHI chip needs workaround to use it,
> > and, we can judge it based on chip version.
> > This patch adds very quick-hack workaround method,
> > since we still don't know how many chips
> > need workaround in the future.
> 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >   drivers/mmc/host/sh_mobile_sdhi.c |   11 +++++++++++
> >   include/linux/mmc/tmio.h          |    1 +
> >   2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index f1e35a7..d241d86 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -33,6 +33,8 @@
> >
> >   #include "tmio_mmc.h"
> >
> > +#define EXT_ACC           0xe4
> > +
> 
>     Why not #define it in the tmio.h? It already contains SDHI specific 
> register, CTL_DMA_ENABLE...

I'm not sure which approach is correct.
I will follow Maintainer's decision

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index f1e35a7..d241d86 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -33,6 +33,8 @@ 
 
 #include "tmio_mmc.h"
 
+#define EXT_ACC           0xe4
+
 struct sh_mobile_sdhi_of_data {
 	unsigned long tmio_flags;
 };
@@ -137,6 +139,7 @@  static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	int irq, ret, i = 0;
 	bool multiplexed_isr = true;
 	struct tmio_mmc_dma *dma_priv;
+	u16 ver;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
@@ -219,6 +222,14 @@  static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 		goto eprobe;
 
 	/*
+	 * FIXME:
+	 * this Workaround can be more clever method
+	 */
+	ver = sd_ctrl_read16(host, CTL_VERSION);
+	if (ver == 0xCB0D)
+		sd_ctrl_write16(host, EXT_ACC, 1);
+
+	/*
 	 * Allow one or more specific (named) ISRs or
 	 * one or more multiplexed (un-named) ISRs.
 	 */
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
index a1c1f32..84d9053 100644
--- a/include/linux/mmc/tmio.h
+++ b/include/linux/mmc/tmio.h
@@ -33,6 +33,7 @@ 
 #define CTL_SDIO_IRQ_MASK 0x38
 #define CTL_DMA_ENABLE 0xd8
 #define CTL_RESET_SD 0xe0
+#define CTL_VERSION 0xe2
 #define CTL_SDIO_REGS 0x100
 #define CTL_CLK_AND_WAIT_CTL 0x138
 #define CTL_RESET_SDIO 0x1e0