The following patch improves the support for the arv7518pw:

- it defines the gpio to activate the usb (it was in a previous patch, still 
  unapplied)
- adds support for the wifi chip (ath9k)
- defines a specific profile for the arv7518
- doesn't trash the command line parameters set in uboot

I could only test wifi in station mode and in the g band, and, while it
works, the performance is atrocious, however nobody helped so I cannot do
better.
Oh, and it needs the patch to mac80211 that I posted previously.

Signed-off-by: Luca Olivetti <l...@ventoso.org>

--- 

Index: target/linux/lantiq/image/Makefile
===================================================================
--- target/linux/lantiq/image/Makefile  (revisión: 25626)
+++ target/linux/lantiq/image/Makefile  (copia de trabajo)
@@ -9,7 +9,7 @@
 
 JFFS2_BLOCKSIZE = 64k 128k 256k
 
-xway_cmdline=-console=ttyS1,115200 rootfstype=squashfs,jffs2
+xway_cmdline=console=ttyS1,115200 rootfstype=squashfs,jffs2
 falcon_cmdline=-console=ttyS0,115200 rootfstype=squashfs,jffs2
 
 define CompressLzma
@@ -111,6 +111,14 @@
        $(call Image/Build/$(1),$(1),ARV752DPW22)
 endef
 
+define Image/BuildKernel/Profile/ARV7518PW
+       $(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline))
+endef
+
+define Image/Build/Profile/ARV7518PW
+       $(call Image/Build/$(1),$(1),ARV7518PW)
+endef
+
 define Image/BuildKernel/Profile/Generic
        $(call Image/BuildKernel/Template,EASY4010,$(xway_cmdline))
        $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
Index: target/linux/lantiq/patches/400-mach-arv45xx.patch
===================================================================
--- target/linux/lantiq/patches/400-mach-arv45xx.patch  (revisión: 25626)
+++ target/linux/lantiq/patches/400-mach-arv45xx.patch  (copia de trabajo)
@@ -1,6 +1,6 @@
 --- a/arch/mips/include/asm/mach-lantiq/machine.h
 +++ b/arch/mips/include/asm/mach-lantiq/machine.h
-@@ -11,4 +11,14 @@
+@@ -11,4 +11,14 @@ enum lantiq_mach_type {
        LANTIQ_MACH_EASY4010,           /* Twinpass evalkit */
        LANTIQ_MACH_EASY50712,          /* Danube evalkit */
        LANTIQ_MACH_EASY50812,          /* AR9 eval board */
@@ -17,7 +17,7 @@
  };
 --- a/arch/mips/lantiq/xway/Kconfig
 +++ b/arch/mips/lantiq/xway/Kconfig
-@@ -14,6 +14,10 @@
+@@ -14,6 +14,10 @@ config LANTIQ_MACH_EASY4010
        bool "Easy4010"
        default y
  
@@ -30,14 +30,14 @@
  endif
 --- a/arch/mips/lantiq/xway/Makefile
 +++ b/arch/mips/lantiq/xway/Makefile
-@@ -3,3 +3,4 @@
+@@ -3,3 +3,4 @@ obj-y += gpio.o gpio_ebu.o gpio_leds.o d
  obj-$(CONFIG_LANTIQ_MACH_EASY50812) += mach-easy50812.o
  obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
  obj-$(CONFIG_LANTIQ_MACH_EASY4010) += mach-easy4010.o
 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
-@@ -0,0 +1,514 @@
+@@ -0,0 +1,540 @@
 +/*
 + *  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
@@ -57,6 +57,7 @@
 +#include <linux/input.h>
 +#include <linux/etherdevice.h>
 +#include <linux/ath5k_platform.h>
++#include <linux/ath9k_platform.h>
 +#include <linux/pci.h>
 +
 +#include <machine.h>
@@ -358,6 +359,31 @@
 +      lqpci_plat_dev_init = arv45xx_pci_plat_dev_init;
 +}
 +
++static struct ath9k_platform_data arv7518_ath9k_wmac_data = {
++      .led_pin = -1,
++      .check_endianness = 1,
++};
++
++static int arv7518_pci_plat_dev_init(struct pci_dev *dev)
++{
++      dev->dev.platform_data = &arv7518_ath9k_wmac_data;
++      return 0;
++}
++
++void __init
++arv7518_register_ath9k(unsigned char *mac)
++{
++#define ARV7518_BRN_ATH               0xa07f0400
++      u16 *eepdata;
++
++      memcpy_fromio(arv7518_ath9k_wmac_data.eeprom_data,
++              (void *)KSEG1ADDR(LQ_FLASH_START + 
ARV7518_BRN_ATH),sizeof(arv7518_ath9k_wmac_data.eeprom_data));
++      eepdata = (u16 *) (&arv7518_ath9k_wmac_data.eeprom_data);
++      arv7518_ath9k_wmac_data.macaddr = mac;
++      lqpci_plat_dev_init = arv7518_pci_plat_dev_init;
++      pci_enable_ath9k_fixup(14, arv7518_ath9k_wmac_data.eeprom_data);
++}
++
 +static void __init
 +arv4510pw_init(void)
 +{
@@ -501,7 +527,7 @@
 +arv7518pw_init(void)
 +{
 +#define ARV7518PW_EBU                 0x2
-+#define ARV7518PW_USB                 -1
++#define ARV7518PW_USB                 14
 +
 +      lq_register_gpio();
 +      lq_register_gpio_ebu(ARV7518PW_EBU);
@@ -514,7 +540,7 @@
 +      lq_register_wdt();
 +      xway_register_dwc(ARV7518PW_USB);
 +      arv75xx_register_ethernet();
-+      //arv7518_register_ath9k(mac);
++      arv7518_register_ath9k(lq_eth_data.mac);
 +}
 +
 +MIPS_MACHINE(LANTIQ_MACH_ARV7518PW,
@@ -552,3 +578,135 @@
 +                      "ARV752DPW22",
 +                      "ARV752DPW22 - Arcor A803",
 +                      arv752dpw22_init);
+--- a/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
++++ b/arch/mips/include/asm/mach-lantiq/lantiq_platform.h
+@@ -47,5 +47,6 @@ struct lq_pci_data {
+ };
+ 
+ extern int (*lqpci_plat_dev_init)(struct pci_dev *dev);
++void pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data) __init;
+ 
+ #endif
+--- a/arch/mips/pci/pci-lantiq.c
++++ b/arch/mips/pci/pci-lantiq.c
+@@ -65,6 +65,105 @@ extern int lq_pci_read_config_dword(stru
+ extern int lq_pci_write_config_dword(struct pci_bus *bus,
+       unsigned int devfn, int where, int size, u32 val);
+ 
++struct ath9k_fixup {
++      u16             *cal_data;
++      unsigned        slot;
++};
++
++static int ath9k_num_fixups;
++static struct ath9k_fixup ath9k_fixups[2];
++
++static void ath9k_pci_fixup(struct pci_dev *dev)
++{
++      void __iomem *mem;
++      u16 *cal_data = NULL;
++      u16 cmd;
++      u32 bar0;
++      u32 val;
++      unsigned i;
++
++      pr_info("ath9k_pci_fixup slot: %d, ath9k_num_fixups %d\n", 
PCI_SLOT(dev->devfn), ath9k_num_fixups);
++      for (i = 0; i < ath9k_num_fixups; i++) {
++              if (ath9k_fixups[i].cal_data == NULL)
++                      continue;
++
++              if (ath9k_fixups[i].slot != PCI_SLOT(dev->devfn))
++                      continue;
++
++              cal_data = ath9k_fixups[i].cal_data;
++              break;
++      }
++
++      if (cal_data == NULL)
++              return;
++
++      if (*cal_data != 0xa55a) {
++              pr_err("pci %s: invalid calibration data\n", pci_name(dev));
++              return;
++      }
++
++      pr_info("pci %s: fixup device configuration\n", pci_name(dev));
++
++      mem = ioremap(LQ_PCI_MEM_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, LQ_PCI_MEM_BASE);
++
++      pci_read_config_word(dev, PCI_COMMAND, &cmd);
++      cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
++      pci_write_config_word(dev, PCI_COMMAND, cmd);
++
++      /* set pointer to first reg address */
++      cal_data += 3;
++      while (*cal_data != 0xffff) {
++              u32 reg;
++              reg = *cal_data++;
++              /* original from ar71xx
++              val = *cal_data++;
++              val |= (*cal_data++) << 16; */
++              /* my version */
++              val = swab16(*cal_data++) << 16;
++              val |= swab16(*cal_data++);
++              pr_info("ath9k_pci_fixup   reg %x val %x\n",reg,val);
++
++              __raw_writel(val, mem + reg);
++              udelay(100);
++      }
++
++      pci_read_config_dword(dev, PCI_VENDOR_ID, &val);
++      dev->vendor = val & 0xffff;
++      dev->device = (val >> 16) & 0xffff;
++      pr_info("ath9k_pci_fixup  vid:pid %04x:%04x\n", dev->vendor, 
dev->device);
++
++      pci_read_config_dword(dev, PCI_CLASS_REVISION, &val);
++      dev->revision = val & 0xff;
++      dev->class = val >> 8; /* upper 3 bytes */
++
++      pci_read_config_word(dev, PCI_COMMAND, &cmd);
++      cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
++      pci_write_config_word(dev, PCI_COMMAND, cmd);
++
++      pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0);
++
++      iounmap(mem);
++}
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup);
++
++void __init pci_enable_ath9k_fixup(unsigned slot, u16 *cal_data)
++{
++      if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups))
++              return;
++
++      ath9k_fixups[ath9k_num_fixups].slot = slot;
++      ath9k_fixups[ath9k_num_fixups].cal_data = cal_data;
++      ath9k_num_fixups++;
++}
++
+ u32 lq_pci_mapped_cfg;
+ 
+ int (*lqpci_plat_dev_init)(struct pci_dev *dev) = NULL;
+--- a/include/linux/ath9k_platform.h
++++ b/include/linux/ath9k_platform.h
+@@ -23,6 +23,12 @@
+ 
+ struct ath9k_platform_data {
+       u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
++      u8 *macaddr;
++
++      int led_pin;
++      u32 gpio_mask;
++      u32 gpio_val;
++      int check_endianness;
+ };
+ 
+ #endif /* _LINUX_ATH9K_PLATFORM_H */
Index: target/linux/lantiq/xway/profiles/002-arcadyan.mk
===================================================================
--- target/linux/lantiq/xway/profiles/002-arcadyan.mk   (revisión: 25626)
+++ target/linux/lantiq/xway/profiles/002-arcadyan.mk   (copia de trabajo)
@@ -63,3 +63,15 @@
 
 $(eval $(call Profile,ARV752DPW22))
 
+define Profile/ARV7518PW
+  NAME:=ARV7518PW - ASTORIA
+  PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
+       kmod-ledtrig-netdev kmod-ledtrig-usbdev kmod-leds-gpio 
kmod-button-hotplug \
+       kmod-ath9k wpad-mini ltq-dsl-firmware-a
+endef
+
+define Profile/ARV7518PW/Description
+       Package set optimized for the ARV7518PW
+endef
+
+$(eval $(call Profile,ARV7518PW))

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to