Merge branch 'v2021.07-rc1' of https://github.com/lftan/u-boot
authorTom Rini <trini@konsulko.com>
Fri, 9 Apr 2021 17:10:38 +0000 (13:10 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 9 Apr 2021 17:10:38 +0000 (13:10 -0400)
251 files changed:
arch/arm/Kconfig
arch/arm/dts/Makefile
arch/arm/dts/imx23-olinuxino-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/imx23-olinuxino.dts [new file with mode: 0644]
arch/arm/dts/imx53-usbarmory.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw51xx.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw52xx.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw53xx.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw54xx.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw551x.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw552x.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw553x.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw560x.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw5903.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw5904.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw5907.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw5910.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw5912.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-gw5913.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-riotboard-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/imx6dl-riotboard.dts [new file with mode: 0644]
arch/arm/dts/imx6dl-udoo.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw51xx.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw52xx.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw53xx.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw54xx.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw551x.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw552x.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw553x.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw560x.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw5903.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw5904.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw5907.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw5910.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw5912.dts [new file with mode: 0644]
arch/arm/dts/imx6q-gw5913.dts [new file with mode: 0644]
arch/arm/dts/imx6q-marsboard-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/imx6q-marsboard.dts [new file with mode: 0644]
arch/arm/dts/imx6q-phytec-mira-rdk-nand-u-boot.dtsi
arch/arm/dts/imx6q-udoo.dts [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw51xx.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw52xx.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw53xx.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw54xx.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw551x.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw552x.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw553x.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw560x.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw5903.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw5904.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw5907.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw5910.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw5912.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-gw5913.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-udoo-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/imx6qdl-udoo.dtsi [new file with mode: 0644]
arch/arm/dts/imx8mm-evk-u-boot.dtsi
arch/arm/dts/imx8mm-evk.dtsi
arch/arm/dts/imx8mn-beacon-baseboard.dtsi
arch/arm/dts/imx8mn-beacon-som.dtsi
arch/arm/dts/imx8mn-ddr4-evk-u-boot.dtsi
arch/arm/dts/imx8mn-evk-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/imx8mn-evk.dts [new file with mode: 0644]
arch/arm/dts/imx8mn.dtsi
arch/arm/dts/imx8mp-evk-u-boot.dtsi
arch/arm/include/asm/arch-imx/cpu.h
arch/arm/include/asm/arch-imx8/image.h
arch/arm/include/asm/arch-imx8m/clock.h
arch/arm/include/asm/arch-imx8m/imx-regs.h
arch/arm/include/asm/arch-mx6/mx6ull_pins.h
arch/arm/include/asm/arch-mx7ulp/imx-regs.h
arch/arm/include/asm/mach-imx/hab.h
arch/arm/include/asm/mach-imx/sys_proto.h
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/cmd_dek.c
arch/arm/mach-imx/cmd_mfgprot.c [new file with mode: 0644]
arch/arm/mach-imx/cpu.c
arch/arm/mach-imx/hab.c
arch/arm/mach-imx/imx8/Kconfig
arch/arm/mach-imx/imx8m/Kconfig
arch/arm/mach-imx/imx8m/clock_imx8mm.c
arch/arm/mach-imx/imx8m/clock_imx8mq.c
arch/arm/mach-imx/imx8m/soc.c
arch/arm/mach-imx/imx_bootaux.c
arch/arm/mach-imx/mx7ulp/Kconfig
arch/arm/mach-imx/priblob.c [new file with mode: 0644]
arch/arm/mach-kirkwood/cpu.c
arch/riscv/Kconfig
arch/riscv/dts/Makefile
arch/riscv/dts/k210.dtsi
arch/riscv/dts/microchip-mpfs-icicle-kit.dts
arch/riscv/include/asm/string.h
arch/riscv/lib/Makefile
arch/riscv/lib/memcpy.S [new file with mode: 0644]
arch/riscv/lib/memmove.S [new file with mode: 0644]
arch/riscv/lib/memset.S [new file with mode: 0644]
arch/riscv/lib/setjmp.S
board/Synology/common/Makefile [new file with mode: 0644]
board/Synology/common/legacy.c [new file with mode: 0644]
board/Synology/common/legacy.h [new file with mode: 0644]
board/Synology/ds109/ds109.c
board/Synology/ds109/ds109.h
board/Synology/ds414/Kconfig [new file with mode: 0644]
board/Synology/ds414/cmd_syno.c
board/Synology/ds414/cmd_syno.h [new file with mode: 0644]
board/Synology/ds414/ds414.c
board/embest/mx6boards/mx6boards.c
board/freescale/imx8mm_evk/boot.cmd [deleted file]
board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg [new file with mode: 0644]
board/freescale/imx8mm_evk/lpddr4_timing.c
board/freescale/imx8mm_evk/spl.c
board/freescale/imx8mn_evk/Kconfig
board/freescale/imx8mn_evk/MAINTAINERS
board/freescale/imx8mn_evk/Makefile
board/freescale/imx8mn_evk/ddr4_timing.c
board/freescale/imx8mn_evk/ddr4_timing_ld.c [new file with mode: 0644]
board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg [new file with mode: 0644]
board/freescale/imx8mn_evk/lpddr4_timing.c [new file with mode: 0644]
board/freescale/imx8mn_evk/lpddr4_timing_ld.c [new file with mode: 0644]
board/freescale/imx8mn_evk/spl.c
board/freescale/imx8mp_evk/boot.cmd [deleted file]
board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg [new file with mode: 0644]
board/freescale/imx8mp_evk/lpddr4_timing.c
board/freescale/imx8mp_evk/spl.c
board/freescale/imx8mq_evk/spl.c
board/freescale/imxrt1020-evk/imxrt1020-evk.c
board/freescale/imxrt1050-evk/imxrt1050-evk.c
board/freescale/mx28evk/MAINTAINERS
board/freescale/mx6sabreauto/MAINTAINERS
board/freescale/mx6sabresd/MAINTAINERS
board/freescale/mx6slevk/MAINTAINERS
board/freescale/mx6sxsabreauto/MAINTAINERS
board/freescale/mx6sxsabresd/MAINTAINERS
board/gateworks/gw_ventana/MAINTAINERS
board/gateworks/gw_ventana/common.c
board/gateworks/gw_ventana/common.h
board/gateworks/gw_ventana/gsc.c
board/gateworks/gw_ventana/gsc.h
board/gateworks/gw_ventana/gw_ventana.c
board/gateworks/gw_ventana/gw_ventana_spl.c
board/gateworks/venice/gsc.c
board/olimex/mx23_olinuxino/mx23_olinuxino.c
board/phytec/phycore_imx8mp/spl.c
board/sifive/unleashed/Kconfig [moved from board/sifive/fu540/Kconfig with 91% similarity]
board/sifive/unleashed/MAINTAINERS [moved from board/sifive/fu540/MAINTAINERS with 50% similarity]
board/sifive/unleashed/Makefile [moved from board/sifive/fu540/Makefile with 87% similarity]
board/sifive/unleashed/spl.c [moved from board/sifive/fu540/spl.c with 100% similarity]
board/sifive/unleashed/unleashed.c [moved from board/sifive/fu540/fu540.c with 100% similarity]
board/sipeed/maix/Kconfig
board/solidrun/mx6cuboxi/MAINTAINERS
board/st/stm32f746-disco/stm32f746-disco.c
board/technexion/pico-imx6ul/MAINTAINERS
board/technexion/pico-imx6ul/pico-imx6ul.c
board/udoo/MAINTAINERS
board/udoo/udoo.c
board/wandboard/MAINTAINERS
board/warp7/MAINTAINERS
cmd/Kconfig
cmd/blob.c
common/spl/Kconfig
common/spl/spl_nand.c
configs/ds414_defconfig
configs/gwventana_emmc_defconfig
configs/gwventana_gw5904_defconfig
configs/gwventana_nand_defconfig
configs/imx8mm_evk_defconfig
configs/imx8mn_beacon_defconfig
configs/imx8mn_ddr4_evk_defconfig
configs/imx8mn_evk_defconfig [new file with mode: 0644]
configs/imx8mp_evk_defconfig
configs/marsboard_defconfig
configs/microchip_mpfs_icicle_defconfig
configs/mx23_olinuxino_defconfig
configs/riotboard_defconfig
configs/riotboard_spl_defconfig [deleted file]
configs/sheevaplug_defconfig
configs/sifive_unleashed_defconfig [moved from configs/sifive_fu540_defconfig with 95% similarity]
configs/sipeed_maix_smode_defconfig
configs/turris_omnia_defconfig
configs/udoo_defconfig
configs/usbarmory_defconfig
doc/board/freescale/imx8mm_evk.rst
doc/board/freescale/imx8mn_evk.rst
doc/board/freescale/imx8mp_evk.rst
doc/board/sifive/index.rst
doc/board/sifive/unleashed.rst [moved from doc/board/sifive/fu540.rst with 100% similarity]
doc/board/toradex/apalix-imx8x.rst
doc/imx/habv4/guides/mx6_mx7_secure_boot.txt
doc/imx/index.rst [new file with mode: 0644]
doc/imx/misc/index.rst [new file with mode: 0644]
doc/imx/misc/psb.rst [new file with mode: 0644]
doc/index.rst
drivers/clk/microchip/mpfs_clk.c
drivers/crypto/fsl/Kconfig
drivers/crypto/fsl/Makefile
drivers/crypto/fsl/desc.h
drivers/crypto/fsl/desc_constr.h
drivers/crypto/fsl/fsl_blob.c
drivers/crypto/fsl/fsl_hash.c
drivers/crypto/fsl/fsl_mfgprot.c [new file with mode: 0644]
drivers/crypto/fsl/jobdesc.c
drivers/crypto/fsl/jr.c
drivers/crypto/fsl/jr.h
drivers/crypto/fsl/type.h [new file with mode: 0644]
drivers/ddr/imx/imx8m/Kconfig
drivers/misc/mxc_ocotp.c
drivers/mmc/Kconfig
drivers/mmc/fsl_esdhc_imx.c
drivers/mmc/mvebu_mmc.c
drivers/mtd/nand/raw/mxs_nand_spl.c
drivers/power/pmic/pmic_pca9450.c
drivers/ram/sifive/Kconfig
drivers/reset/Kconfig
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/armada38x.c [new file with mode: 0644]
drivers/timer/sifive_clint_timer.c
drivers/watchdog/designware_wdt.c
include/configs/apalis_imx6.h
include/configs/clearfog.h
include/configs/colibri-imx6ull.h
include/configs/colibri_imx6.h
include/configs/colibri_imx7.h
include/configs/controlcenterdc.h
include/configs/db-88f6820-gp.h
include/configs/ds109.h
include/configs/ds414.h
include/configs/embestmx6boards.h
include/configs/gw_ventana.h
include/configs/helios4.h
include/configs/imx8mm_evk.h
include/configs/imx8mm_venice.h
include/configs/imx8mp_evk.h
include/configs/openrd.h
include/configs/pcm058.h
include/configs/sheevaplug.h
include/configs/sifive-unleashed.h [moved from include/configs/sifive-fu540.h with 100% similarity]
include/configs/sipeed-maix.h
include/configs/udoo.h
include/dt-bindings/media/tda1997x.h [new file with mode: 0644]
include/fsl_esdhc_imx.h
include/fsl_sec.h
include/mvebu_mmc.h
include/power/pca9450.h
scripts/config_whitelist.txt
test/lib/Makefile
test/lib/longjmp.c [new file with mode: 0644]
tools/imx8image.c
tools/imx8mimage.c
tools/logos/engicam.bmp [changed mode: 0755->0644]

index 3307f2b..76adf7f 100644 (file)
@@ -839,6 +839,9 @@ config ARCH_IMX8
 config ARCH_IMX8M
        bool "NXP i.MX8M platform"
        select ARM64
+       select SYS_FSL_HAS_SEC if IMX_HAB
+       select SYS_FSL_SEC_COMPAT_4
+       select SYS_FSL_SEC_LE
        select DM
        select SUPPORT_SPL
        imply CMD_DM
@@ -875,6 +878,9 @@ config ARCH_MX31
 config ARCH_MX7ULP
        bool "NXP MX7ULP"
        select CPU_V7A
+       select SYS_FSL_HAS_SEC if IMX_HAB
+       select SYS_FSL_SEC_COMPAT_4
+       select SYS_FSL_SEC_LE
        select ROM_UNIFIED_SECTIONS
        imply MXC_GPIO
        imply SYS_THUMB_BUILD
index cedddd3..4df1f03 100644 (file)
@@ -653,6 +653,9 @@ dtb-$(CONFIG_VF610) += vf500-colibri.dtb \
 dtb-$(CONFIG_MX23) += \
        imx23-evk.dtb
 
+dtb-$(CONFIG_TARGET_MX23_OLINUXINO) += \
+       imx23-olinuxino.dtb
+
 dtb-$(CONFIG_MX28) += \
        imx28-xea.dtb
 
@@ -662,7 +665,8 @@ dtb-$(CONFIG_MX51) += \
 dtb-$(CONFIG_MX53) += imx53-cx9020.dtb \
        imx53-qsb.dtb \
        imx53-kp.dtb \
-       imx53-m53menlo.dtb
+       imx53-m53menlo.dtb \
+       imx53-usbarmory.dtb
 
 ifneq ($(CONFIG_MX6DL)$(CONFIG_MX6QDL)$(CONFIG_MX6S),)
 dtb-y += \
@@ -673,6 +677,20 @@ dtb-y += \
        imx6dl-cubox-i-emmc-som-v15.dtb \
        imx6dl-cubox-i-som-v15.dtb \
        imx6dl-dhcom-pdk2.dtb \
+       imx6dl-gw51xx.dtb \
+       imx6dl-gw52xx.dtb \
+       imx6dl-gw53xx.dtb \
+       imx6dl-gw54xx.dtb \
+       imx6dl-gw551x.dtb \
+       imx6dl-gw552x.dtb \
+       imx6dl-gw553x.dtb \
+       imx6dl-gw560x.dtb \
+       imx6dl-gw5903.dtb \
+       imx6dl-gw5904.dtb \
+       imx6dl-gw5907.dtb \
+       imx6dl-gw5910.dtb \
+       imx6dl-gw5912.dtb \
+       imx6dl-gw5913.dtb \
        imx6dl-hummingboard2.dtb \
        imx6dl-hummingboard2-emmc-som-v15.dtb \
        imx6dl-hummingboard2-som-v15.dtb \
@@ -687,6 +705,8 @@ dtb-y += \
        imx6dl-mamoj.dtb \
        imx6dl-nitrogen6x.dtb \
        imx6dl-pico.dtb \
+       imx6dl-udoo.dtb \
+       imx6dl-riotboard.dtb \
        imx6dl-sabreauto.dtb \
        imx6dl-sabresd.dtb \
        imx6dl-wandboard-revd1.dtb \
@@ -702,6 +722,20 @@ dtb-y += \
        imx6q-cubox-i-som-v15.dtb \
        imx6q-dhcom-pdk2.dtb \
        imx6q-display5.dtb \
+       imx6q-gw51xx.dtb \
+       imx6q-gw52xx.dtb \
+       imx6q-gw53xx.dtb \
+       imx6q-gw54xx.dtb \
+       imx6q-gw551x.dtb \
+       imx6q-gw552x.dtb \
+       imx6q-gw553x.dtb \
+       imx6q-gw560x.dtb \
+       imx6q-gw5903.dtb \
+       imx6q-gw5904.dtb \
+       imx6q-gw5907.dtb \
+       imx6q-gw5910.dtb \
+       imx6q-gw5912.dtb \
+       imx6q-gw5913.dtb \
        imx6q-hummingboard2.dtb \
        imx6q-hummingboard2-emmc-som-v15.dtb \
        imx6q-hummingboard2-som-v15.dtb \
@@ -713,6 +747,7 @@ dtb-y += \
        imx6q-icore-rqs.dtb \
        imx6q-kp.dtb \
        imx6q-logicpd.dtb \
+       imx6q-marsboard.dtb \
        imx6q-mba6a.dtb \
        imx6q-mba6b.dtb \
        imx6q-mccmon6.dtb\
@@ -720,6 +755,7 @@ dtb-y += \
        imx6q-novena.dtb \
        imx6q-pico.dtb \
        imx6q-phytec-mira-rdk-nand.dtb \
+       imx6q-udoo.dtb \
        imx6q-sabreauto.dtb \
        imx6q-sabrelite.dtb \
        imx6q-sabresd.dtb \
@@ -799,6 +835,7 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
        imx8mm-verdin.dtb \
        phycore-imx8mm.dtb \
        imx8mn-ddr4-evk.dtb \
+       imx8mn-evk.dtb \
        imx8mq-evk.dtb \
        imx8mm-beacon-kit.dtb \
        imx8mn-beacon-kit.dtb \
diff --git a/arch/arm/dts/imx23-olinuxino-u-boot.dtsi b/arch/arm/dts/imx23-olinuxino-u-boot.dtsi
new file mode 100644 (file)
index 0000000..dee8433
--- /dev/null
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+&ssp0 {
+       non-removable;
+};
diff --git a/arch/arm/dts/imx23-olinuxino.dts b/arch/arm/dts/imx23-olinuxino.dts
new file mode 100644 (file)
index 0000000..0729e72
--- /dev/null
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <fabio.estevam@freescale.com>
+ */
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include "imx23.dtsi"
+
+/ {
+       model = "i.MX23 Olinuxino Low Cost Board";
+       compatible = "olimex,imx23-olinuxino", "fsl,imx23";
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x04000000>;
+       };
+
+       apb@80000000 {
+               apbh@80000000 {
+                       ssp0: spi@80010000 {
+                               compatible = "fsl,imx23-mmc";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&mmc0_4bit_pins_a &mmc0_sck_cfg>;
+                               bus-width = <4>;
+                               broken-cd;
+                               status = "okay";
+                       };
+
+                       pinctrl@80018000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&hog_pins_a>;
+
+                               hog_pins_a: hog@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX23_PAD_GPMI_ALE__GPIO_0_17
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_4mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_DISABLE>;
+                               };
+
+                               led_pin_gpio2_1: led_gpio2_1@0 {
+                                       reg = <0>;
+                                       fsl,pinmux-ids = <
+                                               MX23_PAD_SSP1_DETECT__GPIO_2_1
+                                       >;
+                                       fsl,drive-strength = <MXS_DRIVE_4mA>;
+                                       fsl,voltage = <MXS_VOLTAGE_HIGH>;
+                                       fsl,pull-up = <MXS_PULL_DISABLE>;
+                               };
+                       };
+
+                       ssp1: spi@80034000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "fsl,imx23-spi";
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&spi2_pins_a>;
+                               status = "okay";
+                       };
+               };
+
+               apbx@80040000 {
+                       lradc@80050000 {
+                               status = "okay";
+                       };
+
+                       i2c: i2c@80058000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&i2c_pins_b>;
+                               status = "okay";
+                       };
+
+                       duart: serial@80070000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&duart_pins_a>;
+                               status = "okay";
+                       };
+
+                       auart0: serial@8006c000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&auart0_2pins_a>;
+                               status = "okay";
+                       };
+
+                       usbphy0: usbphy@8007c000 {
+                               status = "okay";
+                       };
+               };
+       };
+
+       ahb@80080000 {
+               usb0: usb@80080000 {
+                       dr_mode = "host";
+                       vbus-supply = <&reg_usb0_vbus>;
+                       status = "okay";
+               };
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_usb0_vbus: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "usb0_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       startup-delay-us = <300>; /* LAN9215 requires a POR of 200us minimum */
+                       gpio = <&gpio0 17 0>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&led_pin_gpio2_1>;
+
+               user {
+                       label = "green";
+                       gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
diff --git a/arch/arm/dts/imx53-usbarmory.dts b/arch/arm/dts/imx53-usbarmory.dts
new file mode 100644 (file)
index 0000000..f34993a
--- /dev/null
@@ -0,0 +1,225 @@
+/*
+ * USB armory MkI device tree file
+ * https://inversepath.com/usbarmory
+ *
+ * Copyright (C) 2015, Inverse Path
+ * Andrej Rosano <andrej@inversepath.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx53.dtsi"
+
+/ {
+       model = "Inverse Path USB armory";
+       compatible = "inversepath,imx53-usbarmory", "fsl,imx53";
+};
+
+/ {
+       chosen {
+               stdout-path = &uart1;
+       };
+
+       memory@70000000 {
+               device_type = "memory";
+               reg = <0x70000000 0x20000000>;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_led>;
+
+               user {
+                       label = "LED";
+                       gpios = <&gpio4 27 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+};
+
+/*
+ * Not every i.MX53 P/N supports clock > 800MHz.
+ * As USB armory does not mount a specific P/N set a safe clock upper limit.
+ */
+&cpu0 {
+       operating-points = <
+               /* kHz */
+               166666  850000
+               400000  900000
+               800000 1050000
+       >;
+};
+
+&esdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_esdhc1>;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_esdhc1: esdhc1grp {
+               fsl,pins = <
+                       MX53_PAD_SD1_DATA0__ESDHC1_DAT0         0x1d5
+                       MX53_PAD_SD1_DATA1__ESDHC1_DAT1         0x1d5
+                       MX53_PAD_SD1_DATA2__ESDHC1_DAT2         0x1d5
+                       MX53_PAD_SD1_DATA3__ESDHC1_DAT3         0x1d5
+                       MX53_PAD_SD1_CMD__ESDHC1_CMD            0x1d5
+                       MX53_PAD_SD1_CLK__ESDHC1_CLK            0x1d5
+               >;
+       };
+
+       pinctrl_i2c1_pmic: i2c1grp {
+               fsl,pins = <
+                       MX53_PAD_EIM_D21__I2C1_SCL      0x80
+                       MX53_PAD_EIM_D28__I2C1_SDA      0x80
+               >;
+       };
+
+       pinctrl_led: ledgrp {
+               fsl,pins = <
+                       MX53_PAD_DISP0_DAT6__GPIO4_27 0x1e4
+               >;
+       };
+
+       /*
+        * UART mode pin header configuration
+        * 3 - GPIO5[26], pull-down 100K
+        * 4 - GPIO5[27], pull-down 100K
+        * 5 - TX, pull-up 100K
+        * 6 - RX, pull-up 100K
+        * 7 - GPIO5[30], pull-down 100K
+        */
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX53_PAD_CSI0_DAT8__GPIO5_26            0xc0
+                       MX53_PAD_CSI0_DAT9__GPIO5_27            0xc0
+                       MX53_PAD_CSI0_DAT10__UART1_TXD_MUX      0x1e4
+                       MX53_PAD_CSI0_DAT11__UART1_RXD_MUX      0x1e4
+                       MX53_PAD_CSI0_DAT12__GPIO5_30           0xc0
+               >;
+       };
+};
+
+&i2c1 {
+       pinctrl-0 = <&pinctrl_i2c1_pmic>;
+       status = "okay";
+
+       ltc3589: pmic@34 {
+               compatible = "lltc,ltc3589-2";
+               reg = <0x34>;
+
+               regulators {
+                       sw1_reg: sw1 {
+                               regulator-min-microvolt = <591930>;
+                               regulator-max-microvolt = <1224671>;
+                               lltc,fb-voltage-divider = <100000 158000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <704123>;
+                               regulator-max-microvolt = <1456803>;
+                               lltc,fb-voltage-divider = <180000 191000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3_reg: sw3 {
+                               regulator-min-microvolt = <1341250>;
+                               regulator-max-microvolt = <2775000>;
+                               lltc,fb-voltage-divider = <270000 100000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       bb_out_reg: bb-out {
+                               regulator-min-microvolt = <3387341>;
+                               regulator-max-microvolt = <3387341>;
+                               lltc,fb-voltage-divider = <511000 158000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo1_reg: ldo1 {
+                               regulator-min-microvolt = <1306329>;
+                               regulator-max-microvolt = <1306329>;
+                               lltc,fb-voltage-divider = <100000 158000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2_reg: ldo2 {
+                               regulator-min-microvolt = <704123>;
+                               regulator-max-microvolt = <1456806>;
+                               lltc,fb-voltage-divider = <180000 191000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo3_reg: ldo3 {
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-boot-on;
+                       };
+
+                       ldo4_reg: ldo4 {
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3200000>;
+                       };
+               };
+       };
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&usbotg {
+       dr_mode = "peripheral";
+       status = "okay";
+};
diff --git a/arch/arm/dts/imx6dl-gw51xx.dts b/arch/arm/dts/imx6dl-gw51xx.dts
new file mode 100644 (file)
index 0000000..9956d12
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw51xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW51XX";
+       compatible = "gw,imx6dl-gw51xx", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw52xx.dts b/arch/arm/dts/imx6dl-gw52xx.dts
new file mode 100644 (file)
index 0000000..9ea23dd
--- /dev/null
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw52xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW52XX";
+       compatible = "gw,imx6dl-gw52xx", "gw,ventana", "fsl,imx6dl";
+};
+
+&i2c3 {
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu1_csi1_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi1_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi1_from_ipu1_csi1_mux {
+       bus-width = <8>;
+};
+
+&ipu1_csi1_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu1_csi1_mux>;
+       bus-width = <8>;
+};
+
+&ipu1_csi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi1>;
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x0001b0b0
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x4001b0b0
+               >;
+       };
+
+       pinctrl_ipu1_csi1: ipu1_csi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_EB2__IPU1_CSI1_DATA19    0x1b0b0
+                       MX6QDL_PAD_EIM_D16__IPU1_CSI1_DATA18    0x1b0b0
+                       MX6QDL_PAD_EIM_D18__IPU1_CSI1_DATA17    0x1b0b0
+                       MX6QDL_PAD_EIM_D19__IPU1_CSI1_DATA16    0x1b0b0
+                       MX6QDL_PAD_EIM_D20__IPU1_CSI1_DATA15    0x1b0b0
+                       MX6QDL_PAD_EIM_D26__IPU1_CSI1_DATA14    0x1b0b0
+                       MX6QDL_PAD_EIM_D27__IPU1_CSI1_DATA13    0x1b0b0
+                       MX6QDL_PAD_EIM_A17__IPU1_CSI1_DATA12    0x1b0b0
+                       MX6QDL_PAD_EIM_D29__IPU1_CSI1_VSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_EB3__IPU1_CSI1_HSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_A16__IPU1_CSI1_PIXCLK    0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6dl-gw53xx.dts b/arch/arm/dts/imx6dl-gw53xx.dts
new file mode 100644 (file)
index 0000000..182e819
--- /dev/null
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw53xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW53XX";
+       compatible = "gw,imx6dl-gw53xx", "gw,ventana", "fsl,imx6dl";
+};
+
+&i2c3 {
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu1_csi1_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi1_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi1_from_ipu1_csi1_mux {
+       bus-width = <8>;
+};
+
+&ipu1_csi1_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu1_csi1_mux>;
+       bus-width = <8>;
+};
+
+&ipu1_csi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi1>;
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x0001b0b0
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x4001b0b0
+               >;
+       };
+
+       pinctrl_ipu1_csi1: ipu1_csi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_EB2__IPU1_CSI1_DATA19    0x1b0b0
+                       MX6QDL_PAD_EIM_D16__IPU1_CSI1_DATA18    0x1b0b0
+                       MX6QDL_PAD_EIM_D18__IPU1_CSI1_DATA17    0x1b0b0
+                       MX6QDL_PAD_EIM_D19__IPU1_CSI1_DATA16    0x1b0b0
+                       MX6QDL_PAD_EIM_D20__IPU1_CSI1_DATA15    0x1b0b0
+                       MX6QDL_PAD_EIM_D26__IPU1_CSI1_DATA14    0x1b0b0
+                       MX6QDL_PAD_EIM_D27__IPU1_CSI1_DATA13    0x1b0b0
+                       MX6QDL_PAD_EIM_A17__IPU1_CSI1_DATA12    0x1b0b0
+                       MX6QDL_PAD_EIM_D29__IPU1_CSI1_VSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_EB3__IPU1_CSI1_HSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_A16__IPU1_CSI1_PIXCLK    0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6dl-gw54xx.dts b/arch/arm/dts/imx6dl-gw54xx.dts
new file mode 100644 (file)
index 0000000..a106c4e
--- /dev/null
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw54xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW54XX";
+       compatible = "gw,imx6dl-gw54xx", "gw,ventana", "fsl,imx6dl";
+};
+
+&i2c3 {
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu1_csi1_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi1_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi1_from_ipu1_csi1_mux {
+       bus-width = <8>;
+};
+
+&ipu1_csi1_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu1_csi1_mux>;
+       bus-width = <8>;
+};
+
+&ipu1_csi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi1>;
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x0001b0b0
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x4001b0b0
+               >;
+       };
+
+       pinctrl_ipu1_csi1: ipu1_csi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_EB2__IPU1_CSI1_DATA19    0x1b0b0
+                       MX6QDL_PAD_EIM_D16__IPU1_CSI1_DATA18    0x1b0b0
+                       MX6QDL_PAD_EIM_D18__IPU1_CSI1_DATA17    0x1b0b0
+                       MX6QDL_PAD_EIM_D19__IPU1_CSI1_DATA16    0x1b0b0
+                       MX6QDL_PAD_EIM_D20__IPU1_CSI1_DATA15    0x1b0b0
+                       MX6QDL_PAD_EIM_D26__IPU1_CSI1_DATA14    0x1b0b0
+                       MX6QDL_PAD_EIM_D27__IPU1_CSI1_DATA13    0x1b0b0
+                       MX6QDL_PAD_EIM_A17__IPU1_CSI1_DATA12    0x1b0b0
+                       MX6QDL_PAD_EIM_D29__IPU1_CSI1_VSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_EB3__IPU1_CSI1_HSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_A16__IPU1_CSI1_PIXCLK    0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6dl-gw551x.dts b/arch/arm/dts/imx6dl-gw551x.dts
new file mode 100644 (file)
index 0000000..82d5f85
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw551x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW551X";
+       compatible = "gw,imx6dl-gw551x", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw552x.dts b/arch/arm/dts/imx6dl-gw552x.dts
new file mode 100644 (file)
index 0000000..4864a36
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2014 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw552x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW552X";
+       compatible = "gw,imx6dl-gw552x", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw553x.dts b/arch/arm/dts/imx6dl-gw553x.dts
new file mode 100644 (file)
index 0000000..59b8afc
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw553x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW553X";
+       compatible = "gw,imx6dl-gw553x", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw560x.dts b/arch/arm/dts/imx6dl-gw560x.dts
new file mode 100644 (file)
index 0000000..21bdfaf
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw560x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW560X";
+       compatible = "gw,imx6dl-gw560x", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw5903.dts b/arch/arm/dts/imx6dl-gw5903.dts
new file mode 100644 (file)
index 0000000..103261e
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw5903.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Duallite/Solo GW5903";
+       compatible = "gw,imx6dl-gw5903", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw5904.dts b/arch/arm/dts/imx6dl-gw5904.dts
new file mode 100644 (file)
index 0000000..9c6d3cd
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw5904.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW5904";
+       compatible = "gw,imx6dl-gw5904", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw5907.dts b/arch/arm/dts/imx6dl-gw5907.dts
new file mode 100644 (file)
index 0000000..3fa2822
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw5907.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW5907";
+       compatible = "gw,imx6dl-gw5907", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw5910.dts b/arch/arm/dts/imx6dl-gw5910.dts
new file mode 100644 (file)
index 0000000..0d5e7e5
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw5910.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW5910";
+       compatible = "gw,imx6dl-gw5910", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw5912.dts b/arch/arm/dts/imx6dl-gw5912.dts
new file mode 100644 (file)
index 0000000..5260e01
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw5912.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW5912";
+       compatible = "gw,imx6dl-gw5912", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-gw5913.dts b/arch/arm/dts/imx6dl-gw5913.dts
new file mode 100644 (file)
index 0000000..b74e533
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw5913.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 DualLite/Solo GW5913";
+       compatible = "gw,imx6dl-gw5913", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6dl-riotboard-u-boot.dtsi b/arch/arm/dts/imx6dl-riotboard-u-boot.dtsi
new file mode 100644 (file)
index 0000000..e51cd24
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/ {
+       aliases {
+               mmc0 = &usdhc2;
+               mmc1 = &usdhc3;
+       };
+};
diff --git a/arch/arm/dts/imx6dl-riotboard.dts b/arch/arm/dts/imx6dl-riotboard.dts
new file mode 100644 (file)
index 0000000..065d3ab
--- /dev/null
@@ -0,0 +1,594 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright 2014 Iain Paton <ipaton0@gmail.com>
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "RIoTboard i.MX6S";
+       compatible = "riot,imx6s-riotboard", "fsl,imx6dl";
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       chosen {
+               stdout-path = "serial1:115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_led>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio3 28 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+       };
+
+       sound {
+               compatible = "fsl,imx-audio-sgtl5000";
+               model = "imx6-riotboard-sgtl5000";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&codec>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+                       mux-int-port = <1>;
+                       mux-ext-port = <3>;
+       };
+
+       reg_2p5v: regulator-2p5v {
+               compatible = "regulator-fixed";
+               regulator-name = "2P5V";
+               regulator-min-microvolt = <2500000>;
+               regulator-max-microvolt = <2500000>;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       reg_usb_otg_vbus: regulator-usbotgvbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&clks {
+       fsl,pmic-stby-poweroff;
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-handle = <&rgmii_phy>;
+       interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
+                             <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
+       fsl,err006687-workaround-present;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               /* Atheros AR8035 PHY */
+               rgmii_phy: ethernet-phy@4 {
+                       reg = <4>;
+                       interrupts-extended = <&gpio1 28 IRQ_TYPE_LEVEL_LOW>;
+                       reset-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <1000>;
+               };
+       };
+};
+
+&gpio1 {
+       gpio-line-names =
+               "", "", "SD2_WP", "", "SD2_CD", "I2C3_SCL",
+                       "I2C3_SDA", "I2C4_SCL",
+               "I2C4_SDA", "", "", "", "", "", "", "",
+               "", "PWM3", "", "", "", "", "", "",
+               "", "", "", "", "", "", "", "";
+};
+
+&gpio3 {
+       gpio-line-names =
+               "", "", "", "", "", "", "", "",
+               "", "", "", "", "", "", "", "",
+               "", "", "", "", "", "", "USB_OTG_VBUS", "",
+               "UART3_TXD", "UART3_RXD", "", "", "EIM_D28", "", "", "";
+};
+
+&gpio4 {
+       gpio-line-names =
+               "", "", "", "", "", "", "UART4_TXD", "UART4_RXD",
+               "UART5_TXD", "UART5_RXD", "", "", "", "", "", "",
+               "GPIO4_16", "GPIO4_17", "GPIO4_18", "GPIO4_19", "",
+                       "CSPI3_CLK", "CSPI3_MOSI", "CSPI3_MISO",
+               "CSPI3_CS0", "CSPI3_CS1", "GPIO4_26", "GPIO4_27",
+                       "CSPI3_RDY", "PWM1", "PWM2", "GPIO4_31";
+};
+
+&gpio5 {
+       gpio-line-names =
+               "", "", "EIM_A25", "", "", "GPIO5_05", "GPIO5_06",
+                       "GPIO5_07",
+               "GPIO5_08", "CSPI2_CS1", "CSPI2_MOSI", "CSPI2_MISO",
+                       "CSPI2_CS0", "CSPI2_CLK", "", "",
+               "", "", "", "", "", "", "", "",
+               "", "", "", "", "", "", "", "";
+};
+
+&gpio7 {
+       gpio-line-names =
+               "SD3_CD", "SD3_WP", "", "", "", "", "", "",
+               "", "", "", "", "", "", "", "",
+               "", "", "", "", "", "", "", "",
+               "", "", "", "", "", "", "", "";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c2>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       codec: sgtl5000@a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks IMX6QDL_CLK_CKO>;
+               VDDA-supply = <&reg_2p5v>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       pmic: pf0100@8 {
+               compatible = "fsl,pfuze100";
+               reg = <0x08>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <16 8>;
+               fsl,pmic-stby-poweroff;
+
+               regulators {
+                       reg_vddcore: sw1ab {                            /* VDDARM_IN */
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-always-on;
+                       };
+
+                       reg_vddsoc: sw1c {                              /* VDDSOC_IN */
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-always-on;
+                       };
+
+                       reg_gen_3v3: sw2 {                              /* VDDHIGH_IN */
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       reg_ddr_1v5a: sw3a {                            /* NVCC_DRAM, NVCC_RGMII */
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-always-on;
+                       };
+
+                       reg_ddr_1v5b: sw3b {                            /* NVCC_DRAM, NVCC_RGMII */
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-always-on;
+                       };
+
+                       reg_ddr_vtt: sw4 {                              /* MIPI conn */
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-always-on;
+                       };
+
+                       reg_5v_600mA: swbst {                           /* not used */
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                       };
+
+                       reg_snvs_3v: vsnvs {                            /* VDD_SNVS_IN */
+                               regulator-min-microvolt = <1500000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {                             /* VREF_DDR */
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_vgen1_1v5: vgen1 {                          /* not used */
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       reg_vgen2_1v2_eth: vgen2 {                      /* pcie ? */
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                               regulator-always-on;
+                       };
+
+                       reg_vgen3_2v8: vgen3 {                          /* not used */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+                       reg_vgen4_1v8: vgen4 {                          /* NVCC_SD3 */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       reg_vgen5_2v5_sgtl: vgen5 {                     /* Pwr LED & 5V0_delayed enable */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       reg_vgen6_3v3: vgen6 {                          /* #V#_DELAYED enable, MIPI */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+};
+
+&i2c4 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c4>;
+       clocks = <&clks 116>;
+       status = "okay";
+};
+
+&pwm1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm1>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>;
+       status = "okay";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>;
+       status = "okay";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>;
+       status = "okay";
+};
+
+&ssi1 {
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbh1 {
+       dr_mode = "host";
+       disable-over-current;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
+
+&usdhc4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc4>;
+       vmmc-supply = <&reg_3p3v>;
+       non-removable;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl-names = "default";
+
+       imx6-riotboard {
+               pinctrl_audmux: audmuxgrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_CSI0_DAT7__AUD3_RXD          0x130b0
+                               MX6QDL_PAD_CSI0_DAT4__AUD3_TXC          0x130b0
+                               MX6QDL_PAD_CSI0_DAT5__AUD3_TXD          0x110b0
+                               MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS         0x130b0
+                               MX6QDL_PAD_GPIO_0__CCM_CLKO1            0x130b0         /* CAM_MCLK */
+                       >;
+               };
+
+               pinctrl_ecspi1: ecspi1grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_D16__ECSPI1_SCLK         0x100b1
+                               MX6QDL_PAD_EIM_D17__ECSPI1_MISO         0x100b1
+                               MX6QDL_PAD_EIM_D18__ECSPI1_MOSI         0x100b1
+                               MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17      0x000b1         /* CS0 */
+                       >;
+               };
+
+               pinctrl_ecspi2: ecspi2grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_DISP0_DAT15__GPIO5_IO09      0x000b1         /* CS1 */
+                               MX6QDL_PAD_DISP0_DAT16__ECSPI2_MOSI     0x100b1
+                               MX6QDL_PAD_DISP0_DAT17__ECSPI2_MISO     0x100b1
+                               MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12      0x000b1         /* CS0 */
+                               MX6QDL_PAD_DISP0_DAT19__ECSPI2_SCLK     0x100b1
+                       >;
+               };
+
+               pinctrl_ecspi3: ecspi3grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK      0x100b1
+                               MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI      0x100b1
+                               MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO      0x100b1
+                               MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24       0x000b1         /* CS0 */
+                               MX6QDL_PAD_DISP0_DAT4__GPIO4_IO25       0x000b1         /* CS1 */
+                       >;
+               };
+
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                               MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                               MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                               MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                               MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                               MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                               MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                               MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                               MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x0a0b1         /* AR8035 CLK_25M --> ENET_REF_CLK (V22) */
+                               MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030         /* AR8035 pin strapping: IO voltage: pull up */
+                               MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x13030         /* AR8035 pin strapping: PHYADDR#0: pull down */
+                               MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x13030         /* AR8035 pin strapping: PHYADDR#1: pull down */
+                               MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030         /* AR8035 pin strapping: MODE#1: pull up */
+                               MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030         /* AR8035 pin strapping: MODE#3: pull up */
+                               MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x130b0         /* AR8035 pin strapping: MODE#0: pull down */
+                               MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8      /* GPIO16 -> AR8035 25MHz */
+                               MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x130b0         /* RGMII_nRST */
+                               MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28       0x180b0         /* AR8035 interrupt */
+                               MX6QDL_PAD_GPIO_6__ENET_IRQ             0x000b1
+                       >;
+               };
+
+               pinctrl_i2c1: i2c1grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_CSI0_DAT8__I2C1_SDA          0x4001b8b1
+                               MX6QDL_PAD_CSI0_DAT9__I2C1_SCL          0x4001b8b1
+                       >;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                               MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+                       >;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_GPIO_5__I2C3_SCL             0x4001b8b1
+                               MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+                       >;
+               };
+
+               pinctrl_i2c4: i2c4grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_GPIO_7__I2C4_SCL             0x4001b8b1
+                               MX6QDL_PAD_GPIO_8__I2C4_SDA             0x4001b8b1
+                       >;
+               };
+
+               pinctrl_led: ledgrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_A25__GPIO5_IO02          0x1b0b1 /* user led0 */
+                               MX6QDL_PAD_EIM_D28__GPIO3_IO28          0x1b0b1 /* user led1 */
+                       >;
+               };
+
+               pinctrl_pwm1: pwm1grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_DISP0_DAT8__PWM1_OUT         0x1b0b1
+                       >;
+               };
+
+               pinctrl_pwm2: pwm2grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_DISP0_DAT9__PWM2_OUT         0x1b0b1
+                       >;
+               };
+
+               pinctrl_pwm3: pwm3grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+                       >;
+               };
+
+               pinctrl_pwm4: pwm4grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+                       >;
+               };
+
+               pinctrl_uart1: uart1grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA    0x1b0b1
+                               MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA    0x1b0b1
+                       >;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_D26__UART2_TX_DATA       0x1b0b1
+                               MX6QDL_PAD_EIM_D27__UART2_RX_DATA       0x1b0b1
+                       >;
+               };
+
+               pinctrl_uart3: uart3grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                               MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+                       >;
+               };
+
+               pinctrl_uart4: uart4grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_KEY_COL0__UART4_TX_DATA      0x1b0b1
+                               MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA      0x1b0b1
+                       >;
+               };
+
+               pinctrl_uart5: uart5grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                               MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+                       >;
+               };
+
+               pinctrl_usbotg: usbotggrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID       0x17059
+                               MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x000b0 /* MX6QDL_PAD_EIM_D22__USB_OTG_PWR */
+                               MX6QDL_PAD_EIM_D21__USB_OTG_OC          0x1b0b0
+                       >;
+               };
+
+               pinctrl_usdhc2: usdhc2grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17059
+                               MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10059
+                               MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17059
+                               MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17059
+                               MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17059
+                               MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17059
+                               MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* SD2 CD */
+                               MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x1f0b0 /* SD2 WP */
+                       >;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                               MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                               MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                               MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                               MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                               MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                               MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x1b0b0 /* SD3 CD */
+                               MX6QDL_PAD_SD3_DAT4__GPIO7_IO01         0x1f0b0 /* SD3 WP */
+                       >;
+               };
+
+               pinctrl_usdhc4: usdhc4grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_SD4_CMD__SD4_CMD             0x17059
+                               MX6QDL_PAD_SD4_CLK__SD4_CLK             0x10059
+                               MX6QDL_PAD_SD4_DAT0__SD4_DATA0          0x17059
+                               MX6QDL_PAD_SD4_DAT1__SD4_DATA1          0x17059
+                               MX6QDL_PAD_SD4_DAT2__SD4_DATA2          0x17059
+                               MX6QDL_PAD_SD4_DAT3__SD4_DATA3          0x17059
+                               MX6QDL_PAD_NANDF_ALE__GPIO6_IO08        0x17059 /* SD4 RST (eMMC) */
+                       >;
+               };
+       };
+};
diff --git a/arch/arm/dts/imx6dl-udoo.dts b/arch/arm/dts/imx6dl-udoo.dts
new file mode 100644 (file)
index 0000000..d871cac
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <fabio.estevam@freescale.com>
+ */
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-udoo.dtsi"
+
+/ {
+       model = "Udoo i.MX6 Dual-lite Board";
+       compatible = "udoo,imx6dl-udoo", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6q-gw51xx.dts b/arch/arm/dts/imx6q-gw51xx.dts
new file mode 100644 (file)
index 0000000..f801734
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw51xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW51XX";
+       compatible = "gw,imx6q-gw51xx", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-gw52xx.dts b/arch/arm/dts/imx6q-gw52xx.dts
new file mode 100644 (file)
index 0000000..6e1c493
--- /dev/null
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw52xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW52XX";
+       compatible = "gw,imx6q-gw52xx", "gw,ventana", "fsl,imx6q";
+};
+
+&i2c3 {
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu2_csi1_mux: endpoint {
+                               remote-endpoint = <&ipu2_csi1_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+};
+
+&ipu2_csi1_from_ipu2_csi1_mux {
+       bus-width = <8>;
+};
+
+&ipu2_csi1_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu2_csi1_mux>;
+       bus-width = <8>;
+};
+
+&ipu2_csi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu2_csi1>;
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x0001b0b0
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x4001b0b0
+               >;
+       };
+
+       pinctrl_ipu2_csi1: ipu2_csi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_EB2__IPU2_CSI1_DATA19    0x1b0b0
+                       MX6QDL_PAD_EIM_D16__IPU2_CSI1_DATA18    0x1b0b0
+                       MX6QDL_PAD_EIM_D18__IPU2_CSI1_DATA17    0x1b0b0
+                       MX6QDL_PAD_EIM_D19__IPU2_CSI1_DATA16    0x1b0b0
+                       MX6QDL_PAD_EIM_D20__IPU2_CSI1_DATA15    0x1b0b0
+                       MX6QDL_PAD_EIM_D26__IPU2_CSI1_DATA14    0x1b0b0
+                       MX6QDL_PAD_EIM_D27__IPU2_CSI1_DATA13    0x1b0b0
+                       MX6QDL_PAD_EIM_A17__IPU2_CSI1_DATA12    0x1b0b0
+                       MX6QDL_PAD_EIM_D29__IPU2_CSI1_VSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_EB3__IPU2_CSI1_HSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_A16__IPU2_CSI1_PIXCLK    0x1b0b0
+               >;
+       };
+};
+
+&sata {
+       status = "okay";
+};
diff --git a/arch/arm/dts/imx6q-gw53xx.dts b/arch/arm/dts/imx6q-gw53xx.dts
new file mode 100644 (file)
index 0000000..f13df8e
--- /dev/null
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw53xx.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW53XX";
+       compatible = "gw,imx6q-gw53xx", "gw,ventana", "fsl,imx6q";
+};
+
+&i2c3 {
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu2_csi1_mux: endpoint {
+                               remote-endpoint = <&ipu2_csi1_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+};
+
+&ipu2_csi1_from_ipu2_csi1_mux {
+       bus-width = <8>;
+};
+
+&ipu2_csi1_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu2_csi1_mux>;
+       bus-width = <8>;
+};
+
+&ipu2_csi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu2_csi1>;
+};
+
+&sata {
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x0001b0b0
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x4001b0b0
+               >;
+       };
+
+       pinctrl_ipu2_csi1: ipu2_csi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_EB2__IPU2_CSI1_DATA19    0x1b0b0
+                       MX6QDL_PAD_EIM_D16__IPU2_CSI1_DATA18    0x1b0b0
+                       MX6QDL_PAD_EIM_D18__IPU2_CSI1_DATA17    0x1b0b0
+                       MX6QDL_PAD_EIM_D19__IPU2_CSI1_DATA16    0x1b0b0
+                       MX6QDL_PAD_EIM_D20__IPU2_CSI1_DATA15    0x1b0b0
+                       MX6QDL_PAD_EIM_D26__IPU2_CSI1_DATA14    0x1b0b0
+                       MX6QDL_PAD_EIM_D27__IPU2_CSI1_DATA13    0x1b0b0
+                       MX6QDL_PAD_EIM_A17__IPU2_CSI1_DATA12    0x1b0b0
+                       MX6QDL_PAD_EIM_D29__IPU2_CSI1_VSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_EB3__IPU2_CSI1_HSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_A16__IPU2_CSI1_PIXCLK    0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6q-gw54xx.dts b/arch/arm/dts/imx6q-gw54xx.dts
new file mode 100644 (file)
index 0000000..d5d4690
--- /dev/null
@@ -0,0 +1,177 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw54xx.dtsi"
+#include <dt-bindings/media/tda1997x.h>
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW54XX";
+       compatible = "gw,imx6q-gw54xx", "gw,ventana", "fsl,imx6q";
+
+       sound-digital {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "tda1997x-audio";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,bitclock-master = <&sound_codec>;
+               simple-audio-card,frame-master = <&sound_codec>;
+
+               sound_cpu: simple-audio-card,cpu {
+                       sound-dai = <&ssi2>;
+               };
+
+               sound_codec: simple-audio-card,codec {
+                       sound-dai = <&hdmi_receiver>;
+               };
+       };
+};
+
+&i2c3 {
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio3>;
+               interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu2_csi1_mux: endpoint {
+                               remote-endpoint = <&ipu2_csi1_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+
+       hdmi_receiver: hdmi-receiver@48 {
+               compatible = "nxp,tda19971";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tda1997x>;
+               reg = <0x48>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+               DOVDD-supply = <&reg_3p3v>;
+               AVDD-supply = <&sw4_reg>;
+               DVDD-supply = <&sw4_reg>;
+               #sound-dai-cells = <0>;
+               nxp,audout-format = "i2s";
+               nxp,audout-layout = <0>;
+               nxp,audout-width = <16>;
+               nxp,audout-mclk-fs = <128>;
+               /*
+                * The 8bpp YUV422 semi-planar mode outputs CbCr[11:4]
+                * and Y[11:4] across 16bits in the same cycle
+                * which we map to VP[15:08]<->CSI_DATA[19:12]
+                */
+               nxp,vidout-portcfg =
+                       /*G_Y_11_8<->VP[15:12]<->CSI_DATA[19:16]*/
+                       < TDA1997X_VP24_V15_12 TDA1997X_G_Y_11_8 >,
+                       /*G_Y_7_4<->VP[11:08]<->CSI_DATA[15:12]*/
+                       < TDA1997X_VP24_V11_08 TDA1997X_G_Y_7_4 >,
+                       /*R_CR_CBCR_11_8<->VP[07:04]<->CSI_DATA[11:08]*/
+                       < TDA1997X_VP24_V07_04 TDA1997X_R_CR_CBCR_11_8 >,
+                       /*R_CR_CBCR_7_4<->VP[03:00]<->CSI_DATA[07:04]*/
+                       < TDA1997X_VP24_V03_00 TDA1997X_R_CR_CBCR_7_4 >;
+
+               port {
+                       tda1997x_to_ipu1_csi0_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>;
+                               bus-width = <16>;
+                               hsync-active = <1>;
+                               vsync-active = <1>;
+                               data-active = <1>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi0_from_ipu1_csi0_mux {
+       bus-width = <16>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+       remote-endpoint = <&tda1997x_to_ipu1_csi0_mux>;
+       bus-width = <16>;
+};
+
+&ipu1_csi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi0>;
+};
+
+&ipu2_csi1_from_ipu2_csi1_mux {
+       bus-width = <8>;
+};
+
+&ipu2_csi1_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu2_csi1_mux>;
+       bus-width = <8>;
+};
+
+&ipu2_csi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu2_csi1>;
+};
+
+&sata {
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D30__GPIO3_IO30          0x0001b0b0
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x4001b0b0
+               >;
+       };
+
+       pinctrl_ipu1_csi0: ipu1_csi0grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19         0x1b0b0
+                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC           0x1b0b0
+                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK        0x1b0b0
+                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC          0x1b0b0
+               >;
+       };
+
+       pinctrl_ipu2_csi1: ipu2_csi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_EB2__IPU2_CSI1_DATA19    0x1b0b0
+                       MX6QDL_PAD_EIM_D16__IPU2_CSI1_DATA18    0x1b0b0
+                       MX6QDL_PAD_EIM_D18__IPU2_CSI1_DATA17    0x1b0b0
+                       MX6QDL_PAD_EIM_D19__IPU2_CSI1_DATA16    0x1b0b0
+                       MX6QDL_PAD_EIM_D20__IPU2_CSI1_DATA15    0x1b0b0
+                       MX6QDL_PAD_EIM_D26__IPU2_CSI1_DATA14    0x1b0b0
+                       MX6QDL_PAD_EIM_D27__IPU2_CSI1_DATA13    0x1b0b0
+                       MX6QDL_PAD_EIM_A17__IPU2_CSI1_DATA12    0x1b0b0
+                       MX6QDL_PAD_EIM_D29__IPU2_CSI1_VSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_EB3__IPU2_CSI1_HSYNC     0x1b0b0
+                       MX6QDL_PAD_EIM_A16__IPU2_CSI1_PIXCLK    0x1b0b0
+               >;
+       };
+
+       pinctrl_tda1997x: tda1997xgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_7__GPIO1_IO07   0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6q-gw551x.dts b/arch/arm/dts/imx6q-gw551x.dts
new file mode 100644 (file)
index 0000000..2c7feee
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw551x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW551X";
+       compatible = "gw,imx6q-gw551x", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-gw552x.dts b/arch/arm/dts/imx6q-gw552x.dts
new file mode 100644 (file)
index 0000000..c973b73
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2014 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6q.dtsi"
+#include "imx6qdl-gw552x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW552X";
+       compatible = "gw,imx6q-gw552x", "gw,ventana", "fsl,imx6q";
+};
+
+&sata {
+       status = "okay";
+};
diff --git a/arch/arm/dts/imx6q-gw553x.dts b/arch/arm/dts/imx6q-gw553x.dts
new file mode 100644 (file)
index 0000000..e9c224c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw553x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW553X";
+       compatible = "gw,imx6q-gw553x", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-gw560x.dts b/arch/arm/dts/imx6q-gw560x.dts
new file mode 100644 (file)
index 0000000..735f2bb
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw560x.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW560X";
+       compatible = "gw,imx6q-gw560x", "gw,ventana", "fsl,imx6q";
+};
+
+&sata {
+       status = "okay";
+};
diff --git a/arch/arm/dts/imx6q-gw5903.dts b/arch/arm/dts/imx6q-gw5903.dts
new file mode 100644 (file)
index 0000000..a182e4c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw5903.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW5903";
+       compatible = "gw,imx6q-gw5903", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-gw5904.dts b/arch/arm/dts/imx6q-gw5904.dts
new file mode 100644 (file)
index 0000000..ca1e2ae
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw5904.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW5904";
+       compatible = "gw,imx6q-gw5904", "gw,ventana", "fsl,imx6q";
+};
+
+&sata {
+       status = "okay";
+};
diff --git a/arch/arm/dts/imx6q-gw5907.dts b/arch/arm/dts/imx6q-gw5907.dts
new file mode 100644 (file)
index 0000000..b25526e
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6q.dtsi"
+#include "imx6qdl-gw5907.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW5907";
+       compatible = "gw,imx6q-gw5907", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-gw5910.dts b/arch/arm/dts/imx6q-gw5910.dts
new file mode 100644 (file)
index 0000000..6aafa2f
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6q.dtsi"
+#include "imx6qdl-gw5910.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW5910";
+       compatible = "gw,imx6q-gw5910", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-gw5912.dts b/arch/arm/dts/imx6q-gw5912.dts
new file mode 100644 (file)
index 0000000..4dcbd94
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-gw5912.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW5912";
+       compatible = "gw,imx6q-gw5912", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-gw5913.dts b/arch/arm/dts/imx6q-gw5913.dts
new file mode 100644 (file)
index 0000000..6f511f1
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx6q.dtsi"
+#include "imx6qdl-gw5913.dtsi"
+
+/ {
+       model = "Gateworks Ventana i.MX6 Dual/Quad GW5913";
+       compatible = "gw,imx6q-gw5913", "gw,ventana", "fsl,imx6q";
+};
diff --git a/arch/arm/dts/imx6q-marsboard-u-boot.dtsi b/arch/arm/dts/imx6q-marsboard-u-boot.dtsi
new file mode 100644 (file)
index 0000000..e51cd24
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/ {
+       aliases {
+               mmc0 = &usdhc2;
+               mmc1 = &usdhc3;
+       };
+};
diff --git a/arch/arm/dts/imx6q-marsboard.dts b/arch/arm/dts/imx6q-marsboard.dts
new file mode 100644 (file)
index 0000000..05ee283
--- /dev/null
@@ -0,0 +1,417 @@
+/*
+ * Copyright (C) 2016 Sergio Prado (sergio.prado@e-labworks.com)
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License
+ *     version 2 as published by the Free Software Foundation.
+ *
+ *     This file 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.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       model = "Embest MarS Board i.MX6Dual";
+       compatible = "embest,imx6q-marsboard", "fsl,imx6q";
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_led>;
+
+               user1 {
+                       label = "imx6:green:user1";
+                       gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               user2 {
+                       label = "imx6:green:user2";
+                       gpios = <&gpio3 28 GPIO_ACTIVE_LOW>;
+                       default-state = "off";
+               };
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&ecspi1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi1>;
+       cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+
+       m25p80@0 {
+               compatible = "microchip,sst25vf016b";
+               spi-max-frequency = <20000000>;
+               reg = <0>;
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-handle = <&rgmii_phy>;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               /* Atheros AR8035 PHY */
+               rgmii_phy: ethernet-phy@4 {
+                       reg = <4>;
+                       interrupts-extended = <&gpio1 28 IRQ_TYPE_LEVEL_LOW>;
+                       reset-gpios = <&gpio3 31 GPIO_ACTIVE_LOW>;
+                       reset-assert-us = <10000>;
+                       reset-deassert-us = <1000>;
+               };
+       };
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c2>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+};
+
+&pwm1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm1>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>;
+       status = "okay";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>;
+       status = "okay";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbh1 {
+       dr_mode = "host";
+       disable-over-current;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       dr_mode = "otg";
+       disable-over-current;
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       vmmc-supply = <&reg_3p3v>;
+       cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+       wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       vmmc-supply = <&reg_3p3v>;
+       non-removable;
+       status = "okay";
+};
+
+&iomuxc {
+
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT7__AUD3_RXD          0x130b0
+                       MX6QDL_PAD_CSI0_DAT4__AUD3_TXC          0x130b0
+                       MX6QDL_PAD_CSI0_DAT5__AUD3_TXD          0x110b0
+                       MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS         0x130b0
+                       MX6QDL_PAD_GPIO_0__CCM_CLKO1            0x130b0 /* CAM_MCLK */
+               >;
+       };
+
+       pinctrl_ecspi1: ecspi1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D16__ECSPI1_SCLK         0x100b1
+                       MX6QDL_PAD_EIM_D17__ECSPI1_MISO         0x100b1
+                       MX6QDL_PAD_EIM_D18__ECSPI1_MOSI         0x100b1
+                       MX6QDL_PAD_EIM_EB2__GPIO2_IO30          0x000b1 /* CS0 */
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       /* AR8035 CLK_25M --> ENET_REF_CLK (V22) */
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x0a0b1
+                       /* AR8035 pin strapping: IO voltage: pull up */
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       /* AR8035 pin strapping: PHYADDR#0: pull down */
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x13030
+                       /* AR8035 pin strapping: PHYADDR#1: pull down */
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x13030
+                       /* AR8035 pin strapping: MODE#1: pull up */
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       /* AR8035 pin strapping: MODE#3: pull up */
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       /* AR8035 pin strapping: MODE#0: pull down */
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x13030
+                       /* GPIO16 -> AR8035 25MHz */
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       /* RGMII_nRST */
+                       MX6QDL_PAD_EIM_D31__GPIO3_IO31          0x130b0
+                       /* AR8035 interrupt */
+                       MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28       0x180b0
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT8__I2C1_SDA          0x4001b8b1
+                       MX6QDL_PAD_CSI0_DAT9__I2C1_SCL          0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_5__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_led: ledgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_A25__GPIO5_IO02          0x1b0b1 /* LED1 */
+                       MX6QDL_PAD_EIM_D28__GPIO3_IO28          0x1b0b1 /* LED2 */
+               >;
+       };
+
+       pinctrl_pwm1: pwm1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__PWM1_OUT         0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT9__PWM2_OUT         0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA    0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D26__UART2_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D27__UART2_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__UART4_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID       0x17059
+                       MX6QDL_PAD_EIM_D21__USB_OTG_OC          0x1b0b0
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x000b0 /* USB OTG POWER ENABLE */
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17059
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10059
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17059
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17059
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17059
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17059
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x1b0b0 /* CD */
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x1f0b0 /* WP */
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17009
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10009
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17009
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17009
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17009
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17009
+                       MX6QDL_PAD_SD3_RST__SD3_RESET           0x17009
+               >;
+       };
+};
index 8555be1..5a64f86 100644 (file)
@@ -40,3 +40,7 @@
 &m25p80 {
        u-boot,dm-spl;
 };
+
+&gpmi {
+       fsl,legacy-bch-geometry;
+};
diff --git a/arch/arm/dts/imx6q-udoo.dts b/arch/arm/dts/imx6q-udoo.dts
new file mode 100644 (file)
index 0000000..52e9f4a
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <fabio.estevam@freescale.com>
+ */
+/dts-v1/;
+#include "imx6q.dtsi"
+#include "imx6qdl-udoo.dtsi"
+
+/ {
+       model = "Udoo i.MX6 Quad Board";
+       compatible = "udoo,imx6q-udoo", "fsl,imx6q";
+};
+
+&sata {
+       status = "okay";
+};
diff --git a/arch/arm/dts/imx6qdl-gw51xx.dtsi b/arch/arm/dts/imx6qdl-gw51xx.dtsi
new file mode 100644 (file)
index 0000000..2a21c67
--- /dev/null
@@ -0,0 +1,638 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               nand = &gpmi;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_an1";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw1 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8 (1+R1/R2 = 2.505): GPS/VideoIn/ENET-PHY */
+                       reg_1p8v: sw2 {
+                               regulator-name = "vdd1p8";
+                               regulator-min-microvolt = <1033310>;
+                               regulator-max-microvolt = <2004000>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw4 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_2P5 (1+R1/R2 = 3.435): PCIe/ENET-PHY */
+                       reg_2p5v: ldo2 {
+                               regulator-name = "vdd2p5";
+                               regulator-min-microvolt = <2490375>;
+                               regulator-max-microvolt = <2490375>;
+                               lltc,fb-voltage-divider = <487000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio5 20 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu1_csi0_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi0_from_ipu1_csi0_mux {
+       bus-width = <8>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu1_csi0_mux>;
+       bus-width = <8>;
+};
+
+&ipu1_csi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi0>;
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>; /* MX6_DIO3 */
+       status = "disabled";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT5__GPIO5_IO23        0x0001b0b0
+                       MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20     0x4001b0b0
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x1b0b0 /* PHY Reset */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x0001b0b0 /* GSC_IRQ# */
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_ipu1_csi0: ipu1csi0grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19    0x1b0b0
+                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC      0x1b0b0
+                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC     0x1b0b0
+                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK   0x1b0b0
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_0__GPIO1_IO00           0x1b0b0
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x1b0b0 /* OTG_PWR_EN */
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw52xx.dtsi b/arch/arm/dts/imx6qdl-gw52xx.dtsi
new file mode 100644 (file)
index 0000000..6eedf8d
--- /dev/null
@@ -0,0 +1,782 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               mmc0 = &usdhc3;
+               nand = &gpmi;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm4 0 5000000>;
+               brightness-levels = <0 4 8 16 32 64 128 255>;
+               default-brightness-level = <7>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       reg_1p0v: regulator-1p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "1P0V";
+               regulator-min-microvolt = <1000000>;
+               regulator-max-microvolt = <1000000>;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       sound {
+               compatible = "fsl,imx6q-ventana-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "sgtl5000-audio";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&codec>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&clks {
+       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+                                <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&ecspi3 {
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi3>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_1p0";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+
+                       channel@29 {
+                               gw,mode = <1>;
+                               reg = <0x29>;
+                               label = "vdd_an1";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw1 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8 (1+R1/R2 = 2.505): GPS/VideoIn/ENET-PHY */
+                       reg_1p8v: sw2 {
+                               regulator-name = "vdd1p8";
+                               regulator-min-microvolt = <1033310>;
+                               regulator-max-microvolt = <2004000>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw4 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_2P5 (1+R1/R2 = 3.435): PCIe/ENET-PHY */
+                       reg_2p5v: ldo2 {
+                               regulator-name = "vdd2p5";
+                               regulator-min-microvolt = <2490375>;
+                               regulator-max-microvolt = <2490375>;
+                               lltc,fb-voltage-divider = <487000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_AUD_1P8: Audio codec */
+                       reg_aud_1p8v: ldo3 {
+                               regulator-name = "vdd1p8a";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       codec: sgtl5000@a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks IMX6QDL_CLK_CKO>;
+               VDDA-supply = <&reg_1p8v>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       touchscreen: egalax_ts@4 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <12 2>;
+               wakeup-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
+       };
+
+       accel@1e {
+               compatible = "nxp,fxos8700";
+               reg = <0x1e>;
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       lvds-channel@0 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: hsd100pxn1 {
+                               clock-frequency = <65000000>;
+                               hactive = <1024>;
+                               vactive = <768>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       #pwm-cells = <2>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>;
+       status = "okay";
+};
+
+&ssi1 {
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       rts-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_3p3v>;
+       no-1-8-v; /* firmware will remove if board revision supports */
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_DAT0__AUD4_RXD           0x130b0
+                       MX6QDL_PAD_SD2_DAT3__AUD4_TXC           0x130b0
+                       MX6QDL_PAD_SD2_DAT2__AUD4_TXD           0x110b0
+                       MX6QDL_PAD_SD2_DAT1__AUD4_TXFS          0x130b0
+                       MX6QDL_PAD_GPIO_0__CCM_CLKO1    0x130b0 /* AUD4_MCK */
+               >;
+       };
+
+       pinctrl_ecspi3: escpi3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK      0x100b1
+                       MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI      0x100b1
+                       MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO      0x100b1
+                       MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24       0x100b1
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x1b0b0 /* PHY Reset */
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX        0x1b0b1
+                       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX        0x1b0b1
+                       MX6QDL_PAD_GPIO_9__GPIO1_IO09           0x4001b0b0 /* CAN_STBY */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06  0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07  0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15  0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0xb0b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_TXD1__GPIO1_IO29        0x1b0b0 /* PCIE_RST# */
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT4__GPIO7_IO01         0x4001b0b1 /* TEN */
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22  0x1b0b0 /* OTG_PWR_EN */
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x17059 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x170b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170b9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170f9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw53xx.dtsi b/arch/arm/dts/imx6qdl-gw53xx.dtsi
new file mode 100644 (file)
index 0000000..9deec7e
--- /dev/null
@@ -0,0 +1,772 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               mmc0 = &usdhc3;
+               nand = &gpmi;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm4 0 5000000>;
+               brightness-levels = <0 4 8 16 32 64 128 255>;
+               default-brightness-level = <7>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       reg_1p0v: regulator-1p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "1P0V";
+               regulator-min-microvolt = <1000000>;
+               regulator-max-microvolt = <1000000>;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_usb_h1_vbus: regulator-usb-h1-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_h1_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       sound {
+               compatible = "fsl,imx6q-ventana-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "sgtl5000-audio";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&codec>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&clks {
+       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+                                <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_1p0";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+
+                       channel@26 {
+                               gw,mode = <1>;
+                               reg = <0x26>;
+                               label = "vdd_gps";
+                       };
+
+                       channel@29 {
+                               gw,mode = <1>;
+                               reg = <0x29>;
+                               label = "vdd_an1";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw1 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8 (1+R1/R2 = 2.505): GPS/VideoIn/ENET-PHY */
+                       reg_1p8v: sw2 {
+                               regulator-name = "vdd1p8";
+                               regulator-min-microvolt = <1033310>;
+                               regulator-max-microvolt = <2004000>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw4 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_2P5 (1+R1/R2 = 3.435): PCIe/ENET-PHY */
+                       reg_2p5v: ldo2 {
+                               regulator-name = "vdd2p5";
+                               regulator-min-microvolt = <2490375>;
+                               regulator-max-microvolt = <2490375>;
+                               lltc,fb-voltage-divider = <487000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_AUD_1P8: Audio codec */
+                       reg_aud_1p8v: ldo3 {
+                               regulator-name = "vdd1p8a";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       codec: sgtl5000@a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks IMX6QDL_CLK_CKO>;
+               VDDA-supply = <&reg_1p8v>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       touchscreen: egalax_ts@4 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <11 2>;
+               wakeup-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
+       };
+
+       accel@1e {
+               compatible = "nxp,fxos8700";
+               reg = <0x1e>;
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       lvds-channel@0 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: hsd100pxn1 {
+                               clock-frequency = <65000000>;
+                               hactive = <1024>;
+                               vactive = <768>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       #pwm-cells = <2>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>;
+       status = "okay";
+};
+
+&ssi1 {
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       rts-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_3p3v>;
+       no-1-8-v; /* firmware will remove if board revision supports */
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_DAT0__AUD4_RXD           0x130b0
+                       MX6QDL_PAD_SD2_DAT3__AUD4_TXC           0x130b0
+                       MX6QDL_PAD_SD2_DAT2__AUD4_TXD           0x110b0
+                       MX6QDL_PAD_SD2_DAT1__AUD4_TXFS          0x130b0
+                       MX6QDL_PAD_GPIO_0__CCM_CLKO1            0x130b0 /* AUD4_MCK */
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX        0x1b0b1
+                       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX        0x1b0b1
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x4001b0b0 /* CAN_STBY */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06   0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07   0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15   0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0xb0b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x1b0b0 /* PCIE IRQ */
+                       MX6QDL_PAD_ENET_TXD1__GPIO1_IO29  0x1b0b0 /* PCIE RST */
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT4__GPIO7_IO01         0x4001b0b1 /* TEN */
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x1b0b0 /* PWR_EN */
+                       MX6QDL_PAD_KEY_COL4__GPIO4_IO14         0x1b0b0 /* OC */
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x17059 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170b9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170f9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw54xx.dtsi b/arch/arm/dts/imx6qdl-gw54xx.dtsi
new file mode 100644 (file)
index 0000000..a30ba48
--- /dev/null
@@ -0,0 +1,866 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2013 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/sound/fsl-imx-audmux.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               mmc0 = &usdhc3;
+               nand = &gpmi;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm4 0 5000000>;
+               brightness-levels = <0 4 8 16 32 64 128 255>;
+               default-brightness-level = <7>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_1p0v: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "1P0V";
+                       regulator-min-microvolt = <1000000>;
+                       regulator-max-microvolt = <1000000>;
+                       regulator-always-on;
+               };
+
+               reg_3p3v: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "3P3V";
+                       regulator-min-microvolt = <3300000>;
+                       regulator-max-microvolt = <3300000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_h1_vbus: regulator@2 {
+                       compatible = "regulator-fixed";
+                       reg = <2>;
+                       regulator-name = "usb_h1_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       regulator-always-on;
+               };
+
+               reg_usb_otg_vbus: regulator@3 {
+                       compatible = "regulator-fixed";
+                       reg = <3>;
+                       regulator-name = "usb_otg_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+                       enable-active-high;
+               };
+       };
+
+       sound-analog {
+               compatible = "fsl,imx6q-ventana-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "sgtl5000-audio";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&sgtl5000>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>; /* AUD4<->sgtl5000 */
+       status = "okay";
+
+       ssi2 {
+               fsl,audmux-port = <1>;
+               fsl,port-config = <
+                       (IMX_AUDMUX_V2_PTCR_TFSDIR |
+                       IMX_AUDMUX_V2_PTCR_TFSEL(4+8) | /* RXFS */
+                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
+                       IMX_AUDMUX_V2_PTCR_TCSEL(4+8) | /* RXC */
+                       IMX_AUDMUX_V2_PTCR_SYN)
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(4)
+               >;
+       };
+
+       aud5 {
+               fsl,audmux-port = <4>;
+               fsl,port-config = <
+                       IMX_AUDMUX_V2_PTCR_SYN
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(1)>;
+       };
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&clks {
+       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+                                <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&ecspi2 {
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi2>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_1p0";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+
+                       channel@26 {
+                               gw,mode = <1>;
+                               reg = <0x26>;
+                               label = "vdd_gps";
+                       };
+               };
+
+               fan-controller@2c {
+                       compatible = "gw,gsc-fan";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x2c>;
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       pmic: pfuze100@8 {
+               compatible = "fsl,pfuze100";
+               reg = <0x08>;
+
+               regulators {
+                       sw1a_reg: sw1ab {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw1c_reg: sw1c {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3950000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3a_reg: sw3a {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3b_reg: sw3b {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw4_reg: sw4 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+
+                       swbst_reg: swbst {
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       snvs_reg: vsnvs {
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vgen1_reg: vgen1 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen2_reg: vgen2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen3_reg: vgen3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+
+                       vgen4_reg: vgen4 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen5_reg: vgen5 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen6_reg: vgen6 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       sgtl5000: audio-codec@a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               clocks = <&clks IMX6QDL_CLK_CKO>;
+               VDDA-supply = <&sw4_reg>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       touchscreen: egalax_ts@4 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <12 2>;
+               wakeup-gpios = <&gpio7 12 GPIO_ACTIVE_LOW>;
+       };
+
+       accel@1e {
+               compatible = "nxp,fxos8700";
+               reg = <0x1e>;
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       lvds-channel@0 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: hsd100pxn1 {
+                               clock-frequency = <65000000>;
+                               hactive = <1024>;
+                               vactive = <768>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm1>; /* MX6_DIO0 */
+       status = "disabled";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       #pwm-cells = <2>;
+       pinctrl-names = "default", "state_dio";
+       pinctrl-0 = <&pinctrl_pwm4_backlight>;
+       pinctrl-1 = <&pinctrl_pwm4_dio>;
+       status = "okay";
+};
+
+&ssi1 {
+       status = "okay";
+};
+
+&ssi2 {
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       rts-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_3p3v>;
+       no-1-8-v; /* firmware will remove if board revision supports */
+       status = "okay";
+};
+
+&wdog1 {
+       status = "disabled";
+};
+
+&wdog2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_DAT0__AUD4_RXD           0x130b0
+                       MX6QDL_PAD_SD2_DAT3__AUD4_TXC           0x130b0
+                       MX6QDL_PAD_SD2_DAT2__AUD4_TXD           0x110b0
+                       MX6QDL_PAD_SD2_DAT1__AUD4_TXFS          0x130b0
+                       MX6QDL_PAD_GPIO_0__CCM_CLKO1            0x130b0 /* AUD4_MCK */
+                       MX6QDL_PAD_EIM_D25__AUD5_RXC            0x130b0
+                       MX6QDL_PAD_DISP0_DAT19__AUD5_RXD        0x130b0
+                       MX6QDL_PAD_EIM_D24__AUD5_RXFS           0x130b0
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+               >;
+       };
+
+       pinctrl_ecspi2: escpi2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1
+                       MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1
+                       MX6QDL_PAD_EIM_OE__ECSPI2_MISO  0x100b1
+                       MX6QDL_PAD_EIM_RW__GPIO2_IO26   0x100b1
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX        0x1b0b1
+                       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX        0x1b0b1
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x4001b0b0 /* CAN_STBY */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15         0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0xb0b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28       0x1b0b0 /* PCIE IRQ */
+                       MX6QDL_PAD_ENET_TXD1__GPIO1_IO29        0x1b0b0 /* PCIE RST */
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm1: pwm1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_9__PWM1_OUT             0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4_backlight: pwm4grpbacklight {
+               fsl,pins = <
+                       /* LVDS_PWM J6.5 */
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4_dio: pwm4grpdio {
+               fsl,pins = <
+                       /* DIO3 J16.4 */
+                       MX6QDL_PAD_SD4_DAT2__PWM4_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT4__GPIO7_IO01         0x4001b0b1 /* TEN */
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x1b0b0 /* PWR_EN */
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x17059 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170b9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170f9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT3__WDOG2_B            0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw551x.dtsi b/arch/arm/dts/imx6qdl-gw551x.dtsi
new file mode 100644 (file)
index 0000000..1bb586c
--- /dev/null
@@ -0,0 +1,698 @@
+/*
+ * Copyright 2014 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/media/tda1997x.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/sound/fsl-imx-audmux.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               nand = &gpmi;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+
+       reg_usb_h1_vbus: regulator-usb-h1-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_h1_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+       };
+
+       sound-digital {
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "tda1997x-audio";
+               simple-audio-card,format = "i2s";
+               simple-audio-card,bitclock-master = <&sound_codec>;
+               simple-audio-card,frame-master = <&sound_codec>;
+
+               sound_cpu: simple-audio-card,cpu {
+                       sound-dai = <&ssi1>;
+               };
+
+               sound_codec: simple-audio-card,codec {
+                       sound-dai = <&hdmi_receiver>;
+               };
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>; /* AUD5<->tda1997x */
+       status = "okay";
+
+       ssi1 {
+               fsl,audmux-port = <0>;
+               fsl,port-config = <
+                       (IMX_AUDMUX_V2_PTCR_TFSDIR |
+                       IMX_AUDMUX_V2_PTCR_TFSEL(4+8) | /* RXFS */
+                       IMX_AUDMUX_V2_PTCR_TCLKDIR |
+                       IMX_AUDMUX_V2_PTCR_TCSEL(4+8) | /* RXC */
+                       IMX_AUDMUX_V2_PTCR_SYN)
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(4)
+               >;
+       };
+
+       aud5 {
+               fsl,audmux-port = <4>;
+               fsl,port-config = <
+                       IMX_AUDMUX_V2_PTCR_SYN
+                       IMX_AUDMUX_V2_PDCR_RXDSEL(0)>;
+       };
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8a";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_1p0b";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw1 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw2 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_3P3 (1+R1/R2 = 1.281) */
+                       reg_3p3: sw4 {
+                               regulator-name = "vdd3p3";
+                               regulator-min-microvolt = <1880000>;
+                               regulator-max-microvolt = <3647000>;
+                               lltc,fb-voltage-divider = <200000 56200>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8a (1+R1/R2 = 2.505): HDMI In core */
+                       reg_1p8a: ldo2 {
+                               regulator-name = "vdd1p8a";
+                               regulator-min-microvolt = <1816125>;
+                               regulator-max-microvolt = <1816125>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8b: HDMI In analog */
+                       reg_1p8b: ldo3 {
+                               regulator-name = "vdd1p8b";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       gpio_exp: pca9555@24 {
+               compatible = "nxp,pca9555";
+               reg = <0x24>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       hdmi_receiver: hdmi-receiver@48 {
+               compatible = "nxp,tda19971";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_tda1997x>;
+               reg = <0x48>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+               DOVDD-supply = <&reg_3p3>;
+               AVDD-supply = <&reg_1p8b>;
+               DVDD-supply = <&reg_1p8a>;
+               #sound-dai-cells = <0>;
+               nxp,audout-format = "i2s";
+               nxp,audout-layout = <0>;
+               nxp,audout-width = <16>;
+               nxp,audout-mclk-fs = <128>;
+               /*
+                * The 8bpp YUV422 semi-planar mode outputs CbCr[11:4]
+                * and Y[11:4] across 16bits in the same cycle
+                * which we map to VP[15:08]<->CSI_DATA[19:12]
+                */
+               nxp,vidout-portcfg =
+                       /*G_Y_11_8<->VP[15:12]<->CSI_DATA[19:16]*/
+                       < TDA1997X_VP24_V15_12 TDA1997X_G_Y_11_8 >,
+                       /*G_Y_7_4<->VP[11:08]<->CSI_DATA[15:12]*/
+                       < TDA1997X_VP24_V11_08 TDA1997X_G_Y_7_4 >,
+                       /*R_CR_CBCR_11_8<->VP[07:04]<->CSI_DATA[11:08]*/
+                       < TDA1997X_VP24_V07_04 TDA1997X_R_CR_CBCR_11_8 >,
+                       /*R_CR_CBCR_7_4<->VP[03:00]<->CSI_DATA[07:04]*/
+                       < TDA1997X_VP24_V03_00 TDA1997X_R_CR_CBCR_7_4 >;
+
+               port {
+                       tda1997x_to_ipu1_csi0_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>;
+                               bus-width = <16>;
+                               hsync-active = <1>;
+                               vsync-active = <1>;
+                               data-active = <1>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi0_from_ipu1_csi0_mux {
+       bus-width = <16>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+       remote-endpoint = <&tda1997x_to_ipu1_csi0_mux>;
+       bus-width = <16>;
+};
+
+&ipu1_csi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi0>;
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&ssi1 {
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT19__AUD5_RXD        0x130b0
+                       MX6QDL_PAD_DISP0_DAT14__AUD5_RXC        0x130b0
+                       MX6QDL_PAD_DISP0_DAT13__AUD5_RXFS       0x130b0
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX        0x1b0b1
+                       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX        0x1b0b1
+                       MX6QDL_PAD_GPIO_9__GPIO1_IO09           0x4001b0b0 /* CAN_STBY */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07   0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0xb0b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_ipu1_csi0: ipu1_csi0grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09          0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18         0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19         0x1b0b0
+                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC           0x1b0b0
+                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK        0x1b0b0
+                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC          0x1b0b0
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_0__GPIO1_IO00           0x1b0b0 /* PCIE RST */
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_tda1997x: tda1997xgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_7__GPIO1_IO07           0x1b0b0
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw552x.dtsi b/arch/arm/dts/imx6qdl-gw552x.dtsi
new file mode 100644 (file)
index 0000000..5462907
--- /dev/null
@@ -0,0 +1,522 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright 2014 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               nand = &gpmi;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               bootargs = "console=ttymxc1,115200";
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       reg_1p0v: regulator-1p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "1P0V";
+               regulator-min-microvolt = <1000000>;
+               regulator-max-microvolt = <1000000>;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_1p0";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw1 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8 (1+R1/R2 = 2.505): ENET-PHY */
+                       reg_1p8v: sw2 {
+                               regulator-name = "vdd1p8";
+                               regulator-min-microvolt = <1033310>;
+                               regulator-max-microvolt = <2004000>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw4 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_2P5 (1+R1/R2 = 3.435): PCIe/ENET-PHY */
+                       reg_2p5v: ldo2 {
+                               regulator-name = "vdd2p5";
+                               regulator-min-microvolt = <2490375>;
+                               regulator-max-microvolt = <2490375>;
+                               lltc,fb-voltage-divider = <487000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay"; };
+
+&usbh1 {
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_5p0v>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15         0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0xb0b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_TXD1__GPIO1_IO29        0x1b0b0
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID       0x13059
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw553x.dtsi b/arch/arm/dts/imx6qdl-gw553x.dtsi
new file mode 100644 (file)
index 0000000..b6965f2
--- /dev/null
@@ -0,0 +1,738 @@
+/*
+ * Copyright 2016 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               nand = &gpmi;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 10 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 11 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_hdmi>;
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8a";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_1p0b";
+                       };
+
+                       channel@26 {
+                               gw,mode = <1>;
+                               reg = <0x26>;
+                               label = "vdd_an1";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc: ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       magn@1c {
+               compatible = "st,lsm9ds1-magn";
+               reg = <0x1c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_mag>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <2 IRQ_TYPE_EDGE_RISING>;
+       };
+
+       imu@6a {
+               compatible = "st,lsm9ds1-imu";
+               reg = <0x6a>;
+               st,drdy-int-pin = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_imu>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
+       };
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw1 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw2 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_3P3 (1+R1/R2 = 1.281) */
+                       reg_3p3v: sw4 {
+                               regulator-name = "vdd3p3";
+                               regulator-min-microvolt = <1880000>;
+                               regulator-max-microvolt = <3647000>;
+                               lltc,fb-voltage-divider = <200000 56200>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8a (1+R1/R2 = 2.505): Analog Video Decoder */
+                       reg_1p8a: ldo2 {
+                               regulator-name = "vdd1p8a";
+                               regulator-min-microvolt = <1816125>;
+                               regulator-max-microvolt = <1816125>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8b: microSD VDD_1P8 */
+                       reg_1p8b: ldo3 {
+                               regulator-name = "vdd1p8b";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       adv7180: camera@20 {
+               compatible = "adi,adv7180";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_adv7180>;
+               reg = <0x20>;
+               powerdown-gpios = <&gpio5 20 GPIO_ACTIVE_LOW>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
+
+               port {
+                       adv7180_to_ipu1_csi0_mux: endpoint {
+                               remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>;
+                               bus-width = <8>;
+                       };
+               };
+       };
+};
+
+&ipu1_csi0_from_ipu1_csi0_mux {
+       bus-width = <8>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+       remote-endpoint = <&adv7180_to_ipu1_csi0_mux>;
+       bus-width = <8>;
+};
+
+&ipu1_csi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ipu1_csi0>;
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>; /* MX6_DIO3 */
+       status = "disabled";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_adv7180: adv7180grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT5__GPIO5_IO23        0x0001b0b0
+                       MX6QDL_PAD_CSI0_DATA_EN__GPIO5_IO20     0x4001b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_hdmi: hdmigrp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_A25__HDMI_TX_CEC_LINE    0x1f8b0
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0xb0b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_imu: imugrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_18__GPIO7_IO13          0x1b0b0
+               >;
+       };
+
+       pinctrl_ipu1_csi0: ipu1csi0grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18    0x1b0b0
+                       MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19    0x1b0b0
+                       MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC      0x1b0b0
+                       MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC     0x1b0b0
+                       MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK   0x1b0b0
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL2__GPIO4_IO10         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW2__GPIO4_IO11         0x1b0b0
+               >;
+       };
+
+       pinctrl_mag: maggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x1b0b0
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_0__GPIO1_IO00           0x1b0b0
+                       MX6QDL_PAD_GPIO_17__GPIO7_IO12          0x4001b0b0 /* PCIESKT_WDIS# */
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__UART4_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x1b0b0 /* OTG_PWR_EN */
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x17059 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170b9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170f9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw560x.dtsi b/arch/arm/dts/imx6qdl-gw560x.dtsi
new file mode 100644 (file)
index 0000000..0786b0d
--- /dev/null
@@ -0,0 +1,937 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               mmc0 = &usdhc2;
+               mmc1 = &usdhc3;
+               ssi0 = &ssi1;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       backlight-display {
+               compatible = "pwm-backlight";
+               pwms = <&pwm4 0 5000000>;
+               brightness-levels = <
+                       0  1  2  3  4  5  6  7  8  9
+                       10 11 12 13 14 15 16 17 18 19
+                       20 21 22 23 24 25 26 27 28 29
+                       30 31 32 33 34 35 36 37 38 39
+                       40 41 42 43 44 45 46 47 48 49
+                       50 51 52 53 54 55 56 57 58 59
+                       60 61 62 63 64 65 66 67 68 69
+                       70 71 72 73 74 75 76 77 78 79
+                       80 81 82 83 84 85 86 87 88 89
+                       90 91 92 93 94 95 96 97 98 99
+                       100
+                       >;
+               default-brightness-level = <100>;
+       };
+
+       backlight-keypad {
+               compatible = "gpio-backlight";
+               gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
+               default-on;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+       };
+
+       reg_2p5v: regulator-2p5v {
+               compatible = "regulator-fixed";
+               regulator-name = "2P5V";
+               regulator-min-microvolt = <2500000>;
+               regulator-max-microvolt = <2500000>;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_12p0v: regulator-12p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "12P0V";
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+               gpio = <&gpio4 25 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_1p4v: regulator-vddsoc {
+               compatible = "regulator-fixed";
+               regulator-name = "vdd_soc";
+               regulator-min-microvolt = <1400000>;
+               regulator-max-microvolt = <1400000>;
+               regulator-always-on;
+       };
+
+       reg_usb_h1_vbus: regulator-usb-h1-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_h1_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       sound {
+               compatible = "fsl,imx6q-ventana-sgtl5000",
+                            "fsl,imx-audio-sgtl5000";
+               model = "sgtl5000-audio";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&sgtl5000>;
+               audio-routing =
+                       "MIC_IN", "Mic Jack",
+                       "Mic Jack", "Mic Bias",
+                       "Headphone Jack", "HP_OUT";
+               mux-int-port = <1>;
+               mux-ext-port = <4>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&ecspi3 {
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi3>;
+       status = "okay";
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan>;
+       status = "okay";
+};
+
+&clks {
+       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+                                <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_an1";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+
+                       channel@26 {
+                               gw,mode = <1>;
+                               reg = <0x26>;
+                               label = "vdd_gps";
+                       };
+
+                       channel@29 {
+                               gw,mode = <1>;
+                               reg = <0x29>;
+                               label = "vdd_an2";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       ds1672: rtc@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       sgtl5000: codec@a {
+               compatible = "fsl,sgtl5000";
+               reg = <0x0a>;
+               #sound-dai-cells = <0>;
+               clocks = <&clks IMX6QDL_CLK_CKO>;
+               VDDA-supply = <&reg_1p8v>;
+               VDDIO-supply = <&reg_3p3v>;
+       };
+
+       magn@1c {
+               compatible = "st,lsm9ds1-magn";
+               reg = <0x1c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_mag>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <9 IRQ_TYPE_EDGE_RISING>;
+       };
+
+       tca8418: keypad@34 {
+               compatible = "ti,tca8418";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_keypad>;
+               reg = <0x34>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
+               linux,keymap = < MATRIX_KEY(0x00, 0x01, BTN_0)
+                                MATRIX_KEY(0x00, 0x00, BTN_1)
+                                MATRIX_KEY(0x01, 0x01, BTN_2)
+                                MATRIX_KEY(0x01, 0x00, BTN_3)
+                                MATRIX_KEY(0x02, 0x00, BTN_4)
+                                MATRIX_KEY(0x00, 0x03, BTN_5)
+                                MATRIX_KEY(0x00, 0x02, BTN_6)
+                                MATRIX_KEY(0x01, 0x03, BTN_7)
+                                MATRIX_KEY(0x01, 0x02, BTN_8)
+                                MATRIX_KEY(0x02, 0x02, BTN_9)
+               >;
+               keypad,num-rows = <4>;
+               keypad,num-columns = <4>;
+       };
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               reg = <0x3c>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw2 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.931) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <796551>;
+                               regulator-max-microvolt = <1544827>;
+                               lltc,fb-voltage-divider = <243000 261000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               linux,phandle = <&reg_vdd_arm>;
+                       };
+
+                       /* VDD_1P8 (1+R1/R2 = 2.505): GPS/VideoIn/ENET-PHY */
+                       reg_1p8v: sw4 {
+                               regulator-name = "vdd1p8";
+                               regulator-min-microvolt = <1033310>;
+                               regulator-max-microvolt = <2004000>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P0 (1+R1/R2 = 1.39): PCIe/ENET-PHY */
+                       reg_1p0v: ldo2 {
+                               regulator-name = "vdd1p0";
+                               regulator-min-microvolt = <950000>;
+                               regulator-max-microvolt = <1050000>;
+                               lltc,fb-voltage-divider = <78700 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_AUD_1P8: Audio codec */
+                       reg_aud_1p8v: ldo3 {
+                               regulator-name = "vdd1p8a";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+
+       imu@6a {
+               compatible = "st,lsm9ds1-imu";
+               reg = <0x6a>;
+               st,drdy-int-pin = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_imu>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       egalax_ts: touchscreen@4 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
+               wakeup-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&ldb {
+       fsl,dual-channel;
+       status = "okay";
+
+       lvds-channel@0 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: hsd100pxn1 {
+                               clock-frequency = <65000000>;
+                               hactive = <1024>;
+                               vactive = <768>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio4 31 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       #pwm-cells = <2>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>;
+       status = "okay";
+};
+
+&ssi1 {
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       uart-has-rtscts;
+       rts-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbh1>;
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       bus-width = <8>;
+       vmmc-supply = <&reg_3p3v>;
+       non-removable;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       /* AUD4 */
+                       MX6QDL_PAD_DISP0_DAT20__AUD4_TXC        0x130b0
+                       MX6QDL_PAD_DISP0_DAT21__AUD4_TXD        0x110b0
+                       MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS       0x130b0
+                       MX6QDL_PAD_DISP0_DAT23__AUD4_RXD        0x130b0
+                       MX6QDL_PAD_GPIO_0__CCM_CLKO1            0x130b0 /* AUD4_MCK */
+                       /* AUD6 */
+                       MX6QDL_PAD_DI0_PIN2__AUD6_TXD           0x130b0
+                       MX6QDL_PAD_DI0_PIN3__AUD6_TXFS          0x130b0
+                       MX6QDL_PAD_DI0_PIN4__AUD6_RXD           0x130b0
+                       MX6QDL_PAD_DI0_PIN15__AUD6_TXC          0x130b0
+               >;
+       };
+
+       pinctrl_ecspi3: escpi3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK      0x100b1
+                       MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI      0x100b1
+                       MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO      0x100b1
+                       MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24       0x100b1
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x4001b0b0 /* PHY_RST# */
+               >;
+       };
+
+       pinctrl_flexcan: flexcangrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX        0x1b0b1
+                       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX        0x1b0b1
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x4001b0b0 /* CAN_STBY */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15         0x1b0b0
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0xb0b1
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+                       MX6QDL_PAD_GPIO_19__GPIO4_IO05          0x4001b0b0 /* DIOI2C_DIS# */
+                       MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12      0x0001b0b0 /* LVDS_TOUCH_IRQ# */
+                       MX6QDL_PAD_DISP0_DAT19__GPIO5_IO13      0x0001b0b0 /* LVDS_BACKEN */
+               >;
+       };
+
+       pinctrl_imu: imugrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT12__GPIO5_IO06      0x1b0b0
+               >;
+       };
+
+       pinctrl_keypad: keypadgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT17__GPIO5_IO11      0x0001b0b0 /* KEYPAD_IRQ# */
+                       MX6QDL_PAD_DISP0_DAT9__GPIO4_IO30       0x0001b0b0 /* KEYPAD_LED_EN */
+               >;
+       };
+
+       pinctrl_mag: maggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT15__GPIO5_IO09      0x1b0b0
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT10__GPIO4_IO31      0x1b0b0    /* PCI_RST# */
+                       MX6QDL_PAD_GPIO_17__GPIO7_IO12          0x4001b0b0 /* PCIESKT_WDIS# */
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT4__GPIO7_IO01         0x4001b0b1 /* TEN */
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbh1: usbh1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_9__GPIO1_IO09           0x4001b0b0 /* USBHUB_RST# */
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x1b0b0 /* PWR_EN */
+                       MX6QDL_PAD_KEY_COL4__GPIO4_IO14         0x1b0b0 /* OC */
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x170f9
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x100f9
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x170f9
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x170f9
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x170f9
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x170f9
+                       MX6QDL_PAD_NANDF_D4__SD2_DATA4          0x170f9
+                       MX6QDL_PAD_NANDF_D5__SD2_DATA5          0x170f9
+                       MX6QDL_PAD_NANDF_D6__SD2_DATA6          0x170f9
+                       MX6QDL_PAD_NANDF_D7__SD2_DATA7          0x170f9
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x17059 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170b9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170f9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw5903.dtsi b/arch/arm/dts/imx6qdl-gw5903.dtsi
new file mode 100644 (file)
index 0000000..78f9ec9
--- /dev/null
@@ -0,0 +1,796 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm1 0 5000000>;
+               brightness-levels = <
+                       0  1  2  3  4  5  6  7  8  9
+                       10 11 12 13 14 15 16 17 18 19
+                       20 21 22 23 24 25 26 27 28 29
+                       30 31 32 33 34 35 36 37 38 39
+                       40 41 42 43 44 45 46 47 48 49
+                       50 51 52 53 54 55 56 57 58 59
+                       60 61 62 63 64 65 66 67 68 69
+                       70 71 72 73 74 75 76 77 78 79
+                       80 81 82 83 84 85 86 87 88 89
+                       90 91 92 93 94 95 96 97 98 99
+                       100
+                       >;
+               default-brightness-level = <100>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio6 14 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_2p5v: regulator-2p5v {
+               compatible = "regulator-fixed";
+               regulator-name = "2P5V";
+               regulator-min-microvolt = <2500000>;
+               regulator-max-microvolt = <2500000>;
+               regulator-always-on;
+       };
+
+       reg_usb_h1_vbus: regulator-usb-h1-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_h1_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 30 0>;
+               enable-active-high;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio4 15 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       reg_12p0: regulator-12p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "12P0V";
+               regulator-min-microvolt = <12000000>;
+               regulator-max-microvolt = <12000000>;
+               gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
+       sound {
+               compatible = "fsl,imx-audio-tlv320";
+               model = "imx-tlv320";
+               ssi-controller = <&ssi1>;
+               audio-codec = <&tlv320aic3105>;
+               /* routing of sink, source */
+               audio-routing =
+                       /* TLV320 LINE1L pin <-> Mic Jack connector */
+                       "LINE1L", "Mic Jack",
+                       /* board Headphone Jack <-> HPOUT */
+                       "Headphone Jack", "HPLOUT",
+                       "Headphone Jack", "HPROUT",
+                       "Mic Jack", "Mic Bias";
+               mux-int-port = <1>;
+               mux-ext-port = <6>;
+       };
+};
+
+&audmux {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_audmux>;
+       status = "okay";
+};
+
+&clks {
+       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+                                <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_an1";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       dts1672: rtc@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_1P8 (1+R1/R2 = 2.505): Aud/eMMC/microSD/Touch */
+                       reg_1p8v: sw1 {
+                               regulator-name = "vdd1p8";
+                               regulator-min-microvolt = <1033310>;
+                               regulator-max-microvolt = <2004000>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw2 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               linux,phandle = <&reg_vdd_arm>;
+                       };
+
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw4 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               linux,phandle = <&reg_vdd_soc>;
+                       };
+
+                       /* VDD_1P0 (1+R1/R2 = 1.38): */
+                       reg_1p0v: ldo2 {
+                               regulator-name = "vdd1p0";
+                               regulator-min-microvolt = <1002777>;
+                               regulator-max-microvolt = <1002777>;
+                               lltc,fb-voltage-divider = <100000 261000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
+
+&i2c3 {
+       clock-frequency = <400000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       tlv320aic3105: codec@18 {
+               compatible = "ti,tlv320aic3x";
+               reg = <0x18>;
+               reset-gpios = <&gpio5 17 GPIO_ACTIVE_LOW>;
+               clocks = <&clks IMX6QDL_CLK_CKO>;
+               ai3x-micbias-vg = <2>; /* MICBIAS_2_5V */
+               /* Regulators */
+               DRVDD-supply = <&reg_3p3v>;
+               AVDD-supply = <&reg_3p3v>;
+               IOVDD-supply = <&reg_3p3v>;
+               DVDD-supply = <&reg_1p8v>;
+       };
+
+       accelerometer@1d {
+               compatible = "fsl,mma8451";
+               reg = <0x1d>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <11 IRQ_TYPE_EDGE_RISING>;
+               interrupt-names = "INT2";
+       };
+
+       /* headphone detect */
+       ts3a227e@3b {
+               compatible = "ti,ts3a227e";
+               reg = <0x3b>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
+               ti,micbias = <4>; /* 2.5V micbias */
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       lvds-channel@0 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: g101evn010 {
+                               clock-frequency = <68930000>;
+                               hactive = <1280>;
+                               vactive = <800>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pwm1 {
+       #pwm-cells = <2>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm1>;
+       status = "okay";
+};
+
+&ssi1 {
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usdhc1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc1_200mhz>;
+       vmmc-supply = <&reg_3p3v>;
+       non-removable;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&usdhc2 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
+       cd-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_3p3v>;
+       max-frequency = <100000000>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       non-removable;
+       vmmc-supply = <&reg_3p3v>;
+       keep-power-in-suspend;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_audmux: audmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DI0_PIN2__AUD6_TXD           0x130b0
+                       MX6QDL_PAD_DI0_PIN3__AUD6_TXFS          0x130b0
+                       MX6QDL_PAD_DI0_PIN4__AUD6_RXD           0x130b0
+                       MX6QDL_PAD_DI0_PIN15__AUD6_TXC          0x130b0
+                       MX6QDL_PAD_GPIO_0__CCM_CLKO1            0x130b0 /* MCK */
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x4001b0b0 /* PHY_RST# */
+                       MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25      0x4001b0b0 /* PHY_EN */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CS1__GPIO6_IO14        0x1b0b0
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x0001b0b0 /* GSC_IRQ# */
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08           0x0001b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       /* I2C3 */
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+
+                       /* Headphone Detect */
+                       MX6QDL_PAD_DISP0_DAT21__GPIO5_IO15      0x0001b0b0 /* HPDET_IRQ# */
+                       MX6QDL_PAD_DISP0_DAT22__GPIO5_IO16      0x0001b0b0 /* HPDET_MIC# */
+
+                       /* Codec */
+                       MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17      0x0001b0b0 /* CODEC_RST# */
+
+                       /* Touch Controller */
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x0001b0b0 /* TOUCH_IRQ# */
+                       MX6QDL_PAD_KEY_COL1__GPIO4_IO08         0x0001b0b0 /* TOUCH_RST */
+
+                       /* Stow Sensor */
+                       MX6QDL_PAD_GPIO_16__GPIO7_IO11          0x0001b0b0 /* ACCEL_IRQ2 */
+                       MX6QDL_PAD_GPIO_18__GPIO7_IO13          0x0001b0b0 /* ACCEL_IRQ1 */
+               >;
+       };
+
+       pinctrl_pwm1: pwm1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_9__PWM1_OUT             0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT12__GPIO5_IO30       0x1b0b1 /* TXEN */
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x13059
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15         0x4001b0b0 /* PWR_EN */
+                       MX6QDL_PAD_KEY_COL4__GPIO4_IO14         0x1b0b0 /* OC */
+               >;
+       };
+
+       pinctrl_usdhc1_200mhz: usdhc1grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_D3__GPIO2_IO03         0x4001b0b0 /* EMMY_EN */
+                       MX6QDL_PAD_NANDF_D4__GPIO2_IO04         0x4001b0b0 /* EMMY_CFG1# */
+                       MX6QDL_PAD_NANDF_D5__GPIO2_IO05         0x4001b0b0 /* EMMY_CFG2# */
+                       MX6QDL_PAD_NANDF_D6__GPIO2_IO06         0x0001b0b0 /* EMMY_BTWAKE# */
+                       MX6QDL_PAD_NANDF_D7__GPIO2_IO07         0x0001b0b0 /* EMMY_WFWAKE# */
+
+                       MX6QDL_PAD_SD1_CLK__SD1_CLK             0x100f9
+                       MX6QDL_PAD_SD1_CMD__SD1_CMD             0x100f9
+                       MX6QDL_PAD_SD1_DAT0__SD1_DATA0          0x170f9
+                       MX6QDL_PAD_SD1_DAT1__SD1_DATA1          0x170f9
+                       MX6QDL_PAD_SD1_DAT2__SD1_DATA2          0x170f9
+                       MX6QDL_PAD_SD1_DAT3__SD1_DATA3          0x170f9
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17059
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10059
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17059
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17059
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17059
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17059
+                       MX6QDL_PAD_NANDF_CS0__GPIO6_IO11        0x17059 /* CD */
+                       MX6QDL_PAD_KEY_ROW1__SD2_VSELECT        0x17059
+               >;
+       };
+
+       pinctrl_usdhc2_100mhz: usdhc2grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x170b9
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x100b9
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x170b9
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x170b9
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x170b9
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x170b9
+                       MX6QDL_PAD_NANDF_CS0__GPIO6_IO11        0x170b9 /* CD */
+                       MX6QDL_PAD_KEY_ROW1__SD2_VSELECT        0x170b9
+               >;
+       };
+
+       pinctrl_usdhc2_200mhz: usdhc2grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x170f9
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x100f9
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x170f9
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x170f9
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x170f9
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x170f9
+                       MX6QDL_PAD_NANDF_CS0__GPIO6_IO11        0x170f9 /* CD */
+                       MX6QDL_PAD_KEY_ROW1__SD2_VSELECT        0x170f9
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_RST__SD3_RESET           0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4          0x17059
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5          0x17059
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6          0x17059
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7          0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100b9
+                       MX6QDL_PAD_SD3_RST__SD3_RESET           0x100b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5          0x170b9
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6          0x170b9
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7          0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_RST__SD3_RESET           0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5          0x170f9
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6          0x170f9
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7          0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw5904.dtsi b/arch/arm/dts/imx6qdl-gw5904.dtsi
new file mode 100644 (file)
index 0000000..5b7bd56
--- /dev/null
@@ -0,0 +1,814 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 file 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 file; if not, write to the Free
+ *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ *     MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               mmc0 = &usdhc3;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       backlight {
+               compatible = "pwm-backlight";
+               pwms = <&pwm4 0 5000000>;
+               brightness-levels = <0 4 8 16 32 64 128 255>;
+               default-brightness-level = <7>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+       };
+
+       reg_1p0v: regulator-1p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "1P0V";
+               regulator-min-microvolt = <1000000>;
+               regulator-max-microvolt = <1000000>;
+               regulator-always-on;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_usb_h1_vbus: regulator-usb-h1-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_h1_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&clks {
+       assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+                         <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+       assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+                                <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       status = "okay";
+
+       fixed-link {
+               speed = <1000>;
+               full-duplex;
+       };
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               switch@0 {
+                       compatible = "marvell,mv88e6085";
+                       reg = <0>;
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       label = "lan4";
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+                                       label = "lan3";
+                               };
+
+                               port@2 {
+                                       reg = <2>;
+                                       label = "lan2";
+                               };
+
+                               port@3 {
+                                       reg = <3>;
+                                       label = "lan1";
+                               };
+
+                               port@5 {
+                                       reg = <5>;
+                                       label = "cpu";
+                                       ethernet = <&fec>;
+                               };
+                       };
+               };
+       };
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_an1";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom1: eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom2: eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom3: eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom4: eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       dts1672: rtc@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+
+       magn@1c {
+               compatible = "st,lsm9ds1-magn";
+               reg = <0x1c>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_mag>;
+               interrupt-parent = <&gpio5>;
+               interrupts = <17 IRQ_TYPE_EDGE_RISING>;
+       };
+
+       ltc3676: pmic@3c {
+               compatible = "lltc,ltc3676";
+               reg = <0x3c>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <8 IRQ_TYPE_EDGE_FALLING>;
+
+               regulators {
+                       /* VDD_SOC (1+R1/R2 = 1.635) */
+                       reg_vdd_soc: sw1 {
+                               regulator-name = "vddsoc";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_1P8 (1+R1/R2 = 2.505): GbE switch */
+                       reg_1p8v: sw2 {
+                               regulator-name = "vdd1p8";
+                               regulator-min-microvolt = <1033310>;
+                               regulator-max-microvolt = <2004000>;
+                               lltc,fb-voltage-divider = <301000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_ARM (1+R1/R2 = 1.635) */
+                       reg_vdd_arm: sw3 {
+                               regulator-name = "vddarm";
+                               regulator-min-microvolt = <674400>;
+                               regulator-max-microvolt = <1308000>;
+                               lltc,fb-voltage-divider = <127000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_DDR (1+R1/R2 = 2.105) */
+                       reg_vdd_ddr: sw4 {
+                               regulator-name = "vddddr";
+                               regulator-min-microvolt = <868310>;
+                               regulator-max-microvolt = <1684000>;
+                               lltc,fb-voltage-divider = <221000 200000>;
+                               regulator-ramp-delay = <7000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_2P5 (1+R1/R2 = 3.435): PCIe/ENET-PHY */
+                       reg_2p5v: ldo2 {
+                               regulator-name = "vdd2p5";
+                               regulator-min-microvolt = <2490375>;
+                               regulator-max-microvolt = <2490375>;
+                               lltc,fb-voltage-divider = <487000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       /* VDD_HIGH (1+R1/R2 = 4.17) */
+                       reg_3p0v: ldo4 {
+                               regulator-name = "vdd3p0";
+                               regulator-min-microvolt = <3023250>;
+                               regulator-max-microvolt = <3023250>;
+                               lltc,fb-voltage-divider = <634000 200000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+
+       imu@6a {
+               compatible = "st,lsm9ds1-imu";
+               reg = <0x6a>;
+               st,drdy-int-pin = <1>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_imu>;
+               interrupt-parent = <&gpio4>;
+               interrupts = <18 IRQ_TYPE_LEVEL_HIGH>;
+       };
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       egalax_ts: touchscreen@4 {
+               compatible = "eeti,egalax_ts";
+               reg = <0x04>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
+               wakeup-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       lvds-channel@0 {
+               fsl,data-mapping = "spwg";
+               fsl,data-width = <18>;
+               status = "okay";
+
+               display-timings {
+                       native-mode = <&timing0>;
+                       timing0: hsd100pxn1 {
+                               clock-frequency = <65000000>;
+                               hactive = <1024>;
+                               vactive = <768>;
+                               hback-porch = <220>;
+                               hfront-porch = <40>;
+                               vback-porch = <21>;
+                               vfront-porch = <7>;
+                               hsync-len = <60>;
+                               vsync-len = <10>;
+                       };
+               };
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       #pwm-cells = <2>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>;
+       status = "okay";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       uart-has-rtscts;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       uart-has-rtscts;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_h1_vbus>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       non-removable;
+       vmmc-supply = <&reg_3p3v>;
+       keep-power-in-suspend;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x4001b0b0 /* PHY_RST# */
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15         0x1b0b0
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x0001b0b0 /* GSC_IRQ# */
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_imu: imugrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DI0_PIN2__GPIO4_IO18         0x1b0b0
+               >;
+       };
+
+       pinctrl_mag: maggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17      0x1b0b0
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_0__GPIO1_IO00   0x1b0b0 /* PCIE RST */
+               >;
+       };
+
+       pinctrl_pmic: pmicgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_8__GPIO1_IO08   0x1b0b0 /* PMIC_IRQ# */
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA    0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D23__UART3_CTS_B         0x1b0b1
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D31__UART3_RTS_B         0x1b0b1
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT12__UART4_TX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT13__UART4_RX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT16__UART4_RTS_B      0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT17__UART4_CTS_B      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x1b0b0 /* PWR_EN */
+                       MX6QDL_PAD_KEY_COL4__GPIO4_IO14         0x1b0b0 /* OC */
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_RST__SD3_RESET           0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4          0x17059
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5          0x17059
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6          0x17059
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7          0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100b9
+                       MX6QDL_PAD_SD3_RST__SD3_RESET           0x100b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5          0x170b9
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6          0x170b9
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7          0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_RST__SD3_RESET           0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT4__SD3_DATA4          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__SD3_DATA5          0x170f9
+                       MX6QDL_PAD_SD3_DAT6__SD3_DATA6          0x170f9
+                       MX6QDL_PAD_SD3_DAT7__SD3_DATA7          0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw5907.dtsi b/arch/arm/dts/imx6qdl-gw5907.dtsi
new file mode 100644 (file)
index 0000000..c8b2924
--- /dev/null
@@ -0,0 +1,539 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               nand = &gpmi;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_usb_otg_vbus: regulator-usb-otg-vbus {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_otg_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio3 22 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       phy-reset-gpios = <&gpio1 30 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c3>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_an1";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       ds1672@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       gpio@20 {
+               compatible = "nxp,pca9555";
+               reg = <0x20>;
+               gpio-controller;
+               #gpio-cells = <2>;
+       };
+
+       adc@48 {
+               compatible = "ti,ads1015";
+               reg = <0x48>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               channel@4 {
+                       reg = <4>;
+                       ti,gain = <0>;
+                       ti,datarate = <5>;
+               };
+
+               channel@5 {
+                       reg = <5>;
+                       ti,gain = <0>;
+                       ti,datarate = <5>;
+               };
+
+               channel@6 {
+                       reg = <6>;
+                       ti,gain = <0>;
+                       ti,datarate = <5>;
+               };
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>; /* MX6_DIO3 */
+       status = "disabled";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_otg_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "otg";
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b0b0
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b0b0
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b0b0
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b0b0
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b0b0
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b0b0
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b0b0
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b0b0
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b0b0
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b0b0
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b0b0
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b0b0
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x1b0b0
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x0001b0b0
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x1b0b0
+                       MX6QDL_PAD_GPIO_19__GPIO4_IO05          0x1b0b0
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_0__GPIO1_IO00           0x1b0b0
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_RXD1__GPIO1_IO26        0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+                       MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x1b0b0
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw5910.dtsi b/arch/arm/dts/imx6qdl-gw5910.dtsi
new file mode 100644 (file)
index 0000000..248e077
--- /dev/null
@@ -0,0 +1,668 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               mmc0 = &usdhc3;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+
+       reg_wl: regulator-wl {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_reg_wl>;
+               compatible = "regulator-fixed";
+               regulator-name = "wl";
+               gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
+               startup-delay-us = <100>;
+               enable-active-high;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+       };
+};
+
+
+&ecspi3 {
+       cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi3>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@6 {
+                               gw,mode = <0>;
+                               reg = <0x06>;
+                               label = "temp";
+                       };
+
+                       channel@8 {
+                               gw,mode = <3>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@82 {
+                               gw,mode = <2>;
+                               reg = <0x82>;
+                               label = "vdd_vin";
+                               gw,voltage-divider-ohms = <22100 1000>;
+                               gw,voltage-offset-microvolt = <800000>;
+                       };
+
+                       channel@84 {
+                               gw,mode = <2>;
+                               reg = <0x84>;
+                               label = "vdd_5p0";
+                               gw,voltage-divider-ohms = <22100 10000>;
+                       };
+
+                       channel@86 {
+                               gw,mode = <2>;
+                               reg = <0x86>;
+                               label = "vdd_3p3";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+
+                       channel@88 {
+                               gw,mode = <2>;
+                               reg = <0x88>;
+                               label = "vdd_2p5";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+
+                       channel@8c {
+                               gw,mode = <2>;
+                               reg = <0x8c>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@8e {
+                               gw,mode = <2>;
+                               reg = <0x8e>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@90 {
+                               gw,mode = <2>;
+                               reg = <0x90>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@92 {
+                               gw,mode = <2>;
+                               reg = <0x92>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@98 {
+                               gw,mode = <2>;
+                               reg = <0x98>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@9a {
+                               gw,mode = <2>;
+                               reg = <0x9a>;
+                               label = "vdd_1p0";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+
+                       channel@9c {
+                               gw,mode = <2>;
+                               reg = <0x9c>;
+                               label = "vdd_an1";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+
+                       channel@a2 {
+                               gw,mode = <2>;
+                               reg = <0xa2>;
+                               label = "vdd_gsc";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       accel@19 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_accel>;
+               compatible = "st,lis2de12";
+               reg = <0x19>;
+               st,drdy-int-pin = <1>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <13 0>;
+               interrupt-names = "INT1";
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio3 20 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+/* off-board RS232 */
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+/* serial console */
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+/* cc1352 */
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       uart-has-rtscts;
+       status = "okay";
+};
+
+/* Sterling-LWB Bluetooth */
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>,<&pinctrl_bten>;
+       uart-has-rtscts;
+       status = "okay";
+
+       bluetooth {
+               compatible = "brcm,bcm4330-bt";
+               shutdown-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
+       };
+};
+
+/* GPS */
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_5p0v>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+/* Sterling-LWB SDIO WiFi */
+&usdhc2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc2>;
+       vmmc-supply = <&reg_wl>;
+       non-removable;
+       bus-width = <4>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_accel: accelmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_18__GPIO7_IO13          0x1b0b1
+               >;
+       };
+
+       pinctrl_bten: btengrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x1b0b1
+               >;
+       };
+
+       pinctrl_ecspi3: escpi3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK      0x100b1
+                       MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI      0x100b1
+                       MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO      0x100b1
+                       MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24       0x100b1
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x1b0b0
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06  0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07  0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15  0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x0001b0b0
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D20__GPIO3_IO20          0x1b0b0
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DI0_DISP_CLK__GPIO4_IO16     0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_reg_wl: regwlgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_5__GPIO1_IO05           0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA    0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D23__UART3_RTS_B         0x1b0b1
+                       MX6QDL_PAD_EIM_D31__UART3_CTS_B         0x1b0b1
+                       MX6QDL_PAD_EIM_A25__GPIO5_IO02          0x4001b0b1 /* DIO20 */
+                       MX6QDL_PAD_DISP0_DAT11__GPIO5_IO05      0x4001b0b1 /* DIO14 */
+                       MX6QDL_PAD_DISP0_DAT12__GPIO5_IO06      0x4001b0b1 /* DIO15 */
+                       MX6QDL_PAD_DISP0_DAT14__GPIO5_IO08      0x1b0b1 /* TMS */
+                       MX6QDL_PAD_DISP0_DAT15__GPIO5_IO09      0x1b0b1 /* TCK */
+                       MX6QDL_PAD_DISP0_DAT16__GPIO5_IO10      0x1b0b1 /* TDO */
+                       MX6QDL_PAD_DISP0_DAT17__GPIO5_IO11      0x1b0b1 /* TDI */
+                       MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17      0x4001b0b1 /* RST# */
+               >;
+       };
+
+       pinctrl_uart4: uart4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_CSI0_DAT12__UART4_TX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT13__UART4_RX_DATA    0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT16__UART4_RTS_B      0x1b0b1
+                       MX6QDL_PAD_CSI0_DAT17__UART4_CTS_B      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x13059
+               >;
+       };
+
+       pinctrl_usdhc2: usdhc2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD2_CMD__SD2_CMD             0x17059
+                       MX6QDL_PAD_SD2_CLK__SD2_CLK             0x10059
+                       MX6QDL_PAD_SD2_DAT0__SD2_DATA0          0x17059
+                       MX6QDL_PAD_SD2_DAT1__SD2_DATA1          0x17059
+                       MX6QDL_PAD_SD2_DAT2__SD2_DATA2          0x17059
+                       MX6QDL_PAD_SD2_DAT3__SD2_DATA3          0x17059
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x17059 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x170b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170b9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170f9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw5912.dtsi b/arch/arm/dts/imx6qdl-gw5912.dtsi
new file mode 100644 (file)
index 0000000..7593872
--- /dev/null
@@ -0,0 +1,609 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               led2 = &led2;
+               mmc0 = &usdhc3;
+               nand = &gpmi;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+
+               led2: user3 {
+                       label = "user3";
+                       gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; /* MX6_LOCLED# */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_usb_vbus: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "usb_vbus";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+};
+
+&can1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexcan1>;
+       status = "okay";
+};
+
+&ecspi2 {
+       cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi2>;
+       status = "okay";
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@0 {
+                               gw,mode = <0>;
+                               reg = <0x00>;
+                               label = "temp";
+                       };
+
+                       channel@2 {
+                               gw,mode = <1>;
+                               reg = <0x02>;
+                               label = "vdd_vin";
+                       };
+
+                       channel@5 {
+                               gw,mode = <1>;
+                               reg = <0x05>;
+                               label = "vdd_3p3";
+                       };
+
+                       channel@8 {
+                               gw,mode = <1>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@b {
+                               gw,mode = <1>;
+                               reg = <0x0b>;
+                               label = "vdd_5p0";
+                       };
+
+                       channel@e {
+                               gw,mode = <1>;
+                               reg = <0xe>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@11 {
+                               gw,mode = <1>;
+                               reg = <0x11>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@14 {
+                               gw,mode = <1>;
+                               reg = <0x14>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@17 {
+                               gw,mode = <1>;
+                               reg = <0x17>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@1d {
+                               gw,mode = <1>;
+                               reg = <0x1d>;
+                               label = "vdd_1p8";
+                       };
+
+                       channel@20 {
+                               gw,mode = <1>;
+                               reg = <0x20>;
+                               label = "vdd_1p0";
+                       };
+
+                       channel@23 {
+                               gw,mode = <1>;
+                               reg = <0x23>;
+                               label = "vdd_2p5";
+                       };
+               };
+
+               fan-controller@a {
+                       compatible = "gw,gsc-fan";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       reg = <0x0a>;
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       accel@19 {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_accel>;
+               compatible = "st,lis2de12";
+               reg = <0x19>;
+               st,drdy-int-pin = <1>;
+               interrupt-parent = <&gpio7>;
+               interrupts = <13 0>;
+               interrupt-names = "INT1";
+       };
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 29 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm1>; /* MX6_DIO0 */
+       status = "disabled";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>; /* MX6_DIO3 */
+       status = "disabled";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       rts-gpios = <&gpio7 12 GPIO_ACTIVE_HIGH>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       vbus-supply = <&reg_usb_vbus>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbh1 {
+       vbus-supply = <&reg_usb_vbus>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default", "state_100mhz", "state_200mhz";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       pinctrl-1 = <&pinctrl_usdhc3_100mhz>;
+       pinctrl-2 = <&pinctrl_usdhc3_200mhz>;
+       cd-gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
+       vmmc-supply = <&reg_3p3v>;
+       no-1-8-v; /* firmware will remove if board revision supports */
+       status = "okay";
+};
+
+&wdog1 {
+       status = "disabled";
+};
+
+&wdog2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+       status = "okay";
+};
+
+&iomuxc {
+       pinctrl_accel: accelmuxgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_18__GPIO7_IO13          0x1b0b1
+               >;
+       };
+
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+               >;
+       };
+
+       pinctrl_ecspi2: escpi2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1
+                       MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1
+                       MX6QDL_PAD_EIM_OE__ECSPI2_MISO  0x100b1
+                       MX6QDL_PAD_EIM_RW__GPIO2_IO26   0x100b1
+               >;
+       };
+
+       pinctrl_flexcan1: flexcan1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX        0x1b0b1
+                       MX6QDL_PAD_KEY_COL2__FLEXCAN1_TX        0x1b0b1
+                       MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x4001b0b0
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW4__GPIO4_IO15         0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x0001b0b0
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28       0x1b0b0
+                       MX6QDL_PAD_ENET_TXD1__GPIO1_IO29        0x1b0b0
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_5__GPIO1_IO05           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm1: pwm1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_9__PWM1_OUT             0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT2__PWM4_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+                       MX6QDL_PAD_GPIO_17__GPIO7_IO12          0x4001b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT3__GPIO2_IO11         0x4001b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x13059
+               >;
+       };
+
+       pinctrl_usdhc3: usdhc3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x17059 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x17059
+               >;
+       };
+
+       pinctrl_usdhc3_100mhz: usdhc3grp100mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170b9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100b9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170b9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170b9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170b9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170b9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170b9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170b9
+               >;
+       };
+
+       pinctrl_usdhc3_200mhz: usdhc3grp200mhz {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_CMD__SD3_CMD             0x170f9
+                       MX6QDL_PAD_SD3_CLK__SD3_CLK             0x100f9
+                       MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x170f9
+                       MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x170f9
+                       MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x170f9
+                       MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x170f9
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x170f9 /* CD */
+                       MX6QDL_PAD_NANDF_CS1__SD3_VSELECT       0x170f9
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT3__WDOG2_B            0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-gw5913.dtsi b/arch/arm/dts/imx6qdl-gw5913.dtsi
new file mode 100644 (file)
index 0000000..9fae4cc
--- /dev/null
@@ -0,0 +1,501 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 Gateworks Corporation
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       /* these are used by bootloader for disabling nodes */
+       aliases {
+               led0 = &led0;
+               led1 = &led1;
+               nand = &gpmi;
+               usb0 = &usbh1;
+               usb1 = &usbotg;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               user-pb {
+                       label = "user_pb";
+                       gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               user-pb1x {
+                       label = "user_pb1x";
+                       linux,code = <BTN_1>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <0>;
+               };
+
+               key-erased {
+                       label = "key-erased";
+                       linux,code = <BTN_2>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <1>;
+               };
+
+               eeprom-wp {
+                       label = "eeprom_wp";
+                       linux,code = <BTN_3>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <2>;
+               };
+
+               tamper {
+                       label = "tamper";
+                       linux,code = <BTN_4>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <5>;
+               };
+
+               switch-hold {
+                       label = "switch_hold";
+                       linux,code = <BTN_5>;
+                       interrupt-parent = <&gsc>;
+                       interrupts = <7>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led0: user1 {
+                       label = "user1";
+                       gpios = <&gpio4 6 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDG */
+                       default-state = "on";
+                       linux,default-trigger = "heartbeat";
+               };
+
+               led1: user2 {
+                       label = "user2";
+                       gpios = <&gpio4 7 GPIO_ACTIVE_HIGH>; /* MX6_PANLEDR */
+                       default-state = "off";
+               };
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x20000000>;
+       };
+
+       pps {
+               compatible = "pps-gpio";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pps>;
+               gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "3P3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-always-on;
+       };
+
+       reg_5p0v: regulator-5p0v {
+               compatible = "regulator-fixed";
+               regulator-name = "5P0V";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-always-on;
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       status = "okay";
+};
+
+&gpmi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_gpmi_nand>;
+       status = "okay";
+};
+
+&i2c1 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c1>;
+       status = "okay";
+
+       gsc: gsc@20 {
+               compatible = "gw,gsc";
+               reg = <0x20>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               #size-cells = <0>;
+
+               adc {
+                       compatible = "gw,gsc-adc";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       channel@6 {
+                               gw,mode = <0>;
+                               reg = <0x06>;
+                               label = "temp";
+                       };
+
+                       channel@8 {
+                               gw,mode = <3>;
+                               reg = <0x08>;
+                               label = "vdd_bat";
+                       };
+
+                       channel@82 {
+                               gw,mode = <2>;
+                               reg = <0x82>;
+                               label = "vdd_vin";
+                               gw,voltage-divider-ohms = <22100 1000>;
+                               gw,voltage-offset-microvolt = <800000>;
+                       };
+
+                       channel@84 {
+                               gw,mode = <2>;
+                               reg = <0x84>;
+                               label = "vdd_5p0";
+                               gw,voltage-divider-ohms = <22100 10000>;
+                       };
+
+                       channel@86 {
+                               gw,mode = <2>;
+                               reg = <0x86>;
+                               label = "vdd_3p3";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+
+                       channel@88 {
+                               gw,mode = <2>;
+                               reg = <0x88>;
+                               label = "vdd_2p5";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+
+                       channel@8c {
+                               gw,mode = <2>;
+                               reg = <0x8c>;
+                               label = "vdd_arm";
+                       };
+
+                       channel@8e {
+                               gw,mode = <2>;
+                               reg = <0x8e>;
+                               label = "vdd_soc";
+                       };
+
+                       channel@90 {
+                               gw,mode = <2>;
+                               reg = <0x90>;
+                               label = "vdd_1p5";
+                       };
+
+                       channel@92 {
+                               gw,mode = <2>;
+                               reg = <0x92>;
+                               label = "vdd_1p0";
+                       };
+
+                       channel@98 {
+                               gw,mode = <2>;
+                               reg = <0x98>;
+                               label = "vdd_3p0";
+                       };
+
+                       channel@9a {
+                               gw,mode = <2>;
+                               reg = <0x9a>;
+                               label = "vdd_an1";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+
+                       channel@a2 {
+                               gw,mode = <2>;
+                               reg = <0xa2>;
+                               label = "vdd_gsc";
+                               gw,voltage-divider-ohms = <10000 10000>;
+                       };
+               };
+       };
+
+       gsc_gpio: gpio@23 {
+               compatible = "nxp,pca9555";
+               reg = <0x23>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               interrupt-parent = <&gsc>;
+               interrupts = <4>;
+       };
+
+       eeprom@50 {
+               compatible = "atmel,24c02";
+               reg = <0x50>;
+               pagesize = <16>;
+       };
+
+       eeprom@51 {
+               compatible = "atmel,24c02";
+               reg = <0x51>;
+               pagesize = <16>;
+       };
+
+       eeprom@52 {
+               compatible = "atmel,24c02";
+               reg = <0x52>;
+               pagesize = <16>;
+       };
+
+       eeprom@53 {
+               compatible = "atmel,24c02";
+               reg = <0x53>;
+               pagesize = <16>;
+       };
+
+       rtc@68 {
+               compatible = "dallas,ds1672";
+               reg = <0x68>;
+       };
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+};
+
+&pcie {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcie>;
+       reset-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
+       status = "okay";
+};
+
+&pwm2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm2>; /* MX6_DIO1 */
+       status = "disabled";
+};
+
+&pwm3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm3>; /* MX6_DIO2 */
+       status = "disabled";
+};
+
+&pwm4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pwm4>; /* MX6_DIO3 */
+       status = "disabled";
+};
+
+&uart1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart1>;
+       status = "okay";
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart3>;
+       status = "okay";
+};
+
+&uart5 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart5>;
+       status = "okay";
+};
+
+&usbotg {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       disable-over-current;
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbh1 {
+       status = "okay";
+};
+
+&wdog1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_wdog>;
+       fsl,ext-reset-output;
+};
+
+&iomuxc {
+       pinctrl_enet: enetgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                       MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                       MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                       MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                       MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                       MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                       MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                       MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                       MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                       MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                       MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                       MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                       MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                       MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                       MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                       MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       MX6QDL_PAD_ENET_TXD0__GPIO1_IO30        0x1b0b0
+               >;
+       };
+
+       pinctrl_gpio_leds: gpioledsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL0__GPIO4_IO06         0x1b0b0
+                       MX6QDL_PAD_KEY_ROW0__GPIO4_IO07         0x1b0b0
+               >;
+       };
+
+       pinctrl_gpmi_nand: gpminandgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_NANDF_CLE__NAND_CLE          0xb0b1
+                       MX6QDL_PAD_NANDF_ALE__NAND_ALE          0xb0b1
+                       MX6QDL_PAD_NANDF_WP_B__NAND_WP_B        0xb0b1
+                       MX6QDL_PAD_NANDF_RB0__NAND_READY_B      0xb000
+                       MX6QDL_PAD_NANDF_CS0__NAND_CE0_B        0xb0b1
+                       MX6QDL_PAD_SD4_CMD__NAND_RE_B           0xb0b1
+                       MX6QDL_PAD_SD4_CLK__NAND_WE_B           0xb0b1
+                       MX6QDL_PAD_NANDF_D0__NAND_DATA00        0xb0b1
+                       MX6QDL_PAD_NANDF_D1__NAND_DATA01        0xb0b1
+                       MX6QDL_PAD_NANDF_D2__NAND_DATA02        0xb0b1
+                       MX6QDL_PAD_NANDF_D3__NAND_DATA03        0xb0b1
+                       MX6QDL_PAD_NANDF_D4__NAND_DATA04        0xb0b1
+                       MX6QDL_PAD_NANDF_D5__NAND_DATA05        0xb0b1
+                       MX6QDL_PAD_NANDF_D6__NAND_DATA06        0xb0b1
+                       MX6QDL_PAD_NANDF_D7__NAND_DATA07        0xb0b1
+               >;
+       };
+
+       pinctrl_i2c1: i2c1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D21__I2C1_SCL            0x4001b8b1
+                       MX6QDL_PAD_EIM_D28__I2C1_SDA            0x4001b8b1
+                       MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x0001b0b0
+               >;
+       };
+
+       pinctrl_i2c2: i2c2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                       MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+               >;
+       };
+
+       pinctrl_i2c3: i2c3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_3__I2C3_SCL             0x4001b8b1
+                       MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001b8b1
+               >;
+       };
+
+       pinctrl_pcie: pciegrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_0__GPIO1_IO00           0x1b0b0
+               >;
+       };
+
+       pinctrl_pps: ppsgrp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT5__GPIO7_IO00         0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm2: pwm2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT2__PWM2_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm3: pwm3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_DAT1__PWM3_OUT           0x1b0b1
+               >;
+       };
+
+       pinctrl_pwm4: pwm4grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD1_CMD__PWM4_OUT            0x1b0b1
+               >;
+       };
+
+       pinctrl_uart1: uart1grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart2: uart2grp {
+               fsl,pins = <
+                       MX6QDL_PAD_SD4_DAT7__UART2_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_SD4_DAT4__UART2_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_uart3: uart3grp {
+               fsl,pins = <
+                       MX6QDL_PAD_EIM_D24__UART3_TX_DATA       0x1b0b1
+                       MX6QDL_PAD_EIM_D25__UART3_RX_DATA       0x1b0b1
+               >;
+       };
+
+       pinctrl_uart5: uart5grp {
+               fsl,pins = <
+                       MX6QDL_PAD_KEY_COL1__UART5_TX_DATA      0x1b0b1
+                       MX6QDL_PAD_KEY_ROW1__UART5_RX_DATA      0x1b0b1
+               >;
+       };
+
+       pinctrl_usbotg: usbotggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_GPIO_1__USB_OTG_ID           0x17059
+               >;
+       };
+
+       pinctrl_wdog: wdoggrp {
+               fsl,pins = <
+                       MX6QDL_PAD_DISP0_DAT8__WDOG1_B          0x1b0b0
+               >;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-udoo-u-boot.dtsi b/arch/arm/dts/imx6qdl-udoo-u-boot.dtsi
new file mode 100644 (file)
index 0000000..749791a
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/ {
+       aliases {
+               mmc0 = &usdhc3;
+       };
+};
diff --git a/arch/arm/dts/imx6qdl-udoo.dtsi b/arch/arm/dts/imx6qdl-udoo.dtsi
new file mode 100644 (file)
index 0000000..d07d8f8
--- /dev/null
@@ -0,0 +1,324 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * Author: Fabio Estevam <fabio.estevam@freescale.com>
+ */
+
+/ {
+       aliases {
+               backlight = &backlight;
+               panelchan = &panelchan;
+               panel7 = &panel7;
+               touchscreenp7 = &touchscreenp7;
+       };
+
+       chosen {
+               stdout-path = &uart2;
+       };
+
+       backlight: backlight {
+               compatible = "gpio-backlight";
+               gpios = <&gpio1 4 0>;
+               default-on;
+               status = "disabled";
+       };
+
+       gpio-poweroff {
+               compatible = "gpio-poweroff";
+               gpios = <&gpio2 4 0>;
+               pinctrl-0 = <&pinctrl_power_off>;
+               pinctrl-names = "default";
+       };
+
+       memory@10000000 {
+               device_type = "memory";
+               reg = <0x10000000 0x40000000>;
+       };
+
+       panel7: panel7 {
+               /*
+                * in reality it is a -20t (parallel) model,
+                * but with LVDS bridge chip attached,
+                * so it is equivalent to -19t model in drive
+                * characteristics
+                */
+               compatible = "urt,umsh-8596md-19t";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_panel>;
+               power-supply = <&reg_panel>;
+               backlight = <&backlight>;
+               status = "disabled";
+
+               port {
+                       panel_in: endpoint {
+                               remote-endpoint = <&lvds0_out>;
+                       };
+               };
+       };
+
+       regulators {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               reg_usb_h1_vbus: regulator@0 {
+                       compatible = "regulator-fixed";
+                       reg = <0>;
+                       regulator-name = "usb_h1_vbus";
+                       regulator-min-microvolt = <5000000>;
+                       regulator-max-microvolt = <5000000>;
+                       enable-active-high;
+                       startup-delay-us = <2>; /* USB2415 requires a POR of 1 us minimum */
+                       gpio = <&gpio7 12 0>;
+               };
+
+               reg_panel: regulator@1 {
+                       compatible = "regulator-fixed";
+                       reg = <1>;
+                       regulator-name = "lcd_panel";
+                       enable-active-high;
+                       gpio = <&gpio1 2 0>;
+               };
+       };
+
+       sound {
+               compatible = "fsl,imx6q-udoo-ac97",
+                            "fsl,imx-audio-ac97";
+               model = "fsl,imx6q-udoo-ac97";
+               audio-cpu = <&ssi1>;
+               audio-routing =
+                       "RX", "Mic Jack",
+                       "Headphone Jack", "TX";
+               mux-int-port = <1>;
+               mux-ext-port = <6>;
+       };
+};
+
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii-id";
+       status = "okay";
+};
+
+&hdmi {
+       ddc-i2c-bus = <&i2c2>;
+       status = "okay";
+};
+
+&i2c2 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c2>;
+       status = "okay";
+};
+
+&i2c3 {
+       clock-frequency = <100000>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_i2c3>;
+       status = "okay";
+
+       touchscreenp7: touchscreenp7@55 {
+               compatible = "sitronix,st1232";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_touchscreenp7>;
+               reg = <0x55>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <13 8>;
+               gpios = <&gpio1 15 0>;
+               status = "disabled";
+       };
+};
+
+&iomuxc {
+       imx6q-udoo {
+               pinctrl_enet: enetgrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_RGMII_RXC__RGMII_RXC         0x1b030
+                               MX6QDL_PAD_RGMII_RD0__RGMII_RD0         0x1b030
+                               MX6QDL_PAD_RGMII_RD1__RGMII_RD1         0x1b030
+                               MX6QDL_PAD_RGMII_RD2__RGMII_RD2         0x1b030
+                               MX6QDL_PAD_RGMII_RD3__RGMII_RD3         0x1b030
+                               MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
+                               MX6QDL_PAD_RGMII_TXC__RGMII_TXC         0x1b030
+                               MX6QDL_PAD_RGMII_TD0__RGMII_TD0         0x1b030
+                               MX6QDL_PAD_RGMII_TD1__RGMII_TD1         0x1b030
+                               MX6QDL_PAD_RGMII_TD2__RGMII_TD2         0x1b030
+                               MX6QDL_PAD_RGMII_TD3__RGMII_TD3         0x1b030
+                               MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL   0x1b030
+                               MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK    0x1b0b0
+                               MX6QDL_PAD_ENET_MDIO__ENET_MDIO         0x1b0b0
+                               MX6QDL_PAD_ENET_MDC__ENET_MDC           0x1b0b0
+                               MX6QDL_PAD_GPIO_16__ENET_REF_CLK        0x4001b0a8
+                       >;
+               };
+
+               pinctrl_i2c2: i2c2grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_KEY_COL3__I2C2_SCL           0x4001b8b1
+                               MX6QDL_PAD_KEY_ROW3__I2C2_SDA           0x4001b8b1
+                       >;
+               };
+
+               pinctrl_i2c3: i2c3grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_GPIO_5__I2C3_SCL             0x4001f8b1
+                               MX6QDL_PAD_GPIO_6__I2C3_SDA             0x4001f8b1
+                       >;
+               };
+
+               pinctrl_panel: panelgrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_GPIO_2__GPIO1_IO02           0x70
+                               MX6QDL_PAD_GPIO_4__GPIO1_IO04           0x70
+                       >;
+               };
+
+               pinctrl_power_off: poweroffgrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_NANDF_D4__GPIO2_IO04         0x30
+                       >;
+               };
+
+               pinctrl_touchscreenp7: touchscreenp7grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_SD2_DAT0__GPIO1_IO15         0x70
+                               MX6QDL_PAD_SD2_DAT2__GPIO1_IO13         0x1b0b0
+                       >;
+               };
+
+               pinctrl_uart2: uart2grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_EIM_D26__UART2_TX_DATA       0x1b0b1
+                               MX6QDL_PAD_EIM_D27__UART2_RX_DATA       0x1b0b1
+                       >;
+               };
+
+               pinctrl_uart4: uart4grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_KEY_COL0__UART4_TX_DATA      0x1b0b1
+                               MX6QDL_PAD_KEY_ROW0__UART4_RX_DATA      0x1b0b1
+                       >;
+               };
+
+               pinctrl_usbh: usbhgrp {
+                       fsl,pins = <
+                               MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x80000000
+                               MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0
+                       >;
+               };
+
+               pinctrl_usbotg: usbotg {
+                       fsl,pins = <
+                               MX6QDL_PAD_GPIO_1__USB_OTG_ID 0x17059
+                               MX6QDL_PAD_EIM_D22__USB_OTG_PWR 0x17059
+                               MX6QDL_PAD_EIM_D21__USB_OTG_OC 0x17059
+                       >;
+               };
+
+               pinctrl_usdhc3: usdhc3grp {
+                       fsl,pins = <
+                               MX6QDL_PAD_SD3_CMD__SD3_CMD             0x17059
+                               MX6QDL_PAD_SD3_CLK__SD3_CLK             0x10059
+                               MX6QDL_PAD_SD3_DAT0__SD3_DATA0          0x17059
+                               MX6QDL_PAD_SD3_DAT1__SD3_DATA1          0x17059
+                               MX6QDL_PAD_SD3_DAT2__SD3_DATA2          0x17059
+                               MX6QDL_PAD_SD3_DAT3__SD3_DATA3          0x17059
+                       >;
+               };
+
+               pinctrl_ac97_running: ac97running {
+                       fsl,pins = <
+                               MX6QDL_PAD_DI0_PIN2__AUD6_TXD           0x1b0b0
+                               MX6QDL_PAD_DI0_PIN3__AUD6_TXFS          0x1b0b0
+                               MX6QDL_PAD_DI0_PIN4__AUD6_RXD           0x13080
+                               MX6QDL_PAD_DI0_PIN15__AUD6_TXC          0x13080
+                               MX6QDL_PAD_EIM_EB2__GPIO2_IO30          0x1b0b0
+                       >;
+               };
+
+               pinctrl_ac97_warm_reset: ac97warmreset {
+                       fsl,pins = <
+                               MX6QDL_PAD_DI0_PIN2__AUD6_TXD           0x1b0b0
+                               MX6QDL_PAD_DI0_PIN3__GPIO4_IO19         0x1b0b0
+                               MX6QDL_PAD_DI0_PIN4__AUD6_RXD           0x13080
+                               MX6QDL_PAD_DI0_PIN15__AUD6_TXC          0x13080
+                               MX6QDL_PAD_EIM_EB2__GPIO2_IO30          0x1b0b0
+                       >;
+               };
+
+               pinctrl_ac97_reset: ac97reset {
+                       fsl,pins = <
+                               MX6QDL_PAD_DI0_PIN2__GPIO4_IO18         0x1b0b0
+                               MX6QDL_PAD_DI0_PIN3__GPIO4_IO19         0x1b0b0
+                               MX6QDL_PAD_DI0_PIN4__AUD6_RXD           0x13080
+                               MX6QDL_PAD_DI0_PIN15__AUD6_TXC          0x13080
+                               MX6QDL_PAD_EIM_EB2__GPIO2_IO30          0x1b0b0
+                       >;
+               };
+       };
+};
+
+&ldb {
+       status = "okay";
+
+       panelchan: lvds-channel@0 {
+               port@4 {
+                       reg = <4>;
+
+                       lvds0_out: endpoint {
+                               remote-endpoint = <&panel_in>;
+                       };
+               };
+       };
+};
+
+&uart2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart2>;
+       status = "okay";
+};
+
+&uart4 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_uart4>;
+       status = "okay";
+};
+
+&usbh1 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbh>;
+       vbus-supply = <&reg_usb_h1_vbus>;
+       clocks = <&clks IMX6QDL_CLK_CKO>;
+       status = "okay";
+};
+
+&usbotg {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usbotg>;
+       status = "okay";
+};
+
+&usdhc3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_usdhc3>;
+       non-removable;
+       status = "okay";
+};
+
+&audmux {
+       status = "okay";
+};
+
+&ssi1 {
+       cell-index = <0>;
+       fsl,mode = "ac97-slave";
+       pinctrl-names = "ac97-running", "ac97-reset", "ac97-warm-reset";
+       pinctrl-0 = <&pinctrl_ac97_running>;
+       pinctrl-1 = <&pinctrl_ac97_reset>;
+       pinctrl-2 = <&pinctrl_ac97_warm_reset>;
+       ac97-gpios = <&gpio4 19 0 &gpio4 18 0 &gpio2 30 0>;
+       status = "okay";
+};
index e843a56..3701557 100644 (file)
@@ -4,11 +4,22 @@
  */
 
 / {
+       binman: binman {
+               multiple-images;
+       };
+
        wdt-reboot {
                compatible = "wdt-reboot";
                wdt = <&wdog1>;
                u-boot,dm-spl;
        };
+
+       firmware {
+               optee {
+                       compatible = "linaro,optee-tz";
+                       method = "smc";
+               };
+       };
 };
 
 &{/soc@0} {
        u-boot,dm-spl;
        sd-uhs-sdr104;
        sd-uhs-ddr50;
+       fsl,signal-voltage-switch-extra-delay-ms = <8>;
 };
 
 &usdhc3 {
        u-boot,dm-spl;
 };
 
-&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b} {
+&{/soc@0/bus@30800000/i2c@30a20000/pca9450@25} {
        u-boot,dm-spl;
 };
 
-&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b/regulators} {
+&{/soc@0/bus@30800000/i2c@30a20000/pca9450@25/regulators} {
        u-boot,dm-spl;
 };
 
 &wdog1 {
        u-boot,dm-spl;
 };
+
+&binman {
+        u-boot-spl-ddr {
+               filename = "u-boot-spl-ddr.bin";
+               pad-byte = <0xff>;
+               align-size = <4>;
+               align = <4>;
+
+               u-boot-spl {
+                       align-end = <4>;
+               };
+
+               blob_1: blob-ext@1 {
+                       filename = "lpddr4_pmu_train_1d_imem.bin";
+                       size = <0x8000>;
+               };
+
+               blob_2: blob-ext@2 {
+                       filename = "lpddr4_pmu_train_1d_dmem.bin";
+                       size = <0x4000>;
+               };
+
+               blob_3: blob-ext@3 {
+                       filename = "lpddr4_pmu_train_2d_imem.bin";
+                       size = <0x8000>;
+               };
+
+               blob_4: blob-ext@4 {
+                       filename = "lpddr4_pmu_train_2d_dmem.bin";
+                       size = <0x4000>;
+               };
+       };
+
+
+       flash {
+               mkimage {
+                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x7e1000";
+
+                       blob {
+                               filename = "u-boot-spl-ddr.bin";
+                       };
+               };
+       };
+
+       itb {
+               filename = "u-boot.itb";
+
+               fit {
+                       description = "Configuration to load ATF before U-Boot";
+                       #address-cells = <1>;
+                       fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+
+                       images {
+                               uboot {
+                                       description = "U-Boot (64-bit)";
+                                       type = "standalone";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <CONFIG_SYS_TEXT_BASE>;
+
+                                       uboot_blob: blob-ext {
+                                               filename = "u-boot-nodtb.bin";
+                                       };
+                               };
+
+                               atf {
+                                       description = "ARM Trusted Firmware";
+                                       type = "firmware";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <0x920000>;
+                                       entry = <0x920000>;
+
+                                       atf_blob: blob-ext {
+                                               filename = "bl31.bin";
+                                       };
+                               };
+
+                               fdt {
+                                       description = "NAME";
+                                       type = "flat_dt";
+                                       compression = "none";
+
+                                       uboot_fdt_blob: blob-ext {
+                                               filename = "u-boot.dtb";
+                                       };
+                               };
+                       };
+
+                       configurations {
+                               default = "conf";
+
+                               conf {
+                                       description = "NAME";
+                                       firmware = "uboot";
+                                       loadables = "atf";
+                                       fdt = "fdt";
+                               };
+                       };
+               };
+       };
+};
index 6518f08..60179e0 100644 (file)
        pinctrl-0 = <&pinctrl_i2c1>;
        status = "okay";
 
-       pmic@4b {
-               compatible = "rohm,bd71847";
-               reg = <0x4b>;
-               pinctrl-names = "default";
+       pmic: pca9450@25 {
+               reg = <0x25>;
+               compatible = "nxp,pca9450a";
+               /* PMIC PCA9450 PMIC_nINT GPIO1_IO3 */
                pinctrl-0 = <&pinctrl_pmic>;
-               interrupt-parent = <&gpio1>;
-               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
-               rohm,reset-snvs-powered;
-
-               #clock-cells = <0>;
-               clocks = <&osc_32k 0>;
-               clock-output-names = "clk-32k-out";
+               gpio_intr = <&gpio1 3 GPIO_ACTIVE_LOW>;
 
                regulators {
-                       buck1_reg: BUCK1 {
-                               regulator-name = "buck1";
-                               regulator-min-microvolt = <700000>;
-                               regulator-max-microvolt = <1300000>;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       pca9450,pmic-buck2-uses-i2c-dvs;
+                       /* Run/Standby voltage */
+                       pca9450,pmic-buck2-dvs-voltage = <950000>, <850000>;
+
+                       buck1_reg: regulator@0 {
+                               reg = <0>;
+                               regulator-compatible = "buck1";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <2187500>;
                                regulator-boot-on;
                                regulator-always-on;
-                               regulator-ramp-delay = <1250>;
+                               regulator-ramp-delay = <3125>;
                        };
 
-                       buck2_reg: BUCK2 {
-                               regulator-name = "buck2";
-                               regulator-min-microvolt = <700000>;
-                               regulator-max-microvolt = <1300000>;
+                       buck2_reg: regulator@1 {
+                               reg = <1>;
+                               regulator-compatible = "buck2";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <2187500>;
                                regulator-boot-on;
                                regulator-always-on;
-                               regulator-ramp-delay = <1250>;
-                               rohm,dvs-run-voltage = <1000000>;
-                               rohm,dvs-idle-voltage = <900000>;
+                               regulator-ramp-delay = <3125>;
                        };
 
-                       buck3_reg: BUCK3 {
-                               // BUCK5 in datasheet
-                               regulator-name = "buck3";
-                               regulator-min-microvolt = <700000>;
-                               regulator-max-microvolt = <1350000>;
+                       buck3_reg: regulator@2 {
+                               reg = <2>;
+                               regulator-compatible = "buck3";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <2187500>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       buck4_reg: BUCK4 {
-                               // BUCK6 in datasheet
-                               regulator-name = "buck4";
-                               regulator-min-microvolt = <3000000>;
-                               regulator-max-microvolt = <3300000>;
+                       buck4_reg: regulator@3 {
+                               reg = <3>;
+                               regulator-compatible = "buck4";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <3400000>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       buck5_reg: BUCK5 {
-                               // BUCK7 in datasheet
-                               regulator-name = "buck5";
-                               regulator-min-microvolt = <1605000>;
-                               regulator-max-microvolt = <1995000>;
+                       buck5_reg: regulator@4 {
+                               reg = <4>;
+                               regulator-compatible = "buck5";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <3400000>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       buck6_reg: BUCK6 {
-                               // BUCK8 in datasheet
-                               regulator-name = "buck6";
-                               regulator-min-microvolt = <800000>;
-                               regulator-max-microvolt = <1400000>;
+                       buck6_reg: regulator@5 {
+                               reg = <5>;
+                               regulator-compatible = "buck6";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <3400000>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       ldo1_reg: LDO1 {
-                               regulator-name = "ldo1";
+                       ldo1_reg: regulator@6 {
+                               reg = <6>;
+                               regulator-compatible = "ldo1";
                                regulator-min-microvolt = <1600000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       ldo2_reg: LDO2 {
-                               regulator-name = "ldo2";
+                       ldo2_reg: regulator@7 {
+                               reg = <7>;
+                               regulator-compatible = "ldo2";
                                regulator-min-microvolt = <800000>;
-                               regulator-max-microvolt = <900000>;
+                               regulator-max-microvolt = <1150000>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       ldo3_reg: LDO3 {
-                               regulator-name = "ldo3";
-                               regulator-min-microvolt = <1800000>;
+                       ldo3_reg: regulator@8 {
+                               reg = <8>;
+                               regulator-compatible = "ldo3";
+                               regulator-min-microvolt = <800000>;
                                regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       ldo4_reg: LDO4 {
-                               regulator-name = "ldo4";
-                               regulator-min-microvolt = <900000>;
-                               regulator-max-microvolt = <1800000>;
+                       ldo4_reg: regulator@9 {
+                               reg = <9>;
+                               regulator-compatible = "ldo4";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
                                regulator-boot-on;
                                regulator-always-on;
                        };
 
-                       ldo6_reg: LDO6 {
-                               regulator-name = "ldo6";
-                               regulator-min-microvolt = <900000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-boot-on;
-                               regulator-always-on;
+                       ldo5_reg: regulator@10 {
+                               reg = <10>;
+                               regulator-compatible = "ldo5";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
                        };
+
                };
        };
 };
index 49bff19..376ca8f 100644 (file)
                };
        };
 
+       reg_audio: regulator-audio {
+               compatible = "regulator-fixed";
+               regulator-name = "3v3_aud";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&pca6416_1 11 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+       };
+
        reg_usdhc2_vmmc: regulator-usdhc2 {
                compatible = "regulator-fixed";
                regulator-name = "vsd_3v3";
                gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
                enable-active-high;
        };
+
+       sound {
+               compatible = "fsl,imx-audio-wm8962";
+               model = "wm8962-audio";
+               audio-cpu = <&sai3>;
+               audio-codec = <&wm8962>;
+               audio-routing =
+                       "Headphone Jack", "HPOUTL",
+                       "Headphone Jack", "HPOUTR",
+                       "Ext Spk", "SPKOUTL",
+                       "Ext Spk", "SPKOUTR",
+                       "AMIC", "MICBIAS",
+                       "IN3R", "AMIC";
+       };
 };
 
 &ecspi2 {
                interrupt-parent = <&gpio4>;
                interrupts = <27 IRQ_TYPE_LEVEL_LOW>;
        };
+
+       wm8962: audio-codec@1a {
+               compatible = "wlf,wm8962";
+               reg = <0x1a>;
+               clocks = <&clk IMX8MN_CLK_SAI3_ROOT>;
+               clock-names = "xclk";
+               DCVDD-supply = <&reg_audio>;
+               DBVDD-supply = <&reg_audio>;
+               AVDD-supply = <&reg_audio>;
+               CPVDD-supply = <&reg_audio>;
+               MICVDD-supply = <&reg_audio>;
+               PLLVDD-supply = <&reg_audio>;
+               SPKVDD1-supply = <&reg_audio>;
+               SPKVDD2-supply = <&reg_audio>;
+               gpio-cfg = <
+                       0x0000 /* 0:Default */
+                       0x0000 /* 1:Default */
+                       0x0000 /* 2:FN_DMICCLK */
+                       0x0000 /* 3:Default */
+                       0x0000 /* 4:FN_DMICCDAT */
+                       0x0000 /* 5:Default */
+               >;
+       };
+};
+
+&easrc {
+       fsl,asrc-rate  = <48000>;
+       status = "okay";
+};
+
+&sai3 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_sai3>;
+       assigned-clocks = <&clk IMX8MN_CLK_SAI3>;
+       assigned-clock-parents = <&clk IMX8MN_AUDIO_PLL1_OUT>;
+       assigned-clock-rates = <24576000>;
+       fsl,sai-mclk-direction-output;
+       status = "okay";
 };
 
 &snvs_pwrkey {
                >;
        };
 
+       pinctrl_sai3: sai3grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC     0xd6
+                       MX8MN_IOMUXC_SAI3_TXC_SAI3_TX_BCLK      0xd6
+                       MX8MN_IOMUXC_SAI3_MCLK_SAI3_MCLK        0xd6
+                       MX8MN_IOMUXC_SAI3_TXD_SAI3_TX_DATA0     0xd6
+                       MX8MN_IOMUXC_SAI3_RXD_SAI3_RX_DATA0     0xd6
+               >;
+       };
+
        pinctrl_uart2: uart2grp {
                fsl,pins = <
                        MX8MN_IOMUXC_UART2_RXD_UART2_DCE_RX     0x140
index 52a50d9..de2cd0e 100644 (file)
@@ -4,6 +4,12 @@
  */
 
 / {
+       aliases {
+               rtc0 = &rtc;
+               rtc1 = &snvs_rtc;
+               spi0 = &flexspi;
+       };
+
        usdhc1_pwrseq: usdhc1_pwrseq {
                compatible = "mmc-pwrseq-simple";
                pinctrl-names = "default";
        cpu-supply = <&buck2_reg>;
 };
 
+/* DDR controller is running LPDDR at 800MHz which requires 0.95V */
+&a53_opp_table {
+       opp-1200000000 {
+               opp-microvolt = <950000>;
+       };
+};
+
+&ddrc {
+       operating-points-v2 = <&ddrc_opp_table>;
+
+       ddrc_opp_table: opp-table {
+               compatible = "operating-points-v2";
+
+               opp-25M {
+                       opp-hz = /bits/ 64 <25000000>;
+               };
+
+               opp-100M {
+                       opp-hz = /bits/ 64 <100000000>;
+               };
+
+               opp-800M {
+                       opp-hz = /bits/ 64 <800000000>;
+               };
+       };
+};
+
 &fec1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_fec1>;
        phy-mode = "rgmii-id";
        phy-handle = <&ethphy0>;
+       phy-supply = <&buck6_reg>;
        phy-reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
        fsl,magic-packet;
        status = "okay";
        };
 };
 
+&flexspi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_flexspi>;
+       status = "okay";
+
+       flash@0 {
+               reg = <0>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               spi-max-frequency = <80000000>;
+               spi-tx-bus-width = <4>;
+               spi-rx-bus-width = <4>;
+       };
+};
+
 &i2c1 {
        clock-frequency = <400000>;
        pinctrl-names = "default";
                reg = <0x50>;
        };
 
-       rtc@51 {
+       rtc: rtc@51 {
                compatible = "nxp,pcf85263";
                reg = <0x51>;
        };
                >;
        };
 
+       pinctrl_flexspi: flexspigrp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_NAND_ALE_QSPI_A_SCLK               0x1c2
+                       MX8MN_IOMUXC_NAND_CE0_B_QSPI_A_SS0_B            0x82
+                       MX8MN_IOMUXC_NAND_DATA00_QSPI_A_DATA0           0x82
+                       MX8MN_IOMUXC_NAND_DATA01_QSPI_A_DATA1           0x82
+                       MX8MN_IOMUXC_NAND_DATA02_QSPI_A_DATA2           0x82
+                       MX8MN_IOMUXC_NAND_DATA03_QSPI_A_DATA3           0x82
+               >;
+       };
+
        pinctrl_pmic: pmicirqgrp {
                fsl,pins = <
                        MX8MN_IOMUXC_GPIO1_IO03_GPIO1_IO3               0x141
index 025090f..1d38444 100644 (file)
@@ -4,11 +4,21 @@
  */
 
 / {
+       binman: binman {
+               multiple-images;
+       };
+
        wdt-reboot {
                compatible = "wdt-reboot";
                wdt = <&wdog1>;
                u-boot,dm-spl;
        };
+       firmware {
+               optee {
+                       compatible = "linaro,optee-tz";
+                       method = "smc";
+               };
+       };
 };
 
 &{/soc@0} {
@@ -19,6 +29,9 @@
 &clk {
        u-boot,dm-spl;
        u-boot,dm-pre-reloc;
+       /delete-property/ assigned-clocks;
+       /delete-property/ assigned-clock-parents;
+       /delete-property/ assigned-clock-rates;
 };
 
 &osc_24m {
 &wdog1 {
        u-boot,dm-spl;
 };
+
+&binman {
+        u-boot-spl-ddr {
+               filename = "u-boot-spl-ddr.bin";
+               pad-byte = <0xff>;
+               align-size = <4>;
+               align = <4>;
+
+               u-boot-spl {
+                       align-end = <4>;
+               };
+
+               blob_1: blob-ext@1 {
+                       filename = "ddr4_imem_1d_201810.bin";
+                       size = <0x8000>;
+               };
+
+               blob_2: blob-ext@2 {
+                       filename = "ddr4_dmem_1d_201810.bin";
+                       size = <0x4000>;
+               };
+
+               blob_3: blob-ext@3 {
+                       filename = "ddr4_imem_2d_201810.bin";
+                       size = <0x8000>;
+               };
+
+               blob_4: blob-ext@4 {
+                       filename = "ddr4_dmem_2d_201810.bin";
+                       size = <0x4000>;
+               };
+       };
+
+
+       flash {
+               mkimage {
+                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x912000";
+
+                       blob {
+                               filename = "u-boot-spl-ddr.bin";
+                       };
+               };
+       };
+
+       itb {
+               filename = "u-boot.itb";
+
+               fit {
+                       description = "Configuration to load ATF before U-Boot";
+                       #address-cells = <1>;
+                       fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+
+                       images {
+                               uboot {
+                                       description = "U-Boot (64-bit)";
+                                       type = "standalone";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <CONFIG_SYS_TEXT_BASE>;
+
+                                       uboot_blob: blob-ext {
+                                               filename = "u-boot-nodtb.bin";
+                                       };
+                               };
+
+                               atf {
+                                       description = "ARM Trusted Firmware";
+                                       type = "firmware";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <0x960000>;
+                                       entry = <0x960000>;
+
+                                       atf_blob: blob-ext {
+                                               filename = "bl31.bin";
+                                       };
+                               };
+
+                               fdt {
+                                       description = "NAME";
+                                       type = "flat_dt";
+                                       compression = "none";
+
+                                       uboot_fdt_blob: blob-ext {
+                                               filename = "u-boot.dtb";
+                                       };
+                               };
+                       };
+
+                       configurations {
+                               default = "conf";
+
+                               conf {
+                                       description = "NAME";
+                                       firmware = "uboot";
+                                       loadables = "atf";
+                                       fdt = "fdt";
+                               };
+                       };
+               };
+       };
+};
diff --git a/arch/arm/dts/imx8mn-evk-u-boot.dtsi b/arch/arm/dts/imx8mn-evk-u-boot.dtsi
new file mode 100644 (file)
index 0000000..3db46d4
--- /dev/null
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include "imx8mn-ddr4-evk-u-boot.dtsi"
+
+&i2c1 {
+       u-boot,dm-spl;
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pca9450@25} {
+       u-boot,dm-spl;
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pca9450@25/regulators} {
+       u-boot,dm-spl;
+};
+
+&pinctrl_i2c1 {
+       u-boot,dm-spl;
+};
+
+&pinctrl_pmic {
+       u-boot,dm-spl;
+};
+
+&binman {
+        u-boot-spl-ddr {
+               filename = "u-boot-spl-ddr.bin";
+               pad-byte = <0xff>;
+               align-size = <4>;
+               align = <4>;
+
+               u-boot-spl {
+                       align-end = <4>;
+               };
+
+               blob_1: blob-ext@1 {
+                       filename = "lpddr4_pmu_train_1d_imem.bin";
+                       size = <0x8000>;
+               };
+
+               blob_2: blob-ext@2 {
+                       filename = "lpddr4_pmu_train_1d_dmem.bin";
+                       size = <0x4000>;
+               };
+
+               blob_3: blob-ext@3 {
+                       filename = "lpddr4_pmu_train_2d_imem.bin";
+                       size = <0x8000>;
+               };
+
+               blob_4: blob-ext@4 {
+                       filename = "lpddr4_pmu_train_2d_dmem.bin";
+                       size = <0x4000>;
+               };
+       };
+
+
+       flash {
+               mkimage {
+                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x912000";
+
+                       blob {
+                               filename = "u-boot-spl-ddr.bin";
+                       };
+               };
+       };
+
+       itb {
+               filename = "u-boot.itb";
+
+               fit {
+                       description = "Configuration to load ATF before U-Boot";
+                       #address-cells = <1>;
+                       fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+
+                       images {
+                               uboot {
+                                       description = "U-Boot (64-bit)";
+                                       type = "standalone";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <CONFIG_SYS_TEXT_BASE>;
+
+                                       uboot_blob: blob-ext {
+                                               filename = "u-boot-nodtb.bin";
+                                       };
+                               };
+
+                               atf {
+                                       description = "ARM Trusted Firmware";
+                                       type = "firmware";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <0x960000>;
+                                       entry = <0x960000>;
+
+                                       atf_blob: blob-ext {
+                                               filename = "bl31.bin";
+                                       };
+                               };
+
+                               fdt {
+                                       description = "NAME";
+                                       type = "flat_dt";
+                                       compression = "none";
+
+                                       uboot_fdt_blob: blob-ext {
+                                               filename = "u-boot.dtb";
+                                       };
+                               };
+                       };
+
+                       configurations {
+                               default = "conf";
+
+                               conf {
+                                       description = "NAME";
+                                       firmware = "uboot";
+                                       loadables = "atf";
+                                       fdt = "fdt";
+                               };
+                       };
+               };
+       };
+};
diff --git a/arch/arm/dts/imx8mn-evk.dts b/arch/arm/dts/imx8mn-evk.dts
new file mode 100644 (file)
index 0000000..cd11fb2
--- /dev/null
@@ -0,0 +1,128 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2019 NXP
+ */
+
+/dts-v1/;
+
+#include "imx8mn.dtsi"
+#include "imx8mn-evk.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
+
+/ {
+       model = "NXP i.MX8MNano EVK board";
+       compatible = "fsl,imx8mn-evk", "fsl,imx8mn";
+};
+
+&A53_0 {
+       cpu-supply = <&buck2>;
+};
+
+&A53_1 {
+       cpu-supply = <&buck2>;
+};
+
+&A53_2 {
+       cpu-supply = <&buck2>;
+};
+
+&A53_3 {
+       cpu-supply = <&buck2>;
+};
+
+&i2c1 {
+       pmic: pca9450@25 {
+               compatible = "nxp,pca9450b";
+               reg = <0x25>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_pmic>;
+               interrupt-parent = <&gpio1>;
+               interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+
+               regulators {
+                       buck1: BUCK1{
+                               regulator-name = "BUCK1";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <2187500>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <3125>;
+                       };
+
+                       buck2: BUCK2 {
+                               regulator-name = "BUCK2";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <2187500>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <3125>;
+                               nxp,dvs-run-voltage = <950000>;
+                               nxp,dvs-standby-voltage = <850000>;
+                       };
+
+                       buck4: BUCK4{
+                               regulator-name = "BUCK4";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck5: BUCK5{
+                               regulator-name = "BUCK5";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       buck6: BUCK6 {
+                               regulator-name = "BUCK6";
+                               regulator-min-microvolt = <600000>;
+                               regulator-max-microvolt = <3400000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo1: LDO1 {
+                               regulator-name = "LDO1";
+                               regulator-min-microvolt = <1600000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo2: LDO2 {
+                               regulator-name = "LDO2";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1150000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo3: LDO3 {
+                               regulator-name = "LDO3";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo4: LDO4 {
+                               regulator-name = "LDO4";
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       ldo5: LDO5 {
+                               regulator-name = "LDO5";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
+       };
+};
index ee17902..16ea500 100644 (file)
        };
 
        soc@0 {
-               compatible = "simple-bus";
+               compatible = "fsl,imx8mn-soc", "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                ranges = <0x0 0x0 0x0 0x3e000000>;
+               nvmem-cells = <&imx8mn_uid>;
+               nvmem-cell-names = "soc_unique_id";
 
                aips1: bus@30000000 {
                        compatible = "fsl,aips-bus", "simple-bus";
                        #size-cells = <1>;
                        ranges;
 
-                       spba: bus@30000000 {
+                       spba: spba-bus@30000000 {
                                compatible = "fsl,spba-bus", "simple-bus";
                                #address-cells = <1>;
                                #size-cells = <1>;
                                #address-cells = <1>;
                                #size-cells = <1>;
 
+                               imx8mn_uid: unique-id@410 {
+                                       reg = <0x4 0x8>;
+                               };
+
                                cpu_speed_grade: speed-grade@10 {
                                        reg = <0x10 4>;
                                };
+
+                               fec_mac_address: mac-address@90 {
+                                       reg = <0x90 6>;
+                               };
                        };
 
                        anatop: anatop@30360000 {
                                                <&clk IMX8MN_CLK_NOC>,
                                                <&clk IMX8MN_CLK_AUDIO_AHB>,
                                                <&clk IMX8MN_CLK_IPG_AUDIO_ROOT>,
-                                               <&clk IMX8MN_SYS_PLL3>;
+                                               <&clk IMX8MN_SYS_PLL3>,
+                                               <&clk IMX8MN_AUDIO_PLL1>,
+                                               <&clk IMX8MN_AUDIO_PLL2>;
                                assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_800M>,
                                                         <&clk IMX8MN_ARM_PLL_OUT>,
                                                         <&clk IMX8MN_SYS_PLL3_OUT>,
                                assigned-clock-rates = <0>, <0>, <0>,
                                                        <400000000>,
                                                        <400000000>,
-                                                       <600000000>;
+                                                       <600000000>,
+                                                       <393216000>,
+                                                       <361267200>;
                        };
 
                        src: reset-controller@30390000 {
                                status = "disabled";
                        };
 
+                       flexspi: spi@30bb0000 {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               compatible = "nxp,imx8mm-fspi";
+                               reg = <0x30bb0000 0x10000>, <0x8000000 0x10000000>;
+                               reg-names = "fspi_base", "fspi_mmap";
+                               interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>;
+                               clocks = <&clk IMX8MN_CLK_QSPI_ROOT>,
+                                        <&clk IMX8MN_CLK_QSPI_ROOT>;
+                               clock-names = "fspi", "fspi_en";
+                               status = "disabled";
+                       };
+
                        sdma1: dma-controller@30bd0000 {
                                compatible = "fsl,imx8mn-sdma", "fsl,imx8mq-sdma";
                                reg = <0x30bd0000 0x10000>;
                                assigned-clocks = <&clk IMX8MN_CLK_ENET_AXI>,
                                                  <&clk IMX8MN_CLK_ENET_TIMER>,
                                                  <&clk IMX8MN_CLK_ENET_REF>,
-                                                 <&clk IMX8MN_CLK_ENET_TIMER>;
+                                                 <&clk IMX8MN_CLK_ENET_PHY_REF>;
                                assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_266M>,
                                                         <&clk IMX8MN_SYS_PLL2_100M>,
-                                                        <&clk IMX8MN_SYS_PLL2_125M>;
-                               assigned-clock-rates = <0>, <0>, <125000000>, <100000000>;
+                                                        <&clk IMX8MN_SYS_PLL2_125M>,
+                                                        <&clk IMX8MN_SYS_PLL2_50M>;
+                               assigned-clock-rates = <0>, <100000000>, <125000000>, <0>;
                                fsl,num-tx-queues = <3>;
                                fsl,num-rx-queues = <3>;
+                               nvmem-cells = <&fec_mac_address>;
+                               nvmem-cell-names = "mac-address";
+                               nvmem_macaddr_swap;
+                               fsl,stop-mode = <&gpr 0x10 3>;
                                status = "disabled";
                        };
 
index 6a91404..4162f41 100644 (file)
@@ -4,11 +4,21 @@
  */
 
 / {
+       binman: binman {
+               multiple-images;
+       };
+
        wdt-reboot {
                compatible = "wdt-reboot";
                wdt = <&wdog1>;
                u-boot,dm-spl;
        };
+       firmware {
+               optee {
+                       compatible = "linaro,optee-tz";
+                       method = "smc";
+               };
+       };
 };
 
 &{/soc@0} {
        phy-reset-duration = <15>;
        phy-reset-post-delay = <100>;
 };
+
+&binman {
+        u-boot-spl-ddr {
+               filename = "u-boot-spl-ddr.bin";
+               pad-byte = <0xff>;
+               align-size = <4>;
+               align = <4>;
+
+               u-boot-spl {
+                       align-end = <4>;
+               };
+
+               blob_1: blob-ext@1 {
+                       filename = "lpddr4_pmu_train_1d_imem_202006.bin";
+                       size = <0x8000>;
+               };
+
+               blob_2: blob-ext@2 {
+                       filename = "lpddr4_pmu_train_1d_dmem_202006.bin";
+                       size = <0x4000>;
+               };
+
+               blob_3: blob-ext@3 {
+                       filename = "lpddr4_pmu_train_2d_imem_202006.bin";
+                       size = <0x8000>;
+               };
+
+               blob_4: blob-ext@4 {
+                       filename = "lpddr4_pmu_train_2d_dmem_202006.bin";
+                       size = <0x4000>;
+               };
+       };
+
+
+       flash {
+               mkimage {
+                       args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 0x920000";
+
+                       blob {
+                               filename = "u-boot-spl-ddr.bin";
+                       };
+               };
+       };
+
+       itb {
+               filename = "u-boot.itb";
+
+               fit {
+                       description = "Configuration to load ATF before U-Boot";
+                       #address-cells = <1>;
+                       fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+
+                       images {
+                               uboot {
+                                       description = "U-Boot (64-bit)";
+                                       type = "standalone";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <CONFIG_SYS_TEXT_BASE>;
+
+                                       uboot_blob: blob-ext {
+                                               filename = "u-boot-nodtb.bin";
+                                       };
+                               };
+
+                               atf {
+                                       description = "ARM Trusted Firmware";
+                                       type = "firmware";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <0x970000>;
+                                       entry = <0x970000>;
+
+                                       atf_blob: blob-ext {
+                                               filename = "bl31.bin";
+                                       };
+                               };
+
+                               fdt {
+                                       description = "NAME";
+                                       type = "flat_dt";
+                                       compression = "none";
+
+                                       uboot_fdt_blob: blob-ext {
+                                               filename = "u-boot.dtb";
+                                       };
+                               };
+                       };
+
+                       configurations {
+                               default = "conf";
+
+                               conf {
+                                       description = "NAME";
+                                       firmware = "uboot";
+                                       loadables = "atf";
+                                       fdt = "fdt";
+                               };
+                       };
+               };
+       };
+};
index f37fe21..bb13e07 100644 (file)
 #define MXC_CPU_IMX8MNL                0x8e /* dummy ID */
 #define MXC_CPU_IMX8MNDL               0x8f /* dummy ID */
 #define MXC_CPU_IMX8MNSL               0x181 /* dummy ID */
-#define MXC_CPU_IMX8MP         0x182/* dummy ID */
-#define MXC_CPU_IMX8MP6                0x184 /* dummy ID */
-#define MXC_CPU_IMX8MPL                0x186 /* dummy ID */
-#define MXC_CPU_IMX8MPD                0x187 /* dummy ID */
+#define MXC_CPU_IMX8MNUQ               0x182 /* dummy ID */
+#define MXC_CPU_IMX8MNUD               0x183 /* dummy ID */
+#define MXC_CPU_IMX8MNUS               0x184 /* dummy ID */
+#define MXC_CPU_IMX8MP         0x185/* dummy ID */
+#define MXC_CPU_IMX8MP6                0x186 /* dummy ID */
+#define MXC_CPU_IMX8MPL                0x187 /* dummy ID */
+#define MXC_CPU_IMX8MPD                0x188 /* dummy ID */
 #define MXC_CPU_IMX8QXP_A0     0x90 /* dummy ID */
 #define MXC_CPU_IMX8QM         0x91 /* dummy ID */
 #define MXC_CPU_IMX8QXP                0x92 /* dummy ID */
 #define CHIP_REV_1_0            0x10
 #define CHIP_REV_1_1            0x11
 #define CHIP_REV_1_2            0x12
+#define CHIP_REV_1_3            0x13
 #define CHIP_REV_1_5            0x15
 #define CHIP_REV_2_0            0x20
 #define CHIP_REV_2_1            0x21
+#define CHIP_REV_2_2            0x22
 #define CHIP_REV_2_5            0x25
 #define CHIP_REV_3_0            0x30
 
index c1e5700..547beeb 100644 (file)
@@ -53,4 +53,15 @@ struct signature_block_hdr {
        u16 signature_offset;
        u32 reserved;
 } __packed;
+
+struct generate_key_blob_hdr {
+       u8 version;
+       u8 length_lsb;
+       u8 length_msb;
+       u8 tag;
+       u8 flags;
+       u8 size;
+       u8 algorithm;
+       u8 mode;
+} __packed;
 #endif
index c545eb8..77d9428 100644 (file)
@@ -275,3 +275,4 @@ void enable_ocotp_clk(unsigned char enable);
 int enable_i2c_clk(unsigned char enable, unsigned int i2c_num);
 int set_clk_enet(enum enet_freq type);
 int set_clk_eqos(enum enet_freq type);
+void hab_caam_clock_enable(unsigned char enable);
index 3f50014..b800da1 100644 (file)
 #define IOMUXC_GPR_GPR1_GPR_ENET_QOS_INTF_SEL_MASK 0x70000
 #define FEC_QUIRK_ENET_MAC
 
+#define CAAM_ARB_BASE_ADDR              (0x00100000)
+#define CAAM_ARB_END_ADDR               (0x00107FFF)
+#define CAAM_IPS_BASE_ADDR              (0x30900000)
+#define CONFIG_SYS_FSL_SEC_OFFSET       (0)
+#define CONFIG_SYS_FSL_SEC_ADDR         (CAAM_IPS_BASE_ADDR + \
+                                        CONFIG_SYS_FSL_SEC_OFFSET)
+#define CONFIG_SYS_FSL_JR0_OFFSET       (0x1000)
+#define CONFIG_SYS_FSL_JR0_ADDR         (CONFIG_SYS_FSL_SEC_ADDR + \
+                                        CONFIG_SYS_FSL_JR0_OFFSET)
+#define CONFIG_SYS_FSL_MAX_NUM_OF_SEC   1
 #if !defined(__ASSEMBLY__)
 #include <asm/types.h>
 #include <linux/bitops.h>
@@ -120,6 +130,16 @@ struct ocotp_regs {
        } bank[0];
 };
 
+#ifdef CONFIG_IMX8MP
+struct fuse_bank0_regs {
+       u32 lock;
+       u32 rsvd0[7];
+       u32 uid_low;
+       u32 rsvd1[3];
+       u32 uid_high;
+       u32 rsvd2[3];
+};
+#else
 struct fuse_bank0_regs {
        u32 lock;
        u32 rsvd0[3];
@@ -128,6 +148,7 @@ struct fuse_bank0_regs {
        u32 uid_high;
        u32 rsvd2[7];
 };
+#endif
 
 struct fuse_bank1_regs {
        u32 tester3;
index de4a1ab..842d0ca 100644 (file)
@@ -326,7 +326,7 @@ enum {
 
        MX6_PAD_UART5_TX_DATA__UART5_DCE_TX                   = IOMUX_PAD(0x0348, 0x00BC, 0, 0x0000, 0, 0),
 
-       MX6_PAD_UART5_TX_DATA__UART5_DTE_RX                   = IOMUX_PAD(0x0348, 0x00BC, 0, 0x0644, 4, 0),
+       MX6_PAD_UART5_TX_DATA__UART5_DTE_RX                   = IOMUX_PAD(0x0348, 0x00BC, 0, 0x0644, 6, 0),
        MX6_PAD_UART5_TX_DATA__ENET2_CRS                      = IOMUX_PAD(0x0348, 0x00BC, 1, 0x0000, 0, 0),
        MX6_PAD_UART5_TX_DATA__I2C2_SCL                       = IOMUX_PAD(0x0348, 0x00BC, IOMUX_CONFIG_SION | 2, 0x05AC, 2, 0),
        MX6_PAD_UART5_TX_DATA__CSI_DATA14                     = IOMUX_PAD(0x0348, 0x00BC, 3, 0x04FC, 0, 0),
@@ -363,7 +363,7 @@ enum {
        MX6_PAD_ENET1_RX_DATA1__USDHC2_LCTL                   = IOMUX_PAD(0x0354, 0x00C8, 8, 0x0000, 0, 0),
 
        MX6_PAD_ENET1_RX_EN__ENET1_RX_EN                      = IOMUX_PAD(0x0358, 0x00CC, 0, 0x0000, 0, 0),
-       MX6_PAD_ENET1_RX_EN__UART5_DCE_RTS                    = IOMUX_PAD(0x0358, 0x00CC, 1, 0x0640, 3, 0),
+       MX6_PAD_ENET1_RX_EN__UART5_DCE_RTS                    = IOMUX_PAD(0x0358, 0x00CC, 1, 0x0640, 5, 0),
        MX6_PAD_ENET1_RX_EN__UART5_DTE_CTS                    = IOMUX_PAD(0x0358, 0x00CC, 1, 0x0000, 0, 0),
        MX6_PAD_ENET1_RX_EN__CSI_DATA18                       = IOMUX_PAD(0x0358, 0x00CC, 3, 0x050C, 0, 0),
        MX6_PAD_ENET1_RX_EN__FLEXCAN2_TX                      = IOMUX_PAD(0x0358, 0x00CC, 4, 0x0000, 0, 0),
@@ -373,7 +373,7 @@ enum {
 
        MX6_PAD_ENET1_TX_DATA0__ENET1_TDATA00                 = IOMUX_PAD(0x035C, 0x00D0, 0, 0x0000, 0, 0),
        MX6_PAD_ENET1_TX_DATA0__UART5_DCE_CTS                 = IOMUX_PAD(0x035C, 0x00D0, 1, 0x0000, 0, 0),
-       MX6_PAD_ENET1_TX_DATA0__UART5_DTE_RTS                 = IOMUX_PAD(0x035C, 0x00D0, 1, 0x0640, 4, 0),
+       MX6_PAD_ENET1_TX_DATA0__UART5_DTE_RTS                 = IOMUX_PAD(0x035C, 0x00D0, 1, 0x0640, 6, 0),
        MX6_PAD_ENET1_TX_DATA0__CSI_DATA19                    = IOMUX_PAD(0x035C, 0x00D0, 3, 0x0510, 0, 0),
        MX6_PAD_ENET1_TX_DATA0__FLEXCAN2_RX                   = IOMUX_PAD(0x035C, 0x00D0, 4, 0x0588, 1, 0),
        MX6_PAD_ENET1_TX_DATA0__GPIO2_IO03                    = IOMUX_PAD(0x035C, 0x00D0, 5, 0x0000, 0, 0),
@@ -1012,7 +1012,7 @@ enum {
        MX6_PAD_CSI_DATA02__EIM_AD02                          = IOMUX_PAD(0x0478, 0x01EC, 4, 0x0000, 0, 0),
        MX6_PAD_CSI_DATA02__GPIO4_IO23                        = IOMUX_PAD(0x0478, 0x01EC, 5, 0x0000, 0, 0),
        MX6_PAD_CSI_DATA02__SAI1_RX_SYNC                      = IOMUX_PAD(0x0478, 0x01EC, 6, 0x0000, 0, 0),
-       MX6_PAD_CSI_DATA02__UART5_DCE_RTS                     = IOMUX_PAD(0x0478, 0x01EC, 8, 0x0640, 5, 0),
+       MX6_PAD_CSI_DATA02__UART5_DCE_RTS                     = IOMUX_PAD(0x0478, 0x01EC, 8, 0x0640, 7, 0),
        MX6_PAD_CSI_DATA02__UART5_DTE_CTS                     = IOMUX_PAD(0x0478, 0x01EC, 8, 0x0000, 0, 0),
 
        MX6_PAD_CSI_DATA03__CSI_DATA05                        = IOMUX_PAD(0x047C, 0x01F0, 0, 0x04CC, 0, 0),
index 9a420dc..cb0c2c1 100644 (file)
@@ -16,6 +16,8 @@
 #define CAAM_SEC_SRAM_SIZE      (SZ_32K)
 #define CAAM_SEC_SRAM_END       (CAAM_SEC_SRAM_BASE + CAAM_SEC_SRAM_SIZE - 1)
 
+#define CAAM_ARB_BASE_ADDR      CAAM_SEC_SRAM_BASE
+
 #define OCRAM_0_BASE            (0x2F000000)
 #define OCRAM_0_SIZE            (SZ_128K)
 #define OCRAM_0_END             (OCRAM_0_BASE + OCRAM_0_SIZE - 1)
 #define IOMUXC_DDR_RBASE       ((AIPS3_BASE + (AIPS3_SLOT_SIZE * IOMUXC_DDR_AIPS3_SLOT)))
 #define MMDC0_PCC_REG          (PCC3_RBASE + (4 * MMDC0_PCC3_SLOT))
 
+#define CAAM_IPS_BASE_ADDR              (AIPS2_BASE + 0x240000) /* 40240000 */
+
+#define CONFIG_SYS_FSL_SEC_OFFSET       0
+#define CONFIG_SYS_FSL_SEC_ADDR         (CAAM_IPS_BASE_ADDR + \
+                                        CONFIG_SYS_FSL_SEC_OFFSET)
+#define CONFIG_SYS_FSL_JR0_OFFSET       0x1000
+#define CONFIG_SYS_FSL_JR0_ADDR         (CONFIG_SYS_FSL_SEC_ADDR + \
+                                        CONFIG_SYS_FSL_JR0_OFFSET)
+#define CONFIG_SYS_FSL_MAX_NUM_OF_SEC   1
+
 #define IOMUXC_DPCR_DDR_DQS0   ((IOMUXC_DDR_RBASE + (4 * 32)))
 #define IOMUXC_DPCR_DDR_DQS1   ((IOMUXC_DDR_RBASE + (4 * 33)))
 #define IOMUXC_DPCR_DDR_DQS2   ((IOMUXC_DDR_RBASE + (4 * 34)))
index d8bd770..2abf28e 100644 (file)
@@ -18,8 +18,6 @@
  */
 #define IVT_HEADER_MAGIC       0xD1
 #define IVT_TOTAL_LENGTH       0x20
-#define IVT_HEADER_V1          0x40
-#define IVT_HEADER_V2          0x41
 
 struct __packed ivt_header {
        uint8_t         magic;
@@ -44,6 +42,15 @@ struct __packed hab_hdr {
        u8 par;              /* Parameters field */
 };
 
+/* Default event structure */
+struct __packed evt_def {
+       struct hab_hdr hdr;             /* Header */
+       uint32_t sts;                   /* Status */
+       uint32_t ctx;                   /* Default context */
+       uint8_t *data;                  /* Default data location */
+       size_t bytes;                   /* Size of default data */
+};
+
 /* -------- start of HAB API updates ------------*/
 /* The following are taken from HAB4 SIS */
 
@@ -165,6 +172,22 @@ typedef void hapi_clock_init_t(void);
 #define HAB_ENG_RTL            0x77   /* RTL simulation engine */
 #define HAB_ENG_SW             0xff   /* Software engine */
 
+#ifdef CONFIG_ARM64
+#ifdef CONFIG_IMX8MQ
+#define HAB_RVT_BASE                   0x00000880
+#else
+#define HAB_RVT_BASE                   0x00000900
+#endif
+
+#define HAB_RVT_ENTRY                  (*(ulong *)(HAB_RVT_BASE + 0x08))
+#define HAB_RVT_EXIT                   (*(ulong *)(HAB_RVT_BASE + 0x10))
+#define HAB_RVT_CHECK_TARGET           (*(ulong *)(HAB_RVT_BASE + 0x18))
+#define HAB_RVT_AUTHENTICATE_IMAGE     (*(ulong *)(HAB_RVT_BASE + 0x20))
+#define HAB_RVT_REPORT_EVENT           (*(ulong *)(HAB_RVT_BASE + 0x40))
+#define HAB_RVT_REPORT_STATUS          (*(ulong *)(HAB_RVT_BASE + 0x48))
+#define HAB_RVT_FAILSAFE               (*(ulong *)(HAB_RVT_BASE + 0x50))
+#else
+
 #ifdef CONFIG_ROM_UNIFIED_SECTIONS
 #define HAB_RVT_BASE                   0x00000100
 #else
@@ -172,7 +195,7 @@ typedef void hapi_clock_init_t(void);
 #define HAB_RVT_BASE_OLD               0x00000094
 #define HAB_RVT_BASE ((is_mx6dqp()) ?                                  \
                        HAB_RVT_BASE_NEW :                              \
-                       (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ?   \
+                       (is_mx6dq() && (soc_rev() >= CHIP_REV_1_3)) ?   \
                        HAB_RVT_BASE_NEW :                              \
                        (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ?  \
                        HAB_RVT_BASE_NEW : HAB_RVT_BASE_OLD)
@@ -186,6 +209,8 @@ typedef void hapi_clock_init_t(void);
 #define HAB_RVT_REPORT_STATUS          (*(uint32_t *)(HAB_RVT_BASE + 0x24))
 #define HAB_RVT_FAILSAFE               (*(uint32_t *)(HAB_RVT_BASE + 0x28))
 
+#endif /*CONFIG_ARM64*/
+
 #define HAB_CID_ROM 0 /**< ROM Caller ID */
 #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
 
@@ -199,6 +224,12 @@ typedef void hapi_clock_init_t(void);
 #define IVT_SIZE                       0x20
 #define CSF_PAD_SIZE                   0x2000
 
+#define HAB_TAG_EVT            0xDB
+#define HAB_TAG_EVT_DEF                0x0C
+
+#define HAB_MAJ_VER            0x40
+#define HAB_MAJ_MASK           0xF0
+
 /* ----------- end of HAB API updates ------------*/
 
 int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
index 43eae6d..c7668ff 100644 (file)
@@ -60,12 +60,16 @@ struct bd_info;
 #define is_imx8mmsl() (is_cpu_type(MXC_CPU_IMX8MMSL))
 #define is_imx8mn() (is_cpu_type(MXC_CPU_IMX8MN) || is_cpu_type(MXC_CPU_IMX8MND) || \
        is_cpu_type(MXC_CPU_IMX8MNS) || is_cpu_type(MXC_CPU_IMX8MNL) || \
-       is_cpu_type(MXC_CPU_IMX8MNDL) || is_cpu_type(MXC_CPU_IMX8MNSL))
+       is_cpu_type(MXC_CPU_IMX8MNDL) || is_cpu_type(MXC_CPU_IMX8MNSL) || \
+       is_cpu_type(MXC_CPU_IMX8MNUD) || is_cpu_type(MXC_CPU_IMX8MNUS) || is_cpu_type(MXC_CPU_IMX8MNUQ))
 #define is_imx8mnd() (is_cpu_type(MXC_CPU_IMX8MND))
 #define is_imx8mns() (is_cpu_type(MXC_CPU_IMX8MNS))
 #define is_imx8mnl() (is_cpu_type(MXC_CPU_IMX8MNL))
 #define is_imx8mndl() (is_cpu_type(MXC_CPU_IMX8MNDL))
 #define is_imx8mnsl() (is_cpu_type(MXC_CPU_IMX8MNSL))
+#define is_imx8mnuq() (is_cpu_type(MXC_CPU_IMX8MNUQ))
+#define is_imx8mnud() (is_cpu_type(MXC_CPU_IMX8MNUD))
+#define is_imx8mnus() (is_cpu_type(MXC_CPU_IMX8MNUS))
 #define is_imx8mp() (is_cpu_type(MXC_CPU_IMX8MP)  || is_cpu_type(MXC_CPU_IMX8MPD) || \
        is_cpu_type(MXC_CPU_IMX8MPL) || is_cpu_type(MXC_CPU_IMX8MP6))
 #define is_imx8mpd() (is_cpu_type(MXC_CPU_IMX8MPD))
index 8f64e23..26bfc5c 100644 (file)
@@ -43,9 +43,9 @@ config USE_IMXIMG_PLUGIN
 
 config IMX_HAB
        bool "Support i.MX HAB features"
-       depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX5
+       depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX5 || ARCH_IMX8M
        select FSL_CAAM if HAS_CAAM
-       imply CMD_DEKBLOB
+       imply CMD_DEKBLOB if HAS_CAAM
        help
          This option enables the support for secure boot (HAB).
          See doc/imx/habv4/* for more details.
@@ -75,12 +75,43 @@ config CMD_BMODE
 
 config CMD_DEKBLOB
        bool "Support the 'dek_blob' command"
+       select IMX_CAAM_DEK_ENCAP if ARCH_MX6 || ARCH_MX7 || ARCH_MX7ULP
+       select IMX_OPTEE_DEK_ENCAP if ARCH_IMX8M
+       select IMX_SECO_DEK_ENCAP if ARCH_IMX8
        help
          This enables the 'dek_blob' command which is used with the
          Freescale secure boot mechanism. This command encapsulates and
          creates a blob of data. See also CMD_BLOB and doc/imx/habv4/* for
          more information.
 
+config IMX_CAAM_DEK_ENCAP
+       bool "Support the DEK blob encapsulation with CAAM U-Boot driver"
+       help
+         This enables the DEK blob encapsulation with the U-Boot CAAM driver.
+         This option is only available on imx6, imx7 and imx7ulp.
+
+config IMX_OPTEE_DEK_ENCAP
+       select TEE
+       select OPTEE
+       bool "Support the DEK blob encapsulation with OP-TEE"
+       help
+         This enabled the DEK blob encapsulation with OP-TEE. The communication
+         with OP-TEE is done through a SMC call and OP-TEE shared memory. This
+         option is available on imx8mm.
+
+config IMX_SECO_DEK_ENCAP
+       bool "Support the DEK blob encapsulation with SECO"
+       help
+         This enabled the DEK blob encapsulation with the SECO API. This option
+         is only available on imx8.
+
+config CMD_PRIBLOB
+       bool "Support the set_priblob_bitfield command"
+       depends on HAS_CAAM && IMX_HAB
+       help
+         This option enables the priblob command which can be used
+               to set the priblob setting to 0x3.
+
 config CMD_HDMIDETECT
        bool "Support the 'hdmidet' command"
        help
@@ -99,6 +130,15 @@ config CMD_NANDBCB
          This is similar to kobs-ng, which is used in Linux as separate
          rootfs package.
 
+config FSL_MFGPROT
+       bool "Support the 'mfgprot' command"
+       depends on IMX_HAB && ARCH_MX7
+       help
+         This option enables the manufacturing protection command
+         which can be used has a protection feature for Manufacturing
+         process. With this tool is possible to authenticate the
+         chip to the OEM's server.
+
 config NXP_BOARD_REVISION
        bool "Read NXP board revision from fuses"
        depends on ARCH_MX6 || ARCH_MX7
index e6b4654..82aa39d 100644 (file)
@@ -16,6 +16,7 @@ endif
 obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o
 obj-$(CONFIG_FEC_MXC) += mac.o
 obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
+obj-$(CONFIG_IMX_HAB) += hab.o
 obj-y += cpu.o
 endif
 
@@ -29,12 +30,14 @@ obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8 imxrt))
 obj-y  += misc.o
+obj-$(CONFIG_CMD_PRIBLOB) += priblob.o
 obj-$(CONFIG_SPL_BUILD)        += spl.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx7))
 obj-y  += cpu.o
 obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
 obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o
+obj-$(CONFIG_FSL_MFGPROT) += cmd_mfgprot.o
 endif
 ifeq ($(SOC),$(filter $(SOC),mx5 mx6 mx7))
 obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
index 49dd473..b10ead1 100644 (file)
 #include <fsl_sec.h>
 #include <asm/arch/clock.h>
 #include <mapmem.h>
+#include <tee.h>
+#ifdef CONFIG_IMX_SECO_DEK_ENCAP
+#include <asm/arch/sci/sci.h>
+#include <asm/arch/image.h>
+#endif
+#include <cpu_func.h>
 
 /**
 * blob_dek() - Encapsulate the DEK as a blob using CAM's Key
 *
 * Returns zero on success,and negative on error.
 */
-static int blob_encap_dek(const u8 *src, u8 *dst, u32 len)
+#ifdef CONFIG_IMX_CAAM_DEK_ENCAP
+static int blob_encap_dek(u32 src_addr, u32 dst_addr, u32 len)
 {
-       int ret = 0;
-       u32 jr_size = 4;
+       u8 *src_ptr, *dst_ptr;
+
+       src_ptr = map_sysmem(src_addr, len / 8);
+       dst_ptr = map_sysmem(dst_addr, BLOB_SIZE(len / 8));
+
+       hab_caam_clock_enable(1);
 
-       u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR + 0x102c);
-       if (out_jr_size != jr_size) {
-               hab_caam_clock_enable(1);
+       u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
+                                  FSL_CAAM_ORSR_JRa_OFFSET);
+       if (out_jr_size != FSL_CAAM_MAX_JR_SIZE)
                sec_init();
-       }
 
        if (!((len == 128) | (len == 192) | (len == 256))) {
                debug("Invalid DEK size. Valid sizes are 128, 192 and 256b\n");
@@ -40,10 +50,237 @@ static int blob_encap_dek(const u8 *src, u8 *dst, u32 len)
        }
 
        len /= 8;
-       ret = blob_dek(src, dst, len);
+       return blob_dek(src_ptr, dst_ptr, len);
+}
+#endif /* CONFIG_IMX_CAAM_DEK_ENCAP */
+
+#ifdef CONFIG_IMX_OPTEE_DEK_ENCAP
+
+#define PTA_DEK_BLOB_PTA_UUID {0xef477737, 0x0db1, 0x4a9d, \
+       {0x84, 0x37, 0xf2, 0xf5, 0x35, 0xc0, 0xbd, 0x92} }
+
+#define OPTEE_BLOB_HDR_SIZE            8
+
+static int blob_encap_dek(u32 src_addr, u32 dst_addr, u32 len)
+{
+       struct udevice *dev = NULL;
+       struct tee_shm *shm_input, *shm_output;
+       struct tee_open_session_arg arg = {0};
+       struct tee_invoke_arg arg_func = {0};
+       const struct tee_optee_ta_uuid uuid = PTA_DEK_BLOB_PTA_UUID;
+       struct tee_param param[4] = {0};
+       int ret;
+
+       /* Get tee device */
+       dev = tee_find_device(NULL, NULL, NULL, NULL);
+       if (!dev) {
+               printf("Cannot get OP-TEE device\n");
+               return -1;
+       }
+
+       /* Set TA UUID */
+       tee_optee_ta_uuid_to_octets(arg.uuid, &uuid);
+
+       /* Open TA session */
+       ret = tee_open_session(dev, &arg, 0, NULL);
+       if (ret < 0) {
+               printf("Cannot open session with PTA Blob 0x%X\n", ret);
+               return -1;
+       }
+
+       /* Allocate shared input and output buffers for TA */
+       ret = tee_shm_register(dev, (void *)(ulong)src_addr, len / 8, 0x0, &shm_input);
+       if (ret < 0) {
+               printf("Cannot register input shared memory 0x%X\n", ret);
+               goto error;
+       }
+
+       ret = tee_shm_register(dev, (void *)(ulong)dst_addr,
+                              BLOB_SIZE(len / 8) + OPTEE_BLOB_HDR_SIZE,
+                              0x0, &shm_output);
+       if (ret < 0) {
+               printf("Cannot register output shared memory 0x%X\n", ret);
+               goto error;
+       }
+
+       param[0].u.memref.shm   = shm_input;
+       param[0].u.memref.size  = shm_input->size;
+       param[0].attr           = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT;
+       param[1].u.memref.shm   = shm_output;
+       param[1].u.memref.size  = shm_output->size;
+       param[1].attr           = TEE_PARAM_ATTR_TYPE_MEMREF_OUTPUT;
+       param[2].attr           = TEE_PARAM_ATTR_TYPE_NONE;
+       param[3].attr           = TEE_PARAM_ATTR_TYPE_NONE;
+
+       arg_func.func = 0;
+       arg_func.session = arg.session;
+
+       /* Generate DEK blob */
+       arg_func.session = arg.session;
+       ret = tee_invoke_func(dev, &arg_func, 4, param);
+       if (ret < 0)
+               printf("Cannot generate Blob with PTA DEK Blob 0x%X\n", ret);
+
+error:
+       /* Free shared memory */
+       tee_shm_free(shm_input);
+       tee_shm_free(shm_output);
+
+       /* Close session */
+       ret = tee_close_session(dev, arg.session);
+       if (ret < 0)
+               printf("Cannot close session with PTA DEK Blob 0x%X\n", ret);
+
+       return ret;
+}
+#endif /* CONFIG_IMX_OPTEE_DEK_ENCAP */
+#ifdef CONFIG_IMX_SECO_DEK_ENCAP
+
+#define DEK_BLOB_KEY_ID                                0x0
+
+#define AHAB_PRIVATE_KEY                       0x81
+#define AHAB_VERSION                           0x00
+#define AHAB_MODE_CBC                          0x67
+#define AHAB_ALG_AES                           0x55
+#define AHAB_128_AES_KEY                       0x10
+#define AHAB_192_AES_KEY                       0x18
+#define AHAB_256_AES_KEY                       0x20
+#define AHAB_FLAG_KEK                          0x80
+#define AHAB_DEK_BLOB                          0x01
+
+#define DEK_BLOB_HDR_SIZE                      8
+#define SECO_PT                                        2U
+
+static int blob_encap_dek(u32 src_addr, u32 dst_addr, u32 len)
+{
+       sc_err_t err;
+       sc_rm_mr_t mr_input, mr_output;
+       struct generate_key_blob_hdr hdr;
+       u8 in_size, out_size;
+       u8 *src_ptr, *dst_ptr;
+       int ret = 0;
+       int i;
+
+       /* Set sizes */
+       in_size = sizeof(struct generate_key_blob_hdr) + len / 8;
+       out_size = BLOB_SIZE(len / 8) + DEK_BLOB_HDR_SIZE;
+
+       /* Get src and dst virtual addresses */
+       src_ptr = map_sysmem(src_addr, in_size);
+       dst_ptr = map_sysmem(dst_addr, out_size);
+
+       /* Check addr input */
+       if (!(src_ptr && dst_ptr)) {
+               debug("src_addr or dst_addr invalid\n");
+               return -1;
+       }
+
+       /* Build key header */
+       hdr.version = AHAB_VERSION;
+       hdr.length_lsb = sizeof(struct generate_key_blob_hdr) + len / 8;
+       hdr.length_msb = 0x00;
+       hdr.tag = AHAB_PRIVATE_KEY;
+       hdr.flags = AHAB_DEK_BLOB;
+       hdr.algorithm = AHAB_ALG_AES;
+       hdr.mode = AHAB_MODE_CBC;
+
+       switch (len) {
+       case 128:
+               hdr.size = AHAB_128_AES_KEY;
+               break;
+       case 192:
+               hdr.size = AHAB_192_AES_KEY;
+               break;
+       case 256:
+               hdr.size = AHAB_256_AES_KEY;
+               break;
+       default:
+               /* Not supported */
+               debug("Invalid DEK size. Valid sizes are 128, 192 and 256b\n");
+               return -1;
+       }
+
+       /* Build input message */
+       memmove((void *)(src_ptr + sizeof(struct generate_key_blob_hdr)),
+               (void *)src_ptr, len / 8);
+       memcpy((void *)src_ptr, (void *)&hdr,
+              sizeof(struct generate_key_blob_hdr));
+
+       /* Flush the cache before triggering the CAAM DMA */
+       flush_dcache_range(src_addr, src_addr + in_size);
+
+       /* Find input memory region */
+       err = sc_rm_find_memreg((-1), &mr_input, src_addr & ~(CONFIG_SYS_CACHELINE_SIZE - 1),
+                               ALIGN(src_addr + in_size, CONFIG_SYS_CACHELINE_SIZE));
+       if (err) {
+               printf("Error: find memory region 0x%X\n", src_addr);
+               return -ENOMEM;
+       }
+
+       /* Find output memory region */
+       err = sc_rm_find_memreg((-1), &mr_output, dst_addr & ~(CONFIG_SYS_CACHELINE_SIZE - 1),
+                               ALIGN(dst_addr + out_size, CONFIG_SYS_CACHELINE_SIZE));
+       if (err) {
+               printf("Error: find memory region 0x%X\n", dst_addr);
+               return -ENOMEM;
+       }
+
+       /* Set memory region permissions for SECO */
+       err = sc_rm_set_memreg_permissions(-1, mr_input, SECO_PT,
+                                          SC_RM_PERM_FULL);
+       if (err) {
+               printf("Set permission failed for input memory region\n");
+               ret = -EPERM;
+               goto error;
+       }
+
+       err = sc_rm_set_memreg_permissions(-1, mr_output, SECO_PT,
+                                          SC_RM_PERM_FULL);
+       if (err) {
+               printf("Set permission failed for output memory region\n");
+               ret = -EPERM;
+               goto error;
+       }
+
+       /* Flush output data before SECO operation */
+       flush_dcache_range((ulong)dst_ptr, (ulong)(dst_ptr +
+                       roundup(out_size, ARCH_DMA_MINALIGN)));
+
+       /* Generate DEK blob */
+       err = sc_seco_gen_key_blob((-1), 0x0, src_addr, dst_addr, out_size);
+       if (err) {
+               ret = -EPERM;
+               goto error;
+       }
+
+       /* Invalidate output buffer */
+       invalidate_dcache_range((ulong)dst_ptr, (ulong)(dst_ptr +
+                       roundup(out_size, ARCH_DMA_MINALIGN)));
+
+       printf("DEK Blob\n");
+       for (i = 0; i < DEK_BLOB_HDR_SIZE + BLOB_SIZE(len / 8); i++)
+               printf("%02X", dst_ptr[i]);
+       printf("\n");
+
+error:
+       /* Remove memory region permission to SECO */
+       err = sc_rm_set_memreg_permissions(-1, mr_input, SECO_PT,
+                                          SC_RM_PERM_NONE);
+       if (err) {
+               printf("Error: remove permission failed for input\n");
+               ret = -EPERM;
+       }
+
+       err = sc_rm_set_memreg_permissions(-1, mr_output, SECO_PT,
+                                          SC_RM_PERM_NONE);
+       if (err) {
+               printf("Error: remove permission failed for output\n");
+               ret = -EPERM;
+       }
 
        return ret;
 }
+#endif /* CONFIG_IMX_SECO_DEK_ENCAP */
 
 /**
  * do_dek_blob() - Handle the "dek_blob" command-line command
@@ -59,8 +296,6 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,
                       char *const argv[])
 {
        uint32_t src_addr, dst_addr, len;
-       uint8_t *src_ptr, *dst_ptr;
-       int ret = 0;
 
        if (argc != 4)
                return CMD_RET_USAGE;
@@ -69,12 +304,7 @@ static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,
        dst_addr = simple_strtoul(argv[2], NULL, 16);
        len = simple_strtoul(argv[3], NULL, 10);
 
-       src_ptr = map_sysmem(src_addr, len/8);
-       dst_ptr = map_sysmem(dst_addr, BLOB_SIZE(len/8));
-
-       ret = blob_encap_dek(src_ptr, dst_ptr, len);
-
-       return ret;
+       return blob_encap_dek(src_addr, dst_addr, len);
 }
 
 /***************************************************/
diff --git a/arch/arm/mach-imx/cmd_mfgprot.c b/arch/arm/mach-imx/cmd_mfgprot.c
new file mode 100644 (file)
index 0000000..1430f61
--- /dev/null
@@ -0,0 +1,150 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ *
+ * These commands enable the use of the CAAM MPPubK-generation and MPSign
+ * functions in supported i.MX devices.
+ */
+
+#include <asm/byteorder.h>
+#include <asm/arch/clock.h>
+#include <linux/compiler.h>
+#include <command.h>
+#include <common.h>
+#include <environment.h>
+#include <fsl_sec.h>
+#include <mapmem.h>
+#include <memalign.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/**
+ * do_mfgprot() - Handle the "mfgprot" command-line command
+ * @cmdtp:  Command data struct pointer
+ * @flag:   Command flag
+ * @argc:   Command-line argument count
+ * @argv:   Array of command-line arguments
+ *
+ * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
+ * on error.
+ */
+static int do_mfgprot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+       u8 *m_ptr, *dgst_ptr, *c_ptr, *d_ptr, *dst_ptr;
+       char *pubk, *sign, *sel;
+       int m_size, i, ret;
+       u32 m_addr;
+
+       pubk = "pubk";
+       sign = "sign";
+       sel = argv[1];
+
+       /* Enable HAB clock */
+       hab_caam_clock_enable(1);
+
+       u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
+                                  FSL_CAAM_ORSR_JRa_OFFSET);
+
+       if (out_jr_size != FSL_CAAM_MAX_JR_SIZE)
+               sec_init();
+
+       if (strcmp(sel, pubk) == 0) {
+               dst_ptr = malloc_cache_aligned(FSL_CAAM_MP_PUBK_BYTES);
+               if (!dst_ptr)
+                       return -ENOMEM;
+
+               ret = gen_mppubk(dst_ptr);
+               if (ret) {
+                       free(dst_ptr);
+                       return ret;
+               }
+
+               /* Output results */
+               puts("Public key:\n");
+               for (i = 0; i < FSL_CAAM_MP_PUBK_BYTES; i++)
+                       printf("%02X", (dst_ptr)[i]);
+               puts("\n");
+               free(dst_ptr);
+
+       } else if (strcmp(sel, sign) == 0) {
+               if (argc != 4)
+                       return CMD_RET_USAGE;
+
+               m_addr = simple_strtoul(argv[2], NULL, 16);
+               m_size = simple_strtoul(argv[3], NULL, 10);
+               m_ptr = map_physmem(m_addr, m_size, MAP_NOCACHE);
+               if (!m_ptr)
+                       return -ENOMEM;
+
+               dgst_ptr = malloc_cache_aligned(FSL_CAAM_MP_MES_DGST_BYTES);
+               if (!dgst_ptr) {
+                       ret = -ENOMEM;
+                       goto free_m;
+               }
+
+               c_ptr = malloc_cache_aligned(FSL_CAAM_MP_PRVK_BYTES);
+               if (!c_ptr) {
+                       ret = -ENOMEM;
+                       goto free_dgst;
+               }
+
+               d_ptr = malloc_cache_aligned(FSL_CAAM_MP_PRVK_BYTES);
+               if (!d_ptr) {
+                       ret = -ENOMEM;
+                       goto free_c;
+               }
+
+               ret = sign_mppubk(m_ptr, m_size, dgst_ptr, c_ptr, d_ptr);
+               if (ret)
+                       goto free_d;
+
+               /* Output results */
+               puts("Message: ");
+               for (i = 0; i < m_size; i++)
+                       printf("%02X ", (m_ptr)[i]);
+               puts("\n");
+
+               puts("Message Representative Digest(SHA-256):\n");
+               for (i = 0; i < FSL_CAAM_MP_MES_DGST_BYTES; i++)
+                       printf("%02X", (dgst_ptr)[i]);
+               puts("\n");
+
+               puts("Signature:\n");
+               puts("C:\n");
+               for (i = 0; i < FSL_CAAM_MP_PRVK_BYTES; i++)
+                       printf("%02X", (c_ptr)[i]);
+               puts("\n");
+
+               puts("d:\n");
+               for (i = 0; i < FSL_CAAM_MP_PRVK_BYTES; i++)
+                       printf("%02X", (d_ptr)[i]);
+               puts("\n");
+free_d:
+       free(d_ptr);
+free_c:
+       free(c_ptr);
+free_dgst:
+       free(dgst_ptr);
+free_m:
+       unmap_sysmem(m_ptr);
+
+       } else {
+               return CMD_RET_USAGE;
+       }
+       return ret;
+}
+
+/***************************************************/
+static char mfgprot_help_text[] =
+       "Usage:\n"
+        "Print the public key for Manufacturing Protection\n"
+        "\tmfgprot pubk\n"
+        "Generates a Manufacturing Protection signature\n"
+        "\tmfgprot sign <data_addr> <size>";
+
+U_BOOT_CMD(
+       mfgprot, 4, 1, do_mfgprot,
+       "Manufacturing Protection\n",
+       mfgprot_help_text
+);
index 38b87ed..423b715 100644 (file)
@@ -117,7 +117,13 @@ const char *get_imx_type(u32 imxtype)
        case MXC_CPU_IMX8MNDL:
                return "8MNano DualLite"; /* Dual-core Lite version */
        case MXC_CPU_IMX8MNSL:
-               return "8MNano SoloLite"; /* Single-core Lite version */
+               return "8MNano SoloLite";/* Single-core Lite version of the imx8mn */
+       case MXC_CPU_IMX8MNUQ:
+               return "8MNano UltraLite Quad";/* Quad-core UltraLite version of the imx8mn */
+       case MXC_CPU_IMX8MNUD:
+               return "8MNano UltraLite Dual";/* Dual-core UltraLite version of the imx8mn */
+       case MXC_CPU_IMX8MNUS:
+               return "8MNano UltraLite Solo";/* Single-core UltraLite version of the imx8mn */
        case MXC_CPU_IMX8MM:
                return "8MMQ";  /* Quad-core version of the imx8mm */
        case MXC_CPU_IMX8MML:
index d0757d8..00bd157 100644 (file)
 #include <mapmem.h>
 #include <image.h>
 #include <asm/io.h>
+#include <asm/global_data.h>
 #include <asm/system.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/hab.h>
+#include <linux/arm-smccc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 #define ALIGN_SIZE             0x1000
 #define MX6DQ_PU_IROM_MMU_EN_VAR       0x009024a8
 #define MX6SL_PU_IROM_MMU_EN_VAR       0x00901c60
 #define IS_HAB_ENABLED_BIT \
        (is_soc_type(MXC_SOC_MX7ULP) ? 0x80000000 :     \
-        (is_soc_type(MXC_SOC_MX7) ? 0x2000000 : 0x2))
+        ((is_soc_type(MXC_SOC_MX7) || is_soc_type(MXC_SOC_IMX8M)) ? 0x2000000 : 0x2))
+
+#ifdef CONFIG_MX7ULP
+#define HAB_M4_PERSISTENT_START        ((soc_rev() >= CHIP_REV_2_0) ? 0x20008040 : \
+                                 0x20008180)
+#define HAB_M4_PERSISTENT_BYTES                0xB80
+#endif
 
 static int ivt_header_error(const char *err_str, struct ivt_header *ivt_hdr)
 {
@@ -41,13 +51,200 @@ static int verify_ivt_header(struct ivt_header *ivt_hdr)
        if (be16_to_cpu(ivt_hdr->length) != IVT_TOTAL_LENGTH)
                result = ivt_header_error("bad length", ivt_hdr);
 
-       if (ivt_hdr->version != IVT_HEADER_V1 &&
-           ivt_hdr->version != IVT_HEADER_V2)
+       if ((ivt_hdr->version & HAB_MAJ_MASK) != HAB_MAJ_VER)
                result = ivt_header_error("bad version", ivt_hdr);
 
        return result;
 }
 
+#ifdef CONFIG_ARM64
+#define FSL_SIP_HAB            0xC2000007
+#define FSL_SIP_HAB_AUTHENTICATE       0x00
+#define FSL_SIP_HAB_ENTRY              0x01
+#define FSL_SIP_HAB_EXIT               0x02
+#define FSL_SIP_HAB_REPORT_EVENT       0x03
+#define FSL_SIP_HAB_REPORT_STATUS      0x04
+#define FSL_SIP_HAB_FAILSAFE           0x05
+#define FSL_SIP_HAB_CHECK_TARGET       0x06
+static volatile gd_t *gd_save;
+#endif
+
+static inline void save_gd(void)
+{
+#ifdef CONFIG_ARM64
+       gd_save = gd;
+#endif
+}
+
+static inline void restore_gd(void)
+{
+#ifdef CONFIG_ARM64
+       /*
+        * Make will already error that reserving x18 is not supported at the
+        * time of writing, clang: error: unknown argument: '-ffixed-x18'
+        */
+       __asm__ volatile("mov x18, %0\n" : : "r" (gd_save));
+#endif
+}
+
+enum hab_status hab_rvt_report_event(enum hab_status status, u32 index,
+                                    u8 *event, size_t *bytes)
+{
+       enum hab_status ret;
+       hab_rvt_report_event_t *hab_rvt_report_event_func;
+       struct arm_smccc_res res __maybe_unused;
+
+       hab_rvt_report_event_func =  (hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT;
+#if defined(CONFIG_ARM64)
+       if (current_el() != 3) {
+               /* call sip */
+               arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_REPORT_EVENT, (unsigned long)index,
+                             (unsigned long)event, (unsigned long)bytes, 0, 0, 0, &res);
+               return (enum hab_status)res.a0;
+       }
+#endif
+
+       save_gd();
+       ret = hab_rvt_report_event_func(status, index, event, bytes);
+       restore_gd();
+
+       return ret;
+
+}
+
+enum hab_status hab_rvt_report_status(enum hab_config *config, enum hab_state *state)
+{
+       enum hab_status ret;
+       hab_rvt_report_status_t *hab_rvt_report_status_func;
+       struct arm_smccc_res res __maybe_unused;
+
+       hab_rvt_report_status_func = (hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS;
+#if defined(CONFIG_ARM64)
+       if (current_el() != 3) {
+               /* call sip */
+               arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_REPORT_STATUS, (unsigned long)config,
+                             (unsigned long)state, 0, 0, 0, 0, &res);
+               return (enum hab_status)res.a0;
+       }
+#endif
+
+       save_gd();
+       ret = hab_rvt_report_status_func(config, state);
+       restore_gd();
+
+       return ret;
+}
+
+enum hab_status hab_rvt_entry(void)
+{
+       enum hab_status ret;
+       hab_rvt_entry_t *hab_rvt_entry_func;
+       struct arm_smccc_res res __maybe_unused;
+
+       hab_rvt_entry_func = (hab_rvt_entry_t *)HAB_RVT_ENTRY;
+#if defined(CONFIG_ARM64)
+       if (current_el() != 3) {
+               /* call sip */
+               arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_ENTRY, 0, 0, 0, 0, 0, 0, &res);
+               return (enum hab_status)res.a0;
+       }
+#endif
+
+       save_gd();
+       ret = hab_rvt_entry_func();
+       restore_gd();
+
+       return ret;
+}
+
+enum hab_status hab_rvt_exit(void)
+{
+       enum hab_status ret;
+       hab_rvt_exit_t *hab_rvt_exit_func;
+       struct arm_smccc_res res __maybe_unused;
+
+       hab_rvt_exit_func =  (hab_rvt_exit_t *)HAB_RVT_EXIT;
+#if defined(CONFIG_ARM64)
+       if (current_el() != 3) {
+               /* call sip */
+               arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_EXIT, 0, 0, 0, 0, 0, 0, &res);
+               return (enum hab_status)res.a0;
+       }
+#endif
+
+       save_gd();
+       ret = hab_rvt_exit_func();
+       restore_gd();
+
+       return ret;
+}
+
+void hab_rvt_failsafe(void)
+{
+       hab_rvt_failsafe_t *hab_rvt_failsafe_func;
+
+       hab_rvt_failsafe_func = (hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE;
+#if defined(CONFIG_ARM64)
+       if (current_el() != 3) {
+               /* call sip */
+               arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_FAILSAFE, 0, 0, 0, 0, 0, 0, NULL);
+               return;
+       }
+#endif
+
+       save_gd();
+       hab_rvt_failsafe_func();
+       restore_gd();
+}
+
+enum hab_status hab_rvt_check_target(enum hab_target type, const void *start,
+                                              size_t bytes)
+{
+       enum hab_status ret;
+       hab_rvt_check_target_t *hab_rvt_check_target_func;
+       struct arm_smccc_res res __maybe_unused;
+
+       hab_rvt_check_target_func =  (hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET;
+#if defined(CONFIG_ARM64)
+       if (current_el() != 3) {
+               /* call sip */
+               arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_CHECK_TARGET, (unsigned long)type,
+                             (unsigned long)start, (unsigned long)bytes, 0, 0, 0, &res);
+               return (enum hab_status)res.a0;
+       }
+#endif
+
+       save_gd();
+       ret = hab_rvt_check_target_func(type, start, bytes);
+       restore_gd();
+
+       return ret;
+}
+
+void *hab_rvt_authenticate_image(uint8_t cid, ptrdiff_t ivt_offset,
+                                void **start, size_t *bytes, hab_loader_callback_f_t loader)
+{
+       void *ret;
+       hab_rvt_authenticate_image_t *hab_rvt_authenticate_image_func;
+       struct arm_smccc_res res __maybe_unused;
+
+       hab_rvt_authenticate_image_func = (hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE;
+#if defined(CONFIG_ARM64)
+       if (current_el() != 3) {
+               /* call sip */
+               arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_AUTHENTICATE, (unsigned long)ivt_offset,
+                             (unsigned long)start, (unsigned long)bytes, 0, 0, 0, &res);
+               return (void *)res.a0;
+       }
+#endif
+
+       save_gd();
+       ret = hab_rvt_authenticate_image_func(cid, ivt_offset, start, bytes, loader);
+       restore_gd();
+
+       return ret;
+}
+
 #if !defined(CONFIG_SPL_BUILD)
 
 #define MAX_RECORD_BYTES     (8*1024) /* 4 kbytes */
@@ -253,12 +450,6 @@ static int get_hab_status(void)
        size_t bytes = sizeof(event_data); /* Event size in bytes */
        enum hab_config config = 0;
        enum hab_state state = 0;
-       hab_rvt_report_event_t *hab_rvt_report_event;
-       hab_rvt_report_status_t *hab_rvt_report_status;
-
-       hab_rvt_report_event = (hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT;
-       hab_rvt_report_status =
-                       (hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS;
 
        if (imx_hab_is_enabled())
                puts("\nSecure boot enabled\n");
@@ -270,8 +461,8 @@ static int get_hab_status(void)
                printf("\nHAB Configuration: 0x%02x, HAB State: 0x%02x\n",
                       config, state);
 
-               /* Display HAB Error events */
-               while (hab_rvt_report_event(HAB_FAILURE, index, event_data,
+               /* Display HAB events */
+               while (hab_rvt_report_event(HAB_STS_ANY, index, event_data,
                                        &bytes) == HAB_SUCCESS) {
                        puts("\n");
                        printf("--------- HAB Event %d -----------------\n",
@@ -292,15 +483,99 @@ static int get_hab_status(void)
        return 0;
 }
 
+#ifdef CONFIG_MX7ULP
+
+static int get_record_len(struct record *rec)
+{
+       return (size_t)((rec->len[0] << 8) + (rec->len[1]));
+}
+
+static int get_hab_status_m4(void)
+{
+       unsigned int index = 0;
+       uint8_t event_data[128];
+       size_t record_len, offset = 0;
+       enum hab_config config = 0;
+       enum hab_state state = 0;
+
+       if (imx_hab_is_enabled())
+               puts("\nSecure boot enabled\n");
+       else
+               puts("\nSecure boot disabled\n");
+
+       /*
+        * HAB in both A7 and M4 gather the security state
+        * and configuration of the chip from
+        * shared SNVS module
+        */
+       hab_rvt_report_status(&config, &state);
+       printf("\nHAB Configuration: 0x%02x, HAB State: 0x%02x\n",
+              config, state);
+
+       struct record *rec = (struct record *)(HAB_M4_PERSISTENT_START);
+
+       record_len = get_record_len(rec);
+
+       /* Check if HAB persistent memory is valid */
+       if (rec->tag != HAB_TAG_EVT_DEF ||
+           record_len != sizeof(struct evt_def) ||
+           (rec->par & HAB_MAJ_MASK) != HAB_MAJ_VER) {
+               puts("\nERROR: Invalid HAB persistent memory\n");
+               return 1;
+       }
+
+       /* Parse events in HAB M4 persistent memory region */
+       while (offset < HAB_M4_PERSISTENT_BYTES) {
+               rec = (struct record *)(HAB_M4_PERSISTENT_START + offset);
+
+               record_len = get_record_len(rec);
+
+               if (rec->tag == HAB_TAG_EVT) {
+                       memcpy(&event_data, rec, record_len);
+                       puts("\n");
+                       printf("--------- HAB Event %d -----------------\n",
+                              index + 1);
+                       puts("event data:\n");
+                       display_event(event_data, record_len);
+                       puts("\n");
+                       index++;
+               }
+
+               offset += record_len;
+
+               /* Ensure all records start on a word boundary */
+               if ((offset % 4) != 0)
+                       offset =  offset + (4 - (offset % 4));
+       }
+
+       if (!index)
+               puts("No HAB Events Found!\n\n");
+
+       return 0;
+}
+#endif
+
 static int do_hab_status(struct cmd_tbl *cmdtp, int flag, int argc,
                         char *const argv[])
 {
+#ifdef CONFIG_MX7ULP
+       if ((argc > 2)) {
+               cmd_usage(cmdtp);
+               return 1;
+       }
+
+       if (strcmp("m4", argv[1]) == 0)
+               get_hab_status_m4();
+       else
+               get_hab_status();
+#else
        if ((argc != 1)) {
                cmd_usage(cmdtp);
                return 1;
        }
 
        get_hab_status();
+#endif
 
        return 0;
 }
@@ -353,14 +628,11 @@ static int do_authenticate_image(struct cmd_tbl *cmdtp, int flag, int argc,
 static int do_hab_failsafe(struct cmd_tbl *cmdtp, int flag, int argc,
                           char *const argv[])
 {
-       hab_rvt_failsafe_t *hab_rvt_failsafe;
-
        if (argc != 1) {
                cmd_usage(cmdtp);
                return 1;
        }
 
-       hab_rvt_failsafe = (hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE;
        hab_rvt_failsafe();
 
        return 0;
@@ -406,11 +678,20 @@ error:
        return ret;
 }
 
+#ifdef CONFIG_MX7ULP
+U_BOOT_CMD(
+               hab_status, CONFIG_SYS_MAXARGS, 2, do_hab_status,
+               "display HAB status and events",
+               "hab_status - A7 HAB event and status\n"
+               "hab_status m4 - M4 HAB event and status"
+         );
+#else
 U_BOOT_CMD(
                hab_status, CONFIG_SYS_MAXARGS, 1, do_hab_status,
                "display HAB status",
                ""
          );
+#endif
 
 U_BOOT_CMD(
                hab_auth_img, 4, 0, do_authenticate_image,
@@ -493,7 +774,7 @@ static bool csf_is_valid(struct ivt *ivt, ulong start_addr, size_t bytes)
                return false;
        }
 
-       csf_hdr = (u8 *)ivt->csf;
+       csf_hdr = (u8 *)(ulong)ivt->csf;
 
        /* Verify if CSF Header exist */
        if (*csf_hdr != HAB_CMD_HDR) {
@@ -542,6 +823,48 @@ static bool csf_is_valid(struct ivt *ivt, ulong start_addr, size_t bytes)
        return true;
 }
 
+/*
+ * Validate IVT structure of the image being authenticated
+ */
+static int validate_ivt(struct ivt *ivt_initial)
+{
+       struct ivt_header *ivt_hdr = &ivt_initial->hdr;
+
+       if ((ulong)ivt_initial & 0x3) {
+               puts("Error: Image's start address is not 4 byte aligned\n");
+               return 0;
+       }
+
+       /* Check IVT fields before allowing authentication */
+       if ((!verify_ivt_header(ivt_hdr)) && \
+           (ivt_initial->entry != 0x0) && \
+           (ivt_initial->reserved1 == 0x0) && \
+           (ivt_initial->self == \
+                  (uint32_t)((ulong)ivt_initial & 0xffffffff)) && \
+           (ivt_initial->csf != 0x0) && \
+           (ivt_initial->reserved2 == 0x0)) {
+               /* Report boot failure if DCD pointer is found in IVT */
+               if (ivt_initial->dcd != 0x0)
+                       puts("Error: DCD pointer must be 0\n");
+               else
+                       return 1;
+       }
+
+       puts("Error: Invalid IVT structure\n");
+       debug("\nAllowed IVT structure:\n");
+       debug("IVT HDR       = 0x4X2000D1\n");
+       debug("IVT ENTRY     = 0xXXXXXXXX\n");
+       debug("IVT RSV1      = 0x0\n");
+       debug("IVT DCD       = 0x0\n");         /* Recommended */
+       debug("IVT BOOT_DATA = 0xXXXXXXXX\n");  /* Commonly 0x0 */
+       debug("IVT SELF      = 0xXXXXXXXX\n");  /* = ddr_start + ivt_offset */
+       debug("IVT CSF       = 0xXXXXXXXX\n");
+       debug("IVT RSV2      = 0x0\n");
+
+       /* Invalid IVT structure */
+       return 0;
+}
+
 bool imx_hab_is_enabled(void)
 {
        struct imx_sec_config_fuse_t *fuse =
@@ -561,29 +884,16 @@ bool imx_hab_is_enabled(void)
 int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
                               uint32_t ivt_offset)
 {
-       uint32_t load_addr = 0;
+       ulong load_addr = 0;
        size_t bytes;
-       uint32_t ivt_addr = 0;
+       ulong ivt_addr = 0;
        int result = 1;
        ulong start;
-       hab_rvt_authenticate_image_t *hab_rvt_authenticate_image;
-       hab_rvt_entry_t *hab_rvt_entry;
-       hab_rvt_exit_t *hab_rvt_exit;
-       hab_rvt_check_target_t *hab_rvt_check_target;
        struct ivt *ivt;
-       struct ivt_header *ivt_hdr;
        enum hab_status status;
 
-       hab_rvt_authenticate_image =
-               (hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE;
-       hab_rvt_entry = (hab_rvt_entry_t *)HAB_RVT_ENTRY;
-       hab_rvt_exit = (hab_rvt_exit_t *)HAB_RVT_EXIT;
-       hab_rvt_check_target = (hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET;
-
-       if (!imx_hab_is_enabled()) {
+       if (!imx_hab_is_enabled())
                puts("hab fuse not enabled\n");
-               return 0;
-       }
 
        printf("\nAuthenticate image from DDR location 0x%x...\n",
               ddr_start);
@@ -591,27 +901,13 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
        hab_caam_clock_enable(1);
 
        /* Calculate IVT address header */
-       ivt_addr = ddr_start + ivt_offset;
+       ivt_addr = (ulong) (ddr_start + ivt_offset);
        ivt = (struct ivt *)ivt_addr;
-       ivt_hdr = &ivt->hdr;
 
        /* Verify IVT header bugging out on error */
-       if (verify_ivt_header(ivt_hdr))
+       if (!validate_ivt(ivt))
                goto hab_authentication_exit;
 
-       /* Verify IVT body */
-       if (ivt->self != ivt_addr) {
-               printf("ivt->self 0x%08x pointer is 0x%08x\n",
-                      ivt->self, ivt_addr);
-               goto hab_authentication_exit;
-       }
-
-       /* Verify if IVT DCD pointer is NULL */
-       if (ivt->dcd) {
-               puts("Error: DCD pointer must be NULL\n");
-               goto hab_authentication_exit;
-       }
-
        start = ddr_start;
        bytes = image_size;
 
@@ -624,14 +920,14 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
                goto hab_exit_failure_print_status;
        }
 
-       status = hab_rvt_check_target(HAB_TGT_MEMORY, (void *)ddr_start, bytes);
+       status = hab_rvt_check_target(HAB_TGT_MEMORY, (void *)(ulong)ddr_start, bytes);
        if (status != HAB_SUCCESS) {
-               printf("HAB check target 0x%08x-0x%08x fail\n",
-                      ddr_start, ddr_start + bytes);
+               printf("HAB check target 0x%08x-0x%08lx fail\n",
+                      ddr_start, ddr_start + (ulong)bytes);
                goto hab_exit_failure_print_status;
        }
 #ifdef DEBUG
-       printf("\nivt_offset = 0x%x, ivt addr = 0x%x\n", ivt_offset, ivt_addr);
+       printf("\nivt_offset = 0x%x, ivt addr = 0x%lx\n", ivt_offset, ivt_addr);
        printf("ivt entry = 0x%08x, dcd = 0x%08x, csf = 0x%08x\n", ivt->entry,
               ivt->dcd, ivt->csf);
        puts("Dumping IVT\n");
@@ -649,6 +945,8 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
        printf("\tstart = 0x%08lx\n", start);
        printf("\tbytes = 0x%x\n", bytes);
 #endif
+
+#ifndef CONFIG_ARM64
        /*
         * If the MMU is enabled, we have to notify the ROM
         * code, or it won't flush the caches when needed.
@@ -676,8 +974,9 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size,
                        writel(1, MX6SL_PU_IROM_MMU_EN_VAR);
                }
        }
+#endif
 
-       load_addr = (uint32_t)hab_rvt_authenticate_image(
+       load_addr = (ulong)hab_rvt_authenticate_image(
                        HAB_CID_UBOOT,
                        ivt_offset, (void **)&start,
                        (size_t *)&bytes, NULL);
@@ -693,8 +992,20 @@ hab_exit_failure_print_status:
 
 hab_authentication_exit:
 
-       if (load_addr != 0)
+       if (load_addr != 0 || !imx_hab_is_enabled())
                result = 0;
 
        return result;
 }
+
+int authenticate_image(u32 ddr_start, u32 raw_image_size)
+{
+       u32 ivt_offset;
+       size_t bytes;
+
+       ivt_offset = (raw_image_size + ALIGN_SIZE - 1) &
+                                       ~(ALIGN_SIZE - 1);
+       bytes = ivt_offset + IVT_SIZE + CSF_PAD_SIZE;
+
+       return imx_hab_authenticate_image(ddr_start, bytes, ivt_offset);
+}
index 04b9729..4e76612 100644 (file)
@@ -2,6 +2,7 @@ if ARCH_IMX8
 
 config AHAB_BOOT
        bool "Support i.MX8 AHAB features"
+       imply CMD_DEKBLOB
        help
          This option enables the support for AHAB secure boot.
 
index 12b8d0d..c27fb24 100644 (file)
@@ -2,6 +2,7 @@ if ARCH_IMX8M
 
 config IMX8M
        bool
+       select HAS_CAAM
        select ROM_UNIFIED_SECTIONS
 
 config IMX8MQ
@@ -39,6 +40,7 @@ config TARGET_IMX8MQ_PHANBELL
 
 config TARGET_IMX8MM_EVK
        bool "imx8mm LPDDR4 EVK board"
+       select BINMAN
        select IMX8MM
        select SUPPORT_SPL
        select IMX8M_LPDDR4
@@ -49,14 +51,23 @@ config TARGET_IMX8MM_VENICE
        select SUPPORT_SPL
        select IMX8M_LPDDR4
 
+config TARGET_IMX8MN_EVK
+       bool "imx8mn LPDDR4 EVK board"
+       select BINMAN
+       select IMX8MN
+       select SUPPORT_SPL
+       select IMX8M_LPDDR4
+
 config TARGET_IMX8MN_DDR4_EVK
        bool "imx8mn DDR4 EVK board"
+       select BINMAN
        select IMX8MN
        select SUPPORT_SPL
        select IMX8M_DDR4
 
 config TARGET_IMX8MP_EVK
        bool "imx8mp LPDDR4 EVK board"
+       select BINMAN
        select IMX8MP
        select SUPPORT_SPL
        select IMX8M_LPDDR4
index 4024daf..029d06f 100644 (file)
@@ -21,6 +21,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
 
 static u32 get_root_clk(enum clk_root_index clock_id);
+
+#ifdef CONFIG_IMX_HAB
+void hab_caam_clock_enable(unsigned char enable)
+{
+       /* The CAAM clock is always on for iMX8M */
+}
+#endif
+
 void enable_ocotp_clk(unsigned char enable)
 {
        clock_enable(CCGR_OCOTP, !!enable);
index 759ec6d..8fecc60 100644 (file)
@@ -310,6 +310,13 @@ static u32 get_root_clk(enum clk_root_index clock_id)
        return root_src_clk / (post_podf + 1) / (pre_podf + 1);
 }
 
+#ifdef CONFIG_IMX_HAB
+void hab_caam_clock_enable(unsigned char enable)
+{
+       /* The CAAM clock is always on for iMX8M */
+}
+#endif
+
 #ifdef CONFIG_MXC_OCOTP
 void enable_ocotp_clk(unsigned char enable)
 {
index e6bc977..36abb2e 100644 (file)
@@ -104,6 +104,13 @@ static struct mm_region imx8m_mem_map[] = {
                .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
                         PTE_BLOCK_NON_SHARE |
                         PTE_BLOCK_PXN | PTE_BLOCK_UXN
+       }, {
+               /* OCRAM_S */
+               .virt = 0x180000UL,
+               .phys = 0x180000UL,
+               .size = 0x8000UL,
+               .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+                        PTE_BLOCK_OUTER_SHARE
        }, {
                /* TCM */
                .virt = 0x7C0000UL,
@@ -324,18 +331,30 @@ static u32 get_cpu_variant_type(u32 type)
        } else if (type == MXC_CPU_IMX8MN) {
                switch (value & 0x3) {
                case 2:
-                       if (value & 0x1000000)
-                               return MXC_CPU_IMX8MNDL;
-                       else
+                       if (value & 0x1000000) {
+                               if (value & 0x10000000)  /* MIPI DSI */
+                                       return MXC_CPU_IMX8MNUD;
+                               else
+                                       return MXC_CPU_IMX8MNDL;
+                       } else {
                                return MXC_CPU_IMX8MND;
+                       }
                case 3:
-                       if (value & 0x1000000)
-                               return MXC_CPU_IMX8MNSL;
-                       else
+                       if (value & 0x1000000) {
+                               if (value & 0x10000000)  /* MIPI DSI */
+                                       return MXC_CPU_IMX8MNUS;
+                               else
+                                       return MXC_CPU_IMX8MNSL;
+                       } else {
                                return MXC_CPU_IMX8MNS;
+                       }
                default:
-                       if (value & 0x1000000)
-                               return MXC_CPU_IMX8MNL;
+                       if (value & 0x1000000) {
+                               if (value & 0x10000000)  /* MIPI DSI */
+                                       return MXC_CPU_IMX8MNUQ;
+                               else
+                                       return MXC_CPU_IMX8MNL;
+                       }
                        break;
                }
        } else if (type == MXC_CPU_IMX8MP) {
@@ -398,7 +417,16 @@ u32 get_cpu_rev(void)
                         * 0xff0055aa is magic number for B1.
                         */
                        if (readl((void __iomem *)(OCOTP_BASE_ADDR + 0x40)) == 0xff0055aa) {
-                               reg = CHIP_REV_2_1;
+                               /*
+                                * B2 uses same DIGPROG and OCOTP_READ_FUSE_DATA value with B1,
+                                * so have to check ROM to distinguish them
+                                */
+                               rom_version = readl((void __iomem *)ROM_VERSION_B0);
+                               rom_version &= 0xff;
+                               if (rom_version == CHIP_REV_2_2)
+                                       reg = CHIP_REV_2_2;
+                               else
+                                       reg = CHIP_REV_2_1;
                        } else {
                                rom_version =
                                        readl((void __iomem *)ROM_VERSION_A0);
@@ -468,7 +496,7 @@ int arch_cpu_init(void)
 
                if (is_imx8md() || is_imx8mmd() || is_imx8mmdl() || is_imx8mms() ||
                    is_imx8mmsl() || is_imx8mnd() || is_imx8mndl() || is_imx8mns() ||
-                   is_imx8mnsl() || is_imx8mpd()) {
+                   is_imx8mnsl() || is_imx8mpd() || is_imx8mnud() || is_imx8mnus()) {
                        /* Power down cpu core 1, 2 and 3 for iMX8M Dual core or Single core */
                        struct pgc_reg *pgc_core1 = (struct pgc_reg *)(GPC_BASE_ADDR + 0x840);
                        struct pgc_reg *pgc_core2 = (struct pgc_reg *)(GPC_BASE_ADDR + 0x880);
@@ -477,7 +505,7 @@ int arch_cpu_init(void)
 
                        writel(0x1, &pgc_core2->pgcr);
                        writel(0x1, &pgc_core3->pgcr);
-                       if (is_imx8mms() || is_imx8mmsl() || is_imx8mns() || is_imx8mnsl()) {
+                       if (is_imx8mms() || is_imx8mmsl() || is_imx8mns() || is_imx8mnsl() || is_imx8mnus()) {
                                writel(0x1, &pgc_core1->pgcr);
                                writel(0xE, &gpc->cpu_pgc_dn_trg);
                        } else {
@@ -616,7 +644,8 @@ static int disable_mipi_dsi_nodes(void *blob)
                "/mipi_dsi_bridge@30A00000",
                "/dsi_phy@30A00300",
                "/soc@0/bus@30800000/mipi_dsi@30a00000",
-               "/soc@0/bus@30800000/dphy@30a00300"
+               "/soc@0/bus@30800000/dphy@30a00300",
+               "/soc@0/bus@30800000/mipi-dsi@30a00000",
        };
 
        return disable_fdt_nodes(blob, nodes_path, ARRAY_SIZE(nodes_path));
@@ -644,7 +673,8 @@ static int check_mipi_dsi_nodes(void *blob)
 {
        static const char * const lcdif_path[] = {
                "/lcdif@30320000",
-               "/soc@0/bus@30000000/lcdif@30320000"
+               "/soc@0/bus@30000000/lcdif@30320000",
+               "/soc@0/bus@30000000/lcd-controller@30320000"
        };
        static const char * const mipi_dsi_path[] = {
                "/mipi_dsi@30A00000",
@@ -652,11 +682,13 @@ static int check_mipi_dsi_nodes(void *blob)
        };
        static const char * const lcdif_ep_path[] = {
                "/lcdif@30320000/port@0/mipi-dsi-endpoint",
-               "/soc@0/bus@30000000/lcdif@30320000/port@0/endpoint"
+               "/soc@0/bus@30000000/lcdif@30320000/port@0/endpoint",
+               "/soc@0/bus@30000000/lcd-controller@30320000/port@0/endpoint"
        };
        static const char * const mipi_dsi_ep_path[] = {
                "/mipi_dsi@30A00000/port@1/endpoint",
-               "/soc@0/bus@30800000/mipi_dsi@30a00000/ports/port@0/endpoint"
+               "/soc@0/bus@30800000/mipi_dsi@30a00000/ports/port@0/endpoint",
+               "/soc@0/bus@30800000/mipi-dsi@30a00000/ports/port@0/endpoint@0"
        };
 
        int lookup_node;
@@ -726,10 +758,46 @@ int disable_vpu_nodes(void *blob)
                return -EPERM;
 }
 
+#ifdef CONFIG_IMX8MN_LOW_DRIVE_MODE
+static int low_drive_gpu_freq(void *blob)
+{
+       static const char *nodes_path_8mn[] = {
+               "/gpu@38000000",
+               "/soc@0/gpu@38000000"
+       };
+
+       int nodeoff, cnt, i;
+       u32 assignedclks[7];
+
+       nodeoff = fdt_path_offset(blob, nodes_path_8mn[0]);
+       if (nodeoff < 0)
+               return nodeoff;
+
+       cnt = fdtdec_get_int_array_count(blob, nodeoff, "assigned-clock-rates", assignedclks, 7);
+       if (cnt < 0)
+               return cnt;
+
+       if (cnt != 7)
+               printf("Warning: %s, assigned-clock-rates count %d\n", nodes_path_8mn[0], cnt);
+
+       assignedclks[cnt - 1] = 200000000;
+       assignedclks[cnt - 2] = 200000000;
+
+       for (i = 0; i < cnt; i++) {
+               debug("<%u>, ", assignedclks[i]);
+               assignedclks[i] = cpu_to_fdt32(assignedclks[i]);
+       }
+       debug("\n");
+
+       return fdt_setprop(blob, nodeoff, "assigned-clock-rates", &assignedclks, sizeof(assignedclks));
+}
+#endif
+
 int disable_gpu_nodes(void *blob)
 {
        static const char * const nodes_path_8mn[] = {
-               "/gpu@38000000"
+               "/gpu@38000000",
+               "/soc@/gpu@38000000"
        };
 
        return disable_fdt_nodes(blob, nodes_path_8mn, ARRAY_SIZE(nodes_path_8mn));
@@ -763,6 +831,79 @@ int disable_dsp_nodes(void *blob)
        return disable_fdt_nodes(blob, nodes_path_8mp, ARRAY_SIZE(nodes_path_8mp));
 }
 
+static void disable_thermal_cpu_nodes(void *blob, u32 disabled_cores)
+{
+       static const char * const thermal_path[] = {
+               "/thermal-zones/cpu-thermal/cooling-maps/map0"
+       };
+
+       int nodeoff, cnt, i, ret, j;
+       u32 cooling_dev[12];
+
+       for (i = 0; i < ARRAY_SIZE(thermal_path); i++) {
+               nodeoff = fdt_path_offset(blob, thermal_path[i]);
+               if (nodeoff < 0)
+                       continue; /* Not found, skip it */
+
+               cnt = fdtdec_get_int_array_count(blob, nodeoff, "cooling-device", cooling_dev, 12);
+               if (cnt < 0)
+                       continue;
+
+               if (cnt != 12)
+                       printf("Warning: %s, cooling-device count %d\n", thermal_path[i], cnt);
+
+               for (j = 0; j < cnt; j++)
+                       cooling_dev[j] = cpu_to_fdt32(cooling_dev[j]);
+
+               ret = fdt_setprop(blob, nodeoff, "cooling-device", &cooling_dev,
+                                 sizeof(u32) * (12 - disabled_cores * 3));
+               if (ret < 0) {
+                       printf("Warning: %s, cooling-device setprop failed %d\n",
+                              thermal_path[i], ret);
+                       continue;
+               }
+
+               printf("Update node %s, cooling-device prop\n", thermal_path[i]);
+       }
+}
+
+static void disable_pmu_cpu_nodes(void *blob, u32 disabled_cores)
+{
+       static const char * const pmu_path[] = {
+               "/pmu"
+       };
+
+       int nodeoff, cnt, i, ret, j;
+       u32 irq_affinity[4];
+
+       for (i = 0; i < ARRAY_SIZE(pmu_path); i++) {
+               nodeoff = fdt_path_offset(blob, pmu_path[i]);
+               if (nodeoff < 0)
+                       continue; /* Not found, skip it */
+
+               cnt = fdtdec_get_int_array_count(blob, nodeoff, "interrupt-affinity",
+                                                irq_affinity, 4);
+               if (cnt < 0)
+                       continue;
+
+               if (cnt != 4)
+                       printf("Warning: %s, interrupt-affinity count %d\n", pmu_path[i], cnt);
+
+               for (j = 0; j < cnt; j++)
+                       irq_affinity[j] = cpu_to_fdt32(irq_affinity[j]);
+
+               ret = fdt_setprop(blob, nodeoff, "interrupt-affinity", &irq_affinity,
+                                sizeof(u32) * (4 - disabled_cores));
+               if (ret < 0) {
+                       printf("Warning: %s, interrupt-affinity setprop failed %d\n",
+                              pmu_path[i], ret);
+                       continue;
+               }
+
+               printf("Update node %s, interrupt-affinity prop\n", pmu_path[i]);
+       }
+}
+
 static int disable_cpu_nodes(void *blob, u32 disabled_cores)
 {
        static const char * const nodes_path[] = {
@@ -795,6 +936,9 @@ static int disable_cpu_nodes(void *blob, u32 disabled_cores)
                }
        }
 
+       disable_thermal_cpu_nodes(blob, disabled_cores);
+       disable_pmu_cpu_nodes(blob, disabled_cores);
+
        return 0;
 }
 
@@ -895,10 +1039,20 @@ usb_modify_speed:
 #elif defined(CONFIG_IMX8MN)
        if (is_imx8mnl() || is_imx8mndl() ||  is_imx8mnsl())
                disable_gpu_nodes(blob);
+#ifdef CONFIG_IMX8MN_LOW_DRIVE_MODE
+       else {
+               int ldm_gpu = low_drive_gpu_freq(blob);
+
+               if (ldm_gpu < 0)
+                       printf("Update GPU node assigned-clock-rates failed\n");
+               else
+                       printf("Update GPU node assigned-clock-rates ok\n");
+       }
+#endif
 
-       if (is_imx8mnd() || is_imx8mndl())
+       if (is_imx8mnd() || is_imx8mndl() || is_imx8mnud())
                disable_cpu_nodes(blob, 2);
-       else if (is_imx8mns() || is_imx8mnsl())
+       else if (is_imx8mns() || is_imx8mnsl() || is_imx8mnus())
                disable_cpu_nodes(blob, 3);
 
 #elif defined(CONFIG_IMX8MP)
index e1fc4b3..30fb45d 100644 (file)
 #include <linux/compiler.h>
 #include <cpu_func.h>
 
+#ifndef CONFIG_IMX8M
+const __weak struct rproc_att hostmap[] = { };
+
+static const struct rproc_att *get_host_mapping(unsigned long auxcore)
+{
+       const struct rproc_att *mmap = hostmap;
+
+       while (mmap && mmap->size) {
+               if (mmap->da <= auxcore &&
+                   mmap->da + mmap->size > auxcore)
+                       return mmap;
+               mmap++;
+       }
+
+       return NULL;
+}
+
+/*
+ * A very simple elf loader for the auxilary core, assumes the image
+ * is valid, returns the entry point address.
+ * Translates load addresses in the elf file to the U-Boot address space.
+ */
+static unsigned long load_elf_image_m_core_phdr(unsigned long addr)
+{
+       Elf32_Ehdr *ehdr; /* ELF header structure pointer */
+       Elf32_Phdr *phdr; /* Program header structure pointer */
+       int i;
+
+       ehdr = (Elf32_Ehdr *)addr;
+       phdr = (Elf32_Phdr *)(addr + ehdr->e_phoff);
+
+       /* Load each program header */
+       for (i = 0; i < ehdr->e_phnum; ++i, ++phdr) {
+               const struct rproc_att *mmap = get_host_mapping(phdr->p_paddr);
+               void *dst, *src;
+
+               if (phdr->p_type != PT_LOAD)
+                       continue;
+
+               if (!mmap) {
+                       printf("Invalid aux core address: %08x",
+                              phdr->p_paddr);
+                       return 0;
+               }
+
+               dst = (void *)(phdr->p_paddr - mmap->da) + mmap->sa;
+               src = (void *)addr + phdr->p_offset;
+
+               debug("Loading phdr %i to 0x%p (%i bytes)\n",
+                     i, dst, phdr->p_filesz);
+
+               if (phdr->p_filesz)
+                       memcpy(dst, src, phdr->p_filesz);
+               if (phdr->p_filesz != phdr->p_memsz)
+                       memset(dst + phdr->p_filesz, 0x00,
+                              phdr->p_memsz - phdr->p_filesz);
+               flush_cache((unsigned long)dst &
+                           ~(CONFIG_SYS_CACHELINE_SIZE - 1),
+                           ALIGN(phdr->p_filesz, CONFIG_SYS_CACHELINE_SIZE));
+       }
+
+       return ehdr->e_entry;
+}
+#endif
+
 int arch_auxiliary_core_up(u32 core_id, ulong addr)
 {
        ulong stack, pc;
@@ -31,7 +96,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr)
         */
        if (valid_elf_image(addr)) {
                stack = 0x0;
-               pc = load_elf_image_phdr(addr);
+               pc = load_elf_image_m_core_phdr(addr);
                if (!pc)
                        return CMD_RET_FAILURE;
 
index 6680f85..2ffac9c 100644 (file)
@@ -9,6 +9,7 @@ config LDO_ENABLED_MODE
          Select this option to enable the PMC1 LDO.
 
 config MX7ULP
+       select HAS_CAAM
        bool
 
 choice
diff --git a/arch/arm/mach-imx/priblob.c b/arch/arm/mach-imx/priblob.c
new file mode 100644 (file)
index 0000000..e253edd
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018 NXP
+ */
+
+/*
+ * Boot command to get and set the PRIBLOB bitfield form the SCFGR register
+ * of the CAAM IP. It is recommended to set this bitfield to 3 once your
+ * encrypted boot image is ready, to prevent the generation of blobs usable
+ * to decrypt an encrypted boot image.
+ */
+
+#include <asm/io.h>
+#include <common.h>
+#include <command.h>
+#include "../drivers/crypto/fsl_caam_internal.h"
+
+int do_priblob_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       writel((readl(CAAM_SCFGR) & 0xFFFFFFFC) | 3, CAAM_SCFGR);
+       printf("New priblob setting = 0x%x\n", readl(CAAM_SCFGR) & 0x3);
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       set_priblob_bitfield, 1, 0, do_priblob_write,
+       "Set the PRIBLOB bitfield to 3",
+       "<value>\n"
+       "    - Write 3 in PRIBLOB bitfield of SCFGR regiter of CAAM IP.\n"
+       "    Prevent the generation of blobs usable to decrypt an\n"
+       "    encrypted boot image."
+);
index 9c818fa..339ae7f 100644 (file)
@@ -279,10 +279,3 @@ int cpu_eth_init(struct bd_info *bis)
 }
 #endif
 
-#ifdef CONFIG_MVEBU_MMC
-int board_mmc_init(struct bd_info *bis)
-{
-       mvebu_mmc_init(bis);
-       return 0;
-}
-#endif /* CONFIG_MVEBU_MMC */
index 55eaee2..3f221dc 100644 (file)
@@ -17,8 +17,8 @@ config TARGET_MICROCHIP_ICICLE
 config TARGET_QEMU_VIRT
        bool "Support QEMU Virt Board"
 
-config TARGET_SIFIVE_FU540
-       bool "Support SiFive FU540 Board"
+config TARGET_SIFIVE_UNLEASHED
+       bool "Support SiFive Unleashed Board"
 
 config TARGET_SIPEED_MAIX
        bool "Support Sipeed Maix Board"
@@ -55,7 +55,7 @@ config SPL_SYS_DCACHE_OFF
 source "board/AndesTech/ax25-ae350/Kconfig"
 source "board/emulation/qemu-riscv/Kconfig"
 source "board/microchip/mpfs_icicle/Kconfig"
-source "board/sifive/fu540/Kconfig"
+source "board/sifive/unleashed/Kconfig"
 source "board/sipeed/maix/Kconfig"
 
 # platform-specific options below
@@ -271,4 +271,82 @@ config STACK_SIZE_SHIFT
 config OF_BOARD_FIXUP
        default y if OF_SEPARATE && RISCV_SMODE
 
+config USE_ARCH_MEMCPY
+       bool "Use an assembly optimized implementation of memcpy"
+       default y
+       help
+         Enable the generation of an optimized version of memcpy.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config SPL_USE_ARCH_MEMCPY
+       bool "Use an assembly optimized implementation of memcpy for SPL"
+       default y if USE_ARCH_MEMCPY
+       depends on SPL
+       help
+         Enable the generation of an optimized version of memcpy.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config TPL_USE_ARCH_MEMCPY
+       bool "Use an assembly optimized implementation of memcpy for TPL"
+       default y if USE_ARCH_MEMCPY
+       depends on TPL
+       help
+         Enable the generation of an optimized version of memcpy.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config USE_ARCH_MEMMOVE
+       bool "Use an assembly optimized implementation of memmove"
+       default y
+       help
+         Enable the generation of an optimized version of memmove.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config SPL_USE_ARCH_MEMMOVE
+       bool "Use an assembly optimized implementation of memmove for SPL"
+       default y if USE_ARCH_MEMCPY
+       depends on SPL
+       help
+         Enable the generation of an optimized version of memmove.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config TPL_USE_ARCH_MEMMOVE
+       bool "Use an assembly optimized implementation of memmove for TPL"
+       default y if USE_ARCH_MEMCPY
+       depends on TPL
+       help
+         Enable the generation of an optimized version of memmove.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config USE_ARCH_MEMSET
+       bool "Use an assembly optimized implementation of memset"
+       default y
+       help
+         Enable the generation of an optimized version of memset.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config SPL_USE_ARCH_MEMSET
+       bool "Use an assembly optimized implementation of memset for SPL"
+       default y if USE_ARCH_MEMSET
+       depends on SPL
+       help
+         Enable the generation of an optimized version of memset.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
+config TPL_USE_ARCH_MEMSET
+       bool "Use an assembly optimized implementation of memset for TPL"
+       default y if USE_ARCH_MEMSET
+       depends on TPL
+       help
+         Enable the generation of an optimized version of memset.
+         Such an implementation may be faster under some conditions
+         but may increase the binary size.
+
 endmenu
index 01331b0..8138d89 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 
 dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb
-dtb-$(CONFIG_TARGET_SIFIVE_FU540) += hifive-unleashed-a00.dtb
+dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb
 dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
 dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb
 
index 81b0401..0b79a29 100644 (file)
                                interrupts = <21>;
                                clocks = <&sysclk K210_CLK_WDT0>;
                                resets = <&sysrst K210_RST_WDT0>;
-                               status = "disabled";
                        };
 
                        wdt1: watchdog@50410000 {
index e2b9dec..89c4cf5 100644 (file)
                        reg-shift = <2>;
                        interrupt-parent = <&plic>;
                        interrupts = <90>;
-                       clock-frequency = <150000000>;
                        clocks = <&clkcfg CLK_MMUART0>;
                        status = "okay";
                };
                        reg-shift = <2>;
                        interrupt-parent = <&plic>;
                        interrupts = <91>;
-                       clock-frequency = <150000000>;
                        clocks = <&clkcfg CLK_MMUART1>;
                        status = "okay";
                };
                        reg-shift = <2>;
                        interrupt-parent = <&plic>;
                        interrupts = <92>;
-                       clock-frequency = <150000000>;
                        clocks = <&clkcfg CLK_MMUART2>;
                        status = "okay";
                };
                        reg-shift = <2>;
                        interrupt-parent = <&plic>;
                        interrupts = <93>;
-                       clock-frequency = <150000000>;
                        clocks = <&clkcfg CLK_MMUART3>;
                        status = "okay";
                };
index 0fc3424..7dee3e4 100644 (file)
 
 #undef __HAVE_ARCH_STRRCHR
 #undef __HAVE_ARCH_STRCHR
-#undef __HAVE_ARCH_MEMCPY
-#undef __HAVE_ARCH_MEMMOVE
 #undef __HAVE_ARCH_MEMCHR
 #undef __HAVE_ARCH_MEMZERO
-#undef __HAVE_ARCH_MEMSET
 
-#ifdef CONFIG_MARCO_MEMSET
-#define memset(_p, _v, _n)     \
-       (typeof(_p) (p) = (_p); \
-        typeof(_v) (v) = (_v); \
-        typeof(_n) (n) = (_n); \
-        {                                                              \
-               if ((n) != 0) {                                         \
-                       if (__builtin_constant_p((v)) && (v) == 0)      \
-                               __memzero((p), (n));                    \
-                       else                                            \
-                               memset((p), (v), (n));                  \
-               }                                                       \
-               (p);                                                    \
-       })
+#undef __HAVE_ARCH_MEMCPY
+#if CONFIG_IS_ENABLED(USE_ARCH_MEMCPY)
+#define __HAVE_ARCH_MEMCPY
+#endif
+extern void *memcpy(void *, const void *, __kernel_size_t);
+
+#undef __HAVE_ARCH_MEMMOVE
+#if CONFIG_IS_ENABLED(USE_ARCH_MEMMOVE)
+#define __HAVE_ARCH_MEMMOVE
+#endif
+extern void *memmove(void *, const void *, __kernel_size_t);
 
-#define memzero(_p, _n) \
-       (typeof(_p) (p) = (_p); \
-        typeof(_n) (n) = (_n); \
-        { if ((n) != 0) __memzero((p), (n)); (p); })
+#undef __HAVE_ARCH_MEMZERO
+#if CONFIG_IS_ENABLED(USE_ARCH_MEMSET)
+#define __HAVE_ARCH_MEMSET
 #endif
+extern void *memset(void *, int, __kernel_size_t);
 
 #endif /* __ASM_RISCV_STRING_H */
index 12c14f2..ff0677a 100644 (file)
@@ -36,3 +36,7 @@ CFLAGS_REMOVE_$(EFI_RELOC) := $(CFLAGS_NON_EFI)
 extra-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += $(EFI_CRT0) $(EFI_RELOC)
 extra-$(CONFIG_CMD_BOOTEFI_SELFTEST) += $(EFI_CRT0) $(EFI_RELOC)
 extra-$(CONFIG_EFI) += $(EFI_CRT0) $(EFI_RELOC)
+
+obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMSET) += memset.o
+obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMMOVE) += memmove.o
+obj-$(CONFIG_$(SPL_TPL_)USE_ARCH_MEMCPY) += memcpy.o
diff --git a/arch/riscv/lib/memcpy.S b/arch/riscv/lib/memcpy.S
new file mode 100644 (file)
index 0000000..51ab716
--- /dev/null
@@ -0,0 +1,108 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 Regents of the University of California
+ */
+
+#include <linux/linkage.h>
+#include <asm/asm.h>
+
+/* void *memcpy(void *, const void *, size_t) */
+ENTRY(__memcpy)
+WEAK(memcpy)
+       move t6, a0  /* Preserve return value */
+
+       /* Defer to byte-oriented copy for small sizes */
+       sltiu a3, a2, 128
+       bnez a3, 4f
+       /* Use word-oriented copy only if low-order bits match */
+       andi a3, t6, SZREG-1
+       andi a4, a1, SZREG-1
+       bne a3, a4, 4f
+
+       beqz a3, 2f  /* Skip if already aligned */
+       /*
+        * Round to nearest double word-aligned address
+        * greater than or equal to start address
+        */
+       andi a3, a1, ~(SZREG-1)
+       addi a3, a3, SZREG
+       /* Handle initial misalignment */
+       sub a4, a3, a1
+1:
+       lb a5, 0(a1)
+       addi a1, a1, 1
+       sb a5, 0(t6)
+       addi t6, t6, 1
+       bltu a1, a3, 1b
+       sub a2, a2, a4  /* Update count */
+
+2:
+       andi a4, a2, ~((16*SZREG)-1)
+       beqz a4, 4f
+       add a3, a1, a4
+3:
+       REG_L a4,       0(a1)
+       REG_L a5,   SZREG(a1)
+       REG_L a6, 2*SZREG(a1)
+       REG_L a7, 3*SZREG(a1)
+       REG_L t0, 4*SZREG(a1)
+       REG_L t1, 5*SZREG(a1)
+       REG_L t2, 6*SZREG(a1)
+       REG_L t3, 7*SZREG(a1)
+       REG_L t4, 8*SZREG(a1)
+       REG_L t5, 9*SZREG(a1)
+       REG_S a4,       0(t6)
+       REG_S a5,   SZREG(t6)
+       REG_S a6, 2*SZREG(t6)
+       REG_S a7, 3*SZREG(t6)
+       REG_S t0, 4*SZREG(t6)
+       REG_S t1, 5*SZREG(t6)
+       REG_S t2, 6*SZREG(t6)
+       REG_S t3, 7*SZREG(t6)
+       REG_S t4, 8*SZREG(t6)
+       REG_S t5, 9*SZREG(t6)
+       REG_L a4, 10*SZREG(a1)
+       REG_L a5, 11*SZREG(a1)
+       REG_L a6, 12*SZREG(a1)
+       REG_L a7, 13*SZREG(a1)
+       REG_L t0, 14*SZREG(a1)
+       REG_L t1, 15*SZREG(a1)
+       addi a1, a1, 16*SZREG
+       REG_S a4, 10*SZREG(t6)
+       REG_S a5, 11*SZREG(t6)
+       REG_S a6, 12*SZREG(t6)
+       REG_S a7, 13*SZREG(t6)
+       REG_S t0, 14*SZREG(t6)
+       REG_S t1, 15*SZREG(t6)
+       addi t6, t6, 16*SZREG
+       bltu a1, a3, 3b
+       andi a2, a2, (16*SZREG)-1  /* Update count */
+
+4:
+       /* Handle trailing misalignment */
+       beqz a2, 6f
+       add a3, a1, a2
+
+       /* Use word-oriented copy if co-aligned to word boundary */
+       or a5, a1, t6
+       or a5, a5, a3
+       andi a5, a5, 3
+       bnez a5, 5f
+7:
+       lw a4, 0(a1)
+       addi a1, a1, 4
+       sw a4, 0(t6)
+       addi t6, t6, 4
+       bltu a1, a3, 7b
+
+       ret
+
+5:
+       lb a4, 0(a1)
+       addi a1, a1, 1
+       sb a4, 0(t6)
+       addi t6, t6, 1
+       bltu a1, a3, 5b
+6:
+       ret
+END(__memcpy)
diff --git a/arch/riscv/lib/memmove.S b/arch/riscv/lib/memmove.S
new file mode 100644 (file)
index 0000000..07d1d21
--- /dev/null
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/linkage.h>
+#include <asm/asm.h>
+
+ENTRY(__memmove)
+WEAK(memmove)
+        move    t0, a0
+        move    t1, a1
+
+        beq     a0, a1, exit_memcpy
+        beqz    a2, exit_memcpy
+        srli    t2, a2, 0x2
+
+        slt     t3, a0, a1
+        beqz    t3, do_reverse
+
+        andi    a2, a2, 0x3
+        li      t4, 1
+        beqz    t2, byte_copy
+
+word_copy:
+        lw      t3, 0(a1)
+        addi    t2, t2, -1
+        addi    a1, a1, 4
+        sw      t3, 0(a0)
+        addi    a0, a0, 4
+        bnez    t2, word_copy
+        beqz    a2, exit_memcpy
+        j       byte_copy
+
+do_reverse:
+        add     a0, a0, a2
+        add     a1, a1, a2
+        andi    a2, a2, 0x3
+        li      t4, -1
+        beqz    t2, reverse_byte_copy
+
+reverse_word_copy:
+        addi    a1, a1, -4
+        addi    t2, t2, -1
+        lw      t3, 0(a1)
+        addi    a0, a0, -4
+        sw      t3, 0(a0)
+        bnez    t2, reverse_word_copy
+        beqz    a2, exit_memcpy
+
+reverse_byte_copy:
+        addi    a0, a0, -1
+        addi    a1, a1, -1
+
+byte_copy:
+        lb      t3, 0(a1)
+        addi    a2, a2, -1
+        sb      t3, 0(a0)
+        add     a1, a1, t4
+        add     a0, a0, t4
+        bnez    a2, byte_copy
+
+exit_memcpy:
+        move a0, t0
+        move a1, t1
+        ret
+END(__memmove)
diff --git a/arch/riscv/lib/memset.S b/arch/riscv/lib/memset.S
new file mode 100644 (file)
index 0000000..34c5360
--- /dev/null
@@ -0,0 +1,113 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2013 Regents of the University of California
+ */
+
+
+#include <linux/linkage.h>
+#include <asm/asm.h>
+
+/* void *memset(void *, int, size_t) */
+ENTRY(__memset)
+WEAK(memset)
+       move t0, a0  /* Preserve return value */
+
+       /* Defer to byte-oriented fill for small sizes */
+       sltiu a3, a2, 16
+       bnez a3, 4f
+
+       /*
+        * Round to nearest XLEN-aligned address
+        * greater than or equal to start address
+        */
+       addi a3, t0, SZREG-1
+       andi a3, a3, ~(SZREG-1)
+       beq a3, t0, 2f  /* Skip if already aligned */
+       /* Handle initial misalignment */
+       sub a4, a3, t0
+1:
+       sb a1, 0(t0)
+       addi t0, t0, 1
+       bltu t0, a3, 1b
+       sub a2, a2, a4  /* Update count */
+
+2: /* Duff's device with 32 XLEN stores per iteration */
+       /* Broadcast value into all bytes */
+       andi a1, a1, 0xff
+       slli a3, a1, 8
+       or a1, a3, a1
+       slli a3, a1, 16
+       or a1, a3, a1
+#ifdef CONFIG_64BIT
+       slli a3, a1, 32
+       or a1, a3, a1
+#endif
+
+       /* Calculate end address */
+       andi a4, a2, ~(SZREG-1)
+       add a3, t0, a4
+
+       andi a4, a4, 31*SZREG  /* Calculate remainder */
+       beqz a4, 3f            /* Shortcut if no remainder */
+       neg a4, a4
+       addi a4, a4, 32*SZREG  /* Calculate initial offset */
+
+       /* Adjust start address with offset */
+       sub t0, t0, a4
+
+       /* Jump into loop body */
+       /* Assumes 32-bit instruction lengths */
+       la a5, 3f
+#ifdef CONFIG_64BIT
+       srli a4, a4, 1
+#endif
+       add a5, a5, a4
+       jr a5
+3:
+       REG_S a1,        0(t0)
+       REG_S a1,    SZREG(t0)
+       REG_S a1,  2*SZREG(t0)
+       REG_S a1,  3*SZREG(t0)
+       REG_S a1,  4*SZREG(t0)
+       REG_S a1,  5*SZREG(t0)
+       REG_S a1,  6*SZREG(t0)
+       REG_S a1,  7*SZREG(t0)
+       REG_S a1,  8*SZREG(t0)
+       REG_S a1,  9*SZREG(t0)
+       REG_S a1, 10*SZREG(t0)
+       REG_S a1, 11*SZREG(t0)
+       REG_S a1, 12*SZREG(t0)
+       REG_S a1, 13*SZREG(t0)
+       REG_S a1, 14*SZREG(t0)
+       REG_S a1, 15*SZREG(t0)
+       REG_S a1, 16*SZREG(t0)
+       REG_S a1, 17*SZREG(t0)
+       REG_S a1, 18*SZREG(t0)
+       REG_S a1, 19*SZREG(t0)
+       REG_S a1, 20*SZREG(t0)
+       REG_S a1, 21*SZREG(t0)
+       REG_S a1, 22*SZREG(t0)
+       REG_S a1, 23*SZREG(t0)
+       REG_S a1, 24*SZREG(t0)
+       REG_S a1, 25*SZREG(t0)
+       REG_S a1, 26*SZREG(t0)
+       REG_S a1, 27*SZREG(t0)
+       REG_S a1, 28*SZREG(t0)
+       REG_S a1, 29*SZREG(t0)
+       REG_S a1, 30*SZREG(t0)
+       REG_S a1, 31*SZREG(t0)
+       addi t0, t0, 32*SZREG
+       bltu t0, a3, 3b
+       andi a2, a2, SZREG-1  /* Update count */
+
+4:
+       /* Handle trailing misalignment */
+       beqz a2, 6f
+       add a3, t0, a2
+5:
+       sb a1, 0(t0)
+       addi t0, t0, 1
+       bltu t0, a3, 5b
+6:
+       ret
+END(__memset)
index 72bc924..99d6195 100644 (file)
@@ -54,12 +54,8 @@ ENTRY(longjmp)
        LOAD_IDX(sp, 13)
 
        /* Move the return value in place, but return 1 if passed 0. */
-       beq a1, zero, longjmp_1
-       mv a0, a1
-       ret
-
-       longjmp_1:
-       li a0, 1
+       seqz a0, a1
+       add a0, a0, a1
        ret
 ENDPROC(longjmp)
 .popsection
diff --git a/board/Synology/common/Makefile b/board/Synology/common/Makefile
new file mode 100644 (file)
index 0000000..62354cc
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2021 Phil Sutter <phil@nwl.cc>
+
+obj-y  += legacy.o
diff --git a/board/Synology/common/legacy.c b/board/Synology/common/legacy.c
new file mode 100644 (file)
index 0000000..3c89e92
--- /dev/null
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021
+ * Walter Schweizer <swwa@users.sourceforge.net>
+ * Phil Sutter <phil@nwl.cc>
+ */
+
+#include <config.h>
+#include <vsprintf.h>
+#include <env.h>
+#include <net.h>
+#include <asm/setup.h>
+
+#include "legacy.h"
+
+static unsigned int syno_board_id(void)
+{
+       switch (CONFIG_MACH_TYPE) {
+       case 527:
+               return SYNO_DS109_ID;
+       case 3036:
+               return SYNO_AXP_4BAY_2BAY;
+       default:
+               return 0;
+       }
+}
+
+static unsigned int usb_port_modes(void)
+{
+       unsigned int i, ret = 0;
+       char var[32], *val;
+
+       for (i = 0; i < USBPORT_MAX; i++) {
+               snprintf(var, 32, "usb%dMode", i);
+               val = env_get(var);
+
+               if (!val || strcasecmp(val, "host"))
+                       continue;
+
+               ret |= 1 << i;
+       }
+       return ret;
+}
+
+/* Support old kernels */
+void setup_board_tags(struct tag **in_params)
+{
+       struct tag_mv_uboot *t;
+       struct tag *params;
+       int i;
+
+       debug("Synology board tags...\n");
+
+       params = *in_params;
+       t = (struct tag_mv_uboot *)&params->u;
+
+       t->uboot_version = VER_NUM | syno_board_id();
+       t->tclk = CONFIG_SYS_TCLK;
+       t->sysclk = CONFIG_SYS_TCLK * 2;
+       t->isusbhost = usb_port_modes();
+
+       for (i = 0; i < ETHADDR_MAX; i++) {
+               char addrvar[16], mtuvar[16];
+
+               sprintf(addrvar, i ? "eth%daddr" : "ethaddr", i);
+               sprintf(mtuvar, i ? "eth%dmtu" : "ethmtu", i);
+
+               eth_env_get_enetaddr(addrvar, t->macaddr[i]);
+               t->mtu[i] = env_get_ulong(mtuvar, 10, 0);
+       }
+
+       params->hdr.tag = ATAG_MV_UBOOT;
+       params->hdr.size = tag_size(tag_mv_uboot);
+       params = tag_next(params);
+       *in_params = params;
+}
diff --git a/board/Synology/common/legacy.h b/board/Synology/common/legacy.h
new file mode 100644 (file)
index 0000000..0a81432
--- /dev/null
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2021
+ * Walter Schweizer <swwa@users.sourceforge.net>
+ * Phil Sutter <phil@nwl.cc>
+ */
+
+#ifndef __SYNO_LEGACY_H
+#define __SYNO_LEGACY_H
+
+/* Marvell uboot parameters */
+#define ATAG_MV_UBOOT 0x41000403
+#define VER_NUM       0x03040400 /* 3.4.4 */
+
+#define BOARD_ID_BASE 0x0
+#define SYNO_DS109_ID (BOARD_ID_BASE + 0x15)
+#define SYNO_AXP_4BAY_2BAY (0xf + 1)
+
+#define ETHADDR_MAX    4
+#define USBPORT_MAX    3
+
+struct tag_mv_uboot {
+       u32 uboot_version;
+       u32 tclk;
+       u32 sysclk;
+       u32 isusbhost;
+       u8 macaddr[ETHADDR_MAX][ETH_ALEN];
+       u16 mtu[ETHADDR_MAX];
+       u32 fw_image_base;
+       u32 fw_image_size;
+};
+
+#endif /* __SYNO_LEGACY_H */
index eaac954..3914faa 100644 (file)
@@ -114,38 +114,6 @@ void reset_misc(void)
                     SOFTWARE_REBOOT);
 }
 
-/* Support old kernels */
-void setup_board_tags(struct tag **in_params)
-{
-       unsigned int boardId;
-       struct tag *params;
-       struct tag_mv_uboot *t;
-       int i;
-
-       printf("Synology board tags...");
-       params = *in_params;
-       t = (struct tag_mv_uboot *)&params->u;
-
-       t->uboot_version = VER_NUM;
-
-       boardId = SYNO_DS109_ID;
-       t->uboot_version |= boardId;
-
-       t->tclk = CONFIG_SYS_TCLK;
-       t->sysclk = CONFIG_SYS_TCLK*2;
-
-       t->isusbhost = 1;
-       for (i = 0; i < 4; i++) {
-               memset(t->macaddr[i], 0, sizeof(t->macaddr[i]));
-               t->mtu[i] = 0;
-       }
-
-       params->hdr.tag = ATAG_MV_UBOOT;
-       params->hdr.size = tag_size(tag_mv_uboot);
-       params = tag_next(params);
-       *in_params = params;
-}
-
 #ifdef CONFIG_RESET_PHY_R
 /* Configure and enable MV88E1116 PHY */
 void reset_phy(void)
index cc6ef99..0cf0525 100644 (file)
 #define MV88E1116_RGMII_TXTM_CTRL      (1 << 4)
 #define MV88E1116_RGMII_RXTM_CTRL      (1 << 5)
 
-/* Marvell uboot parameters */
-#define ATAG_MV_UBOOT 0x41000403
-#define VER_NUM       0x03040400 /* 3.4.4 */
-#define BOARD_ID_BASE 0x0
-#define SYNO_DS109_ID (BOARD_ID_BASE+0x15)
-
-struct tag_mv_uboot {
-       u32 uboot_version;
-       u32 tclk;
-       u32 sysclk;
-       u32 isusbhost;
-       char macaddr[4][6];
-       u16 mtu[4];
-       u32 fw_image_base;
-       u32 fw_image_size;
-};
-
 #endif /* __DS109_H */
diff --git a/board/Synology/ds414/Kconfig b/board/Synology/ds414/Kconfig
new file mode 100644 (file)
index 0000000..4d30852
--- /dev/null
@@ -0,0 +1,12 @@
+if TARGET_DS414
+
+config SYS_BOARD
+       default "ds414"
+
+config SYS_VENDOR
+       default "Synology"
+
+config SYS_CONFIG_NAME
+       default "ds414"
+
+endif
index a120c31..a62658a 100644 (file)
 #include <asm/io.h>
 #include "../drivers/ddr/marvell/axp/ddr3_init.h"
 
-#define ETHADDR_MAX            4
-#define SYNO_SN_TAG            "SN="
-#define SYNO_CHKSUM_TAG                "CHK="
+#include "cmd_syno.h"
 
-
-static int do_syno_populate(int argc, char *const argv[])
+int do_syno_populate(int argc, char *const argv[])
 {
        unsigned int bus = CONFIG_SF_DEFAULT_BUS;
        unsigned int cs = CONFIG_SF_DEFAULT_CS;
@@ -57,7 +54,7 @@ static int do_syno_populate(int argc, char *const argv[])
                goto out_unmap;
        }
 
-       for (n = 0; n < ETHADDR_MAX; n++) {
+       for (n = 0; n < SYNO_ETHADDR_MAX; n++) {
                char ethaddr[ETH_ALEN];
                int i, sum = 0;
                unsigned char csum = 0;
diff --git a/board/Synology/ds414/cmd_syno.h b/board/Synology/ds414/cmd_syno.h
new file mode 100644 (file)
index 0000000..42e435c
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Commands to deal with Synology specifics.
+ *
+ * Copyright (C) 2021  Phil Sutter <phil@nwl.cc>
+ */
+
+#ifndef _CMD_SYNO_H
+#define _CMD_SYNO_H
+
+#define SYNO_ETHADDR_MAX       4
+#define SYNO_SN_TAG            "SN="
+#define SYNO_CHKSUM_TAG                "CHK="
+
+int do_syno_populate(int argc, char *const argv[]);
+
+#endif /* _CMD_SYNO_H */
index 9c4ce67..abe6f9e 100644 (file)
@@ -18,6 +18,8 @@
 #include "../arch/arm/mach-mvebu/serdes/axp/high_speed_env_spec.h"
 #include "../arch/arm/mach-mvebu/serdes/axp/board_env_spec.h"
 
+#include "cmd_syno.h"
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /* GPP and MPP settings as found in mvBoardEnvSpec.c of Synology's U-Boot */
@@ -179,6 +181,15 @@ int board_init(void)
        return 0;
 }
 
+int misc_init_r(void)
+{
+       if (!env_get("ethaddr")) {
+               puts("Incomplete environment, populating from SPI flash\n");
+               do_syno_populate(0, NULL);
+       }
+       return 0;
+}
+
 int checkboard(void)
 {
        puts("Board: DS414\n");
index 65b3942..dda8502 100644 (file)
@@ -31,8 +31,6 @@
 #include <asm/mach-imx/video.h>
 #include <i2c.h>
 #include <input.h>
-#include <mmc.h>
-#include <fsl_esdhc_imx.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/arch/mxc_hdmi.h>
@@ -93,24 +91,6 @@ static void setup_iomux_uart(void)
 }
 
 iomux_v3_cfg_t const enet_pads[] = {
-       MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       /* GPIO16 -> AR8035 25MHz */
-       MX6_PAD_GPIO_16__ENET_REF_CLK | MUX_PAD_CTRL(NO_PAD_CTRL),
-       MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(NO_PAD_CTRL),
-       MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       /* AR8035 CLK_25M --> ENET_REF_CLK (V22) */
-       MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL_CLK),
-       MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
-       MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
-       MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
        /* AR8035 PHY Reset */
        MX6_PAD_EIM_D31__GPIO3_IO31 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
        /* AR8035 PHY Interrupt */
@@ -150,141 +130,6 @@ int board_phy_config(struct phy_device *phydev)
        return 0;
 }
 
-iomux_v3_cfg_t const usdhc2_pads[] = {
-       MX6_PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CLK_CTRL),
-       MX6_PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_GPIO_2__GPIO1_IO02 | MUX_PAD_CTRL(NO_PAD_CTRL), /* WP */
-       MX6_PAD_GPIO_4__GPIO1_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
-};
-
-iomux_v3_cfg_t const usdhc3_pads[] = {
-       MX6_PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CLK_CTRL),
-       MX6_PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-};
-
-iomux_v3_cfg_t const riotboard_usdhc3_pads[] = {
-       MX6_PAD_SD3_DAT4__GPIO7_IO01 | MUX_PAD_CTRL(NO_PAD_CTRL), /* WP */
-       MX6_PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
-};
-
-iomux_v3_cfg_t const usdhc4_pads[] = {
-       MX6_PAD_SD4_CLK__SD4_CLK | MUX_PAD_CTRL(USDHC_PAD_CLK_CTRL),
-       MX6_PAD_SD4_CMD__SD4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD4_DAT0__SD4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD4_DAT1__SD4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD4_DAT2__SD4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       MX6_PAD_SD4_DAT3__SD4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-       /* eMMC RST */
-       MX6_PAD_NANDF_ALE__GPIO6_IO08 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-#ifdef CONFIG_FSL_ESDHC_IMX
-struct fsl_esdhc_cfg usdhc_cfg[3] = {
-       {USDHC2_BASE_ADDR},
-       {USDHC3_BASE_ADDR},
-       {USDHC4_BASE_ADDR},
-};
-
-#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4)
-#define USDHC3_CD_GPIO IMX_GPIO_NR(7, 0)
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-       struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-       int ret = 0;
-
-       switch (cfg->esdhc_base) {
-       case USDHC2_BASE_ADDR:
-               ret = !gpio_get_value(USDHC2_CD_GPIO);
-               break;
-       case USDHC3_BASE_ADDR:
-               if (board_type == BOARD_IS_RIOTBOARD)
-                       ret = !gpio_get_value(USDHC3_CD_GPIO);
-               else if (board_type == BOARD_IS_MARSBOARD)
-                       ret = 1; /* eMMC/uSDHC3 is always present */
-               break;
-       case USDHC4_BASE_ADDR:
-               ret = 1; /* eMMC/uSDHC4 is always present */
-               break;
-       }
-
-       return ret;
-}
-
-int board_mmc_init(struct bd_info *bis)
-{
-       int ret;
-       int i;
-
-       /*
-        * According to the board_mmc_init() the following map is done:
-        * (U-Boot device node)    (Physical Port)
-        * ** RiOTboard :
-        * mmc0                    SDCard slot (bottom)
-        * mmc1                    uSDCard slot (top)
-        * mmc2                    eMMC
-        * ** MarSBoard :
-        * mmc0                    uSDCard slot (bottom)
-        * mmc1                    eMMC
-        */
-       for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
-               switch (i) {
-               case 0:
-                       imx_iomux_v3_setup_multiple_pads(
-                               usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
-                       gpio_direction_input(USDHC2_CD_GPIO);
-                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-                       usdhc_cfg[0].max_bus_width = 4;
-                       break;
-               case 1:
-                       imx_iomux_v3_setup_multiple_pads(
-                               usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
-                       if (board_type == BOARD_IS_RIOTBOARD) {
-                               imx_iomux_v3_setup_multiple_pads(
-                                       riotboard_usdhc3_pads,
-                                       ARRAY_SIZE(riotboard_usdhc3_pads));
-                               gpio_direction_input(USDHC3_CD_GPIO);
-                       } else {
-                               gpio_direction_output(IMX_GPIO_NR(7, 8) , 0);
-                               udelay(250);
-                               gpio_set_value(IMX_GPIO_NR(7, 8), 1);
-                       }
-                       usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-                       usdhc_cfg[1].max_bus_width = 4;
-                       break;
-               case 2:
-                       imx_iomux_v3_setup_multiple_pads(
-                               usdhc4_pads, ARRAY_SIZE(usdhc4_pads));
-                       usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
-                       usdhc_cfg[2].max_bus_width = 4;
-                       gpio_direction_output(IMX_GPIO_NR(6, 8) , 0);
-                       udelay(250);
-                       gpio_set_value(IMX_GPIO_NR(6, 8), 1);
-                       break;
-               default:
-                       printf("Warning: you configured more USDHC controllers"
-                              "(%d) then supported by the board (%d)\n",
-                              i + 1, CONFIG_SYS_FSL_USDHC_NUM);
-                       return -EINVAL;
-               }
-
-               ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
-}
-#endif
-
 #ifdef CONFIG_MXC_SPI
 iomux_v3_cfg_t const ecspi1_pads[] = {
        MX6_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL),
@@ -513,13 +358,6 @@ int overwrite_console(void)
        return 1;
 }
 
-int board_eth_init(struct bd_info *bis)
-{
-       setup_iomux_enet();
-
-       return cpu_eth_init(bis);
-}
-
 int board_early_init_f(void)
 {
        u32 cputype = cpu_type(get_cpu_rev());
@@ -597,6 +435,7 @@ int board_late_init(void)
        else if (board_type == BOARD_IS_RIOTBOARD)
                add_board_boot_modes(marsboard_boot_modes);
 #endif
+       setup_iomux_enet();
 
        return 0;
 }
diff --git a/board/freescale/imx8mm_evk/boot.cmd b/board/freescale/imx8mm_evk/boot.cmd
deleted file mode 100644 (file)
index fdfceec..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-setenv bootargs console=${console} root=${mmcroot};
-
-for boot_target in ${boot_targets};
-do
-        if test "${boot_target}" = "mmc1" ; then
-                if fatload mmc 1:${mmcpart} ${kernel_addr_r} ${image}; then
-                        if fatload mmc 1:${mmcpart} ${fdt_addr} ${fdt_file}; then
-                                echo Load image and .dtb from SD card(mmc1);
-                                booti ${kernel_addr_r} - ${fdt_addr};
-                                exit;
-                        fi
-                fi
-        fi
-
-        if test "${boot_target}" = "mmc2" ; then
-                if fatload mmc 2:${mmcpart} ${kernel_addr_r} ${image}; then
-                        if fatload mmc 2:${mmcpart} ${fdt_addr} ${fdt_file}; then
-                                echo Load image and .dtb from eMMC(mmc2);
-                                booti ${kernel_addr_r} - ${fdt_addr};
-                                exit;
-                        fi
-                fi
-        fi
-
-        if test "${boot_target}" = "dhcp" ; then
-                if dhcp ${kernel_addr_r} ${serverip}:${image}; then
-                        if dhcp ${fdt_addr} ${serverip}:${fdt_file}; then
-                                echo Load image and .dtb from net(dhcp);
-                                booti ${kernel_addr_r} - ${fdt_addr};
-                                exit;
-                        fi
-                fi
-        fi
-
-done
diff --git a/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg b/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg
new file mode 100644 (file)
index 0000000..b89092a
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+#define __ASSEMBLY__
+
+BOOT_FROM      sd
+LOADER         mkimage.flash.mkimage   0x7E1000
index 8e48b9d..4373ca6 100644 (file)
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2019 NXP
+ * Copyright 2018-2019 NXP
+ *
+ * Generated code from MX8M_DDR_tool
  */
 
 #include <linux/kernel.h>
-#include <common.h>
 #include <asm/arch/ddr.h>
-#include <asm/arch/lpddr4_define.h>
 
-struct dram_cfg_param lpddr4_ddrc_cfg[] = {
-       /* Start to config, default 3200mbps */
-       { DDRC_DBG1(0), 0x00000001 },
-       { DDRC_PWRCTL(0), 0x00000001 },
-       { DDRC_MSTR(0), 0xa1080020 },
-       { DDRC_RFSHTMG(0), 0x005b00d2 },
-       { DDRC_INIT0(0), 0xC003061B },
-       { DDRC_INIT1(0), 0x009D0000 },
-       { DDRC_INIT3(0), 0x00D4002D },
-       { DDRC_INIT4(0), (LPDDR4_MR3 << 16) | 0x0000 },
-       { DDRC_INIT6(0), 0x0066004a },
-       { DDRC_INIT7(0), 0x0006004a },
-
-       { DDRC_DRAMTMG0(0), 0x1A201B22 },
-       { DDRC_DRAMTMG1(0), 0x00060633 },
-       { DDRC_DRAMTMG3(0), 0x00C0C000 },
-       { DDRC_DRAMTMG4(0), 0x0F04080F },
-       { DDRC_DRAMTMG5(0), 0x02040C0C },
-       { DDRC_DRAMTMG6(0), 0x01010007 },
-       { DDRC_DRAMTMG7(0), 0x00000401 },
-       { DDRC_DRAMTMG12(0), 0x00020600 },
-       { DDRC_DRAMTMG13(0), 0x0C100002 },
-       { DDRC_DRAMTMG14(0), 0x000000E6 },
-       { DDRC_DRAMTMG17(0), 0x00A00050 },
-
-       { DDRC_ZQCTL0(0), 0x03200018 },
-       { DDRC_ZQCTL1(0), 0x028061A8 },
-       { DDRC_ZQCTL2(0), 0x00000000 },
-
-       { DDRC_DFITMG0(0), 0x0497820A },
-       { DDRC_DFITMG2(0), 0x0000170A },
-       { DDRC_DRAMTMG2(0), 0x070E171a },
-       { DDRC_DBICTL(0), 0x00000001 },
-
-       { DDRC_DFITMG1(0), 0x00080303 },
-       { DDRC_DFIUPD0(0), 0xE0400018 },
-       { DDRC_DFIUPD1(0), 0x00DF00E4 },
-       { DDRC_DFIUPD2(0), 0x80000000 },
-       { DDRC_DFIMISC(0), 0x00000011 },
-
-       { DDRC_DFIPHYMSTR(0), 0x00000000 },
-       { DDRC_RANKCTL(0), 0x00000c99 },
-
-       /* address mapping */
-       { DDRC_ADDRMAP0(0), 0x0000001f },
-       { DDRC_ADDRMAP1(0), 0x00080808 },
-       { DDRC_ADDRMAP2(0), 0x00000000 },
-       { DDRC_ADDRMAP3(0), 0x00000000 },
-       { DDRC_ADDRMAP4(0), 0x00001f1f },
-       { DDRC_ADDRMAP5(0), 0x07070707 },
-       { DDRC_ADDRMAP6(0), 0x07070707 },
-       { DDRC_ADDRMAP7(0), 0x00000f0f },
+struct dram_cfg_param ddr_ddrc_cfg[] = {
+       /* Initialize DDRC registers */
+       { 0x3d400304, 0x1 },
+       { 0x3d400030, 0x1 },
+       { 0x3d400000, 0xa1080020 },
+       { 0x3d400020, 0x223 },
+       { 0x3d400024, 0x16e3600 },
+       { 0x3d400064, 0x5b00d2 },
+       { 0x3d4000d0, 0xc00305ba },
+       { 0x3d4000d4, 0x940000 },
+       { 0x3d4000dc, 0xd4002d },
+       { 0x3d4000e0, 0x310000 },
+       { 0x3d4000e8, 0x66004d },
+       { 0x3d4000ec, 0x16004d },
+       { 0x3d400100, 0x191e1920 },
+       { 0x3d400104, 0x60630 },
+       { 0x3d40010c, 0xb0b000 },
+       { 0x3d400110, 0xe04080e },
+       { 0x3d400114, 0x2040c0c },
+       { 0x3d400118, 0x1010007 },
+       { 0x3d40011c, 0x401 },
+       { 0x3d400130, 0x20600 },
+       { 0x3d400134, 0xc100002 },
+       { 0x3d400138, 0xd8 },
+       { 0x3d400144, 0x96004b },
+       { 0x3d400180, 0x2ee0017 },
+       { 0x3d400184, 0x2605b8e },
+       { 0x3d400188, 0x0 },
+       { 0x3d400190, 0x497820a },
+       { 0x3d400194, 0x80303 },
+       { 0x3d4001b4, 0x170a },
+       { 0x3d4001a0, 0xe0400018 },
+       { 0x3d4001a4, 0xdf00e4 },
+       { 0x3d4001a8, 0x80000000 },
+       { 0x3d4001b0, 0x11 },
+       { 0x3d4001c0, 0x1 },
+       { 0x3d4001c4, 0x0 },
+       { 0x3d4000f4, 0xc99 },
+       { 0x3d400108, 0x70e1617 },
+       { 0x3d400200, 0x1f },
+       { 0x3d40020c, 0x0 },
+       { 0x3d400210, 0x1f1f },
+       { 0x3d400204, 0x80808 },
+       { 0x3d400214, 0x7070707 },
+       { 0x3d400218, 0x7070707 },
 
        /* performance setting */
-       { DDRC_SCHED(0), 0x29001701 },
-       { DDRC_SCHED1(0), 0x0000002c },
-       { DDRC_PERFHPR1(0), 0x04000030 },
-       { DDRC_PERFLPR1(0), 0x900093e7 },
-       { DDRC_PERFWR1(0), 0x20005574 },
-       { DDRC_PCCFG(0), 0x00000111 },
-       { DDRC_PCFGW_0(0), 0x000072ff },
-       { DDRC_PCFGQOS0_0(0), 0x02100e07 },
-       { DDRC_PCFGQOS1_0(0), 0x00620096 },
-       { DDRC_PCFGWQOS0_0(0), 0x01100e07 },
-       { DDRC_PCFGWQOS1_0(0), 0x00c8012c },
+       { 0x3d400250, 0x29001701 },
+       { 0x3d400254, 0x2c },
+       { 0x3d40025c, 0x4000030 },
+       { 0x3d400264, 0x900093e7 },
+       { 0x3d40026c, 0x2005574 },
+       { 0x3d400400, 0x111 },
+       { 0x3d400408, 0x72ff },
+       { 0x3d400494, 0x2100e07 },
+       { 0x3d400498, 0x620096 },
+       { 0x3d40049c, 0x1100e07 },
+       { 0x3d4004a0, 0xc8012c },
 
-       /* frequency P1&P2 */
-       /* Frequency 1: 400mbps */
-       { DDRC_FREQ1_DRAMTMG0(0), 0x0d0b010c },
-       { DDRC_FREQ1_DRAMTMG1(0), 0x00030410 },
-       { DDRC_FREQ1_DRAMTMG2(0), 0x0203090c },
-       { DDRC_FREQ1_DRAMTMG3(0), 0x00505006 },
-       { DDRC_FREQ1_DRAMTMG4(0), 0x05040305 },
-       { DDRC_FREQ1_DRAMTMG5(0), 0x0d0e0504 },
-       { DDRC_FREQ1_DRAMTMG6(0), 0x0a060004 },
-       { DDRC_FREQ1_DRAMTMG7(0), 0x0000090e },
-       { DDRC_FREQ1_DRAMTMG14(0), 0x00000032 },
-       { DDRC_FREQ1_DRAMTMG15(0), 0x00000000 },
-       { DDRC_FREQ1_DRAMTMG17(0), 0x0036001b },
-       { DDRC_FREQ1_DERATEINT(0), 0x7e9fbeb1 },
-       { DDRC_FREQ1_DFITMG0(0), 0x03818200 },
-       { DDRC_FREQ1_DFITMG2(0), 0x00000000 },
-       { DDRC_FREQ1_RFSHTMG(0), 0x000C001c },
-       { DDRC_FREQ1_INIT3(0), 0x00840000 },
-       { DDRC_FREQ1_INIT4(0), 0x00310000 },
-       { DDRC_FREQ1_INIT6(0), 0x0066004a },
-       { DDRC_FREQ1_INIT7(0), 0x0006004a },
+       /* P1: 400mts */
+       { 0x3d402020, 0x21 },
+       { 0x3d402024, 0x30d400 },
+       { 0x3d402050, 0x20d040 },
+       { 0x3d402064, 0xc001c },
+       { 0x3d4020dc, 0x840000 },
+       { 0x3d4020e0, 0x310000 },
+       { 0x3d4020e8, 0x66004d },
+       { 0x3d4020ec, 0x16004d },
+       { 0x3d402100, 0xa040305 },
+       { 0x3d402104, 0x30407 },
+       { 0x3d402108, 0x203060b },
+       { 0x3d40210c, 0x505000 },
+       { 0x3d402110, 0x2040202 },
+       { 0x3d402114, 0x2030202 },
+       { 0x3d402118, 0x1010004 },
+       { 0x3d40211c, 0x301 },
+       { 0x3d402130, 0x20300 },
+       { 0x3d402134, 0xa100002 },
+       { 0x3d402138, 0x1d },
+       { 0x3d402144, 0x14000a },
+       { 0x3d402180, 0x640004 },
+       { 0x3d402190, 0x3818200 },
+       { 0x3d402194, 0x80303 },
+       { 0x3d4021b4, 0x100 },
 
-       /* Frequency 2: 100mbps */
-       { DDRC_FREQ2_DRAMTMG0(0), 0x0d0b010c },
-       { DDRC_FREQ2_DRAMTMG1(0), 0x00030410 },
-       { DDRC_FREQ2_DRAMTMG2(0), 0x0203090c },
-       { DDRC_FREQ2_DRAMTMG3(0), 0x00505006 },
-       { DDRC_FREQ2_DRAMTMG4(0), 0x05040305 },
-       { DDRC_FREQ2_DRAMTMG5(0), 0x0d0e0504 },
-       { DDRC_FREQ2_DRAMTMG6(0), 0x0a060004 },
-       { DDRC_FREQ2_DRAMTMG7(0), 0x0000090e },
-       { DDRC_FREQ2_DRAMTMG14(0), 0x00000032 },
-       { DDRC_FREQ2_DRAMTMG17(0), 0x0036001b },
-       { DDRC_FREQ2_DERATEINT(0), 0x7e9fbeb1 },
-       { DDRC_FREQ2_DFITMG0(0), 0x03818200 },
-       { DDRC_FREQ2_DFITMG2(0), 0x00000000 },
-       { DDRC_FREQ2_RFSHTMG(0), 0x0003800c },
-       { DDRC_FREQ2_RFSHTMG(0), 0x00030007 },
-       { DDRC_FREQ2_INIT3(0), 0x00840000 },
-       { DDRC_FREQ2_INIT4(0), 0x00310008 },
-       { DDRC_FREQ2_INIT4(0), (LPDDR4_MR3 << 16) | 0x0000 },
-       { DDRC_FREQ2_INIT6(0), 0x0066004a },
-       { DDRC_FREQ2_INIT7(0), 0x0006004a },
+       /* p2: 100mts */
+       { 0x3d403020, 0x21 },
+       { 0x3d403024, 0xc3500 },
+       { 0x3d403050, 0x20d040 },
+       { 0x3d403064, 0x30007 },
+       { 0x3d4030dc, 0x840000 },
+       { 0x3d4030e0, 0x310000 },
+       { 0x3d4030e8, 0x66004d },
+       { 0x3d4030ec, 0x16004d },
+       { 0x3d403100, 0xa010102 },
+       { 0x3d403104, 0x30404 },
+       { 0x3d403108, 0x203060b },
+       { 0x3d40310c, 0x505000 },
+       { 0x3d403110, 0x2040202 },
+       { 0x3d403114, 0x2030202 },
+       { 0x3d403118, 0x1010004 },
+       { 0x3d40311c, 0x301 },
+       { 0x3d403130, 0x20300 },
+       { 0x3d403134, 0xa100002 },
+       { 0x3d403138, 0x8 },
+       { 0x3d403144, 0x50003 },
+       { 0x3d403180, 0x190004 },
+       { 0x3d403190, 0x3818200 },
+       { 0x3d403194, 0x80303 },
+       { 0x3d4031b4, 0x100 },
 
-       /* boot start point */
-       { DDRC_MSTR2(0), 0x2 }, //DDRC_MSTR2
+       /* default boot point */
+       { 0x3d400028, 0x0 },
 };
 
 /* PHY Initialize Configuration */
-struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
+struct dram_cfg_param ddr_ddrphy_cfg[] = {
+       { 0x100a0, 0x0 },
+       { 0x100a1, 0x1 },
+       { 0x100a2, 0x2 },
+       { 0x100a3, 0x3 },
+       { 0x100a4, 0x4 },
+       { 0x100a5, 0x5 },
+       { 0x100a6, 0x6 },
+       { 0x100a7, 0x7 },
+       { 0x110a0, 0x0 },
+       { 0x110a1, 0x1 },
+       { 0x110a2, 0x3 },
+       { 0x110a3, 0x4 },
+       { 0x110a4, 0x5 },
+       { 0x110a5, 0x2 },
+       { 0x110a6, 0x7 },
+       { 0x110a7, 0x6 },
+       { 0x120a0, 0x0 },
+       { 0x120a1, 0x1 },
+       { 0x120a2, 0x3 },
+       { 0x120a3, 0x2 },
+       { 0x120a4, 0x5 },
+       { 0x120a5, 0x4 },
+       { 0x120a6, 0x7 },
+       { 0x120a7, 0x6 },
+       { 0x130a0, 0x0 },
+       { 0x130a1, 0x1 },
+       { 0x130a2, 0x2 },
+       { 0x130a3, 0x3 },
+       { 0x130a4, 0x4 },
+       { 0x130a5, 0x5 },
+       { 0x130a6, 0x6 },
+       { 0x130a7, 0x7 },
        { 0x1005f, 0x1ff },
        { 0x1015f, 0x1ff },
        { 0x1105f, 0x1ff },
@@ -132,7 +165,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x1215f, 0x1ff },
        { 0x1305f, 0x1ff },
        { 0x1315f, 0x1ff },
-
        { 0x11005f, 0x1ff },
        { 0x11015f, 0x1ff },
        { 0x11105f, 0x1ff },
@@ -141,7 +173,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x11215f, 0x1ff },
        { 0x11305f, 0x1ff },
        { 0x11315f, 0x1ff },
-
        { 0x21005f, 0x1ff },
        { 0x21015f, 0x1ff },
        { 0x21105f, 0x1ff },
@@ -150,7 +181,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x21215f, 0x1ff },
        { 0x21305f, 0x1ff },
        { 0x21315f, 0x1ff },
-
        { 0x55, 0x1ff },
        { 0x1055, 0x1ff },
        { 0x2055, 0x1ff },
@@ -161,32 +191,24 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x7055, 0x1ff },
        { 0x8055, 0x1ff },
        { 0x9055, 0x1ff },
-
        { 0x200c5, 0x19 },
        { 0x1200c5, 0x7 },
        { 0x2200c5, 0x7 },
-
        { 0x2002e, 0x2 },
        { 0x12002e, 0x2 },
        { 0x22002e, 0x2 },
-
        { 0x90204, 0x0 },
        { 0x190204, 0x0 },
        { 0x290204, 0x0 },
-
-       { 0x20024, 0xab },
+       { 0x20024, 0x1ab },
        { 0x2003a, 0x0 },
-
-       { 0x120024, 0xab },
+       { 0x120024, 0x1ab },
        { 0x2003a, 0x0 },
-
-       { 0x220024, 0xab },
+       { 0x220024, 0x1ab },
        { 0x2003a, 0x0 },
-
        { 0x20056, 0x3 },
        { 0x120056, 0xa },
        { 0x220056, 0xa },
-
        { 0x1004d, 0xe00 },
        { 0x1014d, 0xe00 },
        { 0x1104d, 0xe00 },
@@ -195,7 +217,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x1214d, 0xe00 },
        { 0x1304d, 0xe00 },
        { 0x1314d, 0xe00 },
-
        { 0x11004d, 0xe00 },
        { 0x11014d, 0xe00 },
        { 0x11104d, 0xe00 },
@@ -204,7 +225,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x11214d, 0xe00 },
        { 0x11304d, 0xe00 },
        { 0x11314d, 0xe00 },
-
        { 0x21004d, 0xe00 },
        { 0x21014d, 0xe00 },
        { 0x21104d, 0xe00 },
@@ -213,34 +233,30 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x21214d, 0xe00 },
        { 0x21304d, 0xe00 },
        { 0x21314d, 0xe00 },
-
-       { 0x10049, 0xfbe },
-       { 0x10149, 0xfbe },
-       { 0x11049, 0xfbe },
-       { 0x11149, 0xfbe },
-       { 0x12049, 0xfbe },
-       { 0x12149, 0xfbe },
-       { 0x13049, 0xfbe },
-       { 0x13149, 0xfbe },
-
-       { 0x110049, 0xfbe },
-       { 0x110149, 0xfbe },
-       { 0x111049, 0xfbe },
-       { 0x111149, 0xfbe },
-       { 0x112049, 0xfbe },
-       { 0x112149, 0xfbe },
-       { 0x113049, 0xfbe },
-       { 0x113149, 0xfbe },
-
-       { 0x210049, 0xfbe },
-       { 0x210149, 0xfbe },
-       { 0x211049, 0xfbe },
-       { 0x211149, 0xfbe },
-       { 0x212049, 0xfbe },
-       { 0x212149, 0xfbe },
-       { 0x213049, 0xfbe },
-       { 0x213149, 0xfbe },
-
+       { 0x10049, 0xeba },
+       { 0x10149, 0xeba },
+       { 0x11049, 0xeba },
+       { 0x11149, 0xeba },
+       { 0x12049, 0xeba },
+       { 0x12149, 0xeba },
+       { 0x13049, 0xeba },
+       { 0x13149, 0xeba },
+       { 0x110049, 0xeba },
+       { 0x110149, 0xeba },
+       { 0x111049, 0xeba },
+       { 0x111149, 0xeba },
+       { 0x112049, 0xeba },
+       { 0x112149, 0xeba },
+       { 0x113049, 0xeba },
+       { 0x113149, 0xeba },
+       { 0x210049, 0xeba },
+       { 0x210149, 0xeba },
+       { 0x211049, 0xeba },
+       { 0x211149, 0xeba },
+       { 0x212049, 0xeba },
+       { 0x212149, 0xeba },
+       { 0x213049, 0xeba },
+       { 0x213149, 0xeba },
        { 0x43, 0x63 },
        { 0x1043, 0x63 },
        { 0x2043, 0x63 },
@@ -251,7 +267,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x7043, 0x63 },
        { 0x8043, 0x63 },
        { 0x9043, 0x63 },
-
        { 0x20018, 0x3 },
        { 0x20075, 0x4 },
        { 0x20050, 0x0 },
@@ -259,8 +274,7 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x120008, 0x64 },
        { 0x220008, 0x19 },
        { 0x20088, 0x9 },
-
-       { 0x200b2, 0x1d4 },
+       { 0x200b2, 0xdc },
        { 0x10043, 0x5a1 },
        { 0x10143, 0x5a1 },
        { 0x11043, 0x5a1 },
@@ -269,7 +283,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x12143, 0x5a1 },
        { 0x13043, 0x5a1 },
        { 0x13143, 0x5a1 },
-
        { 0x1200b2, 0xdc },
        { 0x110043, 0x5a1 },
        { 0x110143, 0x5a1 },
@@ -279,7 +292,6 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x112143, 0x5a1 },
        { 0x113043, 0x5a1 },
        { 0x113143, 0x5a1 },
-
        { 0x2200b2, 0xdc },
        { 0x210043, 0x5a1 },
        { 0x210143, 0x5a1 },
@@ -289,15 +301,12 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x212143, 0x5a1 },
        { 0x213043, 0x5a1 },
        { 0x213143, 0x5a1 },
-
        { 0x200fa, 0x1 },
        { 0x1200fa, 0x1 },
        { 0x2200fa, 0x1 },
-
        { 0x20019, 0x1 },
        { 0x120019, 0x1 },
        { 0x220019, 0x1 },
-
        { 0x200f0, 0x660 },
        { 0x200f1, 0x0 },
        { 0x200f2, 0x4444 },
@@ -306,21 +315,20 @@ struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
        { 0x200f5, 0x0 },
        { 0x200f6, 0x0 },
        { 0x200f7, 0xf000 },
-
        { 0x20025, 0x0 },
-       { 0x2002d, LPDDR4_PHY_DMIPinPresent },
-       { 0x12002d, LPDDR4_PHY_DMIPinPresent },
-       { 0x22002d, LPDDR4_PHY_DMIPinPresent },
+       { 0x2002d, 0x0 },
+       { 0x12002d, 0x0 },
+       { 0x22002d, 0x0 },
        { 0x200c7, 0x21 },
-       { 0x200ca, 0x24 },
        { 0x1200c7, 0x21 },
-       { 0x1200ca, 0x24 },
        { 0x2200c7, 0x21 },
+       { 0x200ca, 0x24 },
+       { 0x1200ca, 0x24 },
        { 0x2200ca, 0x24 },
 };
 
 /* ddr phy trained csr */
-struct dram_cfg_param lpddr4_ddrphy_trained_csr[] = {
+struct dram_cfg_param ddr_ddrphy_trained_csr[] = {
        { 0x200b2, 0x0 },
        { 0x1200b2, 0x0 },
        { 0x2200b2, 0x0 },
@@ -1041,309 +1049,164 @@ struct dram_cfg_param lpddr4_ddrphy_trained_csr[] = {
        { 0x13730, 0x0 },
        { 0x13830, 0x0 },
 };
-
 /* P0 message block paremeter for training firmware */
-struct dram_cfg_param lpddr4_fsp0_cfg[] = {
+struct dram_cfg_param ddr_fsp0_cfg[] = {
        { 0xd0000, 0x0 },
-       { 0x54000, 0x0 },
-       { 0x54001, 0x0 },
-       { 0x54002, 0x0 },
        { 0x54003, 0xbb8 },
        { 0x54004, 0x2 },
-       { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT) },//PHY Ron/Rtt
-       { 0x54006, LPDDR4_PHY_VREF_VALUE },
-       { 0x54007, 0x0 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
        { 0x54008, 0x131f },
        { 0x54009, 0xc8 },
-       { 0x5400a, 0x0 },
        { 0x5400b, 0x2 },
-       { 0x5400c, 0x0 },
-       { 0x5400d, 0x0 },
-       { 0x5400e, 0x0 },
-       { 0x5400f, 0x0 },
-       { 0x54010, 0x0 },
-       { 0x54011, 0x0 },
-       { 0x54012, (LPDDR4_CS << 8) | (0x110 & 0xff) },
-       { 0x54013, 0x0 },
-       { 0x54014, 0x0 },
-       { 0x54015, 0x0 },
-       { 0x54016, 0x0 },
-       { 0x54017, 0x0 },
-       { 0x54018, 0x0 },
+       { 0x54012, 0x110 },
        { 0x54019, 0x2dd4 },
-       { 0x5401a, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x5401a, 0x31 },
        { 0x5401b, 0x4d66 },
-       { 0x5401c, 0x4d08 },
-       { 0x5401d, 0x0 },
-       { 0x5401e, LPDDR4_MR22_RANK0/*0x16*/ },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
        { 0x5401f, 0x2dd4 },
-       { 0x54020, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x54020, 0x31 },
        { 0x54021, 0x4d66 },
-       { 0x54022, 0x4d08 },
-       { 0x54023, 0x0 },
-       { 0x54024, LPDDR4_MR22_RANK1/*0x16*/ },
-       { 0x54025, 0x0 },
-       { 0x54026, 0x0 },
-       { 0x54027, 0x0 },
-       { 0x54028, 0x0 },
-       { 0x54029, 0x0 },
-       { 0x5402a, 0x0 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
        { 0x5402b, 0x1000 },
-       { 0x5402c, LPDDR4_CS },
-       { 0x5402d, 0x0 },
-       { 0x5402e, 0x0 },
-       { 0x5402f, 0x0 },
-       { 0x54030, 0x0 },
-       { 0x54031, 0x0 },
+       { 0x5402c, 0x1 },
        { 0x54032, 0xd400 },
-       { 0x54033, (LPDDR4_MR3 << 8) | (0x312d & 0xff) },
+       { 0x54033, 0x312d },
        { 0x54034, 0x6600 },
-       { 0x54035, 0x84d },
+       { 0x54035, 0x4d },
        { 0x54036, 0x4d },
-       { 0x54037, (LPDDR4_MR22_RANK0 << 8)/*0x1600*/ },
+       { 0x54037, 0x1600 },
        { 0x54038, 0xd400 },
-       { 0x54039, (LPDDR4_MR3 << 8) | (0x312d & 0xff) },
+       { 0x54039, 0x312d },
        { 0x5403a, 0x6600 },
-       { 0x5403b, 0x84d },
+       { 0x5403b, 0x4d },
        { 0x5403c, 0x4d },
-       { 0x5403d, (LPDDR4_MR22_RANK1 << 8)/*0x1600*/ },
-       { 0x5403e, 0x0 },
-       { 0x5403f, 0x0 },
-       { 0x54040, 0x0 },
-       { 0x54041, 0x0 },
-       { 0x54042, 0x0 },
-       { 0x54043, 0x0 },
-       { 0x54044, 0x0 },
+       { 0x5403d, 0x1600 },
        { 0xd0000, 0x1 },
 };
 
 /* P1 message block paremeter for training firmware */
-struct dram_cfg_param lpddr4_fsp1_cfg[] = {
+struct dram_cfg_param ddr_fsp1_cfg[] = {
        { 0xd0000, 0x0 },
-       { 0x54000, 0x0 },
-       { 0x54001, 0x0 },
        { 0x54002, 0x101 },
        { 0x54003, 0x190 },
        { 0x54004, 0x2 },
-       { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT) },/* PHY Ron/Rtt */
-       { 0x54006, LPDDR4_PHY_VREF_VALUE },
-       { 0x54007, 0x0 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
        { 0x54008, 0x121f },
        { 0x54009, 0xc8 },
-       { 0x5400a, 0x0 },
        { 0x5400b, 0x2 },
-       { 0x5400c, 0x0 },
-       { 0x5400d, 0x0 },
-       { 0x5400e, 0x0 },
-       { 0x5400f, 0x0 },
-       { 0x54010, 0x0 },
-       { 0x54011, 0x0 },
-       { 0x54012, (LPDDR4_CS << 8) | (0x110 & 0xff) },
-       { 0x54013, 0x0 },
-       { 0x54014, 0x0 },
-       { 0x54015, 0x0 },
-       { 0x54016, 0x0 },
-       { 0x54017, 0x0 },
-       { 0x54018, 0x0 },
+       { 0x54012, 0x110 },
        { 0x54019, 0x84 },
-       { 0x5401a, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x5401a, 0x31 },
        { 0x5401b, 0x4d66 },
-       { 0x5401c, 0x4d08 },
-       { 0x5401d, 0x0 },
-       { 0x5401e, LPDDR4_MR22_RANK0/*0x16*/ },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
        { 0x5401f, 0x84 },
-       { 0x54020, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x54020, 0x31 },
        { 0x54021, 0x4d66 },
-       { 0x54022, 0x4d08 },
-       { 0x54023, 0x0 },
-       { 0x54024, LPDDR4_MR22_RANK1/*0x16*/ },
-       { 0x54025, 0x0 },
-       { 0x54026, 0x0 },
-       { 0x54027, 0x0 },
-       { 0x54028, 0x0 },
-       { 0x54029, 0x0 },
-       { 0x5402a, 0x0 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
        { 0x5402b, 0x1000 },
-       { 0x5402c, LPDDR4_CS },
-       { 0x5402d, 0x0 },
-       { 0x5402e, 0x0 },
-       { 0x5402f, 0x0 },
-       { 0x54030, 0x0 },
-       { 0x54031, 0x0 },
+       { 0x5402c, 0x1 },
        { 0x54032, 0x8400 },
-       { 0x54033, (LPDDR4_MR3 << 8) | (0x3100 & 0xff) },
+       { 0x54033, 0x3100 },
        { 0x54034, 0x6600 },
-       { 0x54035, 0x84d },
+       { 0x54035, 0x4d },
        { 0x54036, 0x4d },
-       { 0x54037, (LPDDR4_MR22_RANK0 << 8)/*0x1600*/ },
+       { 0x54037, 0x1600 },
        { 0x54038, 0x8400 },
-       { 0x54039, (LPDDR4_MR3 << 8) | (0x3100 & 0xff) },
+       { 0x54039, 0x3100 },
        { 0x5403a, 0x6600 },
-       { 0x5403b, 0x84d },
+       { 0x5403b, 0x4d },
        { 0x5403c, 0x4d },
-       { 0x5403d, (LPDDR4_MR22_RANK1 << 8)/*0x1600*/ },
-       { 0x5403e, 0x0 },
-       { 0x5403f, 0x0 },
-       { 0x54040, 0x0 },
-       { 0x54041, 0x0 },
-       { 0x54042, 0x0 },
-       { 0x54043, 0x0 },
-       { 0x54044, 0x0 },
+       { 0x5403d, 0x1600 },
        { 0xd0000, 0x1 },
 };
 
-/* P1 message block paremeter for training firmware */
-struct dram_cfg_param lpddr4_fsp2_cfg[] = {
+/* P2 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp2_cfg[] = {
        { 0xd0000, 0x0 },
-       { 0x54000, 0x0 },
-       { 0x54001, 0x0 },
        { 0x54002, 0x102 },
        { 0x54003, 0x64 },
        { 0x54004, 0x2 },
-       { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT) },//PHY Ron/Rtt
-       { 0x54006, LPDDR4_PHY_VREF_VALUE },
-       { 0x54007, 0x0 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
        { 0x54008, 0x121f },
        { 0x54009, 0xc8 },
-       { 0x5400a, 0x0 },
        { 0x5400b, 0x2 },
-       { 0x5400c, 0x0 },
-       { 0x5400d, 0x0 },
-       { 0x5400e, 0x0 },
-       { 0x5400f, 0x0 },
-       { 0x54010, 0x0 },
-       { 0x54011, 0x0 },
-       { 0x54012, (LPDDR4_CS << 8) | (0x110 & 0xff) },
-       { 0x54013, 0x0 },
-       { 0x54014, 0x0 },
-       { 0x54015, 0x0 },
-       { 0x54016, 0x0 },
-       { 0x54017, 0x0 },
-       { 0x54018, 0x0 },
+       { 0x54012, 0x110 },
        { 0x54019, 0x84 },
-       { 0x5401a, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x5401a, 0x31 },
        { 0x5401b, 0x4d66 },
-       { 0x5401c, 0x4d08 },
-       { 0x5401d, 0x0 },
-       { 0x5401e, LPDDR4_MR22_RANK0/*0x16*/ },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
        { 0x5401f, 0x84 },
-       { 0x54020, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x54020, 0x31 },
        { 0x54021, 0x4d66 },
-       { 0x54022, 0x4d08 },
-       { 0x54023, 0x0 },
-       { 0x54024, LPDDR4_MR22_RANK1/*0x16*/ },
-       { 0x54025, 0x0 },
-       { 0x54026, 0x0 },
-       { 0x54027, 0x0 },
-       { 0x54028, 0x0 },
-       { 0x54029, 0x0 },
-       { 0x5402a, 0x0 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
        { 0x5402b, 0x1000 },
-       { 0x5402c, LPDDR4_CS },
-       { 0x5402d, 0x0 },
-       { 0x5402e, 0x0 },
-       { 0x5402f, 0x0 },
-       { 0x54030, 0x0 },
-       { 0x54031, 0x0 },
+       { 0x5402c, 0x1 },
        { 0x54032, 0x8400 },
-       { 0x54033, (LPDDR4_MR3 << 8) | (0x3100 & 0xff) },
+       { 0x54033, 0x3100 },
        { 0x54034, 0x6600 },
-       { 0x54035, 0x84d },
+       { 0x54035, 0x4d },
        { 0x54036, 0x4d },
-       { 0x54037, (LPDDR4_MR22_RANK0 << 8)/*0x1600*/ },
+       { 0x54037, 0x1600 },
        { 0x54038, 0x8400 },
-       { 0x54039, (LPDDR4_MR3 << 8) | (0x3100 & 0xff) },
+       { 0x54039, 0x3100 },
        { 0x5403a, 0x6600 },
-       { 0x5403b, 0x84d },
+       { 0x5403b, 0x4d },
        { 0x5403c, 0x4d },
-       { 0x5403d, (LPDDR4_MR22_RANK1 << 8)/*0x1600*/ },
-       { 0x5403e, 0x0 },
-       { 0x5403f, 0x0 },
-       { 0x54040, 0x0 },
-       { 0x54041, 0x0 },
-       { 0x54042, 0x0 },
-       { 0x54043, 0x0 },
-       { 0x54044, 0x0 },
+       { 0x5403d, 0x1600 },
        { 0xd0000, 0x1 },
 };
 
 /* P0 2D message block paremeter for training firmware */
-struct dram_cfg_param lpddr4_fsp0_2d_cfg[] = {
+struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
        { 0xd0000, 0x0 },
-       { 0x54000, 0x0 },
-       { 0x54001, 0x0 },
-       { 0x54002, 0x0 },
        { 0x54003, 0xbb8 },
        { 0x54004, 0x2 },
-       { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT) },//PHY Ron/Rtt
-       { 0x54006, LPDDR4_PHY_VREF_VALUE },
-       { 0x54007, 0x0 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
        { 0x54008, 0x61 },
        { 0x54009, 0xc8 },
-       { 0x5400a, 0x0 },
        { 0x5400b, 0x2 },
-       { 0x5400c, 0x0 },
-       { 0x5400d, 0x0 },
-       { 0x5400e, 0x0 },
        { 0x5400f, 0x100 },
        { 0x54010, 0x1f7f },
-       { 0x54011, 0x0 },
-       { 0x54012, (LPDDR4_CS << 8) | (0x110 & 0xff) },
-       { 0x54013, 0x0 },
-       { 0x54014, 0x0 },
-       { 0x54015, 0x0 },
-       { 0x54016, 0x0 },
-       { 0x54017, 0x0 },
-       { 0x54018, 0x0 },
+       { 0x54012, 0x110 },
        { 0x54019, 0x2dd4 },
-       { 0x5401a, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x5401a, 0x31 },
        { 0x5401b, 0x4d66 },
-       { 0x5401c, 0x4d08 },
-       { 0x5401d, 0x0 },
-       { 0x5401e, LPDDR4_MR22_RANK0/*0x16*/ },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
        { 0x5401f, 0x2dd4 },
-       { 0x54020, (0x31 & 0xff00) | LPDDR4_MR3 },
+       { 0x54020, 0x31 },
        { 0x54021, 0x4d66 },
-       { 0x54022, 0x4d08 },
-       { 0x54023, 0x0 },
-       { 0x54024, LPDDR4_MR22_RANK1/*0x16*/ },
-       { 0x54025, 0x0 },
-       { 0x54026, 0x0 },
-       { 0x54027, 0x0 },
-       { 0x54028, 0x0 },
-       { 0x54029, 0x0 },
-       { 0x5402a, 0x0 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
        { 0x5402b, 0x1000 },
-       { 0x5402c, LPDDR4_CS },
-       { 0x5402d, 0x0 },
-       { 0x5402e, 0x0 },
-       { 0x5402f, 0x0 },
-       { 0x54030, 0x0 },
-       { 0x54031, 0x0 },
+       { 0x5402c, 0x1 },
        { 0x54032, 0xd400 },
-       { 0x54033, (LPDDR4_MR3 << 8) | (0x312d & 0xff) },
+       { 0x54033, 0x312d },
        { 0x54034, 0x6600 },
-       { 0x54035, 0x84d },
+       { 0x54035, 0x4d },
        { 0x54036, 0x4d },
-       { 0x54037, (LPDDR4_MR22_RANK0 << 8)/*0x1600*/ },
+       { 0x54037, 0x1600 },
        { 0x54038, 0xd400 },
-       { 0x54039, (LPDDR4_MR3 << 8) | (0x312d & 0xff) },
+       { 0x54039, 0x312d },
        { 0x5403a, 0x6600 },
-       { 0x5403b, 0x84d },
+       { 0x5403b, 0x4d },
        { 0x5403c, 0x4d },
-       { 0x5403d, (LPDDR4_MR22_RANK1 << 8)/*0x1600*/ },
-       { 0x5403e, 0x0 },
-       { 0x5403f, 0x0 },
-       { 0x54040, 0x0 },
-       { 0x54041, 0x0 },
-       { 0x54042, 0x0 },
-       { 0x54043, 0x0 },
-       { 0x54044, 0x0 },
+       { 0x5403d, 0x1600 },
        { 0xd0000, 0x1 },
 };
 
 /* DRAM PHY init engine image */
-struct dram_cfg_param lpddr4_phy_pie[] = {
+struct dram_cfg_param ddr_phy_pie[] = {
        { 0xd0000, 0x0 },
        { 0x90000, 0x10 },
        { 0x90001, 0x400 },
@@ -1854,6 +1717,10 @@ struct dram_cfg_param lpddr4_phy_pie[] = {
        { 0x90013, 0x6152 },
        { 0x20010, 0x5a },
        { 0x20011, 0x3 },
+       { 0x120010, 0x5a },
+       { 0x120011, 0x3 },
+       { 0x220010, 0x5a },
+       { 0x220011, 0x3 },
        { 0x40080, 0xe0 },
        { 0x40081, 0x12 },
        { 0x40082, 0xe0 },
@@ -1931,50 +1798,51 @@ struct dram_cfg_param lpddr4_phy_pie[] = {
        { 0x138b4, 0x1 },
        { 0x2003a, 0x2 },
        { 0xc0080, 0x2 },
-       { 0xd0000, 0x1 },
+       { 0xd0000, 0x1 }
 };
 
-struct dram_fsp_msg lpddr4_dram_fsp_msg[] = {
+struct dram_fsp_msg ddr_dram_fsp_msg[] = {
        {
                /* P0 3000mts 1D */
                .drate = 3000,
                .fw_type = FW_1D_IMAGE,
-               .fsp_cfg = lpddr4_fsp0_cfg,
-               .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_cfg),
-       },
-       {
-               /* P0 3000mts 2D */
-               .drate = 3000,
-               .fw_type = FW_2D_IMAGE,
-               .fsp_cfg = lpddr4_fsp0_2d_cfg,
-               .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_2d_cfg),
+               .fsp_cfg = ddr_fsp0_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg),
        },
        {
                /* P1 400mts 1D */
                .drate = 400,
                .fw_type = FW_1D_IMAGE,
-               .fsp_cfg = lpddr4_fsp1_cfg,
-               .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp1_cfg),
+               .fsp_cfg = ddr_fsp1_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp1_cfg),
        },
        {
-               /* P1 100mts 1D */
+               /* P2 100mts 1D */
                .drate = 100,
                .fw_type = FW_1D_IMAGE,
-               .fsp_cfg = lpddr4_fsp2_cfg,
-               .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp2_cfg),
+               .fsp_cfg = ddr_fsp2_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp2_cfg),
+       },
+       {
+               /* P0 3000mts 2D */
+               .drate = 3000,
+               .fw_type = FW_2D_IMAGE,
+               .fsp_cfg = ddr_fsp0_2d_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_2d_cfg),
        },
 };
 
-/* lpddr4 timing config params on EVK board */
+/* ddr timing config params */
 struct dram_timing_info dram_timing = {
-       .ddrc_cfg = lpddr4_ddrc_cfg,
-       .ddrc_cfg_num = ARRAY_SIZE(lpddr4_ddrc_cfg),
-       .ddrphy_cfg = lpddr4_ddrphy_cfg,
-       .ddrphy_cfg_num = ARRAY_SIZE(lpddr4_ddrphy_cfg),
-       .fsp_msg = lpddr4_dram_fsp_msg,
-       .fsp_msg_num = ARRAY_SIZE(lpddr4_dram_fsp_msg),
-       .ddrphy_trained_csr = lpddr4_ddrphy_trained_csr,
-       .ddrphy_trained_csr_num = ARRAY_SIZE(lpddr4_ddrphy_trained_csr),
-       .ddrphy_pie = lpddr4_phy_pie,
-       .ddrphy_pie_num = ARRAY_SIZE(lpddr4_phy_pie),
+       .ddrc_cfg = ddr_ddrc_cfg,
+       .ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg),
+       .ddrphy_cfg = ddr_ddrphy_cfg,
+       .ddrphy_cfg_num = ARRAY_SIZE(ddr_ddrphy_cfg),
+       .fsp_msg = ddr_dram_fsp_msg,
+       .fsp_msg_num = ARRAY_SIZE(ddr_dram_fsp_msg),
+       .ddrphy_trained_csr = ddr_ddrphy_trained_csr,
+       .ddrphy_trained_csr_num = ARRAY_SIZE(ddr_ddrphy_trained_csr),
+       .ddrphy_pie = ddr_phy_pie,
+       .ddrphy_pie_num = ARRAY_SIZE(ddr_phy_pie),
+       .fsp_table = { 3000, 400, 100, },
 };
index 64bc606..4ef7f6f 100644 (file)
@@ -26,7 +26,7 @@
 #include <dm/device-internal.h>
 
 #include <power/pmic.h>
-#include <power/bd71837.h>
+#include <power/pca9450.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -94,7 +94,7 @@ static int power_init_board(void)
        struct udevice *dev;
        int ret;
 
-       ret = pmic_get("pmic@4b", &dev);
+       ret = pmic_get("pca9450@25", &dev);
        if (ret == -ENODEV) {
                puts("No pmic\n");
                return 0;
@@ -102,25 +102,26 @@ static int power_init_board(void)
        if (ret != 0)
                return ret;
 
-       /* decrease RESET key long push time from the default 10s to 10ms */
-       pmic_reg_write(dev, BD718XX_PWRONCONFIG1, 0x0);
+       /* BUCKxOUT_DVS0/1 control BUCK123 output */
+       pmic_reg_write(dev, PCA9450_BUCK123_DVS, 0x29);
 
-       /* unlock the PMIC regs */
-       pmic_reg_write(dev, BD718XX_REGLOCK, 0x1);
+       /* Buck 1 DVS control through PMIC_STBY_REQ */
+       pmic_reg_write(dev, PCA9450_BUCK1CTRL, 0x59);
 
-       /* increase VDD_SOC to typical value 0.85v before first DRAM access */
-       pmic_reg_write(dev, BD718XX_BUCK1_VOLT_RUN, 0x0f);
+       /* Set DVS1 to 0.8v for suspend */
+       pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS1, 0x10);
 
-       /* increase VDD_DRAM to 0.975v for 3Ghz DDR */
-       pmic_reg_write(dev, BD718XX_1ST_NODVS_BUCK_VOLT, 0x83);
+       /* increase VDD_DRAM to 0.95v for 3Ghz DDR */
+       pmic_reg_write(dev, PCA9450_BUCK3OUT_DVS0, 0x1C);
 
-#ifndef CONFIG_IMX8M_LPDDR4
-       /* increase NVCC_DRAM_1V2 to 1.2v for DDR4 */
-       pmic_reg_write(dev, BD718XX_4TH_NODVS_BUCK_VOLT, 0x28);
-#endif
+       /* VDD_DRAM needs off in suspend, set B1_ENMODE=10 (ON by PMIC_ON_REQ = H && PMIC_STBY_REQ = L) */
+       pmic_reg_write(dev, PCA9450_BUCK3CTRL, 0x4a);
+
+       /* set VDD_SNVS_0V8 from default 0.85V */
+       pmic_reg_write(dev, PCA9450_LDO2CTRL, 0xC0);
 
-       /* lock the PMIC regs */
-       pmic_reg_write(dev, BD718XX_REGLOCK, 0x11);
+       /* set WDOG_B_CFG to cold reset */
+       pmic_reg_write(dev, PCA9450_RESET_CTRL, 0xA1);
 
        return 0;
 }
index 048fb7d..478f4ed 100644 (file)
@@ -1,4 +1,4 @@
-if TARGET_IMX8MN_DDR4_EVK
+if TARGET_IMX8MN_EVK || TARGET_IMX8MN_DDR4_EVK
 
 config SYS_BOARD
        default "imx8mn_evk"
@@ -9,6 +9,10 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
        default "imx8mn_evk"
 
+config IMX8MN_LOW_DRIVE_MODE
+       bool "Enable the low drive mode of iMX8MN on EVK board"
+       default n
+
 source "board/freescale/common/Kconfig"
 
 endif
index 3b0653d..6d110cc 100644 (file)
@@ -1,6 +1,7 @@
-i.MX8MM EVK BOARD
+i.MX8MN EVK BOARD
 M:     Peng Fan <peng.fan@nxp.com>
 S:     Maintained
 F:     board/freescale/imx8mn_evk/
 F:     include/configs/imx8mn_evk.h
 F:     configs/imx8mn_ddr4_evk_defconfig
+F:     configs/imx8mn_evk_defconfig
index 9511a70..42d1179 100644 (file)
@@ -8,5 +8,11 @@ obj-y += imx8mn_evk.o
 
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
+ifdef CONFIG_IMX8MN_LOW_DRIVE_MODE
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing_ld.o
+obj-$(CONFIG_IMX8M_DDR4) += ddr4_timing_ld.o
+else
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
 obj-$(CONFIG_IMX8M_DDR4) += ddr4_timing.o
 endif
+endif
index cfd193a..f1509e2 100644 (file)
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2019 NXP
  *
- * SPDX-License-Identifier:    GPL-2.0+
- *
  * Generated code from MX8M_DDR_tool
- * Align with uboot-imx_v2018.03_4.14.78_1.0.0_ga
+ * Align with uboot version:
+ * imx_v2018.03_4.14.78_1.0.0_ga ~ imx_v2018.04_4.19.35_1.0.0_ga
  */
 
 #include <linux/kernel.h>
 #include <asm/arch/ddr.h>
 
 struct dram_cfg_param ddr_ddrc_cfg[] = {
-       {0x3d400000, 0x81040010},
-       {0x3d400030, 0x00000020},
-       {0x3d400034, 0x00221306},
-       {0x3d400050, 0x00210070},
-       {0x3d400054, 0x00010008},
-       {0x3d400060, 0x00000000},
-       {0x3d400064, 0x0092014a},
-       {0x3d4000c0, 0x00000000},
-       {0x3d4000c4, 0x00001000},
-       {0x3d4000d0, 0xc0030126},
-       {0x3d4000d4, 0x00770000},
-       {0x3d4000dc, 0x08340105},
-       {0x3d4000e0, 0x00180200},
-       {0x3d4000e4, 0x00110000},
-       {0x3d4000e8, 0x02000740},
-       {0x3d4000ec, 0x00000850},
-       {0x3d4000f4, 0x00000ec7},
-       {0x3d400100, 0x11122914},
-       {0x3d400104, 0x0004051c},
-       {0x3d400108, 0x0608050d},
-       {0x3d40010c, 0x0000400c},
-       {0x3d400110, 0x08030409},
-       {0x3d400114, 0x06060403},
-       {0x3d40011c, 0x00000606},
-       {0x3d400120, 0x07070d0c},
-       {0x3d400124, 0x0002040a},
-       {0x3d40012c, 0x1809010e},
-       {0x3d400130, 0x00000008},
-       {0x3d40013c, 0x00000000},
-       {0x3d400180, 0x01000040},
-       {0x3d400184, 0x0000493e},
-       {0x3d400190, 0x038b8207},
-       {0x3d400194, 0x02020303},
-       {0x3d400198, 0x07f04011},
-       {0x3d40019c, 0x000000b0},
-       {0x3d4001a0, 0xe0400018},
-       {0x3d4001a4, 0x0048005a},
-       {0x3d4001a8, 0x80000000},
-       {0x3d4001b0, 0x00000001},
-       {0x3d4001b4, 0x00000b07},
-       {0x3d4001b8, 0x00000004},
-       {0x3d4001c0, 0x00000001},
-       {0x3d4001c4, 0x00000000},
-       {0x3d400240, 0x06000610},
-       {0x3d400244, 0x00001323},
-       {0x3d400200, 0x00003f1f},
-       {0x3d400204, 0x003f0909},
-       {0x3d400208, 0x01010100},
-       {0x3d40020c, 0x01010101},
-       {0x3d400210, 0x00001f1f},
-       {0x3d400214, 0x07070707},
-       {0x3d400218, 0x07070707},
-       {0x3d40021c, 0x00000f07},
-       {0x3d400220, 0x00003f01},
-       {0x3d402050, 0x00210070},
-       {0x3d402064, 0x00180037},
-       {0x3d4020dc, 0x00000105},
-       {0x3d4020e0, 0x00000000},
-       {0x3d4020e8, 0x02000740},
-       {0x3d4020ec, 0x00000050},
-       {0x3d402100, 0x08030604},
-       {0x3d402104, 0x00020205},
-       {0x3d402108, 0x05050309},
-       {0x3d40210c, 0x0000400c},
-       {0x3d402110, 0x02030202},
-       {0x3d402114, 0x03030202},
-       {0x3d402118, 0x0a070008},
-       {0x3d40211c, 0x00000d09},
-       {0x3d402120, 0x08084b09},
-       {0x3d402124, 0x00020308},
-       {0x3d402128, 0x000f0d06},
-       {0x3d40212c, 0x12060111},
-       {0x3d402130, 0x00000008},
-       {0x3d40213c, 0x00000000},
-       {0x3d402180, 0x01000040},
-       {0x3d402190, 0x03848204},
-       {0x3d402194, 0x02020303},
-       {0x3d4021b4, 0x00000404},
-       {0x3d4021b8, 0x00000004},
-       {0x3d402240, 0x07000600},
-       {0x3d403050, 0x00210070},
-       {0x3d403064, 0x0006000d},
-       {0x3d4030dc, 0x00000105},
-       {0x3d4030e0, 0x00000000},
-       {0x3d4030e8, 0x02000740},
-       {0x3d4030ec, 0x00000050},
-       {0x3d403100, 0x07010101},
-       {0x3d403104, 0x00020202},
-       {0x3d403108, 0x05050309},
-       {0x3d40310c, 0x0000400c},
-       {0x3d403110, 0x01030201},
-       {0x3d403114, 0x03030202},
-       {0x3d40311c, 0x00000303},
-       {0x3d403120, 0x02020d02},
-       {0x3d403124, 0x00020208},
-       {0x3d403128, 0x000f0d06},
-       {0x3d40312c, 0x0e02010e},
-       {0x3d403130, 0x00000008},
-       {0x3d40313c, 0x00000000},
-       {0x3d403180, 0x01000040},
-       {0x3d403190, 0x03848204},
-       {0x3d403194, 0x02020303},
-       {0x3d4031b4, 0x00000404},
-       {0x3d4031b8, 0x00000004},
-       {0x3d403240, 0x07000600},
+       /** Initialize DDRC registers **/
+       { 0x3d400000, 0x81040010 },
+       { 0x3d400030, 0x20 },
+       { 0x3d400034, 0x221306 },
+       { 0x3d400050, 0x210070 },
+       { 0x3d400054, 0x10008 },
+       { 0x3d400060, 0x0 },
+       { 0x3d400064, 0x92014a },
+       { 0x3d4000c0, 0x0 },
+       { 0x3d4000c4, 0x1000 },
+       { 0x3d4000d0, 0xc0030126 },
+       { 0x3d4000d4, 0x770000 },
+       { 0x3d4000dc, 0x8340105 },
+       { 0x3d4000e0, 0x180200 },
+       { 0x3d4000e4, 0x110000 },
+       { 0x3d4000e8, 0x2000600 },
+       { 0x3d4000ec, 0x810 },
+       { 0x3d4000f0, 0x20 },
+       { 0x3d4000f4, 0xec7 },
+       { 0x3d400100, 0x11122914 },
+       { 0x3d400104, 0x4051c },
+       { 0x3d400108, 0x608050d },
+       { 0x3d40010c, 0x400c },
+       { 0x3d400110, 0x8030409 },
+       { 0x3d400114, 0x6060403 },
+       { 0x3d40011c, 0x606 },
+       { 0x3d400120, 0x7070d0c },
+       { 0x3d400124, 0x2040a },
+       { 0x3d40012c, 0x1809010e },
+       { 0x3d400130, 0x8 },
+       { 0x3d40013c, 0x0 },
+       { 0x3d400180, 0x1000040 },
+       { 0x3d400184, 0x493e },
+       { 0x3d400190, 0x38b8207 },
+       { 0x3d400194, 0x2020303 },
+       { 0x3d400198, 0x7f04011 },
+       { 0x3d40019c, 0xb0 },
+       { 0x3d4001a0, 0xe0400018 },
+       { 0x3d4001a4, 0x48005a },
+       { 0x3d4001a8, 0x80000000 },
+       { 0x3d4001b0, 0x1 },
+       { 0x3d4001b4, 0xb07 },
+       { 0x3d4001b8, 0x4 },
+       { 0x3d4001c0, 0x1 },
+       { 0x3d4001c4, 0x0 },
+       { 0x3d400200, 0x3f1f },
+       { 0x3d400204, 0x3f0909 },
+       { 0x3d400208, 0x700 },
+       { 0x3d40020c, 0x0 },
+       { 0x3d400210, 0x1f1f },
+       { 0x3d400214, 0x7070707 },
+       { 0x3d400218, 0x7070707 },
+       { 0x3d40021c, 0xf07 },
+       { 0x3d400220, 0x3f01 },
+       { 0x3d400240, 0x6000610 },
+       { 0x3d400244, 0x1323 },
+       { 0x3d400400, 0x100 },
 
        /* performance setting */
        { 0x3d400250, 0x00001f05 },
@@ -126,141 +78,136 @@ struct dram_cfg_param ddr_ddrc_cfg[] = {
        { 0x3d400498, 0x03ff0000 },
        { 0x3d40049c, 0x01000e00 },
        { 0x3d4004a0, 0x03ff0000 },
+
+       { 0x3d402050, 0x210070 },
+       { 0x3d402064, 0x400093 },
+       { 0x3d4020dc, 0x105 },
+       { 0x3d4020e0, 0x0 },
+       { 0x3d4020e8, 0x2000600 },
+       { 0x3d4020ec, 0x10 },
+       { 0x3d402100, 0xb081209 },
+       { 0x3d402104, 0x2020d },
+       { 0x3d402108, 0x5050309 },
+       { 0x3d40210c, 0x400c },
+       { 0x3d402110, 0x5030206 },
+       { 0x3d402114, 0x3030202 },
+       { 0x3d40211c, 0x303 },
+       { 0x3d402120, 0x4040d06 },
+       { 0x3d402124, 0x20208 },
+       { 0x3d40212c, 0x1205010e },
+       { 0x3d402130, 0x8 },
+       { 0x3d40213c, 0x0 },
+       { 0x3d402180, 0x1000040 },
+       { 0x3d402190, 0x3848204 },
+       { 0x3d402194, 0x2020303 },
+       { 0x3d4021b4, 0x404 },
+       { 0x3d4021b8, 0x4 },
+       { 0x3d402240, 0x6000600 },
+       { 0x3d4020f4, 0xec7 },
 };
 
 /* PHY Initialize Configuration */
 struct dram_cfg_param ddr_ddrphy_cfg[] = {
-       {0x0001005f, 0x000002fd},
-       {0x0001015f, 0x000002fd},
-       {0x0001105f, 0x000002fd},
-       {0x0001115f, 0x000002fd},
-       {0x0011005f, 0x000002fd},
-       {0x0011015f, 0x000002fd},
-       {0x0011105f, 0x000002fd},
-       {0x0011115f, 0x000002fd},
-       {0x0021005f, 0x000002fd},
-       {0x0021015f, 0x000002fd},
-       {0x0021105f, 0x000002fd},
-       {0x0021115f, 0x000002fd},
-       {0x00000055, 0x00000355},
-       {0x00001055, 0x00000355},
-       {0x00002055, 0x00000355},
-       {0x00003055, 0x00000355},
-       {0x00004055, 0x00000055},
-       {0x00005055, 0x00000055},
-       {0x00006055, 0x00000355},
-       {0x00007055, 0x00000355},
-       {0x00008055, 0x00000355},
-       {0x00009055, 0x00000355},
-       {0x000200c5, 0x0000000a},
-       {0x001200c5, 0x00000007},
-       {0x002200c5, 0x00000007},
-       {0x0002002e, 0x00000002},
-       {0x0012002e, 0x00000002},
-       {0x0022002e, 0x00000002},
-       {0x00020024, 0x00000008},
-       {0x0002003a, 0x00000002},
-       {0x0002007d, 0x00000212},
-       {0x0002007c, 0x00000061},
-       {0x00120024, 0x00000008},
-       {0x0002003a, 0x00000002},
-       {0x0012007d, 0x00000212},
-       {0x0012007c, 0x00000061},
-       {0x00220024, 0x00000008},
-       {0x0002003a, 0x00000002},
-       {0x0022007d, 0x00000212},
-       {0x0022007c, 0x00000061},
-       {0x00020056, 0x00000006},
-       {0x00120056, 0x0000000a},
-       {0x00220056, 0x0000000a},
-       {0x0001004d, 0x0000001a},
-       {0x0001014d, 0x0000001a},
-       {0x0001104d, 0x0000001a},
-       {0x0001114d, 0x0000001a},
-       {0x0011004d, 0x0000001a},
-       {0x0011014d, 0x0000001a},
-       {0x0011104d, 0x0000001a},
-       {0x0011114d, 0x0000001a},
-       {0x0021004d, 0x0000001a},
-       {0x0021014d, 0x0000001a},
-       {0x0021104d, 0x0000001a},
-       {0x0021114d, 0x0000001a},
-       {0x00010049, 0x00000e38},
-       {0x00010149, 0x00000e38},
-       {0x00011049, 0x00000e38},
-       {0x00011149, 0x00000e38},
-       {0x00110049, 0x00000e38},
-       {0x00110149, 0x00000e38},
-       {0x00111049, 0x00000e38},
-       {0x00111149, 0x00000e38},
-       {0x00210049, 0x00000e38},
-       {0x00210149, 0x00000e38},
-       {0x00211049, 0x00000e38},
-       {0x00211149, 0x00000e38},
-       {0x00000043, 0x00000063},
-       {0x00001043, 0x00000063},
-       {0x00002043, 0x00000063},
-       {0x00003043, 0x00000063},
-       {0x00004043, 0x00000063},
-       {0x00005043, 0x00000063},
-       {0x00006043, 0x00000063},
-       {0x00007043, 0x00000063},
-       {0x00008043, 0x00000063},
-       {0x00009043, 0x00000063},
-       {0x00020018, 0x00000001},
-       {0x00020075, 0x00000002},
-       {0x00020050, 0x00000000},
-       {0x00020008, 0x00000258},
-       {0x00120008, 0x00000064},
-       {0x00220008, 0x00000019},
-       {0x00020088, 0x00000009},
-       {0x000200b2, 0x00000268},
-       {0x00010043, 0x000005b1},
-       {0x00010143, 0x000005b1},
-       {0x00011043, 0x000005b1},
-       {0x00011143, 0x000005b1},
-       {0x001200b2, 0x00000268},
-       {0x00110043, 0x000005b1},
-       {0x00110143, 0x000005b1},
-       {0x00111043, 0x000005b1},
-       {0x00111143, 0x000005b1},
-       {0x002200b2, 0x00000268},
-       {0x00210043, 0x000005b1},
-       {0x00210143, 0x000005b1},
-       {0x00211043, 0x000005b1},
-       {0x00211143, 0x000005b1},
-       {0x0002005b, 0x00007529},
-       {0x0002005c, 0x00000000},
-       {0x000200fa, 0x00000001},
-       {0x001200fa, 0x00000001},
-       {0x002200fa, 0x00000001},
-       {0x00020019, 0x00000005},
-       {0x00120019, 0x00000005},
-       {0x00220019, 0x00000005},
-       {0x000200f0, 0x00005665},
-       {0x000200f1, 0x00005555},
-       {0x000200f2, 0x00005555},
-       {0x000200f3, 0x00005555},
-       {0x000200f4, 0x00005555},
-       {0x000200f5, 0x00005555},
-       {0x000200f6, 0x00005555},
-       {0x000200f7, 0x0000f000},
-       {0x0001004a, 0x00000500},
-       {0x0001104a, 0x00000500},
-       {0x00020025, 0x00000000},
-       {0x0002002d, 0x00000000},
-       {0x0012002d, 0x00000000},
-       {0x0022002d, 0x00000000},
-       {0x0002002c, 0x00000000},
-       {0x000200c7, 0x00000021},
-       {0x000200ca, 0x00000024},
-       {0x000200cc, 0x000001f7},
-       {0x001200c7, 0x00000021},
-       {0x001200ca, 0x00000024},
-       {0x001200cc, 0x000001f7},
-       {0x002200c7, 0x00000021},
-       {0x002200ca, 0x00000024},
-       {0x002200cc, 0x000001f7},
+       { 0x1005f, 0x2fd },
+       { 0x1015f, 0x2fd },
+       { 0x1105f, 0x2fd },
+       { 0x1115f, 0x2fd },
+       { 0x11005f, 0x2fd },
+       { 0x11015f, 0x2fd },
+       { 0x11105f, 0x2fd },
+       { 0x11115f, 0x2fd },
+       { 0x55, 0x355 },
+       { 0x1055, 0x355 },
+       { 0x2055, 0x355 },
+       { 0x3055, 0x355 },
+       { 0x4055, 0x55 },
+       { 0x5055, 0x55 },
+       { 0x6055, 0x355 },
+       { 0x7055, 0x355 },
+       { 0x8055, 0x355 },
+       { 0x9055, 0x355 },
+       { 0x200c5, 0xa },
+       { 0x1200c5, 0x6 },
+       { 0x2002e, 0x2 },
+       { 0x12002e, 0x1 },
+       { 0x20024, 0x8 },
+       { 0x2003a, 0x2 },
+       { 0x120024, 0x8 },
+       { 0x2003a, 0x2 },
+       { 0x20056, 0x6 },
+       { 0x120056, 0xa },
+       { 0x1004d, 0x1a },
+       { 0x1014d, 0x1a },
+       { 0x1104d, 0x1a },
+       { 0x1114d, 0x1a },
+       { 0x11004d, 0x1a },
+       { 0x11014d, 0x1a },
+       { 0x11104d, 0x1a },
+       { 0x11114d, 0x1a },
+       { 0x10049, 0xe38 },
+       { 0x10149, 0xe38 },
+       { 0x11049, 0xe38 },
+       { 0x11149, 0xe38 },
+       { 0x110049, 0xe38 },
+       { 0x110149, 0xe38 },
+       { 0x111049, 0xe38 },
+       { 0x111149, 0xe38 },
+       { 0x43, 0x63 },
+       { 0x1043, 0x63 },
+       { 0x2043, 0x63 },
+       { 0x3043, 0x63 },
+       { 0x4043, 0x63 },
+       { 0x5043, 0x63 },
+       { 0x6043, 0x63 },
+       { 0x7043, 0x63 },
+       { 0x8043, 0x63 },
+       { 0x9043, 0x63 },
+       { 0x20018, 0x1 },
+       { 0x20075, 0x2 },
+       { 0x20050, 0x0 },
+       { 0x20008, 0x258 },
+       { 0x120008, 0x10a },
+       { 0x20088, 0x9 },
+       { 0x200b2, 0x268 },
+       { 0x10043, 0x5b1 },
+       { 0x10143, 0x5b1 },
+       { 0x11043, 0x5b1 },
+       { 0x11143, 0x5b1 },
+       { 0x1200b2, 0x268 },
+       { 0x110043, 0x5b1 },
+       { 0x110143, 0x5b1 },
+       { 0x111043, 0x5b1 },
+       { 0x111143, 0x5b1 },
+       { 0x200fa, 0x1 },
+       { 0x1200fa, 0x1 },
+       { 0x20019, 0x5 },
+       { 0x120019, 0x5 },
+       { 0x200f0, 0x5555 },
+       { 0x200f1, 0x5555 },
+       { 0x200f2, 0x5555 },
+       { 0x200f3, 0x5555 },
+       { 0x200f4, 0x5555 },
+       { 0x200f5, 0x5555 },
+       { 0x200f6, 0x5555 },
+       { 0x200f7, 0xf000 },
+       { 0x20025, 0x0 },
+       { 0x2002d, 0x0 },
+       { 0x12002d, 0x0 },
+       { 0x2005b, 0x7529 },
+       { 0x2005c, 0x0 },
+       { 0x200c7, 0x21 },
+       { 0x200ca, 0x24 },
+       { 0x200cc, 0x1f7 },
+       { 0x1200c7, 0x21 },
+       { 0x1200ca, 0x24 },
+       { 0x1200cc, 0x1f7 },
+       { 0x2007d, 0x212 },
+       { 0x12007d, 0x212 },
+       { 0x2007c, 0x61 },
+       { 0x12007c, 0x61 },
+       { 0x1004a, 0x500 },
+       { 0x1104a, 0x500 },
+       { 0x2002c, 0x0 },
 };
 
 /* ddr phy trained csr */
@@ -792,378 +739,279 @@ struct dram_cfg_param ddr_ddrphy_trained_csr[] = {
 
 /* P0 message block paremeter for training firmware */
 struct dram_cfg_param ddr_fsp0_cfg[] = {
-       {0x000d0000, 0x00000000},
-       {0x00020060, 0x00000002},
-       {0x00054000, 0x00000000},
-       {0x00054001, 0x00000000},
-       {0x00054002, 0x00000000},
-       {0x00054003, 0x00000960},
-       {0x00054004, 0x00000002},
-       {0x00054005, 0x00000000},
-       {0x00054006, 0x0000025e},
-       {0x00054007, 0x00001000},
-       {0x00054008, 0x00000101},
-       {0x00054009, 0x00000000},
-       {0x0005400a, 0x00000000},
-       {0x0005400b, 0x0000031f},
-       {0x0005400c, 0x000000c8},
-       {0x0005400d, 0x00000100},
-       {0x0005400e, 0x00000000},
-       {0x0005400f, 0x00000000},
-       {0x00054010, 0x00000000},
-       {0x00054011, 0x00000000},
-       {0x00054012, 0x00000001},
-       {0x0005402f, 0x00000834},
-       {0x00054030, 0x00000105},
-       {0x00054031, 0x00000018},
-       {0x00054032, 0x00000200},
-       {0x00054033, 0x00000200},
-       {0x00054034, 0x00000740},
-       {0x00054035, 0x00000850},
-       {0x00054036, 0x00000103},
-       {0x00054037, 0x00000000},
-       {0x00054038, 0x00000000},
-       {0x00054039, 0x00000000},
-       {0x0005403a, 0x00000000},
-       {0x0005403b, 0x00000000},
-       {0x0005403c, 0x00000000},
-       {0x0005403d, 0x00000000},
-       {0x0005403e, 0x00000000},
-       {0x0005403f, 0x00001221},
-       {0x000541fc, 0x00000100},
-       {0x000d0000, 0x00000001},
+       { 0xd0000, 0x0 },
+       { 0x54003, 0x960 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2830 },
+       { 0x54006, 0x25e },
+       { 0x54007, 0x1000 },
+       { 0x54008, 0x101 },
+       { 0x5400b, 0x31f },
+       { 0x5400c, 0xc8 },
+       { 0x5400d, 0x100 },
+       { 0x54012, 0x1 },
+       { 0x5402f, 0x834 },
+       { 0x54030, 0x105 },
+       { 0x54031, 0x18 },
+       { 0x54032, 0x200 },
+       { 0x54033, 0x200 },
+       { 0x54034, 0x600 },
+       { 0x54035, 0x810 },
+       { 0x54036, 0x101 },
+       { 0x5403f, 0x1221 },
+       { 0x541fc, 0x100 },
+       { 0xd0000, 0x1 },
 };
 
 /* P1 message block paremeter for training firmware */
 struct dram_cfg_param ddr_fsp1_cfg[] = {
-       {0x000d0000, 0x00000000},
-       {0x00054000, 0x00000000},
-       {0x00054001, 0x00000000},
-       {0x00054002, 0x00000101},
-       {0x00054003, 0x00000190},
-       {0x00054004, 0x00000002},
-       {0x00054005, 0x00000000},
-       {0x00054006, 0x0000025e},
-       {0x00054007, 0x00001000},
-       {0x00054008, 0x00000101},
-       {0x00054009, 0x00000000},
-       {0x0005400a, 0x00000000},
-       {0x0005400b, 0x0000021f},
-       {0x0005400c, 0x000000c8},
-       {0x0005400d, 0x00000100},
-       {0x0005400e, 0x00000000},
-       {0x0005400f, 0x00000000},
-       {0x00054010, 0x00000000},
-       {0x00054011, 0x00000000},
-       {0x00054012, 0x00000001},
-       {0x0005402f, 0x00000000},
-       {0x00054030, 0x00000105},
-       {0x00054031, 0x00000000},
-       {0x00054032, 0x00000000},
-       {0x00054033, 0x00000200},
-       {0x00054034, 0x00000740},
-       {0x00054035, 0x00000050},
-       {0x00054036, 0x00000103},
-       {0x00054037, 0x00000000},
-       {0x00054038, 0x00000000},
-       {0x00054039, 0x00000000},
-       {0x0005403a, 0x00000000},
-       {0x0005403b, 0x00000000},
-       {0x0005403c, 0x00000000},
-       {0x0005403d, 0x00000000},
-       {0x0005403e, 0x00000000},
-       {0x0005403f, 0x00001221},
-       {0x000541fc, 0x00000100},
-       {0x000d0000, 0x00000001},
+       { 0xd0000, 0x0 },
+       { 0x54002, 0x1 },
+       { 0x54003, 0x42a },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2830 },
+       { 0x54006, 0x25e },
+       { 0x54007, 0x1000 },
+       { 0x54008, 0x101 },
+       { 0x5400b, 0x21f },
+       { 0x5400c, 0xc8 },
+       { 0x5400d, 0x100 },
+       { 0x54012, 0x1 },
+       { 0x54030, 0x105 },
+       { 0x54033, 0x200 },
+       { 0x54034, 0x600 },
+       { 0x54035, 0x10 },
+       { 0x54036, 0x101 },
+       { 0x5403f, 0x1221 },
+       { 0x541fc, 0x100 },
+       { 0xd0000, 0x1 },
 };
 
-/* P2 message block paremeter for training firmware */
-struct dram_cfg_param ddr_fsp2_cfg[] = {
-       {0x000d0000, 0x00000000},
-       {0x00054000, 0x00000000},
-       {0x00054001, 0x00000000},
-       {0x00054002, 0x00000102},
-       {0x00054003, 0x00000064},
-       {0x00054004, 0x00000002},
-       {0x00054005, 0x00000000},
-       {0x00054006, 0x0000025e},
-       {0x00054007, 0x00001000},
-       {0x00054008, 0x00000101},
-       {0x00054009, 0x00000000},
-       {0x0005400a, 0x00000000},
-       {0x0005400b, 0x0000021f},
-       {0x0005400c, 0x000000c8},
-       {0x0005400d, 0x00000100},
-       {0x0005400e, 0x00000000},
-       {0x0005400f, 0x00000000},
-       {0x00054010, 0x00000000},
-       {0x00054011, 0x00000000},
-       {0x00054012, 0x00000001},
-       {0x0005402f, 0x00000000},
-       {0x00054030, 0x00000105},
-       {0x00054031, 0x00000000},
-       {0x00054032, 0x00000000},
-       {0x00054033, 0x00000200},
-       {0x00054034, 0x00000740},
-       {0x00054035, 0x00000050},
-       {0x00054036, 0x00000103},
-       {0x00054037, 0x00000000},
-       {0x00054038, 0x00000000},
-       {0x00054039, 0x00000000},
-       {0x0005403a, 0x00000000},
-       {0x0005403b, 0x00000000},
-       {0x0005403c, 0x00000000},
-       {0x0005403d, 0x00000000},
-       {0x0005403e, 0x00000000},
-       {0x0005403f, 0x00001221},
-       {0x000541fc, 0x00000100},
-       {0x000d0000, 0x00000001},
-};
 
 /* P0 2D message block paremeter for training firmware */
 struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
-       {0x000d0000, 0x00000000},
-       {0x00054000, 0x00000000},
-       {0x00054001, 0x00000000},
-       {0x00054002, 0x00000000},
-       {0x00054003, 0x00000960},
-       {0x00054004, 0x00000002},
-       {0x00054005, 0x00000000},
-       {0x00054006, 0x0000025e},
-       {0x00054007, 0x00001000},
-       {0x00054008, 0x00000101},
-       {0x00054009, 0x00000000},
-       {0x0005400a, 0x00000000},
-       {0x0005400b, 0x00000061},
-       {0x0005400c, 0x000000c8},
-       {0x0005400d, 0x00000100},
-       {0x0005400e, 0x00001f7f},
-       {0x0005400f, 0x00000000},
-       {0x00054010, 0x00000000},
-       {0x00054011, 0x00000000},
-       {0x00054012, 0x00000001},
-       {0x0005402f, 0x00000834},
-       {0x00054030, 0x00000105},
-       {0x00054031, 0x00000018},
-       {0x00054032, 0x00000200},
-       {0x00054033, 0x00000200},
-       {0x00054034, 0x00000740},
-       {0x00054035, 0x00000850},
-       {0x00054036, 0x00000103},
-       {0x00054037, 0x00000000},
-       {0x00054038, 0x00000000},
-       {0x00054039, 0x00000000},
-       {0x0005403a, 0x00000000},
-       {0x0005403b, 0x00000000},
-       {0x0005403c, 0x00000000},
-       {0x0005403d, 0x00000000},
-       {0x0005403e, 0x00000000},
-       {0x0005403f, 0x00001221},
-       {0x000541fc, 0x00000100},
-       {0x000d0000, 0x00000001},
+       { 0xd0000, 0x0 },
+       { 0x54003, 0x960 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2830 },
+       { 0x54006, 0x25e },
+       { 0x54007, 0x1000 },
+       { 0x54008, 0x101 },
+       { 0x5400b, 0x61 },
+       { 0x5400c, 0xc8 },
+       { 0x5400d, 0x100 },
+       { 0x5400e, 0x1f7f },
+       { 0x54012, 0x1 },
+       { 0x5402f, 0x834 },
+       { 0x54030, 0x105 },
+       { 0x54031, 0x18 },
+       { 0x54032, 0x200 },
+       { 0x54033, 0x200 },
+       { 0x54034, 0x600 },
+       { 0x54035, 0x810 },
+       { 0x54036, 0x101 },
+       { 0x5403f, 0x1221 },
+       { 0x541fc, 0x100 },
+       { 0xd0000, 0x1 },
 };
 
 /* DRAM PHY init engine image */
 struct dram_cfg_param ddr_phy_pie[] = {
-       {0xd0000, 0x0},
-       {0x90000, 0x10},
-       {0x90001, 0x400},
-       {0x90002, 0x10e},
-       {0x90003, 0x0},
-       {0x90004, 0x0},
-       {0x90005, 0x8},
-       {0x90029, 0xb},
-       {0x9002a, 0x480},
-       {0x9002b, 0x109},
-       {0x9002c, 0x8},
-       {0x9002d, 0x448},
-       {0x9002e, 0x139},
-       {0x9002f, 0x8},
-       {0x90030, 0x478},
-       {0x90031, 0x109},
-       {0x90032, 0x2},
-       {0x90033, 0x10},
-       {0x90034, 0x139},
-       {0x90035, 0xb},
-       {0x90036, 0x7c0},
-       {0x90037, 0x139},
-       {0x90038, 0x44},
-       {0x90039, 0x633},
-       {0x9003a, 0x159},
-       {0x9003b, 0x14f},
-       {0x9003c, 0x630},
-       {0x9003d, 0x159},
-       {0x9003e, 0x47},
-       {0x9003f, 0x633},
-       {0x90040, 0x149},
-       {0x90041, 0x4f},
-       {0x90042, 0x633},
-       {0x90043, 0x179},
-       {0x90044, 0x8},
-       {0x90045, 0xe0},
-       {0x90046, 0x109},
-       {0x90047, 0x0},
-       {0x90048, 0x7c8},
-       {0x90049, 0x109},
-       {0x9004a, 0x0},
-       {0x9004b, 0x1},
-       {0x9004c, 0x8},
-       {0x9004d, 0x0},
-       {0x9004e, 0x45a},
-       {0x9004f, 0x9},
-       {0x90050, 0x0},
-       {0x90051, 0x448},
-       {0x90052, 0x109},
-       {0x90053, 0x40},
-       {0x90054, 0x633},
-       {0x90055, 0x179},
-       {0x90056, 0x1},
-       {0x90057, 0x618},
-       {0x90058, 0x109},
-       {0x90059, 0x40c0},
-       {0x9005a, 0x633},
-       {0x9005b, 0x149},
-       {0x9005c, 0x8},
-       {0x9005d, 0x4},
-       {0x9005e, 0x48},
-       {0x9005f, 0x4040},
-       {0x90060, 0x633},
-       {0x90061, 0x149},
-       {0x90062, 0x0},
-       {0x90063, 0x4},
-       {0x90064, 0x48},
-       {0x90065, 0x40},
-       {0x90066, 0x633},
-       {0x90067, 0x149},
-       {0x90068, 0x10},
-       {0x90069, 0x4},
-       {0x9006a, 0x18},
-       {0x9006b, 0x0},
-       {0x9006c, 0x4},
-       {0x9006d, 0x78},
-       {0x9006e, 0x549},
-       {0x9006f, 0x633},
-       {0x90070, 0x159},
-       {0x90071, 0xd49},
-       {0x90072, 0x633},
-       {0x90073, 0x159},
-       {0x90074, 0x94a},
-       {0x90075, 0x633},
-       {0x90076, 0x159},
-       {0x90077, 0x441},
-       {0x90078, 0x633},
-       {0x90079, 0x149},
-       {0x9007a, 0x42},
-       {0x9007b, 0x633},
-       {0x9007c, 0x149},
-       {0x9007d, 0x1},
-       {0x9007e, 0x633},
-       {0x9007f, 0x149},
-       {0x90080, 0x0},
-       {0x90081, 0xe0},
-       {0x90082, 0x109},
-       {0x90083, 0xa},
-       {0x90084, 0x10},
-       {0x90085, 0x109},
-       {0x90086, 0x9},
-       {0x90087, 0x3c0},
-       {0x90088, 0x149},
-       {0x90089, 0x9},
-       {0x9008a, 0x3c0},
-       {0x9008b, 0x159},
-       {0x9008c, 0x18},
-       {0x9008d, 0x10},
-       {0x9008e, 0x109},
-       {0x9008f, 0x0},
-       {0x90090, 0x3c0},
-       {0x90091, 0x109},
-       {0x90092, 0x18},
-       {0x90093, 0x4},
-       {0x90094, 0x48},
-       {0x90095, 0x18},
-       {0x90096, 0x4},
-       {0x90097, 0x58},
-       {0x90098, 0xb},
-       {0x90099, 0x10},
-       {0x9009a, 0x109},
-       {0x9009b, 0x1},
-       {0x9009c, 0x10},
-       {0x9009d, 0x109},
-       {0x9009e, 0x5},
-       {0x9009f, 0x7c0},
-       {0x900a0, 0x109},
-       {0x900a1, 0x0},
-       {0x900a2, 0x8140},
-       {0x900a3, 0x10c},
-       {0x900a4, 0x10},
-       {0x900a5, 0x8138},
-       {0x900a6, 0x10c},
-       {0x900a7, 0x8},
-       {0x900a8, 0x7c8},
-       {0x900a9, 0x101},
-       {0x900aa, 0x8},
-       {0x900ab, 0x448},
-       {0x900ac, 0x109},
-       {0x900ad, 0xf},
-       {0x900ae, 0x7c0},
-       {0x900af, 0x109},
-       {0x900b0, 0x47},
-       {0x900b1, 0x630},
-       {0x900b2, 0x109},
-       {0x900b3, 0x8},
-       {0x900b4, 0x618},
-       {0x900b5, 0x109},
-       {0x900b6, 0x8},
-       {0x900b7, 0xe0},
-       {0x900b8, 0x109},
-       {0x900b9, 0x0},
-       {0x900ba, 0x7c8},
-       {0x900bb, 0x109},
-       {0x900bc, 0x8},
-       {0x900bd, 0x8140},
-       {0x900be, 0x10c},
-       {0x900bf, 0x0},
-       {0x900c0, 0x1},
-       {0x900c1, 0x8},
-       {0x900c2, 0x8},
-       {0x900c3, 0x4},
-       {0x900c4, 0x8},
-       {0x900c5, 0x8},
-       {0x900c6, 0x7c8},
-       {0x900c7, 0x101},
-       {0x90006, 0x0},
-       {0x90007, 0x0},
-       {0x90008, 0x8},
-       {0x90009, 0x0},
-       {0x9000a, 0x0},
-       {0x9000b, 0x0},
-       {0xd00e7, 0x400},
-       {0x90017, 0x0},
-       {0x90026, 0x2b},
-       {0x2000b, 0x4b},
-       {0x2000c, 0x96},
-       {0x2000d, 0x5dc},
-       {0x2000e, 0x2c},
-       {0x12000b, 0xc},
-       {0x12000c, 0x16},
-       {0x12000d, 0xfa},
-       {0x12000e, 0x10},
-       {0x22000b, 0x3},
-       {0x22000c, 0x3},
-       {0x22000d, 0x3e},
-       {0x22000e, 0x10},
-       {0x9000c, 0x0},
-       {0x9000d, 0x173},
-       {0x9000e, 0x60},
-       {0x9000f, 0x6110},
-       {0x90010, 0x2152},
-       {0x90011, 0xdfbd},
-       {0x90012, 0xffff},
-       {0x90013, 0x6152},
-       {0x20089, 0x1},
-       {0x20088, 0x19},
-       {0xc0080, 0x0},
-       {0xd0000, 0x1},
+       { 0xd0000, 0x0 },
+       { 0x90000, 0x10 },
+       { 0x90001, 0x400 },
+       { 0x90002, 0x10e },
+       { 0x90003, 0x0 },
+       { 0x90004, 0x0 },
+       { 0x90005, 0x8 },
+       { 0x90029, 0xb },
+       { 0x9002a, 0x480 },
+       { 0x9002b, 0x109 },
+       { 0x9002c, 0x8 },
+       { 0x9002d, 0x448 },
+       { 0x9002e, 0x139 },
+       { 0x9002f, 0x8 },
+       { 0x90030, 0x478 },
+       { 0x90031, 0x109 },
+       { 0x90032, 0x2 },
+       { 0x90033, 0x10 },
+       { 0x90034, 0x139 },
+       { 0x90035, 0xb },
+       { 0x90036, 0x7c0 },
+       { 0x90037, 0x139 },
+       { 0x90038, 0x44 },
+       { 0x90039, 0x633 },
+       { 0x9003a, 0x159 },
+       { 0x9003b, 0x14f },
+       { 0x9003c, 0x630 },
+       { 0x9003d, 0x159 },
+       { 0x9003e, 0x47 },
+       { 0x9003f, 0x633 },
+       { 0x90040, 0x149 },
+       { 0x90041, 0x4f },
+       { 0x90042, 0x633 },
+       { 0x90043, 0x179 },
+       { 0x90044, 0x8 },
+       { 0x90045, 0xe0 },
+       { 0x90046, 0x109 },
+       { 0x90047, 0x0 },
+       { 0x90048, 0x7c8 },
+       { 0x90049, 0x109 },
+       { 0x9004a, 0x0 },
+       { 0x9004b, 0x1 },
+       { 0x9004c, 0x8 },
+       { 0x9004d, 0x0 },
+       { 0x9004e, 0x45a },
+       { 0x9004f, 0x9 },
+       { 0x90050, 0x0 },
+       { 0x90051, 0x448 },
+       { 0x90052, 0x109 },
+       { 0x90053, 0x40 },
+       { 0x90054, 0x633 },
+       { 0x90055, 0x179 },
+       { 0x90056, 0x1 },
+       { 0x90057, 0x618 },
+       { 0x90058, 0x109 },
+       { 0x90059, 0x40c0 },
+       { 0x9005a, 0x633 },
+       { 0x9005b, 0x149 },
+       { 0x9005c, 0x8 },
+       { 0x9005d, 0x4 },
+       { 0x9005e, 0x48 },
+       { 0x9005f, 0x4040 },
+       { 0x90060, 0x633 },
+       { 0x90061, 0x149 },
+       { 0x90062, 0x0 },
+       { 0x90063, 0x4 },
+       { 0x90064, 0x48 },
+       { 0x90065, 0x40 },
+       { 0x90066, 0x633 },
+       { 0x90067, 0x149 },
+       { 0x90068, 0x10 },
+       { 0x90069, 0x4 },
+       { 0x9006a, 0x18 },
+       { 0x9006b, 0x0 },
+       { 0x9006c, 0x4 },
+       { 0x9006d, 0x78 },
+       { 0x9006e, 0x549 },
+       { 0x9006f, 0x633 },
+       { 0x90070, 0x159 },
+       { 0x90071, 0xd49 },
+       { 0x90072, 0x633 },
+       { 0x90073, 0x159 },
+       { 0x90074, 0x94a },
+       { 0x90075, 0x633 },
+       { 0x90076, 0x159 },
+       { 0x90077, 0x441 },
+       { 0x90078, 0x633 },
+       { 0x90079, 0x149 },
+       { 0x9007a, 0x42 },
+       { 0x9007b, 0x633 },
+       { 0x9007c, 0x149 },
+       { 0x9007d, 0x1 },
+       { 0x9007e, 0x633 },
+       { 0x9007f, 0x149 },
+       { 0x90080, 0x0 },
+       { 0x90081, 0xe0 },
+       { 0x90082, 0x109 },
+       { 0x90083, 0xa },
+       { 0x90084, 0x10 },
+       { 0x90085, 0x109 },
+       { 0x90086, 0x9 },
+       { 0x90087, 0x3c0 },
+       { 0x90088, 0x149 },
+       { 0x90089, 0x9 },
+       { 0x9008a, 0x3c0 },
+       { 0x9008b, 0x159 },
+       { 0x9008c, 0x18 },
+       { 0x9008d, 0x10 },
+       { 0x9008e, 0x109 },
+       { 0x9008f, 0x0 },
+       { 0x90090, 0x3c0 },
+       { 0x90091, 0x109 },
+       { 0x90092, 0x18 },
+       { 0x90093, 0x4 },
+       { 0x90094, 0x48 },
+       { 0x90095, 0x18 },
+       { 0x90096, 0x4 },
+       { 0x90097, 0x58 },
+       { 0x90098, 0xb },
+       { 0x90099, 0x10 },
+       { 0x9009a, 0x109 },
+       { 0x9009b, 0x1 },
+       { 0x9009c, 0x10 },
+       { 0x9009d, 0x109 },
+       { 0x9009e, 0x5 },
+       { 0x9009f, 0x7c0 },
+       { 0x900a0, 0x109 },
+       { 0x900a1, 0x0 },
+       { 0x900a2, 0x8140 },
+       { 0x900a3, 0x10c },
+       { 0x900a4, 0x10 },
+       { 0x900a5, 0x8138 },
+       { 0x900a6, 0x10c },
+       { 0x900a7, 0x8 },
+       { 0x900a8, 0x7c8 },
+       { 0x900a9, 0x101 },
+       { 0x900aa, 0x8 },
+       { 0x900ab, 0x448 },
+       { 0x900ac, 0x109 },
+       { 0x900ad, 0xf },
+       { 0x900ae, 0x7c0 },
+       { 0x900af, 0x109 },
+       { 0x900b0, 0x47 },
+       { 0x900b1, 0x630 },
+       { 0x900b2, 0x109 },
+       { 0x900b3, 0x8 },
+       { 0x900b4, 0x618 },
+       { 0x900b5, 0x109 },
+       { 0x900b6, 0x8 },
+       { 0x900b7, 0xe0 },
+       { 0x900b8, 0x109 },
+       { 0x900b9, 0x0 },
+       { 0x900ba, 0x7c8 },
+       { 0x900bb, 0x109 },
+       { 0x900bc, 0x8 },
+       { 0x900bd, 0x8140 },
+       { 0x900be, 0x10c },
+       { 0x900bf, 0x0 },
+       { 0x900c0, 0x1 },
+       { 0x900c1, 0x8 },
+       { 0x900c2, 0x8 },
+       { 0x900c3, 0x4 },
+       { 0x900c4, 0x8 },
+       { 0x900c5, 0x8 },
+       { 0x900c6, 0x7c8 },
+       { 0x900c7, 0x101 },
+       { 0x90006, 0x0 },
+       { 0x90007, 0x0 },
+       { 0x90008, 0x8 },
+       { 0x90009, 0x0 },
+       { 0x9000a, 0x0 },
+       { 0x9000b, 0x0 },
+       { 0xd00e7, 0x400 },
+       { 0x90017, 0x0 },
+       { 0x90026, 0x2b },
+       { 0x2000b, 0x4b },
+       { 0x2000c, 0x96 },
+       { 0x2000d, 0x5dc },
+       { 0x2000e, 0x2c },
+       { 0x12000b, 0x21 },
+       { 0x12000c, 0x42 },
+       { 0x12000d, 0x29a },
+       { 0x12000e, 0x21 },
+       { 0x9000c, 0x0 },
+       { 0x9000d, 0x173 },
+       { 0x9000e, 0x60 },
+       { 0x9000f, 0x6110 },
+       { 0x90010, 0x2152 },
+       { 0x90011, 0xdfbd },
+       { 0x90012, 0xffff },
+       { 0x90013, 0x6152 },
+       { 0x20089, 0x1 },
+       { 0x20088, 0x19 },
+       { 0xc0080, 0x0 },
+       { 0xd0000, 0x1 }
 };
 
 struct dram_fsp_msg ddr_dram_fsp_msg[] = {
@@ -1175,19 +1023,12 @@ struct dram_fsp_msg ddr_dram_fsp_msg[] = {
                .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg),
        },
        {
-               /* P1 400mts 1D */
-               .drate = 400,
+               /* P1 1066mts 1D */
+               .drate = 1066,
                .fw_type = FW_1D_IMAGE,
                .fsp_cfg = ddr_fsp1_cfg,
                .fsp_cfg_num = ARRAY_SIZE(ddr_fsp1_cfg),
        },
-       {
-               /* P2 100mts 1D */
-               .drate = 100,
-               .fw_type = FW_1D_IMAGE,
-               .fsp_cfg = ddr_fsp2_cfg,
-               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp2_cfg),
-       },
        {
                /* P0 2400mts 2D */
                .drate = 2400,
@@ -1209,6 +1050,6 @@ struct dram_timing_info dram_timing = {
        .ddrphy_trained_csr_num = ARRAY_SIZE(ddr_ddrphy_trained_csr),
        .ddrphy_pie = ddr_phy_pie,
        .ddrphy_pie_num = ARRAY_SIZE(ddr_phy_pie),
-       .fsp_table = { 2400, 400, 100,},
+       .fsp_table = { 2400, 1066, },
 };
 
diff --git a/board/freescale/imx8mn_evk/ddr4_timing_ld.c b/board/freescale/imx8mn_evk/ddr4_timing_ld.c
new file mode 100644 (file)
index 0000000..983fc7d
--- /dev/null
@@ -0,0 +1,1057 @@
+/*
+ * Copyright 2019 NXP
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ *
+ * Generated code from MX8M_DDR_tool
+ * Align with uboot version:
+ * imx_v2018.03_4.14.78_1.0.0_ga ~ imx_v2018.04_4.19.35_1.1.0_ga
+ */
+
+#include <linux/kernel.h>
+#include <asm/arch/ddr.h>
+
+struct dram_cfg_param ddr_ddrc_cfg[] = {
+       /** Initialize DDRC registers **/
+       { 0x3d400000, 0x81040010 },
+       { 0x3d400030, 0x20 },
+       { 0x3d400034, 0x221306 },
+       { 0x3d400050, 0x210070 },
+       { 0x3d400054, 0x10008 },
+       { 0x3d400060, 0x0 },
+       { 0x3d400064, 0x6100dc },
+       { 0x3d4000c0, 0x0 },
+       { 0x3d4000c4, 0x1000 },
+       { 0x3d4000d0, 0xc00200c5 },
+       { 0x3d4000d4, 0x500000 },
+       { 0x3d4000dc, 0x2340105 },
+       { 0x3d4000e0, 0x0 },
+       { 0x3d4000e4, 0x110000 },
+       { 0x3d4000e8, 0x2000600 },
+       { 0x3d4000ec, 0x410 },
+       { 0x3d4000f0, 0x20 },
+       { 0x3d4000f4, 0xec7 },
+       { 0x3d400100, 0xd0c1b0d },
+       { 0x3d400104, 0x30313 },
+       { 0x3d400108, 0x508060a },
+       { 0x3d40010c, 0x400c },
+       { 0x3d400110, 0x6030306 },
+       { 0x3d400114, 0x4040302 },
+       { 0x3d40011c, 0x404 },
+       { 0x3d400120, 0x5050d08 },
+       { 0x3d400124, 0x20308 },
+       { 0x3d40012c, 0x1406010e },
+       { 0x3d400130, 0x8 },
+       { 0x3d40013c, 0x0 },
+       { 0x3d400180, 0x1000040 },
+       { 0x3d400184, 0x30d4 },
+       { 0x3d400190, 0x38b8204 },
+       { 0x3d400194, 0x2020303 },
+       { 0x3d400198, 0x7f04011 },
+       { 0x3d40019c, 0xb0 },
+       { 0x3d4001a0, 0xe0400018 },
+       { 0x3d4001a4, 0x48005a },
+       { 0x3d4001a8, 0x80000000 },
+       { 0x3d4001b0, 0x1 },
+       { 0x3d4001b4, 0xb04 },
+       { 0x3d4001b8, 0x4 },
+       { 0x3d4001c0, 0x1 },
+       { 0x3d4001c4, 0x0 },
+       { 0x3d400200, 0x3f1f },
+       { 0x3d400204, 0x3f0909 },
+       { 0x3d400208, 0x700 },
+       { 0x3d40020c, 0x0 },
+       { 0x3d400210, 0x1f1f },
+       { 0x3d400214, 0x7070707 },
+       { 0x3d400218, 0x7070707 },
+       { 0x3d40021c, 0xf07 },
+       { 0x3d400220, 0x3f01 },
+       { 0x3d400240, 0x600061c },
+       { 0x3d400244, 0x1323 },
+       { 0x3d400400, 0x100 },
+       { 0x3d400250, 0x317d1a07 },
+       { 0x3d400254, 0xf },
+       { 0x3d40025c, 0x2a001b76 },
+       { 0x3d400264, 0x7300b473 },
+       { 0x3d40026c, 0x30000e06 },
+       { 0x3d400300, 0x14 },
+       { 0x3d40036c, 0x10 },
+       { 0x3d400404, 0x13193 },
+       { 0x3d400408, 0x6096 },
+       { 0x3d400490, 0x1 },
+       { 0x3d400494, 0x2000c00 },
+       { 0x3d400498, 0x3c00db },
+       { 0x3d40049c, 0x100009 },
+       { 0x3d4004a0, 0x2 },
+       { 0x3d402050, 0x210070 },
+       { 0x3d402064, 0x400093 },
+       { 0x3d4020dc, 0x40105 },
+       { 0x3d4020e0, 0x0 },
+       { 0x3d4020e8, 0x2000600 },
+       { 0x3d4020ec, 0x10 },
+       { 0x3d402100, 0xb081209 },
+       { 0x3d402104, 0x2020d },
+       { 0x3d402108, 0x5050309 },
+       { 0x3d40210c, 0x400c },
+       { 0x3d402110, 0x5030206 },
+       { 0x3d402114, 0x3030202 },
+       { 0x3d40211c, 0x303 },
+       { 0x3d402120, 0x4040d06 },
+       { 0x3d402124, 0x20208 },
+       { 0x3d40212c, 0x1205010e },
+       { 0x3d402130, 0x8 },
+       { 0x3d40213c, 0x0 },
+       { 0x3d402180, 0x1000040 },
+       { 0x3d402190, 0x3858204 },
+       { 0x3d402194, 0x2020303 },
+       { 0x3d4021b4, 0x504 },
+       { 0x3d4021b8, 0x4 },
+       { 0x3d402240, 0x6000604 },
+       { 0x3d4020f4, 0xec7 },
+};
+
+/* PHY Initialize Configuration */
+struct dram_cfg_param ddr_ddrphy_cfg[] = {
+       { 0x1005f, 0x2fd },
+       { 0x1015f, 0x2fd },
+       { 0x1105f, 0x2fd },
+       { 0x1115f, 0x2fd },
+       { 0x11005f, 0x2fd },
+       { 0x11015f, 0x2fd },
+       { 0x11105f, 0x2fd },
+       { 0x11115f, 0x2fd },
+       { 0x55, 0x355 },
+       { 0x1055, 0x355 },
+       { 0x2055, 0x355 },
+       { 0x3055, 0x355 },
+       { 0x4055, 0x55 },
+       { 0x5055, 0x55 },
+       { 0x6055, 0x355 },
+       { 0x7055, 0x355 },
+       { 0x8055, 0x355 },
+       { 0x9055, 0x355 },
+       { 0x200c5, 0xb },
+       { 0x1200c5, 0x6 },
+       { 0x2002e, 0x1 },
+       { 0x12002e, 0x1 },
+       { 0x20024, 0x8 },
+       { 0x2003a, 0x2 },
+       { 0x120024, 0x8 },
+       { 0x2003a, 0x2 },
+       { 0x20056, 0xa },
+       { 0x120056, 0xa },
+       { 0x1004d, 0x1a },
+       { 0x1014d, 0x1a },
+       { 0x1104d, 0x1a },
+       { 0x1114d, 0x1a },
+       { 0x11004d, 0x1a },
+       { 0x11014d, 0x1a },
+       { 0x11104d, 0x1a },
+       { 0x11114d, 0x1a },
+       { 0x10049, 0xe38 },
+       { 0x10149, 0xe38 },
+       { 0x11049, 0xe38 },
+       { 0x11149, 0xe38 },
+       { 0x110049, 0xe38 },
+       { 0x110149, 0xe38 },
+       { 0x111049, 0xe38 },
+       { 0x111149, 0xe38 },
+       { 0x43, 0x63 },
+       { 0x1043, 0x63 },
+       { 0x2043, 0x63 },
+       { 0x3043, 0x63 },
+       { 0x4043, 0x63 },
+       { 0x5043, 0x63 },
+       { 0x6043, 0x63 },
+       { 0x7043, 0x63 },
+       { 0x8043, 0x63 },
+       { 0x9043, 0x63 },
+       { 0x20018, 0x1 },
+       { 0x20075, 0x2 },
+       { 0x20050, 0x0 },
+       { 0x20008, 0x190 },
+       { 0x120008, 0x10a },
+       { 0x20088, 0x9 },
+       { 0x200b2, 0x268 },
+       { 0x10043, 0x5b1 },
+       { 0x10143, 0x5b1 },
+       { 0x11043, 0x5b1 },
+       { 0x11143, 0x5b1 },
+       { 0x1200b2, 0x268 },
+       { 0x110043, 0x5b1 },
+       { 0x110143, 0x5b1 },
+       { 0x111043, 0x5b1 },
+       { 0x111143, 0x5b1 },
+       { 0x200fa, 0x1 },
+       { 0x1200fa, 0x1 },
+       { 0x20019, 0x5 },
+       { 0x120019, 0x5 },
+       { 0x200f0, 0x5555 },
+       { 0x200f1, 0x5555 },
+       { 0x200f2, 0x5555 },
+       { 0x200f3, 0x5555 },
+       { 0x200f4, 0x5555 },
+       { 0x200f5, 0x5555 },
+       { 0x200f6, 0x5555 },
+       { 0x200f7, 0xf000 },
+       { 0x20025, 0x0 },
+       { 0x2002d, 0x0 },
+       { 0x12002d, 0x0 },
+       { 0x2005b, 0x7529 },
+       { 0x2005c, 0x0 },
+       { 0x200c7, 0x21 },
+       { 0x200ca, 0x24 },
+       { 0x200cc, 0x1f7 },
+       { 0x1200c7, 0x21 },
+       { 0x1200ca, 0x24 },
+       { 0x1200cc, 0x1f7 },
+       { 0x2007d, 0x212 },
+       { 0x12007d, 0x212 },
+       { 0x2007c, 0x61 },
+       { 0x12007c, 0x61 },
+       { 0x1004a, 0x500 },
+       { 0x1104a, 0x500 },
+       { 0x2002c, 0x0 },
+};
+
+/* ddr phy trained csr */
+struct dram_cfg_param ddr_ddrphy_trained_csr[] = {
+       {0x0200b2, 0x0},
+       {0x1200b2, 0x0},
+       {0x2200b2, 0x0},
+       {0x0200cb, 0x0},
+       {0x010043, 0x0},
+       {0x110043, 0x0},
+       {0x210043, 0x0},
+       {0x010143, 0x0},
+       {0x110143, 0x0},
+       {0x210143, 0x0},
+       {0x011043, 0x0},
+       {0x111043, 0x0},
+       {0x211043, 0x0},
+       {0x011143, 0x0},
+       {0x111143, 0x0},
+       {0x211143, 0x0},
+       {0x000080, 0x0},
+       {0x100080, 0x0},
+       {0x200080, 0x0},
+       {0x001080, 0x0},
+       {0x101080, 0x0},
+       {0x201080, 0x0},
+       {0x002080, 0x0},
+       {0x102080, 0x0},
+       {0x202080, 0x0},
+       {0x003080, 0x0},
+       {0x103080, 0x0},
+       {0x203080, 0x0},
+       {0x004080, 0x0},
+       {0x104080, 0x0},
+       {0x204080, 0x0},
+       {0x005080, 0x0},
+       {0x105080, 0x0},
+       {0x205080, 0x0},
+       {0x006080, 0x0},
+       {0x106080, 0x0},
+       {0x206080, 0x0},
+       {0x007080, 0x0},
+       {0x107080, 0x0},
+       {0x207080, 0x0},
+       {0x008080, 0x0},
+       {0x108080, 0x0},
+       {0x208080, 0x0},
+       {0x009080, 0x0},
+       {0x109080, 0x0},
+       {0x209080, 0x0},
+       {0x010080, 0x0},
+       {0x110080, 0x0},
+       {0x210080, 0x0},
+       {0x010180, 0x0},
+       {0x110180, 0x0},
+       {0x210180, 0x0},
+       {0x010081, 0x0},
+       {0x110081, 0x0},
+       {0x210081, 0x0},
+       {0x010181, 0x0},
+       {0x110181, 0x0},
+       {0x210181, 0x0},
+       {0x010082, 0x0},
+       {0x110082, 0x0},
+       {0x210082, 0x0},
+       {0x010182, 0x0},
+       {0x110182, 0x0},
+       {0x210182, 0x0},
+       {0x010083, 0x0},
+       {0x110083, 0x0},
+       {0x210083, 0x0},
+       {0x010183, 0x0},
+       {0x110183, 0x0},
+       {0x210183, 0x0},
+       {0x011080, 0x0},
+       {0x111080, 0x0},
+       {0x211080, 0x0},
+       {0x011180, 0x0},
+       {0x111180, 0x0},
+       {0x211180, 0x0},
+       {0x011081, 0x0},
+       {0x111081, 0x0},
+       {0x211081, 0x0},
+       {0x011181, 0x0},
+       {0x111181, 0x0},
+       {0x211181, 0x0},
+       {0x011082, 0x0},
+       {0x111082, 0x0},
+       {0x211082, 0x0},
+       {0x011182, 0x0},
+       {0x111182, 0x0},
+       {0x211182, 0x0},
+       {0x011083, 0x0},
+       {0x111083, 0x0},
+       {0x211083, 0x0},
+       {0x011183, 0x0},
+       {0x111183, 0x0},
+       {0x211183, 0x0},
+       {0x0100d0, 0x0},
+       {0x1100d0, 0x0},
+       {0x2100d0, 0x0},
+       {0x0101d0, 0x0},
+       {0x1101d0, 0x0},
+       {0x2101d0, 0x0},
+       {0x0100d1, 0x0},
+       {0x1100d1, 0x0},
+       {0x2100d1, 0x0},
+       {0x0101d1, 0x0},
+       {0x1101d1, 0x0},
+       {0x2101d1, 0x0},
+       {0x0100d2, 0x0},
+       {0x1100d2, 0x0},
+       {0x2100d2, 0x0},
+       {0x0101d2, 0x0},
+       {0x1101d2, 0x0},
+       {0x2101d2, 0x0},
+       {0x0100d3, 0x0},
+       {0x1100d3, 0x0},
+       {0x2100d3, 0x0},
+       {0x0101d3, 0x0},
+       {0x1101d3, 0x0},
+       {0x2101d3, 0x0},
+       {0x0110d0, 0x0},
+       {0x1110d0, 0x0},
+       {0x2110d0, 0x0},
+       {0x0111d0, 0x0},
+       {0x1111d0, 0x0},
+       {0x2111d0, 0x0},
+       {0x0110d1, 0x0},
+       {0x1110d1, 0x0},
+       {0x2110d1, 0x0},
+       {0x0111d1, 0x0},
+       {0x1111d1, 0x0},
+       {0x2111d1, 0x0},
+       {0x0110d2, 0x0},
+       {0x1110d2, 0x0},
+       {0x2110d2, 0x0},
+       {0x0111d2, 0x0},
+       {0x1111d2, 0x0},
+       {0x2111d2, 0x0},
+       {0x0110d3, 0x0},
+       {0x1110d3, 0x0},
+       {0x2110d3, 0x0},
+       {0x0111d3, 0x0},
+       {0x1111d3, 0x0},
+       {0x2111d3, 0x0},
+       {0x010068, 0x0},
+       {0x010168, 0x0},
+       {0x010268, 0x0},
+       {0x010368, 0x0},
+       {0x010468, 0x0},
+       {0x010568, 0x0},
+       {0x010668, 0x0},
+       {0x010768, 0x0},
+       {0x010868, 0x0},
+       {0x010069, 0x0},
+       {0x010169, 0x0},
+       {0x010269, 0x0},
+       {0x010369, 0x0},
+       {0x010469, 0x0},
+       {0x010569, 0x0},
+       {0x010669, 0x0},
+       {0x010769, 0x0},
+       {0x010869, 0x0},
+       {0x01006a, 0x0},
+       {0x01016a, 0x0},
+       {0x01026a, 0x0},
+       {0x01036a, 0x0},
+       {0x01046a, 0x0},
+       {0x01056a, 0x0},
+       {0x01066a, 0x0},
+       {0x01076a, 0x0},
+       {0x01086a, 0x0},
+       {0x01006b, 0x0},
+       {0x01016b, 0x0},
+       {0x01026b, 0x0},
+       {0x01036b, 0x0},
+       {0x01046b, 0x0},
+       {0x01056b, 0x0},
+       {0x01066b, 0x0},
+       {0x01076b, 0x0},
+       {0x01086b, 0x0},
+       {0x011068, 0x0},
+       {0x011168, 0x0},
+       {0x011268, 0x0},
+       {0x011368, 0x0},
+       {0x011468, 0x0},
+       {0x011568, 0x0},
+       {0x011668, 0x0},
+       {0x011768, 0x0},
+       {0x011868, 0x0},
+       {0x011069, 0x0},
+       {0x011169, 0x0},
+       {0x011269, 0x0},
+       {0x011369, 0x0},
+       {0x011469, 0x0},
+       {0x011569, 0x0},
+       {0x011669, 0x0},
+       {0x011769, 0x0},
+       {0x011869, 0x0},
+       {0x01106a, 0x0},
+       {0x01116a, 0x0},
+       {0x01126a, 0x0},
+       {0x01136a, 0x0},
+       {0x01146a, 0x0},
+       {0x01156a, 0x0},
+       {0x01166a, 0x0},
+       {0x01176a, 0x0},
+       {0x01186a, 0x0},
+       {0x01106b, 0x0},
+       {0x01116b, 0x0},
+       {0x01126b, 0x0},
+       {0x01136b, 0x0},
+       {0x01146b, 0x0},
+       {0x01156b, 0x0},
+       {0x01166b, 0x0},
+       {0x01176b, 0x0},
+       {0x01186b, 0x0},
+       {0x01008c, 0x0},
+       {0x11008c, 0x0},
+       {0x21008c, 0x0},
+       {0x01018c, 0x0},
+       {0x11018c, 0x0},
+       {0x21018c, 0x0},
+       {0x01008d, 0x0},
+       {0x11008d, 0x0},
+       {0x21008d, 0x0},
+       {0x01018d, 0x0},
+       {0x11018d, 0x0},
+       {0x21018d, 0x0},
+       {0x01008e, 0x0},
+       {0x11008e, 0x0},
+       {0x21008e, 0x0},
+       {0x01018e, 0x0},
+       {0x11018e, 0x0},
+       {0x21018e, 0x0},
+       {0x01008f, 0x0},
+       {0x11008f, 0x0},
+       {0x21008f, 0x0},
+       {0x01018f, 0x0},
+       {0x11018f, 0x0},
+       {0x21018f, 0x0},
+       {0x01108c, 0x0},
+       {0x11108c, 0x0},
+       {0x21108c, 0x0},
+       {0x01118c, 0x0},
+       {0x11118c, 0x0},
+       {0x21118c, 0x0},
+       {0x01108d, 0x0},
+       {0x11108d, 0x0},
+       {0x21108d, 0x0},
+       {0x01118d, 0x0},
+       {0x11118d, 0x0},
+       {0x21118d, 0x0},
+       {0x01108e, 0x0},
+       {0x11108e, 0x0},
+       {0x21108e, 0x0},
+       {0x01118e, 0x0},
+       {0x11118e, 0x0},
+       {0x21118e, 0x0},
+       {0x01108f, 0x0},
+       {0x11108f, 0x0},
+       {0x21108f, 0x0},
+       {0x01118f, 0x0},
+       {0x11118f, 0x0},
+       {0x21118f, 0x0},
+       {0x0100c0, 0x0},
+       {0x1100c0, 0x0},
+       {0x2100c0, 0x0},
+       {0x0101c0, 0x0},
+       {0x1101c0, 0x0},
+       {0x2101c0, 0x0},
+       {0x0102c0, 0x0},
+       {0x1102c0, 0x0},
+       {0x2102c0, 0x0},
+       {0x0103c0, 0x0},
+       {0x1103c0, 0x0},
+       {0x2103c0, 0x0},
+       {0x0104c0, 0x0},
+       {0x1104c0, 0x0},
+       {0x2104c0, 0x0},
+       {0x0105c0, 0x0},
+       {0x1105c0, 0x0},
+       {0x2105c0, 0x0},
+       {0x0106c0, 0x0},
+       {0x1106c0, 0x0},
+       {0x2106c0, 0x0},
+       {0x0107c0, 0x0},
+       {0x1107c0, 0x0},
+       {0x2107c0, 0x0},
+       {0x0108c0, 0x0},
+       {0x1108c0, 0x0},
+       {0x2108c0, 0x0},
+       {0x0100c1, 0x0},
+       {0x1100c1, 0x0},
+       {0x2100c1, 0x0},
+       {0x0101c1, 0x0},
+       {0x1101c1, 0x0},
+       {0x2101c1, 0x0},
+       {0x0102c1, 0x0},
+       {0x1102c1, 0x0},
+       {0x2102c1, 0x0},
+       {0x0103c1, 0x0},
+       {0x1103c1, 0x0},
+       {0x2103c1, 0x0},
+       {0x0104c1, 0x0},
+       {0x1104c1, 0x0},
+       {0x2104c1, 0x0},
+       {0x0105c1, 0x0},
+       {0x1105c1, 0x0},
+       {0x2105c1, 0x0},
+       {0x0106c1, 0x0},
+       {0x1106c1, 0x0},
+       {0x2106c1, 0x0},
+       {0x0107c1, 0x0},
+       {0x1107c1, 0x0},
+       {0x2107c1, 0x0},
+       {0x0108c1, 0x0},
+       {0x1108c1, 0x0},
+       {0x2108c1, 0x0},
+       {0x0100c2, 0x0},
+       {0x1100c2, 0x0},
+       {0x2100c2, 0x0},
+       {0x0101c2, 0x0},
+       {0x1101c2, 0x0},
+       {0x2101c2, 0x0},
+       {0x0102c2, 0x0},
+       {0x1102c2, 0x0},
+       {0x2102c2, 0x0},
+       {0x0103c2, 0x0},
+       {0x1103c2, 0x0},
+       {0x2103c2, 0x0},
+       {0x0104c2, 0x0},
+       {0x1104c2, 0x0},
+       {0x2104c2, 0x0},
+       {0x0105c2, 0x0},
+       {0x1105c2, 0x0},
+       {0x2105c2, 0x0},
+       {0x0106c2, 0x0},
+       {0x1106c2, 0x0},
+       {0x2106c2, 0x0},
+       {0x0107c2, 0x0},
+       {0x1107c2, 0x0},
+       {0x2107c2, 0x0},
+       {0x0108c2, 0x0},
+       {0x1108c2, 0x0},
+       {0x2108c2, 0x0},
+       {0x0100c3, 0x0},
+       {0x1100c3, 0x0},
+       {0x2100c3, 0x0},
+       {0x0101c3, 0x0},
+       {0x1101c3, 0x0},
+       {0x2101c3, 0x0},
+       {0x0102c3, 0x0},
+       {0x1102c3, 0x0},
+       {0x2102c3, 0x0},
+       {0x0103c3, 0x0},
+       {0x1103c3, 0x0},
+       {0x2103c3, 0x0},
+       {0x0104c3, 0x0},
+       {0x1104c3, 0x0},
+       {0x2104c3, 0x0},
+       {0x0105c3, 0x0},
+       {0x1105c3, 0x0},
+       {0x2105c3, 0x0},
+       {0x0106c3, 0x0},
+       {0x1106c3, 0x0},
+       {0x2106c3, 0x0},
+       {0x0107c3, 0x0},
+       {0x1107c3, 0x0},
+       {0x2107c3, 0x0},
+       {0x0108c3, 0x0},
+       {0x1108c3, 0x0},
+       {0x2108c3, 0x0},
+       {0x0110c0, 0x0},
+       {0x1110c0, 0x0},
+       {0x2110c0, 0x0},
+       {0x0111c0, 0x0},
+       {0x1111c0, 0x0},
+       {0x2111c0, 0x0},
+       {0x0112c0, 0x0},
+       {0x1112c0, 0x0},
+       {0x2112c0, 0x0},
+       {0x0113c0, 0x0},
+       {0x1113c0, 0x0},
+       {0x2113c0, 0x0},
+       {0x0114c0, 0x0},
+       {0x1114c0, 0x0},
+       {0x2114c0, 0x0},
+       {0x0115c0, 0x0},
+       {0x1115c0, 0x0},
+       {0x2115c0, 0x0},
+       {0x0116c0, 0x0},
+       {0x1116c0, 0x0},
+       {0x2116c0, 0x0},
+       {0x0117c0, 0x0},
+       {0x1117c0, 0x0},
+       {0x2117c0, 0x0},
+       {0x0118c0, 0x0},
+       {0x1118c0, 0x0},
+       {0x2118c0, 0x0},
+       {0x0110c1, 0x0},
+       {0x1110c1, 0x0},
+       {0x2110c1, 0x0},
+       {0x0111c1, 0x0},
+       {0x1111c1, 0x0},
+       {0x2111c1, 0x0},
+       {0x0112c1, 0x0},
+       {0x1112c1, 0x0},
+       {0x2112c1, 0x0},
+       {0x0113c1, 0x0},
+       {0x1113c1, 0x0},
+       {0x2113c1, 0x0},
+       {0x0114c1, 0x0},
+       {0x1114c1, 0x0},
+       {0x2114c1, 0x0},
+       {0x0115c1, 0x0},
+       {0x1115c1, 0x0},
+       {0x2115c1, 0x0},
+       {0x0116c1, 0x0},
+       {0x1116c1, 0x0},
+       {0x2116c1, 0x0},
+       {0x0117c1, 0x0},
+       {0x1117c1, 0x0},
+       {0x2117c1, 0x0},
+       {0x0118c1, 0x0},
+       {0x1118c1, 0x0},
+       {0x2118c1, 0x0},
+       {0x0110c2, 0x0},
+       {0x1110c2, 0x0},
+       {0x2110c2, 0x0},
+       {0x0111c2, 0x0},
+       {0x1111c2, 0x0},
+       {0x2111c2, 0x0},
+       {0x0112c2, 0x0},
+       {0x1112c2, 0x0},
+       {0x2112c2, 0x0},
+       {0x0113c2, 0x0},
+       {0x1113c2, 0x0},
+       {0x2113c2, 0x0},
+       {0x0114c2, 0x0},
+       {0x1114c2, 0x0},
+       {0x2114c2, 0x0},
+       {0x0115c2, 0x0},
+       {0x1115c2, 0x0},
+       {0x2115c2, 0x0},
+       {0x0116c2, 0x0},
+       {0x1116c2, 0x0},
+       {0x2116c2, 0x0},
+       {0x0117c2, 0x0},
+       {0x1117c2, 0x0},
+       {0x2117c2, 0x0},
+       {0x0118c2, 0x0},
+       {0x1118c2, 0x0},
+       {0x2118c2, 0x0},
+       {0x0110c3, 0x0},
+       {0x1110c3, 0x0},
+       {0x2110c3, 0x0},
+       {0x0111c3, 0x0},
+       {0x1111c3, 0x0},
+       {0x2111c3, 0x0},
+       {0x0112c3, 0x0},
+       {0x1112c3, 0x0},
+       {0x2112c3, 0x0},
+       {0x0113c3, 0x0},
+       {0x1113c3, 0x0},
+       {0x2113c3, 0x0},
+       {0x0114c3, 0x0},
+       {0x1114c3, 0x0},
+       {0x2114c3, 0x0},
+       {0x0115c3, 0x0},
+       {0x1115c3, 0x0},
+       {0x2115c3, 0x0},
+       {0x0116c3, 0x0},
+       {0x1116c3, 0x0},
+       {0x2116c3, 0x0},
+       {0x0117c3, 0x0},
+       {0x1117c3, 0x0},
+       {0x2117c3, 0x0},
+       {0x0118c3, 0x0},
+       {0x1118c3, 0x0},
+       {0x2118c3, 0x0},
+       {0x010020, 0x0},
+       {0x110020, 0x0},
+       {0x210020, 0x0},
+       {0x011020, 0x0},
+       {0x111020, 0x0},
+       {0x211020, 0x0},
+       {0x02007d, 0x0},
+       {0x12007d, 0x0},
+       {0x22007d, 0x0},
+       {0x010040, 0x0},
+       {0x010140, 0x0},
+       {0x010240, 0x0},
+       {0x010340, 0x0},
+       {0x010440, 0x0},
+       {0x010540, 0x0},
+       {0x010640, 0x0},
+       {0x010740, 0x0},
+       {0x010840, 0x0},
+       {0x010030, 0x0},
+       {0x010130, 0x0},
+       {0x010230, 0x0},
+       {0x010330, 0x0},
+       {0x010430, 0x0},
+       {0x010530, 0x0},
+       {0x010630, 0x0},
+       {0x010730, 0x0},
+       {0x010830, 0x0},
+       {0x011040, 0x0},
+       {0x011140, 0x0},
+       {0x011240, 0x0},
+       {0x011340, 0x0},
+       {0x011440, 0x0},
+       {0x011540, 0x0},
+       {0x011640, 0x0},
+       {0x011740, 0x0},
+       {0x011840, 0x0},
+       {0x011030, 0x0},
+       {0x011130, 0x0},
+       {0x011230, 0x0},
+       {0x011330, 0x0},
+       {0x011430, 0x0},
+       {0x011530, 0x0},
+       {0x011630, 0x0},
+       {0x011730, 0x0},
+       {0x011830, 0x0},
+};
+
+/* P0 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp0_cfg[] = {
+       { 0xd0000, 0x0 },
+       { 0x54003, 0x640 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2830 },
+       { 0x54006, 0x25e },
+       { 0x54007, 0x1000 },
+       { 0x54008, 0x101 },
+       { 0x5400b, 0x31f },
+       { 0x5400c, 0xc8 },
+       { 0x5400d, 0x100 },
+       { 0x54012, 0x1 },
+       { 0x5402f, 0x234 },
+       { 0x54030, 0x105 },
+       { 0x54033, 0x200 },
+       { 0x54034, 0x600 },
+       { 0x54035, 0x410 },
+       { 0x54036, 0x101 },
+       { 0x5403f, 0x1221 },
+       { 0x541fc, 0x100 },
+       { 0xd0000, 0x1 },
+};
+
+
+/* P1 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp1_cfg[] = {
+       { 0xd0000, 0x0 },
+       { 0x54002, 0x1 },
+       { 0x54003, 0x42a },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2830 },
+       { 0x54006, 0x25e },
+       { 0x54007, 0x1000 },
+       { 0x54008, 0x101 },
+       { 0x5400b, 0x21f },
+       { 0x5400c, 0xc8 },
+       { 0x5400d, 0x100 },
+       { 0x54012, 0x1 },
+       { 0x5402f, 0x4 },
+       { 0x54030, 0x105 },
+       { 0x54033, 0x200 },
+       { 0x54034, 0x600 },
+       { 0x54035, 0x10 },
+       { 0x54036, 0x101 },
+       { 0x5403f, 0x1221 },
+       { 0x541fc, 0x100 },
+       { 0xd0000, 0x1 },
+};
+
+
+/* P0 2D message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
+       { 0xd0000, 0x0 },
+       { 0x54003, 0x640 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2830 },
+       { 0x54006, 0x25e },
+       { 0x54007, 0x1000 },
+       { 0x54008, 0x101 },
+       { 0x5400b, 0x61 },
+       { 0x5400c, 0xc8 },
+       { 0x5400d, 0x100 },
+       { 0x5400e, 0x1f7f },
+       { 0x54012, 0x1 },
+       { 0x5402f, 0x234 },
+       { 0x54030, 0x105 },
+       { 0x54033, 0x200 },
+       { 0x54034, 0x600 },
+       { 0x54035, 0x410 },
+       { 0x54036, 0x101 },
+       { 0x5403f, 0x1221 },
+       { 0x541fc, 0x100 },
+       { 0xd0000, 0x1 },
+};
+
+/* DRAM PHY init engine image */
+struct dram_cfg_param ddr_phy_pie[] = {
+       { 0xd0000, 0x0 },
+       { 0x90000, 0x10 },
+       { 0x90001, 0x400 },
+       { 0x90002, 0x10e },
+       { 0x90003, 0x0 },
+       { 0x90004, 0x0 },
+       { 0x90005, 0x8 },
+       { 0x90029, 0xb },
+       { 0x9002a, 0x480 },
+       { 0x9002b, 0x109 },
+       { 0x9002c, 0x8 },
+       { 0x9002d, 0x448 },
+       { 0x9002e, 0x139 },
+       { 0x9002f, 0x8 },
+       { 0x90030, 0x478 },
+       { 0x90031, 0x109 },
+       { 0x90032, 0x2 },
+       { 0x90033, 0x10 },
+       { 0x90034, 0x139 },
+       { 0x90035, 0xb },
+       { 0x90036, 0x7c0 },
+       { 0x90037, 0x139 },
+       { 0x90038, 0x44 },
+       { 0x90039, 0x633 },
+       { 0x9003a, 0x159 },
+       { 0x9003b, 0x14f },
+       { 0x9003c, 0x630 },
+       { 0x9003d, 0x159 },
+       { 0x9003e, 0x47 },
+       { 0x9003f, 0x633 },
+       { 0x90040, 0x149 },
+       { 0x90041, 0x4f },
+       { 0x90042, 0x633 },
+       { 0x90043, 0x179 },
+       { 0x90044, 0x8 },
+       { 0x90045, 0xe0 },
+       { 0x90046, 0x109 },
+       { 0x90047, 0x0 },
+       { 0x90048, 0x7c8 },
+       { 0x90049, 0x109 },
+       { 0x9004a, 0x0 },
+       { 0x9004b, 0x1 },
+       { 0x9004c, 0x8 },
+       { 0x9004d, 0x0 },
+       { 0x9004e, 0x45a },
+       { 0x9004f, 0x9 },
+       { 0x90050, 0x0 },
+       { 0x90051, 0x448 },
+       { 0x90052, 0x109 },
+       { 0x90053, 0x40 },
+       { 0x90054, 0x633 },
+       { 0x90055, 0x179 },
+       { 0x90056, 0x1 },
+       { 0x90057, 0x618 },
+       { 0x90058, 0x109 },
+       { 0x90059, 0x40c0 },
+       { 0x9005a, 0x633 },
+       { 0x9005b, 0x149 },
+       { 0x9005c, 0x8 },
+       { 0x9005d, 0x4 },
+       { 0x9005e, 0x48 },
+       { 0x9005f, 0x4040 },
+       { 0x90060, 0x633 },
+       { 0x90061, 0x149 },
+       { 0x90062, 0x0 },
+       { 0x90063, 0x4 },
+       { 0x90064, 0x48 },
+       { 0x90065, 0x40 },
+       { 0x90066, 0x633 },
+       { 0x90067, 0x149 },
+       { 0x90068, 0x10 },
+       { 0x90069, 0x4 },
+       { 0x9006a, 0x18 },
+       { 0x9006b, 0x0 },
+       { 0x9006c, 0x4 },
+       { 0x9006d, 0x78 },
+       { 0x9006e, 0x549 },
+       { 0x9006f, 0x633 },
+       { 0x90070, 0x159 },
+       { 0x90071, 0xd49 },
+       { 0x90072, 0x633 },
+       { 0x90073, 0x159 },
+       { 0x90074, 0x94a },
+       { 0x90075, 0x633 },
+       { 0x90076, 0x159 },
+       { 0x90077, 0x441 },
+       { 0x90078, 0x633 },
+       { 0x90079, 0x149 },
+       { 0x9007a, 0x42 },
+       { 0x9007b, 0x633 },
+       { 0x9007c, 0x149 },
+       { 0x9007d, 0x1 },
+       { 0x9007e, 0x633 },
+       { 0x9007f, 0x149 },
+       { 0x90080, 0x0 },
+       { 0x90081, 0xe0 },
+       { 0x90082, 0x109 },
+       { 0x90083, 0xa },
+       { 0x90084, 0x10 },
+       { 0x90085, 0x109 },
+       { 0x90086, 0x9 },
+       { 0x90087, 0x3c0 },
+       { 0x90088, 0x149 },
+       { 0x90089, 0x9 },
+       { 0x9008a, 0x3c0 },
+       { 0x9008b, 0x159 },
+       { 0x9008c, 0x18 },
+       { 0x9008d, 0x10 },
+       { 0x9008e, 0x109 },
+       { 0x9008f, 0x0 },
+       { 0x90090, 0x3c0 },
+       { 0x90091, 0x109 },
+       { 0x90092, 0x18 },
+       { 0x90093, 0x4 },
+       { 0x90094, 0x48 },
+       { 0x90095, 0x18 },
+       { 0x90096, 0x4 },
+       { 0x90097, 0x58 },
+       { 0x90098, 0xb },
+       { 0x90099, 0x10 },
+       { 0x9009a, 0x109 },
+       { 0x9009b, 0x1 },
+       { 0x9009c, 0x10 },
+       { 0x9009d, 0x109 },
+       { 0x9009e, 0x5 },
+       { 0x9009f, 0x7c0 },
+       { 0x900a0, 0x109 },
+       { 0x900a1, 0x0 },
+       { 0x900a2, 0x8140 },
+       { 0x900a3, 0x10c },
+       { 0x900a4, 0x10 },
+       { 0x900a5, 0x8138 },
+       { 0x900a6, 0x10c },
+       { 0x900a7, 0x8 },
+       { 0x900a8, 0x7c8 },
+       { 0x900a9, 0x101 },
+       { 0x900aa, 0x8 },
+       { 0x900ab, 0x448 },
+       { 0x900ac, 0x109 },
+       { 0x900ad, 0xf },
+       { 0x900ae, 0x7c0 },
+       { 0x900af, 0x109 },
+       { 0x900b0, 0x47 },
+       { 0x900b1, 0x630 },
+       { 0x900b2, 0x109 },
+       { 0x900b3, 0x8 },
+       { 0x900b4, 0x618 },
+       { 0x900b5, 0x109 },
+       { 0x900b6, 0x8 },
+       { 0x900b7, 0xe0 },
+       { 0x900b8, 0x109 },
+       { 0x900b9, 0x0 },
+       { 0x900ba, 0x7c8 },
+       { 0x900bb, 0x109 },
+       { 0x900bc, 0x8 },
+       { 0x900bd, 0x8140 },
+       { 0x900be, 0x10c },
+       { 0x900bf, 0x0 },
+       { 0x900c0, 0x1 },
+       { 0x900c1, 0x8 },
+       { 0x900c2, 0x8 },
+       { 0x900c3, 0x4 },
+       { 0x900c4, 0x8 },
+       { 0x900c5, 0x8 },
+       { 0x900c6, 0x7c8 },
+       { 0x900c7, 0x101 },
+       { 0x90006, 0x0 },
+       { 0x90007, 0x0 },
+       { 0x90008, 0x8 },
+       { 0x90009, 0x0 },
+       { 0x9000a, 0x0 },
+       { 0x9000b, 0x0 },
+       { 0xd00e7, 0x400 },
+       { 0x90017, 0x0 },
+       { 0x90026, 0x2b },
+       { 0x2000b, 0x32 },
+       { 0x2000c, 0x64 },
+       { 0x2000d, 0x3e8 },
+       { 0x2000e, 0x2c },
+       { 0x12000b, 0x21 },
+       { 0x12000c, 0x42 },
+       { 0x12000d, 0x29a },
+       { 0x12000e, 0x21 },
+       { 0x9000c, 0x0 },
+       { 0x9000d, 0x173 },
+       { 0x9000e, 0x60 },
+       { 0x9000f, 0x6110 },
+       { 0x90010, 0x2152 },
+       { 0x90011, 0xdfbd },
+       { 0x90012, 0xffff },
+       { 0x90013, 0x6152 },
+       { 0x20089, 0x1 },
+       { 0x20088, 0x19 },
+       { 0xc0080, 0x0 },
+       { 0xd0000, 0x1 }
+};
+
+struct dram_fsp_msg ddr_dram_fsp_msg[] = {
+       {
+               /* P0 1600mts 1D */
+               .drate = 1600,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp0_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg),
+       },
+       {
+               /* P1 1066mts 1D */
+               .drate = 1066,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp1_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp1_cfg),
+       },
+       {
+               /* P0 1600mts 2D */
+               .drate = 1600,
+               .fw_type = FW_2D_IMAGE,
+               .fsp_cfg = ddr_fsp0_2d_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_2d_cfg),
+       },
+};
+
+/* ddr timing config params */
+struct dram_timing_info dram_timing = {
+       .ddrc_cfg = ddr_ddrc_cfg,
+       .ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg),
+       .ddrphy_cfg = ddr_ddrphy_cfg,
+       .ddrphy_cfg_num = ARRAY_SIZE(ddr_ddrphy_cfg),
+       .fsp_msg = ddr_dram_fsp_msg,
+       .fsp_msg_num = ARRAY_SIZE(ddr_dram_fsp_msg),
+       .ddrphy_trained_csr = ddr_ddrphy_trained_csr,
+       .ddrphy_trained_csr_num = ARRAY_SIZE(ddr_ddrphy_trained_csr),
+       .ddrphy_pie = ddr_phy_pie,
+       .ddrphy_pie_num = ARRAY_SIZE(ddr_phy_pie),
+       .fsp_table = { 1600, 1066, },
+};
+
diff --git a/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg b/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg
new file mode 100644 (file)
index 0000000..22aec26
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+#define __ASSEMBLY__
+
+ROM_VERSION    v2
+BOOT_FROM      sd
+LOADER         mkimage.flash.mkimage   0x912000
diff --git a/board/freescale/imx8mn_evk/lpddr4_timing.c b/board/freescale/imx8mn_evk/lpddr4_timing.c
new file mode 100644 (file)
index 0000000..671e924
--- /dev/null
@@ -0,0 +1,1587 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ *
+ * Generated code from MX8M_DDR_tool
+ * Align with uboot-imx_v2018.03_4.14.78_1.0.0_ga
+ */
+
+#include <linux/kernel.h>
+#include <asm/arch/ddr.h>
+
+struct dram_cfg_param ddr_ddrc_cfg[] = {
+       {0x3d400020, 0x00000213},
+       {0x3d400024, 0x0003e800},
+       {0x3d400030, 0x00000120},
+       {0x3d400000, 0xa3080020},
+       {0x3d400064, 0x006100e0},
+       {0x3d4000d0, 0xc003061c},
+       {0x3d4000d4, 0x009e0000},
+       {0x3d4000dc, 0x00d4002d},
+       {0x3d4000e0, 0x00310000},
+       {0x3d4000e8, 0x0066004d},
+       {0x3d4000ec, 0x0016004a},
+       {0x3d400100, 0x1a201b22},
+       {0x3d400104, 0x00060633},
+       {0x3d40010c, 0x00c0c000},
+       {0x3d400110, 0x0f04080f},
+       {0x3d400114, 0x02040c0c},
+       {0x3d400118, 0x01010007},
+       {0x3d40011c, 0x00000401},
+       {0x3d400130, 0x00020600},
+       {0x3d400134, 0x0c100002},
+       {0x3d400138, 0x000000e6},
+       {0x3d400144, 0x00a00050},
+       {0x3d400180, 0x03200018},
+       {0x3d400184, 0x028061a8},
+       {0x3d400188, 0x00000000},
+       {0x3d400190, 0x0497820a},
+       {0x3d4001b4, 0x0000170a},
+       {0x3d400108, 0x070e1617},
+       {0x3d4001c0, 0x00000001},
+       {0x3d400194, 0x00080303},
+       {0x3d4001a0, 0xe0400018},
+       {0x3d4001a4, 0x00df00e4},
+       {0x3d4001a8, 0x80000000},
+       {0x3d4001b0, 0x00000011},
+       {0x3d4001c4, 0x00000001},
+       {0x3d4000f4, 0x00000c99},
+       {0x3d400200, 0x00000017},
+       {0x3d400204, 0x00080808},
+       {0x3d400208, 0x00000000},
+       {0x3d40020c, 0x00000000},
+       {0x3d400210, 0x00001f1f},
+       {0x3d400214, 0x07070707},
+       {0x3d400218, 0x07070707},
+       {0x3d40021c, 0x00000f0f},
+       {0x3d400250, 0x29001701},
+       {0x3d400254, 0x0000002c},
+       {0x3d40025c, 0x04000030},
+       {0x3d400264, 0x900093e7},
+       {0x3d40026c, 0x20005574},
+       {0x3d400400, 0x00000111},
+       {0x3d400408, 0x000072ff},
+       {0x3d400494, 0x02100e07},
+       {0x3d400498, 0x00620096},
+       {0x3d40049c, 0x01100e07},
+       {0x3d4004a0, 0x00c8012c},
+       {0x3d402020, 0x00000011},
+       {0x3d402024, 0x00007d00},
+       {0x3d402050, 0x0020d040},
+       {0x3d402064, 0x000c001d},
+       {0x3d4020f4, 0x00000c99},
+       {0x3d402100, 0x0a040305},
+       {0x3d402104, 0x00030407},
+       {0x3d402108, 0x0203060b},
+       {0x3d40210c, 0x00505000},
+       {0x3d402110, 0x02040202},
+       {0x3d402114, 0x02030202},
+       {0x3d402118, 0x01010004},
+       {0x3d40211c, 0x00000301},
+       {0x3d402130, 0x00020300},
+       {0x3d402134, 0x0a100002},
+       {0x3d402138, 0x0000001d},
+       {0x3d402144, 0x0014000a},
+       {0x3d402180, 0x00650004},
+       {0x3d402190, 0x03818200},
+       {0x3d402194, 0x00080303},
+       {0x3d4021b4, 0x00000100},
+       {0x3d4020dc, 0x00840000},
+       {0x3d4020e0, 0x00310000},
+       {0x3d4020e8, 0x0066004d},
+       {0x3d4020ec, 0x0016004a},
+       {0x3d403020, 0x00000011},
+       {0x3d403024, 0x00001f40},
+       {0x3d403050, 0x0020d040},
+       {0x3d403064, 0x00030007},
+       {0x3d4030f4, 0x00000c99},
+       {0x3d403100, 0x0a010102},
+       {0x3d403104, 0x00030404},
+       {0x3d403108, 0x0203060b},
+       {0x3d40310c, 0x00505000},
+       {0x3d403110, 0x02040202},
+       {0x3d403114, 0x02030202},
+       {0x3d403118, 0x01010004},
+       {0x3d40311c, 0x00000301},
+       {0x3d403130, 0x00020300},
+       {0x3d403134, 0x0a100002},
+       {0x3d403138, 0x00000008},
+       {0x3d403144, 0x00050003},
+       {0x3d403180, 0x00190004},
+       {0x3d403190, 0x03818200},
+       {0x3d403194, 0x00080303},
+       {0x3d4031b4, 0x00000100},
+       {0x3d4030dc, 0x00840000},
+       {0x3d4030e0, 0x00310000},
+       {0x3d4030e8, 0x0066004d},
+       {0x3d4030ec, 0x0016004a},
+
+       /* default boot point */
+       { 0x3d400028, 0x0 },
+};
+
+/* PHY Initialize Configuration */
+struct dram_cfg_param ddr_ddrphy_cfg[] = {
+       {0x000d0000, 0x00000000},
+       {0x000100a0, 0x00000000},
+       {0x000100a1, 0x00000001},
+       {0x000100a2, 0x00000002},
+       {0x000100a3, 0x00000003},
+       {0x000100a4, 0x00000004},
+       {0x000100a5, 0x00000005},
+       {0x000100a6, 0x00000006},
+       {0x000100a7, 0x00000007},
+       {0x000110a0, 0x00000000},
+       {0x000110a1, 0x00000001},
+       {0x000110a2, 0x00000003},
+       {0x000110a3, 0x00000004},
+       {0x000110a4, 0x00000005},
+       {0x000110a5, 0x00000002},
+       {0x000110a6, 0x00000007},
+       {0x000110a7, 0x00000006},
+       {0x0001005f, 0x0000015f},
+       {0x0001015f, 0x0000015f},
+       {0x0001105f, 0x0000015f},
+       {0x0001115f, 0x0000015f},
+       {0x0011005f, 0x0000015f},
+       {0x0011015f, 0x0000015f},
+       {0x0011105f, 0x0000015f},
+       {0x0011115f, 0x0000015f},
+       {0x0021005f, 0x0000015f},
+       {0x0021015f, 0x0000015f},
+       {0x0021105f, 0x0000015f},
+       {0x0021115f, 0x0000015f},
+       {0x00000055, 0x0000016f},
+       {0x00001055, 0x0000016f},
+       {0x00002055, 0x0000016f},
+       {0x00003055, 0x0000016f},
+       {0x00004055, 0x0000016f},
+       {0x00005055, 0x0000016f},
+       {0x00006055, 0x0000016f},
+       {0x00007055, 0x0000016f},
+       {0x00008055, 0x0000016f},
+       {0x00009055, 0x0000016f},
+       {0x000200c5, 0x00000019},
+       {0x001200c5, 0x00000007},
+       {0x002200c5, 0x00000007},
+       {0x0002002e, 0x00000002},
+       {0x0012002e, 0x00000002},
+       {0x0022002e, 0x00000002},
+       {0x00090204, 0x00000000},
+       {0x00190204, 0x00000000},
+       {0x00290204, 0x00000000},
+       {0x00020024, 0x000001a3},
+       {0x0002003a, 0x00000002},
+       {0x0002007d, 0x00000212},
+       {0x0002007c, 0x00000061},
+       {0x00120024, 0x000001a3},
+       {0x0002003a, 0x00000002},
+       {0x0012007d, 0x00000212},
+       {0x0012007c, 0x00000061},
+       {0x00220024, 0x000001a3},
+       {0x0002003a, 0x00000002},
+       {0x0022007d, 0x00000212},
+       {0x0022007c, 0x00000061},
+       {0x00020056, 0x00000003},
+       {0x00120056, 0x00000003},
+       {0x00220056, 0x00000003},
+       {0x0001004d, 0x00000f80},
+       {0x0001014d, 0x00000f80},
+       {0x0001104d, 0x00000f80},
+       {0x0001114d, 0x00000f80},
+       {0x0011004d, 0x00000f80},
+       {0x0011014d, 0x00000f80},
+       {0x0011104d, 0x00000f80},
+       {0x0011114d, 0x00000f80},
+       {0x0021004d, 0x00000f80},
+       {0x0021014d, 0x00000f80},
+       {0x0021104d, 0x00000f80},
+       {0x0021114d, 0x00000f80},
+       {0x00010049, 0x00000fbe},
+       {0x00010149, 0x00000fbe},
+       {0x00011049, 0x00000fbe},
+       {0x00011149, 0x00000fbe},
+       {0x00110049, 0x00000fbe},
+       {0x00110149, 0x00000fbe},
+       {0x00111049, 0x00000fbe},
+       {0x00111149, 0x00000fbe},
+       {0x00210049, 0x00000fbe},
+       {0x00210149, 0x00000fbe},
+       {0x00211049, 0x00000fbe},
+       {0x00211149, 0x00000fbe},
+       {0x00000043, 0x00000063},
+       {0x00001043, 0x00000063},
+       {0x00002043, 0x00000063},
+       {0x00003043, 0x00000063},
+       {0x00004043, 0x00000063},
+       {0x00005043, 0x00000063},
+       {0x00006043, 0x00000063},
+       {0x00007043, 0x00000063},
+       {0x00008043, 0x00000063},
+       {0x00009043, 0x00000063},
+       {0x00020018, 0x00000001},
+       {0x00020075, 0x00000004},
+       {0x00020050, 0x00000000},
+       {0x00020008, 0x00000320},
+       {0x00120008, 0x00000064},
+       {0x00220008, 0x00000019},
+       {0x00020088, 0x00000009},
+       {0x000200b2, 0x000000dc},
+       {0x00010043, 0x000005a1},
+       {0x00010143, 0x000005a1},
+       {0x00011043, 0x000005a1},
+       {0x00011143, 0x000005a1},
+       {0x001200b2, 0x000000dc},
+       {0x00110043, 0x000005a1},
+       {0x00110143, 0x000005a1},
+       {0x00111043, 0x000005a1},
+       {0x00111143, 0x000005a1},
+       {0x002200b2, 0x000000dc},
+       {0x00210043, 0x000005a1},
+       {0x00210143, 0x000005a1},
+       {0x00211043, 0x000005a1},
+       {0x00211143, 0x000005a1},
+       {0x000200fa, 0x00000001},
+       {0x001200fa, 0x00000001},
+       {0x002200fa, 0x00000001},
+       {0x00020019, 0x00000001},
+       {0x00120019, 0x00000001},
+       {0x00220019, 0x00000001},
+       {0x000200f0, 0x00000660},
+       {0x000200f1, 0x00000000},
+       {0x000200f2, 0x00004444},
+       {0x000200f3, 0x00008888},
+       {0x000200f4, 0x00005665},
+       {0x000200f5, 0x00000000},
+       {0x000200f6, 0x00000000},
+       {0x000200f7, 0x0000f000},
+       {0x0001004a, 0x00000500},
+       {0x0001104a, 0x00000500},
+       {0x00020025, 0x00000000},
+       {0x0002002d, 0x00000000},
+       {0x0012002d, 0x00000000},
+       {0x0022002d, 0x00000000},
+       {0x0002002c, 0x00000000},
+       {0x000200c7, 0x00000021},
+       {0x000200ca, 0x00000024},
+       {0x000200cc, 0x000001f7},
+       {0x001200c7, 0x00000021},
+       {0x001200ca, 0x00000024},
+       {0x001200cc, 0x000001f7},
+       {0x002200c7, 0x00000021},
+       {0x002200ca, 0x00000024},
+       {0x002200cc, 0x000001f7},
+       {0x00020060, 0x00000002},
+       {0x000d0000, 0x00000001},
+};
+
+/* ddr phy trained csr */
+struct dram_cfg_param ddr_ddrphy_trained_csr[] = {
+       {0x0200b2, 0x0},
+       {0x1200b2, 0x0},
+       {0x2200b2, 0x0},
+       {0x0200cb, 0x0},
+       {0x010043, 0x0},
+       {0x110043, 0x0},
+       {0x210043, 0x0},
+       {0x010143, 0x0},
+       {0x110143, 0x0},
+       {0x210143, 0x0},
+       {0x011043, 0x0},
+       {0x111043, 0x0},
+       {0x211043, 0x0},
+       {0x011143, 0x0},
+       {0x111143, 0x0},
+       {0x211143, 0x0},
+       {0x000080, 0x0},
+       {0x100080, 0x0},
+       {0x200080, 0x0},
+       {0x001080, 0x0},
+       {0x101080, 0x0},
+       {0x201080, 0x0},
+       {0x002080, 0x0},
+       {0x102080, 0x0},
+       {0x202080, 0x0},
+       {0x003080, 0x0},
+       {0x103080, 0x0},
+       {0x203080, 0x0},
+       {0x004080, 0x0},
+       {0x104080, 0x0},
+       {0x204080, 0x0},
+       {0x005080, 0x0},
+       {0x105080, 0x0},
+       {0x205080, 0x0},
+       {0x006080, 0x0},
+       {0x106080, 0x0},
+       {0x206080, 0x0},
+       {0x007080, 0x0},
+       {0x107080, 0x0},
+       {0x207080, 0x0},
+       {0x008080, 0x0},
+       {0x108080, 0x0},
+       {0x208080, 0x0},
+       {0x009080, 0x0},
+       {0x109080, 0x0},
+       {0x209080, 0x0},
+       {0x010080, 0x0},
+       {0x110080, 0x0},
+       {0x210080, 0x0},
+       {0x010180, 0x0},
+       {0x110180, 0x0},
+       {0x210180, 0x0},
+       {0x011080, 0x0},
+       {0x111080, 0x0},
+       {0x211080, 0x0},
+       {0x011180, 0x0},
+       {0x111180, 0x0},
+       {0x211180, 0x0},
+       {0x010081, 0x0},
+       {0x110081, 0x0},
+       {0x210081, 0x0},
+       {0x010181, 0x0},
+       {0x110181, 0x0},
+       {0x210181, 0x0},
+       {0x011081, 0x0},
+       {0x111081, 0x0},
+       {0x211081, 0x0},
+       {0x011181, 0x0},
+       {0x111181, 0x0},
+       {0x211181, 0x0},
+       {0x0100d0, 0x0},
+       {0x1100d0, 0x0},
+       {0x2100d0, 0x0},
+       {0x0101d0, 0x0},
+       {0x1101d0, 0x0},
+       {0x2101d0, 0x0},
+       {0x0110d0, 0x0},
+       {0x1110d0, 0x0},
+       {0x2110d0, 0x0},
+       {0x0111d0, 0x0},
+       {0x1111d0, 0x0},
+       {0x2111d0, 0x0},
+       {0x0100d1, 0x0},
+       {0x1100d1, 0x0},
+       {0x2100d1, 0x0},
+       {0x0101d1, 0x0},
+       {0x1101d1, 0x0},
+       {0x2101d1, 0x0},
+       {0x0110d1, 0x0},
+       {0x1110d1, 0x0},
+       {0x2110d1, 0x0},
+       {0x0111d1, 0x0},
+       {0x1111d1, 0x0},
+       {0x2111d1, 0x0},
+       {0x010068, 0x0},
+       {0x010168, 0x0},
+       {0x010268, 0x0},
+       {0x010368, 0x0},
+       {0x010468, 0x0},
+       {0x010568, 0x0},
+       {0x010668, 0x0},
+       {0x010768, 0x0},
+       {0x010868, 0x0},
+       {0x011068, 0x0},
+       {0x011168, 0x0},
+       {0x011268, 0x0},
+       {0x011368, 0x0},
+       {0x011468, 0x0},
+       {0x011568, 0x0},
+       {0x011668, 0x0},
+       {0x011768, 0x0},
+       {0x011868, 0x0},
+       {0x010069, 0x0},
+       {0x010169, 0x0},
+       {0x010269, 0x0},
+       {0x010369, 0x0},
+       {0x010469, 0x0},
+       {0x010569, 0x0},
+       {0x010669, 0x0},
+       {0x010769, 0x0},
+       {0x010869, 0x0},
+       {0x011069, 0x0},
+       {0x011169, 0x0},
+       {0x011269, 0x0},
+       {0x011369, 0x0},
+       {0x011469, 0x0},
+       {0x011569, 0x0},
+       {0x011669, 0x0},
+       {0x011769, 0x0},
+       {0x011869, 0x0},
+       {0x01008c, 0x0},
+       {0x11008c, 0x0},
+       {0x21008c, 0x0},
+       {0x01018c, 0x0},
+       {0x11018c, 0x0},
+       {0x21018c, 0x0},
+       {0x01108c, 0x0},
+       {0x11108c, 0x0},
+       {0x21108c, 0x0},
+       {0x01118c, 0x0},
+       {0x11118c, 0x0},
+       {0x21118c, 0x0},
+       {0x01008d, 0x0},
+       {0x11008d, 0x0},
+       {0x21008d, 0x0},
+       {0x01018d, 0x0},
+       {0x11018d, 0x0},
+       {0x21018d, 0x0},
+       {0x01108d, 0x0},
+       {0x11108d, 0x0},
+       {0x21108d, 0x0},
+       {0x01118d, 0x0},
+       {0x11118d, 0x0},
+       {0x21118d, 0x0},
+       {0x0100c0, 0x0},
+       {0x1100c0, 0x0},
+       {0x2100c0, 0x0},
+       {0x0101c0, 0x0},
+       {0x1101c0, 0x0},
+       {0x2101c0, 0x0},
+       {0x0102c0, 0x0},
+       {0x1102c0, 0x0},
+       {0x2102c0, 0x0},
+       {0x0103c0, 0x0},
+       {0x1103c0, 0x0},
+       {0x2103c0, 0x0},
+       {0x0104c0, 0x0},
+       {0x1104c0, 0x0},
+       {0x2104c0, 0x0},
+       {0x0105c0, 0x0},
+       {0x1105c0, 0x0},
+       {0x2105c0, 0x0},
+       {0x0106c0, 0x0},
+       {0x1106c0, 0x0},
+       {0x2106c0, 0x0},
+       {0x0107c0, 0x0},
+       {0x1107c0, 0x0},
+       {0x2107c0, 0x0},
+       {0x0108c0, 0x0},
+       {0x1108c0, 0x0},
+       {0x2108c0, 0x0},
+       {0x0110c0, 0x0},
+       {0x1110c0, 0x0},
+       {0x2110c0, 0x0},
+       {0x0111c0, 0x0},
+       {0x1111c0, 0x0},
+       {0x2111c0, 0x0},
+       {0x0112c0, 0x0},
+       {0x1112c0, 0x0},
+       {0x2112c0, 0x0},
+       {0x0113c0, 0x0},
+       {0x1113c0, 0x0},
+       {0x2113c0, 0x0},
+       {0x0114c0, 0x0},
+       {0x1114c0, 0x0},
+       {0x2114c0, 0x0},
+       {0x0115c0, 0x0},
+       {0x1115c0, 0x0},
+       {0x2115c0, 0x0},
+       {0x0116c0, 0x0},
+       {0x1116c0, 0x0},
+       {0x2116c0, 0x0},
+       {0x0117c0, 0x0},
+       {0x1117c0, 0x0},
+       {0x2117c0, 0x0},
+       {0x0118c0, 0x0},
+       {0x1118c0, 0x0},
+       {0x2118c0, 0x0},
+       {0x0100c1, 0x0},
+       {0x1100c1, 0x0},
+       {0x2100c1, 0x0},
+       {0x0101c1, 0x0},
+       {0x1101c1, 0x0},
+       {0x2101c1, 0x0},
+       {0x0102c1, 0x0},
+       {0x1102c1, 0x0},
+       {0x2102c1, 0x0},
+       {0x0103c1, 0x0},
+       {0x1103c1, 0x0},
+       {0x2103c1, 0x0},
+       {0x0104c1, 0x0},
+       {0x1104c1, 0x0},
+       {0x2104c1, 0x0},
+       {0x0105c1, 0x0},
+       {0x1105c1, 0x0},
+       {0x2105c1, 0x0},
+       {0x0106c1, 0x0},
+       {0x1106c1, 0x0},
+       {0x2106c1, 0x0},
+       {0x0107c1, 0x0},
+       {0x1107c1, 0x0},
+       {0x2107c1, 0x0},
+       {0x0108c1, 0x0},
+       {0x1108c1, 0x0},
+       {0x2108c1, 0x0},
+       {0x0110c1, 0x0},
+       {0x1110c1, 0x0},
+       {0x2110c1, 0x0},
+       {0x0111c1, 0x0},
+       {0x1111c1, 0x0},
+       {0x2111c1, 0x0},
+       {0x0112c1, 0x0},
+       {0x1112c1, 0x0},
+       {0x2112c1, 0x0},
+       {0x0113c1, 0x0},
+       {0x1113c1, 0x0},
+       {0x2113c1, 0x0},
+       {0x0114c1, 0x0},
+       {0x1114c1, 0x0},
+       {0x2114c1, 0x0},
+       {0x0115c1, 0x0},
+       {0x1115c1, 0x0},
+       {0x2115c1, 0x0},
+       {0x0116c1, 0x0},
+       {0x1116c1, 0x0},
+       {0x2116c1, 0x0},
+       {0x0117c1, 0x0},
+       {0x1117c1, 0x0},
+       {0x2117c1, 0x0},
+       {0x0118c1, 0x0},
+       {0x1118c1, 0x0},
+       {0x2118c1, 0x0},
+       {0x010020, 0x0},
+       {0x110020, 0x0},
+       {0x210020, 0x0},
+       {0x011020, 0x0},
+       {0x111020, 0x0},
+       {0x211020, 0x0},
+       {0x020072, 0x0},
+       {0x020073, 0x0},
+       {0x020074, 0x0},
+       {0x0100aa, 0x0},
+       {0x0110aa, 0x0},
+       {0x020010, 0x0},
+       {0x120010, 0x0},
+       {0x220010, 0x0},
+       {0x020011, 0x0},
+       {0x120011, 0x0},
+       {0x220011, 0x0},
+       {0x0100ae, 0x0},
+       {0x1100ae, 0x0},
+       {0x2100ae, 0x0},
+       {0x0100af, 0x0},
+       {0x1100af, 0x0},
+       {0x2100af, 0x0},
+       {0x0110ae, 0x0},
+       {0x1110ae, 0x0},
+       {0x2110ae, 0x0},
+       {0x0110af, 0x0},
+       {0x1110af, 0x0},
+       {0x2110af, 0x0},
+       {0x020020, 0x0},
+       {0x120020, 0x0},
+       {0x220020, 0x0},
+       {0x0100a0, 0x0},
+       {0x0100a1, 0x0},
+       {0x0100a2, 0x0},
+       {0x0100a3, 0x0},
+       {0x0100a4, 0x0},
+       {0x0100a5, 0x0},
+       {0x0100a6, 0x0},
+       {0x0100a7, 0x0},
+       {0x0110a0, 0x0},
+       {0x0110a1, 0x0},
+       {0x0110a2, 0x0},
+       {0x0110a3, 0x0},
+       {0x0110a4, 0x0},
+       {0x0110a5, 0x0},
+       {0x0110a6, 0x0},
+       {0x0110a7, 0x0},
+       {0x02007c, 0x0},
+       {0x12007c, 0x0},
+       {0x22007c, 0x0},
+       {0x02007d, 0x0},
+       {0x12007d, 0x0},
+       {0x22007d, 0x0},
+       {0x0400fd, 0x0},
+       {0x0400c0, 0x0},
+       {0x090201, 0x0},
+       {0x190201, 0x0},
+       {0x290201, 0x0},
+       {0x090202, 0x0},
+       {0x190202, 0x0},
+       {0x290202, 0x0},
+       {0x090203, 0x0},
+       {0x190203, 0x0},
+       {0x290203, 0x0},
+       {0x090204, 0x0},
+       {0x190204, 0x0},
+       {0x290204, 0x0},
+       {0x090205, 0x0},
+       {0x190205, 0x0},
+       {0x290205, 0x0},
+       {0x090206, 0x0},
+       {0x190206, 0x0},
+       {0x290206, 0x0},
+       {0x090207, 0x0},
+       {0x190207, 0x0},
+       {0x290207, 0x0},
+       {0x090208, 0x0},
+       {0x190208, 0x0},
+       {0x290208, 0x0},
+       {0x010062, 0x0},
+       {0x010162, 0x0},
+       {0x010262, 0x0},
+       {0x010362, 0x0},
+       {0x010462, 0x0},
+       {0x010562, 0x0},
+       {0x010662, 0x0},
+       {0x010762, 0x0},
+       {0x010862, 0x0},
+       {0x011062, 0x0},
+       {0x011162, 0x0},
+       {0x011262, 0x0},
+       {0x011362, 0x0},
+       {0x011462, 0x0},
+       {0x011562, 0x0},
+       {0x011662, 0x0},
+       {0x011762, 0x0},
+       {0x011862, 0x0},
+       {0x020077, 0x0},
+       {0x010001, 0x0},
+       {0x011001, 0x0},
+       {0x010040, 0x0},
+       {0x010140, 0x0},
+       {0x010240, 0x0},
+       {0x010340, 0x0},
+       {0x010440, 0x0},
+       {0x010540, 0x0},
+       {0x010640, 0x0},
+       {0x010740, 0x0},
+       {0x010840, 0x0},
+       {0x010030, 0x0},
+       {0x010130, 0x0},
+       {0x010230, 0x0},
+       {0x010330, 0x0},
+       {0x010430, 0x0},
+       {0x010530, 0x0},
+       {0x010630, 0x0},
+       {0x010730, 0x0},
+       {0x010830, 0x0},
+       {0x011040, 0x0},
+       {0x011140, 0x0},
+       {0x011240, 0x0},
+       {0x011340, 0x0},
+       {0x011440, 0x0},
+       {0x011540, 0x0},
+       {0x011640, 0x0},
+       {0x011740, 0x0},
+       {0x011840, 0x0},
+       {0x011030, 0x0},
+       {0x011130, 0x0},
+       {0x011230, 0x0},
+       {0x011330, 0x0},
+       {0x011430, 0x0},
+       {0x011530, 0x0},
+       {0x011630, 0x0},
+       {0x011730, 0x0},
+       {0x011830, 0x0},
+};
+
+/* P0 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp0_cfg[] = {
+       {0x000d0000, 0x00000000},
+       {0x00054000, 0x00000000},
+       {0x00054001, 0x00000000},
+       {0x00054002, 0x00000000},
+       {0x00054003, 0x00000c80},
+       {0x00054004, 0x00000002},
+       {0x00054005, 0x00000000},
+       {0x00054006, 0x00000011},
+       {0x00054007, 0x00000000},
+       {0x00054008, 0x0000131f},
+       {0x00054009, 0x000000c8},
+       {0x0005400a, 0x00000000},
+       {0x0005400b, 0x00000002},
+       {0x0005400c, 0x00000000},
+       {0x0005400d, 0x00000000},
+       {0x0005400e, 0x00000000},
+       {0x0005400f, 0x00000100},
+       {0x00054010, 0x00000000},
+       {0x00054011, 0x00000000},
+       {0x00054012, 0x00000310},
+       {0x00054013, 0x00000000},
+       {0x00054014, 0x00000000},
+       {0x00054015, 0x00000000},
+       {0x00054016, 0x00000000},
+       {0x00054017, 0x00000000},
+       {0x00054018, 0x00000000},
+       {0x00054019, 0x00002dd4},
+       {0x0005401a, 0x00000031},
+       {0x0005401b, 0x00004d66},
+       {0x0005401c, 0x00004a00},
+       {0x0005401d, 0x00000000},
+       {0x0005401e, 0x00000016},
+       {0x0005401f, 0x00002dd4},
+       {0x00054020, 0x00000031},
+       {0x00054021, 0x00004d66},
+       {0x00054022, 0x00004a00},
+       {0x00054023, 0x00000000},
+       {0x00054024, 0x0000002e},
+       {0x00054025, 0x00000000},
+       {0x00054026, 0x00000000},
+       {0x00054027, 0x00000000},
+       {0x00054028, 0x00000000},
+       {0x00054029, 0x00000000},
+       {0x0005402a, 0x00000000},
+       {0x0005402b, 0x00000000},
+       {0x0005402c, 0x00000000},
+       {0x0005402d, 0x00000000},
+       {0x0005402e, 0x00000000},
+       {0x0005402f, 0x00000000},
+       {0x00054030, 0x00000000},
+       {0x00054031, 0x00000000},
+       {0x00054032, 0x0000d400},
+       {0x00054033, 0x0000312d},
+       {0x00054034, 0x00006600},
+       {0x00054035, 0x0000004d},
+       {0x00054036, 0x0000004a},
+       {0x00054037, 0x00001600},
+       {0x00054038, 0x0000d400},
+       {0x00054039, 0x0000312d},
+       {0x0005403a, 0x00006600},
+       {0x0005403b, 0x0000004d},
+       {0x0005403c, 0x0000004a},
+       {0x0005403d, 0x00002e00},
+       {0x0005403e, 0x00000000},
+       {0x0005403f, 0x00000000},
+       {0x00054040, 0x00000000},
+       {0x00054041, 0x00000000},
+       {0x00054042, 0x00000000},
+       {0x00054043, 0x00000000},
+       {0x00054044, 0x00000000},
+       {0x000d0000, 0x00000001},
+};
+
+/* P1 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp1_cfg[] = {
+       {0x000d0000, 0x00000000},
+       {0x00054000, 0x00000000},
+       {0x00054001, 0x00000000},
+       {0x00054002, 0x00000101},
+       {0x00054003, 0x00000190},
+       {0x00054004, 0x00000002},
+       {0x00054005, 0x00000000},
+       {0x00054006, 0x00000011},
+       {0x00054007, 0x00000000},
+       {0x00054008, 0x0000121f},
+       {0x00054009, 0x000000c8},
+       {0x0005400a, 0x00000000},
+       {0x0005400b, 0x00000002},
+       {0x0005400c, 0x00000000},
+       {0x0005400d, 0x00000000},
+       {0x0005400e, 0x00000000},
+       {0x0005400f, 0x00000100},
+       {0x00054010, 0x00000000},
+       {0x00054011, 0x00000000},
+       {0x00054012, 0x00000310},
+       {0x00054013, 0x00000000},
+       {0x00054014, 0x00000000},
+       {0x00054015, 0x00000000},
+       {0x00054016, 0x00000000},
+       {0x00054017, 0x00000000},
+       {0x00054018, 0x00000000},
+       {0x00054019, 0x00000084},
+       {0x0005401a, 0x00000031},
+       {0x0005401b, 0x00004d66},
+       {0x0005401c, 0x00004a00},
+       {0x0005401d, 0x00000000},
+       {0x0005401e, 0x00000016},
+       {0x0005401f, 0x00000084},
+       {0x00054020, 0x00000031},
+       {0x00054021, 0x00004d66},
+       {0x00054022, 0x00004a00},
+       {0x00054023, 0x00000000},
+       {0x00054024, 0x0000002e},
+       {0x00054025, 0x00000000},
+       {0x00054026, 0x00000000},
+       {0x00054027, 0x00000000},
+       {0x00054028, 0x00000000},
+       {0x00054029, 0x00000000},
+       {0x0005402a, 0x00000000},
+       {0x0005402b, 0x00000000},
+       {0x0005402c, 0x00000000},
+       {0x0005402d, 0x00000000},
+       {0x0005402e, 0x00000000},
+       {0x0005402f, 0x00000000},
+       {0x00054030, 0x00000000},
+       {0x00054031, 0x00000000},
+       {0x00054032, 0x00008400},
+       {0x00054033, 0x00003100},
+       {0x00054034, 0x00006600},
+       {0x00054035, 0x0000004d},
+       {0x00054036, 0x0000004a},
+       {0x00054037, 0x00001600},
+       {0x00054038, 0x00008400},
+       {0x00054039, 0x00003100},
+       {0x0005403a, 0x00006600},
+       {0x0005403b, 0x0000004d},
+       {0x0005403c, 0x0000004a},
+       {0x0005403d, 0x00002e00},
+       {0x0005403e, 0x00000000},
+       {0x0005403f, 0x00000000},
+       {0x00054040, 0x00000000},
+       {0x00054041, 0x00000000},
+       {0x00054042, 0x00000000},
+       {0x00054043, 0x00000000},
+       {0x00054044, 0x00000000},
+       {0x000d0000, 0x00000001},
+};
+
+/* P2 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp2_cfg[] = {
+       {0x000d0000, 0x00000000},
+       {0x00054000, 0x00000000},
+       {0x00054001, 0x00000000},
+       {0x00054002, 0x00000102},
+       {0x00054003, 0x00000064},
+       {0x00054004, 0x00000002},
+       {0x00054005, 0x00000000},
+       {0x00054006, 0x00000011},
+       {0x00054007, 0x00000000},
+       {0x00054008, 0x0000121f},
+       {0x00054009, 0x000000c8},
+       {0x0005400a, 0x00000000},
+       {0x0005400b, 0x00000002},
+       {0x0005400c, 0x00000000},
+       {0x0005400d, 0x00000000},
+       {0x0005400e, 0x00000000},
+       {0x0005400f, 0x00000100},
+       {0x00054010, 0x00000000},
+       {0x00054011, 0x00000000},
+       {0x00054012, 0x00000310},
+       {0x00054013, 0x00000000},
+       {0x00054014, 0x00000000},
+       {0x00054015, 0x00000000},
+       {0x00054016, 0x00000000},
+       {0x00054017, 0x00000000},
+       {0x00054018, 0x00000000},
+       {0x00054019, 0x00000084},
+       {0x0005401a, 0x00000031},
+       {0x0005401b, 0x00004d66},
+       {0x0005401c, 0x00004a00},
+       {0x0005401d, 0x00000000},
+       {0x0005401e, 0x00000016},
+       {0x0005401f, 0x00000084},
+       {0x00054020, 0x00000031},
+       {0x00054021, 0x00004d66},
+       {0x00054022, 0x00004a00},
+       {0x00054023, 0x00000000},
+       {0x00054024, 0x0000002e},
+       {0x00054025, 0x00000000},
+       {0x00054026, 0x00000000},
+       {0x00054027, 0x00000000},
+       {0x00054028, 0x00000000},
+       {0x00054029, 0x00000000},
+       {0x0005402a, 0x00000000},
+       {0x0005402b, 0x00000000},
+       {0x0005402c, 0x00000000},
+       {0x0005402d, 0x00000000},
+       {0x0005402e, 0x00000000},
+       {0x0005402f, 0x00000000},
+       {0x00054030, 0x00000000},
+       {0x00054031, 0x00000000},
+       {0x00054032, 0x00008400},
+       {0x00054033, 0x00003100},
+       {0x00054034, 0x00006600},
+       {0x00054035, 0x0000004d},
+       {0x00054036, 0x0000004a},
+       {0x00054037, 0x00001600},
+       {0x00054038, 0x00008400},
+       {0x00054039, 0x00003100},
+       {0x0005403a, 0x00006600},
+       {0x0005403b, 0x0000004d},
+       {0x0005403c, 0x0000004a},
+       {0x0005403d, 0x00002e00},
+       {0x0005403e, 0x00000000},
+       {0x0005403f, 0x00000000},
+       {0x00054040, 0x00000000},
+       {0x00054041, 0x00000000},
+       {0x00054042, 0x00000000},
+       {0x00054043, 0x00000000},
+       {0x00054044, 0x00000000},
+       {0x000d0000, 0x00000001},
+};
+
+/* P0 2D message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
+       {0x000d0000, 0x00000000},
+       {0x00054000, 0x00000000},
+       {0x00054001, 0x00000000},
+       {0x00054002, 0x00000000},
+       {0x00054003, 0x00000c80},
+       {0x00054004, 0x00000002},
+       {0x00054005, 0x00000000},
+       {0x00054006, 0x00000011},
+       {0x00054007, 0x00000000},
+       {0x00054008, 0x00000061},
+       {0x00054009, 0x000000c8},
+       {0x0005400a, 0x00000000},
+       {0x0005400b, 0x00000002},
+       {0x0005400c, 0x00000000},
+       {0x0005400d, 0x00000000},
+       {0x0005400e, 0x00000000},
+       {0x0005400f, 0x00000100},
+       {0x00054010, 0x00001f7f},
+       {0x00054011, 0x00000000},
+       {0x00054012, 0x00000310},
+       {0x00054013, 0x00000000},
+       {0x00054014, 0x00000000},
+       {0x00054015, 0x00000000},
+       {0x00054016, 0x00000000},
+       {0x00054017, 0x00000000},
+       {0x00054018, 0x00000000},
+       {0x00054019, 0x00002dd4},
+       {0x0005401a, 0x00000031},
+       {0x0005401b, 0x00004d66},
+       {0x0005401c, 0x00004a00},
+       {0x0005401d, 0x00000000},
+       {0x0005401e, 0x00000016},
+       {0x0005401f, 0x00002dd4},
+       {0x00054020, 0x00000031},
+       {0x00054021, 0x00004d66},
+       {0x00054022, 0x00004a00},
+       {0x00054023, 0x00000000},
+       {0x00054024, 0x0000002e},
+       {0x00054025, 0x00000000},
+       {0x00054026, 0x00000000},
+       {0x00054027, 0x00000000},
+       {0x00054028, 0x00000000},
+       {0x00054029, 0x00000000},
+       {0x0005402a, 0x00000000},
+       {0x0005402b, 0x00000000},
+       {0x0005402c, 0x00000000},
+       {0x0005402d, 0x00000000},
+       {0x0005402e, 0x00000000},
+       {0x0005402f, 0x00000000},
+       {0x00054030, 0x00000000},
+       {0x00054031, 0x00000000},
+       {0x00054032, 0x0000d400},
+       {0x00054033, 0x0000312d},
+       {0x00054034, 0x00006600},
+       {0x00054035, 0x0000004d},
+       {0x00054036, 0x0000004a},
+       {0x00054037, 0x00001600},
+       {0x00054038, 0x0000d400},
+       {0x00054039, 0x0000312d},
+       {0x0005403a, 0x00006600},
+       {0x0005403b, 0x0000004d},
+       {0x0005403c, 0x0000004a},
+       {0x0005403d, 0x00002e00},
+       {0x0005403e, 0x00000000},
+       {0x0005403f, 0x00000000},
+       {0x00054040, 0x00000000},
+       {0x00054041, 0x00000000},
+       {0x00054042, 0x00000000},
+       {0x00054043, 0x00000000},
+       {0x00054044, 0x00000000},
+       {0x000d0000, 0x00000001},
+};
+
+/* DRAM PHY init engine image */
+struct dram_cfg_param ddr_phy_pie[] = {
+       {0xd0000, 0x0},
+       {0x90000, 0x10},
+       {0x90001, 0x400},
+       {0x90002, 0x10e},
+       {0x90003, 0x0},
+       {0x90004, 0x0},
+       {0x90005, 0x8},
+       {0x90029, 0xb},
+       {0x9002a, 0x480},
+       {0x9002b, 0x109},
+       {0x9002c, 0x8},
+       {0x9002d, 0x448},
+       {0x9002e, 0x139},
+       {0x9002f, 0x8},
+       {0x90030, 0x478},
+       {0x90031, 0x109},
+       {0x90032, 0x0},
+       {0x90033, 0xe8},
+       {0x90034, 0x109},
+       {0x90035, 0x2},
+       {0x90036, 0x10},
+       {0x90037, 0x139},
+       {0x90038, 0xb},
+       {0x90039, 0x7c0},
+       {0x9003a, 0x139},
+       {0x9003b, 0x44},
+       {0x9003c, 0x633},
+       {0x9003d, 0x159},
+       {0x9003e, 0x14f},
+       {0x9003f, 0x630},
+       {0x90040, 0x159},
+       {0x90041, 0x47},
+       {0x90042, 0x633},
+       {0x90043, 0x149},
+       {0x90044, 0x4f},
+       {0x90045, 0x633},
+       {0x90046, 0x179},
+       {0x90047, 0x8},
+       {0x90048, 0xe0},
+       {0x90049, 0x109},
+       {0x9004a, 0x0},
+       {0x9004b, 0x7c8},
+       {0x9004c, 0x109},
+       {0x9004d, 0x0},
+       {0x9004e, 0x1},
+       {0x9004f, 0x8},
+       {0x90050, 0x0},
+       {0x90051, 0x45a},
+       {0x90052, 0x9},
+       {0x90053, 0x0},
+       {0x90054, 0x448},
+       {0x90055, 0x109},
+       {0x90056, 0x40},
+       {0x90057, 0x633},
+       {0x90058, 0x179},
+       {0x90059, 0x1},
+       {0x9005a, 0x618},
+       {0x9005b, 0x109},
+       {0x9005c, 0x40c0},
+       {0x9005d, 0x633},
+       {0x9005e, 0x149},
+       {0x9005f, 0x8},
+       {0x90060, 0x4},
+       {0x90061, 0x48},
+       {0x90062, 0x4040},
+       {0x90063, 0x633},
+       {0x90064, 0x149},
+       {0x90065, 0x0},
+       {0x90066, 0x4},
+       {0x90067, 0x48},
+       {0x90068, 0x40},
+       {0x90069, 0x633},
+       {0x9006a, 0x149},
+       {0x9006b, 0x10},
+       {0x9006c, 0x4},
+       {0x9006d, 0x18},
+       {0x9006e, 0x0},
+       {0x9006f, 0x4},
+       {0x90070, 0x78},
+       {0x90071, 0x549},
+       {0x90072, 0x633},
+       {0x90073, 0x159},
+       {0x90074, 0xd49},
+       {0x90075, 0x633},
+       {0x90076, 0x159},
+       {0x90077, 0x94a},
+       {0x90078, 0x633},
+       {0x90079, 0x159},
+       {0x9007a, 0x441},
+       {0x9007b, 0x633},
+       {0x9007c, 0x149},
+       {0x9007d, 0x42},
+       {0x9007e, 0x633},
+       {0x9007f, 0x149},
+       {0x90080, 0x1},
+       {0x90081, 0x633},
+       {0x90082, 0x149},
+       {0x90083, 0x0},
+       {0x90084, 0xe0},
+       {0x90085, 0x109},
+       {0x90086, 0xa},
+       {0x90087, 0x10},
+       {0x90088, 0x109},
+       {0x90089, 0x9},
+       {0x9008a, 0x3c0},
+       {0x9008b, 0x149},
+       {0x9008c, 0x9},
+       {0x9008d, 0x3c0},
+       {0x9008e, 0x159},
+       {0x9008f, 0x18},
+       {0x90090, 0x10},
+       {0x90091, 0x109},
+       {0x90092, 0x0},
+       {0x90093, 0x3c0},
+       {0x90094, 0x109},
+       {0x90095, 0x18},
+       {0x90096, 0x4},
+       {0x90097, 0x48},
+       {0x90098, 0x18},
+       {0x90099, 0x4},
+       {0x9009a, 0x58},
+       {0x9009b, 0xb},
+       {0x9009c, 0x10},
+       {0x9009d, 0x109},
+       {0x9009e, 0x1},
+       {0x9009f, 0x10},
+       {0x900a0, 0x109},
+       {0x900a1, 0x5},
+       {0x900a2, 0x7c0},
+       {0x900a3, 0x109},
+       {0x40000, 0x811},
+       {0x40020, 0x880},
+       {0x40040, 0x0},
+       {0x40060, 0x0},
+       {0x40001, 0x4008},
+       {0x40021, 0x83},
+       {0x40041, 0x4f},
+       {0x40061, 0x0},
+       {0x40002, 0x4040},
+       {0x40022, 0x83},
+       {0x40042, 0x51},
+       {0x40062, 0x0},
+       {0x40003, 0x811},
+       {0x40023, 0x880},
+       {0x40043, 0x0},
+       {0x40063, 0x0},
+       {0x40004, 0x720},
+       {0x40024, 0xf},
+       {0x40044, 0x1740},
+       {0x40064, 0x0},
+       {0x40005, 0x16},
+       {0x40025, 0x83},
+       {0x40045, 0x4b},
+       {0x40065, 0x0},
+       {0x40006, 0x716},
+       {0x40026, 0xf},
+       {0x40046, 0x2001},
+       {0x40066, 0x0},
+       {0x40007, 0x716},
+       {0x40027, 0xf},
+       {0x40047, 0x2800},
+       {0x40067, 0x0},
+       {0x40008, 0x716},
+       {0x40028, 0xf},
+       {0x40048, 0xf00},
+       {0x40068, 0x0},
+       {0x40009, 0x720},
+       {0x40029, 0xf},
+       {0x40049, 0x1400},
+       {0x40069, 0x0},
+       {0x4000a, 0xe08},
+       {0x4002a, 0xc15},
+       {0x4004a, 0x0},
+       {0x4006a, 0x0},
+       {0x4000b, 0x625},
+       {0x4002b, 0x15},
+       {0x4004b, 0x0},
+       {0x4006b, 0x0},
+       {0x4000c, 0x4028},
+       {0x4002c, 0x80},
+       {0x4004c, 0x0},
+       {0x4006c, 0x0},
+       {0x4000d, 0xe08},
+       {0x4002d, 0xc1a},
+       {0x4004d, 0x0},
+       {0x4006d, 0x0},
+       {0x4000e, 0x625},
+       {0x4002e, 0x1a},
+       {0x4004e, 0x0},
+       {0x4006e, 0x0},
+       {0x4000f, 0x4040},
+       {0x4002f, 0x80},
+       {0x4004f, 0x0},
+       {0x4006f, 0x0},
+       {0x40010, 0x2604},
+       {0x40030, 0x15},
+       {0x40050, 0x0},
+       {0x40070, 0x0},
+       {0x40011, 0x708},
+       {0x40031, 0x5},
+       {0x40051, 0x0},
+       {0x40071, 0x2002},
+       {0x40012, 0x8},
+       {0x40032, 0x80},
+       {0x40052, 0x0},
+       {0x40072, 0x0},
+       {0x40013, 0x2604},
+       {0x40033, 0x1a},
+       {0x40053, 0x0},
+       {0x40073, 0x0},
+       {0x40014, 0x708},
+       {0x40034, 0xa},
+       {0x40054, 0x0},
+       {0x40074, 0x2002},
+       {0x40015, 0x4040},
+       {0x40035, 0x80},
+       {0x40055, 0x0},
+       {0x40075, 0x0},
+       {0x40016, 0x60a},
+       {0x40036, 0x15},
+       {0x40056, 0x1200},
+       {0x40076, 0x0},
+       {0x40017, 0x61a},
+       {0x40037, 0x15},
+       {0x40057, 0x1300},
+       {0x40077, 0x0},
+       {0x40018, 0x60a},
+       {0x40038, 0x1a},
+       {0x40058, 0x1200},
+       {0x40078, 0x0},
+       {0x40019, 0x642},
+       {0x40039, 0x1a},
+       {0x40059, 0x1300},
+       {0x40079, 0x0},
+       {0x4001a, 0x4808},
+       {0x4003a, 0x880},
+       {0x4005a, 0x0},
+       {0x4007a, 0x0},
+       {0x900a4, 0x0},
+       {0x900a5, 0x790},
+       {0x900a6, 0x11a},
+       {0x900a7, 0x8},
+       {0x900a8, 0x7aa},
+       {0x900a9, 0x2a},
+       {0x900aa, 0x10},
+       {0x900ab, 0x7b2},
+       {0x900ac, 0x2a},
+       {0x900ad, 0x0},
+       {0x900ae, 0x7c8},
+       {0x900af, 0x109},
+       {0x900b0, 0x10},
+       {0x900b1, 0x10},
+       {0x900b2, 0x109},
+       {0x900b3, 0x10},
+       {0x900b4, 0x2a8},
+       {0x900b5, 0x129},
+       {0x900b6, 0x8},
+       {0x900b7, 0x370},
+       {0x900b8, 0x129},
+       {0x900b9, 0xa},
+       {0x900ba, 0x3c8},
+       {0x900bb, 0x1a9},
+       {0x900bc, 0xc},
+       {0x900bd, 0x408},
+       {0x900be, 0x199},
+       {0x900bf, 0x14},
+       {0x900c0, 0x790},
+       {0x900c1, 0x11a},
+       {0x900c2, 0x8},
+       {0x900c3, 0x4},
+       {0x900c4, 0x18},
+       {0x900c5, 0xe},
+       {0x900c6, 0x408},
+       {0x900c7, 0x199},
+       {0x900c8, 0x8},
+       {0x900c9, 0x8568},
+       {0x900ca, 0x108},
+       {0x900cb, 0x18},
+       {0x900cc, 0x790},
+       {0x900cd, 0x16a},
+       {0x900ce, 0x8},
+       {0x900cf, 0x1d8},
+       {0x900d0, 0x169},
+       {0x900d1, 0x10},
+       {0x900d2, 0x8558},
+       {0x900d3, 0x168},
+       {0x900d4, 0x70},
+       {0x900d5, 0x788},
+       {0x900d6, 0x16a},
+       {0x900d7, 0x1ff8},
+       {0x900d8, 0x85a8},
+       {0x900d9, 0x1e8},
+       {0x900da, 0x50},
+       {0x900db, 0x798},
+       {0x900dc, 0x16a},
+       {0x900dd, 0x60},
+       {0x900de, 0x7a0},
+       {0x900df, 0x16a},
+       {0x900e0, 0x8},
+       {0x900e1, 0x8310},
+       {0x900e2, 0x168},
+       {0x900e3, 0x8},
+       {0x900e4, 0xa310},
+       {0x900e5, 0x168},
+       {0x900e6, 0xa},
+       {0x900e7, 0x408},
+       {0x900e8, 0x169},
+       {0x900e9, 0x6e},
+       {0x900ea, 0x0},
+       {0x900eb, 0x68},
+       {0x900ec, 0x0},
+       {0x900ed, 0x408},
+       {0x900ee, 0x169},
+       {0x900ef, 0x0},
+       {0x900f0, 0x8310},
+       {0x900f1, 0x168},
+       {0x900f2, 0x0},
+       {0x900f3, 0xa310},
+       {0x900f4, 0x168},
+       {0x900f5, 0x1ff8},
+       {0x900f6, 0x85a8},
+       {0x900f7, 0x1e8},
+       {0x900f8, 0x68},
+       {0x900f9, 0x798},
+       {0x900fa, 0x16a},
+       {0x900fb, 0x78},
+       {0x900fc, 0x7a0},
+       {0x900fd, 0x16a},
+       {0x900fe, 0x68},
+       {0x900ff, 0x790},
+       {0x90100, 0x16a},
+       {0x90101, 0x8},
+       {0x90102, 0x8b10},
+       {0x90103, 0x168},
+       {0x90104, 0x8},
+       {0x90105, 0xab10},
+       {0x90106, 0x168},
+       {0x90107, 0xa},
+       {0x90108, 0x408},
+       {0x90109, 0x169},
+       {0x9010a, 0x58},
+       {0x9010b, 0x0},
+       {0x9010c, 0x68},
+       {0x9010d, 0x0},
+       {0x9010e, 0x408},
+       {0x9010f, 0x169},
+       {0x90110, 0x0},
+       {0x90111, 0x8b10},
+       {0x90112, 0x168},
+       {0x90113, 0x1},
+       {0x90114, 0xab10},
+       {0x90115, 0x168},
+       {0x90116, 0x0},
+       {0x90117, 0x1d8},
+       {0x90118, 0x169},
+       {0x90119, 0x80},
+       {0x9011a, 0x790},
+       {0x9011b, 0x16a},
+       {0x9011c, 0x18},
+       {0x9011d, 0x7aa},
+       {0x9011e, 0x6a},
+       {0x9011f, 0xa},
+       {0x90120, 0x0},
+       {0x90121, 0x1e9},
+       {0x90122, 0x8},
+       {0x90123, 0x8080},
+       {0x90124, 0x108},
+       {0x90125, 0xf},
+       {0x90126, 0x408},
+       {0x90127, 0x169},
+       {0x90128, 0xc},
+       {0x90129, 0x0},
+       {0x9012a, 0x68},
+       {0x9012b, 0x9},
+       {0x9012c, 0x0},
+       {0x9012d, 0x1a9},
+       {0x9012e, 0x0},
+       {0x9012f, 0x408},
+       {0x90130, 0x169},
+       {0x90131, 0x0},
+       {0x90132, 0x8080},
+       {0x90133, 0x108},
+       {0x90134, 0x8},
+       {0x90135, 0x7aa},
+       {0x90136, 0x6a},
+       {0x90137, 0x0},
+       {0x90138, 0x8568},
+       {0x90139, 0x108},
+       {0x9013a, 0xb7},
+       {0x9013b, 0x790},
+       {0x9013c, 0x16a},
+       {0x9013d, 0x1f},
+       {0x9013e, 0x0},
+       {0x9013f, 0x68},
+       {0x90140, 0x8},
+       {0x90141, 0x8558},
+       {0x90142, 0x168},
+       {0x90143, 0xf},
+       {0x90144, 0x408},
+       {0x90145, 0x169},
+       {0x90146, 0xd},
+       {0x90147, 0x0},
+       {0x90148, 0x68},
+       {0x90149, 0x0},
+       {0x9014a, 0x408},
+       {0x9014b, 0x169},
+       {0x9014c, 0x0},
+       {0x9014d, 0x8558},
+       {0x9014e, 0x168},
+       {0x9014f, 0x8},
+       {0x90150, 0x3c8},
+       {0x90151, 0x1a9},
+       {0x90152, 0x3},
+       {0x90153, 0x370},
+       {0x90154, 0x129},
+       {0x90155, 0x20},
+       {0x90156, 0x2aa},
+       {0x90157, 0x9},
+       {0x90158, 0x0},
+       {0x90159, 0x400},
+       {0x9015a, 0x10e},
+       {0x9015b, 0x8},
+       {0x9015c, 0xe8},
+       {0x9015d, 0x109},
+       {0x9015e, 0x0},
+       {0x9015f, 0x8140},
+       {0x90160, 0x10c},
+       {0x90161, 0x10},
+       {0x90162, 0x8138},
+       {0x90163, 0x10c},
+       {0x90164, 0x8},
+       {0x90165, 0x7c8},
+       {0x90166, 0x101},
+       {0x90167, 0x8},
+       {0x90168, 0x448},
+       {0x90169, 0x109},
+       {0x9016a, 0xf},
+       {0x9016b, 0x7c0},
+       {0x9016c, 0x109},
+       {0x9016d, 0x0},
+       {0x9016e, 0xe8},
+       {0x9016f, 0x109},
+       {0x90170, 0x47},
+       {0x90171, 0x630},
+       {0x90172, 0x109},
+       {0x90173, 0x8},
+       {0x90174, 0x618},
+       {0x90175, 0x109},
+       {0x90176, 0x8},
+       {0x90177, 0xe0},
+       {0x90178, 0x109},
+       {0x90179, 0x0},
+       {0x9017a, 0x7c8},
+       {0x9017b, 0x109},
+       {0x9017c, 0x8},
+       {0x9017d, 0x8140},
+       {0x9017e, 0x10c},
+       {0x9017f, 0x0},
+       {0x90180, 0x1},
+       {0x90181, 0x8},
+       {0x90182, 0x8},
+       {0x90183, 0x4},
+       {0x90184, 0x8},
+       {0x90185, 0x8},
+       {0x90186, 0x7c8},
+       {0x90187, 0x101},
+       {0x90006, 0x0},
+       {0x90007, 0x0},
+       {0x90008, 0x8},
+       {0x90009, 0x0},
+       {0x9000a, 0x0},
+       {0x9000b, 0x0},
+       {0xd00e7, 0x400},
+       {0x90017, 0x0},
+       {0x9001f, 0x29},
+       {0x90026, 0x6a},
+       {0x400d0, 0x0},
+       {0x400d1, 0x101},
+       {0x400d2, 0x105},
+       {0x400d3, 0x107},
+       {0x400d4, 0x10f},
+       {0x400d5, 0x202},
+       {0x400d6, 0x20a},
+       {0x400d7, 0x20b},
+       {0x2003a, 0x2},
+       {0x2000b, 0x64},
+       {0x2000c, 0xc8},
+       {0x2000d, 0x7d0},
+       {0x2000e, 0x2c},
+       {0x12000b, 0xc},
+       {0x12000c, 0x19},
+       {0x12000d, 0xfa},
+       {0x12000e, 0x10},
+       {0x22000b, 0x3},
+       {0x22000c, 0x6},
+       {0x22000d, 0x3e},
+       {0x22000e, 0x10},
+       {0x9000c, 0x0},
+       {0x9000d, 0x173},
+       {0x9000e, 0x60},
+       {0x9000f, 0x6110},
+       {0x90010, 0x2152},
+       {0x90011, 0xdfbd},
+       {0x90012, 0x2060},
+       {0x90013, 0x6152},
+       {0x20010, 0x5a},
+       {0x20011, 0x3},
+       {0x40080, 0xe0},
+       {0x40081, 0x12},
+       {0x40082, 0xe0},
+       {0x40083, 0x12},
+       {0x40084, 0xe0},
+       {0x40085, 0x12},
+       {0x140080, 0xe0},
+       {0x140081, 0x12},
+       {0x140082, 0xe0},
+       {0x140083, 0x12},
+       {0x140084, 0xe0},
+       {0x140085, 0x12},
+       {0x240080, 0xe0},
+       {0x240081, 0x12},
+       {0x240082, 0xe0},
+       {0x240083, 0x12},
+       {0x240084, 0xe0},
+       {0x240085, 0x12},
+       {0x400fd, 0xf},
+       {0x10011, 0x1},
+       {0x10012, 0x1},
+       {0x10013, 0x180},
+       {0x10018, 0x1},
+       {0x10002, 0x6209},
+       {0x100b2, 0x1},
+       {0x101b4, 0x1},
+       {0x102b4, 0x1},
+       {0x103b4, 0x1},
+       {0x104b4, 0x1},
+       {0x105b4, 0x1},
+       {0x106b4, 0x1},
+       {0x107b4, 0x1},
+       {0x108b4, 0x1},
+       {0x11011, 0x1},
+       {0x11012, 0x1},
+       {0x11013, 0x180},
+       {0x11018, 0x1},
+       {0x11002, 0x6209},
+       {0x110b2, 0x1},
+       {0x111b4, 0x1},
+       {0x112b4, 0x1},
+       {0x113b4, 0x1},
+       {0x114b4, 0x1},
+       {0x115b4, 0x1},
+       {0x116b4, 0x1},
+       {0x117b4, 0x1},
+       {0x118b4, 0x1},
+       {0x20089, 0x1},
+       {0x20088, 0x19},
+       {0xc0080, 0x2},
+       {0xd0000, 0x1},
+};
+
+struct dram_fsp_msg ddr_dram_fsp_msg[] = {
+       {
+               /* P0 3200mts 1D */
+               .drate = 3200,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp0_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg),
+       },
+       {
+               /* P1 400mts 1D */
+               .drate = 400,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp1_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp1_cfg),
+       },
+       {
+               /* P2 100mts 1D */
+               .drate = 100,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp2_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp2_cfg),
+       },
+       {
+               /* P0 3200mts 2D */
+               .drate = 3200,
+               .fw_type = FW_2D_IMAGE,
+               .fsp_cfg = ddr_fsp0_2d_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_2d_cfg),
+       },
+};
+
+/* ddr timing config params */
+struct dram_timing_info dram_timing = {
+       .ddrc_cfg = ddr_ddrc_cfg,
+       .ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg),
+       .ddrphy_cfg = ddr_ddrphy_cfg,
+       .ddrphy_cfg_num = ARRAY_SIZE(ddr_ddrphy_cfg),
+       .fsp_msg = ddr_dram_fsp_msg,
+       .fsp_msg_num = ARRAY_SIZE(ddr_dram_fsp_msg),
+       .ddrphy_trained_csr = ddr_ddrphy_trained_csr,
+       .ddrphy_trained_csr_num = ARRAY_SIZE(ddr_ddrphy_trained_csr),
+       .ddrphy_pie = ddr_phy_pie,
+       .ddrphy_pie_num = ARRAY_SIZE(ddr_phy_pie),
+       .fsp_table = { 3200, 400, 100, },
+};
diff --git a/board/freescale/imx8mn_evk/lpddr4_timing_ld.c b/board/freescale/imx8mn_evk/lpddr4_timing_ld.c
new file mode 100644 (file)
index 0000000..aa23c35
--- /dev/null
@@ -0,0 +1,1440 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ *
+ * Generated code from MX8M_DDR_tool
+ * Align with uboot version:
+ * imx_v2018.03_4.14.78_1.0.0_ga ~ imx_v2018.04_4.19.35_1.1.0_ga
+ */
+
+#include <linux/kernel.h>
+#include <asm/arch/ddr.h>
+
+struct dram_cfg_param ddr_ddrc_cfg[] = {
+       /** Initialize DDRC registers **/
+       { 0x3d400304, 0x1 },
+       { 0x3d400030, 0x1 },
+       { 0x3d400000, 0xa3080020 },
+       { 0x3d400020, 0x111 },
+       { 0x3d400024, 0x1f400 },
+       { 0x3d400064, 0x300070 },
+       { 0x3d4000d0, 0xc002030f },
+       { 0x3d4000d4, 0x500000 },
+       { 0x3d4000dc, 0xa40012 },
+       { 0x3d4000e0, 0x310000 },
+       { 0x3d4000e8, 0x66004d },
+       { 0x3d4000ec, 0x16004d },
+       { 0x3d400100, 0x10100d11 },
+       { 0x3d400104, 0x3041a },
+       { 0x3d40010c, 0x606000 },
+       { 0x3d400110, 0x8040408 },
+       { 0x3d400114, 0x2030606 },
+       { 0x3d400118, 0x1010004 },
+       { 0x3d40011c, 0x301 },
+       { 0x3d400130, 0x20300 },
+       { 0x3d400134, 0xa100002 },
+       { 0x3d400138, 0x73 },
+       { 0x3d400144, 0x500028 },
+       { 0x3d400180, 0x190000c },
+       { 0x3d400184, 0x14030d4 },
+       { 0x3d400188, 0x0 },
+       { 0x3d400190, 0x4898204 },
+       { 0x3d400194, 0x80303 },
+       { 0x3d4001b4, 0x904 },
+       { 0x3d4001a0, 0xe0400018 },
+       { 0x3d4001a4, 0xdf00e4 },
+       { 0x3d4001a8, 0x80000000 },
+       { 0x3d4001b0, 0x11 },
+       { 0x3d4001c0, 0x1 },
+       { 0x3d4001c4, 0x1 },
+       { 0x3d4000f4, 0xc99 },
+       { 0x3d400108, 0x4070f0f },
+       { 0x3d400200, 0x17 },
+       { 0x3d40020c, 0x0 },
+       { 0x3d400210, 0x1f1f },
+       { 0x3d400204, 0x80808 },
+       { 0x3d400214, 0x7070707 },
+       { 0x3d400218, 0x7070707 },
+       { 0x3d400250, 0x29001701 },
+       { 0x3d400254, 0x2c },
+       { 0x3d40025c, 0x4000030 },
+       { 0x3d400264, 0x900093e7 },
+       { 0x3d40026c, 0x2005574 },
+       { 0x3d400400, 0x111 },
+       { 0x3d400408, 0x72ff },
+       { 0x3d400494, 0x2100e07 },
+       { 0x3d400498, 0x620096 },
+       { 0x3d40049c, 0x1100e07 },
+       { 0x3d4004a0, 0xc8012c },
+       { 0x3d402020, 0x11 },
+       { 0x3d402024, 0x7d00 },
+       { 0x3d402050, 0x20d040 },
+       { 0x3d402064, 0xc001c },
+       { 0x3d4020dc, 0x840000 },
+       { 0x3d4020e0, 0x310000 },
+       { 0x3d4020e8, 0x66004d },
+       { 0x3d4020ec, 0x16004d },
+       { 0x3d402100, 0xa040305 },
+       { 0x3d402104, 0x30407 },
+       { 0x3d402108, 0x203060b },
+       { 0x3d40210c, 0x505000 },
+       { 0x3d402110, 0x2040202 },
+       { 0x3d402114, 0x2030202 },
+       { 0x3d402118, 0x1010004 },
+       { 0x3d40211c, 0x301 },
+       { 0x3d402130, 0x20300 },
+       { 0x3d402134, 0xa100002 },
+       { 0x3d402138, 0x1d },
+       { 0x3d402144, 0x14000a },
+       { 0x3d402180, 0x640004 },
+       { 0x3d402190, 0x3818200 },
+       { 0x3d402194, 0x80303 },
+       { 0x3d4021b4, 0x100 },
+       { 0x3d4020f4, 0xc99 },
+       { 0x3d403020, 0x11 },
+       { 0x3d403024, 0x1f40 },
+       { 0x3d403050, 0x20d040 },
+       { 0x3d403064, 0x30007 },
+       { 0x3d4030dc, 0x840000 },
+       { 0x3d4030e0, 0x310000 },
+       { 0x3d4030e8, 0x66004d },
+       { 0x3d4030ec, 0x16004d },
+       { 0x3d403100, 0xa010102 },
+       { 0x3d403104, 0x30404 },
+       { 0x3d403108, 0x203060b },
+       { 0x3d40310c, 0x505000 },
+       { 0x3d403110, 0x2040202 },
+       { 0x3d403114, 0x2030202 },
+       { 0x3d403118, 0x1010004 },
+       { 0x3d40311c, 0x301 },
+       { 0x3d403130, 0x20300 },
+       { 0x3d403134, 0xa100002 },
+       { 0x3d403138, 0x8 },
+       { 0x3d403144, 0x50003 },
+       { 0x3d403180, 0x190004 },
+       { 0x3d403190, 0x3818200 },
+       { 0x3d403194, 0x80303 },
+       { 0x3d4031b4, 0x100 },
+       { 0x3d4030f4, 0xc99 },
+       { 0x3d400028, 0x0 },
+};
+
+/* PHY Initialize Configuration */
+struct dram_cfg_param ddr_ddrphy_cfg[] = {
+       { 0x100a0, 0x0 },
+       { 0x100a1, 0x1 },
+       { 0x100a2, 0x2 },
+       { 0x100a3, 0x3 },
+       { 0x100a4, 0x4 },
+       { 0x100a5, 0x5 },
+       { 0x100a6, 0x6 },
+       { 0x100a7, 0x7 },
+       { 0x110a0, 0x0 },
+       { 0x110a1, 0x1 },
+       { 0x110a2, 0x3 },
+       { 0x110a3, 0x4 },
+       { 0x110a4, 0x5 },
+       { 0x110a5, 0x2 },
+       { 0x110a6, 0x7 },
+       { 0x110a7, 0x6 },
+       { 0x1005f, 0x1ff },
+       { 0x1015f, 0x1ff },
+       { 0x1105f, 0x1ff },
+       { 0x1115f, 0x1ff },
+       { 0x11005f, 0x1ff },
+       { 0x11015f, 0x1ff },
+       { 0x11105f, 0x1ff },
+       { 0x11115f, 0x1ff },
+       { 0x21005f, 0x1ff },
+       { 0x21015f, 0x1ff },
+       { 0x21105f, 0x1ff },
+       { 0x21115f, 0x1ff },
+       { 0x55, 0x1ff },
+       { 0x1055, 0x1ff },
+       { 0x2055, 0x1ff },
+       { 0x3055, 0x1ff },
+       { 0x4055, 0x1ff },
+       { 0x5055, 0x1ff },
+       { 0x6055, 0x1ff },
+       { 0x7055, 0x1ff },
+       { 0x8055, 0x1ff },
+       { 0x9055, 0x1ff },
+       { 0x200c5, 0xb },
+       { 0x1200c5, 0x7 },
+       { 0x2200c5, 0x7 },
+       { 0x2002e, 0x1 },
+       { 0x12002e, 0x2 },
+       { 0x22002e, 0x2 },
+       { 0x90204, 0x0 },
+       { 0x190204, 0x0 },
+       { 0x290204, 0x0 },
+       { 0x20024, 0x1a3 },
+       { 0x2003a, 0x2 },
+       { 0x120024, 0x1a3 },
+       { 0x2003a, 0x2 },
+       { 0x220024, 0x1a3 },
+       { 0x2003a, 0x2 },
+       { 0x20056, 0x3 },
+       { 0x120056, 0x3 },
+       { 0x220056, 0x3 },
+       { 0x1004d, 0xe00 },
+       { 0x1014d, 0xe00 },
+       { 0x1104d, 0xe00 },
+       { 0x1114d, 0xe00 },
+       { 0x11004d, 0xe00 },
+       { 0x11014d, 0xe00 },
+       { 0x11104d, 0xe00 },
+       { 0x11114d, 0xe00 },
+       { 0x21004d, 0xe00 },
+       { 0x21014d, 0xe00 },
+       { 0x21104d, 0xe00 },
+       { 0x21114d, 0xe00 },
+       { 0x10049, 0xeba },
+       { 0x10149, 0xeba },
+       { 0x11049, 0xeba },
+       { 0x11149, 0xeba },
+       { 0x110049, 0xeba },
+       { 0x110149, 0xeba },
+       { 0x111049, 0xeba },
+       { 0x111149, 0xeba },
+       { 0x210049, 0xeba },
+       { 0x210149, 0xeba },
+       { 0x211049, 0xeba },
+       { 0x211149, 0xeba },
+       { 0x43, 0x63 },
+       { 0x1043, 0x63 },
+       { 0x2043, 0x63 },
+       { 0x3043, 0x63 },
+       { 0x4043, 0x63 },
+       { 0x5043, 0x63 },
+       { 0x6043, 0x63 },
+       { 0x7043, 0x63 },
+       { 0x8043, 0x63 },
+       { 0x9043, 0x63 },
+       { 0x20018, 0x1 },
+       { 0x20075, 0x4 },
+       { 0x20050, 0x0 },
+       { 0x20008, 0x190 },
+       { 0x120008, 0x64 },
+       { 0x220008, 0x19 },
+       { 0x20088, 0x9 },
+       { 0x200b2, 0xdc },
+       { 0x10043, 0x5a1 },
+       { 0x10143, 0x5a1 },
+       { 0x11043, 0x5a1 },
+       { 0x11143, 0x5a1 },
+       { 0x1200b2, 0xdc },
+       { 0x110043, 0x5a1 },
+       { 0x110143, 0x5a1 },
+       { 0x111043, 0x5a1 },
+       { 0x111143, 0x5a1 },
+       { 0x2200b2, 0xdc },
+       { 0x210043, 0x5a1 },
+       { 0x210143, 0x5a1 },
+       { 0x211043, 0x5a1 },
+       { 0x211143, 0x5a1 },
+       { 0x200fa, 0x1 },
+       { 0x1200fa, 0x1 },
+       { 0x2200fa, 0x1 },
+       { 0x20019, 0x1 },
+       { 0x120019, 0x1 },
+       { 0x220019, 0x1 },
+       { 0x200f0, 0x660 },
+       { 0x200f1, 0x0 },
+       { 0x200f2, 0x4444 },
+       { 0x200f3, 0x8888 },
+       { 0x200f4, 0x5665 },
+       { 0x200f5, 0x0 },
+       { 0x200f6, 0x0 },
+       { 0x200f7, 0xf000 },
+       { 0x20025, 0x0 },
+       { 0x2002d, 0x0 },
+       { 0x12002d, 0x0 },
+       { 0x22002d, 0x0 },
+       { 0x2005b, 0x7529 },
+       { 0x2005c, 0x0 },
+       { 0x200c7, 0x21 },
+       { 0x200ca, 0x24 },
+       { 0x200cc, 0x1f7 },
+       { 0x1200c7, 0x21 },
+       { 0x1200ca, 0x24 },
+       { 0x1200cc, 0x1f7 },
+       { 0x2200c7, 0x21 },
+       { 0x2200ca, 0x24 },
+       { 0x2200cc, 0x1f7 },
+       { 0x2007d, 0x212 },
+       { 0x12007d, 0x212 },
+       { 0x22007d, 0x212 },
+       { 0x2007c, 0x61 },
+       { 0x12007c, 0x61 },
+       { 0x22007c, 0x61 },
+       { 0x1004a, 0x500 },
+       { 0x1104a, 0x500 },
+       { 0x2002c, 0x0 },
+};
+
+/* ddr phy trained csr */
+struct dram_cfg_param ddr_ddrphy_trained_csr[] = {
+       {0x0200b2, 0x0},
+       {0x1200b2, 0x0},
+       {0x2200b2, 0x0},
+       {0x0200cb, 0x0},
+       {0x010043, 0x0},
+       {0x110043, 0x0},
+       {0x210043, 0x0},
+       {0x010143, 0x0},
+       {0x110143, 0x0},
+       {0x210143, 0x0},
+       {0x011043, 0x0},
+       {0x111043, 0x0},
+       {0x211043, 0x0},
+       {0x011143, 0x0},
+       {0x111143, 0x0},
+       {0x211143, 0x0},
+       {0x000080, 0x0},
+       {0x100080, 0x0},
+       {0x200080, 0x0},
+       {0x001080, 0x0},
+       {0x101080, 0x0},
+       {0x201080, 0x0},
+       {0x002080, 0x0},
+       {0x102080, 0x0},
+       {0x202080, 0x0},
+       {0x003080, 0x0},
+       {0x103080, 0x0},
+       {0x203080, 0x0},
+       {0x004080, 0x0},
+       {0x104080, 0x0},
+       {0x204080, 0x0},
+       {0x005080, 0x0},
+       {0x105080, 0x0},
+       {0x205080, 0x0},
+       {0x006080, 0x0},
+       {0x106080, 0x0},
+       {0x206080, 0x0},
+       {0x007080, 0x0},
+       {0x107080, 0x0},
+       {0x207080, 0x0},
+       {0x008080, 0x0},
+       {0x108080, 0x0},
+       {0x208080, 0x0},
+       {0x009080, 0x0},
+       {0x109080, 0x0},
+       {0x209080, 0x0},
+       {0x010080, 0x0},
+       {0x110080, 0x0},
+       {0x210080, 0x0},
+       {0x010180, 0x0},
+       {0x110180, 0x0},
+       {0x210180, 0x0},
+       {0x011080, 0x0},
+       {0x111080, 0x0},
+       {0x211080, 0x0},
+       {0x011180, 0x0},
+       {0x111180, 0x0},
+       {0x211180, 0x0},
+       {0x010081, 0x0},
+       {0x110081, 0x0},
+       {0x210081, 0x0},
+       {0x010181, 0x0},
+       {0x110181, 0x0},
+       {0x210181, 0x0},
+       {0x011081, 0x0},
+       {0x111081, 0x0},
+       {0x211081, 0x0},
+       {0x011181, 0x0},
+       {0x111181, 0x0},
+       {0x211181, 0x0},
+       {0x0100d0, 0x0},
+       {0x1100d0, 0x0},
+       {0x2100d0, 0x0},
+       {0x0101d0, 0x0},
+       {0x1101d0, 0x0},
+       {0x2101d0, 0x0},
+       {0x0110d0, 0x0},
+       {0x1110d0, 0x0},
+       {0x2110d0, 0x0},
+       {0x0111d0, 0x0},
+       {0x1111d0, 0x0},
+       {0x2111d0, 0x0},
+       {0x0100d1, 0x0},
+       {0x1100d1, 0x0},
+       {0x2100d1, 0x0},
+       {0x0101d1, 0x0},
+       {0x1101d1, 0x0},
+       {0x2101d1, 0x0},
+       {0x0110d1, 0x0},
+       {0x1110d1, 0x0},
+       {0x2110d1, 0x0},
+       {0x0111d1, 0x0},
+       {0x1111d1, 0x0},
+       {0x2111d1, 0x0},
+       {0x010068, 0x0},
+       {0x010168, 0x0},
+       {0x010268, 0x0},
+       {0x010368, 0x0},
+       {0x010468, 0x0},
+       {0x010568, 0x0},
+       {0x010668, 0x0},
+       {0x010768, 0x0},
+       {0x010868, 0x0},
+       {0x011068, 0x0},
+       {0x011168, 0x0},
+       {0x011268, 0x0},
+       {0x011368, 0x0},
+       {0x011468, 0x0},
+       {0x011568, 0x0},
+       {0x011668, 0x0},
+       {0x011768, 0x0},
+       {0x011868, 0x0},
+       {0x010069, 0x0},
+       {0x010169, 0x0},
+       {0x010269, 0x0},
+       {0x010369, 0x0},
+       {0x010469, 0x0},
+       {0x010569, 0x0},
+       {0x010669, 0x0},
+       {0x010769, 0x0},
+       {0x010869, 0x0},
+       {0x011069, 0x0},
+       {0x011169, 0x0},
+       {0x011269, 0x0},
+       {0x011369, 0x0},
+       {0x011469, 0x0},
+       {0x011569, 0x0},
+       {0x011669, 0x0},
+       {0x011769, 0x0},
+       {0x011869, 0x0},
+       {0x01008c, 0x0},
+       {0x11008c, 0x0},
+       {0x21008c, 0x0},
+       {0x01018c, 0x0},
+       {0x11018c, 0x0},
+       {0x21018c, 0x0},
+       {0x01108c, 0x0},
+       {0x11108c, 0x0},
+       {0x21108c, 0x0},
+       {0x01118c, 0x0},
+       {0x11118c, 0x0},
+       {0x21118c, 0x0},
+       {0x01008d, 0x0},
+       {0x11008d, 0x0},
+       {0x21008d, 0x0},
+       {0x01018d, 0x0},
+       {0x11018d, 0x0},
+       {0x21018d, 0x0},
+       {0x01108d, 0x0},
+       {0x11108d, 0x0},
+       {0x21108d, 0x0},
+       {0x01118d, 0x0},
+       {0x11118d, 0x0},
+       {0x21118d, 0x0},
+       {0x0100c0, 0x0},
+       {0x1100c0, 0x0},
+       {0x2100c0, 0x0},
+       {0x0101c0, 0x0},
+       {0x1101c0, 0x0},
+       {0x2101c0, 0x0},
+       {0x0102c0, 0x0},
+       {0x1102c0, 0x0},
+       {0x2102c0, 0x0},
+       {0x0103c0, 0x0},
+       {0x1103c0, 0x0},
+       {0x2103c0, 0x0},
+       {0x0104c0, 0x0},
+       {0x1104c0, 0x0},
+       {0x2104c0, 0x0},
+       {0x0105c0, 0x0},
+       {0x1105c0, 0x0},
+       {0x2105c0, 0x0},
+       {0x0106c0, 0x0},
+       {0x1106c0, 0x0},
+       {0x2106c0, 0x0},
+       {0x0107c0, 0x0},
+       {0x1107c0, 0x0},
+       {0x2107c0, 0x0},
+       {0x0108c0, 0x0},
+       {0x1108c0, 0x0},
+       {0x2108c0, 0x0},
+       {0x0110c0, 0x0},
+       {0x1110c0, 0x0},
+       {0x2110c0, 0x0},
+       {0x0111c0, 0x0},
+       {0x1111c0, 0x0},
+       {0x2111c0, 0x0},
+       {0x0112c0, 0x0},
+       {0x1112c0, 0x0},
+       {0x2112c0, 0x0},
+       {0x0113c0, 0x0},
+       {0x1113c0, 0x0},
+       {0x2113c0, 0x0},
+       {0x0114c0, 0x0},
+       {0x1114c0, 0x0},
+       {0x2114c0, 0x0},
+       {0x0115c0, 0x0},
+       {0x1115c0, 0x0},
+       {0x2115c0, 0x0},
+       {0x0116c0, 0x0},
+       {0x1116c0, 0x0},
+       {0x2116c0, 0x0},
+       {0x0117c0, 0x0},
+       {0x1117c0, 0x0},
+       {0x2117c0, 0x0},
+       {0x0118c0, 0x0},
+       {0x1118c0, 0x0},
+       {0x2118c0, 0x0},
+       {0x0100c1, 0x0},
+       {0x1100c1, 0x0},
+       {0x2100c1, 0x0},
+       {0x0101c1, 0x0},
+       {0x1101c1, 0x0},
+       {0x2101c1, 0x0},
+       {0x0102c1, 0x0},
+       {0x1102c1, 0x0},
+       {0x2102c1, 0x0},
+       {0x0103c1, 0x0},
+       {0x1103c1, 0x0},
+       {0x2103c1, 0x0},
+       {0x0104c1, 0x0},
+       {0x1104c1, 0x0},
+       {0x2104c1, 0x0},
+       {0x0105c1, 0x0},
+       {0x1105c1, 0x0},
+       {0x2105c1, 0x0},
+       {0x0106c1, 0x0},
+       {0x1106c1, 0x0},
+       {0x2106c1, 0x0},
+       {0x0107c1, 0x0},
+       {0x1107c1, 0x0},
+       {0x2107c1, 0x0},
+       {0x0108c1, 0x0},
+       {0x1108c1, 0x0},
+       {0x2108c1, 0x0},
+       {0x0110c1, 0x0},
+       {0x1110c1, 0x0},
+       {0x2110c1, 0x0},
+       {0x0111c1, 0x0},
+       {0x1111c1, 0x0},
+       {0x2111c1, 0x0},
+       {0x0112c1, 0x0},
+       {0x1112c1, 0x0},
+       {0x2112c1, 0x0},
+       {0x0113c1, 0x0},
+       {0x1113c1, 0x0},
+       {0x2113c1, 0x0},
+       {0x0114c1, 0x0},
+       {0x1114c1, 0x0},
+       {0x2114c1, 0x0},
+       {0x0115c1, 0x0},
+       {0x1115c1, 0x0},
+       {0x2115c1, 0x0},
+       {0x0116c1, 0x0},
+       {0x1116c1, 0x0},
+       {0x2116c1, 0x0},
+       {0x0117c1, 0x0},
+       {0x1117c1, 0x0},
+       {0x2117c1, 0x0},
+       {0x0118c1, 0x0},
+       {0x1118c1, 0x0},
+       {0x2118c1, 0x0},
+       {0x010020, 0x0},
+       {0x110020, 0x0},
+       {0x210020, 0x0},
+       {0x011020, 0x0},
+       {0x111020, 0x0},
+       {0x211020, 0x0},
+       {0x020072, 0x0},
+       {0x020073, 0x0},
+       {0x020074, 0x0},
+       {0x0100aa, 0x0},
+       {0x0110aa, 0x0},
+       {0x020010, 0x0},
+       {0x120010, 0x0},
+       {0x220010, 0x0},
+       {0x020011, 0x0},
+       {0x120011, 0x0},
+       {0x220011, 0x0},
+       {0x0100ae, 0x0},
+       {0x1100ae, 0x0},
+       {0x2100ae, 0x0},
+       {0x0100af, 0x0},
+       {0x1100af, 0x0},
+       {0x2100af, 0x0},
+       {0x0110ae, 0x0},
+       {0x1110ae, 0x0},
+       {0x2110ae, 0x0},
+       {0x0110af, 0x0},
+       {0x1110af, 0x0},
+       {0x2110af, 0x0},
+       {0x020020, 0x0},
+       {0x120020, 0x0},
+       {0x220020, 0x0},
+       {0x0100a0, 0x0},
+       {0x0100a1, 0x0},
+       {0x0100a2, 0x0},
+       {0x0100a3, 0x0},
+       {0x0100a4, 0x0},
+       {0x0100a5, 0x0},
+       {0x0100a6, 0x0},
+       {0x0100a7, 0x0},
+       {0x0110a0, 0x0},
+       {0x0110a1, 0x0},
+       {0x0110a2, 0x0},
+       {0x0110a3, 0x0},
+       {0x0110a4, 0x0},
+       {0x0110a5, 0x0},
+       {0x0110a6, 0x0},
+       {0x0110a7, 0x0},
+       {0x02007c, 0x0},
+       {0x12007c, 0x0},
+       {0x22007c, 0x0},
+       {0x02007d, 0x0},
+       {0x12007d, 0x0},
+       {0x22007d, 0x0},
+       {0x0400fd, 0x0},
+       {0x0400c0, 0x0},
+       {0x090201, 0x0},
+       {0x190201, 0x0},
+       {0x290201, 0x0},
+       {0x090202, 0x0},
+       {0x190202, 0x0},
+       {0x290202, 0x0},
+       {0x090203, 0x0},
+       {0x190203, 0x0},
+       {0x290203, 0x0},
+       {0x090204, 0x0},
+       {0x190204, 0x0},
+       {0x290204, 0x0},
+       {0x090205, 0x0},
+       {0x190205, 0x0},
+       {0x290205, 0x0},
+       {0x090206, 0x0},
+       {0x190206, 0x0},
+       {0x290206, 0x0},
+       {0x090207, 0x0},
+       {0x190207, 0x0},
+       {0x290207, 0x0},
+       {0x090208, 0x0},
+       {0x190208, 0x0},
+       {0x290208, 0x0},
+       {0x010062, 0x0},
+       {0x010162, 0x0},
+       {0x010262, 0x0},
+       {0x010362, 0x0},
+       {0x010462, 0x0},
+       {0x010562, 0x0},
+       {0x010662, 0x0},
+       {0x010762, 0x0},
+       {0x010862, 0x0},
+       {0x011062, 0x0},
+       {0x011162, 0x0},
+       {0x011262, 0x0},
+       {0x011362, 0x0},
+       {0x011462, 0x0},
+       {0x011562, 0x0},
+       {0x011662, 0x0},
+       {0x011762, 0x0},
+       {0x011862, 0x0},
+       {0x020077, 0x0},
+       {0x010001, 0x0},
+       {0x011001, 0x0},
+       {0x010040, 0x0},
+       {0x010140, 0x0},
+       {0x010240, 0x0},
+       {0x010340, 0x0},
+       {0x010440, 0x0},
+       {0x010540, 0x0},
+       {0x010640, 0x0},
+       {0x010740, 0x0},
+       {0x010840, 0x0},
+       {0x010030, 0x0},
+       {0x010130, 0x0},
+       {0x010230, 0x0},
+       {0x010330, 0x0},
+       {0x010430, 0x0},
+       {0x010530, 0x0},
+       {0x010630, 0x0},
+       {0x010730, 0x0},
+       {0x010830, 0x0},
+       {0x011040, 0x0},
+       {0x011140, 0x0},
+       {0x011240, 0x0},
+       {0x011340, 0x0},
+       {0x011440, 0x0},
+       {0x011540, 0x0},
+       {0x011640, 0x0},
+       {0x011740, 0x0},
+       {0x011840, 0x0},
+       {0x011030, 0x0},
+       {0x011130, 0x0},
+       {0x011230, 0x0},
+       {0x011330, 0x0},
+       {0x011430, 0x0},
+       {0x011530, 0x0},
+       {0x011630, 0x0},
+       {0x011730, 0x0},
+       {0x011830, 0x0},
+};
+
+/* P0 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp0_cfg[] = {
+       { 0xd0000, 0x0 },
+       { 0x54003, 0x640 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
+       { 0x54008, 0x131f },
+       { 0x54009, 0xc8 },
+       { 0x5400b, 0x2 },
+       { 0x5400f, 0x100 },
+       { 0x54012, 0x310 },
+       { 0x54019, 0x12a4 },
+       { 0x5401a, 0x31 },
+       { 0x5401b, 0x4d66 },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
+       { 0x5401f, 0x12a4 },
+       { 0x54020, 0x31 },
+       { 0x54021, 0x4d66 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
+       { 0x54032, 0xa400 },
+       { 0x54033, 0x3112 },
+       { 0x54034, 0x6600 },
+       { 0x54035, 0x4d },
+       { 0x54036, 0x4d },
+       { 0x54037, 0x1600 },
+       { 0x54038, 0xa400 },
+       { 0x54039, 0x3112 },
+       { 0x5403a, 0x6600 },
+       { 0x5403b, 0x4d },
+       { 0x5403c, 0x4d },
+       { 0x5403d, 0x1600 },
+       { 0xd0000, 0x1 },
+};
+
+/* P1 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp1_cfg[] = {
+       { 0xd0000, 0x0 },
+       { 0x54002, 0x101 },
+       { 0x54003, 0x190 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
+       { 0x54008, 0x121f },
+       { 0x54009, 0xc8 },
+       { 0x5400b, 0x2 },
+       { 0x5400f, 0x100 },
+       { 0x54012, 0x310 },
+       { 0x54019, 0x84 },
+       { 0x5401a, 0x31 },
+       { 0x5401b, 0x4d66 },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
+       { 0x5401f, 0x84 },
+       { 0x54020, 0x31 },
+       { 0x54021, 0x4d66 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
+       { 0x54032, 0x8400 },
+       { 0x54033, 0x3100 },
+       { 0x54034, 0x6600 },
+       { 0x54035, 0x4d },
+       { 0x54036, 0x4d },
+       { 0x54037, 0x1600 },
+       { 0x54038, 0x8400 },
+       { 0x54039, 0x3100 },
+       { 0x5403a, 0x6600 },
+       { 0x5403b, 0x4d },
+       { 0x5403c, 0x4d },
+       { 0x5403d, 0x1600 },
+       { 0xd0000, 0x1 },
+};
+
+/* P2 message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp2_cfg[] = {
+       { 0xd0000, 0x0 },
+       { 0x54002, 0x102 },
+       { 0x54003, 0x64 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
+       { 0x54008, 0x121f },
+       { 0x54009, 0xc8 },
+       { 0x5400b, 0x2 },
+       { 0x5400f, 0x100 },
+       { 0x54012, 0x310 },
+       { 0x54019, 0x84 },
+       { 0x5401a, 0x31 },
+       { 0x5401b, 0x4d66 },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
+       { 0x5401f, 0x84 },
+       { 0x54020, 0x31 },
+       { 0x54021, 0x4d66 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
+       { 0x54032, 0x8400 },
+       { 0x54033, 0x3100 },
+       { 0x54034, 0x6600 },
+       { 0x54035, 0x4d },
+       { 0x54036, 0x4d },
+       { 0x54037, 0x1600 },
+       { 0x54038, 0x8400 },
+       { 0x54039, 0x3100 },
+       { 0x5403a, 0x6600 },
+       { 0x5403b, 0x4d },
+       { 0x5403c, 0x4d },
+       { 0x5403d, 0x1600 },
+       { 0xd0000, 0x1 },
+};
+
+/* P0 2D message block paremeter for training firmware */
+struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
+       { 0xd0000, 0x0 },
+       { 0x54003, 0x640 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x11 },
+       { 0x54008, 0x61 },
+       { 0x54009, 0xc8 },
+       { 0x5400b, 0x2 },
+       { 0x5400f, 0x100 },
+       { 0x54010, 0x1f7f },
+       { 0x54012, 0x310 },
+       { 0x54019, 0x12a4 },
+       { 0x5401a, 0x31 },
+       { 0x5401b, 0x4d66 },
+       { 0x5401c, 0x4d00 },
+       { 0x5401e, 0x16 },
+       { 0x5401f, 0x12a4 },
+       { 0x54020, 0x31 },
+       { 0x54021, 0x4d66 },
+       { 0x54022, 0x4d00 },
+       { 0x54024, 0x16 },
+       { 0x54032, 0xa400 },
+       { 0x54033, 0x3112 },
+       { 0x54034, 0x6600 },
+       { 0x54035, 0x4d },
+       { 0x54036, 0x4d },
+       { 0x54037, 0x1600 },
+       { 0x54038, 0xa400 },
+       { 0x54039, 0x3112 },
+       { 0x5403a, 0x6600 },
+       { 0x5403b, 0x4d },
+       { 0x5403c, 0x4d },
+       { 0x5403d, 0x1600 },
+       { 0xd0000, 0x1 },
+};
+
+/* DRAM PHY init engine image */
+struct dram_cfg_param ddr_phy_pie[] = {
+       { 0xd0000, 0x0 },
+       { 0x90000, 0x10 },
+       { 0x90001, 0x400 },
+       { 0x90002, 0x10e },
+       { 0x90003, 0x0 },
+       { 0x90004, 0x0 },
+       { 0x90005, 0x8 },
+       { 0x90029, 0xb },
+       { 0x9002a, 0x480 },
+       { 0x9002b, 0x109 },
+       { 0x9002c, 0x8 },
+       { 0x9002d, 0x448 },
+       { 0x9002e, 0x139 },
+       { 0x9002f, 0x8 },
+       { 0x90030, 0x478 },
+       { 0x90031, 0x109 },
+       { 0x90032, 0x0 },
+       { 0x90033, 0xe8 },
+       { 0x90034, 0x109 },
+       { 0x90035, 0x2 },
+       { 0x90036, 0x10 },
+       { 0x90037, 0x139 },
+       { 0x90038, 0xb },
+       { 0x90039, 0x7c0 },
+       { 0x9003a, 0x139 },
+       { 0x9003b, 0x44 },
+       { 0x9003c, 0x633 },
+       { 0x9003d, 0x159 },
+       { 0x9003e, 0x14f },
+       { 0x9003f, 0x630 },
+       { 0x90040, 0x159 },
+       { 0x90041, 0x47 },
+       { 0x90042, 0x633 },
+       { 0x90043, 0x149 },
+       { 0x90044, 0x4f },
+       { 0x90045, 0x633 },
+       { 0x90046, 0x179 },
+       { 0x90047, 0x8 },
+       { 0x90048, 0xe0 },
+       { 0x90049, 0x109 },
+       { 0x9004a, 0x0 },
+       { 0x9004b, 0x7c8 },
+       { 0x9004c, 0x109 },
+       { 0x9004d, 0x0 },
+       { 0x9004e, 0x1 },
+       { 0x9004f, 0x8 },
+       { 0x90050, 0x0 },
+       { 0x90051, 0x45a },
+       { 0x90052, 0x9 },
+       { 0x90053, 0x0 },
+       { 0x90054, 0x448 },
+       { 0x90055, 0x109 },
+       { 0x90056, 0x40 },
+       { 0x90057, 0x633 },
+       { 0x90058, 0x179 },
+       { 0x90059, 0x1 },
+       { 0x9005a, 0x618 },
+       { 0x9005b, 0x109 },
+       { 0x9005c, 0x40c0 },
+       { 0x9005d, 0x633 },
+       { 0x9005e, 0x149 },
+       { 0x9005f, 0x8 },
+       { 0x90060, 0x4 },
+       { 0x90061, 0x48 },
+       { 0x90062, 0x4040 },
+       { 0x90063, 0x633 },
+       { 0x90064, 0x149 },
+       { 0x90065, 0x0 },
+       { 0x90066, 0x4 },
+       { 0x90067, 0x48 },
+       { 0x90068, 0x40 },
+       { 0x90069, 0x633 },
+       { 0x9006a, 0x149 },
+       { 0x9006b, 0x10 },
+       { 0x9006c, 0x4 },
+       { 0x9006d, 0x18 },
+       { 0x9006e, 0x0 },
+       { 0x9006f, 0x4 },
+       { 0x90070, 0x78 },
+       { 0x90071, 0x549 },
+       { 0x90072, 0x633 },
+       { 0x90073, 0x159 },
+       { 0x90074, 0xd49 },
+       { 0x90075, 0x633 },
+       { 0x90076, 0x159 },
+       { 0x90077, 0x94a },
+       { 0x90078, 0x633 },
+       { 0x90079, 0x159 },
+       { 0x9007a, 0x441 },
+       { 0x9007b, 0x633 },
+       { 0x9007c, 0x149 },
+       { 0x9007d, 0x42 },
+       { 0x9007e, 0x633 },
+       { 0x9007f, 0x149 },
+       { 0x90080, 0x1 },
+       { 0x90081, 0x633 },
+       { 0x90082, 0x149 },
+       { 0x90083, 0x0 },
+       { 0x90084, 0xe0 },
+       { 0x90085, 0x109 },
+       { 0x90086, 0xa },
+       { 0x90087, 0x10 },
+       { 0x90088, 0x109 },
+       { 0x90089, 0x9 },
+       { 0x9008a, 0x3c0 },
+       { 0x9008b, 0x149 },
+       { 0x9008c, 0x9 },
+       { 0x9008d, 0x3c0 },
+       { 0x9008e, 0x159 },
+       { 0x9008f, 0x18 },
+       { 0x90090, 0x10 },
+       { 0x90091, 0x109 },
+       { 0x90092, 0x0 },
+       { 0x90093, 0x3c0 },
+       { 0x90094, 0x109 },
+       { 0x90095, 0x18 },
+       { 0x90096, 0x4 },
+       { 0x90097, 0x48 },
+       { 0x90098, 0x18 },
+       { 0x90099, 0x4 },
+       { 0x9009a, 0x58 },
+       { 0x9009b, 0xb },
+       { 0x9009c, 0x10 },
+       { 0x9009d, 0x109 },
+       { 0x9009e, 0x1 },
+       { 0x9009f, 0x10 },
+       { 0x900a0, 0x109 },
+       { 0x900a1, 0x5 },
+       { 0x900a2, 0x7c0 },
+       { 0x900a3, 0x109 },
+       { 0x40000, 0x811 },
+       { 0x40020, 0x880 },
+       { 0x40040, 0x0 },
+       { 0x40060, 0x0 },
+       { 0x40001, 0x4008 },
+       { 0x40021, 0x83 },
+       { 0x40041, 0x4f },
+       { 0x40061, 0x0 },
+       { 0x40002, 0x4040 },
+       { 0x40022, 0x83 },
+       { 0x40042, 0x51 },
+       { 0x40062, 0x0 },
+       { 0x40003, 0x811 },
+       { 0x40023, 0x880 },
+       { 0x40043, 0x0 },
+       { 0x40063, 0x0 },
+       { 0x40004, 0x720 },
+       { 0x40024, 0xf },
+       { 0x40044, 0x1740 },
+       { 0x40064, 0x0 },
+       { 0x40005, 0x16 },
+       { 0x40025, 0x83 },
+       { 0x40045, 0x4b },
+       { 0x40065, 0x0 },
+       { 0x40006, 0x716 },
+       { 0x40026, 0xf },
+       { 0x40046, 0x2001 },
+       { 0x40066, 0x0 },
+       { 0x40007, 0x716 },
+       { 0x40027, 0xf },
+       { 0x40047, 0x2800 },
+       { 0x40067, 0x0 },
+       { 0x40008, 0x716 },
+       { 0x40028, 0xf },
+       { 0x40048, 0xf00 },
+       { 0x40068, 0x0 },
+       { 0x40009, 0x720 },
+       { 0x40029, 0xf },
+       { 0x40049, 0x1400 },
+       { 0x40069, 0x0 },
+       { 0x4000a, 0xe08 },
+       { 0x4002a, 0xc15 },
+       { 0x4004a, 0x0 },
+       { 0x4006a, 0x0 },
+       { 0x4000b, 0x625 },
+       { 0x4002b, 0x15 },
+       { 0x4004b, 0x0 },
+       { 0x4006b, 0x0 },
+       { 0x4000c, 0x4028 },
+       { 0x4002c, 0x80 },
+       { 0x4004c, 0x0 },
+       { 0x4006c, 0x0 },
+       { 0x4000d, 0xe08 },
+       { 0x4002d, 0xc1a },
+       { 0x4004d, 0x0 },
+       { 0x4006d, 0x0 },
+       { 0x4000e, 0x625 },
+       { 0x4002e, 0x1a },
+       { 0x4004e, 0x0 },
+       { 0x4006e, 0x0 },
+       { 0x4000f, 0x4040 },
+       { 0x4002f, 0x80 },
+       { 0x4004f, 0x0 },
+       { 0x4006f, 0x0 },
+       { 0x40010, 0x2604 },
+       { 0x40030, 0x15 },
+       { 0x40050, 0x0 },
+       { 0x40070, 0x0 },
+       { 0x40011, 0x708 },
+       { 0x40031, 0x5 },
+       { 0x40051, 0x0 },
+       { 0x40071, 0x2002 },
+       { 0x40012, 0x8 },
+       { 0x40032, 0x80 },
+       { 0x40052, 0x0 },
+       { 0x40072, 0x0 },
+       { 0x40013, 0x2604 },
+       { 0x40033, 0x1a },
+       { 0x40053, 0x0 },
+       { 0x40073, 0x0 },
+       { 0x40014, 0x708 },
+       { 0x40034, 0xa },
+       { 0x40054, 0x0 },
+       { 0x40074, 0x2002 },
+       { 0x40015, 0x4040 },
+       { 0x40035, 0x80 },
+       { 0x40055, 0x0 },
+       { 0x40075, 0x0 },
+       { 0x40016, 0x60a },
+       { 0x40036, 0x15 },
+       { 0x40056, 0x1200 },
+       { 0x40076, 0x0 },
+       { 0x40017, 0x61a },
+       { 0x40037, 0x15 },
+       { 0x40057, 0x1300 },
+       { 0x40077, 0x0 },
+       { 0x40018, 0x60a },
+       { 0x40038, 0x1a },
+       { 0x40058, 0x1200 },
+       { 0x40078, 0x0 },
+       { 0x40019, 0x642 },
+       { 0x40039, 0x1a },
+       { 0x40059, 0x1300 },
+       { 0x40079, 0x0 },
+       { 0x4001a, 0x4808 },
+       { 0x4003a, 0x880 },
+       { 0x4005a, 0x0 },
+       { 0x4007a, 0x0 },
+       { 0x900a4, 0x0 },
+       { 0x900a5, 0x790 },
+       { 0x900a6, 0x11a },
+       { 0x900a7, 0x8 },
+       { 0x900a8, 0x7aa },
+       { 0x900a9, 0x2a },
+       { 0x900aa, 0x10 },
+       { 0x900ab, 0x7b2 },
+       { 0x900ac, 0x2a },
+       { 0x900ad, 0x0 },
+       { 0x900ae, 0x7c8 },
+       { 0x900af, 0x109 },
+       { 0x900b0, 0x10 },
+       { 0x900b1, 0x10 },
+       { 0x900b2, 0x109 },
+       { 0x900b3, 0x10 },
+       { 0x900b4, 0x2a8 },
+       { 0x900b5, 0x129 },
+       { 0x900b6, 0x8 },
+       { 0x900b7, 0x370 },
+       { 0x900b8, 0x129 },
+       { 0x900b9, 0xa },
+       { 0x900ba, 0x3c8 },
+       { 0x900bb, 0x1a9 },
+       { 0x900bc, 0xc },
+       { 0x900bd, 0x408 },
+       { 0x900be, 0x199 },
+       { 0x900bf, 0x14 },
+       { 0x900c0, 0x790 },
+       { 0x900c1, 0x11a },
+       { 0x900c2, 0x8 },
+       { 0x900c3, 0x4 },
+       { 0x900c4, 0x18 },
+       { 0x900c5, 0xe },
+       { 0x900c6, 0x408 },
+       { 0x900c7, 0x199 },
+       { 0x900c8, 0x8 },
+       { 0x900c9, 0x8568 },
+       { 0x900ca, 0x108 },
+       { 0x900cb, 0x18 },
+       { 0x900cc, 0x790 },
+       { 0x900cd, 0x16a },
+       { 0x900ce, 0x8 },
+       { 0x900cf, 0x1d8 },
+       { 0x900d0, 0x169 },
+       { 0x900d1, 0x10 },
+       { 0x900d2, 0x8558 },
+       { 0x900d3, 0x168 },
+       { 0x900d4, 0x70 },
+       { 0x900d5, 0x788 },
+       { 0x900d6, 0x16a },
+       { 0x900d7, 0x1ff8 },
+       { 0x900d8, 0x85a8 },
+       { 0x900d9, 0x1e8 },
+       { 0x900da, 0x50 },
+       { 0x900db, 0x798 },
+       { 0x900dc, 0x16a },
+       { 0x900dd, 0x60 },
+       { 0x900de, 0x7a0 },
+       { 0x900df, 0x16a },
+       { 0x900e0, 0x8 },
+       { 0x900e1, 0x8310 },
+       { 0x900e2, 0x168 },
+       { 0x900e3, 0x8 },
+       { 0x900e4, 0xa310 },
+       { 0x900e5, 0x168 },
+       { 0x900e6, 0xa },
+       { 0x900e7, 0x408 },
+       { 0x900e8, 0x169 },
+       { 0x900e9, 0x6e },
+       { 0x900ea, 0x0 },
+       { 0x900eb, 0x68 },
+       { 0x900ec, 0x0 },
+       { 0x900ed, 0x408 },
+       { 0x900ee, 0x169 },
+       { 0x900ef, 0x0 },
+       { 0x900f0, 0x8310 },
+       { 0x900f1, 0x168 },
+       { 0x900f2, 0x0 },
+       { 0x900f3, 0xa310 },
+       { 0x900f4, 0x168 },
+       { 0x900f5, 0x1ff8 },
+       { 0x900f6, 0x85a8 },
+       { 0x900f7, 0x1e8 },
+       { 0x900f8, 0x68 },
+       { 0x900f9, 0x798 },
+       { 0x900fa, 0x16a },
+       { 0x900fb, 0x78 },
+       { 0x900fc, 0x7a0 },
+       { 0x900fd, 0x16a },
+       { 0x900fe, 0x68 },
+       { 0x900ff, 0x790 },
+       { 0x90100, 0x16a },
+       { 0x90101, 0x8 },
+       { 0x90102, 0x8b10 },
+       { 0x90103, 0x168 },
+       { 0x90104, 0x8 },
+       { 0x90105, 0xab10 },
+       { 0x90106, 0x168 },
+       { 0x90107, 0xa },
+       { 0x90108, 0x408 },
+       { 0x90109, 0x169 },
+       { 0x9010a, 0x58 },
+       { 0x9010b, 0x0 },
+       { 0x9010c, 0x68 },
+       { 0x9010d, 0x0 },
+       { 0x9010e, 0x408 },
+       { 0x9010f, 0x169 },
+       { 0x90110, 0x0 },
+       { 0x90111, 0x8b10 },
+       { 0x90112, 0x168 },
+       { 0x90113, 0x0 },
+       { 0x90114, 0xab10 },
+       { 0x90115, 0x168 },
+       { 0x90116, 0x0 },
+       { 0x90117, 0x1d8 },
+       { 0x90118, 0x169 },
+       { 0x90119, 0x80 },
+       { 0x9011a, 0x790 },
+       { 0x9011b, 0x16a },
+       { 0x9011c, 0x18 },
+       { 0x9011d, 0x7aa },
+       { 0x9011e, 0x6a },
+       { 0x9011f, 0xa },
+       { 0x90120, 0x0 },
+       { 0x90121, 0x1e9 },
+       { 0x90122, 0x8 },
+       { 0x90123, 0x8080 },
+       { 0x90124, 0x108 },
+       { 0x90125, 0xf },
+       { 0x90126, 0x408 },
+       { 0x90127, 0x169 },
+       { 0x90128, 0xc },
+       { 0x90129, 0x0 },
+       { 0x9012a, 0x68 },
+       { 0x9012b, 0x9 },
+       { 0x9012c, 0x0 },
+       { 0x9012d, 0x1a9 },
+       { 0x9012e, 0x0 },
+       { 0x9012f, 0x408 },
+       { 0x90130, 0x169 },
+       { 0x90131, 0x0 },
+       { 0x90132, 0x8080 },
+       { 0x90133, 0x108 },
+       { 0x90134, 0x8 },
+       { 0x90135, 0x7aa },
+       { 0x90136, 0x6a },
+       { 0x90137, 0x0 },
+       { 0x90138, 0x8568 },
+       { 0x90139, 0x108 },
+       { 0x9013a, 0xb7 },
+       { 0x9013b, 0x790 },
+       { 0x9013c, 0x16a },
+       { 0x9013d, 0x1f },
+       { 0x9013e, 0x0 },
+       { 0x9013f, 0x68 },
+       { 0x90140, 0x8 },
+       { 0x90141, 0x8558 },
+       { 0x90142, 0x168 },
+       { 0x90143, 0xf },
+       { 0x90144, 0x408 },
+       { 0x90145, 0x169 },
+       { 0x90146, 0xd },
+       { 0x90147, 0x0 },
+       { 0x90148, 0x68 },
+       { 0x90149, 0x0 },
+       { 0x9014a, 0x408 },
+       { 0x9014b, 0x169 },
+       { 0x9014c, 0x0 },
+       { 0x9014d, 0x8558 },
+       { 0x9014e, 0x168 },
+       { 0x9014f, 0x8 },
+       { 0x90150, 0x3c8 },
+       { 0x90151, 0x1a9 },
+       { 0x90152, 0x3 },
+       { 0x90153, 0x370 },
+       { 0x90154, 0x129 },
+       { 0x90155, 0x20 },
+       { 0x90156, 0x2aa },
+       { 0x90157, 0x9 },
+       { 0x90158, 0x0 },
+       { 0x90159, 0x400 },
+       { 0x9015a, 0x10e },
+       { 0x9015b, 0x8 },
+       { 0x9015c, 0xe8 },
+       { 0x9015d, 0x109 },
+       { 0x9015e, 0x0 },
+       { 0x9015f, 0x8140 },
+       { 0x90160, 0x10c },
+       { 0x90161, 0x10 },
+       { 0x90162, 0x8138 },
+       { 0x90163, 0x10c },
+       { 0x90164, 0x8 },
+       { 0x90165, 0x7c8 },
+       { 0x90166, 0x101 },
+       { 0x90167, 0x8 },
+       { 0x90168, 0x448 },
+       { 0x90169, 0x109 },
+       { 0x9016a, 0xf },
+       { 0x9016b, 0x7c0 },
+       { 0x9016c, 0x109 },
+       { 0x9016d, 0x0 },
+       { 0x9016e, 0xe8 },
+       { 0x9016f, 0x109 },
+       { 0x90170, 0x47 },
+       { 0x90171, 0x630 },
+       { 0x90172, 0x109 },
+       { 0x90173, 0x8 },
+       { 0x90174, 0x618 },
+       { 0x90175, 0x109 },
+       { 0x90176, 0x8 },
+       { 0x90177, 0xe0 },
+       { 0x90178, 0x109 },
+       { 0x90179, 0x0 },
+       { 0x9017a, 0x7c8 },
+       { 0x9017b, 0x109 },
+       { 0x9017c, 0x8 },
+       { 0x9017d, 0x8140 },
+       { 0x9017e, 0x10c },
+       { 0x9017f, 0x0 },
+       { 0x90180, 0x1 },
+       { 0x90181, 0x8 },
+       { 0x90182, 0x8 },
+       { 0x90183, 0x4 },
+       { 0x90184, 0x8 },
+       { 0x90185, 0x8 },
+       { 0x90186, 0x7c8 },
+       { 0x90187, 0x101 },
+       { 0x90006, 0x0 },
+       { 0x90007, 0x0 },
+       { 0x90008, 0x8 },
+       { 0x90009, 0x0 },
+       { 0x9000a, 0x0 },
+       { 0x9000b, 0x0 },
+       { 0xd00e7, 0x400 },
+       { 0x90017, 0x0 },
+       { 0x9001f, 0x29 },
+       { 0x90026, 0x6a },
+       { 0x400d0, 0x0 },
+       { 0x400d1, 0x101 },
+       { 0x400d2, 0x105 },
+       { 0x400d3, 0x107 },
+       { 0x400d4, 0x10f },
+       { 0x400d5, 0x202 },
+       { 0x400d6, 0x20a },
+       { 0x400d7, 0x20b },
+       { 0x2003a, 0x2 },
+       { 0x2000b, 0x32 },
+       { 0x2000c, 0x64 },
+       { 0x2000d, 0x3e8 },
+       { 0x2000e, 0x2c },
+       { 0x12000b, 0xc },
+       { 0x12000c, 0x19 },
+       { 0x12000d, 0xfa },
+       { 0x12000e, 0x10 },
+       { 0x22000b, 0x3 },
+       { 0x22000c, 0x6 },
+       { 0x22000d, 0x3e },
+       { 0x22000e, 0x10 },
+       { 0x9000c, 0x0 },
+       { 0x9000d, 0x173 },
+       { 0x9000e, 0x60 },
+       { 0x9000f, 0x6110 },
+       { 0x90010, 0x2152 },
+       { 0x90011, 0xdfbd },
+       { 0x90012, 0x2060 },
+       { 0x90013, 0x6152 },
+       { 0x20010, 0x5a },
+       { 0x20011, 0x3 },
+       { 0x120010, 0x5a },
+       { 0x120011, 0x3 },
+       { 0x220010, 0x5a },
+       { 0x220011, 0x3 },
+       { 0x40080, 0xe0 },
+       { 0x40081, 0x12 },
+       { 0x40082, 0xe0 },
+       { 0x40083, 0x12 },
+       { 0x40084, 0xe0 },
+       { 0x40085, 0x12 },
+       { 0x140080, 0xe0 },
+       { 0x140081, 0x12 },
+       { 0x140082, 0xe0 },
+       { 0x140083, 0x12 },
+       { 0x140084, 0xe0 },
+       { 0x140085, 0x12 },
+       { 0x240080, 0xe0 },
+       { 0x240081, 0x12 },
+       { 0x240082, 0xe0 },
+       { 0x240083, 0x12 },
+       { 0x240084, 0xe0 },
+       { 0x240085, 0x12 },
+       { 0x400fd, 0xf },
+       { 0x10011, 0x1 },
+       { 0x10012, 0x1 },
+       { 0x10013, 0x180 },
+       { 0x10018, 0x1 },
+       { 0x10002, 0x6209 },
+       { 0x100b2, 0x1 },
+       { 0x101b4, 0x1 },
+       { 0x102b4, 0x1 },
+       { 0x103b4, 0x1 },
+       { 0x104b4, 0x1 },
+       { 0x105b4, 0x1 },
+       { 0x106b4, 0x1 },
+       { 0x107b4, 0x1 },
+       { 0x108b4, 0x1 },
+       { 0x11011, 0x1 },
+       { 0x11012, 0x1 },
+       { 0x11013, 0x180 },
+       { 0x11018, 0x1 },
+       { 0x11002, 0x6209 },
+       { 0x110b2, 0x1 },
+       { 0x111b4, 0x1 },
+       { 0x112b4, 0x1 },
+       { 0x113b4, 0x1 },
+       { 0x114b4, 0x1 },
+       { 0x115b4, 0x1 },
+       { 0x116b4, 0x1 },
+       { 0x117b4, 0x1 },
+       { 0x118b4, 0x1 },
+       { 0x20089, 0x1 },
+       { 0x20088, 0x19 },
+       { 0xc0080, 0x2 },
+       { 0xd0000, 0x1 }
+};
+
+struct dram_fsp_msg ddr_dram_fsp_msg[] = {
+       {
+               /* P0 1600mts 1D */
+               .drate = 1600,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp0_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg),
+       },
+       {
+               /* P1 400mts 1D */
+               .drate = 400,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp1_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp1_cfg),
+       },
+       {
+               /* P2 100mts 1D */
+               .drate = 100,
+               .fw_type = FW_1D_IMAGE,
+               .fsp_cfg = ddr_fsp2_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp2_cfg),
+       },
+       {
+               /* P0 1600mts 2D */
+               .drate = 1600,
+               .fw_type = FW_2D_IMAGE,
+               .fsp_cfg = ddr_fsp0_2d_cfg,
+               .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_2d_cfg),
+       },
+};
+
+/* ddr timing config params */
+struct dram_timing_info dram_timing = {
+       .ddrc_cfg = ddr_ddrc_cfg,
+       .ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg),
+       .ddrphy_cfg = ddr_ddrphy_cfg,
+       .ddrphy_cfg_num = ARRAY_SIZE(ddr_ddrphy_cfg),
+       .fsp_msg = ddr_dram_fsp_msg,
+       .fsp_msg_num = ARRAY_SIZE(ddr_dram_fsp_msg),
+       .ddrphy_trained_csr = ddr_ddrphy_trained_csr,
+       .ddrphy_trained_csr_num = ARRAY_SIZE(ddr_ddrphy_trained_csr),
+       .ddrphy_pie = ddr_phy_pie,
+       .ddrphy_pie_num = ARRAY_SIZE(ddr_phy_pie),
+       .fsp_table = { 1600, 400, 100, },
+};
index 6d5c7a5..03f2a56 100644 (file)
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
 #include <dm/device-internal.h>
+#include <power/pmic.h>
+#include <power/pca9450.h>
+#include <asm/mach-imx/gpio.h>
+#include <asm/mach-imx/mxc_i2c.h>
+#include <fsl_esdhc_imx.h>
+#include <mmc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -52,6 +58,48 @@ void spl_board_init(void)
                printf("Failed to find clock node. Check device tree\n");
 }
 
+#if CONFIG_IS_ENABLED(DM_PMIC_PCA9450)
+int power_init_board(void)
+{
+       struct udevice *dev;
+       int ret;
+
+       ret = pmic_get("pca9450@25", &dev);
+       if (ret == -ENODEV) {
+               puts("No pca9450@25\n");
+               return 0;
+       }
+       if (ret != 0)
+               return ret;
+
+       /* BUCKxOUT_DVS0/1 control BUCK123 output */
+       pmic_reg_write(dev, PCA9450_BUCK123_DVS, 0x29);
+
+#ifdef CONFIG_IMX8MN_LOW_DRIVE_MODE
+       /* Set VDD_SOC/VDD_DRAM to 0.8v for low drive mode */
+       pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, 0x10);
+#else
+       /* increase VDD_SOC/VDD_DRAM to typical value 0.95V before first DRAM access */
+       pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS0, 0x1C);
+#endif
+       /* Set DVS1 to 0.85v for suspend */
+       /* Enable DVS control through PMIC_STBY_REQ and set B1_ENMODE=1 (ON by PMIC_ON_REQ=H) */
+       pmic_reg_write(dev, PCA9450_BUCK1OUT_DVS1, 0x14);
+       pmic_reg_write(dev, PCA9450_BUCK1CTRL, 0x59);
+
+       /* set VDD_SNVS_0V8 from default 0.85V */
+       pmic_reg_write(dev, PCA9450_LDO2CTRL, 0xC0);
+
+       /* enable LDO4 to 1.2v */
+       pmic_reg_write(dev, PCA9450_LDO4CTRL, 0x44);
+
+       /* set WDOG_B_CFG to cold reset */
+       pmic_reg_write(dev, PCA9450_RESET_CTRL, 0xA1);
+
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
@@ -84,8 +132,6 @@ int board_early_init_f(void)
 
        imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
 
-       init_uart_clk(1);
-
        return 0;
 }
 
diff --git a/board/freescale/imx8mp_evk/boot.cmd b/board/freescale/imx8mp_evk/boot.cmd
deleted file mode 100644 (file)
index 10bcced..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-setenv bootargs console=${console} root=${mmcroot};
-
-for boot_target in ${boot_targets};
-do
-        if test "${boot_target}" = "mmc1" ; then
-                if fatload mmc 1:${mmcpart} ${kernel_addr_r} ${image}; then
-                        if fatload mmc 1:${mmcpart} ${fdt_addr} ${fdt_file}; then
-                                echo Load image and .dtb from SD card(mmc1);
-                                booti ${kernel_addr_r} - ${fdt_addr};
-                                exit;
-                        fi
-                fi
-        fi
-
-        if test "${boot_target}" = "mmc2" ; then
-                if fatload mmc 2:${mmcpart} ${kernel_addr_r} ${image}; then
-                        if fatload mmc 2:${mmcpart} ${fdt_addr} ${fdt_file}; then
-                                echo Load image and .dtb from eMMC(mmc2);
-                                booti ${kernel_addr_r} - ${fdt_addr};
-                                exit;
-                        fi
-                fi
-        fi
-
-done
diff --git a/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg b/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg
new file mode 100644 (file)
index 0000000..b2920b4
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2021 NXP
+ */
+
+#define __ASSEMBLY__
+
+ROM_VERSION    v2
+BOOT_FROM      sd
+LOADER         mkimage.flash.mkimage   0x920000
index 7658262..8c5306d 100644 (file)
@@ -11,15 +11,51 @@ struct dram_cfg_param ddr_ddrc_cfg[] = {
        { 0x3d400304, 0x1 },
        { 0x3d400030, 0x1 },
        { 0x3d400000, 0xa3080020 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x3d400020, 0x223 },
+       { 0x3d400024, 0x124f800 },
+       { 0x3d400064, 0x4900a8 },
+       { 0x3d400070, 0x1027f90 },
+       { 0x3d400074, 0x790 },
+       { 0x3d4000d0, 0xc0030495 },
+       { 0x3d4000d4, 0x770000 },
+       { 0x3d4000dc, 0xc40024 },
+#else
        { 0x3d400020, 0x1323 },
        { 0x3d400024, 0x1e84800 },
-       { 0x3d400064, 0x7a0118 },
+       { 0x3d400064, 0x7a017c },
+#ifdef CONFIG_IMX8M_DRAM_INLINE_ECC
+       { 0x3d400070, 0x1027f54 },
+#else
+       { 0x3d400070, 0x1027f10 },
+#endif
+       { 0x3d400074, 0x7b0 },
        { 0x3d4000d0, 0xc00307a3 },
        { 0x3d4000d4, 0xc50000 },
        { 0x3d4000dc, 0xf4003f },
+#endif
        { 0x3d4000e0, 0x330000 },
-       { 0x3d4000e8, 0x460048 },
-       { 0x3d4000ec, 0x150048 },
+       { 0x3d4000e8, 0x660048 },
+       { 0x3d4000ec, 0x160048 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x3d400100, 0x1618141a },
+       { 0x3d400104, 0x504a6 },
+       { 0x3d40010c, 0x909000 },
+       { 0x3d400110, 0xb04060b },
+       { 0x3d400114, 0x2030909 },
+       { 0x3d400118, 0x1010006 },
+       { 0x3d40011c, 0x301 },
+       { 0x3d400130, 0x20500 },
+       { 0x3d400134, 0xb100002 },
+       { 0x3d400138, 0xad },
+       { 0x3d400144, 0x78003c },
+       { 0x3d400180, 0x2580012 },
+       { 0x3d400184, 0x1e0493e },
+       { 0x3d400188, 0x0 },
+       { 0x3d400190, 0x4938208 },
+       { 0x3d400194, 0x80303 },
+       { 0x3d4001b4, 0x1308 },
+#else
        { 0x3d400100, 0x2028222a },
        { 0x3d400104, 0x807bf },
        { 0x3d40010c, 0xe0e000 },
@@ -29,7 +65,7 @@ struct dram_cfg_param ddr_ddrc_cfg[] = {
        { 0x3d40011c, 0x501 },
        { 0x3d400130, 0x20800 },
        { 0x3d400134, 0xe100002 },
-       { 0x3d400138, 0x120 },
+       { 0x3d400138, 0x184 },
        { 0x3d400144, 0xc80064 },
        { 0x3d400180, 0x3e8001e },
        { 0x3d400184, 0x3207a12 },
@@ -37,6 +73,7 @@ struct dram_cfg_param ddr_ddrc_cfg[] = {
        { 0x3d400190, 0x49f820e },
        { 0x3d400194, 0x80303 },
        { 0x3d4001b4, 0x1f0e },
+#endif
        { 0x3d4001a0, 0xe0400018 },
        { 0x3d4001a4, 0xdf00e4 },
        { 0x3d4001a8, 0x80000000 },
@@ -44,34 +81,68 @@ struct dram_cfg_param ddr_ddrc_cfg[] = {
        { 0x3d4001c0, 0x1 },
        { 0x3d4001c4, 0x1 },
        { 0x3d4000f4, 0xc99 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x3d400108, 0x60c1514 },
+       { 0x3d400200, 0x16 },
+       { 0x3d40020c, 0x0 },
+       { 0x3d400210, 0x1f1f },
+       { 0x3d400204, 0x80808 },
+       { 0x3d400214, 0x7070707 },
+       { 0x3d400218, 0x68070707 },
+       { 0x3d40021c, 0xf08 },
+       { 0x3d400250, 0x1f05 },
+       { 0x3d400254, 0x1f },
+       { 0x3d400264, 0x90003ff },
+       { 0x3d40026c, 0x20003ff },
+       { 0x3d400400, 0x111 },
+       { 0x3d400408, 0x72ff },
+       { 0x3d400494, 0x1000e00 },
+       { 0x3d400498, 0x3ff0000 },
+       { 0x3d40049c, 0x1000e00 },
+       { 0x3d4004a0, 0x3ff0000 },
+       { 0x3d402020, 0x21 },
+       { 0x3d402024, 0x30d400 },
+       { 0x3d402050, 0x20d000 },
+       { 0x3d402064, 0xc001c },
+#else
        { 0x3d400108, 0x9121c1c },
+#ifdef CONFIG_IMX8M_DRAM_INLINE_ECC
+       { 0x3d400200, 0x13 },
+       { 0x3d40020c, 0x13131300 },
+       { 0x3d400210, 0x1f1f },
+       { 0x3d400204, 0x50505 },
+       { 0x3d400214, 0x4040404 },
+       { 0x3d400218, 0x68040404 },
+#else
        { 0x3d400200, 0x16 },
        { 0x3d40020c, 0x0 },
        { 0x3d400210, 0x1f1f },
        { 0x3d400204, 0x80808 },
        { 0x3d400214, 0x7070707 },
        { 0x3d400218, 0x68070707 },
+#endif
        { 0x3d40021c, 0xf08 },
-       { 0x3d400250, 0x00001705 },
+       { 0x3d400250, 0x1705 },
        { 0x3d400254, 0x2c },
        { 0x3d40025c, 0x4000030 },
        { 0x3d400264, 0x900093e7 },
        { 0x3d40026c, 0x2005574 },
        { 0x3d400400, 0x111 },
-       { 0x3d400404, 0x72ff },
+       { 0x3d400404, 0x72ff },
        { 0x3d400408, 0x72ff },
        { 0x3d400494, 0x2100e07 },
        { 0x3d400498, 0x620096 },
        { 0x3d40049c, 0x1100e07 },
        { 0x3d4004a0, 0xc8012c },
-       { 0x3d402020, 0x21 },
-       { 0x3d402024, 0x7d00 },
-       { 0x3d402050, 0x20d040 },
-       { 0x3d402064, 0xc001c },
+       { 0x3d402020, 0x1021 },
+       { 0x3d402024, 0x30d400 },
+       { 0x3d402050, 0x20d000 },
+       { 0x3d402064, 0xc0026 },
+#endif
        { 0x3d4020dc, 0x840000 },
-       { 0x3d4020e0, 0x310000 },
-       { 0x3d4020e8, 0x66004d },
-       { 0x3d4020ec, 0x16004d },
+       { 0x3d4020e0, 0x330000 },
+       { 0x3d4020e8, 0x660048 },
+       { 0x3d4020ec, 0x160048 },
        { 0x3d402100, 0xa040305 },
        { 0x3d402104, 0x30407 },
        { 0x3d402108, 0x203060b },
@@ -82,21 +153,28 @@ struct dram_cfg_param ddr_ddrc_cfg[] = {
        { 0x3d40211c, 0x301 },
        { 0x3d402130, 0x20300 },
        { 0x3d402134, 0xa100002 },
-       { 0x3d402138, 0x1d },
+       { 0x3d402138, 0x27 },
        { 0x3d402144, 0x14000a },
        { 0x3d402180, 0x640004 },
        { 0x3d402190, 0x3818200 },
        { 0x3d402194, 0x80303 },
        { 0x3d4021b4, 0x100 },
        { 0x3d4020f4, 0xc99 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
        { 0x3d403020, 0x21 },
-       { 0x3d403024, 0x30d400 },
-       { 0x3d403050, 0x20d040 },
+       { 0x3d403024, 0xc3500 },
+       { 0x3d403050, 0x20d000 },
        { 0x3d403064, 0x30007 },
+#else
+       { 0x3d403020, 0x1021 },
+       { 0x3d403024, 0xc3500 },
+       { 0x3d403050, 0x20d000 },
+       { 0x3d403064, 0x3000a },
+#endif
        { 0x3d4030dc, 0x840000 },
-       { 0x3d4030e0, 0x310000 },
-       { 0x3d4030e8, 0x66004d },
-       { 0x3d4030ec, 0x16004d },
+       { 0x3d4030e0, 0x330000 },
+       { 0x3d4030e8, 0x660048 },
+       { 0x3d4030ec, 0x160048 },
        { 0x3d403100, 0xa010102 },
        { 0x3d403104, 0x30404 },
        { 0x3d403108, 0x203060b },
@@ -107,12 +185,13 @@ struct dram_cfg_param ddr_ddrc_cfg[] = {
        { 0x3d40311c, 0x301 },
        { 0x3d403130, 0x20300 },
        { 0x3d403134, 0xa100002 },
-       { 0x3d403138, 0x8 },
+       { 0x3d403138, 0xa },
        { 0x3d403144, 0x50003 },
        { 0x3d403180, 0x190004 },
        { 0x3d403190, 0x3818200 },
        { 0x3d403194, 0x80303 },
        { 0x3d4031b4, 0x100 },
+       { 0x3d4030f4, 0xc99 },
        { 0x3d400028, 0x0 },
 };
 
@@ -184,7 +263,11 @@ struct dram_cfg_param ddr_ddrphy_cfg[] = {
        { 0x7055, 0x1ff },
        { 0x8055, 0x1ff },
        { 0x9055, 0x1ff },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x200c5, 0xa },
+#else
        { 0x200c5, 0x18 },
+#endif
        { 0x1200c5, 0x7 },
        { 0x2200c5, 0x7 },
        { 0x2002e, 0x2 },
@@ -263,7 +346,11 @@ struct dram_cfg_param ddr_ddrphy_cfg[] = {
        { 0x20018, 0x3 },
        { 0x20075, 0x4 },
        { 0x20050, 0x0 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x20008, 0x258 },
+#else
        { 0x20008, 0x3e8 },
+#endif
        { 0x120008, 0x64 },
        { 0x220008, 0x19 },
        { 0x20088, 0x9 },
@@ -1050,6 +1137,38 @@ struct dram_cfg_param ddr_ddrphy_trained_csr[] = {
 
 /* P0 message block paremeter for training firmware */
 struct dram_cfg_param ddr_fsp0_cfg[] = {
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0xd0000, 0x0 },
+       { 0x54003, 0x960 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x14 },
+       { 0x54008, 0x131f },
+       { 0x54009, 0xc8 },
+       { 0x5400b, 0x2 },
+       { 0x5400f, 0x100 },
+       { 0x54012, 0x310 },
+       { 0x54019, 0x24c4 },
+       { 0x5401a, 0x33 },
+       { 0x5401b, 0x4866 },
+       { 0x5401c, 0x4800 },
+       { 0x5401e, 0x16 },
+       { 0x5401f, 0x24c4 },
+       { 0x54020, 0x33 },
+       { 0x54021, 0x4866 },
+       { 0x54022, 0x4800 },
+       { 0x54024, 0x16 },
+       { 0x5402b, 0x1000 },
+       { 0x5402c, 0x3 },
+       { 0x54032, 0xc400 },
+       { 0x54033, 0x3324 },
+       { 0x54034, 0x6600 },
+       { 0x54035, 0x48 },
+       { 0x54036, 0x48 },
+       { 0x54037, 0x1600 },
+       { 0x54038, 0xc400 },
+       { 0x54039, 0x3324 },
+#else
        { 0xd0000, 0x0 },
        { 0x54003, 0xfa0 },
        { 0x54004, 0x2 },
@@ -1080,6 +1199,7 @@ struct dram_cfg_param ddr_fsp0_cfg[] = {
        { 0x54037, 0x1600 },
        { 0x54038, 0xf400 },
        { 0x54039, 0x333f },
+#endif
        { 0x5403a, 0x6600 },
        { 0x5403b, 0x48 },
        { 0x5403c, 0x48 },
@@ -1102,28 +1222,28 @@ struct dram_cfg_param ddr_fsp1_cfg[] = {
        { 0x54012, 0x310 },
        { 0x54019, 0x84 },
        { 0x5401a, 0x33 },
-       { 0x5401b, 0x4846 },
+       { 0x5401b, 0x4866 },
        { 0x5401c, 0x4800 },
-       { 0x5401e, 0x15 },
+       { 0x5401e, 0x16 },
        { 0x5401f, 0x84 },
        { 0x54020, 0x33 },
-       { 0x54021, 0x4846 },
+       { 0x54021, 0x4866 },
        { 0x54022, 0x4800 },
-       { 0x54024, 0x15 },
+       { 0x54024, 0x16 },
        { 0x5402b, 0x1000 },
        { 0x5402c, 0x3 },
        { 0x54032, 0x8400 },
        { 0x54033, 0x3300 },
-       { 0x54034, 0x4600 },
+       { 0x54034, 0x6600 },
        { 0x54035, 0x48 },
        { 0x54036, 0x48 },
-       { 0x54037, 0x1500 },
+       { 0x54037, 0x1600 },
        { 0x54038, 0x8400 },
        { 0x54039, 0x3300 },
-       { 0x5403a, 0x4600 },
+       { 0x5403a, 0x6600 },
        { 0x5403b, 0x48 },
        { 0x5403c, 0x48 },
-       { 0x5403d, 0x1500 },
+       { 0x5403d, 0x1600 },
        { 0xd0000, 0x1 },
 };
 
@@ -1142,34 +1262,66 @@ struct dram_cfg_param ddr_fsp2_cfg[] = {
        { 0x54012, 0x310 },
        { 0x54019, 0x84 },
        { 0x5401a, 0x33 },
-       { 0x5401b, 0x4846 },
+       { 0x5401b, 0x4866 },
        { 0x5401c, 0x4800 },
-       { 0x5401e, 0x15 },
+       { 0x5401e, 0x16 },
        { 0x5401f, 0x84 },
        { 0x54020, 0x33 },
-       { 0x54021, 0x4846 },
+       { 0x54021, 0x4866 },
        { 0x54022, 0x4800 },
-       { 0x54024, 0x15 },
+       { 0x54024, 0x16 },
        { 0x5402b, 0x1000 },
        { 0x5402c, 0x3 },
        { 0x54032, 0x8400 },
        { 0x54033, 0x3300 },
-       { 0x54034, 0x4600 },
+       { 0x54034, 0x6600 },
        { 0x54035, 0x48 },
        { 0x54036, 0x48 },
-       { 0x54037, 0x1500 },
+       { 0x54037, 0x1600 },
        { 0x54038, 0x8400 },
        { 0x54039, 0x3300 },
-       { 0x5403a, 0x4600 },
+       { 0x5403a, 0x6600 },
        { 0x5403b, 0x48 },
        { 0x5403c, 0x48 },
-       { 0x5403d, 0x1500 },
+       { 0x5403d, 0x1600 },
        { 0xd0000, 0x1 },
 };
 
 /* P0 2D message block paremeter for training firmware */
 struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
        { 0xd0000, 0x0 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x54003, 0x960 },
+       { 0x54004, 0x2 },
+       { 0x54005, 0x2228 },
+       { 0x54006, 0x14 },
+       { 0x54008, 0x61 },
+       { 0x54009, 0xc8 },
+       { 0x5400b, 0x2 },
+       { 0x5400f, 0x100 },
+       { 0x54010, 0x1f7f },
+       { 0x54012, 0x310 },
+       { 0x54019, 0x24c4 },
+       { 0x5401a, 0x33 },
+       { 0x5401b, 0x4866 },
+       { 0x5401c, 0x4800 },
+       { 0x5401e, 0x16 },
+       { 0x5401f, 0x24c4 },
+       { 0x54020, 0x33 },
+       { 0x54021, 0x4866 },
+       { 0x54022, 0x4800 },
+       { 0x54024, 0x16 },
+       { 0x5402b, 0x1000 },
+       { 0x5402c, 0x3 },
+       { 0x54032, 0xc400 },
+       { 0x54033, 0x3324 },
+       { 0x54034, 0x6600 },
+       { 0x54035, 0x48 },
+       { 0x54036, 0x48 },
+       { 0x54037, 0x1600 },
+       { 0x54038, 0xc400 },
+       { 0x54039, 0x3324 },
+#else
        { 0x54003, 0xfa0 },
        { 0x54004, 0x2 },
        { 0x54005, 0x2228 },
@@ -1177,7 +1329,6 @@ struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
        { 0x54008, 0x61 },
        { 0x54009, 0xc8 },
        { 0x5400b, 0x2 },
-       { 0x5400d, 0x100 },
        { 0x5400f, 0x100 },
        { 0x54010, 0x1f7f },
        { 0x54012, 0x310 },
@@ -1201,6 +1352,7 @@ struct dram_cfg_param ddr_fsp0_2d_cfg[] = {
        { 0x54037, 0x1600 },
        { 0x54038, 0xf400 },
        { 0x54039, 0x333f },
+#endif
        { 0x5403a, 0x6600 },
        { 0x5403b, 0x48 },
        { 0x5403c, 0x48 },
@@ -1628,67 +1780,58 @@ struct dram_cfg_param ddr_phy_pie[] = {
        { 0x90155, 0x20 },
        { 0x90156, 0x2aa },
        { 0x90157, 0x9 },
-       { 0x90158, 0x0 },
-       { 0x90159, 0x400 },
-       { 0x9015a, 0x10e },
-       { 0x9015b, 0x8 },
-       { 0x9015c, 0xe8 },
-       { 0x9015d, 0x109 },
-       { 0x9015e, 0x0 },
-       { 0x9015f, 0x8140 },
-       { 0x90160, 0x10c },
-       { 0x90161, 0x10 },
-       { 0x90162, 0x8138 },
-       { 0x90163, 0x10c },
-       { 0x90164, 0x8 },
-       { 0x90165, 0x7c8 },
-       { 0x90166, 0x101 },
-       { 0x90167, 0x8 },
-       { 0x90168, 0x448 },
+       { 0x90158, 0x8 },
+       { 0x90159, 0xe8 },
+       { 0x9015a, 0x109 },
+       { 0x9015b, 0x0 },
+       { 0x9015c, 0x8140 },
+       { 0x9015d, 0x10c },
+       { 0x9015e, 0x10 },
+       { 0x9015f, 0x8138 },
+       { 0x90160, 0x104 },
+       { 0x90161, 0x8 },
+       { 0x90162, 0x448 },
+       { 0x90163, 0x109 },
+       { 0x90164, 0xf },
+       { 0x90165, 0x7c0 },
+       { 0x90166, 0x109 },
+       { 0x90167, 0x0 },
+       { 0x90168, 0xe8 },
        { 0x90169, 0x109 },
-       { 0x9016a, 0xf },
-       { 0x9016b, 0x7c0 },
+       { 0x9016a, 0x47 },
+       { 0x9016b, 0x630 },
        { 0x9016c, 0x109 },
-       { 0x9016d, 0x0 },
-       { 0x9016e, 0xe8 },
+       { 0x9016d, 0x8 },
+       { 0x9016e, 0x618 },
        { 0x9016f, 0x109 },
-       { 0x90170, 0x47 },
-       { 0x90171, 0x630 },
+       { 0x90170, 0x8 },
+       { 0x90171, 0xe0 },
        { 0x90172, 0x109 },
-       { 0x90173, 0x8 },
-       { 0x90174, 0x618 },
+       { 0x90173, 0x0 },
+       { 0x90174, 0x7c8 },
        { 0x90175, 0x109 },
        { 0x90176, 0x8 },
-       { 0x90177, 0xe0 },
-       { 0x90178, 0x109 },
+       { 0x90177, 0x8140 },
+       { 0x90178, 0x10c },
        { 0x90179, 0x0 },
-       { 0x9017a, 0x7c8 },
+       { 0x9017a, 0x478 },
        { 0x9017b, 0x109 },
-       { 0x9017c, 0x8 },
-       { 0x9017d, 0x8140 },
-       { 0x9017e, 0x10c },
-       { 0x9017f, 0x0 },
-       { 0x90180, 0x478 },
-       { 0x90181, 0x109 },
-       { 0x90182, 0x0 },
-       { 0x90183, 0x1 },
-       { 0x90184, 0x8 },
-       { 0x90185, 0x8 },
-       { 0x90186, 0x4 },
-       { 0x90187, 0x8 },
-       { 0x90188, 0x8 },
-       { 0x90189, 0x7c8 },
-       { 0x9018a, 0x101 },
-       { 0x90006, 0x0 },
-       { 0x90007, 0x0 },
-       { 0x90008, 0x8 },
+       { 0x9017c, 0x0 },
+       { 0x9017d, 0x1 },
+       { 0x9017e, 0x8 },
+       { 0x9017f, 0x8 },
+       { 0x90180, 0x4 },
+       { 0x90181, 0x0 },
+       { 0x90006, 0x8 },
+       { 0x90007, 0x7c8 },
+       { 0x90008, 0x109 },
        { 0x90009, 0x0 },
-       { 0x9000a, 0x0 },
-       { 0x9000b, 0x0 },
+       { 0x9000a, 0x400 },
+       { 0x9000b, 0x106 },
        { 0xd00e7, 0x400 },
        { 0x90017, 0x0 },
        { 0x9001f, 0x29 },
-       { 0x90026, 0x6a },
+       { 0x90026, 0x68 },
        { 0x400d0, 0x0 },
        { 0x400d1, 0x101 },
        { 0x400d2, 0x105 },
@@ -1698,9 +1841,16 @@ struct dram_cfg_param ddr_phy_pie[] = {
        { 0x400d6, 0x20a },
        { 0x400d7, 0x20b },
        { 0x2003a, 0x2 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x2000b, 0x4b },
+       { 0x2000c, 0x96 },
+       { 0x2000d, 0x5dc },
+#else
+       { 0x200be, 0x3 },
        { 0x2000b, 0x7d },
        { 0x2000c, 0xfa },
        { 0x2000d, 0x9c4 },
+#endif
        { 0x2000e, 0x2c },
        { 0x12000b, 0xc },
        { 0x12000c, 0x19 },
@@ -1720,6 +1870,12 @@ struct dram_cfg_param ddr_phy_pie[] = {
        { 0x90013, 0x6152 },
        { 0x20010, 0x5a },
        { 0x20011, 0x3 },
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       { 0x120010, 0x5a },
+       { 0x120011, 0x3 },
+       { 0x220010, 0x5a },
+       { 0x220011, 0x3 },
+#endif
        { 0x40080, 0xe0 },
        { 0x40081, 0x12 },
        { 0x40082, 0xe0 },
@@ -1803,8 +1959,13 @@ struct dram_cfg_param ddr_phy_pie[] = {
 
 struct dram_fsp_msg ddr_dram_fsp_msg[] = {
        {
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+               /* P0 2400mts 1D */
+               .drate = 2400,
+#else
                /* P0 4000mts 1D */
                .drate = 4000,
+#endif
                .fw_type = FW_1D_IMAGE,
                .fsp_cfg = ddr_fsp0_cfg,
                .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg),
@@ -1824,8 +1985,13 @@ struct dram_fsp_msg ddr_dram_fsp_msg[] = {
                .fsp_cfg_num = ARRAY_SIZE(ddr_fsp2_cfg),
        },
        {
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+               /* P0 2400mts 2D */
+               .drate = 2400,
+#else
                /* P0 4000mts 2D */
                .drate = 4000,
+#endif
                .fw_type = FW_2D_IMAGE,
                .fsp_cfg = ddr_fsp0_2d_cfg,
                .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_2d_cfg),
@@ -1844,5 +2010,39 @@ struct dram_timing_info dram_timing = {
        .ddrphy_trained_csr_num = ARRAY_SIZE(ddr_ddrphy_trained_csr),
        .ddrphy_pie = ddr_phy_pie,
        .ddrphy_pie_num = ARRAY_SIZE(ddr_phy_pie),
+#ifdef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+       .fsp_table = { 2400, 400, 100, },
+#else
        .fsp_table = { 4000, 400, 100, },
+#endif
 };
+
+#ifndef CONFIG_IMX8M_LPDDR4_FREQ0_2400MTS
+#ifdef CONFIG_IMX8M_DRAM_INLINE_ECC
+void board_dram_ecc_scrub(void)
+{
+       ddrc_inline_ecc_scrub(0x0, 0x3ffffff);
+       ddrc_inline_ecc_scrub(0x20000000, 0x23ffffff);
+       ddrc_inline_ecc_scrub(0x40000000, 0x43ffffff);
+       ddrc_inline_ecc_scrub(0x4000000, 0x7ffffff);
+       ddrc_inline_ecc_scrub(0x24000000, 0x27ffffff);
+       ddrc_inline_ecc_scrub(0x44000000, 0x47ffffff);
+       ddrc_inline_ecc_scrub(0x8000000, 0xbffffff);
+       ddrc_inline_ecc_scrub(0x28000000, 0x2bffffff);
+       ddrc_inline_ecc_scrub(0x48000000, 0x4bffffff);
+       ddrc_inline_ecc_scrub(0xc000000, 0xfffffff);
+       ddrc_inline_ecc_scrub(0x2c000000, 0x2fffffff);
+       ddrc_inline_ecc_scrub(0x4c000000, 0x4fffffff);
+       ddrc_inline_ecc_scrub(0x10000000, 0x13ffffff);
+       ddrc_inline_ecc_scrub(0x30000000, 0x33ffffff);
+       ddrc_inline_ecc_scrub(0x50000000, 0x53ffffff);
+       ddrc_inline_ecc_scrub(0x14000000, 0x17ffffff);
+       ddrc_inline_ecc_scrub(0x34000000, 0x37ffffff);
+       ddrc_inline_ecc_scrub(0x54000000, 0x57ffffff);
+       ddrc_inline_ecc_scrub(0x18000000, 0x1bffffff);
+       ddrc_inline_ecc_scrub(0x38000000, 0x3bffffff);
+       ddrc_inline_ecc_scrub(0x58000000, 0x5bffffff);
+       ddrc_inline_ecc_scrub_end(0x0, 0x5fffffff);
+}
+#endif
+#endif
index ebfd94d..a7564e9 100644 (file)
@@ -5,30 +5,21 @@
  */
 
 #include <common.h>
-#include <command.h>
-#include <cpu_func.h>
 #include <hang.h>
-#include <image.h>
 #include <init.h>
 #include <log.h>
 #include <spl.h>
 #include <asm/global_data.h>
-#include <asm/io.h>
-#include <errno.h>
-#include <asm/io.h>
-#include <asm/mach-imx/iomux-v3.h>
+#include <asm/arch/clock.h>
 #include <asm/arch/imx8mp_pins.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
-#include <power/pmic.h>
-
-#include <power/pca9450.h>
-#include <asm/arch/clock.h>
 #include <asm/mach-imx/gpio.h>
+#include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
-#include <fsl_esdhc.h>
-#include <mmc.h>
 #include <asm/arch/ddr.h>
+#include <power/pmic.h>
+#include <power/pca9450.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -44,6 +35,16 @@ void spl_dram_init(void)
 
 void spl_board_init(void)
 {
+       /*
+        * Set GIC clock to 500Mhz for OD VDD_SOC. Kernel driver does
+        * not allow to change it. Should set the clock after PMIC
+        * setting done. Default is 400Mhz (system_pll1_800m with div = 2)
+        * set by ROM for ND VDD_SOC
+        */
+       clock_enable(CCGR_GIC, 0);
+       clock_set_target_val(GIC_CLK_ROOT, CLK_ROOT_ON | CLK_ROOT_SOURCE_SEL(5));
+       clock_enable(CCGR_GIC, 1);
+
        puts("Normal Boot\n");
 }
 
@@ -69,7 +70,7 @@ int power_init_board(void)
        struct pmic *p;
        int ret;
 
-       ret = power_pca9450_init(I2C_PMIC);
+       ret = power_pca9450_init(I2C_PMIC, 0x25);
        if (ret)
                printf("power init failed");
        p = pmic_get("PCA9450");
@@ -84,10 +85,19 @@ int power_init_board(void)
         * Enable DVS control through PMIC_STBY_REQ and
         * set B1_ENMODE=1 (ON by PMIC_ON_REQ=H)
         */
+#ifdef CONFIG_IMX8M_VDD_SOC_850MV
+       /* set DVS0 to 0.85v for special case*/
+       pmic_reg_write(p, PCA9450_BUCK1OUT_DVS0, 0x14);
+#else
        pmic_reg_write(p, PCA9450_BUCK1OUT_DVS0, 0x1C);
+#endif
        pmic_reg_write(p, PCA9450_BUCK1OUT_DVS1, 0x14);
        pmic_reg_write(p, PCA9450_BUCK1CTRL, 0x59);
 
+       /* Kernel uses OD/OD freq for SOC */
+       /* To avoid timing risk from SOC to ARM,increase VDD_ARM to OD voltage 0.95v */
+       pmic_reg_write(p, PCA9450_BUCK2OUT_DVS0, 0x1C);
+
        /* set WDOG_B_CFG to cold reset */
        pmic_reg_write(p, PCA9450_RESET_CTRL, 0xA1);
 
index 8275358..e8e0efe 100644 (file)
@@ -36,7 +36,7 @@ extern struct dram_timing_info dram_timing_b0;
 static void spl_dram_init(void)
 {
        /* ddr init */
-       if ((get_cpu_rev() & 0xfff) == CHIP_REV_2_1)
+       if (soc_rev() >= CHIP_REV_2_1)
                ddr_init(&dram_timing);
        else
                ddr_init(&dram_timing_b0);
index 35241ac..479e66b 100644 (file)
@@ -60,8 +60,8 @@ int spl_dram_init(void)
 
 void spl_board_init(void)
 {
-       spl_dram_init();
        preloader_console_init();
+       spl_dram_init();
        arch_cpu_init(); /* to configure mpu for sdram rw permissions */
 }
 
index b8d852f..eb49239 100644 (file)
@@ -60,8 +60,8 @@ int spl_dram_init(void)
 
 void spl_board_init(void)
 {
-       spl_dram_init();
        preloader_console_init();
+       spl_dram_init();
        arch_cpu_init(); /* to configure mpu for sdram rw permissions */
 }
 
index a98a705..597118d 100644 (file)
@@ -1,5 +1,5 @@
 MX28EVK BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/freescale/mx28evk/
 F:     include/configs/mx28evk.h
index a89f05a..6179d67 100644 (file)
@@ -1,5 +1,5 @@
 MX6SABREAUTO BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 M:     Peng Fan <peng.fan@nxp.com>
 S:     Maintained
 F:     board/freescale/mx6sabreauto/
index 9575261..5e256ef 100644 (file)
@@ -1,5 +1,5 @@
 MX6SABRESD BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/freescale/mx6sabresd/
 F:     include/configs/mx6sabresd.h
index be2f3d5..ae87fe4 100644 (file)
@@ -1,5 +1,5 @@
 MX6SLEVK BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 M:     Peng Fan <peng.fan@nxp.com>
 S:     Maintained
 F:     board/freescale/mx6slevk/
index 6f2ff44..692bbd9 100644 (file)
@@ -1,5 +1,5 @@
 MX6SXSABREAUTO BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/freescale/mx6sxsabreauto/
 F:     include/configs/mx6sxsabreauto.h
index a56d252..b3c8b56 100644 (file)
@@ -1,5 +1,5 @@
 MX6SXSABRESD BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/freescale/mx6sxsabresd/
 F:     include/configs/mx6sxsabresd.h
index 265ddac..1619d23 100644 (file)
@@ -6,3 +6,51 @@ F:     include/configs/gw_ventana.h
 F:     configs/gwventana_nand_defconfig
 F:     configs/gwventana_emmc_defconfig
 F:     configs/gwventana_gw5904_defconfig
+F:     arch/arm/dts/imx6dl-gw51xx.dts
+F:     arch/arm/dts/imx6dl-gw52xx.dts
+F:     arch/arm/dts/imx6dl-gw53xx.dts
+F:     arch/arm/dts/imx6dl-gw54xx.dts
+F:     arch/arm/dts/imx6dl-gw551x.dts
+F:     arch/arm/dts/imx6dl-gw552x.dts
+F:     arch/arm/dts/imx6dl-gw553x.dts
+F:     arch/arm/dts/imx6dl-gw560x.dts
+F:     arch/arm/dts/imx6dl-gw5903.dts
+F:     arch/arm/dts/imx6dl-gw5904.dts
+F:     arch/arm/dts/imx6dl-gw5905.dts
+F:     arch/arm/dts/imx6dl-gw5907.dts
+F:     arch/arm/dts/imx6dl-gw5910.dts
+F:     arch/arm/dts/imx6dl-gw5912.dts
+F:     arch/arm/dts/imx6dl-gw5913.dts
+F:     arch/arm/dts/imx6qdl-gw51xx.dtsi
+F:     arch/arm/dts/imx6qdl-gw52xx.dtsi
+F:     arch/arm/dts/imx6qdl-gw53xx.dtsi
+F:     arch/arm/dts/imx6qdl-gw54xx.dtsi
+F:     arch/arm/dts/imx6qdl-gw551x.dtsi
+F:     arch/arm/dts/imx6qdl-gw552x.dtsi
+F:     arch/arm/dts/imx6qdl-gw553x.dtsi
+F:     arch/arm/dts/imx6qdl-gw560x.dtsi
+F:     arch/arm/dts/imx6qdl-gw5903.dtsi
+F:     arch/arm/dts/imx6qdl-gw5904.dtsi
+F:     arch/arm/dts/imx6qdl-gw5905.dtsi
+F:     arch/arm/dts/imx6qdl-gw5907.dtsi
+F:     arch/arm/dts/imx6qdl-gw5910.dtsi
+F:     arch/arm/dts/imx6qdl-gw5912.dtsi
+F:     arch/arm/dts/imx6qdl-gw5913.dtsi
+F:     arch/arm/dts/imx6q-gw51xx.dts
+F:     arch/arm/dts/imx6q-gw52xx.dts
+F:     arch/arm/dts/imx6q-gw53xx.dts
+F:     arch/arm/dts/imx6q-gw5400-a.dts
+F:     arch/arm/dts/imx6q-gw54xx.dts
+F:     arch/arm/dts/imx6q-gw551x.dts
+F:     arch/arm/dts/imx6q-gw552x.dts
+F:     arch/arm/dts/imx6q-gw553x.dts
+F:     arch/arm/dts/imx6q-gw560x.dts
+F:     arch/arm/dts/imx6q-gw5901.dts
+F:     arch/arm/dts/imx6q-gw5902.dts
+F:     arch/arm/dts/imx6q-gw5903.dts
+F:     arch/arm/dts/imx6q-gw5904.dts
+F:     arch/arm/dts/imx6q-gw5905.dts
+F:     arch/arm/dts/imx6q-gw5907.dts
+F:     arch/arm/dts/imx6q-gw5910.dts
+F:     arch/arm/dts/imx6q-gw5912.dts
+F:     arch/arm/dts/imx6q-gw5913.dts
index 14f45bf..4627a15 100644 (file)
@@ -970,7 +970,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .rs485en = IMX_GPIO_NR(3, 24),
                .dioi2c_en = IMX_GPIO_NR(4,  5),
                .pcie_sson = IMX_GPIO_NR(1, 20),
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
                .mmc_cd = IMX_GPIO_NR(7, 0),
        },
 
@@ -990,7 +989,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .gps_shdn = IMX_GPIO_NR(1, 2),
                .vidin_en = IMX_GPIO_NR(5, 20),
                .wdis = IMX_GPIO_NR(7, 12),
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
                .nand = true,
        },
 
@@ -1014,7 +1012,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .wdis = IMX_GPIO_NR(7, 12),
                .msata_en = GP_MSATA_SEL,
                .rs232_en = GP_RS232_EN,
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
                .vsel_pin = IMX_GPIO_NR(6, 14),
                .mmc_cd = IMX_GPIO_NR(7, 0),
                .nand = true,
@@ -1039,7 +1036,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .wdis = IMX_GPIO_NR(7, 12),
                .msata_en = GP_MSATA_SEL,
                .rs232_en = GP_RS232_EN,
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
                .vsel_pin = IMX_GPIO_NR(6, 14),
                .mmc_cd = IMX_GPIO_NR(7, 0),
                .nand = true,
@@ -1066,7 +1062,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .wdis = IMX_GPIO_NR(5, 17),
                .msata_en = GP_MSATA_SEL,
                .rs232_en = GP_RS232_EN,
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
                .vsel_pin = IMX_GPIO_NR(6, 14),
                .mmc_cd = IMX_GPIO_NR(7, 0),
                .nand = true,
@@ -1117,7 +1112,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .pcie_rst = IMX_GPIO_NR(1, 0),
                .vidin_en = IMX_GPIO_NR(5, 20),
                .wdis = IMX_GPIO_NR(7, 12),
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
                .vsel_pin = IMX_GPIO_NR(6, 14),
                .mmc_cd = IMX_GPIO_NR(7, 0),
                .nand = true,
@@ -1140,7 +1134,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .rs232_en = GP_RS232_EN,
                .vidin_en = IMX_GPIO_NR(3, 31),
                .wdis = IMX_GPIO_NR(7, 12),
-               .otgpwr_en = IMX_GPIO_NR(4, 15),
                .mmc_cd = IMX_GPIO_NR(7, 0),
        },
 
@@ -1166,7 +1159,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                },
                .pcie_rst = IMX_GPIO_NR(1, 0),
                .rs232_en = GP_RS232_EN,
-               .otgpwr_en = IMX_GPIO_NR(3, 23),
                .nand = true,
        },
 
@@ -1179,7 +1171,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .leds = {
                        IMX_GPIO_NR(6, 14),
                },
-               .otgpwr_en = IMX_GPIO_NR(4, 15),
                .mmc_cd = IMX_GPIO_NR(6, 11),
        },
 
@@ -1197,7 +1188,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .pcie_rst = IMX_GPIO_NR(1, 0),
                .mezz_pwren = IMX_GPIO_NR(2, 19),
                .mezz_irq = IMX_GPIO_NR(2, 18),
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 
        /* GW5905 */
@@ -1279,7 +1269,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {
                .pcie_rst = IMX_GPIO_NR(1, 0),
                .mezz_pwren = IMX_GPIO_NR(2, 19),
                .mezz_irq = IMX_GPIO_NR(2, 18),
-               .otgpwr_en = IMX_GPIO_NR(3, 22),
        },
 };
 
@@ -1382,12 +1371,6 @@ void setup_iomux_gpio(int board, struct ventana_board_info *info)
                gpio_direction_output(gpio_cfg[board].wdis, 1);
        }
 
-       /* OTG power off */
-       if (gpio_cfg[board].otgpwr_en) {
-               gpio_request(gpio_cfg[board].otgpwr_en, "usbotg_pwr");
-               gpio_direction_output(gpio_cfg[board].otgpwr_en, 0);
-       }
-
        /* sense vselect pin to see if we support uhs-i */
        if (gpio_cfg[board].vsel_pin) {
                gpio_request(gpio_cfg[board].vsel_pin, "sd3_vselect");
index 5cec01c..d73850c 100644 (file)
@@ -75,7 +75,6 @@ struct ventana {
        int wdis;
        int msata_en;
        int rs232_en;
-       int otgpwr_en;
        int vsel_pin;
        int mmc_cd;
        /* various features */
index bcb6bca..ffed6b5 100644 (file)
@@ -14,6 +14,8 @@
 #include <i2c.h>
 #include <linux/ctype.h>
 
+#include <asm/arch/sys_proto.h>
+
 #include "ventana_eeprom.h"
 #include "gsc.h"
 
@@ -179,6 +181,92 @@ int gsc_boot_wd_disable(void)
        return 1;
 }
 
+/* determine BOM revision from model */
+int get_bom_rev(const char *str)
+{
+       int  rev_bom = 0;
+       int i;
+
+       for (i = strlen(str) - 1; i > 0; i--) {
+               if (str[i] == '-')
+                       break;
+               if (str[i] >= '1' && str[i] <= '9') {
+                       rev_bom = str[i] - '0';
+                       break;
+               }
+       }
+       return rev_bom;
+}
+
+/* determine PCB revision from model */
+char get_pcb_rev(const char *str)
+{
+       char rev_pcb = 'A';
+       int i;
+
+       for (i = strlen(str) - 1; i > 0; i--) {
+               if (str[i] == '-')
+                       break;
+               if (str[i] >= 'A') {
+                       rev_pcb = str[i];
+                       break;
+               }
+       }
+       return rev_pcb;
+}
+
+/*
+ * get dt name based on model and detail level:
+ */
+const char *gsc_get_dtb_name(int level, char *buf, int sz)
+{
+       const char *model = (const char *)ventana_info.model;
+       const char *pre = is_mx6dq() ? "imx6q-" : "imx6dl-";
+       int modelno, rev_pcb, rev_bom;
+
+       /* a few board models are dt equivalents to other models */
+       if (strncasecmp(model, "gw5906", 6) == 0)
+               model = "gw552x-d";
+       else if (strncasecmp(model, "gw5908", 6) == 0)
+               model = "gw53xx-f";
+       else if (strncasecmp(model, "gw5905", 6) == 0)
+               model = "gw5904-a";
+
+       modelno = ((model[2] - '0') * 1000)
+                 + ((model[3] - '0') * 100)
+                 + ((model[4] - '0') * 10)
+                 + (model[5] - '0');
+       rev_pcb = tolower(get_pcb_rev(model));
+       rev_bom = get_bom_rev(model);
+
+       /* compare model/rev/bom in order of most specific to least */
+       snprintf(buf, sz, "%s%04d", pre, modelno);
+       switch (level) {
+       case 0: /* full model first (ie gw5400-a1) */
+               if (rev_bom) {
+                       snprintf(buf, sz, "%sgw%04d-%c%d", pre, modelno, rev_pcb, rev_bom);
+                       break;
+               }
+               fallthrough;
+       case 1: /* don't care about bom rev (ie gw5400-a) */
+               snprintf(buf, sz, "%sgw%04d-%c", pre, modelno, rev_pcb);
+               break;
+       case 2: /* don't care about the pcb rev (ie gw5400) */
+               snprintf(buf, sz, "%sgw%04d", pre, modelno);
+               break;
+       case 3: /* look for generic model (ie gw540x) */
+               snprintf(buf, sz, "%sgw%03dx", pre, modelno / 10);
+               break;
+       case 4: /* look for more generic model (ie gw54xx) */
+               snprintf(buf, sz, "%sgw%02dxx", pre, modelno / 100);
+               break;
+       default: /* give up */
+               return NULL;
+       }
+
+       return buf;
+}
+
 #if defined(CONFIG_CMD_GSC) && !defined(CONFIG_SPL_BUILD)
 static int do_gsc_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
                        char *const argv[])
index 6dcaafa..29d375b 100644 (file)
@@ -67,5 +67,6 @@ int gsc_i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len);
 int gsc_i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len);
 int gsc_info(int verbose);
 int gsc_boot_wd_disable(void);
+const char *gsc_get_dtb_name(int level, char *buf, int sz);
 #endif
 
index 71de80c..5237f2d 100644 (file)
 #include <asm/gpio.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/sata.h>
-#include <asm/mach-imx/spi.h>
 #include <asm/mach-imx/video.h>
 #include <asm/io.h>
 #include <asm/setup.h>
 #include <dm.h>
-#include <dm/platform_data/serial_mxc.h>
 #include <env.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <fdt_support.h>
-#include <fsl_esdhc_imx.h>
 #include <jffs2/load_kernel.h>
 #include <linux/ctype.h>
 #include <miiphy.h>
@@ -43,7 +40,6 @@
 #include <power/pfuze100_pmic.h>
 #include <fdt_support.h>
 #include <jffs2/load_kernel.h>
-#include <spi_flash.h>
 
 #include "gsc.h"
 #include "common.h"
@@ -56,7 +52,6 @@ DECLARE_GLOBAL_DATA_PTR;
  * read it once.
  */
 struct ventana_board_info ventana_info;
-
 static int board_type;
 
 /* ENET */
@@ -83,54 +78,6 @@ static iomux_v3_cfg_t const enet_pads[] = {
        IOMUX_PADS(PAD_ENET_TXD0__GPIO1_IO30 | DIO_PAD_CFG),
 };
 
-#ifdef CONFIG_CMD_NAND
-static iomux_v3_cfg_t const nfc_pads[] = {
-       IOMUX_PADS(PAD_NANDF_CLE__NAND_CLE     | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_ALE__NAND_ALE     | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_WP_B__NAND_WP_B   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_RB0__NAND_READY_B | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_CS0__NAND_CE0_B   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_SD4_CMD__NAND_RE_B      | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_SD4_CLK__NAND_WE_B      | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D0__NAND_DATA00   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D1__NAND_DATA01   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D2__NAND_DATA02   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D3__NAND_DATA03   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D4__NAND_DATA04   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D5__NAND_DATA05   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D6__NAND_DATA06   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       IOMUX_PADS(PAD_NANDF_D7__NAND_DATA07   | MUX_PAD_CTRL(NO_PAD_CTRL)),
-};
-
-static void setup_gpmi_nand(void)
-{
-       struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
-
-       /* config gpmi nand iomux */
-       SETUP_IOMUX_PADS(nfc_pads);
-
-       /* config gpmi and bch clock to 100 MHz */
-       clrsetbits_le32(&mxc_ccm->cs2cdr,
-                       MXC_CCM_CS2CDR_ENFC_CLK_PODF_MASK |
-                       MXC_CCM_CS2CDR_ENFC_CLK_PRED_MASK |
-                       MXC_CCM_CS2CDR_ENFC_CLK_SEL_MASK,
-                       MXC_CCM_CS2CDR_ENFC_CLK_PODF(0) |
-                       MXC_CCM_CS2CDR_ENFC_CLK_PRED(3) |
-                       MXC_CCM_CS2CDR_ENFC_CLK_SEL(3));
-
-       /* enable gpmi and bch clock gating */
-       setbits_le32(&mxc_ccm->CCGR4,
-                    MXC_CCM_CCGR4_RAWNAND_U_BCH_INPUT_APB_MASK |
-                    MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_BCH_MASK |
-                    MXC_CCM_CCGR4_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_MASK |
-                    MXC_CCM_CCGR4_RAWNAND_U_GPMI_INPUT_APB_MASK |
-                    MXC_CCM_CCGR4_PL301_MX6QPER1_BCH_OFFSET);
-
-       /* enable apbh clock gating */
-       setbits_le32(&mxc_ccm->CCGR0, MXC_CCM_CCGR0_APBHDMA_MASK);
-}
-#endif
-
 static void setup_iomux_enet(int gpio)
 {
        SETUP_IOMUX_PADS(enet_pads);
@@ -144,18 +91,14 @@ static void setup_iomux_enet(int gpio)
 }
 
 #ifdef CONFIG_USB_EHCI_MX6
-static iomux_v3_cfg_t const usb_pads[] = {
-       IOMUX_PADS(PAD_GPIO_1__USB_OTG_ID   | DIO_PAD_CFG),
-       IOMUX_PADS(PAD_KEY_COL4__USB_OTG_OC | DIO_PAD_CFG),
-       /* OTG PWR */
-       IOMUX_PADS(PAD_EIM_D22__GPIO3_IO22  | DIO_PAD_CFG),
-};
-
+/* toggle USB_HUB_RST# for boards that have it; it is not defined in dt */
 int board_ehci_hcd_init(int port)
 {
        int gpio;
 
-       SETUP_IOMUX_PADS(usb_pads);
+       /* USB HUB is always on P1 */
+       if (port == 0)
+               return 0;
 
        /* Reset USB HUB */
        switch (board_type) {
@@ -180,40 +123,8 @@ int board_ehci_hcd_init(int port)
 
        return 0;
 }
-
-int board_ehci_power(int port, int on)
-{
-       /* enable OTG VBUS */
-       if (!port && board_type < GW_UNKNOWN) {
-               if (gpio_cfg[board_type].otgpwr_en)
-                       gpio_set_value(gpio_cfg[board_type].otgpwr_en, on);
-       }
-       return 0;
-}
 #endif /* CONFIG_USB_EHCI_MX6 */
 
-#ifdef CONFIG_MXC_SPI
-iomux_v3_cfg_t const ecspi1_pads[] = {
-       /* SS1 */
-       IOMUX_PADS(PAD_EIM_D19__GPIO3_IO19  | MUX_PAD_CTRL(SPI_PAD_CTRL)),
-       IOMUX_PADS(PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL)),
-       IOMUX_PADS(PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL)),
-       IOMUX_PADS(PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL)),
-};
-
-int board_spi_cs_gpio(unsigned bus, unsigned cs)
-{
-       return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(3, 19)) : -1;
-}
-
-static void setup_spi(void)
-{
-       gpio_request(IMX_GPIO_NR(3, 19), "spi_cs");
-       gpio_direction_output(IMX_GPIO_NR(3, 19), 1);
-       SETUP_IOMUX_PADS(ecspi1_pads);
-}
-#endif
-
 /* configure eth0 PHY board-specific LED behavior */
 int board_phy_config(struct phy_device *phydev)
 {
@@ -629,8 +540,6 @@ void get_board_serial(struct tag_serialnr *serialnr)
 
 int board_early_init_f(void)
 {
-       setup_iomux_uart();
-
 #if defined(CONFIG_VIDEO_IPUV3)
        setup_display();
 #endif
@@ -658,25 +567,33 @@ int board_init(void)
        setup_ventana_i2c(0);
        board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info);
 
-#ifdef CONFIG_CMD_NAND
-       if (gpio_cfg[board_type].nand)
-               setup_gpmi_nand();
-#endif
-#ifdef CONFIG_MXC_SPI
-       setup_spi();
-#endif
        setup_ventana_i2c(1);
        setup_ventana_i2c(2);
 
-#ifdef CONFIG_SATA
-       setup_sata();
-#endif
-
        setup_iomux_gpio(board_type, &ventana_info);
 
        return 0;
 }
 
+int board_fit_config_name_match(const char *name)
+{
+       static char init;
+       const char *dtb;
+       char buf[32];
+       int i = 0;
+
+       do {
+               dtb = gsc_get_dtb_name(i++, buf, sizeof(buf));
+               if (dtb && !strcmp(dtb, name)) {
+                       if (!init++)
+                               printf("DTB:   %s\n", name);
+                       return 0;
+               }
+       } while (dtb);
+
+       return -1;
+}
+
 #if defined(CONFIG_DISPLAY_BOARDINFO_LATE)
 /*
  * called during late init (after relocation and after board_init())
@@ -1371,12 +1288,3 @@ int ft_board_setup(void *blob, struct bd_info *bd)
        return 0;
 }
 #endif /* CONFIG_OF_BOARD_SETUP */
-
-static struct mxc_serial_plat ventana_mxc_serial_plat = {
-       .reg = (struct mxc_uart *)UART2_BASE,
-};
-
-U_BOOT_DRVINFO(ventana_serial) = {
-       .name   = "serial_mxc",
-       .plat = &ventana_mxc_serial_plat,
-};
index e0e4bac..a4f6439 100644 (file)
@@ -731,8 +731,16 @@ void board_boot_order(u32 *spl_boot_list)
 /* its our chance to print info about boot device */
 void spl_board_init(void)
 {
+       u32 boot_device;
+       int board_type;
+
        /* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 */
-       u32 boot_device = spl_boot_device();
+       boot_device = spl_boot_device();
+
+       /* read eeprom again now that we have gd */
+       board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info);
+       if (board_type == GW_UNKNOWN)
+               hang();
 
        switch (boot_device) {
        case BOOT_DEVICE_MMC1:
index ad3f8d9..d2490e6 100644 (file)
@@ -125,29 +125,18 @@ enum {
 
 static struct udevice *gsc_get_dev(int busno, int slave)
 {
-       struct udevice *dev;
+       static const char * const i2c[] = { "i2c@30a20000", "i2c@30a30000" };
+       struct udevice *dev, *bus;
        int ret;
 
-#if (IS_ENABLED(CONFIG_SPL_BUILD))
-       ret = i2c_get_chip_for_busnum(busno + 1, slave, 1, &dev);
-       if (ret)
-               return NULL;
-#else
-       struct udevice *bus;
-
-       busno--;
-
-       ret = uclass_get_device_by_seq(UCLASS_I2C, busno, &bus);
+       ret = uclass_get_device_by_name(UCLASS_I2C, i2c[busno - 1], &bus);
        if (ret) {
-               printf("i2c%d: no bus %d\n", busno + 1, ret);
+               printf("GSC     : failed I2C%d probe: %d\n", busno, ret);
                return NULL;
        }
-       ret = i2c_get_chip(bus, slave, 1, &dev);
-       if (ret) {
-               printf("i2c%d@0x%02x: no chip %d\n", busno + 1, slave, ret);
+       ret = dm_i2c_probe(bus, slave, 0, &dev);
+       if (ret)
                return NULL;
-       }
-#endif
 
        return dev;
 }
index d1e189c..bdd5fcd 100644 (file)
@@ -57,18 +57,6 @@ int dram_init(void)
        return mxs_dram_init();
 }
 
-#ifdef CONFIG_CMD_MMC
-static int mx23_olx_mmc_cd(int id)
-{
-       return 1;       /* Card always present */
-}
-
-int board_mmc_init(struct bd_info *bis)
-{
-       return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd);
-}
-#endif
-
 int board_init(void)
 {
        /* Adress of boot parameters */
index eefdd7f..f9fa8d1 100644 (file)
@@ -53,7 +53,7 @@ int power_init_board(void)
        struct pmic *p;
        int ret;
 
-       ret = power_pca9450_init(0);
+       ret = power_pca9450_init(0, 0x25);
        if (ret)
                printf("power init failed");
        p = pmic_get("PCA9450");
similarity index 91%
rename from board/sifive/fu540/Kconfig
rename to board/sifive/unleashed/Kconfig
index 64fdbd4..dbffd59 100644 (file)
@@ -1,7 +1,7 @@
-if TARGET_SIFIVE_FU540
+if TARGET_SIFIVE_UNLEASHED
 
 config SYS_BOARD
-       default "fu540"
+       default "unleashed"
 
 config SYS_VENDOR
        default "sifive"
@@ -10,7 +10,7 @@ config SYS_CPU
        default "fu540"
 
 config SYS_CONFIG_NAME
-       default "sifive-fu540"
+       default "sifive-unleashed"
 
 config SYS_TEXT_BASE
        default 0x80200000 if SPL
similarity index 50%
rename from board/sifive/fu540/MAINTAINERS
rename to board/sifive/unleashed/MAINTAINERS
index 2762072..2ea0074 100644 (file)
@@ -1,10 +1,10 @@
-SiFive FU540 BOARD
+SiFive HiFive Unleashed BOARD
 M:     Paul Walmsley <paul.walmsley@sifive.com>
 M:     Palmer Dabbelt <palmer@dabbelt.com>
 M:     Anup Patel <anup.patel@wdc.com>
 M:     Atish Patra <atish.patra@wdc.com>
 S:     Maintained
-F:     board/sifive/fu540/
-F:     doc/board/sifive/fu540.rst
-F:     include/configs/sifive-fu540.h
-F:     configs/sifive_fu540_defconfig
+F:     board/sifive/unleashed/
+F:     doc/board/sifive/unleashed.rst
+F:     include/configs/sifive-unleashed.h
+F:     configs/sifive_unleashed_defconfig
similarity index 87%
rename from board/sifive/fu540/Makefile
rename to board/sifive/unleashed/Makefile
index b05e2f5..5821679 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Copyright (c) 2019 Western Digital Corporation or its affiliates.
 
-obj-y  += fu540.o
+obj-y  += unleashed.o
 
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
index 2cdea8e..adf6abb 100644 (file)
@@ -69,4 +69,6 @@ config BOARD_SPECIFIC_OPTIONS
        imply EFI_PARTITION
        imply CMD_PART
        imply CMD_FS_GENERIC
+       imply WDT
+       imply DESIGNWARE_WATCHDOG
 endif
index bd098b4..0558521 100644 (file)
@@ -1,6 +1,6 @@
 MX6CUBOXI BOARD
 M:     Baruch Siach <baruch@tkos.co.il>
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/solidrun/mx6cuboxi/
 F:     include/configs/mx6cuboxi.h
index 143cc6e..efa38a0 100644 (file)
@@ -69,8 +69,8 @@ int spl_dram_init(void)
 }
 void spl_board_init(void)
 {
-       spl_dram_init();
        preloader_console_init();
+       spl_dram_init();
        arch_cpu_init(); /* to configure mpu for sdram rw permissions */
 }
 u32 spl_boot_device(void)
index e9b5a97..f94a011 100644 (file)
@@ -1,6 +1,6 @@
 TechNexion PICO-IMX6UL board
 M:     Richard Hu <richard.hu@technexion.com>
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/technexion/pico-imx6ul/
 F:     include/configs/pico-imx6ul.h
index 62a54d0..682c88d 100644 (file)
@@ -159,7 +159,7 @@ int power_init_board(void)
        struct udevice *dev;
        int ret, dev_id, rev_id;
 
-       ret = pmic_get("pfuze3000", &dev);
+       ret = pmic_get("pfuze3000@8", &dev);
        if (ret == -ENODEV)
                return 0;
        if (ret != 0)
index b05243c..195882b 100644 (file)
@@ -1,5 +1,5 @@
 UDOO BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/udoo/
 F:     include/configs/udoo.h
index d83f23d..5c49388 100644 (file)
@@ -19,8 +19,6 @@
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/sata.h>
-#include <mmc.h>
-#include <fsl_esdhc_imx.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
@@ -56,15 +54,6 @@ static iomux_v3_cfg_t const uart2_pads[] = {
        IOMUX_PADS(PAD_EIM_D27__UART2_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)),
 };
 
-static iomux_v3_cfg_t const usdhc3_pads[] = {
-       IOMUX_PADS(PAD_SD3_CLK__SD3_CLK    | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-       IOMUX_PADS(PAD_SD3_CMD__SD3_CMD    | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-       IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-       IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-       IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-       IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
-};
-
 static iomux_v3_cfg_t const wdog_pads[] = {
        IOMUX_PADS(PAD_EIM_A24__GPIO5_IO04 | MUX_PAD_CTRL(NO_PAD_CTRL)),
        IOMUX_PADS(PAD_EIM_D19__GPIO3_IO19),
@@ -99,45 +88,8 @@ int mx6_rgmii_rework(struct phy_device *phydev)
        return 0;
 }
 
-static iomux_v3_cfg_t const enet_pads1[] = {
-       IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_ENET_MDC__ENET_MDC               | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TXC__RGMII_TXC     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD0__RGMII_TD0     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD1__RGMII_TD1     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD2__RGMII_TD2     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD3__RGMII_TD3     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL       | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK        | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RXC__RGMII_RXC     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       /* RGMII reset */
-       IOMUX_PADS(PAD_EIM_D23__GPIO3_IO23              | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* Ethernet power supply */
-       IOMUX_PADS(PAD_EIM_EB3__GPIO2_IO31              | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 32 - 1 - (MODE0) all */
-       IOMUX_PADS(PAD_RGMII_RD0__GPIO6_IO25            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 31 - 1 - (MODE1) all */
-       IOMUX_PADS(PAD_RGMII_RD1__GPIO6_IO27            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 28 - 1 - (MODE2) all */
-       IOMUX_PADS(PAD_RGMII_RD2__GPIO6_IO28            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 27 - 1 - (MODE3) all */
-       IOMUX_PADS(PAD_RGMII_RD3__GPIO6_IO29            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */
-       IOMUX_PADS(PAD_RGMII_RX_CTL__GPIO6_IO24 | MUX_PAD_CTRL(NO_PAD_CTRL)),
-};
-
-static iomux_v3_cfg_t const enet_pads2[] = {
-       IOMUX_PADS(PAD_RGMII_RD0__RGMII_RD0     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD1__RGMII_RD1     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD2__RGMII_RD2     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD3__RGMII_RD3     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL       | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-};
-
 static void setup_iomux_enet(void)
 {
-       SETUP_IOMUX_PADS(enet_pads1);
-       udelay(20);
        gpio_direction_output(IMX_GPIO_NR(2, 31), 1); /* Power supply on */
 
        gpio_direction_output(IMX_GPIO_NR(3, 23), 0); /* assert PHY rst */
@@ -159,8 +111,6 @@ static void setup_iomux_enet(void)
        gpio_free(IMX_GPIO_NR(6, 27));
        gpio_free(IMX_GPIO_NR(6, 28));
        gpio_free(IMX_GPIO_NR(6, 29));
-
-       SETUP_IOMUX_PADS(enet_pads2);
 }
 
 static void setup_iomux_uart(void)
@@ -176,56 +126,6 @@ static void setup_iomux_wdog(void)
        gpio_direction_input(WDT_TRG);
 }
 
-static struct fsl_esdhc_cfg usdhc_cfg = { USDHC3_BASE_ADDR };
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-       return 1; /* Always present */
-}
-
-int board_eth_init(struct bd_info *bis)
-{
-       uint32_t base = IMX_FEC_BASE;
-       struct mii_dev *bus = NULL;
-       struct phy_device *phydev = NULL;
-       int ret;
-
-       setup_iomux_enet();
-
-#ifdef CONFIG_FEC_MXC
-       bus = fec_get_miibus(base, -1);
-       if (!bus)
-               return -EINVAL;
-       /* scan phy 4,5,6,7 */
-       phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII);
-
-       if (!phydev) {
-               ret = -EINVAL;
-               goto free_bus;
-       }
-       printf("using phy at %d\n", phydev->addr);
-       ret  = fec_probe(bis, -1, base, bus, phydev);
-       if (ret)
-               goto free_phydev;
-#endif
-       return 0;
-
-free_phydev:
-       free(phydev);
-free_bus:
-       free(bus);
-       return ret;
-}
-
-int board_mmc_init(struct bd_info *bis)
-{
-       SETUP_IOMUX_PADS(usdhc3_pads);
-       usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-       usdhc_cfg.max_bus_width = 4;
-
-       return fsl_esdhc_initialize(bis, &usdhc_cfg);
-}
-
 int board_early_init_f(void)
 {
        setup_iomux_wdog();
@@ -248,9 +148,6 @@ int board_init(void)
        /* address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-#ifdef CONFIG_SATA
-       setup_sata();
-#endif
        return 0;
 }
 
@@ -262,6 +159,8 @@ int board_late_init(void)
        else
                env_set("board_rev", "MX6DL");
 #endif
+       setup_iomux_enet();
+
        return 0;
 }
 
index 00a31a9..3c2a06c 100644 (file)
@@ -1,5 +1,5 @@
 WANDBOARD BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     arch/arm/dts/imx6qdl-wandboard.dtsi
 F:     arch/arm/dts/imx6qdl-wandboard-revb1.dtsi
index 55f8c81..ebb21f8 100644 (file)
@@ -1,5 +1,5 @@
 WARP7 BOARD
-M:     Fabio Estevam <fabio.estevam@nxp.com>
+M:     Fabio Estevam <festevam@gmail.com>
 S:     Maintained
 F:     board/warp7/
 F:     include/configs/warp7.h
index 9bf5e86..c735e81 100644 (file)
@@ -1960,6 +1960,8 @@ config CMD_AES
 
 config CMD_BLOB
        bool "Enable the 'blob' command"
+       depends on !MX6ULL && !MX6SLL && !MX6SL
+       select IMX_HAB if ARCH_MX6 || ARCH_MX7 || ARCH_MX7ULP || ARCH_IMX8M
        help
          This is used with the Freescale secure boot mechanism.
 
index c80e697..887219c 100644 (file)
@@ -9,6 +9,11 @@
 #include <malloc.h>
 #include <asm/byteorder.h>
 #include <linux/compiler.h>
+#if defined(CONFIG_ARCH_MX6) || defined(CONFIG_ARCH_MX7) || \
+       defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_ARCH_IMX8M)
+#include <fsl_sec.h>
+#include <asm/arch/clock.h>
+#endif
 
 /**
  * blob_decap() - Decapsulate the data as a blob
@@ -74,6 +79,17 @@ static int do_blob(struct cmd_tbl *cmdtp, int flag, int argc,
        src_ptr = (uint8_t *)(uintptr_t)src_addr;
        dst_ptr = (uint8_t *)(uintptr_t)dst_addr;
 
+#if defined(CONFIG_ARCH_MX6) || defined(CONFIG_ARCH_MX7) || \
+       defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_ARCH_IMX8M)
+
+       hab_caam_clock_enable(1);
+
+       u32 out_jr_size = sec_in32(CONFIG_SYS_FSL_JR0_ADDR +
+                                  FSL_CAAM_ORSR_JRa_OFFSET);
+       if (out_jr_size != FSL_CAAM_MAX_JR_SIZE)
+               sec_init();
+#endif
+
        if (enc)
                ret = blob_encap(km_ptr, src_ptr, dst_ptr, len);
        else
index 0711cbf..0f528f3 100644 (file)
@@ -330,7 +330,8 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
                     ARCH_MX6 || ARCH_MX7 || \
                     ARCH_ROCKCHIP || ARCH_MVEBU ||  ARCH_SOCFPGA || \
                     ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \
-                    OMAP44XX || OMAP54XX || AM33XX || AM43XX || TARGET_SIFIVE_FU540
+                    OMAP44XX || OMAP54XX || AM33XX || AM43XX || \
+                    TARGET_SIFIVE_UNLEASHED
        help
          Use sector number for specifying U-Boot location on MMC/SD in
          raw mode.
@@ -347,7 +348,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
        default 0x300 if ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || OMAP44XX || \
                         OMAP54XX || AM33XX || AM43XX || ARCH_K3
        default 0x4000 if ARCH_ROCKCHIP
-       default 0x822 if TARGET_SIFIVE_FU540
+       default 0x822 if TARGET_SIFIVE_UNLEASHED
        help
          Address on the MMC to load U-Boot from, when the MMC is being used
          in raw mode. Units: MMC sectors (1 sector = 512 bytes).
index d13a524..59f4a84 100644 (file)
@@ -42,21 +42,33 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
 static ulong spl_nand_fit_read(struct spl_load_info *load, ulong offs,
                               ulong size, void *dst)
 {
-       ulong sector;
        int err;
+#ifdef CONFIG_SYS_NAND_BLOCK_SIZE
+       ulong sector;
 
        sector = *(int *)load->priv;
        offs = sector + nand_spl_adjust_offset(sector, offs - sector);
+#else
+       offs *= load->bl_len;
+       size *= load->bl_len;
+#endif
        err = nand_spl_load_image(offs, size, dst);
        if (err)
                return 0;
 
-       return size;
+       return size / load->bl_len;
+}
+
+struct mtd_info * __weak nand_get_mtd(void)
+{
+       return NULL;
 }
 
 static int spl_nand_load_element(struct spl_image_info *spl_image,
                                 int offset, struct image_header *header)
 {
+       struct mtd_info *mtd = nand_get_mtd();
+       int bl_len = mtd ? mtd->writesize : 1;
        int err;
 
        err = nand_spl_load_image(offset, sizeof(*header), (void *)header);
@@ -71,18 +83,18 @@ static int spl_nand_load_element(struct spl_image_info *spl_image,
                load.dev = NULL;
                load.priv = &offset;
                load.filename = NULL;
-               load.bl_len = 1;
+               load.bl_len = bl_len;
                load.read = spl_nand_fit_read;
-               return spl_load_simple_fit(spl_image, &load, offset, header);
+               return spl_load_simple_fit(spl_image, &load, offset / bl_len, header);
        } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
                struct spl_load_info load;
 
                load.dev = NULL;
                load.priv = NULL;
                load.filename = NULL;
-               load.bl_len = 1;
+               load.bl_len = bl_len;
                load.read = spl_nand_fit_read;
-               return spl_load_imx_container(spl_image, &load, offset);
+               return spl_load_imx_container(spl_image, &load, offset / bl_len);
        } else {
                err = spl_parse_image_header(spl_image, header);
                if (err)
index 3e6dcec..e1c0f69 100644 (file)
@@ -20,11 +20,11 @@ CONFIG_DEFAULT_DEVICE_TREE="armada-xp-synology-ds414"
 CONFIG_DEBUG_UART=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="console=ttyS0,115200"
-CONFIG_USE_PREBOOT=y
-CONFIG_PREBOOT="usb start; sf probe"
+CONFIG_BOOTARGS="console=ttyS0,115200 ip=off initrd=0x8000040,8M root=/dev/md0 rw syno_hw_version=DS414r1 ihd_num=4 netif_num=2 flash_size=8 SataLedSpecial=1 HddHotplug=1"
+# CONFIG_USE_PREBOOT is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_MISC_INIT_R=y
 CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_I2C=y
@@ -47,7 +47,6 @@ CONFIG_ENV_OVERWRITE=y
 CONFIG_USE_ENV_SPI_MAX_HZ=y
 CONFIG_ENV_SPI_MAX_HZ=50000000
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_BLK=y
 # CONFIG_MMC is not set
@@ -65,5 +64,8 @@ CONFIG_SYS_NS16550=y
 CONFIG_KIRKWOOD_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+# CONFIG_USB_XHCI_MVEBU is not set
+CONFIG_USB_XHCI_PCI=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
index 41e190b..d5270c5 100644 (file)
@@ -18,8 +18,13 @@ CONFIG_SPL_STACK_R_ADDR=0x18000000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0xD1400
 CONFIG_CMD_HDMIDETECT=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-gw54xx"
+CONFIG_AHCI=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
@@ -31,6 +36,7 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
+CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
@@ -62,6 +68,9 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=nand:16m(uboot),1m(env),-(rootfs)"
 CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIST="imx6q-gw51xx imx6dl-gw51xx imx6q-gw52xx imx6dl-gw52xx imx6q-gw53xx imx6dl-gw53xx imx6q-gw54xx imx6dl-gw54xx imx6q-gw551x imx6dl-gw551x imx6q-gw552x imx6dl-gw552x imx6q-gw553x imx6dl-gw553x imx6q-gw560x imx6dl-gw560x imx6q-gw5903 imx6dl-gw5903 imx6q-gw5904 imx6dl-gw5904 imx6q-gw5907 imx6dl-gw5907 imx6q-gw5910 imx6dl-gw5910 imx6q-gw5912 imx6dl-gw5912 imx6q-gw5913 imx6dl-gw5913"
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
@@ -71,6 +80,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_DM=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_DWC_AHSATA=y
+CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
@@ -79,11 +89,20 @@ CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
@@ -107,5 +126,4 @@ CONFIG_DM_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 # CONFIG_PANEL is not set
 CONFIG_VIDEO_IPUV3=y
-CONFIG_OF_LIBFDT=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
index 66b0441..091bf30 100644 (file)
@@ -18,8 +18,13 @@ CONFIG_SPL_STACK_R_ADDR=0x18000000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0xD1400
 CONFIG_CMD_HDMIDETECT=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-gw54xx"
+CONFIG_AHCI=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
@@ -31,6 +36,7 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
+CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
@@ -62,6 +68,9 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=nand:16m(uboot),1m(env),-(rootfs)"
 CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIST="imx6q-gw51xx imx6dl-gw51xx imx6q-gw52xx imx6dl-gw52xx imx6q-gw53xx imx6dl-gw53xx imx6q-gw54xx imx6dl-gw54xx imx6q-gw551x imx6dl-gw551x imx6q-gw552x imx6dl-gw552x imx6q-gw553x imx6dl-gw553x imx6q-gw560x imx6dl-gw560x imx6q-gw5903 imx6dl-gw5903 imx6q-gw5904 imx6dl-gw5904 imx6q-gw5907 imx6dl-gw5907 imx6q-gw5910 imx6dl-gw5910 imx6q-gw5912 imx6dl-gw5912 imx6q-gw5913 imx6dl-gw5913"
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
@@ -71,6 +80,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_DM=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_DWC_AHSATA=y
+CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
@@ -83,11 +93,20 @@ CONFIG_MV88E61XX_FIXED_PORTS=0x0
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
@@ -111,5 +130,4 @@ CONFIG_DM_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 # CONFIG_PANEL is not set
 CONFIG_VIDEO_IPUV3=y
-CONFIG_OF_LIBFDT=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
index 9022f35..0ccd3e9 100644 (file)
@@ -18,8 +18,13 @@ CONFIG_SPL_STACK_R_ADDR=0x18000000
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x1080000
 CONFIG_CMD_HDMIDETECT=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-gw54xx"
+CONFIG_AHCI=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
@@ -31,6 +36,7 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
+CONFIG_SPL_FIT_IMAGE_TINY=y
 CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_NAND_SUPPORT=y
@@ -65,6 +71,9 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nand0=nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=nand:16m(uboot),1m(env),-(rootfs)"
 CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIST="imx6q-gw51xx imx6dl-gw51xx imx6q-gw52xx imx6dl-gw52xx imx6q-gw53xx imx6dl-gw53xx imx6q-gw54xx imx6dl-gw54xx imx6q-gw551x imx6dl-gw551x imx6q-gw552x imx6dl-gw552x imx6q-gw553x imx6dl-gw553x imx6q-gw560x imx6dl-gw560x imx6q-gw5903 imx6dl-gw5903 imx6q-gw5904 imx6dl-gw5904 imx6q-gw5907 imx6dl-gw5907 imx6q-gw5910 imx6dl-gw5910 imx6q-gw5912 imx6dl-gw5912 imx6q-gw5913 imx6dl-gw5913"
+CONFIG_MULTI_DTB_FIT=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
@@ -73,21 +82,33 @@ CONFIG_NETCONSOLE=y
 CONFIG_DM=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_DWC_AHSATA=y
+CONFIG_DM_MMC=y
 CONFIG_SUPPORT_EMMC_RPMB=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_NAND_MXS=y
+CONFIG_NAND_MXS_DT=y
 CONFIG_PHYLIB=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_CONS_INDEX=2
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
@@ -111,5 +132,4 @@ CONFIG_DM_VIDEO=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 # CONFIG_PANEL is not set
 CONFIG_VIDEO_IPUV3=y
-CONFIG_OF_LIBFDT=y
 CONFIG_FDT_FIXUP_PARTITIONS=y
index e22b7de..23741a1 100644 (file)
@@ -21,9 +21,9 @@ CONFIG_DEFAULT_DEVICE_TREE="imx8mm-evk"
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg"
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SEPARATE_BSS=y
@@ -83,7 +83,7 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
 CONFIG_DM_PMIC=y
-CONFIG_SPL_DM_PMIC_BD71837=y
+CONFIG_SPL_DM_PMIC_PCA9450=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
index d6a3385..567a6e5 100644 (file)
@@ -49,6 +49,7 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
+CONFIG_CMD_SPI=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
@@ -90,11 +91,14 @@ CONFIG_MMC_UHS_SUPPORT=y
 CONFIG_MMC_HS400_ES_SUPPORT=y
 CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_FSL_USDHC=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=40000000
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_ATHEROS=y
 CONFIG_DM_ETH=y
@@ -116,6 +120,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_NXP_FSPI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_DM_THERMAL=y
index 2c12bda..b10cd13 100644 (file)
@@ -22,9 +22,9 @@ CONFIG_DEFAULT_DEVICE_TREE="imx8mn-ddr4-evk"
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg"
 CONFIG_DEFAULT_FDT_FILE="imx8mn-ddr4-evk.dtb"
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_BOARD_INIT=y
diff --git a/configs/imx8mn_evk_defconfig b/configs/imx8mn_evk_defconfig
new file mode 100644 (file)
index 0000000..d0e5b58
--- /dev/null
@@ -0,0 +1,93 @@
+CONFIG_ARM=y
+CONFIG_SPL_SYS_ICACHE_OFF=y
+CONFIG_SPL_SYS_DCACHE_OFF=y
+CONFIG_ARCH_IMX8M=y
+CONFIG_SYS_TEXT_BASE=0x40200000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x10000
+CONFIG_ENV_SECT_SIZE=0x10000
+CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_OFFSET=0x400000
+CONFIG_SYS_I2C_MXC_I2C1=y
+CONFIG_SYS_I2C_MXC_I2C2=y
+CONFIG_SYS_I2C_MXC_I2C3=y
+CONFIG_DM_GPIO=y
+CONFIG_SPL_TEXT_BASE=0x912000
+CONFIG_TARGET_IMX8MN_EVK=y
+CONFIG_ARCH_MISC_INIT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_SPL=y
+CONFIG_SPL_IMX_ROMAPI_LOADADDR=0x48000000
+CONFIG_DEFAULT_DEVICE_TREE="imx8mn-evk"
+CONFIG_FIT=y
+CONFIG_FIT_EXTERNAL_OFFSET=0x3000
+CONFIG_SPL_LOAD_FIT=y
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
+CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg"
+CONFIG_DEFAULT_FDT_FILE="imx8mn-evk.dtb"
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_BOOTROM_SUPPORT=y
+CONFIG_SPL_SEPARATE_BSS=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
+CONFIG_SPL_POWER_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="u-boot=> "
+# CONFIG_CMD_EXPORTENV is not set
+# CONFIG_CMD_IMPORTENV is not set
+CONFIG_CMD_ERASEENV=y
+# CONFIG_CMD_CRC32 is not set
+CONFIG_CMD_CLK=y
+CONFIG_CMD_FUSE=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_CLK_COMPOSITE_CCF=y
+CONFIG_CLK_COMPOSITE_CCF=y
+CONFIG_SPL_CLK_IMX8MN=y
+CONFIG_CLK_IMX8MN=y
+CONFIG_MXC_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_DM_MMC=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS400_ES_SUPPORT=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_FSL_ESDHC_IMX=y
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_PINCTRL_IMX8M=y
+CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC_PCA9450=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_MXC_UART=y
+CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
+CONFIG_SYSRESET_PSCI=y
+CONFIG_SYSRESET_WATCHDOG=y
+CONFIG_DM_THERMAL=y
+CONFIG_IMX_WATCHDOG=y
index 47a52ee..089ec26 100644 (file)
@@ -22,9 +22,9 @@ CONFIG_DEFAULT_DEVICE_TREE="imx8mp-evk"
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+# CONFIG_USE_SPL_FIT_GENERATOR is not set
 CONFIG_OF_SYSTEM_SETUP=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg"
 CONFIG_DEFAULT_FDT_FILE="imx8mp-evk.dtb"
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_LATE_INIT=y
index d2bd9c4..551d09b 100644 (file)
@@ -2,11 +2,13 @@ CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-marsboard"
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xC0000
 CONFIG_ENV_SECT_SIZE=0x2000
 CONFIG_MX6Q=y
 CONFIG_TARGET_EMBESTMX6BOARDS=y
+CONFIG_OF_CONTROL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q.cfg,DDR_MB=1024"
 CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd"
@@ -17,6 +19,7 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SF=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
@@ -25,21 +28,30 @@ CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_DM=y
+CONFIG_DM_GPIO=y
 CONFIG_BOUNCE_BUFFER=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_USDHC=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_ATHEROS=y
+CONFIG_DM_ETH=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
+CONFIG_DM_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_DM_VIDEO=y
index 0c15c3b..1cb2920 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_RISCV=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="microchip-mpfs-icicle-kit"
 CONFIG_TARGET_MICROCHIP_ICICLE=y
index 0da54c9..680611c 100644 (file)
@@ -11,6 +11,8 @@ CONFIG_SPL_TEXT_BASE=0x00001000
 CONFIG_TARGET_MX23_OLINUXINO=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx23-olinuxino"
+# CONFIG_SYS_MALLOC_F is not set
 CONFIG_BOOTDELAY=3
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_ARCH_MISC_INIT=y
@@ -24,10 +26,12 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_VERSION_VARIABLE=y
+CONFIG_DM=y
 CONFIG_MXS_GPIO=y
 CONFIG_LED_STATUS=y
 CONFIG_LED_STATUS_GPIO=y
@@ -37,11 +41,10 @@ CONFIG_LED_STATUS_STATE=2
 CONFIG_LED_STATUS_BOOT_ENABLE=y
 CONFIG_LED_STATUS_BOOT=0
 CONFIG_LED_STATUS_CMD=y
+CONFIG_DM_MMC=y
 CONFIG_MMC_MXS=y
 CONFIG_CONS_INDEX=0
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_SMSC95XX=y
-CONFIG_OF_LIBFDT=y
index b652057..d41b4ba 100644 (file)
@@ -1,21 +1,35 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="imx6dl-riotboard"
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x60000
 CONFIG_MX6S=y
 CONFIG_TARGET_EMBESTMX6BOARDS=y
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_TEXT_BASE=0x00908000
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s1g.cfg,DDR_MB=1024"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s1g.cfg,SPL,DDR_MB=1024"
 CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
 CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_SPL_RAW_IMAGE_SUPPORT=y
+CONFIG_SPL_FS_EXT4=y
+CONFIG_SPL_OS_BOOT=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SF=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
@@ -25,22 +39,31 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_DEV=2
 CONFIG_DM=y
+CONFIG_DM_GPIO=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_USDHC=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_SPI_FLASH_SST=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_ATHEROS=y
+CONFIG_DM_ETH=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
+CONFIG_DM_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_THERMAL=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_DM_VIDEO=y
@@ -57,3 +80,4 @@ CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
 CONFIG_OF_LIBFDT=y
+CONFIG_SPL_OF_LIBFDT=y
diff --git a/configs/riotboard_spl_defconfig b/configs/riotboard_spl_defconfig
deleted file mode 100644 (file)
index 95549ff..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-CONFIG_ARM=y
-CONFIG_ARCH_MX6=y
-CONFIG_SYS_TEXT_BASE=0x17800000
-CONFIG_SPL_GPIO_SUPPORT=y
-CONFIG_SPL_LIBCOMMON_SUPPORT=y
-CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_NR_DRAM_BANKS=1
-CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_OFFSET=0x60000
-CONFIG_MX6S=y
-CONFIG_TARGET_EMBESTMX6BOARDS=y
-CONFIG_SPL_TEXT_BASE=0x00908000
-CONFIG_SPL_MMC_SUPPORT=y
-CONFIG_SPL_SERIAL_SUPPORT=y
-CONFIG_SPL=y
-CONFIG_SPL_LIBDISK_SUPPORT=y
-CONFIG_DISTRO_DEFAULTS=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s1g.cfg,SPL,DDR_MB=1024"
-CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd"
-# CONFIG_CONSOLE_MUX is not set
-CONFIG_SYS_CONSOLE_IS_IN_ENV=y
-CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
-CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_SPL_RAW_IMAGE_SUPPORT=y
-CONFIG_SPL_FS_EXT4=y
-CONFIG_SPL_OS_BOOT=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
-CONFIG_CMD_SF=y
-CONFIG_CMD_USB=y
-CONFIG_CMD_CACHE=y
-CONFIG_CMD_EXT4_WRITE=y
-CONFIG_ENV_OVERWRITE=y
-CONFIG_ENV_IS_IN_MMC=y
-CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_SYS_MMC_ENV_DEV=2
-CONFIG_DM=y
-CONFIG_SUPPORT_EMMC_BOOT=y
-CONFIG_FSL_USDHC=y
-CONFIG_SPI_FLASH=y
-CONFIG_SF_DEFAULT_MODE=0
-CONFIG_SF_DEFAULT_SPEED=20000000
-CONFIG_SPI_FLASH_SST=y
-CONFIG_PHYLIB=y
-CONFIG_PHY_ATHEROS=y
-CONFIG_MII=y
-CONFIG_MXC_UART=y
-CONFIG_SPI=y
-CONFIG_MXC_SPI=y
-CONFIG_DM_THERMAL=y
-CONFIG_IMX_THERMAL=y
-CONFIG_USB=y
-CONFIG_USB_HOST_ETHER=y
-CONFIG_USB_ETHER_ASIX=y
-CONFIG_DM_VIDEO=y
-# CONFIG_BACKLIGHT is not set
-# CONFIG_CMD_VIDCONSOLE is not set
-# CONFIG_VIDEO_BPP8 is not set
-# CONFIG_VIDEO_BPP32 is not set
-# CONFIG_VIDEO_ANSI is not set
-CONFIG_SYS_WHITE_ON_BLACK=y
-# CONFIG_PANEL is not set
-CONFIG_VIDEO_IPUV3=y
-CONFIG_SPLASH_SCREEN=y
-CONFIG_SPLASH_SCREEN_ALIGN=y
-CONFIG_VIDEO_BMP_RLE8=y
-CONFIG_BMP_16BPP=y
-CONFIG_OF_LIBFDT=y
-CONFIG_SPL_OF_LIBFDT=y
index 34da356..65d8dff 100644 (file)
@@ -40,6 +40,8 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_NETCONSOLE=y
 CONFIG_DM=y
 CONFIG_MVSATA_IDE=y
+CONFIG_DM_MMC=y
+CONFIG_MVEBU_MMC=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MVGBE=y
similarity index 95%
rename from configs/sifive_fu540_defconfig
rename to configs/sifive_unleashed_defconfig
index cabd3b1..62416a7 100644 (file)
@@ -8,7 +8,7 @@ CONFIG_SPL=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00"
-CONFIG_TARGET_SIFIVE_FU540=y
+CONFIG_TARGET_SIFIVE_UNLEASHED=y
 CONFIG_ARCH_RV64I=y
 CONFIG_RISCV_SMODE=y
 CONFIG_DISTRO_DEFAULTS=y
index 2516bb7..c20c389 100644 (file)
@@ -1,10 +1,21 @@
 CONFIG_RISCV=y
 CONFIG_SYS_TEXT_BASE=0x80020000
+CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_OFFSET=0xfff000
+CONFIG_ENV_SECT_SIZE=0x1000
 CONFIG_TARGET_SIPEED_MAIX=y
 CONFIG_ARCH_RV64I=y
 CONFIG_RISCV_SMODE=y
 CONFIG_STACK_SIZE=0x100000
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="run k210_bootcmd"
+CONFIG_HUSH_PARSER=y
+CONFIG_MTDIDS_DEFAULT="nor0=spi3:0"
+CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)"
 # CONFIG_NET is not set
 # CONFIG_INPUT is not set
+CONFIG_SF_DEFAULT_BUS=3
 # CONFIG_DM_ETH is not set
+CONFIG_FS_EXT4=y
+CONFIG_FS_FAT=y
 # CONFIG_EFI_UNICODE_CAPITALIZATION is not set
index 4b8843d..a8218da 100644 (file)
@@ -46,11 +46,13 @@ CONFIG_CMD_SATA=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_TFTPPUT=y
+CONFIG_CMD_WDT=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_AES=y
 CONFIG_CMD_HASH=y
 CONFIG_CMD_BTRFS=y
+CONFIG_CMD_FS_UUID=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_ENV_OVERWRITE=y
 CONFIG_USE_ENV_SPI_MAX_HZ=y
@@ -73,6 +75,8 @@ CONFIG_MII=y
 CONFIG_PCI=y
 CONFIG_PCI_MVEBU=y
 CONFIG_SCSI=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_ARMADA38X=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_KIRKWOOD_SPI=y
index f72b964..064d545 100644 (file)
@@ -5,15 +5,19 @@ CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-udoo"
+CONFIG_OF_LIST="imx6q-udoo imx6dl-udoo"
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x60000
 CONFIG_MX6QDL=y
 CONFIG_TARGET_UDOO=y
+CONFIG_OF_CONTROL=y
 CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
@@ -24,6 +28,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SATA=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4_WRITE=y
@@ -32,13 +37,19 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
+CONFIG_DM_GPIO=y
 CONFIG_BOUNCE_BUFFER=y
+CONFIG_DM_MMC=y
 CONFIG_DWC_AHSATA=y
 CONFIG_FSL_USDHC=y
-CONFIG_MTD=y
+CONFIG_DM_SCSI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_DM_ETH=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
 CONFIG_DM_THERMAL=y
index e1128e5..39fe860 100644 (file)
@@ -2,11 +2,13 @@ CONFIG_ARM=y
 CONFIG_ARCH_MX5=y
 CONFIG_SYS_TEXT_BASE=0x77800000
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_DEFAULT_DEVICE_TREE="imx53-usbarmory"
 CONFIG_SYS_MEMTEST_START=0x70000000
 CONFIG_SYS_MEMTEST_END=0x90000000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x60000
 CONFIG_TARGET_USBARMORY=y
+CONFIG_OF_CONTROL=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_USE_BOOTCOMMAND is not set
@@ -14,13 +16,22 @@ CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_FUSE=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_DM=y
+CONFIG_DM_GPIO=y
 CONFIG_FSL_ESDHC_IMX=y
 CONFIG_MTD=y
 CONFIG_MXC_UART=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX5=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_EHCI_MX5=y
 CONFIG_OF_LIBFDT=y
index a9ccdb7..7fd3d72 100644 (file)
@@ -43,13 +43,14 @@ Build U-Boot
    $ export CROSS_COMPILE=aarch64-poky-linux-
    $ make imx8mm_evk_defconfig
    $ export ATF_LOAD_ADDR=0x920000
-   $ make flash.bin
+   $ make
 
 Burn the flash.bin to MicroSD card offset 33KB:
 
 .. code-block:: bash
 
    $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc
+   $sudo dd if=u-boot.itb of=/dev/sdc bs=1024 seek=384 conv=sync
 
 Boot
 ----
index 375e0bb..9fbb947 100644 (file)
@@ -43,13 +43,14 @@ Build U-Boot
    $ export CROSS_COMPILE=aarch64-poky-linux-
    $ make imx8mn_ddr4_evk_defconfig
    $ export ATF_LOAD_ADDR=0x960000
-   $ make flash.bin
+   $ make
 
 Burn the flash.bin to MicroSD card offset 32KB:
 
 .. code-block:: bash
 
    $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=32 conv=notrunc
+   $sudo dd if=u-boot.itb of=/dev/sd[x] bs=1024 seek=384 conv=notrunc
 
 Boot
 ----
index 796a761..609a29f 100644 (file)
@@ -40,18 +40,19 @@ Build U-Boot
    $ export CROSS_COMPILE=aarch64-poky-linux-
    $ make O=build imx8mp_evk_defconfig
    $ cp ../imx-atf/build/imx8mp/release/bl31.bin ./build/bl31.bin
-   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_202006.bin ./build/lpddr4_pmu_train_1d_dmem.bin
-   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_202006.bin ./build/lpddr4_pmu_train_1d_imem.bin
-   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_202006.bin ./build/lpddr4_pmu_train_2d_dmem.bin
-   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_202006.bin ./build/lpddr4_pmu_train_2d_imem.bin
+   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_202006.bin ./build/
+   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_202006.bin ./build/
+   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_202006.bin ./build/
+   $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_202006.bin ./build/
    $ export ATF_LOAD_ADDR=0x970000
-   $ make O=build flash.bin
+   $ make O=build
 
 Burn the flash.bin to the MicroSD card at offset 32KB:
 
 .. code-block:: bash
 
    $sudo dd if=build/flash.bin of=/dev/sd[x] bs=1K seek=32 conv=notrunc; sync
+   $sudo dd if=build/u-boot.itb of=/dev/sd[x] bs=1K seek=384 conv=notrunc; sync
 
 Boot
 ----
index ad614c9..ed7eacf 100644 (file)
@@ -6,4 +6,4 @@ SiFive
 .. toctree::
    :maxdepth: 2
 
-   fu540
+   unleashed
index ce7dde8..efa7e0c 100644 (file)
@@ -1,43 +1,46 @@
 .. SPDX-License-Identifier: GPL-2.0+
 
-Apalis iMX8X V1.1A Module
+Apalis iMX8X V1.1A Module (SoC NXP i.MX8QXP RevB)
 ==========================
 
 Quick Start
 -----------
 
-- Build the ARM trusted firmware binary
-- Get scfw_tcm.bin and ahab-container.img
+- Get and Build the ARM trusted firmware
+- Get System Controller firmware
+- Get SECO container
 - Build U-Boot
 - Load U-Boot binary using uuu
 - Flash U-Boot binary into the eMMC
 - Boot
 
+Note: builddir is U-Boot build directory (source directory for in-tree builds)
+
 Get and Build the ARM Trusted Firmware
 --------------------------------------
 
 .. code-block:: bash
 
-    $ git clone -b toradex_imx_5.4.24_2.1.0 http://git.toradex.com/cgit/imx-atf.git
-    $ cd imx-atf/
-    $ make PLAT=imx8qx bl31
+    $ cd $(builddir)
+    $ git clone -b toradex_imx_5.4.70_2.3.0 http://git.toradex.com/cgit/imx-atf.git
+    $ make PLAT=imx8qx bl31 -C imx-atf
+    $ cp imx-atf/build/imx8qx/release/bl31.bin $(builddir)
 
-Get scfw_tcm.bin and ahab-container.img
+Get System Controller firmware
 ---------------------------------------
 
 .. code-block:: bash
 
-    $ wget https://github.com/toradex/i.MX-System-Controller-Firmware/blob/master/src/scfw_export_mx8qx_b0/build_mx8qx_b0/mx8qx-apalis-scfw-tcm.bin
-    $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-3.6.3.bin
-    $ chmod +x imx-seco-3.6.3.bin
-    $ ./imx-seco-3.6.3.bin
+    $ wget https://github.com/toradex/i.MX-System-Controller-Firmware/raw/master/src/scfw_export_mx8qx_b0/build_mx8qx_b0/mx8qx-apalis-scfw-tcm.bin
 
-Copy the following binaries to the U-Boot folder:
+Get SECO container
+---------------------------------------
 
 .. code-block:: bash
 
-    $ cp imx-atf/build/imx8qx/release/bl31.bin .
-    $ cp imx-seco-3.6.3/firmware/seco/mx8qxb0-ahab-container.img mx8qx-ahab-container.imx8_defconfig
+    $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-3.7.4.bin
+    $ sh imx-seco-3.7.4.bin
+    $ cp imx-seco-3.7.4/firmware/seco/mx8qxb0-ahab-container.img $(builddir)/mx8qx-ahab-container.img
 
 Build U-Boot
 ------------
@@ -58,7 +61,7 @@ to your host and execute uuu:
 
 .. code-block:: bash
 
-    sudo ./uuu u-boot/u-boot-dtb.imx
+    sudo ./uuu $(builddir)/u-boot-dtb.imx
 
 Flash the U-Boot Binary into the eMMC
 -------------------------------------
index 20fff93..53f71fb 100644 (file)
@@ -213,6 +213,30 @@ the example below:
   HAB Configuration: 0xf0, HAB State: 0x66
   No HAB Events Found!
 
+1.6.1 Verifying HAB events in i.MX7ULP
+---------------------------------------
+
+When booting i.MX7ULP in low power or dual boot modes the M4 binary is
+authenticated by an independent HAB in M4 ROM code using a
+different SRK key set.
+
+The U-Boot provides a M4 option in hab_status command so users can retrieve
+M4 HAB failure and warning events.
+
+- Verify HAB M4 events:
+
+  => hab_status m4
+
+  Secure boot disabled
+
+  HAB Configuration: 0xf0, HAB State: 0x66
+  No HAB Events Found!
+
+As HAB M4 API cannot be called from A7 core the command is parsing the M4 HAB
+persistent memory region, M4 software should not modify this reserved region.
+
+Details about HAB persistent memory region can be found in AN12263[2].
+
 1.7 Closing the device
 -----------------------
 
@@ -400,3 +424,4 @@ If no HAB events were found the zImage is successfully signed.
 References:
 [1] AN4581: "Secure Boot on i.MX 50, i.MX 53, i.MX 6 and i.MX 7 Series using
  HABv4" - Rev 2.
+[2] AN12263: "HABv4 RVT Guidelines and Recommendations" - Rev 0.
diff --git a/doc/imx/index.rst b/doc/imx/index.rst
new file mode 100644 (file)
index 0000000..b225b1d
--- /dev/null
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+NXP i.MX Machine-specific doc
+=============================
+
+.. toctree::
+   :maxdepth: 2
+
+   misc/index
diff --git a/doc/imx/misc/index.rst b/doc/imx/misc/index.rst
new file mode 100644 (file)
index 0000000..85fbdb6
--- /dev/null
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Miscellaneous
+=============
+
+.. toctree::
+   :maxdepth: 2
+
+   psb
diff --git a/doc/imx/misc/psb.rst b/doc/imx/misc/psb.rst
new file mode 100644 (file)
index 0000000..4d6f001
--- /dev/null
@@ -0,0 +1,174 @@
+i.MX7D/i.MX8MM SRC_GPR10 PERSIST_SECONDARY_BOOT for bootloader A/B switching
+============================================================================
+
+Introduction
+------------
+Since at least iMX53 until iMX8MM, it is possible to have two copies of
+bootloader in SD/eMMC and switch between them. The switch is triggered
+either by the BootROM in case the bootloader image is faulty OR can be
+enforced by the user.
+
+Operation
+---------
+ #. Upon Power-On Reset (POR)
+
+    - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is set to 0
+    - BootROM attempts to start bootloader A-copy
+
+      - if A-copy valid
+
+         - BootROM starts A-copy
+         - END
+
+      - if A-copy NOT valid
+
+         - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1
+         - BootROM triggers WARM reset, GOTO 1)
+         - END
+
+ #. Upon COLD Reset
+
+    - GOTO 1)
+    - END
+
+ #. Upon WARM Reset
+
+    - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is retained
+
+      - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 0
+
+        - BootROM attempts to start bootloader A-copy
+
+          - if A-copy valid
+
+            - BootROM starts A-copy
+            - END
+
+          - if A-copy NOT valid
+
+            - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1
+            - BootROM triggers WARM reset. GOTO 1.3)
+            - END
+
+      - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 1
+
+        - BootROM attempts to start bootloader B-copy
+
+          - if B-copy valid
+
+            - BootROM starts B-copy
+            - END
+
+          - if B-copy NOT valid
+            - System hangs
+            - END
+
+Setup
+-----
+The bootloader A-copy must be placed at predetermined offset in SD/eMMC. The
+bootloader B-copy area offset is determined by an offset stored in Secondary
+Image Table (SIT). The SIT must be placed at predetermined offset in SD/eMMC.
+
+The following table contains offset of SIT, bootloader A-copy and recommended
+bootloader B-copy offset. The offsets are in 512 Byte sector units (that is
+offset 0x1 means 512 Bytes from the start of SD/eMMC card data partition).
+For details on the addition of two numbers in recommended B-copy offset, see
+SIT format below.
+
++----------+--------------------+-----------------------+-----------------------------+
+|   SoC    | SIT offset (fixed) | A-copy offset (fixed) | B-copy offset (recommended) |
++----------+--------------------+-----------------------+-----------------------------+
+| iMX7D    |         0x1        |          0x2          |          0x800+0x2          |
++----------+--------------------+-----------------------+-----------------------------+
+| iMX8MM   |        0x41        |         0x42          |         0x1000+0x42         |
++----------+--------------------+-----------------------+-----------------------------+
+
+SIT format
+~~~~~~~~~~
+SIT is a 20 byte long structure containing of 5 32-bit words. Those encode
+bootloader B-copy area offset (called "firstSectorNumber"), magic value
+(called "tag") that is always 0x00112233, and three unused words set to 0.
+SIT is documented in [1] and [2]. Example SIT are below::
+
+  $ hexdump -vC sit-mx7d.bin
+    00000000  00 00 00 00
+    00000004  00 00 00 00
+    00000008  33 22 11 00 <--- This is the "tag"
+    0000000c  00 08 00 00 <--- This is the "firstSectorNumber"
+    00000010  00 00 00 00
+
+  $ hexdump -vC sit-mx8mm.bin
+    00000000  00 00 00 00
+    00000004  00 00 00 00
+    00000008  33 22 11 00 <--- This is the "tag"
+    0000000c  00 10 00 00 <--- This is the "firstSectorNumber"
+    00000010  00 00 00 00
+
+B-copy area offset ("firstSectorNumber") is offset, in units of 512 Byte
+sectors, that is added to the start of boot media when switching between
+A-copy and B-copy. For A-copy, this offset is 0x0. For B-copy, this offset
+is determined by SIT (e.g. if firstSectorNumber is 0x1000 as it is above
+in sit-mx8mm.bin, then the B-copy offset is 0x1000 sectors = 2 MiB).
+
+Bootloader A-copy (e.g. u-boot.imx or flash.bin) is placed at fixed offset
+from A-copy area offset (e.g. 0x2 sectors from sector 0x0 for iMX7D, which
+means u-boot.imx A-copy must be written to sector 0x2).
+
+The same applies to bootloader B-copy, which is placed at fixed offset from
+B-copy area offset determined by SIT (e.g. 0x2 sectors from sector 0x800 [see
+sit-mx7d.bin example above, this can be changed in SIT firstSectorNumber] for
+iMX7D, which means u-boot.imx B-copy must be written to sector 0x802)
+
+**WARNING:**
+B-copy area offset ("firstSectorNumber") is NOT equal to bootloader
+(image, which is u-boot.imx or flash.bin) B-copy offset.
+
+To generate SIT, use for example the following bourne shell printf command::
+
+$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x08\x00\x00\x0\x0\x0\x0' > sit-mx7d.bin
+$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x10\x00\x00\x0\x0\x0\x0' > sit-mx8mm.bin
+
+Write bootloader A/B copy and SIT to SD/eMMC
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Examples of writing SIT and two copies of bootloader to SD or eMMC:
+
+- iMX8MM, SD card at /dev/sdX, Linux command line
+  ::
+
+    $ dd if=sit-mx8mm.bin of=/dev/sdX bs=512 seek=65
+    $ dd if=flash.bin     of=/dev/sdX bs=512 seek=66
+    $ dd if=flash.bin     of=/dev/sdX bs=512 seek=4162
+
+- iMX8MM, eMMC 1 data partition, U-Boot command line
+  ::
+
+    => mmc partconf 1 0 0 0
+
+    => dhcp ${loadaddr} sit-mx8mm.bin
+    => mmc dev 1
+    => mmc write ${loadaddr} 0x41 0x1
+
+    => dhcp ${loadaddr} flash.bin
+    => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt
+    => mmc dev 1
+    => mmc write ${loadaddr} 0x42   ${blkcnt}
+    => mmc write ${loadaddr} 0x1042 ${blkcnt}
+
+WARM reset into B-copy using WDT
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To perform a reboot into B-copy, the PERSIST_SECONDARY_BOOT must be set
+in SRC_GPR0 register. Example on iMX8MM::
+
+  => mw 0x30390098 0x40000000
+
+A WARM reset can be triggered using WDT as follows::
+
+  => mw.w 0x30280000 0x25
+
+References
+----------
+
+.. [1] i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018 ; section 6.6.5.3.5 Redundant boot support for expansion device
+.. [2] i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 ; section 6.1.5.4.5 Redundant boot support for expansion device
index 02de1d4..8066fcb 100644 (file)
@@ -64,6 +64,17 @@ implementation.
 
    arch/index
 
+Machine-specific doc
+--------------------
+
+These books provide programming details about machine-specific
+implementation.
+
+.. toctree::
+   :maxdepth: 2
+
+   imx/index
+
 Board-specific doc
 ------------------
 
index 722c79b..05d7647 100644 (file)
@@ -120,4 +120,5 @@ U_BOOT_DRIVER(mpfs_clk) = {
        .ops = &mpfs_clk_ops,
        .probe = mpfs_clk_probe,
        .priv_auto = sizeof(struct clk),
+       .flags = DM_FLAG_PRE_RELOC,
 };
index 5ed6140..1f5dfb9 100644 (file)
@@ -7,6 +7,12 @@ config FSL_CAAM
          Module (CAAM), also known as the SEC version 4 (SEC4). The driver uses
          Job Ring as interface to communicate with CAAM.
 
+config CAAM_64BIT
+       bool
+       default y if PHYS_64BIT && !ARCH_IMX8M
+       help
+         Select Crypto driver for 64 bits CAAM version
+
 config SYS_FSL_HAS_SEC
        bool
        help
index a5e8d38..f9c3cce 100644 (file)
@@ -4,7 +4,7 @@
 
 obj-y += sec.o
 obj-$(CONFIG_FSL_CAAM) += jr.o fsl_hash.o jobdesc.o error.o
-obj-$(CONFIG_CMD_BLOB) += fsl_blob.o
-obj-$(CONFIG_CMD_DEKBLOB) += fsl_blob.o
+obj-$(CONFIG_CMD_BLOB)$(CONFIG_IMX_CAAM_DEK_ENCAP) += fsl_blob.o
 obj-$(CONFIG_RSA_FREESCALE_EXP) += fsl_rsa.o
 obj-$(CONFIG_FSL_CAAM_RNG) += rng.o
+obj-$(CONFIG_FSL_MFGPROT) += fsl_mfgprot.o
index 3589e6e..5705c4f 100644 (file)
@@ -11,6 +11,8 @@
 #ifndef DESC_H
 #define DESC_H
 
+#include "type.h"
+
 #define KEY_BLOB_SIZE          32
 #define MAC_SIZE                       16
 
 /* Structures for Protocol Data Blocks */
 struct __packed pdb_ecdsa_verify {
        uint32_t pdb_hdr;
-       dma_addr_t dma_q;       /* Pointer to q (elliptic curve) */
-       dma_addr_t dma_r;       /* Pointer to r (elliptic curve) */
-       dma_addr_t dma_g_xy;    /* Pointer to Gx,y (elliptic curve) */
-       dma_addr_t dma_pkey;    /* Pointer to Wx,y (public key) */
-       dma_addr_t dma_hash;    /* Pointer to hash input */
-       dma_addr_t dma_c;       /* Pointer to C_signature */
-       dma_addr_t dma_d;       /* Pointer to D_signature */
-       dma_addr_t dma_buf;     /* Pointer to 64-byte temp buffer */
-       dma_addr_t dma_ab;      /* Pointer to a,b (elliptic curve ) */
+       caam_dma_addr_t dma_q;  /* Pointer to q (elliptic curve) */
+       caam_dma_addr_t dma_r;  /* Pointer to r (elliptic curve) */
+       caam_dma_addr_t dma_g_xy;       /* Pointer to Gx,y (elliptic curve) */
+       caam_dma_addr_t dma_pkey;       /* Pointer to Wx,y (public key) */
+       caam_dma_addr_t dma_hash;       /* Pointer to hash input */
+       caam_dma_addr_t dma_c;  /* Pointer to C_signature */
+       caam_dma_addr_t dma_d;  /* Pointer to D_signature */
+       caam_dma_addr_t dma_buf;        /* Pointer to 64-byte temp buffer */
+       caam_dma_addr_t dma_ab; /* Pointer to a,b (elliptic curve ) */
        uint32_t img_size;      /* Length of Message */
 };
 
 struct __packed pdb_ecdsa_sign {
        uint32_t pdb_hdr;
-       dma_addr_t dma_q;       /* Pointer to q (elliptic curve) */
-       dma_addr_t dma_r;       /* Pointer to r (elliptic curve) */
-       dma_addr_t dma_g_xy;    /* Pointer to Gx,y (elliptic curve) */
-       dma_addr_t dma_pri_key; /* Pointer to S (Private key) */
-       dma_addr_t dma_hash;    /* Pointer to hash input */
-       dma_addr_t dma_c;       /* Pointer to C_signature */
-       dma_addr_t dma_d;       /* Pointer to D_signature */
-       dma_addr_t dma_ab;      /* Pointer to a,b (elliptic curve ) */
-       dma_addr_t dma_u;       /* Pointer to Per Message Random */
+       caam_dma_addr_t dma_q;  /* Pointer to q (elliptic curve) */
+       caam_dma_addr_t dma_r;  /* Pointer to r (elliptic curve) */
+       caam_dma_addr_t dma_g_xy;       /* Pointer to Gx,y (elliptic curve) */
+       caam_dma_addr_t dma_pri_key;    /* Pointer to S (Private key) */
+       caam_dma_addr_t dma_hash;       /* Pointer to hash input */
+       caam_dma_addr_t dma_c;  /* Pointer to C_signature */
+       caam_dma_addr_t dma_d;  /* Pointer to D_signature */
+       caam_dma_addr_t dma_ab; /* Pointer to a,b (elliptic curve ) */
+       caam_dma_addr_t dma_u;  /* Pointer to Per Message Random */
        uint32_t img_size;      /* Length of Message */
 };
 
@@ -726,20 +728,21 @@ struct __packed pdb_ecdsa_sign {
 struct __packed pdb_mp_pub_k {
        uint32_t pdb_hdr;
        #define PDB_MP_PUB_K_SGF_SHIFT          31
-       dma_addr_t dma_pkey;    /* Pointer to Wx,y (public key) */
+       caam_dma_addr_t dma_pkey;       /* Pointer to Wx,y (public key) */
 };
 
 struct __packed pdb_mp_sign {
        uint32_t pdb_hdr;
        #define PDB_MP_SIGN_SGF_SHIFT           28
-       dma_addr_t dma_addr_msg;        /* Pointer to Message */
-       dma_addr_t dma_addr_hash;       /* Pointer to hash output */
-       dma_addr_t dma_addr_c_sig;      /* Pointer to C_signature */
-       dma_addr_t dma_addr_d_sig;      /* Pointer to D_signature */
+       caam_dma_addr_t dma_addr_msg;   /* Pointer to Message */
+       caam_dma_addr_t dma_addr_hash;  /* Pointer to hash output */
+       caam_dma_addr_t dma_addr_c_sig; /* Pointer to C_signature */
+       caam_dma_addr_t dma_addr_d_sig; /* Pointer to D_signature */
        uint32_t img_size;              /* Length of Message */
 };
 
 #define PDB_MP_CSEL_SHIFT      17
+#define PDB_MP_CSEL_WIDTH      4
 #define PDB_MP_CSEL_P256       0x3 << PDB_MP_CSEL_SHIFT        /* P-256 */
 #define PDB_MP_CSEL_P384       0x4 << PDB_MP_CSEL_SHIFT        /* P-384 */
 #define PDB_MP_CSEL_P521       0x5 << PDB_MP_CSEL_SHIFT        /* P-521 */
index b82ba83..209557c 100644 (file)
@@ -12,7 +12,7 @@
 
 #define IMMEDIATE (1 << 23)
 #define CAAM_CMD_SZ sizeof(u32)
-#define CAAM_PTR_SZ sizeof(dma_addr_t)
+#define CAAM_PTR_SZ sizeof(caam_dma_addr_t)
 #define CAAM_DESC_BYTES_MAX (CAAM_CMD_SZ * MAX_CAAM_DESCSIZE)
 #define DESC_JOB_IO_LEN (CAAM_CMD_SZ * 5 + CAAM_PTR_SZ * 3)
 
@@ -35,7 +35,7 @@
                               LDST_SRCDST_WORD_DECOCTRL | \
                               (LDOFF_ENABLE_AUTO_NFIFO << LDST_OFFSET_SHIFT))
 
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
 struct ptr_addr_t {
 #ifdef CONFIG_SYS_FSL_SEC_LE
        u32 low;
@@ -49,9 +49,9 @@ struct ptr_addr_t {
 };
 #endif
 
-static inline void pdb_add_ptr(dma_addr_t *offset, dma_addr_t ptr)
+static inline void pdb_add_ptr(caam_dma_addr_t *offset, caam_dma_addr_t ptr)
 {
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        /* The Position of low and high part of 64 bit address
         * will depend on the endianness of CAAM Block */
        struct ptr_addr_t *ptr_addr = (struct ptr_addr_t *)offset;
@@ -102,11 +102,11 @@ static inline void init_job_desc_pdb(u32 *desc, u32 options, size_t pdb_bytes)
                       options);
 }
 
-static inline void append_ptr(u32 *desc, dma_addr_t ptr)
+static inline void append_ptr(u32 *desc, caam_dma_addr_t ptr)
 {
-       dma_addr_t *offset = (dma_addr_t *)desc_end(desc);
+       caam_dma_addr_t *offset = (caam_dma_addr_t *)desc_end(desc);
 
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        /* The Position of low and high part of 64 bit address
         * will depend on the endianness of CAAM Block */
        struct ptr_addr_t *ptr_addr = (struct ptr_addr_t *)offset;
@@ -159,7 +159,7 @@ static inline u32 *write_cmd(u32 *desc, u32 command)
        return desc + 1;
 }
 
-static inline void append_cmd_ptr(u32 *desc, dma_addr_t ptr, int len,
+static inline void append_cmd_ptr(u32 *desc, caam_dma_addr_t ptr, int len,
                                  u32 command)
 {
        append_cmd(desc, command | len);
@@ -167,7 +167,7 @@ static inline void append_cmd_ptr(u32 *desc, dma_addr_t ptr, int len,
 }
 
 /* Write length after pointer, rather than inside command */
-static inline void append_cmd_ptr_extlen(u32 *desc, dma_addr_t ptr,
+static inline void append_cmd_ptr_extlen(u32 *desc, caam_dma_addr_t ptr,
                                         unsigned int len, u32 command)
 {
        append_cmd(desc, command);
@@ -225,7 +225,7 @@ APPEND_CMD_LEN(seq_fifo_load, SEQ_FIFO_LOAD)
 APPEND_CMD_LEN(seq_fifo_store, SEQ_FIFO_STORE)
 
 #define APPEND_CMD_PTR(cmd, op) \
-static inline void append_##cmd(u32 *desc, dma_addr_t ptr, unsigned int len, \
+static inline void append_##cmd(u32 *desc, caam_dma_addr_t ptr, unsigned int len, \
                                u32 options) \
 { \
        PRINT_POS; \
@@ -236,7 +236,7 @@ APPEND_CMD_PTR(load, LOAD)
 APPEND_CMD_PTR(fifo_load, FIFO_LOAD)
 APPEND_CMD_PTR(fifo_store, FIFO_STORE)
 
-static inline void append_store(u32 *desc, dma_addr_t ptr, unsigned int len,
+static inline void append_store(u32 *desc, caam_dma_addr_t ptr, unsigned int len,
                                u32 options)
 {
        u32 cmd_src;
@@ -254,7 +254,7 @@ static inline void append_store(u32 *desc, dma_addr_t ptr, unsigned int len,
 }
 
 #define APPEND_SEQ_PTR_INTLEN(cmd, op) \
-static inline void append_seq_##cmd##_ptr_intlen(u32 *desc, dma_addr_t ptr, \
+static inline void append_seq_##cmd##_ptr_intlen(u32 *desc, caam_dma_addr_t ptr, \
                                                 unsigned int len, \
                                                 u32 options) \
 { \
@@ -278,7 +278,7 @@ APPEND_CMD_PTR_TO_IMM(load, LOAD);
 APPEND_CMD_PTR_TO_IMM(fifo_load, FIFO_LOAD);
 
 #define APPEND_CMD_PTR_EXTLEN(cmd, op) \
-static inline void append_##cmd##_extlen(u32 *desc, dma_addr_t ptr, \
+static inline void append_##cmd##_extlen(u32 *desc, caam_dma_addr_t ptr, \
                                         unsigned int len, u32 options) \
 { \
        PRINT_POS; \
@@ -292,7 +292,7 @@ APPEND_CMD_PTR_EXTLEN(seq_out_ptr, SEQ_OUT_PTR)
  * the size of its type
  */
 #define APPEND_CMD_PTR_LEN(cmd, op, type) \
-static inline void append_##cmd(u32 *desc, dma_addr_t ptr, \
+static inline void append_##cmd(u32 *desc, caam_dma_addr_t ptr, \
                                type len, u32 options) \
 { \
        PRINT_POS; \
index d6bd861..e8202cc 100644 (file)
@@ -65,6 +65,9 @@ int blob_decap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
        flush_dcache_range((unsigned long)desc,
                           (unsigned long)desc + size);
 
+       flush_dcache_range((unsigned long)dst,
+                          (unsigned long)dst + size);
+
        ret = run_descriptor_jr(desc);
 
        if (ret) {
@@ -130,6 +133,9 @@ int blob_encap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
        flush_dcache_range((unsigned long)desc,
                           (unsigned long)desc + size);
 
+       flush_dcache_range((unsigned long)dst,
+                          (unsigned long)dst + size);
+
        ret = run_descriptor_jr(desc);
 
        if (ret) {
index 61f953e..8b5c26d 100644 (file)
@@ -87,7 +87,7 @@ static int caam_hash_update(void *hash_ctx, const void *buf,
                            enum caam_hash_algos caam_algo)
 {
        uint32_t final;
-       phys_addr_t addr = virt_to_phys((void *)buf);
+       caam_dma_addr_t addr = virt_to_phys((void *)buf);
        struct sha_ctx *ctx = hash_ctx;
 
        if (ctx->sg_num >= MAX_SG_32) {
@@ -95,12 +95,12 @@ static int caam_hash_update(void *hash_ctx, const void *buf,
                return -EINVAL;
        }
 
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        sec_out32(&ctx->sg_tbl[ctx->sg_num].addr_hi, (uint32_t)(addr >> 32));
 #else
        sec_out32(&ctx->sg_tbl[ctx->sg_num].addr_hi, 0x0);
 #endif
-       sec_out32(&ctx->sg_tbl[ctx->sg_num].addr_lo, (uint32_t)addr);
+       sec_out32(&ctx->sg_tbl[ctx->sg_num].addr_lo, (caam_dma_addr_t)addr);
 
        sec_out32(&ctx->sg_tbl[ctx->sg_num].len_flag,
                  (size & SG_ENTRY_LENGTH_MASK));
diff --git a/drivers/crypto/fsl/fsl_mfgprot.c b/drivers/crypto/fsl/fsl_mfgprot.c
new file mode 100644 (file)
index 0000000..29af79f
--- /dev/null
@@ -0,0 +1,160 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2014-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <fsl_sec.h>
+#include <memalign.h>
+#include "desc.h"
+#include "desc_constr.h"
+#include "jobdesc.h"
+#include "jr.h"
+
+/* Size of MFG descriptor */
+#define MFG_PUBK_DSC_WORDS 4
+#define MFG_SIGN_DSC_WORDS 8
+
+static void mfg_build_sign_dsc(u32 *dsc_ptr, const u8 *m, int size,
+                              u8 *dgst, u8 *c, u8 *d)
+{
+       u32 *dsc = dsc_ptr;
+       struct pdb_mp_sign *pdb;
+
+       init_job_desc_pdb(dsc, 0, sizeof(struct pdb_mp_sign));
+
+       pdb = (struct pdb_mp_sign *)desc_pdb(dsc);
+
+       /* Curve */
+       pdb->pdb_hdr = (PDB_MP_CSEL_P256);
+
+       /* Message Pointer */
+       pdb_add_ptr(&pdb->dma_addr_msg, virt_to_phys((void *)m));
+
+       /* mes-resp Pointer */
+       pdb_add_ptr(&pdb->dma_addr_hash, virt_to_phys((void *)dgst));
+
+       /* C Pointer */
+       pdb_add_ptr(&pdb->dma_addr_c_sig, virt_to_phys((void *)c));
+
+       /* d Pointer */
+       pdb_add_ptr(&pdb->dma_addr_d_sig, virt_to_phys((void *)d));
+
+       /* Message Size */
+       pdb->img_size = size;
+
+       /* MP PubK generate key command */
+       append_cmd(dsc, (CMD_OPERATION | OP_TYPE_DECAP_PROTOCOL |
+                        OP_PCLID_MP_SIGN));
+}
+
+static void mfg_build_pubk_dsc(u32 *dsc_ptr, u8 *dst)
+{
+       u32 *dsc = dsc_ptr;
+       struct pdb_mp_pub_k *pdb;
+
+       init_job_desc_pdb(dsc, 0, sizeof(struct pdb_mp_pub_k));
+
+       pdb = (struct pdb_mp_pub_k *)desc_pdb(dsc);
+
+       /* Curve */
+       pdb->pdb_hdr = (PDB_MP_CSEL_P256);
+
+       /* Message Pointer */
+       pdb_add_ptr(&pdb->dma_pkey, virt_to_phys((void *)dst));
+
+       /* MP Sign key command */
+       append_cmd(dsc, (CMD_OPERATION | OP_TYPE_DECAP_PROTOCOL |
+                        OP_PCLID_MP_PUB_KEY));
+}
+
+int gen_mppubk(u8 *dst)
+{
+       int size, ret;
+       u32 *dsc;
+
+       /* Job Descriptor initialization */
+       dsc = memalign(ARCH_DMA_MINALIGN,
+                      sizeof(uint32_t) * MFG_PUBK_DSC_WORDS);
+       if (!dsc) {
+               debug("Not enough memory for descriptor allocation\n");
+               return -ENOMEM;
+       }
+
+       mfg_build_pubk_dsc(dsc, dst);
+
+       size = roundup(sizeof(uint32_t) * MFG_PUBK_DSC_WORDS,
+                      ARCH_DMA_MINALIGN);
+       flush_dcache_range((unsigned long)dsc, (unsigned long)dsc + size);
+
+       size = roundup(FSL_CAAM_MP_PUBK_BYTES, ARCH_DMA_MINALIGN);
+       flush_dcache_range((unsigned long)dst, (unsigned long)dst + size);
+
+       /* Execute Job Descriptor */
+       puts("\nGenerating Manufacturing Protection Public Key\n");
+
+       ret = run_descriptor_jr(dsc);
+       if (ret) {
+               debug("Error in public key generation %d\n", ret);
+               goto err;
+       }
+
+       size = roundup(FSL_CAAM_MP_PUBK_BYTES, ARCH_DMA_MINALIGN);
+       invalidate_dcache_range((unsigned long)dst, (unsigned long)dst + size);
+err:
+       free(dsc);
+       return ret;
+}
+
+int sign_mppubk(const u8 *m, int data_size, u8 *dgst, u8 *c, u8 *d)
+{
+       int size, ret;
+       u32 *dsc;
+
+       /* Job Descriptor initialization */
+       dsc = memalign(ARCH_DMA_MINALIGN,
+                      sizeof(uint32_t) * MFG_SIGN_DSC_WORDS);
+       if (!dsc) {
+               debug("Not enough memory for descriptor allocation\n");
+               return -ENOMEM;
+       }
+
+       mfg_build_sign_dsc(dsc, m, data_size, dgst, c, d);
+
+       size = roundup(sizeof(uint32_t) * MFG_SIGN_DSC_WORDS,
+                      ARCH_DMA_MINALIGN);
+       flush_dcache_range((unsigned long)dsc, (unsigned long)dsc + size);
+
+       size = roundup(data_size, ARCH_DMA_MINALIGN);
+       flush_dcache_range((unsigned long)m, (unsigned long)m + size);
+
+       size = roundup(FSL_CAAM_MP_MES_DGST_BYTES, ARCH_DMA_MINALIGN);
+       flush_dcache_range((unsigned long)dgst, (unsigned long)dgst + size);
+
+       size = roundup(FSL_CAAM_MP_PRVK_BYTES, ARCH_DMA_MINALIGN);
+       flush_dcache_range((unsigned long)c, (unsigned long)c + size);
+       flush_dcache_range((unsigned long)d, (unsigned long)d + size);
+
+       /* Execute Job Descriptor */
+       puts("\nSigning message with Manufacturing Protection Private Key\n");
+
+       ret = run_descriptor_jr(dsc);
+       if (ret) {
+               debug("Error in public key generation %d\n", ret);
+               goto err;
+       }
+
+       size = roundup(FSL_CAAM_MP_MES_DGST_BYTES, ARCH_DMA_MINALIGN);
+       invalidate_dcache_range((unsigned long)dgst,
+                               (unsigned long)dgst + size);
+
+       size = roundup(FSL_CAAM_MP_PRVK_BYTES, ARCH_DMA_MINALIGN);
+       invalidate_dcache_range((unsigned long)c, (unsigned long)c + size);
+       invalidate_dcache_range((unsigned long)d, (unsigned long)d + size);
+
+err:
+       free(dsc);
+       return ret;
+}
index fbc1aed..d235415 100644 (file)
@@ -4,6 +4,7 @@
  * Basic job descriptor construction
  *
  * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
  *
  */
 
@@ -15,7 +16,8 @@
 #include "rsa_caam.h"
 #include <asm/cache.h>
 
-#if defined(CONFIG_MX6) || defined(CONFIG_MX7)
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) || \
+               defined(CONFIG_IMX8M)
 /*!
  * Secure memory run command
  *
@@ -163,9 +165,9 @@ int inline_cnstr_jobdesc_blob_dek(uint32_t *desc, const uint8_t *plain_txt,
 
        append_u32(desc, aad_w2);
 
-       append_cmd_ptr(desc, (dma_addr_t)SEC_MEM_PAGE1, in_sz, CMD_SEQ_IN_PTR);
+       append_cmd_ptr(desc, (caam_dma_addr_t)SEC_MEM_PAGE1, in_sz, CMD_SEQ_IN_PTR);
 
-       append_cmd_ptr(desc, (dma_addr_t)dek_blob + 8, out_sz, CMD_SEQ_OUT_PTR);
+       append_cmd_ptr(desc, (caam_dma_addr_t)(ulong)(dek_blob + 8), out_sz, CMD_SEQ_OUT_PTR);
 
        append_operation(desc, OP_TYPE_ENCAP_PROTOCOL | OP_PCLID_BLOB |
                                                OP_PCLID_SECMEM);
@@ -181,7 +183,7 @@ void inline_cnstr_jobdesc_hash(uint32_t *desc,
        /* SHA 256 , output is of length 32 words */
        uint32_t storelen = alg_size;
        u32 options;
-       dma_addr_t dma_addr_in, dma_addr_out;
+       caam_dma_addr_t dma_addr_in, dma_addr_out;
 
        dma_addr_in = virt_to_phys((void *)msg);
        dma_addr_out = virt_to_phys((void *)digest);
@@ -210,7 +212,7 @@ void inline_cnstr_jobdesc_blob_encap(uint32_t *desc, uint8_t *key_idnfr,
                                     uint8_t *plain_txt, uint8_t *enc_blob,
                                     uint32_t in_sz)
 {
-       dma_addr_t dma_addr_key_idnfr, dma_addr_in, dma_addr_out;
+       caam_dma_addr_t dma_addr_key_idnfr, dma_addr_in, dma_addr_out;
        uint32_t key_sz = KEY_IDNFR_SZ_BYTES;
        /* output blob will have 32 bytes key blob in beginning and
         * 16 byte HMAC identifier at end of data blob */
@@ -235,7 +237,7 @@ void inline_cnstr_jobdesc_blob_decap(uint32_t *desc, uint8_t *key_idnfr,
                                     uint8_t *enc_blob, uint8_t *plain_txt,
                                     uint32_t out_sz)
 {
-       dma_addr_t dma_addr_key_idnfr, dma_addr_in, dma_addr_out;
+       caam_dma_addr_t dma_addr_key_idnfr, dma_addr_in, dma_addr_out;
        uint32_t key_sz = KEY_IDNFR_SZ_BYTES;
        uint32_t in_sz = out_sz + KEY_BLOB_SIZE + MAC_SIZE;
 
@@ -311,7 +313,7 @@ void inline_cnstr_jobdesc_pkha_rsaexp(uint32_t *desc,
                                      struct pk_in_params *pkin, uint8_t *out,
                                      uint32_t out_siz)
 {
-       dma_addr_t dma_addr_e, dma_addr_a, dma_addr_n, dma_addr_out;
+       caam_dma_addr_t dma_addr_e, dma_addr_a, dma_addr_n, dma_addr_out;
 
        dma_addr_e = virt_to_phys((void *)pkin->e);
        dma_addr_a = virt_to_phys((void *)pkin->a);
index 44273c3..22b6492 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2008-2014 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
  *
  * Based on CAAM driver in drivers/crypto/caam in Linux
  */
@@ -21,6 +22,7 @@
 #include <asm/fsl_pamu.h>
 #endif
 #include <dm/lists.h>
+#include <linux/delay.h>
 
 #define CIRC_CNT(head, tail, size)     (((head) - (tail)) & (size - 1))
 #define CIRC_SPACE(head, tail, size)   CIRC_CNT((tail), (head) + 1, (size))
@@ -34,10 +36,10 @@ uint32_t sec_offset[CONFIG_SYS_FSL_MAX_NUM_OF_SEC] = {
 };
 
 #define SEC_ADDR(idx)  \
-       ((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))
+       (ulong)((CONFIG_SYS_FSL_SEC_ADDR + sec_offset[idx]))
 
 #define SEC_JR0_ADDR(idx)      \
-       (SEC_ADDR(idx) +        \
+       (ulong)(SEC_ADDR(idx) + \
         (CONFIG_SYS_FSL_JR0_OFFSET - CONFIG_SYS_FSL_SEC_OFFSET))
 
 struct jobring jr0[CONFIG_SYS_FSL_MAX_NUM_OF_SEC];
@@ -82,16 +84,16 @@ static void jr_initregs(uint8_t sec_idx)
 {
        struct jr_regs *regs = (struct jr_regs *)SEC_JR0_ADDR(sec_idx);
        struct jobring *jr = &jr0[sec_idx];
-       phys_addr_t ip_base = virt_to_phys((void *)jr->input_ring);
-       phys_addr_t op_base = virt_to_phys((void *)jr->output_ring);
+       caam_dma_addr_t ip_base = virt_to_phys((void *)jr->input_ring);
+       caam_dma_addr_t op_base = virt_to_phys((void *)jr->output_ring);
 
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        sec_out32(&regs->irba_h, ip_base >> 32);
 #else
        sec_out32(&regs->irba_h, 0x0);
 #endif
        sec_out32(&regs->irba_l, (uint32_t)ip_base);
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        sec_out32(&regs->orba_h, op_base >> 32);
 #else
        sec_out32(&regs->orba_h, 0x0);
@@ -117,8 +119,8 @@ static int jr_init(uint8_t sec_idx)
        jr->liodn = DEFAULT_JR_LIODN;
 #endif
        jr->size = JR_SIZE;
-       jr->input_ring = (dma_addr_t *)memalign(ARCH_DMA_MINALIGN,
-                               JR_SIZE * sizeof(dma_addr_t));
+       jr->input_ring = (caam_dma_addr_t *)memalign(ARCH_DMA_MINALIGN,
+                               JR_SIZE * sizeof(caam_dma_addr_t));
        if (!jr->input_ring)
                return -1;
 
@@ -129,7 +131,7 @@ static int jr_init(uint8_t sec_idx)
        if (!jr->output_ring)
                return -1;
 
-       memset(jr->input_ring, 0, JR_SIZE * sizeof(dma_addr_t));
+       memset(jr->input_ring, 0, JR_SIZE * sizeof(caam_dma_addr_t));
        memset(jr->output_ring, 0, jr->op_size);
 
        start_jr0(sec_idx);
@@ -148,7 +150,7 @@ static int jr_sw_cleanup(uint8_t sec_idx)
        jr->read_idx = 0;
        jr->write_idx = 0;
        memset(jr->info, 0, sizeof(jr->info));
-       memset(jr->input_ring, 0, jr->size * sizeof(dma_addr_t));
+       memset(jr->input_ring, 0, jr->size * sizeof(caam_dma_addr_t));
        memset(jr->output_ring, 0, jr->size * sizeof(struct op_ring));
 
        return 0;
@@ -194,7 +196,7 @@ static int jr_enqueue(uint32_t *desc_addr,
        uint32_t desc_word;
        int length = desc_len(desc_addr);
        int i;
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        uint32_t *addr_hi, *addr_lo;
 #endif
 
@@ -208,7 +210,7 @@ static int jr_enqueue(uint32_t *desc_addr,
                sec_out32((uint32_t *)&desc_addr[i], desc_word);
        }
 
-       phys_addr_t desc_phys_addr = virt_to_phys(desc_addr);
+       caam_dma_addr_t desc_phys_addr = virt_to_phys(desc_addr);
 
        jr->info[head].desc_phys_addr = desc_phys_addr;
        jr->info[head].callback = (void *)callback;
@@ -221,7 +223,7 @@ static int jr_enqueue(uint32_t *desc_addr,
                                  sizeof(struct jr_info), ARCH_DMA_MINALIGN);
        flush_dcache_range(start, end);
 
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        /* Write the 64 bit Descriptor address on Input Ring.
         * The 32 bit hign and low part of the address will
         * depend on endianness of SEC block.
@@ -240,11 +242,11 @@ static int jr_enqueue(uint32_t *desc_addr,
 #else
        /* Write the 32 bit Descriptor address on Input Ring. */
        sec_out32(&jr->input_ring[head], desc_phys_addr);
-#endif /* ifdef CONFIG_PHYS_64BIT */
+#endif /* ifdef CONFIG_CAAM_64BIT */
 
        start = (unsigned long)&jr->input_ring[head] & ~(ARCH_DMA_MINALIGN - 1);
        end = ALIGN((unsigned long)&jr->input_ring[head] +
-                    sizeof(dma_addr_t), ARCH_DMA_MINALIGN);
+                    sizeof(caam_dma_addr_t), ARCH_DMA_MINALIGN);
        flush_dcache_range(start, end);
 
        jr->head = (head + 1) & (jr->size - 1);
@@ -270,7 +272,7 @@ static int jr_dequeue(int sec_idx)
        int idx, i, found;
        void (*callback)(uint32_t status, void *arg);
        void *arg = NULL;
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        uint32_t *addr_hi, *addr_lo;
 #else
        uint32_t *addr;
@@ -281,8 +283,8 @@ static int jr_dequeue(int sec_idx)
 
                found = 0;
 
-               phys_addr_t op_desc;
-       #ifdef CONFIG_PHYS_64BIT
+               caam_dma_addr_t op_desc;
+       #ifdef CONFIG_CAAM_64BIT
                /* Read the 64 bit Descriptor address from Output Ring.
                 * The 32 bit hign and low part of the address will
                 * depend on endianness of SEC block.
@@ -302,7 +304,7 @@ static int jr_dequeue(int sec_idx)
                /* Read the 32 bit Descriptor address from Output Ring. */
                addr = (uint32_t *)&jr->output_ring[jr->tail].desc;
                op_desc = sec_in32(addr);
-       #endif /* ifdef CONFIG_PHYS_64BIT */
+       #endif /* ifdef CONFIG_CAAM_64BIT */
 
                uint32_t status = sec_in32(&jr->output_ring[jr->tail].status);
 
@@ -355,8 +357,8 @@ static void desc_done(uint32_t status, void *arg)
 
 static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)
 {
-       unsigned long long timeval = get_ticks();
-       unsigned long long timeout = usec2ticks(CONFIG_SEC_DEQ_TIMEOUT);
+       unsigned long long timeval = 0;
+       unsigned long long timeout = CONFIG_USEC_DEQ_TIMEOUT;
        struct result op;
        int ret = 0;
 
@@ -369,9 +371,10 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)
                goto out;
        }
 
-       timeval = get_ticks();
-       timeout = usec2ticks(CONFIG_SEC_DEQ_TIMEOUT);
        while (op.done != 1) {
+               udelay(1);
+               timeval += 1;
+
                ret = jr_dequeue(sec_idx);
                if (ret) {
                        debug("Error in SEC deq\n");
@@ -379,7 +382,7 @@ static inline int run_descriptor_jr_idx(uint32_t *desc, uint8_t sec_idx)
                        goto out;
                }
 
-               if ((get_ticks() - timeval) > timeout) {
+               if (timeval > timeout) {
                        debug("SEC Dequeue timed out\n");
                        ret = JQ_DEQ_TO_ERR;
                        goto out;
@@ -675,7 +678,7 @@ int sec_init_idx(uint8_t sec_idx)
        mcr = (mcr & ~MCFGR_AWCACHE_MASK) | (0x2 << MCFGR_AWCACHE_SHIFT);
 #endif
 
-#ifdef CONFIG_PHYS_64BIT
+#ifdef CONFIG_CAAM_64BIT
        mcr |= (1 << MCFGR_PS_SHIFT);
 #endif
        sec_out32(&sec->mcfgr, mcr);
index ffd3a19..1047aa7 100644 (file)
@@ -8,10 +8,11 @@
 #define __JR_H
 
 #include <linux/compiler.h>
+#include "type.h"
 
 #define JR_SIZE 4
-/* Timeout currently defined as 90 sec */
-#define CONFIG_SEC_DEQ_TIMEOUT 90000000U
+/* Timeout currently defined as 10 sec */
+#define CONFIG_USEC_DEQ_TIMEOUT        10000000U
 
 #define DEFAULT_JR_ID          0
 #define DEFAULT_JR_LIODN       0
 #define RNG4_MAX_HANDLES       2
 
 struct op_ring {
-       phys_addr_t desc;
+       caam_dma_addr_t desc;
        uint32_t status;
 } __packed;
 
 struct jr_info {
        void (*callback)(uint32_t status, void *arg);
-       phys_addr_t desc_phys_addr;
+       caam_dma_addr_t desc_phys_addr;
        uint32_t desc_len;
        uint32_t op_done;
        void *arg;
@@ -83,7 +84,7 @@ struct jobring {
         * by SEC
         */
        /*Circular  Ring of i/p descriptors */
-       dma_addr_t *input_ring;
+       caam_dma_addr_t *input_ring;
        /* Circular Ring of o/p descriptors */
        /* Circula Ring containing info regarding descriptors in i/p
         * and o/p ring
diff --git a/drivers/crypto/fsl/type.h b/drivers/crypto/fsl/type.h
new file mode 100644 (file)
index 0000000..b7031a6
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2020 NXP
+ *
+ */
+
+#ifndef CRYPTO_FSL_TYPE_H
+#define CRYPTO_FSL_TYPE_H
+
+#ifdef CONFIG_CAAM_64BIT
+typedef unsigned long long caam_dma_addr_t;
+#else
+typedef u32 caam_dma_addr_t;
+#endif
+
+#endif
index a5f5524..a90b7db 100644 (file)
@@ -36,4 +36,12 @@ config IMX8M_DRAM_INLINE_ECC
        help
          Select this config if you want to use inline ecc feature for
          imx8mp-evk board.
+
+config IMX8M_VDD_SOC_850MV
+       bool "imx8mp change the vdd_soc voltage to 850mv"
+       depends on IMX8MP
+
+config IMX8M_LPDDR4_FREQ0_2400MTS
+       bool "imx8m PDDR4 freq0 change from 4000MTS to 2400MTS"
+
 endmenu
index 926c62c..b1893a5 100644 (file)
@@ -335,7 +335,7 @@ int fuse_sense(u32 bank, u32 word, u32 *val)
        struct ocotp_regs *regs;
        int ret;
 
-       if (is_imx8mq() && is_soc_rev(CHIP_REV_2_1)) {
+       if (is_imx8mq() && (soc_rev() >= CHIP_REV_2_1)) {
                printf("mxc_ocotp %s(): fuse sense is disabled\n", __func__);
                return -EPERM;
        }
index 4925675..197aa82 100644 (file)
@@ -327,6 +327,15 @@ config MMC_OCTEONTX
 
          If unsure, say N.
 
+config MVEBU_MMC
+       bool "Kirkwood MMC controller support"
+       depends on DM_MMC && BLK && ARCH_KIRKWOOD
+       help
+         Support for MMC host controller on Kirkwood SoCs.
+         If you are on a Kirkwood architecture, say Y here.
+
+         If unsure, say N.
+
 config PXA_MMC_GENERIC
        bool "Support for MMC controllers on PXA"
        help
index 09a5cd6..a467583 100644 (file)
@@ -146,6 +146,7 @@ struct esdhc_soc_data {
  * @start_tuning_tap: the start point for tuning in tuning_ctrl register
  * @strobe_dll_delay_target: settings in strobe_dllctrl
  * @signal_voltage: indicating the current voltage
+ * @signal_voltage_switch_extra_delay_ms: extra delay for IO voltage switch
  * @cd_gpio: gpio for card detection
  * @wp_gpio: gpio for write protection
  */
@@ -170,6 +171,7 @@ struct fsl_esdhc_priv {
        u32 tuning_start_tap;
        u32 strobe_dll_delay_target;
        u32 signal_voltage;
+       u32 signal_voltage_switch_extra_delay_ms;
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
        struct udevice *vqmmc_dev;
        struct udevice *vmmc_dev;
@@ -521,15 +523,6 @@ static int esdhc_send_cmd_common(struct fsl_esdhc_priv *priv, struct mmc *mmc,
                goto out;
        }
 
-       /* Switch voltage to 1.8V if CMD11 succeeded */
-       if (cmd->cmdidx == SD_CMD_SWITCH_UHS18V) {
-               esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
-
-               printf("Run CMD11 1.8V switch\n");
-               /* Sleep for 5 ms - max time for card to switch to 1.8V */
-               udelay(5000);
-       }
-
        /* Workaround for ESDHC errata ENGcm03648 */
        if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
                int timeout = 50000;
@@ -660,7 +653,10 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
        clk = (pre_div << 8) | (div << 4);
 
 #ifdef CONFIG_FSL_USDHC
-       esdhc_clrbits32(&regs->vendorspec, VENDORSPEC_CKEN);
+       esdhc_clrbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
+       ret = readx_poll_timeout(esdhc_read32, &regs->prsstat, tmp, tmp & PRSSTAT_SDOFF, 100);
+       if (ret)
+               pr_warn("fsl_esdhc_imx: Internal clock never gate off.\n");
 #else
        esdhc_clrbits32(&regs->sysctl, SYSCTL_CKEN);
 #endif
@@ -672,7 +668,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
                pr_warn("fsl_esdhc_imx: Internal clock never stabilised.\n");
 
 #ifdef CONFIG_FSL_USDHC
-       esdhc_setbits32(&regs->vendorspec, VENDORSPEC_PEREN | VENDORSPEC_CKEN);
+       esdhc_setbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
 #else
        esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_CKEN);
 #endif
@@ -727,8 +723,14 @@ static void esdhc_set_strobe_dll(struct mmc *mmc)
        struct fsl_esdhc_priv *priv = dev_get_priv(mmc->dev);
        struct fsl_esdhc *regs = priv->esdhc_regs;
        u32 val;
+       u32 tmp;
+       int ret;
 
        if (priv->clock > ESDHC_STROBE_DLL_CLK_FREQ) {
+               esdhc_clrbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
+               ret = readx_poll_timeout(esdhc_read32, &regs->prsstat, tmp, tmp & PRSSTAT_SDOFF, 100);
+               if (ret)
+                       pr_warn("fsl_esdhc_imx: Internal clock never gate off.\n");
                esdhc_write32(&regs->strobe_dllctrl, ESDHC_STROBE_DLL_CTRL_RESET);
 
                /*
@@ -746,6 +748,7 @@ static void esdhc_set_strobe_dll(struct mmc *mmc)
                        pr_warn("HS400 strobe DLL status REF not lock!\n");
                if (!(val & ESDHC_STROBE_DLL_STS_SLV_LOCK))
                        pr_warn("HS400 strobe DLL status SLV not lock!\n");
+               esdhc_setbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
        }
 }
 
@@ -835,6 +838,14 @@ static int esdhc_set_voltage(struct mmc *mmc)
                }
 #endif
                esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
+               /*
+                * some board like imx8mm-evk need about 18ms to switch
+                * the IO voltage from 3.3v to 1.8v, common code only
+                * delay 10ms, so need to delay extra time to make sure
+                * the IO voltage change to 1.8v.
+                */
+               if (priv->signal_voltage_switch_extra_delay_ms)
+                       mdelay(priv->signal_voltage_switch_extra_delay_ms);
                if (esdhc_read32(&regs->vendorspec) & ESDHC_VENDORSPEC_VSELECT)
                        return 0;
 
@@ -969,14 +980,18 @@ static int esdhc_set_ios_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 #ifdef MMC_SUPPORTS_TUNING
        if (mmc->clk_disable) {
 #ifdef CONFIG_FSL_USDHC
-               esdhc_clrbits32(&regs->vendorspec, VENDORSPEC_CKEN);
+               u32 tmp;
+
+               esdhc_clrbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
+               ret = readx_poll_timeout(esdhc_read32, &regs->prsstat, tmp, tmp & PRSSTAT_SDOFF, 100);
+               if (ret)
+                       pr_warn("fsl_esdhc_imx: Internal clock never gate off.\n");
 #else
                esdhc_clrbits32(&regs->sysctl, SYSCTL_CKEN);
 #endif
        } else {
 #ifdef CONFIG_FSL_USDHC
-               esdhc_setbits32(&regs->vendorspec, VENDORSPEC_PEREN |
-                               VENDORSPEC_CKEN);
+               esdhc_setbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
 #else
                esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_CKEN);
 #endif
@@ -1052,7 +1067,7 @@ static int esdhc_init_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 #ifndef CONFIG_FSL_USDHC
        esdhc_setbits32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
 #else
-       esdhc_setbits32(&regs->vendorspec, VENDORSPEC_HCKEN | VENDORSPEC_IPGEN);
+       esdhc_setbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
 #endif
 
        /* Set the initial clock speed */
@@ -1190,8 +1205,7 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,
        esdhc_write32(&regs->autoc12err, 0);
        esdhc_write32(&regs->clktunectrlstatus, 0);
 #else
-       esdhc_setbits32(&regs->vendorspec, VENDORSPEC_PEREN |
-                       VENDORSPEC_HCKEN | VENDORSPEC_IPGEN | VENDORSPEC_CKEN);
+       esdhc_setbits32(&regs->vendorspec, VENDORSPEC_FRC_SDCLK_ON);
 #endif
 
        if (priv->vs18_enable)
@@ -1446,6 +1460,8 @@ static int fsl_esdhc_of_to_plat(struct udevice *dev)
        val = fdtdec_get_int(fdt, node, "fsl,strobe-dll-delay-target",
                             ESDHC_STROBE_DLL_CTRL_SLV_DLY_TARGET_DEFAULT);
        priv->strobe_dll_delay_target = val;
+       val = fdtdec_get_int(fdt, node, "fsl,signal-voltage-switch-extra-delay-ms", 0);
+       priv->signal_voltage_switch_extra_delay_ms = val;
 
        if (dev_read_bool(dev, "broken-cd"))
                priv->broken_cd = 1;
index 8ec1f57..fea55c6 100644 (file)
 #include <errno.h>
 #include <log.h>
 #include <malloc.h>
+#include <dm.h>
+#include <fdtdec.h>
 #include <part.h>
 #include <mmc.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <mvebu_mmc.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#define DRIVER_NAME "MVEBU_MMC"
+#include <dm/device_compat.h>
 
 #define MVEBU_TARGET_DRAM 0
 
 #define TIMEOUT_DELAY  5*CONFIG_SYS_HZ         /* wait 5 seconds */
 
-static void mvebu_mmc_write(u32 offs, u32 val)
+static inline void *get_regbase(const struct mmc *mmc)
 {
-       writel(val, CONFIG_SYS_MMC_BASE + (offs));
+       struct mvebu_mmc_plat *pdata = mmc->priv;
+
+       return pdata->iobase;
 }
 
-static u32 mvebu_mmc_read(u32 offs)
+static void mvebu_mmc_write(const struct mmc *mmc, u32 offs, u32 val)
 {
-       return readl(CONFIG_SYS_MMC_BASE + (offs));
+       writel(val, get_regbase(mmc) + (offs));
 }
 
-static int mvebu_mmc_setup_data(struct mmc_data *data)
+static u32 mvebu_mmc_read(const struct mmc *mmc, u32 offs)
 {
+       return readl(get_regbase(mmc) + (offs));
+}
+
+static int mvebu_mmc_setup_data(struct udevice *dev, struct mmc_data *data)
+{
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc *mmc = &pdata->mmc;
        u32 ctrl_reg;
 
-       debug("%s, data %s : blocks=%d blksz=%d\n", DRIVER_NAME,
-             (data->flags & MMC_DATA_READ) ? "read" : "write",
-             data->blocks, data->blocksize);
+       dev_dbg(dev, "data %s : blocks=%d blksz=%d\n",
+               (data->flags & MMC_DATA_READ) ? "read" : "write",
+               data->blocks, data->blocksize);
 
        /* default to maximum timeout */
-       ctrl_reg = mvebu_mmc_read(SDIO_HOST_CTRL);
+       ctrl_reg = mvebu_mmc_read(mmc, SDIO_HOST_CTRL);
        ctrl_reg |= SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX);
-       mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg);
+       mvebu_mmc_write(mmc, SDIO_HOST_CTRL, ctrl_reg);
 
        if (data->flags & MMC_DATA_READ) {
-               mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data->dest & 0xffff);
-               mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data->dest >> 16);
+               mvebu_mmc_write(mmc, SDIO_SYS_ADDR_LOW, (u32)data->dest & 0xffff);
+               mvebu_mmc_write(mmc, SDIO_SYS_ADDR_HI, (u32)data->dest >> 16);
        } else {
-               mvebu_mmc_write(SDIO_SYS_ADDR_LOW, (u32)data->src & 0xffff);
-               mvebu_mmc_write(SDIO_SYS_ADDR_HI, (u32)data->src >> 16);
+               mvebu_mmc_write(mmc, SDIO_SYS_ADDR_LOW, (u32)data->src & 0xffff);
+               mvebu_mmc_write(mmc, SDIO_SYS_ADDR_HI, (u32)data->src >> 16);
        }
 
-       mvebu_mmc_write(SDIO_BLK_COUNT, data->blocks);
-       mvebu_mmc_write(SDIO_BLK_SIZE, data->blocksize);
+       mvebu_mmc_write(mmc, SDIO_BLK_COUNT, data->blocks);
+       mvebu_mmc_write(mmc, SDIO_BLK_SIZE, data->blocksize);
 
        return 0;
 }
 
-static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
+static int mvebu_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
                              struct mmc_data *data)
 {
        ulong start;
@@ -72,12 +79,14 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
        ushort resptype = 0;
        ushort xfertype = 0;
        ushort resp_indx = 0;
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc *mmc = &pdata->mmc;
 
-       debug("%s: cmdidx [0x%x] resp_type[0x%x] cmdarg[0x%x]\n",
-             DRIVER_NAME, cmd->cmdidx, cmd->resp_type, cmd->cmdarg);
+       dev_dbg(dev, "cmdidx [0x%x] resp_type[0x%x] cmdarg[0x%x]\n",
+               cmd->cmdidx, cmd->resp_type, cmd->cmdarg);
 
-       debug("%s: cmd %d (hw state 0x%04x)\n", DRIVER_NAME,
-             cmd->cmdidx, mvebu_mmc_read(SDIO_HW_STATE));
+       dev_dbg(dev, "cmd %d (hw state 0x%04x)\n",
+               cmd->cmdidx, mvebu_mmc_read(mmc, SDIO_HW_STATE));
 
        /*
         * Hardware weirdness.  The FIFO_EMPTY bit of the HW_STATE
@@ -88,26 +97,26 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
         * this bit comes to good sense (which eventually happens by
         * itself) then the new transfer simply fails with a timeout.
         */
-       if (!(mvebu_mmc_read(SDIO_HW_STATE) & CMD_FIFO_EMPTY)) {
+       if (!(mvebu_mmc_read(mmc, SDIO_HW_STATE) & CMD_FIFO_EMPTY)) {
                ushort hw_state, count = 0;
 
                start = get_timer(0);
                do {
-                       hw_state = mvebu_mmc_read(SDIO_HW_STATE);
+                       hw_state = mvebu_mmc_read(mmc, SDIO_HW_STATE);
                        if ((get_timer(0) - start) > TIMEOUT_DELAY) {
                                printf("%s : FIFO_EMPTY bit missing\n",
-                                      DRIVER_NAME);
+                                      dev->name);
                                break;
                        }
                        count++;
                } while (!(hw_state & CMD_FIFO_EMPTY));
-               debug("%s *** wait for FIFO_EMPTY bit (hw=0x%04x, count=%d, jiffies=%ld)\n",
-                     DRIVER_NAME, hw_state, count, (get_timer(0) - (start)));
+               dev_dbg(dev, "*** wait for FIFO_EMPTY bit (hw=0x%04x, count=%d, jiffies=%ld)\n",
+                       hw_state, count, (get_timer(0) - (start)));
        }
 
        /* Clear status */
-       mvebu_mmc_write(SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
-       mvebu_mmc_write(SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
 
        resptype = SDIO_CMD_INDEX(cmd->cmdidx);
 
@@ -133,11 +142,10 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
        }
 
        if (data) {
-               int err = mvebu_mmc_setup_data(data);
+               int err = mvebu_mmc_setup_data(dev, data);
 
                if (err) {
-                       debug("%s: command DATA error :%x\n",
-                             DRIVER_NAME, err);
+                       dev_dbg(dev, "command DATA error :%x\n", err);
                        return err;
                }
 
@@ -154,34 +162,33 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
        }
 
        /* Setting cmd arguments */
-       mvebu_mmc_write(SDIO_ARG_LOW, cmd->cmdarg & 0xffff);
-       mvebu_mmc_write(SDIO_ARG_HI, cmd->cmdarg >> 16);
+       mvebu_mmc_write(mmc, SDIO_ARG_LOW, cmd->cmdarg & 0xffff);
+       mvebu_mmc_write(mmc, SDIO_ARG_HI, cmd->cmdarg >> 16);
 
        /* Setting Xfer mode */
-       mvebu_mmc_write(SDIO_XFER_MODE, xfertype);
+       mvebu_mmc_write(mmc, SDIO_XFER_MODE, xfertype);
 
        /* Sending command */
-       mvebu_mmc_write(SDIO_CMD, resptype);
+       mvebu_mmc_write(mmc, SDIO_CMD, resptype);
 
        start = get_timer(0);
 
-       while (!((mvebu_mmc_read(SDIO_NOR_INTR_STATUS)) & waittype)) {
-               if (mvebu_mmc_read(SDIO_NOR_INTR_STATUS) & SDIO_NOR_ERROR) {
-                       debug("%s: error! cmdidx : %d, err reg: %04x\n",
-                             DRIVER_NAME, cmd->cmdidx,
-                             mvebu_mmc_read(SDIO_ERR_INTR_STATUS));
-                       if (mvebu_mmc_read(SDIO_ERR_INTR_STATUS) &
+       while (!((mvebu_mmc_read(mmc, SDIO_NOR_INTR_STATUS)) & waittype)) {
+               if (mvebu_mmc_read(mmc, SDIO_NOR_INTR_STATUS) & SDIO_NOR_ERROR) {
+                       dev_dbg(dev, "error! cmdidx : %d, err reg: %04x\n",
+                               cmd->cmdidx,
+                               mvebu_mmc_read(mmc, SDIO_ERR_INTR_STATUS));
+                       if (mvebu_mmc_read(mmc, SDIO_ERR_INTR_STATUS) &
                            (SDIO_ERR_CMD_TIMEOUT | SDIO_ERR_DATA_TIMEOUT)) {
-                               debug("%s: command READ timed out\n",
-                                     DRIVER_NAME);
+                               dev_dbg(dev, "command READ timed out\n");
                                return -ETIMEDOUT;
                        }
-                       debug("%s: command READ error\n", DRIVER_NAME);
+                       dev_dbg(dev, "command READ error\n");
                        return -ECOMM;
                }
 
                if ((get_timer(0) - start) > TIMEOUT_DELAY) {
-                       debug("%s: command timed out\n", DRIVER_NAME);
+                       dev_dbg(dev, "command timed out\n");
                        return -ETIMEDOUT;
                }
        }
@@ -191,8 +198,7 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
                uint response[8];
 
                for (resp_indx = 0; resp_indx < 8; resp_indx++)
-                       response[resp_indx]
-                               = mvebu_mmc_read(SDIO_RSP(resp_indx));
+                       response[resp_indx] = mvebu_mmc_read(mmc, SDIO_RSP(resp_indx));
 
                cmd->response[0] =      ((response[0] & 0x03ff) << 22) |
                                        ((response[1] & 0xffff) << 6) |
@@ -209,8 +215,7 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
                uint response[3];
 
                for (resp_indx = 0; resp_indx < 3; resp_indx++)
-                       response[resp_indx]
-                               = mvebu_mmc_read(SDIO_RSP(resp_indx));
+                       response[resp_indx] = mvebu_mmc_read(mmc, SDIO_RSP(resp_indx));
 
                cmd->response[0] =      ((response[2] & 0x003f) << (8 - 8)) |
                                        ((response[1] & 0xffff) << (14 - 8)) |
@@ -225,64 +230,71 @@ static int mvebu_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
                cmd->response[3] =      0;
        }
 
-       debug("%s: resp[0x%x] ", DRIVER_NAME, cmd->resp_type);
+       dev_dbg(dev, "resp[0x%x] ", cmd->resp_type);
        debug("[0x%x] ", cmd->response[0]);
        debug("[0x%x] ", cmd->response[1]);
        debug("[0x%x] ", cmd->response[2]);
        debug("[0x%x] ", cmd->response[3]);
        debug("\n");
 
-       if (mvebu_mmc_read(SDIO_ERR_INTR_STATUS) &
+       if (mvebu_mmc_read(mmc, SDIO_ERR_INTR_STATUS) &
                (SDIO_ERR_CMD_TIMEOUT | SDIO_ERR_DATA_TIMEOUT))
                return -ETIMEDOUT;
 
        return 0;
 }
 
-static void mvebu_mmc_power_up(void)
+static void mvebu_mmc_power_up(struct udevice *dev)
 {
-       debug("%s: power up\n", DRIVER_NAME);
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc *mmc = &pdata->mmc;
+
+       dev_dbg(dev, "power up\n");
 
        /* disable interrupts */
-       mvebu_mmc_write(SDIO_NOR_INTR_EN, 0);
-       mvebu_mmc_write(SDIO_ERR_INTR_EN, 0);
+       mvebu_mmc_write(mmc, SDIO_NOR_INTR_EN, 0);
+       mvebu_mmc_write(mmc, SDIO_ERR_INTR_EN, 0);
 
        /* SW reset */
-       mvebu_mmc_write(SDIO_SW_RESET, SDIO_SW_RESET_NOW);
+       mvebu_mmc_write(mmc, SDIO_SW_RESET, SDIO_SW_RESET_NOW);
 
-       mvebu_mmc_write(SDIO_XFER_MODE, 0);
+       mvebu_mmc_write(mmc, SDIO_XFER_MODE, 0);
 
        /* enable status */
-       mvebu_mmc_write(SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
-       mvebu_mmc_write(SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
 
        /* enable interrupts status */
-       mvebu_mmc_write(SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
-       mvebu_mmc_write(SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_NOR_INTR_STATUS, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_ERR_INTR_STATUS, SDIO_POLL_MASK);
 }
 
-static void mvebu_mmc_set_clk(unsigned int clock)
+static void mvebu_mmc_set_clk(struct udevice *dev, unsigned int clock)
 {
        unsigned int m;
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc *mmc = &pdata->mmc;
 
        if (clock == 0) {
-               debug("%s: clock off\n", DRIVER_NAME);
-               mvebu_mmc_write(SDIO_XFER_MODE, SDIO_XFER_MODE_STOP_CLK);
-               mvebu_mmc_write(SDIO_CLK_DIV, MVEBU_MMC_BASE_DIV_MAX);
+               dev_dbg(dev, "clock off\n");
+               mvebu_mmc_write(mmc, SDIO_XFER_MODE, SDIO_XFER_MODE_STOP_CLK);
+               mvebu_mmc_write(mmc, SDIO_CLK_DIV, MVEBU_MMC_BASE_DIV_MAX);
        } else {
                m = MVEBU_MMC_BASE_FAST_CLOCK/(2*clock) - 1;
                if (m > MVEBU_MMC_BASE_DIV_MAX)
                        m = MVEBU_MMC_BASE_DIV_MAX;
-               mvebu_mmc_write(SDIO_CLK_DIV, m & MVEBU_MMC_BASE_DIV_MAX);
-               debug("%s: clock (%d) div : %d\n", DRIVER_NAME, clock, m);
+               mvebu_mmc_write(mmc, SDIO_CLK_DIV, m & MVEBU_MMC_BASE_DIV_MAX);
+               dev_dbg(dev, "clock (%d) div : %d\n", clock, m);
        }
 }
 
-static void mvebu_mmc_set_bus(unsigned int bus)
+static void mvebu_mmc_set_bus(struct udevice *dev, unsigned int bus)
 {
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc *mmc = &pdata->mmc;
        u32 ctrl_reg = 0;
 
-       ctrl_reg = mvebu_mmc_read(SDIO_HOST_CTRL);
+       ctrl_reg = mvebu_mmc_read(mmc, SDIO_HOST_CTRL);
        ctrl_reg &= ~SDIO_HOST_CTRL_DATA_WIDTH_4_BITS;
 
        switch (bus) {
@@ -306,23 +318,26 @@ static void mvebu_mmc_set_bus(unsigned int bus)
 
        ctrl_reg |= SDIO_HOST_CTRL_CARD_TYPE_MEM_ONLY;
 
-       debug("%s: ctrl 0x%04x: %s %s %s\n", DRIVER_NAME, ctrl_reg,
-             (ctrl_reg & SDIO_HOST_CTRL_PUSH_PULL_EN) ?
-             "push-pull" : "open-drain",
-             (ctrl_reg & SDIO_HOST_CTRL_DATA_WIDTH_4_BITS) ?
-             "4bit-width" : "1bit-width",
-             (ctrl_reg & SDIO_HOST_CTRL_HI_SPEED_EN) ?
-             "high-speed" : "");
+       dev_dbg(dev, "ctrl 0x%04x: %s %s %s\n", ctrl_reg,
+               (ctrl_reg & SDIO_HOST_CTRL_PUSH_PULL_EN) ?
+               "push-pull" : "open-drain",
+               (ctrl_reg & SDIO_HOST_CTRL_DATA_WIDTH_4_BITS) ?
+               "4bit-width" : "1bit-width",
+               (ctrl_reg & SDIO_HOST_CTRL_HI_SPEED_EN) ?
+               "high-speed" : "");
 
-       mvebu_mmc_write(SDIO_HOST_CTRL, ctrl_reg);
+       mvebu_mmc_write(mmc, SDIO_HOST_CTRL, ctrl_reg);
 }
 
-static int mvebu_mmc_set_ios(struct mmc *mmc)
+static int mvebu_mmc_set_ios(struct udevice *dev)
 {
-       debug("%s: bus[%d] clock[%d]\n", DRIVER_NAME,
-             mmc->bus_width, mmc->clock);
-       mvebu_mmc_set_bus(mmc->bus_width);
-       mvebu_mmc_set_clk(mmc->clock);
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc *mmc = &pdata->mmc;
+
+       dev_dbg(dev, "bus[%d] clock[%d]\n",
+               mmc->bus_width, mmc->clock);
+       mvebu_mmc_set_bus(dev, mmc->bus_width);
+       mvebu_mmc_set_clk(dev, mmc->clock);
 
        return 0;
 }
@@ -330,13 +345,13 @@ static int mvebu_mmc_set_ios(struct mmc *mmc)
 /*
  * Set window register.
  */
-static void mvebu_window_setup(void)
+static void mvebu_window_setup(const struct mmc *mmc)
 {
        int i;
 
        for (i = 0; i < 4; i++) {
-               mvebu_mmc_write(WINDOW_CTRL(i), 0);
-               mvebu_mmc_write(WINDOW_BASE(i), 0);
+               mvebu_mmc_write(mmc, WINDOW_CTRL(i), 0);
+               mvebu_mmc_write(mmc, WINDOW_BASE(i), 0);
        }
        for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
                u32 size, base, attrib;
@@ -364,79 +379,119 @@ static void mvebu_window_setup(void)
                size = gd->bd->bi_dram[i].size;
                base = gd->bd->bi_dram[i].start;
                if (size && attrib) {
-                       mvebu_mmc_write(WINDOW_CTRL(i),
+                       mvebu_mmc_write(mmc, WINDOW_CTRL(i),
                                        MVCPU_WIN_CTRL_DATA(size,
                                                            MVEBU_TARGET_DRAM,
                                                            attrib,
                                                            MVCPU_WIN_ENABLE));
                } else {
-                       mvebu_mmc_write(WINDOW_CTRL(i), MVCPU_WIN_DISABLE);
+                       mvebu_mmc_write(mmc, WINDOW_CTRL(i), MVCPU_WIN_DISABLE);
                }
-               mvebu_mmc_write(WINDOW_BASE(i), base);
+               mvebu_mmc_write(mmc, WINDOW_BASE(i), base);
        }
 }
 
-static int mvebu_mmc_initialize(struct mmc *mmc)
+static int mvebu_mmc_initialize(struct udevice *dev)
 {
-       debug("%s: mvebu_mmc_initialize\n", DRIVER_NAME);
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc *mmc = &pdata->mmc;
+
+       dev_dbg(dev, "%s\n", __func__);
 
        /*
         * Setting host parameters
         * Initial Host Ctrl : Timeout : max , Normal Speed mode,
         * 4-bit data mode, Big Endian, SD memory Card, Push_pull CMD Line
         */
-       mvebu_mmc_write(SDIO_HOST_CTRL,
+       mvebu_mmc_write(mmc, SDIO_HOST_CTRL,
                        SDIO_HOST_CTRL_TMOUT(SDIO_HOST_CTRL_TMOUT_MAX) |
                        SDIO_HOST_CTRL_DATA_WIDTH_4_BITS |
                        SDIO_HOST_CTRL_BIG_ENDIAN |
                        SDIO_HOST_CTRL_PUSH_PULL_EN |
                        SDIO_HOST_CTRL_CARD_TYPE_MEM_ONLY);
 
-       mvebu_mmc_write(SDIO_CLK_CTRL, 0);
+       mvebu_mmc_write(mmc, SDIO_CLK_CTRL, 0);
 
        /* enable status */
-       mvebu_mmc_write(SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
-       mvebu_mmc_write(SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_NOR_STATUS_EN, SDIO_POLL_MASK);
+       mvebu_mmc_write(mmc, SDIO_ERR_STATUS_EN, SDIO_POLL_MASK);
 
        /* disable interrupts */
-       mvebu_mmc_write(SDIO_NOR_INTR_EN, 0);
-       mvebu_mmc_write(SDIO_ERR_INTR_EN, 0);
+       mvebu_mmc_write(mmc, SDIO_NOR_INTR_EN, 0);
+       mvebu_mmc_write(mmc, SDIO_ERR_INTR_EN, 0);
 
-       mvebu_window_setup();
+       mvebu_window_setup(mmc);
 
        /* SW reset */
-       mvebu_mmc_write(SDIO_SW_RESET, SDIO_SW_RESET_NOW);
+       mvebu_mmc_write(mmc, SDIO_SW_RESET, SDIO_SW_RESET_NOW);
 
        return 0;
 }
 
-static const struct mmc_ops mvebu_mmc_ops = {
-       .send_cmd       = mvebu_mmc_send_cmd,
-       .set_ios        = mvebu_mmc_set_ios,
-       .init           = mvebu_mmc_initialize,
-};
+static int mvebu_mmc_of_to_plat(struct udevice *dev)
+{
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       fdt_addr_t addr;
 
-static struct mmc_config mvebu_mmc_cfg = {
-       .name           = DRIVER_NAME,
-       .ops            = &mvebu_mmc_ops,
-       .f_min          = MVEBU_MMC_BASE_FAST_CLOCK / MVEBU_MMC_BASE_DIV_MAX,
-       .f_max          = MVEBU_MMC_CLOCKRATE_MAX,
-       .voltages       = MMC_VDD_32_33 | MMC_VDD_33_34,
-       .host_caps      = MMC_MODE_4BIT | MMC_MODE_HS |
-                         MMC_MODE_HS_52MHz,
-       .part_type      = PART_TYPE_DOS,
-       .b_max          = CONFIG_SYS_MMC_MAX_BLK_COUNT,
-};
+       addr = dev_read_addr(dev);
+       if (addr == FDT_ADDR_T_NONE)
+               return -EINVAL;
 
-int mvebu_mmc_init(struct bd_info *bis)
-{
-       struct mmc *mmc;
+       pdata->iobase = (void *)addr;
 
-       mvebu_mmc_power_up();
+       return 0;
+}
 
-       mmc = mmc_create(&mvebu_mmc_cfg, bis);
-       if (mmc == NULL)
-               return -1;
+static int mvebu_mmc_probe(struct udevice *dev)
+{
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+       struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+       struct mmc *mmc = &pdata->mmc;
+       struct mmc_config *cfg = &pdata->cfg;
+
+       cfg->name = dev->name;
+       cfg->f_min = MVEBU_MMC_BASE_FAST_CLOCK / MVEBU_MMC_BASE_DIV_MAX;
+       cfg->f_max = MVEBU_MMC_CLOCKRATE_MAX;
+       cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
+       cfg->host_caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz;
+       cfg->part_type = PART_TYPE_DOS;
+       cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+
+       mmc->cfg = cfg;
+       mmc->priv = pdata;
+       mmc->dev = dev;
+       upriv->mmc = mmc;
+
+       mvebu_mmc_power_up(dev);
+       mvebu_mmc_initialize(dev);
 
        return 0;
 }
+
+static const struct dm_mmc_ops mvebu_dm_mmc_ops = {
+       .send_cmd = mvebu_mmc_send_cmd,
+       .set_ios = mvebu_mmc_set_ios,
+};
+
+static int mvebu_mmc_bind(struct udevice *dev)
+{
+       struct mvebu_mmc_plat *pdata = dev_get_plat(dev);
+
+       return mmc_bind(dev, &pdata->mmc, &pdata->cfg);
+}
+
+static const struct udevice_id mvebu_mmc_match[] = {
+       { .compatible = "marvell,orion-sdio" },
+       { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(mvebu_mmc) = {
+       .name = "mvebu_mmc",
+       .id = UCLASS_MMC,
+       .of_match = mvebu_mmc_match,
+       .ops = &mvebu_dm_mmc_ops,
+       .probe = mvebu_mmc_probe,
+       .bind = mvebu_mmc_bind,
+       .of_to_plat = mvebu_mmc_of_to_plat,
+       .plat_auto = sizeof(struct mvebu_mmc_plat),
+};
index 46dc29d..17f46ae 100644 (file)
@@ -282,6 +282,11 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
        return 0;
 }
 
+struct mtd_info *nand_get_mtd(void)
+{
+       return mtd;
+}
+
 int nand_default_bbt(struct mtd_info *mtd)
 {
        return 0;
index d4f2742..8c4d0a9 100644 (file)
@@ -11,7 +11,7 @@
 
 static const char pca9450_name[] = "PCA9450";
 
-int power_pca9450_init(unsigned char bus)
+int power_pca9450_init(unsigned char bus, unsigned char addr)
 {
        struct pmic *p = pmic_alloc();
 
@@ -23,7 +23,7 @@ int power_pca9450_init(unsigned char bus)
        p->name = pca9450_name;
        p->interface = PMIC_I2C;
        p->number_of_regs = PCA9450_REG_NUM;
-       p->hw.i2c.addr = 0x25;
+       p->hw.i2c.addr = addr;
        p->hw.i2c.tx_num = 1;
        p->bus = bus;
 
index 6aca22a..08de692 100644 (file)
@@ -8,6 +8,6 @@ config RAM_SIFIVE
 config SIFIVE_FU540_DDR
        bool "SiFive FU540 DDR driver"
        depends on RAM_SIFIVE
-       default y if TARGET_SIFIVE_FU540
+       default y if TARGET_SIFIVE_UNLEASHED
        help
          This enables DDR support for the platforms based on SiFive FU540 SoC.
index f5b3f88..019565f 100644 (file)
@@ -166,7 +166,7 @@ config RESET_IPQ419
 
 config RESET_SIFIVE
        bool "Reset Driver for SiFive SoC's"
-       depends on DM_RESET && CLK_SIFIVE_FU540_PRCI && TARGET_SIFIVE_FU540
+       depends on DM_RESET && CLK_SIFIVE_FU540_PRCI && TARGET_SIFIVE_UNLEASHED
        default y
        help
          PRCI module within SiFive SoC's provides mechanism to reset
index aa6d901..dafba35 100644 (file)
@@ -38,6 +38,13 @@ config RTC_ENABLE_32KHZ_OUTPUT
           Some real-time clocks support the output of 32kHz square waves (such as ds3231),
           the config symbol choose Real Time Clock device 32Khz output feature.
 
+config RTC_ARMADA38X
+       bool "Enable Armada 38x Marvell SoC RTC"
+       depends on DM_RTC && ARCH_MVEBU
+       help
+         This adds support for the in-chip RTC that can be found in the
+         Armada 38x Marvell's SoC devices.
+
 config RTC_PCF2127
        bool "Enable PCF2127 driver"
        depends on DM_RTC
index 6a45a9c..15609e7 100644 (file)
@@ -8,6 +8,7 @@ obj-$(CONFIG_$(SPL_TPL_)DM_RTC) += rtc-uclass.o
 
 obj-$(CONFIG_RTC_AT91SAM9_RTT) += at91sam9_rtt.o
 obj-y += rtc-lib.o
+obj-$(CONFIG_RTC_ARMADA38X) += armada38x.o
 obj-$(CONFIG_RTC_DAVINCI) += davinci.o
 obj-$(CONFIG_RTC_DS1302) += ds1302.o
 obj-$(CONFIG_RTC_DS1306) += ds1306.o
diff --git a/drivers/rtc/armada38x.c b/drivers/rtc/armada38x.c
new file mode 100644 (file)
index 0000000..2d264ac
--- /dev/null
@@ -0,0 +1,184 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * RTC driver for the Armada 38x Marvell SoCs
+ *
+ * Copyright (C) 2021 Marek Behun <marek.behun@nic.cz>
+ *
+ * Based on Linux' driver by Gregory Clement and Marvell
+ */
+
+#include <asm/io.h>
+#include <dm.h>
+#include <linux/delay.h>
+#include <rtc.h>
+
+#define RTC_STATUS                     0x0
+#define RTC_TIME                       0xC
+#define RTC_CONF_TEST                  0x1C
+
+/* Armada38x SoC registers  */
+#define RTC_38X_BRIDGE_TIMING_CTL      0x0
+#define RTC_38X_PERIOD_OFFS            0
+#define RTC_38X_PERIOD_MASK            (0x3FF << RTC_38X_PERIOD_OFFS)
+#define RTC_38X_READ_DELAY_OFFS                26
+#define RTC_38X_READ_DELAY_MASK                (0x1F << RTC_38X_READ_DELAY_OFFS)
+
+#define SAMPLE_NR                      100
+
+struct armada38x_rtc {
+       void __iomem *regs;
+       void __iomem *regs_soc;
+};
+
+/*
+ * According to Erratum RES-3124064 we have to do some configuration in MBUS.
+ * To read an RTC register we need to read it 100 times and return the most
+ * frequent value.
+ * To write an RTC register we need to write 2x zero into STATUS register,
+ * followed by the proper write. Linux adds an 5 us delay after this, so we do
+ * it here as well.
+ */
+static void update_38x_mbus_timing_params(struct armada38x_rtc *rtc)
+{
+       u32 reg;
+
+       reg = readl(rtc->regs_soc + RTC_38X_BRIDGE_TIMING_CTL);
+       reg &= ~RTC_38X_PERIOD_MASK;
+       reg |= 0x3FF << RTC_38X_PERIOD_OFFS; /* Maximum value */
+       reg &= ~RTC_38X_READ_DELAY_MASK;
+       reg |= 0x1F << RTC_38X_READ_DELAY_OFFS; /* Maximum value */
+       writel(reg, rtc->regs_soc + RTC_38X_BRIDGE_TIMING_CTL);
+}
+
+static void armada38x_rtc_write(u32 val, struct armada38x_rtc *rtc, u8 reg)
+{
+       writel(0, rtc->regs + RTC_STATUS);
+       writel(0, rtc->regs + RTC_STATUS);
+       writel(val, rtc->regs + reg);
+       udelay(5);
+}
+
+static u32 armada38x_rtc_read(struct armada38x_rtc *rtc, u8 reg)
+{
+       u8 counts[SAMPLE_NR], max_idx;
+       u32 samples[SAMPLE_NR], max;
+       int i, j, last;
+
+       for (i = 0, last = 0; i < SAMPLE_NR; ++i) {
+               u32 sample = readl(rtc->regs + reg);
+
+               /* find if this value was already read */
+               for (j = 0; j < last; ++j) {
+                       if (samples[j] == sample)
+                               break;
+               }
+
+               if (j < last) {
+                       /* if yes, increment count */
+                       ++counts[j];
+               } else {
+                       /* if not, add */
+                       samples[last] = sample;
+                       counts[last] = 1;
+                       ++last;
+               }
+       }
+
+       /* finally find the sample that was read the most */
+       max = 0;
+       max_idx = 0;
+
+       for (i = 0; i < last; ++i) {
+               if (counts[i] > max) {
+                       max = counts[i];
+                       max_idx = i;
+               }
+       }
+
+       return samples[max_idx];
+}
+
+static int armada38x_rtc_get(struct udevice *dev, struct rtc_time *tm)
+{
+       struct armada38x_rtc *rtc = dev_get_priv(dev);
+       u32 time;
+
+       time = armada38x_rtc_read(rtc, RTC_TIME);
+
+       rtc_to_tm(time, tm);
+
+       return 0;
+}
+
+static int armada38x_rtc_reset(struct udevice *dev)
+{
+       struct armada38x_rtc *rtc = dev_get_priv(dev);
+       u32 reg;
+
+       reg = armada38x_rtc_read(rtc, RTC_CONF_TEST);
+
+       if (reg & 0xff) {
+               armada38x_rtc_write(0, rtc, RTC_CONF_TEST);
+               mdelay(500);
+               armada38x_rtc_write(0, rtc, RTC_TIME);
+               armada38x_rtc_write(BIT(0) | BIT(1), 0, RTC_STATUS);
+       }
+
+       return 0;
+}
+
+static int armada38x_rtc_set(struct udevice *dev, const struct rtc_time *tm)
+{
+       struct armada38x_rtc *rtc = dev_get_priv(dev);
+       unsigned long time;
+
+       time = rtc_mktime(tm);
+
+       if (time > U32_MAX)
+               printf("%s: requested time to set will overflow\n", dev->name);
+
+       armada38x_rtc_reset(dev);
+       armada38x_rtc_write(time, rtc, RTC_TIME);
+
+       return 0;
+}
+
+static int armada38x_probe(struct udevice *dev)
+{
+       struct armada38x_rtc *rtc = dev_get_priv(dev);
+
+       rtc->regs = dev_remap_addr_name(dev, "rtc");
+       if (!rtc->regs)
+               goto err;
+
+       rtc->regs_soc = dev_remap_addr_name(dev, "rtc-soc");
+       if (!rtc->regs_soc)
+               goto err;
+
+       update_38x_mbus_timing_params(rtc);
+
+       return 0;
+err:
+       printf("%s: io address missing\n", dev->name);
+       return -ENODEV;
+}
+
+static const struct rtc_ops armada38x_rtc_ops = {
+       .get = armada38x_rtc_get,
+       .set = armada38x_rtc_set,
+       .reset = armada38x_rtc_reset,
+};
+
+static const struct udevice_id armada38x_rtc_ids[] = {
+       { .compatible = "marvell,armada-380-rtc", .data = 0 },
+       { }
+};
+
+U_BOOT_DRIVER(rtc_armada38x) = {
+       .name           = "rtc-armada38x",
+       .id             = UCLASS_RTC,
+       .of_match       = armada38x_rtc_ids,
+       .probe          = armada38x_probe,
+       .priv_auto      = sizeof(struct armada38x_rtc),
+       .ops            = &armada38x_rtc_ops,
+};
index de7b4b9..939b99d 100644 (file)
@@ -54,6 +54,7 @@ static int sifive_clint_probe(struct udevice *dev)
 
 static const struct udevice_id sifive_clint_ids[] = {
        { .compatible = "riscv,clint0" },
+       { .compatible = "sifive,clint0" },
        { }
 };
 
index c020324..9e54871 100644 (file)
@@ -9,7 +9,6 @@
 #include <reset.h>
 #include <wdt.h>
 #include <asm/io.h>
-#include <asm/utils.h>
 #include <linux/bitops.h>
 
 #define DW_WDT_CR      0x00
@@ -35,7 +34,7 @@ static int designware_wdt_settimeout(void __iomem *base, unsigned int clk_khz,
        signed int i;
 
        /* calculate the timeout range value */
-       i = log_2_n_round_up(timeout * clk_khz) - 16;
+       i = fls(timeout * clk_khz - 1) - 16;
        i = clamp(i, 0, 15);
 
        writel(i | (i << 4), base + DW_WDT_TORR);
@@ -130,27 +129,39 @@ static int designware_wdt_probe(struct udevice *dev)
        if (ret)
                return ret;
 
+       ret = clk_enable(&clk);
+       if (ret)
+               goto err;
+
        priv->clk_khz = clk_get_rate(&clk) / 1000;
-       if (!priv->clk_khz)
-               return -EINVAL;
+       if (!priv->clk_khz) {
+               ret = -EINVAL;
+               goto err;
+       }
 #else
        priv->clk_khz = CONFIG_DW_WDT_CLOCK_KHZ;
 #endif
 
-#if CONFIG_IS_ENABLED(DM_RESET)
-       struct reset_ctl_bulk resets;
+       if (CONFIG_IS_ENABLED(DM_RESET)) {
+               struct reset_ctl_bulk resets;
 
-       ret = reset_get_bulk(dev, &resets);
-       if (ret)
-               return ret;
+               ret = reset_get_bulk(dev, &resets);
+               if (ret)
+                       goto err;
 
-       ret = reset_deassert_bulk(&resets);
-       if (ret)
-               return ret;
-#endif
+               ret = reset_deassert_bulk(&resets);
+               if (ret)
+                       goto err;
+       }
 
        /* reset to disable the watchdog */
        return designware_wdt_stop(dev);
+
+err:
+#if CONFIG_IS_ENABLED(CLK)
+       clk_free(&clk);
+#endif
+       return ret;
 }
 
 static const struct wdt_ops designware_wdt_ops = {
index 0e81ef9..12de010 100644 (file)
                "source ${loadaddr}\0" \
        "splashpos=m,m\0" \
        "splashimage=" __stringify(CONFIG_LOADADDR) "\0" \
-       "vidargs=mxc_hdmi.only_cea=1 " \
-               "video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24 " \
-               "video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off " \
-               "fbmem=32M\0 "
+       "vidargs=mxc_hdmi.only_cea=1 fbmem=32M\0"
 
 /* Miscellaneous configurable options */
 #undef CONFIG_SYS_CBSIZE
index 5441da8..c9852a7 100644 (file)
  */
 #define CONFIG_SYS_TCLK                250000000       /* 250MHz */
 
-/*
- * SDIO/MMC Card Configuration
- */
-#define CONFIG_SYS_MMC_BASE            MVEBU_SDIO_BASE
-
 /* USB/EHCI configuration */
 #define CONFIG_EHCI_IS_TDI
 
index 2827c17..22ee2ba 100644 (file)
@@ -63,7 +63,7 @@
                "ubi.fm_autoconvert=1\0" \
        "ubiboot=run setup; " \
                "setenv bootargs ${defargs} ${ubiargs} " \
-               "${setupargs} ${vidargs}; echo Booting from NAND...; " \
+               "${setupargs} ${vidargs} ${tdxargs}; echo Booting from NAND...; " \
                "ubi part ubi &&" \
                "ubi read ${kernel_addr_r} kernel && " \
                "ubi read ${fdt_addr_r} dtb && " \
index c014d6b..804a144 100644 (file)
@@ -72,7 +72,6 @@
 
 #ifndef CONFIG_SPL_BUILD
 #define BOOT_TARGET_DEVICES(func) \
-       func(MMC, mmc, 0) \
        func(MMC, mmc, 1) \
        func(MMC, mmc, 0) \
        func(USB, usb, 0) \
                "source ${loadaddr}\0" \
        "splashpos=m,m\0" \
        "splashimage=" __stringify(CONFIG_LOADADDR) "\0" \
-       "vidargs=video=mxcfb0:dev=lcd,640x480M@60,if=RGB666 " \
-               "video=mxcfb1:off fbmem=8M\0 "
+       "vidargs=fbmem=8M\0"
 
 /* Miscellaneous configurable options */
 #undef CONFIG_SYS_CBSIZE
index 85dd891..2fffaa3 100644 (file)
                "ubi.fm_autoconvert=1\0" \
        "ubiboot=run setup; " \
                "setenv bootargs ${defargs} ${ubiargs} " \
-               "${setupargs} ${vidargs}; echo Booting from NAND...; " \
+               "${setupargs} ${vidargs} ${tdxargs}; echo Booting from NAND...; " \
                "ubi part ubi && run m4boot && " \
                "ubi read ${kernel_addr_r} kernel && " \
                "ubi read ${fdt_addr_r} dtb && " \
index f53d48d..869b94b 100644 (file)
 
 #define CONFIG_LOADADDR                1000000
 
-/*
- * SDIO/MMC Card Configuration
- */
-#define CONFIG_SYS_MMC_BASE            MVEBU_SDIO_BASE
-
 /*
  * SATA/SCSI/AHCI configuration
  */
index d4207be..ed851bc 100644 (file)
 #define CONFIG_SYS_I2C_SLAVE           0x0
 #define CONFIG_SYS_I2C_SPEED           100000
 
-/*
- * SDIO/MMC Card Configuration
- */
-#define CONFIG_SYS_MMC_BASE            MVEBU_SDIO_BASE
-
 /*
  * SATA/SCSI/AHCI configuration
  */
index 1f033ab..35d8536 100644 (file)
@@ -44,7 +44,8 @@
        "x_bootcmd_kernel=fatload usb 0 0x6400000 uImage\0" \
        "x_bootargs=console=ttyS0,115200\0"     \
        "x_bootargs_root=root=/dev/sda2 rootdelay=10\0" \
-       "ipaddr=192.168.1.5\0"
+       "ipaddr=192.168.1.5\0"          \
+       "usb0Mode=host\0"
 
 /*
  * Ethernet Driver configuration
index 8aa2d47..c8b4506 100644 (file)
@@ -6,6 +6,9 @@
 #ifndef _CONFIG_SYNOLOGY_DS414_H
 #define _CONFIG_SYNOLOGY_DS414_H
 
+/* Vendor kernel expects this MACH_TYPE */
+#define CONFIG_MACH_TYPE       3036
+
 /*
  * High Level Configuration Options (easy to change)
  */
 #define CONFIG_DDR_32BIT
 
 /* Default Environment */
-#define CONFIG_BOOTCOMMAND     "sf read ${loadaddr} 0xd0000 0x700000; bootm"
 #define CONFIG_LOADADDR                0x80000
+#define CONFIG_BOOTCOMMAND                                     \
+       "sf probe; "                                            \
+       "sf read ${loadaddr} 0xd0000 0x2d0000; "                \
+       "sf read ${ramdisk_addr_r} 0x3a0000 0x430000; "         \
+       "bootm ${loadaddr} ${ramdisk_addr_r}"
+
+#define CONFIG_EXTRA_ENV_SETTINGS                              \
+       "initrd_high=0xffffffff\0"                              \
+       "ramdisk_addr_r=0x8000000\0"                            \
+       "usb0Mode=host\0usb1Mode=host\0usb2Mode=device\0"       \
+       "ethmtu=1500\0eth1mtu=1500\0"                           \
+       "update_uboot=sf probe; dhcp; "                         \
+               "mw.b ${loadaddr} 0x0 0xd0000; "                \
+               "tftpboot ${loadaddr} u-boot-spl.kwb; "         \
+               "sf update ${loadaddr} 0x0 0xd0000\0"
+
 
 /* increase autoneg timeout, my NIC sucks */
 #define PHY_ANEG_TIMEOUT       16000
index ff3a849..a29eec0 100644 (file)
@@ -29,7 +29,6 @@
 #define CONFIG_SYS_I2C_SPEED           100000
 
 /* USB Configs */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET       /* For OTG port */
 #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS   0
 /* MMC Configs */
 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
 
-#define CONFIG_FEC_MXC
-#define IMX_FEC_BASE                   ENET_BASE_ADDR
-#define CONFIG_FEC_XCV_TYPE            RGMII
-#define CONFIG_ETHPRIME                        "FEC"
-#define CONFIG_FEC_MXC_PHYADDR         4
-
 #define CONFIG_ARP_TIMEOUT     200UL
 
 /* Physical Memory Map */
index 7c8abda..5754b6a 100644 (file)
 /* Serial */
 #define CONFIG_MXC_UART_BASE          UART2_BASE
 
-#if !defined(CONFIG_SPI_FLASH) && defined(CONFIG_SPL_NAND_SUPPORT)
-/* Enable NAND support */
-#ifdef CONFIG_CMD_NAND
-  #define CONFIG_SYS_MAX_NAND_DEVICE   1
-  #define CONFIG_SYS_NAND_BASE         0x40000000
-  #define CONFIG_SYS_NAND_5_ADDR_CYCLE
-  #define CONFIG_SYS_NAND_ONFI_DETECTION
-
-  /* DMA stuff, needed for GPMI/MXS NAND support */
-#endif
-
-#endif /* CONFIG_SPI_FLASH */
+/* NAND */
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
 
 /* I2C Configs */
 #define CONFIG_SYS_I2C
 #define CONFIG_ARP_TIMEOUT       200UL
 
 /* USB Configs */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET  /* For OTG port */
 #define CONFIG_MXC_USB_PORTSC     (PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS      0
index 396870a..2cda05c 100644 (file)
  */
 #define CONFIG_SYS_TCLK                250000000       /* 250MHz */
 
-/*
- * SDIO/MMC Card Configuration
- */
-#define CONFIG_SYS_MMC_BASE            MVEBU_SDIO_BASE
-
 /* USB/EHCI configuration */
 #define CONFIG_EHCI_IS_TDI
 
index fd9a6cb..8f3dd8f 100644 (file)
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS              \
        BOOTENV \
-       "scriptaddr=0x43500000\0" \
-       "kernel_addr_r=0x40880000\0" \
+       "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
+       "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
        "image=Image\0" \
        "console=ttymxc1,115200\0" \
-       "fdt_addr=0x43000000\0"                 \
+       "fdt_addr_r=0x43000000\0"                       \
        "boot_fit=no\0" \
-       "fdt_file=imx8mm-evk.dtb\0" \
+       "fdtfile=imx8mm-evk.dtb\0" \
        "initrd_addr=0x43800000\0"              \
        "bootm_size=0x10000000\0" \
        "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
index a406e91..9166925 100644 (file)
@@ -19,9 +19,9 @@
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_SPL_STACK               0x920000
 #define CONFIG_SPL_BSS_START_ADDR      0x910000
-#define CONFIG_SPL_BSS_MAX_SIZE                SZ_8K   /* 8 KB */
+#define CONFIG_SPL_BSS_MAX_SIZE                SZ_8K
 #define CONFIG_SYS_SPL_MALLOC_START    0x42200000
-#define CONFIG_SYS_SPL_MALLOC_SIZE     SZ_512K /* 512 KB */
+#define CONFIG_SYS_SPL_MALLOC_SIZE     SZ_1M
 
 /* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
 #define CONFIG_MALLOC_F_ADDR           0x930000
index 61a5c6f..d1bc09e 100644 (file)
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS              \
        BOOTENV \
-       "scriptaddr=0x43500000\0" \
-       "kernel_addr_r=0x40880000\0" \
+       "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
+       "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
        "image=Image\0" \
        "console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200\0" \
-       "fdt_addr=0x43000000\0"                 \
+       "fdt_addr_r=0x43000000\0"                       \
        "boot_fdt=try\0" \
-       "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
+       "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
        "initrd_addr=0x43800000\0"              \
        "bootm_size=0x10000000\0" \
        "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
index e9fd0fc..03b9393 100644 (file)
@@ -74,9 +74,4 @@
 #define CONFIG_SYS_ATA_IDE1_OFFSET     MV_SATA_PORT1_OFFSET
 #endif /*CONFIG_MVSATA_IDE*/
 
-#ifdef CONFIG_CMD_MMC
-#define CONFIG_MVEBU_MMC
-#define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
-#endif /* CONFIG_CMD_MMC */
-
 #endif /* _CONFIG_OPENRD_BASE_H */
index 4f03699..bc48e80 100644 (file)
@@ -19,6 +19,7 @@
 
 /* Enable NAND support */
 #define CONFIG_SYS_MAX_NAND_DEVICE     1
+#define CONFIG_SYS_NAND_ONFI_DETECTION
 
 /* Physical Memory Map */
 #define PHYS_SDRAM                     MMDC0_ARB_BASE_ADDR
index e1f8fb8..abe8418 100644 (file)
 #define CONFIG_PHY_BASE_ADR    0
 #endif /* CONFIG_CMD_NET */
 
-/*
- * SDIO/MMC Card Configuration
- */
-#ifdef CONFIG_CMD_MMC
-#define CONFIG_MVEBU_MMC
-#define CONFIG_SYS_MMC_BASE KW_SDIO_BASE
-#endif /* CONFIG_CMD_MMC */
-
 /*
  * SATA driver configuration
  */
index 08acb25..4c1ff98 100644 (file)
@@ -18,9 +18,6 @@
 /* Don't relocate into AI ram since it isn't set up yet */
 #define CONFIG_SYS_SDRAM_SIZE (SZ_4M + SZ_2M)
 
-/* For early init */
-#define K210_SYSCTL_BASE 0x50440000
-
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "loadaddr=0x80060000\0" \
index b4fbf8c..2983693 100644 (file)
 #define CONFIG_MXC_UART_BASE           UART2_BASE
 
 /* SATA Configs */
-
-#ifdef CONFIG_CMD_SATA
-#define CONFIG_SYS_SATA_MAX_DEVICE     1
-#define CONFIG_DWC_AHSATA_PORT_ID      0
-#define CONFIG_DWC_AHSATA_BASE_ADDR    SATA_ARB_BASE_ADDR
 #define CONFIG_LBA48
-#endif
-
-/* Network support */
-
-#define CONFIG_FEC_MXC
-#define IMX_FEC_BASE                    ENET_BASE_ADDR
-#define CONFIG_FEC_XCV_TYPE             RGMII
-#define CONFIG_ETHPRIME                 "FEC"
-#define CONFIG_FEC_MXC_PHYADDR          6
 
 /* MMC Configuration */
 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
diff --git a/include/dt-bindings/media/tda1997x.h b/include/dt-bindings/media/tda1997x.h
new file mode 100644 (file)
index 0000000..bd9fbd7
--- /dev/null
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2017 Gateworks Corporation
+ */
+#ifndef _DT_BINDINGS_MEDIA_TDA1997X_H
+#define _DT_BINDINGS_MEDIA_TDA1997X_H
+
+/* TDA19973 36bit Video Port control registers */
+#define TDA1997X_VP36_35_32    0
+#define TDA1997X_VP36_31_28    1
+#define TDA1997X_VP36_27_24    2
+#define TDA1997X_VP36_23_20    3
+#define TDA1997X_VP36_19_16    4
+#define TDA1997X_VP36_15_12    5
+#define TDA1997X_VP36_11_08    6
+#define TDA1997X_VP36_07_04    7
+#define TDA1997X_VP36_03_00    8
+
+/* TDA19971 24bit Video Port control registers */
+#define TDA1997X_VP24_V23_20   0
+#define TDA1997X_VP24_V19_16   1
+#define TDA1997X_VP24_V15_12   3
+#define TDA1997X_VP24_V11_08   4
+#define TDA1997X_VP24_V07_04   6
+#define TDA1997X_VP24_V03_00   7
+
+/* Pin groups */
+#define TDA1997X_VP_OUT_EN        0x80 /* enable output group */
+#define TDA1997X_VP_HIZ           0x40 /* hi-Z output group when not used */
+#define TDA1997X_VP_SWP           0x10 /* pin-swap output group */
+#define TDA1997X_R_CR_CBCR_3_0    (0 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_R_CR_CBCR_7_4    (1 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_R_CR_CBCR_11_8   (2 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_B_CB_3_0         (3 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_B_CB_7_4         (4 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_B_CB_11_8        (5 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_G_Y_3_0          (6 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_G_Y_7_4          (7 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+#define TDA1997X_G_Y_11_8         (8 | TDA1997X_VP_OUT_EN | TDA1997X_VP_HIZ)
+/* pinswapped groups */
+#define TDA1997X_R_CR_CBCR_3_0_S  (TDA1997X_R_CR_CBCR_3_0 | TDA1997X_VP_SWAP)
+#define TDA1997X_R_CR_CBCR_7_4_S  (TDA1997X_R_CR_CBCR_7_4 | TDA1997X_VP_SWAP)
+#define TDA1997X_R_CR_CBCR_11_8_S (TDA1997X_R_CR_CBCR_11_8 | TDA1997X_VP_SWAP)
+#define TDA1997X_B_CB_3_0_S       (TDA1997X_B_CB_3_0 | TDA1997X_VP_SWAP)
+#define TDA1997X_B_CB_7_4_S       (TDA1997X_B_CB_7_4 | TDA1997X_VP_SWAP)
+#define TDA1997X_B_CB_11_8_S      (TDA1997X_B_CB_11_8 | TDA1997X_VP_SWAP)
+#define TDA1997X_G_Y_3_0_S        (TDA1997X_G_Y_3_0 | TDA1997X_VP_SWAP)
+#define TDA1997X_G_Y_7_4_S        (TDA1997X_G_Y_7_4 | TDA1997X_VP_SWAP)
+#define TDA1997X_G_Y_11_8_S       (TDA1997X_G_Y_11_8 | TDA1997X_VP_SWAP)
+
+/* Audio bus DAI format */
+#define TDA1997X_I2S16                 1 /* I2S 16bit */
+#define TDA1997X_I2S32                 2 /* I2S 32bit */
+#define TDA1997X_SPDIF                 3 /* SPDIF */
+#define TDA1997X_OBA                   4 /* One Bit Audio */
+#define TDA1997X_DST                   5 /* Direct Stream Transfer */
+#define TDA1997X_I2S16_HBR             6 /* HBR straight in I2S 16bit mode */
+#define TDA1997X_I2S16_HBR_DEMUX       7 /* HBR demux in I2S 16bit mode */
+#define TDA1997X_I2S32_HBR_DEMUX       8 /* HBR demux in I2S 32bit mode */
+#define TDA1997X_SPDIF_HBR_DEMUX       9 /* HBR demux in SPDIF mode */
+
+/* Audio bus channel layout */
+#define TDA1997X_LAYOUT0       0       /* 2-channel */
+#define TDA1997X_LAYOUT1       1       /* 8-channel */
+
+/* Audio bus clock */
+#define TDA1997X_ACLK_16FS     0
+#define TDA1997X_ACLK_32FS     1
+#define TDA1997X_ACLK_64FS     2
+#define TDA1997X_ACLK_128FS    3
+#define TDA1997X_ACLK_256FS    4
+#define TDA1997X_ACLK_512FS    5
+
+#endif /* _DT_BINDINGS_MEDIA_TDA1997X_H */
index 45ed635..b092034 100644 (file)
@@ -39,6 +39,7 @@
 #define VENDORSPEC_HCKEN       0x00001000
 #define VENDORSPEC_IPGEN       0x00000800
 #define VENDORSPEC_INIT                0x20007809
+#define VENDORSPEC_FRC_SDCLK_ON 0x00000100
 
 #define IRQSTAT                        0x0002e030
 #define IRQSTAT_DMAE           (0x10000000)
@@ -96,6 +97,7 @@
 #define PRSSTAT_CINS           (0x00010000)
 #define PRSSTAT_BREN           (0x00000800)
 #define PRSSTAT_BWEN           (0x00000400)
+#define PRSSTAT_SDOFF          (0x00000080)
 #define PRSSTAT_SDSTB          (0X00000008)
 #define PRSSTAT_DLA            (0x00000004)
 #define PRSSTAT_CICHB          (0x00000002)
index 1c6f1eb..c412169 100644 (file)
@@ -3,6 +3,7 @@
  * Common internal memory map for some Freescale SoCs
  *
  * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
  */
 
 #ifndef __FSL_SEC_H
@@ -12,8 +13,8 @@
 #include <asm/io.h>
 
 #ifdef CONFIG_SYS_FSL_SEC_LE
-#define sec_in32(a)       in_le32(a)
-#define sec_out32(a, v)   out_le32(a, v)
+#define sec_in32(a)       in_le32((ulong *)(ulong)a)
+#define sec_out32(a, v)   out_le32((ulong *)(ulong)a, v)
 #define sec_in16(a)       in_le16(a)
 #define sec_clrbits32     clrbits_le32
 #define sec_setbits32     setbits_le32
@@ -27,6 +28,8 @@
 #error Neither CONFIG_SYS_FSL_SEC_LE nor CONFIG_SYS_FSL_SEC_BE is defined
 #endif
 
+#define BLOB_SIZE(x)           ((x) + 32 + 16) /* Blob buffer size */
+
 /* Security Engine Block (MS = Most Sig., LS = Least Sig.) */
 #if CONFIG_SYS_FSL_SEC_COMPAT >= 4
 /* RNG4 TRNG test registers */
@@ -195,7 +198,8 @@ typedef struct ccsr_sec {
 
 struct jr_regs {
 #if defined(CONFIG_SYS_FSL_SEC_LE) && \
-       !(defined(CONFIG_MX6) || defined(CONFIG_MX7))
+       !(defined(CONFIG_MX6) || defined(CONFIG_MX7) || \
+         defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8M))
        u32 irba_l;
        u32 irba_h;
 #else
@@ -209,7 +213,8 @@ struct jr_regs {
        u32 rsvd3;
        u32 irja;
 #if defined(CONFIG_SYS_FSL_SEC_LE) && \
-       !(defined(CONFIG_MX6) || defined(CONFIG_MX7))
+       !(defined(CONFIG_MX6) || defined(CONFIG_MX7) || \
+         defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8M))
        u32 orba_l;
        u32 orba_h;
 #else
@@ -242,7 +247,8 @@ struct jr_regs {
  */
 struct sg_entry {
 #if defined(CONFIG_SYS_FSL_SEC_LE) && \
-       !(defined(CONFIG_MX6) || defined(CONFIG_MX7))
+       !(defined(CONFIG_MX6) || defined(CONFIG_MX7) || \
+         defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8M))
        uint32_t addr_lo;       /* Memory Address - lo */
        uint32_t addr_hi;       /* Memory Address of start of buffer - hi */
 #else
@@ -261,9 +267,8 @@ struct sg_entry {
 #define SG_ENTRY_OFFSET_SHIFT  0
 };
 
-#define BLOB_SIZE(x)           ((x) + 32 + 16) /* Blob buffer size */
-
-#if defined(CONFIG_MX6) || defined(CONFIG_MX7)
+#if defined(CONFIG_MX6) || defined(CONFIG_MX7) || \
+       defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8M)
 /* Job Ring Base Address */
 #define JR_BASE_ADDR(x) (CONFIG_SYS_FSL_SEC_ADDR + 0x1000 * (x + 1))
 /* Secure Memory Offset varies accross versions */
@@ -271,7 +276,8 @@ struct sg_entry {
 #define SM_V2_OFFSET 0xa00
 /*Secure Memory Versioning */
 #define SMVID_V2 0x20105
-#define SM_VERSION(x)  (x < SMVID_V2 ? 1 : 2)
+#define SM_VERSION(x)  ({typeof(x) _x = x; \
+               _x < SMVID_V2 ? 1 : (_x < 0x20300 ? 2 : 3); })
 #define SM_OFFSET(x)  (x == 1 ? SM_V1_OFFSET : SM_V2_OFFSET)
 /* CAAM Job Ring 0 Registers */
 /* Secure Memory Partition Owner register */
@@ -298,8 +304,10 @@ struct sg_entry {
 #define SM_CMD(v)              (v == 1 ? 0x0 : 0x1E4)
 #define SM_STATUS(v)           (v == 1 ? 0x8 : 0x1EC)
 #define SM_PERM(v)             (v == 1 ?  0x10 : 0x4)
-#define SM_GROUP2(v)           (v == 1 ? 0x14 : 0x8)
-#define SM_GROUP1(v)           (v == 1 ? 0x18 : 0xC)
+#define SM_GROUP2(v)           ({typeof(v) _v = v; \
+               _v == 1 ? 0x14 : (_v == 2 ? 0x8 : 0xC); })
+#define SM_GROUP1(v)           ({typeof(v) _v = v; \
+               _v == 1 ? 0x18 : (_v == 2 ? 0xC : 0x8); })
 #define CMD_PAGE_ALLOC         0x1
 #define CMD_PAGE_DEALLOC       0x2
 #define CMD_PART_DEALLOC       0x3
@@ -317,10 +325,15 @@ struct sg_entry {
 #define SEC_MEM_PAGE2          (CAAM_ARB_BASE_ADDR + 0x2000)
 #define SEC_MEM_PAGE3          (CAAM_ARB_BASE_ADDR + 0x3000)
 
-#define JR_MID                 2               /* Matches ROM configuration */
-#define KS_G1                  (1 << JR_MID)   /* CAAM only */
-#define PERM                   0x0000B008      /* Clear on release, lock SMAP
-                                                * lock SMAG group 1 Blob */
+#ifdef CONFIG_IMX8M
+#define JR_MID    (1)         /* Matches ATF configuration */
+#define KS_G1     (0x10000 << JR_MID) /* CAAM only */
+#define PERM      (0xB080)    /* CSP, SMAP_LCK, SMAG_LCK, G1_BLOB */
+#else
+#define JR_MID    (2)         /* Matches ROM configuration */
+#define KS_G1     BIT(JR_MID) /* CAAM only */
+#define PERM      (0xB008)    /* CSP, SMAP_LCK, SMAG_LCK, G1_BLOB */
+#endif /* CONFIG_IMX8M */
 
 /* HAB WRAPPED KEY header */
 #define WRP_HDR_SIZE           0x08
@@ -340,6 +353,13 @@ struct sg_entry {
 
 #endif
 
+#define FSL_CAAM_MP_PUBK_BYTES             64
+#define FSL_CAAM_MP_PRVK_BYTES             32
+#define FSL_CAAM_MP_MES_DGST_BYTES         32
+
+#define FSL_CAAM_ORSR_JRa_OFFSET       0x102c
+#define FSL_CAAM_MAX_JR_SIZE           4
+
 /* blob_dek:
  * Encapsulates the src in a secure blob and stores it dst
  * @src: reference to the plaintext
@@ -349,6 +369,10 @@ struct sg_entry {
  */
 int blob_dek(const u8 *src, u8 *dst, u8 len);
 
+int gen_mppubk(u8 *dst);
+
+int sign_mppubk(const u8 *m, int data_size, u8 *dgst, u8 *c, u8 *d);
+
 #if defined(CONFIG_ARCH_C29X)
 int sec_init_idx(uint8_t);
 #endif
index a35e5a1..e75c3fa 100644 (file)
 /* Hardware reset */
 #define MMC_CAP_HW_RESET                       (1 << 31)
 
-struct mvebu_mmc_cfg {
-       u32     mvebu_mmc_base;
-       u32     mvebu_mmc_clk;
-       u8      max_bus_width;
+struct mvebu_mmc_plat {
+       void *iobase;
        struct mmc_config cfg;
+       struct mmc mmc;
 };
 
-/*
- * Functions prototypes
- */
-
-int mvebu_mmc_init(struct bd_info *bis);
-
 #endif /* __MVEBU_MMC_H__ */
index 5a9a697..27703bb 100644 (file)
@@ -54,6 +54,6 @@ enum {
        PCA9450_REG_NUM,
 };
 
-int power_pca9450_init(unsigned char bus);
+int power_pca9450_init(unsigned char bus, unsigned char addr);
 
 #endif
index b693925..6859d17 100644 (file)
@@ -1076,7 +1076,6 @@ CONFIG_MTD_UBI_GLUEBI
 CONFIG_MTD_UBI_MODULE
 CONFIG_MULTI_CS
 CONFIG_MUSB_HOST
-CONFIG_MVEBU_MMC
 CONFIG_MVGBE_PORTS
 CONFIG_MVMFP_V2
 CONFIG_MVS
@@ -2906,7 +2905,6 @@ CONFIG_SYS_MIPS_TIMER_FREQ
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR
 CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS
 CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR
-CONFIG_SYS_MMC_BASE
 CONFIG_SYS_MMC_CD_PIN
 CONFIG_SYS_MMC_CLK_OD
 CONFIG_SYS_MMC_MAX_BLK_COUNT
index 97c11e3..a30f615 100644 (file)
@@ -7,6 +7,7 @@ obj-$(CONFIG_EFI_LOADER) += efi_device_path.o
 obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o
 obj-y += hexdump.o
 obj-y += lmb.o
+obj-y += longjmp.o
 obj-$(CONFIG_CONSOLE_RECORD) += test_print.o
 obj-$(CONFIG_SSCANF) += sscanf.o
 obj-y += string.o
diff --git a/test/lib/longjmp.c b/test/lib/longjmp.c
new file mode 100644 (file)
index 0000000..201367a
--- /dev/null
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test setjmp(), longjmp()
+ *
+ * Copyright (c) 2021, Heinrich Schuchardt <xypron.glpk@gmx.de>
+ */
+
+#include <common.h>
+#include <test/lib.h>
+#include <test/test.h>
+#include <test/ut.h>
+#include <asm/setjmp.h>
+
+struct test_jmp_buf {
+       jmp_buf env;
+       int val;
+};
+
+/**
+ * test_longjmp() - test longjmp function
+ *
+ * @i is passed to longjmp.
+ * @i << 8 is set in the environment structure.
+ *
+ * @env:       environment
+ * @i:         value passed to longjmp()
+ */
+static noinline void test_longjmp(struct test_jmp_buf *env, int i)
+{
+       env->val = i << 8;
+       longjmp(env->env, i);
+}
+
+/**
+ * test_setjmp() - test setjmp function
+ *
+ * setjmp() will return the value @i passed to longjmp() if @i is non-zero.
+ * For @i == 0 we expect return value 1.
+ *
+ * @i << 8 will be set by test_longjmp in the environment structure.
+ * This value can be used to check that the stack frame is restored.
+ *
+ * We return the XORed values to allow simply check both at once.
+ *
+ * @i:         value passed to longjmp()
+ * Return:     values return by longjmp()
+ */
+static int test_setjmp(int i)
+{
+       struct test_jmp_buf env;
+       int ret;
+
+       env.val = -1;
+       ret = setjmp(env.env);
+       if (ret)
+               return ret ^ env.val;
+       test_longjmp(&env, i);
+       /* We should not arrive here */
+       return 0x1000;
+}
+
+static int lib_test_longjmp(struct unit_test_state *uts)
+{
+       int i;
+
+       for (i = -3; i < 0; ++i)
+               ut_asserteq(i ^ (i << 8), test_setjmp(i));
+       ut_asserteq(1, test_setjmp(0));
+       for (i = 1; i < 4; ++i)
+               ut_asserteq(i ^ (i << 8), test_setjmp(i));
+       return 0;
+}
+LIB_TEST(lib_test_longjmp, 0);
index 133780f..fa8f227 100644 (file)
@@ -365,7 +365,7 @@ static void copy_file (int ifd, const char *datafile, int pad, int offset)
        struct stat sbuf;
        unsigned char *ptr;
        int tail;
-       int zero = 0;
+       uint64_t zero = 0;
        uint8_t zeros[4096];
        int size, ret;
 
index 9985b95..11e40cc 100644 (file)
@@ -248,7 +248,7 @@ static void copy_file(int ifd, const char *datafile, int pad, int offset,
        struct stat sbuf;
        unsigned char *ptr;
        int tail;
-       int zero = 0;
+       uint64_t zero = 0;
        uint8_t zeros[4096];
        int size, ret;
 
old mode 100755 (executable)
new mode 100644 (file)