[LEDE-DEV] [PATCH v4] ar71xx: add ew-balin platform from Embedded Wireless

Catrinel Catrinescu cc at 80211.de
Mon Jan 15 07:57:11 PST 2018


Hi John & Piotr

Thank you for your advices. I updated the patch, inclusive your comments,
I hope now you can commit the new patch version v5.

Best regards
Catrinel


-----Original Message-----
From: Piotr Dymacz [mailto:pepe2k at gmail.com] 
Sent: Samstag, 13. Januar 2018 15:25
To: Catrinel Catrinescu; lede-dev at lists.infradead.org
Cc: 'info at embeddedwireless.de'; john at phrozen.org
Subject: Re: [LEDE-DEV] [PATCH v4] ar71xx: add ew-balin platform from Embedded Wireless

Hello Catrinel,

As John already wrote, it seems that your patch got whitespace mangled. 
Please, send new version using git send-email.

Also, please see minor comments inline, below.

On 13.01.2018 11:36, Catrinel Catrinescu wrote:
> Add the Embedded Wireless "Balin" platform, based on AR9344:
> http://www.embeddedwireless.de/uploads/Balin_data_2016_10.pdf

Please, drop url from commit message.

> SoC: QCA AR9344 or AR9350
> RAM: DDR2-RAM 64MBytes
> Flash: SPI-NOR 16MBytes
> WLAN: 2 x 2 MIMO 2.4 & 5 GHz IEEE802.11 a/b/g/n
> Ethernet: 3 x 10/100 Mb/s
> USB: 1 x USB2.0 Host/Device bootstrap-pin at power-up
> PCI-Express: 1 x lane PCIe 1.2
> UART: 1 x Normal, 1 x High-Speed
> JTAG: 1 x EJTAG
> GPIO: 10 x Input/Output multiplexed
> The module comes already with the current vanilla OpenWRT firmware, so no need to install "factory"-image, or any other stuff :-)

OpenWRT -> OpenWrt.

If the boards already runs OpenWrt, maybe it would be better to write 
something like this instead: Use "sysupgrade" image directly in vendor 
firmware which is based on OpenWrt.

I don't see any reason to mention that "factory" image is not required 
when your patch doesn't include code for it.

And please, drop ":-)" ;)

> 
> Signed-off-by: Catrinel Catrinescu <cc at 80211.de>
> ---
>   .../linux/ar71xx/base-files/etc/board.d/02_network |   6 ++
>   target/linux/ar71xx/base-files/etc/diag.sh         |   3 +
>   .../etc/uci-defaults/03_network-switchX-migration  |   1 +
>   target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
>   .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 +
>   target/linux/ar71xx/config-4.4                     |   1 +
>   target/linux/ar71xx/config-4.9                     |   1 +
>   .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  11 ++
>   target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
>   .../ar71xx/files/arch/mips/ath79/mach-ew-balin.c   | 112 +++++++++++++++++++++
>   .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
>   target/linux/ar71xx/image/generic.mk               |   9 ++
>   target/linux/ar71xx/mikrotik/config-default        |   1 +
>   target/linux/ar71xx/nand/config-default            |   1 +
>   14 files changed, 152 insertions(+)
>   create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c
> 
> 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 fb61792bf4..4919e7c983 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> @@ -368,6 +368,12 @@ ar71xx_setup_interfaces()
>   		ucidef_add_switch "switch0" \
>   			"0 at eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
>   		;;
> +	ew-balin)
> +		ucidef_set_interface_raw "usb2" "usb0" "static"
> +		ucidef_set_interface_raw "usb3" "usb0" "static"

Could you please explain these two lines?
This code will create two static interfaces with the same netdev (usb0).

Is USB in this module/board set to device mode by default?

> +		ucidef_add_switch "switch0" \
> +			"0 at eth0" "5:lan:4" "4:lan:5" "3:wan"
> +		;;
>   	ew-dorin)
>   		ucidef_add_switch "switch0" \
>   			"0 at eth0" "1:lan" "2:lan" "3:wan"
> diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
> index 6cbb3576d8..ca73d5f62b 100644
> --- a/target/linux/ar71xx/base-files/etc/diag.sh
> +++ b/target/linux/ar71xx/base-files/etc/diag.sh
> @@ -193,6 +193,9 @@ get_status_led() {
>   	el-mini)
>   		status_led="easylink:green:system"
>   		;;
> +	ew-balin)
> +		status_led="balin:green:status"
> +		;;
>   	ew-dorin|\
>   	ew-dorin-router)
>   		status_led="dorin:green:status"
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index b5440230a5..162742a94c 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -640,6 +640,9 @@ ar71xx_board_detect() {
>   	*"EL-MINI")
>   		name="el-mini"
>   		;;
> +	*EmbWir-Balin)

*"EmbWir-Balin")

> +		name="ew-balin"
> +		;;
>   	*"EmbWir-Dorin")
>   		name="ew-dorin"
>   		;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index ecf6820a2b..9dceadc563 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -237,6 +237,7 @@ platform_check_image() {
>   	epg5000|\
>   	esr1750|\
>   	esr900|\
> +	ew-balin|\
>   	ew-dorin|\
>   	ew-dorin-router|\
>   	gl-ar150|\
> diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index 5a8004a03e..36b266f21c 100644
> --- a/target/linux/ar71xx/config-4.4
> +++ b/target/linux/ar71xx/config-4.4
> @@ -109,6 +109,7 @@ CONFIG_ATH79_MACH_ENS202EXT=y  CONFIG_ATH79_MACH_EPG5000=y  CONFIG_ATH79_MACH_ESR1750=y  CONFIG_ATH79_MACH_ESR900=y
> +CONFIG_ATH79_MACH_EW_BALIN=y
>   CONFIG_ATH79_MACH_EW_DORIN=y
>   CONFIG_ATH79_MACH_F9K1115V2=y
>   CONFIG_ATH79_MACH_FRITZ300E=y
> diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index 4334d25b80..d51fe5f797 100644
> --- a/target/linux/ar71xx/config-4.9
> +++ b/target/linux/ar71xx/config-4.9
> @@ -107,6 +107,7 @@ CONFIG_ATH79_MACH_ENS202EXT=y  CONFIG_ATH79_MACH_EPG5000=y  CONFIG_ATH79_MACH_ESR1750=y  CONFIG_ATH79_MACH_ESR900=y
> +CONFIG_ATH79_MACH_EW_BALIN=y
>   CONFIG_ATH79_MACH_EW_DORIN=y
>   CONFIG_ATH79_MACH_F9K1115V2=y
>   CONFIG_ATH79_MACH_FRITZ300E=y
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> index 1198fcb74b..a94c5a3a2e 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> @@ -702,6 +702,17 @@ config ATH79_MACH_ESR900
>   	select ATH79_DEV_WMAC
>   	select ATH79_NVRAM
>   
> +config ATH79_MACH_EW_BALIN
> +	bool "embedded wireless Balin Platform support"
> +	select SOC_AR934X
> +	select ATH79_DEV_M25P80
> +	select ATH79_DEV_GPIO_BUTTONS
> +	select ATH79_DEV_LEDS_GPIO
> +	select ATH79_DEV_WMAC
> +	select ATH79_DEV_ETH
> +	select ATH79_DEV_USB
> +	select ATH79_DEV_AP9X_PCI if PCI
> +
>   config ATH79_MACH_EW_DORIN
>   	bool "embedded wireless Dorin Platform support"
>   	select SOC_AR933X
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> index 455af762e3..bde1b75308 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> @@ -115,6 +115,7 @@ obj-$(CONFIG_ATH79_MACH_ENS202EXT)		+= mach-ens202ext.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
> +obj-$(CONFIG_ATH79_MACH_EW_BALIN)		+= mach-ew-balin.o
>   obj-$(CONFIG_ATH79_MACH_EW_DORIN)		+= mach-ew-dorin.o
>   obj-$(CONFIG_ATH79_MACH_F9K1115V2)		+= mach-f9k1115v2.o
>   obj-$(CONFIG_ATH79_MACH_FRITZ300E)		+= mach-fritz300e.o
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c
> new file mode 100644
> index 0000000000..7d7f38c1d2
> --- /dev/null
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c
> @@ -0,0 +1,112 @@
> +/*
> + * EW Balin board support
> + * (based on Atheros DB120 reference board support)
> + *
> + * Copyright (c) 2011 Qualcomm Atheros
> + * Copyright (c) 2011-2012 Gabor Juhos <juhosg at openwrt.org>
> + * Copyright (C) 2017 Embedded Wireless GmbH    www.80211.de
> + *
> + * 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/pci.h>
> +#include <linux/phy.h>
> +#include <linux/platform_device.h>
> +#include <linux/ath9k_platform.h>
> +#include <linux/ar8216_platform.h>
> +
> +#include <asm/mach-ath79/ar71xx_regs.h>
> +
> +#include "common.h"
> +#include "dev-ap9x-pci.h"
> +#include "dev-eth.h"
> +#include "dev-gpio-buttons.h"
> +#include "dev-leds-gpio.h"
> +#include "dev-m25p80.h"
> +#include "dev-spi.h"
> +#include "dev-usb.h"
> +#include "dev-wmac.h"
> +#include "machtypes.h"
> +#include "pci.h"
> +
> +#define BALIN_GPIO_LED_STATUS	14
> +
> +#define BALIN_GPIO_BTN_WPS		18
> +
> +#define BALIN_KEYS_POLL_INTERVAL	20	/* msecs */
> +#define BALIN_KEYS_DEBOUNCE_INTERVAL	(3 * BALIN_KEYS_POLL_INTERVAL)
> +
> +#define BALIN_CALDATA_OFFSET		0x1000
> +#define BALIN_WMAC_MAC_OFFSET		(BALIN_CALDATA_OFFSET + 0x02)
> +
> +static struct gpio_led balin_leds_gpio[] __initdata = {
> +	{
> +		.name		= "balin:green:status",
> +		.gpio		= BALIN_GPIO_LED_STATUS,
> +		.active_low	= 1,
> +	},
> +};
> +
> +static struct gpio_keys_button balin_gpio_keys[] __initdata = {
> +	{
> +		.desc		= "WPS button",
> +		.type		= EV_KEY,
> +		.code		= KEY_WPS_BUTTON,
> +		.debounce_interval = BALIN_KEYS_DEBOUNCE_INTERVAL,
> +		.gpio		= BALIN_GPIO_BTN_WPS,
> +		.active_low	= 0,
> +	},
> +};
> +
> +
> +static void __init balin_setup(void)
> +{
> +	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
> +	static u8 mac[6];
> +
> +	ath79_register_m25p80(NULL);
> +
> +	ath79_register_leds_gpio(-1, ARRAY_SIZE(balin_leds_gpio),
> +				 balin_leds_gpio);
> +
> +	ath79_register_gpio_keys_polled(-1, BALIN_KEYS_POLL_INTERVAL,
> +					ARRAY_SIZE(balin_gpio_keys),
> +					balin_gpio_keys);
> +
> +	ath79_register_usb();
> +
> +
> +	ath79_register_wmac(art + BALIN_CALDATA_OFFSET,
> +				    art + BALIN_WMAC_MAC_OFFSET);

Should work here as well:
ath79_register_wmac(art + BALIN_CALDATA_OFFSET, NULL)

-- 
Cheers,
Piotr


More information about the Lede-dev mailing list