[OpenWrt-Devel] [PATCH] ar71xx: add support for EnGenius ESR1750

John Crispin john at phrozen.org
Tue Jul 1 09:16:16 EDT 2014


Hi,

2 comments inline



On 01/07/2014 13:44, Jon Suphammer wrote:
> Signed-off-by: Jon Suphammer <jon at suphammer.net> --- 
> target/linux/ar71xx/base-files/etc/diag.sh         |   3 + 
> .../ar71xx/base-files/etc/uci-defaults/02_network  |  14 ++ 
> target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 + 
> .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 + 
> target/linux/ar71xx/config-3.10                    |   3 +- 
> .../ar71xx/files/arch/mips/ath79/mach-esr1750.c    | 216
> +++++++++++++++++++++ 
> target/linux/ar71xx/generic/profiles/engenius.mk   |  16 ++ 
> target/linux/ar71xx/image/Makefile                 |   2 + 
> .../713-MIPS-ath79-add-ESR1750-support.patch       |  45 +++++ 9
> files changed, 302 insertions(+), 1 deletion(-) create mode 100644
> target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c create
> mode 100644 target/linux/ar71xx/generic/profiles/engenius.mk create
> mode 100644
> target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch
>
>  diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
> b/target/linux/ar71xx/base-files/etc/diag.sh index 687cddf..3a9de0b
> 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++
> b/target/linux/ar71xx/base-files/etc/diag.sh @@ -69,6 +69,9 @@
> get_status_led() { el-m150) status_led="EasyLink:green:system" ;; +
> esr1750) +		status_led="esr1750:red:status" +		;; hiwifi-hc6361) 
> status_led="hiwifi:blue:system" ;; 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
> 99c0268..166b10c 100755 ---
> a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++
> b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@
> -30,6 +30,20 @@ wlr8100) ucidef_add_switch_vlan "switch0" "2" "0t
> 1" ;;
> 
> +esr1750) +	ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" +
> ucidef_add_switch "switch0" "1" "1" +	ucidef_add_switch_vlan
> "switch0" "1" "0t 2 3 4 5" +	ucidef_add_switch_vlan "switch0" "2"
> "0t 1" +	part=$(find_mtd_part u-boot-env) +	mac=$(strings $part |
> sed -n 's/^'"ethaddr"'=//p' |sed 's/\"//g') +
> mac_lan=$(macaddr_canonicalize $mac) +	[ -n "$mac_lan" ] &&
> ucidef_set_interface_macaddr "lan" "$mac_lan" +
> mac_wan=$(mtd_get_mac_ascii u-boot-env wanaddr) +	[ -n "$mac_wan" ]
> && ucidef_set_interface_macaddr "wan" "$mac_wan" +
> mac_wifi2=$(macaddr_add $mac_lan 1) +	;; +

package/kernel/uboot-env/ can solve this problem for you i believe




> ap136-010) ucidef_set_interfaces_lan_wan "eth0" "eth1" 
> ucidef_add_switch "switch0" "1" "1" diff --git
> a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh index
> 4656ac2..954fc9d 100755 ---
> a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++
> b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -319,6 +319,9 @@
> ar71xx_board_detect() { *EL-MINI) name="el-mini" ;; +	*"EnGenius
> ESR1750") +		name="esr1750" +		;; *JA76PF) name="ja76pf" ;; diff
> --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index
> 8af9580..70f7fc2 100755 ---
> a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++
> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -151,6
> +151,7 @@ platform_check_image() { dir-825-c1 | \ dir-835-a1 | \ 
> dragino2 | \ +	esr1750 | \ ew-dorin | \ ew-dorin-router | \ 
> hiwifi-hc6361 | \ diff --git a/target/linux/ar71xx/config-3.10
> b/target/linux/ar71xx/config-3.10 index 1346c3f..3080c9f 100644 ---
> a/target/linux/ar71xx/config-3.10 +++
> b/target/linux/ar71xx/config-3.10 @@ -49,10 +49,11 @@
> CONFIG_ATH79_MACH_DRAGINO2=y CONFIG_ATH79_MACH_EAP7660D=y 
> CONFIG_ATH79_MACH_EL_M150=y CONFIG_ATH79_MACH_EL_MINI=y 
> +CONFIG_ATH79_MACH_ESR1750=y CONFIG_ATH79_MACH_EW_DORIN=y 
> CONFIG_ATH79_MACH_GS_OOLITE=y -CONFIG_ATH79_MACH_HORNET_UB=y 
> CONFIG_ATH79_MACH_HIWIFI_HC6361=y +CONFIG_ATH79_MACH_HORNET_UB=y 
> CONFIG_ATH79_MACH_JA76PF=y CONFIG_ATH79_MACH_JWAP003=y 
> CONFIG_ATH79_MACH_MR600=y diff --git
> a/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c new file
> mode 100644 index 0000000..6488d70 --- /dev/null +++
> b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c @@ -0,0
> +1,216 @@ +/* + * EnGenius ESR1750 board support + * + * Based on
> the Qualcomm Atheros AP135/AP136 reference board support code + *
> Copyright (c) 2012 Qualcomm Atheros + * Copyright (c) 2012-2013
> Gabor Juhos <juhosg at openwrt.org> + * Copyright (c) 2014 Jon
> Suphammer <jon at suphammer.net> + * + * Permission to use, copy,
> modify, and/or distribute this software for any + * purpose with or
> without fee is hereby granted, provided that the above + *
> copyright notice and this permission notice appear in all copies. +
> * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
> WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
> WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
> THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR
> CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM
> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT,
> NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN
> CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ 
> + +#include <linux/platform_device.h> +#include
> <linux/ar8216_platform.h> + +#include
> <asm/mach-ath79/ar71xx_regs.h> + +#include "common.h" +#include
> "pci.h" +#include "dev-ap9x-pci.h" +#include "dev-gpio-buttons.h" 
> +#include "dev-eth.h" +#include "dev-leds-gpio.h" +#include
> "dev-m25p80.h" +#include "dev-usb.h" +#include "dev-wmac.h" 
> +#include "machtypes.h" + +#define ESR1750_GPIO_LED_WLAN_5G	23 
> +#define ESR1750_GPIO_LED_WLAN_2G	13 +#define
> ESR1750_GPIO_LED_STATUS_RED	14 +#define ESR1750_GPIO_LED_WPS_RED
> 22 +#define ESR1750_GPIO_LED_WPS_BLUE	19 + +#define
> ESR1750_GPIO_BTN_WPS		16 +#define ESR1750_GPIO_BTN_RESET		17 + 
> +#define ESR1750_KEYS_POLL_INTERVAL	20	/* msecs */ +#define
> ESR1750_KEYS_DEBOUNCE_INTERVAL	(3 * ESR1750_KEYS_POLL_INTERVAL) + 
> +#define ESR1750_MAC0_OFFSET		0 +#define ESR1750_MAC1_OFFSET		6 
> +#define ESR1750_WMAC_CALDATA_OFFSET	0x1000 +#define
> ESR1750_PCIE_CALDATA_OFFSET	0x5000 + +static struct gpio_led
> esr1750_leds_gpio[] __initdata = { +	{ +		.name		=
> "esr1750:red:status", +		.gpio		= ESR1750_GPIO_LED_STATUS_RED, +
> .active_low	= 1, +	}, +	{ +		.name		= "esr1750:blue:wps", +		.gpio
> = ESR1750_GPIO_LED_WPS_BLUE, +		.active_low	= 1, +	}, +	{ +		.name
> = "esr1750:red:wps", +		.gpio		= ESR1750_GPIO_LED_WPS_RED, +
> .active_low	= 1, +	}, +	{ +		.name		= "esr1750:blue:wlan-2g", +
> .gpio		= ESR1750_GPIO_LED_WLAN_2G, +		.active_low	= 1, +	}, +	{ +
> .name		= "esr1750:blue:wlan-5g", +		.gpio		=
> ESR1750_GPIO_LED_WLAN_5G, +		.active_low	= 1, +	} +}; + +static
> struct gpio_keys_button esr1750_gpio_keys[] __initdata = { +	{ +
> .desc		= "WPS button", +		.type		= EV_KEY, +		.code		=
> KEY_WPS_BUTTON, +		.debounce_interval =
> ESR1750_KEYS_DEBOUNCE_INTERVAL, +		.gpio		= ESR1750_GPIO_BTN_WPS, +
> .active_low	= 1, +	}, +	{ +		.desc		= "Reset button", +		.type		=
> EV_KEY, +		.code		= KEY_RESTART, +		.debounce_interval =
> ESR1750_KEYS_DEBOUNCE_INTERVAL, +		.gpio		=
> ESR1750_GPIO_BTN_RESET, +		.active_low	= 1, +	}, +}; + +static
> struct ar8327_pad_cfg esr1750_ar8327_pad0_cfg; +static struct
> ar8327_pad_cfg esr1750_ar8327_pad6_cfg; + +static struct
> ar8327_platform_data esr1750_ar8327_data = { +	.pad0_cfg =
> &esr1750_ar8327_pad0_cfg, +	.pad6_cfg = &esr1750_ar8327_pad6_cfg, +
> .port0_cfg = { +		.force_link = 1, +		.speed =
> AR8327_PORT_SPEED_1000, +		.duplex = 1, +		.txpause = 1, +
> .rxpause = 1, +	}, +	.port6_cfg = { +		.force_link = 1, +		.speed =
> AR8327_PORT_SPEED_1000, +		.duplex = 1, +		.txpause = 1, +
> .rxpause = 1, +	}, +}; + +static struct mdio_board_info
> esr1750_mdio0_info[] = { +	{ +		.bus_id = "ag71xx-mdio.0", +
> .phy_addr = 0, +		.platform_data = &esr1750_ar8327_data, +	}, +}; 
> + +static void __init esr1750_gmac_setup(void) +{ +	void __iomem
> *base; +	u32 t; + +	base = ioremap(QCA955X_GMAC_BASE,
> QCA955X_GMAC_SIZE); + +	t = __raw_readl(base +
> QCA955X_GMAC_REG_ETH_CFG); + +	t &= ~(QCA955X_ETH_CFG_RGMII_EN |
> QCA955X_ETH_CFG_GE0_SGMII); +	t |= QCA955X_ETH_CFG_RGMII_EN; + +
> __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG); + +
> iounmap(base); +} +


this function looks wrong. are you sure this cannot be fixed with
existing code ?




> +static void __init esr1750_common_setup(void) +{ +	u8 *art = (u8
> *) KSEG1ADDR(0x1fff0000); + +	ath79_register_m25p80(NULL); + +
> ath79_register_leds_gpio(-1, ARRAY_SIZE(esr1750_leds_gpio), +
> esr1750_leds_gpio); +	ath79_register_gpio_keys_polled(-1,
> ESR1750_KEYS_POLL_INTERVAL, +					ARRAY_SIZE(esr1750_gpio_keys), +
> esr1750_gpio_keys); + +	ath79_register_usb(); + +
> ath79_register_wmac(art + ESR1750_WMAC_CALDATA_OFFSET, NULL); + +
> esr1750_gmac_setup(); + +	ath79_register_mdio(0, 0x0); + +
> ath79_init_mac(ath79_eth0_data.mac_addr, art + ESR1750_MAC0_OFFSET,
> 0); + +	mdiobus_register_board_info(esr1750_mdio0_info, +
> ARRAY_SIZE(esr1750_mdio0_info)); + +	/* GMAC0 is connected to the
> RMGII interface */ +	ath79_eth0_data.phy_if_mode =
> PHY_INTERFACE_MODE_RGMII; +	ath79_eth0_data.phy_mask = BIT(0); +
> ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + +
> ath79_register_eth(0); + +	/* GMAC1 is connected tot eh SGMII
> interface */ +	ath79_eth1_data.phy_if_mode =
> PHY_INTERFACE_MODE_SGMII; +	ath79_eth1_data.speed = SPEED_1000; +
> ath79_eth1_data.duplex = DUPLEX_FULL; + +	ath79_register_eth(1); 
> +} + +static void __init esr1750_010_setup(void) +{ +	u8 *art = (u8
> *) KSEG1ADDR(0x1fff0000); + +	/* GMAC0 of the AR8337 switch is
> connected to GMAC0 via RGMII */ +	esr1750_ar8327_pad0_cfg.mode =
> AR8327_PAD_MAC_RGMII; +	esr1750_ar8327_pad0_cfg.txclk_delay_en =
> true; +	esr1750_ar8327_pad0_cfg.rxclk_delay_en = true; +
> esr1750_ar8327_pad0_cfg.txclk_delay_sel = AR8327_CLK_DELAY_SEL1; +
> esr1750_ar8327_pad0_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2; + 
> +	/* GMAC6 of the AR8337 switch is connected to GMAC1 via SGMII */ 
> +	esr1750_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII; +
> esr1750_ar8327_pad6_cfg.rxclk_delay_en = true; +
> esr1750_ar8327_pad6_cfg.rxclk_delay_sel = AR8327_CLK_DELAY_SEL0; + 
> +	ath79_eth0_pll_data.pll_1000 = 0xa6000000; +
> ath79_eth1_pll_data.pll_1000 = 0x03000101; + +
> esr1750_common_setup(); +	ap91_pci_init(art +
> ESR1750_PCIE_CALDATA_OFFSET, NULL); +} + 
> +MIPS_MACHINE(ATH79_MACH_ESR1750, "ESR1750", +	     "EnGenius
> ESR1750", +	     esr1750_010_setup); + diff --git
> a/target/linux/ar71xx/generic/profiles/engenius.mk
> b/target/linux/ar71xx/generic/profiles/engenius.mk new file mode
> 100644 index 0000000..ed844e0 --- /dev/null +++
> b/target/linux/ar71xx/generic/profiles/engenius.mk @@ -0,0 +1,16
> @@ +# +# Copyright (C) 2009-2013 OpenWrt.org +# +# This is free
> software, licensed under the GNU General Public License v2. +# See
> /LICENSE for more information. +# +define Profile/ESR1750 +
> NAME:=EnGenius ESR1750 +        PACKAGES:=kmod-usb-core kmod-usb2
> kmod-ledtrig-usbdev kmod-ath10k luci -wpad-mini wpad +endef + 
> +define Profile/ESR1750/Description +        Package set optimized
> for the EnGenius ESR1750 +endef + +$(eval $(call Profile,ESR1750)) 
> diff --git a/target/linux/ar71xx/image/Makefile
> b/target/linux/ar71xx/image/Makefile index 6bc1105..0855bf3 100644 
> --- a/target/linux/ar71xx/image/Makefile +++
> b/target/linux/ar71xx/image/Makefile @@ -264,6 +264,7 @@
> cap4200ag_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),320k(custom)ro,
>
> 
db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k at 0x50000(firmware)
> 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)
> +esr1750_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)
>
> 
ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),3712k(firmware),64k(art)
> ew-dorin_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)
>
> 
dlrtdev_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,640k(certs),960k(unknown)ro,64k at 0x7f0000(caldata_copy)
> @@ -1028,6 +1029,7 @@ $(eval $(call
> SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,tt 
> $(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,DRAGINO2,dragino2,DRAGINO2,ttyATH0,115200,$$(dragino2_mtdlayout),KRuImage,65536))
>
> 
+$(eval $(call
SingleProfile,AthLzma,64k,ESR1750,esr1750,ESR1750,ttyS0,115200,$$(esr1750_mtdlayout),KRuImage))
> $(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/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch
b/target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch
> new file mode 100644 index 0000000..9289344 --- /dev/null +++
> b/target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch
>
> 
@@ -0,0 +1,45 @@
> +Index: linux-3.10.44/arch/mips/ath79/Kconfig 
> +===================================================================
>
> 
+--- linux-3.10.44.orig/arch/mips/ath79/Kconfig
> ++++ linux-3.10.44/arch/mips/ath79/Kconfig +@@ -177,6 +177,16 @@
> config ATH79_MACH_AW_NR580 + 	select ATH79_DEV_LEDS_GPIO + 	select
> ATH79_DEV_M25P80 + ++config ATH79_MACH_ESR1750 ++	bool "EnGenius
> ESR1750 board support" ++	select SOC_QCA955X ++	select
> ATH79_DEV_ETH ++	select ATH79_DEV_GPIO_BUTTONS ++	select
> ATH79_DEV_LEDS_GPIO ++	select ATH79_DEV_SPI ++	select
> ATH79_DEV_USB ++	select ATH79_DEV_WMAC ++ + config
> ATH79_MACH_WHR_HP_G300N + 	bool "Buffalo WHR-HP-G300N board
> support" + 	select SOC_AR724X +Index:
> linux-3.10.44/arch/mips/ath79/Makefile 
> +===================================================================
>
> 
+--- linux-3.10.44.orig/arch/mips/ath79/Makefile
> ++++ linux-3.10.44/arch/mips/ath79/Makefile +@@ -64,6 +64,7 @@
> obj-$(CONFIG_ATH79_MACH_EW_DORIN)	+= mac +
> 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_ESR1750)	+= mach-esr1750.o +
> obj-$(CONFIG_ATH79_MACH_GS_OOLITE)	+= mach-gs-oolite.o +
> obj-$(CONFIG_ATH79_MACH_HIWIFI_HC6361)	+= mach-hiwifi-hc6361.o +
> obj-$(CONFIG_ATH79_MACH_JA76PF)		+= mach-ja76pf.o +Index:
> linux-3.10.44/arch/mips/ath79/machtypes.h 
> +===================================================================
>
> 
+--- linux-3.10.44.orig/arch/mips/ath79/machtypes.h
> ++++ linux-3.10.44/arch/mips/ath79/machtypes.h +@@ -52,6 +52,7 @@
> enum ath79_mach_type { + 	ATH79_MACH_EAP7660D,		/* Senao EAP7660D
> */ + 	ATH79_MACH_EL_M150,		/* EasyLink EL-M150 */ +
> ATH79_MACH_EL_MINI,		/* EasyLink EL-MINI */ ++	ATH79_MACH_ESR1750,
> /* EnGenius ESR1750 */ + 	ATH79_MACH_GS_OOLITE,           /* GS
> OOLITE V1.0 */ + 	ATH79_MACH_HIWIFI_HC6361,	/* HiWiFi HC6361 */ +
> ATH79_MACH_JA76PF,		/* jjPlus JA76PF */
> 
_______________________________________________
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