platform/kernel/u-boot.git
4 years agophy: add support for backplane kr mode
Florinel Iordache [Mon, 16 Mar 2020 13:35:59 +0000 (15:35 +0200)]
phy: add support for backplane kr mode

Add generic support for backplane kr modes currently available:
10gbase-kr, 40gbase-kr4. Remove platform generic fixups
(armv8/layerscape and powerpc) for ethernet interfaces specified
in device tree as supported backplane modes.

Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1028a: define esdhc_status_fixup
Yinbo Zhu [Tue, 14 Apr 2020 09:24:48 +0000 (17:24 +0800)]
armv8: ls1028a: define esdhc_status_fixup

This patch is to define esdhc_status_fixup function for ls1028a to disable
SDHC1/SDHC2 status in device tree node if not selected.

Signed-off-by: Yinbo Zhu <yinbo.zhu@nxp.com>
Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoboard: fsl: lx2160a: unused variable gic_lpi_base
Heinrich Schuchardt [Sat, 11 Apr 2020 08:57:09 +0000 (10:57 +0200)]
board: fsl: lx2160a: unused variable gic_lpi_base

If the board is configured without CONFIG_GIC_V3_ITS, an error occurs:

board/freescale/lx2160a/lx2160a.c: In function ‘ft_board_setup’:
board/freescale/lx2160a/lx2160a.c:673:6: error: unused variable
‘gic_lpi_base’ [-Werror=unused-variable]
  673 |  u64 gic_lpi_base;
      |      ^~~~~~~~~~~~

Let's define the variable as __maybe_unused.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1012afrwy: fix board name
Biwen Li [Tue, 24 Mar 2020 03:19:01 +0000 (11:19 +0800)]
configs: ls1012afrwy: fix board name

Fix board name for ls1012afrwy

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agonet: fm: fix build error when not using nand
Francois Gervais [Wed, 8 Apr 2020 13:48:12 +0000 (09:48 -0400)]
net: fm: fix build error when not using nand

If CONFIG_CMD_NAND is disabled, get_nand_dev_by_index() is not
accessible.

This fix allows the build to succeed in this case.

Signed-off-by: Francois Gervais <fgervais@distech-controls.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoMerge tag 'arc-fixes-for-2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Thu, 16 Apr 2020 21:14:44 +0000 (17:14 -0400)]
Merge tag 'arc-fixes-for-2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-arc

This is pretty minor set of changes mostly touching HSDK board:

 * Enable on-chip reset controller on HSDK
 * Add possibility to turn-on & off L2$ on more
   recent ARC HS processors.
 * AXI tunnel clock calculation on HSDK

4 years agoMerge tag 'efi-2020-07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 16 Apr 2020 20:41:40 +0000 (16:41 -0400)]
Merge tag 'efi-2020-07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-07-rc1

This pull request

* provides an implementation of UEFI secure booting
* fixes a problem with the rsa_mod_exp driver which stops some boards
  from booting when CONFIG_RSA is enabled which is needed for UEFI
  secure booting
* enables the EFI_RNG_PROTOCOL if DM_RNG is enabled
* fixes some function comments

4 years agoARC: HSDK: CGU: fix tunnel clock calculation
Eugeniy Paltsev [Thu, 16 Apr 2020 19:35:11 +0000 (22:35 +0300)]
ARC: HSDK: CGU: fix tunnel clock calculation

We set wrong tunnel PLL frequency when we request 125MHz tunnel clock.
Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK: Enable on-chip reset controller
Eugeniy Paltsev [Wed, 11 Mar 2020 12:37:23 +0000 (15:37 +0300)]
ARC: HSDK: Enable on-chip reset controller

As the driver of on-chip reset controller became available
we are ready to enable it.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: CACHE: mark IOC helper functions as inlined_cachefunc
Eugeniy Paltsev [Wed, 11 Mar 2020 12:00:44 +0000 (15:00 +0300)]
ARC: CACHE: mark IOC helper functions as inlined_cachefunc

Force inlining of IOC related functions used in other cache
functions. This is preventive change.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: CACHE: add support for SL$ disable
Eugeniy Paltsev [Wed, 11 Mar 2020 12:00:43 +0000 (15:00 +0300)]
ARC: CACHE: add support for SL$ disable

Since version 3.0 ARC HS supports SL$ (L2 system level cache)
disable. So add support for SL$ disable/enable to code.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoMerge tag 'dm-pull-10apr20-take2' of git://git.denx.de/u-boot-dm
Tom Rini [Thu, 16 Apr 2020 17:45:03 +0000 (13:45 -0400)]
Merge tag 'dm-pull-10apr20-take2' of git://git.denx.de/u-boot-dm

Functions for reading indexed values from device tree
Enhancements to 'dm' command
Log test enhancements and syslog driver
DM change to read parent ofdata before children
Minor fixes

4 years agodm: core: Read parent ofdata before children
Simon Glass [Sun, 5 Apr 2020 21:38:19 +0000 (15:38 -0600)]
dm: core: Read parent ofdata before children

At present a device can read its ofdata before its parent has done the
same. This can cause problems in the case where the parent has a 'ranges'
property, thus affecting the operation of dev_read_addr(), for example.

We already probe parent devices before children so it does not seem to be
a large step to do the same with ofdata.

Make the change and update the documentation in this area.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Ley Foon Tan <ley.foon.tan@intel.com>
4 years agotest: fdtdec: test fdtdec_set_carveout()
Laurentiu Tudor [Fri, 3 Apr 2020 10:43:04 +0000 (13:43 +0300)]
test: fdtdec: test fdtdec_set_carveout()

Add a new test for fdtdec_set_carveout().

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Drop blank line at EFO:
Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agofdtdec: support multiple phandles in memory carveout
Laurentiu Tudor [Fri, 3 Apr 2020 10:43:03 +0000 (13:43 +0300)]
fdtdec: support multiple phandles in memory carveout

fdtdec_set_carveout() is limited to only one phandle. Fix this
limitation by adding support for multiple phandles.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: remove the duplicated function dm_ofnode_pre_reloc
Patrick Delaunay [Fri, 3 Apr 2020 09:39:18 +0000 (11:39 +0200)]
dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: refactor functions reading an u32 from dt
Dario Binacchi [Sun, 29 Mar 2020 16:04:42 +0000 (18:04 +0200)]
dm: core: refactor functions reading an u32 from dt

Now reading a 32 bit value from a device-tree property can be expressed
as reading the first element of an array with a single value.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: support reading a single indexed u32 value
Dario Binacchi [Sun, 29 Mar 2020 16:04:41 +0000 (18:04 +0200)]
dm: core: support reading a single indexed u32 value

The patch adds helper functions to allow reading a single indexed u32
value from a device-tree property containing multiple u32 values, that
is an array of integers.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: test: add test case for dev_read_u64 function
Dario Binacchi [Sun, 29 Mar 2020 16:04:40 +0000 (18:04 +0200)]
dm: test: add test case for dev_read_u64 function

Add test case to cover dev_read_u64 and dev_read_u64_default functions.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a way to skip powering down power domains
Simon Glass [Sat, 28 Mar 2020 20:03:48 +0000 (14:03 -0600)]
dm: core: Add a way to skip powering down power domains

When removing a device the power domains it uses are generally powered
off. But when we are trying to unbind all devices (e.g. for running tests)
we don't want to probe a device in the 'remove' path.

Add a new flag to skip this power-down step.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add logging on unbind failure
Simon Glass [Sat, 28 Mar 2020 20:03:47 +0000 (14:03 -0600)]
dm: core: Add logging on unbind failure

This failure path is tricky to debug since it continues after failure and
there are a lot of error paths. Add logging to help.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agofdt: Fix 'system' command
Tom Warren [Thu, 26 Mar 2020 22:20:44 +0000 (15:20 -0700)]
fdt: Fix 'system' command

'fdt systemsetup' wasn't working, due to the fact that the 'set' command
was being parsed in do_fdt() by only testing for the leading 's' instead
of "se", which kept the "sys" test further down from executing. Changed
to test for "se" instead, now 'fdt systemsetup' works (to test the
ft_system_setup proc w/o having to boot a kernel).

Signed-off-by: Tom Warren <twarren@nvidia.com>
4 years agosandbox: enable CMD_BOOTEFI_HELLO and CMD_EFIDEBUG
Heinrich Schuchardt [Sat, 14 Mar 2020 11:27:02 +0000 (12:27 +0100)]
sandbox: enable CMD_BOOTEFI_HELLO and CMD_EFIDEBUG

'bootefi hello' is used in one of the Python tests.

efidebug can be used to verify the correct initialization of the UEFI
sub-system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromum.org>
4 years agosandbox: implement ft_board_setup()
Heinrich Schuchardt [Sat, 14 Mar 2020 11:13:40 +0000 (12:13 +0100)]
sandbox: implement ft_board_setup()

Currently we are not able to test reservations created by ft_board_setup().

Implement ft_board_setup() to create an arbitrary reservation and enable
OF_BOARD_SETUP.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromum.org>
4 years agosandbox: add reserved-memory node in device tree
Heinrich Schuchardt [Sat, 14 Mar 2020 11:13:39 +0000 (12:13 +0100)]
sandbox: add reserved-memory node in device tree

For testing the handling of memory reservations create a reserved-memory
node in sandbox.dts and sandbox64.dts.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromum.org>
4 years agopatman: Apply the cc limit to the cover letter also
Simon Glass [Fri, 28 Feb 2020 01:49:23 +0000 (18:49 -0700)]
patman: Apply the cc limit to the cover letter also

Quite often on a series that has clean-up patches, the individual patches
may fit within the cc limit but the cover letter does not. Apply the same
limit to the cover letter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
4 years agodoc: driver-model: there is no UCLASS_ETHERNET
Heinrich Schuchardt [Wed, 26 Feb 2020 19:18:54 +0000 (20:18 +0100)]
doc: driver-model: there is no UCLASS_ETHERNET

%s/UCLASS_ETHERNET/UCLASS_ETH/g

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoconfigs: sandbox: enable LOG_SYSLOG
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:20 +0000 (21:48 +0100)]
configs: sandbox: enable LOG_SYSLOG

For testing purposes enable the syslog logging driver.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: log: test syslog logging driver
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:19 +0000 (21:48 +0100)]
test: log: test syslog logging driver

Provide unit tests for the syslog logging driver.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: log functions with CONFIG_LOG=n
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:18 +0000 (21:48 +0100)]
test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: output for CONFIG_LOG=n
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:17 +0000 (21:48 +0100)]
log: output for CONFIG_LOG=n

If CONFIG_LOG=n, we should still output errors, warnings, notices, infos,
and for DEBUG=1 also debug messages.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: syslog driver
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:16 +0000 (21:48 +0100)]
log: syslog driver

Provide a log driver that broadcasts RFC 3164 messages to syslog servers.
rsyslog is one implementation of such a server.

The messages are sent to the local broadcast address 255.255.255.255 on
port 514.

The environment variable log_hostname can be used to provide the HOSTNAME
field for the messages. The optional TIMESTAMP field of RFC 3164 is not
provided.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: correct CONFIG_LOG_TEST prerequisites
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:15 +0000 (21:48 +0100)]
log: correct CONFIG_LOG_TEST prerequisites

An error

undefined reference to `do_log_test'

occurs for CONFIG_CMD_LOG=y, CONFIG_LOG_TEST=y, CONGIG_UNIT_TEST=n

Make CONFIG_UNIT_TEST a prerequisite.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Move "/chosen" and "/firmware" node scan
Patrick Delaunay [Tue, 18 Feb 2020 14:43:46 +0000 (15:43 +0100)]
dm: core: Move "/chosen" and "/firmware" node scan

Use the new function dm_scan_fdt_ofnode_path() to scan all the nodes
which aren't devices themselves but may contain some:
- "/chosen"
- "/clocks"
- "/firmware"

The patch removes the strcmp call in recursive function dm_scan_fdt_live()
and also corrects a conflict with the 2 applied patches in
the commit 1712ca21924b ("dm: core: Scan /firmware node by default")
and in the commit 747558d01457 ("dm: fdt: scan for devices under
/firmware too"): the subnodes of "/firmware" (optee for example)
are bound 2 times.

For example the dm tree command result on STM32MP1 is:

STM32MP> dm tree
 Class     Index  Probed  Driver                Name
 -----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
 firmware      0  [   ]   psci                  |-- psci
 sysreset      0  [   ]   psci-sysreset         |   `-- psci-sysreset
 simple_bus    0  [ + ]   generic_simple_bus    |-- soc
...
 tee           0  [ + ]   optee                 |-- optee
...
 tee           1  [   ]   optee                 `-- optee

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: remove redundant assignment
Heinrich Schuchardt [Sat, 15 Feb 2020 20:46:04 +0000 (21:46 +0100)]
dm: core: remove redundant assignment

Variable count is initialized at the start of every round of the while
loop and it is not used after the while loop. So there is no need to
initialize it beforehand.

Identified by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: remove redundant if statement
Heinrich Schuchardt [Sat, 15 Feb 2020 20:38:48 +0000 (21:38 +0100)]
dm: core: remove redundant if statement

The value of parent is not changed in the first if statement. So we can
merge the two if statements depending on parent.

Indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: also restore terminal settings when killed by SIGINT
Rasmus Villemoes [Fri, 14 Feb 2020 10:58:37 +0000 (10:58 +0000)]
sandbox: also restore terminal settings when killed by SIGINT

Hitting Ctrl-C is a documented way to exit the sandbox, but it is not
actually equivalent to the reset command. The latter, since it follows
normal process exit, takes care to reset terminal settings and
restoring the O_NONBLOCK behaviour of stdin (and, in a terminal, that
is usually the same file description as stdout and stderr, i.e. some
/dev/pts/NN).

Failure to restore (remove) O_NONBLOCK from stdout/stderr can cause
very surprising and hard to debug problems back in the terminal. For
example, I had "make -j8" consistently failing without much
information about just exactly what went wrong, but sometimes I did
get a "echo: write error". I was at first afraid my disk was getting
bad, but then a simple "dmesg" _also_ failed with write error - so it
was writing to the terminal that was buggered. And both "make -j8" and
dmesg in another terminal window worked just fine.

So install a SIGINT handler so that if the chosen terminal
mode (cooked or raw-with-sigs) means Ctrl-C sends a SIGINT, we will
still call os_fd_restore(), then reraise the signal and die as usual
from SIGINT.

Before:

$ grep flags /proc/$$/fdinfo/1
flags:  0102002
$ ./u-boot
# hit Ctrl-C
$ grep flags /proc/$$/fdinfo/1
flags:  0106002

After:

$ grep flags /proc/$$/fdinfo/1
flags:  0102002
$ ./u-boot
# hit Ctrl-C
$ grep flags /proc/$$/fdinfo/1
flags:  0102002

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Update PCI nodes in dts files
Tom Rini [Tue, 11 Feb 2020 17:41:23 +0000 (12:41 -0500)]
sandbox: Update PCI nodes in dts files

The way the PCI nodes are written today causes a number of warnings if
we stop disabling some of the warnings we pass to DTC.  As these
warnings aren't disabled in current Linux Kernel builds, we should aim
to not disable them here either, so rewrite these slightly.  Update the
driver model doc as well.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agosandbox: p2sb: Silence compiler warning
Simon Glass [Sat, 8 Feb 2020 14:53:10 +0000 (07:53 -0700)]
sandbox: p2sb: Silence compiler warning

Some compilers produce a warning about 'child' being used before init.
Silence this by setting to NULL at the start.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoserial: Set baudrate on boot
Sean Anderson [Sun, 2 Feb 2020 18:15:17 +0000 (13:15 -0500)]
serial: Set baudrate on boot

Currently, the baud rate is never set on boot. This works ok when a previous
bootloader has configured the baudrate properly, or when the baudrate is set to
a reasonable default in the serial driver's probe(). However, when this is not
the case, we could be using a different baud rate than what was configured.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Thu, 16 Apr 2020 12:56:37 +0000 (08:56 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Provide serial base clock speed via getinfo() for ACPI SPCR
- Initial ACPI support from DM core by leveraging existing ACPI support
  in x86

4 years agotest: Add hexdump.h to the unit test header
Simon Glass [Wed, 8 Apr 2020 22:57:40 +0000 (16:57 -0600)]
test: Add hexdump.h to the unit test header

Since ut_asserteq_mem() uses bin2hex() we should include this header in
ut.h to avoid errors. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agoacpi: Add support for DMAR
Simon Glass [Wed, 8 Apr 2020 22:57:39 +0000 (16:57 -0600)]
acpi: Add support for DMAR

The DMA Remapping Reporting (DMAR) table contains information about DMA
remapping.

Add a version simple version of this table with only the minimum fields
filled out. i.e. no entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agoacpi: Add a central location for table version numbers
Simon Glass [Wed, 8 Apr 2020 22:57:38 +0000 (16:57 -0600)]
acpi: Add a central location for table version numbers

Each ACPI table has its own version number. Add the version numbers in a
single function so we can keep them consistent and easily see what
versions are supported.

Start a new acpi_table file in a generic directory to house this function.
We can move things over to this file from x86 as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoacpi: Add an __ACPI__ preprocessor symbol
Simon Glass [Wed, 8 Apr 2020 22:57:37 +0000 (16:57 -0600)]
acpi: Add an __ACPI__ preprocessor symbol

The ASL compiler cannot handle C structures and the like so needs some
sort of header guard around these.

We already have an __ASSEMBLY__ #define but it seems best to create a new
one for ACPI since the rules may be different.

Add the check to a few files that ACPI always includes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agox86: Move acpi_table header to main include/ directory
Simon Glass [Wed, 8 Apr 2020 22:57:36 +0000 (16:57 -0600)]
x86: Move acpi_table header to main include/ directory

This file is potentially useful to other architectures saddled with ACPI
so move most of its contents to a common location.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agox86: Move acpi_s3.h to include/acpi/
Simon Glass [Wed, 8 Apr 2020 22:57:35 +0000 (16:57 -0600)]
x86: Move acpi_s3.h to include/acpi/

This header relates to ACPI and we are about to add some more ACPI
headers. Move this one into a new directory so they are together.

The header inclusion in pci_rom.c is not specific to x86 anymore, so drop
the #ifdef CONFIG_X86.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoacpi: Add a simple sandbox test
Simon Glass [Wed, 8 Apr 2020 22:57:34 +0000 (16:57 -0600)]
acpi: Add a simple sandbox test

Add a sandbox test for the basic ACPI functionality we have so far.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agodts: Add a binding for hid-over-i2c
Simon Glass [Wed, 8 Apr 2020 22:57:32 +0000 (16:57 -0600)]
dts: Add a binding for hid-over-i2c

Add this binding from Linux v5.4.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core: Add basic ACPI support
Simon Glass [Thu, 9 Apr 2020 16:27:38 +0000 (10:27 -0600)]
dm: core: Add basic ACPI support

ACPI (Advanced Configuration and Power Interface) is a standard for
specifying information about a platform. It is a little like device
tree but the bindings are part of the specification and it supports an
interpreted bytecode language.

Driver model does not use ACPI for U-Boot's configuration, but it is
convenient to have it support generation of ACPI tables for passing to
Linux, etc.

As a starting point, add an optional set of ACPI operations to each
device. Initially only a single operation is available, to obtain the
ACPI name for the device. More operations are added later.

Enable ACPI for sandbox to ensure build coverage and so that we can add
tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
4 years agox86: apl: Add Global NVS table header
Simon Glass [Wed, 8 Apr 2020 22:57:30 +0000 (16:57 -0600)]
x86: apl: Add Global NVS table header

Add the C version of this header. It includes a few Chrome OS bits which
are disabled for a normal build.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolgang.wallner@br-automation.com>
4 years agopci: Adjust dm_pci_read_bar32() to return errors correctly
Simon Glass [Thu, 9 Apr 2020 16:27:36 +0000 (10:27 -0600)]
pci: Adjust dm_pci_read_bar32() to return errors correctly

At present if reading a BAR returns 0xffffffff then the value is masked
and a different value is returned. This makes it harder to detect the
problem when debugging.

Update the function to avoid masking in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
4 years agox86: apl: Move p2sb ofdata reading to the correct method
Simon Glass [Wed, 8 Apr 2020 22:57:28 +0000 (16:57 -0600)]
x86: apl: Move p2sb ofdata reading to the correct method

With P2SB the initial BAR (base-address register) is set up by TPL and
this is used unchanged right through U-Boot.

At present the reading of this address is split between the ofdata() and
probe() methods. There are a few problems that are unique to the p2sb.
One is that its children need to call pcr_read32(), etc. which needs to
have the p2sb address correct. Also some of its children are pinctrl
devices and pinctrl is used when any device is probed. So p2sb really
needs to get its base address set up in ofdata_to_platdata(), before it is
probed.

Another point is that reading the p2sb BAR will not work if the p2sb is
hidden. The FSP-S seems to hide it, presumably to avoid confusing PCI
enumeration.

Reading ofdata in ofdata_to_platdata() is the correct place anyway, so
this is easy to fix.

Move the code into one place and use the early-regs property in all cases
for simplicity and to avoid needing to probe any PCI devices just to read
the BAR.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Tested-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agox86: Correct wording of coreboot source code
Simon Glass [Wed, 8 Apr 2020 22:57:27 +0000 (16:57 -0600)]
x86: Correct wording of coreboot source code

Some files are taken or modified from coreboot, but the files are
no-longer part of the coreboot project. Fix the wording in a few places.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agodm: pci: Allow disabling auto-config for a device
Simon Glass [Wed, 8 Apr 2020 22:57:26 +0000 (16:57 -0600)]
dm: pci: Allow disabling auto-config for a device

Add a means to avoid configuring a device when needed. Add an explanation
of why this is useful to the binding file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotpm: Don't cleanup unless an error happens
Simon Glass [Wed, 8 Apr 2020 22:57:25 +0000 (16:57 -0600)]
tpm: Don't cleanup unless an error happens

At present the cleanup() method is called on every transfer. It should
only be called on failing transfers. Fix this and tidy up the error
handling a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotpm: cr50: Use the correct GPIO binding
Simon Glass [Wed, 8 Apr 2020 22:57:24 +0000 (16:57 -0600)]
tpm: cr50: Use the correct GPIO binding

This device should use ready-gpios rather than ready-gpio. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotpm: cr50: Add a comment for cr50_priv
Simon Glass [Wed, 8 Apr 2020 22:57:23 +0000 (16:57 -0600)]
tpm: cr50: Add a comment for cr50_priv

Add a comment for the private structure

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotpm: cr50: Release locality on exit
Simon Glass [Wed, 8 Apr 2020 22:57:22 +0000 (16:57 -0600)]
tpm: cr50: Release locality on exit

At present the cr50 driver claims the locality and does not release it for
Linux. This causes problems. Fix this by tracking what is claimed, and
adding a 'remove' method.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agospi: Add SPI mode enums
Simon Glass [Wed, 8 Apr 2020 22:57:21 +0000 (16:57 -0600)]
spi: Add SPI mode enums

With ACPI we need to describe the settings of the SPI bus. Add enums to
handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agocpu: Support querying the address width
Simon Glass [Wed, 8 Apr 2020 22:57:20 +0000 (16:57 -0600)]
cpu: Support querying the address width

Different CPUs may support different address widths, meaning the amount of
memory they can address. Add a property for this to the cpu_info struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: acpi: Let OS know that console already had been initialized
Andy Shevchenko [Thu, 27 Feb 2020 15:21:56 +0000 (17:21 +0200)]
x86: acpi: Let OS know that console already had been initialized

SPCR has no clue if the UART base clock speed is different to
the default one. However, the SPCR 1.04 defines baud rate 0 as
a preconfigured state of UART and OS is supposed not to touch
the configuration of the serial device.

Linux kernel supports that starting from v5.0, see commit
b413b1abeb21 ("ACPI: SPCR: Consider baud rate 0 as preconfigured state")
for the details.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoserial: ns16550: Provide UART base clock speed in ->getinfo()
Andy Shevchenko [Thu, 27 Feb 2020 15:21:55 +0000 (17:21 +0200)]
serial: ns16550: Provide UART base clock speed in ->getinfo()

Some callers may need the UART base clock speed value.
Provide it in the ->getinfo() callback.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: serial: Add clock member to struct serial_device_info
Andy Shevchenko [Thu, 27 Feb 2020 15:21:54 +0000 (17:21 +0200)]
dm: serial: Add clock member to struct serial_device_info

Some callers of serial_getinfo() would like to know the UART base
clock speed in order to make decision what to pass to OS in some
cases. In particular, ACPI SPCR table expects only certain base
clock speed and thus we have to act accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoefi_loader: add some description about UEFI secure boot
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:54 +0000 (11:51 +0900)]
efi_loader: add some description about UEFI secure boot

A small text in docs/uefi/uefi.rst was added to explain how we can
configure and utilise UEFI secure boot feature on U-Boot.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 years agotravis: add packages for UEFI secure boot test
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:53 +0000 (11:51 +0900)]
travis: add packages for UEFI secure boot test

Pytest for UEFI secure boot will use several host commands.
In particular, Test setup relies on efitools, whose version must be v1.5.2
or later. So fetch a new version of deb package directly.
Please note it has a dependency on mtools, which must also be installed
along wih efitools.

In addition, the path, '/sbin', is added to PATH for use of sgdisk and
mkfs.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agosandbox: add extra configurations for UEFI and related tests
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:52 +0000 (11:51 +0900)]
sandbox: add extra configurations for UEFI and related tests

Adding those extra configurations allows us to successfully run UEFI
secure boot pytest on Travis CI.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader, pytest: add UEFI secure boot tests (image)
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:51 +0000 (11:51 +0900)]
efi_loader, pytest: add UEFI secure boot tests (image)

Provide test cases for
 * image authentication for signed images
   (test_efi_secboot/test_signed.py)
 * image authentication for unsigned images
   (test_efi_secboot/test_unsigned.py)

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader, pytest: add UEFI secure boot tests (authenticated variables)
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:50 +0000 (11:51 +0900)]
efi_loader, pytest: add UEFI secure boot tests (authenticated variables)

Provide a couple of test cases for variable authentication.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader, pytest: set up secure boot environment
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:49 +0000 (11:51 +0900)]
efi_loader, pytest: set up secure boot environment

A fixture for UEFI secure boot tests (image authentication and variable
authentication) is defined. A small file system with test data in a single
partition formatted in fat is created.

This test requires efitools v1.5.2 or later. If the system's efitools
is older, you have to build it on your own and define EFITOOLS_PATH.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agocmd: efidebug: add "test bootmgr" sub-command
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:48 +0000 (11:51 +0900)]
cmd: efidebug: add "test bootmgr" sub-command

This sub-command will be used to test image authentication,
in particular, a case where efi_load_image() failed with
EFI_SECURITY_VIOLATION but we still want to try efi_start_image().
We won't run such a case under normal bootmgr because it simply
refuses to call efi_start_image() if anything but EFI_SUCCESS
is returned when loading an image.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agocmd: env: add "-at" option to "env set -e" command
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:47 +0000 (11:51 +0900)]
cmd: env: add "-at" option to "env set -e" command

With "-at" option, EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS
will be passed to SetVariable() to authenticate the variable.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agocmd: env: use appropriate guid for authenticated UEFI variable
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:46 +0000 (11:51 +0900)]
cmd: env: use appropriate guid for authenticated UEFI variable

A signature database variable is associated with a specific guid.
For convenience, if user doesn't supply any guid info, "env set|print -e"
should complement it.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: set up secure boot
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:45 +0000 (11:51 +0900)]
efi_loader: set up secure boot

The following variable is exported as UEFI specification defines:
SignatureSupport: array of GUIDs representing the type of signatures
                      supported by the platform firmware

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: image_loader: support image authentication
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:44 +0000 (11:51 +0900)]
efi_loader: image_loader: support image authentication

With this commit, image validation can be enforced, as UEFI specification
section 32.5 describes, if CONFIG_EFI_SECURE_BOOT is enabled.

Currently we support
* authentication based on db and dbx,
  so dbx-validated image will always be rejected.
* following signature types:
    EFI_CERT_SHA256_GUID (SHA256 digest for unsigned images)
    EFI_CERT_X509_GUID (x509 certificate for signed images)
Timestamp-based certificate revocation is not supported here.

Internally, authentication data is stored in one of certificates tables
of PE image (See efi_image_parse()) and will be verified by
efi_image_authenticate() before loading a given image.

It seems that UEFI specification defines the verification process
in a bit ambiguous way. I tried to implement it as closely to as
EDK2 does.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: variable: add VendorKeys variable
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:43 +0000 (11:51 +0900)]
efi_loader: variable: add VendorKeys variable

The following variable is exported as UEFI specification defines:
VendorKeys: whether the system is configured to use only vendor-provided
    keys or not
The value will have to be modified if a platform has its own way of
initializing signature database, in particular, PK.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: variable: add secure boot state transition
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:42 +0000 (11:51 +0900)]
efi_loader: variable: add secure boot state transition

UEFI specification defines several global variables which are related to
the current secure boot state. In this commit, those values will be
maintained according to operations. Currently, AuditMode and DeployedMode
are defined but not implemented.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: variable: support variable authentication
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:41 +0000 (11:51 +0900)]
efi_loader: variable: support variable authentication

With this commit, EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS
is supported for authenticated variables and the system secure state
will transfer between setup mode and user mode as UEFI specification
section 32.3 describes.

Internally, authentication data is stored as part of authenticated
variable's value. It is nothing but a pkcs7 message (but we need some
wrapper, see efi_variable_parse_signature()) and will be validated by
efi_variable_authenticate(), hence efi_signature_verify_with_db().

Associated time value will be encoded in "{...,time=...}" along with
other UEFI variable's attributes.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: add signature database parser
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:40 +0000 (11:51 +0900)]
efi_loader: add signature database parser

efi_signature_parse_sigdb() is a helper function will be used to parse
signature database variable and instantiate a signature store structure
in later patches.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: add signature verification functions
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:39 +0000 (11:51 +0900)]
efi_loader: add signature verification functions

In this commit, implemented are a couple of helper functions which will be
used to materialize variable authentication as well as image authentication
in later patches.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: add CONFIG_EFI_SECURE_BOOT config option
AKASHI Takahiro [Tue, 14 Apr 2020 02:51:38 +0000 (11:51 +0900)]
efi_loader: add CONFIG_EFI_SECURE_BOOT config option

Under this configuration, UEFI secure boot support will be added
in later patches.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agodrivers: crypto: rsa_mod_exp: avoid DM_FLAG_PRE_RELOC
Heinrich Schuchardt [Wed, 15 Apr 2020 18:31:53 +0000 (18:31 +0000)]
drivers: crypto: rsa_mod_exp: avoid DM_FLAG_PRE_RELOC

Function rsa_verify_key() is not called before relocation. So there is no
need to load the UCLASS_MOD_EXP drivers before relocation.

This avoid a failure to boot for pine64-lts_defconfig with CONFIG_RSA=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: function descriptions efi_watchdog.c
Heinrich Schuchardt [Fri, 10 Apr 2020 15:51:56 +0000 (17:51 +0200)]
efi_loader: function descriptions efi_watchdog.c

Correct function descriptions in efi_watchdog.c.
Add the descriptions to the generated HTML documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: add missing doc comments in efi_disk.c
Heinrich Schuchardt [Fri, 10 Apr 2020 15:10:34 +0000 (17:10 +0200)]
efi_loader: add missing doc comments in efi_disk.c

Add missing descriptions for functions in efi_disk.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: function descriptions efi_unicode_collation.c
Heinrich Schuchardt [Fri, 10 Apr 2020 15:39:23 +0000 (17:39 +0200)]
efi_loader: function descriptions efi_unicode_collation.c

Correct function descriptions in efi_unicode_collation.c
Add the Unicode collation protocol to the generated HTML documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: enable RNG if DM_RNG is enabled
Peter Robinson [Wed, 1 Apr 2020 10:15:01 +0000 (11:15 +0100)]
efi_loader: enable RNG if DM_RNG is enabled

Enable EFI_RNG_PROTOCOL by default if DM_RNG is set.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Remove superfluous 'if DM_RNG'
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge tag 'u-boot-stm32-20200415' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Wed, 15 Apr 2020 16:10:51 +0000 (12:10 -0400)]
Merge tag 'u-boot-stm32-20200415' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Replace STM32MP1_TRUSTED by TFABOOT flag
- Enable bootd, iminfo, imxtract on ST defconfig
- Rename LEDs to match silkscreen on AV96
- Add KS8851-16MLL ethernet on FMC2
- Define FMC2 base address
- net: dwc_eth_qos: implement reset-gpios for stm32
- net: dwc_eth_qos: implement phy reg and max-speed for stm32

4 years agoMerge branch 'master' of git://git.denx.de/u-boot-marvell
Tom Rini [Wed, 15 Apr 2020 12:30:16 +0000 (08:30 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-marvell

- Common: honour hw_margin_ms property (Rasmus)
- sp805_wdt: get platform clock from dt (Rayagonda)

4 years agoboard: stm32mp1: correct CONFIG_IS_ENABLED usage for LED
Patrick Delaunay [Fri, 10 Apr 2020 17:14:01 +0000 (19:14 +0200)]
board: stm32mp1: correct CONFIG_IS_ENABLED usage for LED

Use the correct macro to test presence CONFIG_LED:
replace CONFIG_IS_ENABLED(CONFIG_LED) by CONFIG_IS_ENABLED(LED)

Issue see during review unrelated patch
"board: stm32mp1: update management of boot-led"
http://patchwork.ozlabs.org/patch/1264823/

Cc: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoARM: stm32: Enable bootd, iminfo, imxtract on ST defconfig
Patrick Delaunay [Fri, 10 Apr 2020 16:13:19 +0000 (18:13 +0200)]
ARM: stm32: Enable bootd, iminfo, imxtract on ST defconfig

Enable these standard U-Boot commands for image manipulation and for
starting the default boot command using 'boot' command in U-Boot shell.

Cc: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Rename LEDs to match silkscreen on AV96
Marek Vasut [Mon, 6 Apr 2020 13:05:58 +0000 (15:05 +0200)]
ARM: dts: stm32: Rename LEDs to match silkscreen on AV96

The LED labels do not match the silkscreen on the board, fix it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
4 years agoconfigs: stm32mp1: replace STM32MP1_TRUSTED by TFABOOT
Patrick Delaunay [Wed, 1 Apr 2020 07:07:33 +0000 (09:07 +0200)]
configs: stm32mp1: replace STM32MP1_TRUSTED by TFABOOT

Activate ARCH_SUPPORT_TFABOOT and replace the arch stm32mp
specific config CONFIG_STM32MP1_TRUSTED by the generic CONFIG_TFABOOT
introduced by the commit 535d76a12150 ("armv8: layerscape: Add TFABOOT
support").
This config CONFIG_TFABOOT is activated for the trusted boot chain,
when U-Boot is loaded by TF-A.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoARM: dts: stm32: Add KS8851-16MLL ethernet on FMC2
Marek Vasut [Sat, 28 Mar 2020 01:01:58 +0000 (02:01 +0100)]
ARM: dts: stm32: Add KS8851-16MLL ethernet on FMC2

Add DT entries, Kconfig entries and board-specific entries to configure
FMC2 bus and make KS8851-16MLL on that bus accessible to U-Boot.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Define FMC2 base address
Marek Vasut [Thu, 26 Mar 2020 15:57:26 +0000 (16:57 +0100)]
ARM: dts: stm32: Define FMC2 base address

Define FMC2 base address, for use in board files, until there is an
actual FMC2 bus driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: dwc_eth_qos: implement phy reg and max-speed for stm32
Patrick Delaunay [Wed, 18 Mar 2020 09:50:16 +0000 (10:50 +0100)]
net: dwc_eth_qos: implement phy reg and max-speed for stm32

Add management of property "reg" to configure @ of phy and
also "max-speed" property to specify maximum speed in Mbit/s
supported by the device

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agonet: dwc_eth_qos: implement reset-gpios for stm32
Christophe Roullier [Wed, 18 Mar 2020 09:50:15 +0000 (10:50 +0100)]
net: dwc_eth_qos: implement reset-gpios for stm32

Add management of property "reset-gpios" in the node identified by
"phy-handle" to configure any GPIO used to reset the PHY.

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agowatchdog: sp805_wdt: get platform clock from dt file
Rayagonda Kokatanur [Mon, 6 Apr 2020 07:59:52 +0000 (13:29 +0530)]
watchdog: sp805_wdt: get platform clock from dt file

Get the watchdog platform clock from the DTS file
using clk subsystem and use the same for calculating
ticks in msec.

Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Signed-off-by: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agowatchdog: honour hw_margin_ms DT property
Rasmus Villemoes [Fri, 13 Mar 2020 16:04:58 +0000 (17:04 +0100)]
watchdog: honour hw_margin_ms DT property

Some watchdog devices, e.g. external gpio-triggered ones, must be
reset more often than once per second, which means that the current
rate-limiting logic in watchdog_reset() fails to keep the board alive.

gpio-wdt.txt in the linux source tree defines a "hw_margin_ms"
property used to specifiy the maximum time allowed between resetting
the device. Allow any watchdog device to specify such a property, and
then use a reset period of one quarter of that. We keep the current
default of resetting once every 1000ms.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agowatchdog: move initr_watchdog() to wdt-uclass.c
Rasmus Villemoes [Fri, 13 Mar 2020 16:04:57 +0000 (17:04 +0100)]
watchdog: move initr_watchdog() to wdt-uclass.c

This function is a bit large for an inline function, and for U-Boot
proper, it is called via a function pointer anyway (in board_r.c), so
cannot be inlined.

It will shortly set a global variable to be used by the
watchdog_reset() function in wdt-uclass.c, so this also allows making
that variable local to wdt-uclass.c.

The WATCHDOG_TIMEOUT_SECS define is not used elsewhere.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agowatchdog: remove stale ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS from wdt.h
Rasmus Villemoes [Fri, 13 Mar 2020 16:04:56 +0000 (17:04 +0100)]
watchdog: remove stale ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS from wdt.h

Since WATCHDOG_TIMEOUT_MSECS was converted to Kconfig (commit
ca51ef7c0c), CONFIG_WATCHDOG_TIMEOUT_MSECS has been guaranteed to be
defined. So remove the dead fallback ifdeffery.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>