add 2.6.32 support
[librecmc/librecmc.git] / target / linux / ar7 / patches-2.6.32 / 940-cpmac-titan.patch
1 Index: linux-2.6.32.7/arch/mips/ar7/platform.c
2 ===================================================================
3 --- linux-2.6.32.7.orig/arch/mips/ar7/platform.c        2010-02-04 14:00:53.000000000 +0100
4 +++ linux-2.6.32.7/arch/mips/ar7/platform.c     2010-02-04 14:14:21.000000000 +0100
5 @@ -716,23 +716,35 @@
6         }
7  
8         if (ar7_has_high_cpmac()) {
9 -               res = fixed_phy_add(PHY_POLL, cpmac_high.id, &fixed_phy_status);
10 +               res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_high_titan.id : cpmac_high.id,
11 +                                               &fixed_phy_status);
12                 if (res && res != -ENODEV)
13                         return res;
14 -               cpmac_get_mac(1, cpmac_high_data.dev_addr);
15 -               res = platform_device_register(&cpmac_high);
16 +
17 +               cpmac_get_mac(1, ar7_is_titan() ? cpmac_high_data_titan.dev_addr :
18 +                                               cpmac_high_data.dev_addr);
19 +               res = platform_device_register(ar7_is_titan() ? &cpmac_high_titan :
20 +                                               &cpmac_high);
21 +
22                 if (res)
23                         return res;
24         } else {
25 -               cpmac_low_data.phy_mask = 0xffffffff;
26 +               if (ar7_is_titan())
27 +                       cpmac_low_data_titan.phy_mask = 0xffffffff;
28 +               else
29 +                       cpmac_low_data.phy_mask = 0xffffffff;
30 +
31         }
32  
33 -       res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status);
34 +       res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_low_titan.id :
35 +                       cpmac_low.id, &fixed_phy_status);
36         if (res && res != -ENODEV)
37                 return res;
38  
39 -       cpmac_get_mac(0, cpmac_low_data.dev_addr);
40 -       res = platform_device_register(&cpmac_low);
41 +       cpmac_get_mac(0, ar7_is_titan() ? cpmac_low_data_titan.dev_addr :
42 +                       cpmac_low_data.dev_addr);
43 +       res = platform_device_register(ar7_is_titan() ? &cpmac_low_titan :
44 +                       &cpmac_low);
45         if (res)
46                 return res;
47  
48 Index: linux-2.6.32.7/drivers/net/cpmac.c
49 ===================================================================
50 --- linux-2.6.32.7.orig/drivers/net/cpmac.c     2010-01-29 00:06:20.000000000 +0100
51 +++ linux-2.6.32.7/drivers/net/cpmac.c  2010-02-04 14:05:24.000000000 +0100
52 @@ -1243,6 +1243,10 @@
53         ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
54         ar7_device_reset(AR7_RESET_BIT_EPHY);
55  
56 +       if (ar7_is_titan()) {
57 +               ar7_device_reset(TITAN_RESET_BIT_EPHY1);
58 +       }
59 +
60         cpmac_mii->reset(cpmac_mii);
61  
62         for (i = 0; i < 300; i++)
63 @@ -1257,7 +1261,8 @@
64                 mask = 0;
65         }
66  
67 -       cpmac_mii->phy_mask = ~(mask | 0x80000000);
68 +       cpmac_mii->phy_mask = ar7_is_titan()? ~(mask | 0x80000000 | 0x40000000):
69 +               ~(mask | 0x80000000);
70         snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
71  
72         res = mdiobus_register(cpmac_mii);