[ar7] add support for titan variant (WRTP54G) (#6185)
[openwrt/svn-archive/archive.git] / target / linux / ar7 / patches-2.6.30 / 940-cpmac-titan.patch
1 --- a/arch/mips/ar7/platform.c 2009-11-18 15:47:42.000000000 +0800
2 +++ b/arch/mips/ar7/platform.c 2009-11-19 00:56:05.000000000 +0800
3 @@ -677,24 +677,32 @@
4 }
5
6 if (ar7_has_high_cpmac()) {
7 - res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
8 + res = fixed_phy_add(PHY_POLL, ar7_is_titan()?cpmac_high_titan.id: cpmac_high.id, &fixed_phy_status);
9 if (res && res != -ENODEV)
10 return res;
11
12 - cpmac_get_mac(1, cpmac_high_data.dev_addr);
13 - res = platform_device_register(&cpmac_high);
14 + cpmac_get_mac(1, ar7_is_titan() ? cpmac_high_data_titan.dev_addr:
15 + cpmac_high_data.dev_addr);
16 + res = platform_device_register(ar7_is_titan() ? &cpmac_high_titan :
17 + &cpmac_high);
18 if (res)
19 return res;
20 } else {
21 - cpmac_low_data.phy_mask = 0xffffffff;
22 - }
23 + if (ar7_is_titan())
24 + cpmac_low_data_titan.phy_mask = 0xffffffff;
25 + else
26 + cpmac_low_data.phy_mask = 0xffffffff;
27 + }
28
29 - res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
30 + res = fixed_phy_add(PHY_POLL, ar7_is_titan()?cpmac_low_titan.id:
31 + cpmac_low.id, &fixed_phy_status);
32 if (res && res != -ENODEV)
33 return res;
34
35 - cpmac_get_mac(0, cpmac_low_data.dev_addr);
36 - res = platform_device_register(&cpmac_low);
37 + cpmac_get_mac(0, ar7_is_titan() ? cpmac_low_data_titan.dev_addr :
38 + cpmac_low_data.dev_addr);
39 + res = platform_device_register(ar7_is_titan() ? &cpmac_low_titan :
40 + &cpmac_low);
41 if (res)
42 return res;
43
44 --- a/drivers/net/cpmac.c 2009-11-18 15:47:42.000000000 +0800
45 +++ b/drivers/net/cpmac.c 2009-11-19 00:58:25.000000000 +0800
46 @@ -1236,6 +1236,10 @@
47 ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
48 ar7_device_reset(AR7_RESET_BIT_EPHY);
49
50 + if (ar7_is_titan()) {
51 + ar7_device_reset(TITAN_RESET_BIT_EPHY1);
52 + }
53 +
54 cpmac_mii->reset(cpmac_mii);
55
56 for (i = 0; i < 300; i++)
57 @@ -1250,7 +1254,8 @@
58 mask = 0;
59 }
60
61 - cpmac_mii->phy_mask = ~(mask | 0x80000000);
62 + cpmac_mii->phy_mask = ar7_is_titan()? ~(mask | 0x80000000 | 0x40000000):
63 + ~(mask | 0x80000000);
64 snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
65
66 res = mdiobus_register(cpmac_mii);