OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * Qxwlan E750A v4 board support |
||
3 | * |
||
4 | * Copyright (C) 2017 Peng Zhang <sd20@qxwlan.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/phy.h> |
||
12 | #include <linux/gpio.h> |
||
13 | #include <linux/platform_device.h> |
||
14 | #include <linux/ath9k_platform.h> |
||
15 | #include <linux/ar8216_platform.h> |
||
16 | |||
17 | #include <asm/mach-ath79/ar71xx_regs.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-usb.h" |
||
25 | #include "dev-wmac.h" |
||
26 | #include "machtypes.h" |
||
27 | #include "pci.h" |
||
28 | |||
29 | #define E750A_V4_GPIO_LED_SYS 14 |
||
30 | #define E750A_V4_GPIO_LED_LAN 19 |
||
31 | #define E750A_V4_GPIO_LED_WAN 18 |
||
32 | #define E750A_V4_GPIO_LED_DS10 15 |
||
33 | #define E750A_V4_GPIO_LED_DS20 20 |
||
34 | #define E750A_V4_GPIO_LED_WLAN 21 |
||
35 | |||
36 | #define E750A_V4_GPIO_BTN_RESET 12 |
||
37 | |||
38 | #define E750A_V4_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
39 | #define E750A_V4_KEYS_DEBOUNCE_INTERVAL (3 * E750A_V4_KEYS_POLL_INTERVAL) |
||
40 | |||
41 | static struct gpio_led e750a_v4_leds_gpio[] __initdata = { |
||
42 | { |
||
43 | .name = "e750a-v4:green:system", |
||
44 | .gpio = E750A_V4_GPIO_LED_SYS, |
||
45 | .active_low = 1, |
||
46 | }, |
||
47 | { |
||
48 | .name = "e750a-v4:green:lan", |
||
49 | .gpio = E750A_V4_GPIO_LED_LAN, |
||
50 | .active_low = 1, |
||
51 | }, |
||
52 | { |
||
53 | .name = "e750a-v4:green:wan", |
||
54 | .gpio = E750A_V4_GPIO_LED_WAN, |
||
55 | .active_low = 1, |
||
56 | }, |
||
57 | { |
||
58 | .name = "e750a-v4:green:wlan", |
||
59 | .gpio = E750A_V4_GPIO_LED_WLAN, |
||
60 | .active_low = 1, |
||
61 | }, |
||
62 | { |
||
63 | .name = "e750a-v4:green:ds10", |
||
64 | .gpio = E750A_V4_GPIO_LED_DS10, |
||
65 | .active_low = 1, |
||
66 | }, |
||
67 | { |
||
68 | .name = "e750a-v4:green:ds20", |
||
69 | .gpio = E750A_V4_GPIO_LED_DS20, |
||
70 | .active_low = 1, |
||
71 | }, |
||
72 | }; |
||
73 | |||
74 | static struct gpio_keys_button e750a_v4_gpio_keys[] __initdata = { |
||
75 | { |
||
76 | .desc = "reset", |
||
77 | .type = EV_KEY, |
||
78 | .code = KEY_RESTART, |
||
79 | .debounce_interval = E750A_V4_KEYS_DEBOUNCE_INTERVAL, |
||
80 | .gpio = E750A_V4_GPIO_BTN_RESET, |
||
81 | .active_low = 1, |
||
82 | }, |
||
83 | }; |
||
84 | |||
85 | |||
86 | static void __init e750a_v4_setup(void) |
||
87 | { |
||
88 | u8 *mac = (u8 *) KSEG1ADDR(0x1f050400); |
||
89 | u8 *art = (u8 *) KSEG1ADDR(0x1f061000); |
||
90 | |||
91 | ath79_register_m25p80(NULL); |
||
92 | |||
93 | ath79_register_leds_gpio(-1, ARRAY_SIZE(e750a_v4_leds_gpio), |
||
94 | e750a_v4_leds_gpio); |
||
95 | ath79_register_gpio_keys_polled(-1, E750A_V4_KEYS_POLL_INTERVAL, |
||
96 | ARRAY_SIZE(e750a_v4_gpio_keys), |
||
97 | e750a_v4_gpio_keys); |
||
98 | |||
99 | ath79_register_mdio(1, 0x0); |
||
100 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); |
||
101 | |||
102 | /* GMAC1 is connected to the internal switch */ |
||
103 | ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; |
||
104 | ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0); |
||
105 | ath79_register_eth(1); |
||
106 | |||
107 | /* GMAC0 is connected to the PHY4 of the internal switch */ |
||
108 | ath79_switch_data.phy4_mii_en = 1; |
||
109 | ath79_switch_data.phy_poll_mask = BIT(4); |
||
110 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; |
||
111 | ath79_eth0_data.phy_mask = BIT(4); |
||
112 | ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; |
||
113 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); |
||
114 | ath79_register_eth(0); |
||
115 | |||
116 | ath79_register_pci(); |
||
117 | ath79_register_usb(); |
||
118 | ath79_register_wmac(art, NULL); |
||
119 | } |
||
120 | |||
121 | MIPS_MACHINE(ATH79_MACH_E750A_V4, "E750A-V4", "Qxlan E750A v4", |
||
122 | e750a_v4_setup); |