diff options
Diffstat (limited to 'target/linux/lantiq/patches-3.10/0021-NET-MIPS-lantiq-update-etop-driver-for-devicetree.patch')
-rw-r--r-- | target/linux/lantiq/patches-3.10/0021-NET-MIPS-lantiq-update-etop-driver-for-devicetree.patch | 89 |
1 files changed, 41 insertions, 48 deletions
diff --git a/target/linux/lantiq/patches-3.10/0021-NET-MIPS-lantiq-update-etop-driver-for-devicetree.patch b/target/linux/lantiq/patches-3.10/0021-NET-MIPS-lantiq-update-etop-driver-for-devicetree.patch index 82f8869d52..0474b9e908 100644 --- a/target/linux/lantiq/patches-3.10/0021-NET-MIPS-lantiq-update-etop-driver-for-devicetree.patch +++ b/target/linux/lantiq/patches-3.10/0021-NET-MIPS-lantiq-update-etop-driver-for-devicetree.patch @@ -7,8 +7,6 @@ Subject: [PATCH 21/34] NET: MIPS: lantiq: update etop driver for devicetree drivers/net/ethernet/lantiq_etop.c | 501 +++++++++++++++++++++++++----------- 1 file changed, 355 insertions(+), 146 deletions(-) -diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c -index bfdb0686..cdc0c0e 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c @@ -12,7 +12,7 @@ @@ -35,15 +33,13 @@ index bfdb0686..cdc0c0e 100644 #define ETOP_MII_REVERSE 0xe #define ETOP_PLEN_UNDER 0x40 #define ETOP_CGEN 0x800 -- ++#define ETOP_CFG_MII0 0x01 + -/* use 2 static channels for TX/RX */ -#define LTQ_ETOP_TX_CHANNEL 1 -#define LTQ_ETOP_RX_CHANNEL 6 -#define IS_TX(x) (x == LTQ_ETOP_TX_CHANNEL) -#define IS_RX(x) (x == LTQ_ETOP_RX_CHANNEL) -- -+#define ETOP_CFG_MII0 0x01 -+ +#define LTQ_GBIT_MDIO_CTL 0xCC +#define LTQ_GBIT_MDIO_DATA 0xd0 +#define LTQ_GBIT_GCTL0 0x68 @@ -74,7 +70,7 @@ index bfdb0686..cdc0c0e 100644 +#define MDIO_XR9_REG_OFFSET 0 +#define MDIO_XR9_ADDR_OFFSET 5 +#define MDIO_XR9_WR_OFFSET 16 -+ + +#define LTQ_DMA_ETOP ((of_machine_is_compatible("lantiq,ase")) ? \ + (INT_NUM_IM3_IRL0) : (INT_NUM_IM2_IRL0)) + @@ -142,7 +138,7 @@ index bfdb0686..cdc0c0e 100644 if (!ch->skb[ch->dma.desc]) return -ENOMEM; ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL, -@@ -149,8 +202,11 @@ ltq_etop_hw_receive(struct ltq_etop_chan *ch) +@@ -149,8 +202,11 @@ ltq_etop_hw_receive(struct ltq_etop_chan spin_unlock_irqrestore(&priv->lock, flags); skb_put(skb, len); @@ -154,7 +150,7 @@ index bfdb0686..cdc0c0e 100644 } static int -@@ -158,8 +214,10 @@ ltq_etop_poll_rx(struct napi_struct *napi, int budget) +@@ -158,8 +214,10 @@ ltq_etop_poll_rx(struct napi_struct *nap { struct ltq_etop_chan *ch = container_of(napi, struct ltq_etop_chan, napi); @@ -165,7 +161,7 @@ index bfdb0686..cdc0c0e 100644 while ((rx < budget) && !complete) { struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; -@@ -173,7 +231,9 @@ ltq_etop_poll_rx(struct napi_struct *napi, int budget) +@@ -173,7 +231,9 @@ ltq_etop_poll_rx(struct napi_struct *nap } if (complete || !rx) { napi_complete(&ch->napi); @@ -175,7 +171,7 @@ index bfdb0686..cdc0c0e 100644 } return rx; } -@@ -185,12 +245,14 @@ ltq_etop_poll_tx(struct napi_struct *napi, int budget) +@@ -185,12 +245,14 @@ ltq_etop_poll_tx(struct napi_struct *nap container_of(napi, struct ltq_etop_chan, napi); struct ltq_etop_priv *priv = netdev_priv(ch->netdev); struct netdev_queue *txq = @@ -191,7 +187,7 @@ index bfdb0686..cdc0c0e 100644 dev_kfree_skb_any(ch->skb[ch->tx_free]); ch->skb[ch->tx_free] = NULL; memset(&ch->dma.desc_base[ch->tx_free], 0, -@@ -203,7 +265,9 @@ ltq_etop_poll_tx(struct napi_struct *napi, int budget) +@@ -203,7 +265,9 @@ ltq_etop_poll_tx(struct napi_struct *nap if (netif_tx_queue_stopped(txq)) netif_tx_start_queue(txq); napi_complete(&ch->napi); @@ -215,7 +211,7 @@ index bfdb0686..cdc0c0e 100644 return IRQ_HANDLED; } -@@ -225,7 +290,7 @@ ltq_etop_free_channel(struct net_device *dev, struct ltq_etop_chan *ch) +@@ -225,7 +290,7 @@ ltq_etop_free_channel(struct net_device ltq_dma_free(&ch->dma); if (ch->dma.irq) free_irq(ch->dma.irq, priv); @@ -280,17 +276,17 @@ index bfdb0686..cdc0c0e 100644 struct ltq_etop_priv *priv = netdev_priv(dev); - int i; + int mii_mode = priv->mii_mode; -+ -+ clk_enable(priv->clk_ppe); - ltq_pmu_enable(PMU_PPE); ++ clk_enable(priv->clk_ppe); + +- switch (priv->pldata->mii_mode) { + if (of_machine_is_compatible("lantiq,ar9")) { + ltq_etop_gbit_init(dev); + /* force the etops link to the gbit to MII */ + mii_mode = PHY_INTERFACE_MODE_MII; + } - -- switch (priv->pldata->mii_mode) { ++ + switch (mii_mode) { case PHY_INTERFACE_MODE_RMII: ltq_etop_w32_mask(ETOP_MII_MASK, @@ -386,7 +382,7 @@ index bfdb0686..cdc0c0e 100644 } static void -@@ -312,7 +445,10 @@ ltq_etop_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +@@ -312,7 +445,10 @@ ltq_etop_get_settings(struct net_device { struct ltq_etop_priv *priv = netdev_priv(dev); @@ -398,7 +394,7 @@ index bfdb0686..cdc0c0e 100644 } static int -@@ -320,7 +456,10 @@ ltq_etop_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) +@@ -320,7 +456,10 @@ ltq_etop_set_settings(struct net_device { struct ltq_etop_priv *priv = netdev_priv(dev); @@ -410,7 +406,7 @@ index bfdb0686..cdc0c0e 100644 } static int -@@ -328,7 +467,10 @@ ltq_etop_nway_reset(struct net_device *dev) +@@ -328,7 +467,10 @@ ltq_etop_nway_reset(struct net_device *d { struct ltq_etop_priv *priv = netdev_priv(dev); @@ -422,7 +418,7 @@ index bfdb0686..cdc0c0e 100644 } static const struct ethtool_ops ltq_etop_ethtool_ops = { -@@ -339,6 +481,39 @@ static const struct ethtool_ops ltq_etop_ethtool_ops = { +@@ -339,6 +481,39 @@ static const struct ethtool_ops ltq_etop }; static int @@ -462,18 +458,11 @@ index bfdb0686..cdc0c0e 100644 ltq_etop_mdio_wr(struct mii_bus *bus, int phy_addr, int phy_reg, u16 phy_data) { u32 val = MDIO_REQUEST | -@@ -379,14 +554,18 @@ ltq_etop_mdio_probe(struct net_device *dev) +@@ -379,14 +554,18 @@ ltq_etop_mdio_probe(struct net_device *d { struct ltq_etop_priv *priv = netdev_priv(dev); struct phy_device *phydev = NULL; - int phy_addr; -- -- for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { -- if (priv->mii_bus->phy_map[phy_addr]) { -- phydev = priv->mii_bus->phy_map[phy_addr]; -- break; -- } -- } + u32 phy_supported = (SUPPORTED_10baseT_Half + | SUPPORTED_10baseT_Full + | SUPPORTED_100baseT_Half @@ -481,7 +470,13 @@ index bfdb0686..cdc0c0e 100644 + | SUPPORTED_Autoneg + | SUPPORTED_MII + | SUPPORTED_TP); -+ + +- for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { +- if (priv->mii_bus->phy_map[phy_addr]) { +- phydev = priv->mii_bus->phy_map[phy_addr]; +- break; +- } +- } + if (of_machine_is_compatible("lantiq,ase")) + phydev = priv->mii_bus->phy_map[8]; + else @@ -489,7 +484,7 @@ index bfdb0686..cdc0c0e 100644 if (!phydev) { netdev_err(dev, "no PHY found\n"); -@@ -394,21 +573,18 @@ ltq_etop_mdio_probe(struct net_device *dev) +@@ -394,21 +573,18 @@ ltq_etop_mdio_probe(struct net_device *d } phydev = phy_connect(dev, dev_name(&phydev->dev), @@ -516,7 +511,7 @@ index bfdb0686..cdc0c0e 100644 phydev->advertising = phydev->supported; priv->phydev = phydev; pr_info("%s: attached PHY [%s] (phy_addr=%s, irq=%d)\n", -@@ -433,8 +609,13 @@ ltq_etop_mdio_init(struct net_device *dev) +@@ -433,8 +609,13 @@ ltq_etop_mdio_init(struct net_device *de } priv->mii_bus->priv = dev; @@ -572,6 +567,12 @@ index bfdb0686..cdc0c0e 100644 - phy_stop(priv->phydev); - for (i = 0; i < MAX_DMA_CHAN; i++) { - struct ltq_etop_chan *ch = &priv->ch[i]; +- +- if (!IS_RX(i) && !IS_TX(i)) +- continue; +- napi_disable(&ch->napi); +- ltq_dma_close(&ch->dma); +- } + if (priv->phydev) + phy_stop(priv->phydev); + napi_disable(&priv->txch.napi); @@ -581,16 +582,11 @@ index bfdb0686..cdc0c0e 100644 + ltq_dma_close(&priv->txch.dma); + ltq_dma_close(&priv->rxch.dma); + spin_unlock_irqrestore(&priv->lock, flags); - -- if (!IS_RX(i) && !IS_TX(i)) -- continue; -- napi_disable(&ch->napi); -- ltq_dma_close(&ch->dma); -- } ++ return 0; } -@@ -523,16 +707,16 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev) +@@ -523,16 +707,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); @@ -612,7 +608,7 @@ index bfdb0686..cdc0c0e 100644 netdev_err(dev, "tx ring full\n"); netif_tx_stop_queue(txq); return NETDEV_TX_BUSY; -@@ -540,7 +724,7 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev) +@@ -540,7 +724,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; @@ -621,7 +617,7 @@ index bfdb0686..cdc0c0e 100644 dev->trans_start = jiffies; -@@ -550,11 +734,11 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev) +@@ -550,11 +734,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); @@ -682,7 +678,7 @@ index bfdb0686..cdc0c0e 100644 return 0; err_netdev: -@@ -680,6 +863,9 @@ ltq_etop_tx_timeout(struct net_device *dev) +@@ -680,6 +863,9 @@ ltq_etop_tx_timeout(struct net_device *d err = ltq_etop_hw_init(dev); if (err) goto err_hw; @@ -692,7 +688,7 @@ index bfdb0686..cdc0c0e 100644 dev->trans_start = jiffies; netif_wake_queue(dev); return; -@@ -703,14 +889,18 @@ static const struct net_device_ops ltq_eth_netdev_ops = { +@@ -703,14 +889,18 @@ static const struct net_device_ops ltq_e .ndo_tx_timeout = ltq_etop_tx_timeout, }; @@ -715,7 +711,7 @@ index bfdb0686..cdc0c0e 100644 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { -@@ -736,30 +926,58 @@ ltq_etop_probe(struct platform_device *pdev) +@@ -736,30 +926,58 @@ ltq_etop_probe(struct platform_device *p goto err_out; } @@ -789,7 +785,7 @@ index bfdb0686..cdc0c0e 100644 err = register_netdev(dev); if (err) -@@ -788,32 +1006,23 @@ ltq_etop_remove(struct platform_device *pdev) +@@ -788,32 +1006,23 @@ ltq_etop_remove(struct platform_device * return 0; } @@ -831,6 +827,3 @@ index bfdb0686..cdc0c0e 100644 MODULE_AUTHOR("John Crispin <blogic@openwrt.org>"); MODULE_DESCRIPTION("Lantiq SoC ETOP"); --- -1.7.10.4 - |