OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * GainStrong Oolite/MiniBox V1.0 boards support |
||
3 | * |
||
4 | * |
||
5 | * This program is free software; you can redistribute it and/or modify it |
||
6 | * under the terms of the GNU General Public License version 2 as published |
||
7 | * by the Free Software Foundation. |
||
8 | */ |
||
9 | |||
10 | #include <linux/gpio.h> |
||
11 | |||
12 | #include <asm/mach-ath79/ath79.h> |
||
13 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
14 | |||
15 | #include "common.h" |
||
16 | #include "dev-eth.h" |
||
17 | #include "dev-gpio-buttons.h" |
||
18 | #include "dev-leds-gpio.h" |
||
19 | #include "dev-m25p80.h" |
||
20 | #include "dev-wmac.h" |
||
21 | #include "machtypes.h" |
||
22 | #include "dev-usb.h" |
||
23 | |||
24 | #define GS_MINIBOX_V1_GPIO_BTN_RESET 11 |
||
25 | #define GS_MINIBOX_V1_GPIO_LED_SYSTEM 1 |
||
26 | |||
27 | #define GS_OOLITE_V1_GPIO_BTN6 6 |
||
28 | #define GS_OOLITE_V1_GPIO_BTN7 7 |
||
29 | #define GS_OOLITE_V1_GPIO_BTN_RESET 11 |
||
30 | #define GS_OOLITE_V1_GPIO_LED_SYSTEM 27 |
||
31 | |||
32 | #define GS_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
33 | #define GS_KEYS_DEBOUNCE_INTERVAL (3 * GS_KEYS_POLL_INTERVAL) |
||
34 | |||
35 | static const char *gs_part_probes[] = { |
||
36 | "tp-link", |
||
37 | NULL, |
||
38 | }; |
||
39 | |||
40 | static struct flash_platform_data gs_flash_data = { |
||
41 | .part_probes = gs_part_probes, |
||
42 | }; |
||
43 | |||
44 | static struct gpio_led gs_minibox_v1_leds_gpio[] __initdata = { |
||
45 | { |
||
46 | .name = "minibox-v1:green:system", |
||
47 | .gpio = GS_MINIBOX_V1_GPIO_LED_SYSTEM, |
||
48 | .active_low = 1, |
||
49 | }, |
||
50 | }; |
||
51 | |||
52 | static struct gpio_led gs_oolite_v1_leds_gpio[] __initdata = { |
||
53 | { |
||
54 | .name = "oolite-v1:red:system", |
||
55 | .gpio = GS_OOLITE_V1_GPIO_LED_SYSTEM, |
||
56 | .active_low = 1, |
||
57 | }, |
||
58 | }; |
||
59 | |||
60 | static struct gpio_keys_button gs_minibox_v1_gpio_keys[] __initdata = { |
||
61 | { |
||
62 | .desc = "reset", |
||
63 | .type = EV_KEY, |
||
64 | .code = KEY_RESTART, |
||
65 | .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, |
||
66 | .gpio = GS_MINIBOX_V1_GPIO_BTN_RESET, |
||
67 | .active_low = 0, |
||
68 | }, |
||
69 | }; |
||
70 | |||
71 | static struct gpio_keys_button gs_oolite_v1_gpio_keys[] __initdata = { |
||
72 | { |
||
73 | .desc = "reset", |
||
74 | .type = EV_KEY, |
||
75 | .code = KEY_RESTART, |
||
76 | .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, |
||
77 | .gpio = GS_OOLITE_V1_GPIO_BTN_RESET, |
||
78 | .active_low = 0, |
||
79 | }, { |
||
80 | .desc = "BTN_6", |
||
81 | .type = EV_KEY, |
||
82 | .code = BTN_6, |
||
83 | .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, |
||
84 | .gpio = GS_OOLITE_V1_GPIO_BTN6, |
||
85 | .active_low = 0, |
||
86 | }, { |
||
87 | .desc = "BTN_7", |
||
88 | .type = EV_KEY, |
||
89 | .code = BTN_7, |
||
90 | .debounce_interval = GS_KEYS_DEBOUNCE_INTERVAL, |
||
91 | .gpio = GS_OOLITE_V1_GPIO_BTN7, |
||
92 | .active_low = 0, |
||
93 | }, |
||
94 | }; |
||
95 | |||
96 | static void __init gs_common_setup(void) |
||
97 | { |
||
98 | u8 *art = (u8 *) KSEG1ADDR(0x1fff1000); |
||
99 | u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); |
||
100 | |||
101 | ath79_register_usb(); |
||
102 | |||
103 | ath79_register_m25p80(&gs_flash_data); |
||
104 | |||
105 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); |
||
106 | ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); |
||
107 | |||
108 | ath79_register_mdio(0, 0x0); |
||
109 | ath79_register_eth(1); |
||
110 | ath79_register_eth(0); |
||
111 | |||
112 | ath79_register_wmac(art, mac); |
||
113 | } |
||
114 | |||
115 | static void __init gs_minibox_v1_setup(void) |
||
116 | { |
||
117 | gs_common_setup(); |
||
118 | |||
119 | ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_minibox_v1_leds_gpio), |
||
120 | gs_minibox_v1_leds_gpio); |
||
121 | |||
122 | ath79_register_gpio_keys_polled(-1, GS_KEYS_POLL_INTERVAL, |
||
123 | ARRAY_SIZE(gs_minibox_v1_gpio_keys), |
||
124 | gs_minibox_v1_gpio_keys); |
||
125 | } |
||
126 | |||
127 | static void __init gs_oolite_v1_setup(void) |
||
128 | { |
||
129 | gs_common_setup(); |
||
130 | |||
131 | ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_oolite_v1_leds_gpio), |
||
132 | gs_oolite_v1_leds_gpio); |
||
133 | |||
134 | ath79_register_gpio_keys_polled(-1, GS_KEYS_POLL_INTERVAL, |
||
135 | ARRAY_SIZE(gs_oolite_v1_gpio_keys), |
||
136 | gs_oolite_v1_gpio_keys); |
||
137 | } |
||
138 | |||
139 | MIPS_MACHINE(ATH79_MACH_GS_MINIBOX_V1, "MINIBOX-V1", "GainStrong MiniBox V1.0", |
||
140 | gs_minibox_v1_setup); |
||
141 | |||
142 | MIPS_MACHINE(ATH79_MACH_GS_OOLITE_V1, "OOLITE-V1", "GainStrong Oolite V1.0", |
||
143 | gs_oolite_v1_setup); |