]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
21 months agotpm: Separate out the TPM tests for v1 and v2
Simon Glass [Tue, 21 Feb 2023 13:24:51 +0000 (06:24 -0700)]
tpm: Separate out the TPM tests for v1 and v2

Currently there is only one test and it only works on TPM v2. Update it
to work on v1.2 as well, using a new function to pick up the required
TPM.

Update sandbox to include both a v1.2 and v2 TPM so that this works.
Split out the existing test into two pieces, one for init and one for
the v2-only report_state feature.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
21 months agotest: add a test for the new tpm_auto_start() function
Ilias Apalodimas [Sat, 18 Feb 2023 15:21:22 +0000 (17:21 +0200)]
test: add a test for the new tpm_auto_start() function

A prior patch adds a new API function for TPM2.0, which performs
the full startup sequence of the TPM.  Add a selftest for that.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
21 months agotpm: sandbox: Change the return code when device is already open
Ilias Apalodimas [Sat, 18 Feb 2023 15:18:49 +0000 (17:18 +0200)]
tpm: sandbox: Change the return code when device is already open

All the TPM drivers as well as out TCG TIS API for a TPM2.0 device
return -EBUSY if the device has already been opened.  Adjust
the sandbox TPM do return the same error code.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
21 months agoefi_loader: use tpm_auto_start for the tpm device
Ilias Apalodimas [Wed, 25 Jan 2023 11:06:03 +0000 (13:06 +0200)]
efi_loader: use tpm_auto_start for the tpm device

A previous commit is adding a new tpm startup functions which
initializes the TPMv2 and performs all the needed selftests.
Since the TPM selftests might be needed depending on the requested
algorithm or functional module use that instead.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
21 months agotpm: add a function that performs selftest + startup
Ilias Apalodimas [Wed, 25 Jan 2023 10:18:36 +0000 (12:18 +0200)]
tpm: add a function that performs selftest + startup

As described in [0] if a command requires use of an untested algorithm
or functional module, the TPM performs the test and then completes the
command actions.

Since we don't check for TPM_RC_NEEDS_TEST (which is the return code of
the TPM in that case) and even if we would, it would complicate our TPM
code for no apparent reason,  add a wrapper function that performs both
the selftest and the startup sequence of the TPM.

It's worth noting that this is implemented on TPMv2.0.  The code for
1.2 would look similar,  but I don't have a device available to test.

[0]
https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-1-Architecture-01.07-2014-03-13.pdf
§12.3 Self-test modes

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
21 months agoMerge tag 'v2023.04-rc3' into next
Tom Rini [Mon, 27 Feb 2023 22:28:21 +0000 (17:28 -0500)]
Merge tag 'v2023.04-rc3' into next

Prepare v2023.04-rc3

21 months agoDockerfile: Add missing "chmod" of u-boot-gen-combined
Tom Rini [Mon, 27 Feb 2023 15:49:54 +0000 (10:49 -0500)]
Dockerfile: Add missing "chmod" of u-boot-gen-combined

I had added this line locally, rebuild the image, but didn't ensure that
I had committed the correct version of the patch as well.

Fixes: 75b031ee4a96 ("Dockerfile: download binaries for Nokia RX-51")
Signed-off-by: Tom Rini <trini@konsulko.com>
21 months agoPrepare v2023.04-rc3
Tom Rini [Mon, 27 Feb 2023 22:18:36 +0000 (17:18 -0500)]
Prepare v2023.04-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
21 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 27 Feb 2023 14:11:57 +0000 (09:11 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
21 months agoMerge branch '2023-02-24-include-nx51-components-in-docker-for-testing' into next
Tom Rini [Sat, 25 Feb 2023 17:44:30 +0000 (12:44 -0500)]
Merge branch '2023-02-24-include-nx51-components-in-docker-for-testing' into next

- Merge in changes to our Dockerfile so that we build and download ahead
  of time all of the components required to run the nx51 test scripts.
  This will both speed up the specific job and address failures in Azure
  where the ipk files fail to download.

21 months agoCI: Update test/nokia_rx51_test.sh to use prebuilt images
Pali Rohár [Tue, 21 Feb 2023 16:22:29 +0000 (11:22 -0500)]
CI: Update test/nokia_rx51_test.sh to use prebuilt images

Now that the Dockerfile creates images which have the binaries we
require included, have CI make symlinks for them and update the existing
script to support this.

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
21 months agoDockerfile: build qemu for Nokia n900
Heinrich Schuchardt [Fri, 13 Jan 2023 19:31:33 +0000 (20:31 +0100)]
Dockerfile: build qemu for Nokia n900

Using a pre-built QEMU saves a lot of time when testing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
21 months agoDockerfile: download binaries for Nokia RX-51
Heinrich Schuchardt [Fri, 13 Jan 2023 18:25:01 +0000 (19:25 +0100)]
Dockerfile: download binaries for Nokia RX-51

Downloading files for a test may fail if the server is offline.
It is preferable to provide the files in our Docker image.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegra
Tom Rini [Thu, 23 Feb 2023 22:32:22 +0000 (17:32 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-tegra

22 months agoMerge branch '2023-02-23-assorted-fixes'
Tom Rini [Thu, 23 Feb 2023 22:30:49 +0000 (17:30 -0500)]
Merge branch '2023-02-23-assorted-fixes'

- btrfs bugfix, silence a bunch of gcc-12.2 linker warnings finally,
  relax one of the trace test time requirements (so CI doesn't fail due
  to test being slightly slow, but still correct), and correct env on
  MMC and checking for where GPT can be

22 months agoARM: tegra20: implement BCT patching
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:38 +0000 (19:35 +0200)]
ARM: tegra20: implement BCT patching

This function allows updating bootloader from u-boot
on production devices without need in host PC.

Be aware! It works only with re-crypt BCT.

Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Signed-off-by: Ramin Khonsari <raminterex@yahoo.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra30: implement BCT patching
Ramin Khonsari [Tue, 14 Feb 2023 17:35:37 +0000 (19:35 +0200)]
ARM: tegra30: implement BCT patching

This function allows updating bootloader from u-boot
on production devices without need in host PC.

Be aware! It works only with re-crypted BCT.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Signed-off-by: Ramin Khonsari <raminterex@yahoo.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: crypto: extend crypto functional
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:36 +0000 (19:35 +0200)]
ARM: tegra: crypto: extend crypto functional

Add support for encryption, decryption and signinig with
non-zero key saving backward compatibility.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: expose crypto module for all Tegra SoCs
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:35 +0000 (19:35 +0200)]
ARM: tegra: expose crypto module for all Tegra SoCs

Move crypto module from T20 only into common Tegra dir.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoboard: tegra30: switch to updated pre-dm i2c write
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:34 +0000 (19:35 +0200)]
board: tegra30: switch to updated pre-dm i2c write

Configure PMIC voltages for early stages using updated
early i2c write.

Tested-by: Thierry Reding <treding@nvidia.com> # Beaver T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoboard: tegra124: switch to updated pre-dm i2c write
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:33 +0000 (19:35 +0200)]
board: tegra124: switch to updated pre-dm i2c write

Configure PMIC for early stages using updated i2c write.

Tested-by: Thierry Reding <treding@nvidia.com> # Jetson TK1 T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: create common pre-dm i2c write
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:32 +0000 (19:35 +0200)]
ARM: tegra: create common pre-dm i2c write

This implementation allows pwr i2c writing on early SPL
stages when DM is not yet setup.

Such writing is needed to configure main voltages of PMIC
on early SPL for bootloader to boot properly.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: add late init support
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:31 +0000 (19:35 +0200)]
ARM: tegra: add late init support

Late init function allows passing values like identifiers and
perform device specific configurations of pre-boot stage.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: provide default USB gadget setup
Maxim Schwalm [Tue, 14 Feb 2023 17:35:30 +0000 (19:35 +0200)]
ARM: tegra: provide default USB gadget setup

All Nvidia boards use the same manufacturer, vendor ID and product ID
for the gadgets. Make them the defaults to remove some boilerplate from
the defconfigs.

Inspired by commit e02687bda96c ("sunxi: provide default USB gadget
setup") which did the same for Allwinner boards.

Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Maxim Schwalm <maxim.schwalm@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agospi: tegra20_slink: accept any word length
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:29 +0000 (19:35 +0200)]
spi: tegra20_slink: accept any word length

Original t20 slink could work with commands only
fully divisible by 8. This patch removes such
restriction, so commands of any bitlength now
can be passed and processed.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF600T T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: Fix Tegra PWM parent clock
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:28 +0000 (19:35 +0200)]
ARM: tegra: Fix Tegra PWM parent clock

Default parent clock for the PWM on Tegra is a 32kHz clock and
is unable to support the requested PWM period.

Fix PWM support on Tegra20, Tegra30, Tegra114, Tegra124 and Tegra210 by
updating the parent clock for the PWM to be the PLL_P.

This commit is equivalent to Linux kernel commit:
https://lore.kernel.org/all/20221010100046.6477-1-jonathanh@nvidia.com/

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF201 T30
Tested-by: Thierry Reding <treding@nvidia.com> # T30 and T124
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra30: add PLLD to pll setup
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:27 +0000 (19:35 +0200)]
ARM: tegra30: add PLLD to pll setup

On T30 unlike T20 dsi panels are wider used on devices
and PLLD is used as DISP1 parent more often, so lets
enable it as well for this cases.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF700T T30
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # HTC One X T30
Tested-by: Thierry Reding <treding@nvidia.com> # Beaver T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: clock: add clock_decode_pair helper
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:26 +0000 (19:35 +0200)]
ARM: tegra: clock: add clock_decode_pair helper

Get periph clock id and its parent from device tree.
This works by looking up the peripheral's 'clocks' node and
reading out the second and fourth cells, which are the
peripheral and PLL clock numbers.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # HTC One X
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: tegra: clock: add clk_id_to_pll_id helper
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:25 +0000 (19:35 +0200)]
ARM: tegra: clock: add clk_id_to_pll_id helper

This function allows to convert a device tree clock ID to PLL ID.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # HTC One X
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoARM: t20/t30: swap host1x and disp1 clock parents
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:24 +0000 (19:35 +0200)]
ARM: t20/t30: swap host1x and disp1 clock parents

According to mainline clock tables and TRM HOST1X
parent is PLLC, while DISP1 usually uses PLLP as
parent clock.

Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # ASUS TF T30
Tested-by: Robert Eckelmann <longnoserob@gmail.com> # ASUS TF101 T20
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Tested-by: Thierry Reding <treding@nvidia.com> # Beaver T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agotegra30: clock: add EXTPERIPH
Svyatoslav Ryhel [Tue, 14 Feb 2023 17:35:23 +0000 (19:35 +0200)]
tegra30: clock: add EXTPERIPH

This mappings were missing for some reason.

Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895 T30
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom <twarren@nvidia.com>
22 months agoenv: mmc: Apply GPT only on eMMC user HW partition
Marek Vasut [Thu, 9 Feb 2023 12:30:10 +0000 (13:30 +0100)]
env: mmc: Apply GPT only on eMMC user HW partition

Apply the GPT U-Boot environment GUID type look up only on eMMC user
HW partition, do not apply the look up on eMMC boot HW partitions as
mmc_offset_try_partition() assumes either SD partitions or eMMC user
HW partition.

This fixes environment operation on systems where CONFIG_SYS_MMC_ENV_PART
is non-zero and CONFIG_SYS_REDUNDAND_ENVIRONMENT is set.

Fixes: 80105d8fd52 ("env: mmc: select GPT env partition by type guid")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
22 months agotrace: Relax test requirements
Simon Glass [Fri, 17 Feb 2023 22:45:16 +0000 (15:45 -0700)]
trace: Relax test requirements

We expect the profile and bootstage to agree on timing, but when
running on slow machines there can be a larger descrepency. Increase the
tolerance to fix this.

Fixes: 9cea4797aeb ("trace: Add a test")
Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agox86: Pass -z execstack for EFI payload flags
Tom Rini [Tue, 14 Feb 2023 20:09:32 +0000 (15:09 -0500)]
x86: Pass -z execstack for EFI payload flags

To match how we link EFI executables elsewhere, and to silence a linker
warning, pass -z execstack here as well.

Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
22 months agoMakefile: Link with -z noexectack
Tom Rini [Tue, 14 Feb 2023 20:09:31 +0000 (15:09 -0500)]
Makefile: Link with -z noexectack

When moving to gcc-12.2 we started trying to quiet some of the new
linker warnings, that are not relevant to us. However, a
misunderstanding of the mechanics at play meant that I intentionally
omitted passing -z noexecstack to the linker, when we do need to. Add
this flag and in turn remove warnings from the linker.

Fixes: 1e1c51f8ace8 ("Makefile: link with --no-warn-rwx-segments")
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agofs: btrfs: limit the mapped length to the original length
Qu Wenruo [Mon, 13 Feb 2023 00:37:59 +0000 (08:37 +0800)]
fs: btrfs: limit the mapped length to the original length

[BUG]
There is a bug report that btrfs driver caused hang during file read:

  This breaks btrfs on the HiFive Unmatched.

  => pci enum
  PCIE-0: Link up (Gen1-x8, Bus0)
  => nvme scan
  => load nvme 0:2 0x8c000000 /boot/dtb/sifive/hifive-unmatched-a00.dtb
  [hangs]

[CAUSE]
The reporter provided some debug output:

  read_extent_data: cur=615817216, orig_len=16384, cur_len=16384
  read_extent_data: btrfs_map_block: cur_len=479944704; ret=0
  read_extent_data: ret=0
  read_extent_data: cur=615833600, orig_len=4096, cur_len=4096
  read_extent_data: btrfs_map_block: cur_len=479928320; ret=0

Note the second and the last line, the @cur_len is 450+MiB, which is
almost a chunk size.

And inside __btrfs_map_block(), we limits the returned value to stripe
length, but that's depending on the chunk type:

if (map->type & (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 |
 BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4 |
 BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 |
 BTRFS_BLOCK_GROUP_RAID10 |
 BTRFS_BLOCK_GROUP_DUP)) {
/* we limit the length of each bio to what fits in a stripe */
*length = min_t(u64, ce->size - offset,
      map->stripe_len - stripe_offset);
} else {
*length = ce->size - offset;
}

This means, if the chunk is SINGLE profile, then we don't limit the
returned length at all, and even for other profiles, we can still return
a length much larger than the requested one.

[FIX]
Properly clamp the returned length, preventing it from returning a much
larger range than expected.

Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Qu Wenruo <wqu@suse.com>
22 months agousb: dwc3-uniphier: Select PHY
Marek Vasut [Thu, 23 Feb 2023 16:29:24 +0000 (17:29 +0100)]
usb: dwc3-uniphier: Select PHY

Make sure the PHY subsystem is activated for the uniphier DWC3 glue
logic, as it depends on PHY implementation there.

Signed-off-by: Marek Vasut <marex@denx.de>
22 months agoMerge branch 'next' of git://source.denx.de/u-boot-usb into next
Tom Rini [Wed, 22 Feb 2023 23:21:40 +0000 (18:21 -0500)]
Merge branch 'next' of git://source.denx.de/u-boot-usb into next

- dwc3-generic rework and then switch uniphier to it

22 months agouniphier_defconfig: Disable USB_XHCI_DWC3
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:34 +0000 (14:50 +0900)]
uniphier_defconfig: Disable USB_XHCI_DWC3

Replacing with dwc3-generic, no need USB_XHCI_DWC3 anymore.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agousb: dwc3-uniphier: Use dwc3-generic instead of xhci-dwc3
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:33 +0000 (14:50 +0900)]
usb: dwc3-uniphier: Use dwc3-generic instead of xhci-dwc3

dwc3-uniphier depends on xhci-dwc3 framework, however, it is preferable
to use dwc3-generic.

This driver calls the exported dwc3-generic functions and redefine
the SoC-dependent operations to fit dwc3-generic.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agophy: socionext: Add UniPhier USB3 PHY driver
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:32 +0000 (14:50 +0900)]
phy: socionext: Add UniPhier USB3 PHY driver

Add USB3 PHY driver support to control clocks and resets needed to enable
PHY. The phy_ops->init() and exit() control PHY clocks and resets only,
and clocks and resets for the controller and the parent logic are enabled
in advance.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agoclk: uniphier: Add missing USB SS-PHY clocks
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:31 +0000 (14:50 +0900)]
clk: uniphier: Add missing USB SS-PHY clocks

The USB SS-PHY needs its own clock, however, some clocks don't have
clock gates. Define missing clock entries for the PHY as reference
clock.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agoreset: uniphier: Add USB glue reset support
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:30 +0000 (14:50 +0900)]
reset: uniphier: Add USB glue reset support

Add reset control support in USB glue logic. This needs to control
the external clocks and resets for the logic before accessing the
glue logic.

The USB dm tree when using dwc3-generic is the following:

   USB glue
     +-- controller       (need controller-reset)
     +-- controller-reset (need syscon-reset)
     +-- phy

The controller needs to deassert "controller-reset" in USB glue before
the controller registers are accessed. The glue needs to deassert
"syscon-reset" before the glue registers are accessed.

The glue itself doesn't have "syscon-reset", so the controller-reset
controls "syscon-reset" instead.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agousb: dwc3-generic: Add the size of regs property to glue structure
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:29 +0000 (14:50 +0900)]
usb: dwc3-generic: Add the size of regs property to glue structure

Add the size of regs property to the glue structure to correctly
specify the register region to map.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agousb: dwc3-generic: Export glue structures and functions
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:28 +0000 (14:50 +0900)]
usb: dwc3-generic: Export glue structures and functions

In order to allow external SoC-dependent glue drivers to use dwc3-generic
functions, push the glue structures and export the functions to a header
file.

The exported structures and functions are:

- struct dwc3_glue_data
- struct dwc3_glue_ops
- dwc3_glue_bind()
- dwc3_glue_probe()
- dwc3_glue_remove()

The SoC-dependent glue drivers can only define their own wrapper driver
and specify these functions. The drivers can also add their own compatible
strings and configure functions.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agousb: dwc3-generic: Add clock initialization in child DT node
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:27 +0000 (14:50 +0900)]
usb: dwc3-generic: Add clock initialization in child DT node

Same as the reset cotnrol, should add a clock initialization in child DT
node, if the glue node doesn't have any clocks.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agousb: dwc3-generic: Allow different controller DT node pattern
Kunihiko Hayashi [Mon, 20 Feb 2023 05:50:26 +0000 (14:50 +0900)]
usb: dwc3-generic: Allow different controller DT node pattern

The most of devicetree has the following USB node structure.
The controller node is placed as a child node of the glue node.
Current dwc3-generic driver works on this premise.

    glue {
        /* glue node */
usb {
            /* controller node */
};
    };

However, UniPhier original devicetree has the following USB node structure.
The controller node is separately placed from the glue node.

    usb {
        /* controller node */
    };
    glue {
        /* glue node */
    };

In dwc_glue_bind(), this patch provides .glue_get_ctrl_dev() callback to
get such a controller node and binds the driver related to the node.

If this callback isn't defined, dwc_glue_bind() looks for the controller
nodes from the child nodes, as before.

Suggested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Marek Vasut <marex@denx.de>
22 months agousb: dwc3: Look up reference clock DT phandle in both controller DT nodes
Marek Vasut [Mon, 20 Feb 2023 05:50:25 +0000 (14:50 +0900)]
usb: dwc3: Look up reference clock DT phandle in both controller DT nodes

There are currently four disparate placement possibilities of DWC3
reference clock phandle in SoC DTs:
- in top level glue node, with generic subnode without clock (ZynqMP)
- in top level generic node, with no subnode (i.MX8MQ)
- in generic subnode, with other clock in top level node (i.MX8MP)
- in both top level node and generic subnode (Rockchip)

Cover all the possibilities here by looking into both nodes, start
with the top level node as that seems to be used in majority of DTs
to reference the clock.

Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
22 months agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 22 Feb 2023 18:36:29 +0000 (13:36 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-usb

- DWC3 bugfix

22 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-socfpga
Tom Rini [Wed, 22 Feb 2023 14:28:03 +0000 (09:28 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-socfpga

- chameleonv3 updates

22 months agochameleonv3: Convert CONFIG_SPL_MAX_SIZE to Kconfig
Paweł Anikiel [Tue, 21 Feb 2023 15:17:06 +0000 (16:17 +0100)]
chameleonv3: Convert CONFIG_SPL_MAX_SIZE to Kconfig

This file was missed during the conversion process. Add the symbol to
defconfig.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agoarm: dts: chameleonv3: Add 270-2 variant
Paweł Anikiel [Tue, 21 Feb 2023 15:17:05 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Add 270-2 variant

Add devicetree for chameleonv3 with the 270-2I2-D11E variant of the
Mercury+ AA1 module

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agoarm: dts: chameleonv3: Rename chameleonv3.dts to .dtsi
Paweł Anikiel [Tue, 21 Feb 2023 15:17:04 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Rename chameleonv3.dts to .dtsi

This file is included by the different chameleonv3 variants. Change the
name to .dtsi.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agoarm: dts: chameleonv3: Override chameleonv3 bitstream names
Paweł Anikiel [Tue, 21 Feb 2023 15:17:03 +0000 (16:17 +0100)]
arm: dts: chameleonv3: Override chameleonv3 bitstream names

Set the bitstream name per Chameleon variant. This allows the same
boot filesystem with all bitstream variants to be used on different
boards.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agosocfpga: chameleonv3: Move environment to a text file
Paweł Anikiel [Tue, 21 Feb 2023 15:17:02 +0000 (16:17 +0100)]
socfpga: chameleonv3: Move environment to a text file

Move the environment to an easily editable text file in the boot
partition

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agosocfpga: chameleonv3: Enable ext4 in SPL
Paweł Anikiel [Tue, 21 Feb 2023 15:17:01 +0000 (16:17 +0100)]
socfpga: chameleonv3: Enable ext4 in SPL

Allow SPL to boot from an ext4 filesystem.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
22 months agousb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio
Venkatesh Yadav Abbarapu [Fri, 13 Jan 2023 05:12:02 +0000 (10:42 +0530)]
usb: dwc3: Use the devm_gpiod_get_optional() API for reset gpio

As the "reset-gpios" property is optional, don't return the
error and just skip the gpio reset sequence.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
22 months agoMerge tag 'efi-2023-04-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 19 Feb 2023 22:03:30 +0000 (17:03 -0500)]
Merge tag 'efi-2023-04-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc3

Documentation

* Add a document for the RISC-V architecture
* Move gateworks and bcm7xxx documentation to HTML

UEFI

* measure the loaded device-tree
* make CapsuleMax configurable and provide sensible default

22 months agodoc: remove superfluous warning
Heinrich Schuchardt [Sun, 19 Feb 2023 20:26:24 +0000 (21:26 +0100)]
doc: remove superfluous warning

We have been using Sphinx >=3 since 2020. We don't expect issues.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
22 months agoefi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX
Etienne Carriere [Thu, 16 Feb 2023 17:21:41 +0000 (18:21 +0100)]
efi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX

Adds CONFIG_EFI_CAPSULE_MAX to configure the max index value used in
EFI capsule reports. Prior to this change is the hard coded value was
65535 which would exceed available storage for variables. Now the
default value is 15 which should work fine with most systems.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
22 months agoefi_loader: Measure the loaded DTB
Etienne Carriere [Thu, 16 Feb 2023 16:29:48 +0000 (17:29 +0100)]
efi_loader: Measure the loaded DTB

Measures the DTB passed to the EFI application upon new boolean config
switch CONFIG_EFI_TCG2_PROTOCOL_MEASURE_DTB. For platforms where the
content of the DTB passed to the OS can change across reboots, there is
not point measuring it hence the config switch to allow platform to not
embed this feature.

Co-developed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
22 months agoefi_loader: fix wrong attribute check for QueryVariableInfo
Masahisa Kojima [Wed, 15 Feb 2023 02:32:17 +0000 (11:32 +0900)]
efi_loader: fix wrong attribute check for QueryVariableInfo

QueryVariableInfo with EFI_VARIABLE_HARDWARE_ERROR_RECORD is
accepted, remove wrong attribute check.

Fixes: 454a9442fbce ("efi_loader: update attribute check for QueryVariableInfo()")
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
22 months agoefi_loader: avoid buffer overrun in efi_var_mem_compare
Heinrich Schuchardt [Mon, 13 Feb 2023 18:22:33 +0000 (19:22 +0100)]
efi_loader: avoid buffer overrun in efi_var_mem_compare

We should not scan beyond the end of string name.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
22 months agodoc: arch: Add document for RISC-V architecture
Yu Chien Peter Lin [Tue, 14 Feb 2023 10:18:51 +0000 (18:18 +0800)]
doc: arch: Add document for RISC-V architecture

This patch adds a brief introduction to the RISC-V architecture and
the typical boot process used on a variety of RISC-V platforms.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
22 months agoboard: gateworks: venice: move README to RST
Tim Harvey [Mon, 13 Feb 2023 17:44:27 +0000 (09:44 -0800)]
board: gateworks: venice: move README to RST

Move board/gateworks/venice/README to RST documentation.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
22 months agodoc: board: bcm7xxx: Convert to reStructuredText format
Thomas Fitzsimmons [Mon, 13 Feb 2023 16:21:27 +0000 (11:21 -0500)]
doc: board: bcm7xxx: Convert to reStructuredText format

Convert the documentation for the Broadcom BCM7445 and BCM7260 boards
to reStructuredText format and add the new filename to
doc/board/broadcom/index.rst.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
22 months agodoc: devicetree: dt_qemu.rst: Fix the typo and space
Yu Chien Peter Lin [Sun, 12 Feb 2023 07:09:51 +0000 (15:09 +0800)]
doc: devicetree: dt_qemu.rst: Fix the typo and space

Fix typo and whitespace in the document.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
22 months agoMerge branch '2023-02-17-assorted-fixes'
Tom Rini [Fri, 17 Feb 2023 19:18:46 +0000 (14:18 -0500)]
Merge branch '2023-02-17-assorted-fixes'

- avb_verify bugfix, and cpsw_mdio bugfix

22 months agocommon: avb_verify: prevent opening incorrect session
Ivan Khoronzhuk [Fri, 27 Jan 2023 20:02:14 +0000 (22:02 +0200)]
common: avb_verify: prevent opening incorrect session

The arg->session is not valid if arg->ret != NULL, so can't be
assigned, correct this.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@globallogic.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
22 months agocpsw_mdio.c: Use correct reg in cpsw_mdio_get_alive
Ulf Samuelsson [Tue, 7 Feb 2023 08:25:27 +0000 (09:25 +0100)]
cpsw_mdio.c: Use correct reg in cpsw_mdio_get_alive

cpsw_mdio_get_alive reads the wrong register.
See page 2316 in SPRUH73Q AM335x TRM

Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
22 months agoconfigs: Resync with savedefconfig
Tom Rini [Fri, 17 Feb 2023 14:58:06 +0000 (09:58 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
22 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Fri, 17 Feb 2023 14:03:35 +0000 (09:03 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

- binman: Add help message if opensbi is absent when building u-boot SPL
- AndesTech: rename cpu and board name to 'andesv5' and 'ae350'
- Clean up cache operation for Andes ae350 platform

22 months agoriscv: binman: Add help message for missing blobs
Rick Chen [Fri, 17 Feb 2023 08:57:01 +0000 (16:57 +0800)]
riscv: binman: Add help message for missing blobs

Add the 'missing-msg' for more detailed output
on missing system firmware.

Signed-off-by: Rick Chen <rick@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
22 months agoriscv: ae350: Adjust the memory layout of ae350
Leo Yu-Chi Liang [Tue, 14 Feb 2023 12:42:50 +0000 (20:42 +0800)]
riscv: ae350: Adjust the memory layout of ae350

Adjust the initial stack pointer address to 0x10000000(256M)

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoriscv: Rename Andes cpu and board names
Leo Yu-Chi Liang [Tue, 14 Feb 2023 12:42:49 +0000 (20:42 +0800)]
riscv: Rename Andes cpu and board names

The current ae350-related defconfigs could also
support newer Andes CPU IP, so modify the names of CPU
from ax25 to andesv5, and board name from ax25-ae350 to ae350.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agodriver: cache-v5l2: Fix type casting warning on RV32
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:53 +0000 (16:10 +0800)]
driver: cache-v5l2: Fix type casting warning on RV32

This patch fixes following warning for the riscv32 toolchain.

drivers/cache/cache-v5l2.c:122:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  122 |         regs = (struct l2cache *)dev_read_addr(dev);
      |                ^

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
22 months agoconfigs: ae350: Display CPU and board info for AE350 platforms
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:52 +0000 (16:10 +0800)]
configs: ae350: Display CPU and board info for AE350 platforms

Display information about CPU and board during start up.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoconfigs: ae350: Increase maximum retry count for AE350 platforms
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:51 +0000 (16:10 +0800)]
configs: ae350: Increase maximum retry count for AE350 platforms

Loading an image via TFTP is often interrupted when retrying more than
10 times, increase the number of retries so that it does not simply stop
the transfer.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
22 months agoconfigs: ae350: Enable v5l2 cache for AE350 platforms in SPL
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:50 +0000 (16:10 +0800)]
configs: ae350: Enable v5l2 cache for AE350 platforms in SPL

To reduce the code size, CONFIG_V5L2_CACHE was disabled since commit:
ca06444aac2c643db3a3f2eb37afc60fae15177e

Turing on does not significantly increase the size of u-boot-spl.bin,
so we enable it by default to improve performance.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoriscv: ax25: cache.c: Cleanups to L1/L2 cache function used in SPL
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:49 +0000 (16:10 +0800)]
riscv: ax25: cache.c: Cleanups to L1/L2 cache function used in SPL

This patch refines L1 cache enable/disable and v5l2-cache enable
functions.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoriscv: ae350: dts: Update L2 cache compatible string
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:48 +0000 (16:10 +0800)]
riscv: ae350: dts: Update L2 cache compatible string

Update the compatible string of L2 cache.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoriscv: cpu: ax25: Simplify cache enabling logic in harts_early_init()
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:47 +0000 (16:10 +0800)]
riscv: cpu: ax25: Simplify cache enabling logic in harts_early_init()

As the OpenSBI v1.2 does not enable the cache [0], we enable
the i/d-cache in harts_early_init() and do not disable in
cleanup_before_linux(). This patch also simplifies the logic
and moves the CSR encoding to include/asm/arch-andes/csr.h.

[0] https://github.com/riscv-software-src/opensbi/commit/bd7ef4139829da5c30fa980f7498d385124408fa

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agodriver: cache: cache-v5l2: Update memory-mapped scheme to support Gen2 platform
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:46 +0000 (16:10 +0800)]
driver: cache: cache-v5l2: Update memory-mapped scheme to support Gen2 platform

The L2C configuration register has MAP field to indicate its version
is v0 (Gen1) or v1 (Gen2) L2-cache. This patch makes the driver
compatible with both memory-mapped scheme.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoboard: AndesTech: ax25-ae350.c: Enable v5l2-cache in spl_board_init()
Yu Chien Peter Lin [Mon, 6 Feb 2023 08:10:45 +0000 (16:10 +0800)]
board: AndesTech: ax25-ae350.c: Enable v5l2-cache in spl_board_init()

The L2-cache is not enabled currently, the enbale_caches() will call
the v5l2_enable() callback to enable it in SPL.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoriscv: Remove redundant Kconfig "RISCV_NDS_CACHE"
Leo Yu-Chi Liang [Mon, 6 Feb 2023 08:10:44 +0000 (16:10 +0800)]
riscv: Remove redundant Kconfig "RISCV_NDS_CACHE"

There is no need for RISCV_NDS_CACHE config to control cache switches.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoriscv: global_data.h: Correct the comment for PLICSW
Yu Chien Peter Lin [Mon, 6 Feb 2023 02:06:29 +0000 (10:06 +0800)]
riscv: global_data.h: Correct the comment for PLICSW

PLIC is used for external interrupt, while PLICSW is an Andes-specific
design for software interrupt.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
22 months agoMerge tag 'dm-next-valentine' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 14 Feb 2023 20:11:37 +0000 (15:11 -0500)]
Merge tag 'dm-next-valentine' of https://source.denx.de/u-boot/custodians/u-boot-dm into next

Move U-Boot over to the new schema for driver model tags

22 months agodm: test: Add a test for the various migration combinations
Simon Glass [Mon, 13 Feb 2023 15:56:41 +0000 (08:56 -0700)]
dm: test: Add a test for the various migration combinations

Test that:

- sandbox shows a warning when an unmigrated DT is used
- sandbox fails to run when migration is turned off
- sandbox_spl fails to build when migration is turned off

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agotest: Add a way to set the environment for a pytest
Simon Glass [Mon, 13 Feb 2023 15:56:40 +0000 (08:56 -0700)]
test: Add a way to set the environment for a pytest

This is useful when we need to control a particular environment variable.
Add a way to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agoCI: Add a check for pre-schema driver model tags
Simon Glass [Mon, 13 Feb 2023 15:56:39 +0000 (08:56 -0700)]
CI: Add a check for pre-schema driver model tags

These should not be used anymore. Add a check to ensure they don't creek
back into U-Boot. Use bootph-... instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agocheckpatch: Add a warning for pre-schema driver model tags
Simon Glass [Mon, 13 Feb 2023 15:56:38 +0000 (08:56 -0700)]
checkpatch: Add a warning for pre-schema driver model tags

Help ensure that these don't creep into development by adding a check in
checkpatch for them.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agodm: doc: Move to new driver model schema
Simon Glass [Mon, 13 Feb 2023 15:56:37 +0000 (08:56 -0700)]
dm: doc: Move to new driver model schema

Now that Linux has accepted these tags, update the dtoc tool to use them.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agodm: doc: Update documentation for new driver model schema
Simon Glass [Mon, 13 Feb 2023 15:56:36 +0000 (08:56 -0700)]
dm: doc: Update documentation for new driver model schema

Now that Linux has accepted these tags, move U-Boot over to use them.
Tidy up the comments and formatting, making sure that VPL is mentioned
too.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agodm: doc: Update device tree binding docs for new schema
Simon Glass [Mon, 13 Feb 2023 15:56:35 +0000 (08:56 -0700)]
dm: doc: Update device tree binding docs for new schema

Now that Linux has accepted these tags, move U-Boot over to use them.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agodm: treewide: Complete migration to new driver model schema
Simon Glass [Mon, 13 Feb 2023 15:56:34 +0000 (08:56 -0700)]
dm: treewide: Complete migration to new driver model schema

Update various build and test components to use the new schema.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agodm: dts: Convert driver model tags to use new schema
Simon Glass [Mon, 13 Feb 2023 15:56:33 +0000 (08:56 -0700)]
dm: dts: Convert driver model tags to use new schema

Now that Linux has accepted these tags, move the device tree files in
U-Boot over to use them.

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agodm: Add support for handling old u-boot,dm- tags
Simon Glass [Mon, 13 Feb 2023 15:56:32 +0000 (08:56 -0700)]
dm: Add support for handling old u-boot,dm- tags

Add a CONFIG option to deal with this automatically, printing a warning
when U-Boot starts up. This can be useful if the device tree comes from
another project.

We will maintain this through the 2023.07 release, providing 6 months
for people to notice.

Signed-off-by: Simon Glass <sjg@chromium.org>
Version 4:
Acked-by: Michal Simek <michal.simek@amd.com>
22 months agoschemas: Add schema for U-Boot driver model 'phase tags'
Simon Glass [Mon, 13 Feb 2023 15:56:31 +0000 (08:56 -0700)]
schemas: Add schema for U-Boot driver model 'phase tags'

U-Boot has some particular challenges with device tree and devices:

- U-Boot has multiple build phases, such as a Secondary Program Loader
  (SPL) phase which typically runs in a pre-SDRAM environment where code
  and data space are limited. In particular, there may not be enough
  space for the full device tree blob. U-Boot uses various automated
  techniques to reduce the size from perhaps 40KB to 3KB. It is not
  always possible to handle these tags entirely at build time, since
  U-Boot proper must have the full device tree, even though we do not
  want it to process all nodes until after relocation.
- Some U-Boot phases needs to run before the clocks are properly set up,
  where the CPU may be running very slowly. Therefore it is important to
  bind only those devices which are actually needed in that phase
- U-Boot uses lazy initialisation for its devices, with 'bind' and
  'probe' being separate steps. Even if a device is bound, it is not
  actually probed until it is used. This is necessary to keep the boot
  time reasonable, e.g. to under a second

The phases of U-Boot in order are: TPL, VPL, SPL, U-Boot (first
pre-relocation, then post-relocation). ALl but the last two are optional.

For the above reasons, U-Boot only includes the full device tree in the
final 'U-Boot proper' build. Even then, before relocation U-Boot only
processes nodes which are marked as being needed.

For this to work, U-Boot's driver model[1] provides a way to mark device
tree nodes as applicable for a particular phase. This works by adding a
tag to the node, e.g.:

   cru: clock-controller@ff760000 {
      bootph-all;
      compatible = "rockchip,rk3399-cru";
      reg = <0x0 0xff760000 0x0 0x1000>;
      rockchip,grf = <&grf>;
      #clock-cells = <1>;
      #reset-cells = <1>;
      ...
   };

Here the "bootph-all" tag indicates that the node must be present in all
phases, since the clock driver is required.

There has been discussion over the years about whether this could be done
in a property instead, e.g.

   options {
      bootph-all = <&cru> <&gpio_a> ...;
      ...
   };

Some problems with this:

- we need to be able to merge several such tags from different .dtsi files
  since many boards have their own specific requirements
- it is hard to find and cross-reference the affected nodes
- it is more error-prone
- it requires significant tool rework in U-Boot, including fdtgrep and
  the build system
- is harder (slower, more code) to process since it involves scanning
  another node/property to find out what to do with a particular node
- we don't want to add phandle arguments to the above since we are
  referring, e.g., to the clock device as a whole, not a paricular clock
- the of-platdata feature[2], which converts device tree to C for even
  more constrained environments, would need to become aware of the
  /options node

There is also the question about whether this needs to be U-Boot-specific,
or whether the tags could be generic. From what I can tell, U-Boot is the
only bootloader which seriously attempts to use a runtime device tree in
all cases. For this version, an attempt is made to name the phases in a
generic manner.

It should also be noted that the approach provided here has stood the test
of time, used in U-Boot for 8 years so far.

So add the schema for this. This will allow a major class of schema
exceptions to be dropped from the U-Boot source tree.

This has been applied upstream[3]

[1] https://u-boot.readthedocs.io/en/latest/develop/driver-model/index.html
[2] https://u-boot.readthedocs.io/en/latest/develop/driver-model/of-plat.html
[3] https://github.com/devicetree-org/dt-schema/commit/63bd847

Signed-off-by: Simon Glass <sjg@chromium.org>
22 months agoPrepare v2023.04-rc2
Tom Rini [Mon, 13 Feb 2023 23:39:15 +0000 (18:39 -0500)]
Prepare v2023.04-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
22 months agoclocks: qcs404: Add support for I2C clocks
Sumit Garg [Mon, 13 Feb 2023 04:49:09 +0000 (10:19 +0530)]
clocks: qcs404: Add support for I2C clocks

Co-developed-by: Mike Worsfold <mworsfold@impinj.com>
Signed-off-by: Mike Worsfold <mworsfold@impinj.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>