@@ -56,6 +56,9 @@ get_status_led() {
cap4200ag)
status_led="senao:green:pwr"
;;
+ cf-e316n-v2)
+ status_led="$(ar71xx_board_name):blue:wan"
+ ;;
cpe510)
status_led="tp-link:green:link4"
;;
@@ -96,6 +96,12 @@ carambola2)
ucidef_set_led_wlan "wlan" "WLAN" "carambola2:green:wlan" "phy0tpt"
;;
+cf-e316n-v2)
+ ucidef_set_led_netdev "lan" "LAN" "$board:blue:lan" "eth0"
+ ucidef_set_led_netdev "wan" "WAN" "$board:blue:wan" "eth1"
+ ucidef_set_led_wlan "wlan" "WLAN" "$board:blue:wlan" "phy0tpt"
+ ;;
+
cpe510)
ucidef_set_led_switch "lan0" "LAN0" "tp-link:green:lan0" "switch0" "0x20"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
@@ -392,6 +392,9 @@ ar71xx_board_detect() {
*CAP4200AG)
name="cap4200ag"
;;
+ *"COMFAST CF-E316N v2")
+ name="cf-e316n-v2"
+ ;;
*"CPE210/220/510/520")
name="cpe510"
tplink_pharos_board_detect
@@ -199,6 +199,7 @@ platform_check_image() {
ap81 | \
ap83 | \
ap132 | \
+ cf-e316n-v2 | \
dgl-5500-a1 |\
dhp-1565-a1 |\
dir-505-a1 | \
@@ -50,6 +50,7 @@ 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_CF_E316N_V2=y
CONFIG_ATH79_MACH_CPE510=y
CONFIG_ATH79_MACH_DB120=y
CONFIG_ATH79_MACH_DGL_5500_A1=y
new file mode 100644
@@ -0,0 +1,128 @@
+/*
+ * COMFAST CF-E316N v2
+ * by Shenzhen Four Seas Global Link Network Technology Co., Ltd
+ *
+ * aka CF-E316V2, CF-E316N-V2 and CF-E316Nv2.0 (no FCC ID)
+ *
+ * Copyright (C) 2015 Paul Fertser <fercerpav@gmail.com>
+ *
+ * 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/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/timer.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+static struct gpio_led cf_e316n_v2_leds_gpio[] __initdata = {
+ {
+ .name = "cf-e316n-v2:blue:diag",
+ .gpio = 0,
+ .active_low = 0,
+ }, {
+ .name = "cf-e316n-v2:red:diag",
+ .gpio = 2,
+ .active_low = 0,
+ }, {
+ .name = "cf-e316n-v2:green:diag",
+ .gpio = 3,
+ .active_low = 0,
+ }, {
+ .name = "cf-e316n-v2:blue:wlan",
+ .gpio = 12,
+ .active_low = 1,
+ }, {
+ .name = "cf-e316n-v2:blue:wan",
+ .gpio = 17,
+ .active_low = 1,
+ }, {
+ .name = "cf-e316n-v2:blue:lan",
+ .gpio = 19,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button cf_e316n_v2_gpio_keys[] __initdata = {
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = 60,
+ .gpio = 20,
+ .active_low = 1,
+ },
+};
+
+/* There's a Pericon Technology PT7A7514 connected to GPIO 16 */
+#define EXT_WATCHDOG_GPIO 16
+static struct timer_list gpio_wdt_timer;
+
+static void gpio_wdt_toggle(unsigned long period)
+{
+ static int state;
+ state = !state;
+ gpio_set_value(EXT_WATCHDOG_GPIO, state);
+ mod_timer(&gpio_wdt_timer, jiffies + period);
+}
+
+static void __init cf_e316n_v2_setup(void)
+{
+ u8 *maclan = (u8 *) KSEG1ADDR(0x1f010000);
+ u8 *macwlan = (u8 *) KSEG1ADDR(0x1f011002);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1f011000);
+ u8 tmpmac[ETH_ALEN];
+
+ gpio_request(EXT_WATCHDOG_GPIO, "PT7A7514 watchdog");
+ gpio_direction_output(EXT_WATCHDOG_GPIO, 0);
+ setup_timer(&gpio_wdt_timer, gpio_wdt_toggle, msecs_to_jiffies(500));
+ gpio_wdt_toggle(msecs_to_jiffies(1));
+
+ ath79_register_m25p80(NULL);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
+ ath79_register_mdio(1, 0x0);
+
+ /* 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_init_mac(ath79_eth0_data.mac_addr, maclan, 0);
+ ath79_register_eth(0);
+
+ /* GMAC1 is connected to the internal switch */
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_init_mac(ath79_eth1_data.mac_addr, maclan, 2);
+ ath79_register_eth(1);
+
+ /* Enable 2x Skyworks SE2576L WLAN power amplifiers */
+ gpio_request(13, "RF Amp 1");
+ gpio_direction_output(13, 1);
+ gpio_request(14, "RF Amp 2");
+ gpio_direction_output(14, 1);
+ ath79_init_mac(tmpmac, macwlan, 0);
+ ath79_register_wmac(ee, tmpmac);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e316n_v2_leds_gpio),
+ cf_e316n_v2_leds_gpio);
+
+ ath79_register_gpio_keys_polled(1, 20,
+ ARRAY_SIZE(cf_e316n_v2_gpio_keys),
+ cf_e316n_v2_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_CF_E316N_V2, "CF-E316N-V2", "COMFAST CF-E316N v2",
+ cf_e316n_v2_setup);
new file mode 100644
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/CF-E316N-V2
+ NAME:=COMFAST CF-E316N v2
+ PACKAGES:=
+endef
+
+define Profile/CF-E316N-V2/Description
+ Package set optimised for the COMFAST CF-E316N v2
+ by Shenzhen Four Seas Global Link Network Technology Co., Ltd
+ aka CF-E316V2, CF-E316N-V2 and CF-E316Nv2.0 (no FCC ID)
+endef
+
+$(eval $(call Profile,CF-E316N-V2))
@@ -188,6 +188,14 @@ define Device/carambola2
endef
TARGET_DEVICES += carambola2
+define Device/cf-e316n-v2
+ BOARDNAME = CF-E316N-V2
+ IMAGE_SIZE = 16192k
+ CONSOLE = ttyS0,115200
+ MTDPARTS = spi0.0:64k(u-boot)ro,64k(art)ro,16192k(firmware),64k(nvram)ro
+endef
+TARGET_DEVICES += cf-e316n-v2
+
define Device/wndr3700
BOARDNAME = WNDR3700
NETGEAR_KERNEL_MAGIC = 0x33373030
@@ -1,6 +1,8 @@
---- a/arch/mips/ath79/machtypes.h
-+++ b/arch/mips/ath79/machtypes.h
-@@ -16,24 +16,207 @@
+Index: linux-4.1.5/arch/mips/ath79/machtypes.h
+===================================================================
+--- linux-4.1.5.orig/arch/mips/ath79/machtypes.h 2015-08-16 16:57:42.480656824 +0100
++++ linux-4.1.5/arch/mips/ath79/machtypes.h 2015-08-16 16:59:33.868656175 +0100
+@@ -16,24 +16,208 @@
enum ath79_mach_type {
ATH79_MACH_GENERIC = 0,
@@ -28,6 +30,7 @@
+ ATH79_MACH_BHU_BXU2000N2_A1, /* BHU BXU2000n-2 A1 */
+ ATH79_MACH_CAP4200AG, /* Senao CAP4200AG */
+ ATH79_MACH_CARAMBOLA2, /* 8devices Carambola2 */
++ ATH79_MACH_CF_E316N_V2, /* COMFAST CF-E316N v2 */
+ ATH79_MACH_CPE510, /* TP-LINK CPE510 */
ATH79_MACH_DB120, /* Atheros DB120 reference board */
ATH79_MACH_PB44, /* Atheros PB44 reference board */
@@ -208,9 +211,11 @@
};
#endif /* _ATH79_MACHTYPE_H */
---- a/arch/mips/ath79/Kconfig
-+++ b/arch/mips/ath79/Kconfig
-@@ -2,6 +2,90 @@ if ATH79
+Index: linux-4.1.5/arch/mips/ath79/Kconfig
+===================================================================
+--- linux-4.1.5.orig/arch/mips/ath79/Kconfig 2015-08-16 16:57:42.480656824 +0100
++++ linux-4.1.5/arch/mips/ath79/Kconfig 2015-08-16 17:03:19.472654861 +0100
+@@ -2,6 +2,90 @@
menu "Atheros AR71XX/AR724X/AR913X machine selection"
@@ -301,7 +306,7 @@
config ATH79_MACH_AP121
bool "Atheros AP121 reference board"
select SOC_AR933X
-@@ -11,62 +95,1107 @@ config ATH79_MACH_AP121
+@@ -11,62 +95,1107 @@
select ATH79_DEV_M25P80
select ATH79_DEV_USB
select ATH79_DEV_WMAC
@@ -1437,7 +1442,7 @@
config ATH79_MACH_UBNT_XM
bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1212,97 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1212,106 @@
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.
@@ -1511,6 +1516,15 @@
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
++config ATH79_MACH_CF_E316N_V2
++ bool "COMFAST CF-E316N v2 board"
++ select SOC_AR934X
++ select ATH79_DEV_ETH
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
++ select ATH79_DEV_M25P80
++ select ATH79_DEV_WMAC
++
+config ATH79_MACH_BHU_BXU2000N2_A
+ bool "BHU BXU2000n-2 rev. A support"
+ select SOC_AR934X
@@ -1535,7 +1549,7 @@
endmenu
config SOC_AR71XX
-@@ -134,7 +1354,10 @@ config ATH79_DEV_DSA
+@@ -134,7 +1364,10 @@
config ATH79_DEV_ETH
def_bool n
@@ -1547,7 +1561,7 @@
def_bool n
config ATH79_DEV_GPIO_BUTTONS
-@@ -164,6 +1387,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -164,6 +1397,11 @@
def_bool n
config ATH79_ROUTERBOOT
@@ -1559,9 +1573,11 @@
def_bool n
endif
---- a/arch/mips/ath79/Makefile
-+++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,133 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
+Index: linux-4.1.5/arch/mips/ath79/Makefile
+===================================================================
+--- linux-4.1.5.orig/arch/mips/ath79/Makefile 2015-08-16 16:57:42.480656824 +0100
++++ linux-4.1.5/arch/mips/ath79/Makefile 2015-08-16 17:05:19.072654165 +0100
+@@ -38,9 +38,134 @@
#
# Machines
#
@@ -1583,6 +1599,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_E316N_V2) += mach-cf-e316n-v2.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
@@ -1695,9 +1712,11 @@
+obj-$(CONFIG_ATH79_MACH_ZCN_1523H) += mach-zcn-1523h.o
+obj-$(CONFIG_ATH79_MACH_CARAMBOLA2) += mach-carambola2.o
+obj-$(CONFIG_ATH79_MACH_NBG6716) += mach-nbg6716.o
---- a/arch/mips/ath79/prom.c
-+++ b/arch/mips/ath79/prom.c
-@@ -130,6 +130,13 @@ void __init prom_init(void)
+Index: linux-4.1.5/arch/mips/ath79/prom.c
+===================================================================
+--- linux-4.1.5.orig/arch/mips/ath79/prom.c 2015-08-16 16:57:42.480656824 +0100
++++ linux-4.1.5/arch/mips/ath79/prom.c 2015-08-16 16:57:42.476656824 +0100
+@@ -130,6 +130,13 @@
initrd_end = initrd_start + fw_getenvl("initrd_size");
}
#endif
This adds full support (sans sysupgrading from vendor firmware) for the COMFAST CF-E316N v2 (aka CF-E316V2, CF-E316N-V2 and CF-E316Nv2.0, no FCC ID) by Shenzhen Four Seas Global Link Network Technology Co., Ltd (this company is actively refusing to provide GPL'd sources for the OpenWrt version they ship with the device, damn them). Signed-off-by: Paul Fertser <fercerpav@gmail.com> --- target/linux/ar71xx/base-files/etc/diag.sh | 3 + .../ar71xx/base-files/etc/uci-defaults/01_leds | 6 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-4.1 | 1 + .../files/arch/mips/ath79/mach-cf-e316n-v2.c | 128 +++++++++++++++++++++ target/linux/ar71xx/generic/profiles/comfast.mk | 19 +++ target/linux/ar71xx/image/Makefile | 8 ++ .../700-MIPS-ath79-openwrt-machines.patch | 51 +++++--- 9 files changed, 204 insertions(+), 16 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-cf-e316n-v2.c create mode 100644 target/linux/ar71xx/generic/profiles/comfast.mk