From: Piotr Dymacz Date: Sun, 18 Feb 2018 21:49:10 +0000 (+0100) Subject: ar71xx: fix COMFAST CF-E375AC support X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=1b0e7a1453ad968cd866b9d206a588caabbbb835;p=openwrt%2Fstaging%2Fthess.git ar71xx: fix COMFAST CF-E375AC support Signed-off-by: Piotr Dymacz --- diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index 1b308d7f77..2d0bf2cffa 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -210,13 +210,9 @@ cf-e320n-v2) ucidef_set_led_netdev "wan" "WAN" "$board:red:wan" "eth1" 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-v2|\ +cf-e375ac|\ cf-e380ac-v1|\ cf-e380ac-v2|\ cf-e385ac) @@ -224,6 +220,7 @@ cf-e385ac) ucidef_set_led_wlan "wlan5g" "WLAN5G" "$board:red:wlan5g" "phy0tpt" case "$board" in + cf-e375ac|\ cf-e385ac) ucidef_set_led_switch "lan" "LAN" "$board:green:lan" "switch0" "0x04" ;; diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index 434056a344..f4e113a814 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -266,6 +266,11 @@ ar71xx_setup_interfaces() rme-eg200) ucidef_set_interface_lan "eth0" "dhcp" ;; + cf-e375ac|\ + rb-map-2nd) + ucidef_add_switch "switch0" \ + "0@eth0" "1:wan" "2:lan" + ;; cf-e385ac) ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2" ucidef_add_switch "switch0" \ @@ -447,11 +452,6 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch1" \ "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) ucidef_set_interfaces_lan_wan "eth0.1" "eth1" ucidef_add_switch "switch0" \ diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 232e43b8dc..bec14d4439 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -148,6 +148,7 @@ get_status_led() { cf-e320n-v2) status_led="$board:blue:wlan" ;; + cf-e375ac|\ cf-e380ac-v1|\ cf-e380ac-v2|\ cf-e385ac) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c index a5baeac2ed..587e66d22d 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c @@ -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_LED_LAN 17 +#define CF_E375AC_GPIO_LED_WLAN2G 16 +#define CF_E375AC_GPIO_LED_WLAN5G 15 -#define CF_E375AC_GPIO_BTN_RESET_WPS 2 +#define CF_E375AC_GPIO_EXT_WDT 6 -#define CF_E375AC_GPIO_LED_WAN 15 -#define CF_E375AC_GPIO_LED_LAN 17 -#define CF_E375AC_GPIO_LED_WLAN 16 +#define CF_E375AC_GPIO_BTN_RESET 2 static struct gpio_led cf_e375ac_leds_gpio[] __initdata = { { - .name = "comfast:red:wan", - .gpio = CF_E375AC_GPIO_LED_WAN, + .name = "cf-e375ac:green:lan", + .gpio = CF_E375AC_GPIO_LED_LAN, .active_low = 0, }, { - .name = "comfast:green:lan", - .gpio = CF_E375AC_GPIO_LED_LAN, + .name = "cf-e375ac:red:wlan5g", + .gpio = CF_E375AC_GPIO_LED_WLAN5G, .active_low = 0, }, { - .name = "comfast:blue:wlan", - .gpio = CF_E375AC_GPIO_LED_WLAN, + .name = "cf-e375ac:blue:wlan2g", + .gpio = CF_E375AC_GPIO_LED_WLAN2G, .active_low = 0, }, }; static struct gpio_keys_button cf_e375ac_gpio_keys[] __initdata = { { - .desc = "Reset button/WPS button", + .desc = "Reset button", .type = EV_KEY, .code = KEY_RESTART, .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, - .gpio = CF_E375AC_GPIO_BTN_RESET_WPS, + .gpio = CF_E375AC_GPIO_BTN_RESET, .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) { 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 */ - /* Configure OBS4 line, for GPIO 4*/ 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_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), - cf_e375ac_leds_gpio); + cf_e375ac_leds_gpio); + ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL, ARRAY_SIZE(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.phy_mask = BIT(0); ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 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) { diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 80e20ac0e1..add3aa32a7 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -216,7 +216,8 @@ TARGET_DEVICES += cf-e355ac-v2 define Device/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 IMAGE_SIZE := 16000k MTDPARTS := spi0.0:256k(u-boot)ro,64k(art)ro,16000k(firmware),64k(art-backup)ro