ar71xx: Add Gainstrong MiniBox v1.0 support to trunk
[openwrt/openwrt.git] / target / linux / ar71xx / patches-4.1 / 607-MIPS-ath79-ubnt-xm-fixes.patch
1 --- a/arch/mips/ath79/Kconfig
2 +++ b/arch/mips/ath79/Kconfig
3 @@ -70,9 +70,10 @@ config ATH79_MACH_PB44
4 config ATH79_MACH_UBNT_XM
5 bool "Ubiquiti Networks XM (rev 1.0) board"
6 select SOC_AR724X
7 + select ATH79_DEV_AP9X_PCI if PCI
8 select ATH79_DEV_GPIO_BUTTONS
9 select ATH79_DEV_LEDS_GPIO
10 - select ATH79_DEV_SPI
11 + select ATH79_DEV_M25P80
12 help
13 Say 'Y' here if you want your kernel to support the
14 Ubiquiti Networks XM (rev 1.0) board.
15 --- a/arch/mips/ath79/mach-ubnt-xm.c
16 +++ b/arch/mips/ath79/mach-ubnt-xm.c
17 @@ -16,10 +16,11 @@
18
19 #include <asm/mach-ath79/irq.h>
20
21 -#include "machtypes.h"
22 +#include "dev-ap9x-pci.h"
23 #include "dev-gpio-buttons.h"
24 #include "dev-leds-gpio.h"
25 -#include "dev-spi.h"
26 +#include "dev-m25p80.h"
27 +#include "machtypes.h"
28 #include "pci.h"
29
30 #define UBNT_XM_GPIO_LED_L1 0
31 @@ -32,7 +33,7 @@
32 #define UBNT_XM_KEYS_POLL_INTERVAL 20
33 #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
34
35 -#define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000)
36 +#define UBNT_XM_EEPROM_ADDR 0x1fff1000
37
38 static struct gpio_led ubnt_xm_leds_gpio[] __initdata = {
39 {
40 @@ -65,48 +66,10 @@ static struct gpio_keys_button ubnt_xm_g
41 }
42 };
43
44 -static struct spi_board_info ubnt_xm_spi_info[] = {
45 - {
46 - .bus_num = 0,
47 - .chip_select = 0,
48 - .max_speed_hz = 25000000,
49 - .modalias = "mx25l6405d",
50 - }
51 -};
52 -
53 -static struct ath79_spi_platform_data ubnt_xm_spi_data = {
54 - .bus_num = 0,
55 - .num_chipselect = 1,
56 -};
57 -
58 -#ifdef CONFIG_PCI
59 -static struct ath9k_platform_data ubnt_xm_eeprom_data;
60 -
61 -static int ubnt_xm_pci_plat_dev_init(struct pci_dev *dev)
62 -{
63 - switch (PCI_SLOT(dev->devfn)) {
64 - case 0:
65 - dev->dev.platform_data = &ubnt_xm_eeprom_data;
66 - break;
67 - }
68 -
69 - return 0;
70 -}
71 -
72 -static void __init ubnt_xm_pci_init(void)
73 -{
74 - memcpy(ubnt_xm_eeprom_data.eeprom_data, UBNT_XM_EEPROM_ADDR,
75 - sizeof(ubnt_xm_eeprom_data.eeprom_data));
76 -
77 - ath79_pci_set_plat_dev_init(ubnt_xm_pci_plat_dev_init);
78 - ath79_register_pci();
79 -}
80 -#else
81 -static inline void ubnt_xm_pci_init(void) {}
82 -#endif /* CONFIG_PCI */
83 -
84 static void __init ubnt_xm_init(void)
85 {
86 + u8 *eeprom = (u8 *) KSEG1ADDR(UBNT_XM_EEPROM_ADDR);
87 +
88 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio),
89 ubnt_xm_leds_gpio);
90
91 @@ -114,10 +77,8 @@ static void __init ubnt_xm_init(void)
92 ARRAY_SIZE(ubnt_xm_gpio_keys),
93 ubnt_xm_gpio_keys);
94
95 - ath79_register_spi(&ubnt_xm_spi_data, ubnt_xm_spi_info,
96 - ARRAY_SIZE(ubnt_xm_spi_info));
97 -
98 - ubnt_xm_pci_init();
99 + ath79_register_m25p80(NULL);
100 + ap91_pci_init(eeprom, NULL);
101 }
102
103 MIPS_MACHINE(ATH79_MACH_UBNT_XM,