platform/kernel/u-boot.git
11 months agodoc: unbind man-page
Heinrich Schuchardt [Fri, 16 Jun 2023 15:11:49 +0000 (17:11 +0200)]
doc: unbind man-page

Provide a man-page for the unbind command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Wed, 21 Jun 2023 18:42:50 +0000 (14:42 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

11 months agousb: dwc2: Fix the write to W1C fields in HPRT register
Teik Heng Chong [Wed, 21 Jun 2023 03:13:58 +0000 (11:13 +0800)]
usb: dwc2: Fix the write to W1C fields in HPRT register

Fix the write to the HPRT register which treat W1C fields
as if they were mere RW. This leads to unintended clearing of such fields

This bug was found during the testing on Simics model. Referring to
specification DesignWare Cores USB 2.0 Hi-Speed On-The-Go (OTG)
Databook (3.30a)"5.3.4.8 Host Port Control and Status Register (HPRT)", the
HPRT.PrtPwr is cleared by this mistake. In the Linux driver (contrary to
U-Boot), HPRT is always read using dwc2_read_hprt0 helper function which
clears W1C bits. So after write back those bits are zeroes.

Signed-off-by: Teik Heng Chong <teik.heng.chong@intel.com>
11 months agocmd: usb: Prevent reset in usb tree/info command
Xavier Drudis Ferran [Wed, 21 Jun 2023 07:13:07 +0000 (09:13 +0200)]
cmd: usb: Prevent reset in usb tree/info command

   Commands causing reset in some configs:

When bootflow scan is run, this will cause a UCLASS_BOOTDEV device to
be added as sibling of those UCLASS_BLK devices found in the search
chain defined in environment variable "boot_targets", until boot
succeeds from some device. This can happen automatically as part of
the default boot process on some boards (example: Rock Pi 4) depending
on the board configuration (DISTRO_DEFAULTS, BOOTSTD, BOOTCOMMAND,
etc.) because they have bootcmd=bootflow scan.

If boot doesn't succeed from any device, and usb is in boot_targets,
and an usb storage device is plugged to some usb port at boot time,
its UCLASS_MASS_STORAGE device will have a UCLASS_BOOTDEV device as
child, besides a UCLASS_BLK child.

If once the boot fails the user enters at the U-Boot shell prompt:

usb info

or

usb tree

The code in cmd/usb.c will eventually recurse into the UCLASS_BOOTDEV
device and pass a null usb_device pointer to usb_show_tree_graph() or
usb_show_info() (because it has no parent_priv_).

This causes a reset. The expected behaviour would be to ignore the
UCLASS_BOOTDEV device, continue listing the usb information and return
to the prompt.

   Minimal test:

Another way to trigger this reset as a minimal test or on boards with
a different bootcmd would be:

- make sure "usb" is in environment variable boot_targets (might need
  setenv boot_targets usb; and/or saveenv and reset), then, with a usb
  storage device plugged to a usb port, run:

=> usb reset ; bootflow scan ; usb info

   Solution:

Fix it (twice) by checking for null parent_priv_ and adding
UCLASS_BOOTDEV to the list of ignored class ids before the recursive
call.

This prevents the current particular problem with UCLASS_BOOTDEV, even
in case it ever gets some parent_priv_ struct which is not an
usb_device, despite being the child of a usb_device->dev. And it also
prevents possible future problems if other children are added to usb
devices that don't have parent_priv_ because they are not part of the
usb tree, just abstractions of functionality (like UCLASS_BLK and
UCLASS_BOOTDEV are now).

Signed-off-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
11 months agoMerge tag 'u-boot-at91-fixes-2023.07-a' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 19 Jun 2023 13:18:40 +0000 (09:18 -0400)]
Merge tag 'u-boot-at91-fixes-2023.07-a' of https://source.denx.de/u-boot/custodians/u-boot-at91

First set of u-boot-atmel fixes for the 2023.07 cycle:

This small fixes set includes one init fix for scmi clocks and a missing
gpio_request for pm9g45.

11 months agoMerge tag 'efi-2023-07-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 16 Jun 2023 23:05:52 +0000 (19:05 -0400)]
Merge tag 'efi-2023-07-rc5' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-07-rc5

Documentation:

* man-page for imxtract
* correct EVT_DM_POST_INIT_F description

UEFI:

* bootm: don't call booti_setup for EFI images
* simplify efi_disk_remove
* fix tests that failed when executed repeatedly

11 months agoARM: at91: don't initialize clocks if scmi clock driver is enabled
Clément Léger [Tue, 30 May 2023 09:05:16 +0000 (11:05 +0200)]
ARM: at91: don't initialize clocks if scmi clock driver is enabled

Because clock devices are initialized by the SCMI server, if
CONFIG_CLK_SCMI is defined.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
11 months agoboard: pm9g45: add missing gpio_request()
Ilko Iliev [Tue, 13 Jun 2023 15:09:58 +0000 (17:09 +0200)]
board: pm9g45: add missing gpio_request()

This fixes the following run time error message:

set_dir_flags: error: gpio PIOD3 not reserved
set_dir_flags: error: gpio PIOC14 not reserved

Signed-off-by: Ilko Iliev <iliev@ronetix.at>
11 months agoefi_selftests: fix protocol repeated selftesting
Ilias Apalodimas [Tue, 13 Jun 2023 13:23:06 +0000 (16:23 +0300)]
efi_selftests: fix protocol repeated selftesting

Running the protocols  selftest more than one times fails with

=> setenv efi_selftest 'manage protocols' && bootefi selftest
Testing EFI API implementation
Selected test: 'manage protocols'
Setting up 'manage protocols'
Setting up 'manage protocols' succeeded
Executing 'manage protocols'
Executing 'manage protocols' succeeded
Tearing down 'manage protocols'
Tearing down 'manage protocols' succeeded
Summary: 0 failures

=> bootefi selftest
Testing EFI API implementation
Selected test: 'manage protocols'
Setting up 'manage protocols'
lib/efi_selftest/efi_selftest_manageprotocols.c(88):
ERROR: InstallProtocolInterface failed
lib/efi_selftest/efi_selftest.c(89):
ERROR: Setting up 'manage protocols' failed
Tearing down 'manage protocols'
Tearing down 'manage protocols' succeeded
Summary: 1 failures

The reason is that we don't set the handles to NULL after deleting and
freeing them.  As a result the subsequent protocol installation will try
to use an existing handle which we just removed that from our object list.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agoefi_loader: simplify efi_disk_remove
Ilias Apalodimas [Mon, 12 Jun 2023 15:35:58 +0000 (18:35 +0300)]
efi_loader: simplify efi_disk_remove

Instead of discovering the ID of the device and call two different
functions for a block device or a partition, we can rewrite
efi_disk_remove() and handle the minor differences between the two
variants internally.  As a results we can simplify efi_disk_remove()
a lot and get rid of the extra efi_disk_delete_raw/blk calls.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
If a handle is not found, return 0 to let the device be removed.

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agoefi_selftests: fix controllers repeated selftesting
Ilias Apalodimas [Wed, 14 Jun 2023 06:55:48 +0000 (09:55 +0300)]
efi_selftests: fix controllers repeated selftesting

Running the controller selftest more than one times fails with

=> setenv efi_selftest 'controllers' && bootefi selftest
Testing EFI API implementation
Selected test: 'controllers'
Setting up 'controllers'
Setting up 'controllers' succeeded
Executing 'controllers'
Executing 'controllers' succeeded
Summary: 0 failures

=> bootefi selftest
Testing EFI API implementation
Selected test: 'controllers'
Setting up 'controllers'
lib/efi_selftest/efi_selftest_controllers.c(280):
ERROR: InstallProtocolInterface failed
lib/efi_selftest/efi_selftest.c(89):
ERROR: Setting up 'controllers' failed
Summary: 1 failures

There are multiple reason for this.  We don't uninstall the binding
interface from the controller handle and we don't reset the handle
pointers either.  So let's uninstall all the protocols properly and
reset the handles to NULL on setup().

While at it add a forgotten check when uninstalling protocols from the
handle_controller and make sure the number of child controllers is 0

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agotest: correct architecture in EFI FIT test
Heinrich Schuchardt [Thu, 15 Jun 2023 11:40:05 +0000 (13:40 +0200)]
test: correct architecture in EFI FIT test

On arm64 the its we use to generate the test FIT image has

arch = "arm";

We should use "arm64" here which is mapped to IH_ARCH_ARM64 via
uimage_arch[].

Fixes: 8391f955494e ("test/py: Create a test for launching UEFI binaries from FIT images")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agobootm: don't call booti_setup for EFI images
Heinrich Schuchardt [Tue, 13 Jun 2023 06:18:27 +0000 (08:18 +0200)]
bootm: don't call booti_setup for EFI images

On the arm64 architecture booti_setup() is called for EFI FIT images.
This function call fails because EFI images typically do not have a
kernel signature.

Check that the operating system property "os" of the image is "linux"
before invoking booti_setup().

Fixes: 487b5fa6deb1 ("bootm: Handle kernel_noload on arm64")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoefi_selftest: ReinstallProtocolInterface test
Heinrich Schuchardt [Sat, 10 Jun 2023 19:25:18 +0000 (21:25 +0200)]
efi_selftest: ReinstallProtocolInterface test

Test ReinstallProtocolInterface() more rigorously.

Replacing the sole installed protocol interface must not result in deleting
the handle and creating a new one.

Check which interface is actually installed before and after
ReinstallProtocolInterface().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agoMakefile: clean lib/efi_loader/helloworld_efi.S
Heinrich Schuchardt [Fri, 2 Jun 2023 20:18:23 +0000 (22:18 +0200)]
Makefile: clean lib/efi_loader/helloworld_efi.S

lib/efi_loader/helloworld_efi.S is a generated file and shall be removed by
'make clean'.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agodoc: event: Correct EVT_DM_POST_INIT_F description
Bin Meng [Mon, 12 Jun 2023 06:12:13 +0000 (14:12 +0800)]
doc: event: Correct EVT_DM_POST_INIT_F description

EVT_DM_POST_INIT_F only works in U-Boot proper, not SPL.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Polish the wording a bit

Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
11 months agodoc: man-page for imxtract
Heinrich Schuchardt [Tue, 13 Jun 2023 19:02:01 +0000 (21:02 +0200)]
doc: man-page for imxtract

Provide a man-page for the imxtract command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
12 months agoMerge branch '2023-06-14-assorted-fixes'
Tom Rini [Wed, 14 Jun 2023 19:50:04 +0000 (15:50 -0400)]
Merge branch '2023-06-14-assorted-fixes'

- Fix some issues Coverity Scan reported in IPv6, SPL EXTn support fix,
  two small bootstd fixes, one Kconfig dependency fix, and fix booting
  on Pinephone Pro

12 months agonet: dhcp6: Fix VCI string
Sean Edmond [Thu, 18 May 2023 19:35:41 +0000 (12:35 -0700)]
net: dhcp6: Fix VCI string

Change VCI string from "U-boot" to "U-Boot".

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
12 months agonet: ipv6: Fix CID 453851 and CID 436278
Sean Edmond [Thu, 18 May 2023 19:35:40 +0000 (12:35 -0700)]
net: ipv6: Fix CID 453851 and CID 436278

CID 453851 : sprintf() shouldn't copy from/to tmp
CID 436278 : DHCP6 option_len should be checked before use

Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
12 months agorockchip: Pinephone Pro: Add DDR RAM type config
Peter Robinson [Sun, 11 Jun 2023 17:18:34 +0000 (18:18 +0100)]
rockchip: Pinephone Pro: Add DDR RAM type config

Add the RAM_ROCKCHIP_LPDDR4 to fix the Pinephone Pro booting.
When the configs were updated in 26f92be07e2 it somehow broke
the PPP boot process so let's fix it.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
CC: Jagan Teki <jagan@edgeble.ai>
CC: Kever Yang <kever.yang@rock-chips.com>
12 months agobootstd: Fix relative path use in extlinux bootmeth
Jonas Karlman [Fri, 9 Jun 2023 14:59:01 +0000 (14:59 +0000)]
bootstd: Fix relative path use in extlinux bootmeth

Using relative path in a /boot/extlinux/extlinux.conf file fails to load
linux kernel.

Using a /boot/extlinux/extlinux.conf file:

  LABEL test
    LINUX ../linux/Image

Result in following error:

  Retrieving file: ../linux/Image
  Skipping test for failure retrieving kernel
  Boot failed (err=-14)

However, using sysboot cmd successfully load kernel using same file:

  sysboot mmc 1:1 any ${scriptaddr} /boot/extlinux/extlinux.conf

  Retrieving file: /boot/extlinux/../linux/Image

Fix relative path using bootmeth extlinux by supplying bootfile path
instead of subdir path in the call to pxe_setup_ctx, same as done in the
sysboot command.

Fixes: 31aefaf89a5b ("bootstd: Add an implementation of distro boot")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
12 months agobootstd: Make BOOTSTD_FULL depend on BOOTSTD
Simon Glass [Wed, 22 Feb 2023 21:06:23 +0000 (14:06 -0700)]
bootstd: Make BOOTSTD_FULL depend on BOOTSTD

Move BOOTSTD_FULL down in the file so that it can be enabled only when
BOOTSTD is enabled. This prevents a build error if BOOTSTD is disabled
but BOOTSTD_FULL is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agonet: rtl8169: add depends on PCI
Eugen Hristev [Wed, 17 May 2023 10:41:24 +0000 (13:41 +0300)]
net: rtl8169: add depends on PCI

The rtl8169 driver uses calls to dm_pci_bus_to_phys,
which are compiled under CONFIG_PCI.

Without CONFIG_PCI, this happens:

drivers/net/rtl8169.o: in function `rtl_recv_common':
drivers/net/rtl8169.c:555: undefined reference to `dm_pci_bus_to_phys'

It is only natural that this driver depends on CONFIG_PCI then.
The device does not work connected in another way anyway, and the driver
does not assume anything else at this moment.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
12 months agospl: ext: Use partition size for mount
Mayuresh Chitale [Tue, 2 May 2023 16:10:20 +0000 (21:40 +0530)]
spl: ext: Use partition size for mount

Since commit 9905cae65e03 ("fs: ext4: check the minimal partition size
to mount"), a valid size needs to be provided when mounting
an ext filesystem. Fix the spl ext driver to use the parition size
instead of 0 when mounting the filesystem.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
12 months agoPrepare v2023.07-rc4
Tom Rini [Mon, 12 Jun 2023 17:45:09 +0000 (13:45 -0400)]
Prepare v2023.07-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoMerge branch 'master_reserved' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 11 Jun 2023 20:23:32 +0000 (16:23 -0400)]
Merge branch 'master_reserved' of https://source.denx.de/u-boot/custodians/u-boot-sh

12 months agorenesas: rcar: Apply ATF overlay for reserved-memory
Detlev Casanova [Fri, 9 Jun 2023 15:19:08 +0000 (11:19 -0400)]
renesas: rcar: Apply ATF overlay for reserved-memory

The function fdtdec_board_setup() is called early and adds the overlay
from ATF to the u-boot device tree. That is necessary so that u-boot
doesn't use reserved memory.

Linux also needs to know about that reserved memory so the overlay from
ATF needs to be aplied on the linux device tree as well.

This commit makes sure that the ATF overlay is applied to both device trees.

Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Adam Ford <aford173@gmail.com>
12 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Thu, 8 Jun 2023 22:23:06 +0000 (18:23 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

12 months agoMerge branch 'master_soc/fixes' of https://source.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Thu, 8 Jun 2023 22:22:32 +0000 (18:22 -0400)]
Merge branch 'master_soc/fixes' of https://source.denx.de/u-boot/custodians/u-boot-sh

12 months agopinctrl: renesas: r8a779a0: Remove incorrect AVB[01] pinmux configuration
Hai Pham [Fri, 27 Jan 2023 13:10:31 +0000 (14:10 +0100)]
pinctrl: renesas: r8a779a0: Remove incorrect AVB[01] pinmux configuration

AVB[01]_{MAGIC,MDC,MDIO,TXCREFCLK} are registered as both
PINMUX_SINGLE(fn) and PINMUX_IPSR_GPSR(fn) in the pinmux_data array.

The latter are correct, hence remove the former.
Without this fix, the Ethernet PHY is not operational on the MDIO bus.

Ported from Linux kernel commit a145c9a8674ac8fbfa1595276e1b6cbfc5139038 .

Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: LUU HOAI <hoai.luu.ub@renesas.com>
Fixes: 741a7370fc3b8b54 ("pinctrl: renesas: Initial R8A779A0 (V3U) PFC support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/6fd217b71e83ba9a8157513ed671a1fa218b23b6.1674824958.git.geert+renesas@glider.be
---
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Hai Pham <hai.pham.ud@renesas.com>
Cc: LUU HOAI <hoai.luu.ub@renesas.com>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
12 months agoARM: rmobile: Identify R-Car D3 R8A77995 r1.1 SoC
Hai Pham [Tue, 4 May 2021 10:43:23 +0000 (17:43 +0700)]
ARM: rmobile: Identify R-Car D3 R8A77995 r1.1 SoC

Add support to identify R8A77995 r1.1 SoC.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
[Marek: Slight update to commit message, spell out the SoC model]

12 months agoARM: rmobile: Identify R-Car M3-W R8A7796 r1.1/1.2 SoC
Hiroyuki Yokoyama [Wed, 26 Sep 2018 09:14:41 +0000 (18:14 +0900)]
ARM: rmobile: Identify R-Car M3-W R8A7796 r1.1/1.2 SoC

r8a7796 cpu revision v1.2 has the same information as revision v1.1.
This patch fixes revision display at startup to "rev 1.1/1.2".

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
[Marek: Slight update to commit message, spell out the SoC model]

12 months agousb: musb-new: sunxi: remove unused define
Sam Edwards [Thu, 8 Jun 2023 18:45:42 +0000 (12:45 -0600)]
usb: musb-new: sunxi: remove unused define

This is a remnant from when the USB controller driver managed
the reset signal itself. A patch from the very end of 2018 changed
this driver to delegate reset (and clock) management to the proper
control unit driver, but left this unused define behind.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Thu, 8 Jun 2023 02:05:16 +0000 (22:05 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-sunxi

A small late pull request for Allwinner. The main feature is just a DT
update, matching the v6.4 Linux kernel DT files. This also enables a
board (LCTech Pi F1C200s) which got its .dts file merged into Linux.
Plus a tiny typo fix from Sam.

Gitlab CI passed, briefly tested on an H616 board and the new LCTech Pi.

12 months agosunxi: Fix typo in include guard
Sam Edwards [Fri, 12 May 2023 21:22:14 +0000 (15:22 -0600)]
sunxi: Fix typo in include guard

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
12 months agosunxi: defconfig: Add Lctech Pi F1C200s board
Andre Przywara [Tue, 11 Apr 2023 22:56:14 +0000 (23:56 +0100)]
sunxi: defconfig: Add Lctech Pi F1C200s board

The Lctech Pi F1C200s (also previously known under the Cherry Pi brand)
is a small development board with the Allwinner F1C200s SoC. This is the
same as the F1C100s, but with 64MB instead of 32MB co-packaged DRAM.

Add a defconfig for this board, enabling the most basic features. This
uses the new 64MB memory map, which avoids the very tight memory map we
use for the 32MB F1C100s board(s).
The devicetree file is already in the tree, courtesy of the previous
Linux repo sync.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
12 months agosunxi: dts: arm/arm64: update devicetree files from Linux-v6.4-rc2
Andre Przywara [Sun, 2 Apr 2023 00:17:07 +0000 (01:17 +0100)]
sunxi: dts: arm/arm64: update devicetree files from Linux-v6.4-rc2

Sync the devicetree files from the official Linux kernel tree, v6.4-rc2.
This is covering both 64-bit and 32-bit Allwinner SoCs with Arm Ltd.
cores, we skip the new RISC-V bits for now, as sunxi RISC-V support
is still work in progress.

Among smaller cosmetic changes, this adds a SATA regulator node which we
need in U-Boot to get rid of hard-coded GPIOs.
Also this updates the Allwinner F1C100s DTs, enabling USB support, and
also adds the DTs for two new boards.

As before, this omits the non-backwards compatible changes to the R_INTC
controller, to remain compatible with older kernels.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
12 months agophy: rockchip-inno-usb2: Implement clock operations for usb2phy clock
Xavier Drudis Ferran [Mon, 5 Jun 2023 15:06:57 +0000 (17:06 +0200)]
phy: rockchip-inno-usb2: Implement clock operations for usb2phy clock

This clock doesn't seem needed but appears in a phandle list used by
ehci-generic.c to bulk enable it. The phandle list comes from linux,
where it is needed for suspend/resume to work [1].

My tests give the same results with or without this patch, but Marek
Vasut found it weird to declare an empty clk_ops [2].

So I adapted the code from linux 6.1-rc8 so that it hopefully works
if it ever has some user. For now, without real use, it seems to
at least not give any errors when called.

Link: [1] https://lkml.kernel.org/lkml/1731551.Q6cHK6n5ZM@phil/T/
      [2] https://patchwork.ozlabs.org/project/uboot/patch/Y5IWpjYLB4aXMy9o@localhost/

Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Christoph Fritz <chf.fritz@googlemail.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # rk3399, rk3328, rv1126
12 months agophy: rockchip-inno-usb2: Add usb2phy clock provider of 480MHz clock
Xavier Drudis Ferran [Mon, 5 Jun 2023 15:05:53 +0000 (17:05 +0200)]
phy: rockchip-inno-usb2: Add usb2phy clock provider of 480MHz clock

arch/arm/dts/rk3399.dtsi has a node

  usb_host0_ehci: usb@fe380000 {
       compatible = "generic-ehci";

with clocks:

       clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST0_ARB>,
                <&u2phy0>;

The first 2 refer to nodes with class UCLASS_CLK, but &u2phy0
has class UCLASS_PHY.

  u2phy0: usb2phy@e450 {
       compatible = "rockchip,rk3399-usb2phy";

Since clk_get_bulk() only looks for devices with UCLASS_CLK,
it fails with -ENODEV and then ehci_usb_probe() aborts.

The consequence is peripherals connected to a USB 2 port (e.g. in a
Rock Pi 4 the white port, nearer the edge) not being detected.
They're detected if CONFIG_USB_OHCI_GENERIC is selected in Kconfig,
because ohci_usb_probe() does not abort when one clk_get_by_index()
fails, but then they work in USB 1 mode.

rk3399.dtsi comes from linux and the  u2phy0 was added[1] to the clock
list in:

    commit b5d1c57299734f5b54035ef2e61706b83041f20c
    Author: William wu <wulf@rock-chips.com>
    Date:   Wed Dec 21 18:41:05 2016 +0800

    arm64: dts: rockchip: add u2phy clock for ehci and ohci of rk3399

    We found that the suspend process was blocked when it run into
    ehci/ohci module due to clk-480m of usb2-phy was disabled.
    [...]

Suspend concerns don't apply to U-Boot, and the problem with U-Boot
failing to probe EHCI doesn't apply to linux, because in linux
rockchip_usb2phy_clk480m_register makes u2phy0 a proper clock provider
when called by rockchip_usb2phy_probe().

So I can think of a few alternative solutions:

1- Change ehci_usb_probe() to make it more similar to
   ohci_usb_probe(), and survive failure to get one clock. Looks a
   little harder, and I don't know whether it could break something if
   it ignored a clock that was important for something else than
   suspend.

2- Change rk3399.dtsi effectively reverting the linux commit
   b5d1c57299734f5b54035ef2e61706b83041f20c. This dealigns the .dtsi
   from linux and seems fragile at the next synchronisation.

3- Change the clock list in rk3399-u-boot.dtsi or somewhere else.
   This survives .dts* sync but may survive "too much" and miss some
   change from linux that we might want.

4- Enable CONFIG_USB_OHCI_GENERIC and use the ports in USB 1 mode.
   This would need to be made for all boards using rk3399.  In a
   simple test reading one file from USB storage it gave 769.5 KiB/s
   instead of 20.5 MiB/s with solution 2.

5- Trying to replicate linux and have usb2phy somehow provide a clk,
   or have a separate clock device for usb2phy in addition to the phy
   device.

This patch tries to implement option 5 as Marek Vasut requested in
December 5th.  Options 1 and 3 didn't get through [2][3].

It just registers usb2phy as a clock driver (device_bind_driver()
didn't work but device_bind_driver_to_node() did), without any
specific operations, so that ehci-generic.c finds it and is happy. It
worked in my tests on a Rock Pi 4 B+ (rk3399).

Link: [1] https://lkml.kernel.org/lkml/1731551.Q6cHK6n5ZM@phil/T/
      [2] https://patchwork.ozlabs.org/project/uboot/patch/20220701185959.GC1700@begut/
      [3] https://patchwork.ozlabs.org/project/uboot/patch/Y44+ayJfUlI08ptM@localhost/

Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Christoph Fritz <chf.fritz@googlemail.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # rk3399, rk3328, rv1126
12 months agousb: musb-new: sunxi: fix error check
Sam Edwards [Mon, 5 Jun 2023 17:19:37 +0000 (11:19 -0600)]
usb: musb-new: sunxi: fix error check

The `musb_register` function returns some ERR_PTR(...) on failure,
not NULL, so update the check here appropriately.

Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
12 months agoMerge tag 'u-boot-amlogic-20230607' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 7 Jun 2023 16:17:06 +0000 (12:17 -0400)]
Merge tag 'u-boot-amlogic-20230607' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- meson_uart empty logic fix

12 months agoserial: meson: fix meson_serial_pending() tx logic
Mattijs Korpershoek [Tue, 6 Jun 2023 16:07:48 +0000 (18:07 +0200)]
serial: meson: fix meson_serial_pending() tx logic

According to the dm_serial_ops documentation, pending() should:
> @return number of waiting characters, 0 for none, -ve on error

And:
> It is acceptable to return 1 if an indeterminant number
> of characters is waiting.

With the current implementation, we have:
* FIFO is full           -> pending() returns 0
* FIFO is partially used -> pending() returns 1
* FIFO is empty          -> pending() returns 1

This is not the same as what the documentation requires.

Moreover, since [1], arm reset now flushes all console devices
(including serial) before the cpu gets reset.
Because of the flawed logic:

  => reset # user calls reset
  flush() is called
  _serial_flush() is called
  ops->pending(dev, false) # never returns false
  # board hangs indefinitely without resetting.

Fix it by using AML_UART_TX_EMPTY instead of AML_UART_TX_FULL.

[1] commit c5f4cdb8eb60 ("console: Use flush() before panic and reset"),

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230606-fix-meson-serial-pending-v1-1-6a54d4a01f76@baylibre.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
12 months agoMerge tag 'ubifixes-for-v2023-07-rc4' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 6 Jun 2023 13:47:17 +0000 (09:47 -0400)]
Merge tag 'ubifixes-for-v2023-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-ubi

ubifs changes for v2023.07-rc4

UBIFS fixes from Ben Dooks

- ubifs: allow loading to above 4GiB

12 months agoMerge tag 'for-v2023-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-i2c
Tom Rini [Tue, 6 Jun 2023 13:46:27 +0000 (09:46 -0400)]
Merge tag 'for-v2023-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-i2c

i2c updates for v2023-07-rc4

Bugfixes:
- rockchip: De-initialize the bus after start bit failure
  from Ondrej Jirman

- cdns: Fix broken retry mechanism on arbitration lost

12 months agoubifs: allow loading to above 4GiB
Ben Dooks [Tue, 6 Jun 2023 08:23:28 +0000 (09:23 +0100)]
ubifs: allow loading to above 4GiB

The ubifsload command is truncating any address above 4GiB as it casts
this address to an u32, instead of using an unsigned long which most of
the other load commands do. Change this to an unsigned long to allow
loading into high memory for boards which use these areas.

Fixes the following error:

=> ubifsload 0x2100000000 /boot/Image.lzma
Loading file '/boot/Image.lzma' to addr 0x00000000...
Unhandled exception: Store/AMO access fault

Signed-off-by: Ben Dooks <ben.dooks@sifive.com>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
12 months agoI2C: cdns: Fix broken retry mechanism on arbitration lost.
Andrea Merello [Fri, 26 May 2023 14:56:16 +0000 (16:56 +0200)]
I2C: cdns: Fix broken retry mechanism on arbitration lost.

In the current implementation, in case of I2C arbitration lost, a retry is
attempted; the message counter and pointer are reset to the original values
and the I2C xfer process is restart from the beginning.

However the message counter and message pointer are respectively
decremented and incremented by one before attempting any transfer, causing
the 1st transfer not to be actually retried (in case of a single transfer,
nothing is actually retried at all).

This patch fixes this: in case of retry, the 1st transfer is also retried.

Tested on a ZynqMP Kria board, with upstream older u-boot, but the involved
file and underlying logic seem basically the same.

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
12 months agoi2c: rockchip: De-initialize the bus after start bit failure
Ondrej Jirman [Thu, 25 May 2023 12:18:17 +0000 (14:18 +0200)]
i2c: rockchip: De-initialize the bus after start bit failure

Failure can happen when i2c is used without initializing pinctrl properly,
which U-Boot happily allows in SPL. Without this fix, further I2C access would
fail, even after proper pinctrl initialization.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
12 months agoMerge tag 'efi-2023-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 2 Jun 2023 16:13:01 +0000 (12:13 -0400)]
Merge tag 'efi-2023-07-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2023-07-rc4

Documentation:

* man pages for loadb, loadx

UEFI:

* check return value of part_get_info()
* improve unit test for RegisterProtocolNotify()

12 months agoefi_selftest: LocateHandleBuffer return code
Heinrich Schuchardt [Thu, 1 Jun 2023 07:06:09 +0000 (09:06 +0200)]
efi_selftest: LocateHandleBuffer return code

Check that LocateHandleBuffer() return EFI_NOT_FOUND when called with
ByRegisterNotify and all handles already have been retrieved.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agoefi_loader: check return value of part_get_info()
Heinrich Schuchardt [Sat, 27 May 2023 06:18:28 +0000 (08:18 +0200)]
efi_loader: check return value of part_get_info()

part_get_info() may return an error code. Check it.
Update function description of dp_part_node().

Addresses-Coverity-ID: 184067 ("Unchecked return value")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
12 months agodoc: android: Fix a typo
Bin Meng [Thu, 25 May 2023 06:30:05 +0000 (14:30 +0800)]
doc: android: Fix a typo

%s/than/then

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
12 months agodoc: fix loady man-page
Heinrich Schuchardt [Tue, 16 May 2023 05:45:05 +0000 (07:45 +0200)]
doc: fix loady man-page

* loady may return $? = 1.
* Move misplaced description

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
12 months agodoc: loadx man-page
Heinrich Schuchardt [Tue, 16 May 2023 05:46:53 +0000 (07:46 +0200)]
doc: loadx man-page

Provide a man-page for the loadx command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
12 months agodoc: loadb man-page
Heinrich Schuchardt [Tue, 16 May 2023 05:43:01 +0000 (07:43 +0200)]
doc: loadb man-page

Provide a man-page for the loadb command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
12 months agoMerge branch '2023-05-30-TI-fixes-Apple-M2-support'
Tom Rini [Tue, 30 May 2023 20:23:41 +0000 (16:23 -0400)]
Merge branch '2023-05-30-TI-fixes-Apple-M2-support'

- Fixes for some TI K3 platforms and merge the Apple M2 support I had
  intended to pick up earlier.

12 months agopci: apple: Add support for M2 Pro/Max
Mark Kettenis [Tue, 2 May 2023 19:30:41 +0000 (21:30 +0200)]
pci: apple: Add support for M2 Pro/Max

The PCIe controller on the M2 Pro/Max is different from the one
found on earlier Apple SoCs.  Some registers moved and te meaning
of the bits in some other registers changed.  But they are still
similar enough to handle both controllers in the same driver.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
12 months agoarm: apple: Add initial Apple M2 Pro/Max support
Mark Kettenis [Tue, 2 May 2023 19:30:40 +0000 (21:30 +0200)]
arm: apple: Add initial Apple M2 Pro/Max support

Apple's M2 Pro/Max SoC are somewhat similar to the M1 Pro/Max but
need a tweaked memory map.  USB, NVMe, UART and WDT are working
with the existing drivers.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
12 months agoarm: mach-k3: security: separate out validating binary logic
Manorit Chawdhry [Thu, 18 May 2023 07:14:17 +0000 (12:44 +0530)]
arm: mach-k3: security: separate out validating binary logic

K3 GP devices allows booting the secure binaries on them by bypassing
the x509 header on them.

ATF and OPTEE firewalling required the rproc_load to be called before
authentication. This change caused the failure for GP devices that
strips off the headers. The boot vector had been set before the headers
were stripped off causing the runtime stripping to fail and stripping
becoming in-effective.

Separate out the secure binary check on GP/HS devices so that the
boot_vector could be stripped before calling rproc_load. This allows
keeping the authentication later when the cluster is on along with
allowing the stripping of the binaries in case of gp devices.

Fixes: 1e00e9be62e5 ("arm: mach-k3: common: re-locate authentication for atf/optee")

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
12 months agoarm: mach-k3: Increase SYSFW max image size
Dave Gerlach [Tue, 16 May 2023 04:54:37 +0000 (10:24 +0530)]
arm: mach-k3: Increase SYSFW max image size

When booting with HS silicon, the system firmware image is 278270, which
is slightly larger than currently allocated amount.

This can cause unexpected behavior if this overlap interferes with other
things in memory, so increase this with a slightly margin added as well
to avoid any boot issues that can appear after system firmware gets
loaded.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
12 months agoKconfig: j721e: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region
Manorit Chawdhry [Tue, 16 May 2023 04:54:36 +0000 (10:24 +0530)]
Kconfig: j721e: Change K3_MCU_SCRATCHPAD_BASE to non firewalled region

In non-combined boot flow for K3, all the firewalls are locked by default
until sysfw comes up. Rom configures some of the firewall for its usage
along with the SRAM for R5 but the PSRAM region is still locked.

The K3 MCU Scratchpad for j721e was set to a PSRAM region triggering the
firewall exception before sysfw came up. The exception started happening
after adding multi dtb support that accesses the scratchpad for reading
EEPROM contents.

The commit changes R5 MCU scratchpad for j721e to an SRAM region.

Old Map:
┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                STACK                │
├─────────────────────────────────────┤ 0x41c85b20
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c85bfc
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf5bfc)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
                (0x41cffbfc)

New Map:
┌─────────────────────────────────────┐ 0x41c00000
│                 SPL                 │
├─────────────────────────────────────┤ 0x41c40000 (approx)
│                EMPTY                │
├─────────────────────────────────────┤ 0x41c81920
│                STACK                │
│ SPL_SIZE_LIMIT_PROVIDE_STACK=0x4000 │
├─────────────────────────────────────┤ 0x41c85920
│             Global data             │
│  sizeof(struct global_data) = 0xd8  │
├─────────────────────────────────────┤ gd->malloc_base = 0x41c859f0
│                HEAP                 │
│  CONFIG_SYS_MALLOC_F_LEN = 0x70000  │
├─────────────────────────────────────┤ CONFIG_SPL_BSS_START_ADDR
│               SPL BSS               │ (0x41cf59f0)
│  CONFIG_SPL_BSS_MAX_SIZE = 0xA000   │
├─────────────────────────────────────┤ 0x41cff9fc
│         NEW MCU SCRATCHPAD          │
│  SYS_K3_MCU_SCRATCHPAD_SIZE = 0x200 │
└─────────────────────────────────────┘ CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX
                (0x41cffbfc)

Fixes: ab977c8b91b4 ("configs: j721s2_evm_r5: Enable support for building multiple dtbs into FIT")

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
[n-francis@ti.com: SRAM allocation addressing diagram]
Signed-off-by: Neha Francis <n-francis@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Kamlesh Gurudasani <kamlesh@ti.com>
12 months agoconfigs: j721e: Merge the HS and non-HS defconfigs
Manorit Chawdhry [Tue, 16 May 2023 04:54:35 +0000 (10:24 +0530)]
configs: j721e: Merge the HS and non-HS defconfigs

K3 devices have runtime type board detection. Make the default defconfig
include the secure configuration. Then remove the HS specific config.

Non-HS devices will continue to boot due to runtime device type detection.
If TI_SECURE_DEV_PKG is not set the build will emit warnings, for non-HS
devices these can be ignored.

Reviewed-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Acked-by: Andrew Davis <afd@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
12 months agoarm: k3: config.mk: Add missing dependencies on tispl.bin HS
Andrew Davis [Tue, 16 May 2023 04:54:34 +0000 (10:24 +0530)]
arm: k3: config.mk: Add missing dependencies on tispl.bin HS

When building for secure devices using non-buildman based image generation
the signed tispl.bin file is called tispl.bin_HS. Also build the unsigned
tispl.bin file as expected.

Signed-off-by: Andrew Davis <afd@ti.com>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
12 months agoPrepare v2023.07-rc3
Tom Rini [Mon, 29 May 2023 14:59:09 +0000 (10:59 -0400)]
Prepare v2023.07-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 29 May 2023 14:43:26 +0000 (10:43 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoMerge tag 'u-boot-imx-20230525' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Thu, 25 May 2023 18:27:39 +0000 (14:27 -0400)]
Merge tag 'u-boot-imx-20230525' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

u-boot-imx-20230525
-------------------

- i.MX93 series
- Fixes

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

12 months agoserial: mxs: Add MXS AUART driver
Marek Vasut [Sat, 6 May 2023 14:43:31 +0000 (16:43 +0200)]
serial: mxs: Add MXS AUART driver

Add trivial driver for the MXS AUART IP. This is the other UART IP
present in i.MX23 and i.MX28, used to drive the non-DUART ports.

Signed-off-by: Marek Vasut <marex@denx.de>
12 months agoimx9: imx93_evk: enable sysreset
Peng Fan [Fri, 28 Apr 2023 04:08:47 +0000 (12:08 +0800)]
imx9: imx93_evk: enable sysreset

Enable sysreset for i.MX93 EVK.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: imx93_evk: update ddr timing file
Peng Fan [Fri, 28 Apr 2023 04:08:46 +0000 (12:08 +0800)]
imx9: imx93_evk: update ddr timing file

Update DDR timing file generated by DDR Config Tool
1. Dynamic refresh rate is set by default
2. The 3rd freq will be 625MTS based on power and performance better than 100MTS.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: Calculate DDR size from DDRC setting
Ye Li [Fri, 28 Apr 2023 04:08:45 +0000 (12:08 +0800)]
imx9: Calculate DDR size from DDRC setting

To avoid using static setting for ECC enabled DDR size, switch
to calculate DDR size from DDRC setting

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoddr: imx9: update the rank setting for multi fsp support
Jacky Bai [Fri, 28 Apr 2023 04:08:44 +0000 (12:08 +0800)]
ddr: imx9: update the rank setting for multi fsp support

The rank setting flow should be updated to support multi
fsp config.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoddr: imx93: update the ddr init to support mult setpoints
Jacky Bai [Fri, 28 Apr 2023 04:08:43 +0000 (12:08 +0800)]
ddr: imx93: update the ddr init to support mult setpoints

Update the DDR init flow for multi-setpoint support on i.MX93. A new
fsp_cfg struct need to be added in the timing file to store the diff
part of the DDRC and DRAM MR register for each setpoint.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoddr: imx93: Add 625M bypass clock support
Jacky Bai [Fri, 28 Apr 2023 04:08:42 +0000 (12:08 +0800)]
ddr: imx93: Add 625M bypass clock support

Add 625M bypass clock that may be used DRAM 625M
bypass mode support.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoddr: imx9: Change the saved ddr data base to 0x2051c000
Jacky Bai [Fri, 28 Apr 2023 04:08:41 +0000 (12:08 +0800)]
ddr: imx9: Change the saved ddr data base to 0x2051c000

change the ddr saved info to the last 16KB of the OCRAM.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: imx93_evk: Update spl stack & bss base address
Peng Fan [Fri, 28 Apr 2023 04:08:40 +0000 (12:08 +0800)]
imx9: imx93_evk: Update spl stack & bss base address

As the ddr timing info will be saved at the last 16KB of
the OCRAM, spl stack & bss base should be updated to avoid
conflict.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoddr: imx9: Add workaround for DDRPHY rank-to-rank errata
Ye Li [Fri, 28 Apr 2023 04:08:39 +0000 (12:08 +0800)]
ddr: imx9: Add workaround for DDRPHY rank-to-rank errata

According to DDRPHY errata, the Rank-to-Rank Spacing and tphy_rdcsgap
specification does not include the Critical Delay Difference (CDD) to
properly define the required rank-to-rank read command spacing after
executing PHY training firmware.

Following the errata workaround, at the end of data training, we get
all CDD values through the MessageBlock, then re-configure the DDRC
timing of WWT/WRT/RRT/RWT with comparing MAX CDD values.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
12 months agoarm: dts: imx93: add tmu
Peng Fan [Fri, 28 Apr 2023 04:08:38 +0000 (12:08 +0800)]
arm: dts: imx93: add tmu

Add tmu nodes and thermal zone

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoarm: dts: imx93: sync device tree with Linux
Peng Fan [Fri, 28 Apr 2023 04:08:37 +0000 (12:08 +0800)]
arm: dts: imx93: sync device tree with Linux

Sync device tree with next-20230426

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: allow to bootaux Mcore with input address
Ye Li [Fri, 28 Apr 2023 04:08:36 +0000 (12:08 +0800)]
imx9: allow to bootaux Mcore with input address

Currently bootaux only supports to boot M33 core from TCM. Since ATF
has changed to use x2 parameter for M33 image address, update the
bootaux command to use input address, so we can support boot from
any possilbe address like TCM, DDR, Flexspi NOR.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: imx93_evk: add low drive mode support on 11x11 EVK
Peng Fan [Fri, 28 Apr 2023 04:08:35 +0000 (12:08 +0800)]
imx9: imx93_evk: add low drive mode support on 11x11 EVK

Add a static u-boot config for i.MX93 low drive mode support. When
low drive mode is enabled, VDD_SOC is set to 0.75V. Bus clocks,
A55 core clock (900Mhz), DDR clock (1866MTS), and some peripherals
clocks (USDHC/FLEXSPI/PDM/DISP_PIX/CAM_PIX) must decrease to meet
max frequencies in low drive mode.

Also set standby voltage for buck1

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: use i.MX generic rom api function
Peng Fan [Fri, 28 Apr 2023 04:08:34 +0000 (12:08 +0800)]
imx9: use i.MX generic rom api function

There is no need to save gd with using the generic rom api function, so
simplify code.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: correct coding style
Peng Fan [Fri, 28 Apr 2023 04:08:33 +0000 (12:08 +0800)]
imx9: correct coding style

The end brace should be in a new line

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: add i.MX93 variants support
Peng Fan [Fri, 28 Apr 2023 04:08:32 +0000 (12:08 +0800)]
imx9: add i.MX93 variants support

According to datasheet, iMX93 has fused parts with CORE1 or NPU or
both disabled. So update code to support it, the kernel device tree
runtime update will be added in future patches.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: clock: config arm alt root to 500mhz
Peng Fan [Fri, 28 Apr 2023 04:08:31 +0000 (12:08 +0800)]
imx9: clock: config arm alt root to 500mhz

Config the A55 alt root clock to 500MHz(LD mode frequency)
by default. Normally, this clock root is only used as an
intermediate clock soure for A55 core/dsu when change the
ARM PLL frequency.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: clock: add CONFIG_IMX9_LOW_DRIVE_MODE support
Peng Fan [Fri, 28 Apr 2023 04:08:30 +0000 (12:08 +0800)]
imx9: clock: add CONFIG_IMX9_LOW_DRIVE_MODE support

Add CONFIG_IMX9_LOW_DRIVE_MODE in imx9 clk, later we will
add board support

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: clock: clear HW_CTRL_SEL
Peng Fan [Fri, 28 Apr 2023 04:08:29 +0000 (12:08 +0800)]
imx9: clock: clear HW_CTRL_SEL

The HW_CTRL_SEL should be cleared when configuring PLL to avoid
potential glitch

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: Get market segment and speed grading
Peng Fan [Fri, 28 Apr 2023 04:08:28 +0000 (12:08 +0800)]
imx9: Get market segment and speed grading

Get the chip's market segment and speed grading from fuse and print
them in boot log as other i.MX series.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: soc: support reset cause
Peng Fan [Fri, 28 Apr 2023 04:08:27 +0000 (12:08 +0800)]
imx9: soc: support reset cause

Support print reset cause. Since SRSR is not accessible from non-secure
world, so first save it to grp0, then read it in non-secure world.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agowatchdog: ulp_wdog: guard reset_cpu with condition check
Peng Fan [Fri, 28 Apr 2023 04:08:26 +0000 (12:08 +0800)]
watchdog: ulp_wdog: guard reset_cpu with condition check

There will be build error if CONFIG_SYSRESET is enabled, so guard
the reset_cpu with condition check here

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>
12 months agoimx9: imx93_evk: enable CONFIG_WDT
Peng Fan [Fri, 28 Apr 2023 04:08:25 +0000 (12:08 +0800)]
imx9: imx93_evk: enable CONFIG_WDT

Without this config, there is boot error: Error binding ulp_wdt driver

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: imx93_evk: select IMX_TMU
Peng Fan [Fri, 28 Apr 2023 04:08:24 +0000 (12:08 +0800)]
imx9: imx93_evk: select IMX_TMU

Select thermal config to print current temperature

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: imx93_evk: drop unused macro
Peng Fan [Fri, 28 Apr 2023 04:08:23 +0000 (12:08 +0800)]
imx9: imx93_evk: drop unused macro

Drop unused macro

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: imx93_evk: enable CPU_IMX
Peng Fan [Fri, 28 Apr 2023 04:08:22 +0000 (12:08 +0800)]
imx9: imx93_evk: enable CPU_IMX

select CONFIG_CPU_IMX to display cpu info

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: Change hard coded MAC to read from fuse
Ye Li [Fri, 28 Apr 2023 04:08:21 +0000 (12:08 +0800)]
imx9: Change hard coded MAC to read from fuse

The MAC addresses are hard coded for bring up. Change it to support
reading from fuse.

Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: cut off OPTEE memory region from U-Boot
Peng Fan [Fri, 28 Apr 2023 04:08:20 +0000 (12:08 +0800)]
imx9: cut off OPTEE memory region from U-Boot

OPTEE memory region is set secure access only in ATF with configuration
to TRDC, and need to remove it from U-Boot, otherwise U-Boot and Kernel
may crash when accessing the memory

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: simplify clk settings
Peng Fan [Fri, 28 Apr 2023 04:08:19 +0000 (12:08 +0800)]
imx9: simplify clk settings

Simplify the clk root settings with an array

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: correct getting LPI2C clk
Peng Fan [Fri, 28 Apr 2023 04:08:18 +0000 (12:08 +0800)]
imx9: correct getting LPI2C clk

LPI2C_CLK_ROOT should be used instead of LPUART_CLK_ROOT for i2c

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: use parameter freq when set_arm_clk
Peng Fan [Fri, 28 Apr 2023 04:08:17 +0000 (12:08 +0800)]
imx9: use parameter freq when set_arm_clk

The freq parameter was ignored, should use it when configuring ARM PLL

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: add more PLL settings
Peng Fan [Fri, 28 Apr 2023 04:08:16 +0000 (12:08 +0800)]
imx9: add more PLL settings

Add more PLL settings for A55 and Display

Signed-off-by: Peng Fan <peng.fan@nxp.com>
12 months agoimx9: configure M33 systick to 24M
Peng Fan [Fri, 28 Apr 2023 04:08:15 +0000 (12:08 +0800)]
imx9: configure M33 systick to 24M

The M33 systick should be 24M per reference mannual, so correct it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>