cf95b8d46f454fe8849f88e88e98255afd8fa239
[openwrt/openwrt.git] / target / linux / lantiq / patches-3.10 / 0202-lantiq_ath5k.patch
1 Index: linux-3.10.34/arch/mips/lantiq/xway/ath_eep.c
2 ===================================================================
3 --- linux-3.10.34.orig/arch/mips/lantiq/xway/ath_eep.c 2014-04-03 13:25:03.128464891 +0100
4 +++ linux-3.10.34/arch/mips/lantiq/xway/ath_eep.c 2014-04-03 13:35:30.432482868 +0100
5 @@ -36,10 +36,11 @@
6 return 0;
7 }
8
9 +static int ath9k_eep_load;
10 int __init of_ath9k_eeprom_probe(struct platform_device *pdev)
11 {
12 struct device_node *np = pdev->dev.of_node, *mtd_np;
13 - int mac_offset;
14 + int mac_offset, led_pin;
15 u32 mac_inc = 0, pci_slot = 0;
16 int i;
17 struct mtd_info *the_mtd;
18 @@ -112,6 +113,18 @@
19 if (!of_property_read_u32(np, "ath,pci-slot", &pci_slot)) {
20 ltq_pci_ath_fixup(pci_slot, ath9k_pdata.eeprom_data);
21 dev_info(&pdev->dev, "pci slot: %u\n", pci_slot);
22 + if (ath9k_eep_load) {
23 + struct pci_dev *d = NULL;
24 + while ((d = pci_get_device(PCI_VENDOR_ID_ATHEROS,
25 + PCI_ANY_ID, d)) != NULL)
26 + pci_fixup_device(pci_fixup_early, d);
27 + }
28 + }
29 +
30 + if (!of_property_read_u32(np, "ath,led-pin", &led_pin)) {
31 + ath9k_pdata.led_pin = led_pin;
32 +
33 + dev_info(&pdev->dev, "using led pin %d.\n", led_pin);
34 }
35
36 dev_info(&pdev->dev, "loaded ath9k eeprom\n");
37 @@ -132,20 +145,19 @@
38 },
39 };
40
41 -static int ath9k_eep_loaded;
42 static int __init of_ath9k_eeprom_init(void)
43 {
44 int ret = platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
45
46 - if (!ret)
47 - ath9k_eep_loaded = 1;
48 + if (ret)
49 + ath9k_eep_load = 1;
50
51 return ret;
52 }
53
54 static int __init of_ath9k_eeprom_init_late(void)
55 {
56 - if (ath9k_eep_loaded)
57 + if (!ath9k_eep_load)
58 return 0;
59 return platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
60 }
61 @@ -247,4 +259,4 @@
62 {
63 return platform_driver_probe(&ath5k_eeprom_driver, of_ath5k_eeprom_probe);
64 }
65 -device_initcall(of_ath5k_eeprom_init);
66 +subsys_initcall(of_ath5k_eeprom_init);