]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agodoc: fatinfo man-page
Heinrich Schuchardt [Sun, 11 Apr 2021 18:28:13 +0000 (20:28 +0200)]
doc: fatinfo man-page

Provide a man-page for the fatinfo command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: imx: psb: fix footnotes
Heinrich Schuchardt [Sun, 11 Apr 2021 15:03:53 +0000 (17:03 +0200)]
doc: imx: psb: fix footnotes

In reStructured text footnotes are referenced like [1]_.

Add missing underscores.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Marek Vasut <marex@denx.de>
3 years agoboard: toradex: apalis-imx8x: fix build warning
Heinrich Schuchardt [Sat, 10 Apr 2021 18:07:54 +0000 (20:07 +0200)]
board: toradex: apalis-imx8x: fix build warning

The length of an underline must match the length of the header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
3 years agoMerge branch '2021-04-14-assorted-vboot-improvements'
Tom Rini [Thu, 15 Apr 2021 21:10:25 +0000 (17:10 -0400)]
Merge branch '2021-04-14-assorted-vboot-improvements'

- Add ECDSA support to FIT images
- Improve FIT image loadables (incl fpga) support
- Further FIT improvements with SPL

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
Tom Rini [Thu, 15 Apr 2021 17:11:19 +0000 (13:11 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq

update ls1028aqds networking protocol, config in ls1021atwr, env in ls1012a
Add seli3 board support, booke watchdog, update eTSEC support in ppc-qemu
Add DM_SERIAL and lpuart in sl28, add DM_ETH support for some of powerpc platforms

Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Thu, 15 Apr 2021 13:19:31 +0000 (09:19 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- Minor fix to Apollo Lake devicetree bindings for FSP
- Refactor Designware PCIe drivers to core and SoC parts
- Add Amlogic Meson Designware PCIe controller driver

3 years agoconfigs: T1042D4RDB: enable DM_ETH
Camelia Groza [Tue, 13 Apr 2021 16:48:05 +0000 (19:48 +0300)]
configs: T1042D4RDB: enable DM_ETH

Enable DM_ETH and DM_MDIO for the T1042D4RDB.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopowerpc: dts: t1042d4rdb: add FMan v3 nodes
Camelia Groza [Tue, 13 Apr 2021 16:48:04 +0000 (19:48 +0300)]
powerpc: dts: t1042d4rdb: add FMan v3 nodes

Add the FMan v3 nodes for the T1042D4RDB. The nodes are copied over with
little modification from the Linux kernel source code.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopowerpc: dts: t1042: add QorIQ DPAA 1 FMan v3 nodes
Camelia Groza [Tue, 13 Apr 2021 16:48:03 +0000 (19:48 +0300)]
powerpc: dts: t1042: add QorIQ DPAA 1 FMan v3 nodes

Add the QorIQ DPAA 1 FMan v3 device tree nodes for the T1042 SoC.
The device tree nodes are copied over with little modification
from the Linux kernel source code.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoconfigs: T4240RDB: enable DM_ETH
Camelia Groza [Tue, 13 Apr 2021 16:48:02 +0000 (19:48 +0300)]
configs: T4240RDB: enable DM_ETH

Enable DM_ETH and DM_MDIO for the T4240RDB.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopowerpc: dts: qoriq: update the mdio offsets under the second FMan v3
Camelia Groza [Tue, 13 Apr 2021 16:48:01 +0000 (19:48 +0300)]
powerpc: dts: qoriq: update the mdio offsets under the second FMan v3

When two FMan's are present on a board, the MDIO nodes are found at the
same offsets inside each FMan. This causes "non unique device name"
errors when registering the MDIO nodes under the second FMan. Fix this
by updating the offsets of the MDIO nodes to include the parent FMan's
offset.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopowerpc: dts: t4240rdb: add FMan v3 nodes
Camelia Groza [Tue, 13 Apr 2021 16:48:00 +0000 (19:48 +0300)]
powerpc: dts: t4240rdb: add FMan v3 nodes

Add the FMan v3 nodes for the T4240RDB. The nodes are copied over with
little modification from the Linux kernel source code.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopowerpc: dts: t4240: add QorIQ DPAA 1 FMan v3 nodes
Camelia Groza [Tue, 13 Apr 2021 16:47:59 +0000 (19:47 +0300)]
powerpc: dts: t4240: add QorIQ DPAA 1 FMan v3 nodes

Add the QorIQ DPAA 1 FMan v3 device tree nodes for the T4240 SoC.
The device tree nodes are copied over with little modification
from the Linux kernel source code.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoconfigs: T2080RDB: enable DM_ETH
Camelia Groza [Tue, 13 Apr 2021 16:47:58 +0000 (19:47 +0300)]
configs: T2080RDB: enable DM_ETH

Enable DM_ETH and DM_MDIO for the T2080RDB.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: freescale: t208xrdb: fdt fixups under DM_ETH
Camelia Groza [Tue, 13 Apr 2021 16:47:57 +0000 (19:47 +0300)]
board: freescale: t208xrdb: fdt fixups under DM_ETH

Disable the FMan mEMAC 5 and 6 nodes from the fdt since they are not
available under the supported RCW. Also disable the associated
"fsl,dpa-ethernet" nodes that reference them.

This is a simplified version of the fdt_fixup_fman_ethernet call for
use under DM_ETH.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopowerpc: dts: t2080rdb: add FMan v3 nodes
Camelia Groza [Tue, 13 Apr 2021 16:47:56 +0000 (19:47 +0300)]
powerpc: dts: t2080rdb: add FMan v3 nodes

Add the FMan v3 nodes for the T2080RDB. The nodes are copied over with
little modification from the Linux kernel source code.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopowerpc: dts: t2080: add QorIQ DPAA 1 FMan v3 nodes
Camelia Groza [Tue, 13 Apr 2021 16:47:55 +0000 (19:47 +0300)]
powerpc: dts: t2080: add QorIQ DPAA 1 FMan v3 nodes

Add the QorIQ DPAA 1 FMan v3 device tree nodes for the T2080 SoC.
The device tree nodes are copied over with little modification from
the Linux kernel source code.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agols1012a: use default scan_dev_for_boot
Mian Yousaf Kaukab [Tue, 30 Mar 2021 14:04:14 +0000 (16:04 +0200)]
ls1012a: use default scan_dev_for_boot

scan_dev_for_efi is supposed to be called from scan_dev_for_boot.
However, this call is missing for ls1012a boards. As a result EFI
boot doesn’t work. Fix this issue by removing custom definition of
scan_dev_for_boot and use the default definition instead.

Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: sl28: add config to enable console output on SER0
Michael Walle [Fri, 26 Mar 2021 18:40:59 +0000 (19:40 +0100)]
board: sl28: add config to enable console output on SER0

Sometimes it is desireable to have the console output on the first
serial line. Introduce a configuration option for it (in the board
scope).

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: sl28: enable DM_SERIAL
Michael Walle [Fri, 26 Mar 2021 18:40:58 +0000 (19:40 +0100)]
board: sl28: enable DM_SERIAL

With all preparations in place, switch over to DM_SERIAL.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard: sl28: move DM_* configs to Kconfig
Michael Walle [Fri, 26 Mar 2021 18:40:57 +0000 (19:40 +0100)]
board: sl28: move DM_* configs to Kconfig

Move the CONFIG_DM_* from the defconfig to the TARGET_SL28 config.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarmv8: fsl-layerscape: spl: call spl_early_init()
Michael Walle [Fri, 26 Mar 2021 18:40:56 +0000 (19:40 +0100)]
armv8: fsl-layerscape: spl: call spl_early_init()

DM_SERIAL needs both the device tree as well as an early heap. Thus, we
have to call spl_early_init() to initialize the memory allocator and the
setup the device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarmv8: fsl-layerscape: spl: add debug UART support
Michael Walle [Fri, 26 Mar 2021 18:40:55 +0000 (19:40 +0100)]
armv8: fsl-layerscape: spl: add debug UART support

To use the debug UART we have to call debug_uart_init() in the SPL. Do
so as soon as possible.

As an example, here is how you can use it on a LS1028A SoC:
CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_BASE=0x21c0500
CONFIG_DEBUG_UART_CLOCK=200000000

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agofreescale: ls1021atwr: Drop use of CONFIG_RESET
Simon Glass [Fri, 26 Mar 2021 03:13:01 +0000 (16:13 +1300)]
freescale: ls1021atwr: Drop use of CONFIG_RESET

It is not recommended to use CONFIG_xxx defines for things which are not
Kconfig options. Rename this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodoc: board: qemu-ppce500: Document eTSEC usage
Bin Meng [Sun, 14 Mar 2021 12:15:06 +0000 (20:15 +0800)]
doc: board: qemu-ppce500: Document eTSEC usage

Document how to launch a QEMU session with eTSEC as a network device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoppc: qemu: Enable eTSEC support
Bin Meng [Sun, 14 Mar 2021 12:15:05 +0000 (20:15 +0800)]
ppc: qemu: Enable eTSEC support

QEMU ppce500 target can dynamically instantiate an eTSEC device
if "-device eTSEC" is given to QEMU. This commit enables eTSEC
driver and the required fixed PHY driver to create a usable
network configuration using eTSEC.

Unlike a real world 85xx board that usually stores the eTSEC MAC
address in an EEPROM, CONFIG_NET_RANDOM_ETHADDR is required for
QEMU otherwise U-Boot ethernet initialization complains no valid
ethernet address is set.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoppc: qemu: Create a virtual memory mapping of the platform bus
Bin Meng [Sun, 14 Mar 2021 12:15:04 +0000 (20:15 +0800)]
ppc: qemu: Create a virtual memory mapping of the platform bus

QEMU ppce500 target can dynamically instantiate an eTSEC device on
a platform bus if "-device eTSEC" is given to QEMU. It is presented
as a "simple-bus" in the device tree, with an additional compatible
string "qemu,platform".

Let's create a virtual memory mapping for it in misc_init_r(), in
preparation to adding eTSEC support.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agotest: dm: Add a test case for simple-bus <ranges>
Bin Meng [Sun, 14 Mar 2021 12:15:03 +0000 (20:15 +0800)]
test: dm: Add a test case for simple-bus <ranges>

This adds a test case to verify reading <ranges> of a simple-bus is
working as expected.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodm: core: Correctly read <ranges> of simple-bus
Bin Meng [Sun, 14 Mar 2021 12:15:02 +0000 (20:15 +0800)]
dm: core: Correctly read <ranges> of simple-bus

At present we decode simple bus <ranges> using the following assumption:

- parent #address-cells 1
- child #address-cells 1
- child #size-cells 1

However this might not always be the case.

Update to use fdt_addr_t and fdt_size_t in 'struct simple_bus_plat', and
use fdt_read_ranges() to correctly decode it according to the actual
parent and child #address-cells / #size-cells under a Kconfig option
CONFIG_SIMPLE_BUS_CORRECT_RANGE which can be turned on for any board
that needs it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: tsec: Support <reg> property from the subnode "queue-group"
Bin Meng [Sun, 14 Mar 2021 12:15:01 +0000 (20:15 +0800)]
net: tsec: Support <reg> property from the subnode "queue-group"

At present the tsec driver uses a non-standard DT bindings to get
its <reg> base / size. The upstream Linux kernel seems to require
the <reg> base / size to be put under a subnode of the eTSEC node
with a name prefix "queue-group". This is not documented in the
kernel DT bindings, but it looks every dtsi file that contains the
eTSEC node was written like this.

This commit updates the tsec driver to handle this case.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodt-bindings: net: Update Freescale TSEC to support "queue-group"
Bin Meng [Sun, 14 Mar 2021 12:15:00 +0000 (20:15 +0800)]
dt-bindings: net: Update Freescale TSEC to support "queue-group"

At present the Freescale TSEC node DT bindings doc requires a <reg>
property in the TSEC node. But this might not always be the case.
In the upstream Linux kernel, there is no DT bindings doc for it
but the kernel driver tests a subnode of a name prefixed with
"queue-group", as we can see from gfar_of_init():

  for_each_available_child_of_node(np, child) {
      if (!of_node_name_eq(child, "queue-group"))
  ...

in drivers/net/ethernet/freescale/gianfar.c

Update our DT bindings to describe this alternate description.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: tsec: Use map_physmem() directly instead of dev_remap_addr()
Bin Meng [Sun, 14 Mar 2021 12:14:59 +0000 (20:14 +0800)]
net: tsec: Use map_physmem() directly instead of dev_remap_addr()

dev_remap_addr() eventually calls dev_read_addr_index(), while
pdata->iobase holds the return value of dev_read_addr() that calls
dev_read_addr_index() too. Such duplication can be avoided by using
map_physmem() directly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agotest: dm: Add a case to test ofnode_phy_is_fixed_link()
Bin Meng [Sun, 14 Mar 2021 12:14:58 +0000 (20:14 +0800)]
test: dm: Add a case to test ofnode_phy_is_fixed_link()

This adds a test case to test the new ofnode_phy_is_fixed_link() API.
Both the new and old DT bindings are covered.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agosandbox: Add a DSA sandbox driver and unit test
Claudiu Manoil [Sun, 14 Mar 2021 12:14:57 +0000 (20:14 +0800)]
sandbox: Add a DSA sandbox driver and unit test

The DSA sandbox driver is used for unit testing the DSA class code.
It implements a simple 2 port switch plus 1 CPU port, and uses a
very simple tag to identify the ports.

The DSA sandbox device is connected via CPU port to a regular Ethernet
sandbox device, called 'dsa-test-eth, managed by the existing eth
sandbox driver.  The 'dsa-test-eth' is not intended for testing the
eth class code however, but it is used to emulate traffic through the
'lan0' and 'lan1' front pannel switch ports.  To achieve this the dsa
sandbox driver registers a tx handler for the 'dsa-test-eth' device.
The switch ports, labeled as 'lan0' and 'lan1', are also registered
as eth devices by the dsa class code this time.  So pinging through
these switch ports is as easy as:

=> setenv ethact lan0
=> ping 1.2.3.5

Unit tests for the dsa class code were also added.  The 'dsa_probe'
test exercises most API functions from dsa.h.  The 'dsa' unit test
simply exercises ARP/ICMP traffic through the two switch ports,
including tag injection and extraction, with the help of the dsa
sandbox driver.

I took care to minimize the impact on the existing eth unit tests,
though some adjustments needed to be made with the addition of
extra eth interfaces used by the dsa unit tests. The additional eth
interfaces also require MAC addresses, these have been added to the
sandbox default environment.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Message-Id: <20210216224804.3355044-5-olteanv@gmail.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: tsec: Use dm_eth_phy_connect() directly for the DM case
Vladimir Oltean [Sun, 14 Mar 2021 12:14:56 +0000 (20:14 +0800)]
net: tsec: Use dm_eth_phy_connect() directly for the DM case

Now that the fixed phy driver has been fully adapted to OF APIs,
and dm_eth_phy_connect() already can handle the fixed phy, call
dm_eth_phy_connect() directly in the DM tsec driver.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Message-Id: <20210216224804.3355044-4-olteanv@gmail.com>
[bmeng: split from "net: mdio: teach dm_eth_phy_connect to connect to fixed PHY"]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: fixed: Support the old DT binding
Bin Meng [Sun, 14 Mar 2021 12:14:55 +0000 (20:14 +0800)]
net: phy: fixed: Support the old DT binding

Update fixedphy_probe() to support the old DT binding.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: fixed: Add the missing ending newline
Bin Meng [Sun, 14 Mar 2021 12:14:54 +0000 (20:14 +0800)]
net: phy: fixed: Add the missing ending newline

The printf statement doesn't end with a newline. Add it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: fixed: Make driver ops static
Bin Meng [Sun, 14 Mar 2021 12:14:53 +0000 (20:14 +0800)]
net: phy: fixed: Make driver ops static

The PHY driver ops should be made static.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: Simplify the logic of phy_connect_fixed()
Bin Meng [Sun, 14 Mar 2021 12:14:52 +0000 (20:14 +0800)]
net: phy: Simplify the logic of phy_connect_fixed()

Simplify the logic of phy_connect_fixed() by using the new API
ofnode_phy_is_fixed_link(), which brings additional bonus of
supporting the old DT bindings.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: xilinx: Drop #ifdef CONFIG_DM_ETH around phy_connect_gmii2rgmii()
Bin Meng [Sun, 14 Mar 2021 12:14:51 +0000 (20:14 +0800)]
net: phy: xilinx: Drop #ifdef CONFIG_DM_ETH around phy_connect_gmii2rgmii()

At present phy_connect_gmii2rgmii() is implemented using a DM API
dev_of_offset() hence it cannot support a non-DM configuration.
Remove the non-DM version prototype of phy_connect_gmii2rgmii()
and make the driver depend on CONFIG_DM_ETH.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: xilinx: Be compatible with live OF tree
Bin Meng [Sun, 14 Mar 2021 12:14:50 +0000 (20:14 +0800)]
net: phy: xilinx: Be compatible with live OF tree

Following the same updates that were done to the fixed phy driver,
use ofnode_ APIs instead of fdt_ APIs so that the Xilinx PHY driver
can support live DT.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: fixed: Drop #ifdef CONFIG_DM_ETH around phy_connect_fixed
Vladimir Oltean [Sun, 14 Mar 2021 12:14:49 +0000 (20:14 +0800)]
net: phy: fixed: Drop #ifdef CONFIG_DM_ETH around phy_connect_fixed

In drivers/net/phy/Kconfig, CONFIG_PHY_FIXED already depends on
CONFIG_DM_ETH, so the function prototype definition when
CONFIG_DM_ETH=n does nothing, so it can be dropped. It is also
never reachable, since the whole function is already under #ifdef
CONFIG_PHY_FIXED (which again, as I said, depends on CONFIG_DM_ETH=y).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Message-Id: <20210216224804.3355044-3-olteanv@gmail.com>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agonet: phy: fixed: Be compatible with live OF tree
Vladimir Oltean [Sun, 14 Mar 2021 12:14:48 +0000 (20:14 +0800)]
net: phy: fixed: Be compatible with live OF tree

On systems that use CONFIG_OF_LIVE, the "ofnode" type is defined
as const struct device_node *np, while on the flat DT systems it
is defined as a long of_offset into gd->fdt_blob.

It is desirable that the fixed PHY driver uses the higher-level
ofnode abstraction instead of parsing gd->fdt_blob directly,
because that enables it to work on live OF systems.

The fixed PHY driver has used a nasty hack since its introduction in
commit db40c1aa1c10 ("drivers/net/phy: add fixed-phy /
fixed-link support"),
which is to pass the long gd->fdt_blob offset inside int phydev->addr
(a value that normally holds the MDIO bus address at which the PHY
responds). Even ignoring the fact that the types were already
mismatched leading to a potential truncation (flat OF offset was
supposed to be a long and not an int), we really cannot extend this
hack any longer, because there's no way an int will hold the other
representation of ofnode, the struct device_node *np.

So we unfortunately need to do the right thing, which is to use the
framework introduced by Grygorii Strashko in
commit eef0b8a930d1 ("net: phy: add ofnode node to struct phy_device").
This will populate phydev->node for the fixed PHY.

Note that phydev->node will not be valid in the probe function, since
that is called synchronously from phy_device_create and we really have
no way of passing the ofnode directly through the phy_device_create API.
So we do what other drivers do too: we move the OF parsing logic from
the .probe to the .config method of the PHY driver. The new function
will be called at phy_config() time.

I do believe I've converted all the possible call paths for creating
a PHY with PHY_FIXED_ID, so there is really no reason to maintain
compatibility with the old logic of retrieving a flat OF tree offset
from phydev->addr. We just pass 0 to phydev->addr now.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Message-Id: <20210216224804.3355044-2-olteanv@gmail.com>
[bmeng: keep fixedphy_probe(); update mdio-uclass.c to handle fixed phy]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodm: mdio: Use ofnode_phy_is_fixed_link() API
Bin Meng [Sun, 14 Mar 2021 12:14:47 +0000 (20:14 +0800)]
dm: mdio: Use ofnode_phy_is_fixed_link() API

Switch to use the ofnode_phy_is_fixed_link() API which can support
both the new and old DT bindings.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoof: extra: Introduce ofnode_phy_is_fixed_link() API
Bin Meng [Sun, 14 Mar 2021 12:14:46 +0000 (20:14 +0800)]
of: extra: Introduce ofnode_phy_is_fixed_link() API

Introduce a helper API ofnode_phy_is_fixed_link() to detect whether
the ethernet controller connects to a fixed-link pseudo-PHY device.

Note there are two ways to describe a fixed PHY attached to an
Ethernet device:

- the new DT binding, where 'fixed-link' is a sub-node of the
  Ethernet device
- the old DT binding, where 'fixed-link' is a property with 5
  cells encoding various information about the fixed PHY

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agodt-bindings: net: Add the old DT bindings for "fixed-link"
Bin Meng [Sun, 14 Mar 2021 12:14:45 +0000 (20:14 +0800)]
dt-bindings: net: Add the old DT bindings for "fixed-link"

Per the upstream Linux kernel doc:

  Documentation/devicetree/bindings/net/ethernet-controller.yaml

There are two ways to describe a fixed PHY attached to an Ethernet
device. This updates our dt-bindings doc to add the old DT bindings.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agowatchdog: Add booke watchdog driver
Chris Packham [Fri, 5 Mar 2021 03:32:58 +0000 (16:32 +1300)]
watchdog: Add booke watchdog driver

Add a driver for the PowerPC Book E watchdog driver that is present on a
number of Freescale/NXP SoCs.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoboard/km: add support for seli8 design based on nxp ls102x
Aleksandar Gerasimovski [Mon, 22 Feb 2021 18:18:11 +0000 (18:18 +0000)]
board/km: add support for seli8 design based on nxp ls102x

The SELI8 design is a new tdm service unit card for Hitachi-Powergrids
XMC and FOX product lines.

It is based on NXP LS1021 SoC and it provides following interfaces:
 - IFC interface for NOR, NAND and external FPGA's
 - 1 x RGMII ETH for debug purposes
 - 2 x SGMII ETH for management communication via back-plane
 - 1 x uQE HDLC for management communication via back-plane
 - 1 x I2C for peripheral devices
 - 1 x SPI for peripheral devices
 - 1 x UART for debug logging

It is foreseen that the design will be later re-used for another XMC and
FOX service cards with similar SoC requirements.

Signed-off-by: Rainer Boschung <rainer.boschung@hitachi-powergrids.com>
Signed-off-by: Matteo Ghidoni <matteo.ghidoni@hitachi-powergrids.com>
Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agoarm: dts: ls1028a: define QDS networking protocol combinations
Alex Marginean [Wed, 27 Jan 2021 11:00:00 +0000 (13:00 +0200)]
arm: dts: ls1028a: define QDS networking protocol combinations

Includes DT definition for the following serdes protocols using various
PHY cards: 85xx, 13xx, 65xx, 9999, 7777.

Note that the default device tree for QDS now uses 85xx.
Enabling any of the others requires patching the fsl-ls1028a-qds.dtsi
file (the includes at the bottom of the file).

The phy-handle is specified as a path rather than a label because it is
possible to use the #include multiple times (meaning that more than one
PHY riser card of one type is inserted), and therefore, there would be
duplicate labels with the same name.

LBRW means that the board needs lane B rework before using this dtsi.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
3 years agopci: add Amlogic Meson Designware PCIe controller
Neil Armstrong [Thu, 25 Mar 2021 14:49:21 +0000 (15:49 +0100)]
pci: add Amlogic Meson Designware PCIe controller

Add support for the DW PCIe controller found in the Amlogic Meson AXG and
G12 (G12A, G12B, SM1) SoCs.
This uses the common DW PCIe helpers introducted previously.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agopci: pcie_dw_rockchip: migrate to common Designware PCIe functions
Neil Armstrong [Thu, 25 Mar 2021 14:49:20 +0000 (15:49 +0100)]
pci: pcie_dw_rockchip: migrate to common Designware PCIe functions

Migrate the dw_rockchip driver to use the common DW PCIe helpers.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agopci: pcie_dw_ti: migrate to common Designware PCIe functions
Neil Armstrong [Thu, 25 Mar 2021 14:49:19 +0000 (15:49 +0100)]
pci: pcie_dw_ti: migrate to common Designware PCIe functions

Migrate the dw_ti driver to use the common DW PCIe helpers.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agopci: add common Designware PCIe functions
Neil Armstrong [Thu, 25 Mar 2021 14:49:18 +0000 (15:49 +0100)]
pci: add common Designware PCIe functions

With the introduction of pcie_dw_rockchip, and need to support the DW PCIe in the
Amlogic AXG & G12 SoCs, most of the DW PCIe helpers would be duplicated.

This introduce a "common" DW PCIe helpers file with common code merged from the
dw_ti and dw_rockchip drivers and adapted to fit with the upcoming dw_meson.

The following changes will switch the dw_ti and dw_rockchip to use these helpers.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Green Wan <green.wan@sifive.com>
[bmeng: remove the blank line at EOF of drivers/pci/pcie_dw_common.c]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: mtrr: Fix function descriptions
Wolfgang Wallner [Tue, 23 Mar 2021 09:39:09 +0000 (10:39 +0100)]
x86: mtrr: Fix function descriptions

Fix copy/paste errors in the descriptions of mtrr_close () and mtrr_set().

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agodt-bindings: fsp: Fix Apollo Lake FSP-S devicetree bindings
Wolfgang Wallner [Tue, 23 Mar 2021 08:54:58 +0000 (09:54 +0100)]
dt-bindings: fsp: Fix Apollo Lake FSP-S devicetree bindings

An entry is missing in the FSP-S devicetree bindings, and as a result
the description for the next few following entries is off by one line.

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agolib/rsa: Use EVP_PKEY instead of RSA
Chan, Donald [Thu, 1 Apr 2021 22:42:36 +0000 (22:42 +0000)]
lib/rsa: Use EVP_PKEY instead of RSA

Most modern OpenSSL engines have methods overridden at the EVP level rather
than at RSA level, to make these engines work properly with mkimage, the RSA
signing code needs to switch to using EVP_* APIs as much as possible.

Signed-off-by: Donald Chan <hoiho@lab126.com>
[trini: Rebase on top of keyfile changes]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoimage-fit: Accept OP-TEE images when booting a FIT
Alexandru Gagniuc [Thu, 1 Apr 2021 18:25:31 +0000 (13:25 -0500)]
image-fit: Accept OP-TEE images when booting a FIT

OP-TEE images are normally packaged with
type = "tee;
os = "tee";

However, fit_image_load() thinks that is somehow invalid. However if
they were declared as type = "kernel", os = "linux", fit_image_load()
would happily accept them and allow the boot to continue. There is no
technical limitation to excluding "tee".

Allowing "tee" images is useful in a boot flow where OP-TEE is
executed before linux.

In fact, I think it's unintuitive for a "load"ing function to also do
parsing and contain a bunch ad-hoc heuristics that only its caller
might know. But I don't make the rules, I just write fixes. In more
polite terms: refactoring the fit_image API is beyond the scope of
this change.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoimage-fit: Accept IH_TYPE_FIRMWARE in fit_image_load() as valid
Alexandru Gagniuc [Thu, 1 Apr 2021 18:25:30 +0000 (13:25 -0500)]
image-fit: Accept IH_TYPE_FIRMWARE in fit_image_load() as valid

Consider the following FIT:

images {
whipple {};
};
configurations {
conf-1 {
firmware = "whipple";
};
};

Getting the 'firmware' image with fit_image_load() is not possible, as
it doesn't understand 'firmware =' properties. Although one could pass
IH_TYPE_FIRMWARE for 'image_type', this needs to be converted to a
"firmware" string for FDT lookup -- exactly what this change does.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agospl: LOAD_FIT_FULL: Support 'kernel' and 'firmware' properties
Alexandru Gagniuc [Thu, 1 Apr 2021 18:25:29 +0000 (13:25 -0500)]
spl: LOAD_FIT_FULL: Support 'kernel' and 'firmware' properties

The 'firmware' property of a config node takes precedence over the
'kernel' property. 'standalone' is deprecated. However, give users a
couple of releases where 'standalone' still works, but warns loudly.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agospl: LOAD_FIT_FULL: Relocate FDT for u-boot payloads
Alexandru Gagniuc [Thu, 1 Apr 2021 18:25:28 +0000 (13:25 -0500)]
spl: LOAD_FIT_FULL: Relocate FDT for u-boot payloads

U-Boot expects the FDT to be located right after the _end
linker symbol (see fdtdec.c: board_fdt_blob_setup())

The "basic" LOAD_FIT path is aware of this limitation, and relocates
the FDT at the expected location. Guessing the expected location
probably only works reliably on 32-bit arm, and it feels like a hack.
One proposal would be to pass the FDT address to u-boot
(e.g. using 'r2' on arm platforms).

The variable is named "fdt_hack" to remind future contributors that,
"hey! we should fix the underlying problem". However, that is beyond
the scope of this patch.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agospl: LOAD_FIT_FULL: Do not hard-code os to IH_OS_U_BOOT
Alexandru Gagniuc [Thu, 1 Apr 2021 18:25:27 +0000 (13:25 -0500)]
spl: LOAD_FIT_FULL: Do not hard-code os to IH_OS_U_BOOT

The information on the OS should be contained in the FIT, as the
self-explanatory "os" property of a node under /images. Hard-coding
this to U_BOOT might send us down the wrong path later in the boot
process.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agospl: LOAD_FIT_FULL: Fix selection of the "fdt" node
Alexandru Gagniuc [Thu, 1 Apr 2021 18:25:26 +0000 (13:25 -0500)]
spl: LOAD_FIT_FULL: Fix selection of the "fdt" node

The correct FDT to use is described by the "fdt" property of the
configuration node. When the fit_unamep argument to fit_image_load()
is "fdt", we get the "/images/fdt" node. This is incorrect, as it
ignores the "fdt" property of the config node, and in most cases,
the "/images/fdt" node doesn't exist.

Use NULL for the 'fit_unamep' argument. With NULL, fit_image_load()
uses the IH_TYPE_FLATDT value to read the config property "fdt",
which points to the correct FDT node(s).

fit_image_load() should probably be split into a function that reads
an image by name, and one that reads an image by config reference. I
don't make those decisions, I just point out the craziness.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: fit: Add weak board_fit_config_name_match
Sean Anderson [Wed, 31 Mar 2021 18:32:27 +0000 (14:32 -0400)]
common: fit: Add weak board_fit_config_name_match

Several architectures had a default board_fit_config_name_match already;
this provides a generic weak version. We default to rejecting all configs.
This will use the FIT's default config, instead of the first config. This
may result in boot failures if there are multiple configurations and the
first config is *not* the default.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
3 years agodoc: FIT image: Update FPGA example to make use of "loadables"
Alexandru Gagniuc [Mon, 29 Mar 2021 17:05:16 +0000 (12:05 -0500)]
doc: FIT image: Update FPGA example to make use of "loadables"

The new correct way to load an FPGA image is to declare it in the list
of "loadables". multi-with-fpga.its used the now deprecated "fpga"
property. Since this example most likely intended to use u-boot's
generic FPGA loading code, compatible = "u-boot,fpga-legacy" is also
appropriate here.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoKconfig: Document the limitations of the simple SPL_LOAD_FIT path
Alexandru Gagniuc [Mon, 29 Mar 2021 17:05:15 +0000 (12:05 -0500)]
Kconfig: Document the limitations of the simple SPL_LOAD_FIT path

The "simple" SPL_LOAD_FIT path is the most compliant with the format
documented in doc/uImage.FIT/source_file_format.txt. The other two
paths to load a FIT are SPL_LOAD_FIT_FULL and the "bootm" command.

Since the Kconfig menu is the most likely place for a new user to see
these options, it seems like the most logical candidate to document
the limitations. This documents the _known_ issues, and is not
intended to be a complete list of all follies.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agospl: fit: Support loading FPGA images from list of "loadables"
Alexandru Gagniuc [Mon, 29 Mar 2021 17:05:14 +0000 (12:05 -0500)]
spl: fit: Support loading FPGA images from list of "loadables"

Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
syntax") and delegated FPGA images to be added via the list of
"loadables" in lieu of the "fpga" property. Now actually implement
this in code.

Note that the "compatible" property is ignored for the time being, as
implementing "compatible" loading is beyond the scope of this change.
However, "u-boot,fpga-legacy" is accepted without warning.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agospl: fit: Warn if FIT contains "fpga" property in config node
Alexandru Gagniuc [Mon, 29 Mar 2021 17:05:13 +0000 (12:05 -0500)]
spl: fit: Warn if FIT contains "fpga" property in config node

Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
syntax") requires that FPGA images be referenced through the
"loadables" in the config node. This means that "fpga" properties in
config nodes are deprecated.

Given that there are likely FIT images which use "fpga", let's not
break those right away. Print a warning message that such use is
deprecated, and give users a couple of releases to update their

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agospl: fit: Move FPGA loading code to separate functions
Alexandru Gagniuc [Mon, 29 Mar 2021 17:05:12 +0000 (12:05 -0500)]
spl: fit: Move FPGA loading code to separate functions

The FPGA loading code in spl_simple_fit_read() can easily be separated
from the rest of the logic. It is split into two functions instead of
one because spl_fit_upload_fpga() is used in a subsequent patch.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: FIT image: Introduce "u-boot, fpga-legacy" property
Alexandru Gagniuc [Mon, 29 Mar 2021 17:05:11 +0000 (12:05 -0500)]
doc: FIT image: Introduce "u-boot, fpga-legacy" property

Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
syntax") introduced a "compatible" property for loadable images.
It did not define its contents. Use "u-boot,fpga-legacy" compatible
string to specify that fpga_load() should be used to load the image.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agospl: fit: Don't overwrite previous loadable if "load" is missing
Alexandru Gagniuc [Mon, 29 Mar 2021 17:05:10 +0000 (12:05 -0500)]
spl: fit: Don't overwrite previous loadable if "load" is missing

spl_load_fit_image() will try to load an image at the address given
in the "load" property. Absent such property, it uses

image_info->load_addr

Correct use of this is demonstrated in spl_fit_append_fdt(), which
resets the 'load_addr' before each spl_load_fit_image() call.

On the other hand loading "loadables" loop in spl_load_simple_fit()
completely ignores this. It re-uses the same structure, but doesn't
reset load_addr. If loadable [i] does not have a "load" property, its
load address defaults to load_addr, which still contains the address
of loadable [i - 1].

A simple solution is to treat NULL as an invalid load address. The
caller can set load_addr = 0 to request an abort if the "load"
property is absent.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: ecdsa: Use mkimage keyfile instead of keydir argument
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:20 +0000 (12:45 -0600)]
test/py: ecdsa: Use mkimage keyfile instead of keydir argument

Originally, the ECDSA code path used 'keydir' as the key filename.
mkimage has since been updated to include a new 'keyfile' argument.
Use the new argument for passing in the key.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib/ecdsa: Use the 'keydir' argument from mkimage if appropriate
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:19 +0000 (12:45 -0600)]
lib/ecdsa: Use the 'keydir' argument from mkimage if appropriate

Keys can be derived from keydir, and the "key-name-hint" property of
the FIT. They can also be specified ad-literam via 'keyfile'. Update
the ECDSA signing path to use the appropriate one.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib/rsa: Use the 'keyfile' argument from mkimage
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:18 +0000 (12:45 -0600)]
lib/rsa: Use the 'keyfile' argument from mkimage

Keys can be derived from keydir, and the "key-name-hint" property of
the FIT. They can also be specified ad-literam via 'keyfile'. Update
the RSA signing path to use the appropriate one.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agomkimage: Add a 'keyfile' argument for image signing
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:17 +0000 (12:45 -0600)]
mkimage: Add a 'keyfile' argument for image signing

It's not always desirable to use 'keydir' and some ad-hoc heuristics
to get the filename of the signing key. More often, just passing the
filename is the simpler, easier, and logical thing to do.

Since mkimage doesn't use long options, we're slowly running out of
letters. I've chosen '-G' because it was available.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: signature.txt: Document the keydir and keyfile arguments
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:16 +0000 (12:45 -0600)]
doc: signature.txt: Document the keydir and keyfile arguments

After lots of debating, this documents how we'd like mkimage to treat
'keydir' and 'keyfile' arguments. The rest is in the docs.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: ecdsa: Add test for mkimage ECDSA signing
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:15 +0000 (12:45 -0600)]
test/py: ecdsa: Add test for mkimage ECDSA signing

Add a test to make sure that the ECDSA signatures generated by
mkimage can be verified successfully. pyCryptodomex was chosen as the
crypto library because it integrates much better with python code.
Using openssl would have been unnecessarily painful.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: Add pycryptodomex to list of required pakages
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:14 +0000 (12:45 -0600)]
test/py: Add pycryptodomex to list of required pakages

We wish to use pycryptodomex to verify code paths involving ECDSA
signatures. Add it to requirements.txt so that they get picked up
automatically .gitlab and .azure tasks

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: signature.txt: Document devicetree format for ECDSA keys
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:13 +0000 (12:45 -0600)]
doc: signature.txt: Document devicetree format for ECDSA keys

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: Add support for ECDSA image signing
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:12 +0000 (12:45 -0600)]
lib: Add support for ECDSA image signing

mkimage supports rsa2048, and rsa4096 signatures. With newer silicon
now supporting hardware-accelerated ECDSA, it makes sense to expand
signing support to elliptic curves.

Implement host-side ECDSA signing and verification with libcrypto.
Device-side implementation of signature verification is beyond the
scope of this patch.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib/rsa: Make fdt_add_bignum() available outside of RSA code
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:11 +0000 (12:45 -0600)]
lib/rsa: Make fdt_add_bignum() available outside of RSA code

fdt_add_bignum() is useful for algorithms other than just RSA. To
allow its use for ECDSA, move it to a common file under lib/.

The new file is suffixed with '-libcrypto' because it has a direct
dependency on openssl. This is due to the use of the "BIGNUM *" type.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: Rename rsa-checksum.c to hash-checksum.c
Alexandru Gagniuc [Fri, 19 Feb 2021 18:45:10 +0000 (12:45 -0600)]
lib: Rename rsa-checksum.c to hash-checksum.c

rsa-checksum.c sontains the hash_calculate() implementations. Despite
the "rsa-" file prefix, this function is useful for other algorithms.

To prevent confusion, move this file to lib/, and rename it to
hash-checksum.c, to give it a more "generic" feel.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Wed, 14 Apr 2021 00:13:26 +0000 (20:13 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sh

-  arm: mach-rmobile: Add CPU info support for RZ/G2

3 years agoarm: mach-rmobile: Add CPU info support for RZ/G2
Biju Das [Wed, 17 Mar 2021 14:11:50 +0000 (14:11 +0000)]
arm: mach-rmobile: Add CPU info support for RZ/G2

Add CPU info support for RZ/G2 SoC's.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agoMerge branch '2021-04-13-assorted-improvements'
Tom Rini [Tue, 13 Apr 2021 13:50:45 +0000 (09:50 -0400)]
Merge branch '2021-04-13-assorted-improvements'

- A large assortment of bug fixes, code cleanups and a few feature
  enhancements.

3 years agocmd: exit: Fix return value
Marek Vasut [Tue, 6 Apr 2021 12:00:24 +0000 (14:00 +0200)]
cmd: exit: Fix return value

In case exit is called in a script without parameter, the command
returns -2 ; in case exit is called with a numerical parameter,
the command returns -2 and lower. This leads to the following problem:
=> setenv foo 'echo bar ; exit 1' ; run foo ; echo $?
bar
0
=> setenv foo 'echo bar ; exit 0' ; run foo ; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2' ; run foo ; echo $?
bar
0
That is, no matter what the 'exit' command argument is, the return
value is always 0 and so it is not possible to use script return
value in subsequent tests.

Fix this and simplify the exit command such that if exit is called with
no argument, the command returns 0, just like 'true' in cmd/test.c. In
case the command is called with any argument that is positive integer,
the argument is set as return value.
=> setenv foo 'echo bar ; exit 1' ; run foo ; echo $?
bar
1
=> setenv foo 'echo bar ; exit 0' ; run foo ; echo $?
bar
0
=> setenv foo 'echo bar ; exit -2' ; run foo ; echo $?
bar
0

Note that this does change ABI established in 2004 , although it is
unclear whether that ABI was originally OK or not.

Fixes: c26e454dfc6
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agoscmi: translate the resource only when livetree is not activated
Patrick Delaunay [Tue, 30 Mar 2021 13:29:03 +0000 (15:29 +0200)]
scmi: translate the resource only when livetree is not activated

Call the translation function on the ofnode_read_resource result only
when the livetree is not activated.

Today of_address_to_resource() calls ofnode_read_resource() for livetree
support and fdt_get_resource() when livetree is not supported.

The fdt_get_resource() doesn't do the address translation
so when it is required when livetree is activated but this address
translation is already done by ofnode_read_resource().

Fixes: 240720e9052f ("firmware: scmi: mailbox/smt agent device")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: Drop dm_gpio_set_dir()
Simon Glass [Tue, 23 Mar 2021 01:52:07 +0000 (14:52 +1300)]
gpio: Drop dm_gpio_set_dir()

This function is not used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: i2c-gpio: Drop use of dm_gpio_set_dir()
Simon Glass [Tue, 23 Mar 2021 01:52:06 +0000 (14:52 +1300)]
gpio: i2c-gpio: Drop use of dm_gpio_set_dir()

This is the only driver that uses this function. Update it to use the
alternative which is dm_gpio_clrset_flags().

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Harm Berntsen <harm.berntsen@nedap.com>
3 years agoqemu: arm: select QFW, MMIO on qemu-arm
Asherah Connor [Fri, 19 Mar 2021 07:21:43 +0000 (18:21 +1100)]
qemu: arm: select QFW, MMIO on qemu-arm

Select CMD_QFW and QFW_MMIO in the qemu-arm board (covers arm and
arm64).

Signed-off-by: Asherah Connor <ashe@kivikakk.ee>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoqemu: add MMIO driver for QFW
Asherah Connor [Fri, 19 Mar 2021 07:21:42 +0000 (18:21 +1100)]
qemu: add MMIO driver for QFW

Add MMIO driver for QFW.

Note that there is no consumer as of this patch.

Signed-off-by: Asherah Connor <ashe@kivikakk.ee>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agotest: qemu: add qfw sandbox driver, dm tests, qemu tests
Asherah Connor [Fri, 19 Mar 2021 07:21:41 +0000 (18:21 +1100)]
test: qemu: add qfw sandbox driver, dm tests, qemu tests

A sandbox driver and test are added for the qfw uclass, and a test in
QEMU added for qfw functionality to confirm it doesn't break in real
world use.

Signed-off-by: Asherah Connor <ashe@kivikakk.ee>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: qemu: move QFW to its own uclass
Asherah Connor [Fri, 19 Mar 2021 07:21:40 +0000 (18:21 +1100)]
x86: qemu: move QFW to its own uclass

We move qfw into its own uclass and split the PIO functions into a
specific driver for that uclass.  The PIO driver is selected in the
qemu-x86 board config (this covers x86 and x86_64).

include/qfw.h is cleaned up and documentation added.

Signed-off-by: Asherah Connor <ashe@kivikakk.ee>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoscmi: correctly configure MMU for SCMI buffer
Patrick Delaunay [Tue, 16 Mar 2021 08:29:40 +0000 (09:29 +0100)]
scmi: correctly configure MMU for SCMI buffer

Align the MMU area for SCMI shared buffer on section size;
use the ALIGN macro in mmu_set_region_dcache_behaviour call.

Since commit d877f8fd0f09 ("arm: provide a function for boards init
code to modify MMU virtual-physical map") the parameter of
mmu_set_region_dcache_behaviour need to be MMU_SECTION_SIZE
aligned.

Fixes: 240720e9052f ("firmware: scmi: mailbox/smt agent device")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agomoveconfig.py: add to the "do not process" list
Trevor Woerner [Mon, 15 Mar 2021 16:01:33 +0000 (12:01 -0400)]
moveconfig.py: add to the "do not process" list

Skip the processing of *.aml and *.dat files while iterating through the
source in order to process header files.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
3 years agocheckpatch: Add warnings for using strn(cat|cpy)
Sean Anderson [Thu, 11 Mar 2021 05:15:45 +0000 (00:15 -0500)]
checkpatch: Add warnings for using strn(cat|cpy)

strn(cat|cpy) has a bad habit of not nul-terminating the destination,
resulting in constructions like

strncpy(foo, bar, sizeof(foo) - 1);
foo[sizeof(foo) - 1] = '\0';

However, it is very easy to forget about this behavior and accidentally
leave a string unterminated. This has shown up in some recent coverity
scans [1, 2] (including code recently touched by yours truly).

Fortunately, the guys at OpenBSD came up with strl(cat|cpy), which always
nul-terminate strings. These functions are already in U-Boot, so we should
encourage new code to use them instead of strn(cat|cpy).

[1] https://lists.denx.de/pipermail/u-boot/2021-March/442888.html
[2] https://lists.denx.de/pipermail/u-boot/2021-January/438073.html

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofastboot: Fix possible buffer overrun
Sean Anderson [Thu, 11 Mar 2021 05:15:44 +0000 (00:15 -0500)]
fastboot: Fix possible buffer overrun

This fixes several uses of strn(cpy|cat) which did not terminate their
destinations properly.

Fixes de1728ce4c ("fastboot: Allow u-boot-style partitions")

Reported-by: Coverity Scan
Signed-off-by: Sean Anderson <seanga2@gmail.com>
3 years agotest: Add test for strlcat
Sean Anderson [Thu, 11 Mar 2021 05:15:43 +0000 (00:15 -0500)]
test: Add test for strlcat

This test is adapted from glibc, which is very concerned about alignment.
It also tests strlcpy by dependency.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: string: Implement strlcat
Sean Anderson [Thu, 11 Mar 2021 05:15:42 +0000 (00:15 -0500)]
lib: string: Implement strlcat

This introduces strlcat, which provides a safer interface than strncat. It
never copies more than its size bytes, including the terminating nul. In
addition, it never reads past dest[size - 1], even if dest is not
nul-terminated.

This also removes the stub for dwc3 now that we have a proper
implementation.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: string: Fix strlcpy return value
Sean Anderson [Thu, 11 Mar 2021 05:15:41 +0000 (00:15 -0500)]
lib: string: Fix strlcpy return value

strlcpy should always return the number of bytes copied. We were
accidentally missing the nul-terminator. We also always used to return a
non-zero value, even if we did not actually copy anything.

Fixes: 23cd138503 ("Integrate USB gadget layer and USB CDC driver layer")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
3 years agotee: optee: Change printing during optee_probe
Ilias Apalodimas [Wed, 10 Mar 2021 13:35:11 +0000 (15:35 +0200)]
tee: optee: Change printing during optee_probe

Right now the error messages when optee has a version mismatch or shared
memory is not configured are done with a debug().
That's not very convenient since you have to enable debugging to figure
out what's going on, although this is an actual error.

So let's switch the debug() -> dev_err() and report those explicitly.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>