Skip to content

Commit

Permalink
net: macb: Apply RXUBR workaround only to versions with errata
Browse files Browse the repository at this point in the history
The interrupt handler contains a workaround for RX hang applicable
to Zynq and AT91 only. Subsequent versions do not need this
workaround. Hence introduce an errata field and a check to enable
this workaround only for Zynq (Can add further non-Xilinx devices
after checking with mainline).

A customer reported an issue when using this workaround on ZynqMP.
RX used bit read (RXUBR) is observed whenever there's no free BDs.
But if driver resets RX whenever this occurs, when the DMA clearly
does not hang, there is a minute possibility that one of the RX BDs
is skipped.

Signed-off-by: Harini Katakam <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
  • Loading branch information
harini-katakam authored and Michal Simek committed Nov 27, 2018
1 parent 3248097 commit acbe29b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ethernet/cadence/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@
#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
Expand Down Expand Up @@ -969,6 +972,7 @@ 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 {
Expand Down Expand Up @@ -1084,6 +1088,8 @@ struct macb {
struct ptp_clock_info ptp_clock_info;
struct tsu_incr tsu_incr;
struct hwtstamp_config tstamp_config;

u32 errata;
};

#ifdef CONFIG_MACB_USE_HWSTAMP
Expand Down
8 changes: 6 additions & 2 deletions drivers/net/ethernet/cadence/macb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
* the at91 manual, section 41.3.1 or the Zynq manual
* section 16.7.4 for details.
*/
if (status & MACB_BIT(RXUBR)) {
if ((bp->errata & MACB_ERRATA_RXLOCKUP) &&
(status & MACB_BIT(RXUBR))) {
ctrl = macb_readl(bp, NCR);
macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));
wmb();
Expand Down Expand Up @@ -3587,6 +3588,7 @@ static const struct macb_config zynq_config = {
.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[] = {
Expand Down Expand Up @@ -3692,8 +3694,10 @@ 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);

Expand Down

0 comments on commit acbe29b

Please sign in to comment.