diff mbox

[4/7,v3] mmc: use .multi_io_quirk on sh_mobile

Message ID 8761h578ux.wl%kuninori.morimoto.gx@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Kuninori Morimoto Sept. 3, 2014, 2:09 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Now, sh_mobile_sdhi can use .multi_io_quirk callback
instead of MMC_CAP2_NO_MULTI_READ flags.
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v2 -> v3

 - blk_size_workaround -> multi_io_quirk

 drivers/mmc/host/sh_mobile_sdhi.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

Comments

Ulf Hansson Sept. 8, 2014, 10:28 a.m. UTC | #1
On 3 September 2014 04:09, Kuninori Morimoto
<kuninori.morimoto.gx@gmail.com> wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Now, sh_mobile_sdhi can use .multi_io_quirk callback
> instead of MMC_CAP2_NO_MULTI_READ flags.
> let's use it.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thanks! Applied for next!

Kind regards
Uffe

> ---
> v2 -> v3
>
>  - blk_size_workaround -> multi_io_quirk
>
>  drivers/mmc/host/sh_mobile_sdhi.c |   20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index f2585b6..a2e81a1 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -58,7 +58,6 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
>         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE |
>                           TMIO_MMC_CLK_ACTUAL,
>         .capabilities   = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> -       .capabilities2  = MMC_CAP2_NO_MULTI_READ,
>         .dma_rx_offset  = 0x2000,
>  };
>
> @@ -139,6 +138,24 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
>         return 0;
>  }
>
> +static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card,
> +                                        unsigned int direction, int blk_size)
> +{
> +       /*
> +        * In Renesas controllers, when performing a
> +        * multiple block read of one or two blocks,
> +        * depending on the timing with which the
> +        * response register is read, the response
> +        * value may not be read properly.
> +        * Use single block read for this HW bug
> +        */
> +       if ((direction == MMC_DATA_READ) &&
> +           blk_size == 2)
> +               return 1;
> +
> +       return blk_size;
> +}
> +
>  static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev)
>  {
>         mmc_detect_change(platform_get_drvdata(pdev), msecs_to_jiffies(100));
> @@ -194,6 +211,7 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
>         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
>         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
>         mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
> +       mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
>         if (p) {
>                 mmc_data->flags = p->tmio_flags;
>                 mmc_data->ocr_mask = p->tmio_ocr_mask;
> --
> 1.7.9.5
>
--
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
Ulf Hansson Sept. 8, 2014, 10:53 a.m. UTC | #2
On 8 September 2014 12:28, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 3 September 2014 04:09, Kuninori Morimoto
> <kuninori.morimoto.gx@gmail.com> wrote:
>> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>>
>> Now, sh_mobile_sdhi can use .multi_io_quirk callback
>> instead of MMC_CAP2_NO_MULTI_READ flags.
>> let's use it.
>>
>> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Thanks! Applied for next!

So I understand this one depends on patch 3, putting this on hold,
until we sorted out the comments I had.

Sorry for the noise!

Kind regards
Uffe
--
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 f2585b6..a2e81a1 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -58,7 +58,6 @@  static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE |
 			  TMIO_MMC_CLK_ACTUAL,
 	.capabilities	= MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
-	.capabilities2	= MMC_CAP2_NO_MULTI_READ,
 	.dma_rx_offset	= 0x2000,
 };
 
@@ -139,6 +138,24 @@  static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
 	return 0;
 }
 
+static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card,
+					 unsigned int direction, int blk_size)
+{
+	/*
+	 * In Renesas controllers, when performing a
+	 * multiple block read of one or two blocks,
+	 * depending on the timing with which the
+	 * response register is read, the response
+	 * value may not be read properly.
+	 * Use single block read for this HW bug
+	 */
+	if ((direction == MMC_DATA_READ) &&
+	    blk_size == 2)
+		return 1;
+
+	return blk_size;
+}
+
 static void sh_mobile_sdhi_cd_wakeup(const struct platform_device *pdev)
 {
 	mmc_detect_change(platform_get_drvdata(pdev), msecs_to_jiffies(100));
@@ -194,6 +211,7 @@  static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
 	mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
 	mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
+	mmc_data->multi_io_quirk = sh_mobile_sdhi_multi_io_quirk;
 	if (p) {
 		mmc_data->flags = p->tmio_flags;
 		mmc_data->ocr_mask = p->tmio_ocr_mask;