From b6379896277efce18a1f8e63ca5d66caf077d823 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0tetiar?= Date: Wed, 2 Jun 2021 15:30:59 +0200 Subject: [PATCH] imx: add support for Toradex Colibri iMX6ULL Aster MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add support for Toradex Colibri iMX6ULL 256MB module on Aster carrier board. The Colibri iMX6ULL is a SODIMM-sized SoM based on NXP i.MX 6ULL application processor, featuring a power-efficient Arm Cortex-A7 core. Aster is a carrier board for the Colibri Family of Computer on Modules. Aster carrier board has headers compatible with Arduino Uno and Raspberry Pi (RPi) maker board, thus enabling users to use a huge variety of third party shields/add-on boards. Specifications of iMX6ULL: - CPU: i.MX 6ULL, 1x Arm Cortex-A7 (528-900MHz) - RAM: 256-512MB DDR3L (16 Bit) - Flash: 512MB SLC NAND (MX30LF4G28AC) Specifications of Aster carrier board: - USB 2.0: 2x Host, 1x Client (Shared) - 10/100 Mbit Ethernet (KSZ8041) - 1x I2C, 1x SPI, 4x PWM, 4x ADC, 1x CAN, up to 3x LEDs, up to 39 GPIOs - Audio out: 1x (Stereo), Audio in: 1x (Stereo) - 1x Camera Parallel Interface, 4-wire Resistive Touch - Battery backed M41T0M6 RTC module - JTAG Flashing instructions: 1. Boot initramfs image from U-Boot setenv bootfile openwrt-imx-cortexa7-toradex_colibri-imx6ull-aster-initramfs-fit-zImage.itb run setup && tftpboot ${kernel_addr_r} ${bootfile} && bootm ${kernel_addr_r} 2. Download openwrt-imx-cortexa7-toradex_colibri-imx6ull-aster-squashfs-sysupgrade.tar to device 3. Run sysupgrade Signed-off-by: Petr Å tetiar --- .../boot/uboot-envtools/files/imx_cortexa9 | 3 + package/boot/uboot-imx/Makefile | 9 + ...-Makefile-add-u-boot-nand.imx-target.patch | 72 +++++++ target/linux/imx/Makefile | 2 +- .../base-files/etc/board.d/02_network | 3 +- .../base-files/lib/upgrade/platform.sh | 9 +- target/linux/imx/cortexa7/config-default | 1 + target/linux/imx/image/cortexa7.mk | 24 +++ ...add-support-for-Toradex-Aster-carrie.patch | 190 ++++++++++++++++++ 9 files changed, 309 insertions(+), 4 deletions(-) create mode 100644 package/boot/uboot-imx/patches/0002-Makefile-add-u-boot-nand.imx-target.patch create mode 100644 target/linux/imx/patches-5.10/500-ARM-dts-imx6ull-add-support-for-Toradex-Aster-carrie.patch diff --git a/package/boot/uboot-envtools/files/imx_cortexa9 b/package/boot/uboot-envtools/files/imx_cortexa9 index c6d6d94d16..89204f0ade 100644 --- a/package/boot/uboot-envtools/files/imx_cortexa9 +++ b/package/boot/uboot-envtools/files/imx_cortexa9 @@ -53,6 +53,9 @@ toradex,apalis_imx6q-ixora|\ toradex,apalis_imx6q-ixora-v1.1) ubootenv_add_uci_config $(bootdev_from_uuid)boot0 -0x2200 0x2000 0x200 10 ;; +toradex,colibri-imx6ull-aster) + ubootenv_add_uci_config /dev/mtd3 0 0x00020000 0x20000 + ;; wand,imx6dl-wandboard) ubootenv_add_uci_config "/dev/mmcblk0" "0x60000" "0x2000" "0x2000" ;; diff --git a/package/boot/uboot-imx/Makefile b/package/boot/uboot-imx/Makefile index ade26db768..1e9c50ad5d 100644 --- a/package/boot/uboot-imx/Makefile +++ b/package/boot/uboot-imx/Makefile @@ -28,6 +28,14 @@ define U-Boot/apalis_imx6 BUILD_DEVICES:=toradex_apalis endef +define U-Boot/colibri-imx6ull + NAME:=Toradex Colibri iMX6ULL + UBOOT_IMAGE:=u-boot-nand.imx + UBOOT_MAKE_FLAGS+=u-boot-nand.imx CONFIG_IMX_NAND=y + BUILD_SUBTARGET:=cortexa7 + BUILD_DEVICES:=colibri-imx6ull +endef + define U-Boot/mx6cuboxi NAME:=SolidRun Cubox-i boards UBOOT_IMAGE:=SPL u-boot-dtb.img @@ -52,6 +60,7 @@ endef UBOOT_TARGETS := \ apalis_imx6 \ + colibri-imx6ull \ mx6cuboxi \ pico-pi-imx7d \ wandboard diff --git a/package/boot/uboot-imx/patches/0002-Makefile-add-u-boot-nand.imx-target.patch b/package/boot/uboot-imx/patches/0002-Makefile-add-u-boot-nand.imx-target.patch new file mode 100644 index 0000000000..c45bff3d79 --- /dev/null +++ b/package/boot/uboot-imx/patches/0002-Makefile-add-u-boot-nand.imx-target.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Oleksandr Suvorov +Date: Thu, 13 May 2021 23:09:35 +0300 +Subject: [PATCH] Makefile: add u-boot-nand.imx target + +NAND modules (Colibri Vybrid, iMX7, iMX6ULL) require the images with +1024 prepending bytes. +Add the u-boot-nand.imx target which enables with CONFIG_IMX_NAND +option. + +Signed-off-by: Oleksandr Suvorov +--- + Makefile | 4 ++++ + arch/arm/config.mk | 4 ++++ + arch/arm/mach-imx/Makefile | 8 ++++++++ + 3 files changed, 16 insertions(+) + +diff --git a/Makefile b/Makefile +index 7b526f4f5a88..3e3e6ff9ffab 100644 +--- a/Makefile ++++ b/Makefile +@@ -1166,6 +1166,10 @@ ifeq ($(CONFIG_MULTI_DTB_FIT),y) + IMX_DEPS = u-boot-fit-dtb.bin + endif + ++u-boot-nand.imx: u-boot.imx ++ $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@ ++ $(BOARD_SIZE_CHECK) ++ + %.imx: $(IMX_DEPS) %.bin + $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@ + $(BOARD_SIZE_CHECK) +diff --git a/arch/arm/config.mk b/arch/arm/config.mk +index 4153f7e37130..5993827cdd66 100644 +--- a/arch/arm/config.mk ++++ b/arch/arm/config.mk +@@ -157,12 +157,16 @@ ifndef CONFIG_SPL_BUILD + INPUTS-y += SPL + endif + else ++ifeq ($(CONFIG_IMX_NAND),y) ++ALL-y += u-boot-nand.imx ++else + ifeq ($(CONFIG_OF_SEPARATE),y) + INPUTS-y += u-boot-dtb.imx + else + INPUTS-y += u-boot.imx + endif + endif ++endif + ifneq ($(CONFIG_VF610),) + INPUTS-y += u-boot.vyb + endif +diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile +index e6b4654cd358..a2fdbdd6387c 100644 +--- a/arch/arm/mach-imx/Makefile ++++ b/arch/arm/mach-imx/Makefile +@@ -121,6 +121,14 @@ u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log + u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE + $(call if_changed,mkimage) + ++ifeq ($(CONFIG_IMX_NAND),y) ++cmd_u-boot-nand_imx = (dd bs=1024 count=1 if=/dev/zero 2>/dev/null) | \ ++ cat - $< > $@ ++ ++u-boot-nand.imx: u-boot.imx FORCE ++ $(call if_changed,u-boot-nand_imx) ++endif ++ + ifeq ($(CONFIG_MULTI_DTB_FIT),y) + MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ + -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE) diff --git a/target/linux/imx/Makefile b/target/linux/imx/Makefile index 5fb7a4d339..753065f540 100644 --- a/target/linux/imx/Makefile +++ b/target/linux/imx/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=imx BOARDNAME:=NXP i.MX -FEATURES:=audio display fpu gpio pcie rtc usb usbgadget squashfs targz nand ubifs boot-part rootfs-part +FEATURES:=audio display fpu gpio pcie rtc usb usbgadget squashfs targz nand ubifs boot-part rootfs-part separate_ramdisk SUBTARGETS:=cortexa7 cortexa9 KERNEL_PATCHVER:=5.15 diff --git a/target/linux/imx/cortexa7/base-files/etc/board.d/02_network b/target/linux/imx/cortexa7/base-files/etc/board.d/02_network index 8ada58e6c1..e260af7d4a 100644 --- a/target/linux/imx/cortexa7/base-files/etc/board.d/02_network +++ b/target/linux/imx/cortexa7/base-files/etc/board.d/02_network @@ -5,7 +5,8 @@ board=$(board_name) board_config_update case "$board" in -technexion,imx7d-pico-pi) +technexion,imx7d-pico-pi|\ +toradex,colibri-imx6ull-aster) ucidef_set_interface_lan "eth0" ;; *) diff --git a/target/linux/imx/cortexa7/base-files/lib/upgrade/platform.sh b/target/linux/imx/cortexa7/base-files/lib/upgrade/platform.sh index 1bdc2aa4b9..3656378fbf 100644 --- a/target/linux/imx/cortexa7/base-files/lib/upgrade/platform.sh +++ b/target/linux/imx/cortexa7/base-files/lib/upgrade/platform.sh @@ -4,7 +4,8 @@ RAMFS_COPY_BIN='blkid jffs2reset' enable_image_metadata_check() { case "$(board_name)" in - technexion,imx7d-pico-pi) + technexion,imx7d-pico-pi|\ + toradex,colibri-imx6ull-aster) REQUIRE_IMAGE_METADATA=1 ;; esac @@ -15,7 +16,8 @@ platform_check_image() { local board=$(board_name) case "$board" in - technexion,imx7d-pico-pi) + technexion,imx7d-pico-pi|\ + toradex,colibri-imx6ull-aster) return 0 ;; esac @@ -31,6 +33,9 @@ platform_do_upgrade() { technexion,imx7d-pico-pi) imx_sdcard_do_upgrade "$1" ;; + toradex,colibri-imx6ull-aster) + nand_do_upgrade "$1" + ;; esac } diff --git a/target/linux/imx/cortexa7/config-default b/target/linux/imx/cortexa7/config-default index 10f23be435..52d1913940 100644 --- a/target/linux/imx/cortexa7/config-default +++ b/target/linux/imx/cortexa7/config-default @@ -64,6 +64,7 @@ CONFIG_JFFS2_FS=y CONFIG_KCMP=y CONFIG_LEDS_GPIO=y CONFIG_MEMORY_ISOLATION=y +CONFIG_MICREL_PHY=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIT_FW=y diff --git a/target/linux/imx/image/cortexa7.mk b/target/linux/imx/image/cortexa7.mk index b4ac1b6904..f57456baba 100644 --- a/target/linux/imx/image/cortexa7.mk +++ b/target/linux/imx/image/cortexa7.mk @@ -28,3 +28,27 @@ define Device/technexion_imx7d-pico-pi IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += technexion_imx7d-pico-pi + +define Device/toradex_colibri-imx6ull-aster + DEVICE_VENDOR := Toradex + DEVICE_MODEL := Colibri iMX6ULL Aster + DEVICE_DTS := imx6ull-colibri-aster + DEVICE_PACKAGES := \ + kmod-can kmod-can-flexcan kmod-can-raw \ + kmod-leds-gpio kmod-gpio-button-hotplug \ + kmod-pps-gpio kmod-rtc-ds1307 + FILESYSTEMS := squashfs + KERNEL = kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_SUFFIX := -fit-zImage.itb + KERNEL_INITRAMFS := kernel-bin | gzip | \ + fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd + PAGESIZE := 2048 + BLOCKSIZE := 128k + KERNEL_SIZE := 4096k + KERNEL_IN_UBI := 1 + IMAGES := factory.bin sysupgrade.tar + IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata + IMAGE/factory.bin := append-ubi + SUPPORTED_DEVICES := toradex,colibri-imx6ull-aster +endef +TARGET_DEVICES += toradex_colibri-imx6ull-aster diff --git a/target/linux/imx/patches-5.10/500-ARM-dts-imx6ull-add-support-for-Toradex-Aster-carrie.patch b/target/linux/imx/patches-5.10/500-ARM-dts-imx6ull-add-support-for-Toradex-Aster-carrie.patch new file mode 100644 index 0000000000..58e40a6c1b --- /dev/null +++ b/target/linux/imx/patches-5.10/500-ARM-dts-imx6ull-add-support-for-Toradex-Aster-carrie.patch @@ -0,0 +1,190 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20=C5=A0tetiar?= +Date: Wed, 2 Jun 2021 15:00:52 +0200 +Subject: [PATCH] ARM: dts: imx6ull: add support for Toradex Aster carrier + board +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for iMX6ULL SoM attached to Toradex Aster carrier board. + +Signed-off-by: Petr Å tetiar +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/imx6ull-colibri-aster.dts | 14 ++ + arch/arm/boot/dts/imx6ull-colibri-aster.dtsi | 132 +++++++++++++++++++ + 3 files changed, 147 insertions(+) + create mode 100644 arch/arm/boot/dts/imx6ull-colibri-aster.dts + create mode 100644 arch/arm/boot/dts/imx6ull-colibri-aster.dtsi + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index ce66ffd5a1bb..2ea850a50f60 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -627,6 +627,7 @@ dtb-$(CONFIG_SOC_IMX6UL) += \ + imx6ul-tx6ul-0011.dtb \ + imx6ul-tx6ul-mainboard.dtb \ + imx6ull-14x14-evk.dtb \ ++ imx6ull-colibri-aster.dtb \ + imx6ull-colibri-eval-v3.dtb \ + imx6ull-colibri-wifi-eval-v3.dtb \ + imx6ull-myir-mys-6ulx-eval.dtb \ +diff --git a/arch/arm/boot/dts/imx6ull-colibri-aster.dts b/arch/arm/boot/dts/imx6ull-colibri-aster.dts +new file mode 100644 +index 000000000000..0a314af5a728 +--- /dev/null ++++ b/arch/arm/boot/dts/imx6ull-colibri-aster.dts +@@ -0,0 +1,14 @@ ++// SPDX-License-Identifier: (GPL-2.0 OR MIT) ++/* ++ * Copyright 2017-2020 Toradex AG ++ * ++ */ ++ ++/dts-v1/; ++#include "imx6ull-colibri-nonwifi.dtsi" ++#include "imx6ull-colibri-aster.dtsi" ++ ++/ { ++ model = "Toradex Colibri iMX6ULL 256MB on Aster Carrier board"; ++ compatible = "toradex,colibri-imx6ull-aster", "fsl,imx6ull"; ++}; +diff --git a/arch/arm/boot/dts/imx6ull-colibri-aster.dtsi b/arch/arm/boot/dts/imx6ull-colibri-aster.dtsi +new file mode 100644 +index 000000000000..9ccbb330d528 +--- /dev/null ++++ b/arch/arm/boot/dts/imx6ull-colibri-aster.dtsi +@@ -0,0 +1,132 @@ ++// SPDX-License-Identifier: (GPL-2.0 OR MIT) ++/* ++ * Copyright 2018 Toradex AG ++ ++ */ ++ ++#include ++#include ++ ++/ { ++ chosen { ++ bootargs = "console=ttymxc0,115200"; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_snvs_gpiokeys>; ++ ++ power { ++ label = "Wake-Up"; ++ gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; ++ linux,code = ; ++ debounce-interval = <10>; ++ gpio-key,wakeup; ++ }; ++ }; ++ ++ extcon_usbc_det: usbc_det { ++ compatible = "linux,extcon-usb-gpio"; ++ debounce = <25>; ++ id-gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_snvs_usbc_det>; ++ }; ++ ++ reg_3v3: regulator-3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ }; ++ ++ reg_5v0: regulator-5v0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ reg_usbh_vbus: regulator-usbh-vbus { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_usbh_reg>; ++ regulator-name = "VCC_USB[1-4]"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ gpio = <&gpio1 2 GPIO_ACTIVE_LOW>; ++ vin-supply = <®_5v0>; ++ }; ++}; ++ ++&adc1 { ++ status = "okay"; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default", "gpio"; ++ pinctrl-0 = <&pinctrl_i2c1>; ++ pinctrl-1 = <&pinctrl_i2c1_gpio>; ++ sda-gpios = <&gpio1 29 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ scl-gpios = <&gpio1 28 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; ++ status = "okay"; ++ ++ /* M41T0M6 real time clock on carrier board */ ++ rtc: m41t0m6@68 { ++ compatible = "st,m41t0"; ++ reg = <0x68>; ++ }; ++}; ++ ++&pwm4 { ++ status = "okay"; ++}; ++ ++&pwm5 { ++ status = "okay"; ++}; ++ ++&pwm6 { ++ status = "okay"; ++}; ++ ++&pwm7 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&uart5 { ++ status = "okay"; ++}; ++ ++&usbotg1 { ++ status = "okay"; ++ extcon = <&extcon_usbc_det &extcon_usbc_det>; ++ vbus-supply = <®_usbh_vbus>; ++}; ++ ++&usbotg2 { ++ status = "okay"; ++ vbus-supply = <®_usbh_vbus>; ++}; ++ ++&usdhc1 { ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pinctrl_usdhc1 &pinctrl_snvs_usdhc1_cd>; ++ no-1-8-v; ++ cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>; ++ disable-wp; ++ enable-sdio-wakeup; ++ keep-power-in-suspend; ++ vmmc-supply = <®_3v3>; ++}; -- 2.30.2