OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * Buffalo WZR-HP-G450G board support |
||
3 | * |
||
4 | * Copyright (C) 2011 Felix Fietkau <nbd@nbd.name> |
||
5 | * Copyright (C) 2008-2012 Gabor Juhos <juhosg@openwrt.org> |
||
6 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> |
||
7 | * |
||
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. |
||
11 | */ |
||
12 | |||
13 | #include <linux/gpio.h> |
||
14 | #include <linux/mtd/mtd.h> |
||
15 | #include <linux/mtd/partitions.h> |
||
16 | #include <linux/ath9k_platform.h> |
||
17 | |||
18 | #include <asm/mach-ath79/ath79.h> |
||
19 | |||
20 | #include "dev-eth.h" |
||
21 | #include "dev-m25p80.h" |
||
22 | #include "dev-ap9x-pci.h" |
||
23 | #include "dev-gpio-buttons.h" |
||
24 | #include "dev-leds-gpio.h" |
||
25 | #include "dev-usb.h" |
||
26 | #include "machtypes.h" |
||
27 | |||
28 | #define WZRHPG450H_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
29 | #define WZRHPG450H_KEYS_DEBOUNCE_INTERVAL (3 * WZRHPG450H_KEYS_POLL_INTERVAL) |
||
30 | |||
31 | static struct mtd_partition wzrhpg450h_partitions[] = { |
||
32 | { |
||
33 | .name = "u-boot", |
||
34 | .offset = 0, |
||
35 | .size = 0x0040000, |
||
36 | .mask_flags = MTD_WRITEABLE, |
||
37 | }, { |
||
38 | .name = "u-boot-env", |
||
39 | .offset = 0x0040000, |
||
40 | .size = 0x0010000, |
||
41 | }, { |
||
42 | .name = "ART", |
||
43 | .offset = 0x0050000, |
||
44 | .size = 0x0010000, |
||
45 | .mask_flags = MTD_WRITEABLE, |
||
46 | }, { |
||
47 | .name = "firmware", |
||
48 | .offset = 0x0060000, |
||
49 | .size = 0x1f80000, |
||
50 | }, { |
||
51 | .name = "user_property", |
||
52 | .offset = 0x1fe0000, |
||
53 | .size = 0x0020000, |
||
54 | } |
||
55 | }; |
||
56 | |||
57 | static struct flash_platform_data wzrhpg450h_flash_data = { |
||
58 | .parts = wzrhpg450h_partitions, |
||
59 | .nr_parts = ARRAY_SIZE(wzrhpg450h_partitions), |
||
60 | }; |
||
61 | |||
62 | static struct gpio_led wzrhpg450h_leds_gpio[] __initdata = { |
||
63 | { |
||
64 | .name = "buffalo:red:diag", |
||
65 | .gpio = 14, |
||
66 | .active_low = 1, |
||
67 | }, |
||
68 | { |
||
69 | .name = "buffalo:orange:security", |
||
70 | .gpio = 13, |
||
71 | .active_low = 1, |
||
72 | }, |
||
73 | }; |
||
74 | |||
75 | |||
76 | static struct gpio_led wzrhpg450h_wmac_leds_gpio[] = { |
||
77 | { |
||
78 | .name = "buffalo:blue:movie_engine", |
||
79 | .gpio = 13, |
||
80 | .active_low = 1, |
||
81 | }, |
||
82 | { |
||
83 | .name = "buffalo:green:router", |
||
84 | .gpio = 14, |
||
85 | .active_low = 1, |
||
86 | }, |
||
87 | { |
||
88 | .name = "buffalo:green:wireless", |
||
89 | .gpio = 15, |
||
90 | .active_low = 1, |
||
91 | }, |
||
92 | }; |
||
93 | |||
94 | static struct gpio_keys_button wzrhpg450h_gpio_keys[] __initdata = { |
||
95 | { |
||
96 | .desc = "reset", |
||
97 | .type = EV_KEY, |
||
98 | .code = KEY_RESTART, |
||
99 | .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, |
||
100 | .gpio = 6, |
||
101 | .active_low = 1, |
||
102 | }, { |
||
103 | .desc = "usb", |
||
104 | .type = EV_KEY, |
||
105 | .code = BTN_2, |
||
106 | .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, |
||
107 | .gpio = 1, |
||
108 | .active_low = 1, |
||
109 | }, { |
||
110 | .desc = "aoss", |
||
111 | .type = EV_KEY, |
||
112 | .code = KEY_WPS_BUTTON, |
||
113 | .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, |
||
114 | .gpio = 8, |
||
115 | .active_low = 1, |
||
116 | }, { |
||
117 | .desc = "movie_engine", |
||
118 | .type = EV_KEY, |
||
119 | .code = BTN_6, |
||
120 | .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, |
||
121 | .gpio = 7, |
||
122 | .active_low = 0, |
||
123 | }, { |
||
124 | .desc = "router_off", |
||
125 | .type = EV_KEY, |
||
126 | .code = BTN_5, |
||
127 | .debounce_interval = WZRHPG450H_KEYS_DEBOUNCE_INTERVAL, |
||
128 | .gpio = 12, |
||
129 | .active_low = 0, |
||
130 | } |
||
131 | }; |
||
132 | |||
133 | |||
134 | static void __init wzrhpg450h_init(void) |
||
135 | { |
||
136 | u8 *ee = (u8 *) KSEG1ADDR(0x1f051000); |
||
137 | u8 *mac = (u8 *) ee + 2; |
||
138 | |||
139 | ath79_register_m25p80_multi(&wzrhpg450h_flash_data); |
||
140 | |||
141 | ath79_register_mdio(0, ~BIT(0)); |
||
142 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); |
||
143 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
144 | ath79_eth0_data.speed = SPEED_1000; |
||
145 | ath79_eth0_data.duplex = DUPLEX_FULL; |
||
146 | ath79_eth0_data.phy_mask = BIT(0); |
||
147 | |||
148 | ath79_register_leds_gpio(-1, ARRAY_SIZE(wzrhpg450h_leds_gpio), |
||
149 | wzrhpg450h_leds_gpio); |
||
150 | |||
151 | ath79_register_gpio_keys_polled(-1, WZRHPG450H_KEYS_POLL_INTERVAL, |
||
152 | ARRAY_SIZE(wzrhpg450h_gpio_keys), |
||
153 | wzrhpg450h_gpio_keys); |
||
154 | |||
155 | ath79_register_eth(0); |
||
156 | |||
157 | gpio_request_one(16, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, |
||
158 | "USB power"); |
||
159 | ath79_register_usb(); |
||
160 | |||
161 | ap91_pci_init(ee, NULL); |
||
162 | ap9x_pci_get_wmac_data(0)->tx_gain_buffalo = true; |
||
163 | ap9x_pci_get_wmac_data(1)->tx_gain_buffalo = true; |
||
164 | ap9x_pci_setup_wmac_leds(0, wzrhpg450h_wmac_leds_gpio, |
||
165 | ARRAY_SIZE(wzrhpg450h_wmac_leds_gpio)); |
||
166 | } |
||
167 | |||
168 | MIPS_MACHINE(ATH79_MACH_WZR_HP_G450H, "WZR-HP-G450H", "Buffalo WZR-HP-G450H", |
||
169 | wzrhpg450h_init); |