From 3a75777e8670f12b430e709649f21f1a37eebab7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 15 Jun 2016 14:17:27 +0200 Subject: [PATCH] lantiq: refresh patches Signed-off-by: Felix Fietkau --- .../0028-NET-lantiq-various-etop-fixes.patch | 81 +++++++++---------- .../0030-GPIO-add-named-gpio-exports.patch | 14 ++-- ...iq-wifi-and-ethernet-eeprom-handling.patch | 6 +- ...42-arch-mips-increase-io_space_limit.patch | 5 -- .../lantiq/patches-4.4/0047-irq-fixes.patch | 14 ++-- .../0160-owrt-lantiq-multiple-flash.patch | 69 ++++++++-------- 6 files changed, 89 insertions(+), 100 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 + +#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 +#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 - 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 + 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 - 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 + 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 - 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 - 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 + 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 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 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 + 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; } diff --git a/target/linux/lantiq/patches-4.4/0030-GPIO-add-named-gpio-exports.patch b/target/linux/lantiq/patches-4.4/0030-GPIO-add-named-gpio-exports.patch index 4250398634..1148ec4e26 100644 --- a/target/linux/lantiq/patches-4.4/0030-GPIO-add-named-gpio-exports.patch +++ b/target/linux/lantiq/patches-4.4/0030-GPIO-add-named-gpio-exports.patch @@ -22,7 +22,7 @@ Signed-off-by: John Crispin #include "gpiolib.h" -@@ -450,3 +452,73 @@ +@@ -450,3 +452,73 @@ void of_gpiochip_remove(struct gpio_chip gpiochip_remove_pin_ranges(chip); of_node_put(chip->of_node); } @@ -98,7 +98,7 @@ Signed-off-by: John Crispin +#endif --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h -@@ -122,6 +122,12 @@ +@@ -122,6 +122,12 @@ static inline int gpio_export(unsigned g return gpiod_export(gpio_to_desc(gpio), direction_may_change); } @@ -113,7 +113,7 @@ Signed-off-by: John Crispin { --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h -@@ -427,6 +427,7 @@ +@@ -427,6 +427,7 @@ static inline struct gpio_desc *devm_get #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) @@ -121,7 +121,7 @@ Signed-off-by: John Crispin int gpiod_export(struct gpio_desc *desc, bool direction_may_change); int gpiod_export_link(struct device *dev, const char *name, struct gpio_desc *desc); -@@ -434,6 +435,13 @@ +@@ -434,6 +435,13 @@ void gpiod_unexport(struct gpio_desc *de #else /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */ @@ -137,7 +137,7 @@ Signed-off-by: John Crispin { --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c -@@ -544,7 +544,7 @@ +@@ -544,7 +544,7 @@ static struct class gpio_class = { * * Returns zero on success, else an error. */ @@ -146,7 +146,7 @@ Signed-off-by: John Crispin { struct gpio_chip *chip; struct gpiod_data *data; -@@ -604,6 +604,8 @@ +@@ -604,6 +604,8 @@ int gpiod_export(struct gpio_desc *desc, offset = gpio_chip_hwgpio(desc); if (chip->names && chip->names[offset]) ioname = chip->names[offset]; @@ -155,7 +155,7 @@ Signed-off-by: John Crispin dev = device_create_with_groups(&gpio_class, chip->dev, MKDEV(0, 0), data, gpio_groups, -@@ -625,6 +627,12 @@ +@@ -625,6 +627,12 @@ err_unlock: gpiod_dbg(desc, "%s: status %d\n", __func__, status); return status; } diff --git a/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch b/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch index 07e6a001eb..7116b89230 100644 --- a/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch +++ b/target/linux/lantiq/patches-4.4/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch @@ -30,7 +30,7 @@ Signed-off-by: John Crispin +#endif /* _PCI_ATH_FIXUP */ --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h -@@ -104,5 +104,8 @@ +@@ -104,5 +104,8 @@ int xrx200_gphy_boot(struct device *dev, extern void ltq_pmu_enable(unsigned int module); extern void ltq_pmu_disable(unsigned int module); @@ -41,7 +41,7 @@ Signed-off-by: John Crispin #endif /* _LTQ_XWAY_H__ */ --- a/arch/mips/lantiq/xway/Makefile +++ b/arch/mips/lantiq/xway/Makefile -@@ -2,4 +2,7 @@ +@@ -2,4 +2,7 @@ obj-y := prom.o sysctrl.o clk.o reset.o obj-y += vmmc.o tffs.o @@ -624,7 +624,7 @@ Signed-off-by: John Crispin +device_initcall(of_ralink_eeprom_init); --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c -@@ -840,7 +840,11 @@ +@@ -840,7 +840,11 @@ ltq_etop_init(struct net_device *dev) if (err) goto err_hw; diff --git a/target/linux/lantiq/patches-4.4/0042-arch-mips-increase-io_space_limit.patch b/target/linux/lantiq/patches-4.4/0042-arch-mips-increase-io_space_limit.patch index 1d131f5e71..14b417e690 100644 --- a/target/linux/lantiq/patches-4.4/0042-arch-mips-increase-io_space_limit.patch +++ b/target/linux/lantiq/patches-4.4/0042-arch-mips-increase-io_space_limit.patch @@ -10,8 +10,6 @@ Signed-off-by: John Crispin arch/mips/include/asm/io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h -index d10fd80..d42eac9 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -50,7 +50,7 @@ @@ -23,6 +21,3 @@ index d10fd80..d42eac9 100644 /* * On MIPS I/O ports are memory mapped, so we access them using normal --- -1.7.10.4 - diff --git a/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch b/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch index f11e057a80..9efa63d35a 100644 --- a/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch +++ b/target/linux/lantiq/patches-4.4/0047-irq-fixes.patch @@ -1,6 +1,6 @@ --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c -@@ -67,7 +67,7 @@ +@@ -67,7 +67,7 @@ int gic_present; #endif static int exin_avail; @@ -9,7 +9,7 @@ static void __iomem *ltq_icu_membase[MAX_IM]; static void __iomem *ltq_eiu_membase; static struct irq_domain *ltq_domain; -@@ -76,7 +76,7 @@ +@@ -76,7 +76,7 @@ static int ltq_perfcount_irq; int ltq_eiu_get_irq(int exin) { if (exin < exin_avail) @@ -18,7 +18,7 @@ return -1; } -@@ -128,7 +128,7 @@ +@@ -128,7 +128,7 @@ static int ltq_eiu_settype(struct irq_da int i; for (i = 0; i < MAX_EIU; i++) { @@ -27,7 +27,7 @@ int val = 0; int edge = 0; -@@ -176,7 +176,7 @@ +@@ -176,7 +176,7 @@ static unsigned int ltq_startup_eiu_irq( ltq_enable_irq(d); for (i = 0; i < MAX_EIU; i++) { @@ -36,7 +36,7 @@ /* by default we are low level triggered */ ltq_eiu_settype(d, IRQF_TRIGGER_LOW); /* clear all pending */ -@@ -198,7 +198,7 @@ +@@ -198,7 +198,7 @@ static void ltq_shutdown_eiu_irq(struct ltq_disable_irq(d); for (i = 0; i < MAX_EIU; i++) { @@ -45,7 +45,7 @@ /* disable */ ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~BIT(i), LTQ_EIU_EXIN_INEN); -@@ -343,10 +343,10 @@ +@@ -343,10 +343,10 @@ static int icu_map(struct irq_domain *d, return 0; for (i = 0; i < exin_avail; i++) @@ -58,7 +58,7 @@ return 0; } -@@ -441,14 +441,14 @@ +@@ -441,14 +441,14 @@ int __init icu_of_init(struct device_nod eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { /* find out how many external irq sources we have */ 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 087d923f7d..4c45e4f8a1 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,6 +82,7 @@ - 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]), @@ -94,14 +95,27 @@ + 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 @@ -111,18 +125,30 @@ + 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; @@ -138,10 +164,7 @@ + cfi->addr_unlock2 ^= 1; } -- ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), -- GFP_KERNEL); -- if (!ltq_mtd->map) -- return -ENOMEM; +- ltq_mtd->mtd->dev.parent = &pdev->dev; + if (devices_found == 1) { + ltq_mtd->cmtd = ltq_mtd->mtd[0]; + } else if (devices_found > 1) { @@ -153,34 +176,6 @@ + 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; -- 2.25.1