diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/macb.c | 33 | ||||
-rw-r--r-- | drivers/net/macb.h | 7 | ||||
-rw-r--r-- | drivers/net/phy/mv88e6xxx/chip.c | 1 | ||||
-rw-r--r-- | drivers/net/smc911x.c | 2 |
4 files changed, 35 insertions, 8 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index a0411d6e4b..c4ab9efb63 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -322,6 +322,29 @@ static void macb_configure_dma(struct macb_device *bp) } } +static int gmac_init_dummy_tx_queues(struct macb_device *macb) +{ + int i, num_queues = 1; + u32 queue_mask; + + /* bit 0 is never set but queue 0 always exists */ + queue_mask = gem_readl(macb, DCFG6) & 0xff; + queue_mask |= 0x1; + + for (i = 1; i < MACB_MAX_QUEUES; i++) + if (queue_mask & (1 << i)) + num_queues++; + + macb->gem_q1_descs[0].addr = 0; + macb->gem_q1_descs[0].ctrl = MACB_BIT(TX_WRAP) | + MACB_BIT(TX_LAST) | MACB_BIT(TX_USED); + + for (i = 1; i < num_queues; i++) + gem_writel_queue_TBQP(macb, &macb->gem_q1_descs[0], i - 1); + + return 0; +} + static void macb_init(struct macb_device *macb) { unsigned long paddr, val = 0; @@ -357,16 +380,13 @@ static void macb_init(struct macb_device *macb) macb_writel(macb, TBQP, (ulong)macb->tx_ring); if (macb->is_gem && macb->gem_q1_descs) { - /* Disable the second priority queue */ - macb->gem_q1_descs[0].addr = 0; - macb->gem_q1_descs[0].ctrl = MACB_BIT(TX_WRAP) | - MACB_BIT(TX_LAST) | - MACB_BIT(TX_USED); + gmac_init_dummy_tx_queues(macb); + + /* Disable the second priority rx queue */ macb->gem_q1_descs[1].addr = MACB_BIT(RX_USED) | MACB_BIT(RX_WRAP); macb->gem_q1_descs[1].ctrl = 0; - gem_writel(macb, TQ1, (ulong)&macb->gem_q1_descs[0]); gem_writel(macb, RQ1, (ulong)&macb->gem_q1_descs[1]); } @@ -750,6 +770,7 @@ static void macb_remove(struct device_d *dev) static const struct of_device_id macb_dt_ids[] = { { .compatible = "cdns,at91sam9260-macb",}, + { .compatible = "atmel,sama5d2-gem",}, { .compatible = "atmel,sama5d3-gem",}, { .compatible = "cdns,zynqmp-gem",}, { /* sentinel */ } diff --git a/drivers/net/macb.h b/drivers/net/macb.h index fda4d08663..2e5b64e5e9 100644 --- a/drivers/net/macb.h +++ b/drivers/net/macb.h @@ -5,6 +5,8 @@ #ifndef __DRIVERS_MACB_H__ #define __DRIVERS_MACB_H__ +#define MACB_MAX_QUEUES 8 + /* MACB register offsets */ #define MACB_NCR 0x0000 #define MACB_NCFGR 0x0004 @@ -75,6 +77,8 @@ #define GEM_TQ1 0x0440 #define GEM_RQ1 0x0480 +#define GEM_TBQP(hw_q) (0x0440 + ((hw_q) << 2)) + /* Bitfields in NCR */ #define MACB_LB_OFFSET 0 #define MACB_LB_SIZE 1 @@ -436,4 +440,7 @@ struct macb_dma_desc { #define MACB_TX_USED_OFFSET 31 #define MACB_TX_USED_SIZE 1 +#define gem_writel_queue_TBQP(port, value, queue_num) \ + writel((value), (port)->regs + GEM_TBQP(queue_num)) + #endif /* __DRIVERS_MACB_H__ */ diff --git a/drivers/net/phy/mv88e6xxx/chip.c b/drivers/net/phy/mv88e6xxx/chip.c index ac08b5ef54..9688dbd1be 100644 --- a/drivers/net/phy/mv88e6xxx/chip.c +++ b/drivers/net/phy/mv88e6xxx/chip.c @@ -572,7 +572,6 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .name = "Marvell 88E6352", .num_ports = 7, .port_base_addr = 0x10, - .ops = &mv88e6352_ops, .global2_addr = 0x1c, .ops = &mv88e6352_ops, }, diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 0d5dcb31ee..ea7cea5f1b 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -540,7 +540,7 @@ static int smc911x_probe(struct device_d *dev) * poll the READY bit in PMT_CTRL. Any other access to the device is * forbidden while this bit isn't set. Try for 100ms */ - ret = wait_on_timeout(100 * MSECOND, !smc911x_reg_read(priv, PMT_CTRL) & PMT_CTRL_READY); + ret = wait_on_timeout(100 * MSECOND, smc911x_reg_read(priv, PMT_CTRL) & PMT_CTRL_READY); if (!ret) { dev_err(dev, "Device not READY in 100ms aborting\n"); return -ENODEV; |