OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * Compex WPJ531 board support |
||
3 | * |
||
4 | * Copyright (c) 2012 Qualcomm Atheros |
||
5 | * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org> |
||
6 | * |
||
7 | * Permission to use, copy, modify, and/or distribute this software for any |
||
8 | * purpose with or without fee is hereby granted, provided that the above |
||
9 | * copyright notice and this permission notice appear in all copies. |
||
10 | * |
||
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
||
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
||
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
||
18 | * |
||
19 | */ |
||
20 | |||
21 | #include <linux/irq.h> |
||
22 | #include <linux/platform_device.h> |
||
23 | #include <linux/ar8216_platform.h> |
||
24 | |||
25 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
26 | |||
27 | #include "pci.h" |
||
28 | #include "common.h" |
||
29 | #include "dev-ap9x-pci.h" |
||
30 | #include "dev-gpio-buttons.h" |
||
31 | #include "dev-eth.h" |
||
32 | #include "dev-leds-gpio.h" |
||
33 | #include "dev-m25p80.h" |
||
34 | #include "dev-usb.h" |
||
35 | #include "dev-wmac.h" |
||
36 | #include "machtypes.h" |
||
37 | |||
38 | #define WPJ531_GPIO_LED_SIG1 13 |
||
39 | #define WPJ531_GPIO_LED_SIG2 14 |
||
40 | #define WPJ531_GPIO_LED_SIG3 15 |
||
41 | #define WPJ531_GPIO_LED_SIG4 16 |
||
42 | #define WPJ531_GPIO_BUZZER 4 |
||
43 | |||
44 | #define WPJ531_GPIO_BTN_RESET 17 |
||
45 | |||
46 | #define WPJ531_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
47 | #define WPJ531_KEYS_DEBOUNCE_INTERVAL (3 * WPJ531_KEYS_POLL_INTERVAL) |
||
48 | |||
49 | #define WPJ531_MAC0_OFFSET 0x10 |
||
50 | #define WPJ531_MAC1_OFFSET 0x18 |
||
51 | #define WPJ531_WMAC_CALDATA_OFFSET 0x1000 |
||
52 | #define WPJ531_PCIE_CALDATA_OFFSET 0x5000 |
||
53 | |||
54 | #define WPJ531_ART_SIZE 0x8000 |
||
55 | |||
56 | static struct gpio_led wpj531_leds_gpio[] __initdata = { |
||
57 | { |
||
58 | .name = "wpj531:red:sig1", |
||
59 | .gpio = WPJ531_GPIO_LED_SIG1, |
||
60 | .active_low = 1, |
||
61 | }, |
||
62 | { |
||
63 | .name = "wpj531:yellow:sig2", |
||
64 | .gpio = WPJ531_GPIO_LED_SIG2, |
||
65 | .active_low = 1, |
||
66 | }, |
||
67 | { |
||
68 | .name = "wpj531:green:sig3", |
||
69 | .gpio = WPJ531_GPIO_LED_SIG3, |
||
70 | .active_low = 1, |
||
71 | }, |
||
72 | { |
||
73 | .name = "wpj531:green:sig4", |
||
74 | .gpio = WPJ531_GPIO_LED_SIG4, |
||
75 | .active_low = 1, |
||
76 | }, |
||
77 | { |
||
78 | .name = "wpj531:buzzer", |
||
79 | .gpio = WPJ531_GPIO_BUZZER, |
||
80 | .active_low = 0, |
||
81 | } |
||
82 | }; |
||
83 | |||
84 | static struct gpio_keys_button wpj531_gpio_keys[] __initdata = { |
||
85 | { |
||
86 | .desc = "reset", |
||
87 | .type = EV_KEY, |
||
88 | .code = KEY_RESTART, |
||
89 | .debounce_interval = WPJ531_KEYS_DEBOUNCE_INTERVAL, |
||
90 | .gpio = WPJ531_GPIO_BTN_RESET, |
||
91 | .active_low = 1, |
||
92 | }, |
||
93 | }; |
||
94 | |||
95 | static void __init common_setup(void) |
||
96 | { |
||
97 | u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); |
||
98 | u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000); |
||
99 | |||
100 | ath79_register_m25p80(NULL); |
||
101 | |||
102 | ath79_setup_ar933x_phy4_switch(false, false); |
||
103 | |||
104 | ath79_register_mdio(0, 0x0); |
||
105 | |||
106 | /* LAN */ |
||
107 | ath79_eth0_data.duplex = DUPLEX_FULL; |
||
108 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; |
||
109 | ath79_eth0_data.speed = SPEED_100; |
||
110 | ath79_eth0_data.phy_mask = BIT(4); |
||
111 | ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ531_MAC0_OFFSET, 0); |
||
112 | ath79_register_eth(0); |
||
113 | |||
114 | /* WAN */ |
||
115 | ath79_switch_data.phy4_mii_en = 1; |
||
116 | ath79_eth1_data.duplex = DUPLEX_FULL; |
||
117 | ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; |
||
118 | ath79_eth1_data.speed = SPEED_1000; |
||
119 | ath79_switch_data.phy_poll_mask |= BIT(4); |
||
120 | ath79_init_mac(ath79_eth1_data.mac_addr, mac + WPJ531_MAC1_OFFSET, 0); |
||
121 | ath79_register_eth(1); |
||
122 | |||
123 | ath79_register_wmac(art + WPJ531_WMAC_CALDATA_OFFSET, NULL); |
||
124 | |||
125 | ath79_register_pci(); |
||
126 | ath79_register_usb(); |
||
127 | } |
||
128 | |||
129 | static void __init wpj531_setup(void) |
||
130 | { |
||
131 | common_setup(); |
||
132 | |||
133 | ath79_register_leds_gpio(-1, |
||
134 | ARRAY_SIZE(wpj531_leds_gpio), |
||
135 | wpj531_leds_gpio); |
||
136 | |||
137 | ath79_register_gpio_keys_polled(-1, |
||
138 | WPJ531_KEYS_POLL_INTERVAL, |
||
139 | ARRAY_SIZE(wpj531_gpio_keys), |
||
140 | wpj531_gpio_keys); |
||
141 | } |
||
142 | |||
143 | MIPS_MACHINE(ATH79_MACH_WPJ531, "WPJ531", "Compex WPJ531", wpj531_setup); |