From c5ff273d85f69981e5b126eeaed3dee5b4061fb4 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 23 May 2016 03:17:00 +0200 Subject: [PATCH] ar71xx/cpe510: split profile into 2 profiles cpe210 and cpe510 Split profile into 2GHz and 5GHz. The 5GHz devices are quite "special". The 2 GHz works perfect. Signed-off-by: Alexander Couzens --- .../ar71xx/base-files/etc/board.d/01_leds | 1 + .../ar71xx/base-files/etc/board.d/02_network | 1 + .../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 + .../files/arch/mips/ath79/mach-cpe510.c | 30 +++++++++++++++---- .../ar71xx/files/arch/mips/ath79/machtypes.h | 1 + target/linux/ar71xx/image/tp-link.mk | 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 8ba08ddf25..bee2fb80c1 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 27c8980b08..916bed960a 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@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 8abcfc0db0..00cc167254 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 4318818cd2..b06c60ed70 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 ace039210b..2505b7575c 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 5cb052a84a..74daf434e6 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 a74d0df152..65b1d79019 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/tp-link.mk b/target/linux/ar71xx/image/tp-link.mk index bcaa4ba10e..a3af519efe 100644 --- a/target/linux/ar71xx/image/tp-link.mk +++ b/target/linux/ar71xx/image/tp-link.mk @@ -97,18 +97,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@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.30.2