1 Index: linux-2.6.32.26/arch/mips/ar7/platform.c
2 ===================================================================
3 --- linux-2.6.32.26.orig/arch/mips/ar7/platform.c 2010-11-28 03:22:24.522383766 -0800
4 +++ linux-2.6.32.26/arch/mips/ar7/platform.c 2010-11-28 04:17:24.872413302 -0800
10 static int vlynq_on(struct vlynq_device *dev)
17 - gpio_set_value(pdata->gpio_bit, 1);
18 + gpio_set_value(pdata->gpio_bit,
19 + __vlynq_rev_reg(dev->local) < 0x00010205);
27 +static void auto_mdix_on(void)
29 + ar7_gpio_enable(28);
30 + ar7_gpio_disable(30);
33 +/*static void auto_mdix_off(void)
35 + ar7_gpio_disable(28);
36 + ar7_gpio_disable(30);
39 static void cpmac_get_mac(int instance, unsigned char *dev_addr)
46 + void __iomem *mii_reg;
47 #ifdef CONFIG_SERIAL_8250
48 static struct uart_port uart_port[2];
54 - if (ar7_has_high_cpmac()) {
55 - res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_high_titan.id : cpmac_high.id,
57 - if (res && res != -ENODEV)
60 - cpmac_get_mac(1, ar7_is_titan() ? cpmac_high_data_titan.dev_addr :
61 - cpmac_high_data.dev_addr);
62 - res = platform_device_register(ar7_is_titan() ? &cpmac_high_titan :
69 - cpmac_low_data_titan.phy_mask = 0xffffffff;
71 - cpmac_low_data.phy_mask = 0xffffffff;
75 res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_low_titan.id :
76 cpmac_low.id, &fixed_phy_status);
77 if (res && res != -ENODEV)
82 + if (ar7_has_high_cpmac()) {
83 + res = fixed_phy_add(PHY_POLL, ar7_is_titan() ?
84 + cpmac_high_titan.id : cpmac_high.id,
86 + if (res && res != -ENODEV)
89 + cpmac_get_mac(1, ar7_is_titan() ?
90 + cpmac_high_data_titan.dev_addr :
91 + cpmac_high_data.dev_addr);
92 + res = platform_device_register(ar7_is_titan() ?
93 + &cpmac_high_titan : &cpmac_high);
98 + mii_reg = ioremap(AR7_REGS_MII, 4);
100 + writel(readl(mii_reg) | 1, mii_reg);
104 + ar7_gpio_disable(17);
106 + ar7_gpio_enable(17);
111 res = platform_device_register(&ar7_gpio_leds);
114 ar7_wdt_res.end = ar7_wdt_res.start + 0x20;
116 bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
124 /* Register watchdog only if enabled in hardware */
125 if (val & AR7_WDT_HW_ENA)
126 Index: linux-2.6.32.26/arch/mips/include/asm/mach-ar7/ar7.h
127 ===================================================================
128 --- linux-2.6.32.26.orig/arch/mips/include/asm/mach-ar7/ar7.h 2010-11-28 03:22:24.522383766 -0800
129 +++ linux-2.6.32.26/arch/mips/include/asm/mach-ar7/ar7.h 2010-11-28 03:22:25.012385426 -0800
131 #define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
132 #define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
133 #define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
134 +#define AR7_REGS_MII (AR7_REGS_BASE + 0x1a08)
135 #define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
136 #define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1e00)
137 #define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400)
138 Index: linux-2.6.32.26/drivers/net/cpmac.c
139 ===================================================================
140 --- linux-2.6.32.26.orig/drivers/net/cpmac.c 2010-11-28 03:22:24.982383427 -0800
141 +++ linux-2.6.32.26/drivers/net/cpmac.c 2010-11-28 05:23:59.482390691 -0800
143 for (i = 0; i < 8; i++)
144 cpmac_write(priv->regs, CPMAC_MAC_ADDR_LO(i), dev->dev_addr[5]);
145 cpmac_write(priv->regs, CPMAC_MAC_ADDR_MID, dev->dev_addr[4]);
146 - cpmac_write(priv->regs, CPMAC_MAC_ADDR_HI, dev->dev_addr[0] |
147 - (dev->dev_addr[1] << 8) | (dev->dev_addr[2] << 16) |
148 - (dev->dev_addr[3] << 24));
149 + cpmac_write(priv->regs, CPMAC_MAC_ADDR_HI, be32_to_cpu(*(u32 *)
151 cpmac_write(priv->regs, CPMAC_MAX_LENGTH, CPMAC_SKB_SIZE);
152 cpmac_write(priv->regs, CPMAC_UNICAST_CLEAR, 0xff);
153 cpmac_write(priv->regs, CPMAC_RX_INT_CLEAR, 0xff);
154 @@ -1104,8 +1103,6 @@
155 .ndo_set_mac_address = eth_mac_addr,
158 -static int external_switch;
160 static int __devinit cpmac_probe(struct platform_device *pdev)
163 @@ -1117,24 +1114,26 @@
165 pdata = pdev->dev.platform_data;
167 - if (external_switch || dumb_switch) {
168 - strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
171 - for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
172 - if (!(pdata->phy_mask & (1 << phy_id)))
174 - if (!cpmac_mii->phy_map[phy_id])
176 - strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
180 + phy_id = PHY_MAX_ADDR;
181 + else for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
182 + if (!((pdata->phy_mask | cpmac_mii->phy_mask) &
185 + if (cpmac_mii->phy_map[phy_id])
187 + strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
191 if (phy_id == PHY_MAX_ADDR) {
192 dev_err(&pdev->dev, "no PHY present, falling back to switch mode\n");
193 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
196 + /* Now disable EPHY and enable MII */
197 + dev_info(&pdev->dev, "trying external MII\n");
198 + ar7_device_disable(AR7_RESET_BIT_EPHY);
201 dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES);
202 @@ -1168,7 +1167,7 @@
204 priv->ring_size = 64;
205 priv->msg_enable = netif_msg_init(debug_level, 0xff);
206 - memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
207 + memcpy(dev->dev_addr, pdata->dev_addr, sizeof(pdata->dev_addr));
209 snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
211 @@ -1244,14 +1243,14 @@
212 ar7_gpio_disable(26);
213 ar7_gpio_disable(27);
215 - if (!ar7_is_titan()) {
216 + if (ar7_is_titan()) {
217 + ar7_device_reset(AR7_RESET_BIT_EPHY);
218 + ar7_device_reset(TITAN_RESET_BIT_EPHY1);
220 ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
221 ar7_device_reset(AR7_RESET_BIT_CPMAC_HI);
223 - ar7_device_reset(AR7_RESET_BIT_EPHY);
225 - if (ar7_is_titan()) {
226 - ar7_device_reset(TITAN_RESET_BIT_EPHY1);
227 + ar7_device_reset(AR7_RESET_BIT_EPHY);
230 cpmac_mii->reset(cpmac_mii);
231 @@ -1262,14 +1261,7 @@
235 - mask &= 0x7fffffff;
236 - if (mask & (mask - 1)) {
237 - external_switch = 1;
241 - cpmac_mii->phy_mask = ar7_is_titan()? ~(mask | 0x80000000 | 0x40000000):
242 - ~(mask | 0x80000000);
243 + cpmac_mii->phy_mask = ~mask;
244 snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
246 res = mdiobus_register(cpmac_mii);