4957d85a6d14996918c9389731e3b685c51390c1
[openwrt/openwrt.git] / target / linux / ar7 / patches-2.6.24 / 140-cpmac_fix.patch
1 --- linux-2.6.24/drivers/net/Kconfig 2008-02-07 02:29:04.000000000 +0100
2 +++ linux-2.6.24/drivers/net/Kconfig 2008-02-07 02:29:35.000000000 +0100
3 @@ -1830,10 +1830,8 @@
4
5 config CPMAC
6 tristate "TI AR7 CPMAC Ethernet support (EXPERIMENTAL)"
7 - depends on NET_ETHERNET && EXPERIMENTAL && AR7
8 + depends on NET_ETHERNET && EXPERIMENTAL && AR7 && BROKEN
9 select PHYLIB
10 - select FIXED_PHY
11 - select FIXED_MII_100_FDX
12 help
13 TI AR7 CPMAC Ethernet support
14
15 --- linux-2.6.24/drivers/net/cpmac.c 2008-01-24 23:58:37.000000000 +0100
16 +++ linux-2.6.24/drivers/net/cpmac.c 2008-02-07 02:32:57.000000000 +0100
17 @@ -661,9 +661,6 @@
18 int queue;
19 u32 status;
20
21 - if (!dev)
22 - return IRQ_NONE;
23 -
24 priv = netdev_priv(dev);
25
26 status = cpmac_read(priv->regs, CPMAC_MAC_INT_VECTOR);
27 @@ -848,15 +845,6 @@
28 spin_unlock(&priv->lock);
29 }
30
31 -static int cpmac_link_update(struct net_device *dev,
32 - struct fixed_phy_status *status)
33 -{
34 - status->link = 1;
35 - status->speed = 100;
36 - status->duplex = 1;
37 - return 0;
38 -}
39 -
40 static int cpmac_open(struct net_device *dev)
41 {
42 int i, size, res;
43 @@ -999,11 +987,11 @@
44 static int __devinit cpmac_probe(struct platform_device *pdev)
45 {
46 int rc, phy_id, i;
47 + int mdio_bus_id = cpmac_mii.id;
48 struct resource *mem;
49 struct cpmac_priv *priv;
50 struct net_device *dev;
51 struct plat_cpmac_data *pdata;
52 - struct fixed_info *fixed_phy;
53 DECLARE_MAC_BUF(mac);
54
55 pdata = pdev->dev.platform_data;
56 @@ -1017,9 +1005,23 @@
57 }
58
59 if (phy_id == PHY_MAX_ADDR) {
60 - if (external_switch || dumb_switch)
61 + if (external_switch || dumb_switch) {
62 + struct fixed_phy_status status = {};
63 +
64 + mdio_bus_id = 0;
65 +
66 + /*
67 + * FIXME: this should be in the platform code!
68 + * Since there is not platform code at all (that is,
69 + * no mainline users of that driver), place it here
70 + * for now.
71 + */
72 phy_id = 0;
73 - else {
74 + status.link = 1;
75 + status.duplex = 1;
76 + status.speed = 100;
77 + fixed_phy_add(PHY_POLL, phy_id, &status);
78 + } else {
79 printk(KERN_ERR "cpmac: no PHY present\n");
80 return -ENODEV;
81 }
82 @@ -1063,32 +1065,8 @@
83 priv->msg_enable = netif_msg_init(debug_level, 0xff);
84 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
85
86 - if (phy_id == 31) {
87 - snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, cpmac_mii.id,
88 - phy_id);
89 - } else {
90 - /* Let's try to get a free fixed phy... */
91 - for (i = 0; i < MAX_PHY_AMNT; i++) {
92 - fixed_phy = fixed_mdio_get_phydev(i);
93 - if (!fixed_phy)
94 - continue;
95 - if (!fixed_phy->phydev->attached_dev) {
96 - strncpy(priv->phy_name,
97 - fixed_phy->phydev->dev.bus_id,
98 - BUS_ID_SIZE);
99 - fixed_mdio_set_link_update(fixed_phy->phydev,
100 - &cpmac_link_update);
101 - goto phy_found;
102 - }
103 - }
104 - if (netif_msg_drv(priv))
105 - printk(KERN_ERR "%s: Could not find fixed PHY\n",
106 - dev->name);
107 - rc = -ENODEV;
108 - goto fail;
109 - }
110 + snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
111
112 -phy_found:
113 priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
114 PHY_INTERFACE_MODE_MII);
115 if (IS_ERR(priv->phy)) {