[ar7] add back the fixed PHY patches from #3124, until we move this to platform_data
[openwrt.git] / target / linux / ar7 / patches-2.6.27 / 160-cpmac_up_and_running.patch
1 --- a/arch/mips/ar7/platform.c
2 +++ b/arch/mips/ar7/platform.c
3 @@ -33,6 +33,8 @@
4  #include <linux/vlynq.h>
5  #include <linux/leds.h>
6  #include <linux/string.h>
7 +#include <linux/phy.h>
8 +#include <linux/phy_fixed.h>
9  
10  #include <asm/addrspace.h>
11  #include <asm/ar7/ar7.h>
12 @@ -205,6 +207,13 @@
13         .width = 2,
14  };
15  
16 +/* lets assume this is suitable for both high and low cpmacs links */
17 +static struct fixed_phy_status fixed_phy_status __initdata = {
18 +       .link = 1,
19 +       .speed = 100,
20 +       .duplex = 1,
21 +};
22 +
23  static struct plat_cpmac_data cpmac_low_data = {
24         .reset_bit = 17,
25         .power_bit = 20,
26 @@ -506,6 +515,10 @@
27         }
28  
29         if (ar7_has_high_cpmac()) {
30 +               res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
31 +               if (res && res != -ENODEV)
32 +                       return res;
33 +
34                 cpmac_get_mac(1, cpmac_high_data.dev_addr);
35                 res = platform_device_register(&cpmac_high);
36                 if (res)
37 @@ -514,6 +527,10 @@
38                 cpmac_low_data.phy_mask = 0xffffffff;
39         }
40  
41 +       res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
42 +       if (res && res != -ENODEV)
43 +               return res;
44 +
45         cpmac_get_mac(0, cpmac_low_data.dev_addr);
46         res = platform_device_register(&cpmac_low);
47         if (res)