imx: add i.MX8M support and i.MX8MQ EVK
Subsystems (12)
PATCH v5 31/31 imx: add i.MX8MQ EVK support
In reply to Stefano BabicQuoted 643 lines · Stefano Babic
Hi Peng,
Quoted 24 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
The boot log with Arm trusted firmware console enabled:
"
U-Boot SPL 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56)
PMIC: PFUZE100 ID=0x10
Normal Boot
Trying to boot from MMC2NOTICE: Configureing TZASC380 NOTICE: BL31: v1.4(release):o8.0.0_1.3.0_8m-prc-20171211-6-g54fb0797-dirty NOTICE: BL31: Built : 07:17:16, Jan 8 2018 NOTICE: sip svc initU-Boot 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56 +0800)
CPU: Freescale i.MX8MQ rev2.0 at 1000 MHz Reset cause: POR Model: Freescale i.MX8MQ EVK DRAM: 3 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1Using default environment
Quoted 7 lines
In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0u-boot=>
"If I see the output here, I am expecting the setup forthe working peripherals. Without ethernet working, why do we activate FEC and set the PHY ?
I would suggest to start with the minimal (=that is, all that is working), adding later when peripherals will be successfully added and tested.
Quoted 559 lines
Signed-off-by Peng Fan <[email protected]>Cc Fabio Estevam <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/include/asm/arch-mx8m/ddr.h | 9 + arch/arm/mach-imx/mx8m/Kconfig | 12 + board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + include/configs/mx8mq_evk.h | 269 ++++++ 14 files changed, 2819 insertions(+) create mode 100644 arch/arm/dts/fsl-imx8mq-evk.dts create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.harch/arm/dts/Makefile +2
-0@@ -391,6 +391,8 @@ dtb-$(CONFIG_MX7) += imx7-colibri.dtb \ dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb +dtb-$(CONFIG_ARCH_MX8M) += fsl-imx8mq-evk.dtb + dtb-$(CONFIG_RCAR_GEN3) += \ r8a7795-h3ulcb.dtb \ r8a7795-salvator-x.dtb \arch/arm/dts/fsl-imx8mq-evk.dts new file +424
-0@@ -0,0 +1,424 @@ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +/* First 128KB is for PSCI ATF. */ +/memreserve/ 0x40000000 0x00020000; + +#include "fsl-imx8mq.dtsi" + +/ { + model = "Freescale i.MX8MQ EVK"; + compatible = "fsl,imx8mq-evk", "fsl,imx8mq"; + + chosen { + bootargs = "console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200"; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + reg_usdhc2_vmmc: usdhc2_vmmc { + compatible = "regulator-fixed"; + regulator-name = "VSD_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + + ledpwm2 { + label = "PWM2"; + pwms = <&pwm2 0 50000>; + max-brightness = <255>; + }; + }; +}; + +&iomuxc { + pinctrl-names = "default"; + + imx8mq-evk { + pinctrl_fec1: fec1grp { + fsl,pins = < + MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC 0x3 + MX8MQ_IOMUXC_ENET_MDIO_ENET1_MDIO 0x23 + MX8MQ_IOMUXC_ENET_TD3_ENET1_RGMII_TD3 0x1f + MX8MQ_IOMUXC_ENET_TD2_ENET1_RGMII_TD2 0x1f + MX8MQ_IOMUXC_ENET_TD1_ENET1_RGMII_TD1 0x1f + MX8MQ_IOMUXC_ENET_TD0_ENET1_RGMII_TD0 0x1f + MX8MQ_IOMUXC_ENET_RD3_ENET1_RGMII_RD3 0x91 + MX8MQ_IOMUXC_ENET_RD2_ENET1_RGMII_RD2 0x91 + MX8MQ_IOMUXC_ENET_RD1_ENET1_RGMII_RD1 0x91 + MX8MQ_IOMUXC_ENET_RD0_ENET1_RGMII_RD0 0x91 + MX8MQ_IOMUXC_ENET_TXC_ENET1_RGMII_TXC 0x1f + MX8MQ_IOMUXC_ENET_RXC_ENET1_RGMII_RXC 0x91 + MX8MQ_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL 0x91 + MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL 0x1f + MX8MQ_IOMUXC_GPIO1_IO09_GPIO1_IO9 0x19 + >; + }; + + pinctrl_i2c1: i2c1grp { + fsl,pins = < + MX8MQ_IOMUXC_I2C1_SCL_I2C1_SCL 0x4000007f + MX8MQ_IOMUXC_I2C1_SDA_I2C1_SDA 0x4000007f + >; + }; + + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX8MQ_IOMUXC_I2C2_SCL_I2C2_SCL 0x4000007f + MX8MQ_IOMUXC_I2C2_SDA_I2C2_SDA 0x4000007f + >; + }; + + pinctrl_pwm2: pwm2grp { + fsl,pins = < + MX8MQ_IOMUXC_GPIO1_IO13_PWM2_OUT 0x16 + >; + }; + + pinctrl_qspi: qspigrp { + fsl,pins = < + MX8MQ_IOMUXC_NAND_ALE_QSPI_A_SCLK 0x82 + MX8MQ_IOMUXC_NAND_CE0_B_QSPI_A_SS0_B 0x82 + MX8MQ_IOMUXC_NAND_DATA00_QSPI_A_DATA0 0x82 + MX8MQ_IOMUXC_NAND_DATA01_QSPI_A_DATA1 0x82 + MX8MQ_IOMUXC_NAND_DATA02_QSPI_A_DATA2 0x82 + MX8MQ_IOMUXC_NAND_DATA03_QSPI_A_DATA3 0x82 + + >; + }; + + pinctrl_usdhc1: usdhc1grp { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x83 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc3 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc3 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc3 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc3 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc3 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc3 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc3 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc3 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc3 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x83 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc1_100mhz: usdhc1grp100mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x85 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc5 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc5 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc5 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc5 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc5 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc5 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc5 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc5 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc5 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x85 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc1_200mhz: usdhc1grp200mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x87 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc7 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc7 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc7 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc7 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc7 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc7 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc7 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc7 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc7 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x87 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc2_gpio: usdhc2grpgpio { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12 0x41 + MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19 0x41 + >; + }; + + pinctrl_usdhc2: usdhc2grp { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x83 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc3 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc3 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc3 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc3 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc3 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_usdhc2_100mhz: usdhc2grp100mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x85 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc5 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc5 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc5 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc5 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc5 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_usdhc2_200mhz: usdhc2grp200mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x87 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc7 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc7 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc7 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc7 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc7 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_sai2: sai2grp { + fsl,pins = < + MX8MQ_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC 0xd6 + MX8MQ_IOMUXC_SAI2_TXC_SAI2_TX_BCLK 0xd6 + MX8MQ_IOMUXC_SAI2_MCLK_SAI2_MCLK 0xd6 + MX8MQ_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 0xd6 + MX8MQ_IOMUXC_GPIO1_IO08_GPIO1_IO8 0xd6 + >; + }; + + pinctrl_wdog: wdoggrp { + fsl,pins = < + MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6 + >; + }; + }; +}; + +&fec1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_fec1>; + phy-mode = "rgmii-id"; + phy-handle = <ðphy0>; + fsl,magic-packet; + status = "okay"; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethphy0: ethernet-phy at 0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + at803x,led-act-blind-workaround; + at803x,eee-disabled; + }; + }; +}; + +&i2c1 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + pmic: pfuze100 at 08 { + compatible = "fsl,pfuze100"; + reg = <0x08>; + + regulators { + sw1a_reg: sw1ab { + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1875000>; + regulator-always-on; + }; + + sw1c_reg: sw1c { + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1875000>; + regulator-always-on; + }; + + sw2_reg: sw2 { + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + sw3a_reg: sw3ab { + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <1975000>; + regulator-always-on; + }; + + sw4_reg: sw4 { + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + swbst_reg: swbst { + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5150000>; + }; + + snvs_reg: vsnvs { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + }; + + vref_reg: vrefddr { + 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>; + regulator-always-on; + }; + + vgen3_reg: vgen3 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + 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>; + }; + }; + }; +}; + +&i2c2 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c2>; + status = "disabled"; +}; + +&pwm2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pwm2>; + status = "okay"; +}; + +&lcdif { + status = "okay"; + disp-dev = "mipi_dsi_northwest"; + display = <&display0>; + + display0: display at 0 { + bits-per-pixel = <24>; + bus-width = <24>; + + display-timings { + native-mode = <&timing0>; + timing0: timing0 { + clock-frequency = <9200000>; + hactive = <480>; + vactive = <272>; + hfront-porch = <8>; + hback-porch = <4>; + hsync-len = <41>; + vback-porch = <2>; + vfront-porch = <4>; + vsync-len = <10>; + + hsync-active = <0>; + vsync-active = <0>; + de-active = <1>; + pixelclk-active = <0>; + }; + }; + }; +}; + +&qspi { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_qspi>; + status = "okay"; + + flash0: n25q256a at 0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + compatible = "micron,n25q256a"; + spi-max-frequency = <29000000>; + spi-nor,ddr-quad-read-dummy = <6>; + }; +}; + +&usdhc1 { + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc1>; + pinctrl-1 = <&pinctrl_usdhc1_100mhz>; + pinctrl-2 = <&pinctrl_usdhc1_200mhz>; + bus-width = <8>; + non-removable; + status = "okay"; +}; + +&usdhc2 { + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; + pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; + pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; + bus-width = <4>; + cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; + vmmc-supply = <®_usdhc2_vmmc>; + status = "okay"; +}; + +&wdog1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_wdog>; + fsl,ext-reset-output; + status = "okay"; +};arch/arm/include/asm/arch-mx8m/ddr.h +9
-0@@ -353,4 +353,13 @@ enum msg_response { TRAIN_FAIL = 0xff, }; +enum fw_type { +FW_1D_IMAGE , +FW_2D_IMAGE , +}; + +void ddr_init (void ); +void ddr_load_train_code (enum fw_type type); +void lpddr4_800M_cfg_phy (void ); +void dram_pll_init (void );#endif arch/arm/mach-imx/mx8m/Kconfig +12
-0@@ -7,4 +7,16 @@ config MX8M config SYS_SOC default "mx8m" +choice + prompt "NXP i.MX8M board select" + optional + +config TARGET_MX8MQ_EVK + bool "mx8mq_evk" + select MX8M + +endchoice + +source "board/freescale/mx8mq_evk/Kconfig" + endifboard/freescale/mx8mq_evk/Kconfig new file +12
-0@@ -0,0 +1,12 @@ +if TARGET_MX8MQ_EVK + +config SYS_BOARD + default "mx8mq_evk" + +config SYS_VENDOR + default "freescale" + +config SYS_CONFIG_NAME + default "mx8mq_evk" + +endifboard/freescale/mx8mq_evk/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright 2017 NXP +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += mx8mq_evk.o + +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +obj-y += ddr/ddr_init.o ddr/ddrphy_train.o ddr/helper.o +endifboard/freescale/mx8mq_evk/README new file +3
-0@@ -0,0 +1,47 @@ +U-Boot for the NXP i.MX8MQ EVK board + +Quick Startboard/freescale/mx8mq_evk/README line 13
Quoted 10 lines
board/freescale/mx8mq_evk/README new file +10
-0+==================== +- Build the ARM Trusted firmware binary +- Build U-Boot +- Get ddr fimware and tools +- Generate flash.bin using imx-mkimage +- Boot + +Get and Build the ARM Trusted firmware +==================== +Get ATF from: https://source.codeaurora.org/external/imx/imx-atfThis is currently not enough - master is empty, which branch should be selected ?
Is this maintainable ?I am asking why this is coming from here and not from an official source, like :
Quoted 5 lines
board/freescale/mx8mq_evk/README new file +5
-0+$ make PLAT=imx8mq bl31 + +Build U-Boot +==================== +$ export ARCH=arm64board/freescale/mx8mq_evk/README line 28
Quoted 10 lines
board/freescale/mx8mq_evk/README new file +10
-0+$ export CROSS_COMPILE=aarch64-poky-linux- +$ make mx8mq_evk_defconfig +$ make + +Get the ddr firmware and tools +==================== +Note: Better to use NXP released yocto to get the firmware in case + there is new releases. +https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.2.bin +imx-mkimage: https://source.codeaurora.org/external/imx/imx-mkimage/I am just asking which is the plan here. This is a fork of U-Boot's mkimage tool. I did not see attempts to push changes to imximage mainline.
Quoted 3 lines
Any thoughts ? This means that it is not possible inside U-Boot to produce a U-Boot image, but we need an external tool that was *based* on U-Boot code....
I'll try to develop the support in u-boot, but I could not commit. The new format is a bit complicated.
Quoted 3 lines
I have not understood the usage of firmware-imx-7.2.bin. You ask to load it, but it is not used in further commands.
My bad. Diego's patch has that.
Quoted 68 lines
board/freescale/mx8mq_evk/README line 36
Quoted 9 lines
board/freescale/mx8mq_evk/README new file +8
-0+ +Generate flash.bin using imx-mkimage +==================== +Copy bl31.bin u-boot-nodtb.bin u-boot-spl.bin fsl-imx8mq-evk.dtb to + imx-mkimage/iMX8M +Copy lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_1d_imem.bin + lpddr4_pmu_train_2d_dmem.bin lpddr4_pmu_train_2d_imem.bin to + imx-mkimage/iMX8MWhere are coming the DDR binary files ?
Quoted 41 lines
board/freescale/mx8mq_evk/README new file +11
-0+If you want to run with HDMI, copy signed_hdmi_imx8m.bin to imx-mkimage/iMX8M + +make SOC=iMX8M flash_hdmi_spl_uboot or make SOC=iMX8M flash_spl_uboot to +generate flash.bin. + +Burn the flash.bin to MicroSD card offset 33KB +$sudo dd if=iMX8M/flash.bin of=/dev/sd[x] bs=1024 seek=33 + +Boot +==================== +Set Boot switch SW801: 1100 and Bmode: 10 to boot from Micro SD.board/freescale/mx8mq_evk/ddr/ddr_init.c new file +24
-0@@ -0,0 +1,246 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/ddr.h> +#include <asm/arch/sys_proto.h> +#include <linux/iopoll.h> + +struct imx8m_ddrc_regs *ddrc_regs = (struct imx8m_ddrc_regs *)DDRC_IPS_BASE_ADDR (0 ); +static struct gpc_reg *gpc_reg = (struct gpc_reg *)GPC_BASE_ADDR ; +static struct src *src = (struct src *)SRC_BASE_ADDR ; + +void lpddr4_800mhz_cfg_umctl2 (void ) +{ +writel (0x00000001 , &ddrc_regs->dbg1); +writel (0x00000001 , &ddrc_regs->pwrctl); +writel (0x83080020 , &ddrc_regs->mstr); +writel (0x006180e0 , &ddrc_regs->rfshtmg);board/freescale/mx8mq_evk/ddr/ddr_init.c line 34
Quoted 10 lines
board/freescale/mx8mq_evk/ddr/ddr_init.c new file +10
-0+writel (0xc003061b , &ddrc_regs->init0); +writel (0x009d0000 , &ddrc_regs->init1); +writel (0x0000fe05 , &ddrc_regs->init2); +writel (0x00d4002d , &ddrc_regs->init3); +writel (0x00310008 , &ddrc_regs->init4); +writel (0x00040009 , &ddrc_regs->init5); +writel (0x0046004d , &ddrc_regs->init6); +writel (0x0005004d , &ddrc_regs->init7); +writel (0x00000979 , &ddrc_regs->rankctl); +writel (0x1a203522 , &ddrc_regs->dramtmg0);I guess we will not have any improvement here, at least for first version. I cannot say this is optimal, because it becomes difficult to add further MX8M targets.
Quoted 8 lines
Just an example: dramtmgX contain timings, and they are computed from the RAM chip (tRAS, and so on).
The best way (and I hope, this will go on sometimes..) should be to add a table for the chosen RAM chip and registers are then computed.
It will be even ok if there is a
tool(I guess, you or the DDR-team is using such as tool)to derive registers value from chip datasheet.
I'll try to improve them and see if the code could be moved to drivers/ddr/
Quoted 333 lines
Fabio, what do you think about this ?
Quoted 223 lines
board/freescale/mx8mq_evk/ddr/ddr_init.c new file +211
-0+writel (0x00060630 , &ddrc_regs->dramtmg1); +writel (0x070e1214 , &ddrc_regs->dramtmg2); +writel (0x00b0c006 , &ddrc_regs->dramtmg3); +writel (0x0f04080f , &ddrc_regs->dramtmg4); +writel (0x0d0d0c0c , &ddrc_regs->dramtmg5); +writel (0x01010007 , &ddrc_regs->dramtmg6); +writel (0x0000060a , &ddrc_regs->dramtmg7); +writel (0x01010101 , &ddrc_regs->dramtmg8); +writel (0x40000008 , &ddrc_regs->dramtmg9); +writel (0x00050d01 , &ddrc_regs->dramtmg10); +writel (0x01010008 , &ddrc_regs->dramtmg11); +writel (0x00020000 , &ddrc_regs->dramtmg12); +writel (0x18100002 , &ddrc_regs->dramtmg13); +writel (0x00000dc2 , &ddrc_regs->dramtmg14); +writel (0x80000000 , &ddrc_regs->dramtmg15); +writel (0x00a00050 , &ddrc_regs->dramtmg17); +writel (0x53200018 , &ddrc_regs->zqctl0); +writel (0x02800070 , &ddrc_regs->zqctl1); +writel (0x00000000 , &ddrc_regs->zqctl2); +writel (0x0397820a , &ddrc_regs->dfitmg0); +writel (0x0397820a , &ddrc_regs->freq1.dfitmg0); +writel (0x0397820a , &ddrc_regs->freq2.dfitmg0); +writel (0x00020103 , &ddrc_regs->dfitmg1); +writel (0xe0400018 , &ddrc_regs->dfiupd0); +writel (0x00df00e4 , &ddrc_regs->dfiupd1); +writel (0x00000000 , &ddrc_regs->dfiupd2); +writel (0x00000011 , &ddrc_regs->dfimisc); +writel (0x0000170a , &ddrc_regs->dfitmg2); +writel (0x00000001 , &ddrc_regs->dbictl); +writel (0x00000000 , &ddrc_regs->dfiphymstr); +/* Address map is from MSB 29: r15, r14, cs, r13-r0, b2-b0, c9-c0 */ +writel (0x00000015 , &ddrc_regs->addrmap0); +writel (0x00001f1f , &ddrc_regs->addrmap4); +/* bank interleave */ +writel (0x00080808 , &ddrc_regs->addrmap1); +writel (0x07070707 , &ddrc_regs->addrmap5); +writel (0x08080707 , &ddrc_regs->addrmap6); +writel (0x020f0c54 , &ddrc_regs->odtcfg); +writel (0x00000000 , &ddrc_regs->odtmap); +writel (0x00000001 , &ddrc_regs->pcfg[0 ].pctrl); + +/* performance setting */ +writel (0x0b060908 , &ddrc_regs->odtcfg); +writel (0x00000000 , &ddrc_regs->odtmap); +writel (0x29511505 , &ddrc_regs->sched); +writel (0x0000002c , &ddrc_regs->sched1); +writel (0x5900575b , &ddrc_regs->perfhpr1); +writel (0x900093e7 , &ddrc_regs->perflpr1); +writel (0x02005574 , &ddrc_regs->perfwr1); +writel (0x00000016 , &ddrc_regs->dbg0); +writel (0x00000000 , &ddrc_regs->dbg1); +writel (0x00000000 , &ddrc_regs->dbgcmd); +writel (0x00000001 , &ddrc_regs->swctl); +writel (0x00000011 , &ddrc_regs->poisoncfg); +writel (0x00000111 , &ddrc_regs->pccfg); +writel (0x000010f3 , &ddrc_regs->pcfg[0 ].pcfgr); +writel (0x000072ff , &ddrc_regs->pcfg[0 ].pcfgw); +writel (0x00000001 , &ddrc_regs->pcfg[0 ].pctrl); +writel (0x01110d00 , &ddrc_regs->pcfg[0 ].pcfgqos0); +writel (0x00620790 , &ddrc_regs->pcfg[0 ].pcfgqos1); +writel (0x00100001 , &ddrc_regs->pcfg[0 ].pcfgwqos0); +writel (0x0000041f , &ddrc_regs->pcfg[0 ].pcfgwqos1); +writel (0x00000202 , &ddrc_regs->freq1.derateen); +writel (0xec78f4b5 , &ddrc_regs->freq1.derateint); +writel (0x00618040 , &ddrc_regs->freq1.rfshctl0); +writel (0x00610090 , &ddrc_regs->freq1.rfshtmg); +} + +void lpddr4_100mhz_cfg_umctl2 (void ) +{ +writel (0x0d0b010c , &ddrc_regs->freq1.dramtmg0); +writel (0x00030410 , &ddrc_regs->freq1.dramtmg1); +writel (0x0305090c , &ddrc_regs->freq1.dramtmg2); +writel (0x00505006 , &ddrc_regs->freq1.dramtmg3); +writel (0x05040305 , &ddrc_regs->freq1.dramtmg4); +writel (0x0d0e0504 , &ddrc_regs->freq1.dramtmg5); +writel (0x0a060004 , &ddrc_regs->freq1.dramtmg6); +writel (0x0000090e , &ddrc_regs->freq1.dramtmg7); +writel (0x00000032 , &ddrc_regs->freq1.dramtmg14); +writel (0x00000000 , &ddrc_regs->freq1.dramtmg15); +writel (0x0036001b , &ddrc_regs->freq1.dramtmg17); +writel (0x7e9fbeb1 , &ddrc_regs->freq1.derateint); +writel (0x0020d040 , &ddrc_regs->freq1.rfshctl0); +writel (0x03818200 , &ddrc_regs->freq1.dfitmg0); +writel (0x0a1a096c , &ddrc_regs->freq1.odtcfg); +writel (0x00000000 , &ddrc_regs->freq1.dfitmg2); +writel (0x00038014 , &ddrc_regs->freq1.rfshtmg); +writel (0x00840000 , &ddrc_regs->freq1.init3); +writel (0x0000004d , &ddrc_regs->freq1.init6); +writel (0x0000004d , &ddrc_regs->freq1.init7); +writel (0x00310000 , &ddrc_regs->freq1.init4); +} + +void lpddr4_25mhz_cfg_umctl2 (void ) +{ +writel (0x0d0b010c , &ddrc_regs->freq2.dramtmg0); +writel (0x00030410 , &ddrc_regs->freq2.dramtmg1); +writel (0x0305090c , &ddrc_regs->freq2.dramtmg2); +writel (0x00505006 , &ddrc_regs->freq2.dramtmg3); +writel (0x05040305 , &ddrc_regs->freq2.dramtmg4); +writel (0x0d0e0504 , &ddrc_regs->freq2.dramtmg5); +writel (0x0a060004 , &ddrc_regs->freq2.dramtmg6); +writel (0x0000090e , &ddrc_regs->freq2.dramtmg7); +writel (0x00000032 , &ddrc_regs->freq2.dramtmg14); +writel (0x00000000 , &ddrc_regs->freq2.dramtmg15); +writel (0x0036001b , &ddrc_regs->freq2.dramtmg17); +writel (0x7e9fbeb1 , &ddrc_regs->freq2.derateint); +writel (0x0020d040 , &ddrc_regs->freq2.rfshctl0); +writel (0x03818200 , &ddrc_regs->freq2.dfitmg0); +writel (0x0a1a096c , &ddrc_regs->freq2.odtcfg); +writel (0x00000000 , &ddrc_regs->freq2.dfitmg2); +writel (0x0003800c , &ddrc_regs->freq2.rfshtmg); +writel (0x00840000 , &ddrc_regs->freq2.init3); +writel (0x0000004d , &ddrc_regs->freq2.init6); +writel (0x0000004d , &ddrc_regs->freq2.init7); +writel (0x00310000 , &ddrc_regs->freq2.init4); +} + +void ddr_init (void ) +{ +int ret; +u32 val; + +/* change the clock source of dram_apb_clk_root */ +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (4 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV4 )); + +/* disable the clock gating */ +writel (0xFFFF , &gpc_reg->pgc_cpu_0_1_mapping); +setbits_le32 (&gpc_reg->pu_pgc_up_trg,BIT (5 )); + +writel (SRC_DDR2_ENABLE_MASK , &src->ddr2_rcr); + +dram_pll_init (); + +writel (SRC_DDR1_ENABLE_MASK |SRC_DDR1_RCR_PHY_RESET_MASK | +SRC_DDR1_RCR_CORE_RESET_N_MASK , &src->ddr1_rcr); + +/* Configure uMCTL2's registers */ +lpddr4_800mhz_cfg_umctl2 (); + +writel (SRC_DDR1_ENABLE_MASK |SRC_DDR1_RCR_PHY_RESET_MASK , + &src->ddr1_rcr); +writel (SRC_DDR1_ENABLE_MASK , &src->ddr1_rcr); + +writel (0x00000000 , &ddrc_regs->dbg1); +writel (0x000000a8 , &ddrc_regs->pwrctl); +/* writel(0x0000018a, DDRC_PWRCTL(0), )*/ +writel (0x00000000 , &ddrc_regs->swctl); +writel (0x01 ,DDRC_DDR_SS_GPR0 ); +writel (0x00000010 , &ddrc_regs->dfimisc); + +/* Configure LPDDR4 PHY's registers */ +lpddr4_800M_cfg_phy (); + +writel (0x00000000 , &ddrc_regs->rfshctl3); +writel (0x0000 , &ddrc_regs->swctl); +/* +* ------------------- 9 ------------------- +* Set DFIMISC.dfi_init_start to 1 +* ----------------------------------------- +*/ +writel (0x00000030 , &ddrc_regs->dfimisc); +writel (0x0001 , &ddrc_regs->swctl); + +/* wait DFISTAT.dfi_init_complete to 1 */ + ret =readl_poll_timeout (&ddrc_regs->dfistat, val, val &BIT (0 ),1000 ); +if (ret) +puts ("DFISTAT.dfi_init_complete timeout\n" ); + +writel (0x0000 , &ddrc_regs->swctl); + +/* clear DFIMISC.dfi_init_complete_en */ +writel (0x00000010 , &ddrc_regs->dfimisc); +writel (0x00000011 , &ddrc_regs->dfimisc); +writel (0x00000088 , &ddrc_regs->pwrctl); + +/* +* set SWCTL.sw_done to enable quasi-dynamic register +* programming outside reset. +*/ +writel (0x00000001 , &ddrc_regs->swctl); + +/* wait SWSTAT.sw_done_ack to 1 */ + ret =readl_poll_timeout (&ddrc_regs->swstat, val, val &BIT (0 ),1000 ); +if (ret) +puts ("SWSTAT.sw_done timeout\n" ); + +/* wait STAT.operating_mode([1:0] for ddr3) to normal state */ + ret =readl_poll_timeout (&ddrc_regs->stat, val, (val &0x3 ) ==1 ,1000 ); +if (ret) +puts ("STAT.operating_mode timeout\n" ); + +writel (0x00000088 , &ddrc_regs->pwrctl); + +/* enable port 0 */ +writel (0x00000001 , &ddrc_regs->pcfg[0 ].pctrl); +writel (0x00000000 , &ddrc_regs->rfshctl3); + +writel (0x0 , &ddrc_regs->swctl); +lpddr4_100mhz_cfg_umctl2 (); +lpddr4_25mhz_cfg_umctl2 (); +writel (0x1 , &ddrc_regs->swctl); +> + /* wait SWSTAT.sw_done_ack to 1 */ + ret =readl_poll_timeout (&ddrc_regs->swstat, val, val &BIT (0 ),1000 ); +if (ret) +puts ("SWSTAT.sw_done timeout\n" ); + +writel (0x0 , &ddrc_regs->swctl); +}board/freescale/mx8mq_evk/ddr/ddrphy_train.c new file +6
-0@@ -0,0 +1,1272 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +board/freescale/mx8mq_evk/ddr/ddrphy_train.c line 16
Quoted 10 lines
board/freescale/mx8mq_evk/ddr/ddrphy_train.c new file +10
-0+#include <common.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/ddr.h> +#include <asm/arch/sys_proto.h> +#include <linux/iopoll.h> + +static struct ccm_reg *ccm_reg = (struct ccm_reg *)CCM_BASE_ADDR ; +static struct imx8m_ddrphy_regs *regs = (struct imx8m_ddrphy_regs *)IP2APB_DDRPHY_IPS_BASE_ADDR (0 ); +static struct gpc_reg *gpc_reg = (struct gpc_reg *)GPC_BASE_ADDR ;It is uncommon to have these as global (for a module) in U-Boot.
Quoted 94 lines
board/freescale/mx8mq_evk/ddr/ddrphy_train.c new file +94
-0+ +static inline void poll_pmu_message_ready (void ) +{ +int ret; +u32 val; + +/* +* When BIT0 set to 0, the PMU has a message for the user +* 10ms seems not enough for poll message, so use 1s here. +*/ + ret =readl_poll_timeout (®s->reg[0xd0004 ], val, + !(val &BIT (0 )),1000000 ); +if (ret) +puts ("PMU message timeout\n" ); +} + +static inline void ack_pmu_message_receive (void ) +{ +int ret; +u32 val; +/* +* By setting this register to 0, the user acknowledges the +* receipt of the message. +*/ +writel (0x0 , ®s->reg[0xd0031 ]); + +/* When BIT0 set to 0, the PMU has a message for the user*/ + ret =readl_poll_timeout (®s->reg[0xd0004 ], val, val &BIT (0 ),1000 ); +if (ret) +printf ("%s timeout\n" , __func__); + +writel (0x1 , ®s->reg[0xd0031 ]); +} + +static inline unsigned int get_mail (void ) +{ +unsigned int reg; + +poll_pmu_message_ready (); + +/* Get the major message ID */ + reg =readl (®s->reg[0xd0032 ]); + +ack_pmu_message_receive (); + +return reg; +} + +static inline unsigned int get_stream_message (void ) +{ +unsigned int reg, reg2; + +poll_pmu_message_ready (); + + reg =readl (®s->reg[0xd0032 ]); + reg2 =readl (®s->reg[0xd0034 ]); + reg2 = (reg2 <<16 ) | reg; + +ack_pmu_message_receive (); + +return reg2; +} + +static inline void decode_major_message (unsigned int mail) +{ +debug ("[PMU Major message = 0x%08x]\n" , mail); +} + +static inline void decode_streaming_message (void ) +{ +unsigned int string_index, arg__maybe_unused ; +int i =0 ; + + string_index =get_stream_message (); +debug (" PMU String index = 0x%08x\n" , string_index); +while (i < (string_index &0xffff )) { + arg =get_stream_message (); +debug (" arg[%d] = 0x%08x\n" , i, arg); + i++; + } + +debug ("\n" ); +} + +static void wait_ddrphy_training_complete (void ) +{ +unsigned int mail; + +while (true) { + mail =get_mail (); +decode_major_message (mail); +if (mail ==TRAIN_STREAM_START ) { +decode_streaming_message (); + }else if (mail ==TRAIN_SUCCESS ) {
Quoted 8 lines
board/freescale/mx8mq_evk/ddr/ddrphy_train.c line 116
Quoted 6 lines
board/freescale/mx8mq_evk/ddr/ddrphy_train.c new file +6
-0+debug ("Training PASS\n" ); +break ; + }else if (mail ==TRAIN_FAIL ) { +printf ("Training FAILED\n" ); +break ; + }Is it not possible that code remains in loop forever ?
If training not finished, ddr will not be stable. I not have number how much time it will consume here.
Quoted 1,993 lines
Quoted 1,147 lines
board/freescale/mx8mq_evk/ddr/ddrphy_train.c new file +1146
-0+ } +} + +static void ddr_pll_bypass_100mts (void ) +{ +/* change the clock source of dram_alt_clk_root to source 2 --100MHZ */ +clock_set_target_val (DRAM_ALT_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (2 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 )); + +/* change the clock source of dram_apb_clk_root to source 2 --40MHZ */ +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (2 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV2 )); + +/* disable the clock gating */ +writel (0xFFFF , &gpc_reg->pgc_cpu_0_1_mapping); +/* configure ddr1_sw_pup_req */ +setbits_le32 (&gpc_reg->pu_pgc_up_trg,BIT (5 )); + +/* configure pll bypass mode */ +writel (BIT (24 ), &ccm_reg->dram_sel.target_root_set); + +debug ("PLL bypass to 100MTS setting done\n" ); +} + +static void ddr_pll_bypass_400mts (void ) +{ +/* change the clock source of dram_alt_clk_root to source 2 --400MHZ */ +clock_set_target_val (DRAM_ALT_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (5 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 )); + +/* change the clock source of dram_apb_clk_root to source 2 --40MHZ/2 */ +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (2 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV2 )); + +/* disable the clock gating */ +writel (0xFFFF , &gpc_reg->pgc_cpu_0_1_mapping); +/* configure ddr1_sw_pup_req */ +setbits_le32 (&gpc_reg->pu_pgc_up_trg,BIT (5 )); + +/* configure pll bypass mode */ +writel (BIT (24 ), &ccm_reg->dram_sel.target_root_set); + +debug ("PLL bypass to 400MTS setting done\n" ); +} + +static void dwc_ddrphy_phyinit_usercustom_e_setdficlk (enum pstate state) +{ +if (state ==PS2 ) { +ddr_pll_bypass_100mts (); + }else if (state ==PS1 ) { +ddr_pll_bypass_400mts (); + }else { +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (4 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV4 )); +writel (BIT (24 ), &ccm_reg->dram_sel.target_root_set); + } +} + +void lpddr4_800M_cfg_phy (void ) +{ +int ret; +u32 val; + +writel (0x02 , ®s->reg[0x20110 ]); +writel (0x03 , ®s->reg[0x20111 ]); +writel (0x04 , ®s->reg[0x20112 ]); +writel (0x05 , ®s->reg[0x20113 ]); +writel (0x00 , ®s->reg[0x20114 ]); +writel (0x01 , ®s->reg[0x20115 ]); +writel (0x1ff , ®s->reg[0x1005f ]); +writel (0x1ff , ®s->reg[0x1015f ]); +writel (0x1ff , ®s->reg[0x1105f ]); +writel (0x1ff , ®s->reg[0x1115f ]); +writel (0x1ff , ®s->reg[0x1205f ]); +writel (0x1ff , ®s->reg[0x1215f ]); +writel (0x1ff , ®s->reg[0x1305f ]); +writel (0x1ff , ®s->reg[0x1315f ]); +writel (0x1ff , ®s->reg[0x11005f ]); +writel (0x1ff , ®s->reg[0x11015f ]); +writel (0x1ff , ®s->reg[0x11105f ]); +writel (0x1ff , ®s->reg[0x11115f ]); +writel (0x1ff , ®s->reg[0x11205f ]); +writel (0x1ff , ®s->reg[0x11215f ]); +writel (0x1ff , ®s->reg[0x11305f ]); +writel (0x1ff , ®s->reg[0x11315f ]); +writel (0x1ff , ®s->reg[0x21005f ]); +writel (0x1ff , ®s->reg[0x21015f ]); +writel (0x1ff , ®s->reg[0x21105f ]); +writel (0x1ff , ®s->reg[0x21115f ]); +writel (0x1ff , ®s->reg[0x21205f ]); +writel (0x1ff , ®s->reg[0x21215f ]); +writel (0x1ff , ®s->reg[0x21305f ]); +writel (0x1ff , ®s->reg[0x21315f ]); +writel (0x1ff , ®s->reg[0x55 ]); +writel (0x1ff , ®s->reg[0x1055 ]); +writel (0x1ff , ®s->reg[0x2055 ]); +writel (0x1ff , ®s->reg[0x3055 ]); +writel (0x1ff , ®s->reg[0x4055 ]); +writel (0x1ff , ®s->reg[0x5055 ]); +writel (0x1ff , ®s->reg[0x6055 ]); +writel (0x1ff , ®s->reg[0x7055 ]); +writel (0x1ff , ®s->reg[0x8055 ]); +writel (0x1ff , ®s->reg[0x9055 ]); +writel (0x19 , ®s->reg[0x200c5 ]); +writel (0x7 , ®s->reg[0x1200c5 ]); +writel (0x7 , ®s->reg[0x2200c5 ]); +writel (0x2 , ®s->reg[0x2002e ]); +writel (0x2 , ®s->reg[0x12002e ]); +writel (0x2 , ®s->reg[0x22002e ]); +writel (0x0 , ®s->reg[0x90204 ]); +writel (0x0 , ®s->reg[0x190204 ]); +writel (0x0 , ®s->reg[0x290204 ]); +writel (0xab , ®s->reg[0x20024 ]); +writel (0x0 , ®s->reg[0x2003a ]); +writel (0xab , ®s->reg[0x120024 ]); +writel (0x0 , ®s->reg[0x2003a ]); +writel (0xab , ®s->reg[0x220024 ]); +writel (0x0 , ®s->reg[0x2003a ]); +writel (0x3 , ®s->reg[0x20056 ]); +writel (0xa , ®s->reg[0x120056 ]); +writel (0xa , ®s->reg[0x220056 ]); +writel (0xe00 , ®s->reg[0x1004d ]); +writel (0xe00 , ®s->reg[0x1014d ]); +writel (0xe00 , ®s->reg[0x1104d ]); +writel (0xe00 , ®s->reg[0x1114d ]); +writel (0xe00 , ®s->reg[0x1204d ]); +writel (0xe00 , ®s->reg[0x1214d ]); +writel (0xe00 , ®s->reg[0x1304d ]); +writel (0xe00 , ®s->reg[0x1314d ]); +writel (0xe00 , ®s->reg[0x11004d ]); +writel (0xe00 , ®s->reg[0x11014d ]); +writel (0xe00 , ®s->reg[0x11104d ]); +writel (0xe00 , ®s->reg[0x11114d ]); +writel (0xe00 , ®s->reg[0x11204d ]); +writel (0xe00 , ®s->reg[0x11214d ]); +writel (0xe00 , ®s->reg[0x11304d ]); +writel (0xe00 , ®s->reg[0x11314d ]); +writel (0xe00 , ®s->reg[0x21004d ]); +writel (0xe00 , ®s->reg[0x21014d ]); +writel (0xe00 , ®s->reg[0x21104d ]); +writel (0xe00 , ®s->reg[0x21114d ]); +writel (0xe00 , ®s->reg[0x21204d ]); +writel (0xe00 , ®s->reg[0x21214d ]); +writel (0xe00 , ®s->reg[0x21304d ]); +writel (0xe00 , ®s->reg[0x21314d ]); +writel (0xe38 , ®s->reg[0x10049 ]); +writel (0xe38 , ®s->reg[0x10149 ]); +writel (0xe38 , ®s->reg[0x11049 ]); +writel (0xe38 , ®s->reg[0x11149 ]); +writel (0xe38 , ®s->reg[0x12049 ]); +writel (0xe38 , ®s->reg[0x12149 ]); +writel (0xe38 , ®s->reg[0x13049 ]); +writel (0xe38 , ®s->reg[0x13149 ]); +writel (0xe38 , ®s->reg[0x110049 ]); +writel (0xe38 , ®s->reg[0x110149 ]); +writel (0xe38 , ®s->reg[0x111049 ]); +writel (0xe38 , ®s->reg[0x111149 ]); +writel (0xe38 , ®s->reg[0x112049 ]); +writel (0xe38 , ®s->reg[0x112149 ]); +writel (0xe38 , ®s->reg[0x113049 ]); +writel (0xe38 , ®s->reg[0x113149 ]); +writel (0xe38 , ®s->reg[0x210049 ]); +writel (0xe38 , ®s->reg[0x210149 ]); +writel (0xe38 , ®s->reg[0x211049 ]); +writel (0xe38 , ®s->reg[0x211149 ]); +writel (0xe38 , ®s->reg[0x212049 ]); +writel (0xe38 , ®s->reg[0x212149 ]); +writel (0xe38 , ®s->reg[0x213049 ]); +writel (0xe38 , ®s->reg[0x213149 ]); +writel (0x21 , ®s->reg[0x43 ]); +writel (0x21 , ®s->reg[0x1043 ]); +writel (0x21 , ®s->reg[0x2043 ]); +writel (0x21 , ®s->reg[0x3043 ]); +writel (0x21 , ®s->reg[0x4043 ]); +writel (0x21 , ®s->reg[0x5043 ]); +writel (0x21 , ®s->reg[0x6043 ]); +writel (0x21 , ®s->reg[0x7043 ]); +writel (0x21 , ®s->reg[0x8043 ]); +writel (0x21 , ®s->reg[0x9043 ]); +writel (0x3 , ®s->reg[0x20018 ]); +writel (0x4 , ®s->reg[0x20075 ]); +writel (0x0 , ®s->reg[0x20050 ]); +writel (0x320 , ®s->reg[0x20008 ]); +writel (0x64 , ®s->reg[0x120008 ]); +writel (0x19 , ®s->reg[0x220008 ]); +writel (0x9 , ®s->reg[0x20088 ]); +writel (0x19c , ®s->reg[0x200b2 ]); +writel (0x5a1 , ®s->reg[0x10043 ]); +writel (0x5a1 , ®s->reg[0x10143 ]); +writel (0x5a1 , ®s->reg[0x11043 ]); +writel (0x5a1 , ®s->reg[0x11143 ]); +writel (0x5a1 , ®s->reg[0x12043 ]); +writel (0x5a1 , ®s->reg[0x12143 ]); +writel (0x5a1 , ®s->reg[0x13043 ]); +writel (0x5a1 , ®s->reg[0x13143 ]); +writel (0x19c , ®s->reg[0x1200b2 ]); +writel (0x5a1 , ®s->reg[0x110043 ]); +writel (0x5a1 , ®s->reg[0x110143 ]); +writel (0x5a1 , ®s->reg[0x111043 ]); +writel (0x5a1 , ®s->reg[0x111143 ]); +writel (0x5a1 , ®s->reg[0x112043 ]); +writel (0x5a1 , ®s->reg[0x112143 ]); +writel (0x5a1 , ®s->reg[0x113043 ]); +writel (0x5a1 , ®s->reg[0x113143 ]); +writel (0x19c , ®s->reg[0x2200b2 ]); +writel (0x5a1 , ®s->reg[0x210043 ]); +writel (0x5a1 , ®s->reg[0x210143 ]); +writel (0x5a1 , ®s->reg[0x211043 ]); +writel (0x5a1 , ®s->reg[0x211143 ]); +writel (0x5a1 , ®s->reg[0x212043 ]); +writel (0x5a1 , ®s->reg[0x212143 ]); +writel (0x5a1 , ®s->reg[0x213043 ]); +writel (0x5a1 , ®s->reg[0x213143 ]); +writel (0x1 , ®s->reg[0x200fa ]); +writel (0x1 , ®s->reg[0x1200fa ]); +writel (0x1 , ®s->reg[0x2200fa ]); +writel (0x1 , ®s->reg[0x20019 ]); +writel (0x1 , ®s->reg[0x120019 ]); +writel (0x1 , ®s->reg[0x220019 ]); +writel (0x660 , ®s->reg[0x200f0 ]); +writel (0x0 , ®s->reg[0x200f1 ]); +writel (0x4444 , ®s->reg[0x200f2 ]); +writel (0x8888 , ®s->reg[0x200f3 ]); +writel (0x5555 , ®s->reg[0x200f4 ]); +writel (0x0 , ®s->reg[0x200f5 ]); +writel (0x0 , ®s->reg[0x200f6 ]); +writel (0xf000 , ®s->reg[0x200f7 ]); +writel (0x65 , ®s->reg[0x2000b ]); +writel (0xc9 , ®s->reg[0x2000c ]); +writel (0x7d1 , ®s->reg[0x2000d ]); +writel (0x2c , ®s->reg[0x2000e ]); +writel (0xd , ®s->reg[0x12000b ]); +writel (0x1a , ®s->reg[0x12000c ]); +writel (0xfb , ®s->reg[0x12000d ]); +writel (0x10 , ®s->reg[0x12000e ]); +writel (0x4 , ®s->reg[0x22000b ]); +writel (0x7 , ®s->reg[0x22000c ]); +writel (0x3f , ®s->reg[0x22000d ]); +writel (0x10 , ®s->reg[0x22000e ]); +writel (0x0 , ®s->reg[0x20025 ]); +writel (0x0 , ®s->reg[0x2002d ]); +writel (0x0 , ®s->reg[0x12002d ]); +writel (0x0 , ®s->reg[0x22002d ]); +writel (0x2 , ®s->reg[0x20060 ]); +writel (0x0 , ®s->reg[0xd0000 ]); + +/* load the 1D training image */ +ddr_load_train_code (FW_1D_IMAGE ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* set the PHY input clock to the desired frequency for pstate 2 */ +dwc_ddrphy_phyinit_usercustom_e_setdficlk (PS2 ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x102 , ®s->reg[0x54002 ]); +writel (0x64 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x121f , ®s->reg[0x54008 ]); +writel (0xc8 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x0 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x0 , ®s->reg[0x5400f ]); +writel (0x0 , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0x400 , ®s->reg[0x54032 ]); +writel (0x3100 , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x84d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0x400 , ®s->reg[0x54038 ]); +writel (0x3100 , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x84d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); + +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* set the PHY input clock to the desired frequency for pstate 1 */ +dwc_ddrphy_phyinit_usercustom_e_setdficlk (PS1 ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x101 , ®s->reg[0x54002 ]); +writel (0x190 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x121f , ®s->reg[0x54008 ]); +writel (0xc8 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x0 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x0 , ®s->reg[0x5400f ]); +writel (0x0 , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0x400 , ®s->reg[0x54032 ]); +writel (0x3100 , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x84d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0x400 , ®s->reg[0x54038 ]); +writel (0x3100 , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x84d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); + +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* set the PHY input clock to the desired frequency for pstate 0 */ +dwc_ddrphy_phyinit_usercustom_e_setdficlk (PS0 ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x0 , ®s->reg[0x54002 ]); +writel (0xc80 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x131f , ®s->reg[0x54008 ]); +writel (0x5 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x0 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x0 , ®s->reg[0x5400f ]); +writel (0x0 , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x2dd4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x2dd4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0xd400 , ®s->reg[0x54032 ]); +writel (0x312d , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x84d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0xd400 , ®s->reg[0x54038 ]); +writel (0x312d , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x84d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); + +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0xd0000 ]); + +/* load the 2D training image */ +ddr_load_train_code (FW_2D_IMAGE ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0xd0000 ]); + +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x0 , ®s->reg[0x54002 ]); +writel (0xc80 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x61 , ®s->reg[0x54008 ]); +writel (0xc8 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x100 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x100 , ®s->reg[0x5400f ]); +writel (0x1f7f , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x2dd4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x2dd4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0xd400 , ®s->reg[0x54032 ]); +writel (0x312d , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x084d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0xd400 , ®s->reg[0x54038 ]); +writel (0x312d , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x084d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +/* Execute the Training Firmware */ +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); +/* wait for 2D training complete */ +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* (I) Load PHY Init Engine Image */ +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x10 , ®s->reg[0x90000 ]); +writel (0x400 , ®s->reg[0x90001 ]); +writel (0x10e , ®s->reg[0x90002 ]); +writel (0x0 , ®s->reg[0x90003 ]); +writel (0x0 , ®s->reg[0x90004 ]); +writel (0x8 , ®s->reg[0x90005 ]); +writel (0xb , ®s->reg[0x90029 ]); +writel (0x480 , ®s->reg[0x9002a ]); +writel (0x109 , ®s->reg[0x9002b ]); +writel (0x8 , ®s->reg[0x9002c ]); +writel (0x448 , ®s->reg[0x9002d ]); +writel (0x139 , ®s->reg[0x9002e ]); +writel (0x8 , ®s->reg[0x9002f ]); +writel (0x478 , ®s->reg[0x90030 ]); +writel (0x109 , ®s->reg[0x90031 ]); +writel (0x0 , ®s->reg[0x90032 ]); +writel (0xe8 , ®s->reg[0x90033 ]); +writel (0x109 , ®s->reg[0x90034 ]); +writel (0x2 , ®s->reg[0x90035 ]); +writel (0x10 , ®s->reg[0x90036 ]); +writel (0x139 , ®s->reg[0x90037 ]); +writel (0xf , ®s->reg[0x90038 ]); +writel (0x7c0 , ®s->reg[0x90039 ]); +writel (0x139 , ®s->reg[0x9003a ]); +writel (0x44 , ®s->reg[0x9003b ]); +writel (0x630 , ®s->reg[0x9003c ]); +writel (0x159 , ®s->reg[0x9003d ]); +writel (0x14f , ®s->reg[0x9003e ]); +writel (0x630 , ®s->reg[0x9003f ]); +writel (0x159 , ®s->reg[0x90040 ]); +writel (0x47 , ®s->reg[0x90041 ]); +writel (0x630 , ®s->reg[0x90042 ]); +writel (0x149 , ®s->reg[0x90043 ]); +writel (0x4f , ®s->reg[0x90044 ]); +writel (0x630 , ®s->reg[0x90045 ]); +writel (0x179 , ®s->reg[0x90046 ]); +writel (0x8 , ®s->reg[0x90047 ]); +writel (0xe0 , ®s->reg[0x90048 ]); +writel (0x109 , ®s->reg[0x90049 ]); +writel (0x0 , ®s->reg[0x9004a ]); +writel (0x7c8 , ®s->reg[0x9004b ]); +writel (0x109 , ®s->reg[0x9004c ]); +writel (0x0 , ®s->reg[0x9004d ]); +writel (0x1 , ®s->reg[0x9004e ]); +writel (0x8 , ®s->reg[0x9004f ]); +writel (0x0 , ®s->reg[0x90050 ]); +writel (0x45a , ®s->reg[0x90051 ]); +writel (0x9 , ®s->reg[0x90052 ]); +writel (0x0 , ®s->reg[0x90053 ]); +writel (0x448 , ®s->reg[0x90054 ]); +writel (0x109 , ®s->reg[0x90055 ]); +writel (0x40 , ®s->reg[0x90056 ]); +writel (0x630 , ®s->reg[0x90057 ]); +writel (0x179 , ®s->reg[0x90058 ]); +writel (0x1 , ®s->reg[0x90059 ]); +writel (0x618 , ®s->reg[0x9005a ]); +writel (0x109 , ®s->reg[0x9005b ]); +writel (0x40c0 , ®s->reg[0x9005c ]); +writel (0x630 , ®s->reg[0x9005d ]); +writel (0x149 , ®s->reg[0x9005e ]); +writel (0x8 , ®s->reg[0x9005f ]); +writel (0x4 , ®s->reg[0x90060 ]); +writel (0x48 , ®s->reg[0x90061 ]); +writel (0x4040 , ®s->reg[0x90062 ]); +writel (0x630 , ®s->reg[0x90063 ]); +writel (0x149 , ®s->reg[0x90064 ]); +writel (0x0 , ®s->reg[0x90065 ]); +writel (0x4 , ®s->reg[0x90066 ]); +writel (0x48 , ®s->reg[0x90067 ]); +writel (0x40 , ®s->reg[0x90068 ]); +writel (0x630 , ®s->reg[0x90069 ]); +writel (0x149 , ®s->reg[0x9006a ]); +writel (0x10 , ®s->reg[0x9006b ]); +writel (0x4 , ®s->reg[0x9006c ]); +writel (0x18 , ®s->reg[0x9006d ]); +writel (0x0 , ®s->reg[0x9006e ]); +writel (0x4 , ®s->reg[0x9006f ]); +writel (0x78 , ®s->reg[0x90070 ]); +writel (0x549 , ®s->reg[0x90071 ]); +writel (0x630 , ®s->reg[0x90072 ]); +writel (0x159 , ®s->reg[0x90073 ]); +writel (0xd49 , ®s->reg[0x90074 ]); +writel (0x630 , ®s->reg[0x90075 ]); +writel (0x159 , ®s->reg[0x90076 ]); +writel (0x94a , ®s->reg[0x90077 ]); +writel (0x630 , ®s->reg[0x90078 ]); +writel (0x159 , ®s->reg[0x90079 ]); +writel (0x441 , ®s->reg[0x9007a ]); +writel (0x630 , ®s->reg[0x9007b ]); +writel (0x149 , ®s->reg[0x9007c ]); +writel (0x42 , ®s->reg[0x9007d ]); +writel (0x630 , ®s->reg[0x9007e ]); +writel (0x149 , ®s->reg[0x9007f ]); +writel (0x1 , ®s->reg[0x90080 ]); +writel (0x630 , ®s->reg[0x90081 ]); +writel (0x149 , ®s->reg[0x90082 ]); +writel (0x0 , ®s->reg[0x90083 ]); +writel (0xe0 , ®s->reg[0x90084 ]); +writel (0x109 , ®s->reg[0x90085 ]); +writel (0xa , ®s->reg[0x90086 ]); +writel (0x10 , ®s->reg[0x90087 ]); +writel (0x109 , ®s->reg[0x90088 ]); +writel (0x9 , ®s->reg[0x90089 ]); +writel (0x3c0 , ®s->reg[0x9008a ]); +writel (0x149 , ®s->reg[0x9008b ]); +writel (0x9 , ®s->reg[0x9008c ]); +writel (0x3c0 , ®s->reg[0x9008d ]); +writel (0x159 , ®s->reg[0x9008e ]); +writel (0x18 , ®s->reg[0x9008f ]); +writel (0x10 , ®s->reg[0x90090 ]); +writel (0x109 , ®s->reg[0x90091 ]); +writel (0x0 , ®s->reg[0x90092 ]); +writel (0x3c0 , ®s->reg[0x90093 ]); +writel (0x109 , ®s->reg[0x90094 ]); +writel (0x18 , ®s->reg[0x90095 ]); +writel (0x4 , ®s->reg[0x90096 ]); +writel (0x48 , ®s->reg[0x90097 ]); +writel (0x18 , ®s->reg[0x90098 ]); +writel (0x4 , ®s->reg[0x90099 ]); +writel (0x58 , ®s->reg[0x9009a ]); +writel (0xa , ®s->reg[0x9009b ]); +writel (0x10 , ®s->reg[0x9009c ]); +writel (0x109 , ®s->reg[0x9009d ]); +writel (0x2 , ®s->reg[0x9009e ]); +writel (0x10 , ®s->reg[0x9009f ]); +writel (0x109 , ®s->reg[0x900a0 ]); +writel (0x5 , ®s->reg[0x900a1 ]); +writel (0x7c0 , ®s->reg[0x900a2 ]); +writel (0x109 , ®s->reg[0x900a3 ]); +writel (0x10 , ®s->reg[0x900a4 ]); +writel (0x10 , ®s->reg[0x900a5 ]); +writel (0x109 , ®s->reg[0x900a6 ]); +writel (0x811 , ®s->reg[0x40000 ]); +writel (0x880 , ®s->reg[0x40020 ]); +writel (0x0 , ®s->reg[0x40040 ]); +writel (0x0 , ®s->reg[0x40060 ]); +writel (0x4016 , ®s->reg[0x40001 ]); +writel (0x83 , ®s->reg[0x40021 ]); +writel (0x4f , ®s->reg[0x40041 ]); +writel (0x0 , ®s->reg[0x40061 ]); +writel (0x4040 , ®s->reg[0x40002 ]); +writel (0x83 , ®s->reg[0x40022 ]); +writel (0x51 , ®s->reg[0x40042 ]); +writel (0x0 , ®s->reg[0x40062 ]); +writel (0x811 , ®s->reg[0x40003 ]); +writel (0x880 , ®s->reg[0x40023 ]); +writel (0x0 , ®s->reg[0x40043 ]); +writel (0x0 , ®s->reg[0x40063 ]); +writel (0x720 , ®s->reg[0x40004 ]); +writel (0xf , ®s->reg[0x40024 ]); +writel (0x1740 , ®s->reg[0x40044 ]); +writel (0x0 , ®s->reg[0x40064 ]); +writel (0x16 , ®s->reg[0x40005 ]); +writel (0x83 , ®s->reg[0x40025 ]); +writel (0x4b , ®s->reg[0x40045 ]); +writel (0x0 , ®s->reg[0x40065 ]); +writel (0x716 , ®s->reg[0x40006 ]); +writel (0xf , ®s->reg[0x40026 ]); +writel (0x2001 , ®s->reg[0x40046 ]); +writel (0x0 , ®s->reg[0x40066 ]); +writel (0x716 , ®s->reg[0x40007 ]); +writel (0xf , ®s->reg[0x40027 ]); +writel (0x2800 , ®s->reg[0x40047 ]); +writel (0x0 , ®s->reg[0x40067 ]); +writel (0x716 , ®s->reg[0x40008 ]); +writel (0xf , ®s->reg[0x40028 ]); +writel (0xf00 , ®s->reg[0x40048 ]); +writel (0x0 , ®s->reg[0x40068 ]); +writel (0x720 , ®s->reg[0x40009 ]); +writel (0xf , ®s->reg[0x40029 ]); +writel (0x1400 , ®s->reg[0x40049 ]); +writel (0x0 , ®s->reg[0x40069 ]); +writel (0xe08 , ®s->reg[0x4000a ]); +writel (0xc15 , ®s->reg[0x4002a ]); +writel (0x0 , ®s->reg[0x4004a ]); +writel (0x0 , ®s->reg[0x4006a ]); +writel (0x623 , ®s->reg[0x4000b ]); +writel (0x15 , ®s->reg[0x4002b ]); +writel (0x0 , ®s->reg[0x4004b ]); +writel (0x0 , ®s->reg[0x4006b ]); +writel (0x4004 , ®s->reg[0x4000c ]); +writel (0x80 , ®s->reg[0x4002c ]); +writel (0x0 , ®s->reg[0x4004c ]); +writel (0x0 , ®s->reg[0x4006c ]); +writel (0xe08 , ®s->reg[0x4000d ]); +writel (0xc1a , ®s->reg[0x4002d ]); +writel (0x0 , ®s->reg[0x4004d ]); +writel (0x0 , ®s->reg[0x4006d ]); +writel (0x623 , ®s->reg[0x4000e ]); +writel (0x1a , ®s->reg[0x4002e ]); +writel (0x0 , ®s->reg[0x4004e ]); +writel (0x0 , ®s->reg[0x4006e ]); +writel (0x4040 , ®s->reg[0x4000f ]); +writel (0x80 , ®s->reg[0x4002f ]); +writel (0x0 , ®s->reg[0x4004f ]); +writel (0x0 , ®s->reg[0x4006f ]); +writel (0x2604 , ®s->reg[0x40010 ]); +writel (0x15 , ®s->reg[0x40030 ]); +writel (0x0 , ®s->reg[0x40050 ]); +writel (0x0 , ®s->reg[0x40070 ]); +writel (0x708 , ®s->reg[0x40011 ]); +writel (0x5 , ®s->reg[0x40031 ]); +writel (0x0 , ®s->reg[0x40051 ]); +writel (0x2002 , ®s->reg[0x40071 ]); +writel (0x8 , ®s->reg[0x40012 ]); +writel (0x80 , ®s->reg[0x40032 ]); +writel (0x0 , ®s->reg[0x40052 ]); +writel (0x0 , ®s->reg[0x40072 ]); +writel (0x2604 , ®s->reg[0x40013 ]); +writel (0x1a , ®s->reg[0x40033 ]); +writel (0x0 , ®s->reg[0x40053 ]); +writel (0x0 , ®s->reg[0x40073 ]); +writel (0x708 , ®s->reg[0x40014 ]); +writel (0xa , ®s->reg[0x40034 ]); +writel (0x0 , ®s->reg[0x40054 ]); +writel (0x2002 , ®s->reg[0x40074 ]); +writel (0x4040 , ®s->reg[0x40015 ]); +writel (0x80 , ®s->reg[0x40035 ]); +writel (0x0 , ®s->reg[0x40055 ]); +writel (0x0 , ®s->reg[0x40075 ]); +writel (0x60a , ®s->reg[0x40016 ]); +writel (0x15 , ®s->reg[0x40036 ]); +writel (0x1200 , ®s->reg[0x40056 ]); +writel (0x0 , ®s->reg[0x40076 ]); +writel (0x61a , ®s->reg[0x40017 ]); +writel (0x15 , ®s->reg[0x40037 ]); +writel (0x1300 , ®s->reg[0x40057 ]); +writel (0x0 , ®s->reg[0x40077 ]); +writel (0x60a , ®s->reg[0x40018 ]); +writel (0x1a , ®s->reg[0x40038 ]); +writel (0x1200 , ®s->reg[0x40058 ]); +writel (0x0 , ®s->reg[0x40078 ]); +writel (0x642 , ®s->reg[0x40019 ]); +writel (0x1a , ®s->reg[0x40039 ]); +writel (0x1300 , ®s->reg[0x40059 ]); +writel (0x0 , ®s->reg[0x40079 ]); +writel (0x4808 , ®s->reg[0x4001a ]); +writel (0x880 , ®s->reg[0x4003a ]); +writel (0x0 , ®s->reg[0x4005a ]); +writel (0x0 , ®s->reg[0x4007a ]); +writel (0x0 , ®s->reg[0x900a7 ]); +writel (0x790 , ®s->reg[0x900a8 ]); +writel (0x11a , ®s->reg[0x900a9 ]); +writel (0x8 , ®s->reg[0x900aa ]); +writel (0x7aa , ®s->reg[0x900ab ]); +writel (0x2a , ®s->reg[0x900ac ]); +writel (0x10 , ®s->reg[0x900ad ]); +writel (0x7b2 , ®s->reg[0x900ae ]); +writel (0x2a , ®s->reg[0x900af ]); +writel (0x0 , ®s->reg[0x900b0 ]); +writel (0x7c8 , ®s->reg[0x900b1 ]); +writel (0x109 , ®s->reg[0x900b2 ]); +writel (0x10 , ®s->reg[0x900b3 ]); +writel (0x2a8 , ®s->reg[0x900b4 ]); +writel (0x129 , ®s->reg[0x900b5 ]); +writel (0x8 , ®s->reg[0x900b6 ]); +writel (0x370 , ®s->reg[0x900b7 ]); +writel (0x129 , ®s->reg[0x900b8 ]); +writel (0xa , ®s->reg[0x900b9 ]); +writel (0x3c8 , ®s->reg[0x900ba ]); +writel (0x1a9 , ®s->reg[0x900bb ]); +writel (0xc , ®s->reg[0x900bc ]); +writel (0x408 , ®s->reg[0x900bd ]); +writel (0x199 , ®s->reg[0x900be ]); +writel (0x14 , ®s->reg[0x900bf ]); +writel (0x790 , ®s->reg[0x900c0 ]); +writel (0x11a , ®s->reg[0x900c1 ]); +writel (0x8 , ®s->reg[0x900c2 ]); +writel (0x4 , ®s->reg[0x900c3 ]); +writel (0x18 , ®s->reg[0x900c4 ]); +writel (0xc , ®s->reg[0x900c5 ]); +writel (0x408 , ®s->reg[0x900c6 ]); +writel (0x199 , ®s->reg[0x900c7 ]); +writel (0x8 , ®s->reg[0x900c8 ]); +writel (0x8568 , ®s->reg[0x900c9 ]); +writel (0x108 , ®s->reg[0x900ca ]); +writel (0x18 , ®s->reg[0x900cb ]); +writel (0x790 , ®s->reg[0x900cc ]); +writel (0x16a , ®s->reg[0x900cd ]); +writel (0x8 , ®s->reg[0x900ce ]); +writel (0x1d8 , ®s->reg[0x900cf ]); +writel (0x169 , ®s->reg[0x900d0 ]); +writel (0x10 , ®s->reg[0x900d1 ]); +writel (0x8558 , ®s->reg[0x900d2 ]); +writel (0x168 , ®s->reg[0x900d3 ]); +writel (0x70 , ®s->reg[0x900d4 ]); +writel (0x788 , ®s->reg[0x900d5 ]); +writel (0x16a , ®s->reg[0x900d6 ]); +writel (0x1ff8 , ®s->reg[0x900d7 ]); +writel (0x85a8 , ®s->reg[0x900d8 ]); +writel (0x1e8 , ®s->reg[0x900d9 ]); +writel (0x50 , ®s->reg[0x900da ]); +writel (0x798 , ®s->reg[0x900db ]); +writel (0x16a , ®s->reg[0x900dc ]); +writel (0x60 , ®s->reg[0x900dd ]); +writel (0x7a0 , ®s->reg[0x900de ]); +writel (0x16a , ®s->reg[0x900df ]); +writel (0x8 , ®s->reg[0x900e0 ]); +writel (0x8310 , ®s->reg[0x900e1 ]); +writel (0x168 , ®s->reg[0x900e2 ]); +writel (0x8 , ®s->reg[0x900e3 ]); +writel (0xa310 , ®s->reg[0x900e4 ]); +writel (0x168 , ®s->reg[0x900e5 ]); +writel (0xa , ®s->reg[0x900e6 ]); +writel (0x408 , ®s->reg[0x900e7 ]); +writel (0x169 , ®s->reg[0x900e8 ]); +writel (0x6e , ®s->reg[0x900e9 ]); +writel (0x0 , ®s->reg[0x900ea ]); +writel (0x68 , ®s->reg[0x900eb ]); +writel (0x0 , ®s->reg[0x900ec ]); +writel (0x408 , ®s->reg[0x900ed ]); +writel (0x169 , ®s->reg[0x900ee ]); +writel (0x0 , ®s->reg[0x900ef ]); +writel (0x8310 , ®s->reg[0x900f0 ]); +writel (0x168 , ®s->reg[0x900f1 ]); +writel (0x0 , ®s->reg[0x900f2 ]); +writel (0xa310 , ®s->reg[0x900f3 ]); +writel (0x168 , ®s->reg[0x900f4 ]); +writel (0x1ff8 , ®s->reg[0x900f5 ]); +writel (0x85a8 , ®s->reg[0x900f6 ]); +writel (0x1e8 , ®s->reg[0x900f7 ]); +writel (0x68 , ®s->reg[0x900f8 ]); +writel (0x798 , ®s->reg[0x900f9 ]); +writel (0x16a , ®s->reg[0x900fa ]); +writel (0x78 , ®s->reg[0x900fb ]); +writel (0x7a0 , ®s->reg[0x900fc ]); +writel (0x16a , ®s->reg[0x900fd ]); +writel (0x68 , ®s->reg[0x900fe ]); +writel (0x790 , ®s->reg[0x900ff ]); +writel (0x16a , ®s->reg[0x90100 ]); +writel (0x8 , ®s->reg[0x90101 ]); +writel (0x8b10 , ®s->reg[0x90102 ]); +writel (0x168 , ®s->reg[0x90103 ]); +writel (0x8 , ®s->reg[0x90104 ]); +writel (0xab10 , ®s->reg[0x90105 ]); +writel (0x168 , ®s->reg[0x90106 ]); +writel (0xa , ®s->reg[0x90107 ]); +writel (0x408 , ®s->reg[0x90108 ]); +writel (0x169 , ®s->reg[0x90109 ]); +writel (0x58 , ®s->reg[0x9010a ]); +writel (0x0 , ®s->reg[0x9010b ]); +writel (0x68 , ®s->reg[0x9010c ]); +writel (0x0 , ®s->reg[0x9010d ]); +writel (0x408 , ®s->reg[0x9010e ]); +writel (0x169 , ®s->reg[0x9010f ]); +writel (0x0 , ®s->reg[0x90110 ]); +writel (0x8b10 , ®s->reg[0x90111 ]); +writel (0x168 , ®s->reg[0x90112 ]); +writel (0x0 , ®s->reg[0x90113 ]); +writel (0xab10 , ®s->reg[0x90114 ]); +writel (0x168 , ®s->reg[0x90115 ]); +writel (0x0 , ®s->reg[0x90116 ]); +writel (0x1d8 , ®s->reg[0x90117 ]); +writel (0x169 , ®s->reg[0x90118 ]); +writel (0x80 , ®s->reg[0x90119 ]); +writel (0x790 , ®s->reg[0x9011a ]); +writel (0x16a , ®s->reg[0x9011b ]); +writel (0x18 , ®s->reg[0x9011c ]); +writel (0x7aa , ®s->reg[0x9011d ]); +writel (0x6a , ®s->reg[0x9011e ]); +writel (0xa , ®s->reg[0x9011f ]); +writel (0x0 , ®s->reg[0x90120 ]); +writel (0x1e9 , ®s->reg[0x90121 ]); +writel (0x8 , ®s->reg[0x90122 ]); +writel (0x8080 , ®s->reg[0x90123 ]); +writel (0x108 , ®s->reg[0x90124 ]); +writel (0xf , ®s->reg[0x90125 ]); +writel (0x408 , ®s->reg[0x90126 ]); +writel (0x169 , ®s->reg[0x90127 ]); +writel (0xc , ®s->reg[0x90128 ]); +writel (0x0 , ®s->reg[0x90129 ]); +writel (0x68 , ®s->reg[0x9012a ]); +writel (0x9 , ®s->reg[0x9012b ]); +writel (0x0 , ®s->reg[0x9012c ]); +writel (0x1a9 , ®s->reg[0x9012d ]); +writel (0x0 , ®s->reg[0x9012e ]); +writel (0x408 , ®s->reg[0x9012f ]); +writel (0x169 , ®s->reg[0x90130 ]); +writel (0x0 , ®s->reg[0x90131 ]); +writel (0x8080 , ®s->reg[0x90132 ]); +writel (0x108 , ®s->reg[0x90133 ]); +writel (0x8 , ®s->reg[0x90134 ]); +writel (0x7aa , ®s->reg[0x90135 ]); +writel (0x6a , ®s->reg[0x90136 ]); +writel (0x0 , ®s->reg[0x90137 ]); +writel (0x8568 , ®s->reg[0x90138 ]); +writel (0x108 , ®s->reg[0x90139 ]); +writel (0xb7 , ®s->reg[0x9013a ]); +writel (0x790 , ®s->reg[0x9013b ]); +writel (0x16a , ®s->reg[0x9013c ]); +writel (0x1d , ®s->reg[0x9013d ]); +writel (0x0 , ®s->reg[0x9013e ]); +writel (0x68 , ®s->reg[0x9013f ]); +writel (0x8 , ®s->reg[0x90140 ]); +writel (0x8558 , ®s->reg[0x90141 ]); +writel (0x168 , ®s->reg[0x90142 ]); +writel (0xf , ®s->reg[0x90143 ]); +writel (0x408 , ®s->reg[0x90144 ]); +writel (0x169 , ®s->reg[0x90145 ]); +writel (0xc , ®s->reg[0x90146 ]); +writel (0x0 , ®s->reg[0x90147 ]); +writel (0x68 , ®s->reg[0x90148 ]); +writel (0x0 , ®s->reg[0x90149 ]); +writel (0x408 , ®s->reg[0x9014a ]); +writel (0x169 , ®s->reg[0x9014b ]); +writel (0x0 , ®s->reg[0x9014c ]); +writel (0x8558 , ®s->reg[0x9014d ]); +writel (0x168 , ®s->reg[0x9014e ]); +writel (0x8 , ®s->reg[0x9014f ]); +writel (0x3c8 , ®s->reg[0x90150 ]); +writel (0x1a9 , ®s->reg[0x90151 ]); +writel (0x3 , ®s->reg[0x90152 ]); +writel (0x370 , ®s->reg[0x90153 ]); +writel (0x129 , ®s->reg[0x90154 ]); +writel (0x20 , ®s->reg[0x90155 ]); +writel (0x2aa , ®s->reg[0x90156 ]); +writel (0x9 , ®s->reg[0x90157 ]); +writel (0x0 , ®s->reg[0x90158 ]); +writel (0x400 , ®s->reg[0x90159 ]); +writel (0x10e , ®s->reg[0x9015a ]); +writel (0x8 , ®s->reg[0x9015b ]); +writel (0xe8 , ®s->reg[0x9015c ]); +writel (0x109 , ®s->reg[0x9015d ]); +writel (0x0 , ®s->reg[0x9015e ]); +writel (0x8140 , ®s->reg[0x9015f ]); +writel (0x10c , ®s->reg[0x90160 ]); +writel (0x10 , ®s->reg[0x90161 ]); +writel (0x8138 , ®s->reg[0x90162 ]); +writel (0x10c , ®s->reg[0x90163 ]); +writel (0x8 , ®s->reg[0x90164 ]); +writel (0x7c8 , ®s->reg[0x90165 ]); +writel (0x101 , ®s->reg[0x90166 ]); +writel (0x8 , ®s->reg[0x90167 ]); +writel (0x0 , ®s->reg[0x90168 ]); +writel (0x8 , ®s->reg[0x90169 ]); +writel (0x8 , ®s->reg[0x9016a ]); +writel (0x448 , ®s->reg[0x9016b ]); +writel (0x109 , ®s->reg[0x9016c ]); +writel (0xf , ®s->reg[0x9016d ]); +writel (0x7c0 , ®s->reg[0x9016e ]); +writel (0x109 , ®s->reg[0x9016f ]); +writel (0x0 , ®s->reg[0x90170 ]); +writel (0xe8 , ®s->reg[0x90171 ]); +writel (0x109 , ®s->reg[0x90172 ]); +writel (0x47 , ®s->reg[0x90173 ]); +writel (0x630 , ®s->reg[0x90174 ]); +writel (0x109 , ®s->reg[0x90175 ]); +writel (0x8 , ®s->reg[0x90176 ]); +writel (0x618 , ®s->reg[0x90177 ]); +writel (0x109 , ®s->reg[0x90178 ]); +writel (0x8 , ®s->reg[0x90179 ]); +writel (0xe0 , ®s->reg[0x9017a ]); +writel (0x109 , ®s->reg[0x9017b ]); +writel (0x0 , ®s->reg[0x9017c ]); +writel (0x7c8 , ®s->reg[0x9017d ]); +writel (0x109 , ®s->reg[0x9017e ]); +writel (0x8 , ®s->reg[0x9017f ]); +writel (0x8140 , ®s->reg[0x90180 ]); +writel (0x10c , ®s->reg[0x90181 ]); +writel (0x0 , ®s->reg[0x90182 ]); +writel (0x1 , ®s->reg[0x90183 ]); +writel (0x8 , ®s->reg[0x90184 ]); +writel (0x8 , ®s->reg[0x90185 ]); +writel (0x4 , ®s->reg[0x90186 ]); +writel (0x8 , ®s->reg[0x90187 ]); +writel (0x8 , ®s->reg[0x90188 ]); +writel (0x7c8 , ®s->reg[0x90189 ]); +writel (0x101 , ®s->reg[0x9018a ]); +writel (0x0 , ®s->reg[0x90006 ]); +writel (0x0 , ®s->reg[0x90007 ]); +writel (0x8 , ®s->reg[0x90008 ]); +writel (0x0 , ®s->reg[0x90009 ]); +writel (0x0 , ®s->reg[0x9000a ]); +writel (0x0 , ®s->reg[0x9000b ]); +writel (0x400 , ®s->reg[0xd00e7 ]); +writel (0x0 , ®s->reg[0x90017 ]); +writel (0x2a , ®s->reg[0x9001f ]); +writel (0x6a , ®s->reg[0x90026 ]); +writel (0x0 , ®s->reg[0x400d0 ]); +writel (0x101 , ®s->reg[0x400d1 ]); +writel (0x105 , ®s->reg[0x400d2 ]); +writel (0x107 , ®s->reg[0x400d3 ]); +writel (0x10f , ®s->reg[0x400d4 ]); +writel (0x202 , ®s->reg[0x400d5 ]); +writel (0x20a , ®s->reg[0x400d6 ]); +writel (0x20b , ®s->reg[0x400d7 ]); +writel (0x2 , ®s->reg[0x2003a ]); +writel (0x0 , ®s->reg[0x9000c ]); +writel (0x173 , ®s->reg[0x9000d ]); +writel (0x60 , ®s->reg[0x9000e ]); +writel (0x6110 , ®s->reg[0x9000f ]); +writel (0x2152 , ®s->reg[0x90010 ]); +writel (0xdfbd , ®s->reg[0x90011 ]); +writel (0x60 , ®s->reg[0x90012 ]); +writel (0x6152 , ®s->reg[0x90013 ]); +writel (0x5a , ®s->reg[0x20010 ]); +writel (0x3 , ®s->reg[0x20011 ]); +writel (0xe0 , ®s->reg[0x40080 ]); +writel (0x12 , ®s->reg[0x40081 ]); +writel (0xe0 , ®s->reg[0x40082 ]); +writel (0x12 , ®s->reg[0x40083 ]); +writel (0xe0 , ®s->reg[0x40084 ]); +writel (0x12 , ®s->reg[0x40085 ]); +writel (0xf , ®s->reg[0x400fd ]); +writel (0x1 , ®s->reg[0x10011 ]); +writel (0x1 , ®s->reg[0x10012 ]); +writel (0x180 , ®s->reg[0x10013 ]); +writel (0x1 , ®s->reg[0x10018 ]); +writel (0x6209 , ®s->reg[0x10002 ]); +writel (0x1 , ®s->reg[0x100b2 ]); +writel (0x1 , ®s->reg[0x101b4 ]); +writel (0x1 , ®s->reg[0x102b4 ]); +writel (0x1 , ®s->reg[0x103b4 ]); +writel (0x1 , ®s->reg[0x104b4 ]); +writel (0x1 , ®s->reg[0x105b4 ]); +writel (0x1 , ®s->reg[0x106b4 ]); +writel (0x1 , ®s->reg[0x107b4 ]); +writel (0x1 , ®s->reg[0x108b4 ]); +writel (0x1 , ®s->reg[0x11011 ]); +writel (0x1 , ®s->reg[0x11012 ]); +writel (0x180 , ®s->reg[0x11013 ]); +writel (0x1 , ®s->reg[0x11018 ]); +writel (0x6209 , ®s->reg[0x11002 ]); +writel (0x1 , ®s->reg[0x110b2 ]); +writel (0x1 , ®s->reg[0x111b4 ]); +writel (0x1 , ®s->reg[0x112b4 ]); +writel (0x1 , ®s->reg[0x113b4 ]); +writel (0x1 , ®s->reg[0x114b4 ]); +writel (0x1 , ®s->reg[0x115b4 ]); +writel (0x1 , ®s->reg[0x116b4 ]); +writel (0x1 , ®s->reg[0x117b4 ]); +writel (0x1 , ®s->reg[0x118b4 ]); +writel (0x1 , ®s->reg[0x12011 ]); +writel (0x1 , ®s->reg[0x12012 ]); +writel (0x180 , ®s->reg[0x12013 ]); +writel (0x1 , ®s->reg[0x12018 ]); +writel (0x6209 , ®s->reg[0x12002 ]); +writel (0x1 , ®s->reg[0x120b2 ]); +writel (0x1 , ®s->reg[0x121b4 ]); +writel (0x1 , ®s->reg[0x122b4 ]); +writel (0x1 , ®s->reg[0x123b4 ]); +writel (0x1 , ®s->reg[0x124b4 ]); +writel (0x1 , ®s->reg[0x125b4 ]); +writel (0x1 , ®s->reg[0x126b4 ]); +writel (0x1 , ®s->reg[0x127b4 ]); +writel (0x1 , ®s->reg[0x128b4 ]); +writel (0x1 , ®s->reg[0x13011 ]); +writel (0x1 , ®s->reg[0x13012 ]); +writel (0x180 , ®s->reg[0x13013 ]); +writel (0x1 , ®s->reg[0x13018 ]); +writel (0x6209 , ®s->reg[0x13002 ]); +writel (0x1 , ®s->reg[0x130b2 ]); +writel (0x1 , ®s->reg[0x131b4 ]); +writel (0x1 , ®s->reg[0x132b4 ]); +writel (0x1 , ®s->reg[0x133b4 ]); +writel (0x1 , ®s->reg[0x134b4 ]); +writel (0x1 , ®s->reg[0x135b4 ]); +writel (0x1 , ®s->reg[0x136b4 ]); +writel (0x1 , ®s->reg[0x137b4 ]); +writel (0x1 , ®s->reg[0x138b4 ]); +writel (0x2 , ®s->reg[0x2003a ]); +writel (0x2 , ®s->reg[0xc0080 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x000d0000 ]); +readl (®s->reg[0x00020010 ]); +writel (0x6a , ®s->reg[0x00020010 ]); +readl (®s->reg[0x0002001d ]); +writel (0x1 , ®s->reg[0x0002001d ]); +/* +* CalBusy.0 =1, indicates the calibrator is actively calibrating. board/freescale/mx8mq_evk/ddr/ddrphy_train.c line 1272
Quoted 10 lines
board/freescale/mx8mq_evk/ddr/ddrphy_train.c new file +10
-0+* Wait Calibrating done. +*/ + ret =readl_poll_timeout (®s->reg[0x20097 ], val, + !(val &BIT (1 )),1000 ); +if (ret) +puts ("CalBusy.0 timeout\n" ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x2006e ]); +}This function tells me that we do not need a compiler at all :-(.
I cannot say it is self-explaining....
Quoted 804 lines
board/freescale/mx8mq_evk/ddr/helper.c new file +101
-0@@ -0,0 +1,101 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <spl.h> +#include <asm/io.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/sections.h> +#include <asm/arch/ddr.h> +#include <asm/arch/sys_proto.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#define IMEM_LEN 32768 +#define DMEM_LEN 16384 +#define IMEM_2D_OFFSET 49152 + +#define IMEM_OFFSET_ADDR 0x00050000 +#define DMEM_OFFSET_ADDR 0x00054000 +#define DDR_TRAIN_CODE_BASE_ADDR IP2APB_DDRPHY_IPS_BASE_ADDR(0) + +/* We need PHY iMEM PHY is 32KB padded */ +void ddr_load_train_code (enum fw_type type) +{ +u32 tmp32, i; +u32 error =0 ; +unsigned long pr_to32, pr_from32; +unsigned long fw_offset = type ?IMEM_2D_OFFSET :0 ; +unsigned long imem_start = (unsigned long )&_end + fw_offset; +unsigned long dmem_start = imem_start +IMEM_LEN ; + + pr_from32 = imem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; +for (i =0x0 ; i <IMEM_LEN ; ) { + tmp32 =readl (pr_from32); +writew (tmp32 &0x0000ffff , pr_to32); + pr_to32 +=4 ; +writew ((tmp32 >>16 ) &0x0000ffff , pr_to32); + pr_to32 +=4 ; + pr_from32 +=4 ; + i +=4 ; + } + + pr_from32 = dmem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; +for (i =0x0 ; i <DMEM_LEN ;) { + tmp32 =readl (pr_from32); +writew (tmp32 &0x0000ffff , pr_to32); + pr_to32 +=4 ; +writew ((tmp32 >>16 ) &0x0000ffff , pr_to32); + pr_to32 +=4 ; + pr_from32 +=4 ; + i +=4 ; + } + +debug ("check ddr4_pmu_train_imem code\n" ); + pr_from32 = imem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; +for (i =0x0 ; i <IMEM_LEN ;) { + tmp32 = (readw (pr_to32) &0x0000ffff ); + pr_to32 +=4 ; + tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 ); + +if (tmp32 !=readl (pr_from32)) { +printf ("%lx %lx\n" , pr_from32, pr_to32); + error++; + } + pr_from32 +=4 ; + pr_to32 +=4 ; + i +=4 ; + } +if (error) +printf ("check ddr4_pmu_train_imem code fail=%d\n" , error); +else +debug ("check ddr4_pmu_train_imem code pass\n" ); + +debug ("check ddr4_pmu_train_dmem code\n" ); + pr_from32 = dmem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; +for (i =0x0 ; i <DMEM_LEN ;) { + tmp32 = (readw (pr_to32) &0x0000ffff ); + pr_to32 +=4 ; + tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 ); +if (tmp32 !=readl (pr_from32)) { +printf ("%lx %lx\n" , pr_from32, pr_to32); + error++; + } + pr_from32 +=4 ; + pr_to32 +=4 ; + i +=4 ; + } + +if (error) +printf ("check ddr4_pmu_train_dmem code fail=%d" , error); +else +debug ("check ddr4_pmu_train_dmem code pass\n" ); +}board/freescale/mx8mq_evk/mx8mq_evk.c new file +156
-0@@ -0,0 +1,156 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <malloc.h> +#include <errno.h> +#include <asm/io.h> +#include <miiphy.h> +#include <netdev.h> +#include <asm/mach-imx/iomux-v3.h> +#include <asm-generic/gpio.h> +#include <fsl_esdhc.h> +#include <mmc.h> +#include <asm/arch/mx8mq_pins.h> +#include <asm/arch/sys_proto.h> +#include <asm/mach-imx/gpio.h> +#include <asm/mach-imx/mxc_i2c.h> +#include <asm/arch/clock.h> +#include <spl.h> +#include <power/pmic.h> +#include <power/pfuze100_pmic.h> +#include "../common/pfuze.h" + +DECLARE_GLOBAL_DATA_PTR ; + +#define QSPI_PAD_CTRL (PAD_CTL_DSE2 | PAD_CTL_HYS) + +#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1) + +#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) + +static iomux_v3_cfg_t const wdog_pads[] = { +IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B |MUX_PAD_CTRL (WDOG_PAD_CTRL ), +}; + +#ifdef CONFIG_FSL_QSPI +static iomux_v3_cfg_t const qspi_pads[] = { +IMX8MQ_PAD_NAND_ALE__QSPI_A_SCLK |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_CE0_B__QSPI_A_SS0_B |MUX_PAD_CTRL (QSPI_PAD_CTRL ), + +IMX8MQ_PAD_NAND_DATA00__QSPI_A_DATA0 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_DATA01__QSPI_A_DATA1 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_DATA02__QSPI_A_DATA2 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_DATA03__QSPI_A_DATA3 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +}; + +int board_qspi_init (void ) +{ +imx_iomux_v3_setup_multiple_pads (qspi_pads,ARRAY_SIZE (qspi_pads)); + +set_clk_qspi (); + +return 0 ; +} +#endif + +static iomux_v3_cfg_t const uart_pads[] = { +IMX8MQ_PAD_UART1_RXD__UART1_RX |MUX_PAD_CTRL (UART_PAD_CTRL ), +IMX8MQ_PAD_UART1_TXD__UART1_TX |MUX_PAD_CTRL (UART_PAD_CTRL ), +}; + +int board_early_init_f (void ) +{ +struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR ; + +imx_iomux_v3_setup_multiple_pads (wdog_pads,ARRAY_SIZE (wdog_pads)); +set_wdog_reset (wdog); + +imx_iomux_v3_setup_multiple_pads (uart_pads,ARRAY_SIZE (uart_pads)); + +return 0 ; +} + +int dram_init (void ) +{ +/* rom_pointer[1] contains the size of TEE occupies */ +if (rom_pointer[1 ]) + gd->ram_size =PHYS_SDRAM_SIZE - rom_pointer[1 ]; +else + gd->ram_size =PHYS_SDRAM_SIZE ; + +return 0 ; +} + +#ifdef CONFIG_FEC_MXC +#define FEC_RST_PAD IMX_GPIO_NR(1, 9) +static iomux_v3_cfg_t const fec1_rst_pads[] = { +IMX8MQ_PAD_GPIO1_IO09__GPIO1_IO9 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; + +static void setup_iomux_fec (void ) +{ +imx_iomux_v3_setup_multiple_pads (fec1_rst_pads, +ARRAY_SIZE (fec1_rst_pads)); + +gpio_request (IMX_GPIO_NR (1 ,9 ),"fec1_rst" ); +gpio_direction_output (IMX_GPIO_NR (1 ,9 ),0 ); +udelay (500 ); +gpio_direction_output (IMX_GPIO_NR (1 ,9 ),1 ); +} + +static int setup_fec (void ) +{ +struct iomuxc_gpr_base_regs *gpr = + (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; + +setup_iomux_fec (); + +/* Use 125M anatop REF_CLK1 for ENET1, not from external */ +clrsetbits_le32 (&gpr->gpr[1 ],BIT (13 ) |BIT (17 ),0 ); +return set_clk_enet (ENET_125MHZ ); +} + +int board_phy_config (struct phy_device *phydev) +{ +/* enable rgmii rxc skew and phy mode select to RGMII copper */ +phy_write (phydev,MDIO_DEVAD_NONE ,0x1d ,0x1f ); +phy_write (phydev,MDIO_DEVAD_NONE ,0x1e ,0x8 ); + +phy_write (phydev,MDIO_DEVAD_NONE ,0x1d ,0x05 ); +phy_write (phydev,MDIO_DEVAD_NONE ,0x1e ,0x100 ); + +if (phydev->drv->config) + phydev->drv->config (phydev); +return 0 ; +} +#endif + +int board_init (void ) +{ +board_qspi_init (); + +#ifdef CONFIG_FEC_MXC +setup_fec (); +#endif + +return 0 ; +} + +int board_mmc_get_env_dev (int devno) +{ +return devno; +} + +int board_late_init (void ) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +env_set ("board_name" ,"EVK" ); +env_set ("board_rev" ,"iMX8MQ" ); +#endif + +return 0 ; +}board/freescale/mx8mq_evk/spl.c new file +230
-0@@ -0,0 +1,230 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/arch/ddr.h> +#include <asm/arch/mx8mq_pins.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/clock.h> +#include <asm/mach-imx/iomux-v3.h> +#include <asm/mach-imx/gpio.h> +#include <asm/mach-imx/mxc_i2c.h> +#include <fsl_esdhc.h> +#include <mmc.h> +#include <power/pmic.h> +#include <power/pfuze100_pmic.h> +#include <spl.h> +#include "../common/pfuze.h" + +DECLARE_GLOBAL_DATA_PTR ; + +void spl_dram_init (void ) +{ +/* ddr init */ +ddr_init (); +} + +#define I2C_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) +struct i2c_pads_info i2c_pad_info1 = { + .scl = { + .i2c_mode =IMX8MQ_PAD_I2C1_SCL__I2C1_SCL |PC , + .gpio_mode =IMX8MQ_PAD_I2C1_SCL__GPIO5_IO14 |PC , + .gp =IMX_GPIO_NR (5 ,14 ), + }, + .sda = { + .i2c_mode =IMX8MQ_PAD_I2C1_SDA__I2C1_SDA |PC , + .gpio_mode =IMX8MQ_PAD_I2C1_SDA__GPIO5_IO15 |PC , + .gp =IMX_GPIO_NR (5 ,15 ), + }, +}; + +#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 12) +#define USDHC1_PWR_GPIO IMX_GPIO_NR(2, 10) +#define USDHC2_PWR_GPIO IMX_GPIO_NR(2, 19) + +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 USDHC1_BASE_ADDR : + ret =1 ; +break ; +case USDHC2_BASE_ADDR : + ret = !gpio_get_value (USDHC2_CD_GPIO ); +return ret; + } + +return 1 ; +} + +#define USDHC_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE | \ + PAD_CTL_FSEL2) + +static iomux_v3_cfg_t const usdhc1_pads[] = { +IMX8MQ_PAD_SD1_CLK__USDHC1_CLK |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_CMD__USDHC1_CMD |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA0__USDHC1_DATA0 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA1__USDHC1_DATA1 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA2__USDHC1_DATA2 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA3__USDHC1_DATA3 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA4__USDHC1_DATA4 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA5__USDHC1_DATA5 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA6__USDHC1_DATA6 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA7__USDHC1_DATA7 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_RESET_B__GPIO2_IO10 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; + +static iomux_v3_cfg_t const usdhc2_pads[] = { +IMX8MQ_PAD_SD2_CLK__USDHC2_CLK |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_CMD__USDHC2_CMD |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA0__USDHC2_DATA0 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA1__USDHC2_DATA1 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA2__USDHC2_DATA2 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA3__USDHC2_DATA3 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_CD_B__GPIO2_IO12 |MUX_PAD_CTRL (NO_PAD_CTRL ), +IMX8MQ_PAD_SD2_RESET_B__GPIO2_IO19 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; + +static struct fsl_esdhc_cfg usdhc_cfg[2 ] = { + {USDHC1_BASE_ADDR ,0 ,8 }, + {USDHC2_BASE_ADDR ,0 ,4 }, +}; + +int board_mmc_init (bd_t *bis) +{ +int i, ret; +/* +* According to the board_mmc_init() the following map is done: +* (U-Boot device node) (Physical Port) +* mmc0 USDHC1 +* mmc1 USDHC2 +*/ +for (i =0 ; i <CONFIG_SYS_FSL_USDHC_NUM ; i++) { +switch (i) { +case 0 : +init_clk_usdhc (0 ); + usdhc_cfg[0 ].sdhc_clk =mxc_get_clock (USDHC1_CLK_ROOT ); +imx_iomux_v3_setup_multiple_pads ( + usdhc1_pads,ARRAY_SIZE (usdhc1_pads)); +gpio_request (USDHC1_PWR_GPIO ,"usdhc1_reset" ); +gpio_direction_output (USDHC1_PWR_GPIO ,0 ); +udelay (500 ); +gpio_direction_output (USDHC1_PWR_GPIO ,1 ); +break ; +case 1 : +init_clk_usdhc (1 ); + usdhc_cfg[1 ].sdhc_clk =mxc_get_clock (USDHC2_CLK_ROOT ); +imx_iomux_v3_setup_multiple_pads ( + usdhc2_pads,ARRAY_SIZE (usdhc2_pads)); +gpio_request (USDHC2_PWR_GPIO ,"usdhc2_reset" ); +gpio_direction_output (USDHC2_PWR_GPIO ,0 ); +udelay (500 ); +gpio_direction_output (USDHC2_PWR_GPIO ,1 ); +break ; +default : +printf ("Warning: you configured more USDHC controllers(%d) than supported by the board\n" , i +1 ); +return -EINVAL ; + } + + ret =fsl_esdhc_initialize (bis, &usdhc_cfg[i]); +if (ret) +return ret; + } + +return 0 ; +} + +#ifdef CONFIG_POWER +#define I2C_PMIC 0 +int power_init_board (void ) +{ +struct pmic *p; +int ret; +unsigned int reg; + + ret =power_pfuze100_init (I2C_PMIC ); +if (ret) +return -ENODEV ; + + p =pmic_get ("PFUZE100" ); + ret =pmic_probe (p); +if (ret) +return -ENODEV ; + +pmic_reg_read (p,PFUZE100_DEVICEID , ®); +printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); + +pmic_reg_read (p,PFUZE100_SW3AVOL , ®); +if ((reg &0x3f ) !=0x18 ) { + reg &= ~0x3f ; + reg |=0x18 ; +pmic_reg_write (p,PFUZE100_SW3AVOL , reg); + } + + ret =pfuze_mode_init (p,APS_PFM ); +if (ret <0 ) +return ret; + +return 0 ; +} +#endif + +void spl_board_init (void ) +{ +enable_tzc380 (); + +/* Adjust pmic voltage to 1.0V for 800M */ +setup_i2c (0 ,CONFIG_SYS_I2C_SPEED ,0x7f , &i2c_pad_info1); + +power_init_board (); + +/* DDR initialization */ +spl_dram_init (); + +/* Serial download mode */ +if (is_usb_boot ()) { +puts ("Back to ROM, SDP\n" ); +restore_boot_params (); + } +puts ("Normal Boot\n" ); +} + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match (const char *name) +{ +/* Just empty function now - can't decide what to choose */ +debug ("%s: %s\n" , __func__, name); + +return 0 ; +} +#endif + +void board_init_f (ulong dummy) +{ +/* Clear global data */ +memset ((void *)gd,0 ,sizeof (gd_t)); + +arch_cpu_init (); + +init_uart_clk (0 ); + +board_early_init_f (); + +timer_init (); + +preloader_console_init (); + +/* Clear the BSS. */ +memset (__bss_start,0 , __bss_end - __bss_start); + +board_init_r (NULL ,0 ); +}configs/mx8mq_evk_defconfig new file +27
-0@@ -0,0 +1,27 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX8M=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_TARGET_MX8MQ_EVK=y +CONFIG_DEFAULT_DEVICE_TREE="fsl-imx8mq-evk" +CONFIG_FIT=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_SPL=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_REGULATOR=y +CONFIG_OF_CONTROL=y +CONFIG_DM_GPIO=y +CONFIG_DM_I2C=y +CONFIG_DM_MMC=y +CONFIG_DM_ETH=y +CONFIG_PINCTRL=y +CONFIG_DM_PMIC_PFUZE100=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_PFUZE100=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_THERMAL=y +CONFIG_FS_FAT=yinclude/configs/mx8mq_evk.h new file +259
-0@@ -0,0 +1,269 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __IMX8M_EVK_H +#define __IMX8M_EVK_H + +#include <linux/sizes.h> +#include <asm/arch/imx-regs.h> + +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CSF_SIZE 0x2000/* 8K region */ +#endif + +#define CONFIG_SPL_FRAMEWORK +#define CONFIG_SPL_TEXT_BASE 0x7E1000 +#define CONFIG_SPL_MAX_SIZE (124 * 1024) +#define CONFIG_SYS_MONITOR_LEN (512 * 1024) +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 + +#ifdef CONFIG_SPL_BUILD +/*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/ +#define CONFIG_SPL_WATCHDOG_SUPPORT +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT +#define CONFIG_SPL_POWER_SUPPORT +#define CONFIG_SPL_I2C_SUPPORT +#define CONFIG_SPL_BOARD_INIT +#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv8/u-boot-spl.lds" +#define CONFIG_SPL_STACK 0x187FF0 +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_SUPPORT +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_GPIO_SUPPORT +#define CONFIG_SPL_MMC_SUPPORT +#define CONFIG_SPL_BSS_START_ADDR 0x00180000 +#define CONFIG_SPL_BSS_MAX_SIZE 0x2000/* 8 KB */ +#define CONFIG_SYS_SPL_MALLOC_START 0x00182000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x2000/* 8 KB */ +#define CONFIG_SYS_ICACHE_OFF +#define CONFIG_SYS_DCACHE_OFF + +#define CONFIG_SPL_ABORT_ON_RAW_IMAGE + +#undef CONFIG_DM_MMC +#undef CONFIG_DM_PMIC +#undef CONFIG_DM_PMIC_PFUZE100 + +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */ +#define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */ +#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */ + +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + +#define CONFIG_POWER +#define CONFIG_POWER_I2C +#define CONFIG_POWER_PFUZE100 +#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 +#endif + +#define CONFIG_REMAKE_ELF + +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_BOARD_LATE_INIT + +#undef CONFIG_CMD_EXPORTENV +#undef CONFIG_CMD_IMPORTENV +#undef CONFIG_CMD_IMLS + +#undef CONFIG_CMD_CRC32 +#undef CONFIG_BOOTM_NETBSD + +/* ENET Config */ +/* ENET1 */ +#if defined(CONFIG_CMD_NET ) +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_MII +#define CONFIG_MII +#define CONFIG_ETHPRIME "FEC" + +#define CONFIG_FEC_MXC +#define CONFIG_FEC_XCV_TYPE RGMII +#define CONFIG_FEC_MXC_PHYADDR 0 +#define FEC_QUIRK_ENET_MAC + +#define CONFIG_PHY_GIGE +#define IMX_FEC_BASE 0x30BE0000 + +#define CONFIG_PHYLIB +#define CONFIG_PHY_ATHEROS +#endif + +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + "clk_ignore_unused "\ + "\0" \ + "initrd_addr=0x43800000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;booti ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ +/* Initial environment variables */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ + "script=boot.scr\0" \ + "image=Image\0" \ + "console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200\0" \ + "fdt_addr=0x43000000\0" \ + "fdt_high=0xffffffffffffffff\0" \ + "boot_fdt=try\0" \ + "fdt_file=fsl-imx8mq-evk.dtb\0" \ + "initrd_addr=0x43800000\0" \ + "initrd_high=0xffffffffffffffff\0" \ + "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ + "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ + "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ + "mmcautodetect=yes\0" \ + "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \ + "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "bootscript=echo Running bootscript from mmc ...; " \ + "source\0" \ + "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ + "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "mmcboot=echo Booting from mmc ...; " \ + "run mmcargs; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if run loadfdt; then " \ + "booti ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "else " \ + "echo wait for boot; " \ + "fi;\0" \ + "netargs=setenv bootargs console=${console} " \ + "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ + "netboot=echo Booting from net ...; " \ + "run netargs; " \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "${get_cmd} ${loadaddr} ${image}; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ + "booti ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "else " \ + "booti; " \ + "fi;\0" + +#define CONFIG_BOOTCOMMAND \ + "mmc dev ${mmcdev}; if mmc rescan; then " \ + "if run loadbootscript; then " \ + "run bootscript; " \ + "else " \ + "if run loadimage; then " \ + "run mmcboot; " \ + "else run netboot; " \ + "fi; " \ + "fi; " \ + "else booti ${loadaddr} - ${fdt_addr}; fi" + +/* Link Definitions */ +#define CONFIG_LOADADDR 0x40480000 +#define CONFIG_SYS_TEXT_BASE 0x40200000 + +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR + +#define CONFIG_SYS_INIT_RAM_ADDR 0x40000000 +#define CONFIG_SYS_INIT_RAM_SIZE 0x80000 +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + +#define CONFIG_ENV_OVERWRITE +#define CONFIG_ENV_OFFSET (64 * SZ_64K) +#define CONFIG_ENV_SIZE 0x1000 +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_MMC_ENV_DEV 1/* USDHC2 */ +#define CONFIG_MMCROOT "/dev/mmcblk1p2"/* USDHC2 */ + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (2 * 1024)) * 1024) + +#define CONFIG_SYS_SDRAM_BASE 0x40000000 +#define PHYS_SDRAM 0x40000000 +#define PHYS_SDRAM_SIZE 0xC0000000/* 3GB DDR */ +#define CONFIG_NR_DRAM_BANKS 1 + +#define CONFIG_BAUDRATE 115200 + +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE UART1_BASE_ADDR + +/* Monitor Command Prompt */ +#undef CONFIG_SYS_PROMPT +#define CONFIG_SYS_PROMPT "u-boot=> " +#define CONFIG_SYS_LONGHELP +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_CBSIZE 1024 +#define CONFIG_SYS_MAXARGS 64 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_CMDLINE_EDITING + +#define CONFIG_IMX_BOOTAUX + +#define CONFIG_CMD_MMC +#define CONFIG_FSL_ESDHC +#define CONFIG_FSL_USDHC + +#define CONFIG_SYS_FSL_USDHC_NUM 2 +#define CONFIG_SYS_FSL_ESDHC_ADDR 0 + +#define CONFIG_DOS_PARTITION +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_EXT4 +#define CONFIG_CMD_EXT4_WRITE +#define CONFIG_CMD_FAT + +#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ +#define CONFIG_SYS_MMC_IMG_LOAD_PART 1 + +#define CONFIG_FSL_QSPI /* enable the QUADSPI driver */ +#ifdef CONFIG_FSL_QSPI +#define CONFIG_CMD_SF +#define CONFIG_SPI_FLASH +#define CONFIG_SPI_FLASH_STMICRO +#define CONFIG_SPI_FLASH_BAR +#define CONFIG_SF_DEFAULT_BUS 0 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 40000000 +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 + +#define FSL_QSPI_FLASH_SIZE (SZ_32M) +#define FSL_QSPI_FLASH_NUM 1 +#endif + +#define CONFIG_MXC_GPIO + +#define CONFIG_MXC_OCOTP +#define CONFIG_CMD_FUSE +include/configs/mx8mq_evk.h line 269
Quoted 10 lines
include/configs/mx8mq_evk.h new file +10
-0+/* I2C Configs */ +#define CONFIG_SYS_I2C_SPEED 100000 + +#define CONFIG_OF_SYSTEM_SETUP + +#ifndef CONFIG_SPL_BUILD +#define CONFIG_DM_PMIC +#endif + +#endif Im open to suggestions how to go on. The big isssues with the patchset is IMHO the cryptical part with the LPDDR settings. We could start to merge most of patches - they were already reviewed and they are freee of comments.
Fabio, do you have a best approach ?
Best regards,
StefanoSignature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Hi Peng,
Quoted 3 lines · Peng Fan
Quoted 2 lines · Stefano Babic
Hi Peng,
[snip]
Quoted 13 lines
Quoted 13 lines · Peng Fan
board/freescale/mx8mq_evk/README line 28
Quoted 7 lines
board/freescale/mx8mq_evk/README new file +6
-0+Get the ddr firmware and tools +==================== +Note: Better to use NXP released yocto to get the firmware in case + there is new releases. +https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.2.bin +imx-mkimage: https://source.codeaurora.org/external/imx/imx-mkimage/I am just asking which is the plan here. This is a fork of U-Boot's mkimage tool. I did not see attempts to push changes to imximage mainline.
Quoted 6 lines
Quoted 3 lines
Any thoughts ? This means that it is not possible inside U-Boot to produce a U-Boot image, but we need an external tool that was *based* on U-Boot code....
I'll try to develop the support in u-boot, but I could not commit. The new format is a bit complicated.
Can it help if we introduce a new image format parallel to the older ? This introduce a new tools/<new imx format> that is suitable just for i.MX8. I understand that merging with current code is difficult and it is easy to introduce breakages.
Quoted 6 lines
Quoted 4 lines
I have not understood the usage of firmware-imx-7.2.bin. You ask to load it, but it is not used in further commands.
My bad. Diego's patch has that.
ok, thanks.
Best regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Hi Stefano,
Quoted 35 lines · Stefano Babic
Hi Peng,
Quoted 24 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
The boot log with Arm trusted firmware console enabled:
"
U-Boot SPL 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56)
PMIC: PFUZE100 ID=0x10
Normal Boot
Trying to boot from MMC2NOTICE: Configureing TZASC380 NOTICE: BL31: v1.4(release):o8.0.0_1.3.0_8m-prc-20171211-6-g54fb0797-dirty NOTICE: BL31: Built : 07:17:16, Jan 8 2018 NOTICE: sip svc initU-Boot 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56 +0800)
CPU: Freescale i.MX8MQ rev2.0 at 1000 MHz Reset cause: POR Model: Freescale i.MX8MQ EVK DRAM: 3 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1Using default environment
Quoted 7 lines
In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0u-boot=>
"
Quoted 7 lines
If I see the output here, I am expecting the setup forthe working peripherals. Without ethernet working, why do we activate FEC and set the PHY ?
I would suggest to start with the minimal (=that is, all that is working), adding later when peripherals will be successfully added and tested.
ok. I'll minimize the changes.
Quoted 590 lines
Quoted 575 lines
Signed-off-by Peng Fan <[email protected]>Cc Fabio Estevam <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/include/asm/arch-mx8m/ddr.h | 9 + arch/arm/mach-imx/mx8m/Kconfig | 12 + board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + include/configs/mx8mq_evk.h | 269 ++++++ 14 files changed, 2819 insertions(+) create mode 100644 arch/arm/dts/fsl-imx8mq-evk.dts create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.harch/arm/dts/Makefile +2
-0@@ -391,6 +391,8 @@ dtb-$(CONFIG_MX7) += imx7-colibri.dtb \ dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb +dtb-$(CONFIG_ARCH_MX8M) += fsl-imx8mq-evk.dtb + dtb-$(CONFIG_RCAR_GEN3) += \ r8a7795-h3ulcb.dtb \ r8a7795-salvator-x.dtb \arch/arm/dts/fsl-imx8mq-evk.dts new file +424
-0@@ -0,0 +1,424 @@ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +/* First 128KB is for PSCI ATF. */ +/memreserve/ 0x40000000 0x00020000; + +#include "fsl-imx8mq.dtsi" + +/ { + model = "Freescale i.MX8MQ EVK"; + compatible = "fsl,imx8mq-evk", "fsl,imx8mq"; + + chosen { + bootargs = "console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200"; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + reg_usdhc2_vmmc: usdhc2_vmmc { + compatible = "regulator-fixed"; + regulator-name = "VSD_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + + ledpwm2 { + label = "PWM2"; + pwms = <&pwm2 0 50000>; + max-brightness = <255>; + }; + }; +}; + +&iomuxc { + pinctrl-names = "default"; + + imx8mq-evk { + pinctrl_fec1: fec1grp { + fsl,pins = < + MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC 0x3 + MX8MQ_IOMUXC_ENET_MDIO_ENET1_MDIO 0x23 + MX8MQ_IOMUXC_ENET_TD3_ENET1_RGMII_TD3 0x1f + MX8MQ_IOMUXC_ENET_TD2_ENET1_RGMII_TD2 0x1f + MX8MQ_IOMUXC_ENET_TD1_ENET1_RGMII_TD1 0x1f + MX8MQ_IOMUXC_ENET_TD0_ENET1_RGMII_TD0 0x1f + MX8MQ_IOMUXC_ENET_RD3_ENET1_RGMII_RD3 0x91 + MX8MQ_IOMUXC_ENET_RD2_ENET1_RGMII_RD2 0x91 + MX8MQ_IOMUXC_ENET_RD1_ENET1_RGMII_RD1 0x91 + MX8MQ_IOMUXC_ENET_RD0_ENET1_RGMII_RD0 0x91 + MX8MQ_IOMUXC_ENET_TXC_ENET1_RGMII_TXC 0x1f + MX8MQ_IOMUXC_ENET_RXC_ENET1_RGMII_RXC 0x91 + MX8MQ_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL 0x91 + MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL 0x1f + MX8MQ_IOMUXC_GPIO1_IO09_GPIO1_IO9 0x19 + >; + }; + + pinctrl_i2c1: i2c1grp { + fsl,pins = < + MX8MQ_IOMUXC_I2C1_SCL_I2C1_SCL 0x4000007f + MX8MQ_IOMUXC_I2C1_SDA_I2C1_SDA 0x4000007f + >; + }; + + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX8MQ_IOMUXC_I2C2_SCL_I2C2_SCL 0x4000007f + MX8MQ_IOMUXC_I2C2_SDA_I2C2_SDA 0x4000007f + >; + }; + + pinctrl_pwm2: pwm2grp { + fsl,pins = < + MX8MQ_IOMUXC_GPIO1_IO13_PWM2_OUT 0x16 + >; + }; + + pinctrl_qspi: qspigrp { + fsl,pins = < + MX8MQ_IOMUXC_NAND_ALE_QSPI_A_SCLK 0x82 + MX8MQ_IOMUXC_NAND_CE0_B_QSPI_A_SS0_B 0x82 + MX8MQ_IOMUXC_NAND_DATA00_QSPI_A_DATA0 0x82 + MX8MQ_IOMUXC_NAND_DATA01_QSPI_A_DATA1 0x82 + MX8MQ_IOMUXC_NAND_DATA02_QSPI_A_DATA2 0x82 + MX8MQ_IOMUXC_NAND_DATA03_QSPI_A_DATA3 0x82 + + >; + }; + + pinctrl_usdhc1: usdhc1grp { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x83 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc3 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc3 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc3 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc3 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc3 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc3 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc3 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc3 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc3 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x83 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc1_100mhz: usdhc1grp100mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x85 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc5 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc5 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc5 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc5 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc5 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc5 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc5 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc5 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc5 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x85 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc1_200mhz: usdhc1grp200mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x87 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc7 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc7 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc7 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc7 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc7 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc7 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc7 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc7 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc7 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x87 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc2_gpio: usdhc2grpgpio { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12 0x41 + MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19 0x41 + >; + }; + + pinctrl_usdhc2: usdhc2grp { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x83 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc3 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc3 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc3 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc3 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc3 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_usdhc2_100mhz: usdhc2grp100mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x85 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc5 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc5 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc5 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc5 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc5 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_usdhc2_200mhz: usdhc2grp200mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x87 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc7 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc7 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc7 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc7 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc7 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_sai2: sai2grp { + fsl,pins = < + MX8MQ_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC 0xd6 + MX8MQ_IOMUXC_SAI2_TXC_SAI2_TX_BCLK 0xd6 + MX8MQ_IOMUXC_SAI2_MCLK_SAI2_MCLK 0xd6 + MX8MQ_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 0xd6 + MX8MQ_IOMUXC_GPIO1_IO08_GPIO1_IO8 0xd6 + >; + }; + + pinctrl_wdog: wdoggrp { + fsl,pins = < + MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6 + >; + }; + }; +}; + +&fec1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_fec1>; + phy-mode = "rgmii-id"; + phy-handle = <ðphy0>; + fsl,magic-packet; + status = "okay"; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethphy0: ethernet-phy at 0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + at803x,led-act-blind-workaround; + at803x,eee-disabled; + }; + }; +}; + +&i2c1 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + pmic: pfuze100 at 08 { + compatible = "fsl,pfuze100"; + reg = <0x08>; + + regulators { + sw1a_reg: sw1ab { + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1875000>; + regulator-always-on; + }; + + sw1c_reg: sw1c { + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1875000>; + regulator-always-on; + }; + + sw2_reg: sw2 { + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + sw3a_reg: sw3ab { + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <1975000>; + regulator-always-on; + }; + + sw4_reg: sw4 { + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + swbst_reg: swbst { + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5150000>; + }; + + snvs_reg: vsnvs { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + }; + + vref_reg: vrefddr { + 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>; + regulator-always-on; + }; + + vgen3_reg: vgen3 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + 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>; + }; + }; + }; +}; + +&i2c2 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c2>; + status = "disabled"; +}; + +&pwm2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pwm2>; + status = "okay"; +}; + +&lcdif { + status = "okay"; + disp-dev = "mipi_dsi_northwest"; + display = <&display0>; + + display0: display at 0 { + bits-per-pixel = <24>; + bus-width = <24>; + + display-timings { + native-mode = <&timing0>; + timing0: timing0 { + clock-frequency = <9200000>; + hactive = <480>; + vactive = <272>; + hfront-porch = <8>; + hback-porch = <4>; + hsync-len = <41>; + vback-porch = <2>; + vfront-porch = <4>; + vsync-len = <10>; + + hsync-active = <0>; + vsync-active = <0>; + de-active = <1>; + pixelclk-active = <0>; + }; + }; + }; +}; + +&qspi { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_qspi>; + status = "okay"; + + flash0: n25q256a at 0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + compatible = "micron,n25q256a"; + spi-max-frequency = <29000000>; + spi-nor,ddr-quad-read-dummy = <6>; + }; +}; + +&usdhc1 { + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc1>; + pinctrl-1 = <&pinctrl_usdhc1_100mhz>; + pinctrl-2 = <&pinctrl_usdhc1_200mhz>; + bus-width = <8>; + non-removable; + status = "okay"; +}; + +&usdhc2 { + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; + pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; + pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; + bus-width = <4>; + cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; + vmmc-supply = <®_usdhc2_vmmc>; + status = "okay"; +}; + +&wdog1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_wdog>; + fsl,ext-reset-output; + status = "okay"; +};arch/arm/include/asm/arch-mx8m/ddr.h +9
-0@@ -353,4 +353,13 @@ enum msg_response { TRAIN_FAIL = 0xff, }; +enum fw_type { +FW_1D_IMAGE , +FW_2D_IMAGE , +}; + +void ddr_init (void ); +void ddr_load_train_code (enum fw_type type); +void lpddr4_800M_cfg_phy (void ); +void dram_pll_init (void );#endif arch/arm/mach-imx/mx8m/Kconfig +12
-0@@ -7,4 +7,16 @@ config MX8M config SYS_SOC default "mx8m" +choice + prompt "NXP i.MX8M board select" + optional + +config TARGET_MX8MQ_EVK + bool "mx8mq_evk" + select MX8M + +endchoice + +source "board/freescale/mx8mq_evk/Kconfig" + endifboard/freescale/mx8mq_evk/Kconfig new file +12
-0@@ -0,0 +1,12 @@ +if TARGET_MX8MQ_EVK + +config SYS_BOARD + default "mx8mq_evk" + +config SYS_VENDOR + default "freescale" + +config SYS_CONFIG_NAME + default "mx8mq_evk" + +endifboard/freescale/mx8mq_evk/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright 2017 NXP +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += mx8mq_evk.o + +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +obj-y += ddr/ddr_init.o ddr/ddrphy_train.o ddr/helper.o +endifboard/freescale/mx8mq_evk/README new file +18
-0@@ -0,0 +1,47 @@ +U-Boot for the NXP i.MX8MQ EVK board + +Quick Start +==================== +- Build the ARM Trusted firmware binary +- Build U-Boot +- Get ddr fimware and tools +- Generate flash.bin using imx-mkimage +- Boot + +Get and Build the ARM Trusted firmware +==================== +Get ATF from: https://source.codeaurora.org/external/imx/imx-atf +$ make PLAT=imx8mq bl31 + +Build U-Boot +==================== +$ export ARCH=arm64board/freescale/mx8mq_evk/README line 28
Quoted 10 lines
board/freescale/mx8mq_evk/README new file +10
-0+$ export CROSS_COMPILE=aarch64-poky-linux- +$ make mx8mq_evk_defconfig +$ make + +Get the ddr firmware and tools +==================== +Note: Better to use NXP released yocto to get the firmware in case + there is new releases. +https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.2.bin +imx-mkimage: https://source.codeaurora.org/external/imx/imx-mkimage/I am just asking which is the plan here. This is a fork of U-Boot's mkimage tool. I did not see attempts to push changes to imximage mainline.
Quoted 3 lines
Any thoughts ? This means that it is not possible inside U-Boot to produce a U-Boot image, but we need an external tool that was *based* on U-Boot code....
There are many containers, for i.MX8MQ, there are two containers. For i.MX8QM, there are more and more containers.
Also take secure boot into consideration, it is hard to extend the current mkimage.
For long run, I could look into the support in u-boot, but I could not commit.
Quoted 54 lines
Quoted 54 lines
board/freescale/mx8mq_evk/README new file +19
-0+ +Generate flash.bin using imx-mkimage +==================== +Copy bl31.bin u-boot-nodtb.bin u-boot-spl.bin fsl-imx8mq-evk.dtb to + imx-mkimage/iMX8M +Copy lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_1d_imem.bin + lpddr4_pmu_train_2d_dmem.bin lpddr4_pmu_train_2d_imem.bin to + imx-mkimage/iMX8M +If you want to run with HDMI, copy signed_hdmi_imx8m.bin to imx-mkimage/iMX8M + +make SOC=iMX8M flash_hdmi_spl_uboot or make SOC=iMX8M flash_spl_uboot to +generate flash.bin. + +Burn the flash.bin to MicroSD card offset 33KB +$sudo dd if=iMX8M/flash.bin of=/dev/sd[x] bs=1024 seek=33 + +Boot +==================== +Set Boot switch SW801: 1100 and Bmode: 10 to boot from Micro SD.board/freescale/mx8mq_evk/ddr/ddr_init.c new file +28
-0@@ -0,0 +1,246 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/ddr.h> +#include <asm/arch/sys_proto.h> +#include <linux/iopoll.h> + +struct imx8m_ddrc_regs *ddrc_regs = (struct imx8m_ddrc_regs *)DDRC_IPS_BASE_ADDR (0 ); +static struct gpc_reg *gpc_reg = (struct gpc_reg *)GPC_BASE_ADDR ; +static struct src *src = (struct src *)SRC_BASE_ADDR ; + +void lpddr4_800mhz_cfg_umctl2 (void ) +{ +writel (0x00000001 , &ddrc_regs->dbg1); +writel (0x00000001 , &ddrc_regs->pwrctl); +writel (0x83080020 , &ddrc_regs->mstr); +writel (0x006180e0 , &ddrc_regs->rfshtmg); +writel (0xc003061b , &ddrc_regs->init0); +writel (0x009d0000 , &ddrc_regs->init1); +writel (0x0000fe05 , &ddrc_regs->init2); +writel (0x00d4002d , &ddrc_regs->init3);
Quoted 8 lines
board/freescale/mx8mq_evk/ddr/ddr_init.c line 34
Quoted 6 lines
board/freescale/mx8mq_evk/ddr/ddr_init.c new file +6
-0+writel (0x00310008 , &ddrc_regs->init4); +writel (0x00040009 , &ddrc_regs->init5); +writel (0x0046004d , &ddrc_regs->init6); +writel (0x0005004d , &ddrc_regs->init7); +writel (0x00000979 , &ddrc_regs->rankctl); +writel (0x1a203522 , &ddrc_regs->dramtmg0);I guess we will not have any improvement here, at least for first version.
I'll give a try to improve the ddr controller part. For ddr phy part, it is impossible to do that, it was autogenerated by tool from synopsys.
Thanks,
Peng
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Hi Peng,
Quoted 6 lines · Peng Fan
Quoted 2 lines
I guess we will not have any improvement here, at least for first version.
I'll give a try to improve the ddr controller part. For ddr phy part, it is impossible to do that, it was autogenerated by tool from synopsys.
ok, I supposed something of this type - no human being will generate this mess :-).
Anyway, this is fine if we can describe how it works. We have already such a case with Altera SOCFPGA: the Altera's tool generates headers for DDR and they are just imported into u-boot. Search for "qts" directories, for example ./board/altera/arria5-socdk/qts. But if these files are generated, we should also be sure that we do not need to change them in U-Boot: tool generates DDR files, and we import them in U-Boot. If tool produces them in another format such as a table, we just need a small converter (python, perl, ...) that translates the tables into C header / files (as we already do for assembly, for example). In this way the chain is not broken: synopsys generates the files, we import them into U-Boot and this becomes straightforward for board maintainers.
Best regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v5 31/31 imx: add i.MX8MQ EVK support
In reply to Peng FanHi there,
Quoted 3 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
First off, I'd like to express my gratitude for this port: the i.MX8 looks like a great platform and it's really nice to see support for it land in U-Boot!
Regarding the integration of i.MX8 with upstream software in general:
are there plans to upstream the ARM Trusted Firmware port for i.MX8? It would be great to have both U-Boot and ATF upstream support to achieve a boot chain with (mostly-)free and upstream software.
On that note, are there proprietary components involved in the boot process, other than the already-identified DDR training firmware for the DDR PHY?
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
Thanks in advance for your time and consideration of these questions!
Cheers,
Paul
Quoted 2,973 lines
The boot log with Arm trusted firmware console enabled:
"
U-Boot SPL 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56)
PMIC: PFUZE100 ID=0x10
Normal Boot
Trying to boot from MMC2NOTICE: Configureing TZASC380 NOTICE: BL31: v1.4(release):o8.0.0_1.3.0_8m-prc-20171211-6-g54fb0797-dirty NOTICE: BL31: Built : 07:17:16, Jan 8 2018 NOTICE: sip svc initU-Boot 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56 +0800)
CPU: Freescale i.MX8MQ rev2.0 at 1000 MHz Reset cause: POR Model: Freescale i.MX8MQ EVK DRAM: 3 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1Using default environment
In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0u-boot=>
"Signed-off-by Peng Fan <[email protected]>Cc Fabio Estevam <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/include/asm/arch-mx8m/ddr.h | 9 + arch/arm/mach-imx/mx8m/Kconfig | 12 + board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + include/configs/mx8mq_evk.h | 269 ++++++ 14 files changed, 2819 insertions(+) create mode 100644 arch/arm/dts/fsl-imx8mq-evk.dts create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.harch/arm/dts/Makefile +2
-0@@ -391,6 +391,8 @@ dtb-$(CONFIG_MX7) += imx7-colibri.dtb \ dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb +dtb-$(CONFIG_ARCH_MX8M) += fsl-imx8mq-evk.dtb + dtb-$(CONFIG_RCAR_GEN3) += \ r8a7795-h3ulcb.dtb \ r8a7795-salvator-x.dtb \arch/arm/dts/fsl-imx8mq-evk.dts new file +424
-0@@ -0,0 +1,424 @@ +/* + * Copyright (C) 2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/dts-v1/; + +/* First 128KB is for PSCI ATF. */ +/memreserve/ 0x40000000 0x00020000; + +#include "fsl-imx8mq.dtsi" + +/ { + model = "Freescale i.MX8MQ EVK"; + compatible = "fsl,imx8mq-evk", "fsl,imx8mq"; + + chosen { + bootargs = "console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200"; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + reg_usdhc2_vmmc: usdhc2_vmmc { + compatible = "regulator-fixed"; + regulator-name = "VSD_3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + + ledpwm2 { + label = "PWM2"; + pwms = <&pwm2 0 50000>; + max-brightness = <255>; + }; + }; +}; + +&iomuxc { + pinctrl-names = "default"; + + imx8mq-evk { + pinctrl_fec1: fec1grp { + fsl,pins = < + MX8MQ_IOMUXC_ENET_MDC_ENET1_MDC 0x3 + MX8MQ_IOMUXC_ENET_MDIO_ENET1_MDIO 0x23 + MX8MQ_IOMUXC_ENET_TD3_ENET1_RGMII_TD3 0x1f + MX8MQ_IOMUXC_ENET_TD2_ENET1_RGMII_TD2 0x1f + MX8MQ_IOMUXC_ENET_TD1_ENET1_RGMII_TD1 0x1f + MX8MQ_IOMUXC_ENET_TD0_ENET1_RGMII_TD0 0x1f + MX8MQ_IOMUXC_ENET_RD3_ENET1_RGMII_RD3 0x91 + MX8MQ_IOMUXC_ENET_RD2_ENET1_RGMII_RD2 0x91 + MX8MQ_IOMUXC_ENET_RD1_ENET1_RGMII_RD1 0x91 + MX8MQ_IOMUXC_ENET_RD0_ENET1_RGMII_RD0 0x91 + MX8MQ_IOMUXC_ENET_TXC_ENET1_RGMII_TXC 0x1f + MX8MQ_IOMUXC_ENET_RXC_ENET1_RGMII_RXC 0x91 + MX8MQ_IOMUXC_ENET_RX_CTL_ENET1_RGMII_RX_CTL 0x91 + MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL 0x1f + MX8MQ_IOMUXC_GPIO1_IO09_GPIO1_IO9 0x19 + >; + }; + + pinctrl_i2c1: i2c1grp { + fsl,pins = < + MX8MQ_IOMUXC_I2C1_SCL_I2C1_SCL 0x4000007f + MX8MQ_IOMUXC_I2C1_SDA_I2C1_SDA 0x4000007f + >; + }; + + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX8MQ_IOMUXC_I2C2_SCL_I2C2_SCL 0x4000007f + MX8MQ_IOMUXC_I2C2_SDA_I2C2_SDA 0x4000007f + >; + }; + + pinctrl_pwm2: pwm2grp { + fsl,pins = < + MX8MQ_IOMUXC_GPIO1_IO13_PWM2_OUT 0x16 + >; + }; + + pinctrl_qspi: qspigrp { + fsl,pins = < + MX8MQ_IOMUXC_NAND_ALE_QSPI_A_SCLK 0x82 + MX8MQ_IOMUXC_NAND_CE0_B_QSPI_A_SS0_B 0x82 + MX8MQ_IOMUXC_NAND_DATA00_QSPI_A_DATA0 0x82 + MX8MQ_IOMUXC_NAND_DATA01_QSPI_A_DATA1 0x82 + MX8MQ_IOMUXC_NAND_DATA02_QSPI_A_DATA2 0x82 + MX8MQ_IOMUXC_NAND_DATA03_QSPI_A_DATA3 0x82 + + >; + }; + + pinctrl_usdhc1: usdhc1grp { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x83 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc3 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc3 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc3 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc3 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc3 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc3 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc3 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc3 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc3 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x83 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc1_100mhz: usdhc1grp100mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x85 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc5 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc5 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc5 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc5 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc5 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc5 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc5 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc5 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc5 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x85 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc1_200mhz: usdhc1grp200mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x87 + MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc7 + MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc7 + MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc7 + MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc7 + MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc7 + MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc7 + MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc7 + MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc7 + MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc7 + MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x87 + MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 + >; + }; + + pinctrl_usdhc2_gpio: usdhc2grpgpio { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CD_B_GPIO2_IO12 0x41 + MX8MQ_IOMUXC_SD2_RESET_B_GPIO2_IO19 0x41 + >; + }; + + pinctrl_usdhc2: usdhc2grp { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x83 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc3 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc3 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc3 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc3 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc3 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_usdhc2_100mhz: usdhc2grp100mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x85 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc5 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc5 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc5 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc5 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc5 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_usdhc2_200mhz: usdhc2grp200mhz { + fsl,pins = < + MX8MQ_IOMUXC_SD2_CLK_USDHC2_CLK 0x87 + MX8MQ_IOMUXC_SD2_CMD_USDHC2_CMD 0xc7 + MX8MQ_IOMUXC_SD2_DATA0_USDHC2_DATA0 0xc7 + MX8MQ_IOMUXC_SD2_DATA1_USDHC2_DATA1 0xc7 + MX8MQ_IOMUXC_SD2_DATA2_USDHC2_DATA2 0xc7 + MX8MQ_IOMUXC_SD2_DATA3_USDHC2_DATA3 0xc7 + MX8MQ_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xc1 + >; + }; + + pinctrl_sai2: sai2grp { + fsl,pins = < + MX8MQ_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC 0xd6 + MX8MQ_IOMUXC_SAI2_TXC_SAI2_TX_BCLK 0xd6 + MX8MQ_IOMUXC_SAI2_MCLK_SAI2_MCLK 0xd6 + MX8MQ_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 0xd6 + MX8MQ_IOMUXC_GPIO1_IO08_GPIO1_IO8 0xd6 + >; + }; + + pinctrl_wdog: wdoggrp { + fsl,pins = < + MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6 + >; + }; + }; +}; + +&fec1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_fec1>; + phy-mode = "rgmii-id"; + phy-handle = <ðphy0>; + fsl,magic-packet; + status = "okay"; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethphy0: ethernet-phy at 0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + at803x,led-act-blind-workaround; + at803x,eee-disabled; + }; + }; +}; + +&i2c1 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + pmic: pfuze100 at 08 { + compatible = "fsl,pfuze100"; + reg = <0x08>; + + regulators { + sw1a_reg: sw1ab { + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1875000>; + regulator-always-on; + }; + + sw1c_reg: sw1c { + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1875000>; + regulator-always-on; + }; + + sw2_reg: sw2 { + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + sw3a_reg: sw3ab { + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <1975000>; + regulator-always-on; + }; + + sw4_reg: sw4 { + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + swbst_reg: swbst { + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5150000>; + }; + + snvs_reg: vsnvs { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + }; + + vref_reg: vrefddr { + 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>; + regulator-always-on; + }; + + vgen3_reg: vgen3 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + 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>; + }; + }; + }; +}; + +&i2c2 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c2>; + status = "disabled"; +}; + +&pwm2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pwm2>; + status = "okay"; +}; + +&lcdif { + status = "okay"; + disp-dev = "mipi_dsi_northwest"; + display = <&display0>; + + display0: display at 0 { + bits-per-pixel = <24>; + bus-width = <24>; + + display-timings { + native-mode = <&timing0>; + timing0: timing0 { + clock-frequency = <9200000>; + hactive = <480>; + vactive = <272>; + hfront-porch = <8>; + hback-porch = <4>; + hsync-len = <41>; + vback-porch = <2>; + vfront-porch = <4>; + vsync-len = <10>; + + hsync-active = <0>; + vsync-active = <0>; + de-active = <1>; + pixelclk-active = <0>; + }; + }; + }; +}; + +&qspi { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_qspi>; + status = "okay"; + + flash0: n25q256a at 0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + compatible = "micron,n25q256a"; + spi-max-frequency = <29000000>; + spi-nor,ddr-quad-read-dummy = <6>; + }; +}; + +&usdhc1 { + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc1>; + pinctrl-1 = <&pinctrl_usdhc1_100mhz>; + pinctrl-2 = <&pinctrl_usdhc1_200mhz>; + bus-width = <8>; + non-removable; + status = "okay"; +}; + +&usdhc2 { + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>; + pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>; + pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; + bus-width = <4>; + cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; + vmmc-supply = <®_usdhc2_vmmc>; + status = "okay"; +}; + +&wdog1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_wdog>; + fsl,ext-reset-output; + status = "okay"; +};arch/arm/include/asm/arch-mx8m/ddr.h +9
-0@@ -353,4 +353,13 @@ enum msg_response { TRAIN_FAIL = 0xff, }; +enum fw_type { +FW_1D_IMAGE , +FW_2D_IMAGE , +}; + +void ddr_init (void ); +void ddr_load_train_code (enum fw_type type); +void lpddr4_800M_cfg_phy (void ); +void dram_pll_init (void );#endif arch/arm/mach-imx/mx8m/Kconfig +12
-0@@ -7,4 +7,16 @@ config MX8M config SYS_SOC default "mx8m" +choice + prompt "NXP i.MX8M board select" + optional + +config TARGET_MX8MQ_EVK + bool "mx8mq_evk" + select MX8M + +endchoice + +source "board/freescale/mx8mq_evk/Kconfig" + endifboard/freescale/mx8mq_evk/Kconfig new file +12
-0@@ -0,0 +1,12 @@ +if TARGET_MX8MQ_EVK + +config SYS_BOARD + default "mx8mq_evk" + +config SYS_VENDOR + default "freescale" + +config SYS_CONFIG_NAME + default "mx8mq_evk" + +endifboard/freescale/mx8mq_evk/Makefile new file +12
-0@@ -0,0 +1,12 @@ +# +# Copyright 2017 NXP +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += mx8mq_evk.o + +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +obj-y += ddr/ddr_init.o ddr/ddrphy_train.o ddr/helper.o +endifboard/freescale/mx8mq_evk/README new file +47
-0@@ -0,0 +1,47 @@ +U-Boot for the NXP i.MX8MQ EVK board + +Quick Start +==================== +- Build the ARM Trusted firmware binary +- Build U-Boot +- Get ddr fimware and tools +- Generate flash.bin using imx-mkimage +- Boot + +Get and Build the ARM Trusted firmware +==================== +Get ATF from: https://source.codeaurora.org/external/imx/imx-atf +$ make PLAT=imx8mq bl31 + +Build U-Boot +==================== +$ export ARCH=arm64 +$ export CROSS_COMPILE=aarch64-poky-linux- +$ make mx8mq_evk_defconfig +$ make + +Get the ddr firmware and tools +==================== +Note: Better to use NXP released yocto to get the firmware in case + there is new releases. +https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-7.2.bin +imx-mkimage: https://source.codeaurora.org/external/imx/imx-mkimage/ + +Generate flash.bin using imx-mkimage +==================== +Copy bl31.bin u-boot-nodtb.bin u-boot-spl.bin fsl-imx8mq-evk.dtb to + imx-mkimage/iMX8M +Copy lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_1d_imem.bin + lpddr4_pmu_train_2d_dmem.bin lpddr4_pmu_train_2d_imem.bin to + imx-mkimage/iMX8M +If you want to run with HDMI, copy signed_hdmi_imx8m.bin to imx-mkimage/iMX8M + +make SOC=iMX8M flash_hdmi_spl_uboot or make SOC=iMX8M flash_spl_uboot to +generate flash.bin. + +Burn the flash.bin to MicroSD card offset 33KB +$sudo dd if=iMX8M/flash.bin of=/dev/sd[x] bs=1024 seek=33 + +Boot +==================== +Set Boot switch SW801: 1100 and Bmode: 10 to boot from Micro SD.board/freescale/mx8mq_evk/ddr/ddr_init.c new file +246
-0@@ -0,0 +1,246 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/ddr.h> +#include <asm/arch/sys_proto.h> +#include <linux/iopoll.h> + +struct imx8m_ddrc_regs *ddrc_regs = (struct imx8m_ddrc_regs *)DDRC_IPS_BASE_ADDR (0 ); +static struct gpc_reg *gpc_reg = (struct gpc_reg *)GPC_BASE_ADDR ; +static struct src *src = (struct src *)SRC_BASE_ADDR ; + +void lpddr4_800mhz_cfg_umctl2 (void ) +{ +writel (0x00000001 , &ddrc_regs->dbg1); +writel (0x00000001 , &ddrc_regs->pwrctl); +writel (0x83080020 , &ddrc_regs->mstr); +writel (0x006180e0 , &ddrc_regs->rfshtmg); +writel (0xc003061b , &ddrc_regs->init0); +writel (0x009d0000 , &ddrc_regs->init1); +writel (0x0000fe05 , &ddrc_regs->init2); +writel (0x00d4002d , &ddrc_regs->init3); +writel (0x00310008 , &ddrc_regs->init4); +writel (0x00040009 , &ddrc_regs->init5); +writel (0x0046004d , &ddrc_regs->init6); +writel (0x0005004d , &ddrc_regs->init7); +writel (0x00000979 , &ddrc_regs->rankctl); +writel (0x1a203522 , &ddrc_regs->dramtmg0); +writel (0x00060630 , &ddrc_regs->dramtmg1); +writel (0x070e1214 , &ddrc_regs->dramtmg2); +writel (0x00b0c006 , &ddrc_regs->dramtmg3); +writel (0x0f04080f , &ddrc_regs->dramtmg4); +writel (0x0d0d0c0c , &ddrc_regs->dramtmg5); +writel (0x01010007 , &ddrc_regs->dramtmg6); +writel (0x0000060a , &ddrc_regs->dramtmg7); +writel (0x01010101 , &ddrc_regs->dramtmg8); +writel (0x40000008 , &ddrc_regs->dramtmg9); +writel (0x00050d01 , &ddrc_regs->dramtmg10); +writel (0x01010008 , &ddrc_regs->dramtmg11); +writel (0x00020000 , &ddrc_regs->dramtmg12); +writel (0x18100002 , &ddrc_regs->dramtmg13); +writel (0x00000dc2 , &ddrc_regs->dramtmg14); +writel (0x80000000 , &ddrc_regs->dramtmg15); +writel (0x00a00050 , &ddrc_regs->dramtmg17); +writel (0x53200018 , &ddrc_regs->zqctl0); +writel (0x02800070 , &ddrc_regs->zqctl1); +writel (0x00000000 , &ddrc_regs->zqctl2); +writel (0x0397820a , &ddrc_regs->dfitmg0); +writel (0x0397820a , &ddrc_regs->freq1.dfitmg0); +writel (0x0397820a , &ddrc_regs->freq2.dfitmg0); +writel (0x00020103 , &ddrc_regs->dfitmg1); +writel (0xe0400018 , &ddrc_regs->dfiupd0); +writel (0x00df00e4 , &ddrc_regs->dfiupd1); +writel (0x00000000 , &ddrc_regs->dfiupd2); +writel (0x00000011 , &ddrc_regs->dfimisc); +writel (0x0000170a , &ddrc_regs->dfitmg2); +writel (0x00000001 , &ddrc_regs->dbictl); +writel (0x00000000 , &ddrc_regs->dfiphymstr); +/* Address map is from MSB 29: r15, r14, cs, r13-r0, b2-b0, c9-c0 */ +writel (0x00000015 , &ddrc_regs->addrmap0); +writel (0x00001f1f , &ddrc_regs->addrmap4); +/* bank interleave */ +writel (0x00080808 , &ddrc_regs->addrmap1); +writel (0x07070707 , &ddrc_regs->addrmap5); +writel (0x08080707 , &ddrc_regs->addrmap6); +writel (0x020f0c54 , &ddrc_regs->odtcfg); +writel (0x00000000 , &ddrc_regs->odtmap); +writel (0x00000001 , &ddrc_regs->pcfg[0 ].pctrl); + +/* performance setting */ +writel (0x0b060908 , &ddrc_regs->odtcfg); +writel (0x00000000 , &ddrc_regs->odtmap); +writel (0x29511505 , &ddrc_regs->sched); +writel (0x0000002c , &ddrc_regs->sched1); +writel (0x5900575b , &ddrc_regs->perfhpr1); +writel (0x900093e7 , &ddrc_regs->perflpr1); +writel (0x02005574 , &ddrc_regs->perfwr1); +writel (0x00000016 , &ddrc_regs->dbg0); +writel (0x00000000 , &ddrc_regs->dbg1); +writel (0x00000000 , &ddrc_regs->dbgcmd); +writel (0x00000001 , &ddrc_regs->swctl); +writel (0x00000011 , &ddrc_regs->poisoncfg); +writel (0x00000111 , &ddrc_regs->pccfg); +writel (0x000010f3 , &ddrc_regs->pcfg[0 ].pcfgr); +writel (0x000072ff , &ddrc_regs->pcfg[0 ].pcfgw); +writel (0x00000001 , &ddrc_regs->pcfg[0 ].pctrl); +writel (0x01110d00 , &ddrc_regs->pcfg[0 ].pcfgqos0); +writel (0x00620790 , &ddrc_regs->pcfg[0 ].pcfgqos1); +writel (0x00100001 , &ddrc_regs->pcfg[0 ].pcfgwqos0); +writel (0x0000041f , &ddrc_regs->pcfg[0 ].pcfgwqos1); +writel (0x00000202 , &ddrc_regs->freq1.derateen); +writel (0xec78f4b5 , &ddrc_regs->freq1.derateint); +writel (0x00618040 , &ddrc_regs->freq1.rfshctl0); +writel (0x00610090 , &ddrc_regs->freq1.rfshtmg); +} + +void lpddr4_100mhz_cfg_umctl2 (void ) +{ +writel (0x0d0b010c , &ddrc_regs->freq1.dramtmg0); +writel (0x00030410 , &ddrc_regs->freq1.dramtmg1); +writel (0x0305090c , &ddrc_regs->freq1.dramtmg2); +writel (0x00505006 , &ddrc_regs->freq1.dramtmg3); +writel (0x05040305 , &ddrc_regs->freq1.dramtmg4); +writel (0x0d0e0504 , &ddrc_regs->freq1.dramtmg5); +writel (0x0a060004 , &ddrc_regs->freq1.dramtmg6); +writel (0x0000090e , &ddrc_regs->freq1.dramtmg7); +writel (0x00000032 , &ddrc_regs->freq1.dramtmg14); +writel (0x00000000 , &ddrc_regs->freq1.dramtmg15); +writel (0x0036001b , &ddrc_regs->freq1.dramtmg17); +writel (0x7e9fbeb1 , &ddrc_regs->freq1.derateint); +writel (0x0020d040 , &ddrc_regs->freq1.rfshctl0); +writel (0x03818200 , &ddrc_regs->freq1.dfitmg0); +writel (0x0a1a096c , &ddrc_regs->freq1.odtcfg); +writel (0x00000000 , &ddrc_regs->freq1.dfitmg2); +writel (0x00038014 , &ddrc_regs->freq1.rfshtmg); +writel (0x00840000 , &ddrc_regs->freq1.init3); +writel (0x0000004d , &ddrc_regs->freq1.init6); +writel (0x0000004d , &ddrc_regs->freq1.init7); +writel (0x00310000 , &ddrc_regs->freq1.init4); +} + +void lpddr4_25mhz_cfg_umctl2 (void ) +{ +writel (0x0d0b010c , &ddrc_regs->freq2.dramtmg0); +writel (0x00030410 , &ddrc_regs->freq2.dramtmg1); +writel (0x0305090c , &ddrc_regs->freq2.dramtmg2); +writel (0x00505006 , &ddrc_regs->freq2.dramtmg3); +writel (0x05040305 , &ddrc_regs->freq2.dramtmg4); +writel (0x0d0e0504 , &ddrc_regs->freq2.dramtmg5); +writel (0x0a060004 , &ddrc_regs->freq2.dramtmg6); +writel (0x0000090e , &ddrc_regs->freq2.dramtmg7); +writel (0x00000032 , &ddrc_regs->freq2.dramtmg14); +writel (0x00000000 , &ddrc_regs->freq2.dramtmg15); +writel (0x0036001b , &ddrc_regs->freq2.dramtmg17); +writel (0x7e9fbeb1 , &ddrc_regs->freq2.derateint); +writel (0x0020d040 , &ddrc_regs->freq2.rfshctl0); +writel (0x03818200 , &ddrc_regs->freq2.dfitmg0); +writel (0x0a1a096c , &ddrc_regs->freq2.odtcfg); +writel (0x00000000 , &ddrc_regs->freq2.dfitmg2); +writel (0x0003800c , &ddrc_regs->freq2.rfshtmg); +writel (0x00840000 , &ddrc_regs->freq2.init3); +writel (0x0000004d , &ddrc_regs->freq2.init6); +writel (0x0000004d , &ddrc_regs->freq2.init7); +writel (0x00310000 , &ddrc_regs->freq2.init4); +} + +void ddr_init (void ) +{ +int ret; +u32 val; + +/* change the clock source of dram_apb_clk_root */ +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (4 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV4 )); + +/* disable the clock gating */ +writel (0xFFFF , &gpc_reg->pgc_cpu_0_1_mapping); +setbits_le32 (&gpc_reg->pu_pgc_up_trg,BIT (5 )); + +writel (SRC_DDR2_ENABLE_MASK , &src->ddr2_rcr); + +dram_pll_init (); + +writel (SRC_DDR1_ENABLE_MASK |SRC_DDR1_RCR_PHY_RESET_MASK | +SRC_DDR1_RCR_CORE_RESET_N_MASK , &src->ddr1_rcr); + +/* Configure uMCTL2's registers */ +lpddr4_800mhz_cfg_umctl2 (); + +writel (SRC_DDR1_ENABLE_MASK |SRC_DDR1_RCR_PHY_RESET_MASK , + &src->ddr1_rcr); +writel (SRC_DDR1_ENABLE_MASK , &src->ddr1_rcr); + +writel (0x00000000 , &ddrc_regs->dbg1); +writel (0x000000a8 , &ddrc_regs->pwrctl); +/* writel(0x0000018a, DDRC_PWRCTL(0), )*/ +writel (0x00000000 , &ddrc_regs->swctl); +writel (0x01 ,DDRC_DDR_SS_GPR0 ); +writel (0x00000010 , &ddrc_regs->dfimisc); + +/* Configure LPDDR4 PHY's registers */ +lpddr4_800M_cfg_phy (); + +writel (0x00000000 , &ddrc_regs->rfshctl3); +writel (0x0000 , &ddrc_regs->swctl); +/* +* ------------------- 9 ------------------- +* Set DFIMISC.dfi_init_start to 1 +* ----------------------------------------- +*/ +writel (0x00000030 , &ddrc_regs->dfimisc); +writel (0x0001 , &ddrc_regs->swctl); + +/* wait DFISTAT.dfi_init_complete to 1 */ + ret =readl_poll_timeout (&ddrc_regs->dfistat, val, val &BIT (0 ),1000 ); +if (ret) +puts ("DFISTAT.dfi_init_complete timeout\n" ); + +writel (0x0000 , &ddrc_regs->swctl); + +/* clear DFIMISC.dfi_init_complete_en */ +writel (0x00000010 , &ddrc_regs->dfimisc); +writel (0x00000011 , &ddrc_regs->dfimisc); +writel (0x00000088 , &ddrc_regs->pwrctl); + +/* +* set SWCTL.sw_done to enable quasi-dynamic register +* programming outside reset. +*/ +writel (0x00000001 , &ddrc_regs->swctl); + +/* wait SWSTAT.sw_done_ack to 1 */ + ret =readl_poll_timeout (&ddrc_regs->swstat, val, val &BIT (0 ),1000 ); +if (ret) +puts ("SWSTAT.sw_done timeout\n" ); + +/* wait STAT.operating_mode([1:0] for ddr3) to normal state */ + ret =readl_poll_timeout (&ddrc_regs->stat, val, (val &0x3 ) ==1 ,1000 ); +if (ret) +puts ("STAT.operating_mode timeout\n" ); + +writel (0x00000088 , &ddrc_regs->pwrctl); + +/* enable port 0 */ +writel (0x00000001 , &ddrc_regs->pcfg[0 ].pctrl); +writel (0x00000000 , &ddrc_regs->rfshctl3); + +writel (0x0 , &ddrc_regs->swctl); +lpddr4_100mhz_cfg_umctl2 (); +lpddr4_25mhz_cfg_umctl2 (); +writel (0x1 , &ddrc_regs->swctl); + +/* wait SWSTAT.sw_done_ack to 1 */ + ret =readl_poll_timeout (&ddrc_regs->swstat, val, val &BIT (0 ),1000 ); +if (ret) +puts ("SWSTAT.sw_done timeout\n" ); + +writel (0x0 , &ddrc_regs->swctl); +}board/freescale/mx8mq_evk/ddr/ddrphy_train.c new file +1272
-0@@ -0,0 +1,1272 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/ddr.h> +#include <asm/arch/sys_proto.h> +#include <linux/iopoll.h> + +static struct ccm_reg *ccm_reg = (struct ccm_reg *)CCM_BASE_ADDR ; +static struct imx8m_ddrphy_regs *regs = (struct imx8m_ddrphy_regs *)IP2APB_DDRPHY_IPS_BASE_ADDR (0 ); +static struct gpc_reg *gpc_reg = (struct gpc_reg *)GPC_BASE_ADDR ; + +static inline void poll_pmu_message_ready (void ) +{ +int ret; +u32 val; + +/* +* When BIT0 set to 0, the PMU has a message for the user +* 10ms seems not enough for poll message, so use 1s here. +*/ + ret =readl_poll_timeout (®s->reg[0xd0004 ], val, + !(val &BIT (0 )),1000000 ); +if (ret) +puts ("PMU message timeout\n" ); +} + +static inline void ack_pmu_message_receive (void ) +{ +int ret; +u32 val; +/* +* By setting this register to 0, the user acknowledges the +* receipt of the message. +*/ +writel (0x0 , ®s->reg[0xd0031 ]); + +/* When BIT0 set to 0, the PMU has a message for the user*/ + ret =readl_poll_timeout (®s->reg[0xd0004 ], val, val &BIT (0 ),1000 ); +if (ret) +printf ("%s timeout\n" , __func__); + +writel (0x1 , ®s->reg[0xd0031 ]); +} + +static inline unsigned int get_mail (void ) +{ +unsigned int reg; + +poll_pmu_message_ready (); + +/* Get the major message ID */ + reg =readl (®s->reg[0xd0032 ]); + +ack_pmu_message_receive (); + +return reg; +} + +static inline unsigned int get_stream_message (void ) +{ +unsigned int reg, reg2; + +poll_pmu_message_ready (); + + reg =readl (®s->reg[0xd0032 ]); + reg2 =readl (®s->reg[0xd0034 ]); + reg2 = (reg2 <<16 ) | reg; + +ack_pmu_message_receive (); + +return reg2; +} + +static inline void decode_major_message (unsigned int mail) +{ +debug ("[PMU Major message = 0x%08x]\n" , mail); +} + +static inline void decode_streaming_message (void ) +{ +unsigned int string_index, arg__maybe_unused ; +int i =0 ; + + string_index =get_stream_message (); +debug (" PMU String index = 0x%08x\n" , string_index); +while (i < (string_index &0xffff )) { + arg =get_stream_message (); +debug (" arg[%d] = 0x%08x\n" , i, arg); + i++; + } + +debug ("\n" ); +} + +static void wait_ddrphy_training_complete (void ) +{ +unsigned int mail; + +while (true) { + mail =get_mail (); +decode_major_message (mail); +if (mail ==TRAIN_STREAM_START ) { +decode_streaming_message (); + }else if (mail ==TRAIN_SUCCESS ) { +debug ("Training PASS\n" ); +break ; + }else if (mail ==TRAIN_FAIL ) { +printf ("Training FAILED\n" ); +break ; + } + } +} + +static void ddr_pll_bypass_100mts (void ) +{ +/* change the clock source of dram_alt_clk_root to source 2 --100MHZ */ +clock_set_target_val (DRAM_ALT_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (2 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 )); + +/* change the clock source of dram_apb_clk_root to source 2 --40MHZ */ +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (2 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV2 )); + +/* disable the clock gating */ +writel (0xFFFF , &gpc_reg->pgc_cpu_0_1_mapping); +/* configure ddr1_sw_pup_req */ +setbits_le32 (&gpc_reg->pu_pgc_up_trg,BIT (5 )); + +/* configure pll bypass mode */ +writel (BIT (24 ), &ccm_reg->dram_sel.target_root_set); + +debug ("PLL bypass to 100MTS setting done\n" ); +} + +static void ddr_pll_bypass_400mts (void ) +{ +/* change the clock source of dram_alt_clk_root to source 2 --400MHZ */ +clock_set_target_val (DRAM_ALT_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (5 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV1 )); + +/* change the clock source of dram_apb_clk_root to source 2 --40MHZ/2 */ +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (2 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV2 )); + +/* disable the clock gating */ +writel (0xFFFF , &gpc_reg->pgc_cpu_0_1_mapping); +/* configure ddr1_sw_pup_req */ +setbits_le32 (&gpc_reg->pu_pgc_up_trg,BIT (5 )); + +/* configure pll bypass mode */ +writel (BIT (24 ), &ccm_reg->dram_sel.target_root_set); + +debug ("PLL bypass to 400MTS setting done\n" ); +} + +static void dwc_ddrphy_phyinit_usercustom_e_setdficlk (enum pstate state) +{ +if (state ==PS2 ) { +ddr_pll_bypass_100mts (); + }else if (state ==PS1 ) { +ddr_pll_bypass_400mts (); + }else { +clock_set_target_val (DRAM_APB_CLK_ROOT ,CLK_ROOT_ON | +CLK_ROOT_SOURCE_SEL (4 ) | +CLK_ROOT_PRE_DIV (CLK_ROOT_PRE_DIV4 )); +writel (BIT (24 ), &ccm_reg->dram_sel.target_root_set); + } +} + +void lpddr4_800M_cfg_phy (void ) +{ +int ret; +u32 val; + +writel (0x02 , ®s->reg[0x20110 ]); +writel (0x03 , ®s->reg[0x20111 ]); +writel (0x04 , ®s->reg[0x20112 ]); +writel (0x05 , ®s->reg[0x20113 ]); +writel (0x00 , ®s->reg[0x20114 ]); +writel (0x01 , ®s->reg[0x20115 ]); +writel (0x1ff , ®s->reg[0x1005f ]); +writel (0x1ff , ®s->reg[0x1015f ]); +writel (0x1ff , ®s->reg[0x1105f ]); +writel (0x1ff , ®s->reg[0x1115f ]); +writel (0x1ff , ®s->reg[0x1205f ]); +writel (0x1ff , ®s->reg[0x1215f ]); +writel (0x1ff , ®s->reg[0x1305f ]); +writel (0x1ff , ®s->reg[0x1315f ]); +writel (0x1ff , ®s->reg[0x11005f ]); +writel (0x1ff , ®s->reg[0x11015f ]); +writel (0x1ff , ®s->reg[0x11105f ]); +writel (0x1ff , ®s->reg[0x11115f ]); +writel (0x1ff , ®s->reg[0x11205f ]); +writel (0x1ff , ®s->reg[0x11215f ]); +writel (0x1ff , ®s->reg[0x11305f ]); +writel (0x1ff , ®s->reg[0x11315f ]); +writel (0x1ff , ®s->reg[0x21005f ]); +writel (0x1ff , ®s->reg[0x21015f ]); +writel (0x1ff , ®s->reg[0x21105f ]); +writel (0x1ff , ®s->reg[0x21115f ]); +writel (0x1ff , ®s->reg[0x21205f ]); +writel (0x1ff , ®s->reg[0x21215f ]); +writel (0x1ff , ®s->reg[0x21305f ]); +writel (0x1ff , ®s->reg[0x21315f ]); +writel (0x1ff , ®s->reg[0x55 ]); +writel (0x1ff , ®s->reg[0x1055 ]); +writel (0x1ff , ®s->reg[0x2055 ]); +writel (0x1ff , ®s->reg[0x3055 ]); +writel (0x1ff , ®s->reg[0x4055 ]); +writel (0x1ff , ®s->reg[0x5055 ]); +writel (0x1ff , ®s->reg[0x6055 ]); +writel (0x1ff , ®s->reg[0x7055 ]); +writel (0x1ff , ®s->reg[0x8055 ]); +writel (0x1ff , ®s->reg[0x9055 ]); +writel (0x19 , ®s->reg[0x200c5 ]); +writel (0x7 , ®s->reg[0x1200c5 ]); +writel (0x7 , ®s->reg[0x2200c5 ]); +writel (0x2 , ®s->reg[0x2002e ]); +writel (0x2 , ®s->reg[0x12002e ]); +writel (0x2 , ®s->reg[0x22002e ]); +writel (0x0 , ®s->reg[0x90204 ]); +writel (0x0 , ®s->reg[0x190204 ]); +writel (0x0 , ®s->reg[0x290204 ]); +writel (0xab , ®s->reg[0x20024 ]); +writel (0x0 , ®s->reg[0x2003a ]); +writel (0xab , ®s->reg[0x120024 ]); +writel (0x0 , ®s->reg[0x2003a ]); +writel (0xab , ®s->reg[0x220024 ]); +writel (0x0 , ®s->reg[0x2003a ]); +writel (0x3 , ®s->reg[0x20056 ]); +writel (0xa , ®s->reg[0x120056 ]); +writel (0xa , ®s->reg[0x220056 ]); +writel (0xe00 , ®s->reg[0x1004d ]); +writel (0xe00 , ®s->reg[0x1014d ]); +writel (0xe00 , ®s->reg[0x1104d ]); +writel (0xe00 , ®s->reg[0x1114d ]); +writel (0xe00 , ®s->reg[0x1204d ]); +writel (0xe00 , ®s->reg[0x1214d ]); +writel (0xe00 , ®s->reg[0x1304d ]); +writel (0xe00 , ®s->reg[0x1314d ]); +writel (0xe00 , ®s->reg[0x11004d ]); +writel (0xe00 , ®s->reg[0x11014d ]); +writel (0xe00 , ®s->reg[0x11104d ]); +writel (0xe00 , ®s->reg[0x11114d ]); +writel (0xe00 , ®s->reg[0x11204d ]); +writel (0xe00 , ®s->reg[0x11214d ]); +writel (0xe00 , ®s->reg[0x11304d ]); +writel (0xe00 , ®s->reg[0x11314d ]); +writel (0xe00 , ®s->reg[0x21004d ]); +writel (0xe00 , ®s->reg[0x21014d ]); +writel (0xe00 , ®s->reg[0x21104d ]); +writel (0xe00 , ®s->reg[0x21114d ]); +writel (0xe00 , ®s->reg[0x21204d ]); +writel (0xe00 , ®s->reg[0x21214d ]); +writel (0xe00 , ®s->reg[0x21304d ]); +writel (0xe00 , ®s->reg[0x21314d ]); +writel (0xe38 , ®s->reg[0x10049 ]); +writel (0xe38 , ®s->reg[0x10149 ]); +writel (0xe38 , ®s->reg[0x11049 ]); +writel (0xe38 , ®s->reg[0x11149 ]); +writel (0xe38 , ®s->reg[0x12049 ]); +writel (0xe38 , ®s->reg[0x12149 ]); +writel (0xe38 , ®s->reg[0x13049 ]); +writel (0xe38 , ®s->reg[0x13149 ]); +writel (0xe38 , ®s->reg[0x110049 ]); +writel (0xe38 , ®s->reg[0x110149 ]); +writel (0xe38 , ®s->reg[0x111049 ]); +writel (0xe38 , ®s->reg[0x111149 ]); +writel (0xe38 , ®s->reg[0x112049 ]); +writel (0xe38 , ®s->reg[0x112149 ]); +writel (0xe38 , ®s->reg[0x113049 ]); +writel (0xe38 , ®s->reg[0x113149 ]); +writel (0xe38 , ®s->reg[0x210049 ]); +writel (0xe38 , ®s->reg[0x210149 ]); +writel (0xe38 , ®s->reg[0x211049 ]); +writel (0xe38 , ®s->reg[0x211149 ]); +writel (0xe38 , ®s->reg[0x212049 ]); +writel (0xe38 , ®s->reg[0x212149 ]); +writel (0xe38 , ®s->reg[0x213049 ]); +writel (0xe38 , ®s->reg[0x213149 ]); +writel (0x21 , ®s->reg[0x43 ]); +writel (0x21 , ®s->reg[0x1043 ]); +writel (0x21 , ®s->reg[0x2043 ]); +writel (0x21 , ®s->reg[0x3043 ]); +writel (0x21 , ®s->reg[0x4043 ]); +writel (0x21 , ®s->reg[0x5043 ]); +writel (0x21 , ®s->reg[0x6043 ]); +writel (0x21 , ®s->reg[0x7043 ]); +writel (0x21 , ®s->reg[0x8043 ]); +writel (0x21 , ®s->reg[0x9043 ]); +writel (0x3 , ®s->reg[0x20018 ]); +writel (0x4 , ®s->reg[0x20075 ]); +writel (0x0 , ®s->reg[0x20050 ]); +writel (0x320 , ®s->reg[0x20008 ]); +writel (0x64 , ®s->reg[0x120008 ]); +writel (0x19 , ®s->reg[0x220008 ]); +writel (0x9 , ®s->reg[0x20088 ]); +writel (0x19c , ®s->reg[0x200b2 ]); +writel (0x5a1 , ®s->reg[0x10043 ]); +writel (0x5a1 , ®s->reg[0x10143 ]); +writel (0x5a1 , ®s->reg[0x11043 ]); +writel (0x5a1 , ®s->reg[0x11143 ]); +writel (0x5a1 , ®s->reg[0x12043 ]); +writel (0x5a1 , ®s->reg[0x12143 ]); +writel (0x5a1 , ®s->reg[0x13043 ]); +writel (0x5a1 , ®s->reg[0x13143 ]); +writel (0x19c , ®s->reg[0x1200b2 ]); +writel (0x5a1 , ®s->reg[0x110043 ]); +writel (0x5a1 , ®s->reg[0x110143 ]); +writel (0x5a1 , ®s->reg[0x111043 ]); +writel (0x5a1 , ®s->reg[0x111143 ]); +writel (0x5a1 , ®s->reg[0x112043 ]); +writel (0x5a1 , ®s->reg[0x112143 ]); +writel (0x5a1 , ®s->reg[0x113043 ]); +writel (0x5a1 , ®s->reg[0x113143 ]); +writel (0x19c , ®s->reg[0x2200b2 ]); +writel (0x5a1 , ®s->reg[0x210043 ]); +writel (0x5a1 , ®s->reg[0x210143 ]); +writel (0x5a1 , ®s->reg[0x211043 ]); +writel (0x5a1 , ®s->reg[0x211143 ]); +writel (0x5a1 , ®s->reg[0x212043 ]); +writel (0x5a1 , ®s->reg[0x212143 ]); +writel (0x5a1 , ®s->reg[0x213043 ]); +writel (0x5a1 , ®s->reg[0x213143 ]); +writel (0x1 , ®s->reg[0x200fa ]); +writel (0x1 , ®s->reg[0x1200fa ]); +writel (0x1 , ®s->reg[0x2200fa ]); +writel (0x1 , ®s->reg[0x20019 ]); +writel (0x1 , ®s->reg[0x120019 ]); +writel (0x1 , ®s->reg[0x220019 ]); +writel (0x660 , ®s->reg[0x200f0 ]); +writel (0x0 , ®s->reg[0x200f1 ]); +writel (0x4444 , ®s->reg[0x200f2 ]); +writel (0x8888 , ®s->reg[0x200f3 ]); +writel (0x5555 , ®s->reg[0x200f4 ]); +writel (0x0 , ®s->reg[0x200f5 ]); +writel (0x0 , ®s->reg[0x200f6 ]); +writel (0xf000 , ®s->reg[0x200f7 ]); +writel (0x65 , ®s->reg[0x2000b ]); +writel (0xc9 , ®s->reg[0x2000c ]); +writel (0x7d1 , ®s->reg[0x2000d ]); +writel (0x2c , ®s->reg[0x2000e ]); +writel (0xd , ®s->reg[0x12000b ]); +writel (0x1a , ®s->reg[0x12000c ]); +writel (0xfb , ®s->reg[0x12000d ]); +writel (0x10 , ®s->reg[0x12000e ]); +writel (0x4 , ®s->reg[0x22000b ]); +writel (0x7 , ®s->reg[0x22000c ]); +writel (0x3f , ®s->reg[0x22000d ]); +writel (0x10 , ®s->reg[0x22000e ]); +writel (0x0 , ®s->reg[0x20025 ]); +writel (0x0 , ®s->reg[0x2002d ]); +writel (0x0 , ®s->reg[0x12002d ]); +writel (0x0 , ®s->reg[0x22002d ]); +writel (0x2 , ®s->reg[0x20060 ]); +writel (0x0 , ®s->reg[0xd0000 ]); + +/* load the 1D training image */ +ddr_load_train_code (FW_1D_IMAGE ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* set the PHY input clock to the desired frequency for pstate 2 */ +dwc_ddrphy_phyinit_usercustom_e_setdficlk (PS2 ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x102 , ®s->reg[0x54002 ]); +writel (0x64 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x121f , ®s->reg[0x54008 ]); +writel (0xc8 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x0 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x0 , ®s->reg[0x5400f ]); +writel (0x0 , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0x400 , ®s->reg[0x54032 ]); +writel (0x3100 , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x84d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0x400 , ®s->reg[0x54038 ]); +writel (0x3100 , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x84d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); + +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* set the PHY input clock to the desired frequency for pstate 1 */ +dwc_ddrphy_phyinit_usercustom_e_setdficlk (PS1 ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x101 , ®s->reg[0x54002 ]); +writel (0x190 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x121f , ®s->reg[0x54008 ]); +writel (0xc8 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x0 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x0 , ®s->reg[0x5400f ]); +writel (0x0 , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0x400 , ®s->reg[0x54032 ]); +writel (0x3100 , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x84d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0x400 , ®s->reg[0x54038 ]); +writel (0x3100 , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x84d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); + +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* set the PHY input clock to the desired frequency for pstate 0 */ +dwc_ddrphy_phyinit_usercustom_e_setdficlk (PS0 ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x0 , ®s->reg[0x54002 ]); +writel (0xc80 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x131f , ®s->reg[0x54008 ]); +writel (0x5 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x0 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x0 , ®s->reg[0x5400f ]); +writel (0x0 , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x2dd4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x2dd4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0xd400 , ®s->reg[0x54032 ]); +writel (0x312d , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x84d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0xd400 , ®s->reg[0x54038 ]); +writel (0x312d , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x84d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); + +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0xd0000 ]); + +/* load the 2D training image */ +ddr_load_train_code (FW_2D_IMAGE ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0xd0000 ]); + +writel (0x0 , ®s->reg[0x54000 ]); +writel (0x0 , ®s->reg[0x54001 ]); +writel (0x0 , ®s->reg[0x54002 ]); +writel (0xc80 , ®s->reg[0x54003 ]); +writel (0x2 , ®s->reg[0x54004 ]); +writel (0x2828 , ®s->reg[0x54005 ]); +writel (0x14 , ®s->reg[0x54006 ]); +writel (0x0 , ®s->reg[0x54007 ]); +writel (0x61 , ®s->reg[0x54008 ]); +writel (0xc8 , ®s->reg[0x54009 ]); +writel (0x0 , ®s->reg[0x5400a ]); +writel (0x2 , ®s->reg[0x5400b ]); +writel (0x0 , ®s->reg[0x5400c ]); +writel (0x100 , ®s->reg[0x5400d ]); +writel (0x0 , ®s->reg[0x5400e ]); +writel (0x100 , ®s->reg[0x5400f ]); +writel (0x1f7f , ®s->reg[0x54010 ]); +writel (0x0 , ®s->reg[0x54011 ]); +writel (0x310 , ®s->reg[0x54012 ]); +writel (0x0 , ®s->reg[0x54013 ]); +writel (0x0 , ®s->reg[0x54014 ]); +writel (0x0 , ®s->reg[0x54015 ]); +writel (0x0 , ®s->reg[0x54016 ]); +writel (0x0 , ®s->reg[0x54017 ]); +writel (0x0 , ®s->reg[0x54018 ]); +writel (0x2dd4 , ®s->reg[0x54019 ]); +writel (0x31 , ®s->reg[0x5401a ]); +writel (0x4d46 , ®s->reg[0x5401b ]); +writel (0x4d08 , ®s->reg[0x5401c ]); +writel (0x0 , ®s->reg[0x5401d ]); +writel (0x5 , ®s->reg[0x5401e ]); +writel (0x2dd4 , ®s->reg[0x5401f ]); +writel (0x31 , ®s->reg[0x54020 ]); +writel (0x4d46 , ®s->reg[0x54021 ]); +writel (0x4d08 , ®s->reg[0x54022 ]); +writel (0x0 , ®s->reg[0x54023 ]); +writel (0x5 , ®s->reg[0x54024 ]); +writel (0x0 , ®s->reg[0x54025 ]); +writel (0x0 , ®s->reg[0x54026 ]); +writel (0x0 , ®s->reg[0x54027 ]); +writel (0x0 , ®s->reg[0x54028 ]); +writel (0x0 , ®s->reg[0x54029 ]); +writel (0x0 , ®s->reg[0x5402a ]); +writel (0x1000 , ®s->reg[0x5402b ]); +writel (0x3 , ®s->reg[0x5402c ]); +writel (0x0 , ®s->reg[0x5402d ]); +writel (0x0 , ®s->reg[0x5402e ]); +writel (0x0 , ®s->reg[0x5402f ]); +writel (0x0 , ®s->reg[0x54030 ]); +writel (0x0 , ®s->reg[0x54031 ]); +writel (0xd400 , ®s->reg[0x54032 ]); +writel (0x312d , ®s->reg[0x54033 ]); +writel (0x4600 , ®s->reg[0x54034 ]); +writel (0x084d , ®s->reg[0x54035 ]); +writel (0x4d , ®s->reg[0x54036 ]); +writel (0x500 , ®s->reg[0x54037 ]); +writel (0xd400 , ®s->reg[0x54038 ]); +writel (0x312d , ®s->reg[0x54039 ]); +writel (0x4600 , ®s->reg[0x5403a ]); +writel (0x084d , ®s->reg[0x5403b ]); +writel (0x4d , ®s->reg[0x5403c ]); +writel (0x500 , ®s->reg[0x5403d ]); +writel (0x1 , ®s->reg[0xd0000 ]); +/* Execute the Training Firmware */ +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x9 , ®s->reg[0xd0099 ]); +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0099 ]); +/* wait for 2D training complete */ +wait_ddrphy_training_complete (); + +writel (0x1 , ®s->reg[0xd0099 ]); +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x1 , ®s->reg[0xd0000 ]); + +/* (I) Load PHY Init Engine Image */ +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x10 , ®s->reg[0x90000 ]); +writel (0x400 , ®s->reg[0x90001 ]); +writel (0x10e , ®s->reg[0x90002 ]); +writel (0x0 , ®s->reg[0x90003 ]); +writel (0x0 , ®s->reg[0x90004 ]); +writel (0x8 , ®s->reg[0x90005 ]); +writel (0xb , ®s->reg[0x90029 ]); +writel (0x480 , ®s->reg[0x9002a ]); +writel (0x109 , ®s->reg[0x9002b ]); +writel (0x8 , ®s->reg[0x9002c ]); +writel (0x448 , ®s->reg[0x9002d ]); +writel (0x139 , ®s->reg[0x9002e ]); +writel (0x8 , ®s->reg[0x9002f ]); +writel (0x478 , ®s->reg[0x90030 ]); +writel (0x109 , ®s->reg[0x90031 ]); +writel (0x0 , ®s->reg[0x90032 ]); +writel (0xe8 , ®s->reg[0x90033 ]); +writel (0x109 , ®s->reg[0x90034 ]); +writel (0x2 , ®s->reg[0x90035 ]); +writel (0x10 , ®s->reg[0x90036 ]); +writel (0x139 , ®s->reg[0x90037 ]); +writel (0xf , ®s->reg[0x90038 ]); +writel (0x7c0 , ®s->reg[0x90039 ]); +writel (0x139 , ®s->reg[0x9003a ]); +writel (0x44 , ®s->reg[0x9003b ]); +writel (0x630 , ®s->reg[0x9003c ]); +writel (0x159 , ®s->reg[0x9003d ]); +writel (0x14f , ®s->reg[0x9003e ]); +writel (0x630 , ®s->reg[0x9003f ]); +writel (0x159 , ®s->reg[0x90040 ]); +writel (0x47 , ®s->reg[0x90041 ]); +writel (0x630 , ®s->reg[0x90042 ]); +writel (0x149 , ®s->reg[0x90043 ]); +writel (0x4f , ®s->reg[0x90044 ]); +writel (0x630 , ®s->reg[0x90045 ]); +writel (0x179 , ®s->reg[0x90046 ]); +writel (0x8 , ®s->reg[0x90047 ]); +writel (0xe0 , ®s->reg[0x90048 ]); +writel (0x109 , ®s->reg[0x90049 ]); +writel (0x0 , ®s->reg[0x9004a ]); +writel (0x7c8 , ®s->reg[0x9004b ]); +writel (0x109 , ®s->reg[0x9004c ]); +writel (0x0 , ®s->reg[0x9004d ]); +writel (0x1 , ®s->reg[0x9004e ]); +writel (0x8 , ®s->reg[0x9004f ]); +writel (0x0 , ®s->reg[0x90050 ]); +writel (0x45a , ®s->reg[0x90051 ]); +writel (0x9 , ®s->reg[0x90052 ]); +writel (0x0 , ®s->reg[0x90053 ]); +writel (0x448 , ®s->reg[0x90054 ]); +writel (0x109 , ®s->reg[0x90055 ]); +writel (0x40 , ®s->reg[0x90056 ]); +writel (0x630 , ®s->reg[0x90057 ]); +writel (0x179 , ®s->reg[0x90058 ]); +writel (0x1 , ®s->reg[0x90059 ]); +writel (0x618 , ®s->reg[0x9005a ]); +writel (0x109 , ®s->reg[0x9005b ]); +writel (0x40c0 , ®s->reg[0x9005c ]); +writel (0x630 , ®s->reg[0x9005d ]); +writel (0x149 , ®s->reg[0x9005e ]); +writel (0x8 , ®s->reg[0x9005f ]); +writel (0x4 , ®s->reg[0x90060 ]); +writel (0x48 , ®s->reg[0x90061 ]); +writel (0x4040 , ®s->reg[0x90062 ]); +writel (0x630 , ®s->reg[0x90063 ]); +writel (0x149 , ®s->reg[0x90064 ]); +writel (0x0 , ®s->reg[0x90065 ]); +writel (0x4 , ®s->reg[0x90066 ]); +writel (0x48 , ®s->reg[0x90067 ]); +writel (0x40 , ®s->reg[0x90068 ]); +writel (0x630 , ®s->reg[0x90069 ]); +writel (0x149 , ®s->reg[0x9006a ]); +writel (0x10 , ®s->reg[0x9006b ]); +writel (0x4 , ®s->reg[0x9006c ]); +writel (0x18 , ®s->reg[0x9006d ]); +writel (0x0 , ®s->reg[0x9006e ]); +writel (0x4 , ®s->reg[0x9006f ]); +writel (0x78 , ®s->reg[0x90070 ]); +writel (0x549 , ®s->reg[0x90071 ]); +writel (0x630 , ®s->reg[0x90072 ]); +writel (0x159 , ®s->reg[0x90073 ]); +writel (0xd49 , ®s->reg[0x90074 ]); +writel (0x630 , ®s->reg[0x90075 ]); +writel (0x159 , ®s->reg[0x90076 ]); +writel (0x94a , ®s->reg[0x90077 ]); +writel (0x630 , ®s->reg[0x90078 ]); +writel (0x159 , ®s->reg[0x90079 ]); +writel (0x441 , ®s->reg[0x9007a ]); +writel (0x630 , ®s->reg[0x9007b ]); +writel (0x149 , ®s->reg[0x9007c ]); +writel (0x42 , ®s->reg[0x9007d ]); +writel (0x630 , ®s->reg[0x9007e ]); +writel (0x149 , ®s->reg[0x9007f ]); +writel (0x1 , ®s->reg[0x90080 ]); +writel (0x630 , ®s->reg[0x90081 ]); +writel (0x149 , ®s->reg[0x90082 ]); +writel (0x0 , ®s->reg[0x90083 ]); +writel (0xe0 , ®s->reg[0x90084 ]); +writel (0x109 , ®s->reg[0x90085 ]); +writel (0xa , ®s->reg[0x90086 ]); +writel (0x10 , ®s->reg[0x90087 ]); +writel (0x109 , ®s->reg[0x90088 ]); +writel (0x9 , ®s->reg[0x90089 ]); +writel (0x3c0 , ®s->reg[0x9008a ]); +writel (0x149 , ®s->reg[0x9008b ]); +writel (0x9 , ®s->reg[0x9008c ]); +writel (0x3c0 , ®s->reg[0x9008d ]); +writel (0x159 , ®s->reg[0x9008e ]); +writel (0x18 , ®s->reg[0x9008f ]); +writel (0x10 , ®s->reg[0x90090 ]); +writel (0x109 , ®s->reg[0x90091 ]); +writel (0x0 , ®s->reg[0x90092 ]); +writel (0x3c0 , ®s->reg[0x90093 ]); +writel (0x109 , ®s->reg[0x90094 ]); +writel (0x18 , ®s->reg[0x90095 ]); +writel (0x4 , ®s->reg[0x90096 ]); +writel (0x48 , ®s->reg[0x90097 ]); +writel (0x18 , ®s->reg[0x90098 ]); +writel (0x4 , ®s->reg[0x90099 ]); +writel (0x58 , ®s->reg[0x9009a ]); +writel (0xa , ®s->reg[0x9009b ]); +writel (0x10 , ®s->reg[0x9009c ]); +writel (0x109 , ®s->reg[0x9009d ]); +writel (0x2 , ®s->reg[0x9009e ]); +writel (0x10 , ®s->reg[0x9009f ]); +writel (0x109 , ®s->reg[0x900a0 ]); +writel (0x5 , ®s->reg[0x900a1 ]); +writel (0x7c0 , ®s->reg[0x900a2 ]); +writel (0x109 , ®s->reg[0x900a3 ]); +writel (0x10 , ®s->reg[0x900a4 ]); +writel (0x10 , ®s->reg[0x900a5 ]); +writel (0x109 , ®s->reg[0x900a6 ]); +writel (0x811 , ®s->reg[0x40000 ]); +writel (0x880 , ®s->reg[0x40020 ]); +writel (0x0 , ®s->reg[0x40040 ]); +writel (0x0 , ®s->reg[0x40060 ]); +writel (0x4016 , ®s->reg[0x40001 ]); +writel (0x83 , ®s->reg[0x40021 ]); +writel (0x4f , ®s->reg[0x40041 ]); +writel (0x0 , ®s->reg[0x40061 ]); +writel (0x4040 , ®s->reg[0x40002 ]); +writel (0x83 , ®s->reg[0x40022 ]); +writel (0x51 , ®s->reg[0x40042 ]); +writel (0x0 , ®s->reg[0x40062 ]); +writel (0x811 , ®s->reg[0x40003 ]); +writel (0x880 , ®s->reg[0x40023 ]); +writel (0x0 , ®s->reg[0x40043 ]); +writel (0x0 , ®s->reg[0x40063 ]); +writel (0x720 , ®s->reg[0x40004 ]); +writel (0xf , ®s->reg[0x40024 ]); +writel (0x1740 , ®s->reg[0x40044 ]); +writel (0x0 , ®s->reg[0x40064 ]); +writel (0x16 , ®s->reg[0x40005 ]); +writel (0x83 , ®s->reg[0x40025 ]); +writel (0x4b , ®s->reg[0x40045 ]); +writel (0x0 , ®s->reg[0x40065 ]); +writel (0x716 , ®s->reg[0x40006 ]); +writel (0xf , ®s->reg[0x40026 ]); +writel (0x2001 , ®s->reg[0x40046 ]); +writel (0x0 , ®s->reg[0x40066 ]); +writel (0x716 , ®s->reg[0x40007 ]); +writel (0xf , ®s->reg[0x40027 ]); +writel (0x2800 , ®s->reg[0x40047 ]); +writel (0x0 , ®s->reg[0x40067 ]); +writel (0x716 , ®s->reg[0x40008 ]); +writel (0xf , ®s->reg[0x40028 ]); +writel (0xf00 , ®s->reg[0x40048 ]); +writel (0x0 , ®s->reg[0x40068 ]); +writel (0x720 , ®s->reg[0x40009 ]); +writel (0xf , ®s->reg[0x40029 ]); +writel (0x1400 , ®s->reg[0x40049 ]); +writel (0x0 , ®s->reg[0x40069 ]); +writel (0xe08 , ®s->reg[0x4000a ]); +writel (0xc15 , ®s->reg[0x4002a ]); +writel (0x0 , ®s->reg[0x4004a ]); +writel (0x0 , ®s->reg[0x4006a ]); +writel (0x623 , ®s->reg[0x4000b ]); +writel (0x15 , ®s->reg[0x4002b ]); +writel (0x0 , ®s->reg[0x4004b ]); +writel (0x0 , ®s->reg[0x4006b ]); +writel (0x4004 , ®s->reg[0x4000c ]); +writel (0x80 , ®s->reg[0x4002c ]); +writel (0x0 , ®s->reg[0x4004c ]); +writel (0x0 , ®s->reg[0x4006c ]); +writel (0xe08 , ®s->reg[0x4000d ]); +writel (0xc1a , ®s->reg[0x4002d ]); +writel (0x0 , ®s->reg[0x4004d ]); +writel (0x0 , ®s->reg[0x4006d ]); +writel (0x623 , ®s->reg[0x4000e ]); +writel (0x1a , ®s->reg[0x4002e ]); +writel (0x0 , ®s->reg[0x4004e ]); +writel (0x0 , ®s->reg[0x4006e ]); +writel (0x4040 , ®s->reg[0x4000f ]); +writel (0x80 , ®s->reg[0x4002f ]); +writel (0x0 , ®s->reg[0x4004f ]); +writel (0x0 , ®s->reg[0x4006f ]); +writel (0x2604 , ®s->reg[0x40010 ]); +writel (0x15 , ®s->reg[0x40030 ]); +writel (0x0 , ®s->reg[0x40050 ]); +writel (0x0 , ®s->reg[0x40070 ]); +writel (0x708 , ®s->reg[0x40011 ]); +writel (0x5 , ®s->reg[0x40031 ]); +writel (0x0 , ®s->reg[0x40051 ]); +writel (0x2002 , ®s->reg[0x40071 ]); +writel (0x8 , ®s->reg[0x40012 ]); +writel (0x80 , ®s->reg[0x40032 ]); +writel (0x0 , ®s->reg[0x40052 ]); +writel (0x0 , ®s->reg[0x40072 ]); +writel (0x2604 , ®s->reg[0x40013 ]); +writel (0x1a , ®s->reg[0x40033 ]); +writel (0x0 , ®s->reg[0x40053 ]); +writel (0x0 , ®s->reg[0x40073 ]); +writel (0x708 , ®s->reg[0x40014 ]); +writel (0xa , ®s->reg[0x40034 ]); +writel (0x0 , ®s->reg[0x40054 ]); +writel (0x2002 , ®s->reg[0x40074 ]); +writel (0x4040 , ®s->reg[0x40015 ]); +writel (0x80 , ®s->reg[0x40035 ]); +writel (0x0 , ®s->reg[0x40055 ]); +writel (0x0 , ®s->reg[0x40075 ]); +writel (0x60a , ®s->reg[0x40016 ]); +writel (0x15 , ®s->reg[0x40036 ]); +writel (0x1200 , ®s->reg[0x40056 ]); +writel (0x0 , ®s->reg[0x40076 ]); +writel (0x61a , ®s->reg[0x40017 ]); +writel (0x15 , ®s->reg[0x40037 ]); +writel (0x1300 , ®s->reg[0x40057 ]); +writel (0x0 , ®s->reg[0x40077 ]); +writel (0x60a , ®s->reg[0x40018 ]); +writel (0x1a , ®s->reg[0x40038 ]); +writel (0x1200 , ®s->reg[0x40058 ]); +writel (0x0 , ®s->reg[0x40078 ]); +writel (0x642 , ®s->reg[0x40019 ]); +writel (0x1a , ®s->reg[0x40039 ]); +writel (0x1300 , ®s->reg[0x40059 ]); +writel (0x0 , ®s->reg[0x40079 ]); +writel (0x4808 , ®s->reg[0x4001a ]); +writel (0x880 , ®s->reg[0x4003a ]); +writel (0x0 , ®s->reg[0x4005a ]); +writel (0x0 , ®s->reg[0x4007a ]); +writel (0x0 , ®s->reg[0x900a7 ]); +writel (0x790 , ®s->reg[0x900a8 ]); +writel (0x11a , ®s->reg[0x900a9 ]); +writel (0x8 , ®s->reg[0x900aa ]); +writel (0x7aa , ®s->reg[0x900ab ]); +writel (0x2a , ®s->reg[0x900ac ]); +writel (0x10 , ®s->reg[0x900ad ]); +writel (0x7b2 , ®s->reg[0x900ae ]); +writel (0x2a , ®s->reg[0x900af ]); +writel (0x0 , ®s->reg[0x900b0 ]); +writel (0x7c8 , ®s->reg[0x900b1 ]); +writel (0x109 , ®s->reg[0x900b2 ]); +writel (0x10 , ®s->reg[0x900b3 ]); +writel (0x2a8 , ®s->reg[0x900b4 ]); +writel (0x129 , ®s->reg[0x900b5 ]); +writel (0x8 , ®s->reg[0x900b6 ]); +writel (0x370 , ®s->reg[0x900b7 ]); +writel (0x129 , ®s->reg[0x900b8 ]); +writel (0xa , ®s->reg[0x900b9 ]); +writel (0x3c8 , ®s->reg[0x900ba ]); +writel (0x1a9 , ®s->reg[0x900bb ]); +writel (0xc , ®s->reg[0x900bc ]); +writel (0x408 , ®s->reg[0x900bd ]); +writel (0x199 , ®s->reg[0x900be ]); +writel (0x14 , ®s->reg[0x900bf ]); +writel (0x790 , ®s->reg[0x900c0 ]); +writel (0x11a , ®s->reg[0x900c1 ]); +writel (0x8 , ®s->reg[0x900c2 ]); +writel (0x4 , ®s->reg[0x900c3 ]); +writel (0x18 , ®s->reg[0x900c4 ]); +writel (0xc , ®s->reg[0x900c5 ]); +writel (0x408 , ®s->reg[0x900c6 ]); +writel (0x199 , ®s->reg[0x900c7 ]); +writel (0x8 , ®s->reg[0x900c8 ]); +writel (0x8568 , ®s->reg[0x900c9 ]); +writel (0x108 , ®s->reg[0x900ca ]); +writel (0x18 , ®s->reg[0x900cb ]); +writel (0x790 , ®s->reg[0x900cc ]); +writel (0x16a , ®s->reg[0x900cd ]); +writel (0x8 , ®s->reg[0x900ce ]); +writel (0x1d8 , ®s->reg[0x900cf ]); +writel (0x169 , ®s->reg[0x900d0 ]); +writel (0x10 , ®s->reg[0x900d1 ]); +writel (0x8558 , ®s->reg[0x900d2 ]); +writel (0x168 , ®s->reg[0x900d3 ]); +writel (0x70 , ®s->reg[0x900d4 ]); +writel (0x788 , ®s->reg[0x900d5 ]); +writel (0x16a , ®s->reg[0x900d6 ]); +writel (0x1ff8 , ®s->reg[0x900d7 ]); +writel (0x85a8 , ®s->reg[0x900d8 ]); +writel (0x1e8 , ®s->reg[0x900d9 ]); +writel (0x50 , ®s->reg[0x900da ]); +writel (0x798 , ®s->reg[0x900db ]); +writel (0x16a , ®s->reg[0x900dc ]); +writel (0x60 , ®s->reg[0x900dd ]); +writel (0x7a0 , ®s->reg[0x900de ]); +writel (0x16a , ®s->reg[0x900df ]); +writel (0x8 , ®s->reg[0x900e0 ]); +writel (0x8310 , ®s->reg[0x900e1 ]); +writel (0x168 , ®s->reg[0x900e2 ]); +writel (0x8 , ®s->reg[0x900e3 ]); +writel (0xa310 , ®s->reg[0x900e4 ]); +writel (0x168 , ®s->reg[0x900e5 ]); +writel (0xa , ®s->reg[0x900e6 ]); +writel (0x408 , ®s->reg[0x900e7 ]); +writel (0x169 , ®s->reg[0x900e8 ]); +writel (0x6e , ®s->reg[0x900e9 ]); +writel (0x0 , ®s->reg[0x900ea ]); +writel (0x68 , ®s->reg[0x900eb ]); +writel (0x0 , ®s->reg[0x900ec ]); +writel (0x408 , ®s->reg[0x900ed ]); +writel (0x169 , ®s->reg[0x900ee ]); +writel (0x0 , ®s->reg[0x900ef ]); +writel (0x8310 , ®s->reg[0x900f0 ]); +writel (0x168 , ®s->reg[0x900f1 ]); +writel (0x0 , ®s->reg[0x900f2 ]); +writel (0xa310 , ®s->reg[0x900f3 ]); +writel (0x168 , ®s->reg[0x900f4 ]); +writel (0x1ff8 , ®s->reg[0x900f5 ]); +writel (0x85a8 , ®s->reg[0x900f6 ]); +writel (0x1e8 , ®s->reg[0x900f7 ]); +writel (0x68 , ®s->reg[0x900f8 ]); +writel (0x798 , ®s->reg[0x900f9 ]); +writel (0x16a , ®s->reg[0x900fa ]); +writel (0x78 , ®s->reg[0x900fb ]); +writel (0x7a0 , ®s->reg[0x900fc ]); +writel (0x16a , ®s->reg[0x900fd ]); +writel (0x68 , ®s->reg[0x900fe ]); +writel (0x790 , ®s->reg[0x900ff ]); +writel (0x16a , ®s->reg[0x90100 ]); +writel (0x8 , ®s->reg[0x90101 ]); +writel (0x8b10 , ®s->reg[0x90102 ]); +writel (0x168 , ®s->reg[0x90103 ]); +writel (0x8 , ®s->reg[0x90104 ]); +writel (0xab10 , ®s->reg[0x90105 ]); +writel (0x168 , ®s->reg[0x90106 ]); +writel (0xa , ®s->reg[0x90107 ]); +writel (0x408 , ®s->reg[0x90108 ]); +writel (0x169 , ®s->reg[0x90109 ]); +writel (0x58 , ®s->reg[0x9010a ]); +writel (0x0 , ®s->reg[0x9010b ]); +writel (0x68 , ®s->reg[0x9010c ]); +writel (0x0 , ®s->reg[0x9010d ]); +writel (0x408 , ®s->reg[0x9010e ]); +writel (0x169 , ®s->reg[0x9010f ]); +writel (0x0 , ®s->reg[0x90110 ]); +writel (0x8b10 , ®s->reg[0x90111 ]); +writel (0x168 , ®s->reg[0x90112 ]); +writel (0x0 , ®s->reg[0x90113 ]); +writel (0xab10 , ®s->reg[0x90114 ]); +writel (0x168 , ®s->reg[0x90115 ]); +writel (0x0 , ®s->reg[0x90116 ]); +writel (0x1d8 , ®s->reg[0x90117 ]); +writel (0x169 , ®s->reg[0x90118 ]); +writel (0x80 , ®s->reg[0x90119 ]); +writel (0x790 , ®s->reg[0x9011a ]); +writel (0x16a , ®s->reg[0x9011b ]); +writel (0x18 , ®s->reg[0x9011c ]); +writel (0x7aa , ®s->reg[0x9011d ]); +writel (0x6a , ®s->reg[0x9011e ]); +writel (0xa , ®s->reg[0x9011f ]); +writel (0x0 , ®s->reg[0x90120 ]); +writel (0x1e9 , ®s->reg[0x90121 ]); +writel (0x8 , ®s->reg[0x90122 ]); +writel (0x8080 , ®s->reg[0x90123 ]); +writel (0x108 , ®s->reg[0x90124 ]); +writel (0xf , ®s->reg[0x90125 ]); +writel (0x408 , ®s->reg[0x90126 ]); +writel (0x169 , ®s->reg[0x90127 ]); +writel (0xc , ®s->reg[0x90128 ]); +writel (0x0 , ®s->reg[0x90129 ]); +writel (0x68 , ®s->reg[0x9012a ]); +writel (0x9 , ®s->reg[0x9012b ]); +writel (0x0 , ®s->reg[0x9012c ]); +writel (0x1a9 , ®s->reg[0x9012d ]); +writel (0x0 , ®s->reg[0x9012e ]); +writel (0x408 , ®s->reg[0x9012f ]); +writel (0x169 , ®s->reg[0x90130 ]); +writel (0x0 , ®s->reg[0x90131 ]); +writel (0x8080 , ®s->reg[0x90132 ]); +writel (0x108 , ®s->reg[0x90133 ]); +writel (0x8 , ®s->reg[0x90134 ]); +writel (0x7aa , ®s->reg[0x90135 ]); +writel (0x6a , ®s->reg[0x90136 ]); +writel (0x0 , ®s->reg[0x90137 ]); +writel (0x8568 , ®s->reg[0x90138 ]); +writel (0x108 , ®s->reg[0x90139 ]); +writel (0xb7 , ®s->reg[0x9013a ]); +writel (0x790 , ®s->reg[0x9013b ]); +writel (0x16a , ®s->reg[0x9013c ]); +writel (0x1d , ®s->reg[0x9013d ]); +writel (0x0 , ®s->reg[0x9013e ]); +writel (0x68 , ®s->reg[0x9013f ]); +writel (0x8 , ®s->reg[0x90140 ]); +writel (0x8558 , ®s->reg[0x90141 ]); +writel (0x168 , ®s->reg[0x90142 ]); +writel (0xf , ®s->reg[0x90143 ]); +writel (0x408 , ®s->reg[0x90144 ]); +writel (0x169 , ®s->reg[0x90145 ]); +writel (0xc , ®s->reg[0x90146 ]); +writel (0x0 , ®s->reg[0x90147 ]); +writel (0x68 , ®s->reg[0x90148 ]); +writel (0x0 , ®s->reg[0x90149 ]); +writel (0x408 , ®s->reg[0x9014a ]); +writel (0x169 , ®s->reg[0x9014b ]); +writel (0x0 , ®s->reg[0x9014c ]); +writel (0x8558 , ®s->reg[0x9014d ]); +writel (0x168 , ®s->reg[0x9014e ]); +writel (0x8 , ®s->reg[0x9014f ]); +writel (0x3c8 , ®s->reg[0x90150 ]); +writel (0x1a9 , ®s->reg[0x90151 ]); +writel (0x3 , ®s->reg[0x90152 ]); +writel (0x370 , ®s->reg[0x90153 ]); +writel (0x129 , ®s->reg[0x90154 ]); +writel (0x20 , ®s->reg[0x90155 ]); +writel (0x2aa , ®s->reg[0x90156 ]); +writel (0x9 , ®s->reg[0x90157 ]); +writel (0x0 , ®s->reg[0x90158 ]); +writel (0x400 , ®s->reg[0x90159 ]); +writel (0x10e , ®s->reg[0x9015a ]); +writel (0x8 , ®s->reg[0x9015b ]); +writel (0xe8 , ®s->reg[0x9015c ]); +writel (0x109 , ®s->reg[0x9015d ]); +writel (0x0 , ®s->reg[0x9015e ]); +writel (0x8140 , ®s->reg[0x9015f ]); +writel (0x10c , ®s->reg[0x90160 ]); +writel (0x10 , ®s->reg[0x90161 ]); +writel (0x8138 , ®s->reg[0x90162 ]); +writel (0x10c , ®s->reg[0x90163 ]); +writel (0x8 , ®s->reg[0x90164 ]); +writel (0x7c8 , ®s->reg[0x90165 ]); +writel (0x101 , ®s->reg[0x90166 ]); +writel (0x8 , ®s->reg[0x90167 ]); +writel (0x0 , ®s->reg[0x90168 ]); +writel (0x8 , ®s->reg[0x90169 ]); +writel (0x8 , ®s->reg[0x9016a ]); +writel (0x448 , ®s->reg[0x9016b ]); +writel (0x109 , ®s->reg[0x9016c ]); +writel (0xf , ®s->reg[0x9016d ]); +writel (0x7c0 , ®s->reg[0x9016e ]); +writel (0x109 , ®s->reg[0x9016f ]); +writel (0x0 , ®s->reg[0x90170 ]); +writel (0xe8 , ®s->reg[0x90171 ]); +writel (0x109 , ®s->reg[0x90172 ]); +writel (0x47 , ®s->reg[0x90173 ]); +writel (0x630 , ®s->reg[0x90174 ]); +writel (0x109 , ®s->reg[0x90175 ]); +writel (0x8 , ®s->reg[0x90176 ]); +writel (0x618 , ®s->reg[0x90177 ]); +writel (0x109 , ®s->reg[0x90178 ]); +writel (0x8 , ®s->reg[0x90179 ]); +writel (0xe0 , ®s->reg[0x9017a ]); +writel (0x109 , ®s->reg[0x9017b ]); +writel (0x0 , ®s->reg[0x9017c ]); +writel (0x7c8 , ®s->reg[0x9017d ]); +writel (0x109 , ®s->reg[0x9017e ]); +writel (0x8 , ®s->reg[0x9017f ]); +writel (0x8140 , ®s->reg[0x90180 ]); +writel (0x10c , ®s->reg[0x90181 ]); +writel (0x0 , ®s->reg[0x90182 ]); +writel (0x1 , ®s->reg[0x90183 ]); +writel (0x8 , ®s->reg[0x90184 ]); +writel (0x8 , ®s->reg[0x90185 ]); +writel (0x4 , ®s->reg[0x90186 ]); +writel (0x8 , ®s->reg[0x90187 ]); +writel (0x8 , ®s->reg[0x90188 ]); +writel (0x7c8 , ®s->reg[0x90189 ]); +writel (0x101 , ®s->reg[0x9018a ]); +writel (0x0 , ®s->reg[0x90006 ]); +writel (0x0 , ®s->reg[0x90007 ]); +writel (0x8 , ®s->reg[0x90008 ]); +writel (0x0 , ®s->reg[0x90009 ]); +writel (0x0 , ®s->reg[0x9000a ]); +writel (0x0 , ®s->reg[0x9000b ]); +writel (0x400 , ®s->reg[0xd00e7 ]); +writel (0x0 , ®s->reg[0x90017 ]); +writel (0x2a , ®s->reg[0x9001f ]); +writel (0x6a , ®s->reg[0x90026 ]); +writel (0x0 , ®s->reg[0x400d0 ]); +writel (0x101 , ®s->reg[0x400d1 ]); +writel (0x105 , ®s->reg[0x400d2 ]); +writel (0x107 , ®s->reg[0x400d3 ]); +writel (0x10f , ®s->reg[0x400d4 ]); +writel (0x202 , ®s->reg[0x400d5 ]); +writel (0x20a , ®s->reg[0x400d6 ]); +writel (0x20b , ®s->reg[0x400d7 ]); +writel (0x2 , ®s->reg[0x2003a ]); +writel (0x0 , ®s->reg[0x9000c ]); +writel (0x173 , ®s->reg[0x9000d ]); +writel (0x60 , ®s->reg[0x9000e ]); +writel (0x6110 , ®s->reg[0x9000f ]); +writel (0x2152 , ®s->reg[0x90010 ]); +writel (0xdfbd , ®s->reg[0x90011 ]); +writel (0x60 , ®s->reg[0x90012 ]); +writel (0x6152 , ®s->reg[0x90013 ]); +writel (0x5a , ®s->reg[0x20010 ]); +writel (0x3 , ®s->reg[0x20011 ]); +writel (0xe0 , ®s->reg[0x40080 ]); +writel (0x12 , ®s->reg[0x40081 ]); +writel (0xe0 , ®s->reg[0x40082 ]); +writel (0x12 , ®s->reg[0x40083 ]); +writel (0xe0 , ®s->reg[0x40084 ]); +writel (0x12 , ®s->reg[0x40085 ]); +writel (0xf , ®s->reg[0x400fd ]); +writel (0x1 , ®s->reg[0x10011 ]); +writel (0x1 , ®s->reg[0x10012 ]); +writel (0x180 , ®s->reg[0x10013 ]); +writel (0x1 , ®s->reg[0x10018 ]); +writel (0x6209 , ®s->reg[0x10002 ]); +writel (0x1 , ®s->reg[0x100b2 ]); +writel (0x1 , ®s->reg[0x101b4 ]); +writel (0x1 , ®s->reg[0x102b4 ]); +writel (0x1 , ®s->reg[0x103b4 ]); +writel (0x1 , ®s->reg[0x104b4 ]); +writel (0x1 , ®s->reg[0x105b4 ]); +writel (0x1 , ®s->reg[0x106b4 ]); +writel (0x1 , ®s->reg[0x107b4 ]); +writel (0x1 , ®s->reg[0x108b4 ]); +writel (0x1 , ®s->reg[0x11011 ]); +writel (0x1 , ®s->reg[0x11012 ]); +writel (0x180 , ®s->reg[0x11013 ]); +writel (0x1 , ®s->reg[0x11018 ]); +writel (0x6209 , ®s->reg[0x11002 ]); +writel (0x1 , ®s->reg[0x110b2 ]); +writel (0x1 , ®s->reg[0x111b4 ]); +writel (0x1 , ®s->reg[0x112b4 ]); +writel (0x1 , ®s->reg[0x113b4 ]); +writel (0x1 , ®s->reg[0x114b4 ]); +writel (0x1 , ®s->reg[0x115b4 ]); +writel (0x1 , ®s->reg[0x116b4 ]); +writel (0x1 , ®s->reg[0x117b4 ]); +writel (0x1 , ®s->reg[0x118b4 ]); +writel (0x1 , ®s->reg[0x12011 ]); +writel (0x1 , ®s->reg[0x12012 ]); +writel (0x180 , ®s->reg[0x12013 ]); +writel (0x1 , ®s->reg[0x12018 ]); +writel (0x6209 , ®s->reg[0x12002 ]); +writel (0x1 , ®s->reg[0x120b2 ]); +writel (0x1 , ®s->reg[0x121b4 ]); +writel (0x1 , ®s->reg[0x122b4 ]); +writel (0x1 , ®s->reg[0x123b4 ]); +writel (0x1 , ®s->reg[0x124b4 ]); +writel (0x1 , ®s->reg[0x125b4 ]); +writel (0x1 , ®s->reg[0x126b4 ]); +writel (0x1 , ®s->reg[0x127b4 ]); +writel (0x1 , ®s->reg[0x128b4 ]); +writel (0x1 , ®s->reg[0x13011 ]); +writel (0x1 , ®s->reg[0x13012 ]); +writel (0x180 , ®s->reg[0x13013 ]); +writel (0x1 , ®s->reg[0x13018 ]); +writel (0x6209 , ®s->reg[0x13002 ]); +writel (0x1 , ®s->reg[0x130b2 ]); +writel (0x1 , ®s->reg[0x131b4 ]); +writel (0x1 , ®s->reg[0x132b4 ]); +writel (0x1 , ®s->reg[0x133b4 ]); +writel (0x1 , ®s->reg[0x134b4 ]); +writel (0x1 , ®s->reg[0x135b4 ]); +writel (0x1 , ®s->reg[0x136b4 ]); +writel (0x1 , ®s->reg[0x137b4 ]); +writel (0x1 , ®s->reg[0x138b4 ]); +writel (0x2 , ®s->reg[0x2003a ]); +writel (0x2 , ®s->reg[0xc0080 ]); +writel (0x1 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x000d0000 ]); +readl (®s->reg[0x00020010 ]); +writel (0x6a , ®s->reg[0x00020010 ]); +readl (®s->reg[0x0002001d ]); +writel (0x1 , ®s->reg[0x0002001d ]); +/* +* CalBusy.0 =1, indicates the calibrator is actively calibrating. +* Wait Calibrating done. +*/ + ret =readl_poll_timeout (®s->reg[0x20097 ], val, + !(val &BIT (1 )),1000 ); +if (ret) +puts ("CalBusy.0 timeout\n" ); + +writel (0x0 , ®s->reg[0xd0000 ]); +writel (0x0 , ®s->reg[0x2006e ]); +}board/freescale/mx8mq_evk/ddr/helper.c new file +101
-0@@ -0,0 +1,101 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <spl.h> +#include <asm/io.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/sections.h> +#include <asm/arch/ddr.h> +#include <asm/arch/sys_proto.h> + +DECLARE_GLOBAL_DATA_PTR ; + +#define IMEM_LEN 32768 +#define DMEM_LEN 16384 +#define IMEM_2D_OFFSET 49152 + +#define IMEM_OFFSET_ADDR 0x00050000 +#define DMEM_OFFSET_ADDR 0x00054000 +#define DDR_TRAIN_CODE_BASE_ADDR IP2APB_DDRPHY_IPS_BASE_ADDR(0) + +/* We need PHY iMEM PHY is 32KB padded */ +void ddr_load_train_code (enum fw_type type) +{ +u32 tmp32, i; +u32 error =0 ; +unsigned long pr_to32, pr_from32; +unsigned long fw_offset = type ?IMEM_2D_OFFSET :0 ; +unsigned long imem_start = (unsigned long )&_end + fw_offset; +unsigned long dmem_start = imem_start +IMEM_LEN ; + + pr_from32 = imem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; +for (i =0x0 ; i <IMEM_LEN ; ) { + tmp32 =readl (pr_from32); +writew (tmp32 &0x0000ffff , pr_to32); + pr_to32 +=4 ; +writew ((tmp32 >>16 ) &0x0000ffff , pr_to32); + pr_to32 +=4 ; + pr_from32 +=4 ; + i +=4 ; + } + + pr_from32 = dmem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; +for (i =0x0 ; i <DMEM_LEN ;) { + tmp32 =readl (pr_from32); +writew (tmp32 &0x0000ffff , pr_to32); + pr_to32 +=4 ; +writew ((tmp32 >>16 ) &0x0000ffff , pr_to32); + pr_to32 +=4 ; + pr_from32 +=4 ; + i +=4 ; + } + +debug ("check ddr4_pmu_train_imem code\n" ); + pr_from32 = imem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *IMEM_OFFSET_ADDR ; +for (i =0x0 ; i <IMEM_LEN ;) { + tmp32 = (readw (pr_to32) &0x0000ffff ); + pr_to32 +=4 ; + tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 ); + +if (tmp32 !=readl (pr_from32)) { +printf ("%lx %lx\n" , pr_from32, pr_to32); + error++; + } + pr_from32 +=4 ; + pr_to32 +=4 ; + i +=4 ; + } +if (error) +printf ("check ddr4_pmu_train_imem code fail=%d\n" , error); +else +debug ("check ddr4_pmu_train_imem code pass\n" ); + +debug ("check ddr4_pmu_train_dmem code\n" ); + pr_from32 = dmem_start; + pr_to32 =DDR_TRAIN_CODE_BASE_ADDR +4 *DMEM_OFFSET_ADDR ; +for (i =0x0 ; i <DMEM_LEN ;) { + tmp32 = (readw (pr_to32) &0x0000ffff ); + pr_to32 +=4 ; + tmp32 += ((readw (pr_to32) &0x0000ffff ) <<16 ); +if (tmp32 !=readl (pr_from32)) { +printf ("%lx %lx\n" , pr_from32, pr_to32); + error++; + } + pr_from32 +=4 ; + pr_to32 +=4 ; + i +=4 ; + } + +if (error) +printf ("check ddr4_pmu_train_dmem code fail=%d" , error); +else +debug ("check ddr4_pmu_train_dmem code pass\n" ); +}board/freescale/mx8mq_evk/mx8mq_evk.c new file +156
-0@@ -0,0 +1,156 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <malloc.h> +#include <errno.h> +#include <asm/io.h> +#include <miiphy.h> +#include <netdev.h> +#include <asm/mach-imx/iomux-v3.h> +#include <asm-generic/gpio.h> +#include <fsl_esdhc.h> +#include <mmc.h> +#include <asm/arch/mx8mq_pins.h> +#include <asm/arch/sys_proto.h> +#include <asm/mach-imx/gpio.h> +#include <asm/mach-imx/mxc_i2c.h> +#include <asm/arch/clock.h> +#include <spl.h> +#include <power/pmic.h> +#include <power/pfuze100_pmic.h> +#include "../common/pfuze.h" + +DECLARE_GLOBAL_DATA_PTR ; + +#define QSPI_PAD_CTRL (PAD_CTL_DSE2 | PAD_CTL_HYS) + +#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1) + +#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) + +static iomux_v3_cfg_t const wdog_pads[] = { +IMX8MQ_PAD_GPIO1_IO02__WDOG1_WDOG_B |MUX_PAD_CTRL (WDOG_PAD_CTRL ), +}; + +#ifdef CONFIG_FSL_QSPI +static iomux_v3_cfg_t const qspi_pads[] = { +IMX8MQ_PAD_NAND_ALE__QSPI_A_SCLK |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_CE0_B__QSPI_A_SS0_B |MUX_PAD_CTRL (QSPI_PAD_CTRL ), + +IMX8MQ_PAD_NAND_DATA00__QSPI_A_DATA0 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_DATA01__QSPI_A_DATA1 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_DATA02__QSPI_A_DATA2 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +IMX8MQ_PAD_NAND_DATA03__QSPI_A_DATA3 |MUX_PAD_CTRL (QSPI_PAD_CTRL ), +}; + +int board_qspi_init (void ) +{ +imx_iomux_v3_setup_multiple_pads (qspi_pads,ARRAY_SIZE (qspi_pads)); + +set_clk_qspi (); + +return 0 ; +} +#endif + +static iomux_v3_cfg_t const uart_pads[] = { +IMX8MQ_PAD_UART1_RXD__UART1_RX |MUX_PAD_CTRL (UART_PAD_CTRL ), +IMX8MQ_PAD_UART1_TXD__UART1_TX |MUX_PAD_CTRL (UART_PAD_CTRL ), +}; + +int board_early_init_f (void ) +{ +struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR ; + +imx_iomux_v3_setup_multiple_pads (wdog_pads,ARRAY_SIZE (wdog_pads)); +set_wdog_reset (wdog); + +imx_iomux_v3_setup_multiple_pads (uart_pads,ARRAY_SIZE (uart_pads)); + +return 0 ; +} + +int dram_init (void ) +{ +/* rom_pointer[1] contains the size of TEE occupies */ +if (rom_pointer[1 ]) + gd->ram_size =PHYS_SDRAM_SIZE - rom_pointer[1 ]; +else + gd->ram_size =PHYS_SDRAM_SIZE ; + +return 0 ; +} + +#ifdef CONFIG_FEC_MXC +#define FEC_RST_PAD IMX_GPIO_NR(1, 9) +static iomux_v3_cfg_t const fec1_rst_pads[] = { +IMX8MQ_PAD_GPIO1_IO09__GPIO1_IO9 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; + +static void setup_iomux_fec (void ) +{ +imx_iomux_v3_setup_multiple_pads (fec1_rst_pads, +ARRAY_SIZE (fec1_rst_pads)); + +gpio_request (IMX_GPIO_NR (1 ,9 ),"fec1_rst" ); +gpio_direction_output (IMX_GPIO_NR (1 ,9 ),0 ); +udelay (500 ); +gpio_direction_output (IMX_GPIO_NR (1 ,9 ),1 ); +} + +static int setup_fec (void ) +{ +struct iomuxc_gpr_base_regs *gpr = + (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR ; + +setup_iomux_fec (); + +/* Use 125M anatop REF_CLK1 for ENET1, not from external */ +clrsetbits_le32 (&gpr->gpr[1 ],BIT (13 ) |BIT (17 ),0 ); +return set_clk_enet (ENET_125MHZ ); +} + +int board_phy_config (struct phy_device *phydev) +{ +/* enable rgmii rxc skew and phy mode select to RGMII copper */ +phy_write (phydev,MDIO_DEVAD_NONE ,0x1d ,0x1f ); +phy_write (phydev,MDIO_DEVAD_NONE ,0x1e ,0x8 ); + +phy_write (phydev,MDIO_DEVAD_NONE ,0x1d ,0x05 ); +phy_write (phydev,MDIO_DEVAD_NONE ,0x1e ,0x100 ); + +if (phydev->drv->config) + phydev->drv->config (phydev); +return 0 ; +} +#endif + +int board_init (void ) +{ +board_qspi_init (); + +#ifdef CONFIG_FEC_MXC +setup_fec (); +#endif + +return 0 ; +} + +int board_mmc_get_env_dev (int devno) +{ +return devno; +} + +int board_late_init (void ) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +env_set ("board_name" ,"EVK" ); +env_set ("board_rev" ,"iMX8MQ" ); +#endif + +return 0 ; +}board/freescale/mx8mq_evk/spl.c new file +230
-0@@ -0,0 +1,230 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/arch/ddr.h> +#include <asm/arch/mx8mq_pins.h> +#include <asm/arch/sys_proto.h> +#include <asm/arch/clock.h> +#include <asm/mach-imx/iomux-v3.h> +#include <asm/mach-imx/gpio.h> +#include <asm/mach-imx/mxc_i2c.h> +#include <fsl_esdhc.h> +#include <mmc.h> +#include <power/pmic.h> +#include <power/pfuze100_pmic.h> +#include <spl.h> +#include "../common/pfuze.h" + +DECLARE_GLOBAL_DATA_PTR ; + +void spl_dram_init (void ) +{ +/* ddr init */ +ddr_init (); +} + +#define I2C_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE) +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) +struct i2c_pads_info i2c_pad_info1 = { + .scl = { + .i2c_mode =IMX8MQ_PAD_I2C1_SCL__I2C1_SCL |PC , + .gpio_mode =IMX8MQ_PAD_I2C1_SCL__GPIO5_IO14 |PC , + .gp =IMX_GPIO_NR (5 ,14 ), + }, + .sda = { + .i2c_mode =IMX8MQ_PAD_I2C1_SDA__I2C1_SDA |PC , + .gpio_mode =IMX8MQ_PAD_I2C1_SDA__GPIO5_IO15 |PC , + .gp =IMX_GPIO_NR (5 ,15 ), + }, +}; + +#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 12) +#define USDHC1_PWR_GPIO IMX_GPIO_NR(2, 10) +#define USDHC2_PWR_GPIO IMX_GPIO_NR(2, 19) + +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 USDHC1_BASE_ADDR : + ret =1 ; +break ; +case USDHC2_BASE_ADDR : + ret = !gpio_get_value (USDHC2_CD_GPIO ); +return ret; + } + +return 1 ; +} + +#define USDHC_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE | \ + PAD_CTL_FSEL2) + +static iomux_v3_cfg_t const usdhc1_pads[] = { +IMX8MQ_PAD_SD1_CLK__USDHC1_CLK |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_CMD__USDHC1_CMD |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA0__USDHC1_DATA0 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA1__USDHC1_DATA1 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA2__USDHC1_DATA2 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA3__USDHC1_DATA3 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA4__USDHC1_DATA4 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA5__USDHC1_DATA5 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA6__USDHC1_DATA6 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_DATA7__USDHC1_DATA7 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD1_RESET_B__GPIO2_IO10 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; + +static iomux_v3_cfg_t const usdhc2_pads[] = { +IMX8MQ_PAD_SD2_CLK__USDHC2_CLK |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_CMD__USDHC2_CMD |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA0__USDHC2_DATA0 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA1__USDHC2_DATA1 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA2__USDHC2_DATA2 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_DATA3__USDHC2_DATA3 |MUX_PAD_CTRL (USDHC_PAD_CTRL ), +IMX8MQ_PAD_SD2_CD_B__GPIO2_IO12 |MUX_PAD_CTRL (NO_PAD_CTRL ), +IMX8MQ_PAD_SD2_RESET_B__GPIO2_IO19 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; + +static struct fsl_esdhc_cfg usdhc_cfg[2 ] = { + {USDHC1_BASE_ADDR ,0 ,8 }, + {USDHC2_BASE_ADDR ,0 ,4 }, +}; + +int board_mmc_init (bd_t *bis) +{ +int i, ret; +/* +* According to the board_mmc_init() the following map is done: +* (U-Boot device node) (Physical Port) +* mmc0 USDHC1 +* mmc1 USDHC2 +*/ +for (i =0 ; i <CONFIG_SYS_FSL_USDHC_NUM ; i++) { +switch (i) { +case 0 : +init_clk_usdhc (0 ); + usdhc_cfg[0 ].sdhc_clk =mxc_get_clock (USDHC1_CLK_ROOT ); +imx_iomux_v3_setup_multiple_pads ( + usdhc1_pads,ARRAY_SIZE (usdhc1_pads)); +gpio_request (USDHC1_PWR_GPIO ,"usdhc1_reset" ); +gpio_direction_output (USDHC1_PWR_GPIO ,0 ); +udelay (500 ); +gpio_direction_output (USDHC1_PWR_GPIO ,1 ); +break ; +case 1 : +init_clk_usdhc (1 ); + usdhc_cfg[1 ].sdhc_clk =mxc_get_clock (USDHC2_CLK_ROOT ); +imx_iomux_v3_setup_multiple_pads ( + usdhc2_pads,ARRAY_SIZE (usdhc2_pads)); +gpio_request (USDHC2_PWR_GPIO ,"usdhc2_reset" ); +gpio_direction_output (USDHC2_PWR_GPIO ,0 ); +udelay (500 ); +gpio_direction_output (USDHC2_PWR_GPIO ,1 ); +break ; +default : +printf ("Warning: you configured more USDHC controllers(%d) than supported by the board\n" , i +1 ); +return -EINVAL ; + } + + ret =fsl_esdhc_initialize (bis, &usdhc_cfg[i]); +if (ret) +return ret; + } + +return 0 ; +} + +#ifdef CONFIG_POWER +#define I2C_PMIC 0 +int power_init_board (void ) +{ +struct pmic *p; +int ret; +unsigned int reg; + + ret =power_pfuze100_init (I2C_PMIC ); +if (ret) +return -ENODEV ; + + p =pmic_get ("PFUZE100" ); + ret =pmic_probe (p); +if (ret) +return -ENODEV ; + +pmic_reg_read (p,PFUZE100_DEVICEID , ®); +printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); + +pmic_reg_read (p,PFUZE100_SW3AVOL , ®); +if ((reg &0x3f ) !=0x18 ) { + reg &= ~0x3f ; + reg |=0x18 ; +pmic_reg_write (p,PFUZE100_SW3AVOL , reg); + } + + ret =pfuze_mode_init (p,APS_PFM ); +if (ret <0 ) +return ret; + +return 0 ; +} +#endif + +void spl_board_init (void ) +{ +enable_tzc380 (); + +/* Adjust pmic voltage to 1.0V for 800M */ +setup_i2c (0 ,CONFIG_SYS_I2C_SPEED ,0x7f , &i2c_pad_info1); + +power_init_board (); + +/* DDR initialization */ +spl_dram_init (); + +/* Serial download mode */ +if (is_usb_boot ()) { +puts ("Back to ROM, SDP\n" ); +restore_boot_params (); + } +puts ("Normal Boot\n" ); +} + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match (const char *name) +{ +/* Just empty function now - can't decide what to choose */ +debug ("%s: %s\n" , __func__, name); + +return 0 ; +} +#endif + +void board_init_f (ulong dummy) +{ +/* Clear global data */ +memset ((void *)gd,0 ,sizeof (gd_t)); + +arch_cpu_init (); + +init_uart_clk (0 ); + +board_early_init_f (); + +timer_init (); + +preloader_console_init (); + +/* Clear the BSS. */ +memset (__bss_start,0 , __bss_end - __bss_start); + +board_init_r (NULL ,0 ); +}configs/mx8mq_evk_defconfig new file +27
-0@@ -0,0 +1,27 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX8M=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_TARGET_MX8MQ_EVK=y +CONFIG_DEFAULT_DEVICE_TREE="fsl-imx8mq-evk" +CONFIG_FIT=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_SPL=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_I2C=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_REGULATOR=y +CONFIG_OF_CONTROL=y +CONFIG_DM_GPIO=y +CONFIG_DM_I2C=y +CONFIG_DM_MMC=y +CONFIG_DM_ETH=y +CONFIG_PINCTRL=y +CONFIG_DM_PMIC_PFUZE100=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_PFUZE100=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DM_THERMAL=y +CONFIG_FS_FAT=yinclude/configs/mx8mq_evk.h new file +269
-0@@ -0,0 +1,269 @@ +/* +* Copyright 2017 NXP +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __IMX8M_EVK_H +#define __IMX8M_EVK_H + +#include <linux/sizes.h> +#include <asm/arch/imx-regs.h> + +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CSF_SIZE 0x2000/* 8K region */ +#endif + +#define CONFIG_SPL_FRAMEWORK +#define CONFIG_SPL_TEXT_BASE 0x7E1000 +#define CONFIG_SPL_MAX_SIZE (124 * 1024) +#define CONFIG_SYS_MONITOR_LEN (512 * 1024) +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x300 +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 + +#ifdef CONFIG_SPL_BUILD +/*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/ +#define CONFIG_SPL_WATCHDOG_SUPPORT +#define CONFIG_SPL_DRIVERS_MISC_SUPPORT +#define CONFIG_SPL_POWER_SUPPORT +#define CONFIG_SPL_I2C_SUPPORT +#define CONFIG_SPL_BOARD_INIT +#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv8/u-boot-spl.lds" +#define CONFIG_SPL_STACK 0x187FF0 +#define CONFIG_SPL_LIBCOMMON_SUPPORT +#define CONFIG_SPL_LIBGENERIC_SUPPORT +#define CONFIG_SPL_SERIAL_SUPPORT +#define CONFIG_SPL_GPIO_SUPPORT +#define CONFIG_SPL_MMC_SUPPORT +#define CONFIG_SPL_BSS_START_ADDR 0x00180000 +#define CONFIG_SPL_BSS_MAX_SIZE 0x2000/* 8 KB */ +#define CONFIG_SYS_SPL_MALLOC_START 0x00182000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x2000/* 8 KB */ +#define CONFIG_SYS_ICACHE_OFF +#define CONFIG_SYS_DCACHE_OFF + +#define CONFIG_SPL_ABORT_ON_RAW_IMAGE + +#undef CONFIG_DM_MMC +#undef CONFIG_DM_PMIC +#undef CONFIG_DM_PMIC_PFUZE100 + +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */ +#define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */ +#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */ + +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + +#define CONFIG_POWER +#define CONFIG_POWER_I2C +#define CONFIG_POWER_PFUZE100 +#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 +#endif + +#define CONFIG_REMAKE_ELF + +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_BOARD_LATE_INIT + +#undef CONFIG_CMD_EXPORTENV +#undef CONFIG_CMD_IMPORTENV +#undef CONFIG_CMD_IMLS + +#undef CONFIG_CMD_CRC32 +#undef CONFIG_BOOTM_NETBSD + +/* ENET Config */ +/* ENET1 */ +#if defined(CONFIG_CMD_NET ) +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_MII +#define CONFIG_MII +#define CONFIG_ETHPRIME "FEC" + +#define CONFIG_FEC_MXC +#define CONFIG_FEC_XCV_TYPE RGMII +#define CONFIG_FEC_MXC_PHYADDR 0 +#define FEC_QUIRK_ENET_MAC + +#define CONFIG_PHY_GIGE +#define IMX_FEC_BASE 0x30BE0000 + +#define CONFIG_PHYLIB +#define CONFIG_PHY_ATHEROS +#endif + +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + "clk_ignore_unused "\ + "\0" \ + "initrd_addr=0x43800000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;booti ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ +/* Initial environment variables */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ + "script=boot.scr\0" \ + "image=Image\0" \ + "console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200\0" \ + "fdt_addr=0x43000000\0" \ + "fdt_high=0xffffffffffffffff\0" \ + "boot_fdt=try\0" \ + "fdt_file=fsl-imx8mq-evk.dtb\0" \ + "initrd_addr=0x43800000\0" \ + "initrd_high=0xffffffffffffffff\0" \ + "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ + "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ + "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ + "mmcautodetect=yes\0" \ + "mmcargs=setenv bootargs console=${console} root=${mmcroot}\0 " \ + "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "bootscript=echo Running bootscript from mmc ...; " \ + "source\0" \ + "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ + "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "mmcboot=echo Booting from mmc ...; " \ + "run mmcargs; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if run loadfdt; then " \ + "booti ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "else " \ + "echo wait for boot; " \ + "fi;\0" \ + "netargs=setenv bootargs console=${console} " \ + "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ + "netboot=echo Booting from net ...; " \ + "run netargs; " \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "${get_cmd} ${loadaddr} ${image}; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ + "booti ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "else " \ + "booti; " \ + "fi;\0" + +#define CONFIG_BOOTCOMMAND \ + "mmc dev ${mmcdev}; if mmc rescan; then " \ + "if run loadbootscript; then " \ + "run bootscript; " \ + "else " \ + "if run loadimage; then " \ + "run mmcboot; " \ + "else run netboot; " \ + "fi; " \ + "fi; " \ + "else booti ${loadaddr} - ${fdt_addr}; fi" + +/* Link Definitions */ +#define CONFIG_LOADADDR 0x40480000 +#define CONFIG_SYS_TEXT_BASE 0x40200000 + +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR + +#define CONFIG_SYS_INIT_RAM_ADDR 0x40000000 +#define CONFIG_SYS_INIT_RAM_SIZE 0x80000 +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + +#define CONFIG_ENV_OVERWRITE +#define CONFIG_ENV_OFFSET (64 * SZ_64K) +#define CONFIG_ENV_SIZE 0x1000 +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_MMC_ENV_DEV 1/* USDHC2 */ +#define CONFIG_MMCROOT "/dev/mmcblk1p2"/* USDHC2 */ + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (2 * 1024)) * 1024) + +#define CONFIG_SYS_SDRAM_BASE 0x40000000 +#define PHYS_SDRAM 0x40000000 +#define PHYS_SDRAM_SIZE 0xC0000000/* 3GB DDR */ +#define CONFIG_NR_DRAM_BANKS 1 + +#define CONFIG_BAUDRATE 115200 + +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE UART1_BASE_ADDR + +/* Monitor Command Prompt */ +#undef CONFIG_SYS_PROMPT +#define CONFIG_SYS_PROMPT "u-boot=> " +#define CONFIG_SYS_LONGHELP +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_CBSIZE 1024 +#define CONFIG_SYS_MAXARGS 64 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_CMDLINE_EDITING + +#define CONFIG_IMX_BOOTAUX + +#define CONFIG_CMD_MMC +#define CONFIG_FSL_ESDHC +#define CONFIG_FSL_USDHC + +#define CONFIG_SYS_FSL_USDHC_NUM 2 +#define CONFIG_SYS_FSL_ESDHC_ADDR 0 + +#define CONFIG_DOS_PARTITION +#define CONFIG_CMD_EXT2 +#define CONFIG_CMD_EXT4 +#define CONFIG_CMD_EXT4_WRITE +#define CONFIG_CMD_FAT + +#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ +#define CONFIG_SYS_MMC_IMG_LOAD_PART 1 + +#define CONFIG_FSL_QSPI /* enable the QUADSPI driver */ +#ifdef CONFIG_FSL_QSPI +#define CONFIG_CMD_SF +#define CONFIG_SPI_FLASH +#define CONFIG_SPI_FLASH_STMICRO +#define CONFIG_SPI_FLASH_BAR +#define CONFIG_SF_DEFAULT_BUS 0 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 40000000 +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 + +#define FSL_QSPI_FLASH_SIZE (SZ_32M) +#define FSL_QSPI_FLASH_NUM 1 +#endif + +#define CONFIG_MXC_GPIO + +#define CONFIG_MXC_OCOTP +#define CONFIG_CMD_FUSE + +/* I2C Configs */ +#define CONFIG_SYS_I2C_SPEED 100000 + +#define CONFIG_OF_SYSTEM_SETUP + +#ifndef CONFIG_SPL_BUILD +#define CONFIG_DM_PMIC +#endif + +#endif
Signature · 5 lines
Developer of free digital technology and hardware support. Website: https://www.paulk.fr/ Coding blog: https://code.paulk.fr/ Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
PATCH v5 31/31 imx: add i.MX8MQ EVK support
(resending trimmed version to pass the U-Boot size limit filter ...)
Hi,
Quoted 7 lines · Paul Kocialkowski
Hi there,
Quoted 3 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
Quoted 8 lines
First off, I'd like to express my gratitude for this port: the i.MX8 looks like a great platform and it's really nice to see support for it land in U-Boot!
Regarding the integration of i.MX8 with upstream software in general:
are there plans to upstream the ARM Trusted Firmware port for i.MX8? It would be great to have both U-Boot and ATF upstream support to achieve a boot chain with (mostly-)free and upstream software.
The support for i.MX8QX and i.MX8QM has been merged into the official ATF repo yesterday:
https://github.com/ARM-software/arm-trusted-firmware/pull/1410
I am bit lost in the naming here (i.MX8QM vs i.MX8MQ), but I think that should answer your question.
Quoted 10 lines
On that note, are there proprietary components involved in the boot process, other than the already-identified DDR training firmware for the DDR PHY?
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
I agree on not wanting a blob for that, although that depends a bit on what it does: If it's an not-signed binary, that just does the training and then goes out of the way, and shipping the binary is reasonably licensed, then it might be beneficial to have it, at least for now. AFAIK actual DRAM training for a wide range of chips is not trivial, so there is probably some value in that blob.
For specific boards with soldered chips: can't we dump the results of the training and use that for a static configuration? It is my understanding that the DRAM controller parameters depend on actual voltage and also temperature, but we might get some good enough values for a reasonable range of both? This would make this blob optional then, and people could decide for their own.
Cheers,
Andre.
Quoted 82 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
Thanks in advance for your time and consideration of these questions!
Cheers,
Paul
Quoted 59 lines
The boot log with Arm trusted firmware console enabled:
"
U-Boot SPL 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56)
PMIC: PFUZE100 ID=0x10
Normal Boot
Trying to boot from MMC2NOTICE: Configureing TZASC380 NOTICE: BL31: v1.4(release):o8.0.0_1.3.0_8m-prc-20171211-6-g54fb0797-dirty NOTICE: BL31: Built : 07:17:16, Jan 8 2018 NOTICE: sip svc initU-Boot 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56 +0800)
CPU: Freescale i.MX8MQ rev2.0 at 1000 MHz Reset cause: POR Model: Freescale i.MX8MQ EVK DRAM: 3 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1Using default environment
In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0u-boot=>
"Signed-off-by Peng Fan <[email protected]>Cc Fabio Estevam <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/include/asm/arch-mx8m/ddr.h | 9 + arch/arm/mach-imx/mx8m/Kconfig | 12 + board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + include/configs/mx8mq_evk.h | 269 ++++++ 14 files changed, 2819 insertions(+) create mode 100644 arch/arm/dts/fsl-imx8mq-evk.dts create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.h
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Hi,
Quoted 21 lines · Andre Przywara
(resending trimmed version to pass the U-Boot size limit filter ...)
Hi,
Quoted 7 lines · Paul Kocialkowski
Hi there,
Quoted 3 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
Quoted 8 lines
First off, I'd like to express my gratitude for this port: the i.MX8 looks like a great platform and it's really nice to see support for it land in U-Boot!
Regarding the integration of i.MX8 with upstream software in general:
are there plans to upstream the ARM Trusted Firmware port for i.MX8? It would be great to have both U-Boot and ATF upstream support to achieve a boot chain with (mostly-)free and upstream software.
Quoted 6 lines
The support for i.MX8QX and i.MX8QM has been merged into the official ATF repo yesterday:
https://github.com/ARM-software/arm-trusted-firmware/pull/1410I am bit lost in the naming here (i.MX8QM vs i.MX8MQ), but I think that should answer your question.
Great to hear and great work! I must admit, I did not even check ATF sources when writing the email from this morning, as it seemed too early anyway.
I'm definitely glad I was wrong :)
Quoted 11 lines
Quoted 10 lines
On that note, are there proprietary components involved in the boot process, other than the already-identified DDR training firmware for the DDR PHY?
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
Quoted 4 lines
I agree on not wanting a blob for that, although that depends a bit on what it does: If it's an not-signed binary, that just does the training and then goes out of the way, and shipping the binary is reasonably licensed, then it might be beneficial to have it, at least for now.
Well, that covers some use cases, but definitely does not help with software freedom issues, that can only be solved by either avoiding or liberating that blob. Even following the RYF approach that Purism is considering[0] (moving DDR calibration to a coprocessor) does not help at all with freedom issues and is merely an "exception" that the FSF's RYF certification allows.
I did not mention it, but perhaps NXP is in a positon to ask Designware to free that blob altogether (which would definitely solve the issue at hand here)?
Quoted 8 lines
AFAIK actual DRAM training for a wide range of chips is not trivial, so there is probably some value in that blob.
For specific boards with soldered chips: can't we dump the results of the training and use that for a static configuration? It is my understanding that the DRAM controller parameters depend on actual voltage and also temperature, but we might get some good enough values for a reasonable range of both? This would make this blob optional then, and people could decide for their own.
This is also my understanding and I would totally be satisfied with this approach, as I mentioned earlier.
Thanks for the reply!
Paul
[0]: https://puri.sm/posts/librem5-solving-the-first-fsf-ryf-hurdle/
Quoted 85 lines
Cheers,
Andre.Quoted 82 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
Thanks in advance for your time and consideration of these questions!
Cheers,
Paul
Quoted 59 lines
The boot log with Arm trusted firmware console enabled:
"
U-Boot SPL 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56)
PMIC: PFUZE100 ID=0x10
Normal Boot
Trying to boot from MMC2NOTICE: Configureing TZASC380 NOTICE: BL31: v1.4(release):o8.0.0_1.3.0_8m-prc-20171211-6-g54fb0797-dirty NOTICE: BL31: Built : 07:17:16, Jan 8 2018 NOTICE: sip svc initU-Boot 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56 +0800)
CPU: Freescale i.MX8MQ rev2.0 at 1000 MHz Reset cause: POR Model: Freescale i.MX8MQ EVK DRAM: 3 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1Using default environment
In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0u-boot=>
"Signed-off-by Peng Fan <[email protected]>Cc Fabio Estevam <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/include/asm/arch-mx8m/ddr.h | 9 + arch/arm/mach-imx/mx8m/Kconfig | 12 + board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + include/configs/mx8mq_evk.h | 269 ++++++ 14 files changed, 2819 insertions(+) create mode 100644 arch/arm/dts/fsl-imx8mq-evk.dts create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.h
Signature · 5 lines
Developer of free digital technology and hardware support. Website: https://www.paulk.fr/ Coding blog: https://code.paulk.fr/ Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Quoted 60 lines · Paul Kocialkowski
Hi,
Quoted 21 lines · Andre Przywara
(resending trimmed version to pass the U-Boot size limit filter ...)
Hi,
Quoted 7 lines · Paul Kocialkowski
Hi there,
Quoted 3 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
Quoted 8 lines
First off, I'd like to express my gratitude for this port: the i.MX8 looks like a great platform and it's really nice to see support for it land in U-Boot!
Regarding the integration of i.MX8 with upstream software in general:
are there plans to upstream the ARM Trusted Firmware port for i.MX8? It would be great to have both U-Boot and ATF upstream support to achieve a boot chain with (mostly-)free and upstream software.Quoted 6 lines
The support for i.MX8QX and i.MX8QM has been merged into the official ATF repo yesterday:
https://github.com/ARM-software/arm-trusted-firmware/pull/1410I am bit lost in the naming here (i.MX8QM vs i.MX8MQ), but I think that should answer your question.
Great to hear and great work! I must admit, I did not even check ATF sources when writing the email from this morning, as it seemed too early anyway.
I'm definitely glad I was wrong :)
Quoted 11 lines
Quoted 10 lines
On that note, are there proprietary components involved in the boot process, other than the already-identified DDR training firmware for the DDR PHY?
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
Quoted 4 lines
I agree on not wanting a blob for that, although that depends a bit on what it does: If it's an not-signed binary, that just does the training and then goes out of the way, and shipping the binary is reasonably licensed, then it might be beneficial to have it, at least for now.
Well, that covers some use cases, but definitely does not help with software freedom issues, that can only be solved by either avoiding or liberating that blob. Even following the RYF approach that Purism is considering[0] (moving DDR calibration to a coprocessor) does not help at all with freedom issues and is merely an "exception" that the FSF's RYF certification allows.
Quoted 3 lines
I did not mention it, but perhaps NXP is in a positon to ask Designware to free that blob altogether (which would definitely solve the issue at hand here)?
I meant Synopsys (the company), not Designware (the line of products) here.
Quoted 103 lines
Quoted 8 lines
AFAIK actual DRAM training for a wide range of chips is not trivial, so there is probably some value in that blob.
For specific boards with soldered chips: can't we dump the results of the training and use that for a static configuration? It is my understanding that the DRAM controller parameters depend on actual voltage and also temperature, but we might get some good enough values for a reasonable range of both? This would make this blob optional then, and people could decide for their own.This is also my understanding and I would totally be satisfied with this approach, as I mentioned earlier.
Thanks for the reply!
Paul
[0]: https://puri.sm/posts/librem5-solving-the-first-fsf-ryf-hurdle/
Quoted 85 lines
Cheers,
Andre.Quoted 82 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
Thanks in advance for your time and consideration of these questions!
Cheers,
Paul
Quoted 59 lines
The boot log with Arm trusted firmware console enabled:
"
U-Boot SPL 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56)
PMIC: PFUZE100 ID=0x10
Normal Boot
Trying to boot from MMC2NOTICE: Configureing TZASC380 NOTICE: BL31: v1.4(release):o8.0.0_1.3.0_8m-prc-20171211-6-g54fb0797-dirty NOTICE: BL31: Built : 07:17:16, Jan 8 2018 NOTICE: sip svc initU-Boot 2018.01-00038-gbd426c08ea (Jan 10 2018 - 13:14:56 +0800)
CPU: Freescale i.MX8MQ rev2.0 at 1000 MHz Reset cause: POR Model: Freescale i.MX8MQ EVK DRAM: 3 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1Using default environment
In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0u-boot=>
"Signed-off-by Peng Fan <[email protected]>Cc Fabio Estevam <[email protected]>Cc Stefano Babic <[email protected]>--- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/include/asm/arch-mx8m/ddr.h | 9 + arch/arm/mach-imx/mx8m/Kconfig | 12 + board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + include/configs/mx8mq_evk.h | 269 ++++++ 14 files changed, 2819 insertions(+) create mode 100644 arch/arm/dts/fsl-imx8mq-evk.dts create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.h
Signature · 5 lines
Developer of free digital technology and hardware support. Website: https://www.paulk.fr/ Coding blog: https://code.paulk.fr/ Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
Peng Fan
reviewerPATCH v5 31/31 imx: add i.MX8MQ EVK support
In reply to Paul KocialkowskiHi Paul
Quoted 16 lines
-----Original Message-----
From: Paul Kocialkowski [mailto:contact at paulk.fr]
Sent: 2018年6月20日 16:58
To: Peng Fan <[email protected]>; sbabic at denx.de; Fabio Estevam <[email protected]>
Cc: u-boot at lists.denx.de; andre.przywara at arm.com; Todd Weaver <[email protected]>; Nicole Faerber <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 31/31] imx: add i.MX8MQ EVK supportHi there,
Quoted 3 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
Quoted 6 lines
First off, I'd like to express my gratitude for this port: the i.MX8 looks like a great platform and it's really nice to see support for it land in U-Boot!
Regarding the integration of i.MX8 with upstream software in general:
are there plans to upstream the ARM Trusted Firmware port for i.MX8?
There are i.MX8 i.MX8X i.MX8M product lines for now. This patchset is upstream i.MX8MQ in i.MX8M family.
The i.MX8QM in i.MX8 and i.MX8QXP in i.MX8X has been upstreamed to ATF recently. The i.MX8MQ support will be soon sent to ATF, I think.
Quoted 6 lines
It would be great to have both U-Boot and ATF upstream support to achieve a boot chain with (mostly-)free and upstream software.
On that note, are there proprietary components involved in the boot process, other than the already-identified DDR training firmware for the DDR PHY?
The DDR firmware is not opensource, also there is HDMI firmware. U-Boot will load DDR PHY firmware and initialize DDR controller.
Quoted 7 lines
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
The DDR PHY firmware is not per board. It is required.
There is a ddr tool developed by NXP, like what i.MX6/7 uses, it could generated the script like what this patch contains regarding the ddr part. But the DDR PHY firmware is a must, the DDR PHY firmware will be loaded to a place saying IMEM/DMEM inside DDR PHY.
Quoted 6 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
There are lots lots of registers to configure, honestly, I also do not know the detailed meaning. The ddr code is from DDR team, hard for me to restructure. I suggest you use the DDR tool from NXP to generate the ddr code you need.
Quoted 5 lines
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
The DDR PHY firmware runs inside DDR PHY, it is only DDR TYPE specific, such as DDR4 and LPDDR4 use different DDR PHY firmware.
If different boards use LPDDR4, they could use same firmware.
Quoted 6 lines
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
imx-mkimage, might be good to added into U-Boot as Stefano suggests. Then it will be easy a lot. But the firmware could not be avoided.
Quoted 2 lines
Thanks in advance for your time and consideration of these questions!
Things become complicated, good documentation is required.
Shame on me that the ddr code still be held there.
Regards,
Peng.
Quoted 5 lines
Cheers,
Paul
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Hi and thanks for your anwers!
Quoted 22 lines · Peng Fan
Hi Paul
Quoted 20 lines
-----Original Message-----
From: Paul Kocialkowski [mailto:contact at paulk.fr]
Sent: 2018年6月20日 16:58
To: Peng Fan <[email protected]>; sbabic at denx.de; Fabio Estevam <[email protected]>
Cc: u-boot at lists.denx.de; andre.przywara at arm.com; Todd Weaver <[email protected]>; Nicole Faerber <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 31/31] imx: add i.MX8MQ EVK supportHi there,
Quoted 3 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
First off, I'd like to express my gratitude for this port: the i.MX8 looks like a great platform and it's really nice to see support for it land in U-Boot!
Quoted 8 lines
Quoted 2 lines
Regarding the integration of i.MX8 with upstream software in general:
are there plans to upstream the ARM Trusted Firmware port for i.MX8?There are i.MX8 i.MX8X i.MX8M product lines for now. This patchset is upstream i.MX8MQ in i.MX8M family.
The i.MX8QM in i.MX8 and i.MX8QXP in i.MX8X has been upstreamed to ATF recently. The i.MX8MQ support will be soon sent to ATF, I think.
Okay, thanks for the clarification, this is good to know :)
Quoted 9 lines
Quoted 6 lines
It would be great to have both U-Boot and ATF upstream support to achieve a boot chain with (mostly-)free and upstream software.
On that note, are there proprietary components involved in the boot process, other than the already-identified DDR training firmware for the DDR PHY?
The DDR firmware is not opensource, also there is HDMI firmware. U-Boot will load DDR PHY firmware and initialize DDR controller.
Oh, I didn't know about the HDMI firmware.
Regarding the DDR firmware: I would like to start a discussion with NXP and Synopsys about making the firmware free software/open source.
Would you be able to tell me who to contact about this (probably a manager on the NXP DDR team to begin with)? Feel free to answer off-list if contact information cannot be shared publicly.
Quoted 7 lines
Quoted 6 lines
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
Quoted 6 lines
The DDR PHY firmware is not per board. It is required.
There is a ddr tool developed by NXP, like what i.MX6/7 uses, it could generated the script like what this patch contains regarding the ddr part. But the DDR PHY firmware is a must, the DDR PHY firmware will be loaded to a place saying IMEM/DMEM inside DDR PHY.
Okay, so if I understand correctly, we there is already static configuration. Do you know the role of the DDR PHY in details?
It is very unclear to me why the firmware is required. If you do not have the details, could you direct me to someone who knows such details?
Quoted 10 lines
Quoted 5 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
There are lots lots of registers to configure, honestly, I also do not know the detailed meaning. The ddr code is from DDR team, hard for me to restructure. I suggest you use the DDR tool from NXP to generate the ddr code you need.
Well, this is a very borderline situation, where we can consider that the register dumps are not really source code. I understand that you may not have the necessary information here. Do you know who to contact to solve this problem?
Quoted 7 lines
Quoted 4 lines
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
The DDR PHY firmware runs inside DDR PHY, it is only DDR TYPE specific, such as DDR4 and LPDDR4 use different DDR PHY firmware.
I see, that makes sense.
Quoted 11 lines
If different boards use LPDDR4, they could use same firmware.
Quoted 6 lines
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
imx-mkimage, might be good to added into U-Boot as Stefano suggests. Then it will be easy a lot. But the firmware could not be avoided.
Yes, having that tool in U-Boot would be a very good thing indeed!
Quoted 5 lines
Quoted 1 line
Thanks in advance for your time and consideration of these questions!
Things become complicated, good documentation is required.
Shame on me that the ddr code still be held there.
Don't worry, I'm sure we can work together to solve these problems :)
Cheers,
Paul
Signature · 5 lines
Developer of free digital technology and hardware support. Website: https://www.paulk.fr/ Coding blog: https://code.paulk.fr/ Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Hi,
Quoted 28 lines · Paul Kocialkowski
Hi and thanks for your anwers!
Quoted 25 lines · Peng Fan
Hi Paul
Quoted 22 lines
-----Original Message-----
From: Paul Kocialkowski [mailto:contact at paulk.fr]
Sent: 2018年6月20日 16:58
To: Peng Fan <[email protected]>; sbabic at denx.de; Fabio Estevam <[email protected]>
Cc: u-boot at lists.denx.de; andre.przywara at arm.com; Todd Weaver <[email protected]>; Nicole Faerber <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 31/31] imx: add i.MX8MQ EVK supportHi there,
Quoted 3 lines · Peng Fan
Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to DRAM.
First off, I'd like to express my gratitude for this port: the i.MX8 looks like a great platform and it's really nice to see support for it land in U-Boot!
Regarding the integration of i.MX8 with upstream software in general:
are there plans to upstream the ARM Trusted Firmware port for i.MX8?
Quoted 7 lines
Quoted 5 lines
There are i.MX8 i.MX8X i.MX8M product lines for now. This patchset is upstream i.MX8MQ in i.MX8M family.
The i.MX8QM in i.MX8 and i.MX8QXP in i.MX8X has been upstreamed to ATF recently. The i.MX8MQ support will be soon sent to ATF, I think.
Okay, thanks for the clarification, this is good to know :)
Yeah, this naming is really fun ...
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
It would be great to have both U-Boot and ATF upstream support to achieve a boot chain with (mostly-)free and upstream software.
On that note, are there proprietary components involved in the boot process, other than the already-identified DDR training firmware for the DDR PHY?
Quoted 7 lines
Quoted 2 lines
The DDR firmware is not opensource, also there is HDMI firmware. U-Boot will load DDR PHY firmware and initialize DDR controller.
Oh, I didn't know about the HDMI firmware.
Regarding the DDR firmware: I would like to start a discussion with NXP and Synopsys about making the firmware free software/open source.
Don't want to temper your enthusiasm, but I believe this has been tried before - in vain. Hence my proposal to work around this. This is a common problem for many platforms: DDR training or initialisation code is not documented and/or provided as a closed source blob.
I very much appreciate your push for FOSS code, but I guess this is where reality kicks in.
There was and is quite some reverse engineering effort around this, though, and a lot of similarities have been found between the DDR controllers in different platforms, for instance between Rockchip and Allwinner. I believe it would be worthwhile to go over what we have in U-Boot and try to unify this. AFAIK many vendors use Synopsis IP, but don't necessarily say so. This might lead to some insight about the controllers used in i.MX as well.
Quoted 3 lines
Would you be able to tell me who to contact about this (probably a manager on the NXP DDR team to begin with)? Feel free to answer off-list if contact information cannot be shared publicly.
Good luck with that, but don't be disappointed ...
Cheers,
Andre.
Quoted 72 lines
Quoted 7 lines
Quoted 6 lines
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
Quoted 6 lines
The DDR PHY firmware is not per board. It is required.
There is a ddr tool developed by NXP, like what i.MX6/7 uses, it could generated the script like what this patch contains regarding the ddr part. But the DDR PHY firmware is a must, the DDR PHY firmware will be loaded to a place saying IMEM/DMEM inside DDR PHY.
Okay, so if I understand correctly, we there is already static configuration. Do you know the role of the DDR PHY in details?
It is very unclear to me why the firmware is required. If you do not have the details, could you direct me to someone who knows such details?
Quoted 10 lines
Quoted 5 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
There are lots lots of registers to configure, honestly, I also do not know the detailed meaning. The ddr code is from DDR team, hard for me to restructure. I suggest you use the DDR tool from NXP to generate the ddr code you need.
Well, this is a very borderline situation, where we can consider that the register dumps are not really source code. I understand that you may not have the necessary information here. Do you know who to contact to solve this problem?
Quoted 7 lines
Quoted 4 lines
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
The DDR PHY firmware runs inside DDR PHY, it is only DDR TYPE specific, such as DDR4 and LPDDR4 use different DDR PHY firmware.
I see, that makes sense.
Quoted 11 lines
If different boards use LPDDR4, they could use same firmware.
Quoted 6 lines
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
imx-mkimage, might be good to added into U-Boot as Stefano suggests. Then it will be easy a lot. But the firmware could not be avoided.
Yes, having that tool in U-Boot would be a very good thing indeed!
Quoted 5 lines
Quoted 1 line
Thanks in advance for your time and consideration of these questions!
Things become complicated, good documentation is required.
Shame on me that the ddr code still be held there.
Don't worry, I'm sure we can work together to solve these problems :)
Cheers,
Paul
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Hi,
Quoted 10 lines · Andre Przywara
Quoted 2 lines · Paul Kocialkowski
Regarding the DDR firmware: I would like to start a discussion with NXP and Synopsys about making the firmware free software/open source.
Don't want to temper your enthusiasm, but I believe this has been tried before - in vain. Hence my proposal to work around this. This is a common problem for many platforms: DDR training or initialisation code is not documented and/or provided as a closed source blob.
I very much appreciate your push for FOSS code, but I guess this is where reality kicks in.
I somewhat share your analysis here and I am well aware of the general issue (I remember not too long ago when nobody could say for sure whether the Allwinner A64 platform would see free DRAM init code or not) but I still feel like trying the political way first is the most reasonable way to go.
And I am definitely not going to give up so easily for now :)
Quoted 7 lines
There was and is quite some reverse engineering effort around this, though, and a lot of similarities have been found between the DDR controllers in different platforms, for instance between Rockchip and Allwinner. I believe it would be worthwhile to go over what we have in U-Boot and try to unify this. AFAIK many vendors use Synopsis IP, but don't necessarily say so. This might lead to some insight about the controllers used in i.MX as well.
Indeed, that is another not-so-painful way to go towards resolving this problem. And it also helps with the political way, since it seems that code covering these DRAM controllers' innards tends to come out sooner or later. So what's the point in Synopsys keeping it a secret?
And even if the code can't be released as-is, I'm sure that documentation that would allow writing a feature-equivalent firmware could be released without too much trouble involving lawyers.
Heck, it could even be released under NDA and a company could be mandated to write such a clean firmware!
Quoted 5 lines
Quoted 3 lines
Would you be able to tell me who to contact about this (probably a manager on the NXP DDR team to begin with)? Feel free to answer off-list if contact information cannot be shared publicly.
Good luck with that, but don't be disappointed ...
To be honest, I would mostly feel disappointed for not trying!
Cheers,
Paul
Quoted 72 lines
Quoted 72 lines
Quoted 7 lines
Quoted 6 lines
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
Quoted 6 lines
The DDR PHY firmware is not per board. It is required.
There is a ddr tool developed by NXP, like what i.MX6/7 uses, it could generated the script like what this patch contains regarding the ddr part. But the DDR PHY firmware is a must, the DDR PHY firmware will be loaded to a place saying IMEM/DMEM inside DDR PHY.
Okay, so if I understand correctly, we there is already static configuration. Do you know the role of the DDR PHY in details?
It is very unclear to me why the firmware is required. If you do not have the details, could you direct me to someone who knows such details?
Quoted 10 lines
Quoted 5 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
There are lots lots of registers to configure, honestly, I also do not know the detailed meaning. The ddr code is from DDR team, hard for me to restructure. I suggest you use the DDR tool from NXP to generate the ddr code you need.
Well, this is a very borderline situation, where we can consider that the register dumps are not really source code. I understand that you may not have the necessary information here. Do you know who to contact to solve this problem?
Quoted 7 lines
Quoted 4 lines
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
The DDR PHY firmware runs inside DDR PHY, it is only DDR TYPE specific, such as DDR4 and LPDDR4 use different DDR PHY firmware.
I see, that makes sense.
Quoted 11 lines
If different boards use LPDDR4, they could use same firmware.
Quoted 6 lines
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
imx-mkimage, might be good to added into U-Boot as Stefano suggests. Then it will be easy a lot. But the firmware could not be avoided.
Yes, having that tool in U-Boot would be a very good thing indeed!
Quoted 5 lines
Quoted 1 line
Thanks in advance for your time and consideration of these questions!
Things become complicated, good documentation is required.
Shame on me that the ddr code still be held there.
Don't worry, I'm sure we can work together to solve these problems :)
Cheers,
Paul
Signature · 12 lines
Developer of free digital technology and hardware support. Website: https://www.paulk.fr/ Coding blog: https://code.paulk.fr/ Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180620/4f89dc4e/attachment.sig>
PATCH v5 31/31 imx: add i.MX8MQ EVK support
Quoted 14 lines · Paul Kocialkowski
Hi,
Quoted 10 lines · Andre Przywara
Quoted 2 lines · Paul Kocialkowski
Regarding the DDR firmware: I would like to start a discussion with NXP and Synopsys about making the firmware free software/open source.
Don't want to temper your enthusiasm, but I believe this has been tried before - in vain. Hence my proposal to work around this. This is a common problem for many platforms: DDR training or initialisation code is not documented and/or provided as a closed source blob.
I very much appreciate your push for FOSS code, but I guess this is where reality kicks in.
Quoted 3 lines
I somewhat share your analysis here and I am well aware of the general issue (I remember not too long ago when nobody could say for sure whether the Allwinner A64 platform would see free DRAM init code or not)
I know, this is where I was coming from ;-) We tried to get the DRAM code from Allwinner, but this didn't really end well.
I guess they will play ping-pong: Synopsis won't talk to you, since you are not their customer, and NXP will tell you that they can't share third party code, partly from Synopsis.
Quoted 4 lines
but I still feel like trying the political way first is the most reasonable way to go.
And I am definitely not going to give up so easily for now :)
OK, godspeed, and sorry for my pessimism!
Quoted 8 lines
Quoted 7 lines
There was and is quite some reverse engineering effort around this, though, and a lot of similarities have been found between the DDR controllers in different platforms, for instance between Rockchip and Allwinner. I believe it would be worthwhile to go over what we have in U-Boot and try to unify this. AFAIK many vendors use Synopsis IP, but don't necessarily say so. This might lead to some insight about the controllers used in i.MX as well.
Quoted 4 lines
Indeed, that is another not-so-painful way to go towards resolving this problem. And it also helps with the political way, since it seems that code covering these DRAM controllers' innards tends to come out sooner or later. So what's the point in Synopsys keeping it a secret?
Yeah, don't tell me!
Quoted 6 lines
And even if the code can't be released as-is, I'm sure that documentation that would allow writing a feature-equivalent firmware could be released without too much trouble involving lawyers.
Heck, it could even be released under NDA and a company could be mandated to write such a clean firmware!
Please be careful when an NDAs is offered, that makes releasing the code under a FOSS license quite complicated. AFAIK most NDAs explicitly forbid this even. In the worst case you taint yourself for a long time from working with Open Source in this area.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Would you be able to tell me who to contact about this (probably a manager on the NXP DDR team to begin with)? Feel free to answer off-list if contact information cannot be shared publicly.
Good luck with that, but don't be disappointed ...
To be honest, I would mostly feel disappointed for not trying!
Alright, keeping my fingers crossed!
Cheers,
Andre.
Quoted 72 lines
Quoted 72 lines
Quoted 72 lines
Quoted 7 lines
Quoted 6 lines
About that DDR PHY firmware: to what extent is it necessary? It is common that DDR link training is required for socketed DRAM chips, but properly-tuned static per-board configuration is usually enough for soldered DRAM chips. Is the i.MX8 and exception to that? If not, would it be possible to provide such a static configuration mode, that does not involved any firmware for link training?
Quoted 6 lines
The DDR PHY firmware is not per board. It is required.
There is a ddr tool developed by NXP, like what i.MX6/7 uses, it could generated the script like what this patch contains regarding the ddr part. But the DDR PHY firmware is a must, the DDR PHY firmware will be loaded to a place saying IMEM/DMEM inside DDR PHY.
Okay, so if I understand correctly, we there is already static configuration. Do you know the role of the DDR PHY in details?
It is very unclear to me why the firmware is required. If you do not have the details, could you direct me to someone who knows such details?
Quoted 10 lines
Quoted 5 lines
Perhaps the PHY link training code (with the firmware) could be kept around as a fallback, disabled by default. Also, I see lots of undocumented registers in the process. Does it seem feasable to document these? This currently does not really like the source form of the software.
There are lots lots of registers to configure, honestly, I also do not know the detailed meaning. The ddr code is from DDR team, hard for me to restructure. I suggest you use the DDR tool from NXP to generate the ddr code you need.
Well, this is a very borderline situation, where we can consider that the register dumps are not really source code. I understand that you may not have the necessary information here. Do you know who to contact to solve this problem?
Quoted 7 lines
Quoted 4 lines
Having a firmware in the boot process is a fatal flaw when it comes to software freedom, as it prevents having a fully free boot chain. Since some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8 for this precise reason, this is a serious (if not fatal) drawback.
The DDR PHY firmware runs inside DDR PHY, it is only DDR TYPE specific, such as DDR4 and LPDDR4 use different DDR PHY firmware.
I see, that makes sense.
Quoted 11 lines
If different boards use LPDDR4, they could use same firmware.
Quoted 6 lines
Moreover, it is really not convenient to have a non-free firmware that must be carried around with U-Boot and prevents user from just cloning u-boot, building and running (by adding an extra step that complicates the process and makes it different from other platforms that do not require such a blob).
imx-mkimage, might be good to added into U-Boot as Stefano suggests. Then it will be easy a lot. But the firmware could not be avoided.
Yes, having that tool in U-Boot would be a very good thing indeed!
Quoted 5 lines
Quoted 1 line
Thanks in advance for your time and consideration of these questions!
Things become complicated, good documentation is required.
Shame on me that the ddr code still be held there.
Don't worry, I'm sure we can work together to solve these problems :)
Cheers,
Paul
PATCH v5 31/31 imx: add i.MX8MQ EVK support
+Angus into the thread...
Quoted 85 lines · André Przywara
Quoted 20 lines · Paul Kocialkowski
Hi,
Quoted 6 lines · Andre Przywara
Quoted 4 lines · Paul Kocialkowski
Regarding the DDR firmware: I would like to start a discussion with NXP
and Synopsys about making the firmware free software/open source.Quoted 10 lines
Don't want to temper your enthusiasm, but I believe this has been tried
before - in vain. Hence my proposal to work around this. This is a
common problem for many platforms: DDR training or initialisation code
is not documented and/or provided as a closed source blob. I very much appreciate your push for FOSS code, but I guess this is
where reality kicks in.Quoted 5 lines
I somewhat share your analysis here and I am well aware of the general
issue (I remember not too long ago when nobody could say for sure whether the Allwinner A64 platform would see free DRAM init code or not)I know, this is where I was coming from ;-) We tried to get the DRAM code from Allwinner, but this didn't really end well.
I guess they will play ping-pong: Synopsis won't talk to you, since you
are not their customer, and NXP will tell you that they can't share third party code, partly from Synopsis.Quoted 4 lines
but I still feel like trying the political way first is the most reasonable way to go.
And I am definitely not going to give up so easily for now :)
OK, godspeed, and sorry for my pessimism!
Quoted 13 lines
Quoted 4 lines
There was and is quite some reverse engineering effort around this,
though, and a lot of similarities have been found between the DDR controllers in different platforms, for instance between RockchipQuoted 8 lines
and
Allwinner. I believe it would be worthwhile to go over what we have in
U-Boot and try to unify this. AFAIK many vendors use Synopsis IP, but
don't necessarily say so. This might lead to some insight about the
controllers used in i.MX as well.Quoted 7 lines
Indeed, that is another not-so-painful way to go towards resolving this
problem. And it also helps with the political way, since it seems that
code covering these DRAM controllers' innards tends to come out sooner
or later. So what's the point in Synopsys keeping it a secret?Yeah, don't tell me!
Quoted 7 lines
And even if the code can't be released as-is, I'm sure that documentation that would allow writing a feature-equivalent firmware
could be released without too much trouble involving lawyers.Heck, it could even be released under NDA and a company could be mandated to write such a clean firmware!
Please be careful when an NDAs is offered, that makes releasing the code
under a FOSS license quite complicated. AFAIK most NDAs explicitly forbid this even. In the worst case you taint yourself for a long time
from working with Open Source in this area.Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Would you be able to tell me who to contact about this (probably a
manager on the NXP DDR team to begin with)? Feel free to answer off-list
if contact information cannot be shared publicly.
Quoted 117 lines
Quoted 3 lines
Quoted 1 line
Good luck with that, but don't be disappointed ...
To be honest, I would mostly feel disappointed for not trying!
Alright, keeping my fingers crossed!
Cheers,
Andre.Quoted 106 lines
Quoted 106 lines
Quoted 106 lines
Quoted 14 lines
Quoted 11 lines
About that DDR PHY firmware: to what extent is it necessary? It is
common that DDR link training is required for socketed DRAM chips, but
properly-tuned static per-board configuration is usually enough for
soldered DRAM chips. Is the i.MX8 and exception to that? If not, would
it be possible to provide such a static configuration mode, that does
not involved any firmware for link training?The DDR PHY firmware is not per board. It is required.
Quoted 7 lines
There is a ddr tool developed by NXP, like what i.MX6/7 uses, it could generated
the script like what this patch contains regarding the ddr part. But the DDR
PHY firmware is a must, the DDR PHY firmware will be loaded to a place
saying IMEM/DMEM inside DDR PHY.Okay, so if I understand correctly, we there is already static configuration. Do you know the role of the DDR PHY in details?
It is very unclear to me why the firmware is required. If you do not
have the details, could you direct me to someone who knows such details?Quoted 10 lines
Quoted 9 lines
Perhaps the PHY link training code (with the firmware) could be kept
around as a fallback, disabled by default. Also, I see lots of
undocumented registers in the process. Does it seem feasable to document
these? This currently does not really like the source form of the
software.Quoted 7 lines
There are lots lots of registers to configure, honestly, I also do not
know the detailed meaning. The ddr code is from DDR team, hard
for me to restructure. I suggest you use the DDR tool from NXP to
generate the ddr code you need.Well, this is a very borderline situation, where we can consider that
the register dumps are not really source code. I understand that you may
not have the necessary information here. Do you know who to contact to
solve this problem?Quoted 9 lines
Quoted 8 lines
Having a firmware in the boot process is a fatal flaw when it comes to
software freedom, as it prevents having a fully free boot chain. Since
some projects (e.g. the Purism Librem 5) are aiming at using the i.MX8
for this precise reason, this is a serious (if not fatal) drawback.Quoted 3 lines
The DDR PHY firmware runs inside DDR PHY, it is only DDR TYPE specific,
such as DDR4 and LPDDR4 use different DDR PHY firmware.I see, that makes sense.
Quoted 13 lines
If different boards use LPDDR4, they could use same firmware.
Quoted 10 lines
Moreover, it is really not convenient to have a non-free firmware that
must be carried around with U-Boot and prevents user from just cloning
u-boot, building and running (by adding an extra step that complicates
the process and makes it different from other platforms that do not
require such a blob).Quoted 4 lines
imx-mkimage, might be good to added into U-Boot as Stefano suggests.
Then it will be easy a lot. But the firmware could not be avoided.Yes, having that tool in U-Boot would be a very good thing indeed!
Quoted 6 lines
Quoted 2 lines
Thanks in advance for your time and consideration of these questions!
Things become complicated, good documentation is required.
Shame on me that the ddr code still be held there.
Don't worry, I'm sure we can work together to solve these problems :)
Cheers,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180621/8cd98afd/attachment.sig>
PATCH v5 31/31 imx: add i.MX8MQ EVK support
In reply to Andre PrzywaraDear Andre,
Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Regarding the DDR firmware: I would like to start a discussion with NXP and Synopsys about making the firmware free software/open source.
Don't want to temper your enthusiasm, but I believe this has been tried before - in vain. Hence my proposal to work around this. This is a common problem for many platforms: DDR training or initialisation code is not documented and/or provided as a closed source blob.
I very much appreciate your push for FOSS code, but I guess this is where reality kicks in.
Reality can be changed. This has been done before.
Yes, some vendors think they have their crown jewels buried in their RAM training or initialization code - of they realize it is so badly written that they cannot allow other people to see it.
But we should always try to reduce such closed source parts to the extend possible, and there have been a few cases where this succeeded. For example, it took quite some effort until Marvell released the DDR3 init code under a License that allowed to integrate it into U-Boot - today, all this is in mainline.
OK, with DDR4 the situation is still different. But at least this shows that it is always worth trying!
Quoted 7 lines
There was and is quite some reverse engineering effort around this, though, and a lot of similarities have been found between the DDR controllers in different platforms, for instance between Rockchip and Allwinner. I believe it would be worthwhile to go over what we have in U-Boot and try to unify this. AFAIK many vendors use Synopsis IP, but don't necessarily say so. This might lead to some insight about the controllers used in i.MX as well.
Of course this would be _much_ easier with at least minimal help from the IP core / chip vendors...
Quoted 1 line
Good luck with that, but don't be disappointed ...
...and keep trying!
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A Chairman was as necessary to a Board planet as the zero was in
mathematics, but being a zero had big disadvantages...
- Terry Pratchett, _The Dark Side of the Sun_v5 cover imx: add i.MX8M support and i.MX8MQ EVK
In reply to Peng FanHi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 111 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile. BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other boards, in V3 patchset, only touch pfuze100 related options.
Sharing code about get mac from fuse between mx7/mx8m Sharing code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll configuration
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.
Improve REAMME file to include where to download firmware and imx-mkimage and how to build
Add review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7
patch 12/23: Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK support
Quoted 2 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPL
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeout
Normal Boot
Trying to boot from MMC2
Do you know how to solve it? If so, please add this information on the README file.
Thanks,
Diego
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Hi Diego,
Quoted 117 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 111 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile. BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other boards, in V3 patchset, only touch pfuze100 related options.
Sharing code about get mac from fuse between mx7/mx8m Sharing code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll configuration
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.
Improve REAMME file to include where to download firmware and imx-mkimage and how to build
Add review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7
patch 12/23: Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 2 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPL
Quoted 8 lines
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeout
Seems needs larger time wait.
Could you try
static inline void poll_pmu_message_ready(void)
{
int ret;
u32 val;
/*
* When BIT0 set to 0, the PMU has a message for the user
* 10ms seems not enough for poll message, so use 1s here.
*/
ret = readl_poll_timeout(®s->reg[0xd0004], val,
!(val & BIT(0)), 1000000); --> Change 1000000 to 0?
if (ret)
puts("PMU message timeout\n");
}in board/freescale/mx8mq_evk/ddr/ddrphy_train.c
Not sure you are using latest B0 chip or not.
I'll wait for comments before sending new version patchset.
Thanks,
Peng.
Quoted 12 lines
Normal Boot
Trying to boot from MMC2Do you know how to solve it? If so, please add this information on the README file.
Thanks,
Diego
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Hi Peng,
2018-01-10 23:16 GMT-02:00 Peng Fan <[email protected]>:
Quoted 132 lines
Hi Diego,
Quoted 117 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 111 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile. BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other boards, in V3 patchset, only touch pfuze100 related options.
Sharing code about get mac from fuse between mx7/mx8m Sharing code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll configuration
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.
Improve REAMME file to include where to download firmware and imx-mkimage and how to build
Add review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7
patch 12/23: Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 2 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLQuoted 8 lines
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeoutSeems needs larger time wait.
Could you try
static inline voidpoll_pmu_message_ready(void)
Quoted 14 lines
{
int ret;
u32 val;
/*
* When BIT0 set to 0, the PMU has a message for the user
* 10ms seems not enough for poll message, so use 1s here.
*/
ret = readl_poll_timeout(®s->reg[0xd0004], val,
!(val & BIT(0)), 1000000); --> Change 1000000 to 0?
if (ret)
puts("PMU message timeout\n");
}I've just tested your suggestion and this time the U-Boot hangs it before:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 11 2018 - 10:20:13)
PMIC: PFUZE100 ID=0x10
Quoted 3 lines
in
board/freescale/mx8mq_evk/ddr/ddrphy_train.c
Not sure you are using latest B0 chip or not.
I only have the A0 chip, can you test on this one?
Quoted 13 lines
I'll wait for comments before sending new version patchset.
Thanks,
Peng.Quoted 8 lines
Normal Boot
Trying to boot from MMC2Do you know how to solve it? If so, please add this information on the README file.
Thanks,
Diego
Thanks,
Diego
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Hi Diego,
Quoted 156 lines · Diego Dorta
Hi Peng,
2018-01-10 23:16 GMT-02:00 Peng Fan <[email protected]>:
Quoted 132 lines
Hi Diego,
Quoted 117 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 111 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile. BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other boards, in V3 patchset, only touch pfuze100 related options.
Sharing code about get mac from fuse between mx7/mx8m Sharing code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll configuration
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.
Improve REAMME file to include where to download firmware and imx-mkimage and how to build
Add review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7
patch 12/23: Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 2 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLQuoted 8 lines
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeoutSeems needs larger time wait.
Could you try
static inline voidpoll_pmu_message_ready(void)Quoted 14 lines
{ int ret; u32 val; /* * When BIT0 set to 0, the PMU has a message for the user * 10ms seems not enough for poll message, so use 1s here. */ ret = readl_poll_timeout(®s->reg[0xd0004], val, !(val & BIT(0)), 1000000); --> Change 1000000 to 0? if (ret) puts("PMU message timeout\n"); }I've just tested your suggestion and this time the U-Boot hangs it before:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 11 2018 - 10:20:13)
PMIC: PFUZE100 ID=0x10
Quoted 5 lines
Quoted 3 lines
in
board/freescale/mx8mq_evk/ddr/ddrphy_train.c
Not sure you are using latest B0 chip or not.I only have the A0 chip, can you test on this one?
I test the patchset on my A0 board, it works. But I still suggest using board with B0 chip.
Thanks,
Peng
Quoted 17 lines
Quoted 14 lines
I'll wait for comments before sending new version patchset.
Thanks,
Peng.Quoted 8 lines
Normal Boot
Trying to boot from MMC2Do you know how to solve it? If so, please add this information on the README file.
Thanks,
DiegoThanks,
Diego
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Hi Peng,
2018-01-13 8:55 GMT-02:00 Peng Fan <[email protected]>:
Quoted 158 lines
Hi Diego,
Quoted 156 lines · Diego Dorta
Hi Peng,
2018-01-10 23:16 GMT-02:00 Peng Fan <[email protected]>:
Quoted 132 lines
Hi Diego,
Quoted 117 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 111 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile. BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other boards, in V3 patchset, only touch pfuze100 related options.
Sharing code about get mac from fuse between mx7/mx8m Sharing code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll configuration
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.
Improve REAMME file to include where to download firmware and imx-mkimage and how to build
Add review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7
patch 12/23: Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 2 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLQuoted 8 lines
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeoutSeems needs larger time wait.
Could you try
static inline voidpoll_pmu_message_ready(void)Quoted 14 lines
{ int ret; u32 val; /* * When BIT0 set to 0, the PMU has a message for the user * 10ms seems not enough for poll message, so use 1s here. */ ret = readl_poll_timeout(®s->reg[0xd0004], val, !(val & BIT(0)), 1000000); --> Change 1000000 to 0? if (ret) puts("PMU message timeout\n"); }I've just tested your suggestion and this time the U-Boot hangs it before:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 11 2018 - 10:20:13)
PMIC: PFUZE100 ID=0x10
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
in
board/freescale/mx8mq_evk/ddr/ddrphy_train.c
Not sure you are using latest B0 chip or not.I only have the A0 chip, can you test on this one?
I test the patchset on my A0 board, it works. But I still suggest using board with B0 chip.
It is still not working on my A0 chip. I've enable the debug mode so you can see where it hangs:
Training PASS
Normal Boot
Trying to boot from MMC2
spl: mmc boot mode: raw
hdr read sector 300, count=1
spl: payload image: Second uimage loader load addr: 0x40000fc0 size: 632345 read 4d4 sectors to 40000fc0
Jumping to U-Boot
loaded - jumping to U-Boot...
image entry point: 0x40001000
Unfortunately we do not have here the B0 chip. Can you solve the problem with this log?
Thanks,
Diego
Quoted 22 lines
Thanks,
PengQuoted 9 lines
Quoted 9 lines
I'll wait for comments before sending new version patchset.
Thanks,
Peng.Quoted 3 lines
Normal Boot
Trying to boot from MMC2Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Do you know how to solve it? If so, please add this information on the README file.
Thanks,
DiegoThanks,
Diego--
Peng Fan
reviewerv5 cover imx: add i.MX8M support and i.MX8MQ EVK
Quoted 224 lines
-----Original Message-----
From: Diego Dorta [mailto:diegohdorta at gmail.com]
Sent: Tuesday, January 16, 2018 8:15 PM
To: Peng Fan <[email protected]>
Cc: Peng Fan <[email protected]>; Fabio Estevam <[email protected]>; U-Boot-Denx <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKHi Peng,
2018-01-13 8:55 GMT-02:00 Peng Fan <[email protected]>:
Quoted 21 lines
Hi Diego,
Quoted 19 lines · Diego Dorta
Hi Peng,
2018-01-10 23:16 GMT-02:00 Peng Fan <[email protected]>:
Quoted 16 lines
Hi Diego,
Quoted 13 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 10 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset,https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=ukU9u%2B99GtYbM Pu
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
1F18ZK2FvUpwWJI5ge4Hb607OPMk%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded from SPL"
from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Because
CONFIG_GPT_TIMERchange, I did a small modification to
apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based onhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=ukU9u%2B99GtYbM Pu
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
1F18ZK2FvUpwWJI5ge4Hb607OPMk%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded from SPL"
from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL"
broke other boards, in V3 patchset, only touch pfuze100 related options.Sharing code about get mac from fuse between mx7/mx8m Sharing
code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env betweenmx7/mx8m
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock
pll configurationCorrect authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY
registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and ubootddr phy cod.
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Improve REAMME file to include where to download firmware and
imx-mkimage and how to buildAdd review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons. Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7 patch 12/23:
Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The patchset depends on
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F841934%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=Il%2F%2Bkzq%2B0G S
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
TtZMKo1tnVYBFx4rLD1ymPgrbx5Pdj3s%3D&reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F841958%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=FLMRWI8K0W6XsijQ F
Quoted 80 lines
Quoted 80 lines
Quoted 60 lines
Quoted 49 lines
Quoted 46 lines
cD5JSuRcRjtqEgFBJ%2B4F%2FkVS3o%3D&reserved=0
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 2 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLQuoted 8 lines
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeoutSeems needs larger time wait.
Could you tryQuoted 13 lines
static inline void poll_pmu_message_ready(void) { int ret; u32 val; /* * When BIT0 set to 0, the PMU has a message for the user * 10ms seems not enough for poll message, so use 1s here. */ ret = readl_poll_timeout(®s->reg[0xd0004], val, !(val & BIT(0)), 1000000); --> Change 1000000 to 0? if (ret) puts("PMU message timeout\n"); }I've just tested your suggestion and this time the U-Boot hangs it before:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 11 2018 - 10:20:13)
PMIC: PFUZE100 ID=0x10Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
in
board/freescale/mx8mq_evk/ddr/ddrphy_train.c
Not sure you are using latest B0 chip or not.I only have the A0 chip, can you test on this one?
I test the patchset on my A0 board, it works. But I still suggest using board with B0 chip.
It is still not working on my A0 chip. I've enable the debug mode so you can see where it hangs:
Quoted 8 lines
Training PASS
Normal Boot
Trying to boot from MMC2
spl: mmc boot mode: raw
hdr read sector 300, count=1
spl: payload image: Second uimage loader load addr:0x40000fc0size: 632345 read 4d4 sectors to40000fc0Jumping to U-Boot loaded - jumping to U-Boot... image entry point:0x40001000
I think the entry point address is not correct. It should be 0x910000 for ATF. You need to check your imx-mkimage. Also for PMU message timeout, You still need to use 0 as the timeout value.
Regards,
Peng.
Quoted 29 lines
Unfortunately we do not have here the B0 chip. Can you solve the problem with this log?
Thanks,
DiegoQuoted 22 lines
Thanks,
PengQuoted 9 lines
Quoted 9 lines
I'll wait for comments before sending new version patchset.
Thanks,
Peng.Quoted 3 lines
Normal Boot
Trying to boot from MMC2Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Do you know how to solve it? If so, please add this information on the README file.
Thanks,
DiegoThanks,
Diego--
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Hi Peng,
2018-01-16 10:25 GMT-02:00 Peng Fan <[email protected]>:
Quoted 233 lines
Quoted 224 lines
-----Original Message-----
From: Diego Dorta [mailto:diegohdorta at gmail.com]
Sent: Tuesday, January 16, 2018 8:15 PM
To: Peng Fan <[email protected]>
Cc: Peng Fan <[email protected]>; Fabio Estevam <[email protected]>; U-Boot-Denx <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKHi Peng,
2018-01-13 8:55 GMT-02:00 Peng Fan <[email protected]>:
Quoted 21 lines
Hi Diego,
Quoted 19 lines · Diego Dorta
Hi Peng,
2018-01-10 23:16 GMT-02:00 Peng Fan <[email protected]>:
Quoted 16 lines
Hi Diego,
Quoted 13 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 10 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset,https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=ukU9u%2B99GtYbM Pu
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
1F18ZK2FvUpwWJI5ge4Hb607OPMk%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded from SPL"
from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Because
CONFIG_GPT_TIMERchange, I did a small modification to
apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based onhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=ukU9u%2B99GtYbM Pu
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
1F18ZK2FvUpwWJI5ge4Hb607OPMk%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded from SPL"
from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL"
broke other boards, in V3 patchset, only touch pfuze100 related options.Sharing code about get mac from fuse between mx7/mx8m Sharing
code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env betweenmx7/mx8m
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock
pll configurationCorrect authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY
registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and ubootddr phy cod.
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Improve REAMME file to include where to download firmware and
imx-mkimage and how to buildAdd review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons. Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7 patch 12/23:
Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
The patchset depends on
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F841934%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=Il%2F%2Bkzq%2B0G S
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
TtZMKo1tnVYBFx4rLD1ymPgrbx5Pdj3s%3D&reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F841958%2F&data=02%7C01%7Cpeng.fan%
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=FLMRWI8K0W6XsijQ F
Quoted 80 lines
Quoted 80 lines
Quoted 60 lines
Quoted 49 lines
Quoted 46 lines
cD5JSuRcRjtqEgFBJ%2B4F%2FkVS3o%3D&reserved=0
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 2 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLQuoted 8 lines
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeoutSeems needs larger time wait.
Could you tryQuoted 13 lines
static inline void poll_pmu_message_ready(void) { int ret; u32 val; /* * When BIT0 set to 0, the PMU has a message for the user * 10ms seems not enough for poll message, so use 1s here. */ ret = readl_poll_timeout(®s->reg[0xd0004], val, !(val & BIT(0)), 1000000); --> Change 1000000 to 0? if (ret) puts("PMU message timeout\n"); }I've just tested your suggestion and this time the U-Boot hangs it before:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 11 2018 - 10:20:13)
PMIC: PFUZE100 ID=0x10Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
in
board/freescale/mx8mq_evk/ddr/ddrphy_train.c
Not sure you are using latest B0 chip or not.I only have the A0 chip, can you test on this one?
I test the patchset on my A0 board, it works. But I still suggest using board with B0 chip.
It is still not working on my A0 chip. I've enable the debug mode so you can see where it hangs:
Quoted 8 lines
Training PASS
Normal Boot
Trying to boot from MMC2
spl: mmc boot mode: raw
hdr read sector 300, count=1
spl: payload image: Second uimage loader load addr:0x40000fc0size: 632345 read 4d4 sectors to40000fc0Jumping to U-Boot loaded - jumping to U-Boot... image entry point:0x40001000
Quoted 1 line
I think the entry point address is not correct. It should be
0x910000for ATF.
I've changed the entry point 0x40001000 to 0x910000 on the imx-mkimage and it worked!
However, and I try to boot I got this:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 17 2018 - 12:44:27)
PMIC: PFUZE100 ID=0x10
PMU message timeout
Normal Boot
Trying to boot from MMC2
"Synchronous Abort" handler, esr 0x02000000
ELR: 400052f4 LR: 910020 x0 : 0000000000914e40 x1 : 000000004100d030 x2 : 00000000400052f4 x3 : 00000000ff00fff0 x4 : 0000000000914e60 x5 : 0000000000914e60 x6 : 000000000000000a x7 : 0000000000000001 x8 : 0000000000000000 x9 : 0000000000000018 x10: 000000000018276e x11: 0000000000000006 x12: 000000000001869f x13: 00000000ffffffff x14: 000000003c04c000 x15: 00000000ffffffff x16: 00000000000007c8 x17: 00000000000000b7 x18: 0000000000185e50 x19: 0000000000910020 x20: 0000000000000000 x21: 00000000007ef3e0 x22: 0000000000185df0 x23: 00000000007ef3c8 x24: 00000000007f1000 x25: 00000000007f1c70 x26: 00000000deadbeef x27: 0000000000000000 x28: 0000000000000000 x29: 0000000000185d80
Resetting CPU ...
resetting ...
"Synchronous Abort" handler, esr 0x5e000000
ELR: 7e1cc8 LR: 185a20 x0 : 0000000084000009 x1 : d16302ad9caf8317 x2 : 80d24fad756fa1f7 x3 : fa9cacdc9281e74a x4 : 4be1cc32342e0c28 x5 : d34d32a2c33c2001 x6 : 2a4ad3ad0b84f752 x7 : 000000000000000f x8 : 0000000000185b20 x9 : 0000000000000018 x10: 0000000000185742 x11: 0000000000000021 x12: 0000000000000010 x13: 00000000ffffffff x14: 000000003c04c000 x15: 0000000000000010 x16: 00000000000007c8 x17: 00000000000000b7 x18: 0000000000185e50 x19: 0000000000185c80 x20: 0000000000000000 x21: 00000000007ef3e0 x22: 0000000000185df0 x23: 00000000007ef3c8 x24: 00000000007f1000 x25: 00000000007f1c70 x26: 00000000deadbeef x27: 0000000000000000 x28: 0000000000000000 x29: 0000000000185a00
Resetting CPU ...
resetting ...
Quoted 3 lines
You need to check your imx-mkimage. Also for PMU message timeout, You still need to use 0 as the timeout value.
I also have changed the timeout value to 0, and then I got this:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 17 2018 - 12:51:06)
PMIC: PFUZE100 ID=0x10
U-Boot hangs at this point again. Is there anything else for solving this problem?
Thanks,
Diego
Quoted 32 lines
Regards,
Peng.Quoted 29 lines
Unfortunately we do not have here the B0 chip. Can you solve the problem with this log?
Thanks,
DiegoQuoted 22 lines
Thanks,
PengQuoted 9 lines
Quoted 9 lines
I'll wait for comments before sending new version patchset.
Thanks,
Peng.Quoted 3 lines
Normal Boot
Trying to boot from MMC2Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Do you know how to solve it? If so, please add this information on the README file.
Thanks,
DiegoThanks,
Diego--
Peng Fan
reviewerv5 cover imx: add i.MX8M support and i.MX8MQ EVK
Quoted 330 lines
-----Original Message-----
From: Diego Dorta [mailto:diegohdorta at gmail.com]
Sent: Wednesday, January 17, 2018 11:00 PM
To: Peng Fan <[email protected]>
Cc: Peng Fan <[email protected]>; Fabio Estevam <[email protected]>; U-Boot-Denx <[email protected]>; Diego Dorta <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKHi Peng,
2018-01-16 10:25 GMT-02:00 Peng Fan <[email protected]>:
Quoted 31 lines
Quoted 31 lines
-----Original Message-----
From: Diego Dorta [mailto:diegohdorta at gmail.com]
Sent: Tuesday, January 16, 2018 8:15 PM
To: Peng Fan <[email protected]>
Cc: Peng Fan <[email protected]>; Fabio Estevam <[email protected]>; U-Boot-Denx <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKHi Peng,
2018-01-13 8:55 GMT-02:00 Peng Fan <[email protected]>:
Quoted 17 lines
Hi Diego,
Quoted 15 lines · Diego Dorta
Hi Peng,
2018-01-10 23:16 GMT-02:00 Peng Fan <[email protected]>:
Quoted 12 lines
Hi Diego,
Quoted 9 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 6 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
V4:
Regenerate patchset based on Tom's master tree.
In this patchset,https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=ukU9u%2B99GtYbM
Quoted 3 lines
Quoted 3 lines
Pu
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
1F18ZK2FvUpwWJI5ge4Hb607OPMk%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded fromSPL"
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux and
arch/arm/mach-imx/Makefile.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Because
CONFIG_GPT_TIMERchange, I did a small modification to
apply Tom's patch, no function change.Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Include ATF link in README.
V3:
This patchset based onhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=ukU9u%2B99GtYbM
Quoted 3 lines
Quoted 3 lines
Pu
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
1F18ZK2FvUpwWJI5ge4Hb607OPMk%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded fromSPL"
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
from Tom to avoid this patchset fail apply after Tom's patch merged.
Previously "power: pmic/regulator allow dm be omited by SPL"
broke other boards, in V3 patchset, only touch pfuze100 relatedoptions.
Quoted 29 lines
Quoted 29 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Sharing code about get mac from fuse between mx7/mx8m Sharing
code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env betweenmx7/mx8m
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock
pll configurationQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY
registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and ubootddr phy cod.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Improve REAMME file to include where to download firmware and
imx-mkimage and how to buildAdd review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usbpatch 04/23: conver to use
structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons. Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7 patch 12/23:
Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 couldnot be
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
accepted at current stage, to make others still be could be compiled.
The patchset depends on
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F841934%2F&data=02%7C01%7Cpeng.fan%
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=Il%2F%2Bkzq%2B0G
Quoted 6 lines
Quoted 6 lines
S
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
TtZMKo1tnVYBFx4rLD1ymPgrbx5Pdj3s%3D&reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Fpatchwork.ozlabs.org%2Fpatch%2F841958%2F&data=02%7C01%7Cpeng.fan%
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
40nxp.com%7C7ff0a80d79454c1eb43608d55cdad59d%7C686ea1d3bc2b4c6fa92
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
cd99c5c301635%7C0%7C1%7C636517017329353990&sdata=FLMRWI8K0W6XsijQ
Quoted 95 lines
Quoted 95 lines
F
Quoted 81 lines
Quoted 81 lines
Quoted 61 lines
Quoted 50 lines
Quoted 46 lines
cD5JSuRcRjtqEgFBJ%2B4F%2FkVS3o%3D&reserved=0
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 3 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from
SPLQuoted 8 lines
Thanks for your V5 patches, this time I had no problem on compiling it.
But, even following your README step by step, the U-Boot hangs completely on this point:
U-Boot SPL 2018.01-00038-gb464677cc7 (Jan 10 2018 - 09:50:45)
PMIC: PFUZE100 ID=0x10
PMU message timeoutSeems needs larger time wait.
Could you tryQuoted 13 lines
static inline void poll_pmu_message_ready(void) { int ret; u32 val; /* * When BIT0 set to 0, the PMU has a message for the user * 10ms seems not enough for poll message, so use 1s here. */ ret = readl_poll_timeout(®s->reg[0xd0004], val, !(val & BIT(0)), 1000000); --> Change 1000000 to 0? if (ret) puts("PMU message timeout\n"); }I've just tested your suggestion and this time the U-Boot hangs it before:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 11 2018 - 10:20:13)
PMIC: PFUZE100 ID=0x10Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
in
board/freescale/mx8mq_evk/ddr/ddrphy_train.c
Not sure you are using latest B0 chip or not.I only have the A0 chip, can you test on this one?
I test the patchset on my A0 board, it works. But I still suggest using board with B0 chip.
It is still not working on my A0 chip. I've enable the debug mode so you can see where it hangs:
Quoted 7 lines
Quoted 7 lines
Training PASS
Normal Boot
Trying to boot from MMC2
spl: mmc boot mode: raw
hdr read sector 300, count=1
spl: payload image: Second uimage loader load addr:0x40000fc0size:
632345 read 4d4 sectors to40000fc0Jumping to U-Boot loaded - jumping toU-Boot...
Quoted 3 lines
Quoted 1 line
image entry point:
0x40001000I think the entry point address is not correct. It should be
0x910000for ATF.I've changed the entry point
0x40001000to0x910000on the imx-mkimage and it worked!However, and I try to boot I got this:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 17 2018 - 12:44:27)
PMIC: PFUZE100 ID=0x10
PMU message timeout
Normal Boot
Trying to boot from MMC2
"Synchronous Abort" handler, esr0x02000000ELR: 400052f4 LR: 910020 x0 : 0000000000914e40 x1 : 000000004100d030 x2 : 00000000400052f4 x3 : 00000000ff00fff0 x4 : 0000000000914e60 x5 : 0000000000914e60 x6 : 000000000000000a x7 : 0000000000000001 x8 : 0000000000000000 x9 : 0000000000000018 x10: 000000000018276e x11: 0000000000000006 x12: 000000000001869f x13: 00000000ffffffff x14: 000000003c04c000 x15: 00000000ffffffff x16: 00000000000007c8 x17: 00000000000000b7 x18: 0000000000185e50 x19: 0000000000910020 x20: 0000000000000000 x21: 00000000007ef3e0 x22: 0000000000185df0 x23: 00000000007ef3c8 x24: 00000000007f1000 x25: 00000000007f1c70 x26: 00000000deadbeef x27: 0000000000000000 x28: 0000000000000000 x29: 0000000000185d80Resetting CPU ...
resetting ...
"Synchronous Abort" handler, esr0x5e000000ELR: 7e1cc8 LR: 185a20 x0 : 0000000084000009 x1 : d16302ad9caf8317 x2 : 80d24fad756fa1f7 x3 : fa9cacdc9281e74a x4 : 4be1cc32342e0c28 x5 : d34d32a2c33c2001 x6 : 2a4ad3ad0b84f752 x7 : 000000000000000f x8 : 0000000000185b20 x9 : 0000000000000018 x10: 0000000000185742 x11: 0000000000000021 x12: 0000000000000010 x13: 00000000ffffffff x14: 000000003c04c000 x15: 0000000000000010 x16: 00000000000007c8 x17: 00000000000000b7 x18: 0000000000185e50 x19: 0000000000185c80 x20: 0000000000000000 x21: 00000000007ef3e0 x22: 0000000000185df0 x23: 00000000007ef3c8 x24: 00000000007f1000 x25: 00000000007f1c70 x26: 00000000deadbeef x27: 0000000000000000 x28: 0000000000000000 x29: 0000000000185a00Resetting CPU ...
resetting ...
Quoted 3 lines
You need to check your imx-mkimage. Also for PMU message timeout, You still need to use 0 as the timeout value.
Quoted 6 lines
I also have changed the timeout value to 0, and then I got this:
U-Boot SPL 2018.01-00038-gb464677cc7-dirty (Jan 17 2018 - 12:51:06)
PMIC: PFUZE100 ID=0x10U-Boot hangs at this point again. Is there anything else for solving this problem?
Could you share the info that with timeout value to 0 and uboot debug enabled?
Did you try nxp internal uboot on your board? What's the behavior?
Actually I do not want to bother debugging for A0.
Regards,
Peng.
Quoted 36 lines
Thanks,
DiegoQuoted 32 lines
Regards,
Peng.Quoted 29 lines
Unfortunately we do not have here the B0 chip. Can you solve the problem with this log?
Thanks,
DiegoQuoted 22 lines
Thanks,
PengQuoted 9 lines
Quoted 9 lines
I'll wait for comments before sending new version patchset.
Thanks,
Peng.Quoted 3 lines
Normal Boot
Trying to boot from MMC2Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Do you know how to solve it? If so, please add this information on the README file.
Thanks,
DiegoThanks,
Diego--
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
2018-01-17 23:13 GMT-02:00 Peng Fan <[email protected]>:
Quoted 8 lines
Could you share the info that with timeout value to 0 and uboot debug enabled?
Did you try nxp internal uboot on your board? What's the behavior?
Actually I do not want to bother debugging for A0.
Regards,
Peng.
I talked to Peng offline, and we will work on improving the README file.
Thanks,
Diego
Peng Fan
reviewerv5 cover imx: add i.MX8M support and i.MX8MQ EVK
In reply to Peng FanHi Stefano,
Do you have any comments on this v5 patchset? I would like this patchset could catch up 2018.03.
Thanks,
Peng.
Quoted 216 lines
-----Original Message-----
From: Peng Fan
Sent: Wednesday, January 10, 2018 1:20 PM
To: sbabic at denx.de; Fabio Estevam <[email protected]>
Cc: van.freenix at gmail.com; u-boot at lists.denx.de; Peng Fan <[email protected]>
Subject: [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKThis patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the
patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from
Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile.
BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's
patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from
Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other
boards, in V3 patchset, only touch pfuze100 related options.Sharing code about get mac from fuse between mx7/mx8m Sharing code
about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8mIntroduce wait_mask_set/clr_timeout to avoid deadloop in clock pll
configurationCorrect authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are
about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.Improve REAMME file to include where to download firmware and imx-
mkimage and how to buildAdd review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7 patch 12/23: Typo fix and
return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportTom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLYe Li (1):
net: fec: fix build warnings for 64bits supportarch/arm/Kconfig | 14 +- arch/arm/Makefile | 4 +- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8-ca53.dtsi | 92 ++ arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/dts/fsl-imx8mq.dtsi | 429 +++++++++ arch/arm/include/asm/arch-imx/cpu.h | 6 +- arch/arm/include/asm/arch-mx6/imx-regs.h | 9 +- arch/arm/include/asm/arch-mx7/imx-regs.h | 18 +- arch/arm/include/asm/arch-mx8m/clock.h | 657 +++++++++++++ arch/arm/include/asm/arch-mx8m/crm_regs.h | 10 + arch/arm/include/asm/arch-mx8m/ddr.h | 365 ++++++++ arch/arm/include/asm/arch-mx8m/gpio.h | 12 + arch/arm/include/asm/arch-mx8m/imx-regs.h | 468 ++++++++++ arch/arm/include/asm/arch-mx8m/mx8mq_pins.h | 623 +++++++++++++ arch/arm/include/asm/arch-mx8m/sys_proto.h | 18 + arch/arm/include/asm/mach-imx/boot_mode.h | 10 + arch/arm/include/asm/mach-imx/iomux-v3.h | 22 +- arch/arm/include/asm/mach-imx/regs-lcdif.h | 10 +- arch/arm/include/asm/mach-imx/sys_proto.h | 4 + arch/arm/mach-imx/Makefile | 23 +- arch/arm/mach-imx/cpu.c | 130 ++- arch/arm/mach-imx/imx_bootaux.c | 51 +- arch/arm/mach-imx/mac.c | 61 ++ arch/arm/mach-imx/mmc_env.c | 30 + arch/arm/mach-imx/mx5/clock.c | 4 +- arch/arm/mach-imx/mx6/soc.c | 72 -- arch/arm/mach-imx/mx7/clock.c | 2 + arch/arm/mach-imx/mx7/soc.c | 195 ---- arch/arm/mach-imx/mx7ulp/clock.c | 2 + arch/arm/mach-imx/mx8m/Kconfig | 22 + arch/arm/mach-imx/mx8m/Makefile | 8 + arch/arm/mach-imx/mx8m/clock.c | 795 ++++++++++++++++ arch/arm/mach-imx/mx8m/clock_slice.c | 742 +++++++++++++++ arch/arm/mach-imx/mx8m/lowlevel_init.S | 63 ++ arch/arm/mach-imx/mx8m/soc.c | 227 +++++ arch/arm/mach-imx/sip.c | 23 + arch/arm/mach-imx/spl.c | 10 +- board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + drivers/gpio/mxc_gpio.c | 22 +- drivers/misc/mxc_ocotp.c | 7 + drivers/mmc/fsl_esdhc.c | 12 +- drivers/net/fec_mxc.c | 78 +- drivers/power/pmic/Makefile | 2 +- drivers/power/regulator/Makefile | 2 +- include/configs/mx8mq_evk.h | 269 ++++++ include/dt-bindings/clock/imx8mq-clock.h | 612 +++++++++++++ include/dt-bindings/pinctrl/pins-imx8mq.h | 632 +++++++++++++ include/imx_sip.h | 14 + 57 files changed, 9047 insertions(+), 363 deletions(-) create mode 100644 arch/arm/dts/fsl-imx8-ca53.dtsi create mode 100644 arch/arm/dts/fsl- imx8mq-evk.dts create mode 100644 arch/arm/dts/fsl-imx8mq.dtsi create mode 100644 arch/arm/include/asm/arch-mx8m/clock.h create mode 100644 arch/arm/include/asm/arch-mx8m/crm_regs.h create mode 100644 arch/arm/include/asm/arch-mx8m/ddr.h create mode 100644 arch/arm/include/asm/arch-mx8m/gpio.h create mode 100644 arch/arm/include/asm/arch-mx8m/imx-regs.h create mode 100644 arch/arm/include/asm/arch-mx8m/mx8mq_pins.h create mode 100644 arch/arm/include/asm/arch-mx8m/sys_proto.h create mode 100644 arch/arm/mach-imx/mac.c create mode 100644
arch/arm/mach-imx/mmc_env.ccreate mode 100644arch/arm/mach-imx/mx8m/Kconfig create mode 100644arch/arm/mach-imx/mx8m/Makefilecreate mode 100644arch/arm/mach-imx/mx8m/clock.ccreate mode 100644arch/arm/mach-imx/mx8m/clock_slice.ccreate mode 100644 arch/arm/mach-imx/mx8m/lowlevel_init.S create mode 100644 arch/arm/mach-imx/mx8m/soc.c create mode 100644 arch/arm/mach-imx/sip.c create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.h create mode 100644 include/dt- bindings/clock/imx8mq-clock.h create mode 100644 include/dt-bindings/pinctrl/pins-imx8mq.h create mode 100644 include/imx_sip.h--
2.14.1
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Quoted 4 lines · Peng Fan
Hi Stefano,
Do you have any comments on this v5 patchset? I would like this patchset could catch up 2018.03.
Give me time until week-end, I cannot take a look before - thanks !
Regards,
Stefano
Quoted 221 lines
Thanks,
Peng.Quoted 216 lines
-----Original Message-----
From: Peng Fan
Sent: Wednesday, January 10, 2018 1:20 PM
To: sbabic at denx.de; Fabio Estevam <[email protected]>
Cc: van.freenix at gmail.com; u-boot at lists.denx.de; Peng Fan <[email protected]>
Subject: [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKThis patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the
patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from
Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile.
BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's
patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from
Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other
boards, in V3 patchset, only touch pfuze100 related options.Sharing code about get mac from fuse between mx7/mx8m Sharing code
about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8mIntroduce wait_mask_set/clr_timeout to avoid deadloop in clock pll
configurationCorrect authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are
about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.Improve REAMME file to include where to download firmware and imx-
mkimage and how to buildAdd review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7 patch 12/23: Typo fix and
return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportTom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLYe Li (1):
net: fec: fix build warnings for 64bits supportarch/arm/Kconfig | 14 +- arch/arm/Makefile | 4 +- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8-ca53.dtsi | 92 ++ arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/dts/fsl-imx8mq.dtsi | 429 +++++++++ arch/arm/include/asm/arch-imx/cpu.h | 6 +- arch/arm/include/asm/arch-mx6/imx-regs.h | 9 +- arch/arm/include/asm/arch-mx7/imx-regs.h | 18 +- arch/arm/include/asm/arch-mx8m/clock.h | 657 +++++++++++++ arch/arm/include/asm/arch-mx8m/crm_regs.h | 10 + arch/arm/include/asm/arch-mx8m/ddr.h | 365 ++++++++ arch/arm/include/asm/arch-mx8m/gpio.h | 12 + arch/arm/include/asm/arch-mx8m/imx-regs.h | 468 ++++++++++ arch/arm/include/asm/arch-mx8m/mx8mq_pins.h | 623 +++++++++++++ arch/arm/include/asm/arch-mx8m/sys_proto.h | 18 + arch/arm/include/asm/mach-imx/boot_mode.h | 10 + arch/arm/include/asm/mach-imx/iomux-v3.h | 22 +- arch/arm/include/asm/mach-imx/regs-lcdif.h | 10 +- arch/arm/include/asm/mach-imx/sys_proto.h | 4 + arch/arm/mach-imx/Makefile | 23 +- arch/arm/mach-imx/cpu.c | 130 ++- arch/arm/mach-imx/imx_bootaux.c | 51 +- arch/arm/mach-imx/mac.c | 61 ++ arch/arm/mach-imx/mmc_env.c | 30 + arch/arm/mach-imx/mx5/clock.c | 4 +- arch/arm/mach-imx/mx6/soc.c | 72 -- arch/arm/mach-imx/mx7/clock.c | 2 + arch/arm/mach-imx/mx7/soc.c | 195 ---- arch/arm/mach-imx/mx7ulp/clock.c | 2 + arch/arm/mach-imx/mx8m/Kconfig | 22 + arch/arm/mach-imx/mx8m/Makefile | 8 + arch/arm/mach-imx/mx8m/clock.c | 795 ++++++++++++++++ arch/arm/mach-imx/mx8m/clock_slice.c | 742 +++++++++++++++ arch/arm/mach-imx/mx8m/lowlevel_init.S | 63 ++ arch/arm/mach-imx/mx8m/soc.c | 227 +++++ arch/arm/mach-imx/sip.c | 23 + arch/arm/mach-imx/spl.c | 10 +- board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + drivers/gpio/mxc_gpio.c | 22 +- drivers/misc/mxc_ocotp.c | 7 + drivers/mmc/fsl_esdhc.c | 12 +- drivers/net/fec_mxc.c | 78 +- drivers/power/pmic/Makefile | 2 +- drivers/power/regulator/Makefile | 2 +- include/configs/mx8mq_evk.h | 269 ++++++ include/dt-bindings/clock/imx8mq-clock.h | 612 +++++++++++++ include/dt-bindings/pinctrl/pins-imx8mq.h | 632 +++++++++++++ include/imx_sip.h | 14 + 57 files changed, 9047 insertions(+), 363 deletions(-) create mode 100644 arch/arm/dts/fsl-imx8-ca53.dtsi create mode 100644 arch/arm/dts/fsl- imx8mq-evk.dts create mode 100644 arch/arm/dts/fsl-imx8mq.dtsi create mode 100644 arch/arm/include/asm/arch-mx8m/clock.h create mode 100644 arch/arm/include/asm/arch-mx8m/crm_regs.h create mode 100644 arch/arm/include/asm/arch-mx8m/ddr.h create mode 100644 arch/arm/include/asm/arch-mx8m/gpio.h create mode 100644 arch/arm/include/asm/arch-mx8m/imx-regs.h create mode 100644 arch/arm/include/asm/arch-mx8m/mx8mq_pins.h create mode 100644 arch/arm/include/asm/arch-mx8m/sys_proto.h create mode 100644 arch/arm/mach-imx/mac.c create mode 100644
arch/arm/mach-imx/mmc_env.ccreate mode 100644arch/arm/mach-imx/mx8m/Kconfig create mode 100644arch/arm/mach-imx/mx8m/Makefilecreate mode 100644arch/arm/mach-imx/mx8m/clock.ccreate mode 100644arch/arm/mach-imx/mx8m/clock_slice.ccreate mode 100644 arch/arm/mach-imx/mx8m/lowlevel_init.S create mode 100644 arch/arm/mach-imx/mx8m/soc.c create mode 100644 arch/arm/mach-imx/sip.c create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode 100644 configs/mx8mq_evk_defconfig create mode 100644 include/configs/mx8mq_evk.h create mode 100644 include/dt- bindings/clock/imx8mq-clock.h create mode 100644 include/dt-bindings/pinctrl/pins-imx8mq.h create mode 100644 include/imx_sip.h--
2.14.1
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
Peng Fan
reviewerv5 cover imx: add i.MX8M support and i.MX8MQ EVK
Quoted 7 lines · Peng Fan
Quoted 4 lines
Hi Stefano,
Do you have any comments on this v5 patchset? I would like this patchset could catch up 2018.03.
Give me time until week-end, I cannot take a look before - thanks !
Sorry for the push. Thanks.
Thanks,
Peng.
Quoted 282 lines
Regards,
StefanoQuoted 23 lines
Thanks,
Peng.Quoted 19 lines
-----Original Message-----
From: Peng Fan
Sent: Wednesday, January 10, 2018 1:20 PM
To: sbabic at denx.de; Fabio Estevam <[email protected]>
Cc: van.freenix at gmail.com; u-boot at lists.denx.de; Peng Fan <[email protected]>
Subject: [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKThis patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeout
in the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset,
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%40n xp.
Quoted 1 line
Quoted 1 line
com%7C626cf8e0c4cb46b6fa5608d55e5091dc%7C686ea1d3bc2b4c6fa92cd99c5c 30
Quoted 1 line
Quoted 1 line
1635%7C0%7C1%7C636518622542742993&sdata=PSuBdmBbxw7Z%2B9Maetke qGWEsTC
Quoted 4 lines
Quoted 4 lines
tqSnO5IzYsvKkNGI%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded from SPL"
from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile.
Quoted 9 lines
Quoted 9 lines
Because
CONFIG_GPT_TIMERchange, I did a small modification to apply
Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F855027%2F&data=02%7C01%7Cpeng.fan%40n xp.
Quoted 1 line
Quoted 1 line
com%7C626cf8e0c4cb46b6fa5608d55e5091dc%7C686ea1d3bc2b4c6fa92cd99c5c 30
Quoted 1 line
Quoted 1 line
1635%7C0%7C1%7C636518622542742993&sdata=PSuBdmBbxw7Z%2B9Maetke qGWEsTC
Quoted 10 lines
Quoted 10 lines
tqSnO5IzYsvKkNGI%3D&reserved=0
"arm: imx: Rework i.MX specific commands to be excluded from SPL"
from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke
other boards, in V3 patchset, only touch pfuze100 related options.Sharing code about get mac from fuse between mx7/mx8m Sharing code
about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device betweenmx7/mx8m
Quoted 35 lines
Quoted 35 lines
Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll
configurationCorrect authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers,
there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.Improve REAMME file to include where to download firmware and imx-
mkimage and how to buildAdd review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons. Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7 patch 12/23: Typo
fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.Quoted 3 lines
Quoted 3 lines
The patchset depends on
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F841934%2F&data=02%7C01%7Cpeng.fan%40n xp.
Quoted 1 line
Quoted 1 line
com%7C626cf8e0c4cb46b6fa5608d55e5091dc%7C686ea1d3bc2b4c6fa92cd99c5c 30
Quoted 1 line
Quoted 1 line
1635%7C0%7C1%7C636518622542742993&sdata=DLNROQVpNnwy3wU0Ix25uU QWJmk%2
Quoted 3 lines
Quoted 3 lines
BEx%2BPTESrr%2Fc4330%3D&reserved=0
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.ozlabs.org%2Fpatch%2F841958%2F&data=02%7C01%7Cpeng.fan%40n xp.
Quoted 1 line
Quoted 1 line
com%7C626cf8e0c4cb46b6fa5608d55e5091dc%7C686ea1d3bc2b4c6fa92cd99c5c 30
Quoted 1 line
Quoted 1 line
1635%7C0%7C1%7C636518622542742993&sdata=wpdsOEit3lIJ2dkc8FGh2fcY%2 FhZ
Quoted 115 lines
Quoted 115 lines
vAR%2FVtC19U2fp4QE%3D&reserved=0
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportTom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLYe Li (1):
net: fec: fix build warnings for 64bits supportarch/arm/Kconfig | 14 +- arch/arm/Makefile | 4 +- arch/arm/dts/Makefile | 2 + arch/arm/dts/fsl-imx8-ca53.dtsi | 92 ++ arch/arm/dts/fsl-imx8mq-evk.dts | 424 +++++++++ arch/arm/dts/fsl-imx8mq.dtsi | 429 +++++++++ arch/arm/include/asm/arch-imx/cpu.h | 6 +- arch/arm/include/asm/arch-mx6/imx-regs.h | 9 +- arch/arm/include/asm/arch-mx7/imx-regs.h | 18 +- arch/arm/include/asm/arch-mx8m/clock.h | 657 +++++++++++++ arch/arm/include/asm/arch-mx8m/crm_regs.h | 10 + arch/arm/include/asm/arch-mx8m/ddr.h | 365 ++++++++ arch/arm/include/asm/arch-mx8m/gpio.h | 12 + arch/arm/include/asm/arch-mx8m/imx-regs.h | 468 ++++++++++ arch/arm/include/asm/arch-mx8m/mx8mq_pins.h | 623 +++++++++++++ arch/arm/include/asm/arch-mx8m/sys_proto.h | 18 + arch/arm/include/asm/mach-imx/boot_mode.h | 10 + arch/arm/include/asm/mach-imx/iomux-v3.h | 22 +- arch/arm/include/asm/mach-imx/regs-lcdif.h | 10 +- arch/arm/include/asm/mach-imx/sys_proto.h | 4 + arch/arm/mach-imx/Makefile | 23 +- arch/arm/mach-imx/cpu.c | 130 ++- arch/arm/mach-imx/imx_bootaux.c | 51 +- arch/arm/mach-imx/mac.c | 61 ++ arch/arm/mach-imx/mmc_env.c | 30 + arch/arm/mach-imx/mx5/clock.c | 4 +- arch/arm/mach-imx/mx6/soc.c | 72 -- arch/arm/mach-imx/mx7/clock.c | 2 + arch/arm/mach-imx/mx7/soc.c | 195 ---- arch/arm/mach-imx/mx7ulp/clock.c | 2 + arch/arm/mach-imx/mx8m/Kconfig | 22 + arch/arm/mach-imx/mx8m/Makefile | 8 + arch/arm/mach-imx/mx8m/clock.c | 795 ++++++++++++++++ arch/arm/mach-imx/mx8m/clock_slice.c | 742 +++++++++++++++ arch/arm/mach-imx/mx8m/lowlevel_init.S | 63 ++ arch/arm/mach-imx/mx8m/soc.c | 227 +++++ arch/arm/mach-imx/sip.c | 23 + arch/arm/mach-imx/spl.c | 10 +- board/freescale/mx8mq_evk/Kconfig | 12 + board/freescale/mx8mq_evk/Makefile | 12 + board/freescale/mx8mq_evk/README | 47 + board/freescale/mx8mq_evk/ddr/ddr_init.c | 246 +++++ board/freescale/mx8mq_evk/ddr/ddrphy_train.c | 1272 ++++++++++++++++++++++++++ board/freescale/mx8mq_evk/ddr/helper.c | 101 ++ board/freescale/mx8mq_evk/mx8mq_evk.c | 156 ++++ board/freescale/mx8mq_evk/spl.c | 230 +++++ configs/mx8mq_evk_defconfig | 27 + drivers/gpio/mxc_gpio.c | 22 +- drivers/misc/mxc_ocotp.c | 7 + drivers/mmc/fsl_esdhc.c | 12 +- drivers/net/fec_mxc.c | 78 +- drivers/power/pmic/Makefile | 2 +- drivers/power/regulator/Makefile | 2 +- include/configs/mx8mq_evk.h | 269 ++++++ include/dt-bindings/clock/imx8mq-clock.h | 612 +++++++++++++ include/dt-bindings/pinctrl/pins-imx8mq.h | 632 +++++++++++++ include/imx_sip.h | 14 + 57 files changed, 9047 insertions(+), 363 deletions(-) create mode100644
arch/arm/dts/fsl-imx8-ca53.dtsicreate mode 100644arch/arm/dts/fsl-imx8mq-evk.dtscreate mode 100644arch/arm/dts/fsl-imx8mq.dtsicreate mode 100644arch/arm/include/asm/arch-mx8m/clock.hcreate mode 100644 arch/arm/include/asm/arch-mx8m/crm_regs.hQuoted 8 lines
Quoted 8 lines
create mode 100644 arch/arm/include/asm/arch-mx8m/ddr.h create mode 100644 arch/arm/include/asm/arch-mx8m/gpio.h create mode 100644 arch/arm/include/asm/arch-mx8m/imx-regs.h create mode 100644 arch/arm/include/asm/arch-mx8m/mx8mq_pins.h create mode 100644 arch/arm/include/asm/arch-mx8m/sys_proto.h create mode 100644 arch/arm/mach-imx/mac.c create mode 100644
arch/arm/mach-imx/mmc_env.ccreate mode 100644arch/arm/mach-imx/mx8m/Kconfig create mode 100644arch/arm/mach-imx/mx8m/Makefile
Quoted 1 line
Quoted 1 line
create mode 100644
arch/arm/mach-imx/mx8m/clock.ccreate mode100644
Quoted 18 lines
Quoted 18 lines
arch/arm/mach-imx/mx8m/clock_slice.ccreate mode 100644 arch/arm/mach-imx/mx8m/lowlevel_init.S create mode 100644 arch/arm/mach-imx/mx8m/soc.c create mode 100644 arch/arm/mach-imx/sip.c create mode 100644 board/freescale/mx8mq_evk/Kconfig create mode 100644 board/freescale/mx8mq_evk/Makefile create mode 100644 board/freescale/mx8mq_evk/README create mode 100644 board/freescale/mx8mq_evk/ddr/ddr_init.c create mode 100644 board/freescale/mx8mq_evk/ddr/ddrphy_train.c create mode 100644 board/freescale/mx8mq_evk/ddr/helper.c create mode 100644 board/freescale/mx8mq_evk/mx8mq_evk.c create mode 100644 board/freescale/mx8mq_evk/spl.c create mode100644 configs/mx8mq_evk_defconfig create mode 100644
include/configs/mx8mq_evk.hcreate mode 100644include/dt-bindings/clock/imx8mq-clock.hcreate mode 100644include/dt-bindings/pinctrl/pins-imx8mq.hcreate mode 100644 include/imx_sip.hQuoted 3 lines
Quoted 2 lines
--
2.14.1--
============================================================
=========
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
============================================================
=========
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
In reply to Peng FanHi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 111 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile. BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other boards, in V3 patchset, only touch pfuze100 related options.
Sharing code about get mac from fuse between mx7/mx8m Sharing code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll configuration
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.
Improve REAMME file to include where to download firmware and imx-mkimage and how to build
Add review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7
patch 12/23: Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK support
Quoted 6 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLYe Li (1):
net: fec: fix build warnings for 64bits support
I was able to run your patchset on my board.
For the whole series:
Thanks,
Diego
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Quoted 126 lines · Diego Dorta
Hi Peng,
2018-01-10 3:20 GMT-02:00 Peng Fan <[email protected]>:
Quoted 111 lines
This patchset is to add i.MX8M and i.MX8MQ-EVK support
V5:
Drop wait_mask_set/clr_timeout and switch to usereadl_poll_timeoutin the patchset.V4:
Regenerate patchset based on Tom's master tree.
In this patchset, https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom is included to avoid merge conflicts because the i.mx8m change also has some modification to bootaux andarch/arm/mach-imx/Makefile. BecauseCONFIG_GPT_TIMERchange, I did a small modification to apply Tom's patch, no function change.Include ATF link in README.
V3:
This patchset based on https://patchwork.ozlabs.org/patch/855027/
"arm: imx: Rework i.MX specific commands to be excluded from SPL" from Tom to avoid this patchset fail apply after Tom's patch merged.Previously "power: pmic/regulator allow dm be omited by SPL" broke other boards, in V3 patchset, only touch pfuze100 related options.
Sharing code about get mac from fuse between mx7/mx8m Sharing code about bootaux between mx6/7/mx8m Sharing code about cpu speed grade between mx7/mx8m Sharing code about get boot device between mx7/mx8m Sharding code about mmc env between mx7/mx8m
Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll configuration
Correct authorship of fix building warning on fec arm64, patch 27/31.
Switch to use structure for DDR Controller. For DDR PHY registers, there are about more than 10 thousands registers, I could not convert them with detailed register name, and the script is generated from IC team, So I use regs[0xxxxx] arrays here fo easily converting between IC team released script and uboot ddr phy cod.
Improve REAMME file to include where to download firmware and imx-mkimage and how to build
Add review tags on the V2 patchset.
Hope this patchset could catch up next release :)
V2:
patch 02/23: convert to structure, drop
is_boot_from_usband
disconnect_from_usb
patch 04/23: conver to use structure for the clock driver, removed the
CCM_xxxmacros. Add static for local functons.
Addinit_usdhc_clk,init_uart_clkand etc to not enable them all at default.
patch 05/23: Add more commit msg for the sip part.
patch 08/23: Merge the spl boot device with i.MX7
patch 12/23: Typo fix and return error fix from Heiko for the SoC related part patch 22/23: Use a weak functionddr_init. If patch 23/23 could not be
accepted at current stage, to make others still be could be compiled.The patchset depends on
https://patchwork.ozlabs.org/patch/841934/
https://patchwork.ozlabs.org/patch/841958/
to be tested on real hardware.V1:
patch: "power:
pmic.h: includedm/ofnode.h" and
"power: pmic/regulator allow dm be omited by SPL" is previously reviewed in mailist to not merged. If no issue, you may pick it up.The board support is a large patch because of the ddr related code. If it is not good, please first review/pick-up other patches if they are ok.
Peng Fan (29):
imx: add i.MX8M intoKconfig
imx: mx8m: add register definition header file
imx: mx8m: add pin header file
imx: mx8m: add clock driver
imx: add sip function
imx:boot_mode: addUSB_BOOTentry
imx: cpu: update cpu file to support i.MX8M
imx: spl: implementspl_boot_devicefor i.MX8M
imx: add i.MX8MQ SoC Revision andis_mx8mhelper
imx: add pad settings bit definition for i.MX8M
imx: cpu: move speed/temp to common cpu
imx: cpu: add cpu speed/grade for i.MX8M
imx: refactorimx_get_mac_from_fuse
imx: cleanup bootaux
imx: bootaux: support i.MX8M
imx: mx7: moveget_boot_devicetocpu.c
imx: cpu: supportget_boot_devicefor i.MX8M
imx: mx7: move mmc env code tommc_env.c
imx: mx8m: add soc related settings and files
imx: makefile: compile files for i.MX8M
misc: ocotp: add i.MX8M support
mmc:fsl_esdhc: support i.MX8M
imx: lcdif: include i.MX8M
gpio: mxc: add i.MX8M support
net: fec: do not access reserved register for i.MX8M
imx: imx8mq: add dtsi file
power: pmic/regulator allow dm be omitted by SPL
imx: mx8m: add ddr controller memory map
imx: add i.MX8MQ EVK supportQuoted 6 lines
Tom Rini (1):
arm: imx: Rework i.MX specific commands to be excluded from SPLYe Li (1):
net: fec: fix build warnings for 64bits supportI was able to run your patchset on my board.
For the whole series:
Quoted 8 lines
Tested-by Diego Dorta <[email protected]>Thanks,
Diego
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Peng,
Will you be releasing the script you are using to convert that code generated by the ddr training tool into this format? I would like to test your patchset on our new SOMs and that would be very useful.
Thanks,
Jon
Fabio Estevam
reviewerv5 cover imx: add i.MX8M support and i.MX8MQ EVK
Hi Peng,
Quoted 5 lines · Jon Nettleton
Peng,
Will you be releasing the script you are using to convert that code generated by the ddr training tool into this format? I would like to test your patchset on our new SOMs and that would be very useful.
Any comments about the DDR init script? Looks like we are stuck in this issue for a long time.
Any progress?
Thanks
v5 cover imx: add i.MX8M support and i.MX8MQ EVK
Quoted 5 lines · Fabio Estevam
Hi Peng,
On Fri, Aug 31, 2018 at 3:27 AM, Jon Nettleton <[email protected]> wrote:
Quoted 9 lines
Quoted 5 lines
Peng,
Will you be releasing the script you are using to convert that code generated by the ddr training tool into this format? I would like to test your patchset on our new SOMs and that would be very useful.
Any comments about the DDR init script? Looks like we are stuck in this issue for a long time.
I have been chewing on this over the past week, and I am starting to think that u-boot is not necessarily the right place for the DDR initialization for this platform. We require ATF in order to load the lpddr4 firmware regardless, so why not do the DDR training and configuration there? This would also abstract out the proprietary memory bits so the code doesn't need to be re-duplicated in the various bootloaders. In theory it should also simplify the MX8 image scripts since SPL would not be a requirement.
Thoughts?
Peng Fan
reviewerv5 cover imx: add i.MX8M support and i.MX8MQ EVK
Hi Jon,
Quoted 26 lines
-----Original Message-----
From: Jon Nettleton [mailto:jon at solid-run.com]
Sent: 2018年9月7日 14:03
To: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>; Diego Dorta <[email protected]>; Fabio Estevam <[email protected]>; U-Boot Mailing List <[email protected]>
Subject: Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVKQuoted 5 lines · Fabio Estevam
Hi Peng,
On Fri, Aug 31, 2018 at 3:27 AM, Jon Nettleton <[email protected]> wrote:
Quoted 9 lines
Quoted 5 lines
Peng,
Will you be releasing the script you are using to convert that code generated by the ddr training tool into this format? I would like to test your patchset on our new SOMs and that would be very useful.
Any comments about the DDR init script? Looks like we are stuck in this issue for a long time.
Quoted 7 lines
I have been chewing on this over the past week, and I am starting to think that u-boot is not necessarily the right place for the DDR initialization for this platform. We require ATF in order to load the
lpddr4 firmware regardless, so why not do the DDR training and configuration there? This would also abstract out the proprietary memory bits so the code doesn't need to be re-duplicated in the various bootloaders. In theory it should also simplify the MX8 image scripts since SPL would not be a requirement.
On i.MX8M, SPL is used to initialize DDR and load ATF/TEE/U-Boot to memory and kick ATF.
Two option:
1. Move DDR code out of SPL and make it a standalone image, then pad it the SPL. The drawback is need a new repo holding ddr code.
2. Restructure the DDR code the make it generic enough.
One engineer in NXP is looking into restructure code, but priority is low.
Regards,
Peng.
Quoted 2 lines
Thoughts?