From 3686e187272855915e42762426c6ea4fb15a2ba8 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Sun, 9 Sep 2012 14:05:30 +0000 Subject: [PATCH] ar71xx: use routerboot_find_tag to find wlan data offset on RB751 SVN-Revision: 33348 --- target/linux/ar71xx/config-3.3 | 2 +- .../ar71xx/files/arch/mips/ath79/mach-rb750.c | 23 ++++++++++++------- .../610-MIPS-ath79-openwrt-machines.patch | 11 +++++---- .../patches-3.3/611-TEW-712BR-support.patch | 2 +- .../patches-3.3/613-RB2011-support.patch | 4 ++-- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/target/linux/ar71xx/config-3.3 b/target/linux/ar71xx/config-3.3 index fd113addd1..9194701e78 100644 --- a/target/linux/ar71xx/config-3.3 +++ b/target/linux/ar71xx/config-3.3 @@ -83,7 +83,7 @@ CONFIG_ATH79_MACH_WZR_HP_G450H=y CONFIG_ATH79_MACH_ZCN_1523H=y CONFIG_ATH79_NVRAM=y CONFIG_ATH79_PCI_ATH9K_FIXUP=y -# CONFIG_ATH79_ROUTERBOOT is not set +CONFIG_ATH79_ROUTERBOOT=y # CONFIG_ATH79_WDT is not set CONFIG_BCMA_POSSIBLE=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c index 305fa2f87a..bee8bdf9c2 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -26,6 +27,7 @@ #include "dev-usb.h" #include "dev-eth.h" #include "machtypes.h" +#include "routerboot.h" static struct rb750_led_data rb750_leds[] = { { @@ -277,15 +279,16 @@ static void __init rb750gr3_setup(void) MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL", rb750gr3_setup); -#define RB751_HARDCONFIG 0x1f00b000 +#define RB751_HARDCONFIG 0x1f00b000 +#define RB751_HARDCONFIG_SIZE 0x1000 #define RB751_MAC_ADDRESS_OFFSET 0xE80 -#define RB751_CALDATA_OFFSET 0x27C -#define RB751_CALDATA_SIZE 0xc00 static void __init rb751_wlan_setup(void) { u8 *hardconfig = (u8 *) KSEG1ADDR(RB751_HARDCONFIG); struct ath9k_platform_data *wmac_data; + u16 tag_len; + u8 *tag; int err; wmac_data = ap9x_pci_get_wmac_data(0); @@ -296,11 +299,15 @@ static void __init rb751_wlan_setup(void) ap9x_pci_setup_wmac_led_pin(0, 9); - err = rle_decode(hardconfig + RB751_CALDATA_OFFSET, - RB751_CALDATA_SIZE, - (unsigned char *) wmac_data->eeprom_data, - sizeof(wmac_data->eeprom_data), - NULL, NULL); + err = routerboot_find_tag(hardconfig, RB751_HARDCONFIG_SIZE, + RB_ID_WLAN_DATA, &tag, &tag_len); + if (err) { + pr_err("rb75x: no calibration data found\n"); + return; + } + + err = rle_decode(tag, tag_len, (unsigned char *) wmac_data->eeprom_data, + sizeof(wmac_data->eeprom_data), NULL, NULL); if (err) { pr_err("rb75x: unable to decode wlan eeprom data\n"); return; diff --git a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch index 97e957f2dc..59eeee0699 100644 --- a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch @@ -189,7 +189,7 @@ config ATH79_MACH_PB44 bool "Atheros PB44 reference board" select SOC_AR71XX -@@ -66,6 +137,428 @@ config ATH79_MACH_PB44 +@@ -66,6 +137,429 @@ config ATH79_MACH_PB44 Say 'Y' here if you want your kernel to support the Atheros PB44 reference board. @@ -379,6 +379,7 @@ + select ATH79_DEV_ETH + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_USB ++ select ATH79_ROUTERBOOT + select RLE_DECOMPRESS + +config ATH79_MACH_WNDR3700 @@ -618,7 +619,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM (rev 1.0) board" select SOC_AR724X -@@ -79,6 +572,24 @@ config ATH79_MACH_UBNT_XM +@@ -79,6 +573,24 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -643,7 +644,7 @@ endmenu config SOC_AR71XX -@@ -114,10 +625,6 @@ config SOC_QCA955X +@@ -114,10 +626,6 @@ config SOC_QCA955X select PCI_AR724X if PCI def_bool n @@ -654,7 +655,7 @@ config ATH79_DEV_AP9X_PCI select ATH79_PCI_ATH9K_FIXUP def_bool n -@@ -128,7 +635,14 @@ config ATH79_DEV_DSA +@@ -128,7 +636,14 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -670,7 +671,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -156,4 +670,7 @@ config ATH79_PCI_ATH9K_FIXUP +@@ -156,4 +671,7 @@ config ATH79_PCI_ATH9K_FIXUP config ATH79_ROUTERBOOT def_bool n diff --git a/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch b/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch index b8c227e4ca..319f1f5ce7 100644 --- a/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch +++ b/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -550,6 +550,16 @@ config ATH79_MACH_TEW_673GRU +@@ -551,6 +551,16 @@ config ATH79_MACH_TEW_673GRU select ATH79_DEV_USB select ATH79_NVRAM diff --git a/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch b/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch index 6622b4d96e..be2b144c74 100644 --- a/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch +++ b/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch @@ -1,7 +1,7 @@ --- a/arch/mips/ath79/Kconfig +++ b/arch/mips/ath79/Kconfig -@@ -334,6 +334,11 @@ config ATH79_MACH_RB750 - select ATH79_DEV_USB +@@ -335,6 +335,11 @@ config ATH79_MACH_RB750 + select ATH79_ROUTERBOOT select RLE_DECOMPRESS +config ATH79_MACH_RB2011 -- 2.30.2