All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-29 23:02 ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:02 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
due to the design of gpio / interrupt controller. Therefore provide an
option to specify the cd interrupt e.g. by device tree. The host
controller can store the interrupt in cd_irq for use by
mmc_gpiod_request_cd_irq().

Heiner Kallweit (2):
  mmc: core: support platform interrupt as card detect interrupt
  mmc: meson-gx: support platform interrupt as card detect interrupt

 drivers/mmc/core/slot-gpio.c    | 2 +-
 drivers/mmc/host/meson-gx-mmc.c | 3 +++
 include/linux/mmc/host.h        | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 0/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-29 23:02 ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:02 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
due to the design of gpio / interrupt controller. Therefore provide an
option to specify the cd interrupt e.g. by device tree. The host
controller can store the interrupt in cd_irq for use by
mmc_gpiod_request_cd_irq().

Heiner Kallweit (2):
  mmc: core: support platform interrupt as card detect interrupt
  mmc: meson-gx: support platform interrupt as card detect interrupt

 drivers/mmc/core/slot-gpio.c    | 2 +-
 drivers/mmc/host/meson-gx-mmc.c | 3 +++
 include/linux/mmc/host.h        | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.39.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 0/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-29 23:02 ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:02 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
due to the design of gpio / interrupt controller. Therefore provide an
option to specify the cd interrupt e.g. by device tree. The host
controller can store the interrupt in cd_irq for use by
mmc_gpiod_request_cd_irq().

Heiner Kallweit (2):
  mmc: core: support platform interrupt as card detect interrupt
  mmc: meson-gx: support platform interrupt as card detect interrupt

 drivers/mmc/core/slot-gpio.c    | 2 +-
 drivers/mmc/host/meson-gx-mmc.c | 3 +++
 include/linux/mmc/host.h        | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.39.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
  2023-01-29 23:02 ` Heiner Kallweit
  (?)
@ 2023-01-29 23:04   ` Heiner Kallweit
  -1 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:04 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
due to the design of gpio / interrupt controller. Therefore provide an
option to specify the cd interrupt e.g. by device tree. The host
controller can store the interrupt in cd_irq for use by
mmc_gpiod_request_cd_irq().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/mmc/core/slot-gpio.c | 2 +-
 include/linux/mmc/host.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index dd2a4b6ab..69c22a997 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
 	 * IRQ number is already used by another unit and cannot be shared.
 	 */
 	if (!(host->caps & MMC_CAP_NEEDS_POLL))
-		irq = gpiod_to_irq(ctx->cd_gpio);
+		irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
 
 	if (irq >= 0) {
 		if (!ctx->cd_gpio_isr)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8fdd3cf97..e998e919e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -470,6 +470,7 @@ struct mmc_host {
 
 	struct delayed_work	detect;
 	int			detect_change;	/* card detect flag */
+	int			cd_irq;		/* for use by mmc_gpiod_request_cd_irq */
 	struct mmc_slot		slot;
 
 	const struct mmc_bus_ops *bus_ops;	/* current bus driver */
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
@ 2023-01-29 23:04   ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:04 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
due to the design of gpio / interrupt controller. Therefore provide an
option to specify the cd interrupt e.g. by device tree. The host
controller can store the interrupt in cd_irq for use by
mmc_gpiod_request_cd_irq().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/mmc/core/slot-gpio.c | 2 +-
 include/linux/mmc/host.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index dd2a4b6ab..69c22a997 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
 	 * IRQ number is already used by another unit and cannot be shared.
 	 */
 	if (!(host->caps & MMC_CAP_NEEDS_POLL))
-		irq = gpiod_to_irq(ctx->cd_gpio);
+		irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
 
 	if (irq >= 0) {
 		if (!ctx->cd_gpio_isr)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8fdd3cf97..e998e919e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -470,6 +470,7 @@ struct mmc_host {
 
 	struct delayed_work	detect;
 	int			detect_change;	/* card detect flag */
+	int			cd_irq;		/* for use by mmc_gpiod_request_cd_irq */
 	struct mmc_slot		slot;
 
 	const struct mmc_bus_ops *bus_ops;	/* current bus driver */
-- 
2.39.1



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
@ 2023-01-29 23:04   ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:04 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
due to the design of gpio / interrupt controller. Therefore provide an
option to specify the cd interrupt e.g. by device tree. The host
controller can store the interrupt in cd_irq for use by
mmc_gpiod_request_cd_irq().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/mmc/core/slot-gpio.c | 2 +-
 include/linux/mmc/host.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index dd2a4b6ab..69c22a997 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
 	 * IRQ number is already used by another unit and cannot be shared.
 	 */
 	if (!(host->caps & MMC_CAP_NEEDS_POLL))
-		irq = gpiod_to_irq(ctx->cd_gpio);
+		irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
 
 	if (irq >= 0) {
 		if (!ctx->cd_gpio_isr)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8fdd3cf97..e998e919e 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -470,6 +470,7 @@ struct mmc_host {
 
 	struct delayed_work	detect;
 	int			detect_change;	/* card detect flag */
+	int			cd_irq;		/* for use by mmc_gpiod_request_cd_irq */
 	struct mmc_slot		slot;
 
 	const struct mmc_bus_ops *bus_ops;	/* current bus driver */
-- 
2.39.1



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
  2023-01-29 23:02 ` Heiner Kallweit
  (?)
@ 2023-01-29 23:10   ` Heiner Kallweit
  -1 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:10 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);
+
 	host->pinctrl = devm_pinctrl_get(&pdev->dev);
 	if (IS_ERR(host->pinctrl)) {
 		ret = PTR_ERR(host->pinctrl);
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-29 23:10   ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:10 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);
+
 	host->pinctrl = devm_pinctrl_get(&pdev->dev);
 	if (IS_ERR(host->pinctrl)) {
 		ret = PTR_ERR(host->pinctrl);
-- 
2.39.1



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-29 23:10   ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-29 23:10 UTC (permalink / raw)
  To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);
+
 	host->pinctrl = devm_pinctrl_get(&pdev->dev);
 	if (IS_ERR(host->pinctrl)) {
 		ret = PTR_ERR(host->pinctrl);
-- 
2.39.1



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
  2023-01-29 23:10   ` Heiner Kallweit
  (?)
@ 2023-01-30 11:06     ` Neil Armstrong
  -1 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2023-01-30 11:06 UTC (permalink / raw)
  To: Heiner Kallweit, Ulf Hansson, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-30 11:06     ` Neil Armstrong
  0 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2023-01-30 11:06 UTC (permalink / raw)
  To: Heiner Kallweit, Ulf Hansson, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-30 11:06     ` Neil Armstrong
  0 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2023-01-30 11:06 UTC (permalink / raw)
  To: Heiner Kallweit, Ulf Hansson, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
  2023-01-30 11:06     ` Neil Armstrong
  (?)
@ 2023-01-30 19:04       ` Heiner Kallweit
  -1 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-30 19:04 UTC (permalink / raw)
  To: neil.armstrong, Ulf Hansson, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);
> 


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-30 19:04       ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-30 19:04 UTC (permalink / raw)
  To: neil.armstrong, Ulf Hansson, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-01-30 19:04       ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-01-30 19:04 UTC (permalink / raw)
  To: neil.armstrong, Ulf Hansson, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl
  Cc: linux-mmc, open list:ARM/Amlogic Meson..., linux-arm-kernel

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);
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
  2023-01-29 23:04   ` Heiner Kallweit
  (?)
@ 2023-02-13 22:46     ` Ulf Hansson
  -1 siblings, 0 replies; 27+ messages in thread
From: Ulf Hansson @ 2023-02-13 22:46 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
> due to the design of gpio / interrupt controller. Therefore provide an
> option to specify the cd interrupt e.g. by device tree. The host
> controller can store the interrupt in cd_irq for use by
> mmc_gpiod_request_cd_irq().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/mmc/core/slot-gpio.c | 2 +-
>  include/linux/mmc/host.h     | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index dd2a4b6ab..69c22a997 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
>          * IRQ number is already used by another unit and cannot be shared.
>          */
>         if (!(host->caps & MMC_CAP_NEEDS_POLL))
> -               irq = gpiod_to_irq(ctx->cd_gpio);
> +               irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
>
>         if (irq >= 0) {
>                 if (!ctx->cd_gpio_isr)
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 8fdd3cf97..e998e919e 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -470,6 +470,7 @@ struct mmc_host {
>
>         struct delayed_work     detect;
>         int                     detect_change;  /* card detect flag */
> +       int                     cd_irq;         /* for use by mmc_gpiod_request_cd_irq */

Rather than putting this in the struct mmc_host, I would prefer to
keep it more internal to the mmc core/slot code.

That said, what do you think of moving this into the struct mmc_gpio
instead? Of course, that also means that we need to add new slot gpio
helper that users can call to set the corresponding value for the
cd_irq.

Would that be okay to you?

>         struct mmc_slot         slot;
>
>         const struct mmc_bus_ops *bus_ops;      /* current bus driver */

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
@ 2023-02-13 22:46     ` Ulf Hansson
  0 siblings, 0 replies; 27+ messages in thread
From: Ulf Hansson @ 2023-02-13 22:46 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
> due to the design of gpio / interrupt controller. Therefore provide an
> option to specify the cd interrupt e.g. by device tree. The host
> controller can store the interrupt in cd_irq for use by
> mmc_gpiod_request_cd_irq().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/mmc/core/slot-gpio.c | 2 +-
>  include/linux/mmc/host.h     | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index dd2a4b6ab..69c22a997 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
>          * IRQ number is already used by another unit and cannot be shared.
>          */
>         if (!(host->caps & MMC_CAP_NEEDS_POLL))
> -               irq = gpiod_to_irq(ctx->cd_gpio);
> +               irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
>
>         if (irq >= 0) {
>                 if (!ctx->cd_gpio_isr)
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 8fdd3cf97..e998e919e 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -470,6 +470,7 @@ struct mmc_host {
>
>         struct delayed_work     detect;
>         int                     detect_change;  /* card detect flag */
> +       int                     cd_irq;         /* for use by mmc_gpiod_request_cd_irq */

Rather than putting this in the struct mmc_host, I would prefer to
keep it more internal to the mmc core/slot code.

That said, what do you think of moving this into the struct mmc_gpio
instead? Of course, that also means that we need to add new slot gpio
helper that users can call to set the corresponding value for the
cd_irq.

Would that be okay to you?

>         struct mmc_slot         slot;
>
>         const struct mmc_bus_ops *bus_ops;      /* current bus driver */

Kind regards
Uffe

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
@ 2023-02-13 22:46     ` Ulf Hansson
  0 siblings, 0 replies; 27+ messages in thread
From: Ulf Hansson @ 2023-02-13 22:46 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
> due to the design of gpio / interrupt controller. Therefore provide an
> option to specify the cd interrupt e.g. by device tree. The host
> controller can store the interrupt in cd_irq for use by
> mmc_gpiod_request_cd_irq().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/mmc/core/slot-gpio.c | 2 +-
>  include/linux/mmc/host.h     | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index dd2a4b6ab..69c22a997 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
>          * IRQ number is already used by another unit and cannot be shared.
>          */
>         if (!(host->caps & MMC_CAP_NEEDS_POLL))
> -               irq = gpiod_to_irq(ctx->cd_gpio);
> +               irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
>
>         if (irq >= 0) {
>                 if (!ctx->cd_gpio_isr)
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 8fdd3cf97..e998e919e 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -470,6 +470,7 @@ struct mmc_host {
>
>         struct delayed_work     detect;
>         int                     detect_change;  /* card detect flag */
> +       int                     cd_irq;         /* for use by mmc_gpiod_request_cd_irq */

Rather than putting this in the struct mmc_host, I would prefer to
keep it more internal to the mmc core/slot code.

That said, what do you think of moving this into the struct mmc_gpio
instead? Of course, that also means that we need to add new slot gpio
helper that users can call to set the corresponding value for the
cd_irq.

Would that be okay to you?

>         struct mmc_slot         slot;
>
>         const struct mmc_bus_ops *bus_ops;      /* current bus driver */

Kind regards
Uffe

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
  2023-01-29 23:10   ` Heiner Kallweit
  (?)
@ 2023-02-13 22:47     ` Ulf Hansson
  -1 siblings, 0 replies; 27+ messages in thread
From: Ulf Hansson @ 2023-02-13 22:47 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

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
>
>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-02-13 22:47     ` Ulf Hansson
  0 siblings, 0 replies; 27+ messages in thread
From: Ulf Hansson @ 2023-02-13 22:47 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

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
>
>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-02-13 22:47     ` Ulf Hansson
  0 siblings, 0 replies; 27+ messages in thread
From: Ulf Hansson @ 2023-02-13 22:47 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

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
>
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
  2023-02-13 22:47     ` Ulf Hansson
  (?)
@ 2023-02-14  6:39       ` Heiner Kallweit
  -1 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-02-14  6:39 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

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
>>
>>


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-02-14  6:39       ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-02-14  6:39 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

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
>>
>>


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 2/2] mmc: meson-gx: support platform interrupt as card detect interrupt
@ 2023-02-14  6:39       ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-02-14  6:39 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

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
>>
>>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
  2023-02-13 22:46     ` Ulf Hansson
  (?)
@ 2023-02-14  7:45       ` Heiner Kallweit
  -1 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-02-14  7:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

On 13.02.2023 23:46, Ulf Hansson wrote:
> On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>
>> On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
>> due to the design of gpio / interrupt controller. Therefore provide an
>> option to specify the cd interrupt e.g. by device tree. The host
>> controller can store the interrupt in cd_irq for use by
>> mmc_gpiod_request_cd_irq().
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/mmc/core/slot-gpio.c | 2 +-
>>  include/linux/mmc/host.h     | 1 +
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
>> index dd2a4b6ab..69c22a997 100644
>> --- a/drivers/mmc/core/slot-gpio.c
>> +++ b/drivers/mmc/core/slot-gpio.c
>> @@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
>>          * IRQ number is already used by another unit and cannot be shared.
>>          */
>>         if (!(host->caps & MMC_CAP_NEEDS_POLL))
>> -               irq = gpiod_to_irq(ctx->cd_gpio);
>> +               irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
>>
>>         if (irq >= 0) {
>>                 if (!ctx->cd_gpio_isr)
>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>> index 8fdd3cf97..e998e919e 100644
>> --- a/include/linux/mmc/host.h
>> +++ b/include/linux/mmc/host.h
>> @@ -470,6 +470,7 @@ struct mmc_host {
>>
>>         struct delayed_work     detect;
>>         int                     detect_change;  /* card detect flag */
>> +       int                     cd_irq;         /* for use by mmc_gpiod_request_cd_irq */
> 
> Rather than putting this in the struct mmc_host, I would prefer to
> keep it more internal to the mmc core/slot code.
> 
> That said, what do you think of moving this into the struct mmc_gpio
> instead? Of course, that also means that we need to add new slot gpio
> helper that users can call to set the corresponding value for the
> cd_irq.
> 
> Would that be okay to you?
> 
Yes, that's the better approach.

>>         struct mmc_slot         slot;
>>
>>         const struct mmc_bus_ops *bus_ops;      /* current bus driver */
> 
> Kind regards
> Uffe


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
@ 2023-02-14  7:45       ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-02-14  7:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

On 13.02.2023 23:46, Ulf Hansson wrote:
> On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>
>> On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
>> due to the design of gpio / interrupt controller. Therefore provide an
>> option to specify the cd interrupt e.g. by device tree. The host
>> controller can store the interrupt in cd_irq for use by
>> mmc_gpiod_request_cd_irq().
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/mmc/core/slot-gpio.c | 2 +-
>>  include/linux/mmc/host.h     | 1 +
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
>> index dd2a4b6ab..69c22a997 100644
>> --- a/drivers/mmc/core/slot-gpio.c
>> +++ b/drivers/mmc/core/slot-gpio.c
>> @@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
>>          * IRQ number is already used by another unit and cannot be shared.
>>          */
>>         if (!(host->caps & MMC_CAP_NEEDS_POLL))
>> -               irq = gpiod_to_irq(ctx->cd_gpio);
>> +               irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
>>
>>         if (irq >= 0) {
>>                 if (!ctx->cd_gpio_isr)
>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>> index 8fdd3cf97..e998e919e 100644
>> --- a/include/linux/mmc/host.h
>> +++ b/include/linux/mmc/host.h
>> @@ -470,6 +470,7 @@ struct mmc_host {
>>
>>         struct delayed_work     detect;
>>         int                     detect_change;  /* card detect flag */
>> +       int                     cd_irq;         /* for use by mmc_gpiod_request_cd_irq */
> 
> Rather than putting this in the struct mmc_host, I would prefer to
> keep it more internal to the mmc core/slot code.
> 
> That said, what do you think of moving this into the struct mmc_gpio
> instead? Of course, that also means that we need to add new slot gpio
> helper that users can call to set the corresponding value for the
> cd_irq.
> 
> Would that be okay to you?
> 
Yes, that's the better approach.

>>         struct mmc_slot         slot;
>>
>>         const struct mmc_bus_ops *bus_ops;      /* current bus driver */
> 
> Kind regards
> Uffe


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 1/2] mmc: core: support platform interrupt as card detect interrupt
@ 2023-02-14  7:45       ` Heiner Kallweit
  0 siblings, 0 replies; 27+ messages in thread
From: Heiner Kallweit @ 2023-02-14  7:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	linux-mmc, open list:ARM/Amlogic Meson...,
	linux-arm-kernel

On 13.02.2023 23:46, Ulf Hansson wrote:
> On Mon, 30 Jan 2023 at 00:10, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>
>> On certain platforms like Amlogic Meson gpiod_to_irq() isn't supported
>> due to the design of gpio / interrupt controller. Therefore provide an
>> option to specify the cd interrupt e.g. by device tree. The host
>> controller can store the interrupt in cd_irq for use by
>> mmc_gpiod_request_cd_irq().
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/mmc/core/slot-gpio.c | 2 +-
>>  include/linux/mmc/host.h     | 1 +
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
>> index dd2a4b6ab..69c22a997 100644
>> --- a/drivers/mmc/core/slot-gpio.c
>> +++ b/drivers/mmc/core/slot-gpio.c
>> @@ -99,7 +99,7 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
>>          * IRQ number is already used by another unit and cannot be shared.
>>          */
>>         if (!(host->caps & MMC_CAP_NEEDS_POLL))
>> -               irq = gpiod_to_irq(ctx->cd_gpio);
>> +               irq = host->cd_irq > 0 ? host->cd_irq : gpiod_to_irq(ctx->cd_gpio);
>>
>>         if (irq >= 0) {
>>                 if (!ctx->cd_gpio_isr)
>> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
>> index 8fdd3cf97..e998e919e 100644
>> --- a/include/linux/mmc/host.h
>> +++ b/include/linux/mmc/host.h
>> @@ -470,6 +470,7 @@ struct mmc_host {
>>
>>         struct delayed_work     detect;
>>         int                     detect_change;  /* card detect flag */
>> +       int                     cd_irq;         /* for use by mmc_gpiod_request_cd_irq */
> 
> Rather than putting this in the struct mmc_host, I would prefer to
> keep it more internal to the mmc core/slot code.
> 
> That said, what do you think of moving this into the struct mmc_gpio
> instead? Of course, that also means that we need to add new slot gpio
> helper that users can call to set the corresponding value for the
> cd_irq.
> 
> Would that be okay to you?
> 
Yes, that's the better approach.

>>         struct mmc_slot         slot;
>>
>>         const struct mmc_bus_ops *bus_ops;      /* current bus driver */
> 
> Kind regards
> Uffe


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-02-14  7:46 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 23:02 [PATCH 0/2] mmc: meson-gx: support platform interrupt as card detect interrupt Heiner Kallweit
2023-01-29 23:02 ` Heiner Kallweit
2023-01-29 23:02 ` Heiner Kallweit
2023-01-29 23:04 ` [PATCH 1/2] mmc: core: " Heiner Kallweit
2023-01-29 23:04   ` Heiner Kallweit
2023-01-29 23:04   ` Heiner Kallweit
2023-02-13 22:46   ` Ulf Hansson
2023-02-13 22:46     ` Ulf Hansson
2023-02-13 22:46     ` Ulf Hansson
2023-02-14  7:45     ` Heiner Kallweit
2023-02-14  7:45       ` Heiner Kallweit
2023-02-14  7:45       ` Heiner Kallweit
2023-01-29 23:10 ` [PATCH 2/2] mmc: meson-gx: " Heiner Kallweit
2023-01-29 23:10   ` Heiner Kallweit
2023-01-29 23:10   ` Heiner Kallweit
2023-01-30 11:06   ` Neil Armstrong
2023-01-30 11:06     ` Neil Armstrong
2023-01-30 11:06     ` Neil Armstrong
2023-01-30 19:04     ` Heiner Kallweit
2023-01-30 19:04       ` Heiner Kallweit
2023-01-30 19:04       ` Heiner Kallweit
2023-02-13 22:47   ` Ulf Hansson
2023-02-13 22:47     ` Ulf Hansson
2023-02-13 22:47     ` Ulf Hansson
2023-02-14  6:39     ` Heiner Kallweit
2023-02-14  6:39       ` Heiner Kallweit
2023-02-14  6:39       ` Heiner Kallweit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.