Inital commit

Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
This commit is contained in:
Kirill Kapranov
2023-02-09 00:44:25 +02:00
parent 17aa45316b
commit 31713f34f6
263 changed files with 35669 additions and 2029 deletions
+69 -73
View File
@@ -2,129 +2,125 @@
Supported machines:
* `mcm-imxi8-mini`
* `ucm-imxi8-mini`
* `iot-gate-imx8`
* `IOT-GATE-iMX8`
Define a `MACHINE` environment variable for the target product:
|Machine|Command Line|
|---|---|
|mcm-imx8m-mini|export MACHINE=mcm-imx8m-mini
|ucm-imx8m-mini|export MACHINE=ucm-imx8m-mini
|iot-gate-imx8|export MACHINE=iot-gate-imx8
|ucm-imx8m-mini|export MACHINE=iot-gate-imx8
Define the following environment variables:
|Description|Command Line|
|---|---|
|NXP u-boot release|export NXP_UBOOT_RELEASE=lf-5.10.35-2.0.0|
|NXP ATF release|export NXP_ATF_RELEASE=lf-5.10.35-2.0.0|
|NXP mkimage release|export NXP_MKIMAGE_RELEASE=lf-5.10.35-2.0.0|
|NXP firmware name|export NXP_FIRMWARE=firmware-imx-8.12.bin|
|CompuLab branch name|export CPL_BRANCH=rel_imx_5.10.35_2.0.0-stable|
|NXP firmware name|export NXP_FIRMWARE=firmware-imx-8.14.bin|
|CompuLab release|export CPL_RELEASE=${MACHINE}_r3.1|
|CompuLab branch name|export CPL_BRANCH=lf-5.10.72-2.2.0_${MACHINE}|
|ATF revision|export ATF=lf-5.10.72-2.2.0|
|OPTEE revision|export OPTEE=lf-5.10.72-2.2.0|
|U-Boot revision|export UBOOT=lf-5.10.72-2.2.0|
## Prerequisites
It is up to developer to setup arm64 build environment:
* Download and install the [GNU tool chain](https://github.com/compulab-yokneam/meta-bsp-imx8mm/blob/rel_imx_5.10.35_2.0.0-experiment/Documentation/toolchain.md)
* Download the [ARM tool chain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads/9-2-2019-12)
* Set environment variables:
<pre>
export ARCH=arm64
export CROSS_COMPILE=/opt/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
</pre>
* Create a folder to organize the files:
<pre>
mkdir imx8mm
cd imx8mm
export SRC_ROOT=$(pwd)
mkdir -p imx8mm/{sources,results}
export SRC_ROOT=$(readlink -f imx8mm/sources)
export RESULTS=$(readlink -f imx8mm/results)
cd ${SRC_ROOT}
</pre>
* Download CompuLab BSP
<pre>
git clone -b ${CPL_BRANCH} https://github.com/compulab-yokneam/meta-bsp-imx8mm.git
git clone -b ${CPL_RELEASE} https://github.com/compulab-yokneam/meta-bsp-imx8mm.git
export LAYER_DIR=$(pwd)/meta-bsp-imx8mm
</pre>
## Mkimage setup
* Download the mkimage:
<pre>
git clone https://source.codeaurora.org/external/imx/imx-mkimage.git
git -C imx-mkimage checkout ${NXP_MKIMAGE_RELEASE}
</pre>
## Arm Trusted Firmware (ATF) setup
* Download the ATF:
<pre>
git clone https://source.codeaurora.org/external/imx/imx-atf.git
git -C imx-atf checkout ${NXP_ATF_RELEASE}
git -C imx-atf am ${LAYER_DIR}/recipes-bsp/imx-atf/compulab/imx8mm/*.patch
</pre>
* Make bl31.bin
<pre>
make -C imx-atf PLAT=imx8mm bl31
cp -v imx-atf/build/imx8mm/release/bl31.bin ${SRC_ROOT}/imx-mkimage/iMX8M/
</pre>
## Firmware iMX setup
## Build Procedure
### Firmware iMX setup
* Download the firmware-imx file:
<pre>
wget http://www.freescale.com/lgfiles/NMG/MAD/YOCTO/${NXP_FIRMWARE}
bash -x ${NXP_FIRMWARE} --auto-accept
cp -v $(find firmware* | awk '/train|hdmi_imx8|dp_imx8/' ORS=" ") ${SRC_ROOT}/imx-mkimage/iMX8M/
cp -v $(find firmware* | awk '/train|hdmi_imx8|dp_imx8/' ORS=" ") ${RESULTS}
</pre>
## U-Boot
* Download the U-Boot source and apply CompuLab BSP patches:
### Arm Trusted Firmware (ATF) setup
* Download the ATF:
<pre>
git clone https://source.codeaurora.org/external/imx/uboot-imx.git
git -C uboot-imx checkout ${NXP_UBOOT_RELEASE}
git -C uboot-imx am ${LAYER_DIR}/recipes-bsp/u-boot/compulab/imx8mm/*.patch
git clone https://source.codeaurora.org/external/imx/imx-atf.git
git -C imx-atf checkout ${ATF} -b ${CPL_BRANCH}
</pre>
* Compile U-Boot:
* Apply patches if applicable:
<pre>
make -C uboot-imx -f defconfig.mk
make -C uboot-imx
[[ -d ${LAYER_DIR}/recipes-bsp/imx-atf/compulab/imx8mm ]] && { \
git -C imx-atf am ${LAYER_DIR}/recipes-bsp/imx-atf/compulab/imx8mm/*.patch
}
</pre>
* Make bl31.bin
* Copy files to the mkimage directory:
|Mode |Command
|---|---|
|optee build|make -j 16 -C imx-atf PLAT=imx8mm BUILD_BASE=build PLAT=imx8mm IMX_BOOT_UART_BASE=0x30880000 BL32_BASE=0x56000000 BL32_SIZE=0x2000000 SPD=opteed bl31
|non-optee build|make -j 16 -C imx-atf PLAT=imx8mm BUILD_BASE=build PLAT=imx8mm IMX_BOOT_UART_BASE=0x30880000 BL32_BASE=0x56000000 BL32_SIZE=0x2000000 bl31
* Ceate a symlink in the ${RESULTS} folder:
<pre>
cp -v $(find uboot-imx | awk -v v=${MACHINE} '(/u-boot-spl.bin$|u-boot.bin$|u-boot-nodtb.bin$|tools\/mkimage$/)||($0~v".dtb$")' ORS=" ") ${SRC_ROOT}/imx-mkimage/iMX8M/
ln -s $(readlink -f imx-atf/build/imx8mm/release/bl31.bin) ${RESULTS}/
</pre>
<!---
## OP-TEE Setup
Download the OP-TEE from:
### OP-TEE Setup
| Skip this for a non-optee build |
| --- |
* Download the OP-TEE:
<pre>
git clone https://source.codeaurora.org/external/imx/imx-optee-os
git -C imx-optee-os checkout ${NXP_RELEASE} -b ${CPL_BRANCH}
git -C imx-atf am ${LAYER_DIR}/recipes-security/optee-imx/compulab/imx8mm/*.patch
git -C imx-optee-os checkout ${OPTEE} -b ${CPL_BRANCH}
</pre>
* Apply patches if applicable:
<pre>
[[ -d ${LAYER_DIR}/recipes-security/optee-imx/compulab/imx8mm ]] && { \
git -C imx-optee-os am ${LAYER_DIR}/recipes-security/optee-imx/compulab/imx8mm/*.patch
}
</pre>
* Set environment variables:
<pre>
export ARCH=arm
export CROSS_COMPILE=/usr/bin/arm-linux-gnu-
export CROSS_COMPILE64=/usr/bin/arm-linux-gnu-
export CROSS_COMPILE64=${CROSS_COMPILE}
</pre>
* Make tee.bin
<pre>
cd imx-optee-os
./scripts/imx_build.sh mx8mmevk
cp -v build.mx8mmevk/core/tee.bin ${SRC_ROOT}/imx-mkimage/iMX8M/
make -j 16 -C imx-optee-os PLATFORM=imx PLATFORM_FLAVOR=mx8mm_cl_iot_gate
ln -s $(readlink -f imx-optee-os/out/arm-plat-imx/core/tee-raw.bin) ${RESULTS}/tee.bin
</pre>
-->
## Compiling the **flash.bin** imx-boot image:
* Unset these variables:
### U-Boot
* Download the U-Boot source and apply CompuLab BSP patches:
<pre>
unset ARCH CROSS_COMPILE
git clone https://source.codeaurora.org/external/imx/uboot-imx.git
git -C uboot-imx checkout ${UBOOT} -b ${CPL_BRANCH}
git -C uboot-imx am ${LAYER_DIR}/recipes-bsp/u-boot/compulab/imx8mm/*.patch
</pre>
* Issue:
* Restore `ARCH` environment variables:
<pre>
cd ${SRC_ROOT}/imx-mkimage/iMX8M
sed "s/\(^dtbs = \).*/\1${MACHINE}.dtb/;s/\(mkimage\)_uboot/\1/" soc.mak > Makefile
make clean
make flash_evk SOC=iMX8MM
export ARCH=arm64
</pre>
* Compile U-Boot flash.bin:
<pre>
make -j 16 -C uboot-imx O=${RESULTS} -f defconfig.mk
make -j 16 -C uboot-imx O=${RESULTS}
</pre>
## Flashing
`dd if=flash.bin of=/dev/<your device> bs=1K seek=33 status=progress`
<pre>
dd if=${RESULTS}/flash.bin of=/dev/<your device> bs=1K seek=33 status=progress
</pre>
+156
View File
@@ -0,0 +1,156 @@
# Building Boot Firmware for CompuLab's i.MX8M Mini products with Mkimage
Supported machines:
* `IOT-GATE-iMX8`
Define a `MACHINE` environment variable for the target product:
|Machine|Command Line|
|---|---|
|ucm-imx8m-mini|export MACHINE=iot-gate-imx8
Define the following environment variables:
|Description|Command Line|
|---|---|
|NXP firmware name|export NXP_FIRMWARE=firmware-imx-8.14.bin|
|CompuLab release|export CPL_RELEASE=${MACHINE}_r3.0|
|CompuLab branch name|export CPL_BRANCH=lf-5.10.72-2.2.0_${MACHINE}|
|Mkimage revision|export MKIMG=lf-5.10.72-2.2.0|
|ATF revision|export ATF=lf-5.10.72-2.2.0|
|OPTEE revision|export OPTEE=lf-5.10.72-2.2.0|
|U-Boot revision|export UBOOT=lf-5.10.72-2.2.0|
## Prerequisites
It is up to developer to setup arm64 build environment:
* Download the [ARM tool chain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads/9-2-2019-12)
* Set environment variables:
<pre>
export ARCH=arm64
export CROSS_COMPILE=/opt/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
</pre>
* Create a folder to organize the files:
<pre>
mkdir -p imx8mm
export SRC_ROOT=$(readlink -f imx8mm)
cd ${SRC_ROOT}
</pre>
* Download CompuLab BSP
<pre>
git clone -b ${CPL_RELEASE} https://github.com/compulab-yokneam/meta-bsp-imx8mm.git
export LAYER_DIR=$(pwd)/meta-bsp-imx8mm
</pre>
## Build Procedure
### Mkimage setup
* Download the mkimage:
<pre>
git clone https://source.codeaurora.org/external/imx/imx-mkimage.git
git -C imx-mkimage checkout ${MKIMG}
export RESULTS=${SRC_ROOT}/imx-mkimage/iMX8M
</pre>
### Firmware iMX setup
* Download the firmware-imx file:
<pre>
wget http://www.freescale.com/lgfiles/NMG/MAD/YOCTO/${NXP_FIRMWARE}
bash -x ${NXP_FIRMWARE} --auto-accept
cp -v $(find firmware* | awk '/train|hdmi_imx8|dp_imx8/' ORS=" ") ${RESULTS}
</pre>
### Arm Trusted Firmware (ATF) setup
* Download the ATF:
<pre>
git clone https://source.codeaurora.org/external/imx/imx-atf.git
git -C imx-atf checkout ${ATF} -b ${CPL_BRANCH}
</pre>
* Apply patches if applicable:
<pre>
[[ -d ${LAYER_DIR}/recipes-bsp/imx-atf/compulab/imx8mm ]] && { \
git -C imx-atf am ${LAYER_DIR}/recipes-bsp/imx-atf/compulab/imx8mm/*.patch
}
</pre>
* Make bl31.bin
|Mode |Command
|---|---|
|optee build|make -j 16 -C imx-atf PLAT=imx8mm BUILD_BASE=build PLAT=imx8mm IMX_BOOT_UART_BASE=0x30880000 BL32_BASE=0x56000000 BL32_SIZE=0x2000000 SPD=opteed bl31
|non-optee build|make -j 16 -C imx-atf PLAT=imx8mm BUILD_BASE=build PLAT=imx8mm IMX_BOOT_UART_BASE=0x30880000 BL32_BASE=0x56000000 BL32_SIZE=0x2000000 bl31
* Ceate a symlink in the ${RESULTS} folder:
<pre>
ln -s $(readlink -f imx-atf/build/imx8mm/release/bl31.bin) ${RESULTS}/
</pre>
### OP-TEE Setup
| Skip this for a non-optee build |
| --- |
* Download the OP-TEE:
<pre>
git clone https://source.codeaurora.org/external/imx/imx-optee-os
git -C imx-optee-os checkout ${OPTEE} -b ${CPL_BRANCH}
</pre>
* Apply patches if applicable:
<pre>
[[ -d ${LAYER_DIR}/recipes-security/optee-imx/compulab/imx8mm ]] && { \
git -C imx-optee-os am ${LAYER_DIR}/recipes-security/optee-imx/compulab/imx8mm/*.patch
}
</pre>
* Set environment variables:
<pre>
export ARCH=arm
export CROSS_COMPILE64=${CROSS_COMPILE}
</pre>
* Make tee.bin
<pre>
make -j 16 -C imx-optee-os PLATFORM=imx PLATFORM_FLAVOR=mx8mm_cl_iot_gate
ln -s $(readlink -f imx-optee-os/out/arm-plat-imx/core/tee-raw.bin) ${RESULTS}/tee.bin
</pre>
### U-Boot
* Download the U-Boot source and apply CompuLab BSP patches:
<pre>
git clone https://source.codeaurora.org/external/imx/uboot-imx.git
git -C uboot-imx checkout ${UBOOT} -b ${CPL_BRANCH}
git -C uboot-imx am ${LAYER_DIR}/recipes-bsp/u-boot/compulab/imx8mm/*.patch
</pre>
* Restore `ARCH` environment variables:
<pre>
export ARCH=arm64
</pre>
* Compile U-Boot flash.bin:
<pre>
make -j 16 -C uboot-imx -f defconfig.mk
make -j 16 -C uboot-imx
</pre>
* Copy files to the results directory
<pre>
cp -v $(find uboot-imx | awk -v v=${MACHINE} '(/u-boot-spl.bin$|u-boot.bin$|u-boot-nodtb.bin$|tools\/mkimage$/)||($0~v".dtb$")' ORS=" ") ${RESULTS}
</pre>
### Compiling the flash.bin imx-boot image
* Unset these variables:
<pre>
unset ARCH CROSS_COMPILE
</pre>
Issue:
<pre>
cd ${RESULTS}
sed "s/\(^dtbs \).*/\1= ${MACHINE}.dtb/;s/\(mkimage\)_uboot/\1/;s/\(^TEE_LOAD_ADDR \).*/\1= 0x56000000/g" soc.mak > Makefile
make clean
make flash_evk SOC=iMX8MM
</pre>
Issue the following commands to generate log files for the HAB signing operation:
<pre>
make SOC=iMX8MM flash_evk 2>&1 | tee flash_evk.log
make SOC=iMX8MM print_fit_hab 2>&1 | tee print_fit_hab.log
</pre>
## Flashing
<pre>
echo 0 > /sys/class/block/mmcblk2boot0/force_ro
dd if=flash.bin of=/dev/mmcblk2boot0 bs=1K seek=33 status=progress
echo 1 > /sys/class/block/mmcblk2boot0/force_ro
</pre>
+8 -10
View File
@@ -2,26 +2,24 @@
Supported machines:
* `mcm-imx8m-mini`
* `ucm-imx8m-mini`
* `iot-gate-imx8`
Define a `MACHINE` environment variable for the target product:
|Machine|Command Line|
|---|---|
|mcm-imx8m-mini|export MACHINE=mcm-imx8m-mini
|ucm-imx8m-mini|export MACHINE=ucm-imx8m-mini
|iot-gate-imx8|export MACHINE=iot-gate-imx8
Define the following environment variables:
|Description|Command Line|
|---|---|
|NXP release name|export NXP_RELEASE=lf-5.10.35-2.0.0|
|CompuLab branch name|export CPL_BRANCH=rel_imx_5.10.35_2.0.0-stable|
|NXP release name|export NXP_RELEASE=lf-5.10.y|
|CompuLab branch name|export CPL_BRANCH=iot-gate-imx8_r3.0|
## Prerequisites
It is up to developer to setup arm64 build environment:
* Download the [GNU tool chain](https://github.com/compulab-yokneam/meta-bsp-imx8mm/blob/rel_imx_5.4.70_2.3.0-stable/Documentation/toolchain.md)
* Download the [GNU tool chain](https://github.com/compulab-yokneam/meta-bsp-imx8mm/blob/iot-gate-imx8_r3.0/Documentation/toolchain.md)
* Create a folder to organize the files:
<pre>
mkdir imx8mm
@@ -35,13 +33,13 @@ export PATCHES=$(pwd)/meta-bsp-imx8mm/recipes-kernel/linux/compulab/imx8mm
## CompuLab Linux Kernel setup
<pre>
git clone https://source.codeaurora.org/external/imx/linux-imx.git
git -C linux-imx checkout -b linux-compulab ${NXP_RELEASE}
git clone -b ${NXP_RELEASE} --single-branch https://source.codeaurora.org/external/imx/linux-imx.git
git -C linux-imx checkout -b linux-compulab
git -C linux-imx am ${PATCHES}/*.patch
</pre>
## Compile the Kernel
<pre>
make -C linux-imx cl-imx8m-mini_defconfig ${MACHINE}.config
make -C linux-imx ${MACHINE}_defconfig
make -C linux-imx
</pre>
+1 -1
View File
@@ -14,6 +14,6 @@ sudo tar -C /opt -xf gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz
* Set environment variables:
<pre>
export ARCH=arm64
export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-linux-gnu-
export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
</pre>
+9 -38
View File
@@ -1,43 +1,14 @@
# Quick Start Guide
# Developer snapshot
# Please do not try this at home
Supported CompuLab machines:
* `mcm-imx8m-mini`
* `ucm-imx8m-mini`
export COMPULAB_MACHINE=ucm-imx8m-mini
export LREPO=imx_5.15.32-2.0.0-compulab.xml
export CLB_RELEASE=rel_imx_5.15.32-2.0.0-experimental
# 1 Setup environment
## 1.1 Prepare NXP BSP
```
repo init -u git://source.codeaurora.org/external/imx/imx-manifest.git -b imx-linux-hardknott -m imx-5.10.35-2.0.0.xml
```
## 1.2 Download CompuLab meta layer
```
wget --directory-prefix .repo/manifests https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx8mm/rel_imx_5.10.35_2.0.0-stable/scripts/imx-5.10.35_2.0.0_compulab.xml
```
## 1.3 Get entire BSP tree
```
repo init -m imx-5.10.35_2.0.0_compulab.xml
repo init -u git://source.codeaurora.org/external/imx/imx-manifest.git -b imx-linux-kirkstone -m imx-5.15.32-2.0.0.xml
mkdir -p .repo/local_manifests
wget --directory-prefix .repo/local_manifests https://raw.githubusercontent.com/compulab-yokneam/meta-bsp-imx8mm/${CLB_RELEASE}/scripts/${LREPO}
repo sync
```
# 2 Build
## 2.1 Define COMPULAB_MACHINE environment variable
|Machine|Command Line|
|---|---|
|mcm-imx8m-mini|```export COMPULAB_MACHINE=mcm-imx8m-mini```
|ucm-imx8m-mini|```export COMPULAB_MACHINE=ucm-imx8m-mini```
## 2.2 Run CompuLab Linux Yocto Project setup
|NOTE|Refer to the [NXP Readme](https://source.codeaurora.org/external/imx/meta-imx/tree/README?h=hardknott-5.10.35-2.0.0) for details about how to select a correct backend & distro.|
|---|---|
```
MACHINE=${COMPULAB_MACHINE} DISTRO=fsl-imx-xwayland source compulab-setup-env -b build
```
## 2.3 Build image
```
bitbake -k compulab-ucm-imx8m-mini
```
# 3 Precompiled images
|Machine|Image|
|---|---|
|ucm-imx8m-mini|[compulab-ucm-imx8m-mini-ucm-imx8m-mini-YYYYMMDDhhmmss.rootfs.wic.bz2](https://drive.google.com/file/d/1PLSpK6_F1oTnSQqcTwHmpUboF7tbKLAv/view?usp=sharing)
+3 -2
View File
@@ -9,15 +9,16 @@ BBFILE_COLLECTIONS += "compulab-bsp-imx8mm"
BBFILE_PATTERN_compulab-bsp-imx8mm := "^${LAYERDIR}/"
BBFILE_PRIORITY_compulab-bsp-imx8mm = "9"
BBMASK += "meta-compulab/recipes-bsp"
BBMASK += "meta-compulab/recipes-xfce"
BBMASK += "meta-compulab/recipes-kernel"
BBMASK += "meta-compulab/recipes-graphics"
BBMASK += ".*boundary.*"
CORE_IMAGE_EXTRA_INSTALL += " kernel-modules "
CORE_IMAGE_EXTRA_INSTALL += "${@bb.utils.contains('DISTRO_CODENAME', 'dunfell', 'firmware-imx-sdma-imx7d', 'firmware-imx-sdma', d)}"
CORE_IMAGE_EXTRA_INSTALL += " firmware-imx-sdma-imx7d "
HOSTTOOLS += " git-lfs "
HOSTTOOLS += " bison "
LAYERSERIES_COMPAT_compulab-bsp-imx8mm = "sumo thud warrior zeus dunfell hardknott"
LAYERSERIES_COMPAT_compulab-bsp-imx8mm = "kirkstone"
+28 -13
View File
@@ -1,12 +1,15 @@
MACHINEOVERRIDES =. "mx8:mx8m:mx8mm:"
MACHINEOVERRIDES =. "imx-boot-container:mx8:mx8m:mx8mm:compulab-mx8mm:"
SOC_DEFAULT_WKS_FILE = "imx-imx-boot-bootpart.wks.in"
require conf/machine/include/imx-base.inc
require conf/machine/include/tune-cortexa53.inc
require conf/machine/include/arm/armv8a/tune-cortexa53.inc
MACHINE_FEATURES += " pci wifi bluetooth "
IMX_DEFAULT_BOOTLOADER:use-mainline-bsp = "u-boot-compulab"
IMX_DEFAULT_BOOTLOADER:use-nxp-bsp = "u-boot-compulab"
SPL_BINARY = "spl/u-boot-spl.bin"
# Set DDR FIRMWARE
@@ -27,24 +30,36 @@ UBOOT_SUFFIX = "bin"
UBOOT_MAKE_TARGET = ""
IMX_BOOT_SEEK = "33"
MACHINE_FIRMWARE:append = " firmware-cypress linux-firmware-ax200"
MACHINE_FIRMWARE:remove = "linux-firmware-ath10k"
DEFAULTTUNE:mx8mm-nxp-bsp = "aarch64"
# PLATFORM_FLAVOR = "mx8mmevk"
# PLATFORM_FLAVOR:ucm-imx8m-mini = "mx8mmevk"
# PLATFORM_FLAVOR:mcm-imx8m-mini = "mx8mmevk"
# PLATFORM_FLAVOR:iot-gate-imx8 = "mx8mmevk"
# Optee parameters
OPTEE_BIN_EXT = "8mm"
OPTEE_PLATFORM_FLAVOR = "mx8mm_cl_iot_gate"
PLATFORM_FLAVOR:iot-gate-imx8 = "${OPTEE_PLATFORM_FLAVOR}"
PLATFORM_FLAVOR:mcm-imx8m-mini = "${OPTEE_PLATFORM_FLAVOR}"
PLATFORM_FLAVOR:ucm-imx8m-mini = "${OPTEE_PLATFORM_FLAVOR}"
TEE_LOAD_ADDR = "0x56000000"
MACHINE_FIRMWARE_append = " firmware-cypress linux-firmware-ax200"
MACHINE_FIRMWARE_remove = "linux-firmware-ath10k"
DEFAULTTUNE_mx8mm = "aarch64"
PLATFORM_FLAVOR = "mx8mmevk"
PLATFORM_FLAVOR_ucm-imx8m-mini = "mx8mmevk"
PLATFORM_FLAVOR_mcm-imx8m-mini = "mx8mmevk"
PLATFORM_FLAVOR_iot-gate-imx8 = "mx8mmevk"
ATF_MACHINE_NAME = "bl31-imx8mm.bin"
PLATFORM = "imx8mm"
SOC_TARGET = "iMX8MM"
IMX_BOOT_SOC_TARGET = "iMX8MM"
IMAGE_INSTALL_append = " \
IMAGE_INSTALL:append = " \
kernel-image \
kernel-modules \
kernel-devicetree \
"
PREFERRED_PROVIDER_virtual/kernel:compulab-mx8mm = "linux-compulab"
PREFERRED_PROVIDER_virtual/bootloader:compulab-mx8mm = "u-boot-compulab"
PREFERRED_PROVIDER_linux-imx-mfgtool:compulab-mx8mm = "linux-compulab-mfgtool"
PREFERRED_PROVIDER_linux-compulab-mfgtool:compulab-mx8mm = "linux-compulab-mfgtool"
+17
View File
@@ -9,6 +9,11 @@ require compulab-imx8mm.inc
KERNEL_DEVICETREE = "compulab/ucm-imx8m-mini.dtb "
KERNEL_DEVICETREE += "compulab/sb-iotgimx8.dtb "
KERNEL_DEVICETREE += "compulab/sb-iotgimx8-can.dtb "
KERNEL_DEVICETREE += "compulab/sb-iotgimx8-ied.dtb "
KERNEL_DEVICETREE += "compulab/sb-iotgimx8-ied-m4.dtb "
KERNEL_DEVICETREE += "compulab/sb-iotgimx8-poed.dtb "
KERNEL_DEVICETREE += "compulab/sb-iotgimx8-poedv2.dtb "
KERNEL_DEVICETREE += "compulab/sb-iotgimx8-ied-wakeup.dtb "
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] = "iot-gate-imx8_defconfig,sdcard"
@@ -16,3 +21,15 @@ UBOOT_CONFIG[mfgtool] = "iot-gate-imx8_defconfig"
# Set u-boot DTB
UBOOT_DTB_NAME = "iot-gate-imx8.dtb"
# Prefered components
# PREFERRED_PROVIDER_virtual/kernel_mx8mm = "linux-compulab"
# PREFERRED_PROVIDER_virtual/bootloader_mx8mm = "u-boot-compulab"
# Block recipes
BBMASK += "meta-compulab/recipes-bsp/u-boot"
# Optee parameters
OPTEE_PLATFORM_FLAVOR = "mx8mm_cl_iot_gate"
PLATFORM_FLAVOR:iot-gate-imx8 = "${OPTEE_PLATFORM_FLAVOR}"
TEE_LOAD_ADDR = "0x56000000"
+1 -1
View File
@@ -17,5 +17,5 @@ UBOOT_CONFIG[mfgtool] = "ucm-imx8m-mini_defconfig"
# Set u-boot DTB
UBOOT_DTB_NAME = "ucm-imx8m-mini.dtb"
CL_RELEASE = '2.2.1'
CL_RELEASE = '2.2'
IMAGE_LINK_NAME = "${MACHINE}"
+1 -1
View File
@@ -19,7 +19,7 @@ SRC_URI = "git://chromium.googlesource.com/chromiumos/third_party/broadcom;proto
FILES_${PN} = "/usr/bin/*"
do_install_append() {
do_install:append() {
install -d ${D}/usr/bin
install -m 755 brcm_patchram_plus ${D}/usr/bin
}
-7
View File
@@ -1,7 +0,0 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append = " \
file://bt-start \
"
RDEPENDS_${PN} = "bash brcm-patchram firmware-imx-brcm"
@@ -1,13 +1,13 @@
BB_STRICT_CHECKSUM = "0"
SRC_URI_append += " \
SRC_URI:append = " \
https://github.com/compulab-yokneam/bin/raw/master/rootfs/lib/firmware/brcm/480-0081.tar.bz2;protocol=https;md5sum=c6a3119dec228a6fb65642be931ee6aa;sha256sum=e5755109f263a70738f59869704351a15c846a9a3963236ba9742eb4e0e67052 \
"
do_install_append () {
do_install:append () {
cp -rfv ${WORKDIR}/lib/firmware/brcm ${D}${base_libdir}/firmware/
}
FILES_${PN}-brcm += "${base_libdir}/firmware/brcm"
FILES:${PN}-brcm += "${base_libdir}/firmware/brcm"
PACKAGES =+ "${PN}-brcm"
COMPATIBLE_MACHINE_ucm-imx8m-mini = "ucm-imx8m-mini"
+3 -5
View File
@@ -1,6 +1,4 @@
SRC_URI_append = " \
file://0001-imx8mm-Set-IMX_BOOT_UART_BASE-for-CompuLab-boards.patch \
file://0002-imx8mm-Assign-RDC_PDAP_UART4-to-D0.patch \
file://0003-imx8mm-Set-BL2_BASE-to-the-upper-egde-of-the-1G.patch \
file://0004-imx8mm-RDC-Remove-UART1-D0-restrictions.patch \
SRC_URI:append = " \
file://0001-imx8mm-Assign-RDC_PDAP_UART4-to-D0.patch \
file://0002-iot-gate-imx8-RDC-Remove-UART2-D0-restrictions.patch \
"
@@ -0,0 +1,26 @@
From 48afff4126103326193042622273e036f3396d2c Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 8 Jul 2020 11:34:20 +0300
Subject: [PATCH 1/2] imx8mm: Assign RDC_PDAP_UART4 to D0
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
index f63b9fcad..a89c7f941 100644
--- a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
+++ b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
@@ -58,7 +58,7 @@ static const struct imx_rdc_cfg rdc[] = {
RDC_MDAn(RDC_MDA_M4, DID1),
/* peripherals domain permission */
- RDC_PDAPn(RDC_PDAP_UART4, D1R | D1W),
+ RDC_PDAPn(RDC_PDAP_UART4, D0R | D0W),
RDC_PDAPn(RDC_PDAP_UART2, D0R | D0W),
RDC_PDAPn(RDC_PDAP_UART1, D0R | D0W),
--
2.11.0
@@ -0,0 +1,25 @@
From 3d785a514a3c9251c9db6b4f575153311a848a6c Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Wed, 4 May 2022 11:03:18 +0300
Subject: [PATCH 2/2] iot-gate-imx8: RDC: Remove UART2 D0 restrictions
Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
---
plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
index a89c7f941..c7bfd3f9e 100644
--- a/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
+++ b/plat/imx/imx8m/imx8mm/imx8mm_bl31_setup.c
@@ -59,7 +59,6 @@ static const struct imx_rdc_cfg rdc[] = {
/* peripherals domain permission */
RDC_PDAPn(RDC_PDAP_UART4, D0R | D0W),
- RDC_PDAPn(RDC_PDAP_UART2, D0R | D0W),
RDC_PDAPn(RDC_PDAP_UART1, D0R | D0W),
/* memory region */
--
2.11.0
+11
View File
@@ -0,0 +1,11 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/compulab/imx8mm:"
require compulab/imx8mm.inc
ATF_PLATFORM = "imx8mm"
EXTRA_OEMAKE += "\
IMX_BOOT_UART_BASE=0x30880000 \
BL32_BASE=${TEE_LOAD_ADDR} \
BL32_SIZE=0x2000000 \
"
+1 -1
View File
@@ -1,3 +1,3 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/compulab/imx8mm:"
FILESEXTRAPATHS:prepend := "${THISDIR}/compulab/imx8mm:"
include compulab/imx8mm.inc
+3 -3
View File
@@ -1,12 +1,12 @@
do_compile_preppend () {
make_file=${S}/iMX8M/soc.mak
if [ -e ${make_file} ]; then
sed -i "s/dtbs = .*dtb/dtbs = ${UBOOT_DTB_NAME}/g" ${make_file}
sed -i "s/\(^TEE_LOAD_ADDR \).*/\1= 0x7e000000/g" ${make_file}
sed -i "s/\(^dtbs \).*/\1= ${UBOOT_DTB_NAME}/g" ${make_file}
sed -i "s/\(^TEE_LOAD_ADDR \).*/\1= 0x56000000/g" ${make_file}
fi
}
do_install_append () {
do_install:append () {
ln -fs ${BOOT_CONFIG_MACHINE}-${target} ${D}/boot/imx-boot
}
@@ -1,7 +1,7 @@
DESCRIPTION = "CompuLab release info."
LICENSE = "MIT"
do_install_append() {
do_install:append() {
for i in issue issue.net; do
sed -e "/^Compulab Release/d" -i ${D}/etc/$i
sed -e " 1 i $(date +"Compulab Release ${MACHINE} ${CL_RELEASE} %d %b %Y based on")" -i ${D}/etc/$i
@@ -3,4 +3,4 @@ LICENSE = "MIT"
export IMAGE_LINK_NAME="${MACHINE}"
require dynamic-layers/qt5-layer/recipes-fsl/images/fsl-image-qt5-validation-imx.bb
#require dynamic-layers/qt6-layer/recipes-fsl/images/imx-image-full.bb
@@ -1,6 +1,6 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
do_compile_prepend() {
do_compile:prepend() {
BOOTLOADER=$(basename $(ls ${WORKDIR}/recipe-sysroot/boot/imx-boot-* | head -1))
sed -i "s|##BOOTLOADER##|${BOOTLOADER}|" ${WORKDIR}/boot.script
}
+79 -55
View File
@@ -1,4 +1,5 @@
SRC_URI_append = " \
SRC_URI:append = " \
file://0001-ucm-imx8m-mini-Add-basic-support.patch \
file://0002-ucm-imx8m-mini-update-CPU-model-printed-parameters.patch \
file://0003-ucm-imx8m-mini-Fix-KConfig-warning.patch \
@@ -50,58 +51,81 @@ SRC_URI_append = " \
file://0049-mcm-imx8m-mini-dts-Enable-usbotg2-in-host-mode.patch \
file://0050-mcm-imx8m-mini-config-Remove-unused-stuff.patch \
file://0051-mcm-imx8m-mini-Remove-dram_init_banksize-and-get_eff.patch \
file://0052-imx8m-soc-Don-t-reduce-the-memory-amount-by-the-opte.patch \
file://0053-mcm-imx8m-mini-Move-tcm-to-plat-imx8mm.patch \
file://0054-mcm-imx8m-mini-Refactor-spl-code.patch \
file://0055-ucm-imx8m-mini-Refactor-the-code-for-2020.04.patch \
file://0056-cpl-imx8m-mini-Set-LOCALVERSION-intead-of-EXTRAVERSI.patch \
file://0057-cpl-imx8m-mini-Refactor-.h-configs.patch \
file://0058-cpl-imx8m-mini-Refactor-.dts.patch \
file://0059-iot-gate-imx8-Add-basic-support.patch \
file://0060-mcm-imx8m-mini-config-Update-env-size-offest.patch \
file://0061-imx8m-mini-env-config-Update-size-offset-value.patch \
file://0062-imx8-eeprom-Move-to-the-imx8-platform-independent-fo.patch \
file://0063-imx8-eeprom-Remove-duplicated-code.patch \
file://0064-imx8mm-plat-Add-the-common-board-file-for-imx8mm-SoC.patch \
file://0065-imx8m-mini-Refactor-the-usdhc2.patch \
file://0066-mcm-imx8m-mini-reset-Refactor-the-reset.patch \
file://0067-imx8m-mini-ddr-Change-the-memory-presets-order.patch \
file://0068-imx8m-mini-env-Fix-getopt_long-parameters-string.patch \
file://0069-ucm-imx8m-mini-Fix-reset.patch \
file://0070-imx8m-mini-spl-Add-__weak-board_fit_config_name_matc.patch \
file://0071-mcm-imx8m-mini-spl-Add-board_fit_config_name_match.patch \
file://0072-imx8m-mini-u-boot-Add-__weak-uboot_board_private_ini.patch \
file://0073-mcm-imx8m-mini-u-boot-Add-uboot_board_private_init.patch \
file://0074-Add-ddr_init-return-handling.patch \
file://0075-spl-Enable-Kingston-DRAM-support.patch \
file://0076-Add-show_suite-function.patch \
file://0077-Clean-debug-printout.patch \
file://0078-imx8m-ddr-Add-Nanya-2G-2400-MTS-support.patch \
file://0079-ucm-imx8m-mini-Enable-status-LED-and-cmd-led.patch \
file://0080-mcm-and-ucm-Enable-status-LED-for-both-platforms.patch \
file://0081-Enable-env-address-export-via-FDT.patch \
file://0082-fw_utils-Enable-actual-env-address-readout.patch \
file://0083-SPL-Disable-fake-memsize-report.patch \
file://0084-fdt-Add-export-SoM-data-via-FDT.patch \
file://0085-board-minor-cleaninig.patch \
file://0086-rtc-Disable-bus-when-powered-from-battery.patch \
file://0087-fdt-Add-export-of-base-board-data-via-FDT.patch \
file://0088-spl-ddr-Enable-DDR-ID-0x1060008.patch \
file://0089-drivers-video-Add-startek-ili9881c-panel-driver.patch \
file://0090-cpl-imx8m-mini-Enable-startek-ili9881c-panel-support.patch \
file://0091-cm-imx8m-mini-config-Enable-startek-ili9881c.patch \
file://0092-Migration-to-5.10.35.patch \
file://0093-Fix-enable_cache.patch \
file://0094-Fix-mmc_autodetect.patch \
file://0095-config-Enable-video.patch \
file://0096-readout-some-cleannig.patch \
file://0097-mmc-Fix-mmc_switch-workflow-issue.patch \
file://0098-defconfig-Break-down-to-common-and-specific-parts.patch \
file://0099-spl-lpddr-training-size-optimisation.patch \
file://0100-spl-Add-SDP-support.patch \
file://0101-spl-Enable-Samsung-4G-DRAM-0x01061010.patch \
file://0102-Enable-DDR-Alliance-1G-0x01050008.patch \
file://0103-make-Add-wrapper-for-compound-config.patch \
file://0104-net-Enable-phy-Realtek-RTL8211E.patch \
file://0105-LOCALVERSION-2.2.1-1.1.1.patch \
file://0052-mcm-imx8m-mini-Move-tcm-to-plat-imx8mm.patch \
file://0053-mcm-imx8m-mini-Refactor-spl-code.patch \
file://0054-ucm-imx8m-mini-Refactor-the-code-for-2020.04.patch \
file://0055-cpl-imx8m-mini-Set-LOCALVERSION-intead-of-EXTRAVERSI.patch \
file://0056-cpl-imx8m-mini-Refactor-.h-configs.patch \
file://0057-cpl-imx8m-mini-Refactor-.dts.patch \
file://0058-iot-gate-imx8-Add-basic-support.patch \
file://0059-mcm-imx8m-mini-config-Update-env-size-offest.patch \
file://0060-imx8m-mini-env-config-Update-size-offset-value.patch \
file://0061-imx8-eeprom-Move-to-the-imx8-platform-independent-fo.patch \
file://0062-imx8-eeprom-Remove-duplicated-code.patch \
file://0063-imx8mm-plat-Add-the-common-board-file-for-imx8mm-SoC.patch \
file://0064-imx8m-mini-Refactor-the-usdhc2.patch \
file://0065-mcm-imx8m-mini-reset-Refactor-the-reset.patch \
file://0066-imx8m-mini-ddr-Change-the-memory-presets-order.patch \
file://0067-imx8m-mini-env-Fix-getopt_long-parameters-string.patch \
file://0068-ucm-imx8m-mini-Fix-reset.patch \
file://0069-imx8m-mini-spl-Add-__weak-board_fit_config_name_matc.patch \
file://0070-mcm-imx8m-mini-spl-Add-board_fit_config_name_match.patch \
file://0071-imx8m-mini-u-boot-Add-__weak-uboot_board_private_ini.patch \
file://0072-mcm-imx8m-mini-u-boot-Add-uboot_board_private_init.patch \
file://0073-Add-ddr_init-return-handling.patch \
file://0074-spl-Enable-Kingston-DRAM-support.patch \
file://0075-Add-show_suite-function.patch \
file://0076-Clean-debug-printout.patch \
file://0077-imx8m-ddr-Add-Nanya-2G-2400-MTS-support.patch \
file://0078-ucm-imx8m-mini-Enable-status-LED-and-cmd-led.patch \
file://0079-mcm-and-ucm-Enable-status-LED-for-both-platforms.patch \
file://0080-Enable-env-address-export-via-FDT.patch \
file://0081-fw_utils-Enable-actual-env-address-readout.patch \
file://0082-SPL-Disable-fake-memsize-report.patch \
file://0083-fdt-Add-export-SoM-data-via-FDT.patch \
file://0084-board-minor-cleaninig.patch \
file://0085-rtc-Disable-bus-when-powered-from-battery.patch \
file://0086-fdt-Add-export-of-base-board-data-via-FDT.patch \
file://0087-spl-ddr-Enable-DDR-ID-0x1060008.patch \
file://0088-drivers-video-Add-startek-ili9881c-panel-driver.patch \
file://0089-cpl-imx8m-mini-Enable-startek-ili9881c-panel-support.patch \
file://0090-cm-imx8m-mini-config-Enable-startek-ili9881c.patch \
file://0091-Migration-to-5.10.35.patch \
file://0092-Fix-mmc_autodetect.patch \
file://0093-config-Enable-video.patch \
file://0094-mmc-Fix-mmc_switch-workflow-issue.patch \
file://0095-defconfig-Break-down-to-common-and-specific-parts.patch \
file://0096-spl-lpddr-training-size-optimisation.patch \
file://0097-spl-Add-SDP-support.patch \
file://0098-spl-Enable-Samsung-4G-DRAM-0x01061010.patch \
file://0099-Enable-DDR-Alliance-1G-0x01050008.patch \
file://0100-make-Add-wrapper-for-compound-config.patch \
file://0102-defconfig-Enable-EFI_LOADER.patch \
file://0103-core-Add-EPFNOSUPPORT-handeler.patch \
file://0104-cpl-imx8m-mini-dts-remove-unrelevant-sections.patch \
file://0105-iot-gate-imx8-remove-driver-reset-functions.patch \
file://0106-iot-gate-imx8-dts-set-MMC1-voltage-to-1.8V.patch \
file://0107-iot-gate-imx8-usb-VBUS-enable-fix.patch \
file://0108-imx8mm-enable-global-functions-implementation-in-sub.patch \
file://0109-iot-gate-imx8-RS485-232-selection.patch \
file://0110-iot-gate-imx8-add-extension-board-support.patch \
file://0111-iot-gate-imx8-update-boot-sequence.patch \
file://0112-iot-gate-imx8-prevent-network-interfaces-rename.patch \
file://0113-iot-gate-imx8-update-prompt.patch \
file://0114-imx8mm-enable-prompt-update-in-sub-projects.patch \
file://0115-iot-gate-imx8-hide-temperature-message.patch \
file://0116-iot-gate-imx8-fix-UART1-mode-GPIO.patch \
file://0117-iot-gate-imx8-add-support-for-the-IE-TPM-module.patch \
file://0118-iot-gate-imx8-add-support-for-the-IE-POE-extension-b.patch \
file://0119-iot-gate-imx8-update-support-for-the-IE-TPM-module.patch \
file://0120-iot-gate-imx8-add-support-for-the-IE-CL420-module.patch \
file://0121-iot-gate-imx8-add-support-for-the-POEv2-module.patch \
file://0122-iot-gate-imx8-enable-USB-to-Ethernet-driver-SMSC-LAN.patch \
file://0123-cmd-eeprom-fix-disregarding-of-the-i2c_bus-parameter.patch \
file://0124-Enable-SoC-info-export-via-fdt.patch \
file://0125-imx8mm-net-enable-phy-Realtek-RTL8211E.patch \
file://0126-iot-gate-imx8-release-2020.04-iot-gate-imx8-3.0.patch \
"
# For U-Boot build outside of Yocto
# file://0101-compulab-imx8mm-Add-binman-support.patch
@@ -1,34 +1,34 @@
From 22c3acad098a8c75bd8791eb1ae0e370c0b2984a Mon Sep 17 00:00:00 2001
From a79e947a2a87a687a2cd9fb6e43e3c5d8d29b262 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sun, 18 Jul 2021 23:23:16 +0300
Subject: [PATCH 01/91] ucm-imx8m-mini: Add basic support
Subject: [PATCH 001/126] ucm-imx8m-mini: Add basic support
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
arch/arm/dts/Makefile | 2 +
arch/arm/dts/ucm-imx8m-mini.dts | 452 ++++
arch/arm/mach-imx/imx8m/Kconfig | 8 +
board/compulab/common/Makefile | 1 +
board/compulab/common/eeprom.c | 4 +-
board/compulab/common/mmc.c | 50 +
board/compulab/common/pfuze.c | 174 ++
board/compulab/common/pfuze.h | 19 +
board/compulab/common/pfuze_dm.c | 89 +
board/compulab/common/tcpc.h | 454 ++++
board/compulab/ucm-imx8m-mini/Kconfig | 30 +
board/compulab/ucm-imx8m-mini/Makefile | 16 +
board/compulab/ucm-imx8m-mini/ddr/Makefile | 11 +
board/compulab/ucm-imx8m-mini/ddr/ddr.h | 59 +
board/compulab/ucm-imx8m-mini/ddr/ddr_init.c | 255 +++
.../ucm-imx8m-mini/ddr/ddrphy_train.c | 1044 +++++++++
board/compulab/ucm-imx8m-mini/ddr/helper.c | 103 +
.../ddr/wait_ddrphy_training_complete.c | 103 +
board/compulab/ucm-imx8m-mini/lpddr4_timing.c | 1980 +++++++++++++++++
board/compulab/ucm-imx8m-mini/spl.c | 258 +++
.../compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 734 ++++++
configs/ucm-imx8m-mini_defconfig | 56 +
include/configs/ucm-imx8m-mini.h | 361 +++
23 files changed, 6261 insertions(+), 2 deletions(-)
arch/arm/dts/Makefile | 2 +
arch/arm/dts/ucm-imx8m-mini.dts | 452 +++++
arch/arm/mach-imx/imx8m/Kconfig | 8 +
board/compulab/common/Makefile | 1 +
board/compulab/common/eeprom.c | 4 +-
board/compulab/common/mmc.c | 51 +
board/compulab/common/pfuze.c | 174 ++
board/compulab/common/pfuze.h | 19 +
board/compulab/common/pfuze_dm.c | 89 +
board/compulab/common/tcpc.h | 454 +++++
board/compulab/ucm-imx8m-mini/Kconfig | 30 +
board/compulab/ucm-imx8m-mini/Makefile | 16 +
board/compulab/ucm-imx8m-mini/ddr/Makefile | 11 +
board/compulab/ucm-imx8m-mini/ddr/ddr.h | 59 +
board/compulab/ucm-imx8m-mini/ddr/ddr_init.c | 255 +++
board/compulab/ucm-imx8m-mini/ddr/ddrphy_train.c | 1044 +++++++++++
board/compulab/ucm-imx8m-mini/ddr/helper.c | 103 +
.../ddr/wait_ddrphy_training_complete.c | 103 +
board/compulab/ucm-imx8m-mini/lpddr4_timing.c | 1980 ++++++++++++++++++++
board/compulab/ucm-imx8m-mini/spl.c | 258 +++
board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 734 ++++++++
configs/ucm-imx8m-mini_defconfig | 56 +
include/configs/ucm-imx8m-mini.h | 361 ++++
23 files changed, 6262 insertions(+), 2 deletions(-)
create mode 100644 arch/arm/dts/ucm-imx8m-mini.dts
create mode 100644 board/compulab/common/mmc.c
create mode 100644 board/compulab/common/pfuze.c
@@ -50,10 +50,10 @@ Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
create mode 100644 include/configs/ucm-imx8m-mini.h
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index aa0c6a75c3..2b81a2bc62 100644
index 24a387fb60..c31d483784 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -890,6 +890,8 @@ dtb-$(CONFIG_RCAR_GEN2) += \
@@ -898,6 +898,8 @@ dtb-$(CONFIG_RCAR_GEN2) += \
r8a7794-alt-u-boot.dtb \
r8a7794-silk-u-boot.dtb
@@ -521,10 +521,10 @@ index 0000000000..112345b6a3
+ status = "disabled";
+};
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index 9e5b6d7ffa..d4c41ba1aa 100644
index 245b085499..4930b9bee6 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -201,6 +201,13 @@ config TARGET_PHYCORE_IMX8MP
@@ -259,6 +259,13 @@ config TARGET_PHYCORE_IMX8MP
select IMX8MP
select SUPPORT_SPL
select IMX8M_LPDDR4
@@ -538,7 +538,7 @@ index 9e5b6d7ffa..d4c41ba1aa 100644
endchoice
source "board/freescale/imx8mq_evk/Kconfig"
@@ -217,5 +224,6 @@ source "board/beacon/imx8mm/Kconfig"
@@ -276,5 +283,6 @@ source "board/beacon/imx8mm/Kconfig"
source "board/beacon/imx8mn/Kconfig"
source "board/phytec/phycore_imx8mm/Kconfig"
source "board/phytec/phycore_imx8mp/Kconfig"
@@ -582,10 +582,10 @@ index 5206cf5c0a..e23dd68437 100644
uint offset;
diff --git a/board/compulab/common/mmc.c b/board/compulab/common/mmc.c
new file mode 100644
index 0000000000..9fc3e68728
index 0000000000..52b15ab5f3
--- /dev/null
+++ b/board/compulab/common/mmc.c
@@ -0,0 +1,50 @@
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ * Copyright 2018 NXP
@@ -598,6 +598,7 @@ index 0000000000..9fc3e68728
+#include <asm/io.h>
+#include <stdbool.h>
+#include <mmc.h>
+#include <command.h>
+
+static int check_mmc_autodetect(void)
+{
@@ -6485,5 +6486,5 @@ index 0000000000..1605ab7281
+#endif
+#endif
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From fd167e54036b16013eecd9504fa392734f725fb0 Mon Sep 17 00:00:00 2001
From aa605296da62f4b44932c7d8eedbc95518352cec Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Tue, 26 May 2020 20:55:00 +0300
Subject: [PATCH 02/91] ucm-imx8m-mini: update CPU/model printed parameters
Subject: [PATCH 002/126] ucm-imx8m-mini: update CPU/model printed parameters
Update the startup messages of the CPU and model parameters
@@ -24,5 +24,5 @@ index 112345b6a3..899899c1c6 100644
chosen {
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 5dabb2f3f0d1814c111ff4c6edd2a88360b88948 Mon Sep 17 00:00:00 2001
From 665396af251f6eec00d0ece435f120a75ea3e621 Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Wed, 13 Feb 2019 08:56:03 +0200
Subject: [PATCH 03/91] ucm-imx8m-mini: Fix KConfig warning
Subject: [PATCH 003/126] ucm-imx8m-mini: Fix KConfig warning
The following compilation warning is generated:
choice value used outside its choice group
@@ -84,5 +84,5 @@ index 6d9cccdbcb..34f7683d2d 100644
ddr_init();
#endif
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 4c4365f284eee7ed73c65dd3f1cb9fbfa65ef095 Mon Sep 17 00:00:00 2001
From c826389773619e592df6ccc852cb636b61d935d0 Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Wed, 13 Feb 2019 15:04:59 +0200
Subject: [PATCH 04/91] ucm-imx8m-mini: enable status LED
Subject: [PATCH 004/126] ucm-imx8m-mini: enable status LED
Use the status LED feature to turn on the status LED.
@@ -35,5 +35,5 @@ index 2212e76acb..36cfe1b2e1 100644
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 20aa60bc1225baa35bcc2660351d2a1359fd49ad Mon Sep 17 00:00:00 2001
From fcdfa92492c4104cfd01ed1fe9ac77b8fd204b1d Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Mon, 18 Sep 2017 19:49:32 +0300
Subject: [PATCH 05/91] eeprom: layout: remove buf from the eeprom_field
Subject: [PATCH 005/126] eeprom: layout: remove buf from the eeprom_field
structure
The layout structure contains a pointer to a buffer that contain the
@@ -17,10 +17,10 @@ pointer parameter to the field functions.
Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
---
board/compulab/common/eeprom.c | 150 +++++++++++++++++----------------
common/eeprom/eeprom_field.c | 73 ++++++++++------
common/eeprom/eeprom_layout.c | 21 ++---
include/eeprom_field.h | 31 ++++---
board/compulab/common/eeprom.c | 150 +++++++++++++++++++++--------------------
common/eeprom/eeprom_field.c | 73 ++++++++++++--------
common/eeprom/eeprom_layout.c | 21 +++---
include/eeprom_field.h | 31 +++++----
4 files changed, 149 insertions(+), 126 deletions(-)
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
@@ -603,5 +603,5 @@ index 05c0d14592..a13ca566af 100644
#endif
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From ebfbf0ddfda20d3191ee5b0a1d7341cd68465b72 Mon Sep 17 00:00:00 2001
From cbdfb5f0fea713cc69de29e75a05b36ce50b6931 Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Tue, 19 Sep 2017 10:07:26 +0300
Subject: [PATCH 06/91] eeprom: layout: add field functions read
Subject: [PATCH 006/126] eeprom: layout: add field functions read
Read option is missing in the EEPROM layout feature
@@ -11,9 +11,9 @@ provided buffer without manipulation.
Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
---
board/compulab/common/eeprom.c | 91 +++++++++++++++++-----------------
common/eeprom/eeprom_field.c | 22 ++++++++
common/eeprom/eeprom_layout.c | 37 ++++++++++++++
board/compulab/common/eeprom.c | 91 +++++++++++++++++++++---------------------
common/eeprom/eeprom_field.c | 22 ++++++++++
common/eeprom/eeprom_layout.c | 37 +++++++++++++++++
include/eeprom_field.h | 4 ++
include/eeprom_layout.h | 2 +
5 files changed, 111 insertions(+), 45 deletions(-)
@@ -146,11 +146,10 @@ diff --git a/common/eeprom/eeprom_field.c b/common/eeprom/eeprom_field.c
index 38827f1180..e588b0943f 100644
--- a/common/eeprom/eeprom_field.c
+++ b/common/eeprom/eeprom_field.c
@@ -129,6 +129,28 @@ int eeprom_field_update_bin(struct eeprom_field *field, uchar *fbuf,
return __eeprom_field_update_bin(field, fbuf, value, false);
@@ -130,6 +130,28 @@ int eeprom_field_update_bin(struct eeprom_field *field, uchar *fbuf,
}
+/**
/**
+ * eeprom_field_read_bin() - Read field data in binary form
+ *
+ * @field: an initialized field
@@ -172,18 +171,18 @@ index 38827f1180..e588b0943f 100644
+ return 0;
+}
+
/**
+/**
* eeprom_field_update_reserved() - Update reserved field with new data in
* binary form
*
diff --git a/common/eeprom/eeprom_layout.c b/common/eeprom/eeprom_layout.c
index 1fab8e4dca..cc6dd39e01 100644
--- a/common/eeprom/eeprom_layout.c
+++ b/common/eeprom/eeprom_layout.c
@@ -95,6 +95,42 @@ static int eeprom_layout_update_field(struct eeprom_layout *layout,
return -1;
@@ -96,6 +96,42 @@ static int eeprom_layout_update_field(struct eeprom_layout *layout,
}
+/*
/*
+ * eeprom_layout_read_field() - read a single field from the layout data
+ * @layout: A pointer to an existing struct layout.
+ * @field_name: The name of the field to update.
@@ -219,9 +218,10 @@ index 1fab8e4dca..cc6dd39e01 100644
+ return -1;
+}
+
/*
+/*
* eeprom_layout_setup() - setup layout struct with the layout data and
* metadata as dictated by layout_version
* @layout: A pointer to an existing struct layout.
@@ -116,4 +152,5 @@ void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf,
layout->data_size = buf_size;
layout->print = eeprom_layout_print;
@@ -262,5 +262,5 @@ index 730d963ab9..50e8ec1085 100644
void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf,
--
2.17.1
2.11.0
@@ -1,16 +1,16 @@
From c4e09d71adf13ae781ed295c0667b5ce0a3a2b60 Mon Sep 17 00:00:00 2001
From 42ee0d104b1ecc275269d401cfaad103863cc1e9 Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Tue, 19 Sep 2017 10:47:25 +0300
Subject: [PATCH 07/91] compulab: eeprom: layout: add read serial function
Subject: [PATCH 007/126] compulab: eeprom: layout: add read serial function
The function conver the CompuLab serial number format to tag_serialnr
structure.
Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
---
board/compulab/common/eeprom.c | 67 ++++++++++++++++++++++++++--------
common/eeprom/eeprom_field.c | 21 +++++++++++
include/eeprom_field.h | 2 +
board/compulab/common/eeprom.c | 67 ++++++++++++++++++++++++++++++++----------
common/eeprom/eeprom_field.c | 21 +++++++++++++
include/eeprom_field.h | 2 ++
3 files changed, 75 insertions(+), 15 deletions(-)
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
@@ -191,11 +191,10 @@ diff --git a/common/eeprom/eeprom_field.c b/common/eeprom/eeprom_field.c
index e588b0943f..814dc4eb7a 100644
--- a/common/eeprom/eeprom_field.c
+++ b/common/eeprom/eeprom_field.c
@@ -203,6 +203,27 @@ int eeprom_field_update_bin_rev(struct eeprom_field *field, uchar *fbuf,
return __eeprom_field_update_bin(field, fbuf, value, true);
@@ -204,6 +204,27 @@ int eeprom_field_update_bin_rev(struct eeprom_field *field, uchar *fbuf,
}
+/**
/**
+ * eeprom_field_read_rev() - Read reversed binary data
+ *
+ * @field: an initialized field
@@ -216,9 +215,10 @@ index e588b0943f..814dc4eb7a 100644
+ return 0;
+}
+
/**
+/**
* eeprom_field_print_mac_addr() - print a field which contains a mac address
*
* Treat the field data as simple binary data, and print it formatted as a MAC
diff --git a/include/eeprom_field.h b/include/eeprom_field.h
index 6b6cd37229..311c49401a 100644
--- a/include/eeprom_field.h
@@ -233,5 +233,5 @@ index 6b6cd37229..311c49401a 100644
void eeprom_field_print_mac(const struct eeprom_field *field, uchar *fbuf);
int eeprom_field_update_mac(struct eeprom_field *field, uchar *fbuf,
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 6ae3d093dda3585c0f82f8f044ae7fe542ad8e49 Mon Sep 17 00:00:00 2001
From e7068f16b334d6c518401e30013074a0f88b1ab9 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Tue, 26 May 2020 21:17:29 +0300
Subject: [PATCH 08/91] compulab: integrate DM_I2C in EEPROM driver
Subject: [PATCH 008/126] compulab: integrate DM_I2C in EEPROM driver
CompuLab's EEPROM driver is enabled only for CONFIG_SYS_I2C.
Update the enabling condition of the driver to CONFIG_SYS_I2C or
@@ -41,5 +41,5 @@ index a9c0203b81..2628d4ab86 100644
u32 cl_eeprom_get_board_rev(uint eeprom_bus);
int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From a97a2cf1a2667ab13ecce0bc7c362c7b49008bf7 Mon Sep 17 00:00:00 2001
From 41e820e4b705ab5400c78eb0e3ec4f1fc1a9bbc2 Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Tue, 19 Feb 2019 18:48:29 +0200
Subject: [PATCH 09/91] ucm-imx8m-mini: add support for eeprom layout comands
Subject: [PATCH 009/126] ucm-imx8m-mini: add support for eeprom layout comands
Add support for EEPROM and EEPROM layout commands for the
UCM-iMX8M-Mini.
@@ -54,5 +54,5 @@ index 1605ab7281..f464ed822b 100644
#ifndef CONFIG_SPL_BUILD
#define CONFIG_CMD_USB
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 22c1aa3dd9a65033682e1bec93dad9f20a8d9ed5 Mon Sep 17 00:00:00 2001
From 9da7a67ead6515dbead3bb5ebba3337711508982 Mon Sep 17 00:00:00 2001
From: Uri Mashiach <uri.mashiach@compulab.co.il>
Date: Tue, 19 Feb 2019 21:46:54 +0200
Subject: [PATCH 10/91] mx8m-mini: set Ethernet MAC address environment
Subject: [PATCH 010/126] mx8m-mini: set Ethernet MAC address environment
If the environment variable "ethaddr" is empty:
* Read the MAC address from the EEPROM.
@@ -9,7 +9,7 @@ If the environment variable "ethaddr" is empty:
Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
---
.../compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 37 +++++++++++++++++++
board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 37 ++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c b/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c
@@ -86,5 +86,5 @@ index ef5d1ffa55..80d9a5b8bd 100644
}
--
2.17.1
2.11.0
@@ -1,11 +1,11 @@
From faf90f560f89ba9ebc0f418f15e9d170deba617d Mon Sep 17 00:00:00 2001
From 9247cadb067e9dc9b05851dedde17942d1bf7b34 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 20 Feb 2019 08:21:05 +0200
Subject: [PATCH 11/91] ucm-imx8m-mini: config: Remove unused stuff
Subject: [PATCH 011/126] ucm-imx8m-mini: config: Remove unused stuff
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
include/configs/ucm-imx8m-mini.h | 53 --------------------------------
include/configs/ucm-imx8m-mini.h | 53 ----------------------------------------
1 file changed, 53 deletions(-)
diff --git a/include/configs/ucm-imx8m-mini.h b/include/configs/ucm-imx8m-mini.h
@@ -81,5 +81,5 @@ index f464ed822b..214dad40ed 100644
#define CONFIG_MXC_OCOTP
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 039d1bfdc99917232adcc642e082af7a576b28f2 Mon Sep 17 00:00:00 2001
From 266c4024565e18cf4b3aa0bc41fe37a01f8d8c08 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Thu, 7 Mar 2019 14:17:42 +0200
Subject: [PATCH 12/91] ucm-imx8m-mini: Enable uart4 for bluetooth
Subject: [PATCH 012/126] ucm-imx8m-mini: Enable uart4 for bluetooth
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -62,5 +62,5 @@ index 899899c1c6..003cc857df 100644
pinctrl-names = "default", "state_100mhz", "state_200mhz";
pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
--
2.17.1
2.11.0
@@ -1,12 +1,12 @@
From 191feb9ba6cd656f2f8c8c56749e204ca5aab4f6 Mon Sep 17 00:00:00 2001
From 6bcfe6007bc66837010335c9048fc593677f68a2 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Tue, 26 Mar 2019 10:36:45 +0200
Subject: [PATCH 13/91] ucm-imx8m-mini: ddr: Validate new setting
Subject: [PATCH 013/126] ucm-imx8m-mini: ddr: Validate new setting
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/ucm-imx8m-mini/ddr/ddr_init.c | 23 +++--
.../ucm-imx8m-mini/ddr/ddrphy_train.c | 96 +++++++++----------
board/compulab/ucm-imx8m-mini/ddr/ddr_init.c | 23 +++---
board/compulab/ucm-imx8m-mini/ddr/ddrphy_train.c | 96 ++++++++++++------------
2 files changed, 62 insertions(+), 57 deletions(-)
diff --git a/board/compulab/ucm-imx8m-mini/ddr/ddr_init.c b/board/compulab/ucm-imx8m-mini/ddr/ddr_init.c
@@ -324,5 +324,5 @@ index 8116069dfb..e4577e0a21 100644
+}
\ No newline at end of file
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 25d672480dabfc27a2bc746dd75e6a30d8e117cc Mon Sep 17 00:00:00 2001
From 76a3fdd109d7326b5ba48fb92752a6a188e2fda4 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 27 Mar 2019 13:28:51 +0200
Subject: [PATCH 14/91] ucm-imx8m-mini: defconfig: Disable CONFIG_NXP_TMU
Subject: [PATCH 014/126] ucm-imx8m-mini: defconfig: Disable CONFIG_NXP_TMU
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -21,5 +21,5 @@ index b4a9975b33..75531acb20 100644
CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From bcba8667218c69dc9ed5a8894094dc0ab38966c4 Mon Sep 17 00:00:00 2001
From 45fae1b2de5c218f33a822aedd8b58dfa74cc0f4 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Mon, 22 Apr 2019 12:06:29 +0300
Subject: [PATCH 15/91] ucm-imx8m-mini: config : Update h-file
Subject: [PATCH 015/126] ucm-imx8m-mini: config : Update h-file
1) Add a missing include
2) Remove duplications
@@ -46,5 +46,5 @@ index 214dad40ed..046dc243bc 100644
#define CONFIG_CMD_USB_MASS_STORAGE
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From e3456703938fdcc1f25c8a845fa1f392c02b27e9 Mon Sep 17 00:00:00 2001
From 37c1b745004b455d8ad69c5e2da65fa77e39868f Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Sun, 21 Apr 2019 22:17:20 +0300
Subject: [PATCH 16/91] ucm-imx8m-mini: spl: Refacoring ddr_init() call
Subject: [PATCH 016/126] ucm-imx8m-mini: spl: Refacoring ddr_init() call
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -43,5 +43,5 @@ index 34f7683d2d..833183597a 100644
#define I2C_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE)
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From a07c6130c9cba79e78f333e17529bee57cad61bb Mon Sep 17 00:00:00 2001
From e0b70a34cfa94ec5399b71f680e4b4dd63b1b379 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Sun, 21 Apr 2019 22:19:27 +0300
Subject: [PATCH 17/91] ucm-imx8m-mini: Kconfig: Refacoring ddr init config
Subject: [PATCH 017/126] ucm-imx8m-mini: Kconfig: Refacoring ddr init config
option
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
@@ -32,5 +32,5 @@ index 1da11b2046..e6b334134f 100644
imx8mm_val board configuration approach
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From b11be4155cda9dac8afd1fecfab3dc00370f4e3a Mon Sep 17 00:00:00 2001
From 0001734a9f497a9287fbd1ca9f92d5b30e3cf9e4 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Tue, 26 May 2020 21:33:48 +0300
Subject: [PATCH 18/91] ucm-imx8m-mini: Makefile: Refacoring ddr init build
Subject: [PATCH 018/126] ucm-imx8m-mini: Makefile: Refacoring ddr init build
option
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
@@ -26,5 +26,5 @@ index b092c281ab..02d3393232 100644
+obj-$(CONFIG_UCM_IMX8M_LPDDR4_VAL) += ddr/
endif
--
2.17.1
2.11.0
@@ -1,12 +1,12 @@
From e811ab1437eb7dae3a27027612be3a70a1495481 Mon Sep 17 00:00:00 2001
From 2ccda2a6956bfaa460fd871a5ba95ccb17ac5b6a Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 24 Apr 2019 13:55:44 +0300
Subject: [PATCH 19/91] ucm-imx8m-mini: lpddr4_timing: Add ucm-imx8m-mini
Subject: [PATCH 019/126] ucm-imx8m-mini: lpddr4_timing: Add ucm-imx8m-mini
support
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/ucm-imx8m-mini/lpddr4_timing.c | 39 +++++++++++--------
board/compulab/ucm-imx8m-mini/lpddr4_timing.c | 39 +++++++++++++++------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/board/compulab/ucm-imx8m-mini/lpddr4_timing.c b/board/compulab/ucm-imx8m-mini/lpddr4_timing.c
@@ -102,5 +102,5 @@ index 9c80caea8b..dfd68ea9d8 100644
.ddrc_cfg_num = ARRAY_SIZE(lpddr4_ddrc_cfg),
.ddrphy_cfg = lpddr4_ddrphy_cfg,
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 61856dfbba647d1dc7ace4d0e20b6c2dd70356c5 Mon Sep 17 00:00:00 2001
From 58e467d2a44188a047116e1945a45c4fdecc0c5a Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 1 May 2019 13:48:53 +0300
Subject: [PATCH 20/91] ucm-imx8m-mini: config: Enable the new LPDDR4 config
Subject: [PATCH 020/126] ucm-imx8m-mini: config: Enable the new LPDDR4 config
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -21,5 +21,5 @@ index 75531acb20..d45e7894e8 100644
CONFIG_DEFAULT_DEVICE_TREE="ucm-imx8m-mini"
CONFIG_FIT=y
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 4a41b9cfee034c1cf37639a02226bc4168a20bc6 Mon Sep 17 00:00:00 2001
From e58e45b88859f214573df2d15eb727e4369ea6bc Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Tue, 30 Apr 2019 11:32:58 +0300
Subject: [PATCH 21/91] ucm-imx8m-mini: Move FS support to defconfig
Subject: [PATCH 021/126] ucm-imx8m-mini: Move FS support to defconfig
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -49,5 +49,5 @@ index 046dc243bc..8b55fd61e9 100644
#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From c5c284852f47909de25675a70a98f41057aec3bb Mon Sep 17 00:00:00 2001
From 5309c7bfb05e76e83d0091ba0a192961bda6f992 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 1 May 2019 21:48:56 +0300
Subject: [PATCH 22/91] ucm-imx8m-mini: config: CONFIG_IMX_OPTEE=y
Subject: [PATCH 022/126] ucm-imx8m-mini: config: CONFIG_IMX_OPTEE=y
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -21,5 +21,5 @@ index 3bce614aab..d457d263c4 100644
CONFIG_FIT=y
CONFIG_SPL_LOAD_FIT=y
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 9c604bbf23b9951a1e312f7ebaf8891d740047c6 Mon Sep 17 00:00:00 2001
From a807f865492b22a83840252dde454899265dfbe2 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Fri, 3 May 2019 23:00:08 +0300
Subject: [PATCH 23/91] set extended temperature range
Subject: [PATCH 023/126] set extended temperature range
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
@@ -24,5 +24,5 @@ index 003cc857df..2e68d13e87 100644
+ temperature = <115000>;
+};
--
2.17.1
2.11.0
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
From d4ff862d15542ac90847b63ac784dd2bc19c5e09 Mon Sep 17 00:00:00 2001
From f6f8bfbfaa80842b1ecd7d1b3ce44b6404034468 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sat, 31 Aug 2019 20:18:05 +0300
Subject: [PATCH 25/91] dts: Enable USB OTG support
Subject: [PATCH 025/126] dts: Enable USB OTG support
Enable USB OTG support, necessary for USB load and UMS.
@@ -25,5 +25,5 @@ index 6e59d1101c..c93cf1ac7a 100644
&usbotg2 {
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 17c8e369aaf449e624c40eda88e184856c5e3875 Mon Sep 17 00:00:00 2001
From 56cc0e465092c676b1f5d1401454bad06e316277 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sat, 31 Aug 2019 20:20:34 +0300
Subject: [PATCH 26/91] env: Change boot sequence
Subject: [PATCH 026/126] env: Change boot sequence
Boot commands have been refactored to make them uniform and simplify a boot
sequence edition.
@@ -12,7 +12,7 @@ if not, a pair of files Image + default DTB.
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
include/configs/ucm-imx8m-mini.h | 55 ++++++++++++++++----------------
include/configs/ucm-imx8m-mini.h | 55 ++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/include/configs/ucm-imx8m-mini.h b/include/configs/ucm-imx8m-mini.h
@@ -99,5 +99,5 @@ index 7bbd0e73f9..e9e3b2cb1c 100644
/* Link Definitions */
#define CONFIG_LOADADDR 0x40480000
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From bdcd65e611083d56423826a4e4e0e99722cbffee Mon Sep 17 00:00:00 2001
From b366281614785327ce65a2d0b000c2d187198b66 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Tue, 10 Sep 2019 20:49:44 +0300
Subject: [PATCH 27/91] Enable usb ethernet dongle asix-88179
Subject: [PATCH 027/126] Enable usb ethernet dongle asix-88179
Enable the dongle. In order to use it issue:
usb start
@@ -26,5 +26,5 @@ index 8dbf544e86..3d750f7fe1 100644
CONFIG_PINCTRL_IMX8M=y
CONFIG_DM_REGULATOR=y
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 4b0fb07d9a1a69d4e47426aef870880128ba0ad4 Mon Sep 17 00:00:00 2001
From 59f78def6097a2a24793ae3f92aae9bdc88af39b Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Wed, 1 Apr 2020 14:52:21 +0300
Subject: [PATCH 28/91] ucm-ims8m-mini: dts: wp enable
Subject: [PATCH 028/126] ucm-ims8m-mini: dts: wp enable
Write protection enables for uSD card (the device usdhc2).
@@ -31,5 +31,5 @@ index c93cf1ac7a..3d8be3a09a 100644
vmmc-supply = <&reg_usdhc2_vmmc>;
status = "okay";
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 57d7bed9f9a28495b776238d200040708b8b6f21 Mon Sep 17 00:00:00 2001
From 84e74f109aab8f75430d60e67acbc10a3f95988b Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sun, 5 Apr 2020 17:19:21 +0300
Subject: [PATCH 29/91] SPL: Enable bus I2C2
Subject: [PATCH 029/126] SPL: Enable bus I2C2
Enable the bus i2c1 (I2C2 in a schematic drawing) on SPL stage.
@@ -66,5 +66,5 @@ index e9e3b2cb1c..2400afe7ab 100644
#define CONFIG_CMD_READ
#define CONFIG_SERIAL_TAG
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From f64251dfd83b627c24e1de2d74ecfcf2a4db206c Mon Sep 17 00:00:00 2001
From 584687f751c256836235d5b4321dbf2f427af6b3 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sun, 5 Apr 2020 17:36:34 +0300
Subject: [PATCH 30/91] SPL: Adjust voltage for correct DDR initialisation
Subject: [PATCH 030/126] SPL: Adjust voltage for correct DDR initialisation
The voltage values, that PMIC BD71847 produces, differ from required and need to
be adjusted before a memory training procedure.
@@ -15,10 +15,10 @@ Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/board/compulab/ucm-imx8m-mini/spl.c b/board/compulab/ucm-imx8m-mini/spl.c
index aed967cce0..febd27c93e 100644
index 61ac039ff3..2231cc1f6f 100644
--- a/board/compulab/ucm-imx8m-mini/spl.c
+++ b/board/compulab/ucm-imx8m-mini/spl.c
@@ -174,8 +174,14 @@ int power_init_board(void)
@@ -175,8 +175,14 @@ int power_init_board(void)
/* unlock the PMIC regs */
pmic_reg_write(p, BD71837_REGLOCK, 0x1);
@@ -36,5 +36,5 @@ index aed967cce0..febd27c93e 100644
/* lock the PMIC regs */
pmic_reg_write(p, BD71837_REGLOCK, 0x11);
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From a31a3902562fcc8b38183bd6ccd25cd9d333e0fb Mon Sep 17 00:00:00 2001
From bf2f4b36ada27bf72a642f2e55ac39d5cfd9edaa Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Fri, 17 Apr 2020 20:38:46 +0300
Subject: [PATCH 31/91] Enable env import/export commands
Subject: [PATCH 031/126] Enable env import/export commands
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
@@ -22,5 +22,5 @@ index 2400afe7ab..dfd7d9980f 100644
#undef CONFIG_CMD_CRC32
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From d5e945141af4b6656d741caa0c3a7840b3c7204f Mon Sep 17 00:00:00 2001
From 486ddc5f04efb9755d8b8ea07b9067ff35b21ed3 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sat, 18 Apr 2020 19:17:47 +0300
Subject: [PATCH 32/91] env: Add env_mmcdev variable handling
Subject: [PATCH 032/126] env: Add env_mmcdev variable handling
Handle the variable env_mmcdev the following way:
If the variable is set to an unsigned value, an actual environment is to be
@@ -34,5 +34,5 @@ index 97331e55d9..fca256439b 100644
int mmc_map_to_kernel_blk(int devno)
--
2.17.1
2.11.0
@@ -1,40 +1,31 @@
From 1787abeea8fbcb9e284f5b2d4a4ba06bef8c2251 Mon Sep 17 00:00:00 2001
From e2f68b309bbba5efba12713b4732bbdcc23d809c Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 00:22:59 +0300
Subject: [PATCH 33/91] Trivial cleaning
Subject: [PATCH 033/126] Trivial cleaning
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
arch/arm/dts/Makefile | 4 ++--
arch/arm/dts/Makefile | 2 ++
board/compulab/common/Makefile | 4 +++-
board/compulab/common/common.c | 3 ++-
board/compulab/common/common.h | 3 ++-
board/compulab/common/eeprom.h | 3 ++-
board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 2 +-
6 files changed, 12 insertions(+), 7 deletions(-)
6 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 2b81a2bc62..6238d142af 100644
index c31d483784..9781d3451c 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -880,6 +880,8 @@ dtb-$(CONFIG_ARCH_IMX8M) += \
dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
@@ -888,6 +888,8 @@ dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
imxrt1020-evk.dtb
dtb-$(CONFIG_ARCH_IMX8ULP) += imx8ulp-evk.dtb imx8ulp-evk-i3c.dtb
+dtb-$(CONFIG_TARGET_UCM_IMX8M_MINI) += ucm-imx8m-mini.dtb
+
dtb-$(CONFIG_RCAR_GEN2) += \
r8a7790-lager-u-boot.dtb \
r8a7790-stout-u-boot.dtb \
@@ -890,8 +892,6 @@ dtb-$(CONFIG_RCAR_GEN2) += \
r8a7794-alt-u-boot.dtb \
r8a7794-silk-u-boot.dtb
-dtb-$(CONFIG_TARGET_UCM_IMX8M_MINI) += ucm-imx8m-mini.dtb
-
dtb-$(CONFIG_RCAR_GEN3) += \
r8a774a1-beacon-rzg2m-kit.dtb \
r8a774b1-beacon-rzg2n-kit.dtb \
diff --git a/board/compulab/common/Makefile b/board/compulab/common/Makefile
index 500858035f..0a26fdb426 100644
--- a/board/compulab/common/Makefile
@@ -111,5 +102,5 @@ index fca256439b..cf3cefb30d 100644
switch (value) {
case 4096:
--
2.17.1
2.11.0
@@ -1,45 +1,17 @@
From 7d4680efc8133c631955c64518c6966505317644 Mon Sep 17 00:00:00 2001
From 42104f3ba72deafdec230b2f0d82ba3741ab25fa Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 00:26:38 +0300
Subject: [PATCH 34/91] Migration to rel_imx_5.4.3
Date: Wed, 8 Dec 2021 14:56:15 +0200
Subject: [PATCH 034/126] Migration to rel_imx_5.4.3
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
arch/arm/lib/bootm.c | 2 +-
arch/arm/lib/cache-cp15.c | 2 +-
arch/arm/mach-imx/misc.c | 2 --
board/compulab/ucm-imx8m-mini/spl.c | 13 +++++++------
board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 11 ++++++-----
board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 10 ++++++----
configs/ucm-imx8m-mini_defconfig | 7 ++++++-
include/configs/ucm-imx8m-mini.h | 5 +++--
7 files changed, 24 insertions(+), 18 deletions(-)
5 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index e1bd628507..e4021e1025 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -154,7 +154,7 @@ static void setup_memory_tags(struct bd_info *bd)
int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
- if(!bd->bi_dram[i].size)
+ if (!gd->bd->bi_dram[i].size)
continue;
params->hdr.tag = ATAG_MEM;
params->hdr.size = tag_size (tag_mem32);
diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
index 3212ea47f3..f6a9108fb9 100644
--- a/arch/arm/lib/cache-cp15.c
+++ b/arch/arm/lib/cache-cp15.c
@@ -117,7 +117,7 @@ __weak void dram_bank_mmu_setup(int bank)
i < (bd->bi_dram[bank].start >> MMU_SECTION_SHIFT) +
(bd->bi_dram[bank].size >> MMU_SECTION_SHIFT);
i++) {
- if(!bd->bi_dram[bank].size)
+ if(!bd->bi_dram[bank].size)
continue;
set_section_dcache(i, DCACHE_DEFAULT_OPTION);
}
diff --git a/arch/arm/mach-imx/misc.c b/arch/arm/mach-imx/misc.c
index 5f001926aa..9f53cc2168 100644
--- a/arch/arm/mach-imx/misc.c
@@ -54,19 +26,19 @@ index 5f001926aa..9f53cc2168 100644
gd->bd->bi_dram[bank].size;
if (sp >= bank_end)
diff --git a/board/compulab/ucm-imx8m-mini/spl.c b/board/compulab/ucm-imx8m-mini/spl.c
index febd27c93e..316e8100fc 100644
index 2231cc1f6f..fa1943477e 100644
--- a/board/compulab/ucm-imx8m-mini/spl.c
+++ b/board/compulab/ucm-imx8m-mini/spl.c
@@ -19,7 +19,7 @@
#include <asm/mach-imx/mxc_i2c.h>
@@ -20,7 +20,7 @@
#include <fsl_esdhc.h>
#include <mmc.h>
-#include <asm/arch/imx8m_ddr.h>
+#include <asm/arch/ddr.h>
#include "ddr/ddr.h"
#include "ucm-imx8m-mini.h"
@@ -99,6 +99,7 @@ int board_mmc_init(bd_t *bis)
@@ -100,6 +100,7 @@ int board_mmc_init(bd_t *bis)
for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
switch (i) {
case 0:
@@ -74,7 +46,7 @@ index febd27c93e..316e8100fc 100644
usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
imx_iomux_v3_setup_multiple_pads(
usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
@@ -108,6 +109,7 @@ int board_mmc_init(bd_t *bis)
@@ -109,6 +110,7 @@ int board_mmc_init(bd_t *bis)
gpio_direction_output(USDHC2_PWR_GPIO, 1);
break;
case 1:
@@ -82,7 +54,7 @@ index febd27c93e..316e8100fc 100644
usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
imx_iomux_v3_setup_multiple_pads(
usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
@@ -217,10 +219,12 @@ int board_fit_config_name_match(const char *name)
@@ -218,10 +220,12 @@ int board_fit_config_name_match(const char *name)
void board_init_f(ulong dummy)
{
int ret;
@@ -97,7 +69,7 @@ index febd27c93e..316e8100fc 100644
arch_cpu_init();
board_early_init_f();
@@ -229,9 +233,6 @@ void board_init_f(ulong dummy)
@@ -230,9 +234,6 @@ void board_init_f(ulong dummy)
preloader_console_init();
@@ -108,7 +80,7 @@ index febd27c93e..316e8100fc 100644
if (ret) {
debug("spl_init() failed: %d\n", ret);
diff --git a/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c b/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c
index cf3cefb30d..fa06db9ec6 100644
index cf3cefb30d..f262acf414 100644
--- a/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c
+++ b/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c
@@ -139,6 +139,8 @@ int board_early_init_f(void)
@@ -120,11 +92,10 @@ index cf3cefb30d..fa06db9ec6 100644
return 0;
}
@@ -149,11 +151,10 @@ int board_postclk_init(void)
return 0;
@@ -150,10 +152,10 @@ int board_postclk_init(void)
}
#endif
-
-static phys_size_t imx8_ddr_size(void)
+int board_phys_sdram_size(phys_size_t *size)
{
@@ -134,7 +105,7 @@ index cf3cefb30d..fa06db9ec6 100644
switch (value) {
case 4096:
@@ -165,12 +166,12 @@ static phys_size_t imx8_ddr_size(void)
@@ -165,12 +167,12 @@ static phys_size_t imx8_ddr_size(void)
case 768:
case 512:
case 256:
@@ -150,7 +121,7 @@ index cf3cefb30d..fa06db9ec6 100644
/* Get the top of usable RAM */
ulong board_get_usable_ram_top(ulong total_size)
diff --git a/configs/ucm-imx8m-mini_defconfig b/configs/ucm-imx8m-mini_defconfig
index 2955b2f907..c57d88fa59 100644
index 2955b2f907..a90b813a3d 100644
--- a/configs/ucm-imx8m-mini_defconfig
+++ b/configs/ucm-imx8m-mini_defconfig
@@ -1,3 +1,4 @@
@@ -158,13 +129,14 @@ index 2955b2f907..c57d88fa59 100644
CONFIG_ARM=y
CONFIG_ARCH_IMX8M=y
CONFIG_SYS_TEXT_BASE=0x40200000
@@ -8,10 +9,12 @@ CONFIG_IMX_OPTEE=y
@@ -7,11 +8,13 @@ CONFIG_SPL_MMC_SUPPORT=y
CONFIG_IMX_OPTEE=y
CONFIG_DEFAULT_DEVICE_TREE="ucm-imx8m-mini"
CONFIG_FIT=y
CONFIG_SPL_LOAD_FIT=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,SPL_TEXT_BASE=0x7E1000"
+CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage.cfg,SPL_TEXT_BASE=0x7E1000"
CONFIG_SPL_LOAD_FIT=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,SPL_TEXT_BASE=0x7E1000"
CONFIG_DEFAULT_FDT_FILE="ucm-imx8m-mini.dtb"
CONFIG_ARCH_MISC_INIT=y
CONFIG_SPL=y
@@ -207,5 +179,5 @@ index dfd7d9980f..30caaca5a1 100644
#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
#define PHYS_SDRAM_SIZE 0x80000000 /* 2GB DDR */
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From fa158dafefdcb52d8e10e8d6711fe90b759df091 Mon Sep 17 00:00:00 2001
From 3d914d55d3fa43b8ca1f1d16473cf33e5917061c Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Tue, 16 Jun 2020 15:45:22 +0300
Subject: [PATCH 35/91] Fix storages numeration order
Subject: [PATCH 035/126] Fix storages numeration order
Make u-boot enumerate storages in the same order as previous versions (2018.03)
@@ -36,5 +36,5 @@ index 3d8be3a09a..b191e87755 100644
compatible = "regulator-fixed";
regulator-name = "VSD_3V3";
--
2.17.1
2.11.0
@@ -1,21 +1,21 @@
From a5bb9ce368427a85ca72db9c512b9d9705126e7a Mon Sep 17 00:00:00 2001
From dc542fe009df582db1a167902f72164de920fbcf Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 00:58:48 +0300
Subject: [PATCH 36/91] Fix memory size initialisation
Subject: [PATCH 036/126] Fix memory size initialisation
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
board/compulab/plat/imx8mm/ddr/ddr.c | 15 +-----
.../compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 48 +++++++++++--------
.../compulab/ucm-imx8m-mini/ucm-imx8m-mini.h | 6 +++
configs/ucm-imx8m-mini_defconfig | 2 +-
4 files changed, 35 insertions(+), 36 deletions(-)
board/compulab/plat/imx8mm/ddr/ddr.c | 15 +-------
board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c | 47 ++++++++++++++------------
board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.h | 6 ++++
configs/ucm-imx8m-mini_defconfig | 2 +-
4 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/board/compulab/plat/imx8mm/ddr/ddr.c b/board/compulab/plat/imx8mm/ddr/ddr.c
index 7392fcdfaa..137a0b9f32 100644
index 3c6b6ff489..1340475bef 100644
--- a/board/compulab/plat/imx8mm/ddr/ddr.c
+++ b/board/compulab/plat/imx8mm/ddr/ddr.c
@@ -13,6 +13,7 @@
@@ -14,6 +14,7 @@
#include <asm/arch/clock.h>
#include <asm/mach-imx/gpio.h>
#include "ddr.h"
@@ -23,7 +23,7 @@ index 7392fcdfaa..137a0b9f32 100644
/* Forward declarations */
u32 cl_eeprom_get_ddrinfo(void);
@@ -59,20 +60,6 @@ struct lpddr4_desc {
@@ -60,20 +61,6 @@ struct lpddr4_desc {
char *desc[4];
};
@@ -45,11 +45,11 @@ index 7392fcdfaa..137a0b9f32 100644
static const struct lpddr4_desc lpddr4_array[] = {
{ .name = "Micron", .id = 0xff020008, .size = 2048, .count = 1, .timing = &ucm_dram_timing_ff020008}, //Only the first timing entry is in use
diff --git a/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c b/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c
index fa06db9ec6..0ffbbf3615 100644
index f262acf414..8694201633 100644
--- a/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c
+++ b/board/compulab/ucm-imx8m-mini/ucm-imx8m-mini.c
@@ -153,25 +153,21 @@ int board_postclk_init(void)
#endif
@@ -154,25 +154,21 @@ int board_postclk_init(void)
int board_phys_sdram_size(phys_size_t *size)
{
- unsigned long value = readl(TCM_DATA_CFG);
@@ -89,15 +89,7 @@ index fa06db9ec6..0ffbbf3615 100644
}
/* Get the top of usable RAM */
ulong board_get_usable_ram_top(ulong total_size)
@@ -188,6 +184,7 @@ int dram_init(void)
phys_size_t sdram_size;
int ret;
ret = board_phys_sdram_size(&sdram_size);
+ printf("%s: size %llu\n", __func__, sdram_size);
if (ret)
return ret;
@@ -219,21 +216,30 @@ int dram_init_banksize(void)
@@ -220,21 +216,30 @@ int dram_init_banksize(void)
}
gd->bd->bi_dram[bank].start = PHYS_SDRAM;
@@ -147,7 +139,7 @@ index be698941da..c3380cb5ef 100644
#endif
diff --git a/configs/ucm-imx8m-mini_defconfig b/configs/ucm-imx8m-mini_defconfig
index c57d88fa59..f42597b5c7 100644
index a90b813a3d..3eb63bf1e6 100644
--- a/configs/ucm-imx8m-mini_defconfig
+++ b/configs/ucm-imx8m-mini_defconfig
@@ -5,7 +5,7 @@ CONFIG_SYS_TEXT_BASE=0x40200000
@@ -158,7 +150,7 @@ index c57d88fa59..f42597b5c7 100644
+# CONFIG_IMX_OPTEE is not set
CONFIG_DEFAULT_DEVICE_TREE="ucm-imx8m-mini"
CONFIG_FIT=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 912eada83c4e27cd5dca3fea9f1787b22c55ae25 Mon Sep 17 00:00:00 2001
From 85923035d03ac133385f8d296d9722ed3375157d Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sun, 21 Jun 2020 22:08:06 +0300
Subject: [PATCH 37/91] env: Add to kernel command line rw rootwait
Subject: [PATCH 037/126] env: Add to kernel command line rw rootwait
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
@@ -28,5 +28,5 @@ index 30caaca5a1..e3e91c7f72 100644
"ulimage=load ${iface} ${dev}:${part} ${loadaddr} ${image}\0" \
"ulfdt=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 6801a7a1c65cb87d00c72f1ee7f4074bd651eadf Mon Sep 17 00:00:00 2001
From a93fbb4d91247528a8033cdaa6f99e8d3ca3efd7 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 29 Jun 2020 18:15:26 +0300
Subject: [PATCH 38/91] Move environment from 4M to 17k address
Subject: [PATCH 038/126] Move environment from 4M to 17k address
Change starting address of environment data on eMMC form (64 * 64k) to (34 * 512)
in order to avoid possible conflicts with the first partition.
@@ -25,5 +25,5 @@ index e3e91c7f72..ad4e7997b1 100644
#define CONFIG_SYS_MMC_ENV_DEV 0 /* USDHC2 */
#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
--
2.17.1
2.11.0
@@ -1,11 +1,11 @@
From eeec1e62d5133600bb5006f6dcc4feba2475cfce Mon Sep 17 00:00:00 2001
From 745b74f41e51ff2c7590c6df9a3f2a94f884c2b4 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 8 Jul 2020 08:03:28 +0300
Subject: [PATCH 39/91] compulab: eeprom: Add DM support
Subject: [PATCH 039/126] compulab: eeprom: Add DM support
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/common/eeprom.c | 42 +++++++++++++++++++++++++++++-----
board/compulab/common/eeprom.c | 42 ++++++++++++++++++++++++++++++++++++------
1 file changed, 36 insertions(+), 6 deletions(-)
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
@@ -77,5 +77,5 @@ index cc91f8a195..defd9b6446 100644
return res;
}
--
2.17.1
2.11.0
@@ -1,20 +1,20 @@
From 8e4f334ab1c365dc0ba1d0ef8d0b31ac6caed9ad Mon Sep 17 00:00:00 2001
From ab1153a5f4319338446cbdbea8398dd5ff387706 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 01:01:11 +0300
Subject: [PATCH 40/91] mcm-imx8m-mini: Add basic support
Subject: [PATCH 040/126] mcm-imx8m-mini: Add basic support
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
arch/arm/dts/Makefile | 1 +
arch/arm/dts/mcm-imx8m-mini.dts | 476 ++++++++++++++++++
arch/arm/mach-imx/imx8m/Kconfig | 7 +
board/compulab/mcm-imx8m-mini/Kconfig | 17 +
board/compulab/mcm-imx8m-mini/Makefile | 14 +
.../compulab/mcm-imx8m-mini/mcm-imx8m-mini.c | 352 +++++++++++++
.../compulab/mcm-imx8m-mini/mcm-imx8m-mini.h | 19 +
board/compulab/mcm-imx8m-mini/spl.c | 265 ++++++++++
configs/mcm-imx8m-mini_defconfig | 67 +++
include/configs/mcm-imx8m-mini.h | 308 ++++++++++++
arch/arm/dts/Makefile | 1 +
arch/arm/dts/mcm-imx8m-mini.dts | 476 +++++++++++++++++++++++++
arch/arm/mach-imx/imx8m/Kconfig | 7 +
board/compulab/mcm-imx8m-mini/Kconfig | 17 +
board/compulab/mcm-imx8m-mini/Makefile | 14 +
board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c | 352 ++++++++++++++++++
board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.h | 19 +
board/compulab/mcm-imx8m-mini/spl.c | 265 ++++++++++++++
configs/mcm-imx8m-mini_defconfig | 67 ++++
include/configs/mcm-imx8m-mini.h | 308 ++++++++++++++++
10 files changed, 1526 insertions(+)
create mode 100644 arch/arm/dts/mcm-imx8m-mini.dts
create mode 100644 board/compulab/mcm-imx8m-mini/Kconfig
@@ -26,11 +26,11 @@ Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
create mode 100644 include/configs/mcm-imx8m-mini.h
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 6238d142af..5dacac3b5a 100644
index 9781d3451c..c6b54163d0 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -881,6 +881,7 @@ dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
imxrt1020-evk.dtb
@@ -889,6 +889,7 @@ dtb-$(CONFIG_ARCH_IMXRT) += imxrt1050-evk.dtb \
dtb-$(CONFIG_ARCH_IMX8ULP) += imx8ulp-evk.dtb imx8ulp-evk-i3c.dtb
dtb-$(CONFIG_TARGET_UCM_IMX8M_MINI) += ucm-imx8m-mini.dtb
+dtb-$(CONFIG_TARGET_MCM_IMX8M_MINI) += mcm-imx8m-mini.dtb
@@ -520,10 +520,10 @@ index 0000000000..2c3723a42c
+ temperature = <115000>;
+};
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index d4c41ba1aa..13e93cf0f1 100644
index 4930b9bee6..a38ec31d25 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -208,6 +208,12 @@ config TARGET_UCM_IMX8M_MINI
@@ -266,6 +266,12 @@ config TARGET_UCM_IMX8M_MINI
select SUPPORT_SPL
select IMX8M_LPDDR4
@@ -536,7 +536,7 @@ index d4c41ba1aa..13e93cf0f1 100644
endchoice
source "board/freescale/imx8mq_evk/Kconfig"
@@ -225,5 +231,6 @@ source "board/beacon/imx8mn/Kconfig"
@@ -284,5 +290,6 @@ source "board/beacon/imx8mn/Kconfig"
source "board/phytec/phycore_imx8mm/Kconfig"
source "board/phytec/phycore_imx8mp/Kconfig"
source "board/compulab/ucm-imx8m-mini/Kconfig"
@@ -1628,5 +1628,5 @@ index 0000000000..f5ab2f101b
+#endif
+#endif
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 84e001d6c6fe84c54f2029641860300f7941fb5a Mon Sep 17 00:00:00 2001
From 7696c21869712bd70a49f6d43142437d3f5199e5 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 8 Jul 2020 08:07:55 +0300
Subject: [PATCH 41/91] mcm-imx8m-mini: env: config: Set the machine values
Subject: [PATCH 041/126] mcm-imx8m-mini: env: config: Set the machine values
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -50,5 +50,5 @@ index 053895a2c0..3222fd715c 100644
+/dev/mmcblk2boot0 0x1000 0x4000
+#/dev/mmcblk1 0x1000 0x4000
--
2.17.1
2.11.0
@@ -1,8 +1,8 @@
From daa08d163bc71d8ac1e1347574729be7563f009f Mon Sep 17 00:00:00 2001
From 754cce3320e6c237684530a6611cd8ad78cda536 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 8 Jul 2020 08:10:42 +0300
Subject: [PATCH 42/91] mcm-imx8m-mini: env: Add an option to print the machine
env devices
Subject: [PATCH 042/126] mcm-imx8m-mini: env: Add an option to print the
machine env devices
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -51,5 +51,5 @@ index 1d193bd437..ebd18b40ba 100644
/* ignore unknown options */
break;
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 7328ca230f8f8af35734a42a30554860e2f36240 Mon Sep 17 00:00:00 2001
From e321143aaa0fd2913f731b5cf45d6ae08f11c31e Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 01:02:48 +0300
Subject: [PATCH 43/91] mcm-imx8m-mini: Set EXTRAVERSION
Subject: [PATCH 043/126] mcm-imx8m-mini: Set EXTRAVERSION
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
@@ -22,5 +22,5 @@ index 0451f445f6..22d2230a6f 100644
# *DOCUMENTATION*
--
2.17.1
2.11.0
@@ -1,11 +1,11 @@
From 19bf71a555e5ab75f5157d39b2420cce43060133 Mon Sep 17 00:00:00 2001
From 4e8e749b50ff87ce206d6446c02ff035b11e64f4 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 8 Jul 2020 17:13:00 +0300
Subject: [PATCH 44/91] mcm-imx8m-mini: config: Update defconfig
Subject: [PATCH 044/126] mcm-imx8m-mini: config: Update defconfig
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
configs/mcm-imx8m-mini_defconfig | 46 +++++++++++++++++++++++++++++---
configs/mcm-imx8m-mini_defconfig | 46 +++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/configs/mcm-imx8m-mini_defconfig b/configs/mcm-imx8m-mini_defconfig
@@ -119,5 +119,5 @@ index 80350afa7c..ce1cfb834a 100644
+CONFIG_OF_LIBFDT_OVERLAY=y
# CONFIG_EFI_LOADER is not set
--
2.17.1
2.11.0
@@ -1,11 +1,11 @@
From 020bfa6700660bd1c77c0282f88b288b5b058a3d Mon Sep 17 00:00:00 2001
From cf8a47603118237f8b77790c71d4c78a926aac3c Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 8 Jul 2020 17:13:29 +0300
Subject: [PATCH 45/91] mcm-imx8m-mini: config: Update .h config
Subject: [PATCH 045/126] mcm-imx8m-mini: config: Update .h config
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
include/configs/mcm-imx8m-mini.h | 48 ++++++--------------------------
include/configs/mcm-imx8m-mini.h | 48 ++++++++--------------------------------
1 file changed, 9 insertions(+), 39 deletions(-)
diff --git a/include/configs/mcm-imx8m-mini.h b/include/configs/mcm-imx8m-mini.h
@@ -145,5 +145,5 @@ index f5ab2f101b..dd0448efca 100644
#define CONFIG_OF_BOARD_SETUP
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 161d9b8fcae9a58c5096574b7b815b9ad0f74d79 Mon Sep 17 00:00:00 2001
From a2b63373c7d1f8e01405a0bb08a75ccd53607c71 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 8 Jul 2020 17:28:54 +0300
Subject: [PATCH 46/91] mcm-imx8m-mini: spl: Update the board spl
Subject: [PATCH 046/126] mcm-imx8m-mini: spl: Update the board spl
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -54,5 +54,5 @@ index 7038a8e073..f59bac4cb9 100644
+ return 0;
+}
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 6ccb6f0a01d67e13ece4ddc6ec61f2ff69c0adff Mon Sep 17 00:00:00 2001
From 3e43aa79f734982246d68cc6837601144d64ec72 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Thu, 9 Jul 2020 12:35:27 +0300
Subject: [PATCH 47/91] mcm-imx8m-mini: Fix dram_init_banksize() logics
Subject: [PATCH 047/126] mcm-imx8m-mini: Fix dram_init_banksize() logics
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -32,5 +32,5 @@ index 1ec3ecbde7..9ece28b318 100644
bank_1_size - gd->bd->bi_dram[bank].start;
}
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From cbd85748102a4e9fb1251ff4313fd210de70a202 Mon Sep 17 00:00:00 2001
From 9b7dbbb4c200496a6cca3ee42bfa85d8f6649f7c Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Thu, 9 Jul 2020 22:58:39 +0300
Subject: [PATCH 48/91] mcm-imx8m-mini: Add board_usb_init() and
Subject: [PATCH 048/126] mcm-imx8m-mini: Add board_usb_init() and
board_usb_cleanup()
Enable power on/off usb power in U-Boot.
@@ -40,5 +40,5 @@ index 9ece28b318..6cea3b38cd 100644
{
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 80f1aafd56528a0405f8409d5c3337fbc1212e43 Mon Sep 17 00:00:00 2001
From 4d8f74402acb4986f1db484b55d15c80de2f4acd Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Thu, 9 Jul 2020 23:00:55 +0300
Subject: [PATCH 49/91] mcm-imx8m-mini: dts: Enable usbotg2 in host mode
Subject: [PATCH 049/126] mcm-imx8m-mini: dts: Enable usbotg2 in host mode
Make the ubsotg2 work in U-Boot in host mode.
@@ -25,5 +25,5 @@ index 2c3723a42c..85f4c46dd7 100644
&cpu_alert0 {
--
2.17.1
2.11.0
@@ -1,7 +1,7 @@
From 6a6a9bb555195a8f40ee1426c7c6bdc3878b8cf2 Mon Sep 17 00:00:00 2001
From ae8974e8a232e587112442a63be38b64b1675533 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Thu, 9 Jul 2020 23:02:57 +0300
Subject: [PATCH 50/91] mcm-imx8m-mini: config: Remove unused stuff
Subject: [PATCH 050/126] mcm-imx8m-mini: config: Remove unused stuff
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
@@ -41,5 +41,5 @@ index ce1cfb834a..92cdad293d 100644
CONFIG_SUPPORT_EMMC_BOOT=y
CONFIG_MMC_IO_VOLTAGE=y
--
2.17.1
2.11.0
@@ -1,12 +1,12 @@
From 579a5ba04f8d70af5262e3d1abb6f2b615d289c8 Mon Sep 17 00:00:00 2001
From bddd7484de0069acb92d6421dfcd1fc16bd346f4 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Mon, 13 Jul 2020 10:55:06 +0300
Subject: [PATCH 51/91] mcm-imx8m-mini: Remove dram_init_banksize() and
Subject: [PATCH 051/126] mcm-imx8m-mini: Remove dram_init_banksize() and
get_effective_memsize()
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
.../compulab/mcm-imx8m-mini/mcm-imx8m-mini.c | 76 -------------------
board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c | 76 --------------------------
1 file changed, 76 deletions(-)
diff --git a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
@@ -97,5 +97,5 @@ index 6cea3b38cd..7cfed94479 100644
int ft_board_setup(void *blob, bd_t *bd)
{
--
2.17.1
2.11.0
@@ -0,0 +1,101 @@
From 4fc2bc6314ba1ee0e2c3073bd3bc5c3e33887213 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 01:06:57 +0300
Subject: [PATCH 052/126] mcm-imx8m-mini: Move tcm to plat/imx8mm
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
board/compulab/mcm-imx8m-mini/Makefile | 3 ++-
board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c | 2 +-
board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.h | 19 -------------------
board/compulab/mcm-imx8m-mini/spl.c | 1 -
board/compulab/plat/imx8mm/ddr/ddr.h | 9 +++++++++
5 files changed, 12 insertions(+), 22 deletions(-)
delete mode 100644 board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.h
diff --git a/board/compulab/mcm-imx8m-mini/Makefile b/board/compulab/mcm-imx8m-mini/Makefile
index b926ed9cf9..8ade3b58c5 100644
--- a/board/compulab/mcm-imx8m-mini/Makefile
+++ b/board/compulab/mcm-imx8m-mini/Makefile
@@ -6,8 +6,9 @@
obj-y += mcm-imx8m-mini.o
-ifdef CONFIG_SPL_BUILD
ccflags-y += -I$(srctree)/board/compulab/plat/imx8mm/
+
+ifdef CONFIG_SPL_BUILD
obj-y += spl.o
endif
diff --git a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
index 7cfed94479..20f322223c 100644
--- a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
+++ b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
@@ -27,7 +27,7 @@
#include <usb.h>
#include <asm/mach-imx/boot_mode.h>
#include <asm/mach-imx/video.h>
-#include "mcm-imx8m-mini.h"
+#include "ddr/ddr.h"
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.h b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.h
deleted file mode 100644
index fc59756161..0000000000
--- a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2017 NXP
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef __MCM_IMX8M_MINI__
-#define __MCM_IMX8M_MINI__
-
-#define TCM_DATA_CFG 0x7e0000
-
-struct lpddr4_tcm_desc {
- unsigned int size;
- unsigned int sign;
- unsigned int index;
- unsigned int count;
-};
-
-#endif
diff --git a/board/compulab/mcm-imx8m-mini/spl.c b/board/compulab/mcm-imx8m-mini/spl.c
index f59bac4cb9..3f6cb65102 100644
--- a/board/compulab/mcm-imx8m-mini/spl.c
+++ b/board/compulab/mcm-imx8m-mini/spl.c
@@ -21,7 +21,6 @@
#include <fsl_esdhc_imx.h>
#include <mmc.h>
#include "ddr/ddr.h"
-#include "mcm-imx8m-mini.h"
DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/compulab/plat/imx8mm/ddr/ddr.h b/board/compulab/plat/imx8mm/ddr/ddr.h
index a66e8ec3c4..4d2a238439 100644
--- a/board/compulab/plat/imx8mm/ddr/ddr.h
+++ b/board/compulab/plat/imx8mm/ddr/ddr.h
@@ -14,4 +14,13 @@ extern struct dram_timing_info ucm_dram_timing_01050008;
void spl_dram_init(void);
+#define TCM_DATA_CFG 0x7e0000
+
+struct lpddr4_tcm_desc {
+ unsigned int size;
+ unsigned int sign;
+ unsigned int index;
+ unsigned int count;
+};
+
#endif
--
2.11.0
@@ -0,0 +1,702 @@
From fbeb9ec1d92ce8968914308df8ab54d6288ce86e Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 15 Jul 2020 07:58:17 +0300
Subject: [PATCH 053/126] mcm-imx8m-mini: Refactor spl code
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/mcm-imx8m-mini/Makefile | 4 +-
board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c | 27 ---
board/compulab/mcm-imx8m-mini/spl.c | 265 +----------------------
board/compulab/plat/imx8mm/Makefile | 1 +
board/compulab/plat/imx8mm/spl/Makefile | 7 +
board/compulab/plat/imx8mm/spl/common.c | 33 +++
board/compulab/plat/imx8mm/spl/spl.c | 280 +++++++++++++++++++++++++
7 files changed, 325 insertions(+), 292 deletions(-)
create mode 100644 board/compulab/plat/imx8mm/spl/Makefile
create mode 100644 board/compulab/plat/imx8mm/spl/common.c
create mode 100644 board/compulab/plat/imx8mm/spl/spl.c
diff --git a/board/compulab/mcm-imx8m-mini/Makefile b/board/compulab/mcm-imx8m-mini/Makefile
index 8ade3b58c5..9ce2875d6e 100644
--- a/board/compulab/mcm-imx8m-mini/Makefile
+++ b/board/compulab/mcm-imx8m-mini/Makefile
@@ -4,12 +4,12 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += mcm-imx8m-mini.o
-
ccflags-y += -I$(srctree)/board/compulab/plat/imx8mm/
ifdef CONFIG_SPL_BUILD
obj-y += spl.o
+else
+obj-y += mcm-imx8m-mini.o
endif
obj-y += ../plat/imx8mm/
diff --git a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
index 20f322223c..d01b8f8767 100644
--- a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
+++ b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
@@ -31,33 +31,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
-#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_ODE | PAD_CTL_PUE | PAD_CTL_PE)
-
-static iomux_v3_cfg_t const uart_pads[] = {
- IMX8MM_PAD_UART3_RXD_UART3_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
- IMX8MM_PAD_UART3_TXD_UART3_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
-};
-
-static iomux_v3_cfg_t const wdog_pads[] = {
- IMX8MM_PAD_GPIO1_IO02_WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_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));
-
- init_uart_clk(2);
-
- return 0;
-}
-
#ifdef CONFIG_BOARD_POSTCLK_INIT
int board_postclk_init(void)
{
diff --git a/board/compulab/mcm-imx8m-mini/spl.c b/board/compulab/mcm-imx8m-mini/spl.c
index 3f6cb65102..d6ece8ef3e 100644
--- a/board/compulab/mcm-imx8m-mini/spl.c
+++ b/board/compulab/mcm-imx8m-mini/spl.c
@@ -1,270 +1,9 @@
-/*
- * Copyright 2020 CompuLab Ltd.
- */
-
-#include <common.h>
-#include <cpu_func.h>
-#include <hang.h>
-#include <spl.h>
#include <asm/io.h>
#include <asm/mach-imx/iomux-v3.h>
-#include <asm/arch/clock.h>
#include <asm/arch/imx8mm_pins.h>
+#include <asm/arch/clock.h>
#include <asm/arch/sys_proto.h>
-#include <asm/mach-imx/boot_mode.h>
-#include <asm/arch/ddr.h>
-
-#include <power/pmic.h>
-#include <power/bd71837.h>
-#include <asm/mach-imx/gpio.h>
-#include <asm/mach-imx/mxc_i2c.h>
-#include <fsl_esdhc_imx.h>
-#include <mmc.h>
-#include "ddr/ddr.h"
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int spl_board_boot_device(enum boot_device boot_dev_spl)
-{
- switch (boot_dev_spl) {
- case SD2_BOOT:
- case MMC2_BOOT:
- return BOOT_DEVICE_MMC1;
- case SD3_BOOT:
- case MMC3_BOOT:
- return BOOT_DEVICE_MMC2;
- default:
- return BOOT_DEVICE_NONE;
- }
-}
-
-#define I2C_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE | PAD_CTL_PE)
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-struct i2c_pads_info i2c_pad_info1 = {
- .scl = {
- .i2c_mode = IMX8MM_PAD_I2C2_SCL_I2C2_SCL | PC,
- .gpio_mode = IMX8MM_PAD_I2C2_SCL_GPIO5_IO16 | PC,
- .gp = IMX_GPIO_NR(5, 16),
- },
- .sda = {
- .i2c_mode = IMX8MM_PAD_I2C2_SDA_I2C2_SDA | PC,
- .gpio_mode = IMX8MM_PAD_I2C2_SDA_GPIO5_IO17 | PC,
- .gp = IMX_GPIO_NR(5, 17),
- },
-};
-
-#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 18)
-#define USDHC2_PWR_GPIO IMX_GPIO_NR(2, 19)
-
-#define USDHC_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE |PAD_CTL_PE | \
- PAD_CTL_FSEL2)
-#define USDHC_GPIO_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_DSE1)
-
-static iomux_v3_cfg_t const usdhc3_pads[] = {
- IMX8MM_PAD_NAND_WE_B_USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_WP_B_USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_DATA04_USDHC3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_DATA05_USDHC3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_DATA06_USDHC3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_DATA07_USDHC3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_RE_B_USDHC3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_CE2_B_USDHC3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_CE3_B_USDHC3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_NAND_CLE_USDHC3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-};
-
-static iomux_v3_cfg_t const usdhc2_pads[] = {
- IMX8MM_PAD_SD2_CLK_USDHC2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_SD2_CMD_USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_SD2_DATA0_USDHC2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_SD2_DATA1_USDHC2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_SD2_DATA2_USDHC2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_SD2_DATA3_USDHC2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
- IMX8MM_PAD_SD2_RESET_B_GPIO2_IO19 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL),
-};
-
-/*
- * The evk board uses DAT3 to detect CD card plugin,
- * in u-boot we mux the pin to GPIO when doing board_mmc_getcd.
- */
-static iomux_v3_cfg_t const usdhc2_cd_pad =
- IMX8MM_PAD_SD2_DATA3_GPIO2_IO18 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL);
-
-static iomux_v3_cfg_t const usdhc2_dat3_pad =
- IMX8MM_PAD_SD2_DATA3_USDHC2_DATA3 |
- MUX_PAD_CTRL(USDHC_PAD_CTRL);
-
-
-static struct fsl_esdhc_cfg usdhc_cfg[2] = {
- {USDHC2_BASE_ADDR, 0, 4},
- {USDHC3_BASE_ADDR, 0, 8},
-};
-
-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(1);
- usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
- 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;
- case 1:
- init_clk_usdhc(2);
- usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
- imx_iomux_v3_setup_multiple_pads(
- usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
- 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;
-}
-
-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 USDHC3_BASE_ADDR:
- ret = 1;
- break;
- case USDHC2_BASE_ADDR:
- imx_iomux_v3_setup_pad(usdhc2_cd_pad);
- gpio_request(USDHC2_CD_GPIO, "usdhc2 cd");
- gpio_direction_input(USDHC2_CD_GPIO);
-
- /*
- * Since it is the DAT3 pin, this pin is pulled to
- * low voltage if no card
- */
- ret = gpio_get_value(USDHC2_CD_GPIO);
-
- imx_iomux_v3_setup_pad(usdhc2_dat3_pad);
- return ret;
- }
-
- return 1;
-}
-
-#ifdef CONFIG_POWER
-#define I2C_PMIC 1
-int power_init_board(void)
-{
- struct pmic *p;
- int ret;
-
- ret = power_bd71837_init(I2C_PMIC);
- if (ret)
- printf("power init failed");
-
- p = pmic_get("BD71837");
- pmic_probe(p);
-
-
- /* decrease RESET key long push time from the default 10s to 10ms */
- pmic_reg_write(p, BD71837_PWRONCONFIG1, 0x0);
-
- /* unlock the PMIC regs */
- pmic_reg_write(p, BD71837_REGLOCK, 0x1);
-
- /* decrease VDD_ARM to 0.85V for 1.2GHz operation */
- pmic_reg_write(p, BD71837_BUCK1_VOLT_RUN, 0x0f);
-
- /* increase VDD_DRAM to 0.975V (9v5 required but not supported)*/
- pmic_reg_write(p, BD71837_BUCK5_VOLT, 0x83);
-
- /* increase NVCC_DRAM_1V2 to 1.2v for DDR4 */
- pmic_reg_write(p, BD71837_BUCK8_VOLT, 0x28);
-
- /* lock the PMIC regs */
- pmic_reg_write(p, BD71837_REGLOCK, 0x11);
-
- return 0;
-}
-#else
-int power_init_board(void) { return 0; }
-#endif
-
-void spl_board_init(void)
-{
-#ifndef CONFIG_SPL_USB_SDP_SUPPORT
- /* Serial download mode */
- if (is_usb_boot()) {
- puts("Back to ROM, SDP\n");
- restore_boot_params();
- }
-#endif
- 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)
-{
- int ret;
- /* Clear the BSS. */
- memset(__bss_start, 0, __bss_end - __bss_start);
-
- arch_cpu_init();
-
- board_early_init_f();
-
- timer_init();
-
- preloader_console_init();
-
- ret = spl_init();
- if (ret) {
- debug("spl_init() failed: %d\n", ret);
- hang();
- }
-
- enable_tzc380();
-
- setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
-
- power_init_board();
- /* DDR initialization */
- spl_dram_init();
-
- board_init_r(NULL, 0);
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- puts ("resetting ...\n");
-
- reset_cpu(WDOG1_BASE_ADDR);
+int spl_board_private_init(void) {
return 0;
}
diff --git a/board/compulab/plat/imx8mm/Makefile b/board/compulab/plat/imx8mm/Makefile
index 04b9b2e8f8..2f68e0523e 100644
--- a/board/compulab/plat/imx8mm/Makefile
+++ b/board/compulab/plat/imx8mm/Makefile
@@ -1,2 +1,3 @@
obj-y += ddr/
obj-y += eeprom/
+obj-y += spl/
diff --git a/board/compulab/plat/imx8mm/spl/Makefile b/board/compulab/plat/imx8mm/spl/Makefile
new file mode 100644
index 0000000000..a3a9acaa6e
--- /dev/null
+++ b/board/compulab/plat/imx8mm/spl/Makefile
@@ -0,0 +1,7 @@
+ccflags-y += -I$(srctree)/board/compulab/plat/imx8mm/
+
+obj-y += common.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+endif
diff --git a/board/compulab/plat/imx8mm/spl/common.c b/board/compulab/plat/imx8mm/spl/common.c
new file mode 100644
index 0000000000..5f1d1e5b97
--- /dev/null
+++ b/board/compulab/plat/imx8mm/spl/common.c
@@ -0,0 +1,33 @@
+#include <asm/io.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <asm/arch/imx8mm_pins.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+
+#define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
+#define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_ODE | PAD_CTL_PUE | PAD_CTL_PE)
+
+static iomux_v3_cfg_t const uart_pads[] = {
+ IMX8MM_PAD_UART3_RXD_UART3_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+ IMX8MM_PAD_UART3_TXD_UART3_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const wdog_pads[] = {
+ IMX8MM_PAD_GPIO1_IO02_WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_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));
+
+ init_uart_clk(2);
+
+ return 0;
+}
+
diff --git a/board/compulab/plat/imx8mm/spl/spl.c b/board/compulab/plat/imx8mm/spl/spl.c
new file mode 100644
index 0000000000..50aa6bea3f
--- /dev/null
+++ b/board/compulab/plat/imx8mm/spl/spl.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright 2020 CompuLab Ltd.
+ */
+
+#include <common.h>
+#include <cpu_func.h>
+#include <hang.h>
+#include <init.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx8mm_pins.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/arch/ddr.h>
+#include <linux/delay.h>
+
+#include <power/pmic.h>
+#include <power/bd71837.h>
+#include <asm/mach-imx/gpio.h>
+#include <asm/mach-imx/mxc_i2c.h>
+#include <fsl_esdhc_imx.h>
+#include <mmc.h>
+#include "ddr/ddr.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int spl_board_boot_device(enum boot_device boot_dev_spl)
+{
+ switch (boot_dev_spl) {
+ case SD2_BOOT:
+ case MMC2_BOOT:
+ return BOOT_DEVICE_MMC1;
+ case SD3_BOOT:
+ case MMC3_BOOT:
+ return BOOT_DEVICE_MMC2;
+ default:
+ return BOOT_DEVICE_NONE;
+ }
+}
+
+#define I2C_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE | PAD_CTL_PE)
+#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
+struct i2c_pads_info i2c_pad_info1 = {
+ .scl = {
+ .i2c_mode = IMX8MM_PAD_I2C2_SCL_I2C2_SCL | PC,
+ .gpio_mode = IMX8MM_PAD_I2C2_SCL_GPIO5_IO16 | PC,
+ .gp = IMX_GPIO_NR(5, 16),
+ },
+ .sda = {
+ .i2c_mode = IMX8MM_PAD_I2C2_SDA_I2C2_SDA | PC,
+ .gpio_mode = IMX8MM_PAD_I2C2_SDA_GPIO5_IO17 | PC,
+ .gp = IMX_GPIO_NR(5, 17),
+ },
+};
+
+#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 18)
+#define USDHC2_PWR_GPIO IMX_GPIO_NR(2, 19)
+
+#define USDHC_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE |PAD_CTL_PE | \
+ PAD_CTL_FSEL2)
+#define USDHC_GPIO_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_DSE1)
+
+static iomux_v3_cfg_t const usdhc3_pads[] = {
+ IMX8MM_PAD_NAND_WE_B_USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_WP_B_USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_DATA04_USDHC3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_DATA05_USDHC3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_DATA06_USDHC3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_DATA07_USDHC3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_RE_B_USDHC3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_CE2_B_USDHC3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_CE3_B_USDHC3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_NAND_CLE_USDHC3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const usdhc2_pads[] = {
+ IMX8MM_PAD_SD2_CLK_USDHC2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_SD2_CMD_USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_SD2_DATA0_USDHC2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_SD2_DATA1_USDHC2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_SD2_DATA2_USDHC2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_SD2_DATA3_USDHC2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+ IMX8MM_PAD_SD2_RESET_B_GPIO2_IO19 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL),
+};
+
+/*
+ * The evk board uses DAT3 to detect CD card plugin,
+ * in u-boot we mux the pin to GPIO when doing board_mmc_getcd.
+ */
+static iomux_v3_cfg_t const usdhc2_cd_pad =
+ IMX8MM_PAD_SD2_DATA3_GPIO2_IO18 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL);
+
+static iomux_v3_cfg_t const usdhc2_dat3_pad =
+ IMX8MM_PAD_SD2_DATA3_USDHC2_DATA3 |
+ MUX_PAD_CTRL(USDHC_PAD_CTRL);
+
+
+static struct fsl_esdhc_cfg usdhc_cfg[2] = {
+ {USDHC2_BASE_ADDR, 0, 4},
+ {USDHC3_BASE_ADDR, 0, 8},
+};
+
+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(1);
+ usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+ 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;
+ case 1:
+ init_clk_usdhc(2);
+ usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+ imx_iomux_v3_setup_multiple_pads(
+ usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
+ 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;
+}
+
+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 USDHC3_BASE_ADDR:
+ ret = 1;
+ break;
+ case USDHC2_BASE_ADDR:
+ imx_iomux_v3_setup_pad(usdhc2_cd_pad);
+ gpio_request(USDHC2_CD_GPIO, "usdhc2 cd");
+ gpio_direction_input(USDHC2_CD_GPIO);
+
+ /*
+ * Since it is the DAT3 pin, this pin is pulled to
+ * low voltage if no card
+ */
+ ret = gpio_get_value(USDHC2_CD_GPIO);
+
+ imx_iomux_v3_setup_pad(usdhc2_dat3_pad);
+ return ret;
+ }
+
+ return 1;
+}
+
+#ifdef CONFIG_POWER
+#define I2C_PMIC 1
+int power_init_board(void)
+{
+ struct pmic *p;
+ int ret;
+
+ ret = power_bd71837_init(I2C_PMIC);
+ if (ret)
+ printf("power init failed");
+
+ p = pmic_get("BD71837");
+ pmic_probe(p);
+
+
+ /* decrease RESET key long push time from the default 10s to 10ms */
+ pmic_reg_write(p, BD71837_PWRONCONFIG1, 0x0);
+
+ /* unlock the PMIC regs */
+ pmic_reg_write(p, BD71837_REGLOCK, 0x1);
+
+ /* decrease VDD_ARM to 0.85V for 1.2GHz operation */
+ pmic_reg_write(p, BD71837_BUCK1_VOLT_RUN, 0x0f);
+
+ /* increase VDD_DRAM to 0.975V (9v5 required but not supported)*/
+ pmic_reg_write(p, BD71837_BUCK5_VOLT, 0x83);
+
+ /* increase NVCC_DRAM_1V2 to 1.2v for DDR4 */
+ pmic_reg_write(p, BD71837_BUCK8_VOLT, 0x28);
+
+ /* lock the PMIC regs */
+ pmic_reg_write(p, BD71837_REGLOCK, 0x11);
+
+ return 0;
+}
+#else
+int power_init_board(void) { return 0; }
+#endif
+
+__weak int spl_board_private_init(void) {
+ return 0;
+}
+
+void spl_board_init(void)
+{
+#ifndef CONFIG_SPL_USB_SDP_SUPPORT
+ /* Serial download mode */
+ if (is_usb_boot()) {
+ puts("Back to ROM, SDP\n");
+ restore_boot_params();
+ }
+#endif
+ if (spl_board_private_init()) {
+ debug("spl_board_private_init() failed\n");
+ hang();
+ }
+ 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)
+{
+ int ret;
+ /* Clear the BSS. */
+ memset(__bss_start, 0, __bss_end - __bss_start);
+
+ arch_cpu_init();
+
+ board_early_init_f();
+
+ timer_init();
+
+ preloader_console_init();
+
+ ret = spl_init();
+ if (ret) {
+ debug("spl_init() failed: %d\n", ret);
+ hang();
+ }
+
+ enable_tzc380();
+
+ setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
+
+ power_init_board();
+ /* DDR initialization */
+ spl_dram_init();
+
+ board_init_r(NULL, 0);
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ puts ("resetting ...\n");
+
+ reset_cpu(WDOG1_BASE_ADDR);
+
+ return 0;
+}
--
2.11.0
@@ -0,0 +1,53 @@
From 6bce15eb561907ce960577ca4dc2eb2a00394107 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 15:06:14 +0300
Subject: [PATCH 055/126] cpl-imx8m-mini: Set LOCALVERSION intead of
EXTRAVERSION
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
Makefile | 2 +-
configs/mcm-imx8m-mini_defconfig | 1 +
configs/ucm-imx8m-mini_defconfig | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 22d2230a6f..0451f445f6 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
VERSION = 2021
PATCHLEVEL = 04
SUBLEVEL =
-EXTRAVERSION = -mcm-imx8m-mini-1.0
+EXTRAVERSION =
NAME =
# *DOCUMENTATION*
diff --git a/configs/mcm-imx8m-mini_defconfig b/configs/mcm-imx8m-mini_defconfig
index 92cdad293d..a4c3c90f83 100644
--- a/configs/mcm-imx8m-mini_defconfig
+++ b/configs/mcm-imx8m-mini_defconfig
@@ -13,6 +13,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
CONFIG_SPL=y
CONFIG_CSF_SIZE=0x2000
CONFIG_SPL_TEXT_BASE=0x7E1000
+CONFIG_LOCALVERSION="-mcm-imx8m-mini-1.0"
CONFIG_FIT=y
CONFIG_FIT_EXTERNAL_OFFSET=0x3000
CONFIG_SPL_LOAD_FIT=y
diff --git a/configs/ucm-imx8m-mini_defconfig b/configs/ucm-imx8m-mini_defconfig
index 77b68b8e49..2c98eaa256 100644
--- a/configs/ucm-imx8m-mini_defconfig
+++ b/configs/ucm-imx8m-mini_defconfig
@@ -14,6 +14,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
CONFIG_SPL=y
CONFIG_CSF_SIZE=0x2000
CONFIG_SPL_TEXT_BASE=0x7E1000
+CONFIG_LOCALVERSION="-ucm-imx8m-mini-2.0"
CONFIG_FIT=y
CONFIG_FIT_EXTERNAL_OFFSET=0x3000
CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
--
2.11.0
@@ -0,0 +1,852 @@
From 8ce4046b2b4a29a5158e904f11c128b9c42ea5a9 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 15:46:11 +0300
Subject: [PATCH 056/126] cpl-imx8m-mini: Refactor .h configs
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
include/configs/cpl-imx8m-mini.h | 275 +++++++++++++++++++++++++++++++++++++++
include/configs/mcm-imx8m-mini.h | 265 +------------------------------------
include/configs/ucm-imx8m-mini.h | 268 +-------------------------------------
3 files changed, 277 insertions(+), 531 deletions(-)
create mode 100644 include/configs/cpl-imx8m-mini.h
diff --git a/include/configs/cpl-imx8m-mini.h b/include/configs/cpl-imx8m-mini.h
new file mode 100644
index 0000000000..dd8120f4dc
--- /dev/null
+++ b/include/configs/cpl-imx8m-mini.h
@@ -0,0 +1,275 @@
+/*
+ * Copyright 2020 CompuLab
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __CPL_IMX8M_MINI_H
+#define __CPL_IMX8M_MINI_H
+
+#include <linux/sizes.h>
+#include <asm/arch/imx-regs.h>
+#include "imx_env.h"
+
+#define CONFIG_SPL_MAX_SIZE (148 * 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
+#define CONFIG_SYS_UBOOT_BASE (QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
+
+#ifdef CONFIG_SPL_BUILD
+/*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
+#define CONFIG_SPL_WATCHDOG_SUPPORT
+#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+
+#define CONFIG_SPL_STACK 0x920000
+#define CONFIG_SPL_BSS_START_ADDR 0x910000
+#define CONFIG_SPL_BSS_MAX_SIZE SZ_8K
+#define CONFIG_SYS_SPL_MALLOC_START 0x42200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE SZ_512K
+
+/* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
+#define CONFIG_MALLOC_F_ADDR 0x912000
+
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE /* For RAW image gives a error info not panic */
+
+#undef CONFIG_DM_MMC
+#undef CONFIG_DM_PMIC
+#undef CONFIG_DM_PMIC_PFUZE100
+
+#define CONFIG_SYS_I2C
+#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_POWER
+#define CONFIG_POWER_I2C
+#define CONFIG_POWER_BD71837
+
+#endif /*ifdef CONFIG_SPL_BUILD*/
+
+#define CONFIG_CMD_READ
+#define CONFIG_SERIAL_TAG
+#define CONFIG_FASTBOOT_USB_DEV 0
+
+#define CONFIG_REMAKE_ELF
+
+#define CONFIG_BOARD_POSTCLK_INIT
+
+/* Flat Device Tree Definitions */
+#define CONFIG_OF_BOARD_SETUP
+
+#undef CONFIG_CMD_IMLS
+
+#undef CONFIG_CMD_CRC32
+#undef CONFIG_BOOTM_NETBSD
+
+/* ENET Config */
+/* ENET1 */
+#if defined(CONFIG_CMD_NET)
+#define CONFIG_ETHPRIME "FEC"
+
+#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" \
+ "emmc_dev=1\0" \
+ "sd_dev=0\0" \
+ "bootcmd_mfg=run mfgtool_args; if iminfo ${initrd_addr}; then "\
+ "booti ${loadaddr} ${initrd_addr} ${fdt_addr};"\
+ "else echo \"Run fastboot ...\"; fastboot 0; fi\0" \
+/* Initial environment variables */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ CONFIG_MFG_ENV_SETTINGS \
+ "autoload=off\0" \
+ "script=boot.scr\0" \
+ "image=Image\0" \
+ "console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200\0" \
+ "fdt_addr=0x43000000\0" \
+ "fdt_high=0xffffffffffffffff\0" \
+ "boot_fdt=yes\0" \
+ "fdt_file="CONFIG_DEFAULT_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" \
+ "root_opt=rootwait rw\0" \
+ "emmc_ul=setenv iface mmc; setenv dev 2; setenv part 1;" \
+ "setenv bootargs console=${console} root=/dev/mmcblk2p2 ${root_opt};\0" \
+ "sd_ul=setenv iface mmc; setenv dev 1; setenv part 1;" \
+ "setenv bootargs console=${console} root=/dev/mmcblk1p2 ${root_opt};\0" \
+ "usb_ul=usb start; setenv iface usb; setenv dev 0; setenv part 1;" \
+ "setenv bootargs console=${console} root=/dev/sda2 ${root_opt};\0" \
+ "ulbootscript=load ${iface} ${dev}:${part} ${loadaddr} ${script};\0" \
+ "ulimage=load ${iface} ${dev}:${part} ${loadaddr} ${image}\0" \
+ "ulfdt=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+ "load ${iface} ${dev}:${part} ${fdt_addr} ${fdt_file}; fi;\0" \
+ "bootscript=echo Running bootscript from mmc ...; " \
+ "source\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 \
+ "for src in sd_ul usb_ul emmc_ul; do " \
+ "run ${src}; " \
+ "if run ulbootscript; then " \
+ "run bootscript; " \
+ "else " \
+ "if run ulimage; then " \
+ "if run ulfdt; then " \
+ "booti ${loadaddr} - ${fdt_addr}; " \
+ "else " \
+ "if test ${boot_fdt} != yes; then " \
+ "booti ${loadaddr}; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "done; " \
+ "usb start; ums 0 mmc ${mmcdev};"
+
+/* Link Definitions */
+#define CONFIG_LOADADDR 0x40480000
+
+#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_SYS_MMC_ENV_DEV 1 /* USDHC2 */
+#define CONFIG_SYS_MMC_ENV_PART 1
+#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (2*1024) + (16*1024)) * 1024)
+
+#define PHYS_SDRAM 0x40000000
+#define PHYS_SDRAM_2 0x100000000
+#define PHYS_SDRAM_SIZE 0 /* Memory chip autodetection */
+#define PHYS_SDRAM_2_SIZE 0 /* Memory chip autodetection */
+#define CONFIG_NR_DRAM_BANKS 4
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
+
+#define MEMTEST_DIVIDER 2
+#define MEMTEST_NUMERATOR 1
+
+#define CONFIG_BAUDRATE 115200
+
+#define CONFIG_MXC_UART_BASE UART3_BASE_ADDR
+
+/* Monitor Command Prompt */
+#undef CONFIG_SYS_PROMPT
+#define CONFIG_SYS_PROMPT "u-boot=> "
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
+#define CONFIG_SYS_CBSIZE 2048
+#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_SYS_MMC_IMG_LOAD_PART 1
+
+#define CONFIG_IMX_BOOTAUX
+
+/* USDHC */
+#define CONFIG_FSL_USDHC
+
+#define CONFIG_SYS_FSL_USDHC_NUM 2
+#define CONFIG_SYS_FSL_ESDHC_ADDR 0
+
+#ifndef CONFIG_DM_I2C
+#define CONFIG_SYS_I2C
+#endif
+#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_SYS_I2C_SPEED 100000
+
+/* EEPROM */
+#define CONFIG_ENV_EEPROM_IS_ON_I2C
+#define CONFIG_SYS_I2C_EEPROM_BUS 1
+#define CONFIG_SYS_I2C_SLAVE 0x00
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
+#define CONFIG_SYS_EEPROM_SIZE 256
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
+
+/* USB configs */
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_CMD_USB
+#define CONFIG_USB_STORAGE
+#define CONFIG_USBD_HS
+
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+
+#endif
+
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
+
+#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
+
+#ifdef CONFIG_VIDEO
+#define CONFIG_VIDEO_MXS
+#define CONFIG_VIDEO_LOGO
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_16BPP
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_VIDEO_BMP_LOGO
+#define CONFIG_IMX_VIDEO_SKIP
+#define CONFIG_RM67191
+#endif
+
+#define CONFIG_BOARD_POSTCLK_INIT
+#define CONFIG_OF_BOARD_SETUP
+
+#endif
diff --git a/include/configs/mcm-imx8m-mini.h b/include/configs/mcm-imx8m-mini.h
index dd0448efca..602091a782 100644
--- a/include/configs/mcm-imx8m-mini.h
+++ b/include/configs/mcm-imx8m-mini.h
@@ -7,270 +7,7 @@
#ifndef __MCM_IMX8M_MINI_H
#define __MCM_IMX8M_MINI_H
-#include <linux/sizes.h>
-#include <asm/arch/imx-regs.h>
-#include "imx_env.h"
-
-#define CONFIG_SPL_MAX_SIZE (148 * 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
-#define CONFIG_SYS_UBOOT_BASE (QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
-
-#ifdef CONFIG_SPL_BUILD
-/*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
-#define CONFIG_SPL_WATCHDOG_SUPPORT
-#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
-#define CONFIG_SPL_I2C_SUPPORT
-#define CONFIG_SPL_LIBCOMMON_SUPPORT
-#define CONFIG_SPL_LIBGENERIC_SUPPORT
-
-#define CONFIG_SPL_STACK 0x920000
-#define CONFIG_SPL_BSS_START_ADDR 0x910000
-#define CONFIG_SPL_BSS_MAX_SIZE SZ_8K
-#define CONFIG_SYS_SPL_MALLOC_START 0x42200000
-#define CONFIG_SYS_SPL_MALLOC_SIZE SZ_512K
-
-/* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
-#define CONFIG_MALLOC_F_ADDR 0x912000
-
-#define CONFIG_SPL_ABORT_ON_RAW_IMAGE /* For RAW image gives a error info not panic */
-
-#undef CONFIG_DM_MMC
-#undef CONFIG_DM_PMIC
-#undef CONFIG_DM_PMIC_PFUZE100
-
-#define CONFIG_SYS_I2C
-#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_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_BD71837
-
-#endif /*ifdef CONFIG_SPL_BUILD*/
-
-#define CONFIG_CMD_READ
-#define CONFIG_SERIAL_TAG
-#define CONFIG_FASTBOOT_USB_DEV 0
-
-#define CONFIG_REMAKE_ELF
-
-#define CONFIG_BOARD_POSTCLK_INIT
-
-/* Flat Device Tree Definitions */
-#define CONFIG_OF_BOARD_SETUP
-
-#undef CONFIG_CMD_IMLS
-
-#undef CONFIG_CMD_CRC32
-#undef CONFIG_BOOTM_NETBSD
-
-/* ENET Config */
-/* ENET1 */
-#if defined(CONFIG_CMD_NET)
-#define CONFIG_ETHPRIME "FEC"
-
-#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" \
- "emmc_dev=1\0" \
- "sd_dev=0\0" \
- "bootcmd_mfg=run mfgtool_args; if iminfo ${initrd_addr}; then "\
- "booti ${loadaddr} ${initrd_addr} ${fdt_addr};"\
- "else echo \"Run fastboot ...\"; fastboot 0; fi\0" \
-/* Initial environment variables */
-#define CONFIG_EXTRA_ENV_SETTINGS \
- CONFIG_MFG_ENV_SETTINGS \
- "autoload=off\0" \
- "script=boot.scr\0" \
- "image=Image\0" \
- "console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200\0" \
- "fdt_addr=0x43000000\0" \
- "fdt_high=0xffffffffffffffff\0" \
- "boot_fdt=yes\0" \
- "fdt_file="CONFIG_DEFAULT_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" \
- "root_opt=rootwait rw\0" \
- "emmc_ul=setenv iface mmc; setenv dev 2; setenv part 1;" \
- "setenv bootargs console=${console} root=/dev/mmcblk2p2 ${root_opt};\0" \
- "sd_ul=setenv iface mmc; setenv dev 1; setenv part 1;" \
- "setenv bootargs console=${console} root=/dev/mmcblk1p2 ${root_opt};\0" \
- "usb_ul=usb start; setenv iface usb; setenv dev 0; setenv part 1;" \
- "setenv bootargs console=${console} root=/dev/sda2 ${root_opt};\0" \
- "ulbootscript=load ${iface} ${dev}:${part} ${loadaddr} ${script};\0" \
- "ulimage=load ${iface} ${dev}:${part} ${loadaddr} ${image}\0" \
- "ulfdt=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
- "load ${iface} ${dev}:${part} ${fdt_addr} ${fdt_file}; fi;\0" \
- "bootscript=echo Running bootscript from mmc ...; " \
- "source\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 \
- "for src in sd_ul usb_ul emmc_ul; do " \
- "run ${src}; " \
- "if run ulbootscript; then " \
- "run bootscript; " \
- "else " \
- "if run ulimage; then " \
- "if run ulfdt; then " \
- "booti ${loadaddr} - ${fdt_addr}; " \
- "else " \
- "if test ${boot_fdt} != yes; then " \
- "booti ${loadaddr}; " \
- "fi; " \
- "fi; " \
- "fi; " \
- "fi; " \
- "done; " \
- "usb start; ums 0 mmc ${mmcdev};"
-
-/* Link Definitions */
-#define CONFIG_LOADADDR 0x40480000
-
-#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_SYS_MMC_ENV_DEV 1 /* USDHC2 */
-#define CONFIG_SYS_MMC_ENV_PART 1
-#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
-
-/* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (2*1024) + (16*1024)) * 1024)
-
-#define PHYS_SDRAM 0x40000000
-#define PHYS_SDRAM_2 0x100000000
-#define PHYS_SDRAM_SIZE 0 /* Memory chip autodetection */
-#define PHYS_SDRAM_2_SIZE 0 /* Memory chip autodetection */
-#define CONFIG_NR_DRAM_BANKS 4
-#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
-
-#define MEMTEST_DIVIDER 2
-#define MEMTEST_NUMERATOR 1
-
-#define CONFIG_BAUDRATE 115200
-
-#define CONFIG_MXC_UART_BASE UART3_BASE_ADDR
-
-/* Monitor Command Prompt */
-#undef CONFIG_SYS_PROMPT
-#define CONFIG_SYS_PROMPT "u-boot=> "
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
-#define CONFIG_SYS_CBSIZE 2048
-#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_SYS_MMC_IMG_LOAD_PART 1
-
-#define CONFIG_IMX_BOOTAUX
-
-/* USDHC */
-#define CONFIG_FSL_USDHC
-
-#define CONFIG_SYS_FSL_USDHC_NUM 2
-#define CONFIG_SYS_FSL_ESDHC_ADDR 0
-
-#ifndef CONFIG_DM_I2C
-#define CONFIG_SYS_I2C
-#endif
-#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_SYS_I2C_SPEED 100000
-
-/* EEPROM */
-#define CONFIG_ENV_EEPROM_IS_ON_I2C
-#define CONFIG_SYS_I2C_EEPROM_BUS 1
-#define CONFIG_SYS_I2C_SLAVE 0x00
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
-#define CONFIG_SYS_EEPROM_SIZE 256
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
-
-/* USB configs */
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_CMD_USB
-#define CONFIG_USB_STORAGE
-#define CONFIG_USBD_HS
-
-#define CONFIG_CMD_USB_MASS_STORAGE
-#define CONFIG_USB_GADGET_MASS_STORAGE
-#define CONFIG_USB_FUNCTION_MASS_STORAGE
-
-#endif
-
-#define CONFIG_USB_GADGET_VBUS_DRAW 2
-
-#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
-
-#ifdef CONFIG_VIDEO
-#define CONFIG_VIDEO_MXS
-#define CONFIG_VIDEO_LOGO
-#define CONFIG_SPLASH_SCREEN
-#define CONFIG_SPLASH_SCREEN_ALIGN
-#define CONFIG_CMD_BMP
-#define CONFIG_BMP_16BPP
-#define CONFIG_VIDEO_BMP_RLE8
-#define CONFIG_VIDEO_BMP_LOGO
-#define CONFIG_IMX_VIDEO_SKIP
-#define CONFIG_RM67191
-#endif
-
-#define CONFIG_BOARD_POSTCLK_INIT
-#define CONFIG_OF_BOARD_SETUP
+#include "cpl-imx8m-mini.h"
#if defined(CONFIG_ANDROID_SUPPORT)
#include "mcm-imx8m-mini_android.h"
diff --git a/include/configs/ucm-imx8m-mini.h b/include/configs/ucm-imx8m-mini.h
index 75c6102f10..b3d6082a66 100644
--- a/include/configs/ucm-imx8m-mini.h
+++ b/include/configs/ucm-imx8m-mini.h
@@ -7,273 +7,7 @@
#ifndef __UCM_IMX8M_MINI_H
#define __UCM_IMX8M_MINI_H
-#include <linux/sizes.h>
-#include <asm/arch/imx-regs.h>
-#include "imx_env.h"
-
-#define CONFIG_SPL_MAX_SIZE (148 * 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
-#define CONFIG_SYS_UBOOT_BASE (QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
-
-#ifdef CONFIG_SPL_BUILD
-/*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
-#define CONFIG_SPL_WATCHDOG_SUPPORT
-#define CONFIG_SPL_DRIVERS_MISC_SUPPORT
-#define CONFIG_SPL_I2C_SUPPORT
-#define CONFIG_SPL_LIBCOMMON_SUPPORT
-#define CONFIG_SPL_LIBGENERIC_SUPPORT
-
-#define CONFIG_SPL_STACK 0x920000
-#define CONFIG_SPL_BSS_START_ADDR 0x910000
-#define CONFIG_SPL_BSS_MAX_SIZE SZ_8K
-#define CONFIG_SYS_SPL_MALLOC_START 0x42200000
-#define CONFIG_SYS_SPL_MALLOC_SIZE SZ_512K
-
-/* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
-#define CONFIG_MALLOC_F_ADDR 0x912000
-
-#define CONFIG_SPL_ABORT_ON_RAW_IMAGE /* For RAW image gives a error info not panic */
-
-#undef CONFIG_DM_MMC
-#undef CONFIG_DM_PMIC
-#undef CONFIG_DM_PMIC_PFUZE100
-
-#define CONFIG_SYS_I2C
-#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_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_BD71837
-
-#endif /*ifdef CONFIG_SPL_BUILD*/
-
-#define CONFIG_CMD_READ
-#define CONFIG_SERIAL_TAG
-#define CONFIG_FASTBOOT_USB_DEV 0
-
-#define CONFIG_REMAKE_ELF
-
-#define CONFIG_BOARD_POSTCLK_INIT
-
-/* Flat Device Tree Definitions */
-#define CONFIG_OF_BOARD_SETUP
-
-#undef CONFIG_CMD_IMLS
-
-#undef CONFIG_CMD_CRC32
-#undef CONFIG_BOOTM_NETBSD
-
-/* ENET Config */
-/* ENET1 */
-#if defined(CONFIG_CMD_NET)
-#define CONFIG_ETHPRIME "FEC"
-
-#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" \
- "emmc_dev=1\0" \
- "sd_dev=0\0" \
- "bootcmd_mfg=run mfgtool_args; if iminfo ${initrd_addr}; then "\
- "booti ${loadaddr} ${initrd_addr} ${fdt_addr};"\
- "else echo \"Run fastboot ...\"; fastboot 0; fi\0" \
-/* Initial environment variables */
-#define CONFIG_EXTRA_ENV_SETTINGS \
- CONFIG_MFG_ENV_SETTINGS \
- "autoload=off\0" \
- "script=boot.scr\0" \
- "image=Image\0" \
- "console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200\0" \
- "fdt_addr=0x43000000\0" \
- "fdt_high=0xffffffffffffffff\0" \
- "boot_fdt=yes\0" \
- "fdt_file="CONFIG_DEFAULT_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" \
- "root_opt=rootwait rw\0" \
- "emmc_ul=setenv iface mmc; setenv dev 2; setenv part 1;" \
- "setenv bootargs console=${console} root=/dev/mmcblk2p2 ${root_opt};\0" \
- "sd_ul=setenv iface mmc; setenv dev 1; setenv part 1;" \
- "setenv bootargs console=${console} root=/dev/mmcblk1p2 ${root_opt};\0" \
- "usb_ul=usb start; setenv iface usb; setenv dev 0; setenv part 1;" \
- "setenv bootargs console=${console} root=/dev/sda2 ${root_opt};\0" \
- "ulbootscript=load ${iface} ${dev}:${part} ${loadaddr} ${script};\0" \
- "ulimage=load ${iface} ${dev}:${part} ${loadaddr} ${image}\0" \
- "ulfdt=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
- "load ${iface} ${dev}:${part} ${fdt_addr} ${fdt_file}; fi;\0" \
- "bootscript=echo Running bootscript from mmc ...; " \
- "source\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 \
- "for src in sd_ul usb_ul emmc_ul; do " \
- "run ${src}; " \
- "if run ulbootscript; then " \
- "run bootscript; " \
- "else " \
- "if run ulimage; then " \
- "if run ulfdt; then " \
- "booti ${loadaddr} - ${fdt_addr}; " \
- "else " \
- "if test ${boot_fdt} != yes; then " \
- "booti ${loadaddr}; " \
- "fi; " \
- "fi; " \
- "fi; " \
- "fi; " \
- "done; " \
- "usb start; ums 0 mmc ${mmcdev};"
-
-/* Link Definitions */
-#define CONFIG_LOADADDR 0x40480000
-
-#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_SYS_MMC_ENV_DEV 1 /* USDHC2 */
-#define CONFIG_SYS_MMC_ENV_PART 1
-#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
-
-/* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN ((CONFIG_ENV_SIZE + (2*1024) + (16*1024)) * 1024)
-
-#define PHYS_SDRAM 0x40000000
-#define PHYS_SDRAM_2 0x100000000
-#define PHYS_SDRAM_SIZE 0x80000000 /* 2GB default size*/
-#undef PHYS_SDRAM_2_SIZE /* Memory chip autodetection */
-#define CONFIG_NR_DRAM_BANKS 4
-
-#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
-#define PHYS_SDRAM_SIZE 0x80000000 /* 2GB DDR */
-#define PHYS_SDRAM_2_SIZE 0x40000000
-
-#define MEMTEST_DIVIDER 2
-#define MEMTEST_NUMERATOR 1
-
-#define CONFIG_BAUDRATE 115200
-
-#define CONFIG_MXC_UART_BASE UART3_BASE_ADDR
-
-/* Monitor Command Prompt */
-#undef CONFIG_SYS_PROMPT
-#define CONFIG_SYS_PROMPT "u-boot=> "
-#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
-#define CONFIG_SYS_CBSIZE 2048
-#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_SYS_MMC_IMG_LOAD_PART 1
-
-#define CONFIG_IMX_BOOTAUX
-
-/* USDHC */
-#define CONFIG_FSL_USDHC
-
-#define CONFIG_SYS_FSL_USDHC_NUM 2
-#define CONFIG_SYS_FSL_ESDHC_ADDR 0
-
-#ifndef CONFIG_DM_I2C
-#define CONFIG_SYS_I2C
-#endif
-#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_SYS_I2C_SPEED 100000
-
-/* EEPROM */
-#define CONFIG_ENV_EEPROM_IS_ON_I2C
-#define CONFIG_SYS_I2C_EEPROM_BUS 1
-#define CONFIG_SYS_I2C_SLAVE 0x00
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
-#define CONFIG_SYS_EEPROM_SIZE 256
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
-
-/* USB configs */
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_CMD_USB
-#define CONFIG_USB_STORAGE
-#define CONFIG_USBD_HS
-
-#define CONFIG_CMD_USB_MASS_STORAGE
-#define CONFIG_USB_GADGET_MASS_STORAGE
-#define CONFIG_USB_FUNCTION_MASS_STORAGE
-
-#endif
-
-#define CONFIG_USB_GADGET_VBUS_DRAW 2
-
-#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
-
-#ifdef CONFIG_VIDEO
-#define CONFIG_VIDEO_MXS
-#define CONFIG_VIDEO_LOGO
-#define CONFIG_SPLASH_SCREEN
-#define CONFIG_SPLASH_SCREEN_ALIGN
-#define CONFIG_CMD_BMP
-#define CONFIG_BMP_16BPP
-#define CONFIG_VIDEO_BMP_RLE8
-#define CONFIG_VIDEO_BMP_LOGO
-#define CONFIG_IMX_VIDEO_SKIP
-#define CONFIG_RM67191
-#endif
-
-#define CONFIG_BOARD_POSTCLK_INIT
-#define CONFIG_OF_BOARD_SETUP
+#include "cpl-imx8m-mini.h"
#if defined(CONFIG_ANDROID_SUPPORT)
#include "ucm-imx8m-mini_android.h"
--
2.11.0
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,577 @@
From 684d387f307b2d6259e528eb6785d8cdead52ba5 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Mon, 19 Jul 2021 15:52:47 +0300
Subject: [PATCH 058/126] iot-gate-imx8: Add basic support
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
arch/arm/dts/Makefile | 1 +
arch/arm/dts/iot-gate-imx8.dts | 49 +++++
arch/arm/mach-imx/imx8m/Kconfig | 7 +
board/compulab/iot-gate-imx8/Kconfig | 17 ++
board/compulab/iot-gate-imx8/Makefile | 15 ++
board/compulab/iot-gate-imx8/iot-gate-imx8.c | 265 +++++++++++++++++++++++++++
board/compulab/iot-gate-imx8/spl.c | 8 +
configs/iot-gate-imx8_defconfig | 102 +++++++++++
include/configs/iot-gate-imx8.h | 15 ++
9 files changed, 479 insertions(+)
create mode 100644 arch/arm/dts/iot-gate-imx8.dts
create mode 100644 board/compulab/iot-gate-imx8/Kconfig
create mode 100644 board/compulab/iot-gate-imx8/Makefile
create mode 100644 board/compulab/iot-gate-imx8/iot-gate-imx8.c
create mode 100644 board/compulab/iot-gate-imx8/spl.c
create mode 100644 configs/iot-gate-imx8_defconfig
create mode 100644 include/configs/iot-gate-imx8.h
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index c6b54163d0..1fc99ed1c9 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -890,6 +890,7 @@ dtb-$(CONFIG_ARCH_IMX8ULP) += imx8ulp-evk.dtb imx8ulp-evk-i3c.dtb
dtb-$(CONFIG_TARGET_UCM_IMX8M_MINI) += ucm-imx8m-mini.dtb
dtb-$(CONFIG_TARGET_MCM_IMX8M_MINI) += mcm-imx8m-mini.dtb
+dtb-$(CONFIG_TARGET_IOT_GATE_IMX8) += iot-gate-imx8.dtb
dtb-$(CONFIG_RCAR_GEN2) += \
r8a7790-lager-u-boot.dtb \
diff --git a/arch/arm/dts/iot-gate-imx8.dts b/arch/arm/dts/iot-gate-imx8.dts
new file mode 100644
index 0000000000..6b6b2d69c7
--- /dev/null
+++ b/arch/arm/dts/iot-gate-imx8.dts
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2020 CompuLab
+ *
+ * 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/;
+
+#include "cpl-imx8m-mini.dtsi"
+
+/ {
+ model = "CompuLab IOT-GATE-iMX8";
+ compatible = "sb-iotgimx8", "cpl,ucm-imx8m-mini", "fsl,imx8mm-evk", "fsl,imx8mm";
+
+ reg_vusb_5v: regulator-usdhc2 {
+ compatible = "regulator-fixed";
+ regulator-name = "VUSB_5V";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ gpio = <&gpio4 28 GPIO_ACTIVE_HIGH>;
+ regulator-boot-on;
+ enable-active-high;
+ };
+};
+
+&usbotg1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctl_usb_gpio>;
+ dr_mode = "host";
+ status = "okay";
+};
+
+&iomuxc {
+ sb-iotgimx8 {
+ pinctl_usb_gpio: usb_gpio_grp {
+ fsl,pins = <
+ MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28 0x00
+ >;
+ };
+ };
+};
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index a38ec31d25..3102155bc1 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -272,6 +272,12 @@ config TARGET_MCM_IMX8M_MINI
select SUPPORT_SPL
select IMX8M_LPDDR4
+config TARGET_IOT_GATE_IMX8
+ bool "CompuLab iot-gate-imx8"
+ select IMX8MM
+ select SUPPORT_SPL
+ select IMX8M_LPDDR4
+
endchoice
source "board/freescale/imx8mq_evk/Kconfig"
@@ -291,5 +297,6 @@ source "board/phytec/phycore_imx8mm/Kconfig"
source "board/phytec/phycore_imx8mp/Kconfig"
source "board/compulab/ucm-imx8m-mini/Kconfig"
source "board/compulab/mcm-imx8m-mini/Kconfig"
+source "board/compulab/iot-gate-imx8/Kconfig"
endif
diff --git a/board/compulab/iot-gate-imx8/Kconfig b/board/compulab/iot-gate-imx8/Kconfig
new file mode 100644
index 0000000000..84f53ca6b9
--- /dev/null
+++ b/board/compulab/iot-gate-imx8/Kconfig
@@ -0,0 +1,17 @@
+if TARGET_IOT_GATE_IMX8
+
+config SYS_BOARD
+ default "iot-gate-imx8"
+
+config SYS_VENDOR
+ default "compulab"
+
+config SYS_CONFIG_NAME
+ default "iot-gate-imx8"
+
+config DEFAULT_DTB
+ string "U-Boot Default Device Tree File"
+ depends on TARGET_IOT_GATE_IMX8
+ default "sb-iotgimx8-can.dtb"
+
+endif
diff --git a/board/compulab/iot-gate-imx8/Makefile b/board/compulab/iot-gate-imx8/Makefile
new file mode 100644
index 0000000000..af743b977b
--- /dev/null
+++ b/board/compulab/iot-gate-imx8/Makefile
@@ -0,0 +1,15 @@
+#
+# Copyright 2018 CompuLab
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ccflags-y += -I$(srctree)/board/compulab/plat/imx8mm/
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+else
+obj-y += iot-gate-imx8.o
+endif
+
+obj-y += ../plat/imx8mm/
diff --git a/board/compulab/iot-gate-imx8/iot-gate-imx8.c b/board/compulab/iot-gate-imx8/iot-gate-imx8.c
new file mode 100644
index 0000000000..d01b8f8767
--- /dev/null
+++ b/board/compulab/iot-gate-imx8/iot-gate-imx8.c
@@ -0,0 +1,265 @@
+/*
+ * Copyright 2020 CompuLab
+ *
+ * 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/imx8mm_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 <asm/mach-imx/dma.h>
+#include <power/pmic.h>
+#include <power/bd71837.h>
+#include "../common/eeprom.h"
+#include <usb.h>
+#include <asm/mach-imx/boot_mode.h>
+#include <asm/mach-imx/video.h>
+#include "ddr/ddr.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_BOARD_POSTCLK_INIT
+int board_postclk_init(void)
+{
+ /* TODO */
+ return 0;
+}
+#endif
+int board_phys_sdram_size(phys_size_t *size)
+{
+ struct lpddr4_tcm_desc *lpddr4_tcm_desc = (struct lpddr4_tcm_desc *) TCM_DATA_CFG;
+
+ switch (lpddr4_tcm_desc->size) {
+ case 4096:
+ case 2048:
+ case 1024:
+ *size = (1L << 20) * lpddr4_tcm_desc->size;
+ break;
+ default:
+ printf("%s: DRAM size %uM is not supported \n", __func__,
+ lpddr4_tcm_desc->size);
+ while ( 1 ) {};
+ break;
+ };
+ return 0;
+}
+ /* Get the top of usable RAM */
+ulong board_get_usable_ram_top(ulong total_size)
+{
+
+ if(gd->ram_top > 0x100000000)
+ gd->ram_top = 0x100000000;
+
+ return gd->ram_top;
+}
+
+int dram_init(void)
+{
+ phys_size_t sdram_size;
+ int ret;
+ ret = board_phys_sdram_size(&sdram_size);
+ printf("%s: size %llu\n", __func__, sdram_size);
+ if (ret)
+ return ret;
+
+ /* rom_pointer[1] contains the size of TEE occupies */
+ gd->ram_size = sdram_size - rom_pointer[1];
+
+ return 0;
+}
+
+#ifdef CONFIG_OF_BOARD_SETUP
+int ft_board_setup(void *blob, bd_t *bd)
+{
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_FEC_MXC
+#define FEC_RST_PAD IMX_GPIO_NR(1, 10)
+static iomux_v3_cfg_t const fec1_rst_pads[] = {
+ IMX8MM_PAD_GPIO1_IO10_GPIO1_IO10 | 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(FEC_RST_PAD, "fec1_rst");
+ gpio_direction_output(FEC_RST_PAD, 0);
+ udelay(500);
+ gpio_direction_output(FEC_RST_PAD, 1);
+}
+
+/*
+ * setup_mac_address() - set Ethernet MAC address environment.
+ *
+ * @return: 0 on success, -1 on failure
+ */
+static int setup_mac_address(void)
+{
+ int ret;
+ unsigned char enetaddr[6];
+
+ ret = eth_env_get_enetaddr("ethaddr", enetaddr);
+ if (ret)
+ return 0;
+
+ ret = cl_eeprom_read_mac_addr(enetaddr, CONFIG_SYS_I2C_EEPROM_BUS);
+ if (ret)
+ return ret;
+
+ ret = is_valid_ethaddr(enetaddr);
+ if (!ret)
+ return -1;
+
+ ret = eth_env_set_enetaddr("ethaddr", enetaddr);
+ if (ret)
+ return -1;
+
+ return 0;
+}
+
+static int setup_fec(void)
+{
+ struct iomuxc_gpr_base_regs *const iomuxc_gpr_regs
+ = (struct iomuxc_gpr_base_regs *) IOMUXC_GPR_BASE_ADDR;
+
+ setup_iomux_fec();
+
+ /* Use 125M anatop REF_CLK1 for ENET1, not from external */
+ clrsetbits_le32(&iomuxc_gpr_regs->gpr[1],
+ IOMUXC_GPR_GPR1_GPR_ENET1_TX_CLK_SEL_SHIFT, 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, 0x00);
+ phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee);
+ 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_usb_init(int index, enum usb_init_type init)
+{
+ debug("board_usb_init %d, type %d\n", index, init);
+
+ imx8m_usb_power(index, true);
+
+ return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+ debug("board_usb_cleanup %d, type %d\n", index, init);
+
+ imx8m_usb_power(index, false);
+
+ return 0;
+}
+int board_init(void)
+{
+
+#ifdef CONFIG_FEC_MXC
+ setup_fec();
+#endif
+ return 0;
+}
+
+int board_mmc_get_env_dev(int devno)
+{
+ const ulong user_env_devno = env_get_hex("env_dev", ULONG_MAX);
+ if (user_env_devno != ULONG_MAX) {
+ printf("User Environment dev# is (%lu)\n", user_env_devno);
+ return (int)user_env_devno;
+ }
+ return devno;
+}
+
+static int _mmc_get_env_part(void)
+{
+ const ulong user_env_part = env_get_hex("env_part", ULONG_MAX);
+ if (user_env_part != ULONG_MAX) {
+ printf("User Environment part# is (%lu)\n", user_env_part);
+ return (int)user_env_part;
+ }
+ return CONFIG_SYS_MMC_ENV_PART;
+}
+
+uint mmc_get_env_part(struct mmc *mmc)
+{
+ if (mmc->part_support)
+ return _mmc_get_env_part();
+
+ return 0;
+}
+
+int mmc_map_to_kernel_blk(int devno){
+ return devno;
+}
+
+static void board_bootdev_init(void)
+{
+ u32 bootdev = get_boot_device();
+ switch (bootdev) {
+ case MMC3_BOOT:
+ bootdev = 2;
+ break;
+ case SD2_BOOT:
+ bootdev = 1;
+ break;
+ default:
+ env_set("bootdev", NULL);
+ return;
+ }
+ env_set_ulong("bootdev", bootdev);
+}
+
+int board_late_init(void)
+{
+ int ret;
+
+#ifdef CONFIG_ENV_IS_IN_MMC
+ board_late_mmc_env_init();
+ board_bootdev_init();
+#endif
+
+ ret = setup_mac_address();
+ if (ret < 0)
+ printf("%s: Can't set MAC address\n", __func__);
+
+ return 0;
+}
+
+#ifdef CONFIG_FSL_FASTBOOT
+#ifdef CONFIG_ANDROID_RECOVERY
+int is_recovery_key_pressing(void)
+{
+ return 0; /*TODO*/
+}
+#endif /*CONFIG_ANDROID_RECOVERY*/
+#endif /*CONFIG_FSL_FASTBOOT*/
diff --git a/board/compulab/iot-gate-imx8/spl.c b/board/compulab/iot-gate-imx8/spl.c
new file mode 100644
index 0000000000..6488770333
--- /dev/null
+++ b/board/compulab/iot-gate-imx8/spl.c
@@ -0,0 +1,8 @@
+#include <asm/io.h>
+#include <asm/mach-imx/iomux-v3.h>
+#include <asm/arch/imx8mm_pins.h>
+#include <asm/arch/clock.h>
+
+int spl_board_private_init(void) {
+ return 0;
+}
diff --git a/configs/iot-gate-imx8_defconfig b/configs/iot-gate-imx8_defconfig
new file mode 100644
index 0000000000..39c448eca0
--- /dev/null
+++ b/configs/iot-gate-imx8_defconfig
@@ -0,0 +1,102 @@
+CONFIG_ARM=y
+CONFIG_SPL_SYS_ICACHE_OFF=y
+CONFIG_SPL_SYS_DCACHE_OFF=y
+CONFIG_ARCH_IMX8M=y
+CONFIG_SYS_TEXT_BASE=0x40200000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_OFFSET=0x4400
+CONFIG_DM_GPIO=y
+CONFIG_TARGET_IOT_GATE_IMX8=y
+CONFIG_DEFAULT_DTB="sb-iotgimx8-can.dtb"
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL=y
+CONFIG_CSF_SIZE=0x2000
+CONFIG_SPL_TEXT_BASE=0x7E1000
+CONFIG_LOCALVERSION="-iot-gate-imx8-1.0"
+CONFIG_FIT=y
+CONFIG_FIT_EXTERNAL_OFFSET=0x3000
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+CONFIG_OF_SYSTEM_SETUP=y
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg"
+CONFIG_CONSOLE_MUX=y
+CONFIG_DEFAULT_FDT_FILE="sb-iotgimx8-can.dtb"
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_ARCH_MISC_INIT=y
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_SEPARATE_BSS=y
+CONFIG_SPL_POWER_SUPPORT=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="u-boot=> "
+# CONFIG_BOOTM_NETBSD is not set
+CONFIG_CMD_EEPROM=y
+CONFIG_CMD_EEPROM_LAYOUT=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_FUSE=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_EFI_PARTITION=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="iot-gate-imx8"
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK_COMPOSITE_CCF=y
+CONFIG_CLK_IMX8MM=y
+CONFIG_MXC_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_MXC=y
+CONFIG_DM_MMC=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_MMC_IO_VOLTAGE=y
+CONFIG_MMC_UHS_SUPPORT=y
+CONFIG_MMC_HS400_ES_SUPPORT=y
+CONFIG_MMC_HS400_SUPPORT=y
+CONFIG_FSL_ESDHC_IMX=y
+CONFIG_DM_ETH=y
+CONFIG_FEC_MXC=y
+CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX8M=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RESET=y
+CONFIG_MXC_UART=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_PSCI=y
+CONFIG_DM_THERMAL=y
+CONFIG_NXP_TMU=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_SDP_LOADADDR=0x40400000
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_EXT4_WRITE=y
+CONFIG_FAT_WRITE=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_EFI_LOADER is not set
diff --git a/include/configs/iot-gate-imx8.h b/include/configs/iot-gate-imx8.h
new file mode 100644
index 0000000000..b3d6082a66
--- /dev/null
+++ b/include/configs/iot-gate-imx8.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2020 CompuLab
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __UCM_IMX8M_MINI_H
+#define __UCM_IMX8M_MINI_H
+
+#include "cpl-imx8m-mini.h"
+
+#if defined(CONFIG_ANDROID_SUPPORT)
+#include "ucm-imx8m-mini_android.h"
+#endif
+#endif
--
2.11.0
@@ -0,0 +1,28 @@
From 94829c14ef32f7d41ac3b5b5efee763c549ff196 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 15 Jul 2020 15:25:04 +0300
Subject: [PATCH 059/126] mcm-imx8m-mini: config: Update env size/offest
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
configs/mcm-imx8m-mini_defconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configs/mcm-imx8m-mini_defconfig b/configs/mcm-imx8m-mini_defconfig
index a4c3c90f83..971e1ec982 100644
--- a/configs/mcm-imx8m-mini_defconfig
+++ b/configs/mcm-imx8m-mini_defconfig
@@ -4,8 +4,8 @@ CONFIG_SPL_SYS_DCACHE_OFF=y
CONFIG_ARCH_IMX8M=y
CONFIG_SYS_TEXT_BASE=0x40200000
CONFIG_SPL_GPIO_SUPPORT=y
-CONFIG_ENV_SIZE=0x4000
-CONFIG_ENV_OFFSET=0x1000
+CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_OFFSET=0x4400
CONFIG_DM_GPIO=y
CONFIG_TARGET_MCM_IMX8M_MINI=y
CONFIG_SPL_MMC_SUPPORT=y
--
2.11.0
@@ -0,0 +1,29 @@
From e94a6f8fef7c25d00a41f791ab16813fc760c392 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 15 Jul 2020 15:27:37 +0300
Subject: [PATCH 060/126] imx8m-mini: env: config: Update size/offset value
Update size/offset value for CompuLab imx8m-mini boards
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
tools/env/fw_env.config | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/env/fw_env.config b/tools/env/fw_env.config
index 3222fd715c..988ef9f728 100644
--- a/tools/env/fw_env.config
+++ b/tools/env/fw_env.config
@@ -6,6 +6,6 @@
# be the same as the Environment size, which is valid for NOR and SPI-dataflash
# Device offset must be prefixed with 0x to be parsed as a hexadecimal value.
-# Block device for mcm-imx8m-mini
-/dev/mmcblk2boot0 0x1000 0x4000
-#/dev/mmcblk1 0x1000 0x4000
+# Block devices for CompuLab imx8m-mini
+/dev/mmcblk2boot0 0x4400 0x1000
+#/dev/mmcblk1 0x4400 0x1000
--
2.11.0
@@ -0,0 +1,123 @@
From 663f170f28034023bbd13d6c4359be43719862e7 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Fri, 17 Jul 2020 18:59:22 +0300
Subject: [PATCH 061/126] imx8: eeprom: Move to the imx8 platform independent
folder
Move the eeprom code the imx8 platform independent folder.
The same code gets used by all CompuLab imx8 boards.
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/iot-gate-imx8/Makefile | 2 ++
board/compulab/mcm-imx8m-mini/Makefile | 2 ++
board/compulab/plat/imx8/Makefile | 1 +
board/compulab/plat/{imx8mm => imx8}/eeprom/Makefile | 0
board/compulab/plat/{imx8mm => imx8}/eeprom/eeprom.c | 0
board/compulab/plat/{imx8mm => imx8}/eeprom/eeprom.h | 0
board/compulab/plat/{imx8mm => imx8}/eeprom/eeprom_spl.c | 1 +
board/compulab/plat/imx8mm/Makefile | 1 -
board/compulab/ucm-imx8m-mini/Makefile | 2 ++
9 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 board/compulab/plat/imx8/Makefile
rename board/compulab/plat/{imx8mm => imx8}/eeprom/Makefile (100%)
rename board/compulab/plat/{imx8mm => imx8}/eeprom/eeprom.c (100%)
rename board/compulab/plat/{imx8mm => imx8}/eeprom/eeprom.h (100%)
rename board/compulab/plat/{imx8mm => imx8}/eeprom/eeprom_spl.c (99%)
diff --git a/board/compulab/iot-gate-imx8/Makefile b/board/compulab/iot-gate-imx8/Makefile
index af743b977b..e5239d1dbb 100644
--- a/board/compulab/iot-gate-imx8/Makefile
+++ b/board/compulab/iot-gate-imx8/Makefile
@@ -5,6 +5,7 @@
#
ccflags-y += -I$(srctree)/board/compulab/plat/imx8mm/
+ccflags-y += -I$(srctree)/board/compulab/plat/imx8/
ifdef CONFIG_SPL_BUILD
obj-y += spl.o
@@ -13,3 +14,4 @@ obj-y += iot-gate-imx8.o
endif
obj-y += ../plat/imx8mm/
+obj-y += ../plat/imx8/
diff --git a/board/compulab/mcm-imx8m-mini/Makefile b/board/compulab/mcm-imx8m-mini/Makefile
index 9ce2875d6e..2cadd46fb8 100644
--- a/board/compulab/mcm-imx8m-mini/Makefile
+++ b/board/compulab/mcm-imx8m-mini/Makefile
@@ -5,6 +5,7 @@
#
ccflags-y += -I$(srctree)/board/compulab/plat/imx8mm/
+ccflags-y += -I$(srctree)/board/compulab/plat/imx8/
ifdef CONFIG_SPL_BUILD
obj-y += spl.o
@@ -13,3 +14,4 @@ obj-y += mcm-imx8m-mini.o
endif
obj-y += ../plat/imx8mm/
+obj-y += ../plat/imx8/
diff --git a/board/compulab/plat/imx8/Makefile b/board/compulab/plat/imx8/Makefile
new file mode 100644
index 0000000000..9d3044cb9e
--- /dev/null
+++ b/board/compulab/plat/imx8/Makefile
@@ -0,0 +1 @@
+obj-y += eeprom/
diff --git a/board/compulab/plat/imx8mm/eeprom/Makefile b/board/compulab/plat/imx8/eeprom/Makefile
similarity index 100%
rename from board/compulab/plat/imx8mm/eeprom/Makefile
rename to board/compulab/plat/imx8/eeprom/Makefile
diff --git a/board/compulab/plat/imx8mm/eeprom/eeprom.c b/board/compulab/plat/imx8/eeprom/eeprom.c
similarity index 100%
rename from board/compulab/plat/imx8mm/eeprom/eeprom.c
rename to board/compulab/plat/imx8/eeprom/eeprom.c
diff --git a/board/compulab/plat/imx8mm/eeprom/eeprom.h b/board/compulab/plat/imx8/eeprom/eeprom.h
similarity index 100%
rename from board/compulab/plat/imx8mm/eeprom/eeprom.h
rename to board/compulab/plat/imx8/eeprom/eeprom.h
diff --git a/board/compulab/plat/imx8mm/eeprom/eeprom_spl.c b/board/compulab/plat/imx8/eeprom/eeprom_spl.c
similarity index 99%
rename from board/compulab/plat/imx8mm/eeprom/eeprom_spl.c
rename to board/compulab/plat/imx8/eeprom/eeprom_spl.c
index 09a04fda92..f25493b1ee 100644
--- a/board/compulab/plat/imx8mm/eeprom/eeprom_spl.c
+++ b/board/compulab/plat/imx8/eeprom/eeprom_spl.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <i2c.h>
#include <linux/kernel.h>
+#include <linux/delay.h>
#include <asm/arch/imx8mq_pins.h>
#include <asm/mach-imx/gpio.h>
#include <asm-generic/gpio.h>
diff --git a/board/compulab/plat/imx8mm/Makefile b/board/compulab/plat/imx8mm/Makefile
index 2f68e0523e..33b3fedef9 100644
--- a/board/compulab/plat/imx8mm/Makefile
+++ b/board/compulab/plat/imx8mm/Makefile
@@ -1,3 +1,2 @@
obj-y += ddr/
-obj-y += eeprom/
obj-y += spl/
diff --git a/board/compulab/ucm-imx8m-mini/Makefile b/board/compulab/ucm-imx8m-mini/Makefile
index dbde2116cd..870792441c 100644
--- a/board/compulab/ucm-imx8m-mini/Makefile
+++ b/board/compulab/ucm-imx8m-mini/Makefile
@@ -5,6 +5,7 @@
#
ccflags-y += -I$(srctree)/board/compulab/plat/imx8mm/
+ccflags-y += -I$(srctree)/board/compulab/plat/imx8/
ifdef CONFIG_SPL_BUILD
obj-y += spl.o
@@ -13,3 +14,4 @@ obj-y += ucm-imx8m-mini.o
endif
obj-y += ../plat/imx8mm/
+obj-y += ../plat/imx8/
--
2.11.0
@@ -0,0 +1,285 @@
From bac8699e303c75526c30e3e850601c39944dad8a Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Sat, 18 Jul 2020 13:02:39 +0300
Subject: [PATCH 062/126] imx8: eeprom: Remove duplicated code
Remove duplicated code.
Leave the i2c spl helper only for use in the ddr discovery.
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/plat/imx8/eeprom/Makefile | 4 -
board/compulab/plat/imx8/eeprom/eeprom.c | 192 ---------------------------
board/compulab/plat/imx8/eeprom/eeprom.h | 30 -----
board/compulab/plat/imx8/eeprom/eeprom_spl.c | 5 +-
4 files changed, 4 insertions(+), 227 deletions(-)
delete mode 100644 board/compulab/plat/imx8/eeprom/eeprom.c
delete mode 100644 board/compulab/plat/imx8/eeprom/eeprom.h
diff --git a/board/compulab/plat/imx8/eeprom/Makefile b/board/compulab/plat/imx8/eeprom/Makefile
index 9ec4d29dc1..62ee6de6fa 100644
--- a/board/compulab/plat/imx8/eeprom/Makefile
+++ b/board/compulab/plat/imx8/eeprom/Makefile
@@ -1,5 +1 @@
-ifdef CONFIG_SPL_BUILD
obj-y += eeprom_spl.o
-else
-obj-y += eeprom.o
-endif
diff --git a/board/compulab/plat/imx8/eeprom/eeprom.c b/board/compulab/plat/imx8/eeprom/eeprom.c
deleted file mode 100644
index fd1fa49e21..0000000000
--- a/board/compulab/plat/imx8/eeprom/eeprom.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <dm.h>
-#include <i2c.h>
-#include <eeprom_layout.h>
-#include <eeprom_field.h>
-#include <linux/kernel.h>
-#include <asm/setup.h>
-
-#ifndef CONFIG_SYS_I2C_EEPROM_ADDR
-#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
-#endif
-
-#ifndef CONFIG_SYS_I2C_EEPROM_BUS
-#define CONFIG_SYS_I2C_EEPROM_BUS 1
-#endif
-
-#define EEPROM_LAYOUT_VER_OFFSET 44
-#define BOARD_SERIAL_OFFSET 20
-#define BOARD_SERIAL_OFFSET_LEGACY 8
-#define BOARD_REV_OFFSET 0
-#define BOARD_REV_OFFSET_LEGACY 6
-#define BOARD_REV_SIZE 2
-#define PRODUCT_NAME_OFFSET 128
-#define PRODUCT_NAME_SIZE 16
-#define MAC_ADDR_OFFSET 4
-#define MAC_ADDR_OFFSET_LEGACY 0
-
-#define LAYOUT_INVALID 0
-#define LAYOUT_LEGACY 0xff
-
-static int cpl_eeprom_bus;
-static int cpl_eeprom_layout;
-
-static struct udevice *g_dev = NULL;
-
-static int cpl_eeprom_init(void) {
-
- int i2c_bus = CONFIG_SYS_I2C_EEPROM_BUS;
- uint8_t chip = CONFIG_SYS_I2C_EEPROM_ADDR;
-
- struct udevice *bus, *dev;
- int ret;
-
- if (!g_dev) {
-
- ret = uclass_get_device_by_seq(UCLASS_I2C, i2c_bus, &bus);
- if (ret) {
- printf("%s: No bus %d\n", __func__, i2c_bus);
- return ret;
- }
-
- ret = dm_i2c_probe(bus, chip, 0, &dev);
- if (ret) {
- printf("%s: Can't find device id=0x%x, on bus %d\n",
- __func__, chip, i2c_bus);
- return ret;
- }
-
- /* Init */
- g_dev = dev;
- }
-
- return 0;
-}
-
-static int cpl_eeprom_read(uint offset, uchar *buf, int len)
-{
- int res;
-
- res = cpl_eeprom_init();
- if (res < 0)
- return res;
-
- res = dm_i2c_read(g_dev, offset, buf, len);
-
- return res;
-}
-
-
-static int cpl_eeprom_setup(uint eeprom_bus)
-{
- int res;
-
- /*
- * We know the setup was already done when the layout is set to a valid
- * value and we're using the same bus as before.
- */
- if (cpl_eeprom_layout != LAYOUT_INVALID && eeprom_bus == cpl_eeprom_bus)
- return 0;
-
- cpl_eeprom_bus = eeprom_bus;
- res = cpl_eeprom_read(EEPROM_LAYOUT_VER_OFFSET,
- (uchar *)&cpl_eeprom_layout, 1);
-
- if (res) {
- cpl_eeprom_layout = LAYOUT_INVALID;
- return res;
- }
-
- if (cpl_eeprom_layout == 0 || cpl_eeprom_layout >= 0x20)
- cpl_eeprom_layout = LAYOUT_LEGACY;
-
- return 0;
-}
-
-/*
- * Routine: cpl_eeprom_read_mac_addr
- * Description: read mac address and store it in buf.
- */
-int cpl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
-{
- uint offset;
- int err;
-
- err = cpl_eeprom_setup(eeprom_bus);
- if (err)
- return err;
-
- offset = (cpl_eeprom_layout != LAYOUT_LEGACY) ?
- MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
-
- return cpl_eeprom_read(offset, buf, 6);
-}
-
-static u32 board_rev;
-
-/*
- * Routine: cpl_eeprom_get_board_rev
- * Description: read system revision from eeprom
- */
-u32 cpl_eeprom_get_board_rev(uint eeprom_bus)
-{
- char str[5]; /* Legacy representation can contain at most 4 digits */
- uint offset = BOARD_REV_OFFSET_LEGACY;
-
- if (board_rev)
- return board_rev;
-
- if (cpl_eeprom_setup(eeprom_bus))
- return 0;
-
- if (cpl_eeprom_layout != LAYOUT_LEGACY)
- offset = BOARD_REV_OFFSET;
-
- if (cpl_eeprom_read(offset, (uchar *)&board_rev, BOARD_REV_SIZE))
- return 0;
-
- /*
- * Convert legacy syntactic representation to semantic
- * representation. i.e. for rev 1.00: 0x100 --> 0x64
- */
- if (cpl_eeprom_layout == LAYOUT_LEGACY) {
- sprintf(str, "%x", board_rev);
- board_rev = simple_strtoul(str, NULL, 10);
- }
-
- return board_rev;
-};
-
-/*
- * Routine: cpl_eeprom_get_board_rev
- * Description: read system revision from eeprom
- *
- * @buf: buffer to store the product name
- * @eeprom_bus: i2c bus num of the eeprom
- *
- * @return: 0 on success, < 0 on failure
- */
-int cpl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
-{
- int err;
-
- if (buf == NULL)
- return -EINVAL;
-
- err = cpl_eeprom_setup(eeprom_bus);
- if (err)
- return err;
-
- err = cpl_eeprom_read(PRODUCT_NAME_OFFSET, buf, PRODUCT_NAME_SIZE);
- if (!err) /* Protect ourselves from invalid data (unterminated str) */
- buf[PRODUCT_NAME_SIZE - 1] = '\0';
-
- return err;
-}
diff --git a/board/compulab/plat/imx8/eeprom/eeprom.h b/board/compulab/plat/imx8/eeprom/eeprom.h
deleted file mode 100644
index 9de4aadd43..0000000000
--- a/board/compulab/plat/imx8/eeprom/eeprom.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef _EEPROM_
-#define _EEPROM_
-#include <errno.h>
-
-#ifdef CONFIG_DM_I2C
-int cpl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
-u32 cpl_eeprom_get_board_rev(uint eeprom_bus);
-int cpl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
-#else
-static inline int cpl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
-{
- return 1;
-}
-static inline u32 cpl_eeprom_get_board_rev(uint eeprom_bus)
-{
- return 0;
-}
-static inline int cpl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
-{
- return -ENOSYS;
-}
-#endif
-
-#endif
diff --git a/board/compulab/plat/imx8/eeprom/eeprom_spl.c b/board/compulab/plat/imx8/eeprom/eeprom_spl.c
index f25493b1ee..79b2e29c63 100644
--- a/board/compulab/plat/imx8/eeprom/eeprom_spl.c
+++ b/board/compulab/plat/imx8/eeprom/eeprom_spl.c
@@ -12,7 +12,8 @@
#include <asm/mach-imx/gpio.h>
#include <asm-generic/gpio.h>
#include <asm/setup.h>
-#include "eeprom.h"
+
+#ifdef CONFIG_SPL_BUILD
#define CONFIG_SYS_I2C_EEPROM_ADDR_P1 0x51
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
@@ -146,3 +147,5 @@ u32 cl_eeprom_set_osize(u32 osize)
return board_osize;
};
+
+#endif
--
2.11.0
@@ -0,0 +1,100 @@
From eb1947cb1550fdcb8e41364f2e9b3e9deab974b5 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Mon, 20 Jul 2020 06:08:58 +0300
Subject: [PATCH 064/126] imx8m-mini: Refactor the usdhc2
1) Make it removable.
2) Disable 1V8.
3) Fix the card detect in spl and u-boot.
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
arch/arm/dts/cpl-imx8m-mini.dtsi | 5 +++--
board/compulab/plat/imx8mm/spl/spl.c | 26 ++++----------------------
2 files changed, 7 insertions(+), 24 deletions(-)
diff --git a/arch/arm/dts/cpl-imx8m-mini.dtsi b/arch/arm/dts/cpl-imx8m-mini.dtsi
index 3fe1e7ac5f..4f9c5fbfb9 100644
--- a/arch/arm/dts/cpl-imx8m-mini.dtsi
+++ b/arch/arm/dts/cpl-imx8m-mini.dtsi
@@ -125,7 +125,7 @@
pinctrl_usdhc2_gpio: usdhc2grpgpio {
fsl,pins = <
- MX8MM_IOMUXC_SD2_RESET_B_GPIO2_IO19 0x41
+ MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x41
MX8MM_IOMUXC_SD2_WP_USDHC2_WP 0
>;
};
@@ -426,10 +426,11 @@
pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
pinctrl-1 = <&pinctrl_usdhc2_100mhz>, <&pinctrl_usdhc2_gpio>;
pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
+ cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
bus-width = <4>;
fsl,wp-controller;
- non-removable;
vmmc-supply = <&reg_usdhc2_vmmc>;
+ no-1-8-v;
status = "okay";
};
diff --git a/board/compulab/plat/imx8mm/spl/spl.c b/board/compulab/plat/imx8mm/spl/spl.c
index 50aa6bea3f..643093aaf9 100644
--- a/board/compulab/plat/imx8mm/spl/spl.c
+++ b/board/compulab/plat/imx8mm/spl/spl.c
@@ -55,7 +55,7 @@ struct i2c_pads_info i2c_pad_info1 = {
},
};
-#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 18)
+#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 12)
#define USDHC2_PWR_GPIO IMX_GPIO_NR(2, 19)
#define USDHC_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE |PAD_CTL_PE | \
@@ -83,20 +83,9 @@ static iomux_v3_cfg_t const usdhc2_pads[] = {
IMX8MM_PAD_SD2_DATA2_USDHC2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
IMX8MM_PAD_SD2_DATA3_USDHC2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
IMX8MM_PAD_SD2_RESET_B_GPIO2_IO19 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL),
+ IMX8MM_PAD_SD2_CD_B_GPIO2_IO12 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL),
};
-/*
- * The evk board uses DAT3 to detect CD card plugin,
- * in u-boot we mux the pin to GPIO when doing board_mmc_getcd.
- */
-static iomux_v3_cfg_t const usdhc2_cd_pad =
- IMX8MM_PAD_SD2_DATA3_GPIO2_IO18 | MUX_PAD_CTRL(USDHC_GPIO_PAD_CTRL);
-
-static iomux_v3_cfg_t const usdhc2_dat3_pad =
- IMX8MM_PAD_SD2_DATA3_USDHC2_DATA3 |
- MUX_PAD_CTRL(USDHC_PAD_CTRL);
-
-
static struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC2_BASE_ADDR, 0, 4},
{USDHC3_BASE_ADDR, 0, 8},
@@ -153,18 +142,11 @@ int board_mmc_getcd(struct mmc *mmc)
ret = 1;
break;
case USDHC2_BASE_ADDR:
- imx_iomux_v3_setup_pad(usdhc2_cd_pad);
gpio_request(USDHC2_CD_GPIO, "usdhc2 cd");
gpio_direction_input(USDHC2_CD_GPIO);
-
- /*
- * Since it is the DAT3 pin, this pin is pulled to
- * low voltage if no card
- */
ret = gpio_get_value(USDHC2_CD_GPIO);
-
- imx_iomux_v3_setup_pad(usdhc2_dat3_pad);
- return ret;
+ /* CD is active low */
+ return !ret;
}
return 1;
--
2.11.0
@@ -0,0 +1,46 @@
From c8f58be8401b672be8aa35226470ffd2da136364 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Mon, 20 Jul 2020 06:29:03 +0300
Subject: [PATCH 065/126] mcm-imx8m-mini: reset: Refactor the reset
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/plat/imx8mm/spl/spl.c | 9 ---------
configs/mcm-imx8m-mini_defconfig | 3 ---
2 files changed, 12 deletions(-)
diff --git a/board/compulab/plat/imx8mm/spl/spl.c b/board/compulab/plat/imx8mm/spl/spl.c
index 643093aaf9..ad1be9befd 100644
--- a/board/compulab/plat/imx8mm/spl/spl.c
+++ b/board/compulab/plat/imx8mm/spl/spl.c
@@ -251,12 +251,3 @@ void board_init_f(ulong dummy)
board_init_r(NULL, 0);
}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- puts ("resetting ...\n");
-
- reset_cpu(WDOG1_BASE_ADDR);
-
- return 0;
-}
diff --git a/configs/mcm-imx8m-mini_defconfig b/configs/mcm-imx8m-mini_defconfig
index 971e1ec982..e0e4f86329 100644
--- a/configs/mcm-imx8m-mini_defconfig
+++ b/configs/mcm-imx8m-mini_defconfig
@@ -77,10 +77,7 @@ CONFIG_PINCTRL_IMX8M=y
CONFIG_DM_REGULATOR=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
-CONFIG_DM_RESET=y
CONFIG_MXC_UART=y
-CONFIG_SYSRESET=y
-CONFIG_SYSRESET_PSCI=y
CONFIG_DM_THERMAL=y
CONFIG_NXP_TMU=y
CONFIG_USB=y
--
2.11.0
@@ -0,0 +1,36 @@
From 0a9c14878c90919628fa76ca098f18c86c06cf97 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Mon, 20 Jul 2020 13:01:28 +0300
Subject: [PATCH 066/126] imx8m-mini: ddr: Change the memory presets order
Make the simplest one 1-st.
Nanya 1G has the best ddr-phy settings for reading the mr4-mr8 registers.
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/plat/imx8mm/ddr/ddr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/board/compulab/plat/imx8mm/ddr/ddr.c b/board/compulab/plat/imx8mm/ddr/ddr.c
index 1340475bef..4d774835ef 100644
--- a/board/compulab/plat/imx8mm/ddr/ddr.c
+++ b/board/compulab/plat/imx8mm/ddr/ddr.c
@@ -63,11 +63,11 @@ struct lpddr4_desc {
#define DEFAULT (('D' << 24) + ('E' << 16 ) + ( 'F' << 8 ) + 'A')
static const struct lpddr4_desc lpddr4_array[] = {
- { .name = "Micron", .id = 0xff020008, .size = 2048, .count = 1, .timing = &ucm_dram_timing_ff020008}, //Only the first timing entry is in use
- { .name = "Micron", .id = 0xff000110, .size = 4096, .count = 1, .timing = &ucm_dram_timing_ff000110},
- { .name = "Samsung",.id = 0x01061010, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
+ { .name = "Nanya", .id = 0x01050008, .size = 1024, .count = 1, .timing = &ucm_dram_timing_01050008}, //Only the first timing entry is in use
{ .name = "Nanya", .id = 0x05000010, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
- { .name = "Nanya", .id = 0x01050008, .size = 1024, .count = 1, .timing = &ucm_dram_timing_01050008},
+ { .name = "Samsung",.id = 0x01061010, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
+ { .name = "Micron", .id = 0xff020008, .size = 2048, .count = 1, .timing = &ucm_dram_timing_ff020008},
+ { .name = "Micron", .id = 0xff000110, .size = 4096, .count = 1, .timing = &ucm_dram_timing_ff000110},
};
static unsigned int lpddr4_get_mr(void)
--
2.11.0
@@ -0,0 +1,26 @@
From 20f325051a66a31b0c6644e63cd2f8bb2b616e6e Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Mon, 20 Jul 2020 14:00:31 +0300
Subject: [PATCH 067/126] imx8m-mini: env: Fix getopt_long() parameters' string
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
tools/env/fw_env_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
index ebd18b40ba..ca9ad78014 100644
--- a/tools/env/fw_env_main.c
+++ b/tools/env/fw_env_main.c
@@ -122,7 +122,7 @@ static void parse_common_args(int argc, char *argv[])
env_opts.config_file = CONFIG_FILE;
#endif
- while ((c = getopt_long(argc, argv, ":a:c:l:h:v:e", long_options, NULL)) !=
+ while ((c = getopt_long(argc, argv, ":a:c:l:h:ve", long_options, NULL)) !=
EOF) {
switch (c) {
#ifdef CONFIG_FILE
--
2.11.0
@@ -0,0 +1,28 @@
From 5368f1fce9510d82964e9cc38c76f754f2ff1355 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Wed, 22 Jul 2020 22:26:54 +0300
Subject: [PATCH 068/126] ucm-imx8m-mini: Fix reset
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
configs/ucm-imx8m-mini_defconfig | 3 ---
1 file changed, 3 deletions(-)
diff --git a/configs/ucm-imx8m-mini_defconfig b/configs/ucm-imx8m-mini_defconfig
index 2c98eaa256..ac8b3f558e 100644
--- a/configs/ucm-imx8m-mini_defconfig
+++ b/configs/ucm-imx8m-mini_defconfig
@@ -78,10 +78,7 @@ CONFIG_PINCTRL_IMX8M=y
CONFIG_DM_REGULATOR=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
-CONFIG_DM_RESET=y
CONFIG_MXC_UART=y
-CONFIG_SYSRESET=y
-CONFIG_SYSRESET_PSCI=y
CONFIG_DM_THERMAL=y
CONFIG_NXP_TMU=y
CONFIG_USB=y
--
2.11.0
@@ -0,0 +1,30 @@
From 0db9464775f4664c48b8428cdbd3cd70c87dea2c Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 5 Aug 2020 00:20:44 +0300
Subject: [PATCH 069/126] imx8m-mini: spl: Add __weak
board_fit_config_name_match()
Add __weak board_fit_config_name_match().
Each board can redefind this function in its spl.c file.
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/plat/imx8mm/spl/spl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/compulab/plat/imx8mm/spl/spl.c b/board/compulab/plat/imx8mm/spl/spl.c
index ad1be9befd..63af88caa5 100644
--- a/board/compulab/plat/imx8mm/spl/spl.c
+++ b/board/compulab/plat/imx8mm/spl/spl.c
@@ -212,7 +212,7 @@ void spl_board_init(void)
}
#ifdef CONFIG_SPL_LOAD_FIT
-int board_fit_config_name_match(const char *name)
+__weak 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);
--
2.11.0
@@ -0,0 +1,32 @@
From 447d297f3b0fbc8f2c02d99bc79215a01a7f27f7 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 5 Aug 2020 00:22:29 +0300
Subject: [PATCH 070/126] mcm-imx8m-mini: spl: Add
board_fit_config_name_match()
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/mcm-imx8m-mini/spl.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/board/compulab/mcm-imx8m-mini/spl.c b/board/compulab/mcm-imx8m-mini/spl.c
index d6ece8ef3e..1a208e09a4 100644
--- a/board/compulab/mcm-imx8m-mini/spl.c
+++ b/board/compulab/mcm-imx8m-mini/spl.c
@@ -7,3 +7,13 @@
int spl_board_private_init(void) {
return 0;
}
+
+#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
--
2.11.0
@@ -0,0 +1,51 @@
From 6815fe714952f3ee9e044e3ad14a3feb83857ca6 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 5 Aug 2020 00:25:22 +0300
Subject: [PATCH 071/126] imx8m-mini: u-boot: Add __weak
uboot_board_private_init()
Add a __weak uboot_board_private_init().
Each board can redefind this function in its board.c file.
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/plat/imx8mm/board/board.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/board/compulab/plat/imx8mm/board/board.c b/board/compulab/plat/imx8mm/board/board.c
index 819e6ef32c..2d12861bb8 100644
--- a/board/compulab/plat/imx8mm/board/board.c
+++ b/board/compulab/plat/imx8mm/board/board.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <malloc.h>
#include <errno.h>
+#include <hang.h>
#include <asm/io.h>
#include <miiphy.h>
#include <netdev.h>
@@ -167,12 +168,21 @@ int board_usb_cleanup(int index, enum usb_init_type init)
return 0;
}
+
+__weak int uboot_board_private_init(void) {
+ return 0;
+}
+
int board_init(void)
{
#ifdef CONFIG_FEC_MXC
setup_fec();
#endif
+ if (uboot_board_private_init()) {
+ printf("uboot_board_private_init() failed\n");
+ hang();
+ }
return 0;
}
--
2.11.0
@@ -0,0 +1,26 @@
From 24922199f7e640a0dc20042bdc0ffaa900f85896 Mon Sep 17 00:00:00 2001
From: Valentin Raevsky <valentin@compulab.co.il>
Date: Wed, 5 Aug 2020 00:26:12 +0300
Subject: [PATCH 072/126] mcm-imx8m-mini: u-boot: Add
uboot_board_private_init()
Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
---
board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
index 6cafc259e9..bd863f154f 100644
--- a/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
+++ b/board/compulab/mcm-imx8m-mini/mcm-imx8m-mini.c
@@ -28,3 +28,7 @@
#include <asm/mach-imx/video.h>
DECLARE_GLOBAL_DATA_PTR;
+
+int uboot_board_private_init(void) {
+ return 0;
+}
--
2.11.0
@@ -0,0 +1,29 @@
From afa38bc44bb5b3054439f83173f95f28018064dd Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Wed, 19 Aug 2020 18:45:55 +0300
Subject: [PATCH 073/126] Add ddr_init return handling
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
board/compulab/plat/imx8mm/ddr/ddr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/board/compulab/plat/imx8mm/ddr/ddr.c b/board/compulab/plat/imx8mm/ddr/ddr.c
index 4d774835ef..3912de6316 100644
--- a/board/compulab/plat/imx8mm/ddr/ddr.c
+++ b/board/compulab/plat/imx8mm/ddr/ddr.c
@@ -152,7 +152,10 @@ void spl_dram_init(void)
printf("DDRINFO(%s): %s %dG @ %d MHz\n", (ddr_found ? "D" : "?" ), lpddr4_array[i].name,
lpddr4_array[i].size, lpddr4_array[i].timing->fsp_table[0]);
- ddr_init(lpddr4_array[i].timing);
+ if (ddr_init(lpddr4_array[i].timing)) {
+ SPL_TCM_INIT;
+ do_reset(NULL,0,0,NULL);
+ }
ddr_info_mrr = lpddr4_get_mr();
if (ddr_info_mrr == 0xFFFFFFFF ) {
--
2.11.0
@@ -0,0 +1,121 @@
From 2daab9bfa0085f0b3ed0587128327b14b03fa302 Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Tue, 18 Aug 2020 19:10:19 +0300
Subject: [PATCH 074/126] spl: Enable Kingston DRAM support
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
board/compulab/plat/imx8/eeprom/eeprom_spl.c | 21 +++++++++++++++++++++
board/compulab/plat/imx8mm/ddr/ddr.c | 27 ++++++++++++++++++++-------
2 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/board/compulab/plat/imx8/eeprom/eeprom_spl.c b/board/compulab/plat/imx8/eeprom/eeprom_spl.c
index 79b2e29c63..b3c894a9af 100644
--- a/board/compulab/plat/imx8/eeprom/eeprom_spl.c
+++ b/board/compulab/plat/imx8/eeprom/eeprom_spl.c
@@ -79,6 +79,10 @@ static int cl_eeprom_write(uint offset, uchar *buf, int len)
#define BOARD_DDRINFO_SIZE 4
static u32 board_ddrinfo = 0xdeadbeef;
+#define BOARD_DDRSUBIND_OFFSET 0x44
+#define BOARD_DDRSUBIND_SIZE 1
+static u8 board_ddrsubind = 0xff;
+
#define BOARD_DRATE_OFFSET 0x50
#define BOARD_DRATE_SIZE 4
static u32 board_drate = 0xdeadbeef;
@@ -129,6 +133,23 @@ u32 cl_eeprom_set_drate(u32 drate, unsigned int r, unsigned int c)
return board_drate;
};
+u8 cl_eeprom_get_subind(void)
+{
+ if (cl_eeprom_read(BOARD_DDRSUBIND_OFFSET, (uchar *)&board_ddrsubind, BOARD_DDRSUBIND_SIZE))
+ return 0xff;
+
+ return board_ddrsubind;
+};
+
+u8 cl_eeprom_set_subind(u8 ddrsubind)
+{
+ if (cl_eeprom_write(BOARD_DDRSUBIND_OFFSET, (uchar *)&ddrsubind, BOARD_DDRSUBIND_SIZE))
+ return 0xff;
+ board_ddrsubind = ddrsubind;
+
+ return board_ddrsubind;
+};
+
/* override-size ifaces */
u32 cl_eeprom_get_osize(void)
{
diff --git a/board/compulab/plat/imx8mm/ddr/ddr.c b/board/compulab/plat/imx8mm/ddr/ddr.c
index 3912de6316..970d3ab81b 100644
--- a/board/compulab/plat/imx8mm/ddr/ddr.c
+++ b/board/compulab/plat/imx8mm/ddr/ddr.c
@@ -19,6 +19,8 @@
/* Forward declarations */
u32 cl_eeprom_get_ddrinfo(void);
u32 cl_eeprom_set_ddrinfo(u32 ddrinfo);
+u32 cl_eeprom_get_subind(void);
+u32 cl_eeprom_set_subind(u32 subind);
u32 cl_eeprom_get_osize(void);
@@ -57,17 +59,24 @@ struct lpddr4_desc {
* use it if default is not the
* 1-st array entry */
unsigned int _default;
+ /* An optional field to distiguish DRAM chips that
+ * have different geometry, though return the same MRR.
+ * Default value 0xff
+ */
+ u8 subind;
struct dram_timing_info *timing;
char *desc[4];
};
#define DEFAULT (('D' << 24) + ('E' << 16 ) + ( 'F' << 8 ) + 'A')
static const struct lpddr4_desc lpddr4_array[] = {
- { .name = "Nanya", .id = 0x01050008, .size = 1024, .count = 1, .timing = &ucm_dram_timing_01050008}, //Only the first timing entry is in use
- { .name = "Nanya", .id = 0x05000010, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
- { .name = "Samsung",.id = 0x01061010, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
- { .name = "Micron", .id = 0xff020008, .size = 2048, .count = 1, .timing = &ucm_dram_timing_ff020008},
- { .name = "Micron", .id = 0xff000110, .size = 4096, .count = 1, .timing = &ucm_dram_timing_ff000110},
+ { .name = "Nanya", .id = 0x05000010, .subind = 0xff, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
+ { .name = "Samsung", .id = 0x01061010, .subind = 0xff, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
+ { .name = "Samsung", .id = 0x01050008, .subind = 0xff, .size = 1024, .count = 1, .timing = &ucm_dram_timing_01050008},
+ { .name = "Kingston", .id = 0xff000010, .subind = 0x04, .size = 4096, .count = 1, .timing = &ucm_dram_timing_ff000110},
+ { .name = "Kingston", .id = 0xff000010, .subind = 0x02, .size = 2048, .count = 1, .timing = &ucm_dram_timing_01061010},
+ { .name = "Micron", .id = 0xff020008, .subind = 0xff, .size = 2048, .count = 1, .timing = &ucm_dram_timing_ff020008},
+ { .name = "Micron", .id = 0xff000110, .subind = 0xff, .size = 4096, .count = 1, .timing = &ucm_dram_timing_ff000110},
};
static unsigned int lpddr4_get_mr(void)
@@ -122,7 +131,8 @@ void spl_dram_init(void)
/* get ddr type from the eeprom if not in tcm scan mode */
ddr_info = cl_eeprom_get_ddrinfo();
for ( i = 0; i < ARRAY_SIZE(lpddr4_array); i++ ) {
- if (lpddr4_array[i].id == ddr_info) {
+ if (lpddr4_array[i].id == ddr_info &&
+ lpddr4_array[i].subind == cl_eeprom_get_subind()) {
ddr_found = 1;
break;
}
@@ -177,10 +187,13 @@ void spl_dram_init(void)
if (ddr_found == 0) {
/* Update eeprom */
cl_eeprom_set_ddrinfo(ddr_info_mrr);
+ mdelay(10);
ddr_info = cl_eeprom_get_ddrinfo();
+ mdelay(10);
+ cl_eeprom_set_subind(lpddr4_array[i].subind);
/* make sure that the ddr_info has reached the eeprom */
printf("DDRINFO(E): mr5-8 [ 0x%x ], read back\n", ddr_info);
- if (ddr_info_mrr != ddr_info) {
+ if (ddr_info_mrr != ddr_info || cl_eeprom_get_subind() != lpddr4_array[i].subind) {
printf("DDRINFO(EEPROM): make sure that the eeprom is accessible\n");
printf("DDRINFO(EEPROM): i2c dev 1; i2c md 0x51 0x40 0x50\n");
}
--
2.11.0
@@ -0,0 +1,276 @@
From 218460565b10716a8bc5aa1215f8a3449ea6fb9b Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sat, 29 Aug 2020 22:14:48 +0300
Subject: [PATCH 075/126] Add show_suite function
The function shows product names of UCM and SB on boot.
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
arch/arm/dts/cpl-imx8m-mini.dtsi | 2 +-
board/compulab/common/eeprom.c | 88 ++++++++++++++++++++++++--------
board/compulab/common/eeprom.h | 1 +
board/compulab/plat/imx8mm/board/board.c | 17 ++++++
4 files changed, 87 insertions(+), 21 deletions(-)
diff --git a/arch/arm/dts/cpl-imx8m-mini.dtsi b/arch/arm/dts/cpl-imx8m-mini.dtsi
index 4f9c5fbfb9..a587c3dda0 100644
--- a/arch/arm/dts/cpl-imx8m-mini.dtsi
+++ b/arch/arm/dts/cpl-imx8m-mini.dtsi
@@ -226,7 +226,7 @@
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
- status = "disabled";
+ status = "okay";
};
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index defd9b6446..46363c0707 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -7,6 +7,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
+#include <linux/ctype.h>
#include <common.h>
#include <asm/mach-imx/mxc_i2c.h>
#include <i2c.h>
@@ -22,8 +23,16 @@
# define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
#endif
+#ifndef CONFIG_SYS_I2C_EEPROM_ADDR_SB
+# define CONFIG_SYS_I2C_EEPROM_ADDR_SB 0x54
+#endif
+
#ifndef CONFIG_SYS_I2C_EEPROM_BUS
-#define CONFIG_SYS_I2C_EEPROM_BUS 0
+# define CONFIG_SYS_I2C_EEPROM_BUS 1
+#endif
+
+#ifndef CONFIG_SYS_I2C_EEPROM_BUS_SB
+# define CONFIG_SYS_I2C_EEPROM_BUS_SB 0
#endif
#define EEPROM_LAYOUT_VER_OFFSET 44
@@ -40,31 +49,43 @@
#define LAYOUT_INVALID 0
#define LAYOUT_LEGACY 0xff
-static int cl_eeprom_bus;
static int cl_eeprom_layout; /* Implicitly LAYOUT_INVALID */
-static struct udevice *g_dev = NULL;
+struct eeprom_path {
+ int bus;
+ uint8_t chip;
+};
-static int cpl_eeprom_init(void) {
+static const struct eeprom_path eeprom_som = {
+ CONFIG_SYS_I2C_EEPROM_BUS,
+ CONFIG_SYS_I2C_EEPROM_ADDR
+};
+static const struct eeprom_path eeprom_sb = {
+ CONFIG_SYS_I2C_EEPROM_BUS_SB,
+ CONFIG_SYS_I2C_EEPROM_ADDR_SB
+};
+
+static const struct eeprom_path *working_eeprom;
- int i2c_bus = CONFIG_SYS_I2C_EEPROM_BUS;
- uint8_t chip = CONFIG_SYS_I2C_EEPROM_ADDR;
+static struct udevice *g_dev = NULL;
+
+static int cpl_eeprom_init(void) {
struct udevice *bus, *dev;
int ret;
if (!g_dev) {
- ret = uclass_get_device_by_seq(UCLASS_I2C, i2c_bus, &bus);
+ ret = uclass_get_device_by_seq(UCLASS_I2C, working_eeprom->bus, &bus);
if (ret) {
- printf("%s: No bus %d\n", __func__, i2c_bus);
+ printf("%s: No bus %d\n", __func__, working_eeprom->bus);
return ret;
}
- ret = dm_i2c_probe(bus, chip, 0, &dev);
+ ret = dm_i2c_probe(bus, working_eeprom->chip, 0, &dev);
if (ret) {
printf("%s: Can't find device id=0x%x, on bus %d\n",
- __func__, chip, i2c_bus);
+ __func__, working_eeprom->chip, working_eeprom->bus);
return ret;
}
@@ -88,7 +109,7 @@ static int cl_eeprom_read(uint offset, uchar *buf, int len)
return res;
}
-static int cl_eeprom_setup(uint eeprom_bus)
+static int cl_eeprom_setup(const struct eeprom_path *eeprom)
{
int res;
@@ -96,10 +117,11 @@ static int cl_eeprom_setup(uint eeprom_bus)
* We know the setup was already done when the layout is set to a valid
* value and we're using the same bus as before.
*/
- if (cl_eeprom_layout != LAYOUT_INVALID && eeprom_bus == cl_eeprom_bus)
+ if (cl_eeprom_layout != LAYOUT_INVALID && eeprom == working_eeprom)
return 0;
- cl_eeprom_bus = eeprom_bus;
+ working_eeprom = eeprom;
+ g_dev = NULL;
res = cl_eeprom_read(EEPROM_LAYOUT_VER_OFFSET,
(uchar *)&cl_eeprom_layout, 1);
if (res) {
@@ -120,7 +142,7 @@ void cpl_get_board_serial(struct tag_serialnr *serialnr)
memset(serialnr, 0, sizeof(*serialnr));
- if (cl_eeprom_setup(CONFIG_SYS_I2C_EEPROM_BUS))
+ if (cl_eeprom_setup(&eeprom_som))
return;
offset = (cl_eeprom_layout != LAYOUT_LEGACY) ?
@@ -139,12 +161,12 @@ void cpl_get_board_serial(struct tag_serialnr *serialnr)
* Routine: cl_eeprom_read_mac_addr
* Description: read mac address and store it in buf.
*/
-int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
+int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus __attribute__((unused)))
{
uint offset;
int err;
- err = cl_eeprom_setup(eeprom_bus);
+ err = cl_eeprom_setup(&eeprom_som);
if (err)
return err;
@@ -160,7 +182,7 @@ static u32 board_rev;
* Routine: cl_eeprom_get_board_rev
* Description: read system revision from eeprom
*/
-u32 cl_eeprom_get_board_rev(uint eeprom_bus)
+u32 cl_eeprom_get_board_rev(uint eeprom_bus __attribute__((unused)))
{
char str[5]; /* Legacy representation can contain at most 4 digits */
uint offset = BOARD_REV_OFFSET_LEGACY;
@@ -168,7 +190,7 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)
if (board_rev)
return board_rev;
- if (cl_eeprom_setup(eeprom_bus))
+ if (cl_eeprom_setup(&eeprom_som))
return 0;
if (cl_eeprom_layout != LAYOUT_LEGACY)
@@ -198,14 +220,14 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)
*
* @return: 0 on success, < 0 on failure
*/
-int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
+int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus __attribute__((unused)))
{
int err;
if (buf == NULL)
return -EINVAL;
- err = cl_eeprom_setup(eeprom_bus);
+ err = cl_eeprom_setup(&eeprom_som);
if (err)
return err;
@@ -216,6 +238,32 @@ int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
return err;
}
+static int cl_eeprom_read_product_name(char *buf, const struct eeprom_path *eeprom)
+{
+ int len;
+ int err;
+ uchar tmp[PRODUCT_NAME_SIZE];
+
+ err = cl_eeprom_setup(eeprom);
+ if (err)
+ printf("%s: Error accesing i2c %x@%x\n", __func__, eeprom->bus, eeprom->chip);
+ else
+ err = cl_eeprom_read(PRODUCT_NAME_OFFSET, tmp, PRODUCT_NAME_SIZE);
+
+ if (!err && tmp[0] != 0xff) // Check if the flash isn't written
+ len = snprintf(buf, PRODUCT_NAME_SIZE, (char*)tmp);
+ else
+ len = snprintf(buf, PRODUCT_NAME_SIZE, "unknown");
+
+ return len;
+}
+void cl_eeprom_get_suite(char *buf)
+{
+ buf += cl_eeprom_read_product_name(buf, &eeprom_som);
+ buf += sprintf(buf, " @ ");
+ buf += cl_eeprom_read_product_name(buf, &eeprom_sb);
+}
+
#ifdef CONFIG_CMD_EEPROM_LAYOUT
/**
* eeprom_field_print_bin_ver() - print a "version field" which contains binary
diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h
index 09804ee146..d366f59288 100644
--- a/board/compulab/common/eeprom.h
+++ b/board/compulab/common/eeprom.h
@@ -15,6 +15,7 @@
int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
u32 cl_eeprom_get_board_rev(uint eeprom_bus);
int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
+void cl_eeprom_get_suite(char* buf);
#else
static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
{
diff --git a/board/compulab/plat/imx8mm/board/board.c b/board/compulab/plat/imx8mm/board/board.c
index 2d12861bb8..4ec5a5af4f 100644
--- a/board/compulab/plat/imx8mm/board/board.c
+++ b/board/compulab/plat/imx8mm/board/board.c
@@ -173,6 +173,22 @@ __weak int uboot_board_private_init(void) {
return 0;
}
+static void show_suite_info(void)
+{
+ char *buf = malloc(200); //More than necessary
+
+ if(!buf) {
+ printf("%s: Not enough memory\n", __func__);
+ return;
+ }
+
+ cl_eeprom_get_suite(buf);
+ printf("Suite:\t%s\n", buf);
+
+ free(buf);
+ return;
+}
+
int board_init(void)
{
@@ -183,6 +199,7 @@ int board_init(void)
printf("uboot_board_private_init() failed\n");
hang();
}
+ show_suite_info();
return 0;
}
--
2.11.0
@@ -0,0 +1,26 @@
From debba895d9bbb88e1b855417e6448cd96fed978b Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Sat, 29 Aug 2020 22:37:39 +0300
Subject: [PATCH 076/126] Clean debug printout
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
board/compulab/common/eeprom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index 46363c0707..ebcafac04b 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -260,7 +260,7 @@ static int cl_eeprom_read_product_name(char *buf, const struct eeprom_path *eepr
void cl_eeprom_get_suite(char *buf)
{
buf += cl_eeprom_read_product_name(buf, &eeprom_som);
- buf += sprintf(buf, " @ ");
+ buf += sprintf(buf, " on ");
buf += cl_eeprom_read_product_name(buf, &eeprom_sb);
}
--
2.11.0
@@ -0,0 +1,78 @@
From 7c45580b9dd2ca23e663375ac138c9bfb760cbdb Mon Sep 17 00:00:00 2001
From: Kirill Kapranov <kirill.kapranov@compulab.co.il>
Date: Wed, 2 Sep 2020 23:11:10 +0300
Subject: [PATCH 078/126] ucm-imx8m-mini: Enable status LED and cmd led
Signed-off-by: Kirill Kapranov <kirill.kapranov@compulab.co.il>
---
arch/arm/dts/ucm-imx8m-mini.dts | 20 ++++++++++++++++++++
board/compulab/plat/imx8mm/board/board.c | 3 +++
configs/ucm-imx8m-mini_defconfig | 5 ++++-
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/ucm-imx8m-mini.dts b/arch/arm/dts/ucm-imx8m-mini.dts
index 7b81e8a75b..ba0e169004 100644
--- a/arch/arm/dts/ucm-imx8m-mini.dts
+++ b/arch/arm/dts/ucm-imx8m-mini.dts
@@ -19,4 +19,24 @@
/ {
model = "CompuLab UCM-iMX8M-Mini board";
compatible = "cpl,ucm-imx8m-mini", "fsl,imx8mm-evk", "fsl,imx8mm";
+
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_gpio_led>;
+
+ status_led {
+ label = "status";
+ gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
+ default-state = "on";
+ };
+ };
+};
+
+&iomuxc {
+ pinctrl_gpio_led: gpioledgrp {
+ fsl,pins = <
+ MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12 0x19
+ >;
+ };
};
diff --git a/board/compulab/plat/imx8mm/board/board.c b/board/compulab/plat/imx8mm/board/board.c
index 4ec5a5af4f..03e479ee57 100644
--- a/board/compulab/plat/imx8mm/board/board.c
+++ b/board/compulab/plat/imx8mm/board/board.c
@@ -199,6 +199,9 @@ int board_init(void)
printf("uboot_board_private_init() failed\n");
hang();
}
+ if (IS_ENABLED(CONFIG_LED))
+ led_default_state();
+
show_suite_info();
return 0;
}
diff --git a/configs/ucm-imx8m-mini_defconfig b/configs/ucm-imx8m-mini_defconfig
index ac8b3f558e..7d4b487ce9 100644
--- a/configs/ucm-imx8m-mini_defconfig
+++ b/configs/ucm-imx8m-mini_defconfig
@@ -45,7 +45,7 @@ CONFIG_CMD_DHCP=y
CONFIG_CMD_MII=y
CONFIG_CMD_PING=y
CONFIG_CMD_CACHE=y
-CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_REGULATOR=
CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_FAT=y
@@ -97,3 +97,6 @@ CONFIG_EXT4_WRITE=y
CONFIG_FAT_WRITE=y
CONFIG_OF_LIBFDT_OVERLAY=y
# CONFIG_EFI_LOADER is not set
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+
--
2.11.0

Some files were not shown because too many files have changed in this diff Show More