[PATCH] ipq40xx: add support for GL.iNet GL-B2200-EMMC

Adrian Schmutzler mail at adrianschmutzler.de
Sat Apr 24 13:37:11 BST 2021


Hi,

just some selective feedback below:

> diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-
> wifi/Makefile
> index 7703604..7d592d9 100644
> --- a/package/firmware/ipq-wifi/Makefile
> +++ b/package/firmware/ipq-wifi/Makefile
> @@ -40,6 +40,7 @@ ALLWIFIBOARDS:= \
>  	ezviz_cs-w3-wd1200g-eup \
>  	glinet_gl-ap1300 \
>  	glinet_gl-s1300 \
> +	glinet_gl-b2200-emmc \

Wrong sorting ...

>  	linksys_ea8300 \
>  	linksys_mr8300-v0 \
>  	luma_wrtq-329acn \

[...]

> diff --git a/target/linux/ipq40xx/Makefile b/target/linux/ipq40xx/Makefile
> index 43b1fcb..c32515d 100644
> --- a/target/linux/ipq40xx/Makefile
> +++ b/target/linux/ipq40xx/Makefile
> @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk  ARCH:=arm  BOARD:=ipq40xx
> BOARDNAME:=Qualcomm Atheros IPQ40XX -FEATURES:=squashfs fpu
> ramdisk nand
> +FEATURES:=squashfs fpu ramdisk nand boot-part rootfs-part
>  CPU_TYPE:=cortex-a7
>  CPU_SUBTYPE:=neon-vfpv4
>  SUBTARGETS:=generic mikrotik
> diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network
> b/target/linux/ipq40xx/base-files/etc/board.d/02_network
> index 3f0209d..cd3d41a 100644
> --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
> +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
> @@ -99,6 +99,11 @@ ipq40xx_setup_interfaces()
>  		ucidef_add_switch "switch0" \
>  			"0u at eth0" "3:lan" "4:lan"
>  		;;
> +	glinet,gl-b2200-emmc)
> +		ucidef_set_interfaces_lan_wan "eth0" "eth1"
> +		ucidef_add_switch "switch0" \
> +			"0u at eth0" "1:lan" "2:lan" "3:lan" "5:lan" "0u at eth1"
> "4:wan"
> +		;;
>  	mobipromo,cm520-79f)
>  		ucidef_add_switch "switch0" \
>  			"0u at eth0" "3:lan:2" "4:lan:1"
> diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-
> ath10k-caldata b/target/linux/ipq40xx/base-
> files/etc/hotplug.d/firmware/11-ath10k-caldata
> index 0e027dd..b854dde 100644
> --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-
> caldata
> +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-c
> +++ aldata
> @@ -41,6 +41,7 @@ case "$FIRMWARE" in
>  		caldata_extract "0:ART" 0x9000 0x2f20
>  		;;
>  	linksys,ea8300 |\
> +	glinet,gl-b2200-emmc |\
>  	linksys,mr8300)

Sorting ... Maybe the block need to be moved as well ...

>  		caldata_extract "ART" 0x9000 0x2f20
>  		# OEM assigns 4 sequential MACs
> @@ -58,6 +59,7 @@ case "$FIRMWARE" in
>  	glinet,gl-ap1300 |\
>  	glinet,gl-b1300 |\
>  	glinet,gl-s1300 |\
> +	glinet,gl-b2200-emmc |\

Sorting ...

>  	linksys,ea6350v3 |\
>  	mobipromo,cm520-79f |\
>  	qcom,ap-dk01.1-c1)
> @@ -167,6 +169,7 @@ case "$FIRMWARE" in
>  	glinet,gl-ap1300 |\
>  	glinet,gl-b1300 |\
>  	glinet,gl-s1300 |\
> +	glinet,gl-b2200-emmc |\

Sorting ...

>  	linksys,ea6350v3 |\
>  	mobipromo,cm520-79f |\
>  	qcom,ap-dk01.1-c1)
> diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-
> b2200-emmc.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-
> ipq4019-gl-b2200-emmc.dts
> new file mode 100644
> index 0000000..c479859
> --- /dev/null
> +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200
> +++ -emmc.dts
> @@ -0,0 +1,374 @@
> +// SPDX-License-Identifier: GPL-2.0-only OR MIT
> +
> +#include "qcom-ipq4019.dtsi"
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +#include <dt-bindings/soc/qcom,tcsr.h>
> +
> +/ {
> +	model = "GL.iNet GL-B2200-EMMC";
> +	compatible = "glinet,gl-b2200-emmc";
> +
> +	aliases {
> +		led-boot = &led_power_blue;
> +		led-failsafe = &led_power_blue;
> +		led-running = &led_power_white;
> +		led-upgrade = &led_power_blue;
> +	};
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x80000000 0x10000000>;
> +	};
> +
> +	chosen {
> +		bootargs-append = " root=/dev/mmcblk0p2 rw rootwait
> clk_ignore_unused";
> +	};
> +
> +	soc {
> +		rng at 22000 {
> +			status = "okay";
> +		};
> +
> +		mdio at 90000 {
> +			status = "okay";
> +		};
> +
> +		ess-psgmii at 98000 {
> +			status = "okay";
> +		};
> +
> +		tcsr at 1949000 {
> +			compatible = "qcom,tcsr";
> +			reg = <0x1949000 0x100>;
> +			qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
> +		};
> +
> +		tcsr at 194b000 {
> +			/* select hostmode */
> +			compatible = "qcom,tcsr";
> +			reg = <0x194b000 0x100>;
> +			qcom,usb-hsphy-mode-select =
> <TCSR_USB_HSPHY_HOST_MODE>;
> +			status = "okay";
> +		};
> +
> +		ess_tcsr at 1953000 {
> +			compatible = "qcom,tcsr";
> +			reg = <0x1953000 0x1000>;
> +			qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
> +		};
> +
> +		tcsr at 1957000 {
> +			compatible = "qcom,tcsr";
> +			reg = <0x1957000 0x100>;
> +			qcom,wifi_noc_memtype_m0_m2 =
> <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
> +		};
> +
> +		crypto at 8e3a000 {
> +			status = "okay";
> +		};
> +
> +		ess-switch at c000000 {
> +			status = "okay";
> +			switch_lan_bmp = <0x2e>;
> +			switch_wan_bmp = <0x10>;
> +		};
> +
> +		edma at c080000 {
> +			status = "okay";
> +		};
> +	};
> +
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +
> +		wps {
> +			label = "wps";
> +			gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_WPS_BUTTON>;
> +			linux,input-type = <1>;

Please use the proper name named symbol instead.

> +		};
> +
> +		reset {
> +			label = "reset";
> +			gpios = <&tlmm 43 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_RESTART>;
> +			linux,input-type = <1>;

See above.

> +		};
> +	};
> +
> +	gpio-leds {
> +		compatible = "gpio-leds";
> +
> +		led_power_blue: power_blue {
> +			label = "power_blue_led";

Please use the proper color:function syntax for the label, i.e. blue:power in this case.

> +			gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>;
> +			default-state = "on";
> +		};
> +		internet_blue {
> +			label = "internet_blue_led";
> +			gpios = <&tlmm 60 GPIO_ACTIVE_HIGH>;
> +			default-state = "off";

"off" is default and can be removed here.

> +		};
> +		led_power_white: power_white {
> +			label = "power_white_led";
> +			gpios = <&tlmm 61 GPIO_ACTIVE_LOW>;
> +			default-state = "off";
> +		};
> +		internet_white {
> +			label = "nternet_white_led";
> +			gpios = <&tlmm 66 GPIO_ACTIVE_LOW>;
> +			default-state = "off";
> +		};
> +	};
> +};
> +
> +&gmac1 {
> +	qcom,phy_mdio_addr = <3>;
> +	qcom,poll_required = <1>;
> +	qcom,forced_speed = <1000>;
> +	qcom,forced_duplex = <1>;
> +	vlan_tag = <2 0x10>;
> +};
> +
> +&gmac0 {
> +	vlan_tag = <1 0x2e>;
> +};
> +
> +&vqmmc {
> +	status = "okay";
> +};
> +
> +&sdhci {
> +	status = "okay";
> +	pinctrl-0 = <&sd_pins>;
> +	pinctrl-names = "default";
> +	cd-gpios = <&tlmm 3 GPIO_ACTIVE_LOW>;
> +	vqmmc-supply = <&vqmmc>;
> +};
> +
> +&blsp_dma {
> +	status = "okay";
> +};
> +
> +&cryptobam {
> +	status = "okay";
> +};
> +
> +&blsp1_spi1 {
> +	pinctrl-0 = <&spi_0_pins>;
> +	pinctrl-names = "default";
> +	status = "okay";
> +	cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
> +
> +	flash at 0 {
> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <24000000>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			SBL1 at 0 {

Please use more generic "partition at 0" etc.

> +				label = "SBL1";
> +				reg = <0x0 0x40000>;
> +				read-only;
> +			};
> +
> +			MIBIB at 40000 {
> +				label = "MIBIB";
> +				reg = <0x40000 0x20000>;
> +				read-only;
> +			};
> +
> +			QSEE at 60000 {
> +				label = "QSEE";
> +				reg = <0x60000 0x60000>;
> +				read-only;
> +			};
> +
> +			CDT at c0000 {
> +				label = "CDT";
> +				reg = <0xc0000 0x10000>;
> +				read-only;
> +			};
> +
> +			DDRPARAMS at d0000 {
> +				label = "DDRPARAMS";
> +				reg = <0xd0000 0x10000>;
> +				read-only;
> +			};
> +
> +			APPSBLENV at e0000 {
> +				label = "APPSBLENV";
> +				reg = <0xe0000 0x10000>;
> +				read-only;
> +			};
> +
> +			APPSBL at f0000 {
> +				label = "APPSBL";
> +				reg = <0xf0000 0x80000>;
> +				read-only;
> +			};
> +
> +			ART at 170000 {
> +				label = "ART";
> +				reg = <0x170000 0x10000>;
> +				read-only;
> +			};
> +		};
> +	};
> +};
> +
> +&blsp1_spi2 {
> +	pinctrl-0 = <&spi_1_pins>;
> +	pinctrl-names = "default";
> +	status = "okay";
> +
> +	spidev1: spi at 0 {
> +		compatible = "siliconlabs,si3210";
> +		reg = <0>;
> +		spi-max-frequency = <24000000>;
> +	};
> +};
> +
> +&blsp1_uart1 {
> +	pinctrl-0 = <&serial_pins>;
> +	pinctrl-names = "default";
> +	status = "okay";
> +};
> +
> +&blsp1_uart2 {
> +	pinctrl-0 = <&serial_1_pins>;
> +	pinctrl-names = "default";
> +	status = "okay";
> +};
> +
> +&tlmm {
> +	serial_pins: serial_pinmux {
> +		mux {
> +			pins = "gpio16", "gpio17";
> +			function = "blsp_uart0";
> +			bias-disable;
> +		};
> +	};
> +
> +	serial_1_pins: serial1_pinmux {
> +		mux {
> +			pins = "gpio8", "gpio9",
> +				"gpio10", "gpio11";
> +			function = "blsp_uart1";
> +			bias-disable;
> +		};
> +	};
> +
> +	spi_0_pins: spi_0_pinmux {
> +		pinmux {
> +			function = "blsp_spi0";
> +			pins = "gpio13", "gpio14", "gpio15";
> +		};
> +		pinmux_cs {
> +			function = "gpio";
> +			pins = "gpio12";
> +		};
> +		pinconf {
> +			pins = "gpio13", "gpio14", "gpio15";
> +			drive-strength = <12>;
> +			bias-disable;
> +		};
> +		pinconf_cs {
> +			pins = "gpio12";
> +			drive-strength = <2>;
> +			bias-disable;
> +			output-high;
> +		};
> +	};
> +
> +	spi_1_pins: spi_1_pinmux {
> +		mux {
> +			pins = "gpio44", "gpio46", "gpio47";
> +			function = "blsp_spi1";
> +			bias-disable;
> +		};
> +		cs {
> +			pins = "gpio45";
> +			function = "gpio";
> +			bias-pull-up;
> +		};
> +		reset {
> +			pins = "gpio43";
> +			function = "gpio";
> +			output-high;
> +		};
> +		mux_2 {
> +			pins = "gpio35";
> +			function = "gpio";
> +			output-high;
> +		};
> +		host_int {
> +			pins = "gpio2";
> +			function = "gpio";
> +			input;
> +		};
> +		wake {
> +			pins = "gpio48";
> +			function = "gpio";
> +			output-high;
> +		};
> +	};
> +
> +	sd_pins: sd_pins {
> +		pinmux {
> +			function = "sdio";
> +			pins = "gpio23", "gpio24", "gpio25", "gpio26",
> +				"gpio29", "gpio30", "gpio31", "gpio32";
> +			drive-strength = <10>;
> +		};
> +
> +		pinmux_sd_clk {
> +			function = "sdio";
> +			pins = "gpio27";
> +			drive-strength = <16>;
> +		};
> +
> +		pinmux_sd7 {
> +			function = "sdio";
> +			pins = "gpio28";
> +			drive-strength = <10>;
> +			bias-disable;
> +		};
> +	};
> +
> +};
> +
> +&pcie0 {
> +	status = "okay";
> +	perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>;
> +	wake-gpio = <&tlmm 50 GPIO_ACTIVE_LOW>;
> +
> +	bridge at 0,0 {
> +		reg = <0x00000000 0 0 0 0>;
> +		#address-cells = <3>;
> +		#size-cells = <2>;
> +		ranges;
> +
> +		wifi2: wifi at 1,0 {
> +			status = "okay";
> +			compatible = "qcom,ath10k";
> +			reg = <0x00010000 0 0 0 0>;
> +			qcom,ath10k-calibration-variant = "GL-B2200-EMMC";
> +		};
> +	};
> +};
> +
> +&wifi0 {
> +	status = "okay";
> +	qcom,ath10k-calibration-variant = "GL-B2200-EMMC"; };
> +
> +&wifi1 {
> +	status = "okay";
> +	qcom,ath10k-calibration-variant = "GL-B2200-EMMC"; };
> diff --git a/target/linux/ipq40xx/image/gen_sdcard_img.sh
> b/target/linux/ipq40xx/image/gen_sdcard_img.sh
> new file mode 100755
> index 0000000..628ba24
> --- /dev/null
> +++ b/target/linux/ipq40xx/image/gen_sdcard_img.sh
> @@ -0,0 +1,95 @@
> +#!/bin/sh
> +#
> +# Copyright (C) 2016 Josua Mayer
> +#
> +# This program is free software; you can redistribute it and/or #
> +modify it under the terms of the GNU General Public License # as
> +published by the Free Software Foundation; either version 2 # of the
> +License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful, # but
> +WITHOUT ANY WARRANTY; without even the implied warranty of #
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the #
> GNU
> +General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License #
> +along with this program; if not, write to the Free Software #
> +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
> USA.
> +#

Please use the corresponding SPDX license identifier instead.

> +
> +usage() {
> +	echo "$0 <outfile> [<bootloader> <type_partitionN>
> <size_partitionN> <img_partitionN>]?"
> +}
> +
> +# always require first 2 or 3 arguments # then in pairs up to 8 more
> +for a total of up to 4 partitions if [ $# -lt 1 ] || [ $# -gt 14 ] || [
> +$((($# - 1) % 3)) -ne 0 ]; then
> +	if [ $# -lt 2 ] || [ $# -gt 15 ] || [ $((($# - 2) % 3)) -ne 0 ]; then
> +		usage
> +		exit 1
> +	else
> +		BOOTLOADER="$2"
> +	fi
> +fi
> +
> +set -e
> +
> +# parameters
> +OUTFILE="$1"; shift
> +if [ -n "$BOOTLOADER" ]; then
> +	shift
> +fi
> +
> +# generate image file
> +printf "Creating %s from /dev/zero: " "$OUTFILE"
> +dd if=/dev/zero of="$OUTFILE" bs=512 count=1 >/dev/null printf "Done\n"
> +
> +while [ "$#" -ge 3 ]; do
> +	ptgen_args="$ptgen_args -t $1 -p $(($2 * 1024 + 256))"
> +	parts="$parts$3 "
> +	shift; shift; shift
> +done
> +
> +model=''
> +model=$(echo $OUTFILE | grep "gl-b2200-emmc")
> +
> +# total emmc size = 7634944 KB
> +# partition interval = 1536 KB
> +# mbr = 1024 KB
> +# p1/p2 extra = 256KB
> +[ "$model" != "" ] && {
> +	ptgen_args="$ptgen_args -t 83 -p $((7634944-
> ${TARGET_KERNEL_PARTSIZE}*1024-${TARGET_ROOTFS_PARTSIZE}*1024-
> 1536-256-256-1024))"
> +}
> +
> +head=16
> +sect=63
> +
> +# create real partition table using fdisk printf "Creating partition
> +table: "
> +set $(ptgen -o "$OUTFILE" -h $head -s $sect -l 1024 -S 0x$SIGNATURE
> +$ptgen_args) printf "Done\n"
> +
> +# install bootloader
> +if [ -n "$BOOTLOADER" ]; then
> +	printf "Writing bootloader: "
> +	dd of="$OUTFILE" if="$BOOTLOADER" bs=512 seek=1 conv=notrunc
> 2>/dev/null
> +	printf "Done\n"
> +fi
> +
> +i=1
> +while [ "$#" -ge 2 ]; do
> +	img="${parts%% *}"
> +	parts="${parts#* }"
> +
> +	printf "Writing %s to partition %i: " "$img" $i
> +	(
> +		cat "$img"
> +		# add padding to avoid leaving behind old overlay fs data
> +		dd if=/dev/zero bs=128k count=1 2>/dev/null
> +	) | dd of="$OUTFILE" bs=512 seek=$(($1 / 512)) conv=notrunc
> 2>/dev/null
> +	printf "Done\n"
> +
> +	i=$((i+1))
> +	shift; shift
> +done
> diff --git a/target/linux/ipq40xx/image/generic.mk
> b/target/linux/ipq40xx/image/generic.mk
> index 4e40b8b..859903e 100644
> --- a/target/linux/ipq40xx/image/generic.mk
> +++ b/target/linux/ipq40xx/image/generic.mk
> @@ -508,6 +508,28 @@ define Device/glinet_gl-s1300  endef
> TARGET_DEVICES += glinet_gl-s1300
> 
> +define Build/sdcard-img-ext4
> +	SIGNATURE="$(IMG_PART_SIGNATURE)" \
> +
> 	TARGET_KERNEL_PARTSIZE="$(CONFIG_TARGET_KERNEL_PARTSIZE)
> " \
> +
> 	TARGET_ROOTFS_PARTSIZE="$(CONFIG_TARGET_ROOTFS_PARTSIZE
> )" \
> +	./gen_sdcard_img.sh $@ \
> +		83 $(CONFIG_TARGET_KERNEL_PARTSIZE) $(IMAGE_KERNEL)
> \
> +		83 $(CONFIG_TARGET_ROOTFS_PARTSIZE)
> $(IMAGE_ROOTFS) endef

Please move the build recipe to the top of the file like it's common for build recipes.

Best

Adrian

> +
> +define Device/glinet_gl-b2200-emmc
> +	$(call Device/FitImage)
> +	DEVICE_VENDOR := GL.iNet
> +	DEVICE_MODEL := GL-B2200-EMMC
> +	SOC := qcom-ipq4019
> +	DEVICE_DTS_CONFIG := config at ap.dk04.1-c3
> +	IMAGES := sdcard.img.gz
> +	IMAGE/sdcard.img.gz := sdcard-img-ext4 | gzip | append-metadata
> +	KERNEL_NAME := Image
> +	DEVICE_PACKAGES := ipq-wifi-glinet_gl-b2200-emmc kmod-fs-ext4
> kmod-mmc
> +kmod-spi-dev mkf2fs e2fsprogs kmod-fs-f2fs endef TARGET_DEVICES +=
> +glinet_gl-b2200-emmc
> +
>  define Device/linksys_ea6350v3
>  	# The Linksys EA6350v3 has a uboot bootloader that does not
>  	# support either booting lzma kernel images nor booting UBI diff --git
> a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch
> b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch
> index 6a421b9..4c9171c 100644
> --- a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch
> +++ b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch
> @@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
> 
>  --- a/arch/arm/boot/dts/Makefile
>  +++ b/arch/arm/boot/dts/Makefile
> -@@ -837,11 +837,59 @@ dtb-$(CONFIG_ARCH_QCOM) += \
> +@@ -837,11 +837,60 @@ dtb-$(CONFIG_ARCH_QCOM) += \
>   	qcom-apq8074-dragonboard.dtb \
>   	qcom-apq8084-ifc6540.dtb \
>   	qcom-apq8084-mtp.dtb \
> @@ -50,6 +50,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
>  +	qcom-ipq4019-fritzbox-7530.dtb \
>  +	qcom-ipq4019-fritzrepeater-1200.dtb \
>  +	qcom-ipq4019-fritzrepeater-3000.dtb \
> ++	qcom-ipq4019-gl-b2200-emmc.dtb \
>  +	qcom-ipq4019-map-ac2200.dtb \
>  +	qcom-ipq4019-mr8300.dtb \
>  +	qcom-ipq4019-e2600ac-c1.dtb \
> --
> 2.7.4
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20210424/9f6e65b8/attachment.sig>


More information about the openwrt-devel mailing list