]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agocommon: add fdt_simplefb_enable_and_mem_rsv function
Patrick Delaunay [Mon, 15 Nov 2021 15:32:21 +0000 (16:32 +0100)]
common: add fdt_simplefb_enable_and_mem_rsv function

Add a new function to activate an existing simple frame buffer node
and add the associated reserved memory, with no-map properties.

This device tree update is only done when the video device is active
and the video buffer is used.

This patch uses '#if CONFIG_IS_ENABLED(DM_VIDEO)' because
gd->video_bottom and gd->video_top are only defined when CONFIG_DM_VIDEO
is activated.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agovideo: Add video_is_active function
Patrick Delaunay [Mon, 15 Nov 2021 15:32:20 +0000 (16:32 +0100)]
video: Add video_is_active function

Add the helper function video_is_active() to test if one video device
is active.

This function can be used in board code to execute operation
only when the display is probed / really used.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agocommon: rename functions lcd_dt_simplefb to fdt_simplefb
Patrick Delaunay [Mon, 15 Nov 2021 15:32:19 +0000 (16:32 +0100)]
common: rename functions lcd_dt_simplefb to fdt_simplefb

Rename the function named lcd_dt_simplefb* to fdt_simplefb* to be aligned
with the associated file name fdt_simplefb.h/fdt_simplefb.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
3 years agocommon: rename lcd_simplefb.c file to fdt_simplefb.c
Patrick Delaunay [Mon, 15 Nov 2021 15:32:18 +0000 (16:32 +0100)]
common: rename lcd_simplefb.c file to fdt_simplefb.c

Rename the file lcd_simplefb.c to fdt_simplefb.c to be aligned
with the configuration name and with the associated include file
./include/fdt_simplefb.h

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoConvert CONFIG_LCD_DT_SIMPLEFB to Kconfig
Patrick Delaunay [Mon, 15 Nov 2021 15:32:17 +0000 (16:32 +0100)]
Convert CONFIG_LCD_DT_SIMPLEFB to Kconfig

This converts the following to Kconfig:
   CONFIG_LCD_DT_SIMPLEFB

This patch also renames this config to CONFIG_FDT_SIMPLEFB as the code in
common/lcd_simplefb.c support CONFIG_LCD and CONFIG_VIDEO.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
3 years agostm32mp1: ram: remove tuning support
Patrick Delaunay [Mon, 15 Nov 2021 14:32:30 +0000 (15:32 +0100)]
stm32mp1: ram: remove tuning support

Remove the DDR interactive command tuning, as the support of a predefined
DDR PHY tuning is removed for STM32MP1 driver in SPL and in TF-A
and the result of this tuning will be never used.

Moreover this SW tuning procedure can failed on some hardware
configuration (to many BIST errors and no convergence); it will be no
more supported in the next delivery of the DDR utilities included in
the CubeMX tool of STMicroelectronics.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agostm32mp1: ram: remove the support of calibration result
Patrick Delaunay [Mon, 15 Nov 2021 14:32:29 +0000 (15:32 +0100)]
stm32mp1: ram: remove the support of calibration result

The support of a predefined DDR PHY tuning result is removed for
STM32MP1 driver because it is not needed at the supported frequency
when built-in calibration is executed.

The calibration parameters were provided in the device tree by the
optional node "st,phy-cal", activated in ddr helper file by the
compilation flag DDR_PHY_CAL_SKIP and filled with values generated
by the CubeMX DDR utilities.

This patch
- updates the binding file to remove "st,phy-cal" support
- updates the device trees and remove the associated defines
- simplifies the STM32MP1 DDR driver and remove the support of
  the optional parameter "st,phy-cal"

After this patch, the built-in calibration is always executed
and the calibration registers are moved in the phy dynamic part;
that allows manual tests.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agostm32mp1: ram: add read valid training support
Patrick Delaunay [Mon, 15 Nov 2021 14:32:28 +0000 (15:32 +0100)]
stm32mp1: ram: add read valid training support

Add the read data eye training = training for optimal read valid placement
(RVTRN) when the built-in calibration is executed for LPDDR2 and LPDDR3.

This training is supported on the PUBL integrated in the STM32MP15x
DDR subsystem and it is not required for DDR3.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoARM: dts: stm32: Auto-detect DHSOM with uSD level translator
Marek Vasut [Sat, 13 Nov 2021 02:29:44 +0000 (03:29 +0100)]
ARM: dts: stm32: Auto-detect DHSOM with uSD level translator

The uSD level translator on DHSOM and Avenger96 are optional, however it
is possible to auto-detect it. This is done by setting SD CMD line high,
and then testing whether signal level on CK line matches the signal level
on CKIN line. If so, the uSD level translator is present, otherwise it is
not populated.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agommc: stm32_sdmmc2: Add support for probing bus voltage level translator
Marek Vasut [Sat, 13 Nov 2021 02:29:43 +0000 (03:29 +0100)]
mmc: stm32_sdmmc2: Add support for probing bus voltage level translator

Add support for testing whether bus voltage level translator is present
and operational. This is useful on systems where the bus voltage level
translator is optional, as the translator can be auto-detected by the
driver and the feedback clock functionality can be disabled if it is
not present.

The translator test sets CMD high to avoid interfering with a card, and
then verifies whether signal set on CK is detected on CKIN. If the signal
is detected, translator is present, otherwise the CKIN feedback clock are
disabled.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Yann Gautier <yann.gautier@foss.st.com>
3 years agoARM: stm32: Enable KSZ90x1 PHY driver on DHCOR
Marek Vasut [Sat, 13 Nov 2021 02:28:03 +0000 (03:28 +0100)]
ARM: stm32: Enable KSZ90x1 PHY driver on DHCOR

Enable KSZ9x01 PHY driver in DHCOR common configuration, since the
AV96 board has this PHY populated on the PCB.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Add custom PHY reset bindings on AV96
Marek Vasut [Sat, 13 Nov 2021 02:27:37 +0000 (03:27 +0100)]
ARM: dts: stm32: Add custom PHY reset bindings on AV96

The ethernet PHY must be reset on AV96, however DWMAC currently does
not support the MDIO-bus PHY GPIO reset bindings and the ethernet MAC
PHY reset property is going away on next DT sync. Add PHY specific
reset bindings to trigger the PHY reset and fix sporadic ethernet
malfunctions, until the next DT sync.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: stm32: Fix SoM and board coding strap GPIO handling on DHSOM
Marek Vasut [Sat, 13 Nov 2021 02:26:39 +0000 (03:26 +0100)]
ARM: stm32: Fix SoM and board coding strap GPIO handling on DHSOM

The variables retaining the strap values have to be initialized, always,
make it so. Moreover, free the requested GPIO list at the end to avoid
wasting memory.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: stm32: Increase PHY auto-negotiation timeout to 20s on DHSOM
Marek Vasut [Sat, 13 Nov 2021 02:26:05 +0000 (03:26 +0100)]
ARM: stm32: Increase PHY auto-negotiation timeout to 20s on DHSOM

The Micrel PHYs on known DHSOM based boards take a while to come out
of reset, increase the auto-negotiation timeout to prevent it from
timing out in case the ethernet is used right after the board was
reset.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: stm32: Add update_sf script to install U-Boot into SF on DHSOM
Marek Vasut [Sat, 13 Nov 2021 02:25:13 +0000 (03:25 +0100)]
ARM: stm32: Add update_sf script to install U-Boot into SF on DHSOM

Add script to read U-Boot from SD card and write it to matching
locations in the SPI NOR, thus making the SPI NOR bootable. The
script erases the entire SPI NOR, including U-Boot environment,
to make sure the installation is clean. To retain environment
from current running U-Boot, run 'saveenv' after running the
'update_sf' script.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: stm32: Increase USB power-good delay on DHSOM
Marek Vasut [Sat, 13 Nov 2021 02:24:44 +0000 (03:24 +0100)]
ARM: stm32: Increase USB power-good delay on DHSOM

The USB hub on STM32MP1 DHCOM boards needs to wait a bit longer until
the USB Vbus is stable. Increase the USB power-good delay to 1 s.

This adds default-undefined STM32MP_BOARD_EXTRA_ENV variable into
stm32mp15_common.h to reduce duplication in board-specific config
files adding custom environment.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agopinctrl: stmfx: define LOG_CATEGORY
Patrick Delaunay [Wed, 10 Nov 2021 17:14:10 +0000 (18:14 +0100)]
pinctrl: stmfx: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32429i-eval-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:20 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32429i-eval-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32f746g-eval-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:19 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32f746g-eval-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32f429-disco-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:18 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32f429-disco-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32f469-disco-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:17 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32f469-disco-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32f7-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:16 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32f7-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32746-disco-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:15 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32746-disco-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32f769-disco-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:14 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32f769-disco-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Use lower-case hex for address for stm32mp15-u-boot.dtsi
Patrice Chotard [Mon, 15 Nov 2021 10:39:13 +0000 (11:39 +0100)]
ARM: dts: stm32: Use lower-case hex for address for stm32mp15-u-boot.dtsi

Replace upper-case hex with lower-case hex for address.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoMerge tag 'v2022.01-rc3' into next
Tom Rini [Mon, 29 Nov 2021 17:00:57 +0000 (12:00 -0500)]
Merge tag 'v2022.01-rc3' into next

Prepare v2022.01-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoPrepare v2022.01-rc3
Tom Rini [Mon, 29 Nov 2021 16:16:03 +0000 (11:16 -0500)]
Prepare v2022.01-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoboard: iot2050: update build documentation for OP-TEE
Ivan Mikhaylov [Sun, 28 Nov 2021 21:57:01 +0000 (21:57 +0000)]
board: iot2050: update build documentation for OP-TEE

Set ta-target explicitly to correspond with OP-TEE recipe in
siemens/meta-iot2050.

Errors without explicit set of ta-target:
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mthumb’
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mno-unaligned-access’
aarch64-linux-gnu-gcc: error: unrecognized command-line option ‘-mfloat-abi=hard’
make: *** [mk/compile.mk:159: out/arm-plat-k3/ta_arm32-lib/libdl/dlfcn.o] Error 1

Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
3 years agoqemu: common: Fix build with update capsule
Vincent Stehlé [Wed, 24 Nov 2021 14:54:20 +0000 (15:54 +0100)]
qemu: common: Fix build with update capsule

The common emulation Makefile has a dependency on a non-existent
qemu_capsule.o when building with support for capsule update enabled
(CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y).
The code which was in qemu_capsule.c has been completely moved to
lib/efi_loader/efi_capsule.c by commit 7a6fb28c8e4b ("efi_loader: capsule:
add back efi_get_public_key_data()").
Remove the false dependency.

This fixes the following build error:

  make[1]: *** No rule to make target 'board/emulation/common/qemu_capsule.o', needed by 'board/emulation/common/built-in.o'.  Stop.

Fixes: commit 47a25e81d35c ("Revert "efi_capsule: Move signature from DTB to .rodata"")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Simon Glass <sjg@chromium.org>
3 years agofastboot: Add maintainers entry
Sean Anderson [Wed, 24 Nov 2021 04:33:11 +0000 (23:33 -0500)]
fastboot: Add maintainers entry

Add an entry in maintainers for fastboot. It is starting off orphaned, but
hopefully someone can pick it up.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
3 years agoclk: Add myself as a maintainer for the clock subsystem
Sean Anderson [Wed, 24 Nov 2021 04:23:40 +0000 (23:23 -0500)]
clk: Add myself as a maintainer for the clock subsystem

Lukasz has not been very responsive in reviewing clock patches. Add
myself as a maintainer.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
3 years agoMerge tag 'dm-pull-28nov21' of https://source.denx.de/u-boot/custodians/u-boot-dm...
Tom Rini [Mon, 29 Nov 2021 01:38:01 +0000 (20:38 -0500)]
Merge tag 'dm-pull-28nov21' of https://source.denx.de/u-boot/custodians/u-boot-dm into next

SPI flash documentation and tidy-ups
Various driver model enhancements
Fix up some missing unit tests with pytest

3 years agotest/py: Raise a ValueError if a command fails
Simon Glass [Sat, 23 Oct 2021 23:26:12 +0000 (17:26 -0600)]
test/py: Raise a ValueError if a command fails

At present an Exception is raised if a command fails. This is a very broad
class and makes it difficult for callers to catch the error without also
catching other things, like programming bugs.

Change it to ValueError to make this easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: Relax the naming rules for unit tests
Simon Glass [Sat, 23 Oct 2021 23:26:11 +0000 (17:26 -0600)]
test/py: Relax the naming rules for unit tests

At present the collection function used by pytest is quite strict on the
naming of the functions it detects. In particular it requires the name of
the test to be repeated in the function name.

This is not enforced anywhere else, but instead the tests are silently
omitted from the pytest run. This affects a few dozen tests.

The rule does not seem to have any particular purpose. Relax it, so that
all tests that use the UNIT_TEST() macro will run, regardless of the name
of the test function.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Enable HEXDUMP for sandbox_flattree
Simon Glass [Sat, 23 Oct 2021 23:26:10 +0000 (17:26 -0600)]
sandbox: Enable HEXDUMP for sandbox_flattree

At present the hexdump tests are disabled in sandbox_flattree. This is
good, because they do not pass. Enable the required Kconfig so that they
will, when enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a way to count the devices in a uclass
Simon Glass [Sat, 23 Oct 2021 23:26:09 +0000 (17:26 -0600)]
dm: core: Add a way to count the devices in a uclass

Add a function that returns the number of devices in a uclass. This can be
helpful in sizing an array that needs to hold a list of them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Allow finding children / uclasses by partial name
Simon Glass [Sat, 23 Oct 2021 23:26:08 +0000 (17:26 -0600)]
dm: core: Allow finding children / uclasses by partial name

In some cases it is useful to search just by a partial name, such as
when looking for a sibling device that has a common name substring. Add
helper functions to handle these requirements.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a way to obtain a string list
Simon Glass [Sat, 23 Oct 2021 23:26:07 +0000 (17:26 -0600)]
dm: core: Add a way to obtain a string list

At present we support reading a string list a string at a time. Apart
from being inefficient, this makes it impossible to separate reading of
the devicetree into the of_to_plat() method where it belongs, since any
code which needs access to the string must read it from the devicetree.

Add a function which returns the string property as an array of pointers
to the strings, which is easily used by clients.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Fix up string-function documentation
Simon Glass [Sat, 23 Oct 2021 23:26:06 +0000 (17:26 -0600)]
dm: core: Fix up string-function documentation

The details for of_property_read_string_helper() and
ofnode_read_string_index() are a little inaccurate. Fix up the comments to
avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Fix handling of uclass pre_unbind method
Simon Glass [Sat, 23 Oct 2021 23:26:05 +0000 (17:26 -0600)]
dm: core: Fix handling of uclass pre_unbind method

This method is currently called after the platform data has been freed.
But the pre_unbind() method may wish to access this, e.g. to free some
data structures stored there.

Split the unbinding of devices into two pieces, as is done with removal.
This corrects the problem.

Also tidy a code-style issue in device_remove() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add tests for stringlist functions
Simon Glass [Sat, 23 Oct 2021 23:26:04 +0000 (17:26 -0600)]
dm: core: Add tests for stringlist functions

These functions currently lack tests so add some. The error handling
differs betwee livetree and flattree at present, so only check the error
codes with livetree.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocommon: Allow a smaller console-recording pre-reloc
Simon Glass [Sat, 23 Oct 2021 23:26:03 +0000 (17:26 -0600)]
common: Allow a smaller console-recording pre-reloc

Before relocation there is generally not as much available memory and not
that much console output. At present the console-output buffer is the same
side before and after relocation. Add a separate Kconfig option to remove
this limitation.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodisk: part_dos: Fix a NULL pointer error
Simon Glass [Sat, 23 Oct 2021 23:26:02 +0000 (17:26 -0600)]
disk: part_dos: Fix a NULL pointer error

When ext is NULL we cannot dereference it. Update the code flow to avoid
this, so that layout_mbr_partitions() can be used with partition tables
that do not include an extended partition.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agombr: Correct verification check
Simon Glass [Sat, 23 Oct 2021 23:26:01 +0000 (17:26 -0600)]
mbr: Correct verification check

At present this command considers the partitions to be identical if the
start and size are smaller than expected. It should check that they are
the same. Fix this and tidy up the code style a little.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agommc: Allow for children other than the block device
Simon Glass [Sat, 23 Oct 2021 23:26:00 +0000 (17:26 -0600)]
mmc: Allow for children other than the block device

At present the MMC uclass assumes that the only child it can have is a
block device. Update this so we can add a bootmethod too.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: mmc: Support a backing file
Simon Glass [Sat, 23 Oct 2021 23:25:59 +0000 (17:25 -0600)]
sandbox: mmc: Support a backing file

Provide a way for sandbox MMC to present data from a backing file. This
allows a filesystem to be created on the host and easily served via an
emulated mmc device.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Support unmapping a file
Simon Glass [Sat, 23 Oct 2021 23:25:58 +0000 (17:25 -0600)]
sandbox: Support unmapping a file

Add the opposite of mapping, so that we can unmap and avoid running out of
address space.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: Allow passing input to a program
Simon Glass [Sat, 23 Oct 2021 23:25:57 +0000 (17:25 -0600)]
test/py: Allow passing input to a program

When running a program on the host, allow input to be passed in as stdin.
This is needed for running sfdisk, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Fix extract command for using non-absolute image paths
Jan Kiszka [Thu, 11 Nov 2021 07:14:18 +0000 (08:14 +0100)]
binman: Fix extract command for using non-absolute image paths

Otherwise the updated image will end up in the temporary folder that is
purged after completion.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agosf: doc: Add documentation for the 'sf' command
Simon Glass [Sun, 19 Sep 2021 21:49:35 +0000 (15:49 -0600)]
sf: doc: Add documentation for the 'sf' command

This command is fairly complicated so documentation is useful.
Unfortunately I an not sure how the MTD side of things works and cannot
find information about that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agosf: Tidy up code to avoid #ifdef
Simon Glass [Sun, 19 Sep 2021 21:49:34 +0000 (15:49 -0600)]
sf: Tidy up code to avoid #ifdef

Update this code to use IS_ENABLED() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agosf: Use const for the stage name
Simon Glass [Sun, 19 Sep 2021 21:49:33 +0000 (15:49 -0600)]
sf: Use const for the stage name

This is not updated at runtime so should be marked const. Update the code
accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocommand: Use a constant pointer for the help
Simon Glass [Sun, 19 Sep 2021 21:49:32 +0000 (15:49 -0600)]
command: Use a constant pointer for the help

This text should never change during execution, so it makes sense to
use a const char * so that it can be declared as const in the code.
Update struct cmd_tbl with a const char * pointer for 'help'.

We cannot make usage const because of the bmode command, used on mx53ppd
for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoenv: Avoid using GNU features in awk
Simon Glass [Wed, 24 Nov 2021 14:40:14 +0000 (07:40 -0700)]
env: Avoid using GNU features in awk

GNU has a very useful third argument to match() but this is not supported
in the POSIX awk.

Update the code to cope, so that the script is POSIX-compliant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Mark Kettenis <mark.kettenis@xs4all.nl>
3 years agoMerge tag 'efi-2022-01-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 26 Nov 2021 22:10:53 +0000 (17:10 -0500)]
Merge tag 'efi-2022-01-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-01-rc3-2

Test:
* fix pylint warnings

UEFI:
* disable interrupts before removing devices in ExitBootServices()
* implement poweroff in efi_system_reset() on sandbox
* allow booting via EFI even if some block device fails

3 years agotest: fix pylint error in u_boot_console_exec_attach.py
Heinrich Schuchardt [Mon, 22 Nov 2021 23:01:49 +0000 (00:01 +0100)]
test: fix pylint error in u_boot_console_exec_attach.py

* provide module docstring

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: fix pylint error in u_boot_console_sandbox.py
Heinrich Schuchardt [Mon, 22 Nov 2021 23:01:48 +0000 (00:01 +0100)]
test: fix pylint error in u_boot_console_sandbox.py

* provide module docstring

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: fix pylint errors in u_boot_utils.py
Heinrich Schuchardt [Mon, 22 Nov 2021 23:01:47 +0000 (00:01 +0100)]
test: fix pylint errors in u_boot_utils.py

* there is no os.path.unlink() method
* don't inherit from object
* add module docstring
* move imports to the top
* avoid unused variable

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: fix pylint errors in u_boot_spawn.py
Heinrich Schuchardt [Mon, 22 Nov 2021 23:01:46 +0000 (00:01 +0100)]
test: fix pylint errors in u_boot_spawn.py

* don't inherit from object
* imports should be on the top level
* avoid unused variable names
* avoid unnecessary else after raise

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: fix pylint errors in multiplexed_log.py
Heinrich Schuchardt [Mon, 22 Nov 2021 23:01:45 +0000 (00:01 +0100)]
test: fix pylint errors in multiplexed_log.py

* don't inherit from object
* remove superfluous comprehension
* add module docstring

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoefi_selftest: simplify endian conversion for FDT test
Heinrich Schuchardt [Thu, 25 Nov 2021 17:55:09 +0000 (18:55 +0100)]
efi_selftest: simplify endian conversion for FDT test

UEFI code is always little-endian. Remove a superfluous test.

Remove a superfluous type conversion.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi_loader: segfault in efi_clear_os_indications()
Heinrich Schuchardt [Sat, 20 Nov 2021 10:53:12 +0000 (11:53 +0100)]
efi_loader: segfault in efi_clear_os_indications()

If we call efi_clear_os_indications() before initializing the memory store
for UEFI variables a NULL pointer dereference occurs.

The error was observed on the sandbox with:

    usb start
    host bind 0 sandbox.img
    load host 0:1 $kernel_addr_r helloworld.efi
    bootefi $kernel_addr_r

Here efi_resister_disk() failed due to an error in the BTRFS implementation.

Move the logic to clear EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED
to the rest of the capsule code.

If CONFIG_EFI_IGNORE_OSINDICATIONS=y, we should still clear the flag.
If OsIndications does not exist, we should not create it as it is owned by
the operating system.

Fixes: 149108a3eb59 ("efi_loader: clear OsIndications")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotest: address some pylint warnings
Heinrich Schuchardt [Mon, 22 Nov 2021 07:24:08 +0000 (08:24 +0100)]
test: address some pylint warnings

* remove unused variables
* module description must precede import statements
* fix inconsistent return values

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agosandbox: poweroff in efi_system_reset()
Heinrich Schuchardt [Sat, 20 Nov 2021 13:49:18 +0000 (14:49 +0100)]
sandbox: poweroff in efi_system_reset()

efi_system_reset() should exit if called with EFI_RESET_SHUTDOWN.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoefi_loader: efi_disk_register() should not fail
Heinrich Schuchardt [Sat, 20 Nov 2021 12:56:02 +0000 (13:56 +0100)]
efi_loader: efi_disk_register() should not fail

Our algorithm for creating USB device paths may lead to duplicate device
paths which result in efi_disk_register() failing. Instead we should just
skip devices that cannot be registered as EFI block devices.

Fix a memory leak in efi_disk_add_dev() caused by the duplicate device
path.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 years agoefi: Call bootm_disable_interrupts earlier in efi_exit_boot_services
Tom Rini [Fri, 19 Nov 2021 21:33:04 +0000 (16:33 -0500)]
efi: Call bootm_disable_interrupts earlier in efi_exit_boot_services

If we look at the path that bootm/booti take when preparing to boot the
OS, we see that as part of (or prior to calling do_bootm_states,
explicitly) the process, bootm_disable_interrupts() is called prior to
announce_and_cleanup() which is where udc_disconnect() /
board_quiesce_devices() / dm_remove_devices_flags() are called from.  In
the EFI path, these are called afterwards.  In efi_exit_boot_services()
however we have been calling bootm_disable_interrupts() after the above
functions, as part of ensuring that we disable interrupts as required
by the spec.  However, bootm_disable_interrupts() is also where we go
and call usb_stop().  While this has been fine before, on the TI J721E
platform this leads us to an exception.  This exception seems likely to
be the case that we're trying to stop devices that we have already
disabled clocks for.  The most direct way to handle this particular
problem is to make EFI behave like the do_bootm_states() process and
ensure we call bootm_disable_interrupts() prior to ending up in
usb_stop().

Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Simon Glass <sjg@chromium.org>
Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoMerge branch '2021-11-23-scmi-and-tee-updates' into next
Tom Rini [Tue, 23 Nov 2021 21:24:24 +0000 (16:24 -0500)]
Merge branch '2021-11-23-scmi-and-tee-updates' into next

- A set of SCMI and TEE related updates

3 years agofirmware: scmi: Add OP-TEE transport
Etienne Carriere [Tue, 9 Nov 2021 16:08:24 +0000 (17:08 +0100)]
firmware: scmi: Add OP-TEE transport

This change implements an SCMI transport for agent interfacing the
OP-TEE SCMI service. OP-TEE provides an SCMI PTA (Pseudo-TA) for
non-secure world to send SCMI messages over an identified channel.
The driver implemented here uses a SMT shared memory for passing
messages between client and server.

The implementation opens and releases channel resources for each
passed SCMI message so that resources allocated (sessions) or
registered (shared memory areas) in OP-TEE firmware are released for
example before relocation as the driver will likely allocate/register
them back when probed after relocation.

The integration of the driver using dedicated config switch
CONFIG_SCMI_AGENT_OPTEE is designed on the model posted to the
U-Boot ML by Patrick Delaunay [1].

Link: [1] https://lore.kernel.org/all/20211028191222.v3.4.Ib2e58ee67f4d023823d8b5404332dc4d7e847277@changeid/
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodt-bindings: arm: scmi: OP-TEE as transport channel for SCMI messages
Etienne Carriere [Tue, 9 Nov 2021 16:08:23 +0000 (17:08 +0100)]
dt-bindings: arm: scmi: OP-TEE as transport channel for SCMI messages

Introduce compatible "linaro,scmi-optee" for SCMI transport channel
based on an OP-TEE service invocation.

Define "linaro,optee-channel-id" property to identify the OP-TEE SCMI
channel used by the protocol(s). OP-TEE SCMI transport can either use
shared memory or a static shared memory buffer identified by the DT.

These bindings were posted to the Linux kernel DT bindings mailing list
and acked by maintainer [1].

Link: [1] https://lore.kernel.org/linux-arm-kernel/20211029102118.GG6526@e120937-lin/T/
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agotee: optee: define TEE error code TEE_ERROR_SHORT_BUFFER
Etienne Carriere [Tue, 9 Nov 2021 16:08:22 +0000 (17:08 +0100)]
tee: optee: define TEE error code TEE_ERROR_SHORT_BUFFER

Adds TEE_ERROR_SHORT_BUFFER as TEE error code. This error code is
commonly used by TEEs to inform caller that the buffer(s) it provided
is too small for the desired operation.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agotee: optee: remove unused duplicated login Id macros
Etienne Carriere [Tue, 9 Nov 2021 16:08:21 +0000 (17:08 +0100)]
tee: optee: remove unused duplicated login Id macros

Remove unused OPTEE_MSG_LOGIN_* ID macros as suitable TEE_LOGIN_* ID
macros are already defined tee.h.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agotee: define session login identifiers
Etienne Carriere [Tue, 9 Nov 2021 16:08:20 +0000 (17:08 +0100)]
tee: define session login identifiers

Define identifiers for clnt_login field in struct tee_open_session_arg
based in GlobalPlatform Device TEE IDs and on the REE_KERNEL identifier
extension from OP-TEE OS.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agofirmware: scmi: smccc transport: simplify probe sequence
Etienne Carriere [Mon, 8 Nov 2021 07:56:11 +0000 (08:56 +0100)]
firmware: scmi: smccc transport: simplify probe sequence

Minor simplification in scmi_smccc_probe() exit sequence.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agofirmware: scmi: smccc transport: use plat data, not priv data
Etienne Carriere [Mon, 8 Nov 2021 07:56:10 +0000 (08:56 +0100)]
firmware: scmi: smccc transport: use plat data, not priv data

Change SCMI smccc transport drivers to use platform data rather
than private data for channel reference since it only stores platform
data retrieved from the DT. Consequently the probe handler is replaced
with a of_to_plat handler.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agofirmware: scmi: mailbox transport: use plat data, not priv data
Etienne Carriere [Mon, 8 Nov 2021 07:56:09 +0000 (08:56 +0100)]
firmware: scmi: mailbox transport: use plat data, not priv data

Change SCMI mailbox transport drivers to use platform data rather
than private data for channel reference since it only stores platform
data retrieved from the DT. Consequently the probe handler is replaced
with a of_to_plat handler.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agofirmware: scmi: mailbox transport: fix probe failure implementation
Etienne Carriere [Mon, 8 Nov 2021 07:56:08 +0000 (08:56 +0100)]
firmware: scmi: mailbox transport: fix probe failure implementation

Correct scmi mailbox probe function that can't free the scmi channel
instance since its auto-allocated by the device model framework.

Cc: Simon Glass <sjg@chromium.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agofirmware: scmi: fix description of an API function
Etienne Carriere [Mon, 8 Nov 2021 07:56:07 +0000 (08:56 +0100)]
firmware: scmi: fix description of an API function

Correct inline comment describing API function devm_scmi_process_msg().

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agostm32mp15: deactivate CONFIG_SCMI_AGENT_MAILBOX
Patrick Delaunay [Thu, 28 Oct 2021 17:13:16 +0000 (19:13 +0200)]
stm32mp15: deactivate CONFIG_SCMI_AGENT_MAILBOX

Deactivate the SCMI agent mailbox which is not used on STM32MP15
platforms.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agofirmware: scmi: add configs to select the supported agents
Patrick Delaunay [Thu, 28 Oct 2021 17:13:15 +0000 (19:13 +0200)]
firmware: scmi: add configs to select the supported agents

Add two configs CONFIG_SCMI_AGENT_MAILBOX and CONFIG_SCMI_AGENT_SMCCC
to select the supported agents as all the agents are not supported.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agopower: regulator: scmi: define LOG_CATEGORY
Patrick Delaunay [Thu, 28 Oct 2021 17:13:14 +0000 (19:13 +0200)]
power: regulator: scmi: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoclk: scmi: define LOG_CATEGORY
Patrick Delaunay [Thu, 28 Oct 2021 17:13:13 +0000 (19:13 +0200)]
clk: scmi: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agoreset: scmi: define LOG_CATEGORY
Patrick Delaunay [Thu, 28 Oct 2021 17:13:12 +0000 (19:13 +0200)]
reset: scmi: define LOG_CATEGORY

Define LOG_CATEGORY to allow filtering with log command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
3 years agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net into next
Tom Rini [Tue, 23 Nov 2021 12:43:50 +0000 (07:43 -0500)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net into next

- Various DSA additions
- bootp: fix for VCI string
- tsec: support for promiscuous mode
- add Aspeed MDIO driver

3 years agonet: phy: realtek: Add tx/rx delay config for 8211e
Samuel Holland [Wed, 13 Oct 2021 02:07:32 +0000 (21:07 -0500)]
net: phy: realtek: Add tx/rx delay config for 8211e

Some boards need to change the tx/rx delay config in order for
gigabit Ethernet to work.

In Linux commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e rx/tx
delay config"), Realtek documented the bits for overriding the delays
from the hardware straps.

Copy the logic from linux, so the delay config is set from the PHY's
interface type (the phy-mode property in the device tree).

This removes the need for a one-off workaround for the Pine A64+ board.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agodrivers: net: add Aspeed MDIO driver
Dylan Hung [Tue, 2 Nov 2021 05:41:54 +0000 (13:41 +0800)]
drivers: net: add Aspeed MDIO driver

Add a driver for the MDIO interface for Aspeed AST2600 SOC.  The driver
only supports clause 22 for now.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com>
3 years agonet: tsec: Make redundant_init() static
Bin Meng [Mon, 1 Nov 2021 06:15:12 +0000 (14:15 +0800)]
net: tsec: Make redundant_init() static

redundant_init() is only called in the tsec driver. Make it static.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: fec_mxc: Declare 'promisc' as bool
Bin Meng [Mon, 1 Nov 2021 06:15:11 +0000 (14:15 +0800)]
net: fec_mxc: Declare 'promisc' as bool

priv->promisc is used as the parameter of the set_promisc() call
which accepts a bool type instead of char.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: Use true instead of 1 in the set_promisc() call
Bin Meng [Mon, 1 Nov 2021 06:15:10 +0000 (14:15 +0800)]
net: dsa: Use true instead of 1 in the set_promisc() call

set_promisc() call accepts the parameter of a bool type. Make it
clear by using true instead of 1.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agocmd: pxe_utils: Check fdtcontroladdr in label_boot
Peter Hoyes [Thu, 14 Oct 2021 08:40:04 +0000 (09:40 +0100)]
cmd: pxe_utils: Check fdtcontroladdr in label_boot

If using OF_CONTROL, fdtcontroladdr is set to the fdt used to configure
U-Boot. When using PXE, if no fdt is defined in the menu file, and
there is no fdt at fdt_addr, add fall back on fdtcontroladdr too.

We are developing board support for the Armv8r64 FVP using
config_distro_bootcmd. We are also using OF_BOARD and would like the
PXE boot option to default to the fdt provided by board_fdt_blob_setup.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: bootp: Correct VCI string transmission
Walter Stoll [Tue, 12 Oct 2021 11:01:59 +0000 (11:01 +0000)]
net: bootp: Correct VCI string transmission

The VCI string sent during bootp of U-Boot-SPL is corrupt. This is
because the byte counter is not adjusted within the bootp_extended()
function when the VCI string is added. We fix this.

Signed-off-by: Walter Stoll <walter.stoll@duagon.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconfigs: ls1021a-tsn: enable the generation of random Ethernet MAC addresses
Vladimir Oltean [Wed, 29 Sep 2021 15:04:45 +0000 (18:04 +0300)]
configs: ls1021a-tsn: enable the generation of random Ethernet MAC addresses

Don't fail when booting a board with an empty EEPROM for MAC addresses.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoconfigs: ls1021a-tsn: enable sja1105 switch driver
Vladimir Oltean [Wed, 29 Sep 2021 15:04:44 +0000 (18:04 +0300)]
configs: ls1021a-tsn: enable sja1105 switch driver

The sja1105 is a 5-port switch that uses a DM_DSA driver. Its 5th (CPU)
port is connected internally to the eth2 port of the LS1021A SoC.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoarm: dts: ls1021a-tsn: add sja1105 and eth2 bindings
Vladimir Oltean [Wed, 29 Sep 2021 15:04:43 +0000 (18:04 +0300)]
arm: dts: ls1021a-tsn: add sja1105 and eth2 bindings

The eth aliases are for correct probing order, so that each Ethernet
port will get a predictable MAC address from the environment.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: sja1105: add support for SGMII
Vladimir Oltean [Wed, 29 Sep 2021 15:04:42 +0000 (18:04 +0300)]
net: dsa: sja1105: add support for SGMII

The list of ports which support SGMII depending on switch generation is
available here:
https://www.kernel.org/doc/html/latest/networking/dsa/sja1105.html#port-compatibility-matrix

SGMII can either be used to connect to an external PHY or to the host
port. In the first case, the use of in-band autoneg is expected, in the
last, in-band autoneg is expected to be turned off (fixed-link). So the
driver supports both cases.

SGMII support means configuring the PCS and PMA. The PCS is a Synopsys
Designware XPCS, in Linux this has a separate driver but here it is
embedded within the sja1105 driver. If needed it can be taken out later,
although we would need a UCLASS_PCS for it, which we don't have atm.

Nonetheless, I did go all the way to export an internal MDIO bus for PCS
access, because it is nice to be able to debug the PCS through commands
such as:

=> mdio read ethernet-switch@1-pcs 4 1f.0
Reading from bus ethernet-switch@1-pcs
PHY at address 4:
31.0 - 0x1140

The internal MDIO bus is not registered with DM because there is no
udevice on it, as mentioned. But the XPCS code can still be ripped out,
as needed.

I did not add support for 2500base-x because I do not expect this
interface type to be used as a boot source for anybody, it would just
add unnecessary bloat.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: add driver for NXP SJA1105 L2 switch
Vladimir Oltean [Wed, 29 Sep 2021 15:04:41 +0000 (18:04 +0300)]
net: dsa: add driver for NXP SJA1105 L2 switch

The SJA1105 driver is largely reused from Linux. Its programming model
is that it is blank out of reset, and it waits for a static
configuration stream over SPI, which contains all runtime parameters (it
has no notion of "default values").

Keeping a binary array for the configuration stream would have meant
that aspects such as the CPU port and the MAC speeds could have not been
configured easily, and would have been static and board-dependent.
Live-patching the binary array means recalculating the static config
table CRCs, which is not a fun process.

So we create an abstraction over the static config tables, using the
packing API, same as in Linux. The tables are kept as C structures, and
the binary configuration stream is constructed on-the-go, with CRC and
all.

All static config tables instantiated in this driver are mandatory.
The hardware reference manual can be found at:
https://www.nxp.com/docs/en/user-guide/UM10944.pdf

For tagging, a simplified version of tag_8021q from Linux is used. The
VLAN EtherType is the same (0xdadb) but since we don't want switching in
U-Boot, there is no reason to have a TX VLAN and an RX VLAN for each
port. We just need the RX VLANs to act as the unique pvid of each
front-panel port, to decode the switch port number. The RX VLAN is used
for both RX and TX.

The device tree bindings are the same as in Linux.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: felix: configure the in-band autoneg property based on OF node info
Vladimir Oltean [Wed, 29 Sep 2021 15:04:40 +0000 (18:04 +0300)]
net: dsa: felix: configure the in-band autoneg property based on OF node info

Instead of trying to guess which operating modes need in-band
negotiation to be active and which ones don't, parse the available
information from the device tree. That will be correct in the cases we
can already guess, and more.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: introduce a helper to determine whether to use in-band autoneg
Vladimir Oltean [Wed, 29 Sep 2021 15:04:39 +0000 (18:04 +0300)]
net: introduce a helper to determine whether to use in-band autoneg

Certain serial SERDES protocols like 1000base-x, 2500base-x, SGMII,
USXGMII can operate either in a mode where the PHY (be it on-board or
inside an SFP module) passes the link parameters (speed, duplex, pause)
to the MAC through in-band through control words standardized by IEEE
802.3 clause 37, or in a mode where the MAC must configure (force) its
link parameters based on information obtained out-of-band (MDIO reads,
guesswork etc).

In Linux, the OF node property named "managed" is parsed by the phylink
framework, and the convention is that if a driver uses phylink, then the
presence of this property means that in-band autoneg should be enabled,
otherwise it shouldn't.

To be compatible with the OF node bindings of drivers that use phylink
in Linux, introduce parsing support for this property in U-Boot too.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: dsa: allow drivers to get the port OF node
Vladimir Oltean [Wed, 29 Sep 2021 15:04:38 +0000 (18:04 +0300)]
net: dsa: allow drivers to get the port OF node

In the current DSA switch driver API, only the udevice of the switch
(belonging to UCLASS_DSA) is exposed, as well as an "int port" argument.
So drivers do not have access to the udevice of individual ports
(belonging to UCLASS_ETH), one of the reasons being that not all ports
have an associated UCLASS_ETH udevice.

However, all DSA ports have an OF node, and in some cases the driver
needs a handle to it, for all ports including the CPU port. Example: the
following Linux per-port device tree property:

managed = "in-band-status";

states whether a port should operate with clause 37 in-band autoneg
enabled or not.

This patch exposes a function which can be called by individual drivers
as needed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
3 years agoinclude: import if_vlan.h from Linux
Vladimir Oltean [Wed, 29 Sep 2021 15:04:37 +0000 (18:04 +0300)]
include: import if_vlan.h from Linux

This is needed for the VLAN header structure.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agonet: tsec: add support for promiscuous mode
Vladimir Oltean [Wed, 29 Sep 2021 15:04:36 +0000 (18:04 +0300)]
net: tsec: add support for promiscuous mode

The Freescale TSEC can be a DSA master, and the ports of the attached
DSA switch can have different MAC addresses compared to the TSEC.
Nonetheless, the TSEC must receive the packets on behalf of those switch
ports. Therefore, implement the promiscuous mode method to allow DSA to
set this.

Note that the init_registers() function called from eth_ops :: start
overwrites this setting. There is no reason why the RCTRL register
should be zero-initialized, so just stop clearing it so that the setting
we applied in eth_ops :: set_promisc sticks.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>