From: Enrique Giraldo Date: Thu, 29 Jun 2017 10:03:03 +0000 (+0200) Subject: ar71xx: add support for COMFAST CF-E355AC X-Git-Tag: v18.06.0-rc1~2282 X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=commitdiff_plain;h=fefdb1e0b9e0cc22ab93e6fcf51dc9e917565d26 ar71xx: add support for COMFAST CF-E355AC COMFAST CF-E355AC is a ceiling mount AP with PoE support, based on Qualcomm/Atheros QCA9531 + QCA9882. Short specification: - 2x 10/100 Mbps Ethernet, with PoE support - 64MB of RAM (DDR2) - 16 MB of FLASH - 2T2R 2.4 GHz, 802.11b/g/n - 2T2R 5 GHz, 802.11ac/n/a - built-in 4x 3 dBi antennas - output power (max): 500 mW (27 dBm) - 1x RGB LED, 1x button - built-in watchdog chipset Flash instruction: Original firmware is based on OpenWrt. Use sysupgrade image directly in vendor GUI. Signed-off-by: Enrique Giraldo [whitespace fixes, ac radio caldata offset fix] 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 f367885488..51d21ca917 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -185,6 +185,7 @@ cf-e320n-v2) ucidef_set_led_netdev "wan" "WAN" "$board:red:wan" "eth1" ucidef_set_led_wlan "wlan" "WLAN" "$board:blue:wlan" "phy0tpt" ;; +cf-e355ac|\ cf-e380ac-v1|\ cf-e380ac-v2) ucidef_set_led_netdev "lan" "LAN" "$board:green:lan" "eth0" diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 6a50e0c86e..85a2a63022 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -61,6 +61,7 @@ case "$FIRMWARE" in ath10kcal_extract "art" 20480 2116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2) ;; + cf-e355ac|\ cf-e380ac-v1|\ cf-e380ac-v2|\ dlan-pro-1200-ac|\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 2eab6108f1..0bd96c0651 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -507,6 +507,9 @@ ar71xx_board_detect() { *"CF-E320N v2") name="cf-e320n-v2" ;; + *"CF-E355AC") + name="cf-e355ac" + ;; *"CF-E380AC v1") name="cf-e380ac-v1" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index fcf329478c..65d90d4009 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -216,6 +216,7 @@ platform_check_image() { carambola2|\ cf-e316n-v2|\ cf-e320n-v2|\ + cf-e355ac|\ cf-e380ac-v1|\ cf-e380ac-v2|\ cf-e520n|\ diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index c747af918a..09097d0b48 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -69,6 +69,7 @@ CONFIG_ATH79_MACH_CAP4200AG=y CONFIG_ATH79_MACH_CARAMBOLA2=y CONFIG_ATH79_MACH_CF_E316N_V2=y CONFIG_ATH79_MACH_CF_E320N_V2=y +CONFIG_ATH79_MACH_CF_E355AC=y CONFIG_ATH79_MACH_CF_E380AC_V1=y CONFIG_ATH79_MACH_CF_E380AC_V2=y CONFIG_ATH79_MACH_CF_E520N=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 6b6188dc7b..173de346f1 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -2028,6 +2028,14 @@ config ATH79_MACH_CF_E320N_V2 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_CF_E355AC + bool "COMFAST CF-E355AC support" + select SOC_QCA953X + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_WMAC + config ATH79_MACH_CF_E380AC_V1 bool "COMFAST CF-E380AC v1 support" select SOC_QCA955X diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile index 9e91c44060..0975aac8b3 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -74,6 +74,7 @@ obj-$(CONFIG_ATH79_MACH_CAP4200AG) += mach-cap4200ag.o obj-$(CONFIG_ATH79_MACH_CARAMBOLA2) += mach-carambola2.o obj-$(CONFIG_ATH79_MACH_CF_E316N_V2) += mach-cf-e316n-v2.o obj-$(CONFIG_ATH79_MACH_CF_E320N_V2) += mach-cf-e316n-v2.o +obj-$(CONFIG_ATH79_MACH_CF_E355AC) += mach-cf-e316n-v2.o obj-$(CONFIG_ATH79_MACH_CF_E380AC_V1) += mach-cf-e316n-v2.o obj-$(CONFIG_ATH79_MACH_CF_E380AC_V2) += mach-cf-e316n-v2.o obj-$(CONFIG_ATH79_MACH_CF_E520N) += mach-cf-e316n-v2.o 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 2c202e3754..82fe83f01e 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 @@ -2,6 +2,7 @@ * Support for COMFAST boards: * - CF-E316N v2 (AR9341) * - CF-E320N v2 (QCA9531) + * - CF-E355AC (QCA9531) * - CF-E380AC v1/v2 (QCA9558) * - CF-E520N/CF-E530N (QCA9531) * @@ -130,6 +131,42 @@ static struct gpio_keys_button cf_e320n_v2_gpio_keys[] __initdata = { }, }; +/* CF-E355AC */ +#define CF_E355AC_GPIO_LED_LAN 3 +#define CF_E355AC_GPIO_LED_WLAN2G 0 +#define CF_E355AC_GPIO_LED_WLAN5G 2 + +#define CF_E355AC_GPIO_EXT_WDT 13 + +#define CF_E355AC_GPIO_BTN_RESET 17 + +static struct gpio_led cf_e355ac_leds_gpio[] __initdata = { + { + .name = "cf-e355ac:green:lan", + .gpio = CF_E355AC_GPIO_LED_LAN, + .active_low = 0, + }, { + .name = "cf-e355ac:blue:wlan2g", + .gpio = CF_E355AC_GPIO_LED_WLAN2G, + .active_low = 0, + }, { + .name = "cf-e355ac:red:wlan5g", + .gpio = CF_E355AC_GPIO_LED_WLAN5G, + .active_low = 0, + }, +}; + +static struct gpio_keys_button cf_e355ac_gpio_keys[] __initdata = { + { + .desc = "Reset button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, + .gpio = CF_E355AC_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + /* CF-E380AC v1/v2 */ #define CF_E380AC_V1V2_GPIO_LED_LAN 0 #define CF_E380AC_V1V2_GPIO_LED_WLAN2G 2 @@ -355,6 +392,34 @@ static void __init cf_e320n_v2_setup(void) MIPS_MACHINE(ATH79_MACH_CF_E320N_V2, "CF-E320N-V2", "COMFAST CF-E320N v2", cf_e320n_v2_setup); +static void __init cf_e355ac_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1f010000); + + /* Disable JTAG, enabling GPIOs 0-3 */ + ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE, 0); + + cf_exxxn_common_setup(0x10000, CF_E355AC_GPIO_EXT_WDT); + + cf_exxxn_qca953x_eth_setup(); + + ath79_gpio_output_select(CF_E355AC_GPIO_LED_LAN, 0); + ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN2G, 0); + ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN5G, 0); + + ap91_pci_init(art + 0x5000, NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e355ac_leds_gpio), + cf_e355ac_leds_gpio); + + ath79_register_gpio_keys_polled(1, CF_EXXXN_KEYS_POLL_INTERVAL, + ARRAY_SIZE(cf_e355ac_gpio_keys), + cf_e355ac_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_CF_E355AC, "CF-E355AC", "COMFAST CF-E355AC", + cf_e355ac_setup); + static void __init cf_e380ac_v1v2_common_setup(unsigned long art_ofs) { u8 *mac = (u8 *) KSEG1ADDR(0x1f000000 + art_ofs); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 16fbdcef84..756d406e11 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -60,6 +60,7 @@ enum ath79_mach_type { ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */ ATH79_MACH_CF_E316N_V2, /* COMFAST CF-E316N v2 */ ATH79_MACH_CF_E320N_V2, /* COMFAST CF-E320N v2 */ + ATH79_MACH_CF_E355AC, /* COMFAST CF-E355AC */ ATH79_MACH_CF_E380AC_V1, /* COMFAST CF-E380AC v1 */ ATH79_MACH_CF_E380AC_V2, /* COMFAST CF-E380AC v2 */ ATH79_MACH_CF_E520N, /* COMFAST CF-E520N */ diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index f0b2179f44..726b03a04c 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -151,6 +151,15 @@ define Device/cf-e320n-v2 endef TARGET_DEVICES += cf-e320n-v2 +define Device/cf-e355ac + DEVICE_TITLE := COMFAST CF-E355AC + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca988x + BOARDNAME := CF-E355AC + IMAGE_SIZE := 16192k + MTDPARTS := spi0.0:64k(u-boot)ro,64k(art)ro,16192k(firmware),64k(art-backup)ro +endef +TARGET_DEVICES += cf-e355ac + define Device/cf-e380ac-v1 DEVICE_TITLE := COMFAST CF-E380AC v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca988x diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default index 83e3a03877..d448560eb9 100644 --- a/target/linux/ar71xx/mikrotik/config-default +++ b/target/linux/ar71xx/mikrotik/config-default @@ -34,6 +34,7 @@ # CONFIG_ATH79_MACH_CARAMBOLA2 is not set # CONFIG_ATH79_MACH_CF_E316N_V2 is not set # CONFIG_ATH79_MACH_CF_E320N_V2 is not set +# CONFIG_ATH79_MACH_CF_E355AC is not set # CONFIG_ATH79_MACH_CF_E380AC_V1 is not set # CONFIG_ATH79_MACH_CF_E380AC_V2 is not set # CONFIG_ATH79_MACH_CF_E520N is not set diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default index 99eb346e15..2d3b06f69d 100644 --- a/target/linux/ar71xx/nand/config-default +++ b/target/linux/ar71xx/nand/config-default @@ -34,6 +34,7 @@ CONFIG_ATH79_MACH_C60=y # CONFIG_ATH79_MACH_CARAMBOLA2 is not set # CONFIG_ATH79_MACH_CF_E316N_V2 is not set # CONFIG_ATH79_MACH_CF_E320N_V2 is not set +# CONFIG_ATH79_MACH_CF_E355AC is not set # CONFIG_ATH79_MACH_CF_E380AC_V1 is not set # CONFIG_ATH79_MACH_CF_E380AC_V2 is not set # CONFIG_ATH79_MACH_CF_E520N is not set