backfire: ar71xx: add helper function to setup ath9k LED/GPIO on the AP94 based board...
[openwrt-10.03/.git] / target / linux / ar71xx / files / arch / mips / ar71xx / dev-ap94-pci.c
index 920ab6c7258de72ddecc4b527aeb876fb520a7a9..4c2e1b2ca2427999175538e828e612a9f3cdc7db 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Atheros AP94 reference board PCI initialization
  *
- *  Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
+ *  Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License version 2 as published
 
 #include "dev-ap94-pci.h"
 
-static struct ath9k_platform_data ap94_wmac0_data;
-static struct ath9k_platform_data ap94_wmac1_data;
+static struct ath9k_platform_data ap94_wmac0_data = {
+       .led_pin = -1,
+};
+static struct ath9k_platform_data ap94_wmac1_data = {
+       .led_pin = -1,
+};
 static char ap94_wmac0_mac[6];
 static char ap94_wmac1_mac[6];
 static int ap94_pci_fixup_enabled;
@@ -125,6 +129,32 @@ static void ap94_pci_fixup(struct pci_dev *dev)
 }
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ap94_pci_fixup);
 
+__init void ap94_pci_setup_wmac_led_pin(unsigned wmac, int pin)
+{
+       switch (wmac) {
+       case 0:
+               ap94_wmac0_data.led_pin = pin;
+               break;
+       case 1:
+               ap94_wmac1_data.led_pin = pin;
+               break;
+       }
+}
+
+__init void ap94_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val)
+{
+       switch (wmac) {
+       case 0:
+               ap94_wmac0_data.gpio_mask = mask;
+               ap94_wmac0_data.gpio_val = val;
+               break;
+       case 1:
+               ap94_wmac1_data.gpio_mask = mask;
+               ap94_wmac1_data.gpio_val = val;
+               break;
+       }
+}
+
 void __init ap94_pci_init(u8 *cal_data0, u8 *mac_addr0,
                          u8 *cal_data1, u8 *mac_addr1)
 {