[LEDE-DEV] [PATCH] ar71xx: add Engenius ENH200EXT support

Piotr Dymacz pepe2k at gmail.com
Fri Mar 31 14:42:13 PDT 2017


Hello Paul,

On 31.03.2017 22:38, Paul Oranje wrote:
> This POE access point suited for outside usage needs an external antenna.
> According FCC documentation the ENH200EXT (needs external antenna) and the ENH200 (with internal antenna) are electrically equal to the Allnet ALL0258N.
>
> The stock image does not allow install of a LEDE factory image, but an initramfs image (lede-ar71xx-generic-enh200ext-initramfs-uImage.bin) can be loaded via u-boot recovery procedure (long press reset at power-on until all LEDS burn). The u-boot recovery procedure boots an image named vmlinux-art-ramdisk from 192.168.1.101.
> Once booted the sysupgrade image can be flashed from the booted iniramfs LEDE.
>
> Only abnormality is that for some unknown reason the txpower cannot be set higher than 16 dBm whereas the Engenius stock firmware allows a maximum of 27 dBm.

First of all, thank you for your patch.
Unfortunately, it doesn't apply and seems to be corrupted:

./scripts/checkpatch.pl 745796.patch
ERROR: patch seems to be corrupt (line wrapped?)
#45: FILE: package/boot/uboot-envtools/files/ar71xx:26:
cr3000|\

WARNING: line over 80 characters
#170: FILE: target/linux/ar71xx/files/arch/mips/ath79/mach-enh200ext.c:5:
+ *  Copyright (C) 2017 Paul Oranje <por at xs4all.nl> (ENH200EXT is same 
device as ALL0258N)

Please, fix it (you can use above script and/or 'git apply --check 
--verbose' to test if your patch is ok and can be applied cleanly) and 
resend.

Also, make sure you follow rules from [1], especially the one about 
commit message/description (line wrap).

And, one more comment inline, below.

>
> Signed-off-by: Paul Oranje <por at xs4all.nl>
> ---
> package/boot/uboot-envtools/files/ar71xx           |  1 +
> target/linux/ar71xx/base-files/etc/board.d/01_leds |  3 +-
> .../linux/ar71xx/base-files/etc/board.d/02_network |  1 +
> target/linux/ar71xx/base-files/lib/ar71xx.sh       |  3 +
> .../ar71xx/base-files/lib/upgrade/platform.sh      |  6 +-
> target/linux/ar71xx/config-4.4                     |  1 +
> .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  9 +++
> target/linux/ar71xx/files/arch/mips/ath79/Makefile |  1 +
> .../ar71xx/files/arch/mips/ath79/mach-enh200ext.c  | 89 ++++++++++++++++++++++
> .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |  1 +
> target/linux/ar71xx/image/legacy-devices.mk        |  6 ++
> target/linux/ar71xx/image/legacy.mk                |  2 +

Please, include image support for this device in generic.mk. We really 
don't want to (and won't) include more devices in legacy.mk.

[1] https://lede-project.org/submitting-patches

--
Cheers,
Piotr

> target/linux/ar71xx/mikrotik/config-default        |  1 +
> target/linux/ar71xx/nand/config-default            |  1 +
> 14 files changed, 122 insertions(+), 3 deletions(-)
> create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-enh200ext.c
>
> diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx
> index 3a5d269..a104c3a 100644
> --- a/package/boot/uboot-envtools/files/ar71xx
> +++ b/package/boot/uboot-envtools/files/ar71xx
> @@ -27,6 +27,7 @@ cpe870|\
> cr3000|\
> cr5000|\
> eap300v2|\
> +enh200ext|\
> gl-ar300m|\
> hornet-ub|\
> hornet-ub-x2|\
> 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 686ae31..cf9c3ae 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds
> +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds
> @@ -28,7 +28,8 @@ alfa-nx)
> 	ucidef_set_led_netdev "lan" "LAN" "alfa:green:led_3" "eth1"
> 	;;
> all0258n|\
> -all0315n)
> +all0315n|\
> +enh200ext)
> 	ucidef_set_rssimon "wlan0" "200000" "1"
> 	ucidef_set_led_rssi "rssilow" "RSSILOW" "$board:red:rssilow" "wlan0" "1" "40" "0" "6"
> 	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$board:yellow:rssimedium" "wlan0" "30" "80" "-29" "5"
> 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 20b34e8..014404e 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> @@ -155,6 +155,7 @@ ar71xx_setup_interfaces()
> 	dlan-hotspot|\
> 	dlan-pro-500-wp|\
> 	dr344|\
> +	enh200ext|\
> 	ja76pf2|\
> 	rocket-m-ti|\
> 	ubnt-unifi-outdoor)
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index 4951e5b..f365feb 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -619,6 +619,9 @@ ar71xx_board_detect() {
> 	*"EmbWir-Dorin-Router")
> 		name="ew-dorin-router"
> 		;;
> +	*"ENH200EXT")
> +		name="enh200ext"
> +		;;
> 	*"EPG5000")
> 		name="epg5000"
> 		;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 364a32f..b4a84c2 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -332,7 +332,8 @@ platform_check_image() {
> 	cap324|\
> 	cap4200ag|\
> 	cr3000|\
> -	cr5000)
> +	cr5000|\
> +	enh200ext)
> 		platform_check_image_allnet "$1" && return 0
> 		return 1
> 		;;
> @@ -721,7 +722,8 @@ platform_do_upgrade() {
> 	local board=$(ar71xx_board_name)
>
> 	case "$board" in
> -	all0258n)
> +	all0258n|\
> +	enh200ext)
> 		platform_do_upgrade_allnet "0x9f050000" "$ARGV"
> 		;;
> 	all0305|\
> diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
> index 68b408a..3a74f8f 100644
> --- a/target/linux/ar71xx/config-4.4
> +++ b/target/linux/ar71xx/config-4.4
> @@ -99,6 +99,7 @@ CONFIG_ATH79_MACH_EAP300V2=y
> CONFIG_ATH79_MACH_EAP7660D=y
> CONFIG_ATH79_MACH_EL_M150=y
> CONFIG_ATH79_MACH_EL_MINI=y
> +CONFIG_ATH79_MACH_ENH200EXT=y
> CONFIG_ATH79_MACH_EPG5000=y
> CONFIG_ATH79_MACH_ESR1750=y
> CONFIG_ATH79_MACH_ESR900=y
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> index 1bf00bd..9ff545d 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> @@ -94,6 +94,15 @@ config ATH79_MACH_ALL0258N
> 	select ATH79_DEV_LEDS_GPIO
> 	select ATH79_DEV_M25P80
>
> +config ATH79_MACH_ENH200EXT
> +	bool "Engenius ENH200EXT support"
> +	select SOC_AR724X
> +	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
> +
> config ATH79_MACH_ALL0315N
> 	bool "Allnet ALL0315N support"
> 	select SOC_AR724X
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> index 7383244..7e6482c 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> @@ -103,6 +103,7 @@ obj-$(CONFIG_ATH79_MACH_EAP300V2)		+= mach-eap300v2.o
> obj-$(CONFIG_ATH79_MACH_EAP7660D)		+= mach-eap7660d.o
> obj-$(CONFIG_ATH79_MACH_EL_M150)		+= mach-el-m150.o
> obj-$(CONFIG_ATH79_MACH_EL_MINI)		+= mach-el-mini.o
> +obj-$(CONFIG_ATH79_MACH_ENH200EXT)		+= mach-enh200ext.o
> obj-$(CONFIG_ATH79_MACH_EPG5000)		+= mach-epg5000.o
> obj-$(CONFIG_ATH79_MACH_ESR1750)		+= mach-esr1750.o
> obj-$(CONFIG_ATH79_MACH_ESR900)			+= mach-esr900.o
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-enh200ext.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-enh200ext.c
> new file mode 100644
> index 0000000..68eb2fc
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-enh200ext.c
> @@ -0,0 +1,89 @@
> +/*
> + *  Engenius ENH200EXT support
> + *
> + *  Copyright (C) 2011 Daniel Golle <dgolle at allnet.de>
> + *  Copyright (C) 2017 Paul Oranje <por at xs4all.nl> (ENH200EXT is same device as ALL0258N)
> + *
> + *  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 <asm/mach-ath79/ath79.h>
> +
> +#include "dev-eth.h"
> +#include "dev-ap9x-pci.h"
> +#include "dev-gpio-buttons.h"
> +#include "dev-leds-gpio.h"
> +#include "dev-m25p80.h"
> +#include "machtypes.h"
> +
> +/* found via /sys/gpio/... try and error */
> +#define ENH200EXT_GPIO_BTN_RESET		1
> +#define ENH200EXT_GPIO_LED_RSSIHIGH	13
> +#define ENH200EXT_GPIO_LED_RSSIMEDIUM	15
> +#define ENH200EXT_GPIO_LED_RSSILOW	14
> +
> +/* defaults taken from others machs */
> +#define ENH200EXT_KEYS_POLL_INTERVAL	20	/* msecs */
> +#define ENH200EXT_KEYS_DEBOUNCE_INTERVAL (3 * ENH200EXT_KEYS_POLL_INTERVAL)
> +
> +/* showed up in the original firmware's bootlog */
> +#define ENH200EXT_SEC_PHYMASK BIT(3)
> +
> +static struct gpio_led enh200ext_leds_gpio[] __initdata = {
> +	{
> +		.name		= "enh200ext:green:rssihigh",
> +		.gpio		= ENH200EXT_GPIO_LED_RSSIHIGH,
> +		.active_low	= 1,
> +	}, {
> +		.name		= "enh200ext:yellow:rssimedium",
> +		.gpio		= ENH200EXT_GPIO_LED_RSSIMEDIUM,
> +		.active_low	= 1,
> +	}, {
> +		.name		= "enh200ext:red:rssilow",
> +		.gpio		= ENH200EXT_GPIO_LED_RSSILOW,
> +		.active_low	= 1,
> +	}
> +};
> +
> +static struct gpio_keys_button enh200ext_gpio_keys[] __initdata = {
> +	{
> +		.desc		= "reset",
> +		.type		= EV_KEY,
> +		.code		= KEY_RESTART,
> +		.debounce_interval = ENH200EXT_KEYS_DEBOUNCE_INTERVAL,
> +		.gpio		= ENH200EXT_GPIO_BTN_RESET,
> +		.active_low	= 1,
> +	}
> +};
> +
> +static void __init enh200ext_setup(void)
> +{
> +	u8 *mac = (u8 *) KSEG1ADDR(0x1f7f0000);
> +	u8 *ee =  (u8 *) KSEG1ADDR(0x1f7f1000);
> +
> +	ath79_register_m25p80(NULL);
> +
> +	ath79_register_leds_gpio(-1, ARRAY_SIZE(enh200ext_leds_gpio),
> +				 enh200ext_leds_gpio);
> +
> +	ath79_register_gpio_keys_polled(-1, ENH200EXT_KEYS_POLL_INTERVAL,
> +					ARRAY_SIZE(enh200ext_gpio_keys),
> +					enh200ext_gpio_keys);
> +
> +	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
> +	ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
> +
> +	ath79_eth1_data.phy_mask = ENH200EXT_SEC_PHYMASK;
> +
> +	ath79_register_mdio(0, 0x0);
> +
> +	ath79_register_eth(0);
> +	ath79_register_eth(1);
> +
> +	ap91_pci_init(ee, mac);
> +}
> +
> +MIPS_MACHINE(ATH79_MACH_ENH200EXT, "ENH200EXT", "Engenius ENH200EXT",
> +	     enh200ext_setup);
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> index 478a1a9..b49bb7b 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> @@ -94,6 +94,7 @@ enum ath79_mach_type {
> 	ATH79_MACH_EBR_2310_C1,			/* D-link EBR-2310 rev. C1 */
> 	ATH79_MACH_EL_M150,			/* EasyLink EL-M150 */
> 	ATH79_MACH_EL_MINI,			/* EasyLink EL-MINI */
> +	ATH79_MACH_ENH200EXT,			/* Engenius ENH200EXT */
> 	ATH79_MACH_EPG5000,			/* EnGenius EPG5000 */
> 	ATH79_MACH_ESR1750,			/* EnGenius ESR1750 */
> 	ATH79_MACH_ESR900,			/* EnGenius ESR900 */
> diff --git a/target/linux/ar71xx/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk
> index 7497a1b..c119966 100644
> --- a/target/linux/ar71xx/image/legacy-devices.mk
> +++ b/target/linux/ar71xx/image/legacy-devices.mk
> @@ -132,6 +132,12 @@ define LegacyDevice/DB120
> endef
> LEGACY_DEVICES += DB120
>
> +define LegacyDevice/ENH200EXT
> +  DEVICE_TITLE := Engenius ENH200EXT
> +  DEVICE_PACKAGES := rssileds
> +endef
> +LEGACY_DEVICES += ENH200EXT
> +
> define LegacyDevice/EWDORINAP
>   DEVICE_TITLE := Embedded Wireless Dorin Platform (4MB flash)
>   DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb-storage
> diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk
> index 1845cd0..0562532 100644
> --- a/target/linux/ar71xx/image/legacy.mk
> +++ b/target/linux/ar71xx/image/legacy.mk
> @@ -255,6 +255,7 @@ dlan_pro_500_wp_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(C
> dlan_pro_1200_ac_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(Config1)ro,64k(Config2)ro,15872k at 0x70000(firmware),64k(art)ro
> cameo_ap94_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,1600k(unknown)ro,64k at 0x7f0000(caldata_copy)
> cameo_ap94_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7808k(firmware),64k(caldata)ro,64k at 0x660000(caldata_orig),6208k at 0x50000(firmware_orig)
> +enh200ext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art)ro
> esr900_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k at 0x40000(firmware)
> esr1750_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k at 0x40000(firmware)
> epg5000_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k at 0x40000(firmware)
> @@ -903,6 +904,7 @@ $(eval $(call SingleProfile,AthLzma,64k,AP152_16M,ap152-16M,AP152,ttyS0,115200,$
> $(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),RKuImage))
> $(eval $(call SingleProfile,AthLzma,64k,CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),KRuImage))
> $(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),RKuImage))
> +$(eval $(call SingleProfile,AthLzma,64k,ENH200EXT,enh200ext,ENH200EXT,ttyS0,115200,$$(enh200ext_mtdlayout),KRuImage,65536))
> $(eval $(call SingleProfile,AthLzma,64k,EWDORINAP,ew-dorin,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
> $(eval $(call SingleProfile,AthLzma,64k,EWDORINRT,ew-dorin-router,EW-DORIN-ROUTER,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
> $(eval $(call SingleProfile,AthLzma,64k,EWDORIN16M,ew-dorin-16M,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_16M),KRuImage,65536))
> diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
> index cf6f754..0d77433 100644
> --- a/target/linux/ar71xx/mikrotik/config-default
> +++ b/target/linux/ar71xx/mikrotik/config-default
> @@ -64,6 +64,7 @@
> # CONFIG_ATH79_MACH_EAP7660D is not set
> # CONFIG_ATH79_MACH_EL_M150 is not set
> # CONFIG_ATH79_MACH_EL_MINI is not set
> +# CONFIG_ATH79_MACH_ENH200EXT is not set
> # CONFIG_ATH79_MACH_EPG5000 is not set
> # CONFIG_ATH79_MACH_ESR1750 is not set
> # CONFIG_ATH79_MACH_ESR900 is not set
> diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
> index 24e712c..4f0475a 100644
> --- a/target/linux/ar71xx/nand/config-default
> +++ b/target/linux/ar71xx/nand/config-default
> @@ -62,6 +62,7 @@
> # CONFIG_ATH79_MACH_EAP7660D is not set
> # CONFIG_ATH79_MACH_EL_M150 is not set
> # CONFIG_ATH79_MACH_EL_MINI is not set
> +# CONFIG_ATH79_MACH_ENH200EXT is not set
> # CONFIG_ATH79_MACH_EPG5000 is not set
> # CONFIG_ATH79_MACH_ESR1750 is not set
> # CONFIG_ATH79_MACH_ESR900 is not set
>




More information about the Lede-dev mailing list