[avr32]: upgrade u-boot to v2010.12-rc1
[openwrt.git] / target / linux / ar7 / patches-2.6.35 / 972-cpmac_multi_probe.patch
1 --- a/drivers/net/cpmac.c
2 +++ b/drivers/net/cpmac.c
3 @@ -34,6 +34,7 @@
4 #include <linux/skbuff.h>
5 #include <linux/mii.h>
6 #include <linux/phy.h>
7 +#include <linux/phy_fixed.h>
8 #include <linux/platform_device.h>
9 #include <linux/dma-mapping.h>
10 #include <linux/clk.h>
11 @@ -219,6 +220,12 @@ static void cpmac_hw_stop(struct net_dev
12 static int cpmac_stop(struct net_device *dev);
13 static int cpmac_open(struct net_device *dev);
14
15 +static struct fixed_phy_status fixed_phy_status = {
16 + .link = 1,
17 + .speed = 100,
18 + .duplex = 1,
19 +};
20 +
21 static void cpmac_dump_regs(struct net_device *dev)
22 {
23 int i;
24 @@ -1127,11 +1134,38 @@ static int __devinit cpmac_probe(struct
25 break;
26 }
27
28 - if (phy_id == PHY_MAX_ADDR) {
29 - dev_err(&pdev->dev, "no PHY present\n");
30 - return -ENODEV;
31 + if (phy_id < PHY_MAX_ADDR)
32 + goto dev_alloc;
33 +
34 + dev_info(&pdev->dev, "trying external MII\n");
35 + /* Now disable EPHY and enable MII */
36 + ar7_device_disable(AR7_RESET_BIT_EPHY);
37 + *(unsigned long*) ioremap(0x08611A08, 4) |= 0x00000001;
38 +
39 + for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
40 + if (!(pdata->phy_mask & (1 << phy_id)))
41 + continue;
42 + if (!cpmac_mii->phy_map[phy_id])
43 + continue;
44 + strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
45 + break;
46 }
47
48 + if (phy_id < PHY_MAX_ADDR)
49 + goto dev_alloc;
50 +
51 + /* This still does not work, so now we register a fixed phy */
52 + dev_info(&pdev->dev, "using fixed PHY\n");
53 + rc = fixed_phy_add(PHY_POLL, pdev->id, &fixed_phy_status);
54 + if (rc && rc != -ENODEV) {
55 + dev_err(&pdev->dev, "unable to register fixed PHY\n");
56 + return rc;
57 + }
58 +
59 + strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
60 + phy_id = pdev->id;
61 +
62 +dev_alloc:
63 dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES);
64
65 if (!dev) {
This page took 0.061967 seconds and 5 git commands to generate.