[OpenWrt-Devel] [PATCH 1/2] [kernel] Fix the ath9k pci eeprom init code to use the

Geoffrey McRae geoff at spacevs.com
Mon Sep 22 09:04:34 EDT 2014


 From 349a53426c78da1d02ecb8b8ade6b8c4de4057c2 Mon Sep 17 00:00:00 2001
 From: Geoffrey McRae <geoff at spacevs.com>
Date: Mon, 22 Sep 2014 21:49:32 +1000
Subject: [PATCH 1/2] Lantiq: Fix the ath9k pci eeprom init code to use 
the
  BAR0 base address instead of a fixed address

Fixes support for AR9287 on TP-Link TD-W8980 and possibly other 
platforms that use this chip.

Signed-off-by: Geoffrey McRae <geoff at spacevs.com>
---
  ...-lantiq-wifi-and-ethernet-eeprom-handling.patch |   54 
++++++++------------
  1 file changed, 20 insertions(+), 34 deletions(-)

diff --git 
a/target/linux/lantiq/patches-3.10/0010-MIPS-lantiq-wifi-and-ethernet-eeprom-handling.patch 
b/target/linux/lantiq/patches-3.10/0010-MIPS-lantiq-wifi-and-ethernet-eeprom-handling.patch
index d6025a0..62f66a6 100644
--- 
a/target/linux/lantiq/patches-3.10/0010-MIPS-lantiq-wifi-and-ethernet-eeprom-handling.patch
+++ 
b/target/linux/lantiq/patches-3.10/0010-MIPS-lantiq-wifi-and-ethernet-eeprom-handling.patch
@@ -19,10 +19,8 @@ Subject: [PATCH 18/22] owrt: lantiq: wifi and 
ethernet eeprom handling
   create mode 100644 arch/mips/lantiq/xway/pci-ath-fixup.c
   create mode 100644 arch/mips/lantiq/xway/rt_eep.c

-Index: linux-3.10.49/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ 
linux-3.10.49/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h	2014-09-07 
17:34:26.488234696 +0200
+--- /dev/null
++++ b/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h
  @@ -0,0 +1,6 @@
  +#ifndef _PCI_ATH_FIXUP
  +#define _PCI_ATH_FIXUP
@@ -30,11 +28,9 @@ Index: 
linux-3.10.49/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h
  +void ltq_pci_ath_fixup(unsigned slot, u16 *cal_data) __init;
  +
  +#endif /* _PCI_ATH_FIXUP */
-Index: 
linux-3.10.49/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
-===================================================================
---- 
linux-3.10.49.orig/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h	2014-07-18 
00:58:15.000000000 +0200
-+++ 
linux-3.10.49/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h	2014-09-07 
17:34:26.488234696 +0200
-@@ -90,5 +90,8 @@
+--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
++++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
+@@ -90,5 +90,8 @@ int xrx200_gphy_boot(struct device *dev,
   extern void ltq_pmu_enable(unsigned int module);
   extern void ltq_pmu_disable(unsigned int module);

@@ -43,11 +39,9 @@ Index: 
linux-3.10.49/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
  +
   #endif /* CONFIG_SOC_TYPE_XWAY */
   #endif /* _LTQ_XWAY_H__ */
-Index: linux-3.10.49/arch/mips/lantiq/xway/Makefile
-===================================================================
---- linux-3.10.49.orig/arch/mips/lantiq/xway/Makefile	2014-09-07 
17:34:26.448234696 +0200
-+++ linux-3.10.49/arch/mips/lantiq/xway/Makefile	2014-09-07 
17:41:10.740227820 +0200
-@@ -2,4 +2,7 @@
+--- a/arch/mips/lantiq/xway/Makefile
++++ b/arch/mips/lantiq/xway/Makefile
+@@ -2,4 +2,7 @@ obj-y := prom.o sysctrl.o clk.o reset.o

   obj-y += vmmc.o

@@ -55,10 +49,8 @@ Index: linux-3.10.49/arch/mips/lantiq/xway/Makefile
  +obj-$(CONFIG_PCI) += ath_eep.o rt_eep.o pci-ath-fixup.o
  +
   obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o
-Index: linux-3.10.49/arch/mips/lantiq/xway/ath_eep.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.10.49/arch/mips/lantiq/xway/ath_eep.c	2014-09-07 
17:41:03.184227948 +0200
+--- /dev/null
++++ b/arch/mips/lantiq/xway/ath_eep.c
  @@ -0,0 +1,282 @@
  +/*
  + *  Copyright (C) 2011 Luca Olivetti <luca at ventoso.org>
@@ -342,10 +334,8 @@ Index: 
linux-3.10.49/arch/mips/lantiq/xway/ath_eep.c
  +	return platform_driver_probe(&ath5k_eeprom_driver, 
of_ath5k_eeprom_probe);
  +}
  +device_initcall(of_ath5k_eeprom_init);
-Index: linux-3.10.49/arch/mips/lantiq/xway/eth_mac.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.10.49/arch/mips/lantiq/xway/eth_mac.c	2014-09-07 
17:34:26.488234696 +0200
+--- /dev/null
++++ b/arch/mips/lantiq/xway/eth_mac.c
  @@ -0,0 +1,76 @@
  +/*
  + *  Copyright (C) 2012 John Crispin <blogic at openwrt.org>
@@ -423,10 +413,8 @@ Index: 
linux-3.10.49/arch/mips/lantiq/xway/eth_mac.c
  +	return platform_driver_probe(&eth_mac_driver, of_eth_mac_probe);
  +}
  +device_initcall(of_eth_mac_init);
-Index: linux-3.10.49/arch/mips/lantiq/xway/pci-ath-fixup.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.10.49/arch/mips/lantiq/xway/pci-ath-fixup.c	2014-09-07 
17:34:26.488234696 +0200
+--- /dev/null
++++ b/arch/mips/lantiq/xway/pci-ath-fixup.c
  @@ -0,0 +1,109 @@
  +/*
  + *  Atheros AP94 reference board PCI initialization
@@ -443,8 +431,6 @@ Index: 
linux-3.10.49/arch/mips/lantiq/xway/pci-ath-fixup.c
  +#include <linux/delay.h>
  +#include <lantiq_soc.h>
  +
-+#define LTQ_PCI_MEM_BASE		0x18000000
-+
  +struct ath_fixup {
  +	u16		*cal_data;
  +	unsigned	slot;
@@ -455,6 +441,7 @@ Index: 
linux-3.10.49/arch/mips/lantiq/xway/pci-ath-fixup.c
  +
  +static void ath_pci_fixup(struct pci_dev *dev)
  +{
++	u32 base;
  +	void __iomem *mem;
  +	u16 *cal_data = NULL;
  +	u16 cmd;
@@ -483,14 +470,15 @@ Index: 
linux-3.10.49/arch/mips/lantiq/xway/pci-ath-fixup.c
  +
  +	pr_info("pci %s: fixup device configuration\n", pci_name(dev));
  +
-+	mem = ioremap(LTQ_PCI_MEM_BASE, 0x10000);
++	base = dev->resource[0].start;
++	mem = ioremap(base, 0x10000);
  +	if (!mem) {
  +		pr_err("pci %s: ioremap error\n", pci_name(dev));
  +		return;
  +	}
  +
  +	pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0);
-+	pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, LTQ_PCI_MEM_BASE);
++	pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, base);
  +	pci_read_config_word(dev, PCI_COMMAND, &cmd);
  +	cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
  +	pci_write_config_word(dev, PCI_COMMAND, cmd);
@@ -537,10 +525,8 @@ Index: 
linux-3.10.49/arch/mips/lantiq/xway/pci-ath-fixup.c
  +	ath_fixups[ath_num_fixups].cal_data = cal_data;
  +	ath_num_fixups++;
  +}
-Index: linux-3.10.49/arch/mips/lantiq/xway/rt_eep.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.10.49/arch/mips/lantiq/xway/rt_eep.c	2014-09-07 
17:34:26.488234696 +0200
+--- /dev/null
++++ b/arch/mips/lantiq/xway/rt_eep.c
  @@ -0,0 +1,60 @@
  +/*
  + *  Copyright (C) 2011 John Crispin <blogic at openwrt.org>
-- 
1.7.10.4
_______________________________________________
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