diff options
author | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-08-26 09:13:44 +0000 |
---|---|---|
committer | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-08-26 09:13:44 +0000 |
commit | 4377f9b52651864b3d409a89c6243fc1bbf32fc5 (patch) | |
tree | 09d1e40ca9a83be97965ed643a801e971945618b /target/linux/ar7/patches-2.6.35/972-cpmac_multi_probe.patch | |
parent | 93eeadb8fb02998c5ab8678d512cd0a5060bf4a2 (diff) |
[ar7] add 2.6.35 support
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22812 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar7/patches-2.6.35/972-cpmac_multi_probe.patch')
-rw-r--r-- | target/linux/ar7/patches-2.6.35/972-cpmac_multi_probe.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/target/linux/ar7/patches-2.6.35/972-cpmac_multi_probe.patch b/target/linux/ar7/patches-2.6.35/972-cpmac_multi_probe.patch new file mode 100644 index 0000000000..7ee604a769 --- /dev/null +++ b/target/linux/ar7/patches-2.6.35/972-cpmac_multi_probe.patch @@ -0,0 +1,65 @@ +--- a/drivers/net/cpmac.c ++++ b/drivers/net/cpmac.c +@@ -34,6 +34,7 @@ + #include <linux/skbuff.h> + #include <linux/mii.h> + #include <linux/phy.h> ++#include <linux/phy_fixed.h> + #include <linux/platform_device.h> + #include <linux/dma-mapping.h> + #include <linux/clk.h> +@@ -219,6 +220,12 @@ static void cpmac_hw_stop(struct net_dev + static int cpmac_stop(struct net_device *dev); + static int cpmac_open(struct net_device *dev); + ++static struct fixed_phy_status fixed_phy_status = { ++ .link = 1, ++ .speed = 100, ++ .duplex = 1, ++}; ++ + static void cpmac_dump_regs(struct net_device *dev) + { + int i; +@@ -1127,11 +1134,38 @@ static int __devinit cpmac_probe(struct + break; + } + +- if (phy_id == PHY_MAX_ADDR) { +- dev_err(&pdev->dev, "no PHY present\n"); +- return -ENODEV; ++ if (phy_id < PHY_MAX_ADDR) ++ goto dev_alloc; ++ ++ dev_info(&pdev->dev, "trying external MII\n"); ++ /* Now disable EPHY and enable MII */ ++ ar7_device_disable(AR7_RESET_BIT_EPHY); ++ *(unsigned long*) ioremap(0x08611A08, 4) |= 0x00000001; ++ ++ 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, MII_BUS_ID_SIZE); ++ break; + } + ++ if (phy_id < PHY_MAX_ADDR) ++ goto dev_alloc; ++ ++ /* This still does not work, so now we register a fixed phy */ ++ dev_info(&pdev->dev, "using fixed PHY\n"); ++ rc = fixed_phy_add(PHY_POLL, pdev->id, &fixed_phy_status); ++ if (rc && rc != -ENODEV) { ++ dev_err(&pdev->dev, "unable to register fixed PHY\n"); ++ return rc; ++ } ++ ++ strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ ++ phy_id = pdev->id; ++ ++dev_alloc: + dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); + + if (!dev) { |