diff mbox series

[2/2] mmc: meson-gx: support platform interrupt as card detect interrupt

Message ID 9e08411b-20cb-874f-8915-6f8dc32e9fcf@gmail.com (mailing list archive)
State New, archived
Headers show
Series mmc: meson-gx: support platform interrupt as card detect interrupt | expand

Commit Message

Heiner Kallweit Jan. 29, 2023, 11:10 p.m. UTC
Use a new mmc core feature and support specifying the card detect
gpio interrupt in device tree.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/mmc/host/meson-gx-mmc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Neil Armstrong Jan. 30, 2023, 11:06 a.m. UTC | #1
On 30/01/2023 00:10, Heiner Kallweit wrote:
> Use a new mmc core feature and support specifying the card detect
> gpio interrupt in device tree.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>   drivers/mmc/host/meson-gx-mmc.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index be1a972c2..c87bc31d0 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -1236,6 +1236,9 @@ static int meson_mmc_probe(struct platform_device *pdev)
>   		goto free_host;
>   	}
>   
> +	/* gpio card detect interrupt */
> +	mmc->cd_irq = platform_get_irq_optional(pdev, 1);

Ok it's fine but beware GXBB/GXL/AXG doesn't support Rising + Falling GPIO IRQ,
so this should only be used on G12A/B/SM1 and later.

Neil

> +
>   	host->pinctrl = devm_pinctrl_get(&pdev->dev);
>   	if (IS_ERR(host->pinctrl)) {
>   		ret = PTR_ERR(host->pinctrl);
Heiner Kallweit Jan. 30, 2023, 7:04 p.m. UTC | #2
On 30.01.2023 12:06, Neil Armstrong wrote:
> On 30/01/2023 00:10, Heiner Kallweit wrote:
>> Use a new mmc core feature and support specifying the card detect
>> gpio interrupt in device tree.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>   drivers/mmc/host/meson-gx-mmc.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
>> index be1a972c2..c87bc31d0 100644
>> --- a/drivers/mmc/host/meson-gx-mmc.c
>> +++ b/drivers/mmc/host/meson-gx-mmc.c
>> @@ -1236,6 +1236,9 @@ static int meson_mmc_probe(struct platform_device *pdev)
>>           goto free_host;
>>       }
>>   +    /* gpio card detect interrupt */
>> +    mmc->cd_irq = platform_get_irq_optional(pdev, 1);
> 
> Ok it's fine but beware GXBB/GXL/AXG doesn't support Rising + Falling GPIO IRQ,
> so this should only be used on G12A/B/SM1 and later.
> 
Thanks for the hint. I'm aware of the constraint for older versions.
There the mmc core would silently fall back to polling.
At the time when the gpio irqchip code was developed Jerome and me had
intense discussions on whether there's an acceptable workaround to
support edge-both on these chip versions.

I tested on SC2, there the proposed way to support the gpio cd irq
works fine.

> Neil
> 
>> +
>>       host->pinctrl = devm_pinctrl_get(&pdev->dev);
>>       if (IS_ERR(host->pinctrl)) {
>>           ret = PTR_ERR(host->pinctrl);
>
Ulf Hansson Feb. 13, 2023, 10:47 p.m. UTC | #3
On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Use a new mmc core feature and support specifying the card detect
> gpio interrupt in device tree.

Don't we need an update to the DT doc too?

Kind regards
Uffe

>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/mmc/host/meson-gx-mmc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index be1a972c2..c87bc31d0 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -1236,6 +1236,9 @@ static int meson_mmc_probe(struct platform_device *pdev)
>                 goto free_host;
>         }
>
> +       /* gpio card detect interrupt */
> +       mmc->cd_irq = platform_get_irq_optional(pdev, 1);
> +
>         host->pinctrl = devm_pinctrl_get(&pdev->dev);
>         if (IS_ERR(host->pinctrl)) {
>                 ret = PTR_ERR(host->pinctrl);
> --
> 2.39.1
>
>
Heiner Kallweit Feb. 14, 2023, 6:39 a.m. UTC | #4
On 13.02.2023 23:47, Ulf Hansson wrote:
> On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>
>> Use a new mmc core feature and support specifying the card detect
>> gpio interrupt in device tree.
> 
> Don't we need an update to the DT doc too?
> 
Right, the binding still has to be changed to allow more than one interrupt.

> Kind regards
> Uffe
> 
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/mmc/host/meson-gx-mmc.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
>> index be1a972c2..c87bc31d0 100644
>> --- a/drivers/mmc/host/meson-gx-mmc.c
>> +++ b/drivers/mmc/host/meson-gx-mmc.c
>> @@ -1236,6 +1236,9 @@ static int meson_mmc_probe(struct platform_device *pdev)
>>                 goto free_host;
>>         }
>>
>> +       /* gpio card detect interrupt */
>> +       mmc->cd_irq = platform_get_irq_optional(pdev, 1);
>> +
>>         host->pinctrl = devm_pinctrl_get(&pdev->dev);
>>         if (IS_ERR(host->pinctrl)) {
>>                 ret = PTR_ERR(host->pinctrl);
>> --
>> 2.39.1
>>
>>
diff mbox series

Patch

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index be1a972c2..c87bc31d0 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1236,6 +1236,9 @@  static int meson_mmc_probe(struct platform_device *pdev)
 		goto free_host;
 	}
 
+	/* gpio card detect interrupt */
+	mmc->cd_irq = platform_get_irq_optional(pdev, 1);
+
 	host->pinctrl = devm_pinctrl_get(&pdev->dev);
 	if (IS_ERR(host->pinctrl)) {
 		ret = PTR_ERR(host->pinctrl);