diff mbox

mmc: sdio: fall back to SDIO 1.0 for broken 1.1 cards

Message ID 1462780799-5366-1-git-send-email-wsa@the-dreams.de (mailing list archive)
State New, archived
Headers show

Commit Message

Wolfram Sang May 9, 2016, 7:59 a.m. UTC
From: Wolfram Sang <wsa+renesas@sang-engineering.com>

I have two SDIO WLAN cards which specify being SDIO Rev. 1.1 cards but
their FUNCE tuple reports the smaller size of a Rev 1.0 card. So,
enforce 1.0 on these cards to avoid reading the not present registers.
They are not really used anyhow. My cards initialize properly after this
patch.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/core/sdio_cis.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Ulf Hansson May 10, 2016, 10:28 a.m. UTC | #1
On 9 May 2016 at 09:59, Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> I have two SDIO WLAN cards which specify being SDIO Rev. 1.1 cards but
> their FUNCE tuple reports the smaller size of a Rev 1.0 card. So,
> enforce 1.0 on these cards to avoid reading the not present registers.
> They are not really used anyhow. My cards initialize properly after this
> patch.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/core/sdio_cis.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c
> index 6f6fc527a26338..dcb3dee59fa5f2 100644
> --- a/drivers/mmc/core/sdio_cis.c
> +++ b/drivers/mmc/core/sdio_cis.c
> @@ -177,8 +177,13 @@ static int cistpl_funce_func(struct mmc_card *card, struct sdio_func *func,
>         vsn = func->card->cccr.sdio_vsn;
>         min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42;
>
> -       if (size < min_size)
> +       if (size == 28 && vsn == SDIO_SDIO_REV_1_10) {
> +               pr_warn("%s: card has broken SDIO 1.1 CIS, forcing SDIO 1.0\n",
> +                       mmc_hostname(card->host));
> +               vsn = SDIO_SDIO_REV_1_00;
> +       } else if (size < min_size) {
>                 return -EINVAL;
> +       }
>
>         /* TPLFE_MAX_BLK_SIZE */
>         func->max_blksize = buf[12] | (buf[13] << 8);
> --
> 2.7.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" 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/core/sdio_cis.c b/drivers/mmc/core/sdio_cis.c
index 6f6fc527a26338..dcb3dee59fa5f2 100644
--- a/drivers/mmc/core/sdio_cis.c
+++ b/drivers/mmc/core/sdio_cis.c
@@ -177,8 +177,13 @@  static int cistpl_funce_func(struct mmc_card *card, struct sdio_func *func,
 	vsn = func->card->cccr.sdio_vsn;
 	min_size = (vsn == SDIO_SDIO_REV_1_00) ? 28 : 42;
 
-	if (size < min_size)
+	if (size == 28 && vsn == SDIO_SDIO_REV_1_10) {
+		pr_warn("%s: card has broken SDIO 1.1 CIS, forcing SDIO 1.0\n",
+			mmc_hostname(card->host));
+		vsn = SDIO_SDIO_REV_1_00;
+	} else if (size < min_size) {
 		return -EINVAL;
+	}
 
 	/* TPLFE_MAX_BLK_SIZE */
 	func->max_blksize = buf[12] | (buf[13] << 8);