ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0404-LF-457-ocelot-tsn-clean-preempt-interrupt-status.patch
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
5
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.
9
10 Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
11 Reviewed-by: Po Liu <Po.Liu@nxp.com>
12 ---
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(-)
17
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
21  
22         /* The INTB interrupt is used for both PTP TX timestamp interrupt
23          * and preemption status change interrupt on each port.
24 -        *
25 -        * - Get txtstamp if have
26 -        * - TODO: handle preemption. Without handling it, driver may get
27 -        *   interrupt storm.
28          */
29  
30 +       ocelot_preempt_irq_clean(ocelot);
31         ocelot_get_txtstamp(ocelot);
32  
33         return IRQ_HANDLED;
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
37  
38         return 0;
39  }
40 +
41 +void ocelot_preempt_irq_clean(struct ocelot *ocelot)
42 +{
43 +       struct ocelot_port *ocelot_port;
44 +       int port;
45 +       u32 val;
46 +
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);
52 +       }
53 +}
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);
61  #endif