correct the MDIO base address and reset sequence for Titan (#6573)
[oweals/openwrt.git] / target / linux / ar7 / patches-2.6.30 / 940-cpmac-titan.patch
1 --- a/arch/mips/ar7/platform.c  2010-01-25 16:11:24.000000000 +0800
2 +++ b/arch/mips/ar7/platform.c  2010-01-13 14:46:16.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       2010-01-25 16:11:24.000000000 +0800
45 +++ b/drivers/net/cpmac.c       2010-01-25 16:48:02.000000000 +0800
46 @@ -1141,6 +1141,8 @@
47                 goto fail;
48         }
49  
50 +       ar7_device_reset(pdata->reset_bit);
51 +
52         dev->irq = platform_get_irq_byname(pdev, "irq");
53  
54         dev->open               = cpmac_open;
55 @@ -1221,7 +1223,7 @@
56         cpmac_mii->reset = cpmac_mdio_reset;
57         cpmac_mii->irq = mii_irqs;
58  
59 -       cpmac_mii->priv = ioremap(AR7_REGS_MDIO, 256);
60 +       cpmac_mii->priv = ioremap(ar7_is_titan()?TITAN_REGS_MDIO:AR7_REGS_MDIO, 256);
61  
62         if (!cpmac_mii->priv) {
63                 printk(KERN_ERR "Can't ioremap mdio registers\n");
64 @@ -1232,9 +1234,10 @@
65  #warning FIXME: unhardcode gpio&reset bits
66         ar7_gpio_disable(26);
67         ar7_gpio_disable(27);
68 -       ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
69 -       ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
70         ar7_device_reset(AR7_RESET_BIT_EPHY);
71 +       if (ar7_is_titan()) {
72 +               ar7_device_reset(TITAN_RESET_BIT_EPHY1);
73 +       }
74  
75         cpmac_mii->reset(cpmac_mii);
76