OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * Buffalo WLAE-AG300N board support |
||
3 | */ |
||
4 | |||
5 | #include <linux/gpio.h> |
||
6 | #include <linux/mtd/mtd.h> |
||
7 | #include <linux/mtd/partitions.h> |
||
8 | |||
9 | #include <asm/mach-ath79/ath79.h> |
||
10 | |||
11 | #include "dev-eth.h" |
||
12 | #include "dev-ap9x-pci.h" |
||
13 | #include "dev-gpio-buttons.h" |
||
14 | #include "dev-leds-gpio.h" |
||
15 | #include "dev-m25p80.h" |
||
16 | #include "dev-usb.h" |
||
17 | #include "machtypes.h" |
||
18 | |||
19 | #define WLAEAG300N_MAC_OFFSET 0x20c |
||
20 | #define WLAEAG300N_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
21 | #define WLAEAG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLAEAG300N_KEYS_POLL_INTERVAL) |
||
22 | |||
23 | |||
24 | static struct gpio_led wlaeag300n_leds_gpio[] __initdata = { |
||
25 | /* |
||
26 | * Note: Writing 1 into GPIO 13 will power down the device. |
||
27 | */ |
||
28 | { |
||
29 | .name = "buffalo:green:wireless", |
||
30 | .gpio = 14, |
||
31 | .active_low = 1, |
||
32 | }, { |
||
33 | .name = "buffalo:red:wireless", |
||
34 | .gpio = 15, |
||
35 | .active_low = 1, |
||
36 | }, { |
||
37 | .name = "buffalo:green:status", |
||
38 | .gpio = 16, |
||
39 | .active_low = 1, |
||
40 | }, { |
||
41 | .name = "buffalo:red:status", |
||
42 | .gpio = 17, |
||
43 | .active_low = 1, |
||
44 | } |
||
45 | }; |
||
46 | |||
47 | |||
48 | static struct gpio_keys_button wlaeag300n_gpio_keys[] __initdata = { |
||
49 | { |
||
50 | .desc = "function", |
||
51 | .type = EV_KEY, |
||
52 | .code = KEY_MODE, |
||
53 | .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, |
||
54 | .gpio = 0, |
||
55 | .active_low = 1, |
||
56 | }, { |
||
57 | .desc = "reset", |
||
58 | .type = EV_KEY, |
||
59 | .code = KEY_RESTART, |
||
60 | .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, |
||
61 | .gpio = 1, |
||
62 | .active_low = 1, |
||
63 | }, { |
||
64 | .desc = "power", |
||
65 | .type = EV_KEY, |
||
66 | .code = KEY_POWER, |
||
67 | .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, |
||
68 | .gpio = 11, |
||
69 | .active_low = 1, |
||
70 | }, { |
||
71 | .desc = "aoss", |
||
72 | .type = EV_KEY, |
||
73 | .code = KEY_WPS_BUTTON, |
||
74 | .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL, |
||
75 | .gpio = 12, |
||
76 | .active_low = 1, |
||
77 | } |
||
78 | }; |
||
79 | |||
80 | static void __init wlaeag300n_setup(void) |
||
81 | { |
||
82 | u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1fff1000); |
||
83 | u8 *mac1 = eeprom1 + WLAEAG300N_MAC_OFFSET; |
||
84 | |||
85 | ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); |
||
86 | ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 1); |
||
87 | |||
88 | ath79_register_mdio(0, ~(BIT(0) | BIT(4))); |
||
89 | |||
90 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
91 | ath79_eth0_data.speed = SPEED_1000; |
||
92 | ath79_eth0_data.duplex = DUPLEX_FULL; |
||
93 | ath79_eth0_data.phy_mask = BIT(0); |
||
94 | |||
95 | ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
96 | ath79_eth1_data.phy_mask = BIT(4); |
||
97 | |||
98 | ath79_register_eth(0); |
||
99 | ath79_register_eth(1); |
||
100 | |||
101 | ath79_register_leds_gpio(-1, ARRAY_SIZE(wlaeag300n_leds_gpio), |
||
102 | wlaeag300n_leds_gpio); |
||
103 | |||
104 | ath79_register_gpio_keys_polled(-1, WLAEAG300N_KEYS_POLL_INTERVAL, |
||
105 | ARRAY_SIZE(wlaeag300n_gpio_keys), |
||
106 | wlaeag300n_gpio_keys); |
||
107 | |||
108 | ath79_register_m25p80(NULL); |
||
109 | |||
110 | ap91_pci_init(eeprom1, mac1); |
||
111 | } |
||
112 | |||
113 | MIPS_MACHINE(ATH79_MACH_WLAE_AG300N, "WLAE-AG300N", |
||
114 | "Buffalo WLAE-AG300N", wlaeag300n_setup); |