platform/kernel/u-boot.git
19 months agomx53loco: Remove unused mx53loco_video.c file
Fabio Estevam [Tue, 14 Mar 2023 11:58:15 +0000 (08:58 -0300)]
mx53loco: Remove unused mx53loco_video.c file

Since commit 1fa43cad8625 ("video: Drop references to CONFIG_VIDEO et al")
the mx53loco_video.c is no longer used.

Remove the unused file.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agoARM: imx: Include on-SoM microSD in list of i.MX6 DHCOM boot devices
Marek Vasut [Sun, 5 Mar 2023 23:21:31 +0000 (00:21 +0100)]
ARM: imx: Include on-SoM microSD in list of i.MX6 DHCOM boot devices

Add mmc1, which is mapped to optional on-SoM microSD socket,
to the list of distro boot command boot devices.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoARM: imx: Convert DH i.MX6 DHSOM to DM_SERIAL
Marek Vasut [Sun, 5 Mar 2023 20:48:35 +0000 (21:48 +0100)]
ARM: imx: Convert DH i.MX6 DHSOM to DM_SERIAL

Enable CONFIG_DM_SERIAL on DH i.MX6 DHSOM to convert it to DM serial .

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoconfigs: remove gwventana_gw5904_defconfig
Tim Harvey [Tue, 21 Feb 2023 17:18:49 +0000 (09:18 -0800)]
configs: remove gwventana_gw5904_defconfig

Now that the gwventana_emmc_defconfig is the same as the
gwventana_gw5904_defconfig we can remove the latter.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agoconfigs: gwventana_emmc_defconfig: add MV88E61XX DSA switch support
Tim Harvey [Tue, 21 Feb 2023 17:18:48 +0000 (09:18 -0800)]
configs: gwventana_emmc_defconfig: add MV88E61XX DSA switch support

The MV88E61XX switch is used on the GW5904 which is an eMMC based board.
Adding it here allows us to remove the gwventana_gw5904_defconfig.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
19 months agomisc: imx: remove DM dependency for ocotp driver in SPL
Jean-Marie Lemetayer [Mon, 13 Feb 2023 13:12:25 +0000 (14:12 +0100)]
misc: imx: remove DM dependency for ocotp driver in SPL

The ocotp driver is available for regular and SPL builds using the
(SPL_)MXC_OCOTP configuration. Also, the ocotp driver does not support
the driver model (DM) configuration.

But, for SPL builds, the SPL_MXC_OCOTP configuration depends on
SPL_MISC which implies on SPL_DM.

This commit replaces the dependency on SPL_MISC with SPL_DRIVERS_MISC.
So the only requirement is to have enabled miscellaneous drivers for
the SPL.

Signed-off-by: Jean-Marie Lemetayer <j.lemetayer@kerlink.fr>
19 months agoarm64: dts: imx8mp: Do not delete PHY nodes on i.MX8MP DHCOM PDK2
Marek Vasut [Sat, 11 Feb 2023 22:38:01 +0000 (23:38 +0100)]
arm64: dts: imx8mp: Do not delete PHY nodes on i.MX8MP DHCOM PDK2

The PHY nodes may be activated via DTO in case another SoM variant
is populated into the development kit. Do not delete the nodes.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoarm64: dts: imx8mp: Add FEC RMII pin mux on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:38:00 +0000 (23:38 +0100)]
arm64: dts: imx8mp: Add FEC RMII pin mux on i.MX8MP DHCOM

The i.MX8MP DHCOM SoM may come with either external RGMII PHY or
LAN8740Ai RMII PHY on the SoM attached to FEC MAC. Add pin mux
settings for both options, so that DT overlay can override these
settings on SoM variant with the LAN8740Ai PHY.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoarm64: dts: imx8mp: Add EQoS RMII pin mux on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:37:59 +0000 (23:37 +0100)]
arm64: dts: imx8mp: Add EQoS RMII pin mux on i.MX8MP DHCOM

The i.MX8MP DHCOM SoM may come with either KSZ9131RNXI RGMII PHY
or LAN8740Ai RMII PHY on the SoM attached to EQoS MAC. Add pin
mux settings for both options, so that DT overlay can override
these settings on SoM variant with the LAN8740Ai PHY.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoarm64: dts: imx8mp: Adjust EQoS PHY address on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:37:58 +0000 (23:37 +0100)]
arm64: dts: imx8mp: Adjust EQoS PHY address on i.MX8MP DHCOM

The current variant of the SoM has LAN8740Ai PHY connected to EQoS
strapped to MDIO address 0 , adjust the MDIO address to match the
hardware.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoarm64: imx8mp: Auto-detect PHY on i.MX8MP DHCOM
Marek Vasut [Sat, 11 Feb 2023 22:10:50 +0000 (23:10 +0100)]
arm64: imx8mp: Auto-detect PHY on i.MX8MP DHCOM

The i.MX8MP DHCOM SoM may be populated with either KSZ9131RNXI RGMII PHY
or LAN8740Ai RMII PHY attached to EQoS MAC, and either external RGMII PHY
or LAN8740Ai RMII PHY attached to FEC MAC. The SoM configuration can be
detected for each MAC by reading RX_CTL pull resistor state early on boot.
Make use of this, detect the exact PHY configuration, and patch control DT
accordingly so that the ethernet is configured correctly in U-Boot.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoARM: imx: Add 2 GiB DRAM support for DH electronics i.MX8M Plus DHCOM
Marek Vasut [Sat, 11 Feb 2023 21:49:01 +0000 (22:49 +0100)]
ARM: imx: Add 2 GiB DRAM support for DH electronics i.MX8M Plus DHCOM

The DH electronics i.MX8M Plus DHCOM SoM currently supports only 4 GiB
of DRAM population option. Add another population option with 2 GiB of
DRAM. The chips used on the 2 GiB option are 2x K4F6E3S4HM-MGCJ .

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoARM: imx: Enable LTO for DH electronics i.MX8M Plus DHCOM
Marek Vasut [Sat, 11 Feb 2023 21:48:24 +0000 (22:48 +0100)]
ARM: imx: Enable LTO for DH electronics i.MX8M Plus DHCOM

Enable LTO to reduce the size of SPL, which with multiple DRAM
calibration tables may be close to the limit.

Signed-off-by: Marek Vasut <marex@denx.de>
19 months agoconfigs: colibri-imx7: Fix bad block table in flash configuration
Stefan Eichenberger [Fri, 10 Feb 2023 10:33:51 +0000 (11:33 +0100)]
configs: colibri-imx7: Fix bad block table in flash configuration

Make sure that the bad block table in flash is used on Colibri iMX7.
Without this configuration enabled U-Boot corrupts the bad block table
and Linux will update the table on each reboot. The corruption occurs
because if CONFIG_SYS_NAND_USE_FLASH_BBT is not set, U-boot will store
bad blocks out of band, while the Linux driver for the iMX7 will store
them in band in a bad block table.

Fixes: fd8c1fc9430 ("arm: dts: imx7: colibri: add raw NAND support")
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
19 months agodoc: sl-mx8mm: Fix mistake in merge conflict resolution
Frieder Schrempf [Wed, 8 Feb 2023 16:20:33 +0000 (17:20 +0100)]
doc: sl-mx8mm: Fix mistake in merge conflict resolution

There was a conflict between the following two commits, that wasn't
resolved correctly. Fix this.

a93985ddfcc3 ("doc: sl-mx8mm: Update the NXP TF-A source reference")
f0f461287eff ("imx: Suggest the NXP ATF github repo")

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agoboard: gateworks: venice: enable XWAY PHY support
Tim Harvey [Tue, 7 Feb 2023 23:44:21 +0000 (15:44 -0800)]
board: gateworks: venice: enable XWAY PHY support

Enable XWAY PHY driver and remove board specific config from
board_phy_config weak override.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
19 months agopower: pmic: Add NXP PCA9451A PMIC support
Ye Li [Fri, 3 Feb 2023 10:24:36 +0000 (18:24 +0800)]
power: pmic: Add NXP PCA9451A PMIC support

PCA9451A uses similar BUCKs and LDO regulators as PCA9450B/C but
has LDO2 and LDO3 removed. So reuse pca9450 PMIC and regulator driver
and add new type for PCA9451A.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
19 months agoimx: spl_imx_romapi: Get and print boot stage
Ye Li [Fri, 3 Feb 2023 10:21:47 +0000 (18:21 +0800)]
imx: spl_imx_romapi: Get and print boot stage

Get and print boot stage through ROM API in SPL

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agomx6sabresd: Convert to DM_PMIC
Fabio Estevam [Thu, 16 Feb 2023 10:08:49 +0000 (07:08 -0300)]
mx6sabresd: Convert to DM_PMIC

The usage of DM_PMIC is preferred, so convert to it.

This also brings the benefit of causing a significant amount
of code removal.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agomx6sabreauto: Convert to DM_PMIC
Fabio Estevam [Thu, 16 Feb 2023 10:08:48 +0000 (07:08 -0300)]
mx6sabreauto: Convert to DM_PMIC

The usage of DM_PMIC is preferred, so convert to it.

This also brings the benefit of causing a significant amount
of code removal.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agomx6sxsabreauto: Remove myself from MAINTAINERS
Fabio Estevam [Wed, 15 Feb 2023 18:32:54 +0000 (15:32 -0300)]
mx6sxsabreauto: Remove myself from MAINTAINERS

I don't have access to the mx6sxsabreauto board, so remove myself
from the MAINTAINERS entry and add Peng instead.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Peng Fan <peng.fan@nxp.com>
19 months agopico-imx6: Pass the mmc alias to fix boot regression
Fabio Estevam [Wed, 15 Feb 2023 18:24:44 +0000 (15:24 -0300)]
pico-imx6: Pass the mmc alias to fix boot regression

Originally, the mmc aliases node was present in imx6qdl-pico.dtsi.

After the sync with Linux in commit d0399a46e7cd ("imx6dl/imx6qdl:
synchronise device trees with linux"), the aliases node is gone as
the upstream version does not have it.

This causes a boot regression in which the eMMC card cannot be found anymore.

Fix it by passing the alias node in the u-boot.dtsi file to
restore the original behaviour where the eMMC (esdhc3) was
mapped to mmc0.

Fixes: d0399a46e7cd ("imx6dl/imx6qdl: synchronise device trees with linux")
Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agopico-imx6: Add DM_SERIAL support
Fabio Estevam [Wed, 15 Feb 2023 18:24:43 +0000 (15:24 -0300)]
pico-imx6: Add DM_SERIAL support

The conversion to DM_SERIAL is mandatory, so add support
for it.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agoudoo: Add DM_SERIAL support
Fabio Estevam [Wed, 15 Feb 2023 17:46:33 +0000 (14:46 -0300)]
udoo: Add DM_SERIAL support

The conversion to DM_SERIAL is mandatory, so add support
for it.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agomx6sxsabresd: Add DM_SERIAL support
Fabio Estevam [Wed, 15 Feb 2023 17:08:56 +0000 (14:08 -0300)]
mx6sxsabresd: Add DM_SERIAL support

The conversion to DM_SERIAL is mandatory, so add support
for it.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agomx51evk: Add DM_SERIAL support
Fabio Estevam [Wed, 15 Feb 2023 14:48:49 +0000 (11:48 -0300)]
mx51evk: Add DM_SERIAL support

The conversion to DM_SERIAL is mandatory, so add support
for it.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agomx53loco: Add DM_I2C support
Fabio Estevam [Wed, 15 Feb 2023 14:41:51 +0000 (11:41 -0300)]
mx53loco: Add DM_I2C support

The conversion to DM_I2C is mandatory, so add support
for it.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agomx53loco: Add DM_SERIAL support
Fabio Estevam [Wed, 15 Feb 2023 14:41:50 +0000 (11:41 -0300)]
mx53loco: Add DM_SERIAL support

The conversion to DM_SERIAL is mandatory, so add support
for it.

Signed-off-by: Fabio Estevam <festevam@denx.de>
19 months agoimx: ele_ahab: Remove OEM Secure World Closed print
Ye Li [Mon, 30 Jan 2023 10:39:55 +0000 (18:39 +0800)]
imx: ele_ahab: Remove OEM Secure World Closed print

The OEM Secure World Closed is not a valid lifecycle on iMX8ULP/iMX9.
So remove it from lifecycle print.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: ele_ahab: confirm lifecycle before closing the part
Ye Li [Mon, 30 Jan 2023 10:39:54 +0000 (18:39 +0800)]
imx: ele_ahab: confirm lifecycle before closing the part

Before moving the lifecycle to OEM closed, confirm the lifecycle is
OEM open, otherwise cancel to move forward the lifecycle.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agomisc: sentinel: s400_api: Use new command request definitions
Ye Li [Mon, 30 Jan 2023 10:39:53 +0000 (18:39 +0800)]
misc: sentinel: s400_api: Use new command request definitions

Remove legacy command definitions, change to use new ELE_xxx command
request.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: ahab: Move imx9 and imx8ulp AHAB support together
Ye Li [Mon, 30 Jan 2023 10:39:52 +0000 (18:39 +0800)]
imx: ahab: Move imx9 and imx8ulp AHAB support together

Use common file ele_ahab.c for i.MX9 and iMX8ULP AHAB support, since
both of them use same sentinel ELE APIs

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx93: ahab: Get and decode AHAB events
Ye Li [Mon, 30 Jan 2023 10:39:51 +0000 (18:39 +0800)]
imx93: ahab: Get and decode AHAB events

For ahab_status command, support to get and decode AHAB events

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agomisc: sentinel: s400_api: Add get_events API
Ye Li [Mon, 30 Jan 2023 10:39:50 +0000 (18:39 +0800)]
misc: sentinel: s400_api: Add get_events API

Add get_events API to retrieve any singular events that has occurred
since the FW has started from sentinel

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx8ulp_evk: Clear data at fdt_addr_r before booting kernel
Ye Li [Tue, 31 Jan 2023 08:42:34 +0000 (16:42 +0800)]
imx8ulp_evk: Clear data at fdt_addr_r before booting kernel

When using dual boot mode, the DDR won't be reset when APD power off
or reboot. It has possibility that obsolete fdt data existing on
fdt_addr_r address. Then even nothing in EFI partitions, the distro boot
still continue to parse fdt and get uboot crashed.

Clear the data at fdt_addr_r, so the fdt header check in above case
will not pass.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx8ulp_evk: disable overflow of port0 for LPAV
Peng Fan [Tue, 31 Jan 2023 08:42:33 +0000 (16:42 +0800)]
imx8ulp_evk: disable overflow of port0 for LPAV

Bit0: Port 0 behavior when bandwidth maximized. Set to 1 to allow overflow

With overflow set, we see some issue that A35 may not able to get enough
bandwidth and A35 will report hrtimer takes too much time, workqueue
lockup. With overflow cleared, the issues are gone.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx8ulp_evk: Update DDR ports arbitration for DCNANO underrun
Ye Li [Tue, 31 Jan 2023 08:42:32 +0000 (16:42 +0800)]
imx8ulp_evk: Update DDR ports arbitration for DCNANO underrun

To resolve DCNANO underrun issue, change the DDR Port 0 arbitration
from round robin fashion to fixed priority level 1, while other ports
are not assigned any priority, so they will be serviced in round robin
fashion if there is no active request from Port 0.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx8ulp_evk: Change to use DDR driver
Ye Li [Tue, 31 Jan 2023 08:42:31 +0000 (16:42 +0800)]
imx8ulp_evk: Change to use DDR driver

Remove the DDR initialization codes from board and enable the iMX8ULP
DDR driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
19 months agoimx8ulp_evk: Update the DDR timing
Jacky Bai [Tue, 31 Jan 2023 08:42:30 +0000 (16:42 +0800)]
imx8ulp_evk: Update the DDR timing

Update the dram timing to support PLL bypass mode
for F1.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
19 months agoddr: imx: Update the ddr init flow on imx8ulp
Jacky Bai [Tue, 31 Jan 2023 08:42:29 +0000 (16:42 +0800)]
ddr: imx: Update the ddr init flow on imx8ulp

Update the ddr init flow to support LPDDR3 and PLL bypass mode.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
19 months agomisc: fuse: Lock 8ULP ECC-protected fuse when programming
Ye Li [Tue, 31 Jan 2023 08:42:28 +0000 (16:42 +0800)]
misc: fuse: Lock 8ULP ECC-protected fuse when programming

The ECC fuse on 8ULP can't be written twice. If any user did it, the
ECC value would be wrong then cause accessing problem to the fuse.
The patch will lock the ECC fuse word to avoid this problem.
For iMX9, the OTP controller automatically prevents an ECC fuse word to
be written twice. So it does not need the setting.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agomisc: fuse: Update fuse mapping for 8ULP S400 API
Ye Li [Tue, 31 Jan 2023 08:42:27 +0000 (16:42 +0800)]
misc: fuse: Update fuse mapping for 8ULP S400 API

Since new 8ULP A1 S400 FW (v0.0.8-e329b760) can support to read
more fuses: like PMU trim, Test flow/USB, GP1-5, GP8-10. Update
the u-boot driver for the new mapping.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Alice Guo <alice.guo@nxp.com>
19 months agoimx: sentinel: Update S400 API get info message structure
Ye Li [Tue, 31 Jan 2023 08:42:26 +0000 (16:42 +0800)]
imx: sentinel: Update S400 API get info message structure

From Sentinel FW v0.0.9-9df0f503, the response message of get info API
is changed to add OEM SRK and some states (IMEM, CSAL, TRNG).
With old structure, we get failure from sentinel due to the buffer
size can't fit with new response message. So update the API structure
to fix the issue.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Update clocks to meet max rate restrictions
Ye Li [Tue, 31 Jan 2023 08:42:25 +0000 (16:42 +0800)]
imx: imx8ulp: Update clocks to meet max rate restrictions

Update PLL3/PLL4 PFD and USDHC clocks to meet maximum frequency
restrictions. Detail clock rate changes in the patch:

PLL3 PFD2: 389M -> 324M
PLL3 PFD3: 336M -> 389M
PLL3 PFD3: DIV1 336M -> 389M (OD), 194M (ND/LD)
PLL3 PFD3: DIV2 336M -> 194M (OD), 97M (ND/LD)

PLL4 PFD0: 792M -> 594M
PLL4 PFD2: 792M -> 316.8M

NIC_AP:    96M (ND) -> 192M,  48M (LD) -> 96M
NIC_LPAV:  198 (ND) -> 192M,  99M (LD) -> 96M

USDHC0:    PLL3 PFD3 DIV1, 389M (OD), 194M (ND/LD)
USDHC1:    PLL3 PFD3 DIV2, 194M (OD), 97M (ND/LD)
USDHC2:    PLL3 PFD3 DIV2, 194M (OD), 97M (ND/LD)

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Configure XRDC PDAC and MSC for DBD owner=S400 only
Ye Li [Tue, 31 Jan 2023 08:42:24 +0000 (16:42 +0800)]
imx: imx8ulp: Configure XRDC PDAC and MSC for DBD owner=S400 only

This patch is used to support DBD owner fuse changed to S400 only.
The XRDC PDAC2 for LPAV pbridge5 and MSC1/2/3 for GPIO and LPAV are not
configured by S400 default setting.  So these PDAC and MSC are invalid,
only DBD owner can access the corresponding resources.

We have to configure necessary PDAC and MSC for SPL before DDR
initialization.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: upower: make code cleaner
Peng Fan [Tue, 31 Jan 2023 08:42:23 +0000 (16:42 +0800)]
imx: imx8ulp: upower: make code cleaner

To clean the upower codes by aligning codes format, check err_code
and add detail bits list for the memory magic number

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: upower: replace magic number with macro
Peng Fan [Tue, 31 Jan 2023 08:42:22 +0000 (16:42 +0800)]
imx: imx8ulp: upower: replace magic number with macro

The swton indicates the logic switch, magic number 0xfff80 is hard
to understand, so use macro.

Some board design may not have MIPI_CSI voltage input connected per
data sheet. In that case, the upower power on API may dead loop mu to wait
response, however there is no response. So remove MIPI_CSI here, let
linux power domain driver to runtime enable the power domain.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Clear dividers in PLL3DIV_PFD registers
Ye Li [Tue, 31 Jan 2023 08:42:21 +0000 (16:42 +0800)]
imx: imx8ulp: Clear dividers in PLL3DIV_PFD registers

At present, in cgc1_pll3_init we don't set the pll3pfd div values,
just use the default 0. But on A1 part, ROM will set PLL3 pfd1div2
to 1 and pfd2div1 to 3.
This finally causes some clocks' rate decreased, for example USDHC.
So clear the PLL3DIV_PFD dividers to get correct rate.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Reconfigure MRC3 for SRAM0 access
Ye Li [Tue, 31 Jan 2023 08:42:20 +0000 (16:42 +0800)]
imx: imx8ulp: Reconfigure MRC3 for SRAM0 access

Some space in SRAM0 will be protected by S400 to allow RX SecPriv mode
access only for boot purpose. Since SW will reuse the SRAM0 as SCMI
buffer and SPL container loading buffer, need to reconfigure MRC3.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoddr: imx8ulp: Change DRAM timing save area to 0x20055000
Ye Li [Tue, 31 Jan 2023 08:42:19 +0000 (16:42 +0800)]
ddr: imx8ulp: Change DRAM timing save area to 0x20055000

To align with ARM trusted firmware's change, adjust DRAM timing
save area to new position 0x20055000. So we can release the space
since 0x2006c000 for the NOBITS region of ARM trusted firmware

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
19 months agoimx: imx8ulp: configure XRDC for DRAM access from S400
Ye Li [Tue, 31 Jan 2023 08:42:18 +0000 (16:42 +0800)]
imx: imx8ulp: configure XRDC for DRAM access from S400

Need to add DRAM access permission for S400, as S400 needs to access
it When SPL calls image authentication

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Adjust handshake to sync TRDC and XRDC completion
Ye Li [Tue, 31 Jan 2023 08:42:17 +0000 (16:42 +0800)]
imx: imx8ulp: Adjust handshake to sync TRDC and XRDC completion

To fit the DBD_EN fused part, we re-design the TRDC and XRDC assignment.
M33 will be the TRDC owner and needs to configure TRDC. A35 is the
XRDC owner, ATF will configure XRDC.

The handshake between U-boot and M33 image is used to sync TRDC and
XRDC configuration completion. Once the handshake is done, A35 and M33
can access the allowed resources in others domain.

The handshake is needed when M33 is booted or DBD_EN fused, because both
cases will enable the TRDC. If handshake is timeout, the boot will hang.
We use SIM GPR0 to pass the info from SPL to u-boot, because before the
handshake, u-boot can't access SEC SIM and FSB.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
19 months agoimx: imx8ulp: Remove the TRDC configure from A35
Ye Li [Tue, 31 Jan 2023 08:42:16 +0000 (16:42 +0800)]
imx: imx8ulp: Remove the TRDC configure from A35

As M33 is responsible for TRDC configuration, the settings for A35
nonsecure world access and DMA0 access are moved to M33 image.
So remove the codes to release TRDC and configure it. Just keep
the configurations for reference.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
19 months agoimx: imx8ulp: Set XRDC MRC4/5 for access DDR from APD
Ye Li [Tue, 31 Jan 2023 08:42:15 +0000 (16:42 +0800)]
imx: imx8ulp: Set XRDC MRC4/5 for access DDR from APD

iMX8ULP A1 S400 ROM removes the setting for MRC4/5. So we have to set
them in SPL to allow access to DDR from A35 and APD PER masters

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Limit the eMMC ROM API workaround to A0.1 part
Ye Li [Tue, 31 Jan 2023 08:42:14 +0000 (16:42 +0800)]
imx: imx8ulp: Limit the eMMC ROM API workaround to A0.1 part

Since A1 ROM has fixed the ROM API eMMC issue, we should only use
the workaround for A0.1 part. Add a SOC revision check.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Get chip revision from Sentinel
Ye Li [Tue, 31 Jan 2023 08:42:13 +0000 (16:42 +0800)]
imx: imx8ulp: Get chip revision from Sentinel

In both SPL and u-boot, after probing the S400 MU, get the chip revision,
lifecycle and UID from Sentinel.
Update get_cpu_rev to use the chip revision not hard coded it for A0

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
19 months agoimx: imx8ulp: Fix MU device probe failure
Ye Li [Tue, 31 Jan 2023 08:42:12 +0000 (16:42 +0800)]
imx: imx8ulp: Fix MU device probe failure

Since latest DTS has added multiple MU nodes, using compatible
string to find the device node is not proper. It finds the first
node with the compatible string matched even the node is disabled.

Signed-off-by: Ye Li <ye.li@nxp.com>
19 months agoMerge tag 'u-boot-at91-2023.07-a' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 28 Mar 2023 15:21:29 +0000 (11:21 -0400)]
Merge tag 'u-boot-at91-2023.07-a' of https://source.denx.de/u-boot/custodians/u-boot-at91 into next

First set of u-boot-at91 features for the 2023.07 cycle:

This feature set includes the clock changes required for sam9x60 SoC to
support USB host.

19 months agoRevert "rockchip: Fix early use of bootph props"
Tom Rini [Mon, 27 Mar 2023 19:20:19 +0000 (15:20 -0400)]
Revert "rockchip: Fix early use of bootph props"

While this change is correct for v2023.04 it is not correct for next
(where this is right now) nor post-v2023.04.

This reverts commit 8653e5d3b745925fced5fa6897c92f4a46ec2757.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoMerge branch 'master' into next
Tom Rini [Mon, 27 Mar 2023 19:19:57 +0000 (15:19 -0400)]
Merge branch 'master' into next

19 months agoPrepare v2023.04-rc5
Tom Rini [Mon, 27 Mar 2023 18:23:26 +0000 (14:23 -0400)]
Prepare v2023.04-rc5

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 27 Mar 2023 17:39:17 +0000 (13:39 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agoMerge branch '2023-03-27-rockchip-rk3399-fixes'
Tom Rini [Mon, 27 Mar 2023 15:16:51 +0000 (11:16 -0400)]
Merge branch '2023-03-27-rockchip-rk3399-fixes'

- A series of minor cleanups to DISTRO_DEFAULTS and BOOTSTD so that the
  rk3399 bootstd migration can be complete and functional now, and make
  future migrations easier.

19 months agorockchip: rk3399: Drop altbootcmd
Tom Rini [Fri, 24 Mar 2023 20:58:16 +0000 (16:58 -0400)]
rockchip: rk3399: Drop altbootcmd

The defined altbootcmd was specific to distro_bootcmd which is not
longer in use on these platforms, so drop it.

Tested-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agorockchip: Use BOOTSTD_DEFAULTS if not DISTRO_DEFAULTS
Tom Rini [Fri, 24 Mar 2023 20:58:15 +0000 (16:58 -0400)]
rockchip: Use BOOTSTD_DEFAULTS if not DISTRO_DEFAULTS

When we do not enable DISTRO_DEFAULTS (generally, to get distro_bootcmd)
we instea do want to imply BOOTSTD_DEFAULTS so that when using bootstd
the general distro boot functionality will still work.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agorockchip: Disable DISTRO_DEFAULTS for rk3399 boards
Simon Glass [Fri, 24 Mar 2023 20:58:14 +0000 (16:58 -0400)]
rockchip: Disable DISTRO_DEFAULTS for rk3399 boards

These board have moved to standard boot but the old 'distro_bootcmd'
command is still active. Disable DISTRO_DEFAULTS to fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
19 months agoboot: Create a common BOOT_DEFAULTS for distro and bootstd
Simon Glass [Fri, 24 Mar 2023 20:58:13 +0000 (16:58 -0400)]
boot: Create a common BOOT_DEFAULTS for distro and bootstd

These two features use a lot of common options. Move them into a common
CONFIG to reduce duplication.

Use 'select' for most options since these are things that boards aren't
supposed to override. For now it is not possible to disable
BOOT_DEFAULTS but we may take another look later.

Note that five options use 'imply' to match existing behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Rework a bit so we don't grow so many platforms unintentionally]
Signed-off-by: Tom Rini <trini@konsulko.com>
19 months agolmb: Enable LMB if SYS_BOOT_RAMDISK_HIGH
Simon Glass [Fri, 24 Mar 2023 20:58:12 +0000 (16:58 -0400)]
lmb: Enable LMB if SYS_BOOT_RAMDISK_HIGH

Ramdisk relocation requires LMB, so enable it automatically to avoid
build errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoMove DISTRO_DEFAULTS into boot/
Simon Glass [Fri, 24 Mar 2023 20:58:11 +0000 (16:58 -0400)]
Move DISTRO_DEFAULTS into boot/

This relates to booting so move it in to that Kconfig file, before
changing it.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agorockchip: Drop bootstage stash in TPL and SPL for rockpro64
Simon Glass [Fri, 24 Mar 2023 20:58:10 +0000 (16:58 -0400)]
rockchip: Drop bootstage stash in TPL and SPL for rockpro64

Unfortunately the IRAM used to stash the bootstage records in TPL
becomes inaccessible after SPL runs. Presumably this is because of ATF
taking it over.

We could move the stash to another address in SPL, before passing it to
U-Boot proper. But it seems easier to wait until we have support for
standard passage[1] which should not be too far away.

For now, disable it in TPL and SPL.

[1] https://patchwork.ozlabs.org/project/uboot/cover/
    20220117150428.1580273-1-sjg@chromium.org/

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
19 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 27 Mar 2023 15:05:40 +0000 (11:05 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- x86: Bug fixes of previous BayTrail platform CONFIG_TEXT_BASE changes

19 months agoconfigs: at91: sam9x60: Add required configs for the USB clock
Sergiu Moga [Wed, 8 Mar 2023 14:39:54 +0000 (16:39 +0200)]
configs: at91: sam9x60: Add required configs for the USB clock

Add the configs required to use the SAM9X60's USB clock.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[claudiu.beznea: added CONFIG_AT91_SAM9X60_USB to
 sam9x60_curiosity_mmc1_defconfig]
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: sam9x60: Add initial setup of UPLL and USBCK rates
Sergiu Moga [Wed, 8 Mar 2023 14:39:53 +0000 (16:39 +0200)]
clk: at91: sam9x60: Add initial setup of UPLL and USBCK rates

In order for some of the functionalities, such as the USB clocks,
to work properly we need some clocks to be properly initialised
at the very beginning of booting.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: pmc: export clock setup to pmc
Claudiu Beznea [Wed, 8 Mar 2023 14:39:52 +0000 (16:39 +0200)]
clk: at91: pmc: export clock setup to pmc

Clock setup was intended for setting clocks at boot time on SAMA7G5,
e.g. for root clocks like PLLs, that were used to feed IPs needed alive
in u-boot (e.g. Ethernet clock feed by a PLL). Export this functionality
to all at91 clocks as it may be necessary on other SoCs.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: sam9x60: Register the required clocks for USB
Sergiu Moga [Wed, 8 Mar 2023 14:39:51 +0000 (16:39 +0200)]
clk: at91: sam9x60: Register the required clocks for USB

Register into DM the clocks required to properly enable USB functionality
within the bootloader.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agoclk: at91: Add support for sam9x60 USB clock
Sergiu Moga [Wed, 8 Mar 2023 14:39:50 +0000 (16:39 +0200)]
clk: at91: Add support for sam9x60 USB clock

Implement sam9x60 USB clock driver. This clock has
three parents: PLLA, UPLL and MAINXTAL. The driver is
aware of the three possible parents with the help of the
two mux tables provied to the driver during the registration
of the clock.

Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
19 months agox86: som-db5800-som-6867: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:55 +0000 (17:59 -0600)]
x86: som-db5800-som-6867: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: e23cae30801f ("x86: som-db5800-som-6867: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agox86: dfi-bt700: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:54 +0000 (17:59 -0600)]
x86: dfi-bt700: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: 5d1c8342aeaa ("x86: dfi-bt700: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agox86: conga-qeval20-qa3-e3845: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:53 +0000 (17:59 -0600)]
x86: conga-qeval20-qa3-e3845: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: 388f93f96354 ("x86: conga-qeval20-qa3-e3845: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
19 months agox86: bayleybay: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:52 +0000 (17:59 -0600)]
x86: bayleybay: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Fixes: f38be3086837 ("x86: bayleybay: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agox86: minnowmax: Fix up adjustment of CONFIG_TEXT_BASE
Simon Glass [Tue, 14 Mar 2023 23:59:51 +0000 (17:59 -0600)]
x86: minnowmax: Fix up adjustment of CONFIG_TEXT_BASE

With recent CONFIG_TEXT_BASE changes, there are inconsistencies between
several settings.

Adjust CONFIG_SYS_MONITOR_LEN to allow more code space. Move the MRC
cache out of the way too.

Add documentation on how to make this change safely.

Fixes: 66e2c665f3b6 ("x86: minnowmax: Adjust CONFIG_TEXT_BASE")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
19 months agoMerge tag 'efi-next-20230325' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sat, 25 Mar 2023 21:34:34 +0000 (17:34 -0400)]
Merge tag 'efi-next-20230325' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request for efi-next-20230325

Documenation:

* add man-page for efi command

UEFI:

* Let EFI app call ExitBootServices() before legacy booting kernel
* Support zboot and bootm in the EFI app
* Let efi command show configuration tables
* Support booting a 64-bit kernel from 64-bit EFI app
* Allocate device-tree copy from high memory
* simplify efi_str_to_u16()

19 months agoMerge tag 'efi-2023.04-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 25 Mar 2023 13:40:19 +0000 (09:40 -0400)]
Merge tag 'efi-2023.04-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023.04-rc5

UEFI:

* Create unique device paths for USB devices with the same vendor
  and product id.

19 months agocmd: bootefi: allocate device-tree copy from high memory
Heinrich Schuchardt [Thu, 23 Feb 2023 19:27:38 +0000 (20:27 +0100)]
cmd: bootefi: allocate device-tree copy from high memory

The bootefi command creates a copy of the device-tree within the first
127 MiB of memory. This may lead to overwriting previously loaded binaries
(e.g. kernel, initrd).

Linux EFI stub itself copies U-Boot's copy of the device-tree. This means
there is not restriction for U-Boot to place the device-tree copy to any
address. (Restrictions existed for 32bit ARM before Linux commit
7a1be318f579 ("ARM: 9012/1: move device tree mapping out of linear region")
for legacy booting.

Reported-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
19 months agoefI: Allow packaging a kernel in the debugging script
Simon Glass [Sun, 19 Mar 2023 19:30:16 +0000 (08:30 +1300)]
efI: Allow packaging a kernel in the debugging script

Add an option to package a kernel into the debugging script used for
EFI.

The name of the kernel must be added to the script. By default it is
assumed that the kernel is built in the /tmp/kernel directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Support showing tables
Simon Glass [Sun, 19 Mar 2023 19:30:15 +0000 (08:30 +1300)]
efi: Support showing tables

Add a command (for the app and payload) to display the tables provided
by EFI. Note that for the payload the tables should always be present, so
an error message is unnecessary and would bloat the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Split out table-listing code into a new file
Simon Glass [Sun, 19 Mar 2023 19:30:14 +0000 (08:30 +1300)]
efi: Split out table-listing code into a new file

This code is used with EFI_LOADER but is also useful (with some
modifications) for the EFI app and payload. Move it into a shared
file.

Show the address of the table so it can be examined if needed. Also show
the table name as unknown if necessary. Our list of GUIDs is fairly
small.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agodoc: Add help for the efi command
Simon Glass [Sun, 19 Mar 2023 19:30:13 +0000 (08:30 +1300)]
doc: Add help for the efi command

This command currently has no help. Add some.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Include GUID names with EFI app and payload
Simon Glass [Sun, 19 Mar 2023 19:30:12 +0000 (08:30 +1300)]
efi: Include GUID names with EFI app and payload

These are currently only available when running with EFI_LOADER.
Expand this to include the app and payload, since it is useful to be
able to decode things there.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Add another tranch of GUIDs
Simon Glass [Sun, 19 Mar 2023 19:30:11 +0000 (08:30 +1300)]
efi: Add another tranch of GUIDs

Provide information about the GUIDs supplied by QEMU, so far as it is
known.

These values are used in the 'efi table' command as well as the printf
format string %sU

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Support zboot and bootm in the EFI app
Simon Glass [Sun, 19 Mar 2023 19:30:10 +0000 (08:30 +1300)]
x86: Support zboot and bootm in the EFI app

These have been disabled due to the rudimentary support available. It is
a little better now, so enable these options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
19 months agox86: Exit EFI boot services before starting kernel
Simon Glass [Sun, 19 Mar 2023 19:30:09 +0000 (08:30 +1300)]
x86: Exit EFI boot services before starting kernel

When running the EFI app, we need to exit boot services before jumping
to Linux.

At some point it may be possible to jump to Linux and pass on the system
table, and:

  * install the device-tree as configuration table
  * use LoadImage() to load the kernel image (e.g. from memory)
  * start the image with StartImage()

This should allow the Linux efistub to be used. For now, this is not
implemented.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Support booting a 64-bit kernel from 64-bit U-Boot
Simon Glass [Sun, 19 Mar 2023 19:30:08 +0000 (08:30 +1300)]
x86: Support booting a 64-bit kernel from 64-bit U-Boot

Add the missing code to handle this. For a 64-bit kernel the entry
address is 0x200 bytes after the normal entry.

Rename the parameter to boot_linux_kernel() accordingly. Update the
comments to indicate that these are addresses, not pointers.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Add return-value comment to cpu_jump_to_64bit()
Simon Glass [Sun, 19 Mar 2023 19:30:07 +0000 (08:30 +1300)]
x86: Add return-value comment to cpu_jump_to_64bit()

This does not mention what it returns. Add the missing documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agox86: Adjust bootparam.h to be more like linux
Simon Glass [Sun, 19 Mar 2023 19:30:06 +0000 (08:30 +1300)]
x86: Adjust bootparam.h to be more like linux

This likely came from Linux originally, so update it to match v6.2 more.
This has no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi: Set RUN_64BIT correctly for the EFI app
Simon Glass [Sun, 19 Mar 2023 19:30:05 +0000 (08:30 +1300)]
efi: Set RUN_64BIT correctly for the EFI app

The U-Boot EFI app can run as a 64-bit program, so set the Kconfig
correctly in that case. Make sure it doesn't build SPL, since there is
no need to switch from 32 to 64 bit when running.

Signed-off-by: Simon Glass <sjg@chromium.org>
19 months agoefi_loader: simplify efi_str_to_u16()
Heinrich Schuchardt [Sun, 19 Mar 2023 08:20:23 +0000 (09:20 +0100)]
efi_loader: simplify efi_str_to_u16()

Use efi_alloc() to allocate memory.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
19 months agoefi_loader: move dp_alloc() to efi_alloc()
Heinrich Schuchardt [Sun, 19 Mar 2023 08:20:22 +0000 (09:20 +0100)]
efi_loader: move dp_alloc() to efi_alloc()

The incumbent function efi_alloc() is unused.

Replace dp_alloc() by a new function efi_alloc() that we can use more
widely.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoefi_loader: move struct efi_device_path to efi.h
Heinrich Schuchardt [Sun, 19 Mar 2023 07:59:33 +0000 (08:59 +0100)]
efi_loader: move struct efi_device_path to efi.h

Avoid forward declaration of struct efi_device_path.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
19 months agoefi_loader: fix device-path for USB devices
Heinrich Schuchardt [Sun, 19 Mar 2023 15:18:09 +0000 (16:18 +0100)]
efi_loader: fix device-path for USB devices

EFI device paths for block devices must be unique. If a non-unique device
path is discovered, probing of the block device fails.

Currently we use UsbClass() device path nodes. As multiple devices may
have the same vendor and product id these are non-unique. Instead we
should use Usb() device path nodes. They include the USB port on the
parent hub. Hence they are unique.

A USB storage device may contain multiple logical units. These can be
modeled as Ctrl() nodes.

Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>