All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-20 23:11 ` Marek Behún
  0 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-20 23:11 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Marek Behún, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, Andrew Lunn, stable

Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.

Without this the pin is by default in LED[2] mode, and the Marvell PHY
driver configures LED[2] into "On - Link, Blink - Activity" mode.

This fixes the issue where the pca9538 GPIO/interrupt controller (which
can't mask interrupts in HW) received too many interrupts and after a
time started ignoring the interrupt with error message:
  IRQ 71: nobody cared

There is a work in progress to have the Marvell PHY driver support
parsing PHY LED nodes from OF and registering the LEDs as Linux LED
class devices. Once this is done the PHY driver can also automatically
set the pin into INTn mode if it does not find LED[2] in OF.

Until then, though, we fix this via `marvell,reg-init` DT property.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: <stable@vger.kernel.org>

---

This patch fixes bug introduced with the commit that added Turris
Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
commit 8ee4a5f4f40d which changed node name and node compatible
property and this commit did not go into stable.

So either commit 8ee4a5f4f40d has also to go into stable before this, or
this patch has to be fixed a little in order to apply to 4.14+.

Please let me know how should I handle this.

---
 arch/arm/boot/dts/armada-385-turris-omnia.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
index 646a06420c77..b0f3fd8e1429 100644
--- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
+++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
@@ -389,6 +389,7 @@ &mdio {
 	phy1: ethernet-phy@1 {
 		compatible = "ethernet-phy-ieee802.3-c22";
 		reg = <1>;
+		marvell,reg-init = <3 18 0 0x4985>;
 
 		/* irq is connected to &pcawan pin 7 */
 	};
-- 
2.26.2


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

* [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-20 23:11 ` Marek Behún
  0 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-20 23:11 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Marek Behún, Andrew Lunn, Uwe Kleine-König, stable,
	Rui Salvaterra, linux-arm-kernel

Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.

Without this the pin is by default in LED[2] mode, and the Marvell PHY
driver configures LED[2] into "On - Link, Blink - Activity" mode.

This fixes the issue where the pca9538 GPIO/interrupt controller (which
can't mask interrupts in HW) received too many interrupts and after a
time started ignoring the interrupt with error message:
  IRQ 71: nobody cared

There is a work in progress to have the Marvell PHY driver support
parsing PHY LED nodes from OF and registering the LEDs as Linux LED
class devices. Once this is done the PHY driver can also automatically
set the pin into INTn mode if it does not find LED[2] in OF.

Until then, though, we fix this via `marvell,reg-init` DT property.

Signed-off-by: Marek Behún <kabel@kernel.org>
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: <stable@vger.kernel.org>

---

This patch fixes bug introduced with the commit that added Turris
Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
commit 8ee4a5f4f40d which changed node name and node compatible
property and this commit did not go into stable.

So either commit 8ee4a5f4f40d has also to go into stable before this, or
this patch has to be fixed a little in order to apply to 4.14+.

Please let me know how should I handle this.

---
 arch/arm/boot/dts/armada-385-turris-omnia.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
index 646a06420c77..b0f3fd8e1429 100644
--- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
+++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
@@ -389,6 +389,7 @@ &mdio {
 	phy1: ethernet-phy@1 {
 		compatible = "ethernet-phy-ieee802.3-c22";
 		reg = <1>;
+		marvell,reg-init = <3 18 0 0x4985>;
 
 		/* irq is connected to &pcawan pin 7 */
 	};
-- 
2.26.2


_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-20 23:11 ` Marek Behún
@ 2021-02-21  0:10   ` Andrew Lunn
  -1 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2021-02-21  0:10 UTC (permalink / raw)
  To: Marek Behún
  Cc: Gregory CLEMENT, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, stable

On Sun, Feb 21, 2021 at 12:11:44AM +0100, Marek Behún wrote:
> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
> 
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
> 
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared

Hi Marek

The pca9538 and alike are a poor choice for interrupts. As you said,
you cannot mask interrupts, and input are interrupt sources.

With this change, does it actually work reliably? It looks like all
the inputs you have support polling. And because this devices is so
unreliable with interrupts, interrupt support is mostly not built. I
would not expect a distribution kernel to enable interrupt support for
this driver. Does all the code correctly fall back to polling when
interrupts are not available?

So although the patch looks O.K, i'm just wonder if it is worth it, or
the better fix is to remove the interrupt configuration from the
pca9538 node.

	Andrew

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-21  0:10   ` Andrew Lunn
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2021-02-21  0:10 UTC (permalink / raw)
  To: Marek Behún
  Cc: stable, Gregory CLEMENT, linux-arm-kernel, Uwe Kleine-König,
	Rui Salvaterra

On Sun, Feb 21, 2021 at 12:11:44AM +0100, Marek Behún wrote:
> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
> 
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
> 
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared

Hi Marek

The pca9538 and alike are a poor choice for interrupts. As you said,
you cannot mask interrupts, and input are interrupt sources.

With this change, does it actually work reliably? It looks like all
the inputs you have support polling. And because this devices is so
unreliable with interrupts, interrupt support is mostly not built. I
would not expect a distribution kernel to enable interrupt support for
this driver. Does all the code correctly fall back to polling when
interrupts are not available?

So although the patch looks O.K, i'm just wonder if it is worth it, or
the better fix is to remove the interrupt configuration from the
pca9538 node.

	Andrew

_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-21  0:10   ` Andrew Lunn
@ 2021-02-21  0:47     ` Marek Behún
  -1 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-21  0:47 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Gregory CLEMENT, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, stable

On Sun, 21 Feb 2021 01:10:57 +0100
Andrew Lunn <andrew@lunn.ch> wrote:

> On Sun, Feb 21, 2021 at 12:11:44AM +0100, Marek Behún wrote:
> > Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> > of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
> > 
> > Without this the pin is by default in LED[2] mode, and the Marvell PHY
> > driver configures LED[2] into "On - Link, Blink - Activity" mode.
> > 
> > This fixes the issue where the pca9538 GPIO/interrupt controller (which
> > can't mask interrupts in HW) received too many interrupts and after a
> > time started ignoring the interrupt with error message:
> >   IRQ 71: nobody cared  
> 
> Hi Marek
> 
> The pca9538 and alike are a poor choice for interrupts. As you said,
> you cannot mask interrupts, and input are interrupt sources.
> 
> With this change, does it actually work reliably? It looks like all
> the inputs you have support polling. And because this devices is so
> unreliable with interrupts, interrupt support is mostly not built. I
> would not expect a distribution kernel to enable interrupt support for
> this driver. Does all the code correctly fall back to polling when
> interrupts are not available?
> 
> So although the patch looks O.K, i'm just wonder if it is worth it, or
> the better fix is to remove the interrupt configuration from the
> pca9538 node.
> 
> 	Andrew

Hi Andrew,

- we already discussed this and you explained to me that pca9538 is poor
  as an interrupt source. That is why I did not send patch adding
  interrupt-source to the PHY node last time. We are polling the PHY
  for interrupts for now

- I would like to try this though, and see whether it will cause
  problems. Unfortunately I forgot to do this last time

- nonetheless the pin is connected as an interrupt on the board, so I
  think that the PHY driver should configure it that way, even if the
  INT signal is not used

- removing the interrupts property from the pca9538 controller node
  would solve the issue as well. The other pins on the controller are
  used for SFP cage GPIOs and the way the pca953x driver is written,
  the GPIOs are polled anyway - the interrupt is not used for them

All in all I think for now this solution is best (since the pin is
_meant_ to be used as an interrupt pin on the board and the issue is
solved by this patch).

BTW do you have some experience where pca9538 or compatible cause
errors when used for interrupts? Because I am thinking about trying
to update the pca953x driver to support IRQs via the gpio_chip it
registers, instead of a separate irq_chip.

Marek

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-21  0:47     ` Marek Behún
  0 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-21  0:47 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: stable, Gregory CLEMENT, linux-arm-kernel, Uwe Kleine-König,
	Rui Salvaterra

On Sun, 21 Feb 2021 01:10:57 +0100
Andrew Lunn <andrew@lunn.ch> wrote:

> On Sun, Feb 21, 2021 at 12:11:44AM +0100, Marek Behún wrote:
> > Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> > of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
> > 
> > Without this the pin is by default in LED[2] mode, and the Marvell PHY
> > driver configures LED[2] into "On - Link, Blink - Activity" mode.
> > 
> > This fixes the issue where the pca9538 GPIO/interrupt controller (which
> > can't mask interrupts in HW) received too many interrupts and after a
> > time started ignoring the interrupt with error message:
> >   IRQ 71: nobody cared  
> 
> Hi Marek
> 
> The pca9538 and alike are a poor choice for interrupts. As you said,
> you cannot mask interrupts, and input are interrupt sources.
> 
> With this change, does it actually work reliably? It looks like all
> the inputs you have support polling. And because this devices is so
> unreliable with interrupts, interrupt support is mostly not built. I
> would not expect a distribution kernel to enable interrupt support for
> this driver. Does all the code correctly fall back to polling when
> interrupts are not available?
> 
> So although the patch looks O.K, i'm just wonder if it is worth it, or
> the better fix is to remove the interrupt configuration from the
> pca9538 node.
> 
> 	Andrew

Hi Andrew,

- we already discussed this and you explained to me that pca9538 is poor
  as an interrupt source. That is why I did not send patch adding
  interrupt-source to the PHY node last time. We are polling the PHY
  for interrupts for now

- I would like to try this though, and see whether it will cause
  problems. Unfortunately I forgot to do this last time

- nonetheless the pin is connected as an interrupt on the board, so I
  think that the PHY driver should configure it that way, even if the
  INT signal is not used

- removing the interrupts property from the pca9538 controller node
  would solve the issue as well. The other pins on the controller are
  used for SFP cage GPIOs and the way the pca953x driver is written,
  the GPIOs are polled anyway - the interrupt is not used for them

All in all I think for now this solution is best (since the pin is
_meant_ to be used as an interrupt pin on the board and the issue is
solved by this patch).

BTW do you have some experience where pca9538 or compatible cause
errors when used for interrupts? Because I am thinking about trying
to update the pca953x driver to support IRQs via the gpio_chip it
registers, instead of a separate irq_chip.

Marek

_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-20 23:11 ` Marek Behún
@ 2021-02-21 19:58   ` Rui Salvaterra
  -1 siblings, 0 replies; 18+ messages in thread
From: Rui Salvaterra @ 2021-02-21 19:58 UTC (permalink / raw)
  To: Marek Behún
  Cc: Gregory CLEMENT, Uwe Kleine-König, linux-arm-kernel,
	Andrew Lunn, stable

Hi, Marek,

On Sat, 20 Feb 2021 at 23:12, Marek Behún <kabel@kernel.org> wrote:
>
> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
>
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
>
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared
>
> There is a work in progress to have the Marvell PHY driver support
> parsing PHY LED nodes from OF and registering the LEDs as Linux LED
> class devices. Once this is done the PHY driver can also automatically
> set the pin into INTn mode if it does not find LED[2] in OF.
>
> Until then, though, we fix this via `marvell,reg-init` DT property.
>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
> Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: <stable@vger.kernel.org>
>
> ---
>
> This patch fixes bug introduced with the commit that added Turris
> Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> commit 8ee4a5f4f40d which changed node name and node compatible
> property and this commit did not go into stable.
>
> So either commit 8ee4a5f4f40d has also to go into stable before this, or
> this patch has to be fixed a little in order to apply to 4.14+.
>
> Please let me know how should I handle this.
>
> ---
>  arch/arm/boot/dts/armada-385-turris-omnia.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> index 646a06420c77..b0f3fd8e1429 100644
> --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> @@ -389,6 +389,7 @@ &mdio {
>         phy1: ethernet-phy@1 {
>                 compatible = "ethernet-phy-ieee802.3-c22";
>                 reg = <1>;
> +               marvell,reg-init = <3 18 0 0x4985>;
>
>                 /* irq is connected to &pcawan pin 7 */
>         };
> --
> 2.26.2
>

This does seem to fix the problem on my Omnia. Feel free to add my

Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>

Thanks,
Rui

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-21 19:58   ` Rui Salvaterra
  0 siblings, 0 replies; 18+ messages in thread
From: Rui Salvaterra @ 2021-02-21 19:58 UTC (permalink / raw)
  To: Marek Behún
  Cc: Andrew Lunn, Gregory CLEMENT, stable, linux-arm-kernel,
	Uwe Kleine-König

Hi, Marek,

On Sat, 20 Feb 2021 at 23:12, Marek Behún <kabel@kernel.org> wrote:
>
> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
>
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
>
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared
>
> There is a work in progress to have the Marvell PHY driver support
> parsing PHY LED nodes from OF and registering the LEDs as Linux LED
> class devices. Once this is done the PHY driver can also automatically
> set the pin into INTn mode if it does not find LED[2] in OF.
>
> Until then, though, we fix this via `marvell,reg-init` DT property.
>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
> Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: <stable@vger.kernel.org>
>
> ---
>
> This patch fixes bug introduced with the commit that added Turris
> Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> commit 8ee4a5f4f40d which changed node name and node compatible
> property and this commit did not go into stable.
>
> So either commit 8ee4a5f4f40d has also to go into stable before this, or
> this patch has to be fixed a little in order to apply to 4.14+.
>
> Please let me know how should I handle this.
>
> ---
>  arch/arm/boot/dts/armada-385-turris-omnia.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> index 646a06420c77..b0f3fd8e1429 100644
> --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> @@ -389,6 +389,7 @@ &mdio {
>         phy1: ethernet-phy@1 {
>                 compatible = "ethernet-phy-ieee802.3-c22";
>                 reg = <1>;
> +               marvell,reg-init = <3 18 0 0x4985>;
>
>                 /* irq is connected to &pcawan pin 7 */
>         };
> --
> 2.26.2
>

This does seem to fix the problem on my Omnia. Feel free to add my

Tested-by: Rui Salvaterra <rsalvaterra@gmail.com>

Thanks,
Rui

_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-20 23:11 ` Marek Behún
@ 2021-02-21 20:52   ` Andrew Lunn
  -1 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2021-02-21 20:52 UTC (permalink / raw)
  To: Marek Behún
  Cc: Gregory CLEMENT, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, stable

On Sun, Feb 21, 2021 at 12:11:44AM +0100, Marek Behún wrote:
> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
> 
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
> 
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared
> 
> There is a work in progress to have the Marvell PHY driver support
> parsing PHY LED nodes from OF and registering the LEDs as Linux LED
> class devices. Once this is done the PHY driver can also automatically
> set the pin into INTn mode if it does not find LED[2] in OF.
> 
> Until then, though, we fix this via `marvell,reg-init` DT property.
> 
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
> Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: <stable@vger.kernel.org>

Hi Marek

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

> This patch fixes bug introduced with the commit that added Turris
> Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> commit 8ee4a5f4f40d which changed node name and node compatible
> property and this commit did not go into stable.
> 
> So either commit 8ee4a5f4f40d has also to go into stable before this, or
> this patch has to be fixed a little in order to apply to 4.14+.

Once this has made it into Linus's tree, you can give GregKH a version
which will apply cleanly to 4.14.  Reference the upstream version so
they can be linked together.

     Andrew

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-21 20:52   ` Andrew Lunn
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2021-02-21 20:52 UTC (permalink / raw)
  To: Marek Behún
  Cc: stable, Gregory CLEMENT, linux-arm-kernel, Uwe Kleine-König,
	Rui Salvaterra

On Sun, Feb 21, 2021 at 12:11:44AM +0100, Marek Behún wrote:
> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
> 
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
> 
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared
> 
> There is a work in progress to have the Marvell PHY driver support
> parsing PHY LED nodes from OF and registering the LEDs as Linux LED
> class devices. Once this is done the PHY driver can also automatically
> set the pin into INTn mode if it does not find LED[2] in OF.
> 
> Until then, though, we fix this via `marvell,reg-init` DT property.
> 
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
> Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: <stable@vger.kernel.org>

Hi Marek

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

> This patch fixes bug introduced with the commit that added Turris
> Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> commit 8ee4a5f4f40d which changed node name and node compatible
> property and this commit did not go into stable.
> 
> So either commit 8ee4a5f4f40d has also to go into stable before this, or
> this patch has to be fixed a little in order to apply to 4.14+.

Once this has made it into Linus's tree, you can give GregKH a version
which will apply cleanly to 4.14.  Reference the upstream version so
they can be linked together.

     Andrew

_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-21 20:52   ` Andrew Lunn
@ 2021-02-21 20:58     ` Marek Behún
  -1 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-21 20:58 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Gregory CLEMENT, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, stable

On Sun, 21 Feb 2021 21:52:03 +0100
Andrew Lunn <andrew@lunn.ch> wrote:

> > This patch fixes bug introduced with the commit that added Turris
> > Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> > commit 8ee4a5f4f40d which changed node name and node compatible
> > property and this commit did not go into stable.
> > 
> > So either commit 8ee4a5f4f40d has also to go into stable before this, or
> > this patch has to be fixed a little in order to apply to 4.14+.  
> 
> Once this has made it into Linus's tree, you can give GregKH a version
> which will apply cleanly to 4.14.  Reference the upstream version so
> they can be linked together.

Thank you, Andrew!

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-21 20:58     ` Marek Behún
  0 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-21 20:58 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: stable, Gregory CLEMENT, linux-arm-kernel, Uwe Kleine-König,
	Rui Salvaterra

On Sun, 21 Feb 2021 21:52:03 +0100
Andrew Lunn <andrew@lunn.ch> wrote:

> > This patch fixes bug introduced with the commit that added Turris
> > Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> > commit 8ee4a5f4f40d which changed node name and node compatible
> > property and this commit did not go into stable.
> > 
> > So either commit 8ee4a5f4f40d has also to go into stable before this, or
> > this patch has to be fixed a little in order to apply to 4.14+.  
> 
> Once this has made it into Linus's tree, you can give GregKH a version
> which will apply cleanly to 4.14.  Reference the upstream version so
> they can be linked together.

Thank you, Andrew!

_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-21  0:47     ` Marek Behún
@ 2021-02-21 21:18       ` Andrew Lunn
  -1 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2021-02-21 21:18 UTC (permalink / raw)
  To: Marek Behún
  Cc: Gregory CLEMENT, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, stable

> BTW do you have some experience where pca9538 or compatible cause
> errors when used for interrupts? Because I am thinking about trying
> to update the pca953x driver to support IRQs via the gpio_chip it
> registers, instead of a separate irq_chip.

I had a board which just died at boot with an interrupt storm. It was
probably a PCA9554, at least, i have that datasheet in my collection.

First off, the hardware needs to designed correctly. All unused pins
need a pull up/down since they default to inputs, and hence will
trigger interrupts. Or you need to make unused pins outputs before you
enable interrupts. And that probably goes against the design of the
GPIO subsystem. I don't think you actually know when a pin is unused.

I'm not sure i would want to touch this driver. Given how badly this
device implements interrupts, any board which does successfully use it
for interrupts might regress if you make code changes. And then you
are going to have to try to figure out what you actually changed and
why it regressed.

    Andrew

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-21 21:18       ` Andrew Lunn
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Lunn @ 2021-02-21 21:18 UTC (permalink / raw)
  To: Marek Behún
  Cc: stable, Gregory CLEMENT, linux-arm-kernel, Uwe Kleine-König,
	Rui Salvaterra

> BTW do you have some experience where pca9538 or compatible cause
> errors when used for interrupts? Because I am thinking about trying
> to update the pca953x driver to support IRQs via the gpio_chip it
> registers, instead of a separate irq_chip.

I had a board which just died at boot with an interrupt storm. It was
probably a PCA9554, at least, i have that datasheet in my collection.

First off, the hardware needs to designed correctly. All unused pins
need a pull up/down since they default to inputs, and hence will
trigger interrupts. Or you need to make unused pins outputs before you
enable interrupts. And that probably goes against the design of the
GPIO subsystem. I don't think you actually know when a pin is unused.

I'm not sure i would want to touch this driver. Given how badly this
device implements interrupts, any board which does successfully use it
for interrupts might regress if you make code changes. And then you
are going to have to try to figure out what you actually changed and
why it regressed.

    Andrew

_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-21 21:18       ` Andrew Lunn
@ 2021-02-21 22:40         ` Marek Behún
  -1 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-21 22:40 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Gregory CLEMENT, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, stable

On Sun, 21 Feb 2021 22:18:48 +0100
Andrew Lunn <andrew@lunn.ch> wrote:

> > BTW do you have some experience where pca9538 or compatible cause
> > errors when used for interrupts? Because I am thinking about trying
> > to update the pca953x driver to support IRQs via the gpio_chip it
> > registers, instead of a separate irq_chip.  
> 
> I had a board which just died at boot with an interrupt storm. It was
> probably a PCA9554, at least, i have that datasheet in my collection.

But why did an interrupt storm kill it? The interrupt handler was called
too many times?

> First off, the hardware needs to designed correctly. All unused pins
> need a pull up/down since they default to inputs, and hence will
> trigger interrupts. Or you need to make unused pins outputs before you
> enable interrupts. And that probably goes against the design of the
> GPIO subsystem. I don't think you actually know when a pin is unused.

Omnia has proper pull ups/downs on all 8 pins on this device.
5 of these pins are used from SFP cage, 1 as interrupt from PHY and 2
are unused. Only the interrupt pin was causing problems because marvell
PHY driver configured it as blink on activity LED.

> I'm not sure i would want to touch this driver. Given how badly this
> device implements interrupts, any board which does successfully use it
> for interrupts might regress if you make code changes. And then you
> are going to have to try to figure out what you actually changed and
> why it regressed.

The problem in this driver is:
- interrupt handler is called every time an input pin changes
- not all input pins must be used as interrupt sources
- if at least one input pin is used as an interrupt source,
  the interrupt handler is being called on every change of every input
  pin
- but if the change occurs on a pin that is not used as an interrupt
  source, the interrupt handler returns IRQ_NONE
- a simple scenario to achieve error:
  1. use pin P0 as interrupt source and P1 as GPIO input; other
     pins as outputs
  2. connect P1 to something that changes value
  3. after 10000 changes of P1 (more if there was a change on P0 at the
     same time) the interrupt handler will return IRQ_NONE 10000 times
     and kernel will start ignoring interrupts from this driver because
     it was returning IRQ_NONE
I think this needs to be fixed in this driver. Either this function
should return IRQ_HANDLED in this case, or there should be a third
option to return, something like IRQ_NONE_BUT_THATS_OK

Marek

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-02-21 22:40         ` Marek Behún
  0 siblings, 0 replies; 18+ messages in thread
From: Marek Behún @ 2021-02-21 22:40 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: stable, Gregory CLEMENT, linux-arm-kernel, Uwe Kleine-König,
	Rui Salvaterra

On Sun, 21 Feb 2021 22:18:48 +0100
Andrew Lunn <andrew@lunn.ch> wrote:

> > BTW do you have some experience where pca9538 or compatible cause
> > errors when used for interrupts? Because I am thinking about trying
> > to update the pca953x driver to support IRQs via the gpio_chip it
> > registers, instead of a separate irq_chip.  
> 
> I had a board which just died at boot with an interrupt storm. It was
> probably a PCA9554, at least, i have that datasheet in my collection.

But why did an interrupt storm kill it? The interrupt handler was called
too many times?

> First off, the hardware needs to designed correctly. All unused pins
> need a pull up/down since they default to inputs, and hence will
> trigger interrupts. Or you need to make unused pins outputs before you
> enable interrupts. And that probably goes against the design of the
> GPIO subsystem. I don't think you actually know when a pin is unused.

Omnia has proper pull ups/downs on all 8 pins on this device.
5 of these pins are used from SFP cage, 1 as interrupt from PHY and 2
are unused. Only the interrupt pin was causing problems because marvell
PHY driver configured it as blink on activity LED.

> I'm not sure i would want to touch this driver. Given how badly this
> device implements interrupts, any board which does successfully use it
> for interrupts might regress if you make code changes. And then you
> are going to have to try to figure out what you actually changed and
> why it regressed.

The problem in this driver is:
- interrupt handler is called every time an input pin changes
- not all input pins must be used as interrupt sources
- if at least one input pin is used as an interrupt source,
  the interrupt handler is being called on every change of every input
  pin
- but if the change occurs on a pin that is not used as an interrupt
  source, the interrupt handler returns IRQ_NONE
- a simple scenario to achieve error:
  1. use pin P0 as interrupt source and P1 as GPIO input; other
     pins as outputs
  2. connect P1 to something that changes value
  3. after 10000 changes of P1 (more if there was a change on P0 at the
     same time) the interrupt handler will return IRQ_NONE 10000 times
     and kernel will start ignoring interrupts from this driver because
     it was returning IRQ_NONE
I think this needs to be fixed in this driver. Either this function
should return IRQ_HANDLED in this case, or there should be a third
option to return, something like IRQ_NONE_BUT_THATS_OK

Marek

_______________________________________________
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] 18+ messages in thread

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
  2021-02-20 23:11 ` Marek Behún
@ 2021-04-02 20:15   ` Gregory CLEMENT
  -1 siblings, 0 replies; 18+ messages in thread
From: Gregory CLEMENT @ 2021-04-02 20:15 UTC (permalink / raw)
  To: Marek Behún
  Cc: Marek Behún, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, Andrew Lunn, stable

Hi Marek,

> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
>
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
>
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared
>
> There is a work in progress to have the Marvell PHY driver support
> parsing PHY LED nodes from OF and registering the LEDs as Linux LED
> class devices. Once this is done the PHY driver can also automatically
> set the pin into INTn mode if it does not find LED[2] in OF.
>
> Until then, though, we fix this via `marvell,reg-init` DT property.
>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
> Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: <stable@vger.kernel.org>


Applied on mvebu/fixes

Thanks,

Gregory

>
> ---
>
> This patch fixes bug introduced with the commit that added Turris
> Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> commit 8ee4a5f4f40d which changed node name and node compatible
> property and this commit did not go into stable.
>
> So either commit 8ee4a5f4f40d has also to go into stable before this, or
> this patch has to be fixed a little in order to apply to 4.14+.
>
> Please let me know how should I handle this.
>
> ---
>  arch/arm/boot/dts/armada-385-turris-omnia.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> index 646a06420c77..b0f3fd8e1429 100644
> --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> @@ -389,6 +389,7 @@ &mdio {
>  	phy1: ethernet-phy@1 {
>  		compatible = "ethernet-phy-ieee802.3-c22";
>  		reg = <1>;
> +		marvell,reg-init = <3 18 0 0x4985>;
>  
>  		/* irq is connected to &pcawan pin 7 */
>  	};
> -- 
> 2.26.2
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

* Re: [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
@ 2021-04-02 20:15   ` Gregory CLEMENT
  0 siblings, 0 replies; 18+ messages in thread
From: Gregory CLEMENT @ 2021-04-02 20:15 UTC (permalink / raw)
  To: Marek Behún
  Cc: Marek Behún, Rui Salvaterra, Uwe Kleine-König,
	linux-arm-kernel, Andrew Lunn, stable

Hi Marek,

> Use the `marvell,reg-init` DT property to configure the LED[2]/INTn pin
> of the Marvell 88E1514 ethernet PHY on Turris Omnia into interrupt mode.
>
> Without this the pin is by default in LED[2] mode, and the Marvell PHY
> driver configures LED[2] into "On - Link, Blink - Activity" mode.
>
> This fixes the issue where the pca9538 GPIO/interrupt controller (which
> can't mask interrupts in HW) received too many interrupts and after a
> time started ignoring the interrupt with error message:
>   IRQ 71: nobody cared
>
> There is a work in progress to have the Marvell PHY driver support
> parsing PHY LED nodes from OF and registering the LEDs as Linux LED
> class devices. Once this is done the PHY driver can also automatically
> set the pin into INTn mode if it does not find LED[2] in OF.
>
> Until then, though, we fix this via `marvell,reg-init` DT property.
>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
> Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
> Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: <stable@vger.kernel.org>


Applied on mvebu/fixes

Thanks,

Gregory

>
> ---
>
> This patch fixes bug introduced with the commit that added Turris
> Omnia's DTS (26ca8b52d6e1), but will not apply cleanly because there is
> commit 8ee4a5f4f40d which changed node name and node compatible
> property and this commit did not go into stable.
>
> So either commit 8ee4a5f4f40d has also to go into stable before this, or
> this patch has to be fixed a little in order to apply to 4.14+.
>
> Please let me know how should I handle this.
>
> ---
>  arch/arm/boot/dts/armada-385-turris-omnia.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> index 646a06420c77..b0f3fd8e1429 100644
> --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> @@ -389,6 +389,7 @@ &mdio {
>  	phy1: ethernet-phy@1 {
>  		compatible = "ethernet-phy-ieee802.3-c22";
>  		reg = <1>;
> +		marvell,reg-init = <3 18 0 0x4985>;
>  
>  		/* irq is connected to &pcawan pin 7 */
>  	};
> -- 
> 2.26.2
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

_______________________________________________
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] 18+ messages in thread

end of thread, other threads:[~2021-04-02 20:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 23:11 [PATCH mvebu-dt] ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin Marek Behún
2021-02-20 23:11 ` Marek Behún
2021-02-21  0:10 ` Andrew Lunn
2021-02-21  0:10   ` Andrew Lunn
2021-02-21  0:47   ` Marek Behún
2021-02-21  0:47     ` Marek Behún
2021-02-21 21:18     ` Andrew Lunn
2021-02-21 21:18       ` Andrew Lunn
2021-02-21 22:40       ` Marek Behún
2021-02-21 22:40         ` Marek Behún
2021-02-21 19:58 ` Rui Salvaterra
2021-02-21 19:58   ` Rui Salvaterra
2021-02-21 20:52 ` Andrew Lunn
2021-02-21 20:52   ` Andrew Lunn
2021-02-21 20:58   ` Marek Behún
2021-02-21 20:58     ` Marek Behún
2021-04-02 20:15 ` Gregory CLEMENT
2021-04-02 20:15   ` Gregory CLEMENT

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.