ar71xx: fix COMFAST CF-E375AC support

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
openwrt-18.06
Piotr Dymacz 2018-02-18 22:49:10 +01:00
parent 650a5e993b
commit 1b0e7a1453
5 changed files with 36 additions and 39 deletions

View File

@ -210,13 +210,9 @@ cf-e320n-v2)
ucidef_set_led_netdev "wan" "WAN" "$board:red:wan" "eth1" ucidef_set_led_netdev "wan" "WAN" "$board:red:wan" "eth1"
ucidef_set_led_wlan "wlan" "WLAN" "$board:blue:wlan" "phy0tpt" ucidef_set_led_wlan "wlan" "WLAN" "$board:blue:wlan" "phy0tpt"
;; ;;
cf-e375ac)
ucidef_set_led_switch "wan" "WAN" "comfast:red:wan" "switch0" "0x02"
ucidef_set_led_switch "lan" "LAN" "comfast:green:lan" "switch0" "0x04"
ucidef_set_led_wlan "wlan1" "WLAN" "comfast:blue:wlan" "phy1tpt"
;;
cf-e355ac-v1|\ cf-e355ac-v1|\
cf-e355ac-v2|\ cf-e355ac-v2|\
cf-e375ac|\
cf-e380ac-v1|\ cf-e380ac-v1|\
cf-e380ac-v2|\ cf-e380ac-v2|\
cf-e385ac) cf-e385ac)
@ -224,6 +220,7 @@ cf-e385ac)
ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:red:wlan5g" "phy0tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:red:wlan5g" "phy0tpt"
case "$board" in case "$board" in
cf-e375ac|\
cf-e385ac) cf-e385ac)
ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x04" ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x04"
;; ;;

View File

@ -266,6 +266,11 @@ ar71xx_setup_interfaces()
rme-eg200) rme-eg200)
ucidef_set_interface_lan "eth0" "dhcp" ucidef_set_interface_lan "eth0" "dhcp"
;; ;;
cf-e375ac|\
rb-map-2nd)
ucidef_add_switch "switch0" \
"0@eth0" "1:wan" "2:lan"
;;
cf-e385ac) cf-e385ac)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2" ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
@ -447,11 +452,6 @@ ar71xx_setup_interfaces()
ucidef_add_switch "switch1" \ ucidef_add_switch "switch1" \
"0@eth1" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" "5:wan" "0@eth1" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" "5:wan"
;; ;;
cf-e375ac |\
rb-map-2nd)
ucidef_add_switch "switch0" \
"0@eth0" "1:wan" "2:lan"
;;
rut900) rut900)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1" ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \

View File

@ -148,6 +148,7 @@ get_status_led() {
cf-e320n-v2) cf-e320n-v2)
status_led="$board:blue:wlan" status_led="$board:blue:wlan"
;; ;;
cf-e375ac|\
cf-e380ac-v1|\ cf-e380ac-v1|\
cf-e380ac-v2|\ cf-e380ac-v2|\
cf-e385ac) cf-e385ac)

View File

@ -188,37 +188,38 @@ static struct gpio_keys_button cf_e355ac_gpio_keys[] __initdata = {
}, },
}; };
#define CF_E375AC_GPIO_XWDT_TRIGGER 6 /* CF-E375AC */
#define CF_E375AC_GPIO_BTN_RESET_WPS 2
#define CF_E375AC_GPIO_LED_WAN 15
#define CF_E375AC_GPIO_LED_LAN 17 #define CF_E375AC_GPIO_LED_LAN 17
#define CF_E375AC_GPIO_LED_WLAN 16 #define CF_E375AC_GPIO_LED_WLAN2G 16
#define CF_E375AC_GPIO_LED_WLAN5G 15
#define CF_E375AC_GPIO_EXT_WDT 6
#define CF_E375AC_GPIO_BTN_RESET 2
static struct gpio_led cf_e375ac_leds_gpio[] __initdata = { static struct gpio_led cf_e375ac_leds_gpio[] __initdata = {
{ {
.name = "comfast:red:wan", .name = "cf-e375ac:green:lan",
.gpio = CF_E375AC_GPIO_LED_WAN,
.active_low = 0,
}, {
.name = "comfast:green:lan",
.gpio = CF_E375AC_GPIO_LED_LAN, .gpio = CF_E375AC_GPIO_LED_LAN,
.active_low = 0, .active_low = 0,
}, { }, {
.name = "comfast:blue:wlan", .name = "cf-e375ac:red:wlan5g",
.gpio = CF_E375AC_GPIO_LED_WLAN, .gpio = CF_E375AC_GPIO_LED_WLAN5G,
.active_low = 0,
}, {
.name = "cf-e375ac:blue:wlan2g",
.gpio = CF_E375AC_GPIO_LED_WLAN2G,
.active_low = 0, .active_low = 0,
}, },
}; };
static struct gpio_keys_button cf_e375ac_gpio_keys[] __initdata = { static struct gpio_keys_button cf_e375ac_gpio_keys[] __initdata = {
{ {
.desc = "Reset button/WPS button", .desc = "Reset button",
.type = EV_KEY, .type = EV_KEY,
.code = KEY_RESTART, .code = KEY_RESTART,
.debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL,
.gpio = CF_E375AC_GPIO_BTN_RESET_WPS, .gpio = CF_E375AC_GPIO_BTN_RESET,
.active_low = 1, .active_low = 1,
}, },
}; };
@ -535,25 +536,19 @@ MIPS_MACHINE(ATH79_MACH_CF_E355AC_V2, "CF-E355AC-V2", "COMFAST CF-E355AC v2",
static void __init cf_e375ac_setup(void) static void __init cf_e375ac_setup(void)
{ {
u8 *mac = (u8 *) KSEG1ADDR(0x1f040000); u8 *mac = (u8 *) KSEG1ADDR(0x1f040000);
u8 *art = (u8 *) KSEG1ADDR(0x1f040000);
u8 wlan1_mac[ETH_ALEN];
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
ath79_init_mac(wlan1_mac, art, 3);
/* Disable JTAG, enabling GPIOs 0-3 */ /* Disable JTAG, enabling GPIOs 0-3 */
/* Configure OBS4 line, for GPIO 4*/
ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, 0); ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, 0);
cf_exxxn_common_setup(0x40000, CF_E375AC_GPIO_XWDT_TRIGGER); cf_exxxn_common_setup(0x40000, CF_E375AC_GPIO_EXT_WDT);
ath79_gpio_output_select(CF_E375AC_GPIO_LED_WAN, 0);
ath79_gpio_output_select(CF_E375AC_GPIO_LED_LAN, 0); ath79_gpio_output_select(CF_E375AC_GPIO_LED_LAN, 0);
ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN, 0); ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN2G, 0);
ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN5G, 0);
ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e375ac_leds_gpio), ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e375ac_leds_gpio),
cf_e375ac_leds_gpio); cf_e375ac_leds_gpio);
ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL, ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL,
ARRAY_SIZE(cf_e375ac_gpio_keys), ARRAY_SIZE(cf_e375ac_gpio_keys),
cf_e375ac_gpio_keys); cf_e375ac_gpio_keys);
@ -569,11 +564,14 @@ static void __init cf_e375ac_setup(void)
ath79_eth0_data.duplex = DUPLEX_FULL; ath79_eth0_data.duplex = DUPLEX_FULL;
ath79_eth0_data.phy_mask = BIT(0); ath79_eth0_data.phy_mask = BIT(0);
ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
ath79_register_eth(0); ath79_register_eth(0);
ap91_pci_init(art + 0x5000, wlan1_mac); ath79_register_pci();
} }
MIPS_MACHINE(ATH79_MACH_CF_E375AC, "CF-E375AC", "COMFAST CF-E375AC", cf_e375ac_setup);
MIPS_MACHINE(ATH79_MACH_CF_E375AC, "CF-E375AC", "COMFAST CF-E375AC",
cf_e375ac_setup);
static void __init cf_e38xac_common_setup(unsigned long art_ofs) static void __init cf_e38xac_common_setup(unsigned long art_ofs)
{ {

View File

@ -216,7 +216,8 @@ TARGET_DEVICES += cf-e355ac-v2
define Device/cf-e375ac define Device/cf-e375ac
DEVICE_TITLE := COMFAST CF-E375AC DEVICE_TITLE := COMFAST CF-E375AC
DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9888 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca9888 \
-uboot-envtools
BOARDNAME := CF-E375AC BOARDNAME := CF-E375AC
IMAGE_SIZE := 16000k IMAGE_SIZE := 16000k
MTDPARTS := spi0.0:256k(u-boot)ro,64k(art)ro,16000k(firmware),64k(art-backup)ro MTDPARTS := spi0.0:256k(u-boot)ro,64k(art)ro,16000k(firmware),64k(art-backup)ro