[lantiq] bump to v3.8
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches-3.8 / 0037-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
1 From 0c9b05716ac0e597ae0f81a96ff68e54716decc9 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Wed, 13 Mar 2013 10:02:58 +0100
4 Subject: [PATCH 37/40] owrt: lantiq: wifi and ethernet eeprom handling
5
6 ---
7 arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h | 6 +
8 .../mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 3 +
9 arch/mips/lantiq/xway/Makefile | 3 +
10 arch/mips/lantiq/xway/ath_eep.c | 206 ++++++++++++++++++++
11 arch/mips/lantiq/xway/eth_mac.c | 76 ++++++++
12 arch/mips/lantiq/xway/pci-ath-fixup.c | 109 +++++++++++
13 arch/mips/lantiq/xway/rt_eep.c | 60 ++++++
14 drivers/net/ethernet/lantiq_etop.c | 10 +-
15 8 files changed, 469 insertions(+), 4 deletions(-)
16 create mode 100644 arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h
17 create mode 100644 arch/mips/lantiq/xway/ath_eep.c
18 create mode 100644 arch/mips/lantiq/xway/eth_mac.c
19 create mode 100644 arch/mips/lantiq/xway/pci-ath-fixup.c
20 create mode 100644 arch/mips/lantiq/xway/rt_eep.c
21
22 diff --git a/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h b/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h
23 new file mode 100644
24 index 0000000..095d2619
25 --- /dev/null
26 +++ b/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h
27 @@ -0,0 +1,6 @@
28 +#ifndef _PCI_ATH_FIXUP
29 +#define _PCI_ATH_FIXUP
30 +
31 +void ltq_pci_ath_fixup(unsigned slot, u16 *cal_data) __init;
32 +
33 +#endif /* _PCI_ATH_FIXUP */
34 diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
35 index 133336b..779715c 100644
36 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
37 +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
38 @@ -90,5 +90,8 @@ int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr);
39 extern void ltq_pmu_enable(unsigned int module);
40 extern void ltq_pmu_disable(unsigned int module);
41
42 +/* allow the ethernet driver to load a flash mapped mac addr */
43 +const u8* ltq_get_eth_mac(void);
44 +
45 #endif /* CONFIG_SOC_TYPE_XWAY */
46 #endif /* _LTQ_XWAY_H__ */
47 diff --git a/arch/mips/lantiq/xway/Makefile b/arch/mips/lantiq/xway/Makefile
48 index 087497d..51f0eba 100644
49 --- a/arch/mips/lantiq/xway/Makefile
50 +++ b/arch/mips/lantiq/xway/Makefile
51 @@ -1,3 +1,6 @@
52 obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o
53
54 +obj-y += eth_mac.o
55 +obj-$(CONFIG_PCI) += ath_eep.o rt_eep.o pci-ath-fixup.o
56 +
57 obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o
58 diff --git a/arch/mips/lantiq/xway/ath_eep.c b/arch/mips/lantiq/xway/ath_eep.c
59 new file mode 100644
60 index 0000000..96da7c1
61 --- /dev/null
62 +++ b/arch/mips/lantiq/xway/ath_eep.c
63 @@ -0,0 +1,206 @@
64 +/*
65 + * Copyright (C) 2011 Luca Olivetti <luca@ventoso.org>
66 + * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
67 + * Copyright (C) 2011 Andrej Vlašić <andrej.vlasic0@gmail.com>
68 + * Copyright (C) 2013 Álvaro Fernández Rojas <noltari@gmail.com>
69 + *
70 + * This program is free software; you can redistribute it and/or modify it
71 + * under the terms of the GNU General Public License version 2 as published
72 + * by the Free Software Foundation.
73 + */
74 +
75 +#include <linux/init.h>
76 +#include <linux/module.h>
77 +#include <linux/platform_device.h>
78 +#include <linux/etherdevice.h>
79 +#include <linux/ath5k_platform.h>
80 +#include <linux/ath9k_platform.h>
81 +#include <linux/pci.h>
82 +#include <pci-ath-fixup.h>
83 +
84 +extern int (*ltq_pci_plat_dev_init)(struct pci_dev *dev);
85 +struct ath5k_platform_data ath5k_pdata;
86 +struct ath9k_platform_data ath9k_pdata = {
87 + .led_pin = -1,
88 +};
89 +static u16 ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
90 +static u8 athxk_eeprom_mac[6];
91 +
92 +static int ath9k_pci_plat_dev_init(struct pci_dev *dev)
93 +{
94 + dev->dev.platform_data = &ath9k_pdata;
95 + return 0;
96 +}
97 +
98 +int __init of_ath9k_eeprom_probe(struct platform_device *pdev)
99 +{
100 + struct device_node *np = pdev->dev.of_node;
101 + struct resource *eep_res, *mac_res;
102 + void __iomem *eep, *mac;
103 + int mac_offset;
104 + u32 mac_inc = 0, pci_slot = 0;
105 + int i;
106 + u16 *eepdata, sum, el;
107 +
108 + eep_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
109 + mac_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
110 +
111 + if (!eep_res) {
112 + dev_err(&pdev->dev, "failed to load eeprom address\n");
113 + return -ENODEV;
114 + }
115 + if (resource_size(eep_res) != ATH9K_PLAT_EEP_MAX_WORDS) {
116 + dev_err(&pdev->dev, "eeprom has an invalid size\n");
117 + return -EINVAL;
118 + }
119 +
120 + eep = ioremap(eep_res->start, resource_size(eep_res));
121 + memcpy_fromio(ath9k_pdata.eeprom_data, eep, ATH9K_PLAT_EEP_MAX_WORDS);
122 +
123 + if (of_find_property(np, "ath,eep-swap", NULL)) {
124 + ath9k_pdata.endian_check = true;
125 +
126 + dev_info(&pdev->dev, "endian check enabled.\n");
127 + }
128 +
129 + if (of_find_property(np, "ath,eep-csum", NULL)) {
130 + sum = ath9k_pdata.eeprom_data[0x200>>1];
131 + el = sum / sizeof(u16) - 2; /* skip length and (old) checksum */
132 + eepdata = (u16 *) (&ath9k_pdata.eeprom_data[0x204>>1]); /* after checksum */
133 + for (i = 0; i < el; i++)
134 + sum ^= *eepdata++;
135 + sum ^= 0xffff;
136 + ath9k_pdata.eeprom_data[0x202>>1] = sum;
137 +
138 + dev_info(&pdev->dev, "checksum fixed.\n");
139 + }
140 +
141 + if (!of_property_read_u32(np, "ath,mac-offset", &mac_offset)) {
142 + memcpy_fromio(athxk_eeprom_mac, (void*) ath9k_pdata.eeprom_data, 6);
143 + } else if (mac_res) {
144 + if (resource_size(mac_res) != 6) {
145 + dev_err(&pdev->dev, "mac has an invalid size\n");
146 + return -EINVAL;
147 + }
148 + mac = ioremap(mac_res->start, resource_size(mac_res));
149 + memcpy_fromio(athxk_eeprom_mac, mac, 6);
150 + } else {
151 + dev_warn(&pdev->dev, "using random mac\n");
152 + random_ether_addr(athxk_eeprom_mac);
153 + }
154 +
155 + if (!of_property_read_u32(np, "ath,mac-increment", &mac_inc))
156 + athxk_eeprom_mac[5] += mac_inc;
157 +
158 + ath9k_pdata.macaddr = athxk_eeprom_mac;
159 + ltq_pci_plat_dev_init = ath9k_pci_plat_dev_init;
160 +
161 + if (!of_property_read_u32(np, "ath,pci-slot", &pci_slot)) {
162 + ltq_pci_ath_fixup(pci_slot, ath9k_pdata.eeprom_data);
163 +
164 + dev_info(&pdev->dev, "pci slot: %u\n", pci_slot);
165 + }
166 +
167 + dev_info(&pdev->dev, "loaded ath9k eeprom\n");
168 +
169 + return 0;
170 +}
171 +
172 +static struct of_device_id ath9k_eeprom_ids[] = {
173 + { .compatible = "ath9k,eeprom" },
174 + { }
175 +};
176 +
177 +static struct platform_driver ath9k_eeprom_driver = {
178 + .driver = {
179 + .name = "ath9k,eeprom",
180 + .owner = THIS_MODULE,
181 + .of_match_table = of_match_ptr(ath9k_eeprom_ids),
182 + },
183 +};
184 +
185 +static int __init of_ath9k_eeprom_init(void)
186 +{
187 + return platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
188 +}
189 +arch_initcall(of_ath9k_eeprom_init);
190 +
191 +
192 +static int ath5k_pci_plat_dev_init(struct pci_dev *dev)
193 +{
194 + dev->dev.platform_data = &ath5k_pdata;
195 + return 0;
196 +}
197 +
198 +int __init of_ath5k_eeprom_probe(struct platform_device *pdev)
199 +{
200 + struct device_node *np = pdev->dev.of_node;
201 + struct resource *eep_res, *mac_res;
202 + void __iomem *eep, *mac;
203 + int mac_offset;
204 + u32 mac_inc = 0;
205 + int i;
206 +
207 + eep_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
208 + mac_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
209 +
210 + if (!eep_res) {
211 + dev_err(&pdev->dev, "failed to load eeprom address\n");
212 + return -ENODEV;
213 + }
214 + if (resource_size(eep_res) != ATH5K_PLAT_EEP_MAX_WORDS) {
215 + dev_err(&pdev->dev, "eeprom has an invalid size\n");
216 + return -EINVAL;
217 + }
218 +
219 + eep = ioremap(eep_res->start, resource_size(eep_res));
220 + memcpy_fromio(ath5k_eeprom_data, eep, ATH5K_PLAT_EEP_MAX_WORDS);
221 +
222 + if (of_find_property(np, "ath,eep-swap", NULL))
223 + for (i = 0; i < (ATH5K_PLAT_EEP_MAX_WORDS >> 1); i++)
224 + ath5k_eeprom_data[i] = swab16(ath5k_eeprom_data[i]);
225 +
226 + if (!of_property_read_u32(np, "ath,mac-offset", &mac_offset)) {
227 + memcpy_fromio(athxk_eeprom_mac, (void*) ath5k_eeprom_data, 6);
228 + } else if (mac_res) {
229 + if (resource_size(mac_res) != 6) {
230 + dev_err(&pdev->dev, "mac has an invalid size\n");
231 + return -EINVAL;
232 + }
233 + mac = ioremap(mac_res->start, resource_size(mac_res));
234 + memcpy_fromio(athxk_eeprom_mac, mac, 6);
235 + } else {
236 + dev_warn(&pdev->dev, "using random mac\n");
237 + random_ether_addr(athxk_eeprom_mac);
238 + }
239 +
240 + if (!of_property_read_u32(np, "ath,mac-increment", &mac_inc))
241 + athxk_eeprom_mac[5] += mac_inc;
242 +
243 + ath5k_pdata.eeprom_data = ath5k_eeprom_data;
244 + ath5k_pdata.macaddr = athxk_eeprom_mac;
245 + ltq_pci_plat_dev_init = ath5k_pci_plat_dev_init;
246 +
247 + dev_info(&pdev->dev, "loaded ath5k eeprom\n");
248 +
249 + return 0;
250 +}
251 +
252 +static struct of_device_id ath5k_eeprom_ids[] = {
253 + { .compatible = "ath5k,eeprom" },
254 + { }
255 +};
256 +
257 +static struct platform_driver ath5k_eeprom_driver = {
258 + .driver = {
259 + .name = "ath5k,eeprom",
260 + .owner = THIS_MODULE,
261 + .of_match_table = of_match_ptr(ath5k_eeprom_ids),
262 + },
263 +};
264 +
265 +static int __init of_ath5k_eeprom_init(void)
266 +{
267 + return platform_driver_probe(&ath5k_eeprom_driver, of_ath5k_eeprom_probe);
268 +}
269 +device_initcall(of_ath5k_eeprom_init);
270 diff --git a/arch/mips/lantiq/xway/eth_mac.c b/arch/mips/lantiq/xway/eth_mac.c
271 new file mode 100644
272 index 0000000..d288a0e
273 --- /dev/null
274 +++ b/arch/mips/lantiq/xway/eth_mac.c
275 @@ -0,0 +1,76 @@
276 +/*
277 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
278 + *
279 + * This program is free software; you can redistribute it and/or modify it
280 + * under the terms of the GNU General Public License version 2 as published
281 + * by the Free Software Foundation.
282 + */
283 +
284 +#include <linux/init.h>
285 +#include <linux/module.h>
286 +#include <linux/of_platform.h>
287 +#include <linux/if_ether.h>
288 +
289 +static u8 eth_mac[6];
290 +static int eth_mac_set;
291 +
292 +const u8* ltq_get_eth_mac(void)
293 +{
294 + return eth_mac;
295 +}
296 +
297 +static int __init setup_ethaddr(char *str)
298 +{
299 + eth_mac_set = mac_pton(str, eth_mac);
300 + return !eth_mac_set;
301 +}
302 +__setup("ethaddr=", setup_ethaddr);
303 +
304 +int __init of_eth_mac_probe(struct platform_device *pdev)
305 +{
306 + struct device_node *np = pdev->dev.of_node;
307 + struct resource *mac_res;
308 + void __iomem *mac;
309 + u32 mac_inc = 0;
310 +
311 + if (eth_mac_set) {
312 + dev_err(&pdev->dev, "mac was already set by bootloader\n");
313 + return -EINVAL;
314 + }
315 + mac_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
316 +
317 + if (!mac_res) {
318 + dev_err(&pdev->dev, "failed to load mac\n");
319 + return -EINVAL;
320 + }
321 + if (resource_size(mac_res) != 6) {
322 + dev_err(&pdev->dev, "mac has an invalid size\n");
323 + return -EINVAL;
324 + }
325 + mac = ioremap(mac_res->start, resource_size(mac_res));
326 + memcpy_fromio(eth_mac, mac, 6);
327 +
328 + if (!of_property_read_u32(np, "mac-increment", &mac_inc))
329 + eth_mac[5] += mac_inc;
330 +
331 + return 0;
332 +}
333 +
334 +static struct of_device_id eth_mac_ids[] = {
335 + { .compatible = "lantiq,eth-mac" },
336 + { /* sentinel */ }
337 +};
338 +
339 +static struct platform_driver eth_mac_driver = {
340 + .driver = {
341 + .name = "lantiq,eth-mac",
342 + .owner = THIS_MODULE,
343 + .of_match_table = of_match_ptr(eth_mac_ids),
344 + },
345 +};
346 +
347 +static int __init of_eth_mac_init(void)
348 +{
349 + return platform_driver_probe(&eth_mac_driver, of_eth_mac_probe);
350 +}
351 +device_initcall(of_eth_mac_init);
352 diff --git a/arch/mips/lantiq/xway/pci-ath-fixup.c b/arch/mips/lantiq/xway/pci-ath-fixup.c
353 new file mode 100644
354 index 0000000..c87ffb2
355 --- /dev/null
356 +++ b/arch/mips/lantiq/xway/pci-ath-fixup.c
357 @@ -0,0 +1,109 @@
358 +/*
359 + * Atheros AP94 reference board PCI initialization
360 + *
361 + * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
362 + *
363 + * This program is free software; you can redistribute it and/or modify it
364 + * under the terms of the GNU General Public License version 2 as published
365 + * by the Free Software Foundation.
366 + */
367 +
368 +#include <linux/pci.h>
369 +#include <linux/init.h>
370 +#include <linux/delay.h>
371 +#include <lantiq_soc.h>
372 +
373 +#define LTQ_PCI_MEM_BASE 0x18000000
374 +
375 +struct ath_fixup {
376 + u16 *cal_data;
377 + unsigned slot;
378 +};
379 +
380 +static int ath_num_fixups;
381 +static struct ath_fixup ath_fixups[2];
382 +
383 +static void ath_pci_fixup(struct pci_dev *dev)
384 +{
385 + void __iomem *mem;
386 + u16 *cal_data = NULL;
387 + u16 cmd;
388 + u32 bar0;
389 + u32 val;
390 + unsigned i;
391 +
392 + for (i = 0; i < ath_num_fixups; i++) {
393 + if (ath_fixups[i].cal_data == NULL)
394 + continue;
395 +
396 + if (ath_fixups[i].slot != PCI_SLOT(dev->devfn))
397 + continue;
398 +
399 + cal_data = ath_fixups[i].cal_data;
400 + break;
401 + }
402 +
403 + if (cal_data == NULL)
404 + return;
405 +
406 + if (*cal_data != 0xa55a) {
407 + pr_err("pci %s: invalid calibration data\n", pci_name(dev));
408 + return;
409 + }
410 +
411 + pr_info("pci %s: fixup device configuration\n", pci_name(dev));
412 +
413 + mem = ioremap(LTQ_PCI_MEM_BASE, 0x10000);
414 + if (!mem) {
415 + pr_err("pci %s: ioremap error\n", pci_name(dev));
416 + return;
417 + }
418 +
419 + pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0);
420 + pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, LTQ_PCI_MEM_BASE);
421 + pci_read_config_word(dev, PCI_COMMAND, &cmd);
422 + cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
423 + pci_write_config_word(dev, PCI_COMMAND, cmd);
424 +
425 + /* set pointer to first reg address */
426 + cal_data += 3;
427 + while (*cal_data != 0xffff) {
428 + u32 reg;
429 + reg = *cal_data++;
430 + val = *cal_data++;
431 + val |= (*cal_data++) << 16;
432 +
433 + ltq_w32(swab32(val), mem + reg);
434 + udelay(100);
435 + }
436 +
437 + pci_read_config_dword(dev, PCI_VENDOR_ID, &val);
438 + dev->vendor = val & 0xffff;
439 + dev->device = (val >> 16) & 0xffff;
440 +
441 + pci_read_config_dword(dev, PCI_CLASS_REVISION, &val);
442 + dev->revision = val & 0xff;
443 + dev->class = val >> 8; /* upper 3 bytes */
444 +
445 + pr_info("pci %s: fixup info: [%04x:%04x] revision %02x class %#08x\n",
446 + pci_name(dev), dev->vendor, dev->device, dev->revision, dev->class);
447 +
448 + pci_read_config_word(dev, PCI_COMMAND, &cmd);
449 + cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
450 + pci_write_config_word(dev, PCI_COMMAND, cmd);
451 +
452 + pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0);
453 +
454 + iounmap(mem);
455 +}
456 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath_pci_fixup);
457 +
458 +void __init ltq_pci_ath_fixup(unsigned slot, u16 *cal_data)
459 +{
460 + if (ath_num_fixups >= ARRAY_SIZE(ath_fixups))
461 + return;
462 +
463 + ath_fixups[ath_num_fixups].slot = slot;
464 + ath_fixups[ath_num_fixups].cal_data = cal_data;
465 + ath_num_fixups++;
466 +}
467 diff --git a/arch/mips/lantiq/xway/rt_eep.c b/arch/mips/lantiq/xway/rt_eep.c
468 new file mode 100644
469 index 0000000..00f2d4c
470 --- /dev/null
471 +++ b/arch/mips/lantiq/xway/rt_eep.c
472 @@ -0,0 +1,60 @@
473 +/*
474 + * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
475 + *
476 + * This program is free software; you can redistribute it and/or modify it
477 + * under the terms of the GNU General Public License version 2 as published
478 + * by the Free Software Foundation.
479 + */
480 +
481 +#include <linux/init.h>
482 +#include <linux/module.h>
483 +#include <linux/pci.h>
484 +#include <linux/platform_device.h>
485 +#include <linux/rt2x00_platform.h>
486 +
487 +extern int (*ltq_pci_plat_dev_init)(struct pci_dev *dev);
488 +static struct rt2x00_platform_data rt2x00_pdata;
489 +
490 +static int rt2x00_pci_plat_dev_init(struct pci_dev *dev)
491 +{
492 + dev->dev.platform_data = &rt2x00_pdata;
493 + return 0;
494 +}
495 +
496 +int __init of_ralink_eeprom_probe(struct platform_device *pdev)
497 +{
498 + struct device_node *np = pdev->dev.of_node;
499 + const char *eeprom;
500 +
501 + if (of_property_read_string(np, "ralink,eeprom", &eeprom)) {
502 + dev_err(&pdev->dev, "failed to load eeprom filename\n");
503 + return 0;
504 + }
505 +
506 + rt2x00_pdata.eeprom_file_name = kstrdup(eeprom, GFP_KERNEL);
507 +// rt2x00_pdata.mac_address = mac;
508 + ltq_pci_plat_dev_init = rt2x00_pci_plat_dev_init;
509 +
510 + dev_info(&pdev->dev, "using %s as eeprom\n", eeprom);
511 +
512 + return 0;
513 +}
514 +
515 +static struct of_device_id ralink_eeprom_ids[] = {
516 + { .compatible = "ralink,eeprom" },
517 + { }
518 +};
519 +
520 +static struct platform_driver ralink_eeprom_driver = {
521 + .driver = {
522 + .name = "ralink,eeprom",
523 + .owner = THIS_MODULE,
524 + .of_match_table = of_match_ptr(ralink_eeprom_ids),
525 + },
526 +};
527 +
528 +static int __init of_ralink_eeprom_init(void)
529 +{
530 + return platform_driver_probe(&ralink_eeprom_driver, of_ralink_eeprom_probe);
531 +}
532 +device_initcall(of_ralink_eeprom_init);
533 diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
534 index 91a37f1..fa23a7e 100644
535 --- a/drivers/net/ethernet/lantiq_etop.c
536 +++ b/drivers/net/ethernet/lantiq_etop.c
537 @@ -826,7 +826,8 @@ ltq_etop_init(struct net_device *dev)
538
539 ltq_etop_change_mtu(dev, 1500);
540
541 - memcpy(&mac.sa_data, priv->mac, ETH_ALEN);
542 + if (priv->mac)
543 + memcpy(&mac.sa_data, priv->mac, ETH_ALEN);
544 if (!is_valid_ether_addr(mac.sa_data)) {
545 pr_warn("etop: invalid MAC, using random\n");
546 random_ether_addr(mac.sa_data);
547 @@ -885,8 +886,7 @@ static const struct net_device_ops ltq_eth_netdev_ops = {
548 .ndo_tx_timeout = ltq_etop_tx_timeout,
549 };
550
551 -static int __devinit
552 -ltq_etop_probe(struct platform_device *pdev)
553 +static int ltq_etop_probe(struct platform_device *pdev)
554 {
555 struct net_device *dev;
556 struct ltq_etop_priv *priv;
557 @@ -950,7 +950,9 @@ ltq_etop_probe(struct platform_device *pdev)
558 priv->tx_irq = irqres[0].start;
559 priv->rx_irq = irqres[1].start;
560 priv->mii_mode = of_get_phy_mode(pdev->dev.of_node);
561 - priv->mac = of_get_mac_address(pdev->dev.of_node);
562 + priv->mac = ltq_get_eth_mac();
563 + if (!priv->mac)
564 + priv->mac = of_get_mac_address(pdev->dev.of_node);
565
566 priv->clk_ppe = clk_get(&pdev->dev, NULL);
567 if (IS_ERR(priv->clk_ppe))
568 --
569 1.7.10.4
570