]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 months agoMerge patch series "Bump new hush commits and fix old hush test behavior"
Tom Rini [Fri, 13 Sep 2024 19:44:00 +0000 (13:44 -0600)]
Merge patch series "Bump new hush commits and fix old hush test behavior"

Francis Laniel <francis.laniel@amarulasolutions.com> says:

Hi!

With this series, I bumped the new hush to get the latest commits from upstream.

Also, I added back a reverted commit which goal was to fix a bad behavior in
old hush test.
I had to tweak a bit this commit, but everything worked both locally and in the
CI.

3 months agocli: modern_hush: Add upstream commits up to 13 July 2024
Francis Laniel [Tue, 3 Sep 2024 17:09:43 +0000 (19:09 +0200)]
cli: modern_hush: Add upstream commits up to 13 July 2024

This commit adds the following hush busybox upstream commits:
23da5c4b716b ("hush: do not exit interactive shell on some redirection errors")
14e28c18ca1a ("hush: fix "exec 3>FILE" aborting if 3 is exactly the next free fd")
6c38d0e9da2d ("hush: avoid duplicate fcntl(F_SETFD, FD_CLOEXEC) during init")
758b21402abc ("hush: detect when terminating "done"/"fi" is missing")
2639f3bc72ac ("hush: set G.ifs sooner (prevents segfault)")

Adding specific ifdef and endif guard was needed for 2639f3bc72ac.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
3 months agotest: hush: dollar: fix bugous behavior
Ion Agorria [Tue, 3 Sep 2024 17:09:42 +0000 (19:09 +0200)]
test: hush: dollar: fix bugous behavior

The dollar test was merged with bugous console behavior, and
instead of fixing it, this behavior was just workarounded.
This was done to keep compatibility with the existing behavior.

It seems like without the fix the ut_assert_skipline(); didn't clear
console and running ut_assert_skipline(); many times would give always
OK. With e58bafc35fe3 ("lib: membuff: fix readline not returning line in case of overflow")
the line is cleared correctly and next assert fails because now there
is nothing to clean which is correct if we look the this a bit above
the failing assert:

    if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) {
         /*
          * For some strange reasons, the console is not empty after
          * running above command.
          * So, we reset it to not have side effects for other tests.
          */
         console_record_reset_enable();
    } else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
         ut_assert_console_end();
    }

Which further confirms that tests workaround the old problem and now
that problem is fixed we can remove the whole if blocks and simply
place ut_assert_console_end() right after ut_assert_skipline() without
any conditional and will pass green.

So this part of code goes from:
    ut_assert_skipline();
    ut_assert_skipline();

    if (gd->flags & GD_FLG_HUSH_MODERN_PARSER) {
        /* See above comments. */
        console_record_reset_enable();
    } else if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
        ut_assert_console_end();
    }

to become:
    ut_assert_skipline();
    if (gd->flags & GD_FLG_HUSH_OLD_PARSER) {
        ut_assert_skipline();
    }
    ut_assert_console_end();

The if block mentioned above that calls console_record_reset_enable() is
completely removed as fixed by e58bafc35fe3.

[flaniel: adapt second if]

Signed-off-by: Ion Agorria <ion@agorria.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20240105072212.6615-8-clamor95@gmail.com
[mkorpershoek: reworded commit title]
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
[flaniel: remove console_record_reset_enable() if]
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
3 months agoMerge tag 'efi-next-20241024' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Fri, 13 Sep 2024 14:20:25 +0000 (08:20 -0600)]
Merge tag 'efi-next-20241024' of https://source.denx.de/u-boot/custodians/u-boot-efi into next

Pull request efi-next-20241024

UEFI:

* Use generated UUIDs in UEFI capsules:
  - efi: define struct efi_guid
  - lib: uuid: add UUID v5 support
  - efi: add a helper to generate dynamic UUIDs
  - doc: uefi: document dynamic UUID generation
  - sandbox: switch to dynamic UUIDs
  - lib: uuid: supporting building as part of host tools
  - include: export uuid.h
  - tools: mkeficapsule: use u-boot UUID library
  - tools: mkeficapsule: support generating dynamic GUIDs
  - test: lib/uuid: add unit tests for dynamic UUIDs
  - test: lib/uuid: add tests for UUID version/variant bits

* Minor code clean-up
  - shorten efi_bootmgr_release_uridp_resource()
  - rename efi_bootmgr_image_return_notify
  - return the correct error in efi_bootmgr_release_uridp()
  - Kconfig: clean up the efi configuration status
  - Use puts() in cout so that console recording works
  - Put back copyright message in helloworld.c

3 months agoefi_loader: Put back copyright message
Simon Glass [Mon, 2 Sep 2024 01:18:13 +0000 (19:18 -0600)]
efi_loader: Put back copyright message

This was lost in a later commit, so add it back.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 months agoefi_loader: Use puts() in cout so that console recording works
Simon Glass [Mon, 2 Sep 2024 01:18:12 +0000 (19:18 -0600)]
efi_loader: Use puts() in cout so that console recording works

At present EFI output to the console uses fputs() which bypasses the
console-recording feature. This makes it impossible for tests to check
the output of an EFI app.

There doesn't seem to be any need to do this bypass, so adjust it to
simply use the puts() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 months agotest: lib/uuid: add tests for UUID version/variant bits
Caleb Connolly [Fri, 30 Aug 2024 12:34:41 +0000 (13:34 +0100)]
test: lib/uuid: add tests for UUID version/variant bits

Add a test to check the version/variant bits of v4 and v5 UUIDs.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agotest: lib/uuid: add unit tests for dynamic UUIDs
Caleb Connolly [Fri, 30 Aug 2024 12:34:40 +0000 (13:34 +0100)]
test: lib/uuid: add unit tests for dynamic UUIDs

Add some basic unit tests to validate that the UUID generation behaves
as expected. This matches the implementation in efi_loader for sandbox
and a Qualcomm board and should catch any regressions.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agotools: mkeficapsule: support generating dynamic GUIDs
Caleb Connolly [Fri, 30 Aug 2024 12:34:39 +0000 (13:34 +0100)]
tools: mkeficapsule: support generating dynamic GUIDs

Add support for generating GUIDs that match those generated internally
by U-Boot for capsule update fw_images when using dynamic UUIDs.

Dynamic UUIDs in U-Boot work by taking a namespace UUID and hashing it
with the board compatible and fw_image name. This feature just provides
a way to determine the UUIDs for a particular board without having to
actually boot U-Boot on it.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agotools: mkeficapsule: use u-boot UUID library
Caleb Connolly [Fri, 30 Aug 2024 12:34:38 +0000 (13:34 +0100)]
tools: mkeficapsule: use u-boot UUID library

Replace the use of libuuid with U-Boot's own UUID library. This prepares
us to add support for generating v5 GUIDs.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoinclude: export uuid.h
Caleb Connolly [Fri, 30 Aug 2024 12:34:37 +0000 (13:34 +0100)]
include: export uuid.h

Move this header to include/u-boot/ so that it can be used by external
tools.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agolib: uuid: supporting building as part of host tools
Caleb Connolly [Fri, 30 Aug 2024 12:34:36 +0000 (13:34 +0100)]
lib: uuid: supporting building as part of host tools

Adjust the UUID library code so that it can be compiled as part of a
host tool.

This removes the one redundant log_debug() call, as well as the
incorrectly defined LOG_CATEGORY.

In general this is a fairly trivial change, just adjusting includes and
disabling list_guid.

This will be used by a new genguid tool to generate v5 GUIDs that match
those generated by U-Boot at runtime.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agosandbox: switch to dynamic UUIDs
Caleb Connolly [Fri, 30 Aug 2024 12:34:35 +0000 (13:34 +0100)]
sandbox: switch to dynamic UUIDs

Migrate sandbox over to generating it's capsule update image GUIDs
dynamically from the namespace and board/image info. Update the
reference and tests to use the new GUIDs.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agodoc: uefi: document dynamic UUID generation
Caleb Connolly [Fri, 30 Aug 2024 12:34:34 +0000 (13:34 +0100)]
doc: uefi: document dynamic UUID generation

Document how platforms can generate GUIDs at runtime rather than
maintaining a list of UUIDs per-board.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoefi: add a helper to generate dynamic UUIDs
Caleb Connolly [Fri, 30 Aug 2024 12:34:33 +0000 (13:34 +0100)]
efi: add a helper to generate dynamic UUIDs

Introduce a new helper efi_capsule_update_info_gen_ids() which populates
the capsule update fw images image_type_id field. This allows for
determinstic UUIDs to be used that can scale to a large number of
different boards and board variants without the need to maintain a big
list.

We call this from efi_fill_image_desc_array() to populate the UUIDs
lazily on-demand.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agolib: uuid: add UUID v5 support
Caleb Connolly [Fri, 30 Aug 2024 12:34:32 +0000 (13:34 +0100)]
lib: uuid: add UUID v5 support

Add support for generating version 5 UUIDs, these are determistic and work
by hashing a "namespace" UUID together with some unique data. One intended
usecase is to allow for dynamically generate payload UUIDs for UEFI
capsule updates, so that supported boards can have their own UUIDs
without needing to hardcode them.

In addition, move the common bit twiddling code from gen_ran_uuid into a
separate function and rewrite it not to use clrsetbits (which is not
available when building as part of host tools).

Tests for this are added in an upcoming patch.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoefi: define struct efi_guid
Caleb Connolly [Fri, 30 Aug 2024 12:34:31 +0000 (13:34 +0100)]
efi: define struct efi_guid

This let's us forward declare efi_guid_t in the UUID code without
pulling in efi.h

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoKconfig: clean up the efi configuration status
Ilias Apalodimas [Fri, 30 Aug 2024 11:45:27 +0000 (14:45 +0300)]
Kconfig: clean up the efi configuration status

The EFI_LOADER and EFI config options are randomly scattered under lib/
making it cumbersome to navigate and enable options, unless you really
know what you are doing. On top of that the existing options are in
random order instead of a logical one.

So let's move things around a bit and move them under boot/. Present a
generic UEFI entry where people can select Capsules, Protocols,
Services,  and an option to compile U-Boot as an EFI for X86

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoefi_loader: return the correct error in efi_bootmgr_release_uridp()
Ilias Apalodimas [Mon, 12 Aug 2024 20:56:38 +0000 (23:56 +0300)]
efi_loader: return the correct error in efi_bootmgr_release_uridp()

There's currently a chance for this function to overwrite an error if
one occurred and the subsequent call to
efi_uninstall_multiple_protocol_interfaces() succedded. Although this
is an EFI event and we can't do much let's at least set and return
the correct error

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoefi_loader: rename efi_bootmgr_image_return_notify
Ilias Apalodimas [Mon, 12 Aug 2024 20:56:37 +0000 (23:56 +0300)]
efi_loader: rename efi_bootmgr_image_return_notify

We use this event when returning from an EFI HTTP booted image.
The name is a bit confusing since it suggests we always run it,
rename it to make it clearer

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoefi_loader: shorten efi_bootmgr_release_uridp_resource()
Ilias Apalodimas [Mon, 12 Aug 2024 20:56:36 +0000 (23:56 +0300)]
efi_loader: shorten efi_bootmgr_release_uridp_resource()

We use this function to clean up leftover resources when booting an
EFI HTTP boot image, but the name is unnecessary long.

Shorten it to efi_bootmgr_release_uridp()

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into...
Tom Rini [Thu, 12 Sep 2024 15:03:40 +0000 (09:03 -0600)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into next

CI result shows no issue:
https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/22315
----------------------------------------------------------------
- Aspeed: Add AST2700 board (Ibex RISC-V core) support
        - Add timer, dram controller, network support
- Sophgo: Add clock controller support for Milk-V Duo

3 months agoMerge tag 'u-boot-imx-next-20240911' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Thu, 12 Sep 2024 01:07:53 +0000 (19:07 -0600)]
Merge tag 'u-boot-imx-next-20240911' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next

CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/22320

- Improve i.MX8M boot time by enabling MMU and D-cache very early.
- Don't drop the enable bit once set on the i.MX PWM driver.
- Enable DM_RNG so that the kaslr-seed property is set in the dt
  allowing Linux KASLR.

3 months agopwm: imx: Don't drop the enable bit once set
Miquel Raynal [Tue, 10 Sep 2024 09:13:59 +0000 (11:13 +0200)]
pwm: imx: Don't drop the enable bit once set

Changing the duty-cycle should not blindly override (and clear) the
enable (EN) bit if it has already been set. For instance, a PWM
backlight can be enabled and set to a specific intensity using two
operations. The order of these operations should not matter.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 months agoconfigs: venice: enable DM_RNG
Tim Harvey [Thu, 5 Sep 2024 19:08:26 +0000 (12:08 -0700)]
configs: venice: enable DM_RNG

Enable DM_RNG so that the kaslr-seed property is set in the dt allowing
Linux KASLR.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 months agoARM: imx: Enable MMU and dcache very early on i.MX8M
Marek Vasut [Thu, 5 Sep 2024 15:35:00 +0000 (17:35 +0200)]
ARM: imx: Enable MMU and dcache very early on i.MX8M

Enable MMU and caches very early on in the boot process on i.MX8M
in U-Boot proper. This allows board_init_f to run with icache and
dcache enabled, which saves some 700 milliseconds of boot time on
i.MX8M Plus based device.

The 'bootstage report' output is below:

Before:
```
Timer summary in microseconds (8 records):
       Mark    Elapsed  Stage
          0          0  reset
    961,363    961,363  board_init_f
  1,818,874    857,511  board_init_r
  1,921,474    102,600  eth_common_init
  2,013,702     92,228  eth_initialize
  2,015,238      1,536  main_loop

Accumulated time:
                32,775  dm_r
               289,165  dm_f
```

After:
```
Timer summary in microseconds (8 records):
       Mark    Elapsed  Stage
          0          0  reset
    989,466    989,466  board_init_f
  1,179,100    189,634  board_init_r
  1,281,456    102,356  eth_common_init
  1,373,857     92,401  eth_initialize
  1,375,396      1,539  main_loop

Accumulated time:
                12,630  dm_f
                32,635  dm_r
```

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
3 months agoconfigs: ibex-ast2700: Enable DRAM and timer driver
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:20 +0000 (17:39 +0800)]
configs: ibex-ast2700: Enable DRAM and timer driver

Enable the driver support for the DRAM and timer devices.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoram: ast2700: Add DRAM controller initialization
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:19 +0000 (17:39 +0800)]
ram: ast2700: Add DRAM controller initialization

Add driver for AST2700 to initialize DRAM in SPL.

This patch also refactors the Kconfig dependency of
Aspeed DRAM drivers as some of them are shared among
the file structures of RV and ARM ISAs.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Acked-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoboard: ibex_ast2700: Add FMC header support
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:18 +0000 (17:39 +0800)]
board: ibex_ast2700: Add FMC header support

Define and parse the header of the First Mutable Code (FMC)
of AST2700 SoCs at runtime phase.

The FMC header contains the information to load prebuilt binaries
required for device initialization such as DRAM and VGA.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agotimer: Add AST2700 IBEX timer support
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:17 +0000 (17:39 +0800)]
timer: Add AST2700 IBEX timer support

Add the driver for the AST2700 Ibex timer, which uses CPU
cycles as the timer count running at 200MHz.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoriscv: Add AST2700 SoC initial platform support
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:16 +0000 (17:39 +0800)]
riscv: Add AST2700 SoC initial platform support

AST2700 SoCs integrates a Ibex 32-bits RISC-V core as the boot MCU
for the first stage bootloader execution, namely SPL.

This patch implements the preliminary base to successfully run SPL
on this RV32-based MCU to the console banner message.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoriscv: u-boot-spl.lds: Remove _image_binary_end alignment
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:15 +0000 (17:39 +0800)]
riscv: u-boot-spl.lds: Remove _image_binary_end alignment

The _image_binary_end symbol was aligned to the 8-bytes boundary.
However, the SPL device tree (u-boot-spl.dtb) is concatenated right
after the binary (u-boot-spl-nodtb.bin) wihtout the consideration of
the 8-bytes alignment restriction.

After then, for the SPL_SEPARATE_BSS case, fdtdec_setup() searching
for the DTB by _image_binary_end will return the "Missing DTB" error.
As the real DTB starting point does not align to a 8-bytes address
like _image_binary_end does.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoriscv: Make stack size shift configurable
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:14 +0000 (17:39 +0800)]
riscv: Make stack size shift configurable

Add prompt for STACK_SIZE_SHIFT to make it configurable.
The default value remains 14 as usual.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoriscv: Make A ISA extension selectable
Chia-Wei Wang [Tue, 10 Sep 2024 09:39:13 +0000 (17:39 +0800)]
riscv: Make A ISA extension selectable

Make the Atomic (A) ISA extension selectable. Thus CPUs such as
Ibex without the A extension can be supported.

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agodriver: net: Add Aspeed AST2700 MDIO support
Jacky Chou [Tue, 10 Sep 2024 07:49:34 +0000 (15:49 +0800)]
driver: net: Add Aspeed AST2700 MDIO support

The AST2700 is the 7th generation SoC from Aspeed.
And use the driver to support clause 22 access.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agonet: ftgmac100: Add Aspeed AST2700 support
Jacky Chou [Mon, 8 Jul 2024 06:07:18 +0000 (14:07 +0800)]
net: ftgmac100: Add Aspeed AST2700 support

Add support of Aspeed AST2700 SoC.  AST2700 is based on ARM64 so modify
the DMA address related code to fit both ARM and ARM64.  Besides, the
RMII/RGMII mode control register is moved from SCU500 to MAC50 so
initialize the register in ftgmac100_start correspondingly.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Acked-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agonet: ftgmac100: Modify desc. size to cache line
Jacky Chou [Fri, 28 Jun 2024 09:38:50 +0000 (17:38 +0800)]
net: ftgmac100: Modify desc. size to cache line

The TX/RX descriptor size is 16 byte.
When the cache line size is larger than 16 bytes, descriptors
flushed to RAM will flush more than one descriptor.
It is possible that it may mistakenly flush to other descriptor
that has been updated by MAC in RAM.

To avoid this issue, align the descriptors to cache line size.
Only one desc will be flushed or invalidated at a time.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Acked-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agonet: ftgmac100: Fixed NC-SI PHY device cannot get
Jacky Chou [Fri, 28 Jun 2024 07:14:45 +0000 (15:14 +0800)]
net: ftgmac100: Fixed NC-SI PHY device cannot get

The NC-SI interface does not need the MDIO bus and the
NC-SI PHY device cannot get from dm_eth_phy_connect.
Therefore, use phy_connect directly here.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Acked-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agonet: ftgmac100: Fixed the cache coherency issues of rx memory
Jacky Chou [Thu, 27 Jun 2024 06:26:00 +0000 (14:26 +0800)]
net: ftgmac100: Fixed the cache coherency issues of rx memory

When executing TFTP, the ARP will be replied to after receiving
the ARP. U-boot's ARP routine modifies the data in the receive
packet in response to the ARP packet and then copies it
into the transmit packet.
At this point, the received packet cache is inconsistent.
It is possible that the cache will perform a writeback action to
affect the MAC receiving packets.

Avoid the same problem that occurs in other networking protocols.
In the free_pkt function, ensure cache and memory consistency.

Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Acked-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoriscv: dts: sophgo: Replace device clocks with real clocks.
Kongyang Liu [Tue, 11 Jun 2024 09:41:16 +0000 (17:41 +0800)]
riscv: dts: sophgo: Replace device clocks with real clocks.

Replace device clocks with real clocks from the clock controller, and
remove dummy clocks.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoconfigs: milkv_duo: Enable clock controller
Kongyang Liu [Tue, 11 Jun 2024 09:41:15 +0000 (17:41 +0800)]
configs: milkv_duo: Enable clock controller

Add configs to enable clock controller for Sophgo Milk-V Duo board

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoclk: sophgo: cv1800b: Add clock controller driver for cv1800b SoC
Kongyang Liu [Tue, 11 Jun 2024 09:41:14 +0000 (17:41 +0800)]
clk: sophgo: cv1800b: Add clock controller driver for cv1800b SoC

Add clock controller driver for sophgo cv1800b SoC

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agodt-bindings: clk: import header for clock controller of sophgo CV1800B
Kongyang Liu [Tue, 11 Jun 2024 09:41:13 +0000 (17:41 +0800)]
dt-bindings: clk: import header for clock controller of sophgo CV1800B

Import header file of sophgo cv1800b clock controller from kernel

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Link: https://lore.kernel.org/all/IA1PR20MB4953637E7A6C121D7A700F1CBB8BA@IA1PR20MB4953.namprd20.prod.outlook.com/
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
3 months agoMerge patch series "phycore-am62/4: Add more boot sources"
Tom Rini [Tue, 10 Sep 2024 19:16:59 +0000 (13:16 -0600)]
Merge patch series "phycore-am62/4: Add more boot sources"

Daniel Schultz <d.schultz@phytec.de> says:

This patch stack extends the phyCORE-AM62x/AM64x U-Boot by following boot
sources:

  - Load U-Boot with USB DFU
  - Load a Linux and initramfs from OSPI/QSPI NOR flash
  - Load a Linux and rootfs from Network

Moreover, it adds required changes to the environment to boot an A/B
system with RAUC and includes some minor fixes.

3 months agoconfigs: phycore_am62x_*_defconfig: Set PHYTEC as Manufacturer
Daniel Schultz [Fri, 30 Aug 2024 09:09:40 +0000 (02:09 -0700)]
configs: phycore_am62x_*_defconfig: Set PHYTEC as Manufacturer

Commit 371b379edbf3 ("configs: Make USB_GADGET_MANUFACTURER
consistent over all PHYTEC boards") made the USB_GADGET_MANUFACTURER
value consistent over all PHYTEC boards.

Update the phyCORE-AM62x defconfigs to make this config consistent
as well.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoconfigs: phycore_am62x_a53_defconfig: Fix CONFIG_ENV_SIZE
Daniel Schultz [Fri, 30 Aug 2024 09:09:39 +0000 (02:09 -0700)]
configs: phycore_am62x_a53_defconfig: Fix CONFIG_ENV_SIZE

The environment should have a size of 0x20000 instead 0x2000.
Update to have the same environment size for all PHYTEC K3 products.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoconfigs: Add phycore_am62x_r5_usbdfu_defconfig
Daniel Schultz [Fri, 30 Aug 2024 09:09:38 +0000 (02:09 -0700)]
configs: Add phycore_am62x_r5_usbdfu_defconfig

This config includes the phycore_am62x_r5_defconfig file as well as
the am62x_r5_usbdfu.config fragment. We need another defconfig
because the AM62x has not enough internal SRAM to support all boot
sources. The normal phycore_am62x_r5_defconfig should allow to boot
from MMC and OSPI while this new defconfig allows to boot from USB.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoconfigs: phycore_am62x_a53_defconfig: Merge am62x_a53_usbdfu.config
Daniel Schultz [Fri, 30 Aug 2024 09:09:37 +0000 (02:09 -0700)]
configs: phycore_am62x_a53_defconfig: Merge am62x_a53_usbdfu.config

Merge the am62x_a53_usbdfu.config into the phyCORE-AM62x A53 defconfig to
properly support USB DFU boot.

This config was made with the following command:

    make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- \
        phycore_am62x_a53_defconfig am62x_a53_usbdfu.config

However, CONFIG_USB_GADGET_MANUFACTURER was not merged to keep Phytec
as manufacturer.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoconfigs: phycore_am64x_a53_defconfig: Make BOOTCMD generic
Daniel Schultz [Fri, 30 Aug 2024 09:09:36 +0000 (02:09 -0700)]
configs: phycore_am64x_a53_defconfig: Make BOOTCMD generic

The phyCORE-AM64x board code sets an environment variable 'boot'
with the device U-Boot booted from. Use this variable in
CONFIG_BOOTCOMMAND to boot Linux from the same boot device by
default.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoconfigs: phycore_am62x_a53_defconfig: Make BOOTCMD generic
Daniel Schultz [Fri, 30 Aug 2024 09:09:35 +0000 (02:09 -0700)]
configs: phycore_am62x_a53_defconfig: Make BOOTCMD generic

The phyCORE-AM62x board code sets an environment variable 'boot'
with the device U-Boot booted from. Use this variable in
CONFIG_BOOTCOMMAND to boot Linux from the same boot device by
default.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoboard: phytec: phycore_am64x: Add Network/SPI Boot
Daniel Schultz [Fri, 30 Aug 2024 09:09:34 +0000 (02:09 -0700)]
board: phytec: phycore_am64x: Add Network/SPI Boot

Include the boot logic to boot via Network or from a OSPI/QSPI
NOR flash. Moreover, set all required variables to both boot
methods to the environment.

Note: The phyBOARD-Electra AM64x is not able to load the U-Boot
via Network. However, it's still possible to load the kernel.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoboard: phytec: phycore_am62x: Add Network/SPI Boot
Daniel Schultz [Fri, 30 Aug 2024 09:09:33 +0000 (02:09 -0700)]
board: phytec: phycore_am62x: Add Network/SPI Boot

Include the boot logic to boot via Network or from a OSPI/QSPI
NOR flash. Moreover, set all required variables to both boot
methods to the environment.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoinclude: env: phytec: Add K3 boot logic for OSPI/QSPI flashes
Daniel Schultz [Fri, 30 Aug 2024 09:09:32 +0000 (02:09 -0700)]
include: env: phytec: Add K3 boot logic for OSPI/QSPI flashes

This boot logic allows to boot a Kernel image, Device-Tree blob
and a initramfs from an external OSPI/QSPI NOR flash.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoinclude: net: phytec: Add K3 network boot logic
Daniel Schultz [Fri, 30 Aug 2024 09:09:31 +0000 (02:09 -0700)]
include: net: phytec: Add K3 network boot logic

This boot logic allows to boot a Kernel image, Device-Tree blob
and overlays via tftp/dhcp (configurable with 'net_fetch_cmd').
Additionally, it loads a rootfs via NFS.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoinclude: env: phytec: Add raucinit to k3_mmc environment
Daniel Schultz [Fri, 30 Aug 2024 09:09:30 +0000 (02:09 -0700)]
include: env: phytec: Add raucinit to k3_mmc environment

Initialize the environment for booting an RAUC image when
'doraucboot' is set to 1.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoinclude: env: phytec: k3_mmc: Rename variables
Daniel Schultz [Fri, 30 Aug 2024 09:09:29 +0000 (02:09 -0700)]
include: env: phytec: k3_mmc: Rename variables

Add a mmc prefix to 'loadimage' and 'loadfdt' because we need
similar variables for other boot sources. This will prevent
name clashes and allows to implement similar boot logic.

Also switch from loadaddr to kernel_addr_r.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agoconfigs: phycore_am64x_a53_defconfig: Enable CONFIG_OF_BOARD_SETUP
Wadim Egorov [Fri, 30 Aug 2024 09:09:28 +0000 (02:09 -0700)]
configs: phycore_am64x_a53_defconfig: Enable CONFIG_OF_BOARD_SETUP

Enable CONFIG_OF_BOARD_SETUP to fixup kernel device tree with mtd
partitions.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
3 months agospl: spl_load: fix comparison between negative error code and unsigned size
Daniel Palmer [Sat, 31 Aug 2024 03:17:06 +0000 (12:17 +0900)]
spl: spl_load: fix comparison between negative error code and unsigned size

read could be a negative error value but size in spl_image is unsigned
so when they are compared read is used as if it's a unsigned value
and if it's negative it'll most likely be bigger than size and the
result will be true and _spl_load() will return 0 to the caller.

This results in the caller to _spl_load() not seeing that an error happened
as it should and continuing as if the load was completed when it might
not have been.

Check if read is negative and return it's value if it is before comparing
against size in spl_image.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agotest/py: spi: Set the expected error message
Love Kumar [Mon, 2 Sep 2024 18:38:17 +0000 (00:08 +0530)]
test/py: spi: Set the expected error message

If erase/write/read size is 0 then it throws the mentioned error message
when debug message ie enabled as per 899fb5aa8bec ("cmd: sf/nand: Print
and return failure when 0 length is passed"), setting it to None as
debug message is not enabled by default for testing.

Signed-off-by: Love Kumar <love.kumar@amd.com>
3 months agotreewide: drop redundant "type string" for SYS_SOC and friends
Rasmus Villemoes [Wed, 4 Sep 2024 08:18:40 +0000 (10:18 +0200)]
treewide: drop redundant "type string" for SYS_SOC and friends

The Kconfig symbols SYS_ARCH, SYS_CPU, SYS_SOC, SYS_VENDOR and
SYS_BOARD are defined in arch/Kconfig as having type string, and most
board files simply amend those definition with suitable

  default "foo"

or

  default "foo" if BAR

stanzas. But some also include a redundant repetition of the type.

Homogenize the code base by removing those lines.

Generated by

  find arch/*/ board -name Kconfig | xargs perl -i -g -pe 's/(config SYS_(ARCH|CPU|SOC|VENDOR|BOARD)\n)\s*string\n/\1/gs'

with the trailing slash in arch/*/ ensuring that arch/Kconfig itself
is not found.

This does not change boards which add a prompt string, e.g.

  string "Board name"

because I think those change the semantics of the symbol into being
user-settable.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 months agoarm: Remove ethernut5 board
Tom Rini [Sat, 7 Sep 2024 22:20:13 +0000 (16:20 -0600)]
arm: Remove ethernut5 board

As per the maintainers at egnite GmbH, they are no longer interested in
supporting this board. Go and remove the platform here. Furthermore,
this is the only AT91SAM9XE platform in-tree so remove supporting code
for that as well.

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 months agonet: guard call to tftp_start() with IS_ENABLED(CONFIG_CMD_TFTPBOOT)
Jerome Forissier [Mon, 2 Sep 2024 13:25:11 +0000 (15:25 +0200)]
net: guard call to tftp_start() with IS_ENABLED(CONFIG_CMD_TFTPBOOT)

net_auto_load() cannot call tftp_start() if CONFIG_CMD_TFTPBOOT is
disabled.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
3 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-usb into next
Tom Rini [Mon, 9 Sep 2024 21:54:56 +0000 (15:54 -0600)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-usb into next

3 months agoMerge branch 'qcom-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-snapdrago...
Tom Rini [Mon, 9 Sep 2024 16:52:55 +0000 (10:52 -0600)]
Merge branch 'qcom-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-snapdragon into next

Various improvements to Snapdragon support:

* Bumped up the pagetable size to handle newer SoCs with much more RAM
* Made memory map parsing more robust, fixing chainloading on
  SM8550/SM8650
* Populate fdt_addr_r with U-Boot's FDT by default, and set $loadaddr to
  prevent
  crashes with some commands which expect it
* Added initial support for SC7280/QCM6490 and the new RB3 Gen 2 board
* Add debug config fragments to enable debug UART on some SoCs.
* Enable RPMh regulators on SM8550/SM8650
* Map the cmd-db memory explicitly since it may not be in the memory map

CI: https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/pipelines/22255

3 months agophy: test: Implement sandbox PHY .set_mode and DM test
Marek Vasut [Sun, 8 Sep 2024 21:09:05 +0000 (23:09 +0200)]
phy: test: Implement sandbox PHY .set_mode and DM test

Implement trivial extension to the sandbox PHY, which makes it pretend
to support selecting USB Host mode and nothing else. Any other mode is
rejected with -EINVAL. Any submode except for default submode 0 is
rejected with -EOPNOTSUPP . The implementation behaves in this trivial
way to permit easy unit testing using test which is also added in this
commit.

To run the test, use e.g. sandbox64_defconfig and run U-Boot as follows:
$ ./u-boot -Tc 'ut dm phy_setup'

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
3 months agophy: rcar: Split init and set_mode operations
Marek Vasut [Sun, 8 Sep 2024 21:09:04 +0000 (23:09 +0200)]
phy: rcar: Split init and set_mode operations

The current init operation also sets the PHY into USB host mode.
Split the mode configuration into set_mode callback instead and
implement support for device and OTG modes as well.

The OTG mode performs auto-detection and selects either host or
device mode. In case the OTG mode is configured, submode field
can be used to select full PHY (re)initialization or only mode
auto-detection. The full (re)initialization is only necessary
once, on start up.

Since the OTG mode may enable IRQ generation in the PHY, disable
that IRQ generation in the exit callback again.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
3 months agophy: Extend generic_setup_phy() with PHY mode and submode
Marek Vasut [Sun, 8 Sep 2024 21:09:03 +0000 (23:09 +0200)]
phy: Extend generic_setup_phy() with PHY mode and submode

Extend generic_setup_phy() parameter list with PHY mode and submode and
call generic_phy_set_mode() in generic_setup_phy(), so the generic PHY
setup function can configure the PHY into correct mode before powering
the PHY up.

Update all call sites of generic_setup_phy() as well, all of which are
USB host related, except for DM test which now behaves as a USB host
test.

Note that if the PHY driver does not implement the .set_mode callback,
generic_phy_set_mode() call returns 0 and does not error out, so this
should not break any existing systems.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
3 months agobuildman: Support building within a Python venv
Simon Glass [Thu, 15 Aug 2024 19:57:44 +0000 (13:57 -0600)]
buildman: Support building within a Python venv

The Python virtualenv tool sets up a few things in the environment,
putting its path first in the PATH environment variable and setting up
a sys.prefix different from the sys.base_prefix value.

At present buildman puts the toolchain path first in PATH so that it can
be found easily during the build. For sandbox this causes problems since
/usr/bin/gcc (for example) results in '/usr/bin' being prepended to the
PATH variable. As a result, the venv is partially disabled.

The result is that sandbox builds within a venv ignore the venv, e.g.
when looking for packages.

Correct this by detecting the venv and adding the toolchain path after
the venv path.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 months agoboard/qualcomm: add debug config fragments for some SoCs
Caleb Connolly [Tue, 20 Aug 2024 23:00:27 +0000 (01:00 +0200)]
board/qualcomm: add debug config fragments for some SoCs

We already have some documentation describing how to enable debug UART
for Qualcomm SoCs. However the UART address varies per-soc... Add some
config fragments to enable debug UART for few well supported SoCs.

These can be used like:

$ make qcom_defconfig debug-sdm845.config

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agodoc: board/qualcomm: document rb3gen2 building/flashing
Caleb Connolly [Wed, 21 Aug 2024 13:41:52 +0000 (15:41 +0200)]
doc: board/qualcomm: document rb3gen2 building/flashing

The process here is almost identical to the Dragonboard 410c, we've come
full circle!

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoconfigs: add qcm6490_defconfig
Caleb Connolly [Wed, 21 Aug 2024 13:41:51 +0000 (15:41 +0200)]
configs: add qcm6490_defconfig

Introduce a defconfig for the RB3 Gen 2 and other QCM6490 boards with a
dedicated uefi partition. These can replace EDK2 entirely with U-Boot.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoqcom_defconfig: enable SC7280 clocks
Caleb Connolly [Wed, 21 Aug 2024 13:41:50 +0000 (15:41 +0200)]
qcom_defconfig: enable SC7280 clocks

Enable clocks on SC7280

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoiommu: qcom-smmu: add sc7280-smmu-500 compatible
Caleb Connolly [Wed, 21 Aug 2024 13:41:49 +0000 (15:41 +0200)]
iommu: qcom-smmu: add sc7280-smmu-500 compatible

This soc doesn't have the generic compatible.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agodts: qcs6490-rb3gen2-u-boot: USB host mode
Caleb Connolly [Wed, 21 Aug 2024 13:41:48 +0000 (15:41 +0200)]
dts: qcs6490-rb3gen2-u-boot: USB host mode

Adjust DTS so USB runs in host mode. The type-c port is the only
supported port (since the others need PCIe). Booting from USB is
possible with a powered type-c dock.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agodts: qcs6490-rb3gen2-u-boot: add override dtsi
Caleb Connolly [Wed, 21 Aug 2024 13:41:47 +0000 (15:41 +0200)]
dts: qcs6490-rb3gen2-u-boot: add override dtsi

For running U-Boot as primary bootloader we must define the memory
layout statically.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoclk/qcom: add initial clock driver for sc7280
Caleb Connolly [Wed, 21 Aug 2024 13:41:46 +0000 (15:41 +0200)]
clk/qcom: add initial clock driver for sc7280

We don't actually need any clocks to get UFS up and running, resets are
useful though.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoregulator: qcom-rpmh-regulator: add support for PM8550 & related regulators
Neil Armstrong [Tue, 3 Sep 2024 16:13:31 +0000 (18:13 +0200)]
regulator: qcom-rpmh-regulator: add support for PM8550 & related regulators

Add the PM8550 & related regulators found on the SM8550 and SM8650 platforms.
The tables are imported from the Linux driver.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agosoc: qcom: rpmh-rsc: add back __tcs_set_trigger() for SM8550/SM8650
Neil Armstrong [Tue, 3 Sep 2024 16:13:30 +0000 (18:13 +0200)]
soc: qcom: rpmh-rsc: add back __tcs_set_trigger() for SM8550/SM8650

The TCS writes has no effect after the removal of the __tcs_set_trigger()
call, obviously it seems the RSC version 3 requires it to complete the transactions.

Fixes: 80c5be164ad ("soc: qcom: rpmh-rsc: drop unused multi-threading and non-active TCS support")
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Caleb Connolly <caleb.connolly@linaro.org> # sm8250 rb5
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoqcom_defconfig: bump CONFIG_NR_DRAM_BANKS
Caleb Connolly [Thu, 8 Aug 2024 23:59:34 +0000 (01:59 +0200)]
qcom_defconfig: bump CONFIG_NR_DRAM_BANKS

Some newer boards end up with a bunch of holes in the memory map due to
how Qualcomm's hypervisor and ABL work. The end result is 14+ memory
regions.

Bump CONFIG_NR_DRAM_BANKS to 24 so we can handle these and any future
expansion easily.

Yes, this is ridiculous, but there is no other way.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agosoc: qcom: cmd-db: map cmd-db region
Caleb Connolly [Thu, 8 Aug 2024 23:59:33 +0000 (01:59 +0200)]
soc: qcom: cmd-db: map cmd-db region

On at least SM8650 this region might not be included in the memory map.
Use the new mmu_map_region() helper to map it during bind().

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agosoc: qcom: cmd-db: use strncmp() instead of memcmp()
Caleb Connolly [Thu, 8 Aug 2024 23:59:32 +0000 (01:59 +0200)]
soc: qcom: cmd-db: use strncmp() instead of memcmp()

memcmp() can cause aborts on some platforms and generally seems to be
the wrong approach here. Use strncmp() instead which is more correct.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoarmv8: mmu: add a way to map additional regions
Caleb Connolly [Thu, 8 Aug 2024 23:59:31 +0000 (01:59 +0200)]
armv8: mmu: add a way to map additional regions

In some cases we might want to map some memory region after enabling
caches. Introduce a new helper for this.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agomach-snapdragon: set loadaddr
Caleb Connolly [Thu, 8 Aug 2024 23:59:30 +0000 (01:59 +0200)]
mach-snapdragon: set loadaddr

This variable is used by default in some commands, set it to the same as
kernel_addr_r.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agomach-snapdragon: populate fallback FDT
Caleb Connolly [Thu, 8 Aug 2024 23:59:29 +0000 (01:59 +0200)]
mach-snapdragon: populate fallback FDT

Set the fdt_addr_r environment variable to a region of LMB allocated
memory, and populate it by default with a copy of U-Boots FDT. This will
be used for Linux if no other DT is provided.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agomach-snapdragon: allocate fastboot buffer dynamically
Caleb Connolly [Thu, 8 Aug 2024 23:59:28 +0000 (01:59 +0200)]
mach-snapdragon: allocate fastboot buffer dynamically

We don't know at build time where a sensible place for this is, allocate
it at runtime like the other variables.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agomach-snapdragon: set serial number
Caleb Connolly [Thu, 8 Aug 2024 23:59:27 +0000 (01:59 +0200)]
mach-snapdragon: set serial number

In the typical case where we chainload from ABL, the serial number is
available in the DT bootargs. Read it out and set the serial#
environment variable so that it can be used by fastboot.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agomach-snapdragon: use 1MiB for get_page_table_size()
Neil Armstrong [Thu, 8 Aug 2024 23:59:26 +0000 (01:59 +0200)]
mach-snapdragon: use 1MiB for get_page_table_size()

With 14+ entries in the memory map, we need quite a bit more space for
the page tables.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agomach-snapdragon: parse memory ourselves
Caleb Connolly [Thu, 8 Aug 2024 23:59:25 +0000 (01:59 +0200)]
mach-snapdragon: parse memory ourselves

The generic memory parsing code in U-Boot lacks a few things that we
need on Qualcomm:

1. It sets gd->ram_size and gd->ram_base to represent a single memory
   block.
2. setup_dest_addr() later relocates U-Boot to ram_base + ram_size, the
   end of that first memory block.

This results in all memory beyond U-Boot being unusable in Linux when
booting with EFI.

Since the ranges in the memory node may be out of order, the only way
for us to correctly determine the relocation address for U-Boot is to
parse all memory regions and find the highest valid address.

We can't use fdtdec_setup_memory_banksize() since it stores the result
in gd->bd which is not yet allocated.

Hence, this commit, which implements an optimised parser to read the
memory blocks and store them in the .data section where they will
survive relocation.

We set ram_base and ram_size to describe the entire address space of
memory, with the assumption that the last memory region is big enough
for U-Boot, its DTB, and heap. On all boards tested so far this seems
to be a reasonable assumption.

As a nice side effect, our fdt parsing also winds up being faster since
we avoid the overhead of checking address/size-cells or populating
struct resource. We can safely make these optimisations since we only
support ARM64, and trust the reg property to be populated correctly.

After relocation, we then populate gd->bd->bi_dram with the data we
parsed earlier.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agomach-snapdragon: refactor board_fdt_blob_setup()
Caleb Connolly [Thu, 8 Aug 2024 23:59:24 +0000 (01:59 +0200)]
mach-snapdragon: refactor board_fdt_blob_setup()

If U-Boot has a DTB built in (appended to the image directly) then this
was likely intentional, we should prioritise it over one provided by ABL
(if there was one).

Make this behaviour explicit, and panic if no valid DTB could be found
anywhere. Returning an error is not useful in this case as U-Boot would
just crash later in a more confusing way.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agoregulator: fixed: fix regulator-fixed-clock
John Keeping [Tue, 9 Jul 2024 09:24:54 +0000 (10:24 +0100)]
regulator: fixed: fix regulator-fixed-clock

For regulator-fixed-clock, the device's private data is never set so in
fixed_clock_regulator_set_enable() is null and the function cannot
complete successfully.

Rename the _plat structure to _priv to better represent its role and set
this as the private data.  As shown by the set_enable() function and by
using the same .of_to_plat hook as regulator-fixed, the platform data is
regulator_common_plat so also set .plat_auto correctly.

Finally, set up the private data by adding a .probe function to look up
the clock and set the member variable.

Fixes: f3b5100aff3 ("regulator: fixed: add possibility to enable by clock")
Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 months agopower: regulator: tps6287x: Add driver for TPS6287x step down convertors
Keerthy [Fri, 31 May 2024 05:50:41 +0000 (11:20 +0530)]
power: regulator: tps6287x: Add driver for TPS6287x step down convertors

Add driver for TPS6287x step down convertors

Data sheet: https://www.ti.com/lit/ds/slvsgc5a/slvsgc5a.pdf

Signed-off-by: Keerthy <j-keerthy@ti.com>
3 months agommc: consider cd-gpios in Synopsys DesignWare driver
Heinrich Schuchardt [Sun, 21 Jul 2024 06:59:07 +0000 (08:59 +0200)]
mmc: consider cd-gpios in Synopsys DesignWare driver

The JH7110 SoC uses a GPIO for card detect.

* In the of_to_plat function check if a cd-gpios definition exists and
  request the GPIO.
* In the getcd function return the GPIO value in this case.

Reported-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
3 months agommc: msm_sdhci: program core_vendor_spec
Caleb Connolly [Fri, 21 Jun 2024 01:53:09 +0000 (03:53 +0200)]
mmc: msm_sdhci: program core_vendor_spec

After resetting the host controller, program in the POR val for this
register just like the Linux driver does.

This seems to help with initialization when running U-Boot as the primary
bootloader on some boards.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
3 months agommc: Change the frequency to MMC_HS_52 when selecting hs400
Venkatesh Yadav Abbarapu [Tue, 23 Apr 2024 05:30:57 +0000 (11:00 +0530)]
mmc: Change the frequency to MMC_HS_52 when selecting hs400

Per JESD84-B51 P47, host need to change frequency to <=52MHz
after setting HS_TIMING to 0x1, and host need to set the
8-bit DDR buswidth. Currently setting the frequency to 26MHz
and trying to switch 8-bit DDR buswidth resulting timeouts.

mmc dev 1 0
Select HS400 failed -110
switch to partitions #0, OK
mmc1(part 0) is current device

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
3 months agommc: sdhci-cadence: Add support for Cadence sdmmc v6
Kuan Lim Lee [Tue, 28 Nov 2023 06:38:30 +0000 (14:38 +0800)]
mmc: sdhci-cadence: Add support for Cadence sdmmc v6

Cadence SDMMC v6 controller has a lot of changes on initialize
compared to v4 controller. PHY is needed by v6 controller.

Signed-off-by: Kuan Lim Lee <kuanlim.lee@starfivetech.com>
Co-developed-by: Alex Soo <yuklin.soo@starfivetech.com>
Signed-off-by: Wei Liang Lim <weiliang.lim@starfivetech.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 months agoMerge patch series "provide names for emmc hardware partitions"
Tom Rini [Thu, 5 Sep 2024 18:13:24 +0000 (12:13 -0600)]
Merge patch series "provide names for emmc hardware partitions"

Tim Harvey <tharvey@gateworks.com> says:

Modern eMMC v4+ devices have multiple hardware partitions per the JEDEC
specification described as:
 Boot Area Partition 1
 Boot Area Partition 2
 RPMB Partition
 General Purpose Partition 1
 General Purpose Partition 2
 General Purpose Partition 3
 General Purpose Partition 4
 User Data Area

These are referenced by fields in the PARTITION_CONFIG register
(Extended CSD Register 179) which is defined as:
bit 7: reserved
bit 6: BOOT_ACK
  0x0: No boot acknowledge sent (default
  0x1: Boot acknowledge sent during boot operation Bit
bit 5:3: BOOT_PARTITION_ENABLE
  0x0: Device not boot enabled (default)
  0x1: Boot Area partition 1 enabled for boot
  0x2: Boot Area partition 2 enabled for boot
  0x3-0x6: Reserved
  0x7: User area enabled for boot
bit 2:0 PARTITION_ACCESS
  0x0: No access to boot partition (default)
  0x1: Boot Area partition 1
  0x2: Boot Area partition 2
  0x3: Replay Protected Memory Block (RPMB)
  0x4: Access to General Purpose partition 1
  0x5: Access to General Purpose partition 2
  0x6: Access to General Purpose partition 3
  0x7: Access to General Purpose partition 4

Note that setting PARTITION_ACCESS to 0x0 results in selecting the User
Data Area partition.

You can see above that the two fields BOOT_PARTITION_ENABLE and
PARTITION_ACCESS do not use the same enumerated values.

U-Boot uses a set of macros to access fields of the PARTITION_CONFIG
register:
EXT_CSD_BOOT_ACK_ENABLE                 (1 << 6)
EXT_CSD_BOOT_PARTITION_ENABLE           (1 << 3)
EXT_CSD_PARTITION_ACCESS_ENABLE         (1 << 0)
EXT_CSD_PARTITION_ACCESS_DISABLE        (0 << 0)

EXT_CSD_BOOT_ACK(x)             (x << 6)
EXT_CSD_BOOT_PART_NUM(x)        (x << 3)
EXT_CSD_PARTITION_ACCESS(x)     (x << 0)

EXT_CSD_EXTRACT_BOOT_ACK(x) (((x) >> 6) & 0x1)
EXT_CSD_EXTRACT_BOOT_PART(x) (((x) >> 3) & 0x7)
EXT_CSD_EXTRACT_PARTITION_ACCESS(x) ((x) & 0x7)

There are various places in U-Boot where the BOOT_PARTITION_ENABLE field
is accessed via EXT_CSD_EXTRACT_PARTITION_ACCESS and converted to a
hardware partition consistent with the definition of the
PARTITION_ACCESS field used by the various mmc_switch incarnations.

To add some sanity to the distinction between BOOT_PARTITION_ENABLE
(used to specify the active device on power-cycle) and PARTITION_ACCESS
(used to switch between hardware partitions) create two enumerated types
and use them wherever struct mmc * part_config is used or the above
macros are used.

Additionally provide arrays of the field names and allow those to be
used in the 'mmc partconf' command and in board support files.

The first patch adds enumerated types and makes use of them which
represents no compiled code change.

The 2nd patch adds the array of names and uses them in the 'mmc
partconf' command.

The 3rd patch uses the array of hardware partition names in a board
support file to show what emmc hardware partition U-Boot is being loaded
from.

3 months agovenice: show emmc boot hardware partition
Tim Harvey [Fri, 31 May 2024 15:36:35 +0000 (08:36 -0700)]
venice: show emmc boot hardware partition

To aid in understanding what emmc hardware partition is being
used to boot on power-up, display the hardware partition name in the
SPL.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 months agommc: allow use of hardware partition names for mmc partconf
Tim Harvey [Fri, 31 May 2024 15:36:34 +0000 (08:36 -0700)]
mmc: allow use of hardware partition names for mmc partconf

eMMC v4+ devices have hardware partitions that are accessed via the
PARTITION_CONFIG (Extended CSD Register 179) PARTITION_ACCESS
and BOOT_PARTITION_ENABLE fields defined as:
bit 5:3: BOOT_PARTITION_ENABLE
  0x0: Device not boot enabled (default)
  0x1: Boot Area partition 1 enabled for boot
  0x2: Boot Area partition 2 enabled for boot
  0x3-0x6: Reserved
  0x7: User area enabled for boot
bit 2:0 PARTITION_ACCESS
  0x0: No access to boot partition (default)
  0x1: Boot Area partition 1
  0x2: Boot Area partition 2
  0x3: Replay Protected Memory Block (RPMB)
  0x4: Access to General Purpose partition 1
  0x5: Access to General Purpose partition 2
  0x6: Access to General Purpose partition 3
  0x7: Access to General Purpose partition 4

Add char arrays to provide names for these values.

Use these names which displaying or setting the PARTITION_CONFIG
register via the 'mmc partconf' command.

Before:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2
EXT_CSD[179], PARTITION_CONFIG:
BOOT_ACK: 0x1
BOOT_PARTITION_ENABLE: 0x2
PARTITION_ACCESS: 0x0

After:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2
EXT_CSD[179], PARTITION_CONFIG:
BOOT_ACK: 0x1
BOOT_PARTITION_ENABLE: 0x1 (boot0)
PARTITION_ACCESS: 0x0 (user)
u-boot=> mmc partconf 2 1 boot1 0 && mmc partconf 2
EXT_CSD[179], PARTITION_CONFIG:
BOOT_ACK: 0x1
BOOT_PARTITION_ENABLE: 0x2 (boot1)
PARTITION_ACCESS: 0x0 (user)

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 months agommc: use an enumerated type to represent PARTITION_CONFIG fields
Tim Harvey [Fri, 31 May 2024 15:36:33 +0000 (08:36 -0700)]
mmc: use an enumerated type to represent PARTITION_CONFIG fields

Modern eMMC v4+ devices have multiple hardware partitions per the JEDEC
specification described as:
  Boot Area Partition 1
  Boot Area Partition 2
  RPMB Partition
  General Purpose Partition 1
  General Purpose Partition 2
  General Purpose Partition 3
  General Purpose Partition 4
  User Data Area

These are referenced by fields in the PARTITION_CONFIG register
(Extended CSD Register 179) which is defined as:
bit 7: reserved
bit 6: BOOT_ACK
  0x0: No boot acknowledge sent (default
  0x1: Boot acknowledge sent during boot operation Bit
bit 5:3: BOOT_PARTITION_ENABLE
  0x0: Device not boot enabled (default)
  0x1: Boot Area partition 1 enabled for boot
  0x2: Boot Area partition 2 enabled for boot
  0x3-0x6: Reserved
  0x7: User area enabled for boot
bit 2:0 PARTITION_ACCESS
  0x0: No access to boot partition (default)
  0x1: Boot Area partition 1
  0x2: Boot Area partition 2
  0x3: Replay Protected Memory Block (RPMB)
  0x4: Access to General Purpose partition 1
  0x5: Access to General Purpose partition 2
  0x6: Access to General Purpose partition 3
  0x7: Access to General Purpose partition 4

Note that setting PARTITION_ACCESS to 0x0 results in selecting the User
Data Area partition.

You can see above that the two fields BOOT_PARTITION_ENABLE and
PARTITION_ACCESS do not use the same enumerated values.

U-Boot uses a set of macros to access fields of the PARTITION_CONFIG
register:

There are various places in U-Boot where the BOOT_PARTITION_ENABLE field
is accessed via EXT_CSD_EXTRACT_PARTITION_ACCESS and converted to a
hardware partition consistent with the definition of the
PARTITION_ACCESS field which is also the value used to specify the
hardware partition of the various mmc_switch incarnations.

To add some sanity to the distinction between BOOT_PARTITION_ENABLE
(used to specify the active device on power-cycle) and PARTITION_ACCESS
(used to switch between hardware partitions) create two enumerated types
and use them wherever struct mmc * part_config is used or the above
macros are used.

This represents no code changes.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
3 months agoMerge patch series "Make LMB memory map global and persistent"
Tom Rini [Tue, 3 Sep 2024 20:09:30 +0000 (14:09 -0600)]
Merge patch series "Make LMB memory map global and persistent"

Sughosh Ganu <sughosh.ganu@linaro.org> says:

This is a follow-up from an earlier RFC series [1] for making the LMB
and EFI memory allocations work together. This is a non-rfc version
with only the LMB part of the patches, for making the LMB memory map
global and persistent.

This is part one of a set of patches which aim to have the LMB and EFI
memory allocations work together. This requires making the LMB memory
map global and persistent, instead of having local, caller specific
maps. This is being done keeping in mind the usage of LMB memory by
platforms where the same memory region can be used to load multiple
different images. What is not allowed is to overwrite memory that has
been allocated by the other module, currently the EFI memory
module. This is being achieved by introducing a new flag,
LMB_NOOVERWRITE, which represents memory which cannot be re-requested
once allocated.

The data structures (alloced lists) required for maintaining the LMB
map are initialised during board init. The LMB module is enabled by
default for the main U-Boot image, while it needs to be enabled for
SPL. This version also uses a stack implementation, as suggested by
Simon Glass to temporarily store the lmb structure instance which is
used during normal operation when running lmb tests. This does away
with the need to run the lmb tests separately.

The tests have been tweaked where needed because of these changes.

The second part of the patches, to be sent subsequently, would work on
having the EFI allocations work with the LMB API's.

[1] - https://lore.kernel.org/u-boot/20240704073544.670249-1-sughosh.ganu@linaro.org/T/#t

Notes:

1) These patches are on next, as the alist patches have been
   applied to that branch.
2) I have tested the boot on the ST DK2 board, but it would be good to
   get a T-b/R-b from the ST maintainers.
3) It will be good to test these changes on a PowerPC platform
   (ideally an 85xx, as I do not have one).