1 From 5d246e343440ee4915109dac66543d02d71ca900 Mon Sep 17 00:00:00 2001
2 From: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
3 Date: Tue, 11 Feb 2020 15:33:46 +0800
4 Subject: [PATCH] LF-457: ocelot: tsn: clean preempt interrupt status
6 The INTB interrupt is used both for 1588 interrupt and preemption status
7 change interrupt on each port. So clean preempt status interrupt in IRQ
8 handle function. Without handling it, driver may get interrupt storm.
10 Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
11 Reviewed-by: Po Liu <Po.Liu@nxp.com>
13 drivers/net/dsa/ocelot/felix.c | 5 +----
14 drivers/net/ethernet/mscc/ocelot_tsn.c | 14 ++++++++++++++
15 include/soc/mscc/ocelot.h | 1 +
16 3 files changed, 16 insertions(+), 4 deletions(-)
18 --- a/drivers/net/dsa/ocelot/felix.c
19 +++ b/drivers/net/dsa/ocelot/felix.c
20 @@ -688,12 +688,9 @@ static irqreturn_t felix_irq_handler(int
22 /* The INTB interrupt is used for both PTP TX timestamp interrupt
23 * and preemption status change interrupt on each port.
25 - * - Get txtstamp if have
26 - * - TODO: handle preemption. Without handling it, driver may get
30 + ocelot_preempt_irq_clean(ocelot);
31 ocelot_get_txtstamp(ocelot);
34 --- a/drivers/net/ethernet/mscc/ocelot_tsn.c
35 +++ b/drivers/net/ethernet/mscc/ocelot_tsn.c
36 @@ -1570,3 +1570,17 @@ int ocelot_dscp_set(struct ocelot *ocelo
41 +void ocelot_preempt_irq_clean(struct ocelot *ocelot)
43 + struct ocelot_port *ocelot_port;
47 + val = DEV_GMII_MM_STATISTICS_MM_STATUS_PRMPT_ACTIVE_STICKY;
48 + for (port = 0; port < ocelot->num_phys_ports; port++) {
49 + ocelot_port = ocelot->ports[port];
50 + ocelot_port_rmwl(ocelot_port, val, val,
51 + DEV_GMII_MM_STATISTICS_MM_STATUS);
54 --- a/include/soc/mscc/ocelot.h
55 +++ b/include/soc/mscc/ocelot.h
56 @@ -592,4 +592,5 @@ int ocelot_rtag_parse_enable(struct ocel
57 int ocelot_dscp_set(struct ocelot *ocelot, int port,
58 bool enable, const u8 dscp_ix,
59 struct tsn_qos_switch_dscp_conf *c);
60 +void ocelot_preempt_irq_clean(struct ocelot *ocelot);