[OpenWrt-Devel] [PATCH] lantiq: make loading pci fixup data from cal_data work again

Ben Mulvihill ben.mulvihill at gmail.com
Tue Jun 17 13:06:42 EDT 2014


Changeset 40948 restored an older (and uglier!) version of the
code for reading the athxk calibration partition on lantiq
xway boards. As a result pci fixups stored in this partition
are no longer applied, breaking wireless on the BTHOMEHUBV2B
and (I imagine) on the DGN3500. This is a minimal patch to
restore this functionality for ath9k without reverting any
of the other changes in changeset 40948.

Note for John Crispin:
I guess you won't want to apply this patch if you are planning
to check changeset 40948 anyway yourself. I produced it for
my own use and thought I might as well send it in in case it
was any use to anyone.

Ben Mulvihill


--- a/arch/mips/lantiq/xway/ath_eep.c	2014-06-16 12:10:10.413893209 +0200
+++ b/arch/mips/lantiq/xway/ath_eep.c	2014-06-16 12:10:26.366264625 +0200
@@ -35,6 +35,7 @@ static int ath9k_pci_plat_dev_init(struc
 	return 0;
 }
 
+static int ath9k_eep_load;
 int __init of_ath9k_eeprom_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node, *mtd_np;
@@ -117,6 +118,13 @@ int __init of_ath9k_eeprom_probe(struct
 		ltq_pci_ath_fixup(pci_slot, ath9k_pdata.eeprom_data);
 
 		dev_info(&pdev->dev, "pci slot: %u\n", pci_slot);
+                if (ath9k_eep_load) {
+                        struct pci_dev *d = NULL;
+                        while ((d = pci_get_device(PCI_VENDOR_ID_ATHEROS,
+                                        PCI_ANY_ID, d)) != NULL)
+                                pci_fixup_device(pci_fixup_early, d);
+                }
+
 	}
 
 	dev_info(&pdev->dev, "loaded ath9k eeprom\n");
@@ -139,9 +147,22 @@ static struct platform_driver ath9k_eepr
 
 static int __init of_ath9k_eeprom_init(void)
 {
-	return platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
+        int ret = platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
+
+        if (ret)
+                ath9k_eep_load = 1;
+
+        return ret;
+}
+
+static int __init of_ath9k_eeprom_init_late(void)
+{
+        if (!ath9k_eep_load)
+                return 0;
+        return platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
 }
-arch_initcall(of_ath9k_eeprom_init);
+late_initcall(of_ath9k_eeprom_init_late);
+subsys_initcall(of_ath9k_eeprom_init);
 
 
 static int ath5k_pci_plat_dev_init(struct pci_dev *dev)
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list