]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 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>
4 years agoimx: imx8ulp: include pcc/cgc header in clock header
Peng Fan [Wed, 6 Apr 2022 06:30:07 +0000 (14:30 +0800)] 
imx: imx8ulp: include pcc/cgc header in clock header

With this change, we no need to include pcc/cgc header files both.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8ulp: Set COUNTER_FREQUENCY to 1Mhz
Ye Li [Wed, 6 Apr 2022 06:30:06 +0000 (14:30 +0800)] 
imx: imx8ulp: Set COUNTER_FREQUENCY to 1Mhz

The COUNTER_FREQUENCY is missed in 8ulp configs, it will cause SPL
and u-boot not set the cntfrq_el0. For u-boot, this is ok, because
ATF has set it. But for SPL, it will lead delay and get_timer
not working.

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>
4 years agophy: phy-imx8mq-usb: Add support for i.MX8MP USB PHY
Marek Vasut [Fri, 1 Apr 2022 01:18:31 +0000 (03:18 +0200)] 
phy: phy-imx8mq-usb: Add support for i.MX8MP USB PHY

Add initial support for i.MX8MP USB PHY, i.MX8MP USB is similar to
the i.MX8MQ, except for clock and power domain design customization.

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>
Tested-By: Tim Harvey <tharvey@gateworks.com> #imx8mp-venice-gw74xx
4 years agoclk: imx8mp: Fill in DWC3 USB, USB PHY, HSIOMIX clock
Marek Vasut [Fri, 1 Apr 2022 01:17:29 +0000 (03:17 +0200)] 
clk: imx8mp: Fill in DWC3 USB, USB PHY, HSIOMIX clock

Add clock tables required to bring up DWC3 USB, USB PHY and HSIOMIX domain.

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>
4 years agoarm: imx: parse-container: add some missing end of line
Clément Péron [Wed, 30 Mar 2022 11:49:30 +0000 (13:49 +0200)] 
arm: imx: parse-container: add some missing end of line

Some printf() have strings that doesn't terminate with end of line
and make the output hard to read.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 years agoclk: imx8m: reduce rate table duplication
Angus Ainslie [Tue, 29 Mar 2022 14:02:40 +0000 (07:02 -0700)] 
clk: imx8m: reduce rate table duplication

Re-factor the imx8m[nmpq] rate tables into the common pll1416x clock
driver.

43cdaa1567ad3 ("clk: imx8mm: Move 1443X/1416X PLL clock structure to common place")

Signed-off-by: Angus Ainslie <angus@akkea.ca>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mm-beacon
4 years agoclk: imx8mq: Add a clock driver for the imx8mq
Angus Ainslie [Tue, 29 Mar 2022 14:02:39 +0000 (07:02 -0700)] 
clk: imx8mq: Add a clock driver for the imx8mq

This is a DM clock driver based off the imx8mm u-boot driver and the linux
kernel driver.

All of the PLLs and clocks are initialized so the subsystems below are
functional and tested.

1) USB host and peripheral
2) ECSPI
3) UART
4) I2C all busses
5) USDHC for eMMC support
6) USB storage
7) GPIO
8) DRAM

Signed-off-by: Angus Ainslie <angus@akkea.ca>
Acked-by: Sean Anderson <seanga2@gmail.com>
4 years agodt-bindings: imx8mq-clock: add mainline definitions
Angus Ainslie [Tue, 29 Mar 2022 14:02:38 +0000 (07:02 -0700)] 
dt-bindings: imx8mq-clock: add mainline definitions

Sync the clock ids with the mainline kernel

077de6e1c9f ("clk: imx8mq: add PLL monitor output")

Signed-off-by: Angus Ainslie <angus@akkea.ca>
Reviewed-by: Marek Vasut <marex@denx.de>
4 years agomtd: nand: mxs_nand_spl: Remove the page aligned access
Ye Li [Mon, 28 Mar 2022 09:14:07 +0000 (17:14 +0800)] 
mtd: nand: mxs_nand_spl: Remove the page aligned access

The mxs_nand_spl driver can support to read from page unaligned offset,
so don't need to set bl_len to ask spl_load_simple_fit to handle
the page unaligned access.

Actually spl_load_simple_fit has two parts of reading:
spl_simple_fit_read and spl_load_fit_image.
The spl_load_fit_image can handle the page unaligned offset,
but the spl_simple_fit_read can't do it. spl_simple_fit_read requires
the FIT location at page aligned offset.

Hence, remove the nand_get_mtd overwrite function from mxs_nand_spl
to use page unaligned read by driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
Tested-by: Tim Harvey <tharvey@gateworks.com> #gw_ventana
4 years agoconfigs: imx8mm_evk: add pwm backlight support
Tommaso Merciai [Sat, 26 Mar 2022 11:19:10 +0000 (12:19 +0100)] 
configs: imx8mm_evk: add pwm backlight support

Enable support for backlight/pwm-imx driver

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
4 years agoarm: dts: imx8mm_evk: add pwm1/backlight support
Tommaso Merciai [Sat, 26 Mar 2022 11:19:09 +0000 (12:19 +0100)] 
arm: dts: imx8mm_evk: add pwm1/backlight support

Add pwm1/backlight support nodes for imx8mm_evk board

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
4 years agodriver: pwm: pwm-imx: introduce pwm_dm_imx_get_parms
Tommaso Merciai [Sat, 26 Mar 2022 11:19:07 +0000 (12:19 +0100)] 
driver: pwm: pwm-imx: introduce pwm_dm_imx_get_parms

Introduce pwm_dm_imx_get_parms, dm version of pwm_imx_get_parms.
This function get clock rate using clk dm api

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
4 years agodriver: pwm: pwm-imx: get and enable per/ipg clock using dm
Tommaso Merciai [Sat, 26 Mar 2022 11:19:06 +0000 (12:19 +0100)] 
driver: pwm: pwm-imx: get and enable per/ipg clock using dm

Get and enable ipg/per pwms clocks using dm api into imx_pwm_of_to_plat
and imx_pwm_probe driver function

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
4 years agoclk: imx8mm: add pwm clocks support
Tommaso Merciai [Sat, 26 Mar 2022 11:19:04 +0000 (12:19 +0100)] 
clk: imx8mm: add pwm clocks support

Add clocks support for the PWM controllers. This is ported from
Linux v5.17-rc8.

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
4 years agoarch: mach-imx: imx8m: add pwm_regs struct in imx-regs
Tommaso Merciai [Sat, 26 Mar 2022 11:19:03 +0000 (12:19 +0100)] 
arch: mach-imx: imx8m: add pwm_regs struct in imx-regs

Add pwm_regs struct for i.MX8MM SOC

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
4 years agoarch: mach-imx: imx8m: add pwm ctrl registers fields defines
Tommaso Merciai [Sat, 26 Mar 2022 11:19:02 +0000 (12:19 +0100)] 
arch: mach-imx: imx8m: add pwm ctrl registers fields defines

Add pwm control registers fields defines into imx-regs.h:

 - prescaler
 - dozeen
 - waiten
 - dbgen
 - clksrc_ipg_high
 - clksrc_ipg, en field

References:
 - iMX8MMRM.pdf p 3884

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
4 years agoARM: imx: Decode ECSPI env location from i.MX8M ROMAPI tables
Marek Vasut [Fri, 25 Mar 2022 17:59:28 +0000 (18:59 +0100)] 
ARM: imx: Decode ECSPI env location from i.MX8M ROMAPI tables

Decode ECSPI boot device in env_get_location() from i.MX8M ROMAPI tables.
This is necessary to correctly identify env is in SPI NOR when the system
boots from SPI NOR attached to ECSPI.

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: Fabio Estevam <festevam@denx.de>
4 years agoarm: imx: imx8mn_beacon: Remove unnecessary configs
Adam Ford [Sat, 19 Mar 2022 15:45:16 +0000 (10:45 -0500)] 
arm: imx: imx8mn_beacon: Remove unnecessary configs

Because the Beacon imx8mn board uses device tree
for MMC/SD and Ethernet, there is no need to have some of the
config options. It's handled by the device tree.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
4 years agoarm: imx: imx8mm_beacon: Remove unnecessary configs
Adam Ford [Sat, 19 Mar 2022 15:45:15 +0000 (10:45 -0500)] 
arm: imx: imx8mm_beacon: Remove unnecessary configs

Because the Beacon imx8mm board uses device tree
for MMC/SD and Ethernet, there is no need to have some of the
config options. It's handled by the device tree.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
4 years agoMerge branch '2022-04-12-two-more-fixes'
Tom Rini [Tue, 12 Apr 2022 13:52:08 +0000 (09:52 -0400)] 
Merge branch '2022-04-12-two-more-fixes'

- Bugfix in cpu_to_be32_array() and re-use $(UBOOTINCLUDE) in
  dtc_cpp_flags

4 years agoimx8ulp: Disable SPL exception vector
Ye Li [Fri, 18 Mar 2022 07:50:18 +0000 (15:50 +0800)] 
imx8ulp: Disable SPL exception vector

Disable SPL exception vector which causes issue to ROM patch execution
when SPL calling ROM API.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
4 years agotbs2910: Convert to DM_SERIAL
Fabio Estevam [Tue, 15 Mar 2022 20:47:05 +0000 (17:47 -0300)] 
tbs2910: Convert to DM_SERIAL

Conversion to DM_SERIAL is mandatory.

Select DM_SERIAL and add a imx6q-tbs2910-u-boot.dtsi file
that describes the nodes that require dm-pre-reloc, which allows
the DM model to configure the UART pinctrl early.

Remove the now unneeded board UART initialization.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Tested-by: Soeren Moch <smoch@web.de>
4 years agowarp7: Remove UART initialization code
Fabio Estevam [Mon, 14 Mar 2022 23:24:06 +0000 (20:24 -0300)] 
warp7: Remove UART initialization code

With DM_SERIAL selected, it is no longer needed board code to
initialize the UART.

Describe the nodes that require dm-pre-reloc, which allows
the DM model to configure the UART pinctrl early.

Remove the now unneeded board UART initialization.

Signed-off-by: Fabio Estevam <festevam@denx.de>
4 years agodrivers: misc: add Gateworks System Controller driver
Tim Harvey [Tue, 8 Mar 2022 00:24:04 +0000 (16:24 -0800)] 
drivers: misc: add Gateworks System Controller driver

Add a driver for the Gateworks System Controller used on Gateworks boards
which provides a boot watchdog, power control, temperature monitor,
and voltage ADCs.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years agoboard: gateworks: gw_ventana: move ft_early_fixups out of common
Tim Harvey [Tue, 8 Mar 2022 00:24:03 +0000 (16:24 -0800)] 
board: gateworks: gw_ventana: move ft_early_fixups out of common

DM is not used for the SPL and a generic DT is used in the SPL
which requires no fixups. Remove the call in the SPL and move the function
into the U-Boot code.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years agoboard: gateworks: gw_ventana: move GPIO config out of common
Tim Harvey [Tue, 8 Mar 2022 00:24:02 +0000 (16:24 -0800)] 
board: gateworks: gw_ventana: move GPIO config out of common

Move gpio configuration out of common and into u-boot code as it is
not used by the SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years agoboard: gateworks: gw_ventana: move SPL uart config out of common
Tim Harvey [Tue, 8 Mar 2022 00:24:01 +0000 (16:24 -0800)] 
board: gateworks: gw_ventana: move SPL uart config out of common

Since DM_SERIAL is used for U-Boot we no longer need legacy UART code in
common.c shared by the SPL and U-Boot. Move the legacy UART config to
the non-DM SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years agoboard: gateworks: gw_ventana: convert to DM_I2C
Tim Harvey [Tue, 8 Mar 2022 00:24:00 +0000 (16:24 -0800)] 
board: gateworks: gw_ventana: convert to DM_I2C

convert to DM_I2C for U-Boot while leaving SPL legacy I2C:
 - Move I2C config from common to SPL
 - Move PMIC config from common to SPL (no need to re-configure pmic)
 - add DM_I2C support to eeprom/gsc functions shared by SPL and U-Boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years agoarm: dts: imx8mn_var_som: Set atf-bl31 blob entry type
Ariel D'Alessandro [Fri, 4 Mar 2022 12:48:16 +0000 (09:48 -0300)] 
arm: dts: imx8mn_var_som: Set atf-bl31 blob entry type

Configure binman ATF blob entry type to use the path from the BL31
environment variable, if defined.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
4 years agoARM: imx: imx8mn-evk: enable DM_SERIAL
Heiko Thiery [Sat, 26 Feb 2022 09:44:21 +0000 (10:44 +0100)] 
ARM: imx: imx8mn-evk: enable DM_SERIAL

U-Boot complains that CONFIG_SERIAL is not converted to CONFIG_DM_SERIAL
and gives a deadline before possibly removing the board. Migrate to
DM_SERIAL to fulfill the request.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
4 years agoimx8m: ddrphy_utils: Add 3732 MT/s mode
Marek Vasut [Sat, 26 Feb 2022 03:37:42 +0000 (04:37 +0100)] 
imx8m: ddrphy_utils: Add 3732 MT/s mode

Add entry for 3732 MT/s mode of operation of the LPDDR4, in
which case the DDR PLL has to be configured in 933 MHz mode.

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: Fabio Estevam <festevam@denx.de>
4 years agoARM: imx: imx8m: Add 933 MHz PLL settings
Marek Vasut [Sat, 26 Feb 2022 03:37:41 +0000 (04:37 +0100)] 
ARM: imx: imx8m: Add 933 MHz PLL settings

Add settings for operating PLL at 933 MHz. This setting is useful in
case the LPDDR4 DRAM should operate at 1866 MHz or 3733 MT/s.

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: Fabio Estevam <festevam@denx.de>
4 years agopmic: pca9450: Add PCA9450C compatible string
Marek Vasut [Sat, 26 Feb 2022 03:37:08 +0000 (04:37 +0100)] 
pmic: pca9450: Add PCA9450C compatible string

Add DT compatible string for PCA9450C PMIC. This is a variant of the
PCA9450 PMIC with 6 A dual-phase buck regulator and 3 A buck regulator,
and is software-wise compatible with the PCA9450B. This variant of the
PCA9450 is designed for use as companion PMIC for i.MX8MP.

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: Fabio Estevam <festevam@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoARM: dts: net: dwc_eth_qos: Fix i.MX8MP compatible string
Marek Vasut [Sat, 26 Feb 2022 03:36:37 +0000 (04:36 +0100)] 
ARM: dts: net: dwc_eth_qos: Fix i.MX8MP compatible string

The correct compatible string for i.MX8MP variant of DWC EQoS MAC
is "nxp,imx8mp-dwmac-eqos", use it. Drop the two current users of
the current wrong compatible string to avoid breaking them.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
4 years agoimx: imx8mm/imx8mn_beacon: Remove redundant code
Adam Ford [Wed, 23 Feb 2022 13:50:51 +0000 (07:50 -0600)] 
imx: imx8mm/imx8mn_beacon: Remove redundant code

The Ethernet controller and PHY use the device tree info to
configure themselves, so it's not necessary to manually do it
in the board file.  This permits the removal of a bunch of headers
as well.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Acked-by: Peng Fan <peng.fan@nxp.com>
4 years agoARM: imx: imx8mn-*-evk: add qca, disable-smarteee phy node
Heiko Thiery [Wed, 23 Feb 2022 09:48:28 +0000 (10:48 +0100)] 
ARM: imx: imx8mn-*-evk: add qca, disable-smarteee phy node

To be in sync with the linux devicetree add the disable-smarteee
property.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Tested-by: Marek Vasut <marex@denx.de> # 8MNANOD4-EVK
4 years agoARM: imx: imx8mn-*-evk: use reset-gpios in phy node
Heiko Thiery [Wed, 23 Feb 2022 09:48:26 +0000 (10:48 +0100)] 
ARM: imx: imx8mn-*-evk: use reset-gpios in phy node

To be in sync with the linux devicetree change the 'phy-reset-gpios' in
the fec node to 'reset-gpios' in the phy node. The PHY reset will be
done by the eth-phy-uclass driver while probing the PHY. This is ok
since it is done before probing the fec.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Tested-by: Marek Vasut <marex@denx.de> # 8MNANOD4-EVK
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agoARM: imx: imx8mn-*-evk: use DM settings for PHY configuration
Heiko Thiery [Wed, 23 Feb 2022 08:10:29 +0000 (09:10 +0100)] 
ARM: imx: imx8mn-*-evk: use DM settings for PHY configuration

With the correct settings described in the device-tree the PHY settings
in the board init are no longer required. The values are taken from the
linux device tree.

The PHY latency settings are derived from the phy-mode property and the
voltage seetings are done via the regulator.

Suggested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Tested-by: Marek Vasut <marex@denx.de> # 8MNANOD4-EVK
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agopinctrl: nxp: don't automatically select DEVRES
Angus Ainslie [Mon, 17 Jan 2022 14:18:46 +0000 (06:18 -0800)] 
pinctrl: nxp: don't automatically select DEVRES

If we select DEVRES here then it breaks building an imx8m SPL without
DEVRES support.

Signed-off-by: Angus Ainslie <angus@akkea.ca>
4 years agoinclude/linux/byteorder: fix cpu_to_be32_array()
Heinrich Schuchardt [Thu, 20 May 2021 15:36:03 +0000 (17:36 +0200)] 
include/linux/byteorder: fix cpu_to_be32_array()

In cpu_to_be32_array() and be32_to_cpu_array() we should not compare an int
counter to a size_t parameter. Correct the type of the counter.  This
exists in upstream as b4c80629c5c9 ("include/linux/byteorder/generic.h:
fix index variables").

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMakefile.lib: Re-use $(UBOOTINCLUDE) in dtc_cpp_flags
Andy Shevchenko [Wed, 30 Mar 2022 09:30:04 +0000 (12:30 +0300)] 
Makefile.lib: Re-use $(UBOOTINCLUDE) in dtc_cpp_flags

As in ASL case use same basic set of the inclusions.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
4 years agoconfigs: imx6dl_mamoj_defconfig: Enable LTO on imx6dl_mamoj board
Michael Trimarchi [Wed, 23 Mar 2022 16:52:17 +0000 (17:52 +0100)] 
configs: imx6dl_mamoj_defconfig: Enable LTO on imx6dl_mamoj board

Enable LTO on mamoj to reduce SPL and uboot size. Tested with gcc
gcc-11.1.0

U-Boot 2022.04-rc4-00051-g17fc5facd0 (Mar 23 2022 - 16:43:43 +0100)

CPU:   Freescale i.MX6DL rev1.3 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 40C
Reset cause: POR
Model: BTicino i.MX6DL Mamoj board
DRAM:  512 MiB
Core:  29 devices, 12 uclasses, devicetree: separate
MMC:   FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Net:
Error: ethernet@2188000 address not set.
No ethernet found.

Tested-by: Raffaele RECALCATI <raffaele.recalcati@bticino.it>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
4 years agoupdate CAAM MAINTAINER
Gaurav Jain [Thu, 24 Mar 2022 06:20:38 +0000 (11:50 +0530)] 
update CAAM MAINTAINER

updated CAAM driver files maintainer.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
4 years agoPPC: Enable Job ring driver model.
Gaurav Jain [Thu, 24 Mar 2022 06:20:37 +0000 (11:50 +0530)] 
PPC: Enable Job ring driver model.

removed sec_init() call from board files.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoPPC: Add crypto node in device tree
Gaurav Jain [Thu, 24 Mar 2022 06:20:36 +0000 (11:50 +0530)] 
PPC: Add crypto node in device tree

device tree imported from linux kernel.
c500bee1c5b2 (tag: v5.14-rc4) Linux 5.14-rc4

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoLayerscape: Enable Job ring driver model.
Gaurav Jain [Thu, 24 Mar 2022 06:20:35 +0000 (11:50 +0530)] 
Layerscape: Enable Job ring driver model.

LS(1021/1012/1028/1043/1046/1088/2088), LX2160, LX2162
platforms are enabled with JR driver model.

removed sec_init() call from board files.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Reviewed-by: Michael Walle <michael@walle.cc>
4 years agoLayerscape: Add crypto node in device tree
Gaurav Jain [Thu, 24 Mar 2022 06:20:34 +0000 (11:50 +0530)] 
Layerscape: Add crypto node in device tree

LS(1021/1012/1028/1043/1046/1088/2088), LX2160 - updated device tree

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agocrypto/fsl: i.MX8: Enable Job ring driver model.
Gaurav Jain [Thu, 24 Mar 2022 06:20:33 +0000 (11:50 +0530)] 
crypto/fsl: i.MX8: Enable Job ring driver model.

i.MX8(QM/QXP) - added support for JR driver model.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
4 years agoi.MX8: Add crypto node in device tree
Gaurav Jain [Thu, 24 Mar 2022 06:20:32 +0000 (11:50 +0530)] 
i.MX8: Add crypto node in device tree

i.MX8(QM/QXP) - updated device tree for supporting DM in SPL.

disabled use of JR1 in SPL and uboot, as JR1 is reserved
for SECO FW.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
4 years agoi.MX7ULP: Enable Job ring driver model.
Gaurav Jain [Thu, 24 Mar 2022 06:20:31 +0000 (11:50 +0530)] 
i.MX7ULP: Enable Job ring driver model.

added crypto node in device tree.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
4 years agoi.MX7: Enable Job ring driver model.
Gaurav Jain [Thu, 24 Mar 2022 06:20:30 +0000 (11:50 +0530)] 
i.MX7: Enable Job ring driver model.

i.MX7D - added support for JR driver model.

removed sec_init() call, sec is initialized based on
job ring information processed from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
4 years agoi.MX6: Enable Job ring driver model.
Gaurav Jain [Thu, 24 Mar 2022 06:20:29 +0000 (11:50 +0530)] 
i.MX6: Enable Job ring driver model.

i.MX6,i.MX6SX,i.MX6UL - added support for JR driver model.

removed sec_init() call, sec is initialized based on
job ring information processed from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
4 years agomx6sabre: Remove unnecessary SPL configs
Ye Li [Thu, 24 Mar 2022 06:20:28 +0000 (11:50 +0530)] 
mx6sabre: Remove unnecessary SPL configs

Because we don't use SPL_DM on mx6sabresd and mx6sabreauto, so it is
unnecessary to have SPL DTB related configs and SPL_OF_CONTROL enabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
4 years agocrypto/fsl: i.MX8M: Enable Job ring driver model.
Gaurav Jain [Thu, 24 Mar 2022 06:20:27 +0000 (11:50 +0530)] 
crypto/fsl: i.MX8M: Enable Job ring driver model.

i.MX8MM/MN/MP/MQ - added support for JR driver model.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
4 years agoi.MX8M: crypto: updated device tree for supporting DM in SPL
Gaurav Jain [Thu, 24 Mar 2022 06:20:26 +0000 (11:50 +0530)] 
i.MX8M: crypto: updated device tree for supporting DM in SPL

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
4 years agocrypto/fsl: Add support for CAAM Job ring driver model
Gaurav Jain [Thu, 24 Mar 2022 06:20:25 +0000 (11:50 +0530)] 
crypto/fsl: Add support for CAAM Job ring driver model

added device tree support for job ring driver.
sec is initialized based on job ring information processed
from device tree.

Signed-off-by: Gaurav Jain <gaurav.jain@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoLS1043ARDB, LS1046ARDB, LS1088ARDB: Enable SPL_OF_CONTROL in SECURE Boot defconfig
Kshitiz Varshney [Thu, 7 Apr 2022 12:05:18 +0000 (14:05 +0200)] 
LS1043ARDB, LS1046ARDB, LS1088ARDB: Enable SPL_OF_CONTROL in SECURE Boot defconfig

If enable SPL_DM without SPL_OF_CONTROL,
build errors "undefined reference to fdt_get_resource",
is coming in function `caam_jr_probe'.
Added SPL_OF_CONTROL to remove the error.

Signed-off-by: Kshitiz Varshney <kshitiz.varshney@nxp.com>
4 years agolinux/mtd/mtd.h: Add <dm/ofnode.h>
Tom Rini [Mon, 11 Apr 2022 21:11:21 +0000 (17:11 -0400)] 
linux/mtd/mtd.h: Add <dm/ofnode.h>

We need to know where the typedef of 'ofnode' comes from.

Fixes: c86a4de8df61 ("mtd: Add flash_node in struct mtd_info")
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2022-04-11-assorted-updates'
Tom Rini [Mon, 11 Apr 2022 19:59:45 +0000 (15:59 -0400)] 
Merge branch '2022-04-11-assorted-updates'

- Assorted fixes/updates including K3-J721s2 timer dts fix, assorted
  crypto improvements, led-pwm driver, improve handling of mtd
  partitions, align mkimage hash output buffers and backport a UBIFS
  bugfix from Linux.

4 years agoahci: add PCI bindings for Marvell 88SE6121/45 SATA controllers
Hajo Noerenberg [Mon, 28 Mar 2022 13:49:08 +0000 (15:49 +0200)] 
ahci: add PCI bindings for Marvell 88SE6121/45 SATA controllers

Add AHCI PCI bindings for Marvell 88SE6121/45 SATA controllers.

The 88SE6121 controller is used, for example, in the Seagate Blackarmor NAS440 or the Iomega ix4-200d NAS.

As Pali Rohár explained [1], these controllers do not match the standard AHCI class code and therefore require an explizit PCI binding. The Linux kernel also uses this approach [2].

[1] https://lists.denx.de/pipermail/u-boot/2022-March/479197.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/ata/ahci.c?h=v5.17#n557

Signed-off-by: Hajo Noerenberg <hajo-uboot@noerenberg.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
4 years agoubifs: Fix journal replay wrt. xattr nodes
Ville Baillie [Mon, 28 Mar 2022 09:13:43 +0000 (09:13 +0000)] 
ubifs: Fix journal replay wrt. xattr nodes

Backport commit 1cb51a15b576 ("ubifs: Fix journal replay wrt. xattr
nodes") from the Linux Kernel, which has the following Signed-off-by
line:
Signed-off-by: Richard Weinberger <richard@nod.at>
For U-Boot, after comapring with the upstream commit:
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimage: fit: Align hash output buffers
Sean Anderson [Thu, 24 Mar 2022 15:26:11 +0000 (11:26 -0400)] 
image: fit: Align hash output buffers

Hardware-accelerated hash functions require that the input and output
buffers be aligned to the minimum DMA alignment. memalign.h helpfully
provides a macro just for this purpose. It doesn't exist on the host,
but we don't need to be aligned there either.

Fixes: 5dfb521386 ("[new uImage] New uImage low-level API")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: pxe_utils: sysboot: replace cls command by video_clear in PXE parser
Patrick Delaunay [Tue, 22 Mar 2022 16:08:43 +0000 (17:08 +0100)] 
cmd: pxe_utils: sysboot: replace cls command by video_clear in PXE parser

Since the commit bfaa51dd4adf ("cmd: add serial console support
for the cls command") the cls command is not enough to clear the
video display when ANSI console is activated.

This patch clears the video device with the video_clear() API
before to display the bitmap used for the PXE background.

This patch avoids to display the LOGO, activated by default with
commit 7a8555d87136 ("video: Show the U-Boot logo by default").

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
4 years agomtd: Update the way partitions are parsed
Patrice Chotard [Mon, 21 Mar 2022 08:13:37 +0000 (09:13 +0100)] 
mtd: Update the way partitions are parsed

In case mtd_info's dev field is not populated (raw nand's case),
use the flash_node new field which reference the DT flash node where
can be found "partitions" node with "fixed-partitions" compatible.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Farhan Ali <farhan.ali@broadcom.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Marek Behun <marek.behun@nic.cz>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
4 years agomtd: Add flash_node in struct mtd_info
Patrice Chotard [Mon, 21 Mar 2022 08:13:36 +0000 (09:13 +0100)] 
mtd: Add flash_node in struct mtd_info

Currently, add_mtd_partitions_of() can be used only if dev field of
mtd_info struct is populated. It's the case, for example, for a spi nor
flash, which has a DT compatible "jedec,spi-nor" and an associated
device. mtd->dev is populated in spi_nor_scan().

But in case of a raw nand node, mtd_info's dev field can't be populated
as flash node has no compatible, so no associated device.
add_mtd_partitions_of() can't be used to parse "partitions" subnode.

To remove this constraint, add an ofnode field in mtd_info struct
which reference the DT flash node. This new field is populated by
nand_scan_tail(). This new field will be used by add_mtd_partitions_of()
to parse the flash node for "partitions" defined in DT.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Farhan Ali <farhan.ali@broadcom.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Marek Behun <marek.behun@nic.cz>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
4 years agodrivers: led: bcm6858: Set a default brightness when probing LEDs
Paul HENRYS [Thu, 17 Mar 2022 09:29:47 +0000 (10:29 +0100)] 
drivers: led: bcm6858: Set a default brightness when probing LEDs

When probing the LEDs, a default brightness is set based on settings
from the U-Boot device tree, i.e. the 'default-brightness' property
of the LED nodes. If that property is not present, the default
maximum brightness is set.
This should make sure the LED controller's registers affecting the
brightness are correctly initialized and should give a consistent
behaviour.

Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
4 years agospl: allow boot from first bootable partition
Jérôme Carretero [Tue, 15 Mar 2022 20:34:51 +0000 (16:34 -0400)] 
spl: allow boot from first bootable partition

This was implemented in order to get dual-slot bootloader
partitions on the BeagleBone Black, whose MLO boots from
the first bootable partition: MLO chainloads u-boot in the
same way.

Signed-off-by: Jérôme Carretero <cJ-uboot@zougloub.eu>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agolib/crypto: support sha384/sha512 in x509/pkcs7
Dhananjay Phadke [Tue, 15 Mar 2022 17:19:32 +0000 (10:19 -0700)] 
lib/crypto: support sha384/sha512 in x509/pkcs7

Set digest_size SHA384 and SHA512 algorithms in pkcs7 and x509,
(not set by ported linux code, but needed by __UBOOT__ part).

EFI_CAPSULE_AUTHENTICATE doesn't select these algos but required for
correctness if certificates contain sha384WithRSAEncryption or
sha512WithRSAEncryption OIDs.

Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 years agoled: led_pwm: Add a driver for LEDs connected to PWM
Ivan Vozvakhov [Sat, 12 Mar 2022 10:03:14 +0000 (13:03 +0300)] 
led: led_pwm: Add a driver for LEDs connected to PWM

Add a driver which allows to use of LEDs connected
to PWM (Linux compatible).
MAINTAINERS: add i.vozvakhov as a maintainer of leds-pwm
C(required during new functionality adding).

Signed-off-by: Ivan Vozvakhov <i.vozvakhov@corp.mail.ru>
4 years agolib: rsa: Update function padding_pss_verify (any-salt)
SESA644425 [Wed, 9 Mar 2022 09:27:17 +0000 (01:27 -0800)] 
lib: rsa: Update function padding_pss_verify (any-salt)

Modify function to support any salt length instead of max
length only. Function now detects salt length by parsing
the content of db buffer. Note that it works with (but is
not limited to) zero-length, digest-length and max-length

Signed-off-by: SESA644425 <gioja.hermann@non.se.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib: rsa: Leverage existing data buffer instead of systematic copy
SESA644425 [Wed, 9 Mar 2022 09:27:16 +0000 (01:27 -0800)] 
lib: rsa: Leverage existing data buffer instead of systematic copy

Prior to introduction of modifications in rsassa_pss functions
related to padding verification, doing a pass to reduce memory
consumption of function by replacing memory copies of parts of
const buffer by pointers to the original buffer (masked_db and
h are subparts of msg buffer which is declared const, salt is a
subpart of db which is a working buffer, unmodified after being
filled). New pointers scope is limited to the function where
they are declared (not returned to caller by any mean), zeroing
risk of memory fault related to the change.

Signed-off-by: SESA644425 <gioja.hermann@non.se.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib: rsa: Fix const-correctness of rsassa_pss functions
SESA644425 [Wed, 9 Mar 2022 09:27:15 +0000 (01:27 -0800)] 
lib: rsa: Fix const-correctness of rsassa_pss functions

Prior to introduction of modifications in rsassa_pss functions
related to padding verification, doing a pass to update
const-correctness in targeted functions to comply with
coding-rules and avoid const-cast

Signed-off-by: SESA644425 <gioja.hermann@non.se.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoARM: dts: k3-j721s2: Correct timer frequency
Vignesh Raghavendra [Mon, 7 Mar 2022 09:25:51 +0000 (14:55 +0530)] 
ARM: dts: k3-j721s2: Correct timer frequency

MCU Timer0 runs at 250MHz, and the clock-frequency defined in DT appears
incorrect.

Without this delays in R5 SPL are 10x off.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
4 years agoMerge branch '2022-04-11-add-OP-TEE-rng'
Tom Rini [Mon, 11 Apr 2022 14:46:16 +0000 (10:46 -0400)] 
Merge branch '2022-04-11-add-OP-TEE-rng'

- Add support for OP-TEE providing an RNG to use, and enable on some
  stm32mp15 configurations.

4 years agoconfigs: add support of OPTEE RNG in stm32mp15 defconfig
Patrick Delaunay [Tue, 29 Mar 2022 12:21:25 +0000 (14:21 +0200)] 
configs: add support of OPTEE RNG in stm32mp15 defconfig

When the RNG device is secured with OP-TEE, it is only accessible with
the HWRNG TA, the CONFIG_RNG_OPTEE is needed for STM32MP15 targets
with OP-TEE support.

The probe of this RNG driver fails when the TA is not available in OP-TEE
and the previous driver can be used, as CONFIG_RNG_STM32MP1 is activated
and when the associated node is activated in the device tree with:

&rng1 {
status = "okay";
};

When the RNG is used in OP-TEE, this node should be deactivated in
the Linux and U-Boot device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
4 years agotee: optee: bind rng optee driver
Patrick Delaunay [Tue, 29 Mar 2022 12:21:24 +0000 (14:21 +0200)] 
tee: optee: bind rng optee driver

In U-Boot, the discovery of TA based on its UUID on the TEE bus is
not supported.

This patch only binds the driver associated to the new supported
OP-TEE TA = TA_HWRNG when this driver is enable.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
4 years agorng: add OP-TEE based Random Number Generator
Patrick Delaunay [Tue, 29 Mar 2022 12:21:23 +0000 (14:21 +0200)] 
rng: add OP-TEE based Random Number Generator

Add driver for OP-TEE based Random Number Generator on ARM SoCs
where hardware entropy sources are not accessible to normal world
and the RNG service is provided by a HWRNG Trusted Application (TA).

This driver is based on the linux driver: char/hw_random/optee-rng.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
4 years agoMerge branch '2022-04-11-initial-valgrind-support'
Tom Rini [Mon, 11 Apr 2022 14:15:06 +0000 (10:15 -0400)] 
Merge branch '2022-04-11-initial-valgrind-support'

To quote the author:
This series adds support for running valgrind against U-Boot's internal
malloc. This allows for much more useful reports to be generated.

Some example output of valgrind run against u-boot/master with this
branch applied may be found at [1]. Note that valgrind gives up around
acpi.  This feature still needs a lot of work on suppressions/hints to
filter out the noise properly.

[1] https://gist.githubusercontent.com/Forty-Bot/199bf06f9cdd6871e54f8f484c16e111/raw/2a2f99108eef84b48e27a54332f3f71f4e2e5342/gistfile1.txt

4 years agodoc: sandbox: Document how to run sandbox with valgrind
Sean Anderson [Wed, 23 Mar 2022 18:04:50 +0000 (14:04 -0400)] 
doc: sandbox: Document how to run sandbox with valgrind

This documents how to get more detailed results from valgrind made possible
by the last two commits.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agomalloc: Annotate allocator for valgrind
Sean Anderson [Wed, 23 Mar 2022 18:04:49 +0000 (14:04 -0400)] 
malloc: Annotate allocator for valgrind

This annotates malloc and friends so that valgrind can track the heap. To
do this, we need to follow a few rules:

* Call VALGRIND_MALLOCLIKE_BLOCK whenever we malloc something
* Call VALGRIND_FREELIKE_BLOCK whenever we free something (generally after
  we have done our bookkeeping)
* Call VALGRIND_RESIZEINPLACE_BLOCK whenever we change the size of an
  allocation. We don't record the original request size of a block, and
  neither does valgrind. For this reason, we pretend that the old size of
  the allocation was for 0 bytes. This marks the whole allocaton as
  undefined, so in order to mark all bits correctly, we must make the whole
  new allocation defined with VALGRIND_MAKE_MEM_DEFINED. This may cause us
  to miss some invalid reads, but there is no way to detect these without
  recording the original size of the allocation.

In addition to the above, dlmalloc itself tends to make a lot of accesses
which we know are safe, but which would be unsafe outside of dlmalloc. For
this reason, we provide a suppression file which ignores errors ocurring in
dlmalloc.c

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoAdd valgrind headers to U-Boot
Sean Anderson [Wed, 23 Mar 2022 18:04:48 +0000 (14:04 -0400)] 
Add valgrind headers to U-Boot

Valgrind uses magic code sequences to define an ABI that the client may use
to request behavior from the host. In particular, this may be used to
inform valgrind about custom allocators, such as the one used in U-Boot.

This adds headers defining these sequences to U-Boot. It also adds a config
option to disable emission of these sequences entirely, in the (likely)
event that the user does not wish to use valgrind. Note that this option is
called NVALGRIND upstream, but was renamed (and inverted) to
CONFIG_VALGRIND. Aside from this and the conversion of a few instances of
VALGRIND_DO_CLIENT_REQUEST_EXPR to STMT, these headers are unmodified.

These headers were copied from valgrind 3.16.1-4 as distributed in Arch
Linux. They are licensed with the bzip2 1.16 license. This appears to be a
BSD license with some clauses from Zlib.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoKconfig: Fix SYS_MALLOC_F_LEN for i.MX8MQ
Peng Fan [Mon, 11 Apr 2022 09:07:04 +0000 (17:07 +0800)] 
Kconfig: Fix SYS_MALLOC_F_LEN for i.MX8MQ

i.MX8MQ use SYS_MALLOC_F_LEN 0x2000, not 0x10000. The OCRAM_S only has
32KB memory, use 0x10000 will make SPL not bootable.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
4 years agoMerge tag 'efi-2022-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 10 Apr 2022 15:21:39 +0000 (11:21 -0400)] 
Merge tag 'efi-2022-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-07-rc1

Documentation:

* Describe how enable DM_SERIAL for a board

UEFI

* Preparatory patches for better integration of DM and UEFI
* Use sysreset after capsule updates instead of do_reset
* Allow to disable persisting non-volatile variables

4 years agoRevert "env: Load env when ENV_IS_NOWHERE is only location selected"
Marek Vasut [Sun, 10 Apr 2022 04:46:52 +0000 (06:46 +0200)] 
Revert "env: Load env when ENV_IS_NOWHERE is only location selected"

This reverts commit 8d61237edbf6314a701cf78da2c5893a73ff5438.

This commit broke environment on literally every board I have access
to, with this revert in place, environment works as it should again.
The problem I observe with this patch is that saved environment in
either SPI NOR or eMMC is never used, the system always falls back
to default environment. The 'saveenv' command does succeed, but then
after reset, the default env is again used.

Furthermore, the commit introduced duplicate code in env_init(), this:
"
if (!prio) {
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = ENV_INVALID;

return 0;
}

if (ret == -ENOENT) {
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = ENV_INVALID;

return 0;
}
"

Furthermore, the commit is missing DCO SoB line.

Also note that upstream does not support UltraZed EG board, so
this might have been a patch pulled from downstream which did
depend on some other downstream behavior.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Felix.Vietmeyer@jila.colorado.edu <felix.vietmeyer@jila.colorado.edu>
Cc: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2022-04-08-gpio-updates'
Tom Rini [Sun, 10 Apr 2022 15:19:14 +0000 (11:19 -0400)] 
Merge branch '2022-04-08-gpio-updates'

- Add PCA957X GPIO support, enable GPIO hogging in SPL, add
  gpio_request_by_line_name() for later use and add some pytests for
  'gpio'