Commit graph

86691 commits

Author SHA1 Message Date
Simon Glass
ad29e08b79 doc: Bring in FIT signature files
Bring these files into the documentation.

Fix 'wtih' and 'it' typos and repeated 'could' while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-06-23 16:28:13 +02:00
Simon Glass
3c1e2c3261 doc: Bring in FIT x86 boot
Bring this file into the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-06-23 16:28:13 +02:00
Simon Glass
ba399ce214 doc: Bring in the FIT examples
Convert these to rST format and add them to the index.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-06-23 16:28:13 +02:00
Simon Glass
829fb8b5dc doc: Reformat the FIT documentation to make it nicer
Fix up headings and tables to read better.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-06-23 16:28:13 +02:00
Simon Glass
2576822779 doc: Convert FIT source-file format to rST
Move this document and convert it to rST. Make minimal changes, enough
for it to build successfully.

Future patches will tidy this up.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-06-23 16:28:12 +02:00
Simon Glass
488445cefa doc: Move FIT into its own directory
Create a new usage/fit directory which will house information about FIT.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-06-23 16:28:12 +02:00
Heinrich Schuchardt
63e23f239d doc: bind man-page
provide a man-page for the bind command

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-06-23 15:53:10 +02:00
Heinrich Schuchardt
ed875bdd1b doc: unbind man-page
Provide a man-page for the unbind command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-06-23 15:53:10 +02:00
Tom Rini
68c07fc5fd Merge https://source.denx.de/u-boot/custodians/u-boot-usb 2023-06-21 14:42:50 -04:00
Teik Heng Chong
9c9454ac2e 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>
2023-06-21 13:15:58 +02:00
Xavier Drudis Ferran
7a875a8e5c 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>
2023-06-21 13:08:30 +02:00
Tom Rini
50842b217f First set of u-boot-atmel fixes for the 2023.07 cycle
-----BEGIN PGP SIGNATURE-----
 
 iQFQBAABCgA6FiEEqxhEmNJ6d7ZdeFLIHrMeAg6sL8gFAmSQKuMcHGV1Z2VuLmhy
 aXN0ZXZAY29sbGFib3JhLmNvbQAKCRAesx4CDqwvyPpxCACtOlHioHbgs0BMclpT
 5hqT/ey5utWmnaKauAjUptts8w80TJNDB9goCv1DZeuJeT3OI727y5L73oiOgBBk
 eF5BUXHxFnB6ggwtF3DzhAbhw21RlN4Irr3n4J0DIwLMvzEkLuPvzKjbfK9QUmZ0
 Cg/VBfJGhuQrZkCXlsuKfNh/ywWk9QmnLMLfMJkKbKrc9KQqXCtVBEHplZpvSPD7
 z4nYAg1FAB9zPmbtzCYHMrv+Jnshhv77HAH4ZBXkPNfH9dDHKjfz5d9J7RApwBqv
 JX1TWnqxI9Db7uTsVMlM9sMjYj+U0hC2QEK2K0Khb1TrtLD4DQNb8FKOx9QnjMnI
 C9dP
 =nuwQ
 -----END PGP SIGNATURE-----

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.
2023-06-19 09:18:40 -04:00
Tom Rini
1c30e10017 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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmSL8CQACgkQxIHbvCwF
 GsTu/w/+KZCGgCdg57nm/6Ptjs6xBiuVZpAGy+xALUkJxXvbRrHOXV5/ztkY+gup
 +41J58O++sAMyx3md7B/xLxictBHBmCqsdkT9MPvCkGRQEq4iLb469yJkvBh+CbM
 V9IbEbJfTCY0RImfNHSLIGNf5VkqDjDo05N2r3tMWMPluPGZ9cpU2yAmqOIATf4C
 tx7hZLgQPHFFoisDvNpFHjQcemSLwUoPtXKGcRlNjCgYs5ow7Y/Z9tJV2vSzVcMt
 k4kF1FpgC1JqyF8i2sn/so3Xu3uArXc9iDXb5HKGdxYZOf/7cwQArhZWDvO3T1p0
 eexkoSCbyoAfVCSDS8N4IeZQk+DgqqfXEppMlmTWjyf5CxouzO/PsLoJXD2bmmbx
 Q4tGbXKWF6tcRmIFvgGlV5zyz0XlVCZdG9+zHxW7YPWa+oJlon7FU2Cl40BAXSAA
 bgCFbM7Y/otKuJ0FT5SP6OjY3x/h7NmcpMgjJu2Yi9491NkrqdY4xGPaPC6TZMzU
 trwiId3JA3PDJXt3FnDrbwvWiRcq0ftym7bTyO7OPsK7MqIOi4j6aqxTMGSGrO8v
 WUWmdh3JawD5fL9HK6GnJxRnC8TTGDjX9FKaizhbe7aYepBMNgoSqWhpM8xz4d0f
 3lf1RYIKq3UPy2gpI1XGCyvSP99BchntTCH6RYGuI3Tav/RLvjk=
 =UlmM
 -----END PGP SIGNATURE-----

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
2023-06-16 19:05:52 -04:00
Clément Léger
ee8f873678 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>
2023-06-16 12:17:12 +03:00
Ilko Iliev
c89982f089 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>
2023-06-16 12:02:02 +03:00
Ilias Apalodimas
5669591dd8 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>
2023-06-16 06:48:46 +02:00
Ilias Apalodimas
3cc2b9f5b9 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>
2023-06-16 06:45:20 +02:00
Ilias Apalodimas
3ae95fe21c 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>
2023-06-16 06:45:20 +02:00
Heinrich Schuchardt
0773e4d9d9 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: 8391f95549 ("test/py: Create a test for launching UEFI binaries from FIT images")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-06-16 06:45:20 +02:00
Heinrich Schuchardt
4533b3d0a3 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: 487b5fa6de ("bootm: Handle kernel_noload on arm64")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-16 06:45:20 +02:00
Heinrich Schuchardt
a61e6ad769 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>
2023-06-16 06:45:19 +02:00
Heinrich Schuchardt
12858ab216 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>
2023-06-16 06:45:19 +02:00
Bin Meng
268d25f310 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>
2023-06-16 06:45:19 +02:00
Heinrich Schuchardt
4834bf1bc8 doc: man-page for imxtract
Provide a man-page for the imxtract command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-06-16 06:45:19 +02:00
Tom Rini
2f4664f5c3 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
2023-06-14 15:50:04 -04:00
Sean Edmond
2f7c7159ea 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>
2023-06-14 15:48:45 -04:00
Sean Edmond
1b3117db3e 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>
2023-06-14 15:48:45 -04:00
Peter Robinson
70ca9f62f3 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 26f92be07e 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>
2023-06-14 15:48:45 -04:00
Jonas Karlman
a7e4dffcd8 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: 31aefaf89a ("bootstd: Add an implementation of distro boot")
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-06-14 12:56:10 -04:00
Simon Glass
bcb1d269a4 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>
2023-06-14 12:56:10 -04:00
Eugen Hristev
89d8c56f44 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>
2023-06-14 12:56:10 -04:00
Mayuresh Chitale
7a5f4e4c2f spl: ext: Use partition size for mount
Since commit 9905cae65e ("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>
2023-06-14 12:56:10 -04:00
Tom Rini
19b77d3d23 Prepare v2023.07-rc4
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-06-12 13:45:09 -04:00
Tom Rini
c13a1c22a2 Merge branch 'master_reserved' of https://source.denx.de/u-boot/custodians/u-boot-sh 2023-06-11 16:23:32 -04:00
Detlev Casanova
fd3e2b4de3 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>
2023-06-10 17:06:38 +02:00
Tom Rini
addd47379d Merge https://source.denx.de/u-boot/custodians/u-boot-usb 2023-06-08 18:23:06 -04:00
Tom Rini
681bfd6b46 Merge branch 'master_soc/fixes' of https://source.denx.de/u-boot/custodians/u-boot-sh 2023-06-08 18:22:32 -04:00
Hai Pham
b597b6f986 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>
2023-06-08 22:22:38 +02:00
Hai Pham
13c8a0717d 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]
2023-06-08 22:22:38 +02:00
Hiroyuki Yokoyama
08260efdaf 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]
2023-06-08 22:22:38 +02:00
Sam Edwards
e10f964149 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>
2023-06-08 21:57:01 +02:00
Tom Rini
661332a074 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.
2023-06-07 22:05:16 -04:00
Sam Edwards
9bc6f1a4d0 sunxi: Fix typo in include guard
Signed-off-by: Sam Edwards <CFSworks@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
2023-06-07 22:45:02 +01:00
Andre Przywara
b0816e3bd3 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>
2023-06-07 22:44:40 +01:00
Andre Przywara
57285737cb 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>
2023-06-07 22:44:40 +01:00
Xavier Drudis Ferran
40359c9440 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
2023-06-07 23:41:47 +02:00
Xavier Drudis Ferran
e81512ac30 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
2023-06-07 23:41:47 +02:00
Sam Edwards
3cbd92da9f 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>
2023-06-07 23:38:51 +02:00
Tom Rini
0a8a4b8642 - meson_uart empty logic fix
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPVPGJshWBf4d9CyLd9zb2sjISdEFAmSAbY0ACgkQd9zb2sjI
 SdGUlA/9FWZ+VEl/Q13Kdzpa765NYWXFDx2qsZgufDxEpw7TzP1gf2OktqlPW8t3
 gTl5AsLkD2nIdmzFDAWPz1rWINoxQ1AYlsj3xiRq8/Zjpn9Z9dtOODjfQvxQQ7kh
 YU3qJhQM/pNzieG25LU9uvRAkugwXztzlBw73I41zWoLMJ0kwm3amOGD7P5jyQk3
 CUL54qk1TU8NRSPsI49hrE2ZFkNNaed+rrFVLc95L40ekIGMMvtsEeAWyUm02bjp
 2Sy57+J5g1b313/C6wldP2YwqEGIORGyobKXg775Fvh+bU5kaYLY1cAaS2O8ZM2Z
 BTmjq4IZhDB3FS81KbtEBR2l/12Mdf4ColrM6xOo7rFBGEQypyU9DcxH2kK2o16O
 jul6dadlC3wXkzUTGwAfrf1l7PKMsT32XqHgD9qVogRyMeRe95izdyy30CV2DwGy
 +3aMOx1rZC/ia9MDjlHAh5kHBA3JkrlJW66ng7wTLQM6c2PVBU8E9UbHt2oX1z7c
 6n4Z8fT5VsoTZIYf3YIq/TMwBqOXK7Gy/JloKZUPzaZ9xxV22v/PXvYJT4mM5S+T
 Z1Xop/+l343m2X2E2mjanLlGxcWagcG83IDLdcr9y7OK7lJJGUz2bQHPwnlFUhZI
 IWNllB9xKQX6wBjFqs3HWalZ5BDXzy09OaFGiH/8TXW84cldus0=
 =9zwb
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-amlogic-20230607' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- meson_uart empty logic fix
2023-06-07 12:17:06 -04:00
Mattijs Korpershoek
afa85a2247 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 c5f4cdb8eb ("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>
2023-06-07 10:09:20 +02:00