From 3868d762d1b46f049241b3a7c88524b4e4f01ce1 Mon Sep 17 00:00:00 2001 From: juhosg Date: Sat, 8 Sep 2012 17:51:56 +0000 Subject: [PATCH] ar71xx: use the RLE library for RB751 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33338 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/ar71xx/config-3.3 | 2 +- .../ar71xx/files/arch/mips/ath79/mach-rb750.c | 44 +++++----------------- .../610-MIPS-ath79-openwrt-machines.patch | 11 +++--- .../ar71xx/patches-3.3/611-TEW-712BR-support.patch | 2 +- 4 files changed, 17 insertions(+), 42 deletions(-) diff --git a/target/linux/ar71xx/config-3.3 b/target/linux/ar71xx/config-3.3 index 3b3ace5068..117e847b07 100644 --- a/target/linux/ar71xx/config-3.3 +++ b/target/linux/ar71xx/config-3.3 @@ -188,7 +188,7 @@ CONFIG_PCI_DOMAINS=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PHYLIB=y # CONFIG_PREEMPT_RCU is not set -# CONFIG_RLE_DECOMPRESS is not set +CONFIG_RLE_DECOMPRESS=y CONFIG_RTL8306_PHY=y CONFIG_RTL8366RB_PHY=y CONFIG_RTL8366S_PHY=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 b180621c2a..305fa2f87a 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -276,45 +277,16 @@ static void __init rb750gr3_setup(void) MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL", rb750gr3_setup); -static int decode_rle(char *output, int len, char *in) -{ - char *ptr = output; - char *end = output + len; - - if (!output || !in) - return -EINVAL; - - while (*in) { - if (*in < 0) { - int i = -*in++; - while (i-- > 0) { - if (ptr >= end) - return -EINVAL; - *ptr++ = *in++; - } - } else if (*in > 0) { - int i = *in++; - while (i-- > 0) { - if (ptr >= end) - return -EINVAL; - *ptr++ = *in; - } - in++; - } - } - - return ptr - output; -} - #define RB751_HARDCONFIG 0x1f00b000 #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; - int dec_size; + int err; wmac_data = ap9x_pci_get_wmac_data(0); if (!wmac_data) { @@ -324,10 +296,12 @@ static void __init rb751_wlan_setup(void) ap9x_pci_setup_wmac_led_pin(0, 9); - dec_size = decode_rle((char *) wmac_data->eeprom_data, - sizeof(wmac_data->eeprom_data), - hardconfig + RB751_CALDATA_OFFSET); - if (dec_size != sizeof(wmac_data->eeprom_data)) { + err = rle_decode(hardconfig + RB751_CALDATA_OFFSET, + RB751_CALDATA_SIZE, + (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 10fefd067e..0efdee15af 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,427 @@ config ATH79_MACH_PB44 +@@ -66,6 +137,428 @@ 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 RLE_DECOMPRESS + +config ATH79_MACH_WNDR3700 + bool "NETGEAR WNDR3700 board support" @@ -617,7 +618,7 @@ config ATH79_MACH_UBNT_XM bool "Ubiquiti Networks XM (rev 1.0) board" select SOC_AR724X -@@ -79,6 +571,24 @@ config ATH79_MACH_UBNT_XM +@@ -79,6 +572,24 @@ config ATH79_MACH_UBNT_XM Say 'Y' here if you want your kernel to support the Ubiquiti Networks XM (rev 1.0) board. @@ -642,7 +643,7 @@ endmenu config SOC_AR71XX -@@ -114,10 +624,6 @@ config SOC_QCA955X +@@ -114,10 +625,6 @@ config SOC_QCA955X select PCI_AR724X if PCI def_bool n @@ -653,7 +654,7 @@ config ATH79_DEV_AP9X_PCI select ATH79_PCI_ATH9K_FIXUP def_bool n -@@ -128,7 +634,14 @@ config ATH79_DEV_DSA +@@ -128,7 +635,14 @@ config ATH79_DEV_DSA config ATH79_DEV_ETH def_bool n @@ -669,7 +670,7 @@ def_bool n config ATH79_DEV_GPIO_BUTTONS -@@ -153,4 +666,7 @@ config ATH79_NVRAM +@@ -153,4 +667,7 @@ config ATH79_NVRAM config ATH79_PCI_ATH9K_FIXUP 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 994e1c3eb6..94a056aa51 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 -@@ -549,6 +549,16 @@ config ATH79_MACH_TEW_673GRU +@@ -550,6 +550,16 @@ config ATH79_MACH_TEW_673GRU select ATH79_DEV_USB select ATH79_NVRAM -- 2.11.0