[LEDE-DEV] [PATCH 1/2] ar71xx/cpe510: split profile into 2 profiles cpe210 and cpe510

Alexander Couzens lynxis at fe80.eu
Sun May 22 18:17:00 PDT 2016


Split profile into 2GHz and 5GHz. The 5GHz devices are
quite "special". The 2 GHz works perfect.

Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
 target/linux/ar71xx/base-files/etc/board.d/01_leds |  1 +
 .../linux/ar71xx/base-files/etc/board.d/02_network |  1 +
 .../ar71xx/base-files/etc/board.d/03_gpio_switches |  1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |  6 ++++-
 .../ar71xx/base-files/lib/upgrade/platform.sh      |  1 +
 .../ar71xx/files/arch/mips/ath79/mach-cpe510.c     | 30 +++++++++++++++++-----
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |  1 +
 target/linux/ar71xx/image/Makefile                 | 12 ++++++---
 8 files changed, 43 insertions(+), 10 deletions(-)

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 f6ea9a8..023d91e 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
@@ -127,6 +127,7 @@ cf-e316n-v2)
 	ucidef_set_led_wlan "wlan" "WLAN" "$board:blue:wlan" "phy0tpt"
 	;;
 
+cpe210|\
 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"
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 e7da065..3eb415f 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -72,6 +72,7 @@ bsb)
 	ucidef_set_interface_wlan
 	;;
 
+cpe210|\
 cpe510)
 	ucidef_add_switch "switch0" \
 		"0 at eth0" "5:lan" "4:wan"
diff --git a/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
index 8abcfc0..00cc167 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
@@ -17,6 +17,7 @@ nanostation-m)
 nanostation-m-xw)
 	ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "2"
 	;;
+cpe210|\
 cpe510)
 	ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "20"
 	;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index eb87dd4..ce3e40e 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -446,7 +446,11 @@ ar71xx_board_detect() {
 	*"COMFAST CF-E316N v2")
 		name="cf-e316n-v2"
 		;;
-	*"CPE210/220/510/520")
+	*"CPE210/220")
+		name="cpe210"
+		tplink_pharos_board_detect
+		;;
+	*"CPE510/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 0d6aa6b..0985d33 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -280,6 +280,7 @@ platform_check_image() {
 		return 0
 		;;
 
+	cpe210|\
 	cpe510)
 		tplink_pharos_check_image "$1" && return 0
 		return 1
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
index 5cb052a..74daf43 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-cpe510.c
@@ -78,12 +78,8 @@ static struct gpio_keys_button cpe510_gpio_keys[] __initdata = {
 	}
 };
 
-
-static void __init cpe510_setup(void)
+static void __init cpe_setup(u8 *mac)
 {
-	u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
-	u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
-
 	/* Disable JTAG, enabling GPIOs 0-3 */
 	/* Configure OBS4 line, for GPIO 4*/
 	ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
@@ -105,9 +101,31 @@ static void __init cpe510_setup(void)
 	ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
 	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
 	ath79_register_eth(1);
+}
+
+
+static void __init cpe210_setup(void)
+{
+	u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
+	u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+	cpe_setup(mac);
 
 	ath79_register_wmac(ee, mac);
 }
 
-MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE210/220/510/520",
+static void __init cpe510_setup(void)
+{
+	u8 *mac = (u8 *) KSEG1ADDR(0x1f830008);
+	u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+	cpe_setup(mac);
+
+	ath79_register_wmac(ee, mac);
+}
+
+MIPS_MACHINE(ATH79_MACH_CPE210, "CPE210", "TP-LINK CPE210/220",
+	     cpe210_setup);
+
+MIPS_MACHINE(ATH79_MACH_CPE510, "CPE510", "TP-LINK CPE510/520",
 	     cpe510_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index f53efff..d755c2b 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -51,6 +51,7 @@ enum ath79_mach_type {
 	ATH79_MACH_CAP4200AG,		/* Senao CAP4200AG */
 	ATH79_MACH_CARAMBOLA2,		/* 8devices Carambola2 */
 	ATH79_MACH_CF_E316N_V2,		/* COMFAST CF-E316N v2 */
+	ATH79_MACH_CPE210,		/* TP-LINK CPE210 */
 	ATH79_MACH_CPE510,		/* TP-LINK CPE510 */
 	ATH79_MACH_CR3000,		/* PowerCloud CR3000 */
 	ATH79_MACH_CR5000,		/* PowerCloud CR5000 */
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 96122d7..f75d0c9 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -328,18 +328,24 @@ $(Device/tplink)
   IMAGE_SIZE := 15872k
 endef
 
-define Device/cpe210-220-510-520
+define Device/cpe210-220
   MTDPARTS := spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-info)ro,1536k(kernel),6144k(rootfs),192k(config)ro,64k(ART)ro,7680k at 0x40000(firmware)
   IMAGE_SIZE := 7680k
-  BOARDNAME := CPE510
+  BOARDNAME := CPE210
   TPLINK_BOARD_NAME := CPE510
+  DEVICE_PROFILE := CPE510
   LOADER_TYPE := elf
   KERNEL := kernel-bin | patch-cmdline | lzma | loader-kernel
   IMAGES := sysupgrade.bin factory.bin
   IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
   IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
 endef
-TARGET_DEVICES += cpe210-220-510-520
+
+define Device/cpe510-520
+$(Device/cpe210-220)
+  BOARDNAME := CPE510
+endef
+TARGET_DEVICES += cpe210-220 cpe510-520
 
 define Device/tl-wdr4300-v1
 $(Device/tplink-8mlzma)
-- 
2.8.2




More information about the Lede-dev mailing list