platform/kernel/u-boot.git
3 years agofastboot: add command to select the eMMC boot configuration
Patrick Delaunay [Wed, 27 Jan 2021 13:46:49 +0000 (14:46 +0100)]
fastboot: add command to select the eMMC boot configuration

Add command oem bootbus which executes the command
``mmc bootbus <id> <arg>`` on the current fastboot mmc device
(<i> = CONFIG_FASTBOOT_FLASH_MMC_DEV) to set the eMMC boot
configuration on first update, with
<arg> =  boot_bus_width reset_boot_bus_width boot_mode

$> fastboot oem bootbus:<boot_bus_width> <reset_boot_bus_width> <boot_mode>

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agofastboot: add command to select the default emmc hwpart for boot
Patrick Delaunay [Wed, 27 Jan 2021 13:46:48 +0000 (14:46 +0100)]
fastboot: add command to select the default emmc hwpart for boot

Add fastboot command oem partconf which executes the command
``mmc partconf <id> <arg> 0`` on the current <id> mmc device
to configure the eMMC boot partition with
<arg>: boot_ack boot_partition, so the command is:

$> fastboot oem partconf:<boot_ack> <boot_partition>

The partition_access argument is forced to 0 (userdata)

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
[lukma - Kconfig adjustments after merging this patch]

3 years agofastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2
Patrick Delaunay [Wed, 27 Jan 2021 13:46:47 +0000 (14:46 +0100)]
fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2

Update the code and the configs for eMMC boot and userdata
partitions acces
- FASTBOOT_MMC_BOOT_SUPPORT: boot partition 1 and 2 (erase/write)
- FASTBOOT_MMC_BOOT1_NAME: boot partition 1, default name="mmc0boot0"
- FASTBOOT_MMC_BOOT2_NAME: boot partition 2, default name="mmc0boot1"

This patch also removes the unnecessary dependency with
ARCH_MEDIATEK and EFI_PARTITION.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agofastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT
Patrick Delaunay [Wed, 27 Jan 2021 13:46:46 +0000 (14:46 +0100)]
fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT

Split userdata and boot partition support for eMMC update
and correct the description (update is supported).

The new configuration CONFIG_FASTBOOT_MMC_USER_SUPPORT
allows to activate support of userdata partition update,
based on target name=CONFIG_FASTBOOT_MMC_USER_NAME

This patch also removes the unnecessary dependency with
ARCH_MEDIATEK and EFI_PARTITION.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agofastboot: Implement generic fastboot_set_reboot_flag
Roman Kovalivskyi [Tue, 26 Jan 2021 20:54:56 +0000 (22:54 +0200)]
fastboot: Implement generic fastboot_set_reboot_flag

It is possible to implement fastboot_set_reboot_flag in a generic way
if BCB commands are turned on for a target. Using
bcb_set_reboot_reason allows to do this by simply passing string with
correct reboot reason that should be handled during next boot process.

If BCB are turned off, then bcb_set_reboot_reason would simply return
error, so it won't introduce any new behaviour for such targets.

Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agoRevert "fastboot: Add default fastboot_set_reboot_flag implementation"
Roman Kovalivskyi [Tue, 26 Jan 2021 20:54:55 +0000 (22:54 +0200)]
Revert "fastboot: Add default fastboot_set_reboot_flag implementation"

This reverts commit 0ebf9842e56c5b8cb7cb1f990bb452cc14af6225.

Current generic implementation of fastboot_set_reboot_flag is somewhat
messy and requires some additional configuration option to be enabled
besides CMD_BCB, so it reverts that implementtion in order to bring a
new cleaner one.

Next commit introduces new generic implementation of
fastboot_set_reboot_flag.

Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agodfu: dfu_sf: use correct print code
Heinrich Schuchardt [Sun, 27 Dec 2020 08:58:05 +0000 (09:58 +0100)]
dfu: dfu_sf: use correct print code

For printing unsigned int %u has to be used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMerge tag 'ti-v2021.04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Fri, 5 Feb 2021 14:39:31 +0000 (09:39 -0500)]
Merge tag 'ti-v2021.04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti

- Sync DTS from Linux kernel for all K3 platforms
- Add MMC higher speed nodes for AM65x, J721e, J7200
- Convert Nokia RX-51 to use CONFIG_DM_MMC
- Minor fixes for LEGO MINDSTORMS

3 years agoMerge tag 'efi-2021-04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 4 Feb 2021 22:35:50 +0000 (17:35 -0500)]
Merge tag 'efi-2021-04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc2

Bug fixes:

* do not allow creating of files with filenames on FAT file system
* install UEFI System Partition GUID on ESP handle
* in dtbdump.efi test tool use GUID to find ESP handle

Documentation:

* man-page for load command
* describe end of life of plat_auto

3 years agodoc: dm: describe end of life of plat_auto
Heinrich Schuchardt [Sun, 31 Jan 2021 10:04:12 +0000 (11:04 +0100)]
doc: dm: describe end of life of plat_auto

Describe when plat_auto is freed.

Fix a typo.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: return value exception command
Heinrich Schuchardt [Wed, 27 Jan 2021 20:19:12 +0000 (21:19 +0100)]
doc: return value exception command

If the exception cannot be raised, the command returns.
Currently the return values are not all the same.

Remove the sub-chapter 'Return value'

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: describe load command
Heinrich Schuchardt [Wed, 27 Jan 2021 20:07:40 +0000 (21:07 +0100)]
doc: describe load command

Man-page for load command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoefi_loader: VenMedia device path node
Heinrich Schuchardt [Wed, 3 Feb 2021 17:46:07 +0000 (18:46 +0100)]
efi_loader: VenMedia device path node

The Load File2 protocol exposes a device path with a VenMedia() node. Hence
our implementation of the device path to text protocol should support this
node.

Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: use GUID to find ESP in dtbdump
Heinrich Schuchardt [Tue, 2 Feb 2021 17:02:19 +0000 (18:02 +0100)]
efi_selftest: use GUID to find ESP in dtbdump

If dtbdump.efi is loaded from memory when calling LoadImage the loaded
image protocol will not indicate the partition from where it was loaded.
In this case use the EFI system partition for the 'load' and 'save'
commands.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: install UEFI System Partition GUID
Heinrich Schuchardt [Tue, 2 Feb 2021 16:53:14 +0000 (17:53 +0100)]
efi_loader: install UEFI System Partition GUID

On the handle for the UEFI System Partition we must install the System
Partition GUID (with a NULL interface).

Let the efidebug command display the GUID.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: only check size if EFI_DT_APPLY_FIXUPS
Heinrich Schuchardt [Tue, 2 Feb 2021 06:27:42 +0000 (07:27 +0100)]
efi_loader: only check size if EFI_DT_APPLY_FIXUPS

In the implementation of the EFI_DT_FIXUP_PROTOCOL:

* Only check the buffer size when EFI_DT_APPLY_FIXUPS is set.
* In this case the field totalsize of the device-tree may not exceed the
  buffer size.
* Install device-tree only if EFI_DT_INSTALL_TABLE is set.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoarm: dts: k3-j7200: Sync Linux v5.11-rc6 dts into U-Boot
Lokesh Vutla [Mon, 1 Feb 2021 05:56:41 +0000 (11:26 +0530)]
arm: dts: k3-j7200: Sync Linux v5.11-rc6 dts into U-Boot

Sync all J7200 related v5.11-rc6 Linux kernel dts into U-Boot.
MCU R5F nodes are not yet added in Linux kernel yet but were added
in U-Boot. In order to avoid regressions, r5f nodes are kept intact.
These will be added in kernel in future.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: k3-j721e: Sync Linux v5.11-rc6 dts into U-Boot
Lokesh Vutla [Mon, 1 Feb 2021 05:56:40 +0000 (11:26 +0530)]
arm: dts: k3-j721e: Sync Linux v5.11-rc6 dts into U-Boot

Sync all J721e related v5.11-rc6 Linux kernel dts into U-Boot.
HBMC nodes are not yet added in Linux kernel yet but were added
in U-Boot. In order to avoid any regressions, hbmc nodes are kept
intact. These will be added in kernel in future.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: k3-am65: Sync Linux v5.11-rc6 dts into U-Boot
Lokesh Vutla [Mon, 1 Feb 2021 05:56:39 +0000 (11:26 +0530)]
arm: dts: k3-am65: Sync Linux v5.11-rc6 dts into U-Boot

Sync all AM65 related v5.11-rc6 Linux kernel dts into U-Boot.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoconfigs: am65x_evm: Add configs for UHS modes
Faiz Abbas [Thu, 4 Feb 2021 09:41:05 +0000 (15:11 +0530)]
configs: am65x_evm: Add configs for UHS modes

Add configs for voltage switching and UHS modes for the SD card
and HS200 for the eMMC.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: k3-am654-base-board: Limit Sd card to High speed modes
Faiz Abbas [Thu, 4 Feb 2021 09:41:04 +0000 (15:11 +0530)]
arm: dts: k3-am654-base-board: Limit Sd card to High speed modes

There's an issue with the base board in which the power cycle
circuit takes way longer to power down than expected by mmc core.
code. This prevents the card from enumerating in UHS modes.

Disable UHS modes for this board until a new board revision fixes
the issue.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: k3-am65-main: Add itapdly and clkbuf-sel values
Faiz Abbas [Thu, 4 Feb 2021 09:41:03 +0000 (15:11 +0530)]
arm: dts: k3-am65-main: Add itapdly and clkbuf-sel values

Add the appropriate itapdly and clkbuf-sel values required for
some lower speed modes.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoconfigs: j7200_evm: Add support for UHS modes
Faiz Abbas [Thu, 4 Feb 2021 09:41:02 +0000 (15:11 +0530)]
configs: j7200_evm: Add support for UHS modes

Add configs to support UHS modes for the SD card and HS200 for the eMMC.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoconfigs: j721e_evm: Add support for UHS modes
Faiz Abbas [Thu, 4 Feb 2021 09:41:01 +0000 (15:11 +0530)]
configs: j721e_evm: Add support for UHS modes

Add configs to support UHS modes for the SD card and HS200 for the eMMC.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: k3-j7200-common-proc-board: Enable support for UHS modes
Faiz Abbas [Thu, 4 Feb 2021 09:41:00 +0000 (15:11 +0530)]
arm: dts: k3-j7200-common-proc-board: Enable support for UHS modes

Add support for UHS modes by adding the regulators to power cycle
and voltage switch the card. Also add pinmuxes required for each
node

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: k3-j7200-main: Add support for gpio0
Faiz Abbas [Thu, 4 Feb 2021 09:40:59 +0000 (15:10 +0530)]
arm: dts: k3-j7200-main: Add support for gpio0

Add support for the main_gpio0 node

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: k3-j721e-common-proc-board: Add support for UHS modes for SD card
Faiz Abbas [Thu, 4 Feb 2021 09:40:58 +0000 (15:10 +0530)]
arm: dts: k3-j721e-common-proc-board: Add support for UHS modes for SD card

Add support for regulators to power cycle and switch IO voltage to the
SD card. This enables support for UHS modes.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: k3-j721e-main: Update otap-delay values
Faiz Abbas [Thu, 4 Feb 2021 09:40:57 +0000 (15:10 +0530)]
arm: dts: k3-j721e-main: Update otap-delay values

Update otap delay values to match with the latest Data Manual[1].

[1] https://www.ti.com/lit/gpn/dra829v

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: k3-am65: Fix mmc nodes
Faiz Abbas [Thu, 4 Feb 2021 09:40:56 +0000 (15:10 +0530)]
arm: dts: k3-am65: Fix mmc nodes

Because of fundamental interface issues in am65x pg1, only the
initial sdhci1 node at 25 MHz was added in the u-boot.dtsi
from which both the base-board.dts and r5-base-board.dts
inherit the node. Move the node out to k3-am65-main.dtsi
where it belongs and add the board specific properties
in base-board.dts and r5-base-board.dts

This ensures dts compatibility with the kernel dts in the
base-board.dts and enables the SD card interface at 50 MHz
and High Speed mode

While we are here, also fix the main_mmc0_pins_default
property to be included and inherit from the base-board.dts
instead of the u-boot.dtsi

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agommc: am654_sdhci: Use sdhci_set_control_reg()
Faiz Abbas [Thu, 4 Feb 2021 09:40:55 +0000 (15:10 +0530)]
mmc: am654_sdhci: Use sdhci_set_control_reg()

Use the generic sdhci_set_control_reg() instead of duplicating
in platform driver.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Fix HISPD bit configuration in some lower speed modes
Faiz Abbas [Thu, 4 Feb 2021 09:40:54 +0000 (15:10 +0530)]
mmc: am654_sdhci: Fix HISPD bit configuration in some lower speed modes

According to the AM654x Data Manual[1], the setup timing in lower speed
modes can only be met if the controller uses a falling edge data launch.

To ensure this, the HIGH_SPEED_ENA (HOST_CONTROL[2]) bit should be
cleared in default speed, SD high speed, MMC high speed, SDR12 and SDR25
speed modes.

Use the sdhci writeb callback to implement this condition.

[1] http://www.ti.com/lit/gpn/am6546 Section 5.10.5.16.1

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Add support for software tuning
Faiz Abbas [Thu, 4 Feb 2021 09:40:53 +0000 (15:10 +0530)]
mmc: am654_sdhci: Add support for software tuning

With the new SW tuning App note[1], a custom tuning algorithm is
required for eMMC HS200, HS400 and SD card UHS modes. The algorithm
involves running through the 32 possible input tap delay values and
sending the appropriate tuning command (CMD19/21) for each of them
to get a fail or pass result for each of the values. Typically, the
range will have a small contiguous failing window. Considering the
tuning range as a circular buffer, the algorithm then sets a final
tuned value directly opposite to the failing window.

[1] https://www.ti.com/lit/pdf/spract9

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Add support for writing to clkbuf_sel
Faiz Abbas [Thu, 4 Feb 2021 09:40:52 +0000 (15:10 +0530)]
mmc: am654_sdhci: Add support for writing to clkbuf_sel

Add support for writing new clock buffer select property for both
the am654x and j721e 4 bit IPs

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Add support for input tap delay
Faiz Abbas [Thu, 4 Feb 2021 09:40:51 +0000 (15:10 +0530)]
mmc: am654_sdhci: Add support for input tap delay

DLL need only be enabled for speed modes and clock frequencies at or
above 50 MHz. For speed modes that don't enable the DLL, we need to
configure a static input delay value. This involves reading an optional
itap-del-sel-* value from the device tree and configuring it for the
appropriate speed mode.

Therefore, move all dll configurations to their own functions and gate it
with 50 MHz speed and a minimum mode. If both these conditions are not
satisfied then configure delay chain modes.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Add support for AM65x SR2.0
Faiz Abbas [Thu, 4 Feb 2021 09:40:50 +0000 (15:10 +0530)]
mmc: am654_sdhci: Add support for AM65x SR2.0

Add Support for AM65x PG2.0. Use the SoC bus framework to fixup
the platform data and do DLL calibration if the revision is 1.0

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Add flag for PHY calibration
Faiz Abbas [Thu, 4 Feb 2021 09:40:49 +0000 (15:10 +0530)]
mmc: am654_sdhci: Add flag for PHY calibration

Not all controllers need calibration for the PHY DLL. Add a DLL_CALIB
flag to indicate the same.

Also move the write of trm_icp and driver strength to the set_clock()
function to match the kernel configuration flow.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Convert flag fields to BIT macro
Faiz Abbas [Thu, 4 Feb 2021 09:40:48 +0000 (15:10 +0530)]
mmc: am654_sdhci: Convert flag fields to BIT macro

Convert the flags field defines to use the BIT() macro.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: am654_sdhci: Unconditionally switch off DLL in the beginning of ios_post()
Faiz Abbas [Thu, 4 Feb 2021 09:40:47 +0000 (15:10 +0530)]
mmc: am654_sdhci: Unconditionally switch off DLL in the beginning of ios_post()

There are some speed modes that work without switching the dll on.
Unconditionally switch off the DLL before setting clock frequency to
support this case. The software will automatically enable DLL for speed
modes that require it. This also means the dll_on priv data member is no
longer required.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: sdhci: Add helper functions for UHS modes
Faiz Abbas [Thu, 4 Feb 2021 09:40:46 +0000 (15:10 +0530)]
mmc: sdhci: Add helper functions for UHS modes

Add a set_voltage() function which handles the switch from 3.3V to 1.8V
for SD card UHS modes.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoconfigs: am335x_evm: enable CONFIG_SPL_ALLOC_BD
Dario Binacchi [Mon, 18 Jan 2021 21:28:30 +0000 (22:28 +0100)]
configs: am335x_evm: enable CONFIG_SPL_ALLOC_BD

With commit 38d6b7ebdaee ("spl: Drop bd_info in the data section") you
need to enable this option to boot from mmc.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoremoteproc: k3_r5: Sync to upstreamed kernel DT property names
Suman Anna [Wed, 27 Jan 2021 00:20:56 +0000 (18:20 -0600)]
remoteproc: k3_r5: Sync to upstreamed kernel DT property names

The K3 R5F remoteproc driver in U-Boot was upstreamed prior to the
equivalent remoteproc driver in the Linux kernel. Some of the DT
properties used in U-Boot got upstreamed using different names
in Linux kernel.

The modified property names include the R5F cluster mode configuration
property "lockstep-mode"; and three different individual R5F core config
properties - "atcm-enable", "btcm-enable" and "loczrama". The property
names were updated as follows:
  lockstep-mode => ti,cluster-mode
  atcm-enable   => ti,atcm-enable
  btcm-enable   => ti,btcm-enable
  loczrama      => ti,loczrama

Update the K3 R5F remoteproc driver, the corresponding binding, and
all the existing usage in AM65x, J721E and J7200 dts files all at
once to use the new properties and to not break any bisectability.

Signed-off-by: Suman Anna <s-anna@ti.com>
3 years agoconfigs: am65x_evm_a53: Enable config for phandle check while getting sequence number
Aswath Govindraju [Wed, 13 Jan 2021 07:36:15 +0000 (13:06 +0530)]
configs: am65x_evm_a53: Enable config for phandle check while getting sequence number

AM65x SoC has two USB subsystems and their corresponding device tree nodes
have the same name but different path. While allocating sequence numbers
for these device tree nodes using alias, phandles can be used to
distinguish them.

Enable config for phandle check while getting sequence number to
distinguish the USB device tree nodes.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoconfigs: legoev3: disable non-Linux boot options
David Lechner [Mon, 11 Jan 2021 19:24:47 +0000 (13:24 -0600)]
configs: legoev3: disable non-Linux boot options

This disables booting to non-Linux OSes.

This board is uncomfortably close to its 256K size limit, so every
few KB saved helps.

Signed-off-by: David Lechner <david@lechnology.com>
3 years agoconfigs: legoev3: disable CONFIG_NET
David Lechner [Mon, 11 Jan 2021 19:24:46 +0000 (13:24 -0600)]
configs: legoev3: disable CONFIG_NET

This disables the CONFIG_NET setting for LEGO MINDSTORMS EV3. This board
does not have any built-in networking, so it does not make sense to
enable this feature.

This also fixes the warning:

===================== WARNING ======================
This board does not use CONFIG_DM_ETH (Driver Model
for Ethernet drivers). Please update the board to use
CONFIG_DM_ETH before the v2020.07 release. Failure to
update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================

Signed-off-by: David Lechner <david@lechnology.com>
3 years agoARM: legoev3: drop bi_arch_number
David Lechner [Mon, 11 Jan 2021 19:24:45 +0000 (13:24 -0600)]
ARM: legoev3: drop bi_arch_number

This drops assigning bi_arch_number on LEGO MINDSTORMS EV3. This board
never had its own unique number and since we are using device tree,
we no longer need to pass an arch number to Linux.

Signed-off-by: David Lechner <david@lechnology.com>
3 years agoARM: legoev3: set serial# env var
David Lechner [Mon, 11 Jan 2021 19:24:44 +0000 (13:24 -0600)]
ARM: legoev3: set serial# env var

This sets the serial# environmet variable instead of using ATAGs on
LEGO MINDSTORMS EV3.

Also fix some nomenclature while we are touching this code (Bluetooth
address is not the same as MAC address, EEPROM version is not the same
as board version).

Signed-off-by: David Lechner <david@lechnology.com>
3 years agoNokia RX-51: Convert to CONFIG_DM_MMC
Pali Rohár [Sat, 16 Jan 2021 00:04:54 +0000 (01:04 +0100)]
Nokia RX-51: Convert to CONFIG_DM_MMC

Move twl4030_power_mmc_init() from board_mmc_power_init() to misc_init_r()
and disable CONFIG_SYS_MALLOC_F. Otherwise U-Boot cannot initialize MMC.
Also disable CONFIG_CMD_SLEEP CONFIG_DM_DEVICE_REMOVE CONFIG_MMC_VERBOSE to
free some space.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'dm-pull-3feb21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Thu, 4 Feb 2021 13:19:23 +0000 (08:19 -0500)]
Merge tag 'dm-pull-3feb21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

Support late device removal
Allow booting a 32-bit system with a top memory address beyond 4 GiB

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Thu, 4 Feb 2021 13:18:57 +0000 (08:18 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Fix broken multi-core boot for QEMU x86
- Add zboot support to boot x86 Linux kernel image in the PXE sysboot
  utility

3 years agocmd: pxe_utils: sysboot: Add zboot support to boot x86 Linux kernel image
Kory Maincent [Tue, 2 Feb 2021 15:42:29 +0000 (16:42 +0100)]
cmd: pxe_utils: sysboot: Add zboot support to boot x86 Linux kernel image

Add "zboot" command to the list of supported boot in the
label_boot function.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: add component tags in the summary]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agocmd: pxe_utils: Replace ifdef by IS_ENABLED
Kory Maincent [Tue, 2 Feb 2021 15:42:28 +0000 (16:42 +0100)]
cmd: pxe_utils: Replace ifdef by IS_ENABLED

Replace all the macro ifdef by IS_ENABLED.

All of these configs are set in the defconfig files and not in the
include board headers files.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: keep the preprocessor case unchanged]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agocommand.h: Remove extern from the header
Kory Maincent [Tue, 2 Feb 2021 15:42:27 +0000 (16:42 +0100)]
command.h: Remove extern from the header

Remove the extern of the header because they are useless.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[bmeng: minor edit on the commit message]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: qemu: Fix broken multi-core boot
Bin Meng [Tue, 2 Feb 2021 07:04:47 +0000 (15:04 +0800)]
x86: qemu: Fix broken multi-core boot

Unfortunately the multi-core boot for QEMU x86 has been broken since
commit 77a5e2d3bc61 ("x86: mp_init: Set up the CPU numbers at the start").

In order to support QEMU x86 multi-core boot, the /cpus node must be
bound before any actual fix up in qemu_cpu_fixup(). This adds the
uclass_get() call to ensure this, just like what was done before.

Fixes: 77a5e2d3bc61 ("x86: mp_init: Set up the CPU numbers at the start")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofs: fat: remove trailing periods from long name
Heinrich Schuchardt [Sat, 30 Jan 2021 13:12:10 +0000 (14:12 +0100)]
fs: fat: remove trailing periods from long name

The FAT32 File System Specification [1] requires leading and trailing
spaces as well as trailing periods of long names to be ignored.

[1]
    Microsoft Extensible Firmware Initiative
    FAT32 File System Specification
    Version 1.03, December 6, 2000
    Microsoft Corporation
    https://www.win.tue.nl/~aeb/linux/fs/fat/fatgen103.pdf

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofirmware: smci: possible NULL dereference
Heinrich Schuchardt [Mon, 1 Feb 2021 02:01:54 +0000 (03:01 +0100)]
firmware: smci: possible NULL dereference

sandbox_scmi_devices_ctx() may return NULL. We should not dereference this
value in sandbox_scmi_devices_remove().

The problem was indicated by 'gcc-11 -fanalyzer'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: mark os_abort() as noreturn
Heinrich Schuchardt [Mon, 1 Feb 2021 00:24:10 +0000 (01:24 +0100)]
sandbox: mark os_abort() as noreturn

gcc -fanalyzer needs the information that a function does not return to
provide accurate information.

os_abort() does not return. Mark it accordingly.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobdinfo: Change to use bdinfo_print_num_ll() where the number could be 64-bit
Bin Meng [Sun, 31 Jan 2021 12:36:06 +0000 (20:36 +0800)]
bdinfo: Change to use bdinfo_print_num_ll() where the number could be 64-bit

There are some calls to bdinfo_print_num_l() with parameters that
could be a 64-bit value on a 32-bit system. Change those calls to
use bdinfo_print_num_ll() instead.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobdinfo: Rename function names to be clearer
Bin Meng [Sun, 31 Jan 2021 12:36:05 +0000 (20:36 +0800)]
bdinfo: Rename function names to be clearer

At present we have bdinfo_print_num() to print unsigned long numbers.
We also have print_phys_addr() which accept numbers that might be
64-bit on a 32-bit platform.

Rename these 2 functions to be clearer:

bdinfo_print_num() => bdinfo_print_num_l()
print_phys_addr()  => bdinfo_print_num_ll()

While we are here, make bdinfo_print_num_ll() public so that it can
be used outside cmd/bdinfo.c in the future.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Change phys_addr_t and phys_size_t to 64-bit
Bin Meng [Sun, 31 Jan 2021 12:36:04 +0000 (20:36 +0800)]
riscv: Change phys_addr_t and phys_size_t to 64-bit

phys_addr_t and phys_size_t are currently defined as `unsigned long`,
but RV32 supports 34-bit physical address, hence both phys_addr_t and
phys_size_t should be defined to 64-bit using `unsigned long long`.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agofdtdec: Cast prior_stage_fdt_address with uintptr_t
Bin Meng [Sun, 31 Jan 2021 12:36:03 +0000 (20:36 +0800)]
fdtdec: Cast prior_stage_fdt_address with uintptr_t

At present prior_stage_fdt_address is declared as phys_addr_t. On
a 32-bit platform where phys_addr_t can be 64-bit, assigning its
value to gd->fdt_blob which is a pointer, can cause warnings.

Cast it to uintptr_t before the assignment.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonet: ftmac100: Cast priv->iobase with uintptr_t
Bin Meng [Sun, 31 Jan 2021 12:36:02 +0000 (20:36 +0800)]
net: ftmac100: Cast priv->iobase with uintptr_t

priv->iobase was declared as phys_addr_t which is now a 64-bit
address. In a 32-bit build, this causes the following warning
seen when building ftmac100.c:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Cast priv->iobase with uintptr_t.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: ax25-ae350: Cast addr with uintptr_t
Bin Meng [Sun, 31 Jan 2021 12:36:01 +0000 (20:36 +0800)]
riscv: ax25-ae350: Cast addr with uintptr_t

addr was delcared as fdt_addr_t which is now a 64-bit address.
In a 32-bit build, this causes the following warning seen when
building ax25-ae350.c:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Cast addr with uintptr_t.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agoserial: sifive: Cast dev_read_addr() with uintptr_t
Bin Meng [Sun, 31 Jan 2021 12:36:00 +0000 (20:36 +0800)]
serial: sifive: Cast dev_read_addr() with uintptr_t

dev_read_addr() returns fdt_addr_t which is now a 64-bit address.
In a 32-bit build, this causes the following warning seen when
building serial_sifive.c:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Cast the return value with uintptr_t.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agoglobal_data.h: Change ram_top type to phys_addr_t
Bin Meng [Sun, 31 Jan 2021 12:35:59 +0000 (20:35 +0800)]
global_data.h: Change ram_top type to phys_addr_t

It's possible to have ram_top above 4 GiB in a 32-bit system, hence
we need to declare ram_top as `phys_addr_t`.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: rockchip: Explicitly cast gd->ram_top in dram_init_banksize()
Bin Meng [Sun, 31 Jan 2021 12:35:58 +0000 (20:35 +0800)]
arm: rockchip: Explicitly cast gd->ram_top in dram_init_banksize()

The min() macro used in dram_init_banksize() requires two elements
to compare have the same type. Let's explicitly cast gd->ram_top.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Adjust board_get_usable_ram_top() for 32-bit
Bin Meng [Sun, 31 Jan 2021 12:35:57 +0000 (20:35 +0800)]
riscv: Adjust board_get_usable_ram_top() for 32-bit

When testing QEMU RISC-V 'virt' machine with a 2 GiB memory
configuration, it was discovered gd->ram_top is assigned to
value zero in setup_dest_addr().

While gd->ram_top should not be declared as type `unsigned long`,
which will be updated in a future patch, the current logic in
board_get_usable_ram_top() can be updated to cover both 64-bit
and 32-bit RISC-V.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agodm: core: Add documentation about device removal
Simon Glass [Sun, 24 Jan 2021 21:32:48 +0000 (14:32 -0700)]
dm: core: Add documentation about device removal

Make mention of this feature in the core documentation so people can
discover it without looking at a header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoarm: Remove vital devices last
Simon Glass [Sun, 24 Jan 2021 21:32:47 +0000 (14:32 -0700)]
arm: Remove vital devices last

Update announce_and_cleanup() to remove all devices, with the vital ones
being removed last.

This is an extra patch on top of the recent RFC:

   http://patchwork.ozlabs.org/project/uboot/list/?series=223280

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add late driver remove option
Marek Vasut [Sun, 24 Jan 2021 21:32:46 +0000 (14:32 -0700)]
dm: core: Add late driver remove option

Add another flag to the DM core which could be assigned to drivers and
which makes those drivers call their remove callbacks last, just before
booting OS and after all the other drivers finished with their remove
callbacks. This is necessary for things like clock drivers, where the
other drivers might depend on the clock driver in their remove callbacks.
Prime example is the mmc subsystem, which can reconfigure a card from HS
mode to slower modes in the remove callback and for that it needs to
reconfigure the controller clock.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Avoid partially removing devices
Simon Glass [Sun, 24 Jan 2021 21:32:45 +0000 (14:32 -0700)]
dm: core: Avoid partially removing devices

At present if device_remove() decides that the device should not actually
be removed, it still calls the uclass pre_remove() method and powers the
device down.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Remove children before advising uclass
Simon Glass [Sun, 24 Jan 2021 21:32:44 +0000 (14:32 -0700)]
dm: core: Remove children before advising uclass

At present the uclass pre-remove method is called before the children are
removed. But the children may refused to be removed, in whch case the
uclass is in a tricky situation. At present we handle this by calling
the uclass' post_probe() method. But it seems better to avoid doing
anything with the uclass in this case.

Switch the ordering so that we make sure the children can be removed
before advising the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: pci: Correct use of wrong flag name
Simon Glass [Sun, 24 Jan 2021 21:32:43 +0000 (14:32 -0700)]
dm: pci: Correct use of wrong flag name

Update a driver that uses the incorrect flag. Add a comment to hopefully
prevent furture mistakes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Rename DM_FLAG_REMOVE_WITH_PD_ON
Simon Glass [Sun, 24 Jan 2021 21:32:42 +0000 (14:32 -0700)]
dm: Rename DM_FLAG_REMOVE_WITH_PD_ON

This flag has the word 'REMOVE' in it which means it conflicts with
the DM_REMOVE flags. Rename it to DM_FLAG_LEAVE_PD_ON which seems to
indicate its purpose well enough.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agonand: brcmnand: Don't use -EPROBE_DEFER
Simon Glass [Sun, 24 Jan 2021 21:32:41 +0000 (14:32 -0700)]
nand: brcmnand: Don't use -EPROBE_DEFER

This has no useful meaning in U-Boot and will never be returned. We want
to reserve this flag for internal driver model use.

Drop the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosmem: Don't use -EPROBE_DEFER
Simon Glass [Sun, 24 Jan 2021 21:32:40 +0000 (14:32 -0700)]
smem: Don't use -EPROBE_DEFER

This has no useful meaning in U-Boot. Use -ENOMEM since that appears to
be what has gone wrong in this case. We want to reserve this flag for
internal driver model use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agofs: fat: must not write directory '.' and '..'
Heinrich Schuchardt [Sat, 30 Jan 2021 10:08:21 +0000 (11:08 +0100)]
fs: fat: must not write directory '.' and '..'

Directories or files called '.' or '..' cannot be created or written to
in any directory. Move the test to normalize_longname() to check this
early.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: usage basename in file_fat_write_at, fat_mkdir
Heinrich Schuchardt [Sat, 30 Jan 2021 09:01:08 +0000 (10:01 +0100)]
fs: fat: usage basename in file_fat_write_at, fat_mkdir

This patch involves no functional change. It is just about code
readability.

Both in file_fat_write_at() and fat_mkdir() the incoming file or directory
path are split into two parts: the parent directory and the base name.

In file_fat_write_at() the value of the variable basename is assigned to
the filename parameter and afterwards the variable filename is used instead
of basename. It is more readable to use the variable basename and leave
filename unchanged.

In fat_mkdir() the base name variable is called directory. This is
confusing. Call it basename like in file_fat_write_at(). This allows to
rename parameter new_directory to directory in the implementation of
fat_mkdir() to match the function declaration.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-02-01-assorted-fixes'
Tom Rini [Tue, 2 Feb 2021 14:24:10 +0000 (09:24 -0500)]
Merge branch '2021-02-01-assorted-fixes'

- Assorted fixes

3 years agoazure: Add -E back for the world build script
Bin Meng [Sun, 31 Jan 2021 08:38:35 +0000 (16:38 +0800)]
azure: Add -E back for the world build script

Commit dd5c954e917b ("travis/gitlab/azure: Use -W to avoid warnings check")
added -W to avoid warnings check, but it mistakenly dropped -E for
the world build script in the azure pipelines.

This caused builds on the azure pipelines fail to report warnings. Let's
add it back.

Fixes: dd5c954e917b ("travis/gitlab/azure: Use -W to avoid warnings check")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: fix runtest wrapper for pytest 6
Stephen Warren [Sun, 31 Jan 2021 03:12:18 +0000 (20:12 -0700)]
test/py: fix runtest wrapper for pytest 6

The implementation of pytest_runtest_protocol() must call
pytest_runtest_logstart() and pytest_runtest_logfinish(). This appears to
be necessary even in pytest 5.2.1 judging by the default version of
pytest_runtest_protocol(), but evidently some form of code reorganization
in pytest only made this have a practical effect in the newer version. I'd
previously been under the impression that 100% of the required work of
pytest_runtest_protocol() was handled by the fact it called
runtestprotocol() as its implementation. However, it appears that custom
implementations do need to do a little more than this.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMAINTAINERS: Add maintainer to network subsystem
Ramon Fried [Fri, 29 Jan 2021 16:18:22 +0000 (18:18 +0200)]
MAINTAINERS: Add maintainer to network subsystem

Add myself as co maintainer to network subsystem
Acked-by: Tom Rini <trini@konsulko.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
3 years agodisk: part_dos: update partition table entries after write
Gary Bisson [Thu, 28 Jan 2021 08:10:07 +0000 (09:10 +0100)]
disk: part_dos: update partition table entries after write

Fixes issues when switching from GPT to MBR partition tables.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agocommon: Kconfig.boot: Add FIT_PRINT config option
Ravik Hasija [Wed, 27 Jan 2021 22:01:48 +0000 (14:01 -0800)]
common: Kconfig.boot: Add FIT_PRINT config option

Config allows to disable printing contents of fitImage to optimize boottime.

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: load, emit error message for invalid block device
Heinrich Schuchardt [Wed, 27 Jan 2021 20:26:43 +0000 (21:26 +0100)]
cmd: load, emit error message for invalid block device

The load command should not silently return to the console prompt if an
invalid block device is specified and no file is loaded.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: Remove #include <version.h> from armv8/fwcall.c
Pali Rohár [Wed, 27 Jan 2021 15:29:13 +0000 (16:29 +0100)]
arm: Remove #include <version.h> from armv8/fwcall.c

No version information is used in armv8/fwcall.c therefore do not include
version.h header file. This change prevents recompiling fwcall.o when
SOURCE_DATE_EPOCH changes.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotools/fit_check_sign.c: Update usage function.
Ilies CHERGUI [Sun, 17 Jan 2021 15:52:16 +0000 (15:52 +0000)]
tools/fit_check_sign.c: Update usage function.

Add "-c" option to set the configuration name when
checking the FIT image signature.

Signed-off-by: Ilies CHERGUI <ilies.chergui@gmail.com>
3 years agoPrepare v2021.04-rc1
Tom Rini [Mon, 1 Feb 2021 15:28:20 +0000 (10:28 -0500)]
Prepare v2021.04-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 1 Feb 2021 13:15:46 +0000 (08:15 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Fix CMD_ACPI dependency in Kconfig
- Correct overflow in __udelay() in TSC timer driver
- Add a devicetree node for eMMC for Coral
- Minor improvements on image loading
- Reduce size of Samus image

3 years agox86: Reduce size of samus image
Simon Glass [Sun, 31 Jan 2021 16:17:07 +0000 (09:17 -0700)]
x86: Reduce size of samus image

With the recent addition of ACPI generation, the image size has got beyond
its current limit.

Samus does not actually use this, nor x86 emulation for PCI ROMs, so
disable both features.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tpl: Show next stage being booted
Simon Glass [Sun, 24 Jan 2021 17:06:11 +0000 (10:06 -0700)]
x86: tpl: Show next stage being booted

Enhance the debugging to show the next stage being booted as well as a
dump of the start of the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Clear BSS unconditionally
Simon Glass [Sun, 24 Jan 2021 17:06:10 +0000 (10:06 -0700)]
x86: spl: Clear BSS unconditionally

This should be done even if not using TPL, since BSS may be in use or
boards that only use SPL. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: zimage: Improve command-line debug handling
Simon Glass [Sun, 24 Jan 2021 17:06:09 +0000 (10:06 -0700)]
x86: zimage: Improve command-line debug handling

At present if the command line is very long it is truncated by the
printf() statement, which works within a limited buffer. Use puts()
instead. Also show better debugging with the command-line setup
fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: zimage: Allow dumping the image from outside the module
Simon Glass [Sun, 24 Jan 2021 17:06:08 +0000 (10:06 -0700)]
x86: zimage: Allow dumping the image from outside the module

At present it is possible to dump an image within the zimage command, but
it is also useful to be able to dump it from elsewhere, for example in a
loader that has special handling for the different zimage stages.

Export this feature as a new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Update Chromium OS GNVS names
Simon Glass [Sun, 24 Jan 2021 17:06:07 +0000 (10:06 -0700)]
x86: Update Chromium OS GNVS names

The Global Non-Volatile Storage struct has some fields with particular
meanings. Rename these to make things easier to follow. Also add a few
more boot flags.

GNVS should not be confused with GNVQ (Going Nowhere Very Quickly).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Make moving BSS conditional
Simon Glass [Sun, 24 Jan 2021 17:06:06 +0000 (10:06 -0700)]
x86: spl: Make moving BSS conditional

At present BSS is always placed in SDRAM. If a separate BSS is not in use
this means that BSS doesn't work as expected. Make the setting conditional
on the SEPARATE_BSS option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Make sure the SPL image ends on a suitable boundary
Simon Glass [Sun, 24 Jan 2021 17:06:05 +0000 (10:06 -0700)]
x86: Make sure the SPL image ends on a suitable boundary

The part of U-Boot that actually ends up in u-boot-nodtb.bin is not built
with any particular alignment. It ends at the start of the BSS section.
The BSS section selects its own alignment, which may larger.
This means that there can be a gap of a few bytes between the image
ending and BSS starting.

Since u-boot.bin is build by joining u-boot-nodtb.bin and u-boot.dtb (with
perhaps some padding for BSS), the expected result is not obtained. U-Boot
uses the end of BSS to find the devicetree, so this means that it cannot
be found.

Add 32-byte alignment of BSS so that the image size is correct and
appending the devicetree will place it at the end of BSS.

Example SPL output without this patch:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000142a1  fef40000  fef40000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .u_boot_list  000014a4  fef542a8  fef542a8  000152a8  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  2 .rodata       0000599c  fef55760  fef55760  00016760  2**5
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  3 .data         00000970  fef5b100  fef5b100  0001c100  2**5
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  4 .binman_sym_table 00000020  fef5ba70  fef5ba70  0001ca70  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .bss          00000060  fef5baa0  fef5baa0  00000000  2**5
                  ALLOC

You can see that .bss is aligned to 2**5 (32 bytes). This is because of
the mallinfo struct in dlmalloc.c:

 17 .bss.current_mallinfo 00000028  00000000  00000000  000004c0  2**5
                  ALLOC

In this case the size of u-boot-spl-nodtb.bin is 0x1ba90. This matches up
with the _image_binary_end symbol:

fef5ba90 g       .binman_sym_table      00000000 _image_binary_end

But BSS starts 16 bytes later, at 0xfef5baa0, due to the 32-byte
alignment. So we must align _image_binary_end to a 32-byte boundary. This
forces the binary size to be 0x1baa0, i.e. ending at the start of bss, as
expected.

Note that gcc reports __BIGGEST_ALIGNMENT__ of 16 on this build, even
though it generates an object file with a member that requests 32-byte
alignment.

The current_mallinfo struct is 40 bytes in size. Increasing the struct to
68 bytes (i.e. just above a 64-byte boundary) does not cause the alignment
to go above 32 bytes. So it seems that 32 bytes is the maximum alignment
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: add more details in the commit message to help people understand]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: apl: Enhance debugging in the SPL loader
Simon Glass [Sun, 24 Jan 2021 17:06:04 +0000 (10:06 -0700)]
x86: apl: Enhance debugging in the SPL loader

Move to log_debug() and make use of the new SPL function to find the
text base.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Add a function to find the text base
Simon Glass [Sun, 24 Jan 2021 17:06:03 +0000 (10:06 -0700)]
x86: spl: Add a function to find the text base

It is useful to know the TEXT_BASE value for the image being loaded in
TPL/SPL. Add a new spl_get_image_text_base() function to handle this.

Make use of this in the x86 SPL handler, instead of having the logic
there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: acpi_gpe: Update driver name to match devicetree
Simon Glass [Sun, 24 Jan 2021 17:06:02 +0000 (10:06 -0700)]
x86: acpi_gpe: Update driver name to match devicetree

Use a driver name in line with the compatible string so that of-platdata
can use this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoacpi: Tidy up documentation for struct acpi_gpio
Simon Glass [Sat, 23 Jan 2021 18:08:38 +0000 (11:08 -0700)]
acpi: Tidy up documentation for struct acpi_gpio

Some comments were provided after this patch was applied. Address them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>