From 9f2def0115695d010187dc3722093be00fc2eb5c Mon Sep 17 00:00:00 2001
From: blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Fri, 4 Feb 2011 22:49:52 +0000
Subject: [lantiq] * adds ath5k platform support * adds several new profiles

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25367 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 target/linux/lantiq/image/Makefile                 | 36 +++++++++++++-
 target/linux/lantiq/patches/400-mach-arv45xx.patch | 55 ++++++++++++++++++++--
 target/linux/lantiq/xway/profiles/002-arcadyan.mk  | 52 ++++++++++++++++++++
 3 files changed, 138 insertions(+), 5 deletions(-)

(limited to 'target')

diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile
index b580c99e2..cc5d696d8 100644
--- a/target/linux/lantiq/image/Makefile
+++ b/target/linux/lantiq/image/Makefile
@@ -54,7 +54,7 @@ define Image/BuildKernel/Template
 	$(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
 endef
 
-ifeq ($(CONFIG_SOC_LANTIQ_XWAY),y)
+ifeq ($(CONFIG_TARGET_lantiq_xway),y)
 define Image/BuildKernel/Profile/EASY50712
 	$(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
 endef
@@ -71,6 +71,38 @@ define Image/Build/Profile/EASY50812
 	$(call Image/Build/$(1),$(1),EASY50812)
 endef
 
+define Image/BuildKernel/Profile/ARV4518PW
+	$(call Image/BuildKernel/Template,ARV4518PW,$(xway_cmdline))
+endef
+
+define Image/Build/Profile/ARV4518PW
+	$(call Image/Build/$(1),$(1),ARV4518PW)
+endef
+
+define Image/BuildKernel/Profile/ARV4520PW
+	$(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
+endef
+
+define Image/Build/Profile/ARV4520PW
+	$(call Image/Build/$(1),$(1),ARV4520PW)
+endef
+
+define Image/BuildKernel/Profile/ARV4525PW
+	$(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
+endef
+
+define Image/Build/Profile/ARV4525PW
+	$(call Image/Build/$(1),$(1),ARV4525PW)
+endef
+
+define Image/BuildKernel/Profile/ARV452CPW
+	$(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
+endef
+
+define Image/Build/Profile/ARV452CPW
+	$(call Image/Build/$(1),$(1),ARV452CPW)
+endef
+
 define Image/BuildKernel/Profile/ARV752DPW22
 	$(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
 endef
@@ -111,7 +143,7 @@ define Image/Build/Profile/Generic
 endef
 endif
 
-ifeq ($(CONFIG_SOC_LANTIQ_FALCON),y)
+ifeq ($(CONFIG_TARGET_lantiq_falcon),y)
 define Image/BuildKernel
 	$(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
 	$(call Image/BuildKernel/Template,NONE)
diff --git a/target/linux/lantiq/patches/400-mach-arv45xx.patch b/target/linux/lantiq/patches/400-mach-arv45xx.patch
index 419c9ae55..af8635566 100644
--- a/target/linux/lantiq/patches/400-mach-arv45xx.patch
+++ b/target/linux/lantiq/patches/400-mach-arv45xx.patch
@@ -37,7 +37,7 @@
 +obj-$(CONFIG_LANTIQ_MACH_ARV45XX) += mach-arv45xx.o
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/mach-arv45xx.c
-@@ -0,0 +1,465 @@
+@@ -0,0 +1,514 @@
 +/*
 + *  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
@@ -56,6 +56,8 @@
 +#include <linux/mtd/physmap.h>
 +#include <linux/input.h>
 +#include <linux/etherdevice.h>
++#include <linux/ath5k_platform.h>
++#include <linux/pci.h>
 +
 +#include <machine.h>
 +
@@ -315,6 +317,47 @@
 +	lq_register_ethernet(&lq_eth_data);
 +}
 +
++static u16 arv45xx_ath5k_eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
++static struct ath5k_platform_data arv45xx_ath5k_platform_data;
++
++static int arv45xx_pci_plat_dev_init(struct pci_dev *dev)
++{
++	dev->dev.platform_data = &arv45xx_ath5k_platform_data;
++	return 0;
++}
++
++void __init
++arv45xx_register_ath5k(void)
++{
++#define ARV45XX_BRN_ATH		0x3f0478
++	int i;
++	unsigned char eeprom_mac[6];
++	u16 eeprom_data[ATH5K_PLAT_EEP_MAX_WORDS];
++	u32 *p = (u32*)arv45xx_ath5k_eeprom_data;
++
++	memcpy_fromio(eeprom_mac,
++		(void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_MAC), 6);
++	eeprom_mac[5]++;
++	memcpy_fromio(arv45xx_ath5k_eeprom_data,
++		(void *)KSEG1ADDR(LQ_FLASH_START + ARV45XX_BRN_ATH), ATH5K_PLAT_EEP_MAX_WORDS);
++	// swap eeprom bytes
++	for (i = 0; i < ATH5K_PLAT_EEP_MAX_WORDS>>1; i++){
++		//arv4518_ath5k_eeprom_data[i] = ((eeprom_data[i]&0xff)<<8)|((eeprom_data[i]&0xff00)>>8);
++		p[i] = ((eeprom_data[(i<<1)+1]&0xff)<<24)|((eeprom_data[(i<<1)+1]&0xff00)<<8)|((eeprom_data[i<<1]&0xff)<<8)|((eeprom_data[i<<1]&0xff00)>>8);
++		if (i == 0xbf>>1){
++			// printk ("regdomain: 0x%x --> 0x%x\n", p[i], (p[i] & 0xffff0000)|0x67);
++			/* regdomain is invalid?? how did original fw convert 
++			* value to 0x82d4 ??
++			* for now, force to 0x67 */
++			p[i] &= 0xffff0000;
++			p[i] |= 0x67;
++		}
++	}
++	arv45xx_ath5k_platform_data.eeprom_data = arv45xx_ath5k_eeprom_data;
++	arv45xx_ath5k_platform_data.macaddr = eeprom_mac;
++	lqpci_plat_dev_init = arv45xx_pci_plat_dev_init;
++}
++
 +static void __init
 +arv4510pw_init(void)
 +{
@@ -354,8 +397,9 @@
 +	lq_pci_data.gpio = PCI_GNT2 | PCI_REQ2;
 +	lq_register_pci(&lq_pci_data);
 +	lq_register_wdt();
-+	arv45xx_register_ethernet();
 +	xway_register_dwc(ARV4518PW_USB);
++	arv45xx_register_ethernet();
++	arv45xx_register_ath5k();
 +
 +	gpio_request(ARV4518PW_SWITCH_RESET, "switch");
 +	gpio_direction_output(ARV4518PW_SWITCH_RESET, 1);
@@ -372,6 +416,7 @@
 +{
 +#define ARV4520PW_EBU			0x400
 +#define ARV4520PW_USB			28
++#define ARV4520PW_SWITCH_RESET		42
 +
 +	lq_register_gpio();
 +	lq_register_gpio_ebu(ARV4520PW_EBU);
@@ -383,6 +428,9 @@
 +	lq_register_wdt();
 +	arv45xx_register_ethernet();
 +	xway_register_dwc(ARV4520PW_USB);
++
++	gpio_request(ARV4520PW_SWITCH_RESET, "switch");
++	gpio_set_value(ARV4520PW_SWITCH_RESET, 1);
 +}
 +
 +MIPS_MACHINE(LANTIQ_MACH_ARV4520PW,
@@ -407,8 +455,9 @@
 +	lq_register_nor(&arv4518_flash_data);
 +	lq_register_pci(&lq_pci_data);
 +	lq_register_wdt();
-+	arv45xx_register_ethernet();
 +	xway_register_dwc(ARV452CPW_USB);
++	arv45xx_register_ethernet();
++	arv45xx_register_ath5k();
 +
 +	gpio_request(ARV452CPW_SWITCH_RESET, "switch");
 +	gpio_set_value(ARV452CPW_SWITCH_RESET, 1);
diff --git a/target/linux/lantiq/xway/profiles/002-arcadyan.mk b/target/linux/lantiq/xway/profiles/002-arcadyan.mk
index 5575766f1..f87f87474 100644
--- a/target/linux/lantiq/xway/profiles/002-arcadyan.mk
+++ b/target/linux/lantiq/xway/profiles/002-arcadyan.mk
@@ -1,3 +1,55 @@
+define Profile/ARV4518PW
+  NAME:=ARV4518PW - SMC7908A
+  PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
+  	kmod-ledtrig-netdev kmod-ledtrig-usbdev kmod-leds-gpio kmod-button-hotplug \
+	kmod-madwifi wpad-mini ltq-dsl-firmware-a
+endef
+
+define Profile/ARV4518PW/Description
+	Package set optimized for the ARV4518PW
+endef
+
+$(eval $(call Profile,ARV4518PW))
+
+define Profile/ARV4520PW
+  NAME:=ARV4520PW - Arcor Easybox 800
+  PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
+  	kmod-ledtrig-netdev kmod-ledtrig-usbdev kmod-leds-gpio kmod-button-hotplug \
+	kmod-rt61-pci wpad-mini ltq-dsl-firmware-a 
+endef
+
+define Profile/ARV4520PW/Description
+	Package set optimized for the ARV4520PW
+endef
+
+$(eval $(call Profile,ARV4520PW))
+
+define Profile/ARV4525PW
+  NAME:=ARV4525PW - Speedport W502V
+  PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
+  	kmod-ledtrig-netdev kmod-ledtrig-usbdev kmod-leds-gpio kmod-button-hotplug \
+	kmod-madwifi wpad-mini ltq-dsl-firmware-b
+endef
+
+define Profile/ARV4525PW/Description
+	Package set optimized for the ARV4525PW
+endef
+
+$(eval $(call Profile,ARV4525PW))
+
+define Profile/ARV452CPW
+  NAME:=ARV452CPW - Arcor Easybox 801
+  PACKAGES:= kmod-usb-core kmod-usb-dwc-otg \
+  	kmod-ledtrig-netdev kmod-ledtrig-usbdev kmod-leds-gpio kmod-button-hotplug \
+	kmod-madwifi wpad-mini ltq-dsl-firmware-b
+endef
+
+define Profile/ARV452CPW/Description
+	Package set optimized for the ARV452CPW
+endef
+
+$(eval $(call Profile,ARV452CPW))
+
 define Profile/ARV752DPW22
   NAME:=ARV752DPW22 - Arcor Easybox 803
   PACKAGES:= kmod-usb-core kmod-usb2 kmod-usb-uhci kmod-usb-dwc-otg \
-- 
cgit v1.2.3