]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
net: macb: Sync RXUBR changes with mainline
authorHarini Katakam <harini.katakam@xilinx.com>
Wed, 30 Jan 2019 04:56:19 +0000 (10:26 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 5 Feb 2019 11:27:04 +0000 (12:27 +0100)
Use CAPS instead of errata. Enable RX UBR only for affected SoCs
because there is no action to be performed on RX UBR otherwise.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_main.c

index 2db84cc0e3a51ece454152a7d10eff62ec7896ec..05703cdf20a9d08d97c229c1b74efd9b84f820d8 100644 (file)
 #define MACB_CAPS_JUMBO                                0x00000020
 #define MACB_CAPS_GEM_HAS_PTP                  0x00000040
 #define MACB_CAPS_BD_RD_PREFETCH               0x00000080
+#define MACB_CAPS_NEEDS_RSTONUBR               0x00000100
 #define MACB_CAPS_PCS                          0x00000400
-#define MACB_CAPS_PARTIAL_STORE_FORWARD                0x00000100
+#define MACB_CAPS_PARTIAL_STORE_FORWARD                0x00000800
 #define MACB_CAPS_WOL                          0x00000200
 #define MACB_CAPS_FIFO_MODE                    0x10000000
 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE       0x20000000
 #define MACB_CAPS_SG_DISABLED                  0x40000000
 #define MACB_CAPS_MACB_IS_GEM                  0x80000000
 
-/* Errata mask bits */
-#define MACB_ERRATA_RXLOCKUP                   0x00000001
-
 /* LSO settings */
 #define MACB_LSO_UFO_ENABLE                    0x01
 #define MACB_LSO_TSO_ENABLE                    0x02
@@ -1106,7 +1104,6 @@ struct macb_config {
                            struct clk **rx_clk, struct clk **tsu_clk);
        int     (*init)(struct platform_device *pdev);
        int     jumbo_max_len;
-       u32     errata;
 };
 
 struct tsu_incr {
@@ -1246,7 +1243,7 @@ struct macb {
        int     rx_bd_rd_prefetch;
        int     tx_bd_rd_prefetch;
 
-       u32 errata;
+       u32     rx_intr_mask;
 };
 
 #ifdef CONFIG_MACB_USE_HWSTAMP
index 113e0b61e28400abf180178850e063ac567e2b37..d0d0ee149c55ac643f1650020ae604d1406f1e23 100644 (file)
@@ -59,8 +59,7 @@
 /* level of occupied TX descriptors under which we wake up TX process */
 #define MACB_TX_WAKEUP_THRESH(bp)      (3 * (bp)->tx_ring_size / 4)
 
-#define MACB_RX_INT_FLAGS      (MACB_BIT(RCOMP) | MACB_BIT(RXUBR)      \
-                                | MACB_BIT(ISR_ROVR))
+#define MACB_RX_INT_FLAGS      (MACB_BIT(RCOMP) | MACB_BIT(ISR_ROVR))
 #define MACB_TX_ERR_FLAGS      (MACB_BIT(ISR_TUND)                     \
                                        | MACB_BIT(ISR_RLE)             \
                                        | MACB_BIT(TXERR))
@@ -1349,7 +1348,7 @@ static int macb_poll(struct napi_struct *napi, int budget)
                                queue_writel(queue, ISR, MACB_BIT(RCOMP));
                        napi_reschedule(napi);
                } else {
-                       queue_writel(queue, IER, MACB_RX_INT_FLAGS);
+                       queue_writel(queue, IER, bp->rx_intr_mask);
                }
        }
 
@@ -1367,7 +1366,7 @@ static void macb_hresp_error_task(unsigned long data)
        u32 ctrl;
 
        for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
-               queue_writel(queue, IDR, MACB_RX_INT_FLAGS |
+               queue_writel(queue, IDR, bp->rx_intr_mask |
                                         MACB_TX_INT_FLAGS |
                                         MACB_BIT(HRESP));
        }
@@ -1397,7 +1396,7 @@ static void macb_hresp_error_task(unsigned long data)
 
                /* Enable interrupts */
                queue_writel(queue, IER,
-                            MACB_RX_INT_FLAGS |
+                            bp->rx_intr_mask |
                             MACB_TX_INT_FLAGS |
                             MACB_BIT(HRESP));
        }
@@ -1442,14 +1441,14 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                            (unsigned int)(queue - bp->queues),
                            (unsigned long)status);
 
-               if (status & MACB_RX_INT_FLAGS) {
+               if (status & bp->rx_intr_mask) {
                        /* There's no point taking any more interrupts
                         * until we have processed the buffers. The
                         * scheduling call may fail if the poll routine
                         * is already scheduled, so disable interrupts
                         * now.
                         */
-                       queue_writel(queue, IDR, MACB_RX_INT_FLAGS);
+                       queue_writel(queue, IDR, bp->rx_intr_mask);
                        if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
                                queue_writel(queue, ISR, MACB_BIT(RCOMP));
 
@@ -1479,11 +1478,11 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                /* There is a hardware issue under heavy load where DMA can
                 * stop, this causes endless "used buffer descriptor read"
                 * interrupts but it can be cleared by re-enabling RX. See
-                * the at91 manual, section 41.3.1 or the Zynq manual
-                * section 16.7.4 for details.
+                * the at91rm9200 manual, section 41.3.1 or the Zynq manual
+                * section 16.7.4 for details. RXUBR is only enabled for
+                * these two versions.
                 */
-               if ((bp->errata & MACB_ERRATA_RXLOCKUP) &&
-                   (status & MACB_BIT(RXUBR))) {
+               if (status & MACB_BIT(RXUBR)) {
                        ctrl = macb_readl(bp, NCR);
                        macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));
                        wmb();
@@ -2379,7 +2378,7 @@ static void macb_init_hw(struct macb *bp)
 
                /* Enable interrupts */
                queue_writel(queue, IER,
-                            MACB_RX_INT_FLAGS |
+                            bp->rx_intr_mask |
                             MACB_TX_INT_FLAGS |
                             MACB_BIT(HRESP));
        }
@@ -4071,6 +4070,7 @@ static const struct macb_config sama5d4_config = {
 };
 
 static const struct macb_config emac_config = {
+       .caps = MACB_CAPS_NEEDS_RSTONUBR,
        .clk_init = at91ether_clk_init,
        .init = at91ether_init,
 };
@@ -4094,11 +4094,11 @@ static const struct macb_config zynqmp_config = {
 };
 
 static const struct macb_config zynq_config = {
-       .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF,
+       .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF |
+               MACB_CAPS_NEEDS_RSTONUBR,
        .dma_burst_length = 16,
        .clk_init = macb_clk_init,
        .init = macb_init,
-       .errata = MACB_ERRATA_RXLOCKUP,
 };
 
 static const struct of_device_id macb_dt_ids[] = {
@@ -4205,10 +4205,8 @@ static int macb_probe(struct platform_device *pdev)
        if (tsu_clk)
                bp->tsu_rate = clk_get_rate(tsu_clk);
 
-       if (macb_config) {
+       if (macb_config)
                bp->jumbo_max_len = macb_config->jumbo_max_len;
-               bp->errata = macb_config->errata;
-       }
 
        spin_lock_init(&bp->lock);
 
@@ -4248,6 +4246,10 @@ static int macb_probe(struct platform_device *pdev)
                                                macb_dma_desc_get_size(bp);
        }
 
+       bp->rx_intr_mask = MACB_RX_INT_FLAGS;
+       if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR)
+               bp->rx_intr_mask |= MACB_BIT(RXUBR);
+
        mac = of_get_mac_address(np);
        if (mac) {
                ether_addr_copy(bp->dev->dev_addr, mac);
@@ -4423,7 +4425,7 @@ static int __maybe_unused macb_suspend(struct device *dev)
                macb_writel(bp, IER, MACB_BIT(WOL));
                for (q = 1, queue = bp->queues; q < bp->num_queues;
                     ++q, ++queue) {
-                       queue_writel(queue, IDR, MACB_RX_INT_FLAGS |
+                       queue_writel(queue, IDR, bp->rx_intr_mask |
                                                 MACB_TX_INT_FLAGS |
                                                 MACB_BIT(HRESP));
                }