platform/kernel/u-boot.git
2 years agoefi_loader: simplify efi_serialize_load_option()
Heinrich Schuchardt [Sat, 2 Apr 2022 09:47:01 +0000 (11:47 +0200)]
efi_loader: simplify efi_serialize_load_option()

Use u16_strsize().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: EFI_HII_STRING_PROTOCOL.GetString()
Heinrich Schuchardt [Sat, 2 Apr 2022 09:47:00 +0000 (11:47 +0200)]
efi_loader: EFI_HII_STRING_PROTOCOL.GetString()

Use u16_strsize().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agolib: simplify u16_strdup()
Heinrich Schuchardt [Sat, 2 Apr 2022 09:46:59 +0000 (11:46 +0200)]
lib: simplify u16_strdup()

Use u16_strsize() instead of duplicating it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agolib: convert u16_strlen() into a macro
Heinrich Schuchardt [Sat, 2 Apr 2022 09:46:58 +0000 (11:46 +0200)]
lib: convert u16_strlen() into a macro

The function u16_strlen() can be implemented as call to u16_strnlen().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: man-page for the env command
Patrick Delaunay [Thu, 14 Apr 2022 17:07:05 +0000 (19:07 +0200)]
doc: man-page for the env command

Describe the env command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agodoc: uefi: Update the capsule update related documentation
Sughosh Ganu [Fri, 15 Apr 2022 05:59:41 +0000 (11:29 +0530)]
doc: uefi: Update the capsule update related documentation

Update the capsule update functionality related documentation to
refect the additional definitions that need to be made per platform
for supporting the capsule update feature.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agomkeficapsule: Remove raw and FIT GUID types
Sughosh Ganu [Fri, 15 Apr 2022 05:59:40 +0000 (11:29 +0530)]
mkeficapsule: Remove raw and FIT GUID types

While building a capsule, the GUID value of that specific image is to
be passed through the --guid command option to the mkeficapsule
tool instead of using one of --raw or --fit options, where the GUID
value passed through the command line option is the image GUID.

This renders the EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID and
EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID values superfluous. Remove the
--raw and --fit command line options as well. Also modify the
mkeficapsule man page to reflect this change.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2 years agoFMP: Remove GUIDs for FIT and raw images
Sughosh Ganu [Fri, 15 Apr 2022 05:59:39 +0000 (11:29 +0530)]
FMP: Remove GUIDs for FIT and raw images

The capsule update code has been modified for getting the image GUID
values from the platform code. With this, each image now has a unique
GUID value. With this change, there is no longer a need for defining
GUIDs for FIT and raw images. Remove these GUID values.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2 years agotest: capsule: Modify the capsule tests to use GUID values for sandbox
Sughosh Ganu [Fri, 15 Apr 2022 05:59:38 +0000 (11:29 +0530)]
test: capsule: Modify the capsule tests to use GUID values for sandbox

The current UEFI capsule updation code uses two GUID values, one for
FIT images, and one for raw images across platforms. This logic is
being changed to have GUID values per image, per platform. Change the
tests for the capsule update code to reflect this change. The GUID
values now used are the ones specific to the sandbox platform -- one
for the u-boot image, and another for the u-boot environment image.

Install the FMP instance for raw images on the sandbox variant for
testing the capsule update code. Install the FMP instance for the FIT
images on the sandbox64 and sandbox_flattree variant for testing
capsule update for FIT images. This is being done by splitting the
capsule update script for FIT and raw images.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2 years agoefi: Define set_dfu_alt_info() for boards with UEFI capsule update enabled
Sughosh Ganu [Fri, 15 Apr 2022 05:59:37 +0000 (11:29 +0530)]
efi: Define set_dfu_alt_info() for boards with UEFI capsule update enabled

Currently, there are a bunch of boards which enable the UEFI capsule
update feature. The actual update of the firmware images is done
through the dfu framework which uses the dfu_alt_info environment
variable for getting information on the update, like device, partition
number/address etc. The dfu framework allows the variable to be set
through the set_dfu_alt_info function defined by the platform, or if
the function is not defined, it gets the variable from the
environment. Using the value set in the environment is not very
robust, since the variable can be modified from the u-boot command
line and this can cause an incorrect update.

To prevent this from happening, define the set_dfu_alt_info function
when the capsule update feature is enabled. A weak function is defined
which sets the dfu_alt_info environment variable by getting the string
for the variable from the platform.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agocapsule: Put a check for image index before the update
Sughosh Ganu [Fri, 15 Apr 2022 05:59:36 +0000 (11:29 +0530)]
capsule: Put a check for image index before the update

The current capsule update code compares the image GUID value in the
capsule header with the image GUID value obtained from the
GetImageInfo function of the Firmware Management Protocol(FMP). This
comparison is done to ascertain if the FMP's SetImage function can be
called for the update. Make this checking more robust by comparing the
image_index value passed through the capsule with that returned by the
FMP's GetImageInfo function. This protects against the scenario of the
firmware being updated in a wrong partition/location on the storage
device if an incorrect value has been passed through the capsule,
since the image_index is used to determine the location of the update
on the storage device.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2 years agocapsule: FMP: Populate the image descriptor array from platform data
Sughosh Ganu [Fri, 15 Apr 2022 05:59:35 +0000 (11:29 +0530)]
capsule: FMP: Populate the image descriptor array from platform data

Currently, the image descriptor array that has been passed to the
GetImageInfo function of the Firmware Management Protocol(FMP) gets
populated through the data stored with the dfu framework. The
dfu data is not restricted to contain information only of the images
updatable through the capsule update mechanism, but it also contains
information on other images. The image descriptor array is also parsed
by the ESRT generation code, and thus the ESRT table contains entries
for other images that are not being handled by the FMP for the capsule
updates. Fix this by populating the image descriptor array from the
structure initialised in the board file.

The other issue fixed is assignment of a separate GUID for all images
in the image descriptor array. The UEFI specification mandates that
all entries in the ESRT table should have a unique GUID value as part
of the FwClass member of the EFI_SYSTEM_RESOURCE_ENTRY. Currently, all
images are assigned a single GUID value, either an FIT GUID or a raw
image GUID. This is fixed by obtaining the GUID values from the
efi_fw_images array defined per platform.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years agocapsule: board: Add information needed for capsule updates
Sughosh Ganu [Fri, 15 Apr 2022 05:59:34 +0000 (11:29 +0530)]
capsule: board: Add information needed for capsule updates

Add a structure which defines the information that is needed for
executing capsule updates on a platform. Some information in the
structure like the dfu string is used for making the update process
more robust while some information like the per platform image GUIDs
is used for fixing issues. Initialise this structure in the board
file, and use the information for the capsule updates.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2 years agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 13 Apr 2022 13:14:57 +0000 (09:14 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge tag 'u-boot-imx-20220413' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Wed, 13 Apr 2022 12:00:11 +0000 (08:00 -0400)]
Merge tag 'u-boot-imx-20220413' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20220413

i.MX patches for 2022.07

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/11710

2 years agoboard: gateworks: venice: add imx8mm-gw7903 support
Tim Harvey [Fri, 18 Feb 2022 23:19:33 +0000 (15:19 -0800)]
board: gateworks: venice: add imx8mm-gw7903 support

The GW7903 is based on the i.MX 8M Mini SoC featuring:
 - LPDDR4 DRAM
 - eMMC FLASH
 - microSD socket with voltage select support
 - Gateworks System Controller
 - M.2 A-E Socket with USB2.0 and PCIe
 - MiniPCIe Socket with PCIe, USB2.0, and SIM
 - IMX8M FEC
 - RS232/RS485/RS422 serial transceiver
 - LIS2DE12 3-axis accelerometer
 - front panel LED's
 - off-board isolated digital I/O
 - Wide range DC power input
 - 802.3at PoE
 - PMIC

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoclk: imx8mp: Fix 24M and 32k clock
Marek Vasut [Tue, 12 Apr 2022 22:41:10 +0000 (00:41 +0200)]
clk: imx8mp: Fix 24M and 32k clock

Fix registration of 24M and 32k clock, those got applied or rebased
incorrectly, so fill in the correct code.

Fixes: 7a2c3be95a5 ("clk: imx8mp: Fill in DWC3 USB, USB PHY, HSIOMIX clock")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Ye Li <ye.li@nxp.com>
2 years agowarp7: Remove duplicated "mmc dev" command
Fabio Estevam [Tue, 12 Apr 2022 10:38:59 +0000 (07:38 -0300)]
warp7: Remove duplicated "mmc dev" command

The "mmc dev ${mmcdev}" command is done twice.

Remove one ocurrence to avoid the duplication.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoARM: imx: Get rid of only i.MX8M SMCCC arch call
Marek Vasut [Tue, 12 Apr 2022 22:40:26 +0000 (00:40 +0200)]
ARM: imx: Get rid of only i.MX8M SMCCC arch call

This is the only place where i.MX8M code does SMCCC call, remove it.
The output has little value as it prints some part of commit ID, and
worse, if there is no SMC handler installed, the code outright hangs
or crashes the system.

By removing this one instance of SMCCC call, U-Boot no longer depends
on SMC handlers and can boot without hanging in any case. If there is
a need to dump this commit ID, use CMD_SMC instead and do 'smc' call
from U-Boot shell or scripts instead of hard-coding SMCCC dependency
into architecture code. This particular code can be replaced by:
 => smc 0xc2000003 0 0 0 0 0 0

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agoARM: imx: Enable instruction cache early on on i.MX8M
Marek Vasut [Tue, 12 Apr 2022 22:41:52 +0000 (00:41 +0200)]
ARM: imx: Enable instruction cache early on on i.MX8M

Enable instruction cache early on to speed up the boot process on i.MX8M.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agoclk: imx8mp: Add ECSPI clocks
Elmar Albert [Wed, 6 Apr 2022 11:39:50 +0000 (13:39 +0200)]
clk: imx8mp: Add ECSPI clocks

Add clock tables required for bing up ECSPI interfaces

Signed-off-by: Elmar Albert <ealbert@data-modul.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: uboot-imx <uboot-imx@nxp.com>
Signed-off-by: Elmar Albert <ealbert@data-modul.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoinclude: configs: *imx8*: remove IMX_FEC_BASE
Heiko Thiery [Fri, 18 Feb 2022 20:48:42 +0000 (21:48 +0100)]
include: configs: *imx8*: remove IMX_FEC_BASE

The IMX_FEC_BASE value is not used when CONFIG_DM_ETH is configured. So this
value can be removed.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-By: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agokontron-pitx-imx8m: change environment address variables
Heiko Thiery [Wed, 16 Feb 2022 12:25:15 +0000 (13:25 +0100)]
kontron-pitx-imx8m: change environment address variables

Currently the space between kernel_addr_r and the fdt_addr_r is only 32MB.
To have enought space to load kernel images bigger than 32MB change the
variables to a feasible value.

The new environment variables layout is based on the scheme from
"include/configs/ti_armv7_common.h".

The CONFIG_SYS_LOAD_ADDR value is set to 0x42000000. With that we have
the same value as for the kernel_addr_r.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
2 years agoARM: dts: imx8mm: Add i.MX8M Mini Toradex Verdin based Menlo board
Marek Vasut [Fri, 8 Apr 2022 00:15:01 +0000 (02:15 +0200)]
ARM: dts: imx8mm: Add i.MX8M Mini Toradex Verdin based Menlo board

Add new board based on the Toradex Verdin iMX8M Mini SoM, the MX8Menlo.
The board is a compatible replacement for i.MX53 M53Menlo and features
USB, multiple UARTs, ethernet, LEDs, SD and eMMC.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Max Krummenacher <max.krummenacher@toradex.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agoboard: freescale: imxrt10..-evk: Fix missing include of serial.h
Jesse Taube [Thu, 17 Mar 2022 18:33:21 +0000 (14:33 -0400)]
board: freescale: imxrt10..-evk: Fix missing include of serial.h

If FALCON mode is enabled we have a missing include in spl_start_uboot.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
2 years agoARM: dts: imxrt10..-evk: Linux moved pins-imxrt1020 to dts
Jesse Taube [Thu, 17 Mar 2022 18:33:20 +0000 (14:33 -0400)]
ARM: dts: imxrt10..-evk: Linux moved pins-imxrt1020 to dts

The Linux kernel moved dt-bindings/pinctrl/pins-imxrt to the device tree
This patch move it in U-Boot as well.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
2 years agoconfigs/*imxrt10*: SYS_MALLOC_LEN is too large
Jesse Taube [Thu, 17 Mar 2022 18:33:19 +0000 (14:33 -0400)]
configs/*imxrt10*: SYS_MALLOC_LEN is too large

1M of heap is more than internal ram making booting without SDRAM not
possible now it is 256k

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
2 years agoclk: imxrt: Use dts for anatop base address
Jesse Taube [Thu, 17 Mar 2022 18:33:18 +0000 (14:33 -0400)]
clk: imxrt: Use dts for anatop base address

In Linux IMX and IMXRT use the device tree to hold the anatop address.
The anatop is used in clock drivers as it controls the internal PLLs
This will move the macro from asm/arch-imxrt to the device tree.
This presumably should also be done with the other IMX boards as well.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
2 years agommc: fsl_esdhc_imx: Add i.MX8MP compatible string
Marek Vasut [Thu, 10 Mar 2022 20:27:04 +0000 (21:27 +0100)]
mmc: fsl_esdhc_imx: Add i.MX8MP compatible string

Add compatible string for i.MX8MP, which permits i.MX8MP to use
HS400ES mode, just like all the other i.MX8M.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Haibo Chen <haibo.chen@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 years agoARM: imx: romapi: Repair FlexSPI NOR boot offset
Marek Vasut [Wed, 9 Mar 2022 16:09:45 +0000 (17:09 +0100)]
ARM: imx: romapi: Repair FlexSPI NOR boot offset

The FlexSPI NOR boot offset does not require any special handling,
the image_offset is correct in either case (0x1000 for FlexSPI NOR
and 0x8000 for SD/eMMC) and the offset of u-boot.itb from the start
of flash.bin is always 0x58000 on MX8MN/MX8MP, which matches the
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000 in case
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300, which is always the
case on MX8MN/MX8MP.

The CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is really overloaded in
case of the MX8MN/MX8MP, but fixing that needs additional plumbing.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agoARM: dts: imx: Add flexspi node to i.MX8MP
Marek Vasut [Wed, 9 Mar 2022 03:19:34 +0000 (04:19 +0100)]
ARM: dts: imx: Add flexspi node to i.MX8MP

Add flexspi DT node matching Linux kernel as of commit
d7cd74466651e ("arm64: dts: imx8mp: Reorder flexspi clock-names entry")

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 years agospi: nxp_fspi: Add i.MX8MP compatible string
Marek Vasut [Wed, 9 Mar 2022 03:18:57 +0000 (04:18 +0100)]
spi: nxp_fspi: Add i.MX8MP compatible string

The i.MX8M Mini and i.MX8M Plus flexspi IPs are compatible with one
another, however the linux kernel DT uses separate compatible string
for each SoC. Add the missing i.MX8MP compatible into this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: gateworks venice: add support for GPY111 phy
Tim Harvey [Tue, 8 Mar 2022 18:47:44 +0000 (10:47 -0800)]
board: gateworks venice: add support for GPY111 phy

The TI DP83867 phy has been replaced with the MaxLinear GPY111 phy due
to part availability.

Add support for it by adding LED config and dt-prop based internal delay
config tx-delay/rx-delay per PHY ID.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: venice: add spl_board_loader_name
Tim Harvey [Tue, 8 Mar 2022 18:45:39 +0000 (10:45 -0800)]
board: venice: add spl_board_loader_name

Implement spl_board_loader_name to provide more meaningful device names
vs MMC1 and MMC2.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2 years agoimx8m{m,n}-venice-gw7902: add GSC ADC rail for VDD_5P0
Tim Harvey [Tue, 8 Mar 2022 18:44:43 +0000 (10:44 -0800)]
imx8m{m,n}-venice-gw7902: add GSC ADC rail for VDD_5P0

The GW7902-C revision adds an ADC for the VDD_5P0 voltage rail.
Add register definitions for it.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8m{m,n}_venice: update boot_net script to load fdt
Tim Harvey [Fri, 18 Feb 2022 23:20:17 +0000 (15:20 -0800)]
imx8m{m,n}_venice: update boot_net script to load fdt

Update the 'boot_net' script to load the fdt with the kernel.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoARM: renesas: reduce rcar3_salvator-x image size
Heinrich Schuchardt [Mon, 11 Apr 2022 09:45:29 +0000 (11:45 +0200)]
ARM: renesas: reduce rcar3_salvator-x image size

rcar3_salvator-x u-boot.img is very close to the 0x100000 size limit.

Enable linked time optimization (LTO).

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoARM: dts: imx: Add support for Data Modul i.MX8M Mini eDM SBC
Marek Vasut [Tue, 12 Apr 2022 15:26:01 +0000 (17:26 +0200)]
ARM: dts: imx: Add support for Data Modul i.MX8M Mini eDM SBC

Add support for Data Modul i.MX8M Mini eDM SBC board. This is an
evaluation board for various custom display units. Currently
supported are serial console, ethernet, eMMC, SD, SPI NOR,
USB host and USB OTG.

Reviewed-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agoimx8mm-cl-iot-gate: Add redundand environment support
Fabio Estevam [Tue, 12 Apr 2022 16:05:39 +0000 (13:05 -0300)]
imx8mm-cl-iot-gate: Add redundand environment support

Add redundand environment support as it is required
by SWUpdate.

While at it, also adjust the CONFIG_ENV_OFFSET to a more appropriate
larger offset as done on other i.MX8M defconfigs.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoimx8mm-cl-iot-gate: Retrieve the serial number from EEPROM
Fabio Estevam [Tue, 12 Apr 2022 16:05:38 +0000 (13:05 -0300)]
imx8mm-cl-iot-gate: Retrieve the serial number from EEPROM

The serial number is located at offset 0x14 of the EEPROM
under i2c0 bus at address 0x54.

To print the serial number in Linux:

SERNUM=$(cat /proc/device-tree/serial-number)
echo $SERNUM

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoimx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM
Fabio Estevam [Tue, 12 Apr 2022 16:05:37 +0000 (13:05 -0300)]
imx8mm-cl-iot-gate: Retrieve the MAC address from EEPROM

Currently the eth0 MAC address is randomly assigned.

Retrieve the MAC address from EEPROM.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoimx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM
Fabio Estevam [Tue, 12 Apr 2022 16:05:36 +0000 (13:05 -0300)]
imx8mm-cl-iot-gate: Retrieve the DDR type from EEPROM

Currently, the DDR type is retrieved by iteracting inside an array
of possible DDR types.

This may take saveral attempts, which slows the overall U-Boot process
and does not provide a good user experience:

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 1/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x5000010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 2/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0x1061010 ]
resetting ...

U-Boot SPL 2021.07 (Feb 28 2022 - 06:39:32 +0000)
DDRINFO: Cfg attempt: [ 3/6 ]
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(T): mr5-8 [ 0xff000010 ]
Normal Boot
WDT:   Not starting
Trying to boot from MMC2
NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 07:12:44, Jan 24 2022

Improve the boot time by retrieving the correct DDR information from
the EEPROM:

U-Boot SPL 2022.04-rc4-00045-g6d02bc40d58c (Mar 19 2022 - 08:22:29 -0300)
DDRINFO(D): Kingston 4096G
DDRINFO(M): mr5-8 [ 0xff000010 ]
DDRINFO(E): mr5-8 [ 0xff000010 ]
Normal Boot
WDT:   Started watchdog@30280000 with servicing (60s timeout)
Trying to boot from MMC2
NOTICE:  BL31: v2.5(release):v2.5
NOTICE:  BL31: Built : 22:28:11, Mar 15 2022

Based on the original code from Compulab's U-Boot.

Tested on a imx8mm-cl-iot-gate board populated with 4GB of RAM.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoimx8mm-cl-iot-gate: Add SPL EEPROM support
Fabio Estevam [Tue, 12 Apr 2022 16:05:35 +0000 (13:05 -0300)]
imx8mm-cl-iot-gate: Add SPL EEPROM support

imx8mm-cl-iot-gate supports multiple DDR sizes and models.

The DDR type can be retrieved from the EEPROM, so add SPL code
that can be used to get the DDR information.

Based on the original code from Compulab's U-Boot.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agobsh: imx8mn-smm-s2/pro: Add iMX8MN BSH SMM S2 boards
Ariel D'Alessandro [Tue, 12 Apr 2022 13:31:38 +0000 (10:31 -0300)]
bsh: imx8mn-smm-s2/pro: Add iMX8MN BSH SMM S2 boards

Introduce BSH SystemMaster (SMM) S2 board family, which consists of:
iMX8MN SMM S2 and iMX8MN SMM S2 PRO boards.

Add support for iMX8MN BSH SMM S2 board:

- 256 MiB DDR3 RAM
- 512MiB Nand
- USBOTG1 peripheral - fastboot.
- 100Mbit Ethernet

Add support for iMX8MN BSH SMM S2 PRO board:

- 512 MiB DDR3 RAM
- 8 GiB eMMC
- USBOTG1 peripheral - fastboot.
- 100Mbit Ethernet

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2 years agonet: phy: nxp-tja11xx: Add NXP TJA11xx PHY driver
Michael Trimarchi [Tue, 12 Apr 2022 13:31:37 +0000 (10:31 -0300)]
net: phy: nxp-tja11xx: Add NXP TJA11xx PHY driver

Add driver for the NXP TJA1100 and TJA1101 PHYs. These PHYs are special
BroadRReach 100BaseT1 PHYs used in automotive.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: phy: Add phy_modify() accessor
Ariel D'Alessandro [Tue, 12 Apr 2022 13:31:36 +0000 (10:31 -0300)]
net: phy: Add phy_modify() accessor

Add read-modify-write unlocked accessor for accessing a PHY register.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoiopoll: Extend read_poll_timeout macro to support variable parameters
Ariel D'Alessandro [Tue, 12 Apr 2022 13:31:35 +0000 (10:31 -0300)]
iopoll: Extend read_poll_timeout macro to support variable parameters

This macro currently supports only one parameter. Based on Linux iopoll,
let's extend read_poll_timeout common API to allow multiple variable
parameters.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
2 years agophy: nxp-c45-tja11xx: Rename functions to be c45 tja11xx specific
Ariel D'Alessandro [Tue, 12 Apr 2022 13:31:34 +0000 (10:31 -0300)]
phy: nxp-c45-tja11xx: Rename functions to be c45 tja11xx specific

This driver supports NXP C45 TJA11XX PHYs, but there're also other NXP
TJA11XX PHYs. Let's rename functions in this driver to be c45 variant
specific, so further drivers can be introduced adding support for NXP
TJA11XX PHYs.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
2 years agoimx8m: add init_nand_clk
Michael Trimarchi [Tue, 12 Apr 2022 13:31:33 +0000 (10:31 -0300)]
imx8m: add init_nand_clk

Add init_nand_clk to enable gpmi nand clock. Since i.MX8M not use CCF,
so we still use legacy mode to configure the clock.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2 years agoimx8m: add regs used by GPMI
Michael Trimarchi [Tue, 12 Apr 2022 13:31:32 +0000 (10:31 -0300)]
imx8m: add regs used by GPMI

Add regs used by GPMI

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoARM: imx8mm: verdin-imx8mm: Drop superfluous header
Marek Vasut [Mon, 11 Apr 2022 20:39:44 +0000 (22:39 +0200)]
ARM: imx8mm: verdin-imx8mm: Drop superfluous header

The power/bd71837.h should no longer be included, since V1.1 SoM
uses only the PCA9450 PMIC and the BD71837 support was removed.
Drop the header too.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Max Krummenacher <max.krummenacher@toradex.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agodriver: pwm: pwm-imx: separe dm from non dm implementation
Tommaso Merciai [Sat, 26 Mar 2022 11:19:08 +0000 (12:19 +0100)]
driver: pwm: pwm-imx: separe dm from non dm implementation

Separe dm implementation from non dm implementation of pwm-imx
driver using CONFIG_DM_PWM

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
2 years agodrivers: pwm: pwm-imx: move pwm-imx-util into pwm-imx
Tommaso Merciai [Sat, 26 Mar 2022 11:19:05 +0000 (12:19 +0100)]
drivers: pwm: pwm-imx: move pwm-imx-util into pwm-imx

Move pwm_imx_get_parms, pwm_id_to_reg functions into pwm-imx.c
and drop off pwm-imx-util.c

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
2 years agoimx: mx7dsabresd: enable DM_SERIAL
Peng Fan [Mon, 11 Apr 2022 10:02:16 +0000 (18:02 +0800)]
imx: mx7dsabresd: enable DM_SERIAL

Enable CONFIG_DM_SERIAL, and `dm tree` could show:
 serial        1  [   ]   serial_mxc            |       |-- serial@30a80000

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8mq: soc: Set the BYPASS ID SWAP bit (GPR10 bit 1)
Peng Fan [Sun, 10 Apr 2022 04:18:27 +0000 (12:18 +0800)]
imx8mq: soc: Set the BYPASS ID SWAP bit (GPR10 bit 1)

Set the BYPASS ID SWAP bit (GPR10 bit 1).
The ID SWAP function randomly make TZASC grant non-secure access to
secure memory. TZASC ID SWAP should be bypassed by setting the bit
TZASC_ID_SWAP_BYPASS(bit 1) in IOMUX_GPR10 register.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoboard: colibri-imx6ull: fix detecting sd card
Marcel Ziswiler [Fri, 8 Apr 2022 10:28:21 +0000 (12:28 +0200)]
board: colibri-imx6ull: fix detecting sd card

Turns out on certain carrier boards (e.g. Iris V2) and under certain
circumstances (e.g. after a software reset) the SD card may have been
left in a strange state which later failed as follows:

Colibri iMX6ULL # mmc dev 0
Card did not respond to voltage select! : -110

Fix this as follows:
- Re-name the signaling voltage rail regulator from vmmc to vqmmc.
- Fix the name of the GPIO property to gpios.
- Specify 4-bit bus width, no write-protect capability and no 1.8
  volt signaling voltage capability.
- Fix the clock vs. command pull-up vs. push-pull configuration.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoconfigs: colibri-imx6ull/-emmc: use micrel ksz8xxx phy driver
Marcel Ziswiler [Fri, 8 Apr 2022 10:28:15 +0000 (12:28 +0200)]
configs: colibri-imx6ull/-emmc: use micrel ksz8xxx phy driver

Use the Micrel KSZ8xxx specific Ethernet PHY driver rather than the
generic one.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agocolibri-imx6ull: fix nand bch geometry
Marcel Ziswiler [Fri, 8 Apr 2022 10:27:41 +0000 (12:27 +0200)]
colibri-imx6ull: fix nand bch geometry

Fix NAND BCH geometry as otherwise the following errors are observed
upon boot:

...
Loading Environment from NAND... NAND read from offset 380000 failed -74
...
NAND read from offset 800 failed -74
...
ubi0 error: ubi_io_read: error -74 (ECC error) while reading 64 bytes
 from PEB 0:0, read 64 bytes
...

Fixes: ed48490f8d3f
("mtd: gpmi: fix the bch setting backward compatible issue")
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agodisk: part: add the device search failed log msg
Oleksii Bidnichenko [Fri, 8 Apr 2022 08:07:13 +0000 (10:07 +0200)]
disk: part: add the device search failed log msg

Add missing error message to blk_get_device_part_str.

Signed-off-by: Oleksii Bidnichenko <oleksii.bidnichenko@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoboard: colibri-imx6ull: fix detecting ethernet phy
Philippe Schenker [Fri, 8 Apr 2022 08:07:11 +0000 (10:07 +0200)]
board: colibri-imx6ull: fix detecting ethernet phy

Now that it is possible to use regulator-fixed-clock make use
of it. This makes U-Boot detect the PHY on first cold-boot.

This commit also adjusts the code in setup_fec and follows
how it is done in mx6ullevk.c

This commit also slows down the boot-process by about 150ms
as it now waits for the regulator-fixed-clock voltage that
drives the PHY to go up.
If you rely on very fast boot-speeds and don't need ethernet
for your boot-process you can safely revert the changes on
imx6ull-colibri.dtsi

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoregulator: fixed: add possibility to enable by clock
Philippe Schenker [Fri, 8 Apr 2022 08:07:10 +0000 (10:07 +0200)]
regulator: fixed: add possibility to enable by clock

This commit adds the possibility to choose the compatible
"regulator-fixed-clock" in devicetree.

This is a special case of regulator-fixed where a clock has to
be used to switch the regulator on and off.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoboard: colibri-imx6ull: Do not leave variant variable unset
Philippe Schenker [Fri, 8 Apr 2022 08:07:08 +0000 (10:07 +0200)]
board: colibri-imx6ull: Do not leave variant variable unset

Toradex uses the variable variant to distinguish between modules with
eMMC, NAND with wifi and NAND without wifi.
This variable is set on every boot. Set this variable also if we have a
NAND module without wifi to prevent issues.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoapalis-tk1: avoid save environment unasked
Denys Drozdov [Fri, 8 Apr 2022 08:07:07 +0000 (10:07 +0200)]
apalis-tk1: avoid save environment unasked

U-Boot should never save the environment unasked.
This also avoids storing broken fdt_module to flash.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoapalis-imx6: avoid save environment unasked
Denys Drozdov [Fri, 8 Apr 2022 08:07:06 +0000 (10:07 +0200)]
apalis-imx6: avoid save environment unasked

U-Boot should never save the environment unasked.
This also avoids storing broken ftd_file to eMMC.

Signed-off-by: Denys Drozdov <denys.drozdov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agocolibri-imx6ull: drop vidargs and remove video= settings
Oleksandr Suvorov [Fri, 8 Apr 2022 08:07:03 +0000 (10:07 +0200)]
colibri-imx6ull: drop vidargs and remove video= settings

Since we envision using overlays for display interfaces, the video=
settings within vidargs are obsolete. Remove these settings from the
U-Boot.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoinclude: colibri_vf: add missing tdxargs variable
Philippe Schenker [Fri, 8 Apr 2022 08:07:02 +0000 (10:07 +0200)]
include: colibri_vf: add missing tdxargs variable

All the other NAND-based boards have tdxargs specified for setting
manual kernel command-line arguments.

Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoconfigs: verdin-imx8mm: verdin-imx8mp: enable dm serial
Marcel Ziswiler [Fri, 8 Apr 2022 08:06:57 +0000 (10:06 +0200)]
configs: verdin-imx8mm: verdin-imx8mp: enable dm serial

Enable driver model for serial.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoarm64: dts: imx8mm-u-boot.dtsi: imx8mp-u-boot.dtsi: use atf-bl31 type
Marcel Ziswiler [Fri, 8 Apr 2022 08:06:56 +0000 (10:06 +0200)]
arm64: dts: imx8mm-u-boot.dtsi: imx8mp-u-boot.dtsi: use atf-bl31 type

Explicitly use the atf-bl31 type for the bl31.bin atf-blob. This uses
the path from the BL31 environment variable, if defined.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoARM: imx8mm: verdin-imx8mm: Rework board_early_init()
Marek Vasut [Fri, 8 Apr 2022 00:15:00 +0000 (02:15 +0200)]
ARM: imx8mm: verdin-imx8mm: Rework board_early_init()

Rename board_early_init_f() to board_early_init(), since this function
has nothing to do with actual board_early_init_f() as used throughout
U-Boot. The board_early_init() is function local to this board used to
configure UART and WDT pinmux. Wrap init_uart_clk() into this function
so that early UART init would be all in one place. Turn the function
into __weak one, so it could be overridden in case custom carrier board
uses different UART or needs custom IOMUX settings.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Max Krummenacher <max.krummenacher@toradex.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agoimx8m: soc: Relocate u-boot to the top DDR in 4GB space
Ye Li [Thu, 7 Apr 2022 07:55:56 +0000 (15:55 +0800)]
imx8m: soc: Relocate u-boot to the top DDR in 4GB space

The EFI memory init uses gd->ram_top for conventional memory. In
current implementation, the ram_top is below optee address. This cause
grub failed to allocation memory for initrd.
The change updates DDR bank setup functions to place the u-boot at top
DDR in 4GB space.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8m: soc: drop phy-reset-gpios for fec
Peng Fan [Thu, 7 Apr 2022 07:55:55 +0000 (15:55 +0800)]
imx8m: soc: drop phy-reset-gpios for fec

Need to drop phy-reset-gpios before booting linux, this property
is legacy property and replaced with reset-gpios.

If provide both, kernel would failed to request the same gpio twice
and cause fec not work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8m: soc: runtime drop extcon property from usbotg node
Peng Fan [Thu, 7 Apr 2022 07:55:54 +0000 (15:55 +0800)]
imx: imx8m: soc: runtime drop extcon property from usbotg node

The extcon is an decrepted property and not used by upstream Linux and
NXP 5.10 kernel, so we remove it before kicking linux in case it is in
dts. Otherwise distro kernel will not able to have usb function.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mp: disable fused IP for UltraLite
Peng Fan [Thu, 7 Apr 2022 07:55:53 +0000 (15:55 +0800)]
imx: imx8mp: disable fused IP for UltraLite

Beside the fused modules on iMX8MP Lite, this part has also fused
GPU3D/2D, LVDS and MIPI DSI.
So we have to disable them for kernel and also disable MIPI DSI
in u-boot DTS for splash screen at runtime.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mp: detect i.MX8MP UltraLite when get cpu rev
Peng Fan [Thu, 7 Apr 2022 07:55:52 +0000 (15:55 +0800)]
imx: imx8mp: detect i.MX8MP UltraLite when get cpu rev

Detect i.MX8MP UltraLite in get_cpu_variant_type

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mp: Add iMX8MP UltraLite Part cpu type
Peng Fan [Thu, 7 Apr 2022 07:55:51 +0000 (15:55 +0800)]
imx: imx8mp: Add iMX8MP UltraLite Part cpu type

Add i.MX8MP UltraLite Part CPU type

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agomx6: ddr: Wait before issuing the first MRS cmd
Francesco Dolcini [Wed, 6 Apr 2022 11:53:25 +0000 (13:53 +0200)]
mx6: ddr: Wait before issuing the first MRS cmd

Wait 1ms before issuing the first MRS command to write DDR3 Mode
registers.

There is a requirement to wait a minimum time before issuing command to
the DDR3 device, according to the JEDEC standard this time is 500us
(after RESET_n is de-asserted until CKE becomes active) + tXPR (Reset
CKE Exit time, maximum value 360ns).

It seems that for some reason this is not enforced by the MMDC
controller.

Without this change we experienced random memory initialization failures
with about 2% boot failure rate on specific problematic boards, after
this change we were able to do more than 10.000 power-cycle without a
single failure.

Fixes: fe0f7f7842e1 ("mx6: add mmdc configuration for MX6Q/MX6DL")
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agomx6: ddr: Restore ralat/walat in write level calibration
Francesco Dolcini [Wed, 6 Apr 2022 11:53:24 +0000 (13:53 +0200)]
mx6: ddr: Restore ralat/walat in write level calibration

The current DDR write level calibration routine always overwrite
the ralat/walat fields to their maximum value, just save
the existing values at the beginning of the calibration routine
and restore it at the end.

In case the delay is estimated by the user to be more than one cycle the
walat should be configured according to that, this is not
automatically done.  From the i.MX6 RM:

   The user should read the results of the associated delay-line at
   MPWLDECTRL#[WL_DL_ABS_OFFSET#] and in case the user estimates that the
   reasonable delay may be above 1 cycle then the user should indicate it at
   MPWLDECTRL#[WL_CYC_DEL#]. Moreover the user should indicate it in
   MDMISC[WALAT] field. For example, if the result of the write leveling calibration
   is 100/256 parts of a cycle, but the user estimates that the delay is above 2 cycles
   then MPWLDECTRL#[WL_CYC_DEL#] should be configured to 2, so the total
   delay will be 2 and 100/256 parts of a cycle

Probably it would just possible to not overwrite the mdmisc register in
the first place, since this is not present in the write_level_calib() example
in NXP AN4467 nor in the i.MX6 RM (44.11.6.1 Hardware Write Leveling
Calibration).

Fixes: d339f16911c7 ("arm: imx6: Add DDR3 calibration code for MX6 Q/D/DL")
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agomisc: imx8ulp: Update fuse driver
Peng Fan [Wed, 6 Apr 2022 06:30:31 +0000 (14:30 +0800)]
misc: imx8ulp: Update fuse driver

- According to S400 API, the fuse bank 25 (Testconfig2) is able to
access. Add it into driver's mapping table.
- According to FSB words list, the reserved 48 words are ahead of
the bank 5 and bank 6. Fix the wrong position.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp_evk: Enable multiple env storage devices
Ye Li [Wed, 6 Apr 2022 06:30:30 +0000 (14:30 +0800)]
imx: imx8ulp_evk: Enable multiple env storage devices

Enable multiple storages for u-boot env:
MMC or SPI flash or NOWHERE for usb
so u-boot can runtime select the storage flash according to boot device.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp_evk: enlarge CONFIG_NR_DRAM_BANKS
Peng Fan [Wed, 6 Apr 2022 06:30:29 +0000 (14:30 +0800)]
imx: imx8ulp_evk: enlarge CONFIG_NR_DRAM_BANKS

When TEE is present, the DRAM maybe split to two parts,
so enlarge CONFIG_NR_DRAM_BANKS

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: reserve tee memory
Ji Luo [Wed, 6 Apr 2022 06:30:28 +0000 (14:30 +0800)]
imx: imx8ulp: reserve tee memory

The TEE memory should be reserved when TEE is present, so need
to runtime update dram bank and memory information according to
tee present or not.

Signed-off-by: Ji Luo <ji.luo@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: enable wdog_ad interrupt in CMC1
Peng Fan [Wed, 6 Apr 2022 06:30:27 +0000 (14:30 +0800)]
imx: imx8ulp: enable wdog_ad interrupt in CMC1

Enable wdog_ad interrupt being triggered by CMC1 to CM33 to let CM33
know A35 reset and reinitialize rpmsg.
Clear wdog_ad and AD_PERIPH reset interrupt after A35 up, otherwise
M33 will always receive interrupt.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp_evk: Enable SD/MMC port auto detect
Peng Fan [Wed, 6 Apr 2022 06:30:26 +0000 (14:30 +0800)]
imx: imx8ulp_evk: Enable SD/MMC port auto detect

Enable the SD/MMC port auto detect.
The mmc relevant env can be reset when auto detect is enabled.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: dynamic setting mmcdev and mmcroot
Peng Fan [Wed, 6 Apr 2022 06:30:25 +0000 (14:30 +0800)]
imx: dynamic setting mmcdev and mmcroot

Dynamic setting mmcdev and mmcroot.
Then when boot linux, we can have correct "root=/dev/mmcblk[x]p2"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp_evk: call the handshake with M33
Ye Li [Wed, 6 Apr 2022 06:30:23 +0000 (14:30 +0800)]
imx: imx8ulp_evk: call the handshake with M33

If M33 handshake is successful, TPM and DSI panel MUX setting is
done by M33, no need to set them.
If handshake is failed or M33 is not booted, continue the TPM
and DSI panel MUX setting

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp_evk: Update LPDDR4 PHY settings
Ye Li [Wed, 6 Apr 2022 06:30:22 +0000 (14:30 +0800)]
imx: imx8ulp_evk: Update LPDDR4 PHY settings

Update DDR PHY settings to support LPDDR4 mode only by adjusting
DQ VREF ctrl, ODT and pads drive strength.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: release CAAM for the Cortex-A35
Clement Faure [Wed, 6 Apr 2022 06:30:21 +0000 (14:30 +0800)]
imx: imx8ulp: release CAAM for the Cortex-A35

Release the CAAM for the A35 from the SPL.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agomisc: S400_API: Update S400 API for buffer dump
Ye Li [Wed, 6 Apr 2022 06:30:20 +0000 (14:30 +0800)]
misc: S400_API: Update S400 API for buffer dump

Add ahab_dump_buffer API to dump AHAB buffer for debug purpose

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agomisc: S400_API: add ahab_release_caam
Clement Faure [Wed, 6 Apr 2022 06:30:19 +0000 (14:30 +0800)]
misc: S400_API: add ahab_release_caam

Add ahab_release_caam() function to the S400 API.

Signed-off-by: Clement Faure <clement.faure@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: Load the lposc fuse for dual boot
Ye Li [Wed, 6 Apr 2022 06:30:18 +0000 (14:30 +0800)]
imx: imx8ulp: Load the lposc fuse for dual boot

Found the lposc fuse loading having impact to cpu idle in kernel.
Without the loading in dual boot mode, kernel will hang after idle
for a while.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: Change LPAV assignment for dual boot
Ye Li [Wed, 6 Apr 2022 06:30:17 +0000 (14:30 +0800)]
imx: imx8ulp: Change LPAV assignment for dual boot

Assign the LPAV owner to RTD, and assign LPAV masters and peripherals
to APD. So except the masters and peripherals, other resources
(like DDR, cgc2, pcc5) in LPAV won't be reset during reboot and suspend.

No needs to initialize DDR again after reboot.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agomisc: imx8ulp: Add OEM SRK Hash fuse support
Ye Li [Wed, 6 Apr 2022 06:30:16 +0000 (14:30 +0800)]
misc: imx8ulp: Add OEM SRK Hash fuse support

Since latest S400 firmware has supported to read OEM SRK Hash, add
it to the driver's table

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: enable MU0_B clk by default
Peng Fan [Wed, 6 Apr 2022 06:30:15 +0000 (14:30 +0800)]
imx: imx8ulp: enable MU0_B clk by default

Enable MU0_B clk by default. When M33 image is loaded by Jlink,
the previous method not enable MU0_B clk and not able to communicate
with M33, so let's enable it by default.

And we not put it under kernel dts, because it conflicts with i.MX8QM
suspend/resume logic which requires large change.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: cgc: Switch to NICLPAV to FRO192 before PLL4 init
Ye Li [Wed, 6 Apr 2022 06:30:14 +0000 (14:30 +0800)]
imx: imx8ulp: cgc: Switch to NICLPAV to FRO192 before PLL4 init

When reset with dual boot mode, the LPAV domain won't power down
due to its master is not assigned to APD. So the NICLPAV keeps the
last setting to use PLL4PFD1. So before SPL initialize the PLL4,
we need to switch NICLPAV to FRO192, otherwise system will hang.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp_evk: Skip init DDR for reboot in dual boot mode
Ye Li [Wed, 6 Apr 2022 06:30:13 +0000 (14:30 +0800)]
imx: imx8ulp_evk: Skip init DDR for reboot in dual boot mode

When M33 is LPAV owner in dual boot, DDR, PCC5, CGC2 won't be reset
during APD reset. So no need to init DDR again after reboot, but need to
reconfigure the PLL4 PFD/PFDDIV/LPAV NIC etc, because kernel may
change or disable some of them.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: add ND/LD clock
Peng Fan [Wed, 6 Apr 2022 06:30:12 +0000 (14:30 +0800)]
imx: imx8ulp: add ND/LD clock

Add a new ddr script, defconfig for ND
Configure the clock for ND mode
changing A35 to 960MHz for OD mode
Update NIC CLK for the various modes
Introduce clock_init_early/late, late is used after pmic voltage
setting, early is used in the very early stage for upower mu, lpuart and
etc.

Note: NIC runs at 324MHz, 442MHz has some random kernel hang issue with
cpuidle enabled now.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp_evk: Remove PMIC Bucks PWM mode settings
Ye Li [Wed, 6 Apr 2022 06:30:11 +0000 (14:30 +0800)]
imx: imx8ulp_evk: Remove PMIC Bucks PWM mode settings

This workaround is not needed on i.MX8ULP proto-1B EVK as board has
fixed the problem. Because we don't support proto-1A any longer,
remove the PMIC settings.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: add CAAM clock entry
Peng Fan [Wed, 6 Apr 2022 06:30:10 +0000 (14:30 +0800)]
imx: imx8ulp: add CAAM clock entry

Add CAAM clock entry in PCC3

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: clock: Add clock support for i3c controller
Clark Wang [Wed, 6 Apr 2022 06:30:09 +0000 (14:30 +0800)]
imx: imx8ulp: clock: Add clock support for i3c controller

Add i3c controller clock enable/disable function for imx8ulp.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8ulp: Add M33 handshake functions
Ye Li [Wed, 6 Apr 2022 06:30:08 +0000 (14:30 +0800)]
imx: imx8ulp: Add M33 handshake functions

Add functions to check if M33 image is booted and handshake with M33
image via MU. A core notifies M33 to start init by FCR F0, then wait
M33 init done signal by checking FSR F0.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>