2 * Ubiquiti Networks XM (rev 1.0) board support
4 * Copyright (C) 2011 René Bolldorf <xsecute@googlemail.com>
6 * Derived from: mach-pb44.c
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/init.h>
14 #include <linux/pci.h>
15 #include <linux/ath9k_platform.h>
17 #include <asm/mach-ath79/irq.h>
19 #include "machtypes.h"
20 #include "dev-gpio-buttons.h"
21 #include "dev-leds-gpio.h"
25 #define UBNT_XM_GPIO_LED_L1 0
26 #define UBNT_XM_GPIO_LED_L2 1
27 #define UBNT_XM_GPIO_LED_L3 11
28 #define UBNT_XM_GPIO_LED_L4 7
30 #define UBNT_XM_GPIO_BTN_RESET 12
32 #define UBNT_XM_KEYS_POLL_INTERVAL 20
33 #define UBNT_XM_KEYS_DEBOUNCE_INTERVAL (3 * UBNT_XM_KEYS_POLL_INTERVAL)
35 #define UBNT_XM_EEPROM_ADDR (u8 *) KSEG1ADDR(0x1fff1000)
37 static struct gpio_led ubnt_xm_leds_gpio
[] __initdata
= {
39 .name
= "ubnt-xm:red:link1",
40 .gpio
= UBNT_XM_GPIO_LED_L1
,
43 .name
= "ubnt-xm:orange:link2",
44 .gpio
= UBNT_XM_GPIO_LED_L2
,
47 .name
= "ubnt-xm:green:link3",
48 .gpio
= UBNT_XM_GPIO_LED_L3
,
51 .name
= "ubnt-xm:green:link4",
52 .gpio
= UBNT_XM_GPIO_LED_L4
,
57 static struct gpio_keys_button ubnt_xm_gpio_keys
[] __initdata
= {
62 .debounce_interval
= UBNT_XM_KEYS_DEBOUNCE_INTERVAL
,
63 .gpio
= UBNT_XM_GPIO_BTN_RESET
,
68 static struct spi_board_info ubnt_xm_spi_info
[] = {
72 .max_speed_hz
= 25000000,
73 .modalias
= "mx25l6405d",
77 static struct ath79_spi_platform_data ubnt_xm_spi_data
= {
83 static struct ath9k_platform_data ubnt_xm_eeprom_data
;
85 static int ubnt_xm_pci_plat_dev_init(struct pci_dev
*dev
)
87 switch (PCI_SLOT(dev
->devfn
)) {
89 dev
->dev
.platform_data
= &ubnt_xm_eeprom_data
;
96 static void __init
ubnt_xm_pci_init(void)
98 memcpy(ubnt_xm_eeprom_data
.eeprom_data
, UBNT_XM_EEPROM_ADDR
,
99 sizeof(ubnt_xm_eeprom_data
.eeprom_data
));
101 ath79_pci_set_plat_dev_init(ubnt_xm_pci_plat_dev_init
);
102 ath79_register_pci();
105 static inline void ubnt_xm_pci_init(void) {}
106 #endif /* CONFIG_PCI */
108 static void __init
ubnt_xm_init(void)
110 ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xm_leds_gpio
),
113 ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL
,
114 ARRAY_SIZE(ubnt_xm_gpio_keys
),
117 ath79_register_spi(&ubnt_xm_spi_data
, ubnt_xm_spi_info
,
118 ARRAY_SIZE(ubnt_xm_spi_info
));
123 MIPS_MACHINE(ATH79_MACH_UBNT_XM
,
125 "Ubiquiti Networks XM (rev 1.0) board",