Browse Source

ar71xx: use routerboot_find_tag to find wlan data offset on RB751

SVN-Revision: 33348
Gabor Juhos 13 years ago
parent
commit
3686e18727

+ 1 - 1
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

+ 15 - 8
target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c

@@ -15,6 +15,7 @@
 #include <linux/phy.h>
 #include <linux/ar8216_platform.h>
 #include <linux/rle.h>
+#include <linux/routerboot.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
 #include <asm/mach-ath79/ath79.h>
@@ -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;

+ 6 - 5
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
  

+ 1 - 1
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
  

+ 2 - 2
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