[ar7] add 2.6.35 support
[openwrt.git] / target / linux / ar7 / patches-2.6.35 / 971-cpmac_cleanup.patch
1 --- a/drivers/net/cpmac.c
2 +++ b/drivers/net/cpmac.c
3 @@ -34,7 +34,6 @@
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 @@ -1108,8 +1107,6 @@ static const struct net_device_ops cpmac
12         .ndo_set_mac_address    = eth_mac_addr,
13  };
14  
15 -static int external_switch;
16 -
17  static int __devinit cpmac_probe(struct platform_device *pdev)
18  {
19         int rc, phy_id;
20 @@ -1121,24 +1118,18 @@ static int __devinit cpmac_probe(struct 
21  
22         pdata = pdev->dev.platform_data;
23  
24 -       if (external_switch || dumb_switch) {
25 -               strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
26 -               phy_id = pdev->id;
27 -       } else {
28 -               for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
29 -                       if (!(pdata->phy_mask & (1 << phy_id)))
30 -                               continue;
31 -                       if (!cpmac_mii->phy_map[phy_id])
32 -                               continue;
33 -                       strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
34 -                       break;
35 -               }
36 +       for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
37 +               if (!(pdata->phy_mask & (1 << phy_id)))
38 +                       continue;
39 +               if (!cpmac_mii->phy_map[phy_id])
40 +                       continue;
41 +               strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
42 +               break;
43         }
44  
45         if (phy_id == PHY_MAX_ADDR) {
46 -               dev_err(&pdev->dev, "no PHY present, falling back to switch on MDIO bus 0\n");
47 -               strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
48 -               phy_id = pdev->id;
49 +               dev_err(&pdev->dev, "no PHY present\n");
50 +               return -ENODEV;
51         }
52  
53         dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES);
54 @@ -1266,14 +1257,8 @@ int __devinit cpmac_init(void)
55                 else
56                         msleep(10);
57  
58 -       mask &= 0x7fffffff;
59 -       if (mask & (mask - 1)) {
60 -               external_switch = 1;
61 -               mask = 0;
62 -       }
63 -
64         cpmac_mii->phy_mask = ar7_is_titan()? ~(mask | 0x80000000 | 0x40000000):
65 -               ~(mask | 0x80000001);
66 +               ~(mask | 0x80000000);
67         snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
68  
69         res = mdiobus_register(cpmac_mii);