OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * EnGenius EAP300 v2 board support |
||
3 | * |
||
4 | * Copyright (C) 2014 Gabor Juhos <juhosg@openwrt.org> |
||
5 | * |
||
6 | * This program is free software; you can redistribute it and/or modify it |
||
7 | * under the terms of the GNU General Public License version 2 as published |
||
8 | * by the Free Software Foundation. |
||
9 | */ |
||
10 | |||
11 | #include <linux/gpio.h> |
||
12 | #include <linux/mtd/mtd.h> |
||
13 | #include <linux/mtd/partitions.h> |
||
14 | #include <linux/platform_device.h> |
||
15 | |||
16 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
17 | #include <asm/mach-ath79/ath79.h> |
||
18 | |||
19 | #include "common.h" |
||
20 | #include "dev-eth.h" |
||
21 | #include "dev-gpio-buttons.h" |
||
22 | #include "dev-leds-gpio.h" |
||
23 | #include "dev-m25p80.h" |
||
24 | #include "dev-wmac.h" |
||
25 | #include "machtypes.h" |
||
26 | |||
27 | #define EAP300V2_GPIO_LED_POWER 0 |
||
28 | #define EAP300V2_GPIO_LED_LAN 16 |
||
29 | #define EAP300V2_GPIO_LED_WLAN 17 |
||
30 | |||
31 | #define EAP300V2_GPIO_BTN_RESET 1 |
||
32 | |||
33 | #define EAP300V2_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
34 | #define EAP300V2_KEYS_DEBOUNCE_INTERVAL (3 * EAP300V2_KEYS_POLL_INTERVAL) |
||
35 | |||
36 | static struct gpio_led eap300v2_leds_gpio[] __initdata = { |
||
37 | { |
||
38 | .name = "engenius:blue:power", |
||
39 | .gpio = EAP300V2_GPIO_LED_POWER, |
||
40 | .active_low = 1, |
||
41 | }, { |
||
42 | .name = "engenius:blue:lan", |
||
43 | .gpio = EAP300V2_GPIO_LED_LAN, |
||
44 | .active_low = 1, |
||
45 | }, { |
||
46 | .name = "engenius:blue:wlan", |
||
47 | .gpio = EAP300V2_GPIO_LED_WLAN, |
||
48 | .active_low = 1, |
||
49 | } |
||
50 | }; |
||
51 | |||
52 | static struct gpio_keys_button eap300v2_gpio_keys[] __initdata = { |
||
53 | { |
||
54 | .desc = "reset", |
||
55 | .type = EV_KEY, |
||
56 | .code = KEY_RESTART, |
||
57 | .debounce_interval = EAP300V2_KEYS_DEBOUNCE_INTERVAL, |
||
58 | .gpio = EAP300V2_GPIO_BTN_RESET, |
||
59 | .active_low = 1, |
||
60 | } |
||
61 | }; |
||
62 | |||
63 | #define EAP300V2_ART_MAC_OFFSET 2 |
||
64 | |||
65 | #define EAP300V2_LAN_PHYMASK BIT(0) |
||
66 | |||
67 | static void __init eap300v2_setup(void) |
||
68 | { |
||
69 | u8 *art = (u8 *)KSEG1ADDR(0x1fff1000); |
||
70 | |||
71 | ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); |
||
72 | |||
73 | ath79_gpio_output_select(EAP300V2_GPIO_LED_POWER, AR934X_GPIO_OUT_GPIO); |
||
74 | ath79_gpio_output_select(EAP300V2_GPIO_LED_LAN, AR934X_GPIO_OUT_GPIO); |
||
75 | ath79_gpio_output_select(EAP300V2_GPIO_LED_WLAN, AR934X_GPIO_OUT_GPIO); |
||
76 | |||
77 | ath79_register_leds_gpio(-1, ARRAY_SIZE(eap300v2_leds_gpio), |
||
78 | eap300v2_leds_gpio); |
||
79 | ath79_register_gpio_keys_polled(-1, EAP300V2_KEYS_POLL_INTERVAL, |
||
80 | ARRAY_SIZE(eap300v2_gpio_keys), |
||
81 | eap300v2_gpio_keys); |
||
82 | |||
83 | ath79_register_m25p80(NULL); |
||
84 | ath79_register_wmac(art, NULL); |
||
85 | ath79_register_mdio(1, 0x0); |
||
86 | |||
87 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); |
||
88 | |||
89 | ath79_init_mac(ath79_eth0_data.mac_addr, |
||
90 | art + EAP300V2_ART_MAC_OFFSET, 0); |
||
91 | |||
92 | ath79_switch_data.phy4_mii_en = 1; |
||
93 | ath79_switch_data.phy_poll_mask = EAP300V2_LAN_PHYMASK; |
||
94 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; |
||
95 | ath79_eth0_data.phy_mask = EAP300V2_LAN_PHYMASK; |
||
96 | ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; |
||
97 | ath79_register_eth(0); |
||
98 | } |
||
99 | |||
100 | MIPS_MACHINE(ATH79_MACH_EAP300V2, "EAP300V2", "EnGenius EAP300 v2", |
||
101 | eap300v2_setup); |