platform/kernel/u-boot.git
2 years agoimx8m: lock id_swap_bypass bit in tzc380 enable
Andrey Zhizhikin [Mon, 24 Jan 2022 20:48:09 +0000 (21:48 +0100)]
imx8m: lock id_swap_bypass bit in tzc380 enable

According to TRM for i.MX8M Nano and Plus, GPR10 register contains lock
bit for TZASC_ID_SWAP_BYPASS bit. This bit is required to be set in
order to avoid AXI bus errors when GPU is enabled on the platform.
TZASC_ID_SWAP_BYPASS bit is alread set for all imx8m applicable
derivatives, but is missing a lock settings to be applied.

Set the TZASC_ID_SWAP_BYPASS_LOCK bit for those derivatives which have
it implemented.

Since we're here, provide also names to bits from TRM instead of using
BIT() macro in the code.

Fixes: deca6cfbf5d7 ("imx8mn: set BYPASS ID SWAP to avoid AXI bus errors")
Fixes: a07c7181296f ("imx8mp: set BYPASS ID SWAP to avoid AXI bus errors")
Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Cc: Peng Fan <peng.fan@nxp.com>
2 years agoimx: imx8mn_beacon: Enable TrustZone
Adam Ford [Mon, 24 Jan 2022 15:24:17 +0000 (09:24 -0600)]
imx: imx8mn_beacon: Enable TrustZone

When the board was added, enabling tzc380 was left off by
mistake.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoimx: imx8mm_beacon: Enable USB
Adam Ford [Sat, 22 Jan 2022 18:27:34 +0000 (12:27 -0600)]
imx: imx8mm_beacon: Enable USB

With the updated device tree's having USB support, enable in
U-Boot.  This also requires the addition of the imx8m power
domain, since the USB is gated by the power domain controller.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoarm: dts: imx8mm-beacon: Resync dtsi with Kernel 5.17-rc1
Adam Ford [Sat, 22 Jan 2022 18:27:33 +0000 (12:27 -0600)]
arm: dts: imx8mm-beacon: Resync dtsi with Kernel 5.17-rc1

Resync the SOM and baseboar files with the device trees that will
be included in 5.17-RC1 when it's cut.  This will improve pinmuxing
for USDHC1 and add USB functionality.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agosmegw01: Update DDR initialization
Fabio Estevam [Tue, 18 Jan 2022 20:39:50 +0000 (17:39 -0300)]
smegw01: Update DDR initialization

Sync with the latest DDR initialization from Phytec, which
uses version 1.2 of NXP's i.MX7D DRAM Register Programming Aid
spreadsheet.

This updated DDR initialization fixes occasional system freeze.

Signed-off-by: Fabio Estevam <festevam@denx.de>
2 years agoimx8mn-ddr4-evk: generate single bootable image
Andrey Zhizhikin [Mon, 17 Jan 2022 22:04:07 +0000 (23:04 +0100)]
imx8mn-ddr4-evk: generate single bootable image

As suggested in commit 028abfd9b157 ("imx8mm-evk: Generate a single
bootable flash.bin again") for imx8mm_evk, it is possible to produce
single bootable image via binman. This restores the original behavior in
distros, where only one boot container is used to create target image.

Perform similar adaptions in order to provide single bootable image for
imx8mn-ddr4-evk derivate.

Update documentation to drop additional step of copying u-boot.itb

Fixes: 353dfe4b4359 ("imx8mn-ddr4-evk: switch to use binman")
Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoimx: ventana: correct splashimage load address
Andrey Zhizhikin [Mon, 17 Jan 2022 11:31:46 +0000 (12:31 +0100)]
imx: ventana: correct splashimage load address

Commit 72d81360aabd ("global: Convert CONFIG_LOADADDR to
CONFIG_SYS_LOADADDR") dropped the usage of LOADADDR and replaced it with
SYS_LOADADDR.

Use the correct macro in environment by replacing CONFIG_LOADADDR with
CONFIG_SYS_LOADADDR.

Fixes: d75ebf3482c3 ("imx: ventana: fix splash logo drawing")
Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Acked-By: Tim Harvey <tharvey@gateworks.com>
2 years agoimx8mq_evk: configs: add/cleanup variables for distro boot
Andrey Zhizhikin [Sun, 16 Jan 2022 21:38:31 +0000 (22:38 +0100)]
imx8mq_evk: configs: add/cleanup variables for distro boot

Add fdt_addr_r fdtfile which used by distro boot, and cleanup legacy
environment variables.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2 years agoarm64: dts: imx8mq-u-boot.dtsi: improve odd blob-ext naming
Patrick Wildt [Thu, 13 Jan 2022 14:22:41 +0000 (15:22 +0100)]
arm64: dts: imx8mq-u-boot.dtsi: improve odd blob-ext naming

Rather than using odd implicit blob-ext naming, explicitly specify the
type to be of blob-ext and therefore also simplify the node naming.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoarm64: dts: imx8mm-u-boot.dtsi: use dash for node names
Patrick Wildt [Thu, 13 Jan 2022 14:22:17 +0000 (15:22 +0100)]
arm64: dts: imx8mm-u-boot.dtsi: use dash for node names

Some of the nodes were named using a underscore, so rectify this and
consistenly use dashes.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2 years agoarm64: dts: imx8mq-u-boot.dtsi: explicitly add spl filename
Patrick Wildt [Thu, 13 Jan 2022 14:21:47 +0000 (15:21 +0100)]
arm64: dts: imx8mq-u-boot.dtsi: explicitly add spl filename

Explicitly add SPL aka u-boot-spl.bin filename.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agoarm64: dts: imx8mq-u-boot.dtsi: alphabetically re-order properties
Patrick Wildt [Thu, 13 Jan 2022 14:21:24 +0000 (15:21 +0100)]
arm64: dts: imx8mq-u-boot.dtsi: alphabetically re-order properties

Alphabetically re-order properties.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Fabio Estevam <festevam@denx.de>
2 years agodoc: verdin-imx8mm: Remove ATF_LOAD_ADDR export
Fabio Estevam [Wed, 12 Jan 2022 20:49:46 +0000 (17:49 -0300)]
doc: verdin-imx8mm: Remove ATF_LOAD_ADDR export

imx8mm-u-boot.dtsi passes the ATF load address via the
'entry' and 'load' properties.

Remove the step that performs the ATF_LOAD_ADDR export, which is
now unneeded.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Patrick Wildt <patrick@blueri.se>
2 years agodoc: sl-mx8mm: Remove ATF_LOAD_ADDR export
Fabio Estevam [Wed, 12 Jan 2022 20:49:45 +0000 (17:49 -0300)]
doc: sl-mx8mm: Remove ATF_LOAD_ADDR export

imx8mm-u-boot.dtsi passes the ATF load address via the
'entry' and 'load' properties.

Remove the step that performs the ATF_LOAD_ADDR export, which is
now unneeded.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Patrick Wildt <patrick@blueri.se>
2 years agodoc: imx8mm_evk: Remove ATF_LOAD_ADDR export
Fabio Estevam [Wed, 12 Jan 2022 20:49:44 +0000 (17:49 -0300)]
doc: imx8mm_evk: Remove ATF_LOAD_ADDR export

imx8mm-u-boot.dtsi passes the ATF load address via the
'entry' and 'load' properties.

Remove the step that performs the ATF_LOAD_ADDR export, which is
now unneeded.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Patrick Wildt <patrick@blueri.se>
2 years agoimx: imx8mm: imx8mm-kontron-n801x-s: add common board u-boot.dtsi
Heiko Thiery [Wed, 12 Jan 2022 08:57:57 +0000 (09:57 +0100)]
imx: imx8mm: imx8mm-kontron-n801x-s: add common board u-boot.dtsi

When using a board variant that selects the lvds specific dtb the
*.u-boot.dtsi file will not be included. To have a lvds dtb specific
u-boot.dtsi file move this part to a common board u-boot.dtsi file and
include this in the board base u-boot.dtsi and create an additional one
for the lvds variant.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
2 years agoimx: imx8mm: imx8mm-kontron-n801x-s: convert options to Kconfig
Heiko Thiery [Wed, 12 Jan 2022 08:57:55 +0000 (09:57 +0100)]
imx: imx8mm: imx8mm-kontron-n801x-s: convert options to Kconfig

CONFIG_SPL_MMC and CONFIG_SPL_SERIAL

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
2 years agocmd: bcb: fix bcb struct alignment issue
Gary Bisson [Tue, 11 Jan 2022 17:06:06 +0000 (18:06 +0100)]
cmd: bcb: fix bcb struct alignment issue

Without this patch the bcb struct could be located at an odd address
which resulted in data not being copied to the buffer.

Here was the repro steps (from Mattijs):
=> mmc dev 1
=> bcb load 1 misc
=> bcb dump command
00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=> part start mmc 1 misc misc_start
=> mmc read ${loadaddr} ${misc_start} 4
=> bcb load 1 misc
=> bcb dump command
00000000: 62 6f 6f 74 6f 6e 63 65 2d 62 6f 6f 74 6c 6f 61
00000010: 64 65 72 00 00 00 00 00 00 00 00 00 00 00 00 00

This behavior was observed on an Amlogic A311D (ARM64) platform with a
recent GCC toolchain (11.2.0) but is most likely affecting other
platforms.

To avoid issues the structure is aligned on DMA minimum alignment value
as it is passed directly to the read function.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on khadas vim3
2 years agoconfigs: imx8mm-cl-iot-gate: update dfu_alt_info for single flash.bin
Ying-Chun Liu (PaulLiu) [Tue, 11 Jan 2022 16:38:04 +0000 (00:38 +0800)]
configs: imx8mm-cl-iot-gate: update dfu_alt_info for single flash.bin

We changed to single flash.bin now. So dfu_alt_info should be modified
to reflect this change.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agocmd_nandbcb: Support secondary boot address of imx8mn
Michael Trimarchi [Fri, 7 Jan 2022 17:27:17 +0000 (18:27 +0100)]
cmd_nandbcb: Support secondary boot address of imx8mn

Add support of secondary boot address for imx8mn. The secondary
boot address is hardcoded in the fuse. The value is calculated
from there according to the following description:

The fuse IMG_CNTN_SET1_OFFSET (0x490[22:19]) is defined as follows:
- Secondary boot is disabled if fuse value is bigger than 10, n = fuse
  value bigger than 10.
- n == 0: Offset = 4MB
- n == 2: Offset = 1MB
- Others & n <= 10 : Offset = 1MB*2^n
- For FlexSPI boot, the valid values are: 0, 1, 2, 3, 4, 5, 6, and 7.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2 years agoimx: Enable ACTLR.SMP in SPL for i.MX6/7
Sven Schwermer [Sun, 2 Jan 2022 19:36:56 +0000 (20:36 +0100)]
imx: Enable ACTLR.SMP in SPL for i.MX6/7

Similar to what has been done before with c5437e5b for u-boot proper, we
enable the SMP bit for SPL as well. This is necessary when SDP booting
straight into Linux, i.e. falcon boot. When SDP boot mode is active, the
ROM code does not set this bit which makes the caches not work once
activated in Linux.

On an i.MX6ULL (528MHz), this reduces a minimal kernel's boot time into
an initramfs shell from ~6.1s down to ~1.2s.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoMakefile: imx: Do not call arch/arm/mach-imx flash.bin generation if BINMAN enabled
Marek Vasut [Sat, 1 Jan 2022 18:50:39 +0000 (19:50 +0100)]
Makefile: imx: Do not call arch/arm/mach-imx flash.bin generation if BINMAN enabled

Skip running arch/arm/mach-imx flash.bin generation in case BINMAN is
enabled, otherwise the target in arch/arm/mach-imx/Makefile regenerates
the flash.bin again and produces corrupted result.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Peng Fan <peng.fan@oss.nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoARM: dts: imx: Synchronize iMX6QDL DHCOM PDK2 DTs with Linux 5.15.12
Marek Vasut [Thu, 30 Dec 2021 23:58:08 +0000 (00:58 +0100)]
ARM: dts: imx: Synchronize iMX6QDL DHCOM PDK2 DTs with Linux 5.15.12

Synchronize DH DHCOM DTs with Linux commit 25960cafa06e ("Linux 5.15.12").
There is no functional change to the resulting DTs. The imx6qdl-dhcom-pdk2.dtsi
had to be adjusted with additional headers, gpio.h, pwm.h, input.h, else
the DT cannot be compiled, the same change is likely necessary in Linux.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoARM: dts: imx: Add labels to remaining anatop regulators
Marek Vasut [Thu, 30 Dec 2021 23:58:07 +0000 (00:58 +0100)]
ARM: dts: imx: Add labels to remaining anatop regulators

Add labels to remaining anatop regulators, so their supplies can be
assigned in board DTs. This is similar to Linux kernel commit
93385546ba369 ("ARM: dts: imx6qdl-sabresd: Assign corresponding power supply for LDOs")
except it does not contain the unrelated sabresd changes.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoarm: dts: Enable support for USB on XEA (imx28) board
Lukasz Majewski [Mon, 27 Dec 2021 10:46:41 +0000 (11:46 +0100)]
arm: dts: Enable support for USB on XEA (imx28) board

This change enables the support for USB with DM on the XEA (imx28)
board.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2 years agoarm: xea: config: Provide special defconfig for a single binary u-boot
Lukasz Majewski [Mon, 27 Dec 2021 10:46:40 +0000 (11:46 +0100)]
arm: xea: config: Provide special defconfig for a single binary u-boot

The new configs/imx28_xea_sb_defconfig is introduced to facilitate
building the single binary u-boot.sb fox XEA board.

The biggest distinction from "normal" XEA imx28_xea_sb_defconfig is
support for USB mass storage devices (pen drives).

To achieve that, the CONFIG_DM_USB is enabled and supported.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2 years agoxea: dts: Update the SPI-NOR flash memory partitions description
Lukasz Majewski [Mon, 27 Dec 2021 10:46:38 +0000 (11:46 +0100)]
xea: dts: Update the SPI-NOR flash memory partitions description

Now the dts information corresponds to the one available in the kernel.
With this patch applied the 'mtd list' shows proper names and
offsets for MTD partitions.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2 years agoarm: xea: Modify board code to generate single binary u-boot
Lukasz Majewski [Mon, 27 Dec 2021 10:38:21 +0000 (11:38 +0100)]
arm: xea: Modify board code to generate single binary u-boot

This change provides the possibility to build XEA (imx287 based) board
U-Boot as a single binary (without support for CONFIG_SPL_FRAMEWORK).

The generated u-boot.sb can be used in the factory environment to for
example perform initial setup or HW testing.

It can be used with 'uuu' utility
(SDPS: boot -f /srv/tftp/xea/u-boot.sb)

In the configs/imx28_xea_defconfig one needs to disable following configs:
# CONFIG_SPL_BLK is not set
# CONFIG_SPL_FRAMEWORK is not set

The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S, which
is utilized when CONFIG_SPL_FRAMEWORK is disabled.

However, when it is enabled - the arch/arm/cpu/arm926ejs/start.S is used,
which requires the lowlevel_init() function.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2 years agospl: Provide more space to be used for storing SPL on imx28 OCRAM
Lukasz Majewski [Fri, 17 Dec 2021 15:41:25 +0000 (16:41 +0100)]
spl: Provide more space to be used for storing SPL on imx28 OCRAM

With the current configuration provided in mxsimage{-spl}.mx28.cfg the
size of SPL binary has been constrained to 32 KiB, due to "LOAD IVT"
command with 0x8000 offset.

The problem was that, the imx28 ROM takes the u-boot.sb and then
extracts from it the IVT header and places it on the 0x8000 OCRAM offset
overwriting any valid (i.e. loaded from eMMC or SPI-NOR) SPL code. This
bug was unnoticed as the overwrite size was just 32 bytes, so the
probability that some important code is altered was low.

However, in the XEA board (where the SPL size is ~39KiB), the overwritten
data was `(struct dm_spi_ops *) 0x800c <mxs_spi_ops>`, which is used
during the boot process.

As a result the SPL execution code hanged with "undefined instruction"
abort as callbacks (with wrong addresses) from it were called.

The fix is to change the OCRAM's offset where IVT is loaded to 0xE000,
so the SPL can grow up to ~57KiB (the maximal size of OCRAM memory
available is 0xE3FC).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2 years agoARM: dts: imx6ull: Use the correct name for ESAI_TX0
Fabio Estevam [Fri, 17 Dec 2021 11:09:19 +0000 (08:09 -0300)]
ARM: dts: imx6ull: Use the correct name for ESAI_TX0

According to the i.MX6ULL Reference Manual, pad CSI_DATA07 may
have the ESAI_TX0 functionality, not ESAI_T0.

Also, NXP's i.MX Config Tools 10.0 generates dtsi with the
MX6ULL_PAD_CSI_DATA07__ESAI_TX0 naming, so fix it accordingly.

There are no devicetree users in mainline that use the old name,
so just remove the old entry.

Fixes: f8ca22b8de32 ("arm: dts: imx6ull: add pinctrl defines")
Reported-by: George Makarov <georgemakarov1@gmail.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
2 years agomx6: Use imx6_src_get_boot_mode() to check boot device
Harald Seiler [Wed, 1 Dec 2021 09:11:47 +0000 (10:11 +0100)]
mx6: Use imx6_src_get_boot_mode() to check boot device

Use imx6_src_get_boot_mode() instead of manually reading SBMR1.  The
existing function has proper handling for software overrides of the
bootdevice which can happen, for example, when booting from an alternate
source using `bmode`.

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoARM: dts: imx6q-dhcom: Use 1G ethernet on the PDK2 board
Christoph Niedermaier [Sun, 28 Nov 2021 02:53:18 +0000 (03:53 +0100)]
ARM: dts: imx6q-dhcom: Use 1G ethernet on the PDK2 board

The PDK2 board is capable of running both 100M and 1G ethernet. However,
the i.MX6 has only one ethernet MAC, so it is possible to configure
either 100M or 1G Ethernet. In case of 100M option, the PHY is on the
SoM and the signals are routed to a RJ45 port. For 1G the PHY is on
the PDK2 board with another RJ45 port. 100M and 1G ethernet use
different signal pins from the i.MX6, but share the MDIO bus.

This SoM board combination is used to demonstrate how to enable 1G
ethernet configuration.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Cc: Stefano Babic <sbabic@denx.de>
2 years agotools/mxsimage: Remove fclose on empty FILE pointer
Mattias Hansson [Wed, 24 Nov 2021 12:10:49 +0000 (13:10 +0100)]
tools/mxsimage: Remove fclose on empty FILE pointer

If `sb_load_cmdfile()` fails to open the configuration file it will jump
to error handling where the code will try to `fclose()` the FILE pointer
which is NULL causing `mkimage` to segfault.

This patch removes the label for error handling and instead returns
immediately which skips the `fclose()` and prevents the segfault. The
errno is also described in the error message to guide users.

Signed-off-by: Mattias Hansson <hansson.mattias@gmail.com>
Reviewed-by: Wolfgang Denk <wd@denx.de>
2 years agoimx8mn_var_som: Add support for Variscite VAR-SOM-MX8M-NANO board
Ariel D'Alessandro [Tue, 23 Nov 2021 16:33:30 +0000 (13:33 -0300)]
imx8mn_var_som: Add support for Variscite VAR-SOM-MX8M-NANO board

Add support for iMX8MN VAR-SOM-MX8M-NANO board. Enables support for:

- 1GiB DDR4 RAM
- 16 GiB eMMC
- SD card
- Gigabit ethernet
- USBOTG1 peripheral - fastboot

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agocolibri-imx8x: add on-module gpio expander fxl6408
Oleksandr Suvorov [Sun, 21 Nov 2021 16:05:17 +0000 (18:05 +0200)]
colibri-imx8x: add on-module gpio expander fxl6408

The FXL6408 GPIO expander manages critical devices,
including on-module USB hub. Configure the expander to
switch the USB hub into bypass mode, allowing to use
on-carrier-board USB hub.

Signed-off-by: Oleksandr Suvorov <cryosay@gmail.com>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
2 years agoGPIO: fxl6408: Add support for FXL6408 GPIO expander
Oleksandr Suvorov [Sun, 21 Nov 2021 16:05:16 +0000 (18:05 +0200)]
GPIO: fxl6408: Add support for FXL6408 GPIO expander

Initial support for Fairchild's 8 bit I2C gpio expander FXL6408.
The CONFIG_FXL6408_GPIO define enables support for such devices.

Based on: https://patchwork.kernel.org/patch/9148419/

Signed-off-by: Oleksandr Suvorov <cryosay@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
2 years agoimx8mm-cl-iot-gate-optee: add CONFIG_SPL_MMC and CONFIG_SPL_SERIAL
Ying-Chun Liu (PaulLiu) [Mon, 15 Nov 2021 09:44:07 +0000 (17:44 +0800)]
imx8mm-cl-iot-gate-optee: add CONFIG_SPL_MMC and CONFIG_SPL_SERIAL

Previously these two options are called CONFIG_SPL_MMC_SUPPORT
and CONFIG_SPL_SERIAL_SUPPORT. During the transition they are
removed by accident. Thus adding them back.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agospi: mxc_spi: remove redundant code in spi_xchg_single()
Haolin Li [Sat, 6 Nov 2021 10:03:34 +0000 (03:03 -0700)]
spi: mxc_spi: remove redundant code in spi_xchg_single()

The value of cnt is overwritten without being used.

Signed-off-by: Haolin Li <li.haolin@qq.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoarm: imx8m: imx8mm-cl-iot-gate: detect extension board
Ying-Chun Liu (PaulLiu) [Fri, 5 Nov 2021 09:13:25 +0000 (17:13 +0800)]
arm: imx8m: imx8mm-cl-iot-gate: detect extension board

Extension boards can be added to Compulab's iot-gate-imx8mm.
We implement extension board manager for detecting the extension
boards.

Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: uboot-imx <uboot-imx@nxp.com>
2 years agoarm: dts: imx8mm-cl-iot-gate: add Compulab's ied overlays
Ying-Chun Liu (PaulLiu) [Fri, 5 Nov 2021 09:13:24 +0000 (17:13 +0800)]
arm: dts: imx8mm-cl-iot-gate: add Compulab's ied overlays

add the following overlays:
 - IED extension board
 - CAN/TPM/ADC extension board on IED board.

Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: uboot-imx <uboot-imx@nxp.com>
2 years agoimx8ulp: ddr: Fix DDR frequency request issue
Ye Li [Fri, 29 Oct 2021 01:46:34 +0000 (09:46 +0800)]
imx8ulp: ddr: Fix DDR frequency request issue

After acking the requested frequency, should wait the ack bit clear
by DDR controller and check the DFS interrupt for next request polling.
Otherwise, the next polling of request bit will get previous value
that DDR controller have not cleared it, so a wrong request frequency
is used.

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 agoimx8ulp:ddr: saving the dram config timing data into sram
Jacky Bai [Fri, 29 Oct 2021 01:46:33 +0000 (09:46 +0800)]
imx8ulp:ddr: saving the dram config timing data into sram

On i.MX8ULP, The dram config timing need to be saved into sram for
ddr retention when APD enter PD mode, so add this support on i.MX8ULP.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: implement to obtain the SoC current temperature
Alice Guo [Fri, 29 Oct 2021 01:46:32 +0000 (09:46 +0800)]
imx8ulp: implement to obtain the SoC current temperature

Obatin the SoC current temperature in print_cpuinfo().

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: clock: Handle the DDRLOCKED when setting DDR clock
Ye Li [Fri, 29 Oct 2021 01:46:30 +0000 (09:46 +0800)]
imx8ulp: clock: Handle the DDRLOCKED when setting DDR clock

The DDRLOCKED bit in CGC2 DDRCLK will auto lock up and down by HW
according to DDR DIV updating or DDR CLK halt status change. So DDR
PCC disable/enable will trigger the lock up/down flow. We
need wait until unlock to ensure clock is ready.

And before configuring the DDRCLK DIV, we need polling the DDRLOCKED
until it is unlocked. Otherwise writing ti DIV bits will not set.

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 agoimx8ulp: clock: Support to enable/disable the ADC1 clock
Alice Guo [Fri, 29 Oct 2021 01:46:29 +0000 (09:46 +0800)]
imx8ulp: clock: Support to enable/disable the ADC1 clock

This patch implements enable_adc1_clk() to enable or disable the ADC1
clock on i.MX8ULP.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: Update ethernet mac to get from fuse
Ye Li [Fri, 29 Oct 2021 01:46:28 +0000 (09:46 +0800)]
imx8ulp: Update ethernet mac to get from fuse

Get the MAC address from fuse bank5 word 3 and 4. It has
MSB first at lowest address, so have a reverse order with other
iMX used in mac.c

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 agoimx8ulp: clock: Support to reset DCNano and MIPI DSI
Ye Li [Fri, 29 Oct 2021 01:46:27 +0000 (09:46 +0800)]
imx8ulp: clock: Support to reset DCNano and MIPI DSI

When LPAV is allocated to RTD, the LPAV won't be reset. So we have to
reset DCNano and MIPI DSI in u-boot before enabling the drivers

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 agoimx8ulp: clock: Reset DDR controller before clock enable
Ye Li [Fri, 29 Oct 2021 01:46:26 +0000 (09:46 +0800)]
imx8ulp: clock: Reset DDR controller before clock enable

The LPAV is not allocated to APD when dual boot, so LPAV won't
reset when APD is reset. We have to explicitly reset the DDR,
otherwise its initialization will fail.

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 agoimx8ulp: Workaround LPOSC_TRIM fuse load issue
Ye Li [Fri, 29 Oct 2021 01:46:25 +0000 (09:46 +0800)]
imx8ulp: Workaround LPOSC_TRIM fuse load issue

8ULP ROM should read the LPOSC trim BIAS fuse to fill the CGC0
LPOSCCTRL[7:0], but it writes a fixed value on A0.1 revision.

A0.2 will fix the issue in ROM. But A0.1 we have to workaround
it in SPL by setting LPOSCCTRL BIASCURRENT again.

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 agoimx8ulp: Remove freescale name from CPU revision
Ye Li [Fri, 29 Oct 2021 01:46:24 +0000 (09:46 +0800)]
imx8ulp: Remove freescale name from CPU revision

Remove the freescale vendor name from CPU revision print to align
with other i.MX platforms

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 agoimx8ulp: Fix DCNANO QoS setting
Ye Li [Fri, 29 Oct 2021 01:46:23 +0000 (09:46 +0800)]
imx8ulp: Fix DCNANO QoS setting

The setting does not have effect because we should set it after
power on the PS16 for NIC AV.

So move it after upower_init which has powered on all PS

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 agoimx8ulp: Set DCNANO read QoS on NIC_LPAV to highest
Ye Li [Fri, 29 Oct 2021 01:46:22 +0000 (09:46 +0800)]
imx8ulp: Set DCNANO read QoS on NIC_LPAV to highest

To avoid DCNANO underrun issue on high loading test, set its
read Qos on NIC_LPAV to highest

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 agoimx8ulp_evk: Control LPI2C0 PCA6416 and TPM0 for display
Ye Li [Fri, 29 Oct 2021 01:46:21 +0000 (09:46 +0800)]
imx8ulp_evk: Control LPI2C0 PCA6416 and TPM0 for display

The board use IO9 of PCA6416 on LPI2C0 and TPM0 for MIPI DSI MUX and
backlight. However the LPI2C0 and TPM0 are M33 resources, in this
patch we simply access them, but this is a temporary solution.
We will modify it when M33 FW changes to set MIPI DSI panel as default
path and enable backlight after reset.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: rdc: allow A35 access flexspi0 mem
Ye Li [Fri, 29 Oct 2021 01:46:20 +0000 (09:46 +0800)]
imx8ulp: rdc: allow A35 access flexspi0 mem

For singel boot, set flexspi0 mem to be accessed by A35

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: clock: Add MIPI DSI clock and DCNano clock
Ye Li [Fri, 29 Oct 2021 01:46:19 +0000 (09:46 +0800)]
imx8ulp: clock: Add MIPI DSI clock and DCNano clock

Add the DSI clock enable and disable with PCC reset used.
Add the LCD pixel clock calculation and configuration for DCNano

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: clock: Support LPAV clocks in cgc and pcc
Ye Li [Fri, 29 Oct 2021 01:46:18 +0000 (09:46 +0800)]
imx8ulp: clock: Support LPAV clocks in cgc and pcc

Add the PCC5 clocks support and more LPAV clocks and PLL4 PFD in CGC.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: assign PXP/HIFI4/EPDC to APD domain
Peng Fan [Fri, 29 Oct 2021 01:46:17 +0000 (09:46 +0800)]
imx8ulp: assign PXP/HIFI4/EPDC to APD domain

Assign the PXP/HIFI4/EPDC to APD domain, otherwise APD not
able to receive interrupts from the modules.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoarm: imx8ulp: Allocate LPAV resources to AP domain
Ye Li [Fri, 29 Oct 2021 01:46:16 +0000 (09:46 +0800)]
arm: imx8ulp: Allocate LPAV resources to AP domain

When single boot, assign AP domain as the master domain of the LPAV.
Allocates LPAV master and slave resources like GPU, DCNano, MIPI-DSI
eDMA channel and eDMA request to APD

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoimx8ulp: soc: Check the DBD_EN fuse before setting RDC
Ye Li [Fri, 29 Oct 2021 01:46:15 +0000 (09:46 +0800)]
imx8ulp: soc: Check the DBD_EN fuse before setting RDC

S400 enables RDC only when the DBD_EN is fused. Otherwise, the RDC
is allowed by all masters.

Current S400 has issue if the XRDC has released to A35, then A35 reset
will fail in ROM due to S400 fails to get XRDC.
So temp work around is checking the DBD_EN, if it is not fused, we
don't need to call release XRDC or TRDC.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoARM: imx8m: support env in fat and ext4
Ricardo Salveti [Wed, 20 Oct 2021 19:16:26 +0000 (16:16 -0300)]
ARM: imx8m: support env in fat and ext4

Change boot device logic to also allow environment stored in fat and in
ext4 when booting from SD or from eMMC.

As the boot device check for SD and for eMMC was depending on
ENV_IS_IN_MMC being defined, change the ifdef blocks at env_get_location
to use IS_ENABLED instead for all modes, returning NOWHERE when no valid
mode is found.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoimx: nandbcb: Fix printf format in write_fcb
Pali Rohár [Wed, 20 Oct 2021 09:13:15 +0000 (11:13 +0200)]
imx: nandbcb: Fix printf format in write_fcb

Correct printf format for unsigned long long is %llx and not %llxx.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agomxs: power: Change sequence of enabling DCDC switches
Lukasz Majewski [Wed, 13 Oct 2021 13:40:12 +0000 (15:40 +0200)]
mxs: power: Change sequence of enabling DCDC switches

The imx28 uses following voltage supplies hierarchy:

VDD_5V (VDD_BAT) -> VDDIO -> VDDA -> VDDMEM
     \-----> VDDD

One shall first enable DCDC on the parent source (VDDIO) and then
follow with its children.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agoimx8mm-venice-gw7902: fix M2_RST# gpio pinmux
Tim Harvey [Wed, 6 Oct 2021 20:13:23 +0000 (13:13 -0700)]
imx8mm-venice-gw7902: fix M2_RST# gpio pinmux

Fix the invalid gw7902 M2_RST# gpio pinmux.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agomx7ulp_com: add support for SPL
Ricardo Salveti [Sun, 12 Sep 2021 14:32:57 +0000 (17:32 +0300)]
mx7ulp_com: add support for SPL

Add EA iMX7ULP COM board support for building SPL.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
2 years agomx7ulp: select soc features
Oleksandr Suvorov [Sun, 12 Sep 2021 14:32:55 +0000 (17:32 +0300)]
mx7ulp: select soc features

Force selecting features present in SoC i.MX7ULP.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Igor Opaniuk <igor.opaniuk@foundries.io>
2 years agoarm: imx: imx8mq: add support to get values for more clocks
Heiko Thiery [Thu, 9 Sep 2021 12:59:18 +0000 (14:59 +0200)]
arm: imx: imx8mq: add support to get values for more clocks

Return the root clock values for MXC_CSPI_CLK, MXC_I2C_CLK,
MXC_UART_CLK and MXC_QSPI_CLK.

At least for the I2C clock the missing support leads to a wrong
configured I2C frequency. The expected value is 100kHz but the resulting
value is about 1MHz.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
2 years agocolibri-imx7: improve env badblock management
Francesco Dolcini [Wed, 1 Sep 2021 07:48:03 +0000 (09:48 +0200)]
colibri-imx7: improve env badblock management

Use the complete 512kb (4 blocks) nand partition reserved for u-boot
environment instead of just the first block, this allows the module
to have a working environment even if 3 blocks are bad.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Fri, 4 Feb 2022 04:20:20 +0000 (23:20 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

This is the promised second part of the sunxi PR for 2022.04, albeit
technially outside of the merge window. We were working on this full
steam since the beginning of the year, and it deserves to be merged,
I think.
The main attraction is support for the F1C100s SoC, which sports a
venerable ARM926 core. Support for this SoC and the LicheePi Nano board
has been in Linux for years, and U-Boot patches were posted mid last
year already.
The new SoC using ARMv5 also means that the bulk of the new code should
not touch any existing boards, although we did some refactorings first,
of course, which actually cleans up some existing sunxi code.

Compile tested for all 160 sunxi boards, and briefly tested on BananaPi M1,
OrangePi Zero, Pine64 and Pine-H64. Tested by others on their boards,
including F1C100s and F1C200s devices.

2 years agoconfigs: sunxi: Add support for Lichee Pi Nano
Icenowy Zheng [Sat, 29 Jan 2022 15:23:09 +0000 (10:23 -0500)]
configs: sunxi: Add support for Lichee Pi Nano

The Lichee Pi Nano is a board based on the F1C100s.
Add defconfigs for it.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoARM: dts: suniv: Add device tree files and bindings for F1C100s
Icenowy Zheng [Sat, 29 Jan 2022 15:23:08 +0000 (10:23 -0500)]
ARM: dts: suniv: Add device tree files and bindings for F1C100s

Add device tree files for suniv and
Lichee Pi Nano it is a board based on F1C100s.
dt-bindings/dts are synced with 5.16.0

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agomach-sunxi: Add support for SUNIV architecture
Icenowy Zheng [Sat, 29 Jan 2022 15:23:07 +0000 (10:23 -0500)]
mach-sunxi: Add support for SUNIV architecture

Add support for the suniv architecture, which is newer ARM9 SoCs by
Allwinner. The design of it seems to be a mixture of sun3i, sun4i and
sun6i.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoconfigs: sunxi: Add common SUNIV header
Icenowy Zheng [Sat, 29 Jan 2022 15:23:06 +0000 (10:23 -0500)]
configs: sunxi: Add common SUNIV header

Adds support for SUNIV and the F1C100s.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: board: Add support for SUNIV
Icenowy Zheng [Sat, 29 Jan 2022 15:23:05 +0000 (10:23 -0500)]
sunxi: board: Add support for SUNIV

Generic Timer Extension is not available on SUNIV.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: Add F1C100s DRAM initial support
Icenowy Zheng [Sat, 29 Jan 2022 15:23:04 +0000 (10:23 -0500)]
sunxi: Add F1C100s DRAM initial support

Add support for F1C100s internal dram controller.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoARM: sunxi: Add clock and uart to sunxi headers
Icenowy Zheng [Sat, 29 Jan 2022 15:23:03 +0000 (10:23 -0500)]
ARM: sunxi: Add clock and uart to sunxi headers

This patch aims to add header files for the suniv.
The header files included add support for uart, and clocks.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoarm: arm926ej-s: Add sunxi code
Icenowy Zheng [Sat, 29 Jan 2022 15:23:02 +0000 (10:23 -0500)]
arm: arm926ej-s: Add sunxi code

Some Allwinner SoCs use ARM926EJ-S core.

Add Allwinner/sunXi specific code to ARM926EJ-S CPU dircetory.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agomach-sunxi: Move timer code to mach folder
Jesse Taube [Sat, 29 Jan 2022 15:23:01 +0000 (10:23 -0500)]
mach-sunxi: Move timer code to mach folder

Both armv7 and arm926ejs use this timer code so move it to mach-sunxi.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoarm: arm926ej-s: start.S: port save_boot_params support from armv7 code
Icenowy Zheng [Sat, 29 Jan 2022 15:23:00 +0000 (10:23 -0500)]
arm: arm926ej-s: start.S: port save_boot_params support from armv7 code

The ARMv7 start code has support for saving some boot params at the
entry point, which is used by some SoCs to return to BROM.

Port this to ARM926EJ-S start code.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi-common.h: remove pointless #ifdefs
Andre Przywara [Sun, 23 Jan 2022 00:30:29 +0000 (00:30 +0000)]
sunxi-common.h: remove pointless #ifdefs

Remove some pointless #ifdefs from this file, as there are quite too
many of them already.

Some definitions don't really hurt to have in any case, so remove the
pointless CONFIG_MMC guard around CONFIG_MMC_SUNXI_SLOT.

The BOARD_SIZE_LIMIT applies regardless of ARM64 or not (now), so remove
that guard as well. The maximum number of MMC devices does not depend on
CONFIG_ENV_IS_IN_MMC, so move that out to simplify the file.

Last but not least CONFIG_SPL_BOARD_LOAD_IMAGE serves no real purpose
anymore: it's unconditionally defined for all sunxi boards, and protects
nothing applicable outside of sunxi code anymore. Just remove it.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoarmv8: remove no longer needed lowlevel_init.S
Andre Przywara [Sun, 23 Jan 2022 00:31:06 +0000 (00:31 +0000)]
armv8: remove no longer needed lowlevel_init.S

When we added Allwinner SoC support to ARMv8, we needed to pull in an
implementation of lowlevel_init() calling the C function s_init(), as
sunxi required it as this time.

The last few patches got rid of this bogus requirement, and as sunxi was
still the only user, we can now remove this lowlevel_init.S from ARMv8
altogether.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agosunxi: move early "SRAM setup" into separate file
Andre Przywara [Sun, 23 Jan 2022 00:28:43 +0000 (00:28 +0000)]
sunxi: move early "SRAM setup" into separate file

Currently we do some magic "SRAM setup" MMIO writes in s_init(), copied
from the original BSP U-Boot. The comment speaks of this being required
before DRAM access gets enabled, but there is no indication that this
would actually be required that early.

Move this out of s_init(), into board_init_f(). Since this actually only
affects a very few older SoCs, the actual code goes into the cpu/armv7
directory, to move it out of the way for all other SoCs.

This also uses the opportunity to convert some #ifdefs over to the fancy
IS_ENABLED() macros used in actual C code.

We keep the s_init() stub around for now, since armv8's lowlevel_init
still relies on it.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agosunxi: move Cortex SMPEN setting into start.S
Andre Przywara [Sun, 23 Jan 2022 00:27:19 +0000 (00:27 +0000)]
sunxi: move Cortex SMPEN setting into start.S

According to their TRMs, Cortex ARMv7 CPUs with SMP support require the
ACTLR.SMPEN bit to be set as early as possible, before any cache or TLB
maintenance operations are done. As we do those things still in start.S,
we need to move the SMPEN bit setting there, too.

This introduces a new ARMv7 wide symbol and code to set bit 6 in ACTLR
very early in start.S, and moves sunxi boards over to use that instead
of the custom code we had in our board.c file (where it was called
technically too late).

In practice we got away with this so far, because at this point all the
other cores were still in reset, so any broadcasting would have been
ignored anyway. But it is architecturally cleaner to do it early, and
we move a core specific piece of code out of board.c.

This also gets rid of the ARM_CORTEX_CPU_IS_UP kludge I introduced a few
years back, and moves the respective logic into the new Kconfig entry.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: move non-essential code out of s_init()
Andre Przywara [Sat, 22 Jan 2022 10:05:12 +0000 (10:05 +0000)]
sunxi: move non-essential code out of s_init()

So far all Allwinner based boards were doing some not-so-lowlevel-setup
in lowlevel's s_init() routine.
This includes the initial clock, timer and pinmux setup, among other
things. This is clearly out of the "absolute bare minimum to get started"
scope that lowlevel_init.S suggests for this function.

Since we have an SPL, which is called right after s_init(), move those
calls to our board_init_f() function. As we overwrite this only for
the SPL, this has the added benefit of not doing this setup *again*
shortly afterwards, when running U-Boot proper.

This makes gpio_init() to be called from the SPL only, so pull this code
into a CONFIG_SPL_BUILD protected part to avoid build warnings.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoMerge branch '2022-02-03-assorted-fixes'
Tom Rini [Thu, 3 Feb 2022 20:55:02 +0000 (15:55 -0500)]
Merge branch '2022-02-03-assorted-fixes'

- Update CI image to have libgnutls available.
- Assorted ARM and SPL bugfixes

2 years agotreewide: Use 16-bit Unicode strings
Simon Glass [Sun, 23 Jan 2022 19:55:14 +0000 (12:55 -0700)]
treewide: Use 16-bit Unicode strings

At present we use wide characters for Unicode but this is not necessary.
Change the code to use the 'u' literal instead. This helps to fix build
warnings for sandbox on the Raspberry Pi.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoefi: Use 16-bit unicode strings
Simon Glass [Sun, 23 Jan 2022 19:55:12 +0000 (12:55 -0700)]
efi: Use 16-bit unicode strings

At present we use wide characters for unicode but this is not necessary.
Change the code to use the 'u' literal instead. This helps to fix build
warnings for sandbox on rpi.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2 years agoscripts/checkpatch.pl: Resync with v5.16
Simon Glass [Sun, 23 Jan 2022 19:55:11 +0000 (12:55 -0700)]
scripts/checkpatch.pl: Resync with v5.16

This resyncs us with the version found in v5.16 of the Linux kernel with
the following exceptions:
- Keep our u-boot specific tests / code area.
- Change the location of checkpatch.rst
- Drop the "use strscpy" test as we don't have that, but do have strlcpy
  and want that used now.
- Keep debug/printf in the list for $logFunctions

This also syncs the spdxcheck.py tool and all the associated
documentation.
S
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoarmv8: start.S: remove CONFIG_SYS_RESET_SCTRL code
Andre Przywara [Mon, 24 Jan 2022 17:17:40 +0000 (17:17 +0000)]
armv8: start.S: remove CONFIG_SYS_RESET_SCTRL code

There is some code that tries to "reset" the SCTLR_ELx register early in
the boot process. The idea seems to be to guarantee some sane settings
that U-Boot actually relies on, for instance running in little-endian
mode, with the MMU off initially.
However the current code has multiple problems:
- For a start, no platform or config defines the symbol that would
  enable that code.
- The code itself really only works if the bits that it tries to clear
  are already cleared:
  - If we run in big-endian mode initially, any previous loads would have
    been wrong already. That applies to the (optional) relocation code,
    but more prominently to the mask that it uses to clear those bits:
    "ldr x1, =0xfdfffffa" looks innocent, but actually involves a memory
    access to the literal pool, using the current endianness.
  - If we run with the MMU enabled, we are probably doomed already. We
    *could* hope that we are running with an identity mapping, but would
    need to do some cache maintenance to avoid losing dirty cache lines.
- The idea of doing a read-modify-write of SCTLR is somewhat
  questionable to begin with, because as the owner of the current
  exception level we should initialise all bits of this register with a
  certain fixed value.
- The code is unnecessarily complicated, and the function name is
  misspelled.

While those problems *could* admittedly be fixed, the point that is does
not seem to be used at all at the moment tells me we should just remove
this code, and be it to not give a bad example.

If people care, I could introduce some proper SCTLR initialisation code.
We are about to work this out for the boot-wrapper[1] as we speak, but
apparently we got away without doing this in U-Boot ever since, so it
might not be worth the potential trouble.

[1] https://lore.kernel.org/linux-arm-kernel/20220114105653.3003399-7-mark.rutland@arm.com/

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoscripts: Makefile: also clean subdir dtc
Philippe Reynes [Tue, 25 Jan 2022 10:32:20 +0000 (11:32 +0100)]
scripts: Makefile: also clean subdir dtc

Since commit 93b196532254 ("Makefile: Only build dtc if needed"),
the sub directory scripts/dtc is never cleaned.
Adds the directory dtc to subdir to always clean it.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agonet: ti: am65-cpsw: Cleanup resources before jump to kernel
Vignesh Raghavendra [Fri, 28 Jan 2022 05:51:19 +0000 (11:21 +0530)]
net: ti: am65-cpsw: Cleanup resources before jump to kernel

In case fastboot over Ethernet, am65_cpsw_stop() is not called unless
DM_FLAG_OS_PREPARE is set. Without call to am65_cpsw_stop(), DMA
resources are not released thus leading to failures in kernel.
Fix this by adding DM_FLAG_OS_PREPARE flag to am65_cpsw_nuss_port
driver.

Reported-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoarm: pdu001: Exend the list of maintained files
Felix Brack [Fri, 28 Jan 2022 13:36:12 +0000 (14:36 +0100)]
arm: pdu001: Exend the list of maintained files

Add the PDU001 board specific DT files to MAINTAINERS. This should
help for better tracking of changes to these files.

Signed-off-by: Felix Brack <fb@ltec.ch>
2 years agoarmv8: spl: Fix build with LINUX_KERNEL_IMAGE_HEADER
Alper Nebi Yasak [Sat, 29 Jan 2022 15:27:03 +0000 (18:27 +0300)]
armv8: spl: Fix build with LINUX_KERNEL_IMAGE_HEADER

Setting LINUX_KERNEL_IMAGE_HEADER=y attempts to include an ARM64 Linux
kernel image header at the start of both U-Boot proper and SPL binaries.
However, some definitions that the image header uses are not included by
the SPL linker script, resulting in a build error. Include them the way
they are included in U-Boot proper's linker script to fix the error.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2 years agospl: ymodem: Fix buffer overflow during Image copy
Vignesh Raghavendra [Mon, 31 Jan 2022 04:19:19 +0000 (09:49 +0530)]
spl: ymodem: Fix buffer overflow during Image copy

ymodem_read_fit() driver will end copying up to BUF_SIZE boundary even
when requested size of copy operation is less than that.
For example, if offset = 0, size = 1440B, ymodem_read_fit() ends up
copying 2KB from offset = 0, to destination buffer addr

This causes data corruption when malloc'd buffer is passed during UART
boot since commit 03f1f78a9b44 ("spl: fit: Prefer a malloc()'d buffer
for loading images")

With this, UART boot works again on K3 (AM654, J7, AM64) family of
devices.

Fixes: 03f1f78a9b44 ("spl: fit: Prefer a malloc()'d buffer for loading images")
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoDockfile, CI: Update to latest focal tag and build
Tom Rini [Thu, 3 Feb 2022 13:38:34 +0000 (08:38 -0500)]
Dockfile, CI: Update to latest focal tag and build

- Latest focal tag
- Add libgnutls to image

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoDockerfile: Add libgnutls package for building mkeficapsule command
AKASHI Takahiro [Tue, 1 Feb 2022 01:32:36 +0000 (10:32 +0900)]
Dockerfile: Add libgnutls package for building mkeficapsule command

For adding signing feature for capsule authentication to the host tool,
mkeficapsule, we will link gnutls library for crypto operation.
Since we need this command to complete the capsule authentication test
on sandbox in CI loop, necessary packages must be installed on the host.

See my patch, "tools: mkeficapsule: add firmware image signing."

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
Tom Rini [Wed, 2 Feb 2022 14:16:49 +0000 (09:16 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq

Update and fixes for ls1088a, FMAN, ls1046ardb, ls1043ardb
sync ls1028ardb u-boot and Linux device-tree

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-cfi-flash
Tom Rini [Tue, 1 Feb 2022 15:54:52 +0000 (10:54 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-cfi-flash

- cfi_mtd: populate mtd->dev with flash_info->dev (Patrice)

2 years agomtd: cfi_mtd: populate mtd->dev with flash_info->dev
Patrice Chotard [Fri, 3 Dec 2021 09:27:44 +0000 (10:27 +0100)]
mtd: cfi_mtd: populate mtd->dev with flash_info->dev

Populate mtd->dev with flash_info->dev which allows to get
full mtd information using the "mtd list" command.
Before, "mtd list" command returns :

List of MTD devices:
* nor0
  - type: NOR flash
  - block size: 0x40000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "nor0"

After this patch we get for example:

List of MTD devices:
* nor0
  - device: flash@0
  - parent: spi@40430000
  - driver: cfi_flash
  - path: /soc/spi@40430000/flash@0
  - type: NOR flash
  - block size: 0x40000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "nor0"

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoboard: ls1046ardb: force PCI device enumeration
Martin Schiller [Wed, 17 Nov 2021 11:59:20 +0000 (12:59 +0100)]
board: ls1046ardb: force PCI device enumeration

Commit 045ecf899252 ("configs: enable DM_ETH support for LS1046ARDB")
resulted in the PCI bus no longer being implicitly enumerated.

However, this is necessary for the fdt pcie fixups to work.

Therefore, similar to commit 8b6558bd4187 ("board: ls1088ardb:
transition to DM_ETH"), pci_init() is now called in the board_init()
routine when CONFIG_DM_ETH is active.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
CC: Priyanka Jain <priyanka.jain@nxp.com>
Acked-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2 years agoboard: ls1088a: update ifc node name to be memory-controller
Jianpeng Bu [Mon, 31 Jan 2022 13:12:36 +0000 (18:42 +0530)]
board: ls1088a: update ifc node name to be memory-controller

IFC-NOR and QSPI are muxed on SoC.
So disable IFC node in dts if QSPI is enabled or disable QSPI node in dts
in case QSPI is not enabled.
"ifc/nor" will be changed to "memory-controller/nor" in linux. So need to
modify "ifc/nor" to "memory-controller/nor" in fdt_path_offset().

Signed-off-by: Jianpeng Bu <jianpeng.bu@nxp.com>
[Rebased]
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>