linux_dsm_epyc7002/drivers/net/dsa/mv88e6xxx
John David Anglin 7c0db24cc4 dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit
The GPIO interrupt controller on the espressobin board only supports edge interrupts.
If one enables the use of hardware interrupts in the device tree for the 88E6341, it is
possible to miss an edge.  When this happens, the INTn pin on the Marvell switch is
stuck low and no further interrupts occur.

I found after adding debug statements to mv88e6xxx_g1_irq_thread_work() that there is
a race in handling device interrupts (e.g. PHY link interrupts).  Some interrupts are
directly cleared by reading the Global 1 status register.  However, the device interrupt
flag, for example, is not cleared until all the unmasked SERDES and PHY ports are serviced.
This is done by reading the relevant SERDES and PHY status register.

The code only services interrupts whose status bit is set at the time of reading its status
register.  If an interrupt event occurs after its status is read and before all interrupts
are serviced, then this event will not be serviced and the INTn output pin will remain low.

This is not a problem with polling or level interrupts since the handler will be called
again to process the event.  However, it's a big problem when using level interrupts.

The fix presented here is to add a loop around the code servicing switch interrupts.  If
any pending interrupts remain after the current set has been handled, we loop and process
the new set.  If there are no pending interrupts after servicing, we are sure that INTn has
gone high and we will get an edge when a new event occurs.

Tested on espressobin board.

Fixes: dc30c35be7 ("net: dsa: mv88e6xxx: Implement interrupt support.")
Signed-off-by:  John David Anglin <dave.anglin@bell.net>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-02-13 20:46:38 -08:00
..
chip.c dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit 2019-02-13 20:46:38 -08:00
chip.h net: dsa: mv88x6xxx: mv88e6390 errata 2019-01-10 16:53:46 -05:00
global1_atu.c net: dsa: mv88e6xxx: Fix counting of ATU violations 2019-02-05 16:37:52 -08:00
global1_vtu.c net: dsa: mv88e6xxx: Make VTU miss violations less spammy 2018-03-29 15:04:22 -04:00
global1.c net: dsa: mv88e6xxx: Fix clearing of stats counters 2018-11-11 10:19:10 -08:00
global1.h net: dsa: mv88e6xxx: Fix ATU Miss Violation 2018-09-17 08:03:53 -07:00
global2_avb.c net: dsa: mv88e6xxx: Add MV88E6165 AVB register access 2018-07-18 15:05:38 -07:00
global2_scratch.c net: dsa: mv88e6xxx: scratch registers and external MDIO pins 2018-02-22 14:46:32 -05:00
global2.c net: dsa: mv88e6xxx: Remove OF check for IRQ domain 2018-05-20 18:58:27 -04:00
global2.h net: dsa: mv88e6xxx: Add MV88E6165 AVB register access 2018-07-18 15:05:38 -07:00
hwtstamp.c net: dsa: mv88e6xxx: Longer timeout for PTP TX timestamp 2018-07-18 15:05:38 -07:00
hwtstamp.h net: dsa: mv88e6xxx: Add hwtimestamp support for the 6165 2018-07-18 15:05:38 -07:00
Kconfig net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock 2018-02-14 14:33:36 -05:00
Makefile net: dsa: mv88e6xxx: add rx/tx timestamping support 2018-02-14 14:33:37 -05:00
phy.c net: dsa: mv88e6xxx: Fix writing to a PHY page. 2018-09-02 16:16:23 -07:00
phy.h
port.c net: dsa: mv88e6xxx: Default ports 9/10 6390X CMODE to 1000BaseX 2018-11-11 10:17:46 -08:00
port.h net: dsa: mv88x6xxx: mv88e6390 errata 2019-01-10 16:53:46 -05:00
ptp.c net: dsa: mv88e6xxx: Add hwtimestamp support for the 6165 2018-07-18 15:05:38 -07:00
ptp.h net: dsa: mv88e6xxx: Set PTP Ethertype 2018-07-18 15:05:38 -07:00
serdes.c net: dsa: mv88e6xxx: Fix serdes irq setup going recursive 2019-01-27 23:19:19 -08:00
serdes.h net: dsa: mv88e6xxx: Add support for SERDES on ports 2-8 for 6390X 2018-11-11 10:17:46 -08:00