platform/kernel/u-boot.git
3 years agofdt: translate address if #size-cells = <0>
Dario Binacchi [Tue, 29 Dec 2020 23:16:21 +0000 (00:16 +0100)]
fdt: translate address if #size-cells = <0>

The __of_translate_address routine translates an address from the
device tree into a CPU physical address. A note in the description of
the routine explains that the crossing of any level with
since inherited from IBM. This does not happen for Texas Instruments, or
at least for the beaglebone device tree. Without this patch, in fact,
the translation into physical addresses of the registers contained in the
am33xx-clocks.dtsi nodes would not be possible. They all have a parent
with #size-cells = <0>.

The CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS symbol makes translation
possible even in the case of crossing levels with #size-cells = <0>.

The patch acts conservatively on address translation, except for
removing a check within the of_translate_one function in the
drivers/core/of_addr.c file:

+
        ranges = of_get_property(parent, rprop, &rlen);
-       if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
-               debug("no ranges; cannot translate\n");
-               return 1;
-       }
        if (ranges == NULL || rlen == 0) {
                offset = of_read_number(addr, na);
                memset(addr, 0, pna * 4);
debug("empty ranges; 1:1 translation\n");

There are two reasons:
1 The function of_empty_ranges_quirk always returns false, invalidating
  the following if statement in case of null ranges. Therefore one of
  the two checks is useless.

2 The implementation of the of_translate_one function found in the
  common/fdt_support.c file has removed this check while keeping the one
  about the 1:1 translation.

The patch adds a test and modifies a check for the correctness of an
address in the case of enabling translation also for zero size cells.
The added test checks translations of addresses generated by nodes of
a device tree similar to those you can find in the files am33xx.dtsi
and am33xx-clocks.dtsi for which the patch was created.

The patch was also tested on a beaglebone black board. The addresses
generated for the registers of the loaded drivers are those specified
by the AM335x reference manual.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Tested-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoclk: move clk-ti-sci driver to 'ti' directory
Dario Binacchi [Tue, 29 Dec 2020 23:16:20 +0000 (00:16 +0100)]
clk: move clk-ti-sci driver to 'ti' directory

The patch moves the clk-ti-sci.c file to the 'ti' directory along with
all the other TI's drivers, and renames it clk-sci.c.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoarm: dts: am335x: enable prcm_clocks auto binding
Dario Binacchi [Tue, 29 Dec 2020 23:16:19 +0000 (00:16 +0100)]
arm: dts: am335x: enable prcm_clocks auto binding

Adding the 'simple-bus' compatible string to the prcm_clocks node will
allow its automatic binding.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: omap4: add clock manager driver
Dario Binacchi [Tue, 29 Dec 2020 23:16:18 +0000 (00:16 +0100)]
clk: ti: omap4: add clock manager driver

This minimal driver is only used to bind child devices.

For DT binding details see Linux doc:
- Documentation/devicetree/bindings/arm/omap/prcm.txt

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: add support for clkctrl clocks
Dario Binacchi [Tue, 29 Dec 2020 23:06:39 +0000 (00:06 +0100)]
clk: ti: add support for clkctrl clocks

Until now the clkctrl clocks have been enabled/disabled through platform
routines. Thanks to this patch they can be enabled and configured directly
by the probed devices that need to use them.

For DT binding details see Linux doc:
- Documentation/devicetree/bindings/clock/ti-clkctrl.txt

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoti: am33xx: fix do_enable_clocks() to accept NULL parameters
Dario Binacchi [Tue, 29 Dec 2020 23:06:38 +0000 (00:06 +0100)]
ti: am33xx: fix do_enable_clocks() to accept NULL parameters

Up till this commit passing NULL as input parameter was allowed, but not
handled properly. When a NULL parameter was passed to the function a data
abort was raised.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: dts: am335x: include am33xx-u-boot.dtsi
Dario Binacchi [Tue, 29 Dec 2020 23:06:37 +0000 (00:06 +0100)]
arm: dts: am335x: include am33xx-u-boot.dtsi

Include the SoC U-boot DTS in each am335x-<board>-u-boot.dtsi.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: add gate clock driver
Dario Binacchi [Tue, 29 Dec 2020 23:06:36 +0000 (00:06 +0100)]
clk: ti: add gate clock driver

The patch adds support for TI gate clock binding. The code is based on
the drivers/clk/ti/gate.c driver of the Linux kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/gate.txt

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: add divider clock driver
Dario Binacchi [Tue, 29 Dec 2020 23:06:35 +0000 (00:06 +0100)]
clk: ti: add divider clock driver

The patch adds support for TI divider clock binding. The driver uses
routines provided by the common clock framework (ccf).

The code is based on the drivers/clk/ti/divider.c driver of the Linux
kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/divider.txt

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: am33xx: add DPLL clock drivers
Dario Binacchi [Tue, 29 Dec 2020 23:06:34 +0000 (00:06 +0100)]
clk: ti: am33xx: add DPLL clock drivers

The digital phase-locked loop (DPLL) provides all interface clocks and
functional clocks to the processor of the AM33xx device. The AM33xx
device integrates five different DPLLs:
 * Core DPLL
 * Per DPLL
 * LCD DPLL
 * DDR DPLL
 * MPU DPLL

The patch adds support for the compatible strings:
 * "ti,am3-dpll-core-clock"
 * "ti,am3-dpll-no-gate-clock"
 * "ti,am3-dpll-no-gate-j-type-clock"
 * "ti,am3-dpll-x2-clock"

The code is loosely based on the drivers/clk/ti/dpll.c drivers of the
Linux kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/dpll.txt

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoarm: ti: am33xx: add DPLL_EN_FAST_RELOCK_BYPASS macro
Dario Binacchi [Tue, 29 Dec 2020 23:06:33 +0000 (00:06 +0100)]
arm: ti: am33xx: add DPLL_EN_FAST_RELOCK_BYPASS macro

Add missing DPLL_EN_FAST_RELOCK_BYPASS macro. Used to put the DPLL in
idle bypass fast relock mode.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: ti: add mux clock driver
Dario Binacchi [Tue, 29 Dec 2020 23:06:32 +0000 (00:06 +0100)]
clk: ti: add mux clock driver

The driver manages a register-mapped multiplexer with multiple input
clock signals or parents, one of which can be selected as output. It
uses routines provided by the common clock framework (ccf).

The code is based on the drivers/clk/ti/mux.c driver of the Linux
kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/mux.txt

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: add clk_round_rate()
Dario Binacchi [Tue, 29 Dec 2020 23:06:31 +0000 (00:06 +0100)]
clk: add clk_round_rate()

It returns the rate which will be set if you ask clk_set_rate() to set
that rate. It provides a way to query exactly what rate you'll get if
you call clk_set_rate() with that same argument.
So essentially, clk_round_rate() and clk_set_rate() are equivalent
except the former does not modify the clock hardware in any way.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agoarm: dts: sync am33xx with Linux 5.9-rc7
Dario Binacchi [Tue, 29 Dec 2020 23:06:30 +0000 (00:06 +0100)]
arm: dts: sync am33xx with Linux 5.9-rc7

There have been several changes to the am33xx.dtsi, so this patch
re-syncs it with Linux.

Let's add proper interconnect hierarchy for l4 interconnect instances
with the related ti-sysc interconnect module data as documented in
Documentation/devicetree/bindings/bus/ti-sysc.txt of the Linux kernel.
With l4 interconnect hierarchy and ti-sysc interconnect target module
data in place, we can simply move all the related child devices to their
proper location and enable probing using ti-sysc.

The am33xx-clock.dtsi file is the same as that of the Linux kernel,
except for the reg property of the node l4-wkup-clkctrl@0.
As for the am33xx.dtsi file, all the devices with drivers not yet
implemented and those I was able to test with this patch have been moved
to am33xx-l4.dtsi. In case of any regressions, problem devices can be
reverted by moving them back and removing the related interconnect
target module node.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agobus: ti: add minimal sysc interconnect target driver
Dario Binacchi [Tue, 29 Dec 2020 23:06:29 +0000 (00:06 +0100)]
bus: ti: add minimal sysc interconnect target driver

We can handle the sysc interconnect target module in a generic way for
many TI SoCs. Initially let's just enable domain clocks before the
children are probed.

The code is loosely based on the drivers/bus/ti-sysc.c of the Linux
kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/bus/ti-sysc.txt

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agodt-bindings: bus: ti-sysc: resync with Linux 5.9-rc7
Dario Binacchi [Tue, 29 Dec 2020 23:06:28 +0000 (00:06 +0100)]
dt-bindings: bus: ti-sysc: resync with Linux 5.9-rc7

Add support for PRUSS SYSC type:
The PRUSS module has a SYSCFG which is unique. The SYSCFG has two
additional unique fields called STANDBY_INIT and SUB_MWAIT in addition
to regular IDLE_MODE and STANDBY_MODE fields. Add the bindings for this
new sysc type.

Add support for MCAN on dra76x:
The dra76x MCAN generic interconnect module has a its own format for the
bits in the control registers.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoclk: export generic routines
Dario Binacchi [Tue, 29 Dec 2020 23:06:27 +0000 (00:06 +0100)]
clk: export generic routines

Export routines that can be used by other drivers avoiding duplicating
code.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm:pdu001: Use pseudo partition UUID for LINUX kernel boot paramter root
Felix Brack [Fri, 18 Dec 2020 08:03:50 +0000 (09:03 +0100)]
arm:pdu001: Use pseudo partition UUID for LINUX kernel boot paramter root

As more and more LINUX drivers are modified to use asynchronous probing
instead of synchronous probing, relying on device names being equal in
U-Boot and LINUX is not possible anymore. This is also true for block
device names like mmc0, mmc1 ect.
With LINUX kernel commit a1a4891 the probing type for the sdhci-omap
driver has been set to asynchronous mode too (probe_type is now
PROBE_PREFER_ASYNCHRONOUS).
In the case of the PDU001 board this results in the devices mmc0 and
mmc1 being swapped between U-Boot and LINUX. Device mmc0 in U-Boot
becomes mmc1 in LINUX an vice versa. Hence using device name identifiers
with LINUX kernel parameter root does not work anymore.
This patch changes the LINUX kernel boot parameter root to use the
pseudo (since we use MBR not GPT) partition UUID to locate the partition
hosting the root file system.

Signed-off-by: Felix Brack <fb@ltec.ch>
3 years agoboard: ti: k2g: Add support for K2G ICE with 1GHz Silicon
Lokesh Vutla [Thu, 17 Dec 2020 17:28:07 +0000 (22:58 +0530)]
board: ti: k2g: Add support for K2G ICE with 1GHz Silicon

Add board detection support for K2G ICE with FlagChip 1GHz silicon.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
3 years agoarm: dts: k3-j721e: ddr: Update to 0.5.0 version of DDR config tool
Praneeth Bajjuri [Thu, 3 Dec 2020 23:43:47 +0000 (17:43 -0600)]
arm: dts: k3-j721e: ddr: Update to 0.5.0 version of DDR config tool

Update the ddr settings to use the DDR reg config tool rev 0.5.0.
This enables 4266MTs DDR configuration.

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Signed-off-by: Kevin Scholz <k-scholz@ti.com>
3 years agospi: omap3_spi: Fix speed and mode selection
Vignesh Raghavendra [Sun, 29 Nov 2020 07:23:05 +0000 (12:53 +0530)]
spi: omap3_spi: Fix speed and mode selection

McSPI IP provides per CS specific speed and mode selection. Therefore it
is possible to apply these settings only after CS is known. But
set_speed and set_mode can be called without bus being claimed, this
would lead driver to set up wrong CS (or previously used CS).

Fix this by apply set_speed and set_mode only if bus is already claimed.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Tested-by: Miquel Raynal <miquel.raynal@bootlin.com>
3 years agospi: ti_qspi: Fix "spi-max-frequency" error path in ti_qspi_ofdata_to_platdata
Ovidiu Panait [Sat, 28 Nov 2020 08:11:28 +0000 (10:11 +0200)]
spi: ti_qspi: Fix "spi-max-frequency" error path in ti_qspi_ofdata_to_platdata

struct ti_qspi_priv->max_hz is declared as unsigned int, so the following
error path check will always be false, even when "spi-max-frequency"
property is invalid/missing:
  priv->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency", -1);
  if (priv->max_hz < 0) {
    ...
  }

Replace the fdtdec call with dev_read_u32_default() and use 0 as the
default value. Error out if max_hz is zero.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
3 years agogpio: tca642x: fix input subcommand for gpio banks > 0
Tomas Novotny [Wed, 25 Nov 2020 17:42:16 +0000 (18:42 +0100)]
gpio: tca642x: fix input subcommand for gpio banks > 0

The value of input pin for bank > 0 is always 0 for input subcommand.
The reason is that gpio_bank variable is computed only for invert and
output subcommands (it depends on number of arguments). The default
value of zero causes to shift the mask away for banks > 0.

Please note that info subcommand works as expected, because the input
pin values are accessed differently.

Fixes: 61c1775f16ed ("gpio: tca642x: Add the tca642x gpio expander driver")
Cc: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Tomas Novotny <tomas@novotny.cz>
3 years agoconfigs: am65x_evm: Define the maximum file size for DFU
Aswath Govindraju [Tue, 24 Nov 2020 10:29:34 +0000 (15:59 +0530)]
configs: am65x_evm: Define the maximum file size for DFU

In include/dfu.h, if CONFIG_SYS_DFU_MAX_FILE_SIZE is not defined then it is
defined as CONFIG_SYS_DFU_DATA_BUF_SIZE. This is 128 KiB for a53 core and
20 KiB for r5 core. If a larger file is transferred using dfu then it
fails.

CONFIG_SYS_DFU_DATA_BUF_SIZE can not be increased as there is not enough
heap memory to be allocated for the buffer in case of R5 spl.

Fix this by defining CONFIG_SYS_DFU_MAX_FILE_SIZE as the default
CONFIG_SYS_DFU_DATA_BUF_SIZE value.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: am654-base-board-uboot: Add aliases for USB subsystems
Aswath Govindraju [Fri, 20 Nov 2020 15:48:55 +0000 (21:18 +0530)]
arm: dts: am654-base-board-uboot: Add aliases for USB subsystems

The sequence number assigned for USB subsystem in a uclass is dependent on
the order of occurrence in the device tree. If the dr_mode of USB3SS0
controller is varied then the sequence number of USB3SS1 controller also
changes. If aliases are added then sequence numbers are assigned using the
alias number. This makes the sequence number of USB3SS1 controller
independent of USB3SS0 controller's dr_mode.

Therefore, add aliases to fix the sequence number assigned to the USB
subsystems.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoarm: dts: am654-base-board-uboot: Set USB0 dr_mode to host
Aswath Govindraju [Fri, 20 Nov 2020 15:48:54 +0000 (21:18 +0530)]
arm: dts: am654-base-board-uboot: Set USB0 dr_mode to host

USB3SS0 controller is to be used as a host in U-boot. Fix it by changing
the dr_mode to host.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoboard: ti: am65x: Set SERDES0 mux to PCIe to use USB 2.0 interface
Aswath Govindraju [Fri, 20 Nov 2020 15:48:53 +0000 (21:18 +0530)]
board: ti: am65x: Set SERDES0 mux to PCIe to use USB 2.0 interface

It has been observed that setting SERDES0 lane mux to USB prevents USB 2.0
operation on USB0. Setting SERDES0 lane mux to non-USB when USB0 is used in
USB 2.0 only mode solves this issue. However, for USB3.0+2.0 operation this
issue is not present.

Implement this workaround by writing 1 to LANE_FUNC_SEL field in
CTRLMMR_SERDES0_CTRL register.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
3 years agoMerge branch 'next'
Tom Rini [Mon, 11 Jan 2021 18:55:03 +0000 (13:55 -0500)]
Merge branch 'next'

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoPrepare v2021.01
Tom Rini [Mon, 11 Jan 2021 18:11:43 +0000 (13:11 -0500)]
Prepare v2021.01

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoxea: config: Disable CONFIG_SPL_OF_PLATDATA_PARENT on XEA (imx28)
Lukasz Majewski [Sat, 26 Dec 2020 00:09:02 +0000 (01:09 +0100)]
xea: config: Disable CONFIG_SPL_OF_PLATDATA_PARENT on XEA (imx28)

On the XEA board (imx28) one needs in the SPL support for GPIO, MMC and
SPI. Two last ones are necessary for booting the device. The GPIO support
allows deciding which medium will be used. For example the GPIO DTS node
(gpio@0 at imx28.dtsi) has pinctrl parent (pinctrl@80018000) for which we
don't need driver asigned for correct operation.
In the spl/dts/dt-platdata.c the gpio@0 has index 4 and its parent -
pinctrl@80018000 has index 5.

In the bind_drivers_pass() function (at drivers/core/lists.c) call to
device_bind_by_name() for `fsl_imx23_pinctrl` returns -2, which is
expected.

With current setup - when the SPL_OF_PLATDATA_PARENT=y
The gpio@0 node with index 4 is skipped as its parent with 5 is not yet
bound. It cannot be as we don't need and provide the driver for it.
As a result the gpio@0 is never bound and we end up with bricked board in
the SPL stage.

When CONFIG_SPL_OF_PLATDATA_PARENT is NOT set, all entries from
spl/dts/dt-platdata.c are scanned in ascending index order, so gpio@0 is
properly initialized. For `fsl_imx_pinctrl` we simply check 10 times if
the driver for is available (which is not) and exit.

As a result the GPIOs are initialized and can be used in early SPL stage.
This commit fixes XEA regression introduced with e41651fffda7da55f6.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoxea: config: Use CONFIG_PREBOOT from Kconfig
Lukasz Majewski [Sat, 26 Dec 2020 00:09:01 +0000 (01:09 +0100)]
xea: config: Use CONFIG_PREBOOT from Kconfig

The usage of the preboot feature is now controlled via a separate Kconfig
option - namely CONFIG_USE_PREBOOT.
It must be enabled for preboot code executing commands now defined in
CONFIG_PREBOOT (also moved to the Kconfig).

After defining both CONFIG_USE_PREBOOT and CONFIG_PREBOOT in
imx28_xea_defconfig the define of CONFIG_PREBOOT shall be removed from
xea.h as it is redundant.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
3 years agoxea: spl: Disable pull UP for GPIO0_2{35}
Lukasz Majewski [Sat, 26 Dec 2020 00:09:00 +0000 (01:09 +0100)]
xea: spl: Disable pull UP for GPIO0_2{35}

On the imx287 pin GPMI_WRN (GPIO0_25) no PullUP is available that can be
enabled.

To get the same behavior for both boot select pins (i.e. GPIO0_2{35})
disable pull UPs on both.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
3 years agorockchip: pinebook-pro: default to SPI bus 1 for SPI-flash
Hugh Cole-Baker [Sun, 22 Nov 2020 13:03:44 +0000 (13:03 +0000)]
rockchip: pinebook-pro: default to SPI bus 1 for SPI-flash

SPI flash on this machine is located on bus 1, default to using bus 1
for SPI flash and stop aliasing it to bus 0.

Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Fixes: c4cea2bb ("rockchip: Enable building a SPI ROM image on bob")

3 years agoMerge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 6 Jan 2021 12:57:33 +0000 (07:57 -0500)]
Merge tag 'xilinx-for-v2021.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze into next

Xilinx changes for v2021.04

arm64:
- DT updates

microblaze:
- Add support for NOR device support

spi:
- Fix unaligned data write issue

nand:
- Minor code change

xilinx:
- Fru fix in limit calculation
- Fill git repo link for all Xilinx boards

video:
- Add support for seps525 spi display

tools:
- Minor Vitis file support

cmd/common
- Minor code indentation fixes

serial:
- Uartlite debug uart initialization fix

3 years agoMerge tag 'u-boot-stm32-20210106' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Wed, 6 Jan 2021 12:48:19 +0000 (07:48 -0500)]
Merge tag 'u-boot-stm32-20210106' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Fix GPIO hog flags on DHCOM boards

3 years agoARM: dts: stm32: Fix GPIO hog flags on DHCOM DRC02
Marek Vasut [Sat, 2 Jan 2021 16:44:47 +0000 (17:44 +0100)]
ARM: dts: stm32: Fix GPIO hog flags on DHCOM DRC02

The GPIO hog flags are ignored by gpiolib-of.c now, set the flags to 0.
Since GPIO_ACTIVE_HIGH is defined as 0, this change only increases the
correctness of the DT.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Fix GPIO hog flags on DHCOM PicoITX
Marek Vasut [Sat, 2 Jan 2021 16:44:46 +0000 (17:44 +0100)]
ARM: dts: stm32: Fix GPIO hog flags on DHCOM PicoITX

The GPIO hog flags are ignored by gpiolib-of.c now, set the flags to 0.
Due to a change in gpiolib-of.c, setting flags to GPIO_ACTIVE_LOW and
using output-low DT property leads to the GPIO being set high instead.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoMerge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into next
Tom Rini [Wed, 6 Jan 2021 03:34:43 +0000 (22:34 -0500)]
Merge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into next

Driver model: make some udevice fields private
Driver model: Rename U_BOOT_DEVICE et al.
dtoc: Tidy up and add more tests
ns16550 code clean-up
x86 and sandbox minor fixes for of-platdata
dtoc prepration for adding build-time instantiation

3 years agoMerge tag 'v2021.01-rc5' into next
Tom Rini [Tue, 5 Jan 2021 21:20:26 +0000 (16:20 -0500)]
Merge tag 'v2021.01-rc5' into next

Prepare v2021.01-rc5

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'ti-v2021.01-rc5' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Tue, 5 Jan 2021 21:10:33 +0000 (16:10 -0500)]
Merge tag 'ti-v2021.01-rc5' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti

- Fix I2C speed for Nokia RX51

3 years agodtoc: Tidy up src_scan tests
Simon Glass [Tue, 29 Dec 2020 03:35:08 +0000 (20:35 -0700)]
dtoc: Tidy up src_scan tests

Some of these tests don't actually check anything. Add a few more checks
to complete the tests.

Also add a simple scan test that does the basics.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Move src_scan tests to a separate file
Simon Glass [Tue, 29 Dec 2020 03:35:07 +0000 (20:35 -0700)]
dtoc: Move src_scan tests to a separate file

Move the tests related to scanning into their own class, updating them
to avoid using dtb_platdata as a pass-through.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Split source-code scanning to a separate file
Simon Glass [Tue, 29 Dec 2020 03:35:06 +0000 (20:35 -0700)]
dtoc: Split source-code scanning to a separate file

Before expanding the scanning features any more, move this into a separate
file. This will make it easier to maintain in the future. In particular,
it reduces the size of dtb_platdata.py and allows us to add tests
specifically for scanning, without going through that file.

The pieces moved are the Driver class, the scanning code and the various
naming functions, since they mostly depend on the scanning results.

So far there is are no separate tests for src_scan. These will be added
as new functionality appears.

This introduces no functional change.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Drop dm_populate_phandle_data()
Simon Glass [Tue, 29 Dec 2020 03:35:05 +0000 (20:35 -0700)]
dtoc: Drop dm_populate_phandle_data()

This has not been needed since parent information was added and we started
using indicies for references to other drivers instead of pointers. It was
kept around in the expectation that it might be needed later.

However with the latest updates, it doesn't seem likely that we'll need
this in the foreseeable future.

Drop dm_populate_phandle_data() from dtoc and driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Output nodes in order
Simon Glass [Tue, 29 Dec 2020 03:35:04 +0000 (20:35 -0700)]
dtoc: Output nodes in order

Previously we had to worry about nodes being output before those that they
depended on, thus causing build errors.  So the current algorithm is
careful to output nodes in the right order.

We now use a different method for outputting phandles that does not
involve pointers. Also we plan to add a 'declarations' header file to
declare all drivers as 'extern'.

Update the code to drop the dependency checking and output in a simple
loop. This makes the output easier to follow since drivers are in order of
thier indices (0, 1, ...), which is also the order it appears in in the
linker list.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Allow specifying the base directory for tests
Simon Glass [Tue, 29 Dec 2020 03:35:03 +0000 (20:35 -0700)]
dtoc: Allow specifying the base directory for tests

The base directory of U-Boot, where the source is, it currently calculated
from the directory of the dtb_platdata.py script. If this is installed
elsewhere that will not work. Also it is inconvenient for tests.

Add a parameter to allow specifying this base directory.

To test this, pass a temporary directory with some files in it and check
that they are passed to scan_driver().

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Add the method for each command to OutputFile
Simon Glass [Tue, 29 Dec 2020 03:35:02 +0000 (20:35 -0700)]
dtoc: Add the method for each command to OutputFile

Rather than the if/else construct, update OutputFile with the method to
call to process each command. This is easier to maintain as the number of
commands increases.

Rename generate_tables to generate_plat since it better describes what is
being generated ('plat' is the U-Boot name for platform data).

With this, each output method needs to have the same signature. Store the
output structures in a member variable instead of using parameters, to
accomplish this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Rename dt-platdata.c to dt-plat.c
Simon Glass [Tue, 29 Dec 2020 03:35:01 +0000 (20:35 -0700)]
dtoc: Rename dt-platdata.c to dt-plat.c

Use this new name to be consistent with the rest of U-Boot, which talks
about 'plat' for the platform data, which is what this file holds.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Add a header comment to each generated file
Simon Glass [Tue, 29 Dec 2020 03:35:00 +0000 (20:35 -0700)]
dtoc: Add a header comment to each generated file

It is currently fairly obvious what the two generated files are for, but
this will change as more are added. It is helpful for readers to describe
the purpose of each file.

Add a header commment field to OutputFile and use it to generate a comment
at the top of each file.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Run tests using test_util
Simon Glass [Tue, 29 Dec 2020 03:34:59 +0000 (20:34 -0700)]
dtoc: Run tests using test_util

Use the standard function for running tests and reported results. This
allows the tests to run in parallel, which is a significant speed-up on
most machines (e.g. 4.5 seconds -> 1.5s on mine).

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoconcurrencytest: Fix Python3 warning
Simon Glass [Tue, 29 Dec 2020 03:34:58 +0000 (20:34 -0700)]
concurrencytest: Fix Python3 warning

This gives a warning in some situations:

  File "tools/dtoc/../concurrencytest/concurrencytest.py", line 95,
       in do_fork
    stream = os.fdopen(c2pread, 'rb', 1)
  File "/usr/lib/python3.8/os.py", line 1023, in fdopen
    return io.open(fd, *args, **kwargs)
RuntimeWarning: line buffering (buffering=1) isn't supported in binary
    mode, the default buffer size will be used

Fix this by dropping the line-buffer parameter.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Rename U_BOOT_DRIVER_ALIAS to DM_DRIVER_ALIAS
Simon Glass [Tue, 29 Dec 2020 03:34:57 +0000 (20:34 -0700)]
dm: Rename U_BOOT_DRIVER_ALIAS to DM_DRIVER_ALIAS

We use the U_BOOT_ prefix (i.e. U_BOOT_DRIVER) to declare a driver but
in every other case we just use DM_. Update the alias macros to use the
DM_ prefix.

We could perhaps rename U_BOOT_DRIVER() to DM_DRIVER(), but this macro
is widely used and there is at least some benefit to indicating it us a
U-Boot driver, particularly for code ported from Linux. So for now, let's
keep that name.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()
Simon Glass [Tue, 29 Dec 2020 03:34:56 +0000 (20:34 -0700)]
dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Rename DM_GET_DEVICE() to DM_DRVINFO_GET()
Simon Glass [Tue, 29 Dec 2020 03:34:55 +0000 (20:34 -0700)]
dm: Rename DM_GET_DEVICE() to DM_DRVINFO_GET()

This does not get a device (struct udevice *) but a struct driver_info *
so the name is confusing.

Rename it accordingly. Since we plan to have several various of these
macros, put GET at the end instead of the middle, so it is easier to spot
the related macros.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO()
Simon Glass [Tue, 29 Dec 2020 03:34:54 +0000 (20:34 -0700)]
dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO()

The current macro is a misnomer since it does not declare a device
directly. Instead, it declares driver_info record which U-Boot uses at
runtime to create a device.

The distinction seems somewhat minor most of the time, but is becomes
quite confusing when we actually want to declare a device, with
of-platdata. We are left trying to distinguish between a device which
isn't actually device, and a device that is (perhaps an 'instance'?)

It seems better to rename this macro to describe what it actually is. The
macros is not widely used, since boards should use devicetree to declare
devices.

Rename it to U_BOOT_DRVINFO(), which indicates clearly that this is
declaring a new driver_info record, not a device.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Invoke dtoc only once
Simon Glass [Tue, 29 Dec 2020 03:34:53 +0000 (20:34 -0700)]
Makefile: Invoke dtoc only once

Update the Makefile to run dtoc only once, generating all required files.
This saves time since there is a lot of processing in each invocation of
dtoc.

We already have a variable for the object files to build, so use that
instead of repeating the same filenames. Add a C version of this also,
for the same reason.

This makes it easier to add new C files (generated by dtoc) to the build
later, as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Add an 'all' command
Simon Glass [Tue, 29 Dec 2020 03:34:52 +0000 (20:34 -0700)]
dtoc: Add an 'all' command

With upcoming changes, dtoc will output several files for different
of-platdata components.

Add a way to output all ava!ilable files at once ('all'), to the
appropriate directories, without needing to specify each one invidually.

This puts the commands in alphabetical order, so update the tests
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Allow outputing to multiple files
Simon Glass [Tue, 29 Dec 2020 03:34:51 +0000 (20:34 -0700)]
dtoc: Allow outputing to multiple files

Implement the 'output directory' feature, allowing dtoc to write the
output files separately to the supplied directories. This allows us to
handle the struct and platdata output in one run of dtoc.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Allow providing a directory to write files to
Simon Glass [Tue, 29 Dec 2020 03:34:50 +0000 (20:34 -0700)]
dtoc: Allow providing a directory to write files to

At present dtoc writes only a single file on each invocation. U-Boot
writes the two files it needs by separate invocations of dtoc. Since dtoc
now scans all U-Boot driver source, this is fairly slow (about 1 second
per file).

It would be better if dtoc could write all the files at once.

In preparation for this, add a way to specify an output directory for the
files.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Test the stdout output
Simon Glass [Tue, 29 Dec 2020 03:34:49 +0000 (20:34 -0700)]
dtoc: Test the stdout output

Normally dtoc outputs to a file but it also offers a way to write output
to stdout. At present the test for that does not actually check that the
output is correct. Add this to the test.

This uses a member variable to hold the expected text, so it can be used
in muitiple places.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Use None to mean stdout
Simon Glass [Tue, 29 Dec 2020 03:34:48 +0000 (20:34 -0700)]
dtoc: Use None to mean stdout

At present dtoc uses '-' internally to mean that output should go to
stdout. This is not necessary and None is more convenient. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Tidy up pylint warnings in test
Simon Glass [Tue, 29 Dec 2020 03:34:47 +0000 (20:34 -0700)]
dtoc: Tidy up pylint warnings in test

Tidy up this file to reduce the number of pylint warnings.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add logging when lists_bind_fdt() fails
Simon Glass [Sat, 19 Dec 2020 17:40:18 +0000 (10:40 -0700)]
dm: core: Add logging when lists_bind_fdt() fails

It is useful to see the error code when this fails. Add logging for this
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Allow the uclass list to move
Simon Glass [Sat, 19 Dec 2020 17:40:17 +0000 (10:40 -0700)]
dm: core: Allow the uclass list to move

At present the uclass list head is in global_data. This is convenient
but with the new of-platdata we need the list head to be declared by
the generated code.

Change this over to be a pointer. Provide a 'static' version in
global_data to retain the current behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Split out scanning code to dm_scan()
Simon Glass [Sat, 19 Dec 2020 17:40:16 +0000 (10:40 -0700)]
dm: core: Split out scanning code to dm_scan()

Move the code related to scanning for devices to bind, into a new
function. This will make it easier to skip this step with the new
of-platdata improvements.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename device node to indicate it is private
Simon Glass [Sat, 19 Dec 2020 17:40:15 +0000 (10:40 -0700)]
dm: core: Rename device node to indicate it is private

To avoid having people accidentally access this member, add a trailing
underscore. Also remove it when of-platdata is enabled, since it is not
used.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Access device ofnode through functions
Simon Glass [Sat, 19 Dec 2020 17:40:14 +0000 (10:40 -0700)]
dm: core: Access device ofnode through functions

At present ofnode is present in the device even if it is never used. With
of-platdata this field is not used, so can be removed. In preparation for
this, change the access to go through inline functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Use dev_has_ofnode() instead of dev_of_valid()
Simon Glass [Sat, 19 Dec 2020 17:40:13 +0000 (10:40 -0700)]
dm: core: Use dev_has_ofnode() instead of dev_of_valid()

We have two functions which do the same thing. Standardise on
dev_has_ofnode() since there is no such thing as an 'invalid' ofnode in
normal operation: it is either null or missing.

Also move the functions into one place.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agodm: core: Rename dev_has_of_node() to dev_has_ofnode()
Simon Glass [Sat, 19 Dec 2020 17:40:12 +0000 (10:40 -0700)]
dm: core: Rename dev_has_of_node() to dev_has_ofnode()

We use 'ofnode' rather than 'of_node' in U-Boot. Rename this function to
fit.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename device flags to indicate it is private
Simon Glass [Sat, 19 Dec 2020 17:40:11 +0000 (10:40 -0700)]
dm: core: Rename device flags to indicate it is private

To avoid having people accidentally access this member, add a trailing
underscore.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Access device flags through functions
Simon Glass [Sat, 19 Dec 2020 17:40:10 +0000 (10:40 -0700)]
dm: core: Access device flags through functions

At present flags are stored as part of the device. In preparation for
storing them separately, change the access to go through inline functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Rename sqq to seq_
Simon Glass [Sat, 19 Dec 2020 17:40:09 +0000 (10:40 -0700)]
dm: core: Rename sqq to seq_

Now that the sequence-numbering migration is complete, rename this member
back to seq_, adding an underscore to indicate it is internal to driver
model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agodm: core: Split out alloc code into a new function
Simon Glass [Sat, 19 Dec 2020 17:40:08 +0000 (10:40 -0700)]
dm: core: Split out alloc code into a new function

Add a new function to handle the allocation of private/platform data for
a device. This will make it easier to skip this feature when using the new
of-platdata.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Drop rtc from SPL
Simon Glass [Sat, 19 Dec 2020 17:40:07 +0000 (10:40 -0700)]
x86: Drop rtc from SPL

The RTC is not currently used in SPL. Drop it so that it does not take up
space.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Remove unwanted nodes from SPL/TPL
Simon Glass [Sat, 19 Dec 2020 17:40:06 +0000 (10:40 -0700)]
x86: coral: Remove unwanted nodes from SPL/TPL

Some devices are not needed in SPL/TPL. For TPL this causes the
generation of unnecessary of-platadata structs. Make some adjustments to
fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Adjust how the UART gets its platform data
Simon Glass [Sat, 19 Dec 2020 17:40:05 +0000 (10:40 -0700)]
x86: apl: Adjust how the UART gets its platform data

At present this driver calls malloc() to start a new platform data
structure, fills it in and tells driver model to use it.

We want to avoid malloc, particularly with the new version of of-platdata.
Create a new struct which encompasses both the dtd struct and the ns16550
one, to avoid this. Unfortunately we must copy the data into the right
place for the ns16550 driver. Add some comments about this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: sysreset: Move priv/plat structs to headers
Simon Glass [Sat, 19 Dec 2020 17:40:04 +0000 (10:40 -0700)]
x86: sysreset: Move priv/plat structs to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them and add the dtd struct too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agodm: core: Move priv/plat structs for simple_bus to headers
Simon Glass [Sat, 19 Dec 2020 17:40:03 +0000 (10:40 -0700)]
dm: core: Move priv/plat structs for simple_bus to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Use struct spi_nor instead of struct spi_flash
Simon Glass [Sat, 19 Dec 2020 17:40:02 +0000 (10:40 -0700)]
x86: apl: Use struct spi_nor instead of struct spi_flash

This construct effectively uses struct spi_nor due to a #define in
spi-nor.h so we may as well use that struct here. This allows dtoc to
parse it correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospi: Tweak a few strange SPI NOR features for of-platdata
Simon Glass [Sat, 19 Dec 2020 17:40:01 +0000 (10:40 -0700)]
spi: Tweak a few strange SPI NOR features for of-platdata

The #define of one struct to another has been around for a while. It
confuses dtoc and makes it think that struct spi_flash does not exist.

Make a few changes to improve things while we wait for migration to be
completed:

- Move the 'struct spi_flash' to column 1 so dtoc scans it
- Remove the #define when compiling dt-platdata.c
- Update the strange mtd_get/set_of_node() functions
- Use struct spi_nor in the drivers, so dtoc sees the correct struct

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospi: Tidy up get/set of device node
Simon Glass [Sat, 19 Dec 2020 17:40:00 +0000 (10:40 -0700)]
spi: Tidy up get/set of device node

This code is a bit odd in that it only reads and updates the livetree
version of the device ofnode. This means it won't work with flattree.
Update the code to work as it was presumably intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: spl: Move priv/plat structs to headers
Simon Glass [Sat, 19 Dec 2020 17:39:59 +0000 (10:39 -0700)]
x86: spl: Move priv/plat structs to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Move priv/plat structs for intel_common to headers
Simon Glass [Sat, 19 Dec 2020 17:39:58 +0000 (10:39 -0700)]
x86: Move priv/plat structs for intel_common to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Move priv/plat structs to headers
Simon Glass [Sat, 19 Dec 2020 17:39:57 +0000 (10:39 -0700)]
x86: apl: Move priv/plat structs to headers

With the new of-platdata, these need to be available to dt_platdata.c
so must be in header files. Move them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Update dts files to reduce SPL size
Simon Glass [Sat, 19 Dec 2020 17:39:56 +0000 (10:39 -0700)]
sandbox: Update dts files to reduce SPL size

At present there are require a few devices in the devicetree which are
not actually used in SPL. This will cause problems with the new
of-platdata, since it will try to instantiate devices which are not
compiled into U-Boot.

Update the devicetree to remove these devices from SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Add a compatible string for spltest
Simon Glass [Sat, 19 Dec 2020 17:39:55 +0000 (10:39 -0700)]
sandbox: Add a compatible string for spltest

At present this driver does not have a compatible string. For it to be
used with the coming of-platadata, it must have one. Update it
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: i2c: Move priv into a header file
Simon Glass [Sat, 19 Dec 2020 17:39:54 +0000 (10:39 -0700)]
sandbox: i2c: Move priv into a header file

Move this struct into a header file so that dtoc can include it in its
dt-platdata.c file.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: serial: Move priv into a header file
Simon Glass [Sat, 19 Dec 2020 17:39:53 +0000 (10:39 -0700)]
sandbox: serial: Move priv into a header file

Move this struct into a header file so that dtoc can include it in its
dt-platdata.c file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agosandbox: remove ram buffer file when U-Boot is loaded by SPL
Patrick Delaunay [Fri, 20 Nov 2020 08:48:33 +0000 (09:48 +0100)]
sandbox: remove ram buffer file when U-Boot is loaded by SPL

Update management of "--rm_memory" sandbox's option and force
this option when U-Boot is loaded by SPL in os_spl_to_uboot()
and remove the ram file after reading in main() as described
in option help message: "Remove memory file after reading".

This patch avoids that the file "/tmp/u-boot.mem.XXXXXX" [created in
os_jump_to_file() when U-Boot is loaded by SPL] is never deleted
because state_uninit() is not called after U-Boot execution
(CtrlC or with running pytest for example).

This issue is reproduced by
> build-sandbox_spl/spl/u-boot-spl
  and CtrlC in U-Bot console

> make qcheck

One temp file is created after each SPL and U-Boot execution
(7 tims in qcheck after test_handoff.py, test_ofplatdata.py,
 test_spl.py execution).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agox86: Fix header guard in asm/pmu.h
Simon Glass [Wed, 23 Dec 2020 15:11:33 +0000 (08:11 -0700)]
x86: Fix header guard in asm/pmu.h

This has the wrong name. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: tpl: Remove unwanted devicetree string
Simon Glass [Wed, 23 Dec 2020 15:11:32 +0000 (08:11 -0700)]
x86: tpl: Remove unwanted devicetree string

Update this driver to use of_match_ptr().

This reduces the TPL binary size by about 32 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: pinctrl: Drop unlikely error messages from TPL
Simon Glass [Wed, 23 Dec 2020 15:11:31 +0000 (08:11 -0700)]
x86: pinctrl: Drop unlikely error messages from TPL

These errors are only really for development purposes. Drop them to reduce
the size of TPL. The error numbers are still reported.

This reduces the TPL binary size on coral by about 160 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Reduce size for TPL
Simon Glass [Wed, 23 Dec 2020 15:11:30 +0000 (08:11 -0700)]
x86: apl: Reduce size for TPL

Update various drivers to use of_match_ptr() and to avoid including debug
strings in TPL. Omit the WiFi driver entirely, since it is not used in
TPL.

This reduces the TPL binary size by about 608 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Update hostbridge to remove unwanted TPL code
Simon Glass [Wed, 23 Dec 2020 15:11:29 +0000 (08:11 -0700)]
x86: apl: Update hostbridge to remove unwanted TPL code

At present several strings from this file appear in the TPL binary. Add
preprocessor checks to drop them.

This reduces the TPL binary size by about 128 bytes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: coral: Move fsp-m settings to a subnode
Simon Glass [Wed, 23 Dec 2020 15:11:28 +0000 (08:11 -0700)]
x86: coral: Move fsp-m settings to a subnode

At present these settings are in the node for host-bridge and so are
visible in TPL as well as SPL. But they are only used for SPL.

Move them to a subnode so that TPL does not included them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: Move call64 into its own section
Simon Glass [Wed, 23 Dec 2020 15:11:27 +0000 (08:11 -0700)]
x86: Move call64 into its own section

When this code is not used (e.g. by TPL) we want it to be excluded from
the image. Put it in its own section so that this happens.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agox86: apl: Use const for driver operations
Simon Glass [Wed, 23 Dec 2020 15:11:26 +0000 (08:11 -0700)]
x86: apl: Use const for driver operations

Update these declarations to const to ensure that the data ends up in the
rodata section.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Convert _drivers to a dict
Simon Glass [Wed, 23 Dec 2020 15:11:23 +0000 (08:11 -0700)]
dtoc: Convert _drivers to a dict

At present this member holds a simple list of driver names. Update it to
be a dict of DriverInfo, with the name being the key. This will allow more
information to be added about each driver, in future patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Output the struct values in a separate function
Simon Glass [Wed, 23 Dec 2020 15:11:22 +0000 (08:11 -0700)]
dtoc: Output the struct values in a separate function

Reduce the length of output_node() futher by moving the struct-output
functionality into a two separate functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodtoc: Output the device in a separate function
Simon Glass [Wed, 23 Dec 2020 15:11:21 +0000 (08:11 -0700)]
dtoc: Output the device in a separate function

Reduce the length of output_node() by moving the device-output
functionality into a separate function.

Signed-off-by: Simon Glass <sjg@chromium.org>