0e72267ab5bbd2c75ad2bbb2d3bb4dfd5203f354
[openwrt-10.03/.git] / target / linux / ar7 / patches-2.6.32 / 970-remove_fixed_phy.patch
1 --- a/arch/mips/ar7/platform.c
2 +++ b/arch/mips/ar7/platform.c
3 @@ -33,7 +33,6 @@
4  #include <linux/string.h>
5  #include <linux/etherdevice.h>
6  #include <linux/phy.h>
7 -#include <linux/phy_fixed.h>
8  
9  #include <asm/addrspace.h>
10  #include <asm/mach-ar7/ar7.h>
11 @@ -294,12 +293,6 @@ static struct physmap_flash_data physmap
12         .width = 2,
13  };
14  
15 -static struct fixed_phy_status fixed_phy_status __initdata = {
16 -       .link = 1,
17 -       .speed = 100,
18 -       .duplex = 1,
19 -};
20 -
21  static struct plat_cpmac_data cpmac_low_data = {
22         .reset_bit = 17,
23         .power_bit = 20,
24 @@ -716,11 +709,6 @@ static int __init ar7_register_devices(v
25         }
26  
27         if (ar7_has_high_cpmac()) {
28 -               res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_high_titan.id : cpmac_high.id,
29 -                                               &fixed_phy_status);
30 -               if (res && res != -ENODEV)
31 -                       return res;
32 -
33                 cpmac_get_mac(1, ar7_is_titan() ? cpmac_high_data_titan.dev_addr :
34                                                 cpmac_high_data.dev_addr);
35                 res = platform_device_register(ar7_is_titan() ? &cpmac_high_titan :
36 @@ -736,11 +724,6 @@ static int __init ar7_register_devices(v
37  
38         }
39  
40 -       res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_low_titan.id :
41 -                       cpmac_low.id, &fixed_phy_status);
42 -       if (res && res != -ENODEV)
43 -               return res;
44 -
45         cpmac_get_mac(0, ar7_is_titan() ? cpmac_low_data_titan.dev_addr :
46                         cpmac_low_data.dev_addr);
47         res = platform_device_register(ar7_is_titan() ? &cpmac_low_titan :
48 --- a/drivers/net/cpmac.c
49 +++ b/drivers/net/cpmac.c
50 @@ -1117,21 +1117,17 @@ static int __devinit cpmac_probe(struct
51  
52         pdata = pdev->dev.platform_data;
53  
54 -       if (external_switch || dumb_switch) {
55 -               strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
56 -               phy_id = pdev->id;
57 -       } else {
58 -               for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
59 -                       if (!(pdata->phy_mask & (1 << phy_id)))
60 -                               continue;
61 -                       if (!cpmac_mii->phy_map[phy_id])
62 -                               continue;
63 -                       strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
64 -                       break;
65 -               }
66 +       for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
67 +               if (!(pdata->phy_mask & (1 << phy_id)))
68 +                       continue;
69 +               if (!cpmac_mii->phy_map[phy_id])
70 +                       continue;
71 +               strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
72 +               break;
73         }
74 -
75 +       
76         if (phy_id == PHY_MAX_ADDR) {
77 +               //This probably wont work as no fixed bus anymore.
78                 dev_err(&pdev->dev, "no PHY present, falling back to switch mode\n");
79                 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
80                 phy_id = pdev->id;
81 @@ -1269,7 +1265,7 @@ int __devinit cpmac_init(void)
82         }
83  
84         cpmac_mii->phy_mask = ar7_is_titan()? ~(mask | 0x80000000 | 0x40000000):
85 -               ~(mask | 0x80000000);
86 +               ~(mask | 0x80000001);
87         snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
88  
89         res = mdiobus_register(cpmac_mii);