From: Ding Tengfei Date: Wed, 7 Feb 2018 03:47:52 +0000 (+0800) Subject: ar71xx:add support for COMFAST CF-E375AC X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=bf66bb8c969c58ef658407165a74afbfb4055997;p=openwrt%2Fstaging%2Flinusw.git ar71xx:add support for COMFAST CF-E375AC COMFAST CF-E375AC is a ceiling mount AP with PoE support, based on Qualcomm/Atheros QCA9563 + QCA9886 + QCA8337. Short specification: 2x 10/100/1000 Mbps Ethernet, with PoE support 128MB of RAM (DDR2) 16 MB of FLASH 3T3R 2.4 GHz, 802.11b/g/n 2T2R 5 GHz, 802.11ac/n/a, wave 2 built-in 5x 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: Ding Tengfei --- 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 5739972e75..a3154db7ed 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -208,6 +208,11 @@ 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|\ cf-e380ac-v1|\ cf-e380ac-v2) 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 02eb94691c..435d413c63 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -434,6 +434,7 @@ 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" 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 ccb041028a..ca90563d25 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 @@ -151,7 +151,8 @@ case "$FIRMWARE" in case $board in archer-c58-v1|\ archer-c59-v1|\ - archer-c60-v1) + archer-c60-v1|\ + cf-e375ac) ath10kcal_extract "art" 20480 12064 ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 9d188400d3..267c575545 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -519,6 +519,9 @@ ar71xx_board_detect() { *"CF-E355AC") name="cf-e355ac" ;; + *"CF-E375AC") + name="cf-e375ac" + ;; *"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 28f04e53d7..21e387389d 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -209,6 +209,7 @@ platform_check_image() { cf-e316n-v2|\ cf-e320n-v2|\ cf-e355ac|\ + cf-e375ac|\ cf-e380ac-v1|\ cf-e380ac-v2|\ cf-e520n|\ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index ce54f1d4bb..20eb210105 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -2141,6 +2141,17 @@ config ATH79_MACH_CF_E355AC select ATH79_DEV_AP9X_PCI if PCI select ATH79_DEV_WMAC +config ATH79_MACH_CF_E375AC + bool "COMFAST CF-E375AC support" + select SOC_QCA956X + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + 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 d09762da40..9be721ac20 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -78,6 +78,7 @@ 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_E375AC) += 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 82fe83f01e..90937a4503 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 @@ -3,6 +3,7 @@ * - CF-E316N v2 (AR9341) * - CF-E320N v2 (QCA9531) * - CF-E355AC (QCA9531) + * - CF-E375AC (QCA9563 + QCA9886 + QCA8337) * - CF-E380AC v1/v2 (QCA9558) * - CF-E520N/CF-E530N (QCA9531) * @@ -16,6 +17,7 @@ */ #include +#include #include #include #include @@ -167,6 +169,65 @@ static struct gpio_keys_button cf_e355ac_gpio_keys[] __initdata = { }, }; +#define CF_E375AC_GPIO_XWDT_TRIGGER 6 + +#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_WLAN 16 + +static struct gpio_led cf_e375ac_leds_gpio[] __initdata = { + { + .name = "comfast:red:wan", + .gpio = CF_E375AC_GPIO_LED_WAN, + .active_low = 0, + }, { + .name = "comfast:green:lan", + .gpio = CF_E375AC_GPIO_LED_LAN, + .active_low = 0, + }, { + .name = "comfast:blue:wlan", + .gpio = CF_E375AC_GPIO_LED_WLAN, + .active_low = 0, + }, +}; + +static struct gpio_keys_button cf_e375ac_gpio_keys[] __initdata = { + { + .desc = "Reset button/WPS button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = CF_EXXXN_KEYS_DEBOUNCE_INTERVAL, + .gpio = CF_E375AC_GPIO_BTN_RESET_WPS, + .active_low = 1, + }, +}; + +static struct ar8327_pad_cfg cf_e375ac_ar8337_pad0_cfg = { + .mode = AR8327_PAD_MAC_SGMII, + .sgmii_delay_en = true, +}; + +static struct ar8327_platform_data cf_e375ac_ar8337_data = { + .pad0_cfg = &cf_e375ac_ar8337_pad0_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, +}; + +static struct mdio_board_info cf_e375ac_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &cf_e375ac_ar8337_data, + }, +}; + /* CF-E380AC v1/v2 */ #define CF_E380AC_V1V2_GPIO_LED_LAN 0 #define CF_E380AC_V1V2_GPIO_LED_WLAN2G 2 @@ -420,6 +481,49 @@ static void __init cf_e355ac_setup(void) MIPS_MACHINE(ATH79_MACH_CF_E355AC, "CF-E355AC", "COMFAST CF-E355AC", cf_e355ac_setup); +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); + + 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_register_leds_gpio(-1, ARRAY_SIZE(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); + + platform_device_register(&ath79_mdio0_device); + + mdiobus_register_board_info(cf_e375ac_mdio0_info, + ARRAY_SIZE(cf_e375ac_mdio0_info)); + + /* GMAC0 is connected to an AR8337 switch */ + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth0_data.speed = SPEED_1000; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.phy_mask = BIT(0); + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_register_eth(0); + + ap91_pci_init(art + 0x5000, wlan1_mac); +} +MIPS_MACHINE(ATH79_MACH_CF_E375AC, "CF-E375AC", "COMFAST CF-E375AC", cf_e375ac_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 4093c8b76d..7434f340af 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -64,6 +64,7 @@ enum ath79_mach_type { 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_E375AC, /* COMFAST CF-E375AC */ 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/generic/config-default b/target/linux/ar71xx/generic/config-default index 1a1fa1b830..42df64d780 100644 --- a/target/linux/ar71xx/generic/config-default +++ b/target/linux/ar71xx/generic/config-default @@ -44,6 +44,7 @@ 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_E375AC=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/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 95265d1c0a..1e35f1a84f 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -203,6 +203,15 @@ define Device/cf-e355ac endef TARGET_DEVICES += cf-e355ac +define Device/cf-e375ac + DEVICE_TITLE := COMFAST CF-E375AC + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9888 + BOARDNAME := CF-E375AC + IMAGE_SIZE := 16000k + MTDPARTS := spi0.0:256k(u-boot)ro,64k(art)ro,16000k(firmware),64k(art-backup)ro +endef +TARGET_DEVICES += cf-e375ac + define Device/cf-e380ac-v1 DEVICE_TITLE := COMFAST CF-E380AC v1 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-ath10k ath10k-firmware-qca988x