ar71xx: use the RLE library for RB751
authorGabor Juhos <juhosg@openwrt.org>
Sat, 8 Sep 2012 17:51:56 +0000 (17:51 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sat, 8 Sep 2012 17:51:56 +0000 (17:51 +0000)
SVN-Revision: 33338

target/linux/ar71xx/config-3.3
target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch
target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch

index 3b3ace50685407512a55cb946629b9d863198c67..117e847b0751559d21125992f1e039536e16c78c 100644 (file)
@@ -188,7 +188,7 @@ CONFIG_PCI_DOMAINS=y
 CONFIG_PERF_USE_VMALLOC=y
 CONFIG_PHYLIB=y
 # CONFIG_PREEMPT_RCU is not set
 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
 CONFIG_RTL8306_PHY=y
 CONFIG_RTL8366RB_PHY=y
 CONFIG_RTL8366S_PHY=y
index b180621c2aab12496ac40178b6c608c2f1f2c8c1..305fa2f87a7537b3a216b778c119ea6500ab9986 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/phy.h>
 #include <linux/ar8216_platform.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
 #include <linux/ar8216_platform.h>
+#include <linux/rle.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
 #include <asm/mach-ath79/ath79.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
 #include <asm/mach-ath79/ath79.h>
@@ -276,45 +277,16 @@ static void __init rb750gr3_setup(void)
 MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL",
             rb750gr3_setup);
 
 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_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;
 
 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) {
 
        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);
 
 
        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;
        }
                pr_err("rb75x: unable to decode wlan eeprom data\n");
                return;
        }
index 10fefd067eaddbb42b949aabbd4c2485772a406c..0efdee15afae0ed0558006441d357647cb85aa17 100644 (file)
  config ATH79_MACH_PB44
        bool "Atheros PB44 reference board"
        select SOC_AR71XX
  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.
  
          Say 'Y' here if you want your kernel to support the
          Atheros PB44 reference board.
  
 +      select ATH79_DEV_ETH
 +      select ATH79_DEV_AP9X_PCI if PCI
 +      select ATH79_DEV_USB
 +      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"
 +
 +config ATH79_MACH_WNDR3700
 +      bool "NETGEAR WNDR3700 board support"
  config ATH79_MACH_UBNT_XM
        bool "Ubiquiti Networks XM (rev 1.0) board"
        select SOC_AR724X
  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.
  
          Say 'Y' here if you want your kernel to support the
          Ubiquiti Networks XM (rev 1.0) board.
  
  endmenu
  
  config SOC_AR71XX
  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
  
        select PCI_AR724X if PCI
        def_bool n
  
  config ATH79_DEV_AP9X_PCI
        select ATH79_PCI_ATH9K_FIXUP
        def_bool n
  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
  
  config ATH79_DEV_ETH
        def_bool n
  
        def_bool n
  
  config ATH79_DEV_GPIO_BUTTONS
        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
  
  config ATH79_PCI_ATH9K_FIXUP
        def_bool n
  
index 994e1c3eb6d55ff060bd9d58fde0b186d72e3db7..94a056aa51e6f573363613381aa9c1874968a32c 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/Kconfig
 +++ b/arch/mips/ath79/Kconfig
 --- 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
  
        select ATH79_DEV_USB
        select ATH79_NVRAM