[OpenWrt-Devel] [PATCH] mvebu: add support for GL.iNet GL-MV1000

Paul Spooren mail at aparcar.org
Sat Apr 11 01:09:59 EDT 2020


Hi Li Zhang,

thank you very much for the contribution! Please stick to the device
tree naming schema of `manufacture,model` when adding devices to
OpenWrt. In this case the device should be called `glinet,gl-vm1000`
instead of just `gl-mv1000`.

For the device profile (inline commented below), please replace the `,`
with a `_`.

On Sat Apr 11, 2020 at 2:18 AM PST, Li Zhang wrote:
> This patch adds supports for GL-MV1000.
>
> Specification:
> - SOC: Marvell Armada 88F3720 (1GHz)
> - Flash: 16MB
> - RAM: 1GB DDR4
> - Ethernet: 3x GE (1 WAN + 2 LAN)
> - EMMC: 8GB EMMC
> - MicroSD: 1x microSD slot
> - USB: 1x USB 2.0 port;1x USB 3.0 port(typec)
> - Button: 1x reset button
> - LED: 16x LEDs (3x GPIO controllable)
> - UART: 1x UART on PCB (JP1: 3.3V, RX, TX, GND)
>
> Signed-off-by: Li Zhang <li.zhang at gl-inet.com>
> ---
> package/boot/uboot-envtools/files/mvebu | 3 +
> .../linux/mvebu/base-files/etc/board.d/02_network | 3 +-
> .../linux/mvebu/base-files/lib/upgrade/platform.sh | 19 ++++++
> .../boot/dts/marvell/armada-gl-mv1000-emmc.dts | 68 +++++++++++++++++++
> .../arm64/boot/dts/marvell/armada-gl-mv1000.dts | 77
> ++++++++++++++++++++++
> target/linux/mvebu/image/Makefile | 15 +++++
> target/linux/mvebu/image/gen_mvebu_sdcard_img.sh | 6 ++
> .../mvebu/image/generic-arm64-emmc.bootscript | 12 ++++
> target/linux/mvebu/image/gl-mv1000.mk | 27 ++++++++
> 9 files changed, 229 insertions(+), 1 deletion(-)
> create mode 100644
> target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000-emmc.dts
> create mode 100644
> target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000.dts
> create mode 100644
> target/linux/mvebu/image/generic-arm64-emmc.bootscript
> create mode 100644 target/linux/mvebu/image/gl-mv1000.mk
>
> diff --git a/package/boot/uboot-envtools/files/mvebu
> b/package/boot/uboot-envtools/files/mvebu
> index c2e746d..d37c000 100644
> --- a/package/boot/uboot-envtools/files/mvebu
> +++ b/package/boot/uboot-envtools/files/mvebu
> @@ -24,6 +24,9 @@ globalscale,espressobin-v7-emmc|\
> marvell,armada8040-mcbin)
> ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
> ;;
> +gl-mv1000)

Please call your device within OpenWrt `glinet,gl-mv1000`.

> + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x8000" "1"
> + ;;
> linksys,caiman|\
> linksys,cobra|\
> linksys,shelby)
> diff --git a/target/linux/mvebu/base-files/etc/board.d/02_network
> b/target/linux/mvebu/base-files/etc/board.d/02_network
> index 0881910..65f13f1 100755
> --- a/target/linux/mvebu/base-files/etc/board.d/02_network
> +++ b/target/linux/mvebu/base-files/etc/board.d/02_network
> @@ -18,7 +18,8 @@ cznic,turris-omnia)
> globalscale,espressobin|\
> globalscale,espressobin-emmc|\
> globalscale,espressobin-v7|\
> -globalscale,espressobin-v7-emmc)
> +globalscale,espressobin-v7-emmc|\
> +gl-mv1000)
> ucidef_set_interfaces_lan_wan "lan0 lan1" "wan"
> ;;
> linksys,caiman|\
> diff --git a/target/linux/mvebu/base-files/lib/upgrade/platform.sh
> b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
> index 58e7d83..840eb9c 100755
> --- a/target/linux/mvebu/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
> @@ -19,6 +19,19 @@ platform_check_image() {
> esac
> }
>  
> +platform_do_upgrade_mv1000(){
> + local firmware=`fw_printenv firmware | awk -F '=' '{print $2}'`
> +
> + case "$firmware" in
> + gl-mv1000-emmc)
> + platform_do_upgrade_sdcard "$1"
> + ;;
> + *)
> + default_do_upgrade "$1"
> + ;;
> + esac
> +}
> +
> platform_do_upgrade() {
> case "$(board_name)" in
> linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom)
> @@ -28,6 +41,9 @@ platform_do_upgrade() {
> marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1)
> platform_do_upgrade_sdcard "$1"
> ;;
> + gl-mv1000)
> + platform_do_upgrade_mv1000 "$1"
> + ;;
> *)
> default_do_upgrade "$1"
> ;;
> @@ -42,5 +58,8 @@ platform_copy_config() {
> marvell,armada8040-mcbin|solidrun,clearfog-base-a1|solidrun,clearfog-pro-a1)
> platform_copy_config_sdcard
> ;;
> + gl-mv1000)
> + platform_copy_config_sdcard
> + ;;
> esac
> }
> diff --git
> a/target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000-emmc.dts
> b/target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000-emmc.dts
> new file mode 100644
> index 0000000..9e9c547
> --- /dev/null
> +++
> b/target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000-emmc.dts
> @@ -0,0 +1,68 @@
> +/*
> + * Device Tree file for GL.iNet GL-MV1000
> + */
> +
> +#include "armada-3720-espressobin.dts"
> +
> +/ {
> + model = "GL.inet GL-MV1000 (Marvell)";
> + compatible = "gl-mv1000";

Especially here `glinet,gl-mv1000`.

> +};
> +
> +&spi0 {
> + status = "okay";
> +
> + flash at 0 {
> + reg = <0>;
> + compatible = "jedec,spi-nor";
> + spi-max-frequency = <104000000>;
> + m25p,fast-read;
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition at 0 {
> + label = "u-boot";
> + reg = <0 0xf0000>;
> + };
> +
> + partition at f0000 {
> + label = "u-boot-env";
> + reg = <0Xf0000 0x8000>;
> + };
> +
> + art: partition at f8000 {
> + label = "art";
> + reg = <0xf8000 0x8000>;
> + };
> +
> + };
> + };
> +};
> +
> +&sdhci1 {
> + wp-inverted;
> + bus-width = <4>;
> + cd-gpios = <&gpionb 17 GPIO_ACTIVE_LOW>;
> + marvell,pad-type = "sd";
> + no-1-8-v;
> + vqmmc-supply = <&vcc_sd_reg1>;
> + status = "okay";
> +};
> +
> +
> +&sdhci0 {
> + bus-width = <8>;
> + mmc-ddr-1_8v;
> + mmc-hs400-1_8v;
> + non-removable;
> + no-sd;
> + no-sdio;
> + marvell,pad-type = "fixed-1-8v";
> + status = "okay";
> +};
> +
> +&eth0 {
> + mtd-mac-address = <&art 0x0>;
> +};
> diff --git
> a/target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000.dts
> b/target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000.dts
> new file mode 100644
> index 0000000..5c8c236
> --- /dev/null
> +++
> b/target/linux/mvebu/files-4.14/arch/arm64/boot/dts/marvell/armada-gl-mv1000.dts
> @@ -0,0 +1,77 @@
> +/*
> + * Device Tree file for GL.iNet GL-MV1000
> + */
> +
> +#include "armada-3720-espressobin.dts"
> +
> +/ {
> + model = "GL.inet GL-MV1000 (Marvell)";
> + compatible = "gl-mv1000";
> +};
> +
> +&spi0 {
> + status = "okay";
> +
> + flash at 0 {
> + reg = <0>;
> + compatible = "jedec,spi-nor";
> + spi-max-frequency = <104000000>;
> + m25p,fast-read;
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition at 0 {
> + label = "u-boot";
> + reg = <0 0xf0000>;
> + };
> +
> + partition at f0000 {
> + label = "u-boot-env";
> + reg = <0Xf0000 0x8000>;
> + };
> +
> + art: partition at f8000 {
> + label = "art";
> + reg = <0xf8000 0x8000>;
> + };
> +
> + partition at 100000{
> + label = "dtb";
> + reg = <0X100000 0x10000>;
> + };
> +
> + partition at 110000 {
> + label = "firmware";
> + reg = <0X110000 0xef0000>;
> + };
> + };
> + };
> +};
> +
> +&sdhci1 {
> + wp-inverted;
> + bus-width = <4>;
> + cd-gpios = <&gpionb 17 GPIO_ACTIVE_LOW>;
> + marvell,pad-type = "sd";
> + no-1-8-v;
> + vqmmc-supply = <&vcc_sd_reg1>;
> + status = "okay";
> +};
> +
> +
> +&sdhci0 {
> + bus-width = <8>;
> + mmc-ddr-1_8v;
> + mmc-hs400-1_8v;
> + non-removable;
> + no-sd;
> + no-sdio;
> + marvell,pad-type = "fixed-1-8v";
> + status = "okay";
> +};
> +
> +&eth0 {
> + mtd-mac-address = <&art 0x0>;
> +};
> diff --git a/target/linux/mvebu/image/Makefile
> b/target/linux/mvebu/image/Makefile
> index 57e5a30..d1a4b63 100644
> --- a/target/linux/mvebu/image/Makefile
> +++ b/target/linux/mvebu/image/Makefile
> @@ -68,6 +68,11 @@ define Build/omnia-medkit-initramfs
> --file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
> endef
>  
> +define Build/pad-dtb
> + (dd if=$(KDIR)/image-$(DEVICE_DTS).dtb bs=64k conv=sync;dd if=$@) >
> $@.new
> + mv $@.new $@
> +endef
> +
> define Device/Default
> PROFILES := Default
> BOARD_NAME = $$(DEVICE_DTS)
> @@ -92,6 +97,15 @@ define Device/Default-arm64
> KERNEL := kernel-bin
> endef
>  
> +define Device/Default-arm64-emmc
> + BOOT_SCRIPT := generic-arm64-emmc
> + DTS_DIR := $(DTS_DIR)/marvell
> + IMAGES := emmc.img
> + IMAGE/emmc.img := boot-scr | boot-img-ext4 | sdcard-img-ext4 |
> append-metadata
> + KERNEL_NAME := Image
> + KERNEL := kernel-bin
> +endef
> +
> define Device/NAND-128K
> BLOCKSIZE := 128k
> PAGESIZE := 2048
> @@ -112,5 +126,6 @@ endef
> include cortex-a9.mk
> include cortex-a53.mk
> include cortex-a72.mk
> +include gl-mv1000.mk
>  
> $(eval $(call BuildImage))
> diff --git a/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh
> b/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh
> index e0230e4..7696872 100755
> --- a/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh
> +++ b/target/linux/mvebu/image/gen_mvebu_sdcard_img.sh
> @@ -51,6 +51,12 @@ while [ "$#" -ge 3 ]; do
> shift; shift; shift
> done
>  
> +model=''
> +model=$(echo $OUTFILE | grep "gl-mv1000-emmc")
> +[ "$model" != "" ] && {
> + ptgen_args="$ptgen_args -t 83 -p 7093504"
> +}
> +
> head=16
> sect=63
>  
> diff --git a/target/linux/mvebu/image/generic-arm64-emmc.bootscript
> b/target/linux/mvebu/image/generic-arm64-emmc.bootscript
> new file mode 100644
> index 0000000..4de4d39
> --- /dev/null
> +++ b/target/linux/mvebu/image/generic-arm64-emmc.bootscript
> @@ -0,0 +1,12 @@
> +setenv bootargs "root=/dev/mmcblk0p2 rw rootwait"
> +
> +if test -n "${console}"; then
> + setenv bootargs "${bootargs} ${console}"
> +fi
> +
> +setenv mmcdev 0
> +
> +load mmc ${mmcdev}:1 ${fdt_addr} @DTB at .dtb
> +load mmc ${mmcdev}:1 ${kernel_addr} Image
> +
> +booti ${kernel_addr} - ${fdt_addr}
> diff --git a/target/linux/mvebu/image/gl-mv1000.mk
> b/target/linux/mvebu/image/gl-mv1000.mk
> new file mode 100644
> index 0000000..efce4bc
> --- /dev/null
> +++ b/target/linux/mvebu/image/gl-mv1000.mk
> @@ -0,0 +1,27 @@
> +ifeq ($(SUBTARGET),cortexa53)
> +
> +define Device/gl-mv1000

Please call the device profile `glinet_gl-mv1000`.

> + KERNEL_NAME := Image
> + KERNEL_LOADADDR := 0x000080000
> + KERNEL := kernel-bin | lzma | uImage lzma | pad-dtb
> + DEVICE_TITLE := GL.iNet GL-MV1000
> + DEVICE_PACKAGES := e2fsprogs ethtool mkf2fs kmod-fs-vfat kmod-usb2
> kmod-usb3 kmod-usb-storage
> + BLOCKSIZE := 64k
> + IMAGES := sysupgrade.bin
> + IMAGE_SIZE := 15000k
> + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |
> append-rootfs | pad-rootfs | append-metadata | check-size
> $$$$(IMAGE_SIZE)
> + DEVICE_DTS := armada-gl-mv1000
> + DTS_DIR := $(DTS_DIR)/marvell
> +endef
> +TARGET_DEVICES += gl-mv1000
> +
> +define Device/gl-mv1000-emmc
> + $(call Device/Default-arm64-emmc)
> + DEVICE_TITLE := GL.iNet GL-MV1000 EMMC
> + DEVICE_DTS := armada-gl-mv1000-emmc
> +endef
> +
> +TARGET_DEVICES += gl-mv1000-emmc
> +
> +endif
> +
> --
> 2.7.4
>
>
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list