firewall: update to git head
[librecmc/librecmc.git] / target / linux / lantiq / patches-3.7 / 0302-wifi-eep.patch
index 429d0e92c419b3aa9734ad02c1728c0501514c99..8932dfb726bf250baff52d1141bc7f35006c688a 100644 (file)
@@ -1,7 +1,5 @@
-Index: linux-3.7.4/arch/mips/lantiq/xway/Makefile
-===================================================================
---- linux-3.7.4.orig/arch/mips/lantiq/xway/Makefile    2013-01-28 18:08:39.000000000 +0100
-+++ linux-3.7.4/arch/mips/lantiq/xway/Makefile 2013-01-28 18:10:31.416141818 +0100
+--- a/arch/mips/lantiq/xway/Makefile
++++ b/arch/mips/lantiq/xway/Makefile
 @@ -1,3 +1,6 @@
  obj-y := prom.o sysctrl.o clk.o reset.o dma.o timer.o dcdc.o
  
@@ -9,11 +7,9 @@ Index: linux-3.7.4/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.7.4/arch/mips/lantiq/xway/ath_eep.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.7.4/arch/mips/lantiq/xway/ath_eep.c        2013-01-28 18:13:43.256146389 +0100
-@@ -0,0 +1,206 @@
+--- /dev/null
++++ b/arch/mips/lantiq/xway/ath_eep.c
+@@ -0,0 +1,195 @@
 +/*
 + *  Copyright (C) 2011 Luca Olivetti <luca@ventoso.org>
 + *  Copyright (C) 2011 John Crispin <blogic@openwrt.org>
@@ -39,7 +35,6 @@ Index: linux-3.7.4/arch/mips/lantiq/xway/ath_eep.c
 +struct ath9k_platform_data ath9k_pdata = {
 +      .led_pin = -1,
 +};
-+static u16 ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
 +static u8 athxk_eeprom_mac[6];
 +
 +static int ath9k_pci_plat_dev_init(struct pci_dev *dev)
@@ -56,7 +51,6 @@ Index: linux-3.7.4/arch/mips/lantiq/xway/ath_eep.c
 +      int mac_offset;
 +      u32 mac_inc = 0, pci_slot = 0;
 +      int i;
-+      u16 *eepdata, sum, el;
 +
 +      eep_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +      mac_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
@@ -65,34 +59,26 @@ Index: linux-3.7.4/arch/mips/lantiq/xway/ath_eep.c
 +              dev_err(&pdev->dev, "failed to load eeprom address\n");
 +              return -ENODEV;
 +      }
-+      if (resource_size(eep_res) != ATH9K_PLAT_EEP_MAX_WORDS) {
++      if (resource_size(eep_res) != ATH9K_PLAT_EEP_MAX_WORDS << 1) {
 +              dev_err(&pdev->dev, "eeprom has an invalid size\n");
 +              return -EINVAL;
 +      }
 +
 +      eep = ioremap(eep_res->start, resource_size(eep_res));
-+      memcpy_fromio(ath9k_pdata.eeprom_data, eep, ATH9K_PLAT_EEP_MAX_WORDS);
++      memcpy_fromio(ath9k_pdata.eeprom_data, eep, ATH9K_PLAT_EEP_MAX_WORDS << 1);
 +
-+      if (of_find_property(np, "ath,eep-swap", NULL)) {
++      if (of_find_property(np, "ath,eep-swap", NULL))
++              for (i = 0; i < ATH9K_PLAT_EEP_MAX_WORDS; i++)
++                      ath9k_pdata.eeprom_data[i] = swab16(ath9k_pdata.eeprom_data[i]);
++
++      if (of_find_property(np, "ath,eep-endian", NULL)) {
 +              ath9k_pdata.endian_check = true;
 +
 +              dev_info(&pdev->dev, "endian check enabled.\n");
 +      }
 +
-+      if (of_find_property(np, "ath,eep-csum", NULL)) {
-+              sum = ath9k_pdata.eeprom_data[0x200>>1];
-+              el = sum / sizeof(u16) - 2;  /* skip length and (old) checksum */
-+              eepdata = (u16 *) (&ath9k_pdata.eeprom_data[0x204>>1]); /* after checksum */
-+              for (i = 0; i < el; i++)
-+                      sum ^= *eepdata++;
-+              sum ^= 0xffff;
-+              ath9k_pdata.eeprom_data[0x202>>1] = sum;
-+
-+              dev_info(&pdev->dev, "checksum fixed.\n");
-+      }
-+
 +      if (!of_property_read_u32(np, "ath,mac-offset", &mac_offset)) {
-+              memcpy_fromio(athxk_eeprom_mac, (void*) ath9k_pdata.eeprom_data, 6);
++              memcpy_fromio(athxk_eeprom_mac, (void*) ath9k_pdata.eeprom_data + mac_offset, 6);
 +      } else if (mac_res) {
 +              if (resource_size(mac_res) != 6) {
 +                      dev_err(&pdev->dev, "mac has an invalid size\n");
@@ -139,7 +125,7 @@ Index: linux-3.7.4/arch/mips/lantiq/xway/ath_eep.c
 +{
 +      return platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
 +}
-+arch_initcall(of_ath9k_eeprom_init);
++late_initcall(of_ath9k_eeprom_init);
 +
 +
 +static int ath5k_pci_plat_dev_init(struct pci_dev *dev)
@@ -164,20 +150,20 @@ Index: linux-3.7.4/arch/mips/lantiq/xway/ath_eep.c
 +              dev_err(&pdev->dev, "failed to load eeprom address\n");
 +              return -ENODEV;
 +      }
-+      if (resource_size(eep_res) != ATH5K_PLAT_EEP_MAX_WORDS) {
++      if (resource_size(eep_res) != ATH5K_PLAT_EEP_MAX_WORDS << 1) {
 +              dev_err(&pdev->dev, "eeprom has an invalid size\n");
 +              return -EINVAL;
 +      }
 +
 +      eep = ioremap(eep_res->start, resource_size(eep_res));
-+      memcpy_fromio(ath5k_eeprom_data, eep, ATH5K_PLAT_EEP_MAX_WORDS);
++      memcpy_fromio(ath5k_pdata.eeprom_data, eep, ATH5K_PLAT_EEP_MAX_WORDS << 1);
 +
 +      if (of_find_property(np, "ath,eep-swap", NULL))
-+              for (i = 0; i < (ATH5K_PLAT_EEP_MAX_WORDS >> 1); i++)
-+                              ath5k_eeprom_data[i] = swab16(ath5k_eeprom_data[i]);
++              for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS; i++)
++                      ath5k_pdata.eeprom_data[i] = swab16(ath5k_pdata.eeprom_data[i]);
 +
 +      if (!of_property_read_u32(np, "ath,mac-offset", &mac_offset)) {
-+              memcpy_fromio(athxk_eeprom_mac, (void*) ath5k_eeprom_data, 6);
++              memcpy_fromio(athxk_eeprom_mac, (void*) ath5k_pdata.eeprom_data + mac_offset, 6);
 +      } else if (mac_res) {
 +              if (resource_size(mac_res) != 6) {
 +                      dev_err(&pdev->dev, "mac has an invalid size\n");
@@ -193,7 +179,6 @@ Index: linux-3.7.4/arch/mips/lantiq/xway/ath_eep.c
 +      if (!of_property_read_u32(np, "ath,mac-increment", &mac_inc))
 +              athxk_eeprom_mac[5] += mac_inc;
 +
-+      ath5k_pdata.eeprom_data = ath5k_eeprom_data;
 +      ath5k_pdata.macaddr = athxk_eeprom_mac;
 +      ltq_pci_plat_dev_init = ath5k_pci_plat_dev_init;
 +
@@ -219,12 +204,10 @@ Index: linux-3.7.4/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.7.4/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
-===================================================================
---- linux-3.7.4.orig/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h       2013-01-28 18:08:38.000000000 +0100
-+++ linux-3.7.4/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h    2013-01-28 18:10:03.616141155 +0100
-@@ -90,5 +90,8 @@
++late_initcall(of_ath5k_eeprom_init);
+--- 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);
  
@@ -233,10 +216,8 @@ Index: linux-3.7.4/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
 +
  #endif /* CONFIG_SOC_TYPE_XWAY */
  #endif /* _LTQ_XWAY_H__ */
-Index: linux-3.7.4/arch/mips/lantiq/xway/eth_mac.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.7.4/arch/mips/lantiq/xway/eth_mac.c        2013-01-28 18:10:03.620141154 +0100
+--- /dev/null
++++ b/arch/mips/lantiq/xway/eth_mac.c
 @@ -0,0 +1,76 @@
 +/*
 + *  Copyright (C) 2012 John Crispin <blogic@openwrt.org>
@@ -314,11 +295,9 @@ Index: linux-3.7.4/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.7.4/drivers/net/ethernet/lantiq_etop.c
-===================================================================
---- linux-3.7.4.orig/drivers/net/ethernet/lantiq_etop.c        2013-01-28 18:08:39.000000000 +0100
-+++ linux-3.7.4/drivers/net/ethernet/lantiq_etop.c     2013-01-28 18:10:03.620141154 +0100
-@@ -825,7 +825,8 @@
+--- a/drivers/net/ethernet/lantiq_etop.c
++++ b/drivers/net/ethernet/lantiq_etop.c
+@@ -825,7 +825,8 @@ ltq_etop_init(struct net_device *dev)
  
        ltq_etop_change_mtu(dev, 1500);
  
@@ -328,7 +307,7 @@ Index: linux-3.7.4/drivers/net/ethernet/lantiq_etop.c
        if (!is_valid_ether_addr(mac.sa_data)) {
                pr_warn("etop: invalid MAC, using random\n");
                random_ether_addr(mac.sa_data);
-@@ -949,7 +950,9 @@
+@@ -949,7 +950,9 @@ ltq_etop_probe(struct platform_device *p
        priv->tx_irq = irqres[0].start;
        priv->rx_irq = irqres[1].start;
        priv->mii_mode = of_get_phy_mode(pdev->dev.of_node);
@@ -339,10 +318,8 @@ Index: linux-3.7.4/drivers/net/ethernet/lantiq_etop.c
  
        priv->clk_ppe = clk_get(&pdev->dev, NULL);
        if (IS_ERR(priv->clk_ppe))
-Index: linux-3.7.4/arch/mips/lantiq/xway/rt_eep.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.7.4/arch/mips/lantiq/xway/rt_eep.c 2013-01-28 18:10:03.620141154 +0100
+--- /dev/null
++++ b/arch/mips/lantiq/xway/rt_eep.c
 @@ -0,0 +1,60 @@
 +/*
 + *  Copyright (C) 2011 John Crispin <blogic@openwrt.org>
@@ -404,10 +381,8 @@ Index: linux-3.7.4/arch/mips/lantiq/xway/rt_eep.c
 +      return platform_driver_probe(&ralink_eeprom_driver, of_ralink_eeprom_probe);
 +}
 +device_initcall(of_ralink_eeprom_init);
-Index: linux-3.7.4/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.7.4/arch/mips/include/asm/mach-lantiq/pci-ath-fixup.h      2013-01-28 18:10:03.620141154 +0100
+--- /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
@@ -415,10 +390,8 @@ Index: linux-3.7.4/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.7.4/arch/mips/lantiq/xway/pci-ath-fixup.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.7.4/arch/mips/lantiq/xway/pci-ath-fixup.c  2013-01-28 18:10:03.624141153 +0100
+--- /dev/null
++++ b/arch/mips/lantiq/xway/pci-ath-fixup.c
 @@ -0,0 +1,109 @@
 +/*
 + *  Atheros AP94 reference board PCI initialization