platform/kernel/u-boot.git
3 years agocommon: board_r: Drop arch-specific ifdefs around initr_trap
Ovidiu Panait [Sat, 28 Nov 2020 08:43:18 +0000 (10:43 +0200)]
common: board_r: Drop arch-specific ifdefs around initr_trap

In order to remove the arch-specific ifdefs around initr_trap, introduce
arch_initr_trap weak initcall. Implementations for ppc/m68k/mips have
been moved to arch/<arch>/lib/traps.c

Default implementation is a nop stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 years agocommon: board_r: Drop initr_bbmii wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:17 +0000 (10:43 +0200)]
common: board_r: Drop initr_bbmii wrapper

Add a return value to bb_miiphy_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_api wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:16 +0000 (10:43 +0200)]
common: board_r: Drop initr_api wrapper

Add a return value to api_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_jumptable wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:15 +0000 (10:43 +0200)]
common: board_r: Drop initr_jumptable wrapper

Add a return value to jumptable_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_xen wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:14 +0000 (10:43 +0200)]
common: board_r: Drop initr_xen wrapper

Add a return value to xen_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_noncached wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:13 +0000 (10:43 +0200)]
common: board_r: Drop initr_noncached wrapper

Add a return value to noncached_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_pci wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:12 +0000 (10:43 +0200)]
common: board_r: Drop initr_pci wrapper

Add a return value to pci_init and use it directly in the post-relocation
init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_pci_ep wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:11 +0000 (10:43 +0200)]
common: board_r: Drop initr_pci_ep wrapper

Add a return value to pci_ep_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_post_backlog wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:10 +0000 (10:43 +0200)]
common: board_r: Drop initr_post_backlog wrapper

Add a return value to post_output_backlog and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_secondary_cpu wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:09 +0000 (10:43 +0200)]
common: board_r: Drop initr_secondary_cpu wrapper

Add a return value to cpu_secondary_init_r and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_console_record wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:08 +0000 (10:43 +0200)]
common: board_r: Drop initr_console_record wrapper

Drop initr_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt
Ovidiu Panait [Sat, 28 Nov 2020 08:43:07 +0000 (10:43 +0200)]
common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_f: Move setup_machine code to setup_bdinfo
Ovidiu Panait [Sat, 28 Nov 2020 08:43:06 +0000 (10:43 +0200)]
common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm
Ovidiu Panait [Sat, 28 Nov 2020 08:43:05 +0000 (10:43 +0200)]
common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_f: Drop initf_console_record wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:04 +0000 (10:43 +0200)]
common: board_f: Drop initf_console_record wrapper

Drop initf_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F
Ovidiu Panait [Sat, 28 Nov 2020 08:43:03 +0000 (10:43 +0200)]
common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
 defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: call vsnprintf only when it is needed to emit trace
Patrick Delaunay [Fri, 27 Nov 2020 10:20:59 +0000 (11:20 +0100)]
log: call vsnprintf only when it is needed to emit trace

Reduce the log overhead when the traces are filtered,
by moving the vsnprintf call from _log() to log_dispatch().

This patch avoids the printf treatment when LOG features is
activated, but trace is filtered, for example when
MAX_LOG_LEVEL=8 and LOG_DEFAULT_LEVEL=6.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agotest: log: add test for console output of dropped messages
Patrick Delaunay [Fri, 27 Nov 2020 10:20:58 +0000 (11:20 +0100)]
test: log: add test for console output of dropped messages

Add a new test to check the content of the dropped messages
sent to console puts function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: allow to record console output before ready
Patrick Delaunay [Fri, 27 Nov 2020 10:20:57 +0000 (11:20 +0100)]
console: allow to record console output before ready

Allow to record the console output before before U-Boot
has a console ready.

This patch allows to test the console output in sandbox test
based on console record.

It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY
are 2 independent flags.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: remove duplicated test on gd value
Patrick Delaunay [Fri, 27 Nov 2020 10:20:56 +0000 (11:20 +0100)]
console: remove duplicated test on gd value

Reorder test on gd value and remove the duplicated test (!gd)
in putc and puts function.

This patch is a preliminary step for rework of this function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: add test for dropped trace before log_init
Patrick Delaunay [Fri, 27 Nov 2020 10:20:55 +0000 (11:20 +0100)]
test: add test for dropped trace before log_init

Add test for dropped trace before log_init, displayed by debug uart.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: use console puts to output trace before LOG init
Patrick Delaunay [Fri, 27 Nov 2020 10:20:54 +0000 (11:20 +0100)]
log: use console puts to output trace before LOG init

Use the console puts functions to output the traces before
the log initialization (when CONFIG_LOG is not activated).

This patch allows to display the first U-Boot traces
(with macro debug) when CONFIG_DEBUG_UART is activated
and not only drop them.

For example for traces in board_f.c requested by the macro debug,
when LOG_DEBUG is defined and CONFIG_LOG is activated.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agotest: log: add test for dropped messages
Patrick Delaunay [Fri, 27 Nov 2020 10:20:53 +0000 (11:20 +0100)]
test: log: add test for dropped messages

Add a new test to check the dropped messages when LOG is not ready
with log_drop_count and the result of _log().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: don't build the trace buffer when log is not ready
Patrick Delaunay [Fri, 27 Nov 2020 10:20:52 +0000 (11:20 +0100)]
log: don't build the trace buffer when log is not ready

Update _log function to drop any traces when log is yet initialized:
vsnprintf is no more executed in this case.

This patch allows to reduce the cost for the dropped early debug trace.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agotest: add LOGL_FORCE_DEBUG flags support in log tests
Patrick Delaunay [Fri, 27 Nov 2020 10:20:51 +0000 (11:20 +0100)]
test: add LOGL_FORCE_DEBUG flags support in log tests

Add a check of the _log function with LOGL_FORCE_DEBUG flags,
used to force the trace display.

The trace should be displayed for all the level when flags
have LOGL_FORCE_DEBUG bit is set, for any filter.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: fix build errors generated by last merges
Dario Binacchi [Fri, 15 Jan 2021 08:10:26 +0000 (09:10 +0100)]
dm: fix build errors generated by last merges

Something was wrong in the merge process into the mainline.
Some added patches access driver structure fields and functions that
have been modified by previous patches.
The patch renames:
 - dev_get_platdata to dev_get_plat
 - dev_get_uclass_platdata to dev_get_uclass_plat
 - ofdata_to_platdata to of_to_plat
 - plat_data_alloc_size to plat_auto
 - priv_auto_alloc_size to priv_auto
 - video_uc_platdata to video_uc_plat

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoMerge branch '2021.04-rc' of https://github.com/lftan/u-boot
Tom Rini [Fri, 15 Jan 2021 12:23:50 +0000 (07:23 -0500)]
Merge branch '2021.04-rc' of https://github.com/lftan/u-boot

- Add ATF flow for SoC64 devices
- Update socfpgaimage to support print header and update padding flow

3 years agotools: socfpgaimage: update padding flow
Ley Foon Tan [Wed, 13 Jan 2021 10:53:05 +0000 (18:53 +0800)]
tools: socfpgaimage: update padding flow

The existing socfpgaimage always pads the image to the maximum size of
OCRAM size. This will break in the encryption flow where it expects the
image to be un-padded. The encryption tool will do the encryption for
the whole image and append the signature key at end of the image.
The signature key will append to beyond the size of OCRAM if the image
is padded with the maximum size before encryption.

Move the padding step from socfpgaimage to Makefile and pads with objcopy
command.

socfpgaimage will pad the image with 16 bytes aligned (including CRC word),
this is a requirement in encryption flow.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agoconfigs: socfpga: Add CONFIG_SPL_PAD_TO
Ley Foon Tan [Tue, 22 Dec 2020 01:53:25 +0000 (09:53 +0800)]
configs: socfpga: Add CONFIG_SPL_PAD_TO

Add CONFIG_SPL_PAD_TO for Gen5 and Arria 10. CONFIG_SPL_PAD_TO is set to
size of OCRAM.

This is preparation for image padding change in socfpgaimage.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agotools: socfpgaimage: Print image header information
Ley Foon Tan [Fri, 11 Dec 2020 06:46:47 +0000 (14:46 +0800)]
tools: socfpgaimage: Print image header information

Print image header information if the header is verified.

Example output from mkimage "-l" option:

$ ./tools/mkimage -l spl/u-boot-spl.sfp
Image Type      : Cyclone V / Arria V SoC Image
Validation word : 0x31305341
Version         : 0x00000000
Flags           : 0x00000000
Program length  : 0x00003a59
Header checksum : 0x00000188

$ ./tools/mkimage -l spl/u-boot-spl.sfp
Image Type      : Arria 10 SoC Image
Validation word : 0x31305341
Version         : 0x00000001
Flags           : 0x00000000
Header length   : 0x00000014
Program length  : 0x000138e0
Program entry   : 0x00000014
Header checksum : 0x00000237

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agoconfigs: socfpga: Add defconfig for Agilex and Stratix 10 with ATF support
Chee Hong Ang [Thu, 24 Dec 2020 10:21:13 +0000 (18:21 +0800)]
configs: socfpga: Add defconfig for Agilex and Stratix 10 with ATF support

Booting Agilex and Stratix 10 with ATF support.

SPL now loads ATF (BL31), U-Boot proper and DTB from FIT
image. The new boot flow with ATF support is as follow:

SPL -> ATF (BL31) -> U-Boot proper -> OS (Linux)

U-Boot proper now starts at 0x200000 (CONFIG_SYS_TEXT_BASE).
ATF will occupy the address range starting from 0x1000.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: soc64: Enable FIT image generation using binman
Siew Chin Lim [Thu, 24 Dec 2020 10:21:12 +0000 (18:21 +0800)]
arm: socfpga: soc64: Enable FIT image generation using binman

Enable BINMAN when using Arm-Trusted-Firmware (ATF) to
generate FIT images.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: dts: soc64: Add binman node of FIT image with ATF support
Siew Chin Lim [Thu, 24 Dec 2020 10:21:11 +0000 (18:21 +0800)]
arm: socfpga: dts: soc64: Add binman node of FIT image with ATF support

Add binman node to device tree to generate the FIT image for u-boot
(u-boot.itb) and OS kernel (kernel.itb).

u-boot.itb contains arm trusted firmware (ATF), u-boot proper and
u-boot device tree for ATF u-boot flow.

kernel.itb contains Linux Image and Linux device tree.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: soc64: Skip handoff data access in SSBL
Chee Hong Ang [Thu, 24 Dec 2020 10:21:10 +0000 (18:21 +0800)]
arm: socfpga: soc64: Skip handoff data access in SSBL

SPL already setup the Clock Manager with the handoff data
from OCRAM. When the Clock Manager's driver get probed again
in SSBL, it shall skip the handoff data access in OCRAM.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: SSBL shall not setup stack on OCRAM
Chee Hong Ang [Thu, 24 Dec 2020 10:21:09 +0000 (18:21 +0800)]
arm: socfpga: soc64: SSBL shall not setup stack on OCRAM

Since SSBL is running in DRAM, it shall setup the stack in DRAM
instead of OCRAM which is occupied by SPL and handoff data.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: mailbox: Add 'SYSTEM_RESET' PSCI support to mbox_reset_cold()
Chee Hong Ang [Thu, 24 Dec 2020 10:21:08 +0000 (18:21 +0800)]
arm: socfpga: mailbox: Add 'SYSTEM_RESET' PSCI support to mbox_reset_cold()

mbox_reset_cold() will invoke ATF's PSCI service when running in
non-secure mode (EL2).

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: Add ATF support for FPGA reconfig driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:07 +0000 (18:21 +0800)]
arm: socfpga: soc64: Add ATF support for FPGA reconfig driver

In non-secure mode (EL2), FPGA reconfiguration driver calls the
SMC/PSCI services provided by ATF to configure the FPGA.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: Add ATF support for Reset Manager driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:06 +0000 (18:21 +0800)]
arm: socfpga: soc64: Add ATF support for Reset Manager driver

In non-secure mode (EL2), Reset Manager driver calls the
SMC/PSCI service provided by ATF to enable/disable the
SOCFPGA bridges.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agonet: designware: socfpga: Add ATF support for MAC driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:05 +0000 (18:21 +0800)]
net: designware: socfpga: Add ATF support for MAC driver

In non-secure mode (EL2), MAC driver calls the SMC/PSCI services
provided by ATF to setup the PHY interface.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agommc: dwmmc: socfpga: Add ATF support for MMC driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:04 +0000 (18:21 +0800)]
mmc: dwmmc: socfpga: Add ATF support for MMC driver

In non-secure mode (EL2), MMC driver calls the SMC/PSCI services
provided by ATF to set SDMMC's DRVSEL and SMPLSEL.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agommc: dwmmc: Change designware MMC 'clksel' callback function to return status
Siew Chin Lim [Thu, 24 Dec 2020 10:21:03 +0000 (18:21 +0800)]
mmc: dwmmc: Change designware MMC 'clksel' callback function to return status

Change 'clksel' callback function to allow the code to return a
status.

This patch is a preparation for enabling Arm-Trusted-Firmware (ATF)
in Intel SoC FPGA. This patch does not change functionality.

When using Arm-Trusted-Firmware (ATF) in Intel SoC FPGA, the MMC clock
related register is secure register which is required to be written
via SMC/PCSI call. It is possible that U-Boot fail to write the
register if there is unexpected error between U-Boot and ATF.
As a result, there maybe signal integrity on MMC connection due to
clock. So, the code should reports error to user when 'clksel' fail.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: Add secure register access helper functions for SoC 64bits
Siew Chin Lim [Thu, 24 Dec 2020 10:21:02 +0000 (18:21 +0800)]
arm: socfpga: Add secure register access helper functions for SoC 64bits

These secure register access functions allow U-Boot proper running
at EL2 (non-secure) to access System Manager's secure registers
by calling the ATF's PSCI runtime services (EL3/secure).

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agoarm: socfpga: soc64: Define SMC function identifiers for PSCI SiP services
Chee Hong Ang [Thu, 24 Dec 2020 10:21:01 +0000 (18:21 +0800)]
arm: socfpga: soc64: Define SMC function identifiers for PSCI SiP services

This header file defines the Secure Monitor Call (SMC) message
protocol for ATF (BL31) PSCI runtime services. It includes all
the PSCI SiP function identifiers for the secure runtime services
provided by ATF. The secure runtime services include System Manager's
registers access, 2nd phase bitstream FPGA reconfiguration, Remote
System Update (RSU) and etc.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: soc64: Add SMC helper function for Intel SOCFPGA (64bits)
Chee Hong Ang [Thu, 24 Dec 2020 10:21:00 +0000 (18:21 +0800)]
arm: socfpga: soc64: Add SMC helper function for Intel SOCFPGA (64bits)

invoke_smc() allow U-Boot proper running in non-secure mode (EL2)
to invoke SMC call to ATF's PSCI runtime services such as
System Manager's registers access, 2nd phase bitstream FPGA
reconfiguration, Remote System Update (RSU) and etc.

smc_send_mailbox() is a send mailbox command helper function which invokes
the ATF's PSCI runtime service (function ID: INTEL_SIP_SMC_MBOX_SEND_CMD)
to send mailbox messages to Secure Device Manager (SDM).

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: Disable "spin-table" method for booting Linux
Chee Hong Ang [Thu, 24 Dec 2020 10:20:59 +0000 (18:20 +0800)]
arm: socfpga: Disable "spin-table" method for booting Linux

Standard PSCI function "CPU_ON" provided by ATF is now used
by Linux kernel to bring up the secondary CPUs to enable SMP
booting in Linux on SoC 64bits platform.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: Override 'lowlevel_init' to support ATF
Chee Hong Ang [Thu, 24 Dec 2020 10:20:58 +0000 (18:20 +0800)]
arm: socfpga: soc64: Override 'lowlevel_init' to support ATF

Override 'lowlevel_init' to make sure secondary CPUs trapped
in ATF instead of SPL. After ATF is initialized, it will signal
the secondary CPUs to jump from SPL to ATF waiting to be 'activated'
by Linux OS via PSCI call.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: Load FIT image with ATF support
Chee Hong Ang [Thu, 24 Dec 2020 10:20:57 +0000 (18:20 +0800)]
arm: socfpga: soc64: Load FIT image with ATF support

Instead of loading u-boot proper image (u-boot.img), SPL
now loads FIT image (u-boot.itb) which includes u-boot
proper, ATF and u-boot proper's DTB.

For OS, u-boot now loads FIT images (kernel.itb) which
includes Linux Image and Linux's DTB.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: Add function for checking description from FIT image
Chee Hong Ang [Thu, 24 Dec 2020 10:20:56 +0000 (18:20 +0800)]
arm: socfpga: Add function for checking description from FIT image

Add board_fit_config_name_match() for matching board name with
device tree files in FIT image. This will ensure correct DTB
file is loaded for different board type. Currently, we are not
supporting multiple device tree files in FIT image therefore this
function basically do nothing for now.
Users are allowed to override this 'weak' function in their
specific board implementation.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoMerge tag 'efi-2021-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 14 Jan 2021 13:50:23 +0000 (08:50 -0500)]
Merge tag 'efi-2021-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

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

In the UEFI sub-system:

* implement non-blocking file services
* print boot device and file path in helloworld.efi
* improve detection of boot device
* correct argument handling in efivar.py
* implement EFI_DT_FIXUP_PROTOCOL

Bug fixes:

* adjust conitrace command for low baud rates
* check that FIT images are valid FDTs

3 years agoMerge tag 'u-boot-stm32-20210113' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Wed, 13 Jan 2021 20:00:53 +0000 (15:00 -0500)]
Merge tag 'u-boot-stm32-20210113' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Enable logging features for stm32mp15 boards
- Update MAINTAINERS emails for STI and STM32
- Activate OF_LIVE for ST stm32mp15 boards
- Switch to MCO2 for PHY 50 MHz clock for DHCOM boards
- Correction in stm32prog command on uart: always flush DFU on start command
- Update USB-C power detection algorithm on DK boards

3 years agoMerge tag 'u-boot-amlogic-20210112' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 12 Jan 2021 20:46:52 +0000 (15:46 -0500)]
Merge tag 'u-boot-amlogic-20210112' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- sync amlogic GX & AXG DT to Linux 5.10
- Add new MESON_EE driver support for GXBB & AXG
- Add support for Libretech-CC v2, Wetek Core2, Beelink GT-King/Pro boards
- add driver for TDO tl070wsh30 panel driver
- meson: isolate loading of socinfo
- Add soc_rev to environment
- Enable G12A support for saradc
- Add correct mmcdev on VIM3(L) & Odroid-N2(C4)
- Read MAC from fuses for VIM3 & VIM3L boards

3 years agoMAINTAINERS: Update STi and STM32 maintainers emails in remaining files
Patrice Chotard [Mon, 4 Jan 2021 16:00:56 +0000 (17:00 +0100)]
MAINTAINERS: Update STi and STM32 maintainers emails in remaining files

A previous series already update STMicroelectronics emails maintainers
but some files have been omitted (Makefile, .dts, .dtsi and .rst files).
Update Patrick and my email address with the one dedicated to upstream
activities.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: stm32mp: stm32prog: always flush DFU on start command for uart
Patrick Delaunay [Fri, 11 Dec 2020 12:36:18 +0000 (13:36 +0100)]
arm: stm32mp: stm32prog: always flush DFU on start command for uart

Remove the test on data->dfu_seq, because dfu_seq=0 not only when
the DFU is not started (mask with 0xffff). This flush is mandatory
as the final treatment, common with USB, is done in DFU callback.

This patch avoids issue if the received length is a multiple of
the DFU packet.

For example if size of bootfs partition is egual to 0x4000000,
data->dfu_seq=0 at the end of the partition, the flush it not
requested and the phase is not increased in the callback.
U-Boot continue to request the bootfs in the next GetPhase command.

Fixes: 468f0508b58b ("stm32mp: stm32prog: add serial link support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoconfigs: stm32mp1: activate OF_LIVE for DT live support
Patrick Delaunay [Fri, 11 Dec 2020 14:32:30 +0000 (15:32 +0100)]
configs: stm32mp1: activate OF_LIVE for DT live support

Activate the live DT to reduce the DT parsing time.

For example the boot time is reduced by 200ms on STM32MP157C-EV1 board
for stm32mp15_basic_defconfig (boot with SPL) or
stm32mp15_trusted_defconfig (boot with TF-A).

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoARM: dts: stm32: Switch to MCO2 for PHY 50 MHz clock
Marek Vasut [Tue, 1 Dec 2020 10:34:48 +0000 (11:34 +0100)]
ARM: dts: stm32: Switch to MCO2 for PHY 50 MHz clock

The LAN8710i PHY currently uses 50 MHz clock direct from PLL4P.
To permit PLL4P to run at faster frequency, use MCO2 as a divider.
The PLL4P runs at 100 MHz, supplies MCO2 which divides it by 2 to
50MHz, and supplies the PHY with 50 MHz via pin PG2. The feedback
clock are fed back in via pin PA1.

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>
Change-Id: Ia9bf7119785d49b633a3ae761c3dc4a30b92628a

3 years agoARM: stm32: Use firmware property instead of loadables
Michal Simek [Mon, 5 Oct 2020 09:37:00 +0000 (11:37 +0200)]
ARM: stm32: Use firmware property instead of loadables

There shouldn't be a need to use loadables propertyn because u-boot can be
pointed by firmware property. This change should also speedup boot process
because loadables property is list of strings which code is going through.
On the other hand firmware can just point to one image.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoboard: stm32pm1: update USB-C power detection algorithm on DK boards
Patrice Chotard [Fri, 16 Oct 2020 07:28:59 +0000 (09:28 +0200)]
board: stm32pm1: update USB-C power detection algorithm on DK boards

USB-C power supply which are Power Delivery compliant (USB-PD) are able
to provide different voltage/current (for example 5V/3A 9V/3A 12V/2.25A...)

In this case, the power supply need to negotiate the voltage/current to
use with the device using CC1/CC2 USB-C signals.

If this negotiation occurs during ADC measurement (done also on CC1/CC2
USB-C signals) some ADC acquisition can be corrupted which cause wrong
power supply current detection.

To avoid this, the power supply current detection algorithm is updated
as following:
  - perform an ADC measurement, if a 3A current is detected, continue the
    boot process.
  - else, wait 20ms (max tPDDebounce duration) to ensure that USB-PD
    negotiation is done and perform another ADC measurement.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoconfigs: stm32mp15: enable LOG features
Patrick Delaunay [Fri, 6 Nov 2020 18:02:01 +0000 (19:02 +0100)]
configs: stm32mp15: enable LOG features

Activate the logging features in SPL and U-Boot
(CONFIG_LOG and CONFIG_SPL_LOG) and the command 'log' with
CONFIG_CMD_LOG.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoboard: st: common: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:02:00 +0000 (19:02 +0100)]
board: st: common: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoboard: st: stm32mp1: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:59 +0000 (19:01 +0100)]
board: st: stm32mp1: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agovideo: stm32_dsi: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:58 +0000 (19:01 +0100)]
video: stm32_dsi: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agovideo: stm32_ltdc: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:57 +0000 (19:01 +0100)]
video: stm32_ltdc: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoserial: stm32: define LOG_CATEGORY
Patrick Delaunay [Fri, 6 Nov 2020 18:01:56 +0000 (19:01 +0100)]
serial: stm32: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agomemory: stm32-fmc2: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:55 +0000 (19:01 +0100)]
memory: stm32-fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agomtd: stm32_fmc2: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:54 +0000 (19:01 +0100)]
mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agospi: stm32_qspi: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:53 +0000 (19:01 +0100)]
spi: stm32_qspi: migrate trace to dev and log macro

Change debug/pr_* to log_* or dev_* macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agospi: stm32_spi: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:52 +0000 (19:01 +0100)]
spi: stm32_spi: migrate trace to dev and log macro

Change debug/pr_debug to log_debug or dev_dbg macro and
define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agophy: stm32-usbphyc: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:51 +0000 (19:01 +0100)]
phy: stm32-usbphyc: migrate trace to dev and log macro

Change pr_debug to log_debug or dev_dbg macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoi2c: stm32f7_i2c: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:50 +0000 (19:01 +0100)]
i2c: stm32f7_i2c: migrate trace to dev and log macro

Change debug to dev_dbg macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agomailbox: stm32-ipcc: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:49 +0000 (19:01 +0100)]
mailbox: stm32-ipcc: migrate trace to dev and log macro

Change debug to dev_dbg macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoreset: stm32-reset: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:48 +0000 (19:01 +0100)]
reset: stm32-reset: migrate trace to dev and log macro

Change debug to dev_dbg macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoclk: clk_stm32h7: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:47 +0000 (19:01 +0100)]
clk: clk_stm32h7: migrate trace to dev and log macro

Change debug and pr_ macro to dev macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoclk: clk_stm32f: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:46 +0000 (19:01 +0100)]
clk: clk_stm32f: migrate trace to dev and log macro

Change debug and pr_ macro to dev macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoclk: stm32mp1: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:45 +0000 (19:01 +0100)]
clk: stm32mp1: migrate trace to dev and log macro

Change debug and pr_ macro to dev macro and define LOG_CATEGORY.

Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agomisc: rcc: keep the rcc device name for subnode
Patrick Delaunay [Fri, 6 Nov 2020 18:01:44 +0000 (19:01 +0100)]
misc: rcc: keep the rcc device name for subnode

Update the name associated with the RCC drivers to avoid
duplicated name with the driver name.

With this patch the traces displayed with log macro provide a
correct device name.

The rcc device name before the patch is:

 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
 simple_bus    0  [ + ]   simple_bus            |-- soc
 (...)
 nop           0  [ + ]   stm32-rcc             |   |-- rcc@50000000
 clk           0  [ + ]   stm32mp1_clk          |   |   |-- stm32mp1_clk
 reset         0  [ + ]   stm32_rcc_reset       |   |   `-- stm32_rcc_reset

And they become:
 (...)
 nop           0  [ + ]   stm32-rcc             |   |-- rcc@50000000
 clk           0  [ + ]   stm32mp1_clk          |   |   |-- rcc@50000000
 reset         0  [ + ]   stm32_rcc_reset       |   |   `-- rcc@50000000

The traces is correct:
stm32mp1_clk rcc@stm32mp1_clk: .....
=>
stm32mp1_clk rcc@50000000: .....

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agomisc: rcc: migrate trace to dev macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:43 +0000 (19:01 +0100)]
misc: rcc: migrate trace to dev macro

Change debug and pr_err to dev macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agopower: regulator: stm32-verfbuf: define LOG_CATEGORY
Patrick Delaunay [Fri, 6 Nov 2020 18:01:42 +0000 (19:01 +0100)]
power: regulator: stm32-verfbuf: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agowatchdog: stm32mp: migrate trace to dev macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:41 +0000 (19:01 +0100)]
watchdog: stm32mp: migrate trace to dev macro

Change debug and pr_err to dev macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agortc: stm32: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:40 +0000 (19:01 +0100)]
rtc: stm32: migrate trace to log macro

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agohwspinlock: stm32: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:39 +0000 (19:01 +0100)]
hwspinlock: stm32: migrate trace to log macro

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agotimer: stm32: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:38 +0000 (19:01 +0100)]
timer: stm32: migrate trace to log macro

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agommc: stm32_sdmmc2: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:37 +0000 (19:01 +0100)]
mmc: stm32_sdmmc2: migrate trace to dev and log macro

Define LOG_CATEGORY, use dev_ macro when it is possible.
Remove the "%s:" __func__  header as it is managed by dev macro
(dev->name is displayed) or log macro (CONFIG_LOGF_FUNC).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoram: stm32mp1: migrate trace to dev or log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:36 +0000 (19:01 +0100)]
ram: stm32mp1: migrate trace to dev or log macro

Define LOG_CATEGORY, use dev_ macro when it is possible
and migrate other trace to log_ macro.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoram: stm32: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:35 +0000 (19:01 +0100)]
ram: stm32: migrate trace to log macro

Define LOG_CATEGORY, change debug to dev_dbg and remove "%s:" __func__
header as it is managed by dev macro (dev->name is displayed)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoremoproc: stm32: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:34 +0000 (19:01 +0100)]
remoproc: stm32: migrate trace to log macro

Define LOG_CATEGORY and remove unneeded pr_fmt macro with the dev
macro as dev->name is displayed and CONFIG_LOGF_FUNC can be
activated for log macro.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agogpio: stm32-gpio: migrate trace to dev and log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:33 +0000 (19:01 +0100)]
gpio: stm32-gpio: migrate trace to dev and log macro

Change debug to dev_dbg macro and define LOG_CATEGORY.

Remove dev->name as it is already displayed by dev macro.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agopinctrl: stm32: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:32 +0000 (19:01 +0100)]
pinctrl: stm32: migrate trace to log macro

Change debug to log macro and define LOG_CATEGORY.

Remove "%s:" with __func__ as it is managed by log macro
(CONFIG_LOGF_FUNC)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoarm: stm32mp: bsec: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:31 +0000 (19:01 +0100)]
arm: stm32mp: bsec: migrate trace to log macro

Define LOG_CATEGORY, change pr_debug to dev_dbg and remove "bsec:"
header as it is managed by log macro (dev->name is displayed)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoarm: stm32mp: migrate cmd_stm32prog to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:30 +0000 (19:01 +0100)]
arm: stm32mp: migrate cmd_stm32prog to log macro

Change debug and pr_ macro to log macro.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoarm: stm32mp: migrate trace to log macro
Patrick Delaunay [Fri, 6 Nov 2020 18:01:29 +0000 (19:01 +0100)]
arm: stm32mp: migrate trace to log macro

Change debug and pr_ macro to log macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoefi_selftest: dtbdump support EFI_DT_FIXUP_PROTOCOL
Heinrich Schuchardt [Sun, 13 Dec 2020 18:13:57 +0000 (19:13 +0100)]
efi_selftest: dtbdump support EFI_DT_FIXUP_PROTOCOL

The dtbdump.efi binary can already be used to dump the configuration table
with the device-tree to a file.

With this patch a device-tree file can be loaded. The EFI_DT_FIXUP_PROTOCOL
is called to

* apply U-Boot's fix-ups
* let U-Boot make memory reservations as required by the device-tree
* install the new device-tree as configuration table

In a next step this configuration table can be dumped.

A dtbdump.efi session would look like:

    DTB Dump
    ========

    => load test.dtb
    device-tree installed
    => save fixed-up.dtb
    fixed-up.dtb written
    => exit

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: implement EFI_DT_FIXUP_PROTOCOL
Heinrich Schuchardt [Sun, 13 Dec 2020 09:30:24 +0000 (10:30 +0100)]
efi_loader: implement EFI_DT_FIXUP_PROTOCOL

A boot manager like GRUB can use the protocol to

* apply U-Boot's fix-ups to the a device-tree
* let U-Boot make memory reservations according to the device-tree
* install the device-tree as a configuration table

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocmd: conitrace: increase wait for next key
Heinrich Schuchardt [Sat, 26 Dec 2020 23:12:28 +0000 (00:12 +0100)]
cmd: conitrace: increase wait for next key

At 9600 baud or less a 1 ms wait is too short to detect the end of an
escape sequence.

Increase the wait duration to 10 ms which will work down to 1200 baud.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: remove outdated TODO in efi_memory.c
Heinrich Schuchardt [Tue, 5 Jan 2021 07:22:51 +0000 (08:22 +0100)]
efi_loader: remove outdated TODO in efi_memory.c

In efi_mem_sort() adjacent memory regions of same type are coalesced.
Remove the remark "Merging of adjacent free regions is missing".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: typedef efi_string_t text output protocol
Heinrich Schuchardt [Tue, 5 Jan 2021 06:50:09 +0000 (07:50 +0100)]
efi_loader: typedef efi_string_t text output protocol

We do not want to use typedefs in U-Boot.

Do not use efi_string_t in the EFI_TEXT_OUTPUT_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: move efi_(u)intn_t to efi.h
Heinrich Schuchardt [Tue, 5 Jan 2021 06:52:48 +0000 (07:52 +0100)]
efi_loader: move efi_(u)intn_t to efi.h

Move efi_intn_t and efi_uintn_t to include/efi.h to allow usage without
efi_api.h

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: setting boot device
Heinrich Schuchardt [Tue, 12 Jan 2021 11:46:24 +0000 (12:46 +0100)]
efi_loader: setting boot device

Up to now the bootefi command used the last file loaded to determine the
boot partition. This has led to errors when the fdt had been loaded from
another partition after the EFI binary.

Before setting the boot device from a loaded file check if it is a PE-COFF
image or a FIT image.

For a PE-COFF image remember address and size, boot device and path.

For a FIT image remember boot device and path.

If the PE-COFF image is overwritten by loading another file, forget it.

Do not allow to start an image via bootefi which is not the last loaded
PE-COFF image.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoimage-fit: fit_check_format check for valid FDT
Heinrich Schuchardt [Wed, 13 Jan 2021 01:09:12 +0000 (02:09 +0100)]
image-fit: fit_check_format check for valid FDT

fit_check_format() must check that the buffer contains a flattened device
tree before calling any device tree library functions.

Failure to do may cause segmentation faults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: carve out efi_check_pe()
Heinrich Schuchardt [Tue, 12 Jan 2021 11:40:32 +0000 (12:40 +0100)]
efi_loader: carve out efi_check_pe()

Carve out a function to check that a buffer contains a PE-COFF image.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: print boot device and file path in helloworld
Heinrich Schuchardt [Tue, 12 Jan 2021 11:40:11 +0000 (12:40 +0100)]
efi_loader: print boot device and file path in helloworld

Let helloworld.efi print the device path of the boot device and the file
path as provided by the loaded image protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>