ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
Subsystems (2)
PATCH 1/1 ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
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.
---
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(+)
arch/arm/boot/dts/armada-385-turris-omnia.dts +1 -0
@@ -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 */ };
Signature · 1 line
2.26.2
Quoted 10 lines · Marek Behún
Use the
marvell,reg-initDT 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
Quoted 24 lines · On Sun, 21 Feb 2021 01:10:57 +0100 Andrew Lunn <[email protected]> wrote:
Quoted 10 lines · Marek Behún
Use the
marvell,reg-initDT 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 caredHi 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?
Quoted 5 lines
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
Quoted 4 lines
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_chipit registers, instead of a separateirq_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
Quoted 7 lines · On Sun, 21 Feb 2021 22:18:48 +0100 Andrew Lunn <[email protected]> wrote:
Quoted 4 lines
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_chipit registers, instead of a separateirq_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?
Quoted 5 lines
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.
Quoted 5 lines
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
Hi, Marek,
Quoted 57 lines · Marek Behún
Use the
marvell,reg-initDT 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 caredThere 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-initDT property.Signed-off-by Marek Behún <[email protected]>Reported-by Rui Salvaterra <[email protected]>Fixes 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")Cc Uwe Kleine-König <[email protected]>Cc Andrew Lunn <[email protected]>Cc Gregory CLEMENT <[email protected]>Cc <[email protected]>---
This patch fixes bug introduced with the commit that added Turris Omnia's DTS (
26ca8b52d6e1), but will not apply cleanly because there is commit8ee4a5f4f40dwhich changed node name and node compatible property and this commit did not go into stable.So either commit
8ee4a5f4f40dhas 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(+)arch/arm/boot/dts/armada-385-turris-omnia.dts +1
-1@@ -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 */ }; --
Quoted 2 lines
2.26.2
This does seem to fix the problem on my Omnia. Feel free to add my
Thanks,
Rui
Quoted 18 lines · Marek Behún
Use the
marvell,reg-initDT 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 caredThere 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-initDT property.
Quoted 8 lines
Signed-off-by Marek Behún <[email protected]>Reported-by Rui Salvaterra <[email protected]>Fixes 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")Cc Uwe Kleine-König <[email protected]>Cc Andrew Lunn <[email protected]>Cc Gregory CLEMENT <[email protected]>Cc <[email protected]>
Hi Marek
Quoted 7 lines
This patch fixes bug introduced with the commit that added Turris Omnia's DTS (
26ca8b52d6e1), but will not apply cleanly because there is commit8ee4a5f4f40dwhich changed node name and node compatible property and this commit did not go into stable.So either commit
8ee4a5f4f40dhas 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
Quoted 11 lines · On Sun, 21 Feb 2021 21:52:03 +0100 Andrew Lunn <[email protected]> wrote:
Quoted 7 lines
This patch fixes bug introduced with the commit that added Turris Omnia's DTS (
26ca8b52d6e1), but will not apply cleanly because there is commit8ee4a5f4f40dwhich changed node name and node compatible property and this commit did not go into stable.So either commit
8ee4a5f4f40dhas 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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Marek,
Quoted 18 lines
Use the
marvell,reg-initDT 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 caredThere 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-initDT property.
Quoted 8 lines
Signed-off-by Marek Behún <[email protected]>Reported-by Rui Salvaterra <[email protected]>Fixes 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")Cc Uwe Kleine-König <[email protected]>Cc Andrew Lunn <[email protected]>Cc Gregory CLEMENT <[email protected]>Cc <[email protected]>
Applied on mvebu/fixes
Thanks,
Gregory
Quoted 32 lines
---
This patch fixes bug introduced with the commit that added Turris Omnia's DTS (
26ca8b52d6e1), but will not apply cleanly because there is commit8ee4a5f4f40dwhich changed node name and node compatible property and this commit did not go into stable.So either commit
8ee4a5f4f40dhas 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(+)arch/arm/boot/dts/armada-385-turris-omnia.dts +1
-0@@ -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 */ };Signature · 1 line
2.26.2
Signature · 8 lines
Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel