OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * ALFA Network AP121F board support |
||
3 | * |
||
4 | * Copyright (C) 2017 Piotr Dymacz <pepe2k@gmail.com> |
||
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/platform_device.h> |
||
13 | |||
14 | #include <asm/mach-ath79/ath79.h> |
||
15 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
16 | |||
17 | #include "common.h" |
||
18 | #include "dev-eth.h" |
||
19 | #include "dev-gpio-buttons.h" |
||
20 | #include "dev-leds-gpio.h" |
||
21 | #include "dev-m25p80.h" |
||
22 | #include "dev-usb.h" |
||
23 | #include "dev-wmac.h" |
||
24 | #include "machtypes.h" |
||
25 | |||
26 | #define AP121F_GPIO_LED_LAN 17 |
||
27 | #define AP121F_GPIO_LED_VPN 27 |
||
28 | #define AP121F_GPIO_LED_WLAN 0 |
||
29 | |||
30 | #define AP121F_GPIO_MICROSD_EN 26 |
||
31 | |||
32 | #define AP121F_GPIO_BTN_RESET 12 |
||
33 | #define AP121F_GPIO_BTN_SWITCH 21 |
||
34 | |||
35 | #define AP121F_KEYS_POLL_INTERVAL 20 |
||
36 | #define AP121F_KEYS_DEBOUNCE_INTERVAL (3 * AP121F_KEYS_POLL_INTERVAL) |
||
37 | |||
38 | #define AP121F_WMAC_CALDATA_OFFSET 0x1000 |
||
39 | |||
40 | static struct gpio_led ap121f_leds_gpio[] __initdata = { |
||
41 | { |
||
42 | .name = "ap121f:green:lan", |
||
43 | .gpio = AP121F_GPIO_LED_LAN, |
||
44 | .active_low = 1, |
||
45 | }, { |
||
46 | .name = "ap121f:green:vpn", |
||
47 | .gpio = AP121F_GPIO_LED_VPN, |
||
48 | .active_low = 1, |
||
49 | }, { |
||
50 | .name = "ap121f:green:wlan", |
||
51 | .gpio = AP121F_GPIO_LED_WLAN, |
||
52 | .active_low = 0, |
||
53 | }, |
||
54 | }; |
||
55 | |||
56 | static struct gpio_keys_button ap121f_gpio_keys[] __initdata = { |
||
57 | { |
||
58 | .desc = "reset", |
||
59 | .type = EV_KEY, |
||
60 | .code = KEY_RESTART, |
||
61 | .debounce_interval = AP121F_KEYS_DEBOUNCE_INTERVAL, |
||
62 | .gpio = AP121F_GPIO_BTN_RESET, |
||
63 | .active_low = 1, |
||
64 | }, { |
||
65 | .desc = "switch", |
||
66 | .type = EV_KEY, |
||
67 | .code = BTN_0, |
||
68 | .debounce_interval = AP121F_KEYS_DEBOUNCE_INTERVAL, |
||
69 | .gpio = AP121F_GPIO_BTN_SWITCH, |
||
70 | .active_low = 0, |
||
71 | }, |
||
72 | }; |
||
73 | |||
74 | static void __init ap121f_setup(void) |
||
75 | { |
||
76 | u8 *art = (u8 *) KSEG1ADDR(0x1f040000); |
||
77 | |||
78 | ath79_register_m25p80(NULL); |
||
79 | |||
80 | ath79_setup_ar933x_phy4_switch(false, false); |
||
81 | |||
82 | /* LAN */ |
||
83 | ath79_register_mdio(0, 0x0); |
||
84 | ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); |
||
85 | ath79_register_eth(0); |
||
86 | |||
87 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ap121f_leds_gpio), |
||
88 | ap121f_leds_gpio); |
||
89 | |||
90 | ath79_register_gpio_keys_polled(-1, AP121F_KEYS_POLL_INTERVAL, |
||
91 | ARRAY_SIZE(ap121f_gpio_keys), |
||
92 | ap121f_gpio_keys); |
||
93 | |||
94 | gpio_request_one(AP121F_GPIO_MICROSD_EN, |
||
95 | GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, |
||
96 | "microSD enable"); |
||
97 | |||
98 | ath79_register_wmac(art + AP121F_WMAC_CALDATA_OFFSET, NULL); |
||
99 | |||
100 | ath79_register_usb(); |
||
101 | } |
||
102 | |||
103 | MIPS_MACHINE(ATH79_MACH_AP121F, "AP121F", "ALFA Network AP121F", ap121f_setup); |