This patch adds support for the Comfast CF-WR650AC to Chaos Calmer. More information is located at: http://en.comfast.com.cn/product/SmartRepeater/item-217.html
I haven't been able to add this to Trunk as mac06_exchange_en is required and was changed in r47956. Without it the router hangs then reboots when accessing anything switch related, either through swconfig or luci. Signed-off-by: Gareth Parker <garet...@orcon.net.nz> 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 e6fcec8..751b685 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 @@ -47,6 +47,10 @@ board=$(ar71xx_board_name) case "$FIRMWARE" in "ath10k/cal-pci-0000:00:00.0.bin") case $board in + cf-wr650ac) + ath10kcal_extract "art" 20480 2116 + ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +3) + ;; dlan-pro-1200-ac) ath10kcal_extract "art" 20480 2116 ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds index a4b355a..6fa4813 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -50,6 +50,11 @@ bsb) ucidef_set_led_default "sys" "SYS" "bsb:red:sys" "1" ;; +cf-wr650ac) + ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "comfast:blue:24g" "phy1tpt" + ucidef_set_led_wlan "wlan5g" "WLAN 5 GHz" "comfast:blue:58g" "phy0tpt" + ;; + bullet-m | \ nanostation-m | \ rocket-m | \ diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network index b2e15bb..3ed8cf1 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -64,6 +64,13 @@ tl-wdr4900-v2) ucidef_add_switch_vlan "switch0" "2" "1 6" ;; +cf-wr650ac) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" "1" "1" + ucidef_add_switch_vlan "switch0" "1" "0 2 3 4 5" + ucidef_add_switch_vlan "switch0" "2" "1 6" + ;; + bsb) ucidef_set_interfaces_lan_wan "eth1" "eth0" ucidef_add_switch "switch0" "1" "1" diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index dab4d2c..bdd76f9 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -396,6 +396,9 @@ ar71xx_board_detect() { *CAP4200AG) name="cap4200ag" ;; + *"CF-WR650AC") + name="cf-wr650ac" + ;; *"CPE210/220/510/520") name="cpe510" tplink_pharos_board_detect diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index d025632..bbc06ab 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -400,6 +400,15 @@ platform_check_image() { } return 0 ;; + + cf-wr650ac) + [ "$magic_long" != "27051956" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + wndr3700 | \ wnr2000-v3 | \ wnr612-v2 | \ @@ -531,6 +540,7 @@ platform_do_upgrade() { om5p-an) platform_do_upgrade_openmesh "$ARGV" ;; + cf-wr650ac | \ unifi-outdoor-plus | \ uap-pro) MTD_CONFIG_ARGS="-s 0x180000" diff --git a/target/linux/ar71xx/config-3.18 b/target/linux/ar71xx/config-3.18 index e2ff826..11cd969 100644 --- a/target/linux/ar71xx/config-3.18 +++ b/target/linux/ar71xx/config-3.18 @@ -48,6 +48,7 @@ CONFIG_ATH79_MACH_BSB=y CONFIG_ATH79_MACH_CAP4200AG=y CONFIG_ATH79_MACH_CARAMBOLA2=y CONFIG_ATH79_MACH_CPE510=y +CONFIG_ATH79_MACH_CF_WR650AC=y CONFIG_ATH79_MACH_DB120=y CONFIG_ATH79_MACH_DGL_5500_A1=y CONFIG_ATH79_MACH_DHP_1565_A1=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-wr650ac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-wr650ac.c new file mode 100644 index 0000000..2ffec13 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cf-wr650ac.c @@ -0,0 +1,196 @@ +/* + * COMFAST CF-WR650AC board support + * + * Copyright (C) 2016 Gareth Parker <garet...@orcon.net.nz> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/pci.h> +#include <linux/platform_device.h> +#include <linux/ath9k_platform.h> +#include <linux/etherdevice.h> +#include <linux/ar8216_platform.h> +#include <linux/platform_data/phy-at803x.h> + +#include <asm/mach-ath79/irq.h> +#include <asm/mach-ath79/ath79.h> +#include <asm/mach-ath79/ar71xx_regs.h> + +#include "common.h" +#include "dev-ap9x-pci.h" +#include "dev-eth.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-m25p80.h" +#include "dev-usb.h" +#include "dev-wmac.h" +#include "dev-nfc.h" +#include "gpio.h" +#include "machtypes.h" +#include "pci.h" + +#define CF_WR650AC_KEYS_POLL_INTERVAL 20 /* msecs */ +#define CF_WR650AC_KEYS_DEBOUNCE_INTERVAL (3 * CF_WR650AC_KEYS_POLL_INTERVAL) + +#define CF_WR650AC_WATCHDOG_GPIO 17 + +#define CF_WR650AC_GPIO_BTN_RESET_WPS 19 + +#define CF_WR650AC_GPIO_LED_NETWORK 4 +#define CF_WR650AC_GPIO_LED_24G 13 +#define CF_WR650AC_GPIO_LED_58G 2 +#define CF_WR650AC_GPIO_LED_WPS 20 + +#define CF_WR650AC_WMAC_CALDATA_OFFSET 0x1000 +#define CF_WR650AC_PCIE_CALDATA_OFFSET 0x5000 + +#define CF_WR650AC_LAN_PHYMASK BIT(0) +#define CF_WR650AC_WAN_PHYMASK BIT(5) + +static struct gpio_led cf_wr650ac_leds_gpio[] __initdata = { + { + .name = "comfast:blue:network", + .gpio = CF_WR650AC_GPIO_LED_NETWORK, + .active_low = 1, + }, + { + .name = "comfast:blue:24g", + .gpio = CF_WR650AC_GPIO_LED_24G, + .active_low = 1, + }, + { + .name = "comfast:blue:58g", + .gpio = CF_WR650AC_GPIO_LED_58G, + .active_low = 1, + }, + { + .name = "comfast:blue:wps", + .gpio = CF_WR650AC_GPIO_LED_WPS, + .active_low = 1, + }, +}; + +static struct gpio_keys_button cf_wr650ac_gpio_keys[] __initdata = { + { + .desc = "Reset button/WPS button", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = CF_WR650AC_KEYS_DEBOUNCE_INTERVAL, + .gpio = CF_WR650AC_GPIO_BTN_RESET_WPS, + .active_low = 1, + }, +}; + +static struct ar8327_pad_cfg cf_wr650ac_ar8327_pad0_cfg = { + /* GMAC0 of the AR8337 switch is connected to GMAC0 via RGMII */ + .mode = AR8327_PAD_MAC_RGMII, + .txclk_delay_en = true, + .rxclk_delay_en = true, + .txclk_delay_sel = AR8327_CLK_DELAY_SEL1, + .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2, + .mac06_exchange_en = true, +}; + +static struct ar8327_pad_cfg cf_wr650ac_ar8327_pad6_cfg = { + /* GMAC6 of the AR8337 switch is connected to GMAC1 via SGMII */ + .mode = AR8327_PAD_MAC_SGMII, + .rxclk_delay_en = true, + .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0, +}; + +static struct ar8327_platform_data cf_wr650ac_ar8327_data = { + .pad0_cfg = &cf_wr650ac_ar8327_pad0_cfg, + .pad6_cfg = &cf_wr650ac_ar8327_pad6_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .port6_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, +}; + +static struct mdio_board_info cf_wr650ac_mdio0_info[] = { + { + .bus_id = "ag71xx-mdio.0", + .phy_addr = 0, + .platform_data = &cf_wr650ac_ar8327_data, + }, +}; + +static struct timer_list watchdog_timer; + +static void watchdog_gpio(unsigned long period) +{ + static int state; + state = !state; + gpio_set_value(CF_WR650AC_WATCHDOG_GPIO, state); + mod_timer(&watchdog_timer, jiffies + period); +} + +static void __init cf_wr650ac_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1f020000); + u8 wlan0_mac[ETH_ALEN]; + u8 wlan1_mac[ETH_ALEN]; + + gpio_request(CF_WR650AC_WATCHDOG_GPIO, "watchdog timer gpio"); + gpio_direction_output(CF_WR650AC_WATCHDOG_GPIO, 0); + setup_timer(&watchdog_timer, watchdog_gpio, msecs_to_jiffies(500)); + watchdog_gpio(msecs_to_jiffies(1)); + + ath79_register_m25p80(NULL); + ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_wr650ac_leds_gpio), + cf_wr650ac_leds_gpio); + ath79_register_gpio_keys_polled(-1, CF_WR650AC_KEYS_POLL_INTERVAL, + ARRAY_SIZE(cf_wr650ac_gpio_keys), + cf_wr650ac_gpio_keys); + + ath79_register_usb(); + + ath79_init_mac(wlan0_mac, art, 1); + ath79_init_mac(wlan1_mac, art, 3); + + ath79_register_wmac(art + CF_WR650AC_WMAC_CALDATA_OFFSET, wlan0_mac); + + ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN); + + ath79_register_mdio(0, 0x0); + + mdiobus_register_board_info(cf_wr650ac_mdio0_info, + ARRAY_SIZE(cf_wr650ac_mdio0_info)); + + /* GMAC0 is connected to the RMGII interface */ + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + ath79_eth0_data.phy_mask = CF_WR650AC_LAN_PHYMASK; + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_pll_data.pll_1000 = 0xa6000000; + + ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); + ath79_register_eth(0); + + /* GMAC1 is connected to the SGMII interface */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; + ath79_eth1_data.speed = SPEED_1000; + ath79_eth1_data.duplex = DUPLEX_FULL; + ath79_eth1_pll_data.pll_1000 = 0x03000101; + + ath79_init_mac(ath79_eth1_data.mac_addr, art, 2); + ath79_register_eth(1); + + ap91_pci_init(art + CF_WR650AC_PCIE_CALDATA_OFFSET, wlan1_mac); +} + +MIPS_MACHINE(ATH79_MACH_CF_WR650AC, "CF-WR650AC", "COMFAST CF-WR650AC", + cf_wr650ac_setup); diff --git a/target/linux/ar71xx/generic/profiles/comfast.mk b/target/linux/ar71xx/generic/profiles/comfast.mk new file mode 100644 index 0000000..e79c475 --- /dev/null +++ b/target/linux/ar71xx/generic/profiles/comfast.mk @@ -0,0 +1,14 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +define Profile/CF-WR650AC + NAME:=COMFAST CF-WR650AC + PACKAGES:= +endef +define Profile/CF-WR650AC/Description + Package set optimized for the COMFAST CF-WR650AC. +endef +$(eval $(call Profile,CF-WR650AC)) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 9a7acbd..81e8cd7 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -1043,6 +1043,7 @@ pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs ),89 planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7744k(firm ware),128k(art)ro ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firm ware),256k(cfg)ro,64k(EEPROM)ro uap_pro_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(ker nel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k@0x50000(firmware) +qca9558_cf_wr650ac_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(art)ro,1536 k(kernel),14592k(rootfs),64k(nvram)ro,16128k@0x30000(firmware) ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmw are),64k(certs),256k(cfg)ro,64k(EEPROM)ro whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(f irmware),64k(art)ro wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(ker nel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k@0x400 00(firmware) @@ -1396,6 +1397,16 @@ define Image/Build/UAPPRO -o $(call factoryname,$(1),$(2)) endef +define Image/Build/COMFAST + $(call MkuImageLzma,$(2),$(3) $(4)) + dd if=$(KDIR_TMP)/vmlinux-$(2).uImage \ + of=$(call imgname,kernel,$(2)).bin bs=64k conv=sync; \ + dd if=$(KDIR)/root.$(1) \ + of=$(call imgname,$(1),$(2)-rootfs).bin bs=128k conv=sync; \ + ( dd if=$(KDIR_TMP)/vmlinux-$(2).uImage bs=1572864 conv=sync; dd if=$(KDIR)/root.$(1) ) \ + > $(call imgname,$(1),$(2))-sysupgrade.bin +endef + # $(4) = board (XS2, XS5, RS, XM) # $(5) = series (BZ, XM, XW) # $(6) = chip (ar7240, ar934x) @@ -2064,6 +2075,8 @@ $(eval $(call SingleProfile,TPLINK-SAFELOADER,64kraw,CPE510,cpe210-220-510-520,C $(eval $(call SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar93 4x)) $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-U OP,ttyS0,115200,BZ,BZ,ar7240)) +$(eval $(call SingleProfile,COMFAST,64k,CF-WR650AC,cf-wr650ac,CF-WR650AC,ttyS0,115200,$$(q ca9558_cf_wr650ac_mtdlayout),CF-WR650AC,qca955x)) + $(eval $(call SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,UBDEV01,XM,a r7240)) $(eval $(call SingleProfile,UBNT,64k,UBNTRS,ubnt-rs,UBNT-RS,ttyS0,115200,RS,RSx,ar7100)) diff --git a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch index d6e786d..c33a838 100644 --- a/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch +++ b/target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch @@ -1,6 +1,6 @@ --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -16,22 +16,199 @@ +@@ -16,22 +16,200 @@ enum ath79_mach_type { ATH79_MACH_GENERIC = 0, @@ -26,6 +26,7 @@ + ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */ + ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */ + ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */ ++ ATH79_MACH_CF_WR650AC, /* COMFAST CF-WR650AC */ + ATH79_MACH_CPE510, /* TP-LINK CPE510 */ ATH79_MACH_DB120, /* Atheros DB120 reference board */ ATH79_MACH_PB44, /* Atheros PB44 reference board */ @@ -282,7 +283,7 @@ config ATH79_MACH_AP121 bool "Atheros AP121 reference board" select SOC_AR933X -@@ -11,62 +84,1050 @@ config ATH79_MACH_AP121 +@@ -11,62 +84,1060 @@ config ATH79_MACH_AP121 select ATH79_DEV_M25P80 select ATH79_DEV_USB select ATH79_DEV_WMAC @@ -349,6 +350,16 @@ + select ATH79_DEV_M25P80 + select ATH79_DEV_USB + ++config ATH79_MACH_CF_WR650AC ++ bool "COMFAST CF-WR650AC board support" ++ select SOC_QCA955X ++ 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_DB120 + bool "Atheros DB120 reference board" + select SOC_AR934X @@ -1494,7 +1505,7 @@ endif --- a/arch/mips/ath79/Makefile +++ b/arch/mips/ath79/Makefile -@@ -38,9 +38,128 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route +@@ -38,9 +38,129 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route # # Machines # @@ -1514,6 +1525,7 @@ +obj-$(CONFIG_ATH79_MACH_AW_NR580) += mach-aw-nr580.o +obj-$(CONFIG_ATH79_MACH_BHU_BXU2000N2_A)+= mach-bhu-bxu2000n2-a.o +obj-$(CONFIG_ATH79_MACH_CAP4200AG) += mach-cap4200ag.o ++obj-$(CONFIG_ATH79_MACH_CF_WR650AC) += mach-cf-wr650ac.o +obj-$(CONFIG_ATH79_MACH_CPE510) += mach-cpe510.o obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o +obj-$(CONFIG_ATH79_MACH_DLAN_PRO_500_WP) += mach-dlan-pro-500-wp.o _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel