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

Adrian Schmutzler mail at adrianschmutzler.de
Sat May 8 11:20:26 PDT 2021


Hi,

a few comment below.

> --- /dev/null
> +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200
> +++ -emmc.dts
> @@ -0,0 +1,366 @@
> +// 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";
> +
> +	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";
> +		};
> +	};
> +
> +	keys {
> +		compatible = "gpio-keys";
> +
> +		wps {
> +			label = "wps";
> +			gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_WPS_BUTTON>;
> +			linux,input-type = <1>;
> +		};
> +
> +		reset {
> +			label = "reset";
> +			gpios = <&tlmm 43 GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_RESTART>;
> +			linux,input-type = <1>;
> +		};
> +	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +
> +		blue_power {
> +			label = "blue:power";
> +			gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>;
> +			default-state = "on";
> +		};

These block should be separated by empty lines like all the others.

> +		blue_internet {
> +			label = "blue:internet";
> +			gpios = <&tlmm 60 GPIO_ACTIVE_HIGH>;
> +		};
> +		white_power {
> +			label = "white:power";
> +			gpios = <&tlmm 61 GPIO_ACTIVE_LOW>;
> +			default-state = "off";

Please remove _all_ default-state=off statement, they are default.

> +		};
> +		white_internet {
> +			label = "white:internet";
> +			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";

status should be followed by an empty line.

> +	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>;
> +
> +			partition at 0 {
> +				label = "SBL1";
> +				reg = <0x0 0x40000>;
> +				read-only;
> +			};
> +
> +			partition at 40000 {
> +				label = "MIBIB";
> +				reg = <0x40000 0x20000>;
> +				read-only;
> +			};
> +
> +			partition at 60000 {
> +				label = "QSEE";
> +				reg = <0x60000 0x60000>;
> +				read-only;
> +			};
> +
> +			partition at c0000 {
> +				label = "CDT";
> +				reg = <0xc0000 0x10000>;
> +				read-only;
> +			};
> +
> +			partition at d0000 {
> +				label = "DDRPARAMS";
> +				reg = <0xd0000 0x10000>;
> +				read-only;
> +			};
> +
> +			partition at e0000 {
> +				label = "APPSBLENV";
> +				reg = <0xe0000 0x10000>;
> +				read-only;
> +			};
> +
> +			partition at f0000 {
> +				label = "APPSBL";
> +				reg = <0xf0000 0x80000>;
> +				read-only;
> +			};
> +
> +			partition 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/files/arch/arm/boot/dts/qcom-ipq4029-gl-
> s1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-
> s1300.dts
> index fa859b7..66a6a01 100644
> --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-
> s1300.dts
> +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300
> +++ .dts
> @@ -9,13 +9,6 @@
>  	model = "GL.iNet GL-S1300";
>  	compatible = "glinet,gl-s1300";
> 
> -	aliases {
> -		led-boot = &led_power;
> -		led-failsafe = &led_power;
> -		led-running = &led_power;
> -		led-upgrade = &led_power;
> -	};
> -

This change is totally unrelated. I have not checked whether it makes sense ...
Please drop it.

>  	memory {
>  		device_type = "memory";
>  		reg = <0x80000000 0x10000000>;
> 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 an SPDX license identifier instead of the long license text.

> +#
> +
> +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..133942a 100644
> --- a/target/linux/ipq40xx/image/generic.mk
> +++ b/target/linux/ipq40xx/image/generic.mk
> @@ -71,6 +71,15 @@ define Build/qsdk-ipq-factory-nand-askey
>  	@mv $@.new $@
>  endef
> 
> +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
> +
>  define Build/SenaoFW
>  	-$(STAGING_DIR_HOST)/bin/mksenaofw \
>  		-n $(BOARD_NAME) -r $(VENDOR_ID) -p $(1) \ @@ -508,6
> +517,19 @@ define Device/glinet_gl-s1300  endef  TARGET_DEVICES +=
> glinet_gl-s1300
> 
> +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

Please wrap long lines (> 74 chars.).

> +
>  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 6b7c68b..1322cbb 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,60 @@ dtb-$(CONFIG_ARCH_QCOM) += \
> +@@ -837,11 +837,61 @@ dtb-$(CONFIG_ARCH_QCOM) += \
>   	qcom-apq8074-dragonboard.dtb \
>   	qcom-apq8084-ifc6540.dtb \
>   	qcom-apq8084-mtp.dtb \
> @@ -51,6 +51,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 \

Wrong indent here.

Best

Adrian

>  +	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/20210508/b32f6428/attachment-0001.sig>


More information about the openwrt-devel mailing list