ar71xx: use ap91_pci_init for RB751{,G}
authorGabor Juhos <juhosg@openwrt.org>
Thu, 19 Apr 2012 21:31:48 +0000 (21:31 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Thu, 19 Apr 2012 21:31:48 +0000 (21:31 +0000)
SVN-Revision: 31356

target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
target/linux/ar71xx/patches-3.2/614-MIPS-ath79-RB751GL-support.patch
target/linux/ar71xx/patches-3.3/614-MIPS-ath79-RB751GL-support.patch

index 4d02eb2d895a01ee6cca0c33a21730012b2e54ad..7a24b57fb5023bcc95a90043423a44f3eb31641c 100644 (file)
 #include <asm/mach-ath79/mach-rb750.h>
 
 #include "common.h"
+#include "dev-ap9x-pci.h"
 #include "dev-usb.h"
 #include "dev-eth.h"
 #include "machtypes.h"
-#include "pci-ath9k-fixup.h"
-#include "pci.h"
 
 static struct rb750_led_data rb750_leds[] = {
        {
@@ -278,23 +277,6 @@ static void __init rb750gr3_setup(void)
 MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL",
             rb750gr3_setup);
 
-static struct ath9k_platform_data rb751_wmac_data = {
-       .led_pin = -1,
-};
-
-static u8 rb751_wmac_mac[6];
-
-static int rb751_pci_plat_dev_init(struct pci_dev *dev)
-{
-       switch (PCI_SLOT(dev->devfn)) {
-       case 0:
-               dev->dev.platform_data = &rb751_wmac_data;
-               break;
-       }
-
-       return 0;
-}
-
 static int decode_rle(char *output, int len, char *in)
 {
        char *ptr = output;
@@ -332,20 +314,24 @@ static int decode_rle(char *output, int len, char *in)
 static void __init rb751_wlan_setup(void)
 {
        u8 *hardconfig = (u8 *) KSEG1ADDR(RB751_HARDCONFIG);
+       struct ath9k_platform_data *wmac_data;
+       int dec_size;
 
-       ath79_pci_set_plat_dev_init(rb751_pci_plat_dev_init);
-       ath79_register_pci();
-
-       rb751_wmac_data.macaddr = memcpy(rb751_wmac_mac,
-                       hardconfig + RB751_MAC_ADDRESS_OFFSET, 6);
+       wmac_data = ap9x_pci_get_wmac_data(0);
+       if (!wmac_data) {
+               pr_err("rb75x: unable to get address of wlan data\n");
+               return;
+       }
 
-       if (decode_rle((char *)rb751_wmac_data.eeprom_data,
-                       sizeof(rb751_wmac_data.eeprom_data),
-                       hardconfig + RB751_CALDATA_OFFSET) ==
-                       sizeof(rb751_wmac_data.eeprom_data)) {
-               pr_info("rb7xx: calibration data found\n");
-               pci_enable_ath9k_fixup(0, rb751_wmac_data.eeprom_data);
+       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)) {
+               pr_err("rb75x: unable to decode wlan eeprom data\n");
+               return;
        }
+
+       ap91_pci_init(NULL, hardconfig + RB751_MAC_ADDRESS_OFFSET);
 }
 
 static void __init rb751_setup(void)
index 80689c6a90c0997007eea5e4d6e4a808033d05aa..14d3a2dc5f7ae99754ab7d9cfe02153f929b7952 100644 (file)
@@ -1,9 +1,10 @@
 --- a/arch/mips/ath79/Kconfig
 +++ b/arch/mips/ath79/Kconfig
-@@ -300,6 +300,7 @@ config ATH79_MACH_RB750
+@@ -300,6 +300,8 @@ config ATH79_MACH_RB750
        bool "MikroTik RouterBOARD 750 support"
        select SOC_AR724X
        select ATH79_DEV_ETH
++      select ATH79_DEV_AP9X_PCI if PCI
 +      select ATH79_DEV_USB
  
  config ATH79_MACH_WNDR3700
index 80689c6a90c0997007eea5e4d6e4a808033d05aa..14d3a2dc5f7ae99754ab7d9cfe02153f929b7952 100644 (file)
@@ -1,9 +1,10 @@
 --- a/arch/mips/ath79/Kconfig
 +++ b/arch/mips/ath79/Kconfig
-@@ -300,6 +300,7 @@ config ATH79_MACH_RB750
+@@ -300,6 +300,8 @@ config ATH79_MACH_RB750
        bool "MikroTik RouterBOARD 750 support"
        select SOC_AR724X
        select ATH79_DEV_ETH
++      select ATH79_DEV_AP9X_PCI if PCI
 +      select ATH79_DEV_USB
  
  config ATH79_MACH_WNDR3700