diff mbox

[v2,09/22] mmc: tmio: use mmc_can_gpio_cd() instead of checking TMIO_MMC_USE_GPIO_CD

Message ID 1511540697-27387-10-git-send-email-yamada.masahiro@socionext.com (mailing list archive)
State New, archived
Headers show

Commit Message

Masahiro Yamada Nov. 24, 2017, 4:24 p.m. UTC
To use a GPIO line for card detection, TMIO_MMC_USE_GPIO_CD is set
by a legacy board (arch/sh/boards/mach-ecovec24).

For DT platforms, the "cd-gpios" property is a legitimate way for that
in case the IP-builtin card detection can not be used for some reason.
mmc_of_parse() calls mmc_gpiod_request_cd() to set up ctx->cd_gpio if
the "cd-gpios" property is specified.

To cater to both cases, mmc_can_gpio_cd() is a correct way to check
which card detection logic is used.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v2: None

 drivers/mmc/host/tmio_mmc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang Dec. 4, 2017, 10:22 p.m. UTC | #1
On Sat, Nov 25, 2017 at 01:24:44AM +0900, Masahiro Yamada wrote:
> To use a GPIO line for card detection, TMIO_MMC_USE_GPIO_CD is set
> by a legacy board (arch/sh/boards/mach-ecovec24).
> 
> For DT platforms, the "cd-gpios" property is a legitimate way for that
> in case the IP-builtin card detection can not be used for some reason.
> mmc_of_parse() calls mmc_gpiod_request_cd() to set up ctx->cd_gpio if
> the "cd-gpios" property is specified.
> 
> To cater to both cases, mmc_can_gpio_cd() is a correct way to check
> which card detection logic is used.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

My gut feeling is that your patch is correct, but I need to have another
look at this native_hotplug code with a fresh brain and take your other
patches into account as well then, too.
Wolfram Sang Jan. 2, 2018, 12:56 p.m. UTC | #2
On Sat, Nov 25, 2017 at 01:24:44AM +0900, Masahiro Yamada wrote:
> To use a GPIO line for card detection, TMIO_MMC_USE_GPIO_CD is set
> by a legacy board (arch/sh/boards/mach-ecovec24).
> 
> For DT platforms, the "cd-gpios" property is a legitimate way for that
> in case the IP-builtin card detection can not be used for some reason.
> mmc_of_parse() calls mmc_gpiod_request_cd() to set up ctx->cd_gpio if
> the "cd-gpios" property is specified.
> 
> To cater to both cases, mmc_can_gpio_cd() is a correct way to check
> which card detection logic is used.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

This patch is correct, yet needed some time for testing because it
inverts the results for R-Car SoCs. Again, it is correct that it inverts
it because those SoCs have GPIOs defined in their devicetrees, so they
shouldn't be using native hotplug. Still, this meant checking that no
regression gets introduced. Also, for R-Car Gen 2 & 3 native hotplug
seems to work fine, so I was trying to find out why we use GPIOs here. I
wasn't successful up to now, but since GPIOs work well, too, and seem to
react a bit faster even, I am fine with the patch being merged.

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> ---
> 
> Changes in v2: None
> 
>  drivers/mmc/host/tmio_mmc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index efffb04..610f26f 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -1232,7 +1232,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
>  	}
>  	mmc->max_seg_size = mmc->max_req_size;
>  
> -	_host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||
> +	_host->native_hotplug = !(mmc_can_gpio_cd(mmc) ||
>  				  mmc->caps & MMC_CAP_NEEDS_POLL ||
>  				  !mmc_card_is_removable(mmc));
>  
> -- 
> 2.7.4
>
Masahiro Yamada Jan. 12, 2018, 4:06 a.m. UTC | #3
Hi Ulf,


2018-01-02 21:56 GMT+09:00 Wolfram Sang <wsa@the-dreams.de>:
> On Sat, Nov 25, 2017 at 01:24:44AM +0900, Masahiro Yamada wrote:
>> To use a GPIO line for card detection, TMIO_MMC_USE_GPIO_CD is set
>> by a legacy board (arch/sh/boards/mach-ecovec24).
>>
>> For DT platforms, the "cd-gpios" property is a legitimate way for that
>> in case the IP-builtin card detection can not be used for some reason.
>> mmc_of_parse() calls mmc_gpiod_request_cd() to set up ctx->cd_gpio if
>> the "cd-gpios" property is specified.
>>
>> To cater to both cases, mmc_can_gpio_cd() is a correct way to check
>> which card detection logic is used.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> This patch is correct, yet needed some time for testing because it
> inverts the results for R-Car SoCs. Again, it is correct that it inverts
> it because those SoCs have GPIOs defined in their devicetrees, so they
> shouldn't be using native hotplug. Still, this meant checking that no
> regression gets introduced. Also, for R-Car Gen 2 & 3 native hotplug
> seems to work fine, so I was trying to find out why we use GPIOs here. I
> wasn't successful up to now, but since GPIOs work well, too, and seem to
> react a bit faster even, I am fine with the patch being merged.
>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
>> ---
>>
>> Changes in v2: None
>>
>>  drivers/mmc/host/tmio_mmc_core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
>> index efffb04..610f26f 100644
>> --- a/drivers/mmc/host/tmio_mmc_core.c
>> +++ b/drivers/mmc/host/tmio_mmc_core.c
>> @@ -1232,7 +1232,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
>>       }
>>       mmc->max_seg_size = mmc->max_req_size;
>>
>> -     _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||
>> +     _host->native_hotplug = !(mmc_can_gpio_cd(mmc) ||
>>                                 mmc->caps & MMC_CAP_NEEDS_POLL ||
>>                                 !mmc_card_is_removable(mmc));
>>
>> --
>> 2.7.4
>>

Wolfram issued Reviewed-by.

Could you pick up this patch for -next?
Ulf Hansson Jan. 12, 2018, 2:29 p.m. UTC | #4
On 24 November 2017 at 17:24, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> To use a GPIO line for card detection, TMIO_MMC_USE_GPIO_CD is set
> by a legacy board (arch/sh/boards/mach-ecovec24).
>
> For DT platforms, the "cd-gpios" property is a legitimate way for that
> in case the IP-builtin card detection can not be used for some reason.
> mmc_of_parse() calls mmc_gpiod_request_cd() to set up ctx->cd_gpio if
> the "cd-gpios" property is specified.
>
> To cater to both cases, mmc_can_gpio_cd() is a correct way to check
> which card detection logic is used.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Thanks, applied for next!

For the rest of the series, please re-post those changes.

Kind regards
Uffe

> ---
>
> Changes in v2: None
>
>  drivers/mmc/host/tmio_mmc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index efffb04..610f26f 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -1232,7 +1232,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
>         }
>         mmc->max_seg_size = mmc->max_req_size;
>
> -       _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||
> +       _host->native_hotplug = !(mmc_can_gpio_cd(mmc) ||
>                                   mmc->caps & MMC_CAP_NEEDS_POLL ||
>                                   !mmc_card_is_removable(mmc));
>
> --
> 2.7.4
>
--
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/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index efffb04..610f26f 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1232,7 +1232,7 @@  int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 	}
 	mmc->max_seg_size = mmc->max_req_size;
 
-	_host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD ||
+	_host->native_hotplug = !(mmc_can_gpio_cd(mmc) ||
 				  mmc->caps & MMC_CAP_NEEDS_POLL ||
 				  !mmc_card_is_removable(mmc));