diff options
Diffstat (limited to 'target/linux/lantiq/patches-4.19/0028-NET-lantiq-various-etop-fixes.patch')
-rw-r--r-- | target/linux/lantiq/patches-4.19/0028-NET-lantiq-various-etop-fixes.patch | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/target/linux/lantiq/patches-4.19/0028-NET-lantiq-various-etop-fixes.patch b/target/linux/lantiq/patches-4.19/0028-NET-lantiq-various-etop-fixes.patch index 83aef78ca0..6899a96cc6 100644 --- a/target/linux/lantiq/patches-4.19/0028-NET-lantiq-various-etop-fixes.patch +++ b/target/linux/lantiq/patches-4.19/0028-NET-lantiq-various-etop-fixes.patch @@ -165,14 +165,15 @@ Signed-off-by: John Crispin <blogic@openwrt.org> - int tx_free[MAX_DMA_CHAN >> 1]; + struct ltq_etop_chan txch; + struct ltq_etop_chan rxch; -+ + +- spinlock_t lock; + int tx_irq; + int rx_irq; + + unsigned char mac[6]; + int mii_mode; - - spinlock_t lock; ++ ++ spinlock_t lock; + + struct clk *clk_ppe; + struct clk *clk_switch; @@ -272,7 +273,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> int desc; for (desc = 0; desc < LTQ_DESC_NUM; desc++) dev_kfree_skb_any(ch->skb[ch->dma.desc]); -@@ -231,65 +308,133 @@ static void +@@ -231,66 +308,135 @@ static void ltq_etop_hw_exit(struct net_device *dev) { struct ltq_etop_priv *priv = netdev_priv(dev); @@ -328,11 +329,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org> struct ltq_etop_priv *priv = netdev_priv(dev); - int i; + int mii_mode = priv->mii_mode; - -- ltq_pmu_enable(PMU_PPE); ++ + clk_enable(priv->clk_ppe); -- switch (priv->pldata->mii_mode) { +- ltq_pmu_enable(PMU_PPE); + if (of_machine_is_compatible("lantiq,ar9")) { + ltq_etop_gbit_init(dev); + /* force the etops link to the gbit to MII */ @@ -341,7 +341,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + ltq_etop_w32_mask(MDIO_CFG_MASK, 0, LTQ_ETOP_MDIO_CFG); + ltq_etop_w32_mask(MAC_CFG_MASK, MAC_CFG_CGEN | MAC_CFG_DUPLEX | + MAC_CFG_SPEED | MAC_CFG_LINK, LTQ_ETOP_MAC_CFG); -+ + +- switch (priv->pldata->mii_mode) { + switch (mii_mode) { case PHY_INTERFACE_MODE_RMII: - ltq_etop_w32_mask(ETOP_MII_MASK, @@ -396,6 +397,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> - struct ltq_etop_chan *ch = &priv->ch[i]; - - ch->idx = ch->dma.nr = i; +- ch->dma.dev = &priv->pdev->dev; - - if (IS_TX(i)) { - ltq_dma_alloc_tx(&ch->dma); @@ -409,6 +411,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> - ch->dma.desc = 0; - request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); + priv->txch.dma.nr = tx; ++ priv->txch.dma.dev = &priv->pdev->dev; + ltq_dma_alloc_tx(&priv->txch.dma); + err = request_irq(priv->tx_irq, ltq_etop_dma_irq, 0, "eth_tx", priv); + if (err) { @@ -418,6 +421,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + priv->txch.dma.irq = priv->tx_irq; + + priv->rxch.dma.nr = rx; ++ priv->rxch.dma.dev = &priv->pdev->dev; + ltq_dma_alloc_rx(&priv->rxch.dma); + for (priv->rxch.dma.desc = 0; priv->rxch.dma.desc < LTQ_DESC_NUM; + priv->rxch.dma.desc++) { @@ -440,7 +444,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> } static void -@@ -308,6 +453,39 @@ static const struct ethtool_ops ltq_etop +@@ -309,6 +455,39 @@ static const struct ethtool_ops ltq_etop }; static int @@ -480,7 +484,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, int phy_reg, u16 phy_data) { u32 val = MDIO_REQUEST | -@@ -315,9 +493,9 @@ ltq_etop_mdio_wr(struct mii_bus *bus, in +@@ -316,9 +495,9 @@ ltq_etop_mdio_wr(struct mii_bus *bus, in ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET) | phy_data; @@ -492,7 +496,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return 0; } -@@ -328,12 +506,12 @@ ltq_etop_mdio_rd(struct mii_bus *bus, in +@@ -329,12 +508,12 @@ ltq_etop_mdio_rd(struct mii_bus *bus, in ((phy_addr & MDIO_ADDR_MASK) << MDIO_ADDR_OFFSET) | ((phy_reg & MDIO_REG_MASK) << MDIO_REG_OFFSET); @@ -509,7 +513,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return val; } -@@ -348,8 +526,18 @@ ltq_etop_mdio_probe(struct net_device *d +@@ -349,8 +528,18 @@ ltq_etop_mdio_probe(struct net_device *d { struct ltq_etop_priv *priv = netdev_priv(dev); struct phy_device *phydev; @@ -529,7 +533,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> if (!phydev) { netdev_err(dev, "no PHY found\n"); -@@ -357,21 +545,18 @@ ltq_etop_mdio_probe(struct net_device *d +@@ -358,21 +547,18 @@ ltq_etop_mdio_probe(struct net_device *d } phydev = phy_connect(dev, phydev_name(phydev), @@ -556,7 +560,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> phydev->advertising = phydev->supported; phy_attached_info(phydev); -@@ -392,8 +577,13 @@ ltq_etop_mdio_init(struct net_device *de +@@ -393,8 +579,13 @@ ltq_etop_mdio_init(struct net_device *de } priv->mii_bus->priv = dev; @@ -572,7 +576,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> priv->mii_bus->name = "ltq_mii"; snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", priv->pdev->name, priv->pdev->id); -@@ -430,17 +620,19 @@ static int +@@ -431,17 +622,19 @@ static int ltq_etop_open(struct net_device *dev) { struct ltq_etop_priv *priv = netdev_priv(dev); @@ -601,7 +605,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> netif_tx_start_all_queues(dev); return 0; } -@@ -449,18 +641,19 @@ static int +@@ -450,18 +643,19 @@ static int ltq_etop_stop(struct net_device *dev) { struct ltq_etop_priv *priv = netdev_priv(dev); @@ -631,7 +635,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return 0; } -@@ -470,16 +663,16 @@ ltq_etop_tx(struct sk_buff *skb, struct +@@ -471,16 +665,16 @@ ltq_etop_tx(struct sk_buff *skb, struct int queue = skb_get_queue_mapping(skb); struct netdev_queue *txq = netdev_get_tx_queue(dev, queue); struct ltq_etop_priv *priv = netdev_priv(dev); @@ -653,7 +657,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> netdev_err(dev, "tx ring full\n"); netif_tx_stop_queue(txq); return NETDEV_TX_BUSY; -@@ -487,7 +680,7 @@ ltq_etop_tx(struct sk_buff *skb, struct +@@ -488,7 +682,7 @@ ltq_etop_tx(struct sk_buff *skb, struct /* dma needs to start on a 16 byte aligned address */ byte_offset = CPHYSADDR(skb->data) % 16; @@ -662,7 +666,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> netif_trans_update(dev); -@@ -497,11 +690,11 @@ ltq_etop_tx(struct sk_buff *skb, struct +@@ -498,11 +692,11 @@ ltq_etop_tx(struct sk_buff *skb, struct wmb(); desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP | LTQ_DMA_TX_OFFSET(byte_offset) | (len & LTQ_DMA_SIZE_MASK); @@ -677,7 +681,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> netif_tx_stop_queue(txq); return NETDEV_TX_OK; -@@ -515,8 +708,10 @@ ltq_etop_change_mtu(struct net_device *d +@@ -516,8 +710,10 @@ ltq_etop_change_mtu(struct net_device *d dev->mtu = new_mtu; @@ -689,7 +693,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> spin_unlock_irqrestore(&priv->lock, flags); return 0; -@@ -584,6 +779,9 @@ ltq_etop_init(struct net_device *dev) +@@ -577,6 +773,9 @@ ltq_etop_init(struct net_device *dev) if (err) goto err_hw; ltq_etop_change_mtu(dev, 1500); @@ -699,7 +703,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr)); if (!is_valid_ether_addr(mac.sa_data)) { -@@ -601,9 +799,10 @@ ltq_etop_init(struct net_device *dev) +@@ -594,9 +793,10 @@ ltq_etop_init(struct net_device *dev) dev->addr_assign_type = NET_ADDR_RANDOM; ltq_etop_set_multicast_list(dev); @@ -713,7 +717,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> return 0; err_netdev: -@@ -623,6 +822,9 @@ ltq_etop_tx_timeout(struct net_device *d +@@ -616,6 +816,9 @@ ltq_etop_tx_timeout(struct net_device *d err = ltq_etop_hw_init(dev); if (err) goto err_hw; @@ -723,7 +727,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> netif_trans_update(dev); netif_wake_queue(dev); return; -@@ -646,14 +848,19 @@ static const struct net_device_ops ltq_e +@@ -639,14 +842,19 @@ static const struct net_device_ops ltq_e .ndo_tx_timeout = ltq_etop_tx_timeout, }; @@ -747,7 +751,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { -@@ -679,31 +886,62 @@ ltq_etop_probe(struct platform_device *p +@@ -672,31 +880,62 @@ ltq_etop_probe(struct platform_device *p goto err_out; } @@ -825,7 +829,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> err = register_netdev(dev); if (err) -@@ -732,31 +970,22 @@ ltq_etop_remove(struct platform_device * +@@ -725,31 +964,22 @@ ltq_etop_remove(struct platform_device * return 0; } |