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