linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>
Cc: Simon <horms@verge.net.au>, Chris Ball <cjb@laptop.org>,
	Ian Molton <ian@mnementh.co.uk>,
	Morimoto <kuninori.morimoto.gx@renesas.com>,
	Magnus <magnus.damm@gmail.com>,
	Linux-SH <linux-sh@vger.kernel.org>,
	linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 01/10 v2 resend] mmc: block: add block number limitation flag for multiple block read
Date: Fri, 22 Aug 2014 10:31:19 +0000	[thread overview]
Message-ID: <CAPDyKFqwDTBu53t6iiiA6REe3feBFWWmgd-V93RsOh5XFPpc4w@mail.gmail.com> (raw)
In-Reply-To: <874mx47wf9.wl%kuninori.morimoto.gx@gmail.com>

On 22 August 2014 10:36, Kuninori Morimoto
<kuninori.morimoto.gx@gmail.com> wrote:
> From: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
>
> In some 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.

Can't his be solved in software in the host driver? Or is it pure bug in the HW?

> MMC_CAP2_NO_MULTI_READ flags disable all multiple block read,
> but, it is over-kill for this issue.
> This patch adds new MMC_CAP2_2BLKS_LIMIT to use single block read
> when it was two blocks.
> This is additional option of MMC_CAP2_NO_MULTI_READ
>
> [Kuninori Morimoto: tidyup for upstreaming, and cared mach-shmobile]
>
> Tested-by: Nguyen Xuan Nui <nx-nui@jinso.co.jp>
> Tested-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
> Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  arch/arm/mach-shmobile/board-koelsch.c |    6 +++---
>  arch/arm/mach-shmobile/board-lager.c   |    4 ++--

I prefer to split up patches into ARM patches and MMC patches if it's possible.
That makes it easier to review and collect acks from SoC maintainers.

>  drivers/mmc/card/block.c               |   19 +++++++++++++++++--
>  drivers/mmc/host/sh_mobile_sdhi.c      |    2 +-
>  include/linux/mmc/host.h               |    3 +++
>  5 files changed, 26 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
> index b7d5bc7..32a2b2a 100644
> --- a/arch/arm/mach-shmobile/board-koelsch.c
> +++ b/arch/arm/mach-shmobile/board-koelsch.c
> @@ -331,7 +331,7 @@ SDHI_REGULATOR(2, RCAR_GP_PIN(7, 19), RCAR_GP_PIN(2, 26));
>  static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
>         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
>                           MMC_CAP_POWER_OFF_CARD,
> -       .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
> +       .tmio_caps2     = MMC_CAP2_NO_2BLKS_READ,

Why are MMC_CAP2_NO_MULTI_READ /MMC_CAP2_NO_2BLKS_READ configured from
platform data. If this is HW bug, aren't that related to the actual
mmc controller and version of it - not the board/platform?

This applies to more caps and boards further down below in this patch as well.

To me, it seems like these belongs into the host driver instead!?

>         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT,
>  };
>
> @@ -344,7 +344,7 @@ static struct resource sdhi0_resources[] __initdata = {
>  static struct sh_mobile_sdhi_info sdhi1_info __initdata = {
>         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
>                           MMC_CAP_POWER_OFF_CARD,
> -       .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
> +       .tmio_caps2     = MMC_CAP2_NO_2BLKS_READ,
>         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT,
>  };
>
> @@ -357,7 +357,7 @@ static struct resource sdhi1_resources[] __initdata = {
>  static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
>         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
>                           MMC_CAP_POWER_OFF_CARD,
> -       .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
> +       .tmio_caps2     = MMC_CAP2_NO_2BLKS_READ,
>         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT |
>                           TMIO_MMC_WRPROTECT_DISABLE,
>  };
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index e1d8215..953f9c9 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -630,7 +630,7 @@ static void __init lager_add_rsnd_device(void)
>  static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
>         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
>                           MMC_CAP_POWER_OFF_CARD,
> -       .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
> +       .tmio_caps2     = MMC_CAP2_NO_2BLKS_READ,
>         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT |
>                           TMIO_MMC_WRPROTECT_DISABLE,
>  };
> @@ -644,7 +644,7 @@ static struct resource sdhi0_resources[] __initdata = {
>  static struct sh_mobile_sdhi_info sdhi2_info __initdata = {
>         .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
>                           MMC_CAP_POWER_OFF_CARD,
> -       .tmio_caps2     = MMC_CAP2_NO_MULTI_READ,
> +       .tmio_caps2     = MMC_CAP2_NO_2BLKS_READ,
>         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT |
>                           TMIO_MMC_WRPROTECT_DISABLE,
>  };
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index ede41f0..98c7e8c 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1400,8 +1400,23 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>
>                 /* Some controllers can't do multiblock reads due to hw bugs */
>                 if (card->host->caps2 & MMC_CAP2_NO_MULTI_READ &&
> -                   rq_data_dir(req) = READ)
> -                       brq->data.blocks = 1;
> +                   rq_data_dir(req) = READ) {
> +
> +                       if (card->host->caps2 & MMC_CAP2_2BLKS_LIMIT) {

This conforms to what the commit message states, that
MMC_CAP2_2BLKS_LIMIT needs to be used together with
MMC_CAP2_NO_MULTI_READ to take effect. I think I would prefer to have
them separate.

Anyway, according to your cap configuration changes, you are replacing
MMC_CAP2_NO_MULTI_READ with MMC_CAP2_2BLKS_LIMIT, instead of adding
it...

> +                               /*
> +                                * In some 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 (brq->data.blocks = 2)
> +                                       brq->data.blocks = 1;
> +                       } else {
> +                               brq->data.blocks = 1;
> +                       }
> +               }
>         }
>
>         if (brq->data.blocks > 1 || do_rel_wr) {
> diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> index 91058da..b3baa83 100644
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -55,7 +55,7 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
>  static const struct sh_mobile_sdhi_of_data of_rcar_gen2_compatible = {
>         .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE,
>         .capabilities   = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> -       .capabilities2  = MMC_CAP2_NO_MULTI_READ,
> +       .capabilities2  = MMC_CAP2_NO_2BLKS_READ,
>  };
>
>  static const struct of_device_id sh_mobile_sdhi_of_match[] = {
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 7960424..3510fba 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -266,6 +266,9 @@ struct mmc_host {
>  #define MMC_CAP2_BOOTPART_NOACC        (1 << 0)        /* Boot partition no access */
>  #define MMC_CAP2_FULL_PWR_CYCLE        (1 << 2)        /* Can do full power cycle */
>  #define MMC_CAP2_NO_MULTI_READ (1 << 3)        /* Multiblock reads don't work */
> +#define MMC_CAP2_2BLKS_LIMIT   (1 << 4)        /* 2 blocks limit for multi read */
> +#define MMC_CAP2_NO_2BLKS_READ (MMC_CAP2_NO_MULTI_READ | \
> +                                MMC_CAP2_2BLKS_LIMIT)
>  #define MMC_CAP2_HS200_1_8V_SDR        (1 << 5)        /* can support */
>  #define MMC_CAP2_HS200_1_2V_SDR        (1 << 6)        /* can support */
>  #define MMC_CAP2_HS200         (MMC_CAP2_HS200_1_8V_SDR | \
> --
> 1.7.9.5
>

Kind regards
Uffe

  reply	other threads:[~2014-08-22 10:31 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d3d6aa34548248768494ad88056cf4bd@SINPR06MB105.apcprd06.prod.outlook.com>
     [not found] ` <87simtenpi.wl%kuninori.morimoto.gx@renesas.com>
     [not found]   ` <cb608c5e763f47b597936724ec05b615@SINPR06MB105.apcprd06.prod.outlook.com>
     [not found]     ` <87pphxe2q0.wl%kuninori.morimoto.gx@renesas.com>
     [not found]       ` <53AD638C.5060907@renesas.com>
2014-07-22  5:30         ` [PATCH 0/10][RFC] mmc: tmio: fixup patches Kuninori Morimoto
2014-07-22  5:33           ` [PATCH 01/10] mmc: sh_mobile_sdhi: Add EXT_ACC register busy check Kuninori Morimoto
2014-07-22 12:39             ` Sergei Shtylyov
2014-07-22 23:51               ` Kuninori Morimoto
2014-07-22  5:34           ` [PATCH 02/10] mmc: block: add block number limitation flag for multiple block read Kuninori Morimoto
2014-07-22  5:34           ` [PATCH 03/10] mmc: tmio: care about DMA tx/rx addr offset Kuninori Morimoto
2014-07-22  5:34           ` [PATCH 04/10] mmc: tmio: clear error IRQ status Kuninori Morimoto
2014-07-22  5:34           ` [PATCH 05/10] mmc: tmio: control multiple block transfer mode Kuninori Morimoto
2014-07-22  5:34           ` [PATCH 06/10] mmc: tmio: add TMIO_MMC_SDIO_STATUS_QUIRK Kuninori Morimoto
2014-07-22  5:34           ` [PATCH 07/10] mmc: tmio: check ILL_FUNC instead of CBSY Kuninori Morimoto
2014-07-22  5:34           ` [PATCH 08/10] mmc: tmio: remove Renesas specific #ifdef Kuninori Morimoto
2014-07-22  5:35           ` [PATCH 09/10] mmc: tmio: remove SCLKEN bit setting from tmio_mmc_set_clock() Kuninori Morimoto
2014-07-22  5:35           ` [PATCH 10/10] mmc: tmio: add actual clock support as option Kuninori Morimoto
2014-07-29  8:42           ` [PATCH 0/10 v2] mmc: tmio: fixup patches Kuninori Morimoto
2014-07-29  8:44             ` [PATCH 01/10 v2] mmc: block: add block number limitation flag for multiple block read Kuninori Morimoto
2014-07-31  6:14               ` [Bug] mmc: MMC and SDHI has a kernel panic error when transfer data カオ ミン ヒェップ
2014-07-29  8:44             ` [PATCH 02/10 v2] mmc: tmio: care about DMA tx/rx addr offset Kuninori Morimoto
2014-07-29  8:44             ` [PATCH 03/10 v2] mmc: tmio: clear error IRQ status Kuninori Morimoto
2014-07-29  8:45             ` [PATCH 04/10 v2] mmc: tmio: control multiple block transfer mode Kuninori Morimoto
2014-07-29  8:45             ` [PATCH 05/10 v2] mmc: tmio: add TMIO_MMC_SDIO_STATUS_QUIRK Kuninori Morimoto
2014-07-29  8:46             ` [PATCH 06/10 v2] mmc: tmio: check ILL_FUNC instead of CBSY Kuninori Morimoto
2014-07-29  8:46             ` [PATCH 07/10 v2] mmc: tmio: remove Renesas specific #ifdef Kuninori Morimoto
2014-07-29  8:47             ` [PATCH 08/10 v2] mmc: tmio: remove SCLKEN bit setting from tmio_mmc_set_clock() Kuninori Morimoto
2014-07-29  8:47             ` [PATCH 09/10 v2] mmc: tmio: ensure that the clock has been stopped before set_clock Kuninori Morimoto
2014-07-29  8:47             ` [PATCH 10/10 v2] mmc: tmio: add actual clock support as option Kuninori Morimoto
2014-07-30  0:45             ` [PATCH 0/10 v2] mmc: tmio: fixup patches Simon Horman
2014-07-31  1:52             ` カオ ミン ヒェップ
2014-07-31  2:30               ` Simon Horman
2014-07-31  4:27                 ` カオ ミン ヒェップ
2014-07-31  4:30                   ` Simon Horman
2014-07-31  4:34                   ` Kuninori Morimoto
2014-07-31  5:05                     ` カオ ミン ヒェップ
2014-08-05  3:16             ` [PATCH 1/5] mmc: shmobile: add renesas,sdhi-rcar-gen1/gen2 in DT compatible Kuninori Morimoto
2014-08-05  6:59               ` Geert Uytterhoeven
2014-08-05 23:45                 ` Kuninori Morimoto
2014-08-05  3:17             ` [PATCH 2/5] ARM: shmobile: r8a7778: add generation level compatible for SDHI Kuninori Morimoto
2014-08-05  3:17             ` [PATCH 3/5] ARM: shmobile: r8a7779: " Kuninori Morimoto
2014-08-05  3:17             ` [PATCH 4/5] ARM: shmobile: r8a7790: " Kuninori Morimoto
2014-08-05  3:17             ` [PATCH 5/5] ARM: shmobile: r8a7791: " Kuninori Morimoto
2014-08-06  1:47             ` [PATCH 0/5 v2] mmc: shmobile: adds generatoin level DT compatible Kuninori Morimoto
2014-08-06  1:48               ` [PATCH 1/5 v2] mmc: shmobile: add renesas,sdhi-rcar-gen1/gen2 in " Kuninori Morimoto
2014-08-07  0:43                 ` Simon Horman
2014-08-06  1:49               ` [PATCH 2/5 v2] ARM: shmobile: r8a7778: add generation level compatible for SDHI Kuninori Morimoto
2014-08-06  1:49               ` [PATCH 3/5 v2] ARM: shmobile: r8a7779: " Kuninori Morimoto
2014-08-06  1:49               ` [PATCH 4/5 v2] ARM: shmobile: r8a7790: " Kuninori Morimoto
2014-08-06  1:50               ` [PATCH 5/5 v2] ARM: shmobile: r8a7791: " Kuninori Morimoto
2014-08-22  8:35           ` [PATCH 0/10 v2 resend] mmc: tmio: fixup patches Kuninori Morimoto
2014-08-22  8:36             ` [PATCH 01/10 v2 resend] mmc: block: add block number limitation flag for multiple block read Kuninori Morimoto
2014-08-22 10:31               ` Ulf Hansson [this message]
2014-08-25  0:53                 ` Kuninori Morimoto
2014-08-25  8:50                   ` Ulf Hansson
2014-08-25  9:59                     ` Kuninori Morimoto
2014-08-27  1:37                       ` Kuninori Morimoto
2014-08-22  8:37             ` [PATCH 02/10 v2 resend] mmc: tmio: care about DMA tx/rx addr offset Kuninori Morimoto
2014-08-22  8:38             ` [PATCH 03/10 v2 resend] mmc: tmio: clear error IRQ status Kuninori Morimoto
2014-08-22  8:39             ` [PATCH 04/10 v2 resend] mmc: tmio: control multiple block transfer mode Kuninori Morimoto
2014-08-22  8:40             ` [PATCH 05/10 v2 resend] mmc: tmio: add TMIO_MMC_SDIO_STATUS_QUIRK Kuninori Morimoto
2014-08-22  8:40             ` [PATCH 06/10 v2 resend] mmc: tmio: check ILL_FUNC instead of CBSY Kuninori Morimoto
2014-08-22  8:40             ` [PATCH 07/10 v2 resend] mmc: tmio: remove Renesas specific #ifdef Kuninori Morimoto
2014-08-22  8:40             ` [PATCH 08/10 v2 resend] mmc: tmio: remove SCLKEN bit setting from tmio_mmc_set_clock() Kuninori Morimoto
2014-08-22  8:41             ` [PATCH 09/10 v2 resend] mmc: tmio: ensure that the clock has been stopped before set_clock Kuninori Morimoto
2014-08-25  2:57           ` [PATCH 0/9 v3] mmc: tmio: fixup patches Kuninori Morimoto
2014-08-25  2:58             ` [PATCH 1/9 v3] mmc: tmio: care about DMA tx/rx addr offset Kuninori Morimoto
2014-08-25  2:59             ` [PATCH 2/9 v3] mmc: tmio: clear error IRQ status Kuninori Morimoto
2014-08-25  3:00             ` [PATCH 3/9 v3] mmc: tmio: control multiple block transfer mode Kuninori Morimoto
2014-08-25  3:00             ` [PATCH 4/9 v3] mmc: tmio: add TMIO_MMC_SDIO_STATUS_QUIRK Kuninori Morimoto
2014-08-25  3:01             ` [PATCH 5/9 v3] mmc: tmio: check ILL_FUNC instead of CBSY Kuninori Morimoto
2014-08-25  3:01             ` [PATCH 6/9 v3] mmc: tmio: remove Renesas specific #ifdef Kuninori Morimoto
2014-08-25  3:02             ` [PATCH 7/9 v3] mmc: tmio: remove SCLKEN bit setting from tmio_mmc_set_clock() Kuninori Morimoto
2014-08-25  3:02             ` [PATCH 8/9 v3] mmc: tmio: ensure that the clock has been stopped before set_clock Kuninori Morimoto
2014-08-25  3:03             ` [PATCH 9/9 v3] mmc: tmio: add actual clock support as option Kuninori Morimoto
2014-08-27 13:11             ` [PATCH 0/9 v3] mmc: tmio: fixup patches Ulf Hansson
2014-08-28  2:24               ` [PATCH v4] mmc: tmio: ensure that the clock has been stopped before set_clock Kuninori Morimoto
2014-08-28  7:11                 ` Ulf Hansson
2014-08-28  7:13                   ` Ulf Hansson
2014-08-28 10:36                     ` Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPDyKFqwDTBu53t6iiiA6REe3feBFWWmgd-V93RsOh5XFPpc4w@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=cjb@laptop.org \
    --cc=horms@verge.net.au \
    --cc=ian@mnementh.co.uk \
    --cc=kuninori.morimoto.gx@gmail.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).