lantiq: w303v has its rt2860 eep on the nor flash. tell compat-wireless how to use it
authorJohn Crispin <john@openwrt.org>
Sat, 12 Nov 2011 18:41:15 +0000 (18:41 +0000)
committerJohn Crispin <john@openwrt.org>
Sat, 12 Nov 2011 18:41:15 +0000 (18:41 +0000)
SVN-Revision: 28994

package/mac80211/patches/605-rt2x00-pci-eeprom.patch [new file with mode: 0644]
target/linux/lantiq/files-3.1/arch/mips/lantiq/dev-wifi-rt2x00.c [new file with mode: 0644]
target/linux/lantiq/files-3.1/arch/mips/lantiq/dev-wifi-rt2x00.h [new file with mode: 0644]
target/linux/lantiq/files-3.1/arch/mips/lantiq/xway/mach-arv45xx.c
target/linux/lantiq/patches/211-devices.patch

diff --git a/package/mac80211/patches/605-rt2x00-pci-eeprom.patch b/package/mac80211/patches/605-rt2x00-pci-eeprom.patch
new file mode 100644 (file)
index 0000000..c2e574d
--- /dev/null
@@ -0,0 +1,50 @@
+Index: compat-wireless-2011-11-04/drivers/net/wireless/rt2x00/rt2800pci.c
+===================================================================
+--- compat-wireless-2011-11-04.orig/drivers/net/wireless/rt2x00/rt2800pci.c    2011-11-12 19:34:24.760314206 +0100
++++ compat-wireless-2011-11-04/drivers/net/wireless/rt2x00/rt2800pci.c 2011-11-12 19:34:24.956314211 +0100
+@@ -84,7 +84,7 @@
+       rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
+ }
+-static void rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
++static void rt2800pci_read_eeprom_file(struct rt2x00_dev *rt2x00dev)
+ {
+       memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, EEPROM_SIZE);
+ }
+@@ -938,8 +938,9 @@
+       /*
+        * Read EEPROM into buffer
+        */
+-      if (rt2x00_is_soc(rt2x00dev))
+-              rt2800pci_read_eeprom_soc(rt2x00dev);
++      if (rt2x00_is_soc(rt2x00dev) ||
++                      test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags))
++              rt2800pci_read_eeprom_file(rt2x00dev);
+       else if (rt2800pci_efuse_detect(rt2x00dev))
+               rt2800pci_read_eeprom_efuse(rt2x00dev);
+       else
+Index: compat-wireless-2011-11-04/drivers/net/wireless/rt2x00/rt2x00pci.c
+===================================================================
+--- compat-wireless-2011-11-04.orig/drivers/net/wireless/rt2x00/rt2x00pci.c    2011-11-12 19:34:24.704314204 +0100
++++ compat-wireless-2011-11-04/drivers/net/wireless/rt2x00/rt2x00pci.c 2011-11-12 19:34:24.956314211 +0100
+@@ -255,6 +255,7 @@
+ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops)
+ {
+       struct ieee80211_hw *hw;
++      struct rt2x00_platform_data *pdata;
+       struct rt2x00_dev *rt2x00dev;
+       int retval;
+@@ -299,6 +300,12 @@
+       rt2x00dev->irq = pci_dev->irq;
+       rt2x00dev->name = pci_name(pci_dev);
++      /* if we get passed the name of a eeprom_file_name, then use this in
++         favour of the eeprom */
++      pdata = rt2x00dev->dev->platform_data;
++      if (pdata && pdata->eeprom_file_name)
++              set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags);
++
+       if (pci_is_pcie(pci_dev))
+               rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
+       else
diff --git a/target/linux/lantiq/files-3.1/arch/mips/lantiq/dev-wifi-rt2x00.c b/target/linux/lantiq/files-3.1/arch/mips/lantiq/dev-wifi-rt2x00.c
new file mode 100644 (file)
index 0000000..94932df
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ *  Copyright (C) 2011 John Crispin <blogic@openwrt.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/rt2x00_platform.h>
+#include <linux/pci.h>
+
+#include "dev-wifi-rt2x00.h"
+
+extern int (*ltqpci_plat_dev_init)(struct pci_dev *dev);
+struct rt2x00_platform_data rt2x00_pdata;
+
+static int
+rt2x00_pci_plat_dev_init(struct pci_dev *dev)
+{
+       dev->dev.platform_data = &rt2x00_pdata;
+       return 0;
+}
+
+void __init
+ltq_register_rt2x00(const char *firmware)
+{
+       rt2x00_pdata.eeprom_file_name =  kstrdup(firmware, GFP_KERNEL);
+       ltqpci_plat_dev_init = rt2x00_pci_plat_dev_init;
+}
diff --git a/target/linux/lantiq/files-3.1/arch/mips/lantiq/dev-wifi-rt2x00.h b/target/linux/lantiq/files-3.1/arch/mips/lantiq/dev-wifi-rt2x00.h
new file mode 100644 (file)
index 0000000..060ca50
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ *  Copyright (C) 2011 John Crispin <blogic@openwrt.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#ifndef _DEV_WIFI_RT2X00_H__
+#define _DEV_WIFI_RT2X00_H__
+
+extern void ltq_register_rt2x00(const char *firmware);
+
+#endif
index 1c0fcb5e749c2f5fe8016d962ad400a1c4ae68b9..b08ada5e3ff1cddef9935ba338809e8034c27b3b 100644 (file)
@@ -24,6 +24,7 @@
 #include <dev-gpio-leds.h>
 
 #include "../machtypes.h"
+#include "../dev-wifi-rt2x00.h"
 #include "devices.h"
 #include "dev-dwc_otg.h"
 
@@ -484,9 +485,12 @@ arv7525pw_init(void)
        ltq_add_device_gpio_leds(-1, ARRAY_SIZE(arv4525pw_gpio_leds), arv4525pw_gpio_leds);
        ltq_register_nor(&arv7525_flash_data);
        ltq_pci_data.clock = PCI_CLOCK_INT;
+       ltq_pci_data.gpio |= PCI_EXIN1;
+       ltq_pci_data.irq[14] = (INT_NUM_IM3_IRL0 + 31);
        ltq_register_pci(&ltq_pci_data);
        ltq_eth_data.mii_mode = PHY_INTERFACE_MODE_MII;
        arv45xx_register_ethernet();
+       ltq_register_rt2x00("RT2860.eeprom");
        ltq_register_tapi();
 }
 
index 92c2902d1c70a804d9ca74e5f1fe1a8d7e34acbb..a5561c788ecff0222c83bc78cae24570ee39b40e 100644 (file)
@@ -1,5 +1,7 @@
---- a/arch/mips/lantiq/devices.c
-+++ b/arch/mips/lantiq/devices.c
+Index: linux-3.1/arch/mips/lantiq/devices.c
+===================================================================
+--- linux-3.1.orig/arch/mips/lantiq/devices.c  2011-11-12 18:06:54.712192370 +0100
++++ linux-3.1/arch/mips/lantiq/devices.c       2011-11-12 18:06:55.544192390 +0100
 @@ -18,6 +18,7 @@
  #include <linux/time.h>
  #include <linux/io.h>
@@ -8,7 +10,7 @@
  
  #include <asm/bootinfo.h>
  #include <asm/irq.h>
-@@ -100,3 +101,20 @@ void __init ltq_register_pci(struct ltq_
+@@ -100,3 +101,20 @@
        pr_err("kernel is compiled without PCI support\n");
  }
  #endif
 +      cp1_base =
 +              (void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC));
 +}
---- a/arch/mips/lantiq/devices.h
-+++ b/arch/mips/lantiq/devices.h
-@@ -23,5 +23,6 @@ extern void ltq_register_nor(struct phys
+Index: linux-3.1/arch/mips/lantiq/devices.h
+===================================================================
+--- linux-3.1.orig/arch/mips/lantiq/devices.h  2011-11-12 18:06:54.712192370 +0100
++++ linux-3.1/arch/mips/lantiq/devices.h       2011-11-12 18:06:55.544192390 +0100
+@@ -23,5 +23,6 @@
  extern void ltq_register_wdt(void);
  extern void ltq_register_asc(int port);
  extern void ltq_register_pci(struct ltq_pci_data *data);
 +extern void ltq_register_tapi(void);
  
  #endif
---- a/arch/mips/lantiq/xway/Makefile
-+++ b/arch/mips/lantiq/xway/Makefile
+Index: linux-3.1/arch/mips/lantiq/xway/Makefile
+===================================================================
+--- linux-3.1.orig/arch/mips/lantiq/xway/Makefile      2011-11-12 18:06:55.520192389 +0100
++++ linux-3.1/arch/mips/lantiq/xway/Makefile   2011-11-12 18:06:55.544192390 +0100
 @@ -1,5 +1,7 @@
  obj-y := sysctrl.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o dma.o nand.o timer.o
  
  obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o
  obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o
  obj-$(CONFIG_SOC_VR9) += clk-vr9.o prom-vr9.o
---- a/arch/mips/lantiq/xway/devices.c
-+++ b/arch/mips/lantiq/xway/devices.c
+Index: linux-3.1/arch/mips/lantiq/xway/devices.c
+===================================================================
+--- linux-3.1.orig/arch/mips/lantiq/xway/devices.c     2011-11-12 18:06:55.304192384 +0100
++++ linux-3.1/arch/mips/lantiq/xway/devices.c  2011-11-12 18:06:55.544192390 +0100
 @@ -19,6 +19,7 @@
  #include <linux/time.h>
  #include <linux/io.h>
@@ -58,7 +66,7 @@
  
  #include <asm/bootinfo.h>
  #include <asm/irq.h>
-@@ -99,3 +100,98 @@ ltq_register_etop(struct ltq_eth_data *e
+@@ -99,3 +100,98 @@
                platform_device_register(&ltq_etop);
        }
  }
 +      ltq_spi.dev.platform_data = pdata;
 +      platform_device_register(&ltq_spi);
 +}
---- a/arch/mips/lantiq/xway/devices.h
-+++ b/arch/mips/lantiq/xway/devices.h
+Index: linux-3.1/arch/mips/lantiq/xway/devices.h
+===================================================================
+--- linux-3.1.orig/arch/mips/lantiq/xway/devices.h     2011-10-24 09:10:05.000000000 +0200
++++ linux-3.1/arch/mips/lantiq/xway/devices.h  2011-11-12 18:06:55.544192390 +0100
 @@ -11,10 +11,17 @@
  
  #include "../devices.h"
 +extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
  
  #endif
---- a/arch/mips/lantiq/Makefile
-+++ b/arch/mips/lantiq/Makefile
+Index: linux-3.1/arch/mips/lantiq/Makefile
+===================================================================
+--- linux-3.1.orig/arch/mips/lantiq/Makefile   2011-11-12 18:06:54.780192371 +0100
++++ linux-3.1/arch/mips/lantiq/Makefile        2011-11-12 19:52:32.700339384 +0100
 @@ -4,7 +4,7 @@
  # under the terms of the GNU General Public License version 2 as published
  # by the Free Software Foundation.
  
 -obj-y := irq.o setup.o clk.o prom.o devices.o
-+obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o
++obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o dev-wifi-rt2x00.o
  
  obj-$(CONFIG_EARLY_PRINTK) += early_printk.o