diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-06-15 14:17:27 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-06-15 14:36:47 +0200 |
commit | 3a75777e8670f12b430e709649f21f1a37eebab7 (patch) | |
tree | 486e58d20d838ce0efd9e7d6da1d42b7f8d427bb /target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch | |
parent | ad76366d7ddfe83a0ca2f28d4104697e81c3c3cd (diff) | |
download | upstream-3a75777e8670f12b430e709649f21f1a37eebab7.tar.gz upstream-3a75777e8670f12b430e709649f21f1a37eebab7.tar.bz2 upstream-3a75777e8670f12b430e709649f21f1a37eebab7.zip |
lantiq: refresh patches
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch')
-rw-r--r-- | target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch b/target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch index 81eccf24bc..a236da1efa 100644 --- a/target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch +++ b/target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch @@ -104,7 +104,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + +#define PMAC_HD_CTL_AS (1 << 19) +#define PMAC_HD_CTL_RXSH (1 << 22) -+ + +/* Switch Enable (0=disable, 1=enable) */ +#define GCTL0_SE 0x80000000 +/* Disable MDIO auto polling (0=disable, 1=enable) */ @@ -124,7 +124,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> +#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)) + @@ -333,7 +333,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org> - 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 */ @@ -342,8 +343,7 @@ 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, @@ -382,7 +382,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org> - ltq_etop_w32(PPE32_CGEN, LQ_PPE32_ENET_MAC_CFG); + return 0; +} -+ + +- ltq_dma_init_port(DMA_PORT_ETOP); +static int +ltq_etop_dma_init(struct net_device *dev) +{ @@ -391,14 +392,21 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + int rx = priv->rx_irq - LTQ_DMA_ETOP; + int err; - ltq_dma_init_port(DMA_PORT_ETOP); - - for (i = 0; i < MAX_DMA_CHAN; i++) { - int irq = LTQ_DMA_CH0_INT + i; - struct ltq_etop_chan *ch = &priv->ch[i]; -- ++ ltq_dma_init_port(DMA_PORT_ETOP); + - ch->idx = ch->dma.nr = i; -- ++ priv->txch.dma.nr = tx; ++ ltq_dma_alloc_tx(&priv->txch.dma); ++ err = request_irq(priv->tx_irq, ltq_etop_dma_irq, 0, "eth_tx", priv); ++ if (err) { ++ netdev_err(dev, "failed to allocate tx irq\n"); ++ goto err_out; ++ } ++ priv->txch.dma.irq = priv->tx_irq; + - if (IS_TX(i)) { - ltq_dma_alloc_tx(&ch->dma); - request_irq(irq, ltq_etop_dma_irq, 0, "etop_tx", priv); @@ -410,15 +418,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org> - return -ENOMEM; - ch->dma.desc = 0; - request_irq(irq, ltq_etop_dma_irq, 0, "etop_rx", priv); -+ priv->txch.dma.nr = tx; -+ ltq_dma_alloc_tx(&priv->txch.dma); -+ err = request_irq(priv->tx_irq, ltq_etop_dma_irq, 0, "eth_tx", priv); -+ if (err) { -+ netdev_err(dev, "failed to allocate tx irq\n"); -+ goto err_out; -+ } -+ priv->txch.dma.irq = priv->tx_irq; -+ + priv->rxch.dma.nr = rx; + ltq_dma_alloc_rx(&priv->rxch.dma); + for (priv->rxch.dma.desc = 0; priv->rxch.dma.desc < LTQ_DESC_NUM; @@ -656,12 +655,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org> - 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); @@ -671,7 +664,12 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + 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; } @@ -791,7 +789,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { -@@ -733,30 +943,61 @@ ltq_etop_probe(struct platform_device *p +@@ -733,31 +943,62 @@ ltq_etop_probe(struct platform_device *p goto err_out; } @@ -825,10 +823,19 @@ Signed-off-by: John Crispin <blogic@openwrt.org> priv->pdev = pdev; - priv->pldata = dev_get_platdata(&pdev->dev); priv->netdev = dev; +- spin_lock_init(&priv->lock); + priv->tx_irq = irqres[0].start; + priv->rx_irq = irqres[1].start; + priv->mii_mode = of_get_phy_mode(pdev->dev.of_node); -+ + +- for (i = 0; i < MAX_DMA_CHAN; i++) { +- if (IS_TX(i)) +- netif_napi_add(dev, &priv->ch[i].napi, +- ltq_etop_poll_tx, 8); +- else if (IS_RX(i)) +- netif_napi_add(dev, &priv->ch[i].napi, +- ltq_etop_poll_rx, 32); +- priv->ch[i].netdev = dev; + mac = of_get_mac_address(pdev->dev.of_node); + if (mac) + memcpy(priv->mac, mac, ETH_ALEN); @@ -848,26 +855,18 @@ Signed-off-by: John Crispin <blogic@openwrt.org> + priv->clk_ephycgu = clk_get(&pdev->dev, "ephycgu"); + if (IS_ERR(priv->clk_ephycgu)) + return PTR_ERR(priv->clk_ephycgu); -+ } -+ - spin_lock_init(&priv->lock); + } -- for (i = 0; i < MAX_DMA_CHAN; i++) { -- if (IS_TX(i)) -- netif_napi_add(dev, &priv->ch[i].napi, -- ltq_etop_poll_tx, 8); -- else if (IS_RX(i)) -- netif_napi_add(dev, &priv->ch[i].napi, -- ltq_etop_poll_rx, 32); -- priv->ch[i].netdev = dev; -- } ++ spin_lock_init(&priv->lock); ++ + netif_napi_add(dev, &priv->txch.napi, ltq_etop_poll_tx, 8); + netif_napi_add(dev, &priv->rxch.napi, ltq_etop_poll_rx, 32); + priv->txch.netdev = dev; + priv->rxch.netdev = dev; - ++ err = register_netdev(dev); if (err) + goto err_free; @@ -785,31 +1026,22 @@ ltq_etop_remove(struct platform_device * return 0; } |