[LEDE-DEV] [PATCH] ar71xx: add support for Gainstrong Oolite V5.2

Piotr Dymacz pepe2k at gmail.com
Tue Feb 13 22:56:44 PST 2018


Hi Daniel,

Few minor comments inline, below.

On 14.02.2018 02:01, Daniel Golle wrote:
> The Oolite V5.2 is a dual-radio system-on-a-module.
> 
> Specs:
>   - QCA9531 @ 550MHz with integrated 2T2R 802.11bgn
>   - 64 MB DDR2 RAM
>   - 16 MB SPI NOR Flash (W25Q128FV)
>   - 1+4x 10/100 Mbps Ethernet
>   - QCA9887 1T1R 802.11ac
> 
> Signed-off-by: Daniel Golle <daniel at makrotopia.org>
> ---
>   .../linux/ar71xx/base-files/etc/board.d/02_network |  1 +
>   .../etc/hotplug.d/firmware/11-ath10k-caldata       |  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-gs-oolite.c  | 41 ++++++++++++++++++++++
>   .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |  1 +
>   target/linux/ar71xx/generic/config-default         |  1 +
>   target/linux/ar71xx/image/generic.mk               | 10 ++++++
>   12 files changed, 73 insertions(+)
> 
> 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 f131b3b633..002ad977b7 100755
> --- a/target/linux/ar71xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
> @@ -322,6 +322,7 @@ ar71xx_setup_interfaces()
>   		;;
>   	dir-615-i1|\
>   	omy-g1|\
> +	oolite-v5.2|\

If you reorder ath79_register_eth() calls in your mach file, you could 
use a more common lan/wan mapping: eth0/eth1.

With your current setup, failsafe probably doesn't work (eth0 is the 
default interface in failsafe mode).

>   	r6100|\
>   	smart-300|\
>   	tl-wdr6500-v2|\
> diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 8284550e92..f7bffe8232 100644
> --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
> @@ -67,6 +67,7 @@ case "$FIRMWARE" in
>   	cf-e380ac-v1|\
>   	cf-e380ac-v2|\
>   	dlan-pro-1200-ac|\
> +	oolite-v5.2|\
>   	sr3200|\
>   	xd3200)
>   		ath10kcal_extract "art" 20480 2116
> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> index a255b83802..0dfb278792 100755
> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
> @@ -850,6 +850,9 @@ ar71xx_board_detect() {
>   	*"Oolite V1.0")
>   		name="oolite"
>   		;;
> +	*"Oolite V5.2")
> +		name="oolite-v5.2"
> +		;;
>   	*"PB42")
>   		name="pb42"
>   		;;
> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> index 8f56d1a8f6..23e45e941f 100755
> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
> @@ -391,6 +391,7 @@ platform_check_image() {
>   	omy-x1|\
>   	onion-omega|\
>   	oolite|\
> +	oolite-v5.2|\
>   	re355|\
>   	re450|\
>   	rut900|\
> diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
> index 068b83ce8a..d2c4472cd3 100644
> --- a/target/linux/ar71xx/config-4.4
> +++ b/target/linux/ar71xx/config-4.4
> @@ -123,6 +123,7 @@ CONFIG_ATH79=y
>   # CONFIG_ATH79_MACH_GL_USB150 is not set
>   # CONFIG_ATH79_MACH_GS_MINIBOX_V1 is not set
>   # CONFIG_ATH79_MACH_GS_OOLITE is not set
> +# CONFIG_ATH79_MACH_GS_OOLITE_V5_2 is not set
>   # CONFIG_ATH79_MACH_HIVEAP_121 is not set
>   # CONFIG_ATH79_MACH_HIWIFI_HC6361 is not set
>   # CONFIG_ATH79_MACH_HORNET_UB is not set
> diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9
> index e495f6b4c2..dd5c63dcd5 100644
> --- a/target/linux/ar71xx/config-4.9
> +++ b/target/linux/ar71xx/config-4.9
> @@ -121,6 +121,7 @@ CONFIG_ATH79=y
>   # CONFIG_ATH79_MACH_GL_USB150 is not set
>   # CONFIG_ATH79_MACH_GS_MINIBOX_V1 is not set
>   # CONFIG_ATH79_MACH_GS_OOLITE is not set
> +# CONFIG_ATH79_MACH_GS_OOLITE_V5_2 is not set
>   # CONFIG_ATH79_MACH_HIVEAP_121 is not set
>   # CONFIG_ATH79_MACH_HIWIFI_HC6361 is not set
>   # CONFIG_ATH79_MACH_HORNET_UB is not set
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> index 248bffb1f5..e7fc8db78c 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
> @@ -878,6 +878,17 @@ config ATH79_MACH_GS_OOLITE
>   	select ATH79_DEV_USB
>   	select ATH79_DEV_WMAC
>   
> +config ATH79_MACH_GS_OOLITE_V5_2
> +	bool "GS Oolite V5.2 support"
> +	select SOC_QCA953X
> +	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
> +	select ATH79_DEV_USB
> +	select ATH79_DEV_WMAC
> +
>   config ATH79_MACH_HIVEAP_121
>   	bool "Aerohive HiveAP-121 support"
>   	select SOC_AR934X
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> index 98d4677a5f..cfa7edb1fe 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
> @@ -131,6 +131,7 @@ obj-$(CONFIG_ATH79_MACH_GL_MIFI)		+= mach-gl-mifi.o
>   obj-$(CONFIG_ATH79_MACH_GL_USB150)		+= mach-gl-usb150.o
>   obj-$(CONFIG_ATH79_MACH_GS_MINIBOX_V1)		+= mach-gs-minibox-v1.o
>   obj-$(CONFIG_ATH79_MACH_GS_OOLITE)		+= mach-gs-oolite.o
> +obj-$(CONFIG_ATH79_MACH_GS_OOLITE_V5_2)		+= mach-gs-oolite.o
>   obj-$(CONFIG_ATH79_MACH_HIVEAP_121)		+= mach-hiveap-121.o
>   obj-$(CONFIG_ATH79_MACH_HIWIFI_HC6361)		+= mach-hiwifi-hc6361.o
>   obj-$(CONFIG_ATH79_MACH_HORNET_UB)		+= mach-hornet-ub.o
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite.c
> index c6cb61c366..a4849c96c6 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite.c
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gs-oolite.c
> @@ -20,6 +20,7 @@
>   #include "dev-wmac.h"
>   #include "machtypes.h"
>   #include "dev-usb.h"
> +#include "dev-ap9x-pci.h"
>   
>   #define GS_OOLITE_GPIO_BTN6		6
>   #define GS_OOLITE_GPIO_BTN7		7
> @@ -101,3 +102,43 @@ static void __init gs_oolite_setup(void)
>   
>   MIPS_MACHINE(ATH79_MACH_GS_OOLITE, "GS-OOLITE",
>   	     "Oolite V1.0", gs_oolite_setup);
> +
> +static void __init gs_oolite52_setup(void)
> +{
> +	u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
> +	u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
> +	u8 *ee10k = (u8 *) KSEG1ADDR(0x1fff5000);
> +
> +	ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE,
> +				  AR934X_GPIO_FUNC_CLK_OBS4_EN);
> +
> +	ath79_register_usb();
> +
> +	ath79_register_m25p80(&gs_oolite_flash_data);
> +
> +	ath79_register_mdio(0, 0x0);
> +
> +	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
> +	ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
> +

Here, just reorder these two blocks (remember to swap also MAC above):

> +	/* WAN port */
> +	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
> +	ath79_eth0_data.speed = SPEED_100;
> +	ath79_eth0_data.duplex = DUPLEX_FULL;
> +	ath79_eth0_data.phy_mask = BIT(4);
> +	ath79_register_eth(0);
> +
> +	/* LAN ports */
> +	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
> +	ath79_eth1_data.speed = SPEED_1000;
> +	ath79_eth1_data.duplex = DUPLEX_FULL;
> +	ath79_switch_data.phy_poll_mask |= BIT(4);
> +	ath79_switch_data.phy4_mii_en = 1;
> +	ath79_register_eth(1);
> +
> +	ath79_register_wmac(ee, mac);
> +	ap91_pci_init(ee10k, NULL);

Please, use ath79_register_pci() instead.

> +}
> +
> +MIPS_MACHINE(ATH79_MACH_GS_OOLITE_V5_2, "OOLITE_V5_2",
> +	     "Oolite V5.2", gs_oolite52_setup);
> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> index 497d794e01..521d45f1d5 100644
> --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
> @@ -123,6 +123,7 @@ enum ath79_mach_type {
>   	ATH79_MACH_GL_USB150,			/* GL.iNet GL-USB150 */
>   	ATH79_MACH_GS_MINIBOX_V1,		/* Gainstrong MiniBox V1.0 */
>   	ATH79_MACH_GS_OOLITE,			/* GS OOLITE V1.0 */
> +	ATH79_MACH_GS_OOLITE_V5_2,		/* GS OOLITE V5.2 */
>   	ATH79_MACH_HIVEAP_121,			/* Aerohive HiveAP-121*/
>   	ATH79_MACH_HIWIFI_HC6361,		/* HiWiFi HC6361 */
>   	ATH79_MACH_HORNET_UB,			/* ALFA Networks Hornet-UB */
> diff --git a/target/linux/ar71xx/generic/config-default b/target/linux/ar71xx/generic/config-default
> index 9caf29aa5f..74dcc532a3 100644
> --- a/target/linux/ar71xx/generic/config-default
> +++ b/target/linux/ar71xx/generic/config-default
> @@ -94,6 +94,7 @@ CONFIG_ATH79_MACH_GL_MIFI=y
>   CONFIG_ATH79_MACH_GL_USB150=y
>   CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
>   CONFIG_ATH79_MACH_GS_OOLITE=y
> +CONFIG_ATH79_MACH_GS_OOLITE_V5_2=y
>   CONFIG_ATH79_MACH_HIWIFI_HC6361=y
>   CONFIG_ATH79_MACH_HORNET_UB=y
>   CONFIG_ATH79_MACH_JA76PF=y
> diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
> index eeefde0a98..5f77edaecf 100644
> --- a/target/linux/ar71xx/image/generic.mk
> +++ b/target/linux/ar71xx/image/generic.mk
> @@ -855,6 +855,16 @@ define Device/oolite
>   endef
>   TARGET_DEVICES += oolite
>   
> +define Device/oolite-v5.2
> +  $(Device/tplink-16mlzma)
> +  DEVICE_TITLE := Gainstrong OOLITE V5.2
> +  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k ath10k-firmware-qca9887

Personally I prefer to include only packages which are used/required in 
default image. As there is no LED configured for the USB, please drop 
kmod-usb-ledtrig-usbport.

-- 
Cheers,
Piotr



More information about the Lede-dev mailing list