diff options
Diffstat (limited to 'arch/mips/ath79/mach-ubnt-xm.c')
-rw-r--r-- | arch/mips/ath79/mach-ubnt-xm.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/arch/mips/ath79/mach-ubnt-xm.c b/arch/mips/ath79/mach-ubnt-xm.c index 3c311a539347..4a3c60694c75 100644 --- a/arch/mips/ath79/mach-ubnt-xm.c +++ b/arch/mips/ath79/mach-ubnt-xm.c | |||
@@ -12,16 +12,15 @@ | |||
12 | 12 | ||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | |||
16 | #ifdef CONFIG_PCI | ||
17 | #include <linux/ath9k_platform.h> | 15 | #include <linux/ath9k_platform.h> |
18 | #include <asm/mach-ath79/pci-ath724x.h> | 16 | |
19 | #endif /* CONFIG_PCI */ | 17 | #include <asm/mach-ath79/irq.h> |
20 | 18 | ||
21 | #include "machtypes.h" | 19 | #include "machtypes.h" |
22 | #include "dev-gpio-buttons.h" | 20 | #include "dev-gpio-buttons.h" |
23 | #include "dev-leds-gpio.h" | 21 | #include "dev-leds-gpio.h" |
24 | #include "dev-spi.h" | 22 | #include "dev-spi.h" |
23 | #include "pci.h" | ||
25 | 24 | ||
26 | #define UBNT_XM_GPIO_LED_L1 0 | 25 | #define UBNT_XM_GPIO_LED_L1 0 |
27 | #define UBNT_XM_GPIO_LED_L2 1 | 26 | #define UBNT_XM_GPIO_LED_L2 1 |
@@ -33,7 +32,6 @@ | |||
33 | #define UBNT_XM_KEYS_POLL_INTERVAL 20 | 32 | #define UBNT_XM_KEYS_POLL_INTERVAL 20 |
34 | #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL) | 33 | #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL) |
35 | 34 | ||
36 | #define UBNT_XM_PCI_IRQ 48 | ||
37 | #define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000) | 35 | #define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000) |
38 | 36 | ||
39 | static struct gpio_led ubnt_xm_leds_gpio[] __initdata = { | 37 | static struct gpio_led ubnt_xm_leds_gpio[] __initdata = { |
@@ -84,12 +82,27 @@ static struct ath79_spi_platform_data ubnt_xm_spi_data = { | |||
84 | #ifdef CONFIG_PCI | 82 | #ifdef CONFIG_PCI |
85 | static struct ath9k_platform_data ubnt_xm_eeprom_data; | 83 | static struct ath9k_platform_data ubnt_xm_eeprom_data; |
86 | 84 | ||
87 | static struct ath724x_pci_data ubnt_xm_pci_data[] = { | 85 | static int ubnt_xm_pci_plat_dev_init(struct pci_dev *dev) |
88 | { | 86 | { |
89 | .irq = UBNT_XM_PCI_IRQ, | 87 | switch (PCI_SLOT(dev->devfn)) { |
90 | .pdata = &ubnt_xm_eeprom_data, | 88 | case 0: |
91 | }, | 89 | dev->dev.platform_data = &ubnt_xm_eeprom_data; |
92 | }; | 90 | break; |
91 | } | ||
92 | |||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static void __init ubnt_xm_pci_init(void) | ||
97 | { | ||
98 | memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR, | ||
99 | sizeof(ubnt_xm_eeprom_data.eeprom_data)); | ||
100 | |||
101 | ath79_pci_set_plat_dev_init(ubnt_xm_pci_plat_dev_init); | ||
102 | ath79_register_pci(); | ||
103 | } | ||
104 | #else | ||
105 | static inline void ubnt_xm_pci_init(void) {} | ||
93 | #endif /* CONFIG_PCI */ | 106 | #endif /* CONFIG_PCI */ |
94 | 107 | ||
95 | static void __init ubnt_xm_init(void) | 108 | static void __init ubnt_xm_init(void) |
@@ -104,13 +117,7 @@ static void __init ubnt_xm_init(void) | |||
104 | ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info, | 117 | ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info, |
105 | ARRAY_SIZE(ubnt_xm_spi_info)); | 118 | ARRAY_SIZE(ubnt_xm_spi_info)); |
106 | 119 | ||
107 | #ifdef CONFIG_PCI | 120 | ubnt_xm_pci_init(); |
108 | memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR, | ||
109 | sizeof(ubnt_xm_eeprom_data.eeprom_data)); | ||
110 | |||
111 | ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data)); | ||
112 | #endif /* CONFIG_PCI */ | ||
113 | |||
114 | } | 121 | } |
115 | 122 | ||
116 | MIPS_MACHINE(ATH79_MACH_UBNT_XM, | 123 | MIPS_MACHINE(ATH79_MACH_UBNT_XM, |