[OpenWrt-Devel] [PATCH] target: ar71xx: add support for Comfast CF-WR600N, CF-E325N and CF-E316Nv2

Gustavo Azambuja gustavo at unowifi.com
Fri Oct 2 20:01:45 EDT 2015


This adds full support for the COMFAST routers  CF-WR600N, CF-E325N
and CF-E316Nv2

http://en.comfast.com.cn/product/WirelessRouter/item-168.html
http://en.comfast.com.cn/product/WirelessAP/item-171.html

Signed-off-by: Gustavo Azambuja <gustavo at unowifi.com>

---
 .../ar71xx/base-files/etc/uci-defaults/01_leds     |  31 ++
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  49 +++
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |  12 +
 .../ar71xx/base-files/lib/upgrade/platform.sh      |   8 +
 target/linux/ar71xx/config-3.18                    |   5 +
 target/linux/ar71xx/drivers.diff                   | 404 +++++++++++++++++
 .../ar71xx/files/arch/mips/ath79/mach-comfast.c    | 485 +++++++++++++++++++++
 target/linux/ar71xx/generic/profiles/comfast.mk    |  49 +++
 target/linux/ar71xx/image/Makefile                 | 102 +++++
 .../610-MIPS-ath79-openwrt-machines.patch          |  32 +-
 .../patches-3.18/614-MIPS-ath79-wdt-timeout.patch  |  54 +++
 11 files changed, 1225 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/ar71xx/drivers.diff
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
 create mode 100644 target/linux/ar71xx/generic/profiles/comfast.mk
 create mode 100644
target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch

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 d628f1a..969b97a 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,37 @@ bsb)
  ucidef_set_led_default "sys" "SYS" "bsb:red:sys" "1"
  ;;

+ap9341fe)
+ ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
+ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
+ ;;
+
+ ucidef_set_led_netdev "wan" "WAN" "comfast:white:wan" "eth1"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:white:lan" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:white:wifi" "phy0tpt"
+ ;;
+
+cf-e325n)
+ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
+ ;;
+
+cf-wr600n)
+ ucidef_set_led_netdev "wan1" "WAN1" "cf_wr600n:green:wan1" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "cf_wr600n:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "cf_wr600n:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "cf_wr600n:green:lan3" "switch0" "0x10"
+# ucidef_set_led_switch "lan4" "LAN4" "cf_wr600n:green:lan4" "switch0" "0x02"
+# ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
+ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth0"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth1"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "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 7e26886..2fb753e 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -55,6 +55,55 @@ wzr-450hp2)
  ucidef_add_switch_vlan "switch0" "2" "5 6"
  ;;

+ap9341fe)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wlan_mac=$(macaddr_add "$lan_mac" 1)
+ wan_mac=$(macaddr_add "$lan_mac" 2)
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
+cf-e316nv2)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wlan_mac=$(macaddr_add "$lan_mac" 1)
+ wan_mac=$(macaddr_add "$lan_mac" 2)
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
+cf-e325n)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wlan_mac=$(macaddr_add "$lan_mac" 1)
+ wan_mac=$(macaddr_add "$lan_mac" 2)
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
+cf-wr600n)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth1/address)
+ wlan_mac=$(macaddr_add "$lan_mac" 1)
+ wan_mac=$(macaddr_add "$lan_mac" 2)
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
+
 archer-c5 |\
 archer-c7 |\
 tl-wdr4900-v2)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index cacf362..32fdbfc 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -380,6 +380,18 @@ ar71xx_board_detect() {
  *AW-NR580)
  name="aw-nr580"
  ;;
+ *AP9341FE)
+ name="ap9341fe"
+ ;;
+ *CF-E316NV2)
+ name="cf-e316nv2"
+ ;;
+ *CF-E325N)
+ name="cf-e325n"
+ ;;
+ *CF-WR600N)
+ name="cf-wr600n"
+ ;;
  *CAP4200AG)
  name="cap4200ag"
  ;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index e5376ef..22cae6b 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -387,6 +387,10 @@ platform_check_image() {
  return 1
  ;;

+ ap9341fe | \
+ cf-e316nv2 | \
+ cf-e325n | \
+ cf-wr600n | \
  unifi-outdoor-plus | \
  uap-pro)
  [ "$magic_long" != "19852003" ] && {
@@ -518,6 +522,10 @@ platform_do_upgrade() {
  om5p-an)
  platform_do_upgrade_openmesh "$ARGV"
  ;;
+ ap9341fe | \
+ cf-e316nv2 | \
+ cf-e325n | \
+ cf-wr600n | \
  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 d661aa7..ea3ff09 100644
--- a/target/linux/ar71xx/config-3.18
+++ b/target/linux/ar71xx/config-3.18
@@ -46,6 +46,11 @@ CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
 CONFIG_ATH79_MACH_BSB=y
 CONFIG_ATH79_MACH_CAP4200AG=y
 CONFIG_ATH79_MACH_CARAMBOLA2=y
+CONFIG_ATH79_MACH_COMFAST=y
+CONFIG_ATH79_MACH_COMFAST_AP9341FE=y
+CONFIG_ATH79_MACH_COMFAST_CF_E316NV2=y
+CONFIG_ATH79_MACH_COMFAST_CF_E325N=y
+CONFIG_ATH79_MACH_COMFAST_CF_WR600N=y
 CONFIG_ATH79_MACH_CPE510=y
 CONFIG_ATH79_MACH_DB120=y
 CONFIG_ATH79_MACH_DGL_5500_A1=y
diff --git a/target/linux/ar71xx/drivers.diff b/target/linux/ar71xx/drivers.diff
new file mode 100644
index 0000000..47e5f77
--- /dev/null
+++ b/target/linux/ar71xx/drivers.diff
@@ -0,0 +1,404 @@
+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 e18c2bc..2a3464e 100644
+--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+@@ -35,6 +35,37 @@ ap113)
+ ucidef_set_led_usbdev "usb" "USB" "ap113:green:usb" "1-1"
+ ;;
+
++ap9341fe)
++ ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
++ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
++ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
++ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
++ ;;
++
++cf-e316nv2)
++ ucidef_set_led_netdev "wan" "WAN" "comfast:white:wan" "eth1"
++ ucidef_set_led_netdev "lan" "LAN" "comfast:white:lan" "eth0"
++ ucidef_set_led_wlan "wlan" "WLAN" "comfast:white:wifi" "phy0tpt"
++ ;;
++
++cf-e325n)
++ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
++ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
++ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
++ ;;
++
++cf-wr600n)
++ ucidef_set_led_netdev "wan1" "WAN1" "cf_wr600n:green:wan1" "eth0"
++ ucidef_set_led_switch "lan1" "LAN1" "cf_wr600n:green:lan1" "switch0" "0x04"
++ ucidef_set_led_switch "lan2" "LAN2" "cf_wr600n:green:lan2" "switch0" "0x08"
++ ucidef_set_led_switch "lan3" "LAN3" "cf_wr600n:green:lan3" "switch0" "0x10"
++# ucidef_set_led_switch "lan4" "LAN4" "cf_wr600n:green:lan4" "switch0" "0x02"
++# ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
++ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth0"
++ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth1"
++ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "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 20f34d5..0bce0ec 100644
+--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
++++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+@@ -44,6 +44,54 @@ ap136-010)
+ ucidef_add_switch_vlan "switch0" "2" "5 6"
+ ;;
+
++ap9341fe)
++ ucidef_set_interfaces_lan_wan "eth0" "eth1"
++ ucidef_add_switch "switch0" "1" "1"
++ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
++ lan_mac=$(cat /sys/class/net/eth0/address)
++ wlan_mac=$(macaddr_add "$lan_mac" 1)
++ wan_mac=$(macaddr_add "$lan_mac" 2)
++ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
++ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
++ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
++ ;;
++
++cf-e316nv2)
++ ucidef_set_interfaces_lan_wan "eth0" "eth1"
++ ucidef_add_switch "switch0" "1" "1"
++ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
++ lan_mac=$(cat /sys/class/net/eth0/address)
++ wlan_mac=$(macaddr_add "$lan_mac" 1)
++ wan_mac=$(macaddr_add "$lan_mac" 2)
++ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
++ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
++ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
++ ;;
++
++cf-e325n)
++ ucidef_set_interfaces_lan_wan "eth0" "eth1"
++ ucidef_add_switch "switch0" "1" "1"
++ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
++ lan_mac=$(cat /sys/class/net/eth0/address)
++ wlan_mac=$(macaddr_add "$lan_mac" 1)
++ wan_mac=$(macaddr_add "$lan_mac" 2)
++ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
++ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
++ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
++ ;;
++
++cf-wr600n)
++ ucidef_set_interfaces_lan_wan "eth1" "eth0"
++ ucidef_add_switch "switch0" "1" "1"
++ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
++ lan_mac=$(cat /sys/class/net/eth1/address)
++ wlan_mac=$(macaddr_add "$lan_mac" 1)
++ wan_mac=$(macaddr_add "$lan_mac" 2)
++ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
++ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
++ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
++ ;;
++
+ ap136-020 |\
+ ap135-020 |\
+ tl-wr1043nd-v2 |\
+diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
+index d2fe6ef..d395099 100755
+--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
++++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
+@@ -363,6 +363,18 @@ ar71xx_board_detect() {
+ *CAP4200AG)
+ name="cap4200ag"
+ ;;
++ *AP9341FE)
++ name="ap9341fe"
++ ;;
++ *CF-E316NV2)
++ name="cf-e316nv2"
++ ;;
++ *CF-E325N)
++ name="cf-e325n"
++ ;;
++ *CF-WR600N)
++ name="cf-wr600n"
++ ;;
+ *"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 0cbee1d..5a38df4 100755
+--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
++++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+@@ -375,6 +375,10 @@ platform_check_image() {
+ return 1
+ ;;
+
++ ap9341fe | \
++ cf-e316nv2 | \
++ cf-e325n | \
++ cf-wr600n | \
+ unifi-outdoor-plus | \
+ uap-pro)
+ [ "$magic_long" != "19852003" ] && {
+@@ -493,6 +497,10 @@ platform_do_upgrade() {
+ om5p-an)
+ platform_do_upgrade_openmesh "$ARGV"
+ ;;
++ ap9341fe | \
++ cf-e316nv2 | \
++ cf-e325n | \
++ cf-wr600n | \
+ 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 5c25f32..feb3982 100644
+--- a/target/linux/ar71xx/config-3.18
++++ b/target/linux/ar71xx/config-3.18
+@@ -41,6 +41,11 @@ CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
+ CONFIG_ATH79_MACH_CAP4200AG=y
+ CONFIG_ATH79_MACH_CARAMBOLA2=y
+ CONFIG_ATH79_MACH_CPE510=y
++CONFIG_ATH79_MACH_COMFAST=y
++CONFIG_ATH79_MACH_COMFAST_AP9341FE=y
++CONFIG_ATH79_MACH_COMFAST_CF_E316NV2=y
++CONFIG_ATH79_MACH_COMFAST_CF_E325N=y
++CONFIG_ATH79_MACH_COMFAST_CF_WR600N=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/image/Makefile
b/target/linux/ar71xx/image/Makefile
+index 204a6e7..2e782a2 100644
+--- a/target/linux/ar71xx/image/Makefile
++++ b/target/linux/ar71xx/image/Makefile
+@@ -395,6 +395,10 @@
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(firmware),128k(art)ro
+ ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
+ uap_pro_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k at 0x50000(firmware)
++comfast_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
++ar9341_cf_wr600n_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
++ar9341_cf_e316nv2_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
++ar9341_cf_e325n_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
+ ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
+ whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro
+ wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k at 0x40000(firmware)
+@@ -725,6 +729,98 @@ define Image/Build/UAPPRO
+ -o $(call factoryname,$(1),$(2))
+ endef
+
++Image/Build/COMFAST/initramfs=$(call
MkuImageLzma/initramfs,$(2),$(3) $(comfast_mtdlayout))
++define Image/Build/COMFAST/buildkernel
++ $(call MkuImageLzma,$(2),$(3) $(comfast_mtdlayout))
++ -rm -rf $(KDIR_TMP)/$(2)
++ mkdir -p $(KDIR_TMP)/$(2)/image
++ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
++ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
++ --pad --big-endian --squash-uids -v -e 64KiB \
++ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
++ -d $(KDIR_TMP)/$(2)/image \
++ 2>&1 1>/dev/null | awk '/^.+$$$$/'
++ -rm -rf $(KDIR_TMP)/$(2)
++ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
++endef
++
++define Image/Build/COMFAST
++ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
++ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
++ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
++ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
++ -o $(call factoryname,$(1),$(2))
++endef
++
++Image/Build/COMFAST_CF_WR600N/initramfs=$(call
MkuImageLzma/initramfs,$(2),$(3) $(ar9341_cf_wr600n_mtdlayout))
++define Image/Build/COMFAST_CF_WR600N/buildkernel
++ $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_wr600n_mtdlayout))
++ -rm -rf $(KDIR_TMP)/$(2)
++ mkdir -p $(KDIR_TMP)/$(2)/image
++ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
++ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
++ --pad --big-endian --squash-uids -v -e 64KiB \
++ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
++ -d $(KDIR_TMP)/$(2)/image \
++ 2>&1 1>/dev/null | awk '/^.+$$$$/'
++ -rm -rf $(KDIR_TMP)/$(2)
++ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
++endef
++
++define Image/Build/COMFAST_CF_WR600N
++ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
++ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
++ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
++ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
++ -o $(call factoryname,$(1),$(2))
++endef
++
++Image/Build/COMFAST_CF_E316NV2/initramfs=$(call
MkuImageLzma/initramfs,$(2),$(3) $(ar9341_cf_e316nv2_mtdlayout))
++define Image/Build/COMFAST_CF_E316NV2/buildkernel
++ $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_e316nv2_mtdlayout))
++ -rm -rf $(KDIR_TMP)/$(2)
++ mkdir -p $(KDIR_TMP)/$(2)/image
++ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
++ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
++ --pad --big-endian --squash-uids -v -e 64KiB \
++ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
++ -d $(KDIR_TMP)/$(2)/image \
++ 2>&1 1>/dev/null | awk '/^.+$$$$/'
++ -rm -rf $(KDIR_TMP)/$(2)
++ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
++endef
++
++define Image/Build/COMFAST_CF_E316NV2
++ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
++ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
++ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
++ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
++ -o $(call factoryname,$(1),$(2))
++endef
++
++Image/Build/COMFAST_CF_E325N/initramfs=$(call
MkuImageLzma/initramfs,$(2),$(3) $(ar9341_cf_e325n_mtdlayout))
++define Image/Build/COMFAST_CF_E325N/buildkernel
++ $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_e325n_mtdlayout))
++ -rm -rf $(KDIR_TMP)/$(2)
++ mkdir -p $(KDIR_TMP)/$(2)/image
++ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
++ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
++ --pad --big-endian --squash-uids -v -e 64KiB \
++ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
++ -d $(KDIR_TMP)/$(2)/image \
++ 2>&1 1>/dev/null | awk '/^.+$$$$/'
++ -rm -rf $(KDIR_TMP)/$(2)
++ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
++endef
++
++define Image/Build/COMFAST_CF_E325N
++ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
++ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
++ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
++ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
++ -o $(call factoryname,$(1),$(2))
++endef
++
+ # $(4) = board (XS2, XS5, RS, XM)
+ # $(5) = series (BZ, XM, XW)
+ # $(6) = chip (ar7240, ar934x)
+@@ -1435,6 +1531,10 @@ $(eval $(call
SingleProfile,TPLINK-LZMA,64kraw,OOLITE,oolite,GS-OOLITE,ttyATH0,1
+
+ $(eval $(call
SingleProfile,UAPPRO,64k,UAPPRO,ubnt-uap-pro,UAP-PRO,ttyS0,115200,BZ,BZ,ar934x))
+ $(eval $(call
SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240))
++$(eval $(call
SingleProfile,COMFAST,64k,COMFASTAP9341FE,comfast-ap9341fe,COMFAST-AP9341FE,ttyS0,115200,AP9341FE,AP9341FE,ar934x))
++$(eval $(call
SingleProfile,COMFAST,64k,COMFASTCFWR600N,comfast-cf-wr600n,COMFAST-CF-WR600N,ttyS0,115200,CF-WR600N,CF-WR600N,ar934x))
++$(eval $(call
SingleProfile,COMFAST,64k,COMFASTCFE316NV2,comfast-cf-e316nv2,COMFAST-CF-E316NV2,ttyS0,115200,CF-E316NV2,CF-E316NV2,ar934x))
++$(eval $(call
SingleProfile,COMFAST,64k,COMFASTCFE325N,comfast-cf-e325n,COMFAST-CF-E325N,ttyS0,115200,CF-E325N,CF-E325N,ar934x))
+
+ $(eval $(call
SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,XM,XM,ar7240))
+
+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 fa4074e..00b834c 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,190 @@
++@@ -16,22 +16,194 @@
+
+  enum ath79_mach_type {
+   ATH79_MACH_GENERIC = 0,
+@@ -25,6 +25,10 @@
+ + ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */
+ + ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */
+ + ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */
+++ ATH79_MACH_COMFAST_AP9341FE, /* COMFAST AP9341FE */
+++ ATH79_MACH_COMFAST_CF_E316NV2, /* COMFAST CF-E316NV2 */
+++ ATH79_MACH_COMFAST_CF_E325N, /* COMFAST CF-E325N */
+++ ATH79_MACH_COMFAST_CF_WR600N, /* COMFAST CF-WR600N */
+ + ATH79_MACH_CPE510, /* TP-LINK CPE510 */
+   ATH79_MACH_DB120, /* Atheros DB120 reference board */
+   ATH79_MACH_PB44, /* Atheros PB44 reference board */
+@@ -264,7 +268,7 @@
+  config ATH79_MACH_AP121
+   bool "Atheros AP121 reference board"
+   select SOC_AR933X
+-@@ -11,62 +75,980 @@ config ATH79_MACH_AP121
++@@ -11,62 +75,995 @@ config ATH79_MACH_AP121
+   select ATH79_DEV_M25P80
+   select ATH79_DEV_USB
+   select ATH79_DEV_WMAC
+@@ -331,6 +335,21 @@
+ + select ATH79_DEV_M25P80
+ + select ATH79_DEV_USB
+ +
+++config ATH79_MACH_COMFAST
+++ bool "COMFAST reference board"
+++ select SOC_AR934X
+++ 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_NFC
+++ select ATH79_DEV_USB
+++ select ATH79_DEV_WMAC
+++ help
+++  Say 'Y' here if you want your kernel to support the
+++  Comfast reference board.
+++
+ +config ATH79_MACH_DB120
+ + bool "Atheros DB120 reference board"
+ + select SOC_AR934X
+@@ -1273,7 +1292,7 @@
+
+  config ATH79_MACH_UBNT_XM
+   bool "Ubiquiti Networks XM/UniFi boards"
+-@@ -83,6 +1065,97 @@ config ATH79_MACH_UBNT_XM
++@@ -83,6 +1080,97 @@ config ATH79_MACH_UBNT_XM
+    Say 'Y' here if you want your kernel to support the
+    Ubiquiti Networks XM (rev 1.0) board.
+
+@@ -1371,7 +1390,7 @@
+  endmenu
+
+  config SOC_AR71XX
+-@@ -124,7 +1197,10 @@ config ATH79_DEV_DSA
++@@ -124,7 +1212,10 @@ config ATH79_DEV_DSA
+  config ATH79_DEV_ETH
+   def_bool n
+
+@@ -1383,7 +1402,7 @@
+   def_bool n
+
+  config ATH79_DEV_GPIO_BUTTONS
+-@@ -156,4 +1232,7 @@ config ATH79_PCI_ATH9K_FIXUP
++@@ -156,4 +1247,7 @@ config ATH79_PCI_ATH9K_FIXUP
+  config ATH79_ROUTERBOOT
+   def_bool n
+
+@@ -1393,7 +1412,7 @@
+  endif
+ --- a/arch/mips/ath79/Makefile
+ +++ b/arch/mips/ath79/Makefile
+-@@ -38,9 +38,119 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
++@@ -38,9 +38,120 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
+  #
+  # Machines
+  #
+@@ -1412,6 +1431,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_COMFAST) += mach-comfast.o
+ +obj-$(CONFIG_ATH79_MACH_CPE510) += mach-cpe510.o
+  obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o
+ +obj-$(CONFIG_ATH79_MACH_DGL_5500_A1) += mach-dgl-5500-a1.o
+diff --git a/target/linux/ramips/dts/WHR-1166D.dts
b/target/linux/ramips/dts/WHR-1166D.dts
+index 8f1c9f4..4bc91ae 100644
+--- a/target/linux/ramips/dts/WHR-1166D.dts
++++ b/target/linux/ramips/dts/WHR-1166D.dts
+@@ -6,6 +6,10 @@
+ compatible = "ralink,mt7620a-soc";
+ model = "Buffalo WHR-1166D";
+
++ chosen {
++ bootargs = "console=ttyS0,115200";
++ };
++
+ palmbus at 10000000 {
+ gpio2: gpio at 660 {
+ status = "okay";
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
b/target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
new file mode 100644
index 0000000..d5d8b8b
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
@@ -0,0 +1,485 @@
+#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 <asm/mach-ath79/irq.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"
+
+#define COMFAST_KEYS_POLL_INTERVAL 20
+#define COMFAST_KEYS_DEBOUNCE_INTERVAL (3 * COMFAST_KEYS_POLL_INTERVAL)
+
+#define AP9341FE_GPIO_XWDT_TRIGGER 16
+
+#define XWDT_AUTOFEED_DURATION (HZ / 3)
+static int gpio_external_wdt = -1;
+static int wdt_timeout = -1, wdt_autofeed_count = 0;
+
+static void watchdog_fire(unsigned long);
+static struct timer_list watchdog_ticktock =
TIMER_INITIALIZER(watchdog_fire, 0, 0);
+
+static void enable_external_wdt(int gpio)
+{
+ gpio_external_wdt = gpio;
+ wdt_timeout = -1;
+ mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
+}
+
+static void external_wdt_toggle(void)
+{
+ static u32 data;
+ data ++;
+ gpio_set_value(gpio_external_wdt, data & 0x01);
+}
+
+void ath79_external_wdt_disable(void)
+{
+ if(gpio_external_wdt >= 0) {
+ wdt_timeout = -1;
+ mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
+ }
+}
+EXPORT_SYMBOL(ath79_external_wdt_disable);
+
+void ath79_external_wdt_trigger(void)
+{
+ if(gpio_external_wdt >= 0) {
+// printk(KERN_ERR "XWDT TRIGGER\n");
+ wdt_autofeed_count = 0;
+ mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
+ }
+}
+EXPORT_SYMBOL(ath79_external_wdt_trigger);
+
+void ath79_external_wdt_set_timeout(int timeout)
+{
+ if(gpio_external_wdt >= 0) {
+ wdt_timeout = timeout;
+ external_wdt_toggle();
+// printk(KERN_ERR "XWDT SET TIMEOUT: %d\n", timeout);
+ }
+}
+EXPORT_SYMBOL(ath79_external_wdt_set_timeout);
+
+static void watchdog_fire(unsigned long data)
+{
+ if(wdt_timeout > 0)
+ wdt_autofeed_count++;
+
+ if((wdt_timeout < 0) || (wdt_autofeed_count < wdt_timeout)) {
+// printk(KERN_ERR "XWDT AUTOFEED: %d\n", wdt_autofeed_count);
+ external_wdt_toggle();
+ mod_timer(&watchdog_ticktock, jiffies + XWDT_AUTOFEED_DURATION);
+ }
+}
+
+static struct gpio_keys_button comfast_ap934x_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 20,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_led comfast_ap934x_gpio_leds[] __initdata = {
+ {
+ .name = "comfast:red",
+ .gpio = 2,
+ }, {
+ .name = "comfast:green",
+ .gpio = 3,
+ }, {
+ .name = "comfast:blue",
+ .gpio = 0,
+ }
+};
+
+static void ext_lna_control_gpio_setup(int gpio_rx0, int gpio_rx1)
+{
+ ath79_gpio_output_select(gpio_rx0, AR934X_GPIO_OUT_EXT_LNA0);
+ ath79_gpio_output_select(gpio_rx1, AR934X_GPIO_OUT_EXT_LNA1);
+}
+
+
+static void __init comfast_ap9341fe_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
+
+ /* Disable JTAG, enabling GPIOs 0-3 */
+ /* Configure OBS4 line, for GPIO 4*/
+ ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
AR934X_GPIO_FUNC_CLK_OBS4_EN);
+
+ ath79_gpio_output_select(AP9341FE_GPIO_XWDT_TRIGGER, 0);
+ enable_external_wdt(AP9341FE_GPIO_XWDT_TRIGGER);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_ap934x_gpio_leds),
+ comfast_ap934x_gpio_leds);
+ ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(comfast_ap934x_gpio_keys),
+                                        comfast_ap934x_gpio_keys);
+
+ ext_lna_control_gpio_setup(13, 14);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
+
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
+
+ /* GMAC0 is connected to the PHY0 of the internal switch */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = BIT(0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+ ath79_register_eth(0);
+
+ /* GMAC1 is connected to the internal switch */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+
+ ath79_register_eth(1);
+
+ ath79_register_usb();
+
+ ath79_register_wmac(art, NULL);
+}
+MIPS_MACHINE(ATH79_MACH_COMFAST_AP9341FE, "COMFAST-AP9341FE",
"COMFAST AP9341FE", comfast_ap9341fe_setup);
+
+#define CF_WR600N_GPIO_LED_LAN1 22
+#define CF_WR600N_GPIO_LED_LAN2 11
+#define CF_WR600N_GPIO_LED_LAN3 19
+#define CF_WR600N_GPIO_LED_WAN1 18
+
+#define CF_WR600N_GPIO_XWDT_TRIGGER 20
+
+static struct gpio_keys_button comfast_cf_wr600n_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 16,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_led comfast_cf_wr600n_gpio_leds[] __initdata = {
+ {
+ .name = "comfast:red",
+ .gpio = 2,
+ }, {
+ .name = "comfast:green",
+ .gpio = 3,
+ }, {
+ .name = "comfast:blue",
+ .gpio = 0,
+ }, {
+ .name = "cf_wr600n:green:lan1",
+ .gpio = CF_WR600N_GPIO_LED_LAN1,
+ .active_low = 1,
+ }, {
+ .name = "cf_wr600n:green:lan2",
+ .gpio = CF_WR600N_GPIO_LED_LAN2,
+ .active_low = 1,
+ }, {
+ .name = "cf_wr600n:green:lan3",
+ .gpio = CF_WR600N_GPIO_LED_LAN3,
+ .active_low = 1,
+ }, {
+ .name = "cf_wr600n:green:wan1",
+ .gpio = CF_WR600N_GPIO_LED_WAN1,
+ .active_low = 1,
+ },
+};
+
+
+static void __init comfast_cf_wr600n_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
+
+ /* Disable JTAG, enabling GPIOs 0-3 */
+ /* Configure OBS4 line, for GPIO 4*/
+ ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
AR934X_GPIO_FUNC_CLK_OBS4_EN);
+
+// ath79_gpio_output_select(CF_WR600N_GPIO_XWDT_TRIGGER, 0);
+// enable_external_wdt(CF_WR600N_GPIO_XWDT_TRIGGER);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_gpio_output_select(CF_WR600N_GPIO_LED_LAN2, 0);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_cf_wr600n_gpio_leds),
+ comfast_cf_wr600n_gpio_leds);
+ ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
+
ARRAY_SIZE(comfast_cf_wr600n_gpio_keys),
+                                        comfast_cf_wr600n_gpio_keys);
+
+ ext_lna_control_gpio_setup(13, 14);
+
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
+
+ /* GMAC0 is connected to the PHY0 of the internal switch */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = BIT(4);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+ ath79_register_eth(0);
+
+ /* GMAC1 is connected to the internal switch */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+
+ ath79_register_eth(1);
+
+ ath79_register_usb();
+
+ ath79_register_wmac(art, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_COMFAST_CF_WR600N, "COMFAST-CF-WR600N",
"COMFAST CF-WR600N", comfast_cf_wr600n_setup);
+
+#define CF_E316NV2_GPIO_XWDT_TRIGGER 16
+
+static struct gpio_keys_button comfast_cf_e316nv2_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 20,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_led comfast_cf_e316nv2_gpio_leds[] __initdata = {
+ {
+ .name = "comfast:white:wifi",
+ .gpio = 12,
+ .active_low = 1,
+ }, {
+ .name = "comfast:white:lan",
+ .gpio = 19,
+ .active_low = 1,
+ }, {
+ .name = "comfast:white:wan",
+ .gpio = 17,
+ .active_low = 1,
+ }, {
+ .name = "comfast:green",
+ .gpio = 3,
+ }
+};
+
+static void __init comfast_cf_e316nv2_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
+
+ /* Disable JTAG, enabling GPIOs 0-3 */
+ /* Configure OBS4 line, for GPIO 4*/
+ ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
AR934X_GPIO_FUNC_CLK_OBS4_EN);
+
+ ath79_gpio_output_select(CF_E316NV2_GPIO_XWDT_TRIGGER, 0);
+ enable_external_wdt(CF_E316NV2_GPIO_XWDT_TRIGGER);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_gpio_output_select(12, 0);
+ ath79_gpio_output_select(17, 0);
+ ath79_gpio_output_select(19, 0);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_cf_e316nv2_gpio_leds),
+ comfast_cf_e316nv2_gpio_leds);
+ ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
+
ARRAY_SIZE(comfast_cf_e316nv2_gpio_keys),
+                                        comfast_cf_e316nv2_gpio_keys);
+
+ ext_lna_control_gpio_setup(13, 14);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
+
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
+
+ /* GMAC0 is connected to the PHY0 of the internal switch */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = BIT(0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+ ath79_register_eth(0);
+
+ /* GMAC1 is connected to the internal switch */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+
+ ath79_register_eth(1);
+
+ ath79_register_usb();
+
+ ath79_register_wmac(art, NULL);
+}
+MIPS_MACHINE(ATH79_MACH_COMFAST_CF_E316NV2, "COMFAST-CF-E316NV2",
"COMFAST CF-E316NV2", comfast_cf_e316nv2_setup);
+
+#define CF_E325N_GPIO_XWDT_TRIGGER 16
+
+static struct gpio_keys_button comfast_cf_e325n_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 20,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_led comfast_cf_e325n_gpio_leds[] __initdata = {
+ {
+ .name = "comfast:red",
+ .gpio = 2,
+ }, {
+ .name = "comfast:green",
+ .gpio = 3,
+ }, {
+ .name = "comfast:blue",
+ .gpio = 0,
+ }
+};
+
+static void __init comfast_cf_e325n_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
+ u8 *art = (u8 *) KSEG1ADDR(0x1f011000);
+
+ /* Disable JTAG, enabling GPIOs 0-3 */
+ /* Configure OBS4 line, for GPIO 4*/
+ ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
AR934X_GPIO_FUNC_CLK_OBS4_EN);
+
+ ath79_gpio_output_select(CF_E325N_GPIO_XWDT_TRIGGER, 0);
+ enable_external_wdt(CF_E325N_GPIO_XWDT_TRIGGER);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_cf_e325n_gpio_leds),
+ comfast_cf_e325n_gpio_leds);
+ ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(comfast_cf_e325n_gpio_keys),
+                                        comfast_cf_e325n_gpio_keys);
+
+ ext_lna_control_gpio_setup(13, 14);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
+
+ ath79_register_mdio(1, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
+
+ /* GMAC0 is connected to the PHY0 of the internal switch */
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask = BIT(0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+ ath79_register_eth(0);
+
+ /* GMAC1 is connected to the internal switch */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+
+ ath79_register_eth(1);
+
+ ath79_register_usb();
+
+ ath79_register_wmac(art, NULL);
+}
+MIPS_MACHINE(ATH79_MACH_COMFAST_CF_E325N, "COMFAST-CF-E325N",
"COMFAST CF-E325N", comfast_cf_e325n_setup);
+#if 0
+#define DBDC9344GE_PHYMASK BIT(0)
+#define DBDC9344GE_WMAC_CALDATA_OFFSET 0x1000
+#define DBDC9344GE_PCI_CALDATA_OFFSET 0x5000
+
+#define DBDC9344GE_GPIO_EXTPHY_RESET 11
+
+static struct gpio_keys_button comfast_dbdc9344ge_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = COMFAST_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = 22,
+ .active_low = 1,
+ }
+};
+
+static struct gpio_led comfast_dbdc9344ge_gpio_leds[] __initdata = {
+ {
+ .name = "comfast:red",
+ .gpio = 2,
+ }, {
+ .name = "comfast:green",
+ .gpio = 3,
+ }, {
+ .name = "comfast:blue",
+ .gpio = 0,
+ }
+};
+
+static void __init comfast_dbdc9344ge_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
+
+ ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
AR934X_GPIO_FUNC_CLK_OBS4_EN);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(comfast_dbdc9344ge_gpio_leds),
+ comfast_dbdc9344ge_gpio_leds);
+
+ ath79_register_gpio_keys_polled(-1, COMFAST_KEYS_POLL_INTERVAL,
+
ARRAY_SIZE(comfast_dbdc9344ge_gpio_keys),
+                                        comfast_dbdc9344ge_gpio_keys);
+
+ ext_lna_control_gpio_setup(18, 19);
+
+ ath79_register_mdio(0, 0x00);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+
+ /* GMAC0 is connected to GE-PHY by RGMII */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ath79_eth0_data.phy_mask = DBDC9344GE_PHYMASK;
+ ath79_register_eth(0);
+
+ ath79_register_wmac(mac + DBDC9344GE_WMAC_CALDATA_OFFSET, NULL);
+ ap91_pci_init(mac + DBDC9344GE_PCI_CALDATA_OFFSET, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_COMFAST_DBDC9344GE, "COMFAST-DBDC9344GE",
"COMFAST DBDC9344GE", comfast_dbdc9344ge_setup);
+#endif
diff --git a/target/linux/ar71xx/generic/profiles/comfast.mk
b/target/linux/ar71xx/generic/profiles/comfast.mk
new file mode 100644
index 0000000..09612af
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/comfast.mk
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+define Profile/COMFASTAP9341FE
+ NAME:=COMFAST AP9341FE
+ PACKAGES:=
+endef
+
+define Profile/COMFASTAP9341FE/Description
+ Package set optimized for the COMFAST AP9341FE.
+endef
+
+$(eval $(call Profile,COMFASTAP9341FE))
+
+define Profile/COMFASTCFWR600N
+ NAME:=COMFAST CF-WR600N
+ PACKAGES:=
+endef
+
+define Profile/COMFASTCFWR600N/Description
+ Package set optimized for the COMFAST CF-WR600N.
+endef
+
+$(eval $(call Profile,COMFASTCFWR600N))
+
+define Profile/COMFASTCFE316NV2
+ NAME:=COMFAST CF-E316NV2
+ PACKAGES:=
+endef
+
+define Profile/COMFASTCFE316NV2/Description
+ Package set optimized for the COMFAST CF-E316NV2.
+endef
+
+$(eval $(call Profile,COMFASTCFE316NV2))
+
+define Profile/COMFASTCFE325N
+ NAME:=COMFAST CF-E325N
+ PACKAGES:=
+endef
+
+define Profile/COMFASTCFE325N/Description
+ Package set optimized for the COMFAST CF-E325N.
+endef
+
+$(eval $(call Profile,COMFASTCFE325N))
\ No newline at end of file
diff --git a/target/linux/ar71xx/image/Makefile
b/target/linux/ar71xx/image/Makefile
index bb5de17..118adb3 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -971,6 +971,10 @@
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(firmware),128k(art)ro
 ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7552k(firmware),256k(cfg)ro,64k(EEPROM)ro
 uap_pro_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1536k(kernel),14208k(rootfs),256k(cfg)ro,64k(EEPROM)ro,15744k at 0x50000(firmware)
+comfast_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
+ar9341_cf_wr600n_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
+ar9341_cf_e316nv2_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
+ar9341_cf_e325n_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,1536k(kernel),14656k(rootfs),64k(nvram)ro,16192k at 0x20000(firmware)
 ubdev_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
 whrhpg300n_mtdlayout=mtdparts=spi0.0:248k(u-boot)ro,8k(u-boot-env)ro,3712k(firmware),64k(art)ro
 wlr8100_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),14080k(rootfs),192k(unknown)ro,64k(art)ro,384k(unknown2)ro,15488k at 0x40000(firmware)
@@ -1320,6 +1324,99 @@ define Image/Build/UAPPRO
  -o $(call factoryname,$(1),$(2))
 endef

+Image/Build/COMFAST/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3)
$(comfast_mtdlayout))
+define Image/Build/COMFAST/buildkernel
+ $(call MkuImageLzma,$(2),$(3) $(comfast_mtdlayout))
+ -rm -rf $(KDIR_TMP)/$(2)
+ mkdir -p $(KDIR_TMP)/$(2)/image
+ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
+ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
+ --pad --big-endian --squash-uids -v -e 64KiB \
+ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
+ -d $(KDIR_TMP)/$(2)/image \
+ 2>&1 1>/dev/null | awk '/^.+$$$$/'
+ -rm -rf $(KDIR_TMP)/$(2)
+ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
+endef
+
+define Image/Build/COMFAST
+ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
+ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
+ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
+ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
+ -o $(call factoryname,$(1),$(2))
+endef
+
+Image/Build/COMFAST_CF_WR600N/initramfs=$(call
MkuImageLzma/initramfs,$(2),$(3) (ar9341_cf_wr600n_mtdlayout))
+define Image/Build/COMFAST_CF_WR600N/buildkernel
+ $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_wr600n_mtdlayout))
+ -rm -rf $(KDIR_TMP)/$(2)
+ mkdir -p $(KDIR_TMP)/$(2)/image
+ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
+ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
+ --pad --big-endian --squash-uids -v -e 64KiB \
+ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
+ -d $(KDIR_TMP)/$(2)/image \
+ 2>&1 1>/dev/null | awk '/^.+$$$$/'
+ -rm -rf $(KDIR_TMP)/$(2)
+ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
+endef
+
+define Image/Build/COMFAST_CF_WR600N
+ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
+ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
+ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
+ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
+ -o $(call factoryname,$(1),$(2))
+endef
+
+Image/Build/COMFAST_CF_E316NV2/initramfs=$(call
MkuImageLzma/initramfs,$(2),$(3) $(ar9341_cf_e316nv2_mtdlayout))
+define Image/Build/COMFAST_CF_E316NV2/buildkernel
+ $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_e316nv2_mtdlayout))
+ -rm -rf $(KDIR_TMP)/$(2)
+ mkdir -p $(KDIR_TMP)/$(2)/image
+ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
+ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
+ --pad --big-endian --squash-uids -v -e 64KiB \
+ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
+ -d $(KDIR_TMP)/$(2)/image \
+ 2>&1 1>/dev/null | awk '/^.+$$$$/'
+ -rm -rf $(KDIR_TMP)/$(2)
+ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
+endef
+
+define Image/Build/COMFAST_CF_E316NV2
+ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
+ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
+ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
+ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
+ -o $(call factoryname,$(1),$(2))
+endef
+
+Image/Build/COMFAST_CF_E325N/initramfs=$(call
MkuImageLzma/initramfs,$(2),$(3) $(ar9341_cf_e325n_mtdlayout))
+define Image/Build/COMFAST_CF_E325N/buildkernel
+ $(call MkuImageLzma,$(2),$(3) $(ar9341_cf_e325n_mtdlayout))
+ -rm -rf $(KDIR_TMP)/$(2)
+ mkdir -p $(KDIR_TMP)/$(2)/image
+ cp $(KDIR_TMP)/vmlinux-$(2).uImage $(KDIR_TMP)/$(2)/image/kernel0
+ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
+ --pad --big-endian --squash-uids -v -e 64KiB \
+ -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
+ -d $(KDIR_TMP)/$(2)/image \
+ 2>&1 1>/dev/null | awk '/^.+$$$$/'
+ -rm -rf $(KDIR_TMP)/$(2)
+ $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR_TMP)/$(2)-kernel.jffs2 -J 64
+endef
+
+define Image/Build/COMFAST_CF_E325N
+ $(call CatFiles,$(KDIR_TMP)/$(2)-kernel.jffs2,1572864,$(KDIR)/root.$(1),14548992,$(call
sysupname,$(1),$(2)))
+ -$(STAGING_DIR_HOST)/bin/mkfwimage2 -f 0x9f000000 \
+ -v $(5).$(6).v6.0.0-OpenWrt-$(REVISION) \
+ -p jffs2:0x50000:0xf60000:0:0:$(call sysupname,$(1),$(2)) \
+ -o $(call factoryname,$(1),$(2))
+endef
+
+
 # $(4) = board (XS2, XS5, RS, XM)
 # $(5) = series (BZ, XM, XW)
 # $(6) = chip (ar7240, ar934x)
@@ -1982,6 +2079,11 @@ $(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,ar934x))
 $(eval $(call SingleProfile,UAPPRO,64k,UBNTUNIFIOUTDOORPLUS,ubnt-unifi-outdoor-plus,UBNT-UOP,ttyS0,115200,BZ,BZ,ar7240))

+$(eval $(call SingleProfile,COMFAST,64k,COMFASTAP9341FE,comfast-ap9341fe,COMFAST-AP9341FE,ttyS0,115200,AP9341FE,AP9341FE,ar934x))
+$(eval $(call SingleProfile,COMFAST,64k,COMFASTCFWR600N,comfast-cf-wr600n,COMFAST-CF-WR600N,ttyS0,115200,CF-WR600N,CF-WR600N,ar934x))
+$(eval $(call SingleProfile,COMFAST,64k,COMFASTCFE316NV2,comfast-cf-e316nv2,COMFAST-CF-E316NV2,ttyS0,115200,CF-E316NV2,CF-E316NV2,ar934x))
+$(eval $(call SingleProfile,COMFAST,64k,COMFASTCFE325N,comfast-cf-e325n,COMFAST-CF-E325N,ttyS0,115200,CF-E325N,CF-E325N,ar934x))
+
 $(eval $(call SingleProfile,UBDEV,64kraw,UBDEV01,ubdev01,UBNT-UF,ttyS0,115200,XM,XM,ar7240))

 $(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 941cb49..a3875cd 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,195 @@
+@@ -16,22 +16,199 @@

  enum ath79_mach_type {
  ATH79_MACH_GENERIC = 0,
@@ -25,6 +25,10 @@
 + ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */
 + ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */
 + ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */
++ ATH79_MACH_COMFAST_AP9341FE, /* COMFAST AP9341FE */
++ ATH79_MACH_COMFAST_CF_E316NV2, /* COMFAST CF-E316NV2 */
++ ATH79_MACH_COMFAST_CF_E325N, /* COMFAST CF-E325N */
++ ATH79_MACH_COMFAST_CF_WR600N, /* COMFAST CF-WR600N */
 + ATH79_MACH_CPE510, /* TP-LINK CPE510 */
  ATH79_MACH_DB120, /* Atheros DB120 reference board */
  ATH79_MACH_PB44, /* Atheros PB44 reference board */
@@ -269,7 +273,7 @@
  config ATH79_MACH_AP121
  bool "Atheros AP121 reference board"
  select SOC_AR933X
-@@ -11,62 +75,1030 @@ config ATH79_MACH_AP121
+@@ -11,62 +75,1045 @@ config ATH79_MACH_AP121
  select ATH79_DEV_M25P80
  select ATH79_DEV_USB
  select ATH79_DEV_WMAC
@@ -336,6 +340,21 @@
 + select ATH79_DEV_M25P80
 + select ATH79_DEV_USB
 +
++config ATH79_MACH_COMFAST
++ bool "COMFAST reference board"
++ select SOC_AR934X
++ 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_NFC
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++ help
++  Say 'Y' here if you want your kernel to support the
++  Comfast reference board.
++
 +config ATH79_MACH_DB120
 + bool "Atheros DB120 reference board"
 + select SOC_AR934X
@@ -1328,7 +1347,7 @@

  config ATH79_MACH_UBNT_XM
  bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1115,97 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1130,97 @@ config ATH79_MACH_UBNT_XM
   Say 'Y' here if you want your kernel to support the
   Ubiquiti Networks XM (rev 1.0) board.

@@ -1426,7 +1445,7 @@
  endmenu

  config SOC_AR71XX
-@@ -124,7 +1247,10 @@ config ATH79_DEV_DSA
+@@ -124,7 +1262,10 @@ config ATH79_DEV_DSA
  config ATH79_DEV_ETH
  def_bool n

@@ -1438,7 +1457,7 @@
  def_bool n

  config ATH79_DEV_GPIO_BUTTONS
-@@ -154,6 +1280,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -154,6 +1295,11 @@ config ATH79_PCI_ATH9K_FIXUP
  def_bool n

  config ATH79_ROUTERBOOT
@@ -1452,7 +1471,7 @@
  endif
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,124 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
+@@ -38,9 +38,125 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
  #
  # Machines
  #
@@ -1471,6 +1490,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_COMFAST) += mach-comfast.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
diff --git a/target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch
b/target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch
new file mode 100644
index 0000000..6d45e9f
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch
@@ -0,0 +1,54 @@
+--- a/drivers/watchdog/ath79_wdt.c 2014-06-23 23:35:55.747047338 -0400
++++ b/drivers/watchdog/ath79_wdt.c 2014-06-23 21:29:47.793775345 -0400
+@@ -38,6 +38,12 @@
+
+ #define DRIVER_NAME "ath79-wdt"
+
++#ifdef CONFIG_ATH79_MACH_COMFAST
++void ath79_external_wdt_trigger(void);
++void ath79_external_wdt_set_timeout(int timeout);
++void ath79_external_wdt_disable(void);
++#endif
++
+ #define WDT_TIMEOUT 15 /* seconds */
+
+ #define WDOG_REG_CTRL 0x00
+@@ -86,6 +92,9 @@
+ ath79_wdt_wr(WDOG_REG_TIMER, wdt_freq * timeout);
+ /* flush write */
+ ath79_wdt_rr(WDOG_REG_TIMER);
++#ifdef CONFIG_ATH79_MACH_COMFAST
++ ath79_external_wdt_trigger();
++#endif
+ }
+
+ static inline void ath79_wdt_enable(void)
+@@ -101,6 +110,9 @@
+ ath79_wdt_wr(WDOG_REG_CTRL, WDOG_CTRL_ACTION_NONE);
+ /* flush write */
+ ath79_wdt_rr(WDOG_REG_CTRL);
++#ifdef CONFIG_ATH79_MACH_COMFAST
++ ath79_external_wdt_disable();
++#endif
+ }
+
+ static int ath79_wdt_set_timeout(int val)
+@@ -108,11 +120,17 @@
+ if (val < 1)
+ return -EINVAL;
+
+- if (val > max_timeout)
++ if (val > max_timeout) {
++ printk(KERN_ERR "Watchdog timeout exceeds, using %d\n", max_timeout);
+ timeout = max_timeout;
++ }
+ else
+ timeout = val;
+
++#ifdef CONFIG_ATH79_MACH_COMFAST
++ ath79_external_wdt_set_timeout(timeout);
++#endif
++
+ ath79_wdt_keepalive();
+
+ return 0;
--
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list