* [PATCH v2] mmc: sdio: Enable SDIO 4-bit bus if not support SD_SCR_BUS_WIDTH_4 for SD combo card
@ 2020-06-08 10:30 Yue Hu
2020-06-16 11:32 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Yue Hu @ 2020-06-08 10:30 UTC (permalink / raw)
To: ulf.hansson, dianders, mka; +Cc: linux-mmc, huyue2
From: Yue Hu <huyue2@yulong.com>
If the card type is SD combo(MMC_TYPE_SD_COMBO) and the memory part does
not support wider bus(SD_SCR_BUS_WIDTH_4), nothing will be done except
return 0. However, we should check whether IO part support wider bus or
not. We should use available IO ability if supported.
In addition, there's a duplicated check to MMC_CAP_4_BIT_DATA since
sdio_enable_wide() will include that check. And we can also save one
call site to sdio_enable_wide() after this change.
Change-Id: Iaeb31fba4050ec9d248c415bef6696d38332afe6
Signed-off-by: Yue Hu <huyue2@yulong.com>
---
v2: commit message changed.
drivers/mmc/core/sdio.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 1e42c6b..59f197d 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -367,25 +367,23 @@ static int sdio_enable_4bit_bus(struct mmc_card *card)
{
int err;
+ err = sdio_enable_wide(card);
+ if (err <= 0)
+ return err;
if (card->type == MMC_TYPE_SDIO)
- err = sdio_enable_wide(card);
- else if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
- (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
+ goto out;
+
+ if (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4) {
err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
- if (err)
+ if (err) {
+ sdio_disable_wide(card);
return err;
- err = sdio_enable_wide(card);
- if (err <= 0)
- mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
- } else
- return 0;
-
- if (err > 0) {
- mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
- err = 0;
+ }
}
+out:
+ mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
- return err;
+ return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mmc: sdio: Enable SDIO 4-bit bus if not support SD_SCR_BUS_WIDTH_4 for SD combo card
2020-06-08 10:30 [PATCH v2] mmc: sdio: Enable SDIO 4-bit bus if not support SD_SCR_BUS_WIDTH_4 for SD combo card Yue Hu
@ 2020-06-16 11:32 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2020-06-16 11:32 UTC (permalink / raw)
To: Yue Hu; +Cc: Doug Anderson, Matthias Kaehlcke, linux-mmc, huyue2
On Mon, 8 Jun 2020 at 12:30, Yue Hu <zbestahu@gmail.com> wrote:
>
> From: Yue Hu <huyue2@yulong.com>
>
> If the card type is SD combo(MMC_TYPE_SD_COMBO) and the memory part does
> not support wider bus(SD_SCR_BUS_WIDTH_4), nothing will be done except
> return 0. However, we should check whether IO part support wider bus or
> not. We should use available IO ability if supported.
>
> In addition, there's a duplicated check to MMC_CAP_4_BIT_DATA since
> sdio_enable_wide() will include that check. And we can also save one
> call site to sdio_enable_wide() after this change.
>
> Change-Id: Iaeb31fba4050ec9d248c415bef6696d38332afe6
Dropping this.
> Signed-off-by: Yue Hu <huyue2@yulong.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> v2: commit message changed.
>
> drivers/mmc/core/sdio.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 1e42c6b..59f197d 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -367,25 +367,23 @@ static int sdio_enable_4bit_bus(struct mmc_card *card)
> {
> int err;
>
> + err = sdio_enable_wide(card);
> + if (err <= 0)
> + return err;
> if (card->type == MMC_TYPE_SDIO)
> - err = sdio_enable_wide(card);
> - else if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
> - (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
> + goto out;
> +
> + if (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4) {
> err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
> - if (err)
> + if (err) {
> + sdio_disable_wide(card);
> return err;
> - err = sdio_enable_wide(card);
> - if (err <= 0)
> - mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
> - } else
> - return 0;
> -
> - if (err > 0) {
> - mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
> - err = 0;
> + }
> }
> +out:
> + mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
>
> - return err;
> + return 0;
> }
>
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-16 11:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 10:30 [PATCH v2] mmc: sdio: Enable SDIO 4-bit bus if not support SD_SCR_BUS_WIDTH_4 for SD combo card Yue Hu
2020-06-16 11:32 ` Ulf Hansson
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).