OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * ALFA Network AP91-5G board support |
||
3 | * |
||
4 | * Copyright (C) 2018 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-ap9x-pci.h" |
||
19 | #include "dev-eth.h" |
||
20 | #include "dev-gpio-buttons.h" |
||
21 | #include "dev-leds-gpio.h" |
||
22 | #include "dev-m25p80.h" |
||
23 | #include "machtypes.h" |
||
24 | |||
25 | #define AP91_5G_GPIO_LED_LAN 17 |
||
26 | #define AP91_5G_GPIO_LED_SIGNAL1 12 |
||
27 | #define AP91_5G_GPIO_LED_SIGNAL2 8 |
||
28 | #define AP91_5G_GPIO_LED_SIGNAL3 6 |
||
29 | #define AP91_5G_GPIO_LED_SIGNAL4 7 |
||
30 | |||
31 | #define AP91_5G_GPIO_WDT_EN 1 |
||
32 | #define AP91_5G_GPIO_WDT_IN 0 |
||
33 | |||
34 | #define AP91_5G_GPIO_BTN_RESET 11 |
||
35 | |||
36 | #define AP91_5G_KEYS_POLL_INTERVAL 20 |
||
37 | #define AP91_5G_KEYS_DEBOUNCE_INTERVAL (3 * AP91_5G_KEYS_POLL_INTERVAL) |
||
38 | |||
39 | #define AP91_5G_WMAC_CALDATA_OFFSET 0x1000 |
||
40 | |||
41 | static struct gpio_led ap91_5g_leds_gpio[] __initdata = { |
||
42 | { |
||
43 | .name = "ap91-5g:green:lan", |
||
44 | .gpio = AP91_5G_GPIO_LED_LAN, |
||
45 | .active_low = 1, |
||
46 | }, { |
||
47 | .name = "ap91-5g:red:signal1", |
||
48 | .gpio = AP91_5G_GPIO_LED_SIGNAL1, |
||
49 | .active_low = 1, |
||
50 | }, { |
||
51 | .name = "ap91-5g:orange:signal2", |
||
52 | .gpio = AP91_5G_GPIO_LED_SIGNAL2, |
||
53 | .active_low = 1, |
||
54 | }, { |
||
55 | .name = "ap91-5g:green:signal3", |
||
56 | .gpio = AP91_5G_GPIO_LED_SIGNAL3, |
||
57 | .active_low = 1, |
||
58 | }, { |
||
59 | .name = "ap91-5g:green:signal4", |
||
60 | .gpio = AP91_5G_GPIO_LED_SIGNAL4, |
||
61 | .active_low = 1, |
||
62 | }, |
||
63 | }; |
||
64 | |||
65 | static struct gpio_keys_button ap91_5g_gpio_keys[] __initdata = { |
||
66 | { |
||
67 | .desc = "reset", |
||
68 | .type = EV_KEY, |
||
69 | .code = KEY_RESTART, |
||
70 | .debounce_interval = AP91_5G_KEYS_DEBOUNCE_INTERVAL, |
||
71 | .gpio = AP91_5G_GPIO_BTN_RESET, |
||
72 | .active_low = 1, |
||
73 | }, |
||
74 | }; |
||
75 | |||
76 | static void __init ap91_5g_setup(void) |
||
77 | { |
||
78 | u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); |
||
79 | |||
80 | ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, |
||
81 | AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); |
||
82 | |||
83 | gpio_set_value(AP91_5G_GPIO_LED_LAN, 1); |
||
84 | gpio_set_value(AP91_5G_GPIO_LED_SIGNAL3, 1); |
||
85 | gpio_set_value(AP91_5G_GPIO_LED_SIGNAL4, 1); |
||
86 | |||
87 | ath79_register_m25p80(NULL); |
||
88 | |||
89 | ath79_register_mdio(0, 0x0); |
||
90 | |||
91 | /* LAN */ |
||
92 | ath79_eth0_data.duplex = DUPLEX_FULL; |
||
93 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; |
||
94 | ath79_eth0_data.phy_mask = BIT(4); |
||
95 | ath79_eth0_data.speed = SPEED_100; |
||
96 | ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); |
||
97 | ath79_register_eth(0); |
||
98 | |||
99 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ap91_5g_leds_gpio), |
||
100 | ap91_5g_leds_gpio); |
||
101 | |||
102 | ath79_register_gpio_keys_polled(-1, AP91_5G_KEYS_POLL_INTERVAL, |
||
103 | ARRAY_SIZE(ap91_5g_gpio_keys), |
||
104 | ap91_5g_gpio_keys); |
||
105 | |||
106 | gpio_request_one(AP91_5G_GPIO_WDT_IN, |
||
107 | GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, |
||
108 | "WDT input"); |
||
109 | |||
110 | gpio_request_one(AP91_5G_GPIO_WDT_EN, |
||
111 | GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, |
||
112 | "WDT enable"); |
||
113 | |||
114 | ap91_pci_init(art + AP91_5G_WMAC_CALDATA_OFFSET, NULL); |
||
115 | } |
||
116 | |||
117 | MIPS_MACHINE(ATH79_MACH_AP91_5G, "AP91-5G", "ALFA Network AP91-5G", |
||
118 | ap91_5g_setup); |