From: Florian Fainelli Date: Mon, 3 Aug 2009 21:32:31 +0000 (+0000) Subject: add fixed PHY patches from 2.6.27, refresh patches X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=25b42557da28fb6786653b854ca8b13a86c99ec1;p=openwrt%2Fstaging%2Faparcar.git add fixed PHY patches from 2.6.27, refresh patches SVN-Revision: 17110 --- diff --git a/target/linux/ar7/patches-2.6.30/100-board_support.patch b/target/linux/ar7/patches-2.6.30/100-board_support.patch index c3fad1653a..079f9c0a8c 100644 --- a/target/linux/ar7/patches-2.6.30/100-board_support.patch +++ b/target/linux/ar7/patches-2.6.30/100-board_support.patch @@ -27,7 +27,7 @@ --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c -@@ -1203,9 +1203,22 @@ void *set_except_vector(int n, void *add +@@ -1256,9 +1256,22 @@ void *set_except_vector(int n, void *add exception_handlers[n] = handler; if (n == 0 && cpu_has_divec) { @@ -55,7 +55,7 @@ } --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -167,6 +167,13 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/s +@@ -174,6 +174,13 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/s # # @@ -71,7 +71,7 @@ core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/ --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h -@@ -182,8 +182,10 @@ typedef struct { unsigned long pgprot; } +@@ -185,8 +185,10 @@ typedef struct { unsigned long pgprot; } #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) diff --git a/target/linux/ar7/patches-2.6.30/130-vlynq.patch b/target/linux/ar7/patches-2.6.30/130-vlynq.patch index 9ab3638eaa..12eb538466 100644 --- a/target/linux/ar7/patches-2.6.30/130-vlynq.patch +++ b/target/linux/ar7/patches-2.6.30/130-vlynq.patch @@ -1,20 +1,21 @@ --- a/drivers/Kconfig +++ b/drivers/Kconfig -@@ -100,5 +100,7 @@ source "drivers/auxdisplay/Kconfig" +@@ -104,6 +104,8 @@ source "drivers/auxdisplay/Kconfig" source "drivers/uio/Kconfig" +source "drivers/vlynq/Kconfig" + source "drivers/xen/Kconfig" - endmenu + + source "drivers/staging/Kconfig" --- a/drivers/Makefile +++ b/drivers/Makefile -@@ -96,6 +96,7 @@ obj-$(CONFIG_DCA) += dca/ +@@ -103,6 +103,7 @@ obj-$(CONFIG_DCA) += dca/ obj-$(CONFIG_HID) += hid/ obj-$(CONFIG_PPC_PS3) += ps3/ obj-$(CONFIG_OF) += of/ +obj-$(CONFIG_VLYNQ) += vlynq/ obj-$(CONFIG_SSB) += ssb/ obj-$(CONFIG_VIRTIO) += virtio/ - obj-$(CONFIG_REGULATOR) += regulator/ + obj-$(CONFIG_STAGING) += staging/ diff --git a/target/linux/ar7/patches-2.6.30/131-vlynq_fixes.patch b/target/linux/ar7/patches-2.6.30/131-vlynq_fixes.patch index f68ae4c70e..1f11627d61 100644 --- a/target/linux/ar7/patches-2.6.30/131-vlynq_fixes.patch +++ b/target/linux/ar7/patches-2.6.30/131-vlynq_fixes.patch @@ -1,5 +1,5 @@ ---- a/drivers/vlynq/vlynq.c 2009-05-31 20:41:57.000000000 +0200 -+++ b/drivers/vlynq/vlynq.c 2009-07-28 21:27:52.000000000 +0200 +--- a/drivers/vlynq/vlynq.c ++++ b/drivers/vlynq/vlynq.c @@ -14,6 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software @@ -18,7 +18,7 @@ #include #include -@@ -73,15 +75,11 @@ +@@ -73,15 +75,11 @@ struct vlynq_regs { u32 int_device[8]; }; @@ -36,7 +36,7 @@ printk(KERN_DEBUG "VLYNQ local=%p remote=%p\n", dev->local, dev->remote); for (i = 0; i < 32; i++) { -@@ -95,20 +93,23 @@ +@@ -95,20 +93,23 @@ static void vlynq_dump_regs(struct vlynq static void vlynq_dump_mem(u32 *base, int count) { int i; @@ -63,7 +63,7 @@ return 1; else cpu_relax(); -@@ -118,17 +119,15 @@ +@@ -118,17 +119,15 @@ int vlynq_linked(struct vlynq_device *de static void vlynq_reset(struct vlynq_device *dev) { @@ -85,7 +85,7 @@ /* Give some time for the devices to settle */ msleep(5); -@@ -142,9 +141,9 @@ +@@ -142,9 +141,9 @@ static void vlynq_irq_unmask(unsigned in BUG_ON(!dev); virq = irq - dev->irq_start; @@ -97,7 +97,7 @@ } static void vlynq_irq_mask(unsigned int irq) -@@ -155,9 +154,9 @@ +@@ -155,9 +154,9 @@ static void vlynq_irq_mask(unsigned int BUG_ON(!dev); virq = irq - dev->irq_start; @@ -109,7 +109,7 @@ } static int vlynq_irq_type(unsigned int irq, unsigned int flow_type) -@@ -168,7 +167,7 @@ +@@ -168,7 +167,7 @@ static int vlynq_irq_type(unsigned int i BUG_ON(!dev); virq = irq - dev->irq_start; @@ -118,7 +118,7 @@ switch (flow_type & IRQ_TYPE_SENSE_MASK) { case IRQ_TYPE_EDGE_RISING: case IRQ_TYPE_EDGE_FALLING: -@@ -187,28 +186,30 @@ +@@ -187,28 +186,30 @@ static int vlynq_irq_type(unsigned int i default: return -EINVAL; } @@ -160,7 +160,7 @@ } static irqreturn_t vlynq_irq(int irq, void *dev_id) -@@ -217,8 +218,8 @@ +@@ -217,8 +218,8 @@ static irqreturn_t vlynq_irq(int irq, vo u32 status; int virq = 0; @@ -171,7 +171,7 @@ if (unlikely(!status)) spurious_interrupt(); -@@ -262,28 +263,28 @@ +@@ -262,28 +263,28 @@ static int vlynq_setup_irq(struct vlynq_ if (dev->local_irq == dev->remote_irq) { printk(KERN_ERR "%s: local vlynq irq should be different from remote\n", @@ -210,7 +210,7 @@ for (i = dev->irq_start; i <= dev->irq_end; i++) { virq = i - dev->irq_start; -@@ -299,12 +300,13 @@ +@@ -299,12 +300,13 @@ static int vlynq_setup_irq(struct vlynq_ set_irq_chip_and_handler(i, &vlynq_irq_chip, handle_simple_irq); set_irq_chip_data(i, dev); @@ -226,7 +226,7 @@ return -EAGAIN; } -@@ -328,11 +330,11 @@ +@@ -328,11 +330,11 @@ static int vlynq_device_match(struct dev if (ids->id == vdev->dev_id) { vdev->divisor = ids->divisor; vlynq_set_drvdata(vdev, ids); @@ -240,7 +240,7 @@ " for VLYNQ device: %08x\n", ids->id, vdev->dev_id); ids++; } -@@ -346,8 +348,7 @@ +@@ -346,8 +348,7 @@ static int vlynq_device_probe(struct dev struct vlynq_device_id *id = vlynq_get_drvdata(vdev); int result = -ENODEV; @@ -250,7 +250,7 @@ result = drv->probe(vdev, id); if (result) put_device(dev); -@@ -357,9 +358,10 @@ +@@ -357,9 +358,10 @@ static int vlynq_device_probe(struct dev static int vlynq_device_remove(struct device *dev) { struct vlynq_driver *drv = to_vlynq_driver(dev->driver); @@ -263,7 +263,7 @@ return 0; } -@@ -377,6 +379,14 @@ +@@ -377,6 +379,14 @@ void vlynq_unregister_driver(struct vlyn } EXPORT_SYMBOL(vlynq_unregister_driver); @@ -278,7 +278,7 @@ static int __vlynq_try_remote(struct vlynq_device *dev) { int i; -@@ -389,21 +399,21 @@ +@@ -389,21 +399,21 @@ static int __vlynq_try_remote(struct vly if (!vlynq_linked(dev)) break; @@ -307,7 +307,7 @@ dev->divisor = i; return 0; } else { -@@ -414,26 +424,33 @@ +@@ -414,26 +424,33 @@ static int __vlynq_try_remote(struct vly return -ENODEV; } @@ -346,7 +346,7 @@ dev->divisor = i; return 0; } else { -@@ -444,27 +461,33 @@ +@@ -444,27 +461,33 @@ static int __vlynq_try_local(struct vlyn return -ENODEV; } @@ -389,7 +389,7 @@ return -ENODEV; } -@@ -481,10 +504,10 @@ +@@ -481,10 +504,10 @@ static int __vlynq_enable_device(struct case vlynq_div_external: case vlynq_div_auto: /* When the device is brought from reset it should have clock @@ -404,7 +404,7 @@ VLYNQ_CTRL_CLOCK_INT) { if (!__vlynq_try_remote(dev) || !__vlynq_try_local(dev) || -@@ -497,31 +520,43 @@ +@@ -497,31 +520,43 @@ static int __vlynq_enable_device(struct return 0; } break; @@ -466,7 +466,7 @@ return 0; } break; -@@ -568,12 +603,10 @@ +@@ -568,12 +603,10 @@ int vlynq_set_local_mapping(struct vlynq if (!dev->enabled) return -ENXIO; @@ -482,7 +482,7 @@ } return 0; } -@@ -587,12 +620,10 @@ +@@ -587,12 +620,10 @@ int vlynq_set_remote_mapping(struct vlyn if (!dev->enabled) return -ENXIO; @@ -498,7 +498,7 @@ } return 0; } -@@ -662,8 +693,7 @@ +@@ -662,8 +693,7 @@ static int vlynq_probe(struct platform_d dev->id = pdev->id; dev->dev.bus = &vlynq_bus_type; dev->dev.parent = &pdev->dev; @@ -508,7 +508,7 @@ dev->dev.platform_data = pdev->dev.platform_data; dev->dev.release = vlynq_device_release; -@@ -673,9 +703,9 @@ +@@ -673,9 +703,9 @@ static int vlynq_probe(struct platform_d dev->mem_end = mem_res->end; len = regs_res->end - regs_res->start; @@ -520,7 +520,7 @@ result = -ENXIO; goto fail_request; } -@@ -683,7 +713,7 @@ +@@ -683,7 +713,7 @@ static int vlynq_probe(struct platform_d dev->local = ioremap(regs_res->start, len); if (!dev->local) { printk(KERN_ERR "%s: Can't remap vlynq registers\n", @@ -529,7 +529,7 @@ result = -ENXIO; goto fail_remap; } -@@ -702,14 +732,14 @@ +@@ -702,14 +732,14 @@ static int vlynq_probe(struct platform_d platform_set_drvdata(pdev, dev); printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n", diff --git a/target/linux/ar7/patches-2.6.30/160-cpmac_up_and_running.patch b/target/linux/ar7/patches-2.6.30/160-cpmac_up_and_running.patch new file mode 100644 index 0000000000..8a37e3ace2 --- /dev/null +++ b/target/linux/ar7/patches-2.6.30/160-cpmac_up_and_running.patch @@ -0,0 +1,47 @@ +--- a/arch/mips/ar7/platform.c ++++ b/arch/mips/ar7/platform.c +@@ -33,6 +33,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -205,6 +207,13 @@ static struct physmap_flash_data physmap + .width = 2, + }; + ++/* lets assume this is suitable for both high and low cpmacs links */ ++static struct fixed_phy_status fixed_phy_status __initdata = { ++ .link = 1, ++ .speed = 100, ++ .duplex = 1, ++}; ++ + static struct plat_cpmac_data cpmac_low_data = { + .reset_bit = 17, + .power_bit = 20, +@@ -506,6 +515,10 @@ static int __init ar7_register_devices(v + } + + if (ar7_has_high_cpmac()) { ++ res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status); ++ if (res && res != -ENODEV) ++ return res; ++ + cpmac_get_mac(1, cpmac_high_data.dev_addr); + res = platform_device_register(&cpmac_high); + if (res) +@@ -514,6 +527,10 @@ static int __init ar7_register_devices(v + cpmac_low_data.phy_mask = 0xffffffff; + } + ++ res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status); ++ if (res && res != -ENODEV) ++ return res; ++ + cpmac_get_mac(0, cpmac_low_data.dev_addr); + res = platform_device_register(&cpmac_low); + if (res) diff --git a/target/linux/ar7/patches-2.6.30/910-cpmac_fixed_phy.patch b/target/linux/ar7/patches-2.6.30/910-cpmac_fixed_phy.patch new file mode 100644 index 0000000000..bd7345abf9 --- /dev/null +++ b/target/linux/ar7/patches-2.6.30/910-cpmac_fixed_phy.patch @@ -0,0 +1,90 @@ +This is a hack to make cpmac work with the external switch on a DG834 v3; it +should also work on other similar routers. It has not been tested on hardware +with multiple cpmac devices or with no external switch. It may be safer to +move external_switch to pdata rather than trying to detect it, and to set +phy_mask correctly rather than moving the phy search loop. + +--- a/drivers/net/cpmac.c ++++ b/drivers/net/cpmac.c +@@ -1096,7 +1096,7 @@ static int external_switch; + static int __devinit cpmac_probe(struct platform_device *pdev) + { + int rc, phy_id; +- char *mdio_bus_id = "0"; ++ char mdio_bus_id[BUS_ID_SIZE]; + struct resource *mem; + struct cpmac_priv *priv; + struct net_device *dev; +@@ -1104,22 +1104,23 @@ static int __devinit cpmac_probe(struct + + pdata = pdev->dev.platform_data; + +- for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { +- if (!(pdata->phy_mask & (1 << phy_id))) +- continue; +- if (!cpmac_mii->phy_map[phy_id]) +- continue; +- break; ++ if (external_switch || dumb_switch) { ++ strncpy(mdio_bus_id, "0", BUS_ID_SIZE); /* fixed phys bus */ ++ phy_id = pdev->id; ++ } else { ++ for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { ++ if (!(pdata->phy_mask & (1 << phy_id))) ++ continue; ++ if (!cpmac_mii->phy_map[phy_id]) ++ continue; ++ strncpy(mdio_bus_id, cpmac_mii->id, BUS_ID_SIZE); ++ break; ++ } + } + + if (phy_id == PHY_MAX_ADDR) { +- if (external_switch || dumb_switch) { +- mdio_bus_id = 0; /* fixed phys bus */ +- phy_id = pdev->id; +- } else { +- dev_err(&pdev->dev, "no PHY present\n"); +- return -ENODEV; +- } ++ dev_err(&pdev->dev, "no PHY present\n"); ++ return -ENODEV; + } + + dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); +@@ -1160,8 +1161,10 @@ static int __devinit cpmac_probe(struct + priv->msg_enable = netif_msg_init(debug_level, 0xff); + memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); + +- priv->phy = phy_connect(dev, dev_name(&cpmac_mii->phy_map[phy_id]->dev), +- &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); ++ snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); ++ ++ priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0, ++ PHY_INTERFACE_MODE_MII); + if (IS_ERR(priv->phy)) { + if (netif_msg_drv(priv)) + printk(KERN_ERR "%s: Could not attach to PHY\n", +@@ -1235,11 +1238,11 @@ int __devinit cpmac_init(void) + + cpmac_mii->reset(cpmac_mii); + +- for (i = 0; i < 300000; i++) ++ for (i = 0; i < 300; i++) + if ((mask = cpmac_read(cpmac_mii->priv, CPMAC_MDIO_ALIVE))) + break; + else +- cpu_relax(); ++ msleep(10); + + mask &= 0x7fffffff; + if (mask & (mask - 1)) { +@@ -1248,7 +1251,7 @@ int __devinit cpmac_init(void) + } + + cpmac_mii->phy_mask = ~(mask | 0x80000000); +- snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "0"); ++ snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1"); + + res = mdiobus_register(cpmac_mii); + if (res)