diff options
Diffstat (limited to 'target/linux/lantiq')
-rw-r--r-- | target/linux/lantiq/patches-4.4/0028-NET-lantiq-various-etop-fixes.patch | 81 | ||||
-rw-r--r-- | target/linux/lantiq/patches-4.4/0160-owrt-lantiq-multiple-flash.patch | 69 |
2 files changed, 78 insertions, 72 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 a236da1efa..81eccf24bc 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,8 +333,7 @@ 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 */ @@ -343,7 +342,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, @@ -382,8 +382,7 @@ 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) +{ @@ -392,21 +391,14 @@ 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); @@ -418,6 +410,15 @@ 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; @@ -655,6 +656,12 @@ 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); @@ -664,12 +671,7 @@ 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; } @@ -789,7 +791,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { -@@ -733,31 +943,62 @@ ltq_etop_probe(struct platform_device *p +@@ -733,30 +943,61 @@ ltq_etop_probe(struct platform_device *p goto err_out; } @@ -823,19 +825,10 @@ 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); @@ -855,18 +848,26 @@ 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); ++ } + + 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; +- } + 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; } diff --git a/target/linux/lantiq/patches-4.4/0160-owrt-lantiq-multiple-flash.patch b/target/linux/lantiq/patches-4.4/0160-owrt-lantiq-multiple-flash.patch index 4c45e4f8a1..087d923f7d 100644 --- a/target/linux/lantiq/patches-4.4/0160-owrt-lantiq-multiple-flash.patch +++ b/target/linux/lantiq/patches-4.4/0160-owrt-lantiq-multiple-flash.patch @@ -82,7 +82,6 @@ - if (!ltq_mtd->res) { - dev_err(&pdev->dev, "failed to get memory resource\n"); - return -ENOENT; -- } + for (i = 0; i < pdev->num_resources; i++) { + printk(KERN_NOTICE "lantiq nor flash device: %.8llx at %.8llx\n", + (unsigned long long)resource_size(&pdev->resource[i]), @@ -95,27 +94,14 @@ + dev_err(&pdev->dev, "Could not reserve memory region\n"); + return -ENOMEM; + } - -- ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), -- GFP_KERNEL); -- if (!ltq_mtd->map) -- return -ENOMEM; ++ + ltq_mtd->map[i].name = ltq_map_name; + ltq_mtd->map[i].bankwidth = 2; + ltq_mtd->map[i].read = ltq_read16; + ltq_mtd->map[i].write = ltq_write16; + ltq_mtd->map[i].copy_from = ltq_copy_from; + ltq_mtd->map[i].copy_to = ltq_copy_to; - -- if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) -- ltq_mtd->map->phys = NO_XIP; -- else -- ltq_mtd->map->phys = ltq_mtd->res->start; -- ltq_mtd->res->start; -- ltq_mtd->map->size = resource_size(ltq_mtd->res); -- ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); -- if (IS_ERR(ltq_mtd->map->virt)) -- return PTR_ERR(ltq_mtd->map->virt); ++ + if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) + ltq_mtd->map[i].phys = NO_XIP; + else @@ -125,30 +111,18 @@ + ltq_mtd->map[i].size); + if (IS_ERR(ltq_mtd->map[i].virt)) + return PTR_ERR(ltq_mtd->map[i].virt); - -- ltq_mtd->map->name = ltq_map_name; -- ltq_mtd->map->bankwidth = 2; -- ltq_mtd->map->read = ltq_read16; -- ltq_mtd->map->write = ltq_write16; -- ltq_mtd->map->copy_from = ltq_copy_from; -- ltq_mtd->map->copy_to = ltq_copy_to; ++ + if (ltq_mtd->map[i].virt == NULL) { + dev_err(&pdev->dev, "Failed to ioremap flash region\n"); + err = PTR_ERR(ltq_mtd->map[i].virt); + goto err_out; + } - -- ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING; -- ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map); -- ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL; ++ + ltq_mtd->map[i].map_priv_1 = LTQ_NOR_PROBING; + for (type = rom_probe_types; !ltq_mtd->mtd[i] && *type; type++) + ltq_mtd->mtd[i] = do_map_probe(*type, <q_mtd->map[i]); + ltq_mtd->map[i].map_priv_1 = LTQ_NOR_NORMAL; - -- if (!ltq_mtd->mtd) { -- dev_err(&pdev->dev, "probing failed\n"); -- return -ENXIO; ++ + if (!ltq_mtd->mtd[i]) { + dev_err(&pdev->dev, "probing failed\n"); + return -ENXIO; @@ -164,7 +138,10 @@ + cfi->addr_unlock2 ^= 1; } -- ltq_mtd->mtd->dev.parent = &pdev->dev; +- ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), +- GFP_KERNEL); +- if (!ltq_mtd->map) +- return -ENOMEM; + if (devices_found == 1) { + ltq_mtd->cmtd = ltq_mtd->mtd[0]; + } else if (devices_found > 1) { @@ -176,6 +153,34 @@ + err = -ENXIO; + } +- if (of_find_property(pdev->dev.of_node, "lantiq,noxip", NULL)) +- ltq_mtd->map->phys = NO_XIP; +- else +- ltq_mtd->map->phys = ltq_mtd->res->start; +- ltq_mtd->res->start; +- ltq_mtd->map->size = resource_size(ltq_mtd->res); +- ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); +- if (IS_ERR(ltq_mtd->map->virt)) +- return PTR_ERR(ltq_mtd->map->virt); +- +- ltq_mtd->map->name = ltq_map_name; +- ltq_mtd->map->bankwidth = 2; +- ltq_mtd->map->read = ltq_read16; +- ltq_mtd->map->write = ltq_write16; +- ltq_mtd->map->copy_from = ltq_copy_from; +- ltq_mtd->map->copy_to = ltq_copy_to; +- +- ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING; +- ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map); +- ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL; +- +- if (!ltq_mtd->mtd) { +- dev_err(&pdev->dev, "probing failed\n"); +- return -ENXIO; +- } +- +- ltq_mtd->mtd->dev.parent = &pdev->dev; +- - cfi = ltq_mtd->map->fldrv_priv; - cfi->addr_unlock1 ^= 1; - cfi->addr_unlock2 ^= 1; |