Re: [PULL] u-boot-sh/master-porter

2024-02-17 Thread Tom Rini
On Sun, Feb 18, 2024 at 12:34:49AM +0100, Marek Vasut wrote:

> The following changes since commit 9e00b6993f724da9699ef12573307afea8c19284:
> 
>   Merge tag 'u-boot-dfu-20240215' of 
> https://source.denx.de/u-boot/custodians/u-boot-dfu (2024-02-15 10:26:24 
> -0500)
> 
> are available in the Git repository at:
> 
>   https://source.denx.de/u-boot/custodians/u-boot-sh.git master-porter
> 
> for you to fetch changes up to 87f9ffbef5e894bbcea99614520c8afd216bbf1a:
> 
>   ARM: renesas: Enable LTO on R-Car (2024-02-17 22:38:20 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] rockchip: ringneck-px30: put STM32_RST line in input mode instead of output

2024-02-17 Thread Kever Yang

Hi Quentin,

On 2024/2/9 21:18, Quentin Schulz wrote:

From: Quentin Schulz

The STM32_RST line is routed to the ATtiny microcontroller
PA0/RESET/UPDI pin. By driving the PX30 SoC pin as GPIO output high, we
prevent external UPDI to be used for flashing without first putting this
pin as GPIO input, an extra step we could avoid in userspace.


A little confuse here, this GPIO is an output for PX30, right?So the 
config is:


1. the PX30 SPL init STM32_RST as input, with hardware pull-up the keep 
STM32 work;


2. when need UPDI for flashing, need to set STM32_RST to output and 
trigger the reset in userspace?





There's an external hardware pull-up strong enough to keep the STM32_RST
state high on ATtiny side but weak enough it can be overridden by
external UPDI. This also means it is safe to use for the STM32 variant,
where STM32_RST line will be in the same state as if output high was
used.

The Q7 standard specifies that MFG_NC1 and MFG_NC2 (used for UPDI for
Ringneck) pins should neither be driven by the carrierboard, nor have
pull-up or pull-down resistors.


This sounds like it should use output and pull-none for these GPIOs?


Thanks,

- Kever


This means this commit is safe to use
regardless of the carrierboard this module would be connected to
(provided it follows the Q7 standard).

Fixes: 6acdd63e8771 ("rockchip: ringneck-px30: always reset STM32 companion 
controller on boot")
Cc: Quentin Schulz
Signed-off-by: Quentin Schulz
---
  board/theobroma-systems/ringneck_px30/ringneck-px30.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/theobroma-systems/ringneck_px30/ringneck-px30.c 
b/board/theobroma-systems/ringneck_px30/ringneck-px30.c
index ff7e414303d..2ab1e7a12fa 100644
--- a/board/theobroma-systems/ringneck_px30/ringneck-px30.c
+++ b/board/theobroma-systems/ringneck_px30/ringneck-px30.c
@@ -76,9 +76,9 @@ void spl_board_init(void)
  
  	mdelay(1);
  
-	ret = gpio_direction_output(STM32_RST, 1);

+   ret = gpio_direction_input(STM32_RST);
if (ret) {
-   debug("Failed to configure STM32_RST as output high\n");
+   debug("Failed to configure STM32_RST as input\n");
return;
}
  }

---
base-commit: a4650bf65e4b7d3ef04c90ba8031374428e4a682
change-id: 20240209-ringneck-stm32-rst-input-ca1cdfa67ff5

Best regards,


[PULL] u-boot-sh/master-porter

2024-02-17 Thread Marek Vasut
The following changes since commit 9e00b6993f724da9699ef12573307afea8c19284:

  Merge tag 'u-boot-dfu-20240215' of 
https://source.denx.de/u-boot/custodians/u-boot-dfu (2024-02-15 10:26:24 -0500)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-sh.git master-porter

for you to fetch changes up to 87f9ffbef5e894bbcea99614520c8afd216bbf1a:

  ARM: renesas: Enable LTO on R-Car (2024-02-17 22:38:20 +0100)


Marek Vasut (3):
  ARM: renesas: Disable EFI on R-Car Gen2
  ARM: renesas: Set R-Car Gen2 board size limit to 512 kiB
  ARM: renesas: Enable LTO on R-Car

Niklas Söderlund (1):
  clk: renesas: Fix broken clocks on all Gen2 boards

 Kconfig | 3 ++-
 arch/arm/Kconfig| 1 +
 configs/alt_defconfig   | 2 ++
 configs/blanche_defconfig   | 2 ++
 configs/gose_defconfig  | 2 ++
 configs/koelsch_defconfig   | 2 ++
 configs/lager_defconfig | 2 ++
 configs/porter_defconfig| 2 ++
 configs/silk_defconfig  | 2 ++
 configs/stout_defconfig | 2 ++
 drivers/clk/renesas/clk-rcar-gen2.c | 9 +
 11 files changed, 28 insertions(+), 1 deletion(-)


Re: Booting RPi5B with latest git

2024-02-17 Thread Stefan Wahren

Hi John,

Am 17.02.24 um 17:33 schrieb John:

I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
(2024.04-rc2) just fine.

btw the mainline kernel doesn't have any RPi 5 support yet. So you will
need the vendor kernel.

Best regards



Re: Booting RPi5B with latest git

2024-02-17 Thread Jojan
 You might get these build errorsError:arch/arm/dts/bcm283x-u-boot.dtsi:42.1-14 
Label or path uart0_gpio14 not found
Error: arch/arm/dts/bcm283x-u-boot.dtsi:46.1-14 Label or path uart1_gpio14 
notfound

I just Just commented  out that.

On Saturday, February 17, 2024 at 11:17:12 AM PST, John 
 wrote:  
 
 
On Saturday, February 17th, 2024 at 1:55 PM, Jojan  wrote:

> For RPi 5B you need bcm2712 device tree . RPi4 uses 2711.
> So the e rpi_arm64_confi does not work for RPi5
> 

Which config target did you build or did you modify rpi_arm64_config?  If so, 
can you share the diff?  You mentioned modifying "the config" in your message 
below.

> Also make sure that you have the changes  discussed here.[GIT PULL] rpi: 
> updates for v2024.04 (mail-archive.com)

I built from the master branch of the github mirror.  That should have these 
changes incorporate, no?  https://github.com/u-boot/u-boot/commits/master/

> Iwas able to get the git 
> (https://source.denx.de/u-boot/custodians/u-boot-raspberrypi.git 
> tags/rpi-next-2024.04)
> 
> and modify the config to get 2712 dts file, and able to get u-boot.
> [GIT PULL] rpi: updates for v2024.04
> 
> 
> 
> 
> 
> 
> 
> On Saturday, February 17, 2024 at 08:36:22 AM PST, John 
>  wrote:
> 
> 
> I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
> vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
> (2024.04-rc2) just fine. Yet, if I take that uSD card and place it in my 
> RPi5B, it does not boot. I only see the "U-Boot" submarine logo in the upper 
> right of the screen/no debug output. Any thoughts are appreciated.
> 
> I built u-boot like this:
> 
> unset CFLAGS
> unset CXXFLAGS
> unset CPPFLAGS
> 
> make rpi_arm64_config
> echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
> make EXTRAVERSION=-2024.04rc2
  


Re: Booting RPi5B with latest git

2024-02-17 Thread Jojan
 yes , I created new config  by renaming ' rpi_arm64_config'  to 
rpi5_arm64_config.and edited the device tree to bcm2712-rpi-5-b.dtb. Then get 
get the dts files  from 
linux/arch/arm/boot/dts/bcm2712-rpi-5-b.dts at rpi-6.1.y
)
It gets booted but still need more controllers( ethernet)

On Saturday, February 17, 2024 at 11:17:12 AM PST, John 
 wrote:  
 
 
On Saturday, February 17th, 2024 at 1:55 PM, Jojan  wrote:

> For RPi 5B you need bcm2712 device tree . RPi4 uses 2711.
> So the e rpi_arm64_confi does not work for RPi5
> 

Which config target did you build or did you modify rpi_arm64_config?  If so, 
can you share the diff?  You mentioned modifying "the config" in your message 
below.

> Also make sure that you have the changes  discussed here.[GIT PULL] rpi: 
> updates for v2024.04 (mail-archive.com)

I built from the master branch of the github mirror.  That should have these 
changes incorporate, no?  https://github.com/u-boot/u-boot/commits/master/

> Iwas able to get the git 
> (https://source.denx.de/u-boot/custodians/u-boot-raspberrypi.git 
> tags/rpi-next-2024.04)
> 
> and modify the config to get 2712 dts file, and able to get u-boot.
> [GIT PULL] rpi: updates for v2024.04
> 
> 
> 
> 
> 
> 
> 
> On Saturday, February 17, 2024 at 08:36:22 AM PST, John 
>  wrote:
> 
> 
> I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
> vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
> (2024.04-rc2) just fine. Yet, if I take that uSD card and place it in my 
> RPi5B, it does not boot. I only see the "U-Boot" submarine logo in the upper 
> right of the screen/no debug output. Any thoughts are appreciated.
> 
> I built u-boot like this:
> 
> unset CFLAGS
> unset CXXFLAGS
> unset CPPFLAGS
> 
> make rpi_arm64_config
> echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
> make EXTRAVERSION=-2024.04rc2
  


Re: Booting RPi5B with latest git

2024-02-17 Thread Jojan
 For RPi 5B you need bcm2712 device tree . RPi4 uses 2711.So the e 
rpi_arm64_confi does not work for RPi5
Also make sure that you have the changes  discussed here.[GIT PULL] rpi: 
updates for v2024.04 (mail-archive.com)

Iwas able to get the git 
(https://source.denx.de/u-boot/custodians/u-boot-raspberrypi.git 
tags/rpi-next-2024.04)
and modify the config to get 2712 dts file, and able to get u-boot.

| 
| 
| 
|  |  |

 |

 |
| 
|  | 
[GIT PULL] rpi: updates for v2024.04


 |

 |

 |






   On Saturday, February 17, 2024 at 08:36:22 AM PST, John 
 wrote:  
 
 I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
(2024.04-rc2) just fine. Yet, if I take that uSD card and place it in my RPi5B, 
it does not boot. I only see the "U-Boot" submarine logo in the upper right of 
the screen/no debug output. Any thoughts are appreciated.

I built u-boot like this:

unset CFLAGS
unset CXXFLAGS
unset CPPFLAGS

make rpi_arm64_config
echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
make EXTRAVERSION=-2024.04rc2
  


Re: [PATCH] virtio: fix get_config / set_config for legacy VirtIO targets

2024-02-17 Thread Dmitry Baryshkov
On Mon, 12 Feb 2024 at 09:37, Dmitry Baryshkov
 wrote:
>
> The functions virtio_pci_get_config() and virtio_pci_set_config() don't
> take the offset into account when reading the config space. For example
> this manifests when U-Boot tries to read the MAC address of the VirtIO
> networking device. It reads 6 equa bytes instead of the proper addess.
>
> Fix those functions by taking the offset in the config space into
> account.
>
> Fixes: 4135e10732a0 ("virtio: Add virtio over pci transport driver")
> Signed-off-by: Dmitry Baryshkov 

Gracious ping

> ---
>  drivers/virtio/virtio_pci_legacy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/virtio/virtio_pci_legacy.c 
> b/drivers/virtio/virtio_pci_legacy.c
> index cf5dfb17a94d..aa89604ae84d 100644
> --- a/drivers/virtio/virtio_pci_legacy.c
> +++ b/drivers/virtio/virtio_pci_legacy.c
> @@ -107,7 +107,7 @@ static int virtio_pci_get_config(struct udevice *udev, 
> unsigned int offset,
> int i;
>
> for (i = 0; i < len; i++)
> -   ptr[i] = ioread8(ioaddr + i);
> +   ptr[i] = ioread8(ioaddr + offset + i);
>
> return 0;
>  }
> @@ -121,7 +121,7 @@ static int virtio_pci_set_config(struct udevice *udev, 
> unsigned int offset,
> int i;
>
> for (i = 0; i < len; i++)
> -   iowrite8(ptr[i], ioaddr + i);
> +   iowrite8(ptr[i], ioaddr + offset + i);
>
> return 0;
>  }
> --
> 2.39.2
>


-- 
With best wishes
Dmitry


Re: Booting RPi5B with latest git

2024-02-17 Thread John
Thank you for the steps.  If the NIC is non-functional, I think I will wait for 
official RPi5B support to come to u-boot.


On Saturday, February 17th, 2024 at 2:25 PM, Jojan  wrote:

> yes , I created new config  by renaming ' rpi_arm64_config'  to 
> rpi5_arm64_config.
> and edited the device tree to bcm2712-rpi-5-b.dtb. Then get get the dts files 
>  fromlinux/arch/arm/boot/dts/bcm2712-rpi-5-b.dts at rpi-6.1.y)
> 
> 
> It gets booted but still need more controllers( ethernet)
> 
> 
> 
> On Saturday, February 17, 2024 at 11:17:12 AM PST, John 
>  wrote:
> 
> 
> 
> On Saturday, February 17th, 2024 at 1:55 PM, Jojan  wrote:
> 
> > For RPi 5B you need bcm2712 device tree . RPi4 uses 2711.
> > So the e rpi_arm64_confi does not work for RPi5
> >
> 
> Which config target did you build or did you modify rpi_arm64_config?  If so, 
> can you share the diff?  You mentioned modifying "the config" in your message 
> below.
> 
> > Also make sure that you have the changes  discussed here.[GIT PULL] rpi: 
> > updates for v2024.04 (mail-archive.com)
> 
> I built from the master branch of the github mirror.  That should have these 
> changes incorporate, no?  https://github.com/u-boot/u-boot/commits/master/
> 
> > Iwas able to get the git 
> > (https://source.denx.de/u-boot/custodians/u-boot-raspberrypi.git 
> > tags/rpi-next-2024.04)
> >
> > and modify the config to get 2712 dts file, and able to get u-boot.
> > [GIT PULL] rpi: updates for v2024.04
> >
> >
> >
> >
> >
> >
> >
> > On Saturday, February 17, 2024 at 08:36:22 AM PST, John 
> >  wrote:
> >
> >
> > I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
> > vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
> > (2024.04-rc2) just fine. Yet, if I take that uSD card and place it in my 
> > RPi5B, it does not boot. I only see the "U-Boot" submarine logo in the 
> > upper right of the screen/no debug output. Any thoughts are appreciated.
> >
> > I built u-boot like this:
> >
> > unset CFLAGS
> > unset CXXFLAGS
> > unset CPPFLAGS
> >
> > make rpi_arm64_config
> > echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
> > make EXTRAVERSION=-2024.04rc2


Re: Booting RPi5B with latest git

2024-02-17 Thread John


On Saturday, February 17th, 2024 at 1:55 PM, Jojan  wrote:

> For RPi 5B you need bcm2712 device tree . RPi4 uses 2711.
> So the e rpi_arm64_confi does not work for RPi5
> 

Which config target did you build or did you modify rpi_arm64_config?  If so, 
can you share the diff?  You mentioned modifying "the config" in your message 
below.

> Also make sure that you have the changes  discussed here.[GIT PULL] rpi: 
> updates for v2024.04 (mail-archive.com)

I built from the master branch of the github mirror.  That should have these 
changes incorporate, no?  https://github.com/u-boot/u-boot/commits/master/

> Iwas able to get the git 
> (https://source.denx.de/u-boot/custodians/u-boot-raspberrypi.git 
> tags/rpi-next-2024.04)
> 
> and modify the config to get 2712 dts file, and able to get u-boot.
> [GIT PULL] rpi: updates for v2024.04
> 
> 
> 
> 
> 
> 
> 
> On Saturday, February 17, 2024 at 08:36:22 AM PST, John 
>  wrote:
> 
> 
> I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
> vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
> (2024.04-rc2) just fine. Yet, if I take that uSD card and place it in my 
> RPi5B, it does not boot. I only see the "U-Boot" submarine logo in the upper 
> right of the screen/no debug output. Any thoughts are appreciated.
> 
> I built u-boot like this:
> 
> unset CFLAGS
> unset CXXFLAGS
> unset CPPFLAGS
> 
> make rpi_arm64_config
> echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
> make EXTRAVERSION=-2024.04rc2


[PATCH 11/11] rockchip: google: gru: Migrate to use IO-domain driver

2024-02-17 Thread Jonas Karlman
Switch to use the IO-domain driver to configure IO-domain based on
device tree instead of a setup_iodomain() function.

Signed-off-by: Jonas Karlman 
---
This should be runtime tested by someone with a gru device. All DT props
and driver seem to be enabled and I expect the io_vsel and soc_con0 to
be configured with correct value.
---
 board/google/gru/gru.c | 35 --
 configs/chromebook_bob_defconfig   |  1 +
 configs/chromebook_kevin_defconfig |  1 +
 3 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c
index 9cb3a5252047..e08cb42c27ed 100644
--- a/board/google/gru/gru.c
+++ b/board/google/gru/gru.c
@@ -3,18 +3,9 @@
  * Copyright 2018 Google
  */
 
-#include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
-
-#define GRF_IO_VSEL_BT656_SHIFT 0
-#define GRF_IO_VSEL_AUDIO_SHIFT 1
-#define PMUGRF_CON0_VSEL_SHIFT 8
-#define PMUGRF_CON0_VOL_SHIFT 9
 
 #ifdef CONFIG_SPL_BUILD
 /* provided to defeat compiler optimisation in board_init_f() */
@@ -63,29 +54,3 @@ int board_early_init_r(void)
return 0;
 }
 #endif
-
-static void setup_iodomain(void)
-{
-   struct rk3399_grf_regs *grf =
-  syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-   struct rk3399_pmugrf_regs *pmugrf =
-  syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
-
-   /* BT656 and audio is in 1.8v domain */
-   rk_setreg(>io_vsel, (1 << GRF_IO_VSEL_BT656_SHIFT |
- 1 << GRF_IO_VSEL_AUDIO_SHIFT));
-
-   /*
-* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL
-* and explicitly configure that PMU1830_VOL to be 1.8V
-*/
-   rk_setreg(>soc_con0, (1 << PMUGRF_CON0_VSEL_SHIFT |
- 1 << PMUGRF_CON0_VOL_SHIFT));
-}
-
-int rockchip_early_misc_init_r(void)
-{
-   setup_iodomain();
-
-   return 0;
-}
diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
index 28697b174a05..9e13b3544d05 100644
--- a/configs/chromebook_bob_defconfig
+++ b/configs/chromebook_bob_defconfig
@@ -66,6 +66,7 @@ CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_I2C_MUX=y
 CONFIG_CROS_EC_KEYB=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_CROS_EC=y
 CONFIG_CROS_EC_SPI=y
 CONFIG_PWRSEQ=y
diff --git a/configs/chromebook_kevin_defconfig 
b/configs/chromebook_kevin_defconfig
index aab938014e38..e1e80447de3c 100644
--- a/configs/chromebook_kevin_defconfig
+++ b/configs/chromebook_kevin_defconfig
@@ -67,6 +67,7 @@ CONFIG_I2C_CROS_EC_TUNNEL=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_I2C_MUX=y
 CONFIG_CROS_EC_KEYB=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_CROS_EC=y
 CONFIG_CROS_EC_SPI=y
 CONFIG_PWRSEQ=y
-- 
2.43.0



[PATCH 09/11] rockchip: vamrs: rock960: Migrate to use IO-domain driver

2024-02-17 Thread Jonas Karlman
Switch to use the IO-domain driver to configure IO-domain based on
device tree instead of a setup_iodomain() function.

Signed-off-by: Jonas Karlman 
---
 board/vamrs/rock960_rk3399/Makefile |  6 -
 board/vamrs/rock960_rk3399/rock960-rk3399.c | 27 -
 configs/ficus-rk3399_defconfig  |  1 +
 configs/rock960-rk3399_defconfig|  1 +
 4 files changed, 2 insertions(+), 33 deletions(-)
 delete mode 100644 board/vamrs/rock960_rk3399/Makefile
 delete mode 100644 board/vamrs/rock960_rk3399/rock960-rk3399.c

diff --git a/board/vamrs/rock960_rk3399/Makefile 
b/board/vamrs/rock960_rk3399/Makefile
deleted file mode 100644
index 6c3e475b3a85..
--- a/board/vamrs/rock960_rk3399/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2018 Manivannan Sadhasivam 
-#
-
-obj-y  += rock960-rk3399.o
diff --git a/board/vamrs/rock960_rk3399/rock960-rk3399.c 
b/board/vamrs/rock960_rk3399/rock960-rk3399.c
deleted file mode 100644
index 876be8ed9e10..
--- a/board/vamrs/rock960_rk3399/rock960-rk3399.c
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2018 Manivannan Sadhasivam 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#ifdef CONFIG_MISC_INIT_R
-int misc_init_r(void)
-{
-   struct rk3399_grf_regs *grf =
-   syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-
-   /**
-* Some SSD's to work on rock960 would require explicit
-* domain voltage change, so BT565 is in 1.8v domain
-*/
-   rk_setreg(>io_vsel, BIT(0));
-
-   return 0;
-}
-#endif
diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig
index 3ff894f1207b..5f6cdeb99d50 100644
--- a/configs/ficus-rk3399_defconfig
+++ b/configs/ficus-rk3399_defconfig
@@ -42,6 +42,7 @@ CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index 6e22b83ec910..1685fe3c19e7 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -49,6 +49,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SYS_MMC_ENV_DEV=1
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
-- 
2.43.0



[PATCH 08/11] rockchip: pine64: pinephone-pro: Migrate to use IO-domain driver

2024-02-17 Thread Jonas Karlman
Switch to use the IO-domain driver to configure IO-domain based on
device tree instead of a setup_iodomain() function.

Signed-off-by: Jonas Karlman 
---
This should be runtime tested by someone with a pinephone-pro device.
All DT props and driver seem to be enabled and I expect the io_vsel to
be configured with correct value.
---
 board/pine64/pinephone-pro-rk3399/Makefile|  1 -
 .../pinephone-pro-rk3399.c| 42 ---
 configs/pinephone-pro-rk3399_defconfig|  1 +
 3 files changed, 1 insertion(+), 43 deletions(-)
 delete mode 100644 board/pine64/pinephone-pro-rk3399/Makefile
 delete mode 100644 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c

diff --git a/board/pine64/pinephone-pro-rk3399/Makefile 
b/board/pine64/pinephone-pro-rk3399/Makefile
deleted file mode 100644
index 8d9203053e57..
--- a/board/pine64/pinephone-pro-rk3399/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-obj-y  += pinephone-pro-rk3399.o
diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c 
b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
deleted file mode 100644
index 06dc512c57d8..
--- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- * (C) Copyright 2022 Peter Robinson 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define GRF_IO_VSEL_BT565_GPIO2AB 1
-#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2
-#define PMUGRF_CON0_VSEL_SHIFT 8
-
-#ifdef CONFIG_MISC_INIT_R
-static void setup_iodomain(void)
-{
-   struct rk3399_grf_regs *grf =
-  syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-   struct rk3399_pmugrf_regs *pmugrf =
-  syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
-
-   /* BT565 is in 1.8v domain */
-   rk_setreg(>io_vsel,
- GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A);
-
-   /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
-   rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
-}
-
-int rockchip_early_misc_init_r(void)
-{
-   setup_iodomain();
-
-   return 0;
-
-}
-#endif
diff --git a/configs/pinephone-pro-rk3399_defconfig 
b/configs/pinephone-pro-rk3399_defconfig
index 04551df1da9b..47124196d626 100644
--- a/configs/pinephone-pro-rk3399_defconfig
+++ b/configs/pinephone-pro-rk3399_defconfig
@@ -58,6 +58,7 @@ CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
-- 
2.43.0



[PATCH 07/11] rockchip: pine64: pinebook-pro: Migrate to use IO-domain driver

2024-02-17 Thread Jonas Karlman
Switch to use the IO-domain driver to configure IO-domain based on
device tree instead of a setup_iodomain() function.

Signed-off-by: Jonas Karlman 
---
 board/pine64/pinebook-pro-rk3399/Makefile |  1 -
 .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 39 ---
 configs/pinebook-pro-rk3399_defconfig |  1 +
 3 files changed, 1 insertion(+), 40 deletions(-)
 delete mode 100644 board/pine64/pinebook-pro-rk3399/Makefile
 delete mode 100644 board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c

diff --git a/board/pine64/pinebook-pro-rk3399/Makefile 
b/board/pine64/pinebook-pro-rk3399/Makefile
deleted file mode 100644
index 2f692a12a673..
--- a/board/pine64/pinebook-pro-rk3399/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-obj-y  += pinebook-pro-rk3399.o
diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c 
b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
deleted file mode 100644
index 0001022c62a6..
--- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- * (C) Copyright 2020 Peter Robinson 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define GRF_IO_VSEL_BT565_SHIFT 0
-#define PMUGRF_CON0_VSEL_SHIFT 8
-
-#ifdef CONFIG_MISC_INIT_R
-static void setup_iodomain(void)
-{
-   struct rk3399_grf_regs *grf =
-  syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-   struct rk3399_pmugrf_regs *pmugrf =
-  syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
-
-   /* BT565 is in 1.8v domain */
-   rk_setreg(>io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
-
-   /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
-   rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
-}
-
-int rockchip_early_misc_init_r(void)
-{
-   setup_iodomain();
-
-   return 0;
-}
-#endif
diff --git a/configs/pinebook-pro-rk3399_defconfig 
b/configs/pinebook-pro-rk3399_defconfig
index d70db2bab749..9e0dbd209be3 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -59,6 +59,7 @@ CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_IO_VOLTAGE=y
 CONFIG_SPL_MMC_IO_VOLTAGE=y
 CONFIG_MMC_UHS_SUPPORT=y
-- 
2.43.0



[PATCH 10/11] rockchip: theobroma-systems: puma: Migrate to use IO-domain driver

2024-02-17 Thread Jonas Karlman
Switch to use the IO-domain driver to configure IO-domain based on
device tree instead of a setup_iodomain() function.

Signed-off-by: Jonas Karlman 
---
This should be runtime tested by someone with a puma device. All DT
props and driver seem to be enabled and I expect the io_vsel to be
configured with correct value.
---
 .../puma_rk3399/puma-rk3399.c | 21 ---
 configs/puma-rk3399_defconfig |  1 +
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c 
b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 8b998ef45565..eeb8a99231e4 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -3,31 +3,10 @@
  * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include "../common/common.h"
 
-static void setup_iodomain(void)
-{
-   const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3;
-   struct rk3399_grf_regs *grf =
-   syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-
-   /*
-* Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6).
-* Linux assumes that PCIE_RST# works out of the box as it probes
-* PCIe before loading the iodomain driver.
-*/
-   rk_setreg(>io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT);
-}
-
 int rockchip_early_misc_init_r(void)
 {
-   setup_iodomain();
setup_boottargets();
 
return 0;
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index 818bfdf9aa9b..e30305abfafd 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -66,6 +66,7 @@ CONFIG_GPIO_HOG=y
 CONFIG_SPL_GPIO_HOG=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
-- 
2.43.0



[PATCH 05/11] rockchip: io-domain: Add support for RK3399

2024-02-17 Thread Jonas Karlman
Port the RK3399 part of the Rockchip IO-domain driver from linux.

This differs from linux version in that pmu io iodomain bit is enabled
in the write ops instead of in an init ops as in linux, this way we can
avoid keeping a full state of all supply that have been configured.

Signed-off-by: Jonas Karlman 
---
 drivers/misc/rockchip-io-domain.c | 79 +--
 1 file changed, 75 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/rockchip-io-domain.c 
b/drivers/misc/rockchip-io-domain.c
index 3f6227f993f9..0ffea32ef07f 100644
--- a/drivers/misc/rockchip-io-domain.c
+++ b/drivers/misc/rockchip-io-domain.c
@@ -5,7 +5,6 @@
  * Ported from linux drivers/soc/rockchip/io-domain.c
  */
 
-#include 
 #include 
 #include 
 #include 
@@ -28,6 +27,10 @@
 #define MAX_VOLTAGE_1_8198
 #define MAX_VOLTAGE_3_3360
 
+#define RK3399_PMUGRF_CON0 0x180
+#define RK3399_PMUGRF_CON0_VSELBIT(8)
+#define RK3399_PMUGRF_VSEL_SUPPLY_NUM  9
+
 #define RK3568_PMU_GRF_IO_VSEL00x0140
 #define RK3568_PMU_GRF_IO_VSEL10x0144
 #define RK3568_PMU_GRF_IO_VSEL20x0148
@@ -35,10 +38,10 @@
 struct rockchip_iodomain_soc_data {
int grf_offset;
const char *supply_names[MAX_SUPPLIES];
-   int (*write)(struct regmap *grf, int idx, int uV);
+   int (*write)(struct regmap *grf, uint offset, int idx, int uV);
 };
 
-static int rk3568_iodomain_write(struct regmap *grf, int idx, int uV)
+static int rk3568_iodomain_write(struct regmap *grf, uint offset, int idx, int 
uV)
 {
u32 is_3v3 = uV > MAX_VOLTAGE_1_8;
u32 val0, val1;
@@ -78,6 +81,64 @@ static int rk3568_iodomain_write(struct regmap *grf, int 
idx, int uV)
return 0;
 }
 
+static int rockchip_iodomain_write(struct regmap *grf, uint offset, int idx, 
int uV)
+{
+   u32 val;
+
+   /* set value bit */
+   val = (uV > MAX_VOLTAGE_1_8) ? 0 : 1;
+   val <<= idx;
+
+   /* apply hiword-mask */
+   val |= (BIT(idx) << 16);
+
+   return regmap_write(grf, offset, val);
+}
+
+static int rk3399_pmu_iodomain_write(struct regmap *grf, uint offset, int idx, 
int uV)
+{
+   int ret = rockchip_iodomain_write(grf, offset, idx, uV);
+
+   if (!ret && idx == RK3399_PMUGRF_VSEL_SUPPLY_NUM) {
+   /*
+* set pmu io iodomain to also use this framework
+* instead of a special gpio.
+*/
+   u32 val = RK3399_PMUGRF_CON0_VSEL | (RK3399_PMUGRF_CON0_VSEL << 
16);
+   ret = regmap_write(grf, RK3399_PMUGRF_CON0, val);
+   }
+
+   return ret;
+}
+
+static const struct rockchip_iodomain_soc_data soc_data_rk3399 = {
+   .grf_offset = 0xe640,
+   .supply_names = {
+   "bt656-supply", /* APIO2_VDD */
+   "audio-supply", /* APIO5_VDD */
+   "sdmmc-supply", /* SDMMC0_VDD */
+   "gpio1830-supply",  /* APIO4_VDD */
+   },
+   .write = rockchip_iodomain_write,
+};
+
+static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
+   .grf_offset = 0x180,
+   .supply_names = {
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   NULL,
+   "pmu1830-supply",   /* PMUIO2_VDD */
+   },
+   .write = rk3399_pmu_iodomain_write,
+};
+
 static const struct rockchip_iodomain_soc_data soc_data_rk3568_pmu = {
.grf_offset = 0x140,
.supply_names = {
@@ -95,6 +156,14 @@ static const struct rockchip_iodomain_soc_data 
soc_data_rk3568_pmu = {
 };
 
 static const struct udevice_id rockchip_iodomain_ids[] = {
+   {
+   .compatible = "rockchip,rk3399-io-voltage-domain",
+   .data = (ulong)_data_rk3399,
+   },
+   {
+   .compatible = "rockchip,rk3399-pmu-io-voltage-domain",
+   .data = (ulong)_data_rk3399_pmu,
+   },
{
.compatible = "rockchip,rk3568-pmu-io-voltage-domain",
.data = (ulong)_data_rk3568_pmu,
@@ -152,7 +221,9 @@ static int rockchip_iodomain_probe(struct udevice *dev)
continue;
}
 
-   soc_data->write(grf, i, uV);
+   ret = soc_data->write(grf, soc_data->grf_offset, i, uV);
+   if (ret)
+   dev_err(dev, "%s: Couldn't write to GRF\n", 
supply_name);
}
 
return 0;
-- 
2.43.0



[PATCH 06/11] rockchip: pine64: rockpro64: Migrate to use IO-domain driver

2024-02-17 Thread Jonas Karlman
Switch to use the IO-domain driver to configure IO-domain based on
device tree instead of a setup_iodomain() function.

Signed-off-by: Jonas Karlman 
---
 board/pine64/rockpro64_rk3399/Makefile|  7 
 .../rockpro64_rk3399/rockpro64-rk3399.c   | 39 ---
 configs/rockpro64-rk3399_defconfig|  1 +
 3 files changed, 1 insertion(+), 46 deletions(-)
 delete mode 100644 board/pine64/rockpro64_rk3399/Makefile
 delete mode 100644 board/pine64/rockpro64_rk3399/rockpro64-rk3399.c

diff --git a/board/pine64/rockpro64_rk3399/Makefile 
b/board/pine64/rockpro64_rk3399/Makefile
deleted file mode 100644
index b015c47e6fa6..
--- a/board/pine64/rockpro64_rk3399/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# (C) Copyright 2019 Vasily Khoruzhick
-#
-# SPDX-License-Identifier: GPL-2.0+
-#
-
-obj-y  += rockpro64-rk3399.o
diff --git a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c 
b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
deleted file mode 100644
index fd78ad60d14b..
--- a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2019 Vasily Khoruzhick 
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define GRF_IO_VSEL_BT565_SHIFT 0
-#define PMUGRF_CON0_VSEL_SHIFT 8
-
-#ifdef CONFIG_MISC_INIT_R
-static void setup_iodomain(void)
-{
-   struct rk3399_grf_regs *grf =
-   syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-   struct rk3399_pmugrf_regs *pmugrf =
-   syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
-
-   /* BT565 is in 1.8v domain */
-   rk_setreg(>io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
-
-   /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
-   rk_setreg(>soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
-}
-
-int rockchip_early_misc_init_r(void)
-{
-   setup_iodomain();
-
-   return 0;
-}
-
-#endif
diff --git a/configs/rockpro64-rk3399_defconfig 
b/configs/rockpro64-rk3399_defconfig
index 29f91e2ef67e..2e7325bad8cf 100644
--- a/configs/rockpro64-rk3399_defconfig
+++ b/configs/rockpro64-rk3399_defconfig
@@ -62,6 +62,7 @@ CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
-- 
2.43.0



[PATCH 04/11] board: rockchip: Add a common ROCK Pi 4 target

2024-02-17 Thread Jonas Karlman
Move ROCK Pi 4 specific board code from the shared evb_rk3399 target
into its own board target and update related defconfigs to use the new
TARGET_ROCKPI4_RK3399 option.

Also move the call to gpt_capsule_update_setup() from the weak function
rk_board_late_init() into the main board_late_init() function.

Signed-off-by: Jonas Karlman 
---
 arch/arm/mach-rockchip/board.c| 10 +++---
 arch/arm/mach-rockchip/rk3399/Kconfig |  6 
 board/radxa/rockpi4-rk3399/Kconfig| 15 +
 board/radxa/rockpi4-rk3399/MAINTAINERS| 29 +
 .../rockpi4-rk3399}/Makefile  |  2 +-
 .../rockpi4-rk3399/rockpi4-rk3399.c}  | 13 ++--
 board/rockchip/evb_rk3399/MAINTAINERS | 29 -
 configs/rock-4c-plus-rk3399_defconfig |  2 +-
 configs/rock-4se-rk3399_defconfig |  2 +-
 configs/rock-pi-4-rk3399_defconfig|  2 +-
 configs/rock-pi-4c-rk3399_defconfig   |  2 +-
 include/configs/rk3399_common.h   | 16 --
 include/configs/rockpi4-rk3399.h  | 32 +++
 13 files changed, 95 insertions(+), 65 deletions(-)
 create mode 100644 board/radxa/rockpi4-rk3399/Kconfig
 create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS
 rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%)
 rename board/{rockchip/evb_rk3399/evb-rk3399.c => 
radxa/rockpi4-rk3399/rockpi4-rk3399.c} (79%)
 create mode 100644 include/configs/rockpi4-rk3399.h

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 4f666aee706f..dea5805c4665 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -34,7 +34,7 @@
 #include 
 #include 
 
-#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && 
IS_ENABLED(CONFIG_EFI_PARTITION)
 
 #define DFU_ALT_BUF_LENSZ_1K
 
@@ -185,10 +185,6 @@ static void gpt_capsule_update_setup(void)
 
 __weak int rk_board_late_init(void)
 {
-#if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
-   gpt_capsule_update_setup();
-#endif
-
return 0;
 }
 
@@ -196,6 +192,10 @@ int board_late_init(void)
 {
setup_boot_mode();
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && 
IS_ENABLED(CONFIG_EFI_PARTITION)
+   gpt_capsule_update_setup();
+#endif
+
return rk_board_late_init();
 }
 
diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig 
b/arch/arm/mach-rockchip/rk3399/Kconfig
index d01063ac98b6..bf3600aee2ad 100644
--- a/arch/arm/mach-rockchip/rk3399/Kconfig
+++ b/arch/arm/mach-rockchip/rk3399/Kconfig
@@ -89,6 +89,11 @@ config TARGET_ROCK960_RK3399
   * 2x USB 3.0 type A, 2x USB 2.0 type A (host mode only),
 1x USB 3.0 type C OTG
 
+config TARGET_ROCKPI4_RK3399
+   bool "Radxa ROCK Pi 4 board"
+   help
+ Support for ROCK Pi 4 board family by Radxa.
+
 config TARGET_ROCKPRO64_RK3399
bool "Pine64 Rockpro64 board"
help
@@ -174,6 +179,7 @@ source "board/google/gru/Kconfig"
 source "board/pine64/pinebook-pro-rk3399/Kconfig"
 source "board/pine64/pinephone-pro-rk3399/Kconfig"
 source "board/pine64/rockpro64_rk3399/Kconfig"
+source "board/radxa/rockpi4-rk3399/Kconfig"
 source "board/rockchip/evb_rk3399/Kconfig"
 source "board/theobroma-systems/puma_rk3399/Kconfig"
 source "board/vamrs/rock960_rk3399/Kconfig"
diff --git a/board/radxa/rockpi4-rk3399/Kconfig 
b/board/radxa/rockpi4-rk3399/Kconfig
new file mode 100644
index ..d82663506b12
--- /dev/null
+++ b/board/radxa/rockpi4-rk3399/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_ROCKPI4_RK3399
+
+config SYS_BOARD
+   default "rockpi4-rk3399"
+
+config SYS_VENDOR
+   default "radxa"
+
+config SYS_CONFIG_NAME
+   default "rockpi4-rk3399"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+   def_bool y
+
+endif
diff --git a/board/radxa/rockpi4-rk3399/MAINTAINERS 
b/board/radxa/rockpi4-rk3399/MAINTAINERS
new file mode 100644
index ..12d4f35af881
--- /dev/null
+++ b/board/radxa/rockpi4-rk3399/MAINTAINERS
@@ -0,0 +1,29 @@
+ROCK-PI-4
+M: Jagan Teki 
+R: Jonas Karlman 
+S: Maintained
+F: board/radxa/rockpi4-rk3399/
+F: configs/rock-pi-4-rk3399_defconfig
+F: arch/arm/dts/rk3399-rock-pi-4.dtsi
+F: arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi
+F: arch/arm/dts/rk3399-rock-pi-4a.dts
+F: arch/arm/dts/rk3399-rock-pi-4a-u-boot.dtsi
+F: configs/rock-pi-4c-rk3399_defconfig
+F: arch/arm/dts/rk3399-rock-pi-4c.dts
+F: arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
+
+ROCK-4C+
+M: FUKAUMI Naoki 
+R: Jonas Karlman 
+S: Maintained
+F: configs/rock-4c-plus-rk3399_defconfig
+F: arch/arm/dts/rk3399-rock-4c-plus.dts
+F: arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
+
+ROCK-4SE
+M: Christopher Obbard 
+R: Jonas Karlman 
+S: Maintained
+F: configs/rock-4se-rk3399_defconfig
+F: 

[PATCH 03/11] board: rockchip: rk3399: Remove unused board_early_init_f functions

2024-02-17 Thread Jonas Karlman
These functions is excluded from SPL build and BOARD_EARLY_INIT_F is not
enabled for any of the affected boards, so this legacy code is not used.

Rockchip common board code already enable all regulators flagged as
always-on or boot-on in device tree, and fixed/gpio regulators now have
basic reference counting support so the original intent of this code is
no longer valid.

Remove the unneeded and unused code that used to enable usb regulators.

Signed-off-by: Jonas Karlman 
---
 board/firefly/roc-pc-rk3399/roc-pc-rk3399.c   | 22 +--
 .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 22 ---
 .../pinephone-pro-rk3399.c| 22 ---
 board/rockchip/evb_rk3399/evb-rk3399.c| 20 -
 4 files changed, 1 insertion(+), 85 deletions(-)

diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c 
b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
index 93e7d776fb2f..590519b32af2 100644
--- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
+++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
@@ -9,32 +9,12 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
 #include 
 
-#ifndef CONFIG_SPL_BUILD
-int board_early_init_f(void)
-{
-   struct udevice *regulator;
-   int ret;
-
-   ret = regulator_get_by_platname("vcc5v0_host", );
-   if (ret) {
-   debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
-   goto out;
-   }
-
-   ret = regulator_set_enable(regulator, true);
-   if (ret)
-   debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret);
-out:
-   return 0;
-}
-
-#else
+#ifdef CONFIG_SPL_BUILD
 
 #define PMUGRF_BASE0xff32
 #define GPIO0_BASE 0xff72
diff --git a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c 
b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
index 5e758ea6cd92..0001022c62a6 100644
--- a/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
+++ b/board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
@@ -11,32 +11,10 @@
 #include 
 #include 
 #include 
-#include 
 
 #define GRF_IO_VSEL_BT565_SHIFT 0
 #define PMUGRF_CON0_VSEL_SHIFT 8
 
-#ifndef CONFIG_SPL_BUILD
-int board_early_init_f(void)
-{
-   struct udevice *regulator;
-   int ret;
-
-   ret = regulator_get_by_platname("vcc5v0_usb", );
-   if (ret) {
-   pr_debug("%s vcc5v0_usb init fail! ret %d\n", __func__, ret);
-   goto out;
-   }
-
-   ret = regulator_set_enable(regulator, true);
-   if (ret)
-   pr_debug("%s vcc5v0-host-en-gpio set fail! ret %d\n", __func__, 
ret);
-
-out:
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_MISC_INIT_R
 static void setup_iodomain(void)
 {
diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c 
b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
index c9b0d5a061d6..06dc512c57d8 100644
--- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
+++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
@@ -11,33 +11,11 @@
 #include 
 #include 
 #include 
-#include 
 
 #define GRF_IO_VSEL_BT565_GPIO2AB 1
 #define GRF_IO_VSEL_AUDIO_GPIO3D4A 2
 #define PMUGRF_CON0_VSEL_SHIFT 8
 
-#ifndef CONFIG_SPL_BUILD
-int board_early_init_f(void)
-{
-   struct udevice *regulator;
-   int ret;
-
-   ret = regulator_get_by_platname("vcc5v0_usb", );
-   if (ret) {
-   pr_debug("%s vcc5v0_usb init fail! ret %d\n", __func__, ret);
-   goto out;
-   }
-
-   ret = regulator_set_enable(regulator, true);
-   if (ret)
-   pr_debug("%s vcc5v0-host-en-gpio set fail! ret %d\n", __func__, 
ret);
-
-out:
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_MISC_INIT_R
 static void setup_iodomain(void)
 {
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c 
b/board/rockchip/evb_rk3399/evb-rk3399.c
index 3c773d0930cc..ebdd74a7b97f 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #define ROCKPI4_UPDATABLE_IMAGES   2
 
@@ -25,25 +24,6 @@ struct efi_capsule_update_info update_info = {
 #endif
 
 #ifndef CONFIG_SPL_BUILD
-int board_early_init_f(void)
-{
-   struct udevice *regulator;
-   int ret;
-
-   ret = regulator_get_by_platname("vcc5v0_host", );
-   if (ret) {
-   debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
-   goto out;
-   }
-
-   ret = regulator_set_enable(regulator, true);
-   if (ret)
-   debug("%s vcc5v0-host-en set fail! ret %d\n", __func__, ret);
-
-out:
-   return 0;
-}
-
 #if defined(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) && defined(CONFIG_EFI_PARTITION)
 static bool board_is_rockpi_4b(void)
 {
-- 
2.43.0



[PATCH 01/11] board: rockchip: rk3399: Add device tree files to MAINTAINERS

2024-02-17 Thread Jonas Karlman
Update MAINTAINERS files for RK3399 boards to include related device
tree files. Also correct a few filenames.

Signed-off-by: Jonas Karlman 
---
 board/firefly/roc-pc-rk3399/MAINTAINERS   |  5 
 board/pine64/pinebook-pro-rk3399/MAINTAINERS  |  2 +-
 board/pine64/pinephone-pro-rk3399/MAINTAINERS |  2 +-
 board/pine64/rockpro64_rk3399/MAINTAINERS |  2 ++
 board/rockchip/evb_rk3399/MAINTAINERS | 24 ++-
 board/vamrs/rock960_rk3399/MAINTAINERS|  5 
 6 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/board/firefly/roc-pc-rk3399/MAINTAINERS 
b/board/firefly/roc-pc-rk3399/MAINTAINERS
index 68a5b757d1df..d26e3c4cd2ba 100644
--- a/board/firefly/roc-pc-rk3399/MAINTAINERS
+++ b/board/firefly/roc-pc-rk3399/MAINTAINERS
@@ -6,3 +6,8 @@ F:  board/firefly/roc-pc-rk3399
 F: include/configs/roc-pc-rk3399.h
 F: configs/roc-pc-rk3399_defconfig
 F: configs/roc-pc-mezzanine-rk3399_defconfig
+F: arch/arm/dts/rk3399-roc-pc.dts
+F: arch/arm/dts/rk3399-roc-pc.dtsi
+F: arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
+F: arch/arm/dts/rk3399-roc-pc-mezzanine.dts
+F: arch/arm/dts/rk3399-roc-pc-mezzanine-u-boot.dtsi
diff --git a/board/pine64/pinebook-pro-rk3399/MAINTAINERS 
b/board/pine64/pinebook-pro-rk3399/MAINTAINERS
index 7300ca1b1b81..b80fc5cb6021 100644
--- a/board/pine64/pinebook-pro-rk3399/MAINTAINERS
+++ b/board/pine64/pinebook-pro-rk3399/MAINTAINERS
@@ -2,7 +2,7 @@ PINEBOOK_PRO
 M: Peter Robinson 
 S: Maintained
 F: board/pine64/pinebook-pro-rk3399/
-F: include/configs/rk3399-pinebook-pro.h
+F: include/configs/pinebook-pro-rk3399.h
 F: arch/arm/dts/rk3399-pinebook-pro.dts
 F: arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
 F: configs/pinebook-pro-rk3399_defconfig
diff --git a/board/pine64/pinephone-pro-rk3399/MAINTAINERS 
b/board/pine64/pinephone-pro-rk3399/MAINTAINERS
index bc2dcdd8d423..a2f4337cebc6 100644
--- a/board/pine64/pinephone-pro-rk3399/MAINTAINERS
+++ b/board/pine64/pinephone-pro-rk3399/MAINTAINERS
@@ -2,7 +2,7 @@ PINEPHONE_PRO
 M: Peter Robinson 
 S: Maintained
 F: board/pine64/pinephone-pro-rk3399/
-F: include/configs/rk3399-pinephone-pro.h
+F: include/configs/pinephone-pro-rk3399.h
 F: arch/arm/dts/rk3399-pinephone-pro.dts
 F: arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi
 F: configs/pinephone-pro-rk3399_defconfig
diff --git a/board/pine64/rockpro64_rk3399/MAINTAINERS 
b/board/pine64/rockpro64_rk3399/MAINTAINERS
index 220ee21f230f..396363cc8d9b 100644
--- a/board/pine64/rockpro64_rk3399/MAINTAINERS
+++ b/board/pine64/rockpro64_rk3399/MAINTAINERS
@@ -3,5 +3,7 @@ M:  Jagan Teki 
 S: Maintained
 F: board/pine64/rockpro64_rk3399
 F: include/configs/rockpro64_rk3399.h
+F: arch/arm/dts/rk3399-rockpro64.dts
+F: arch/arm/dts/rk3399-rockpro64.dtsi
 F: arch/arm/dts/rk3399-rockpro64-u-boot.dtsi
 F: configs/rockpro64-rk3399_defconfig
diff --git a/board/rockchip/evb_rk3399/MAINTAINERS 
b/board/rockchip/evb_rk3399/MAINTAINERS
index acdb840f2093..166e01bcc685 100644
--- a/board/rockchip/evb_rk3399/MAINTAINERS
+++ b/board/rockchip/evb_rk3399/MAINTAINERS
@@ -4,35 +4,45 @@ S:  Maintained
 F:  board/rockchip/evb_rk3399
 F:  include/configs/evb_rk3399.h
 F:  configs/evb-rk3399_defconfig
+F:  arch/arm/dts/rk3399-evb.dts
+F:  arch/arm/dts/rk3399-evb-u-boot.dtsi
 F:  configs/firefly-rk3399_defconfig
+F:  arch/arm/dts/rk3399-firefly.dts
+F:  arch/arm/dts/rk3399-firefly-u-boot.dtsi
 
 EAIDK-610
 M:  Andy Yan 
 S:  Maintained
 F: configs/eaidk-610-rk3399_defconfig
+F: arch/arm/dts/rk3399-eaidk-610.dts
 F: arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi
 
 KHADAS-EDGE
 M: Nick Xie 
 S: Maintained
 F: configs/khadas-edge-rk3399_defconfig
+F: arch/arm/dts/rk3399-khadas-edge.dts
+F: arch/arm/dts/rk3399-khadas-edge.dtsi
 F: arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
 
 KHADAS-EDGE-CAPTAIN
 M: Nick Xie 
 S: Maintained
 F: configs/khadas-edge-captain-rk3399_defconfig
+F: arch/arm/dts/rk3399-khadas-edge-captain.dts
 F: arch/arm/dts/rk3399-khadas-edge-captain-u-boot.dtsi
 
 KHADAS-EDGE-V
 M: Nick Xie 
 S: Maintained
 F: configs/khadas-edge-v-rk3399_defconfig
+F: arch/arm/dts/rk3399-khadas-edge-v.dts
 F: arch/arm/dts/rk3399-khadas-edge-v-u-boot.dtsi
 
 LEEZ-P710
 M: Andy Yan 
 S:  Maintained
+F: arch/arm/dts/rk3399-leez-p710.dts
 F: arch/arm/dts/rk3399-leez-p710-u-boot.dtsi
 F: configs/leez-rk3399_defconfig
 
@@ -40,12 +50,14 @@ NANOPC-T4
 M: Jagan Teki 
 S: Maintained
 F: configs/nanopc-t4-rk3399_defconfig
+F: arch/arm/dts/rk3399-nanopc-t4.dts
 F: arch/arm/dts/rk3399-nanopc-t4-u-boot.dtsi
 
 NANOPI-M4
 M: Jagan Teki 
 S: Maintained
 F: configs/nanopi-m4-rk3399_defconfig
+F: arch/arm/dts/rk3399-nanopi-m4.dts
 F: arch/arm/dts/rk3399-nanopi-m4-u-boot.dtsi
 
 NANOPI-M4-2GB
@@ -53,12 +65,14 @@ M:  

[PATCH 02/11] board: rockchip: rk3399: Add myself as reviewer to MAINTAINERS

2024-02-17 Thread Jonas Karlman
Add myself as a reviewer for RK3399 boards that I have and can help with
review and testing of defconfig and device tree changes.

Signed-off-by: Jonas Karlman 
---
 board/pine64/pinebook-pro-rk3399/MAINTAINERS | 1 +
 board/pine64/rockpro64_rk3399/MAINTAINERS| 1 +
 board/rockchip/evb_rk3399/MAINTAINERS| 3 +++
 3 files changed, 5 insertions(+)

diff --git a/board/pine64/pinebook-pro-rk3399/MAINTAINERS 
b/board/pine64/pinebook-pro-rk3399/MAINTAINERS
index b80fc5cb6021..afd662600c69 100644
--- a/board/pine64/pinebook-pro-rk3399/MAINTAINERS
+++ b/board/pine64/pinebook-pro-rk3399/MAINTAINERS
@@ -1,5 +1,6 @@
 PINEBOOK_PRO
 M: Peter Robinson 
+R: Jonas Karlman 
 S: Maintained
 F: board/pine64/pinebook-pro-rk3399/
 F: include/configs/pinebook-pro-rk3399.h
diff --git a/board/pine64/rockpro64_rk3399/MAINTAINERS 
b/board/pine64/rockpro64_rk3399/MAINTAINERS
index 396363cc8d9b..bb4335ae5b73 100644
--- a/board/pine64/rockpro64_rk3399/MAINTAINERS
+++ b/board/pine64/rockpro64_rk3399/MAINTAINERS
@@ -1,5 +1,6 @@
 ROCKPRO64
 M: Jagan Teki 
+R: Jonas Karlman 
 S: Maintained
 F: board/pine64/rockpro64_rk3399
 F: include/configs/rockpro64_rk3399.h
diff --git a/board/rockchip/evb_rk3399/MAINTAINERS 
b/board/rockchip/evb_rk3399/MAINTAINERS
index 166e01bcc685..fa1f320f5a00 100644
--- a/board/rockchip/evb_rk3399/MAINTAINERS
+++ b/board/rockchip/evb_rk3399/MAINTAINERS
@@ -97,6 +97,7 @@ F:arch/arm/dts/rk3399-orangepi-u-boot.dtsi
 
 ROCK-4C+
 M: FUKAUMI Naoki 
+R: Jonas Karlman 
 S: Maintained
 F: configs/rock-4c-plus-rk3399_defconfig
 F: arch/arm/dts/rk3399-rock-4c-plus.dts
@@ -104,6 +105,7 @@ F:  arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
 
 ROCK-4SE
 M: Christopher Obbard 
+R: Jonas Karlman 
 S: Maintained
 F: configs/rock-4se-rk3399_defconfig
 F: arch/arm/dts/rk3399-rock-4se.dts
@@ -111,6 +113,7 @@ F:  arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
 
 ROCK-PI-4
 M: Jagan Teki 
+R: Jonas Karlman 
 S: Maintained
 F: configs/rock-pi-4-rk3399_defconfig
 F: arch/arm/dts/rk3399-rock-pi-4.dtsi
-- 
2.43.0



[PATCH 00/11] rockchip: rk3399: Migrate to use IO-domain driver

2024-02-17 Thread Jonas Karlman
This series remove old unused board_early_init_f() functions, adds
support for RK3399 to the IO-domain driver and migrates all boards that
used setup_iodomain() to now use the IO-domain driver instead.

Also add device tree files and myself as reviewer to MAINTAINERS.

This series depends on cleanup done in Quentin Schulz series "rockchip:
add support for Theobroma JAGUAR SBC-RK3588-AMR" [1]. A copy of this
series can also be found at [2]

[1] https://patchwork.ozlabs.org/cover/1896901/
[2] https://github.com/Kwiboo/u-boot-rockchip/commits/rk3399-io-domain-v1

Jonas Karlman (11):
  board: rockchip: rk3399: Add device tree files to MAINTAINERS
  board: rockchip: rk3399: Add myself as reviewer to MAINTAINERS
  board: rockchip: rk3399: Remove unused board_early_init_f functions
  board: rockchip: Add a common ROCK Pi 4 target
  rockchip: io-domain: Add support for RK3399
  rockchip: pine64: rockpro64: Migrate to use IO-domain driver
  rockchip: pine64: pinebook-pro: Migrate to use IO-domain driver
  rockchip: pine64: pinephone-pro: Migrate to use IO-domain driver
  rockchip: vamrs: rock960: Migrate to use IO-domain driver
  rockchip: theobroma-systems: puma: Migrate to use IO-domain driver
  rockchip: google: gru: Migrate to use IO-domain driver

 arch/arm/mach-rockchip/board.c| 10 +--
 arch/arm/mach-rockchip/rk3399/Kconfig |  6 ++
 board/firefly/roc-pc-rk3399/MAINTAINERS   |  5 ++
 board/firefly/roc-pc-rk3399/roc-pc-rk3399.c   | 22 +-
 board/google/gru/gru.c| 35 
 board/pine64/pinebook-pro-rk3399/MAINTAINERS  |  3 +-
 board/pine64/pinebook-pro-rk3399/Makefile |  1 -
 .../pinebook-pro-rk3399/pinebook-pro-rk3399.c | 61 --
 board/pine64/pinephone-pro-rk3399/MAINTAINERS |  2 +-
 board/pine64/pinephone-pro-rk3399/Makefile|  1 -
 .../pinephone-pro-rk3399.c| 64 ---
 board/pine64/rockpro64_rk3399/MAINTAINERS |  3 +
 board/pine64/rockpro64_rk3399/Makefile|  7 --
 .../rockpro64_rk3399/rockpro64-rk3399.c   | 39 -
 board/radxa/rockpi4-rk3399/Kconfig| 15 
 board/radxa/rockpi4-rk3399/MAINTAINERS| 29 +++
 .../rockpi4-rk3399}/Makefile  |  2 +-
 .../rockpi4-rk3399/rockpi4-rk3399.c}  | 33 +---
 board/rockchip/evb_rk3399/MAINTAINERS | 38 -
 .../puma_rk3399/puma-rk3399.c | 21 -
 board/vamrs/rock960_rk3399/MAINTAINERS|  5 ++
 board/vamrs/rock960_rk3399/Makefile   |  6 --
 board/vamrs/rock960_rk3399/rock960-rk3399.c   | 27 ---
 configs/chromebook_bob_defconfig  |  1 +
 configs/chromebook_kevin_defconfig|  1 +
 configs/ficus-rk3399_defconfig|  1 +
 configs/pinebook-pro-rk3399_defconfig |  1 +
 configs/pinephone-pro-rk3399_defconfig|  1 +
 configs/puma-rk3399_defconfig |  1 +
 configs/rock-4c-plus-rk3399_defconfig |  2 +-
 configs/rock-4se-rk3399_defconfig |  2 +-
 configs/rock-pi-4-rk3399_defconfig|  2 +-
 configs/rock-pi-4c-rk3399_defconfig   |  2 +-
 configs/rock960-rk3399_defconfig  |  1 +
 configs/rockpro64-rk3399_defconfig|  1 +
 drivers/misc/rockchip-io-domain.c | 79 ++-
 include/configs/rk3399_common.h   | 16 
 include/configs/rockpi4-rk3399.h  | 32 
 38 files changed, 212 insertions(+), 366 deletions(-)
 delete mode 100644 board/pine64/pinebook-pro-rk3399/Makefile
 delete mode 100644 board/pine64/pinebook-pro-rk3399/pinebook-pro-rk3399.c
 delete mode 100644 board/pine64/pinephone-pro-rk3399/Makefile
 delete mode 100644 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c
 delete mode 100644 board/pine64/rockpro64_rk3399/Makefile
 delete mode 100644 board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
 create mode 100644 board/radxa/rockpi4-rk3399/Kconfig
 create mode 100644 board/radxa/rockpi4-rk3399/MAINTAINERS
 rename board/{rockchip/evb_rk3399 => radxa/rockpi4-rk3399}/Makefile (79%)
 rename board/{rockchip/evb_rk3399/evb-rk3399.c => 
radxa/rockpi4-rk3399/rockpi4-rk3399.c} (65%)
 delete mode 100644 board/vamrs/rock960_rk3399/Makefile
 delete mode 100644 board/vamrs/rock960_rk3399/rock960-rk3399.c
 create mode 100644 include/configs/rockpi4-rk3399.h

-- 
2.43.0



Re: Booting RPi5B with latest git

2024-02-17 Thread Peter Robinson
On Sat, 17 Feb 2024 at 16:53, John  wrote:
>
> I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
> vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
> (2024.04-rc2) just fine. Yet, if I take that uSD card and place it in my 
> RPi5B, it does not boot. I only see the "U-Boot" submarine logo in the upper 
> right of the screen/no debug output. Any thoughts are appreciated.
>
> I built u-boot like this:
>
> unset CFLAGS
> unset CXXFLAGS
> unset CPPFLAGS
>
> make rpi_arm64_config
> echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
> make EXTRAVERSION=-2024.04rc2

Do you have a serial console to attach? The current support is very
basic, I don't believe display output is supported yet, and thinks
like USB for keyboard input most definitely isn't.

Peter


Re: How To Move Root Partition From eMMC to SSD

2024-02-17 Thread Peter Robinson
> I am running the NanoPi R6C.  The device is not capable of booting from
> the SSD, the next best thing is to load the root filesystem from the SSD.

By booting you mean loading the firmware from SSD (by which I think
you mean NVME right).

> Using rockchip's repos, I compile from source the images to boot 1) from
> the microSD card and 2) from eMMC.  I install to the eMMC.  Then, so as
> not to mount any partitions from eMMC, I boot from the microSD card, and
> I clone the root partition from the eMMC (/dev/mmcblk2p8) to the SSD
> (/dev/nvme0n1p1).
>
> I boot from the eMMC, the output of "cat /proc/cmdline" is:
>
> storagemedia=emmc androidboot.storagemedia=emmc androidboot.mode=normal
> androidboot.dtbo_idx=0 androidboot.verifiedbootstate=orange
> earlycon=uart8250,mmio32,0xfeb5 console=ttyFIQ0 coherent_pool=1m
> irqchip.gicv3_pseudo_nmi=0 rw root=/dev/mmcblk2p8 rootfstype=ext4
> rootflags=discard data=/dev/mmcblk2p9 consoleblank=0
> cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1
> androidboot.fwver=uboot-a83a7263ef-01/09/2024
>
> How do I change "root=/dev/mmcblk2p8" to "root=/dev/nvme0n1p1"?
>
> I connect to the serial port and get to the U-Boot monitor.  I examine
> the variables.  "bootcmd" runs "bootrkp" which boots the system.
> "bootrkp" ignores "bootargs", I confirm this by deleting "bootargs"
> before running "bootrkp", the system boots up as before with no change
> in behavior.  "bootrkp" is implemented in file "cmd/bootrkp.c".  That
> code emits the equivalent of:
>
> setenv bootm-no-reloc y
> booti 0x40 0xa20:0x7b2bc0 0x830
>
> Can I tell U-Boot to load the root partition from /dev/nvme0n1p1, either
> by entering commands at the monitor, or by modifying the source code of
> U-Boot, or through any other means?

You don't mention what OS you're trying to load, is it Android?

So upstream U-Boot can boot a Linux OS from NVME on a rk3588 device,
but it appears you're using the Rockchip fork and I have no idea of
the state of that.

The upstream U-Boot doesn't yet have the R6C.

Generally if a device doesn't have something like a SPI flash where
you can put firmware it's fine to use the eMMC for firmware and it
should be able to run an OS from NVME.

If you're not using Android and are using a standard Linux distro I
would look at enabling "distro boot" in the rockchip fork which will
give you a standard UEFI boot interface and things should work. I have
no idea if the U-Boot fork you're using includes PCI or NVME support
but obviously make sure the appropriate drivers are enabled for that
(look at the upstream Rock5B config).

Unfortunately I can't offer much more help from there as I generally
only deal with upstream.

Peter


Booting RPi5B with latest git

2024-02-17 Thread John
I am running Arch ARM on a RPi4B and also on a RPi5B. My RPi4B can boot the 
vanilla kernel package (linux-aarch64) with the latest uboot-raspberrypi 
(2024.04-rc2) just fine. Yet, if I take that uSD card and place it in my RPi5B, 
it does not boot. I only see the "U-Boot" submarine logo in the upper right of 
the screen/no debug output. Any thoughts are appreciated.

I built u-boot like this:

unset CFLAGS
unset CXXFLAGS
unset CPPFLAGS

make rpi_arm64_config
echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
make EXTRAVERSION=-2024.04rc2


[PATCH 2/2] cli: allow users to determine history buffer allocation method

2024-02-17 Thread Hanyuan Zhao
This commit allows users to choose the appropriate memory
allocation method between static allocated and dynamically
calloc. The previous static-array way will not obviously
contribute to the final binary size since it is uninitialized,
and might have better performance than the dynamical one.
Now we provide the users with both the two options.

Signed-off-by: Hanyuan Zhao 
---
 cmd/Kconfig   |  8 
 common/cli_readline.c | 23 ---
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index af4dbc95fc..d0140b6cbe 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -190,6 +190,14 @@ config CMD_HISTORY
  Show the command-line history, i.e. a list of commands that are in
  the history buffer.
 
+config CMD_HISTORY_USE_CALLOC
+   bool "dynamically allocate memory"
+   default y
+   depends on CMD_HISTORY
+   help
+ Saying Y to this will use calloc to get the space for history
+ storing. Or it will be compiled as a static array.
+
 config CMD_LICENSE
bool "license"
select BUILD_BIN2C
diff --git a/common/cli_readline.c b/common/cli_readline.c
index eec6d8b0a2..a945cbf7cf 100644
--- a/common/cli_readline.c
+++ b/common/cli_readline.c
@@ -87,26 +87,35 @@ static int hist_add_idx;
 static int hist_cur = -1;
 static unsigned hist_num;
 
+#ifndef CONFIG_CMD_HISTORY_USE_CALLOC
+static char hist_data[HIST_MAX][HIST_SIZE + 1];
+#endif
 static char *hist_list[HIST_MAX];
 
 #define add_idx_minus_one() ((hist_add_idx == 0) ? hist_max : hist_add_idx-1)
 
 static int hist_init(void)
 {
-   unsigned char *hist;
int i;
 
-   hist_max = 0;
-   hist_add_idx = 0;
-   hist_cur = -1;
-   hist_num = 0;
-
-   hist = calloc(HIST_MAX, HIST_SIZE + 1);
+#ifndef CONFIG_CMD_HISTORY_USE_CALLOC
+   for (i = 0; i < HIST_MAX; i++) {
+   hist_list[i] = hist_data[i];
+   hist_list[i][0] = '\0';
+   }
+#else
+   unsigned char *hist = calloc(HIST_MAX, HIST_SIZE + 1);
if (!hist)
panic("%s: calloc: out of memory!\n", __func__);
 
for (i = 0; i < HIST_MAX; i++)
hist_list[i] = hist + (i * (HIST_SIZE + 1));
+#endif
+
+   hist_max = 0;
+   hist_add_idx = 0;
+   hist_cur = -1;
+   hist_num = 0;
 
return 0;
 }
-- 
2.34.1



[PATCH 1/2] cli: allow users to disable history if unused at all

2024-02-17 Thread Hanyuan Zhao
This commit allows user to determine whether to have history recording
in command-line. Previously the history data as uninitialized static
array would not directly take much space in binary file since it only
marks size in the binary. However now it asks to allocate space. By
connecting the original CMD_HISTORY flag in Kconfig, users could unset
the whole history function, and the memory usage could be eased, if the
history function is not used at all.

Signed-off-by: Hanyuan Zhao 
---
 cmd/Kconfig   |  1 +
 common/cli_readline.c | 44 ---
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index a86b570517..af4dbc95fc 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -184,6 +184,7 @@ config CMD_FWU_METADATA
 
 config CMD_HISTORY
bool "history"
+   default y
depends on CMDLINE_EDITING
help
  Show the command-line history, i.e. a list of commands that are in
diff --git a/common/cli_readline.c b/common/cli_readline.c
index 2507be2295..eec6d8b0a2 100644
--- a/common/cli_readline.c
+++ b/common/cli_readline.c
@@ -67,12 +67,13 @@ static char *delete_char (char *buffer, char *p, int *colp, 
int *np, int plen)
 #define CTL_BACKSPACE  ('\b')
 #define DEL((char)255)
 #define DEL7   ((char)127)
-#define CREAD_HIST_CHAR('!')
 
 #define getcmd_putch(ch)   putc(ch)
 #define getcmd_getch() getchar()
 #define getcmd_cbeep() getcmd_putch('\a')
 
+#ifdef CONFIG_CMD_HISTORY
+#define CREAD_HIST_CHAR('!')
 #ifdef CONFIG_SPL_BUILD
 #define HIST_MAX   3
 #define HIST_SIZE  32
@@ -90,14 +91,6 @@ static char *hist_list[HIST_MAX];
 
 #define add_idx_minus_one() ((hist_add_idx == 0) ? hist_max : hist_add_idx-1)
 
-static void getcmd_putchars(int count, int ch)
-{
-   int i;
-
-   for (i = 0; i < count; i++)
-   getcmd_putch(ch);
-}
-
 static int hist_init(void)
 {
unsigned char *hist;
@@ -110,7 +103,7 @@ static int hist_init(void)
 
hist = calloc(HIST_MAX, HIST_SIZE + 1);
if (!hist)
-   return -ENOMEM;
+   panic("%s: calloc: out of memory!\n", __func__);
 
for (i = 0; i < HIST_MAX; i++)
hist_list[i] = hist + (i * (HIST_SIZE + 1));
@@ -192,6 +185,15 @@ void cread_print_hist_list(void)
i++;
}
 }
+#endif
+
+static void getcmd_putchars(int count, int ch)
+{
+   int i;
+
+   for (i = 0; i < count; i++)
+   getcmd_putch(ch);
+}
 
 #define BEGINNING_OF_LINE() {  \
while (cls->num) {  \
@@ -365,6 +367,7 @@ int cread_line_process_ch(struct cli_line_state *cls, char 
ichar)
cls->eol_num--;
}
break;
+#ifdef CONFIG_CMD_HISTORY
case CTL_CH('p'):
case CTL_CH('n'):
if (cls->history) {
@@ -394,6 +397,7 @@ int cread_line_process_ch(struct cli_line_state *cls, char 
ichar)
break;
}
break;
+#endif
case '\t':
if (IS_ENABLED(CONFIG_AUTO_COMPLETE) && cls->cmd_complete) {
int num2, col;
@@ -490,19 +494,23 @@ static int cread_line(const char *const prompt, char 
*buf, unsigned int *len,
}
*len = cls->eol_num;
 
+#ifdef CONFIG_CMD_HISTORY
if (buf[0] && buf[0] != CREAD_HIST_CHAR)
cread_add_to_hist(buf);
hist_cur = hist_add_idx;
+#endif
 
return 0;
 }
 
 #else /* !CONFIG_CMDLINE_EDITING */
 
+#ifdef CONFIG_CMD_HISTORY
 static inline int hist_init(void)
 {
return 0;
 }
+#endif
 
 static int cread_line(const char *const prompt, char *buf, unsigned int *len,
  int timeout)
@@ -640,20 +648,18 @@ int cli_readline_into_buffer(const char *const prompt, 
char *buffer,
char *p = buffer;
uint len = CONFIG_SYS_CBSIZE;
int rc;
-   static int initted;
+#ifdef CONFIG_CMD_HISTORY
+   static int hist_initted;
+#endif
 
-   /*
-* History uses a global array which is not
-* writable until after relocation to RAM.
-* Revert to non-history version if still
-* running from flash.
-*/
if (IS_ENABLED(CONFIG_CMDLINE_EDITING) && (gd->flags & GD_FLG_RELOC)) {
-   if (!initted) {
+#ifdef CONFIG_CMD_HISTORY
+   if (!hist_initted) {
rc = hist_init();
if (rc == 0)
-   initted = 1;
+   hist_initted = 1;
}
+#endif
 
if (prompt)
puts(prompt);
-- 
2.34.1



[PATCH] dm: core: Fix address translation in devfdt_get_addr_index()

2024-02-17 Thread Jonas Karlman
During address translation #address/size-cells props are expected to
apply to child nodes. However, devfdt_get_addr_index() incorrectly use
the parent offset of the udevice parent instead of getting the offset of
the node parent. This will work in most cases when there is only one
udevice tied to a node.

On e.g. an Orange Pi R1 Plus TLS board the dwc3-generic (parent) and
dwc3-generic-host (child) udevice is tied to the same node.

In that case both the offset and parent values end up being the same.
As a result, the #address/size-cells props intended for child nodes
incorrectly gets applied to the node itself resulting in wrong addr
being returned, 0x0 instead of 0xff60.

The following can be seen on console:

  dwc3-generic-host usb@ff60: this is not a DesignWare USB3 DRD Core
  dwc3-generic-host usb@ff60: failed to initialize core

Fix this by using the offset of the parent node and not the offset to
the node the parent udevice is tied to.

Signed-off-by: Jonas Karlman 
---
I think the following unit test dts and code should be able to detect
this issue. Not sure on how to add a test with a different dts, most
existing ones seemed to use #address/size-cells = <1>.

Please advide on how following could be turned into a proper unit test.

/dts-v1/;

/ {
#address-cells = <2>;
#size-cells = <2>;

some-bus {
compatible = "denx,u-boot-test-bus";
reg = <0x0 0x 0x0 0x1000>;
#address-cells = <1>;
#size-cells = <0>;

device@0 {
compatible = "denx,u-boot-fdt-test";
reg = <0>;
};
};
};

struct udevice *bus, *dev;

ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, ));
ut_asserteq(0x, devfdt_get_addr(bus));
ut_assertok(device_bind(bus, DM_DRIVER_GET(denx_u_boot_fdt_test),
"test", NULL, dev_ofnode(bus), ));
ut_asserteq(0x, devfdt_get_addr(dev));
---
 drivers/core/fdtaddr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 8e774d49ce6e..5f27d2511485 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -23,7 +23,7 @@ fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, 
int index)
 {
 #if CONFIG_IS_ENABLED(OF_REAL)
int offset = dev_of_offset(dev);
-   int parent = dev_of_offset(dev->parent);
+   int parent = fdt_parent_offset(gd->fdt_blob, offset);
fdt_addr_t addr;
 
if (CONFIG_IS_ENABLED(OF_TRANSLATE)) {
-- 
2.43.0



Re: [PATCH v4] rockchip: spl: Enable caches to speed up checksum validation

2024-02-17 Thread Mark Kettenis
> From: Jonas Karlman 
> Date: Sat, 17 Feb 2024 12:34:04 +
> 
> FIT checksum validation is very slow in SPL due to D-cache not being
> enabled.
> 
> Enable caches in SPL on ARM64 SoCs to speed up FIT checksum validation,
> from seconds to milliseconds.
> 
> This change enables caches in SPL on all Rockchip ARM64 boards, the
> Kconfig options SPL_SYS_ICACHE_OFF and SPL_SYS_DCACHE_OFF can be used to
> disable caches for a specific board or SoC if needed.
> 
> Signed-off-by: Jonas Karlman 
> Reviewed-by: Kever Yang 
> ---
> Changes in v4:
> - Include cpu_func.h to fix build on armv7
> - Remove common.h include
> 
> Changes in v3:
> - Limit to ARM64 SoCs
> - Fix build with SPL_SYS_ICACHE_OFF or SPL_SYS_DCACHE_OFF enabled
> - Use cleanup_before_linux() in spl_board_prepare_for_boot() to disable
>   caches before jumping from SPL to next stage
> - Collect r-b tag
> 
> Changes in v2:
> - None
> 
> This has been tested on multiple RK3328, RK3399, RK356x and RK3588
> boards without any issues, vendor U-Boot also enables caches in SPL for
> all SoCs.
> 
> This only worked on RK3288 because the default enable_caches() that does
> not enable caches was being used. Trying to enable caches on my RK3288
> froze my boards in mmu_setup(). So v3 limits the enable_caches() call to
> only include ARM64 SoCs.

FYI, enabling caches on 32-bit ARM SoCs is generally problematic
because of the presence of non-architected caches.  This poses a
problem for an OS since it can't easily do cache-management in early
boot code before SoC specific drivers attach.

So I agree that this is the right choice.

> Link to RFC: https://patchwork.ozlabs.org/patch/1802303/
> Link to v2: https://patchwork.ozlabs.org/patch/1889319/
> Link to v3: https://patchwork.ozlabs.org/patch/1891025/
> ---
>  arch/arm/mach-rockchip/spl.c | 16 +++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
> index 87280e2ba7cc..1586a093fc37 100644
> --- a/arch/arm/mach-rockchip/spl.c
> +++ b/arch/arm/mach-rockchip/spl.c
> @@ -3,7 +3,7 @@
>   * (C) Copyright 2019 Rockchip Electronics Co., Ltd
>   */
>  
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -136,6 +136,20 @@ void board_init_f(ulong dummy)
>   }
>   gd->ram_top = gd->ram_base + get_effective_memsize();
>   gd->ram_top = board_get_usable_ram_top(gd->ram_size);
> +
> + if (IS_ENABLED(CONFIG_ARM64) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) {
> + gd->relocaddr = gd->ram_top;
> + arch_reserve_mmu();
> + enable_caches();
> + }
>  #endif
>   preloader_console_init();
>  }
> +
> +void spl_board_prepare_for_boot(void)
> +{
> + if (!IS_ENABLED(CONFIG_ARM64) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
> + return;
> +
> + cleanup_before_linux();
> +}
> -- 
> 2.43.0
> 
> 


[PATCH v4] rockchip: spl: Enable caches to speed up checksum validation

2024-02-17 Thread Jonas Karlman
FIT checksum validation is very slow in SPL due to D-cache not being
enabled.

Enable caches in SPL on ARM64 SoCs to speed up FIT checksum validation,
from seconds to milliseconds.

This change enables caches in SPL on all Rockchip ARM64 boards, the
Kconfig options SPL_SYS_ICACHE_OFF and SPL_SYS_DCACHE_OFF can be used to
disable caches for a specific board or SoC if needed.

Signed-off-by: Jonas Karlman 
Reviewed-by: Kever Yang 
---
Changes in v4:
- Include cpu_func.h to fix build on armv7
- Remove common.h include

Changes in v3:
- Limit to ARM64 SoCs
- Fix build with SPL_SYS_ICACHE_OFF or SPL_SYS_DCACHE_OFF enabled
- Use cleanup_before_linux() in spl_board_prepare_for_boot() to disable
  caches before jumping from SPL to next stage
- Collect r-b tag

Changes in v2:
- None

This has been tested on multiple RK3328, RK3399, RK356x and RK3588
boards without any issues, vendor U-Boot also enables caches in SPL for
all SoCs.

This only worked on RK3288 because the default enable_caches() that does
not enable caches was being used. Trying to enable caches on my RK3288
froze my boards in mmu_setup(). So v3 limits the enable_caches() call to
only include ARM64 SoCs.

Link to RFC: https://patchwork.ozlabs.org/patch/1802303/
Link to v2: https://patchwork.ozlabs.org/patch/1889319/
Link to v3: https://patchwork.ozlabs.org/patch/1891025/
---
 arch/arm/mach-rockchip/spl.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index 87280e2ba7cc..1586a093fc37 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -3,7 +3,7 @@
  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -136,6 +136,20 @@ void board_init_f(ulong dummy)
}
gd->ram_top = gd->ram_base + get_effective_memsize();
gd->ram_top = board_get_usable_ram_top(gd->ram_size);
+
+   if (IS_ENABLED(CONFIG_ARM64) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) {
+   gd->relocaddr = gd->ram_top;
+   arch_reserve_mmu();
+   enable_caches();
+   }
 #endif
preloader_console_init();
 }
+
+void spl_board_prepare_for_boot(void)
+{
+   if (!IS_ENABLED(CONFIG_ARM64) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+   return;
+
+   cleanup_before_linux();
+}
-- 
2.43.0



[PATCH v5] remoteproc: uclass: Add methods to load firmware to rproc and boot rproc

2024-02-17 Thread MD Danish Anwar
Add APIs to set a firmware_name to a rproc and boot the rproc with the
same firmware.

Clients can call rproc_set_firmware() API to set firmware_name for a rproc
whereas rproc_boot() will load the firmware set by rproc_set_firmware() to
a buffer by calling request_firmware_into_buf(). rproc_boot() will then
load the firmware file to the remote processor and start the remote
processor.

Also include "fs-loader.h" and make remoteproc driver select FS_LOADER in
Kconfig so that we can call request_firmware_into_buf() from remoteproc
driver.

Signed-off-by: MD Danish Anwar 
---
Changes from v4 to v5:
*) Added Kconfig option REMOTEPROC_MAX_FW_SIZE to set max firmware size
   that can be loaded to a rproc.
*) Added freeing of address in rproc_boot() as pointed out by Ravi.
*) Allocating the address at a later point in rproc_boot()
*) Rebased on latest u-boot/master [commit 
   9e00b6993f724da9699ef12573307afea8c19284]

Changes from v3 to v4:
*) No functional change. Splitted the patch out of the series as suggested
   by Nishant.
*) Droppped the RFC tag.

v4: https://lore.kernel.org/all/20240130063322.2345057-1-danishan...@ti.com/
v3: https://lore.kernel.org/all/20240124064930.1787929-4-danishan...@ti.com/

 drivers/remoteproc/Kconfig|   8 +++
 drivers/remoteproc/rproc-uclass.c | 100 ++
 include/remoteproc.h  |  34 ++
 3 files changed, 142 insertions(+)

diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 781de530af..759d21437a 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -10,6 +10,7 @@ menu "Remote Processor drivers"
 # All users should depend on DM
 config REMOTEPROC
bool
+   select FS_LOADER
depends on DM
 
 # Please keep the configuration alphabetically sorted.
@@ -102,4 +103,11 @@ config REMOTEPROC_TI_IPU
help
  Say 'y' here to add support for TI' K3 remoteproc driver.
 
+config REMOTEPROC_MAX_FW_SIZE
+   hex "Maximum size of firmware that needs to be loaded to rproc"
+   default 0x1
+   help
+ Maximum size of the firmware file (elf, binary) that needs to be
+ loaded to th rproc core.
+
 endmenu
diff --git a/drivers/remoteproc/rproc-uclass.c 
b/drivers/remoteproc/rproc-uclass.c
index 28b362c887..784361cef9 100644
--- a/drivers/remoteproc/rproc-uclass.c
+++ b/drivers/remoteproc/rproc-uclass.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -961,3 +962,102 @@ unsigned long rproc_parse_resource_table(struct udevice 
*dev, struct rproc *cfg)
 
return 1;
 }
+
+int rproc_set_firmware(struct udevice *rproc_dev, const char *fw_name)
+{
+   struct dm_rproc_uclass_pdata *uc_pdata;
+   int len;
+   char *p;
+
+   if (!rproc_dev || !fw_name)
+   return -EINVAL;
+
+   uc_pdata = dev_get_uclass_plat(rproc_dev);
+   if (!uc_pdata)
+   return -EINVAL;
+
+   len = strcspn(fw_name, "\n");
+   if (!len) {
+   debug("invalid firmware name\n");
+   return -EINVAL;
+   }
+
+   p = strndup(fw_name, len);
+   if (!p)
+   return -ENOMEM;
+
+   uc_pdata->fw_name = p;
+
+   return 0;
+}
+
+int rproc_boot(struct udevice *rproc_dev)
+{
+   struct dm_rproc_uclass_pdata *uc_pdata;
+   struct udevice *fs_loader;
+   int core_id, ret = 0;
+   char *firmware;
+   void *addr;
+
+   if (!rproc_dev)
+   return -EINVAL;
+
+   uc_pdata = dev_get_uclass_plat(rproc_dev);
+   if (!uc_pdata)
+   return -EINVAL;
+
+   core_id = dev_seq(rproc_dev);
+   firmware = uc_pdata->fw_name;
+
+   if (!firmware) {
+   debug("No firmware set for rproc core %d\n", core_id);
+   return -EINVAL;
+   }
+
+   /* Initialize all rproc cores */
+   if (!rproc_is_initialized()) {
+   ret = rproc_init();
+   if (ret) {
+   debug("rproc_init() failed: %d\n", ret);
+   return ret;
+   }
+   }
+
+   /* Loading firmware to a given address */
+   ret = get_fs_loader(_loader);
+   if (ret) {
+   debug("could not get fs loader: %d\n", ret);
+   return ret;
+   }
+
+   if (CONFIG_REMOTEPROC_MAX_FW_SIZE) {
+   addr = malloc(CONFIG_REMOTEPROC_MAX_FW_SIZE);
+   if (!addr)
+   return -ENOMEM;
+   } else {
+   debug("CONFIG_REMOTEPROC_MAX_FW_SIZE not defined\n");
+   return -EINVAL;
+   }
+
+   ret = request_firmware_into_buf(fs_loader, firmware, addr, 
CONFIG_REMOTEPROC_MAX_FW_SIZE,
+   0);
+   if (ret < 0) {
+   debug("could not request %s: %d\n", firmware, ret);
+   goto free_buffer;
+   }
+
+   ret = rproc_load(core_id, (ulong)addr, ret);
+   if (ret) {
+ 

[PATCH v2] pinctrl: Check pinconfig nodes pre-reloc status recursively

2024-02-17 Thread Jonas Karlman
Pinconfig nodes normally bind recursively with PINCTRL_FULL and
PINCONF_RECURSIVE enabled. However, during U-Boot proper pre-relocation
any node marked with e.g. bootph-all will not bind unless its parent is
also marked for pre-reloc.

  group1 {
  pinconf1 {
  bootph-all;
  };
  };

This cause the following warning message to be shown during U-Boot
proper pre-reloc stage on Rockchip devices, e.g on RK3568:

  ns16550_serial serial@fe66: pinctrl_select_state_full: 
uclass_get_device_by_phandle_id: err=-19

and on RK3328:

  ns16550_serial serial@ff13: pinctrl_select_state_full: 
uclass_get_device_by_phandle_id: err=-19

Check pinconfig nodes pre-reloc status recursively to fix this and to
make pinconfig_post_bind work same at both U-Boot proper pre-reloc and
at TPL/SPL stage.

Signed-off-by: Jonas Karlman 
---
v2:
- No change

A recent change to fdtgrep was believed to solve this however, fdtgrep
is only applied to control fdt for xPL so this issue still exist at
U-Boot proper pre-reloc stage.

Link to v1: https://patchwork.ozlabs.org/patch/1817296/
---
 drivers/pinctrl/pinctrl-uclass.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 73dd7b1038bb..fe2ba5021a78 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -100,6 +100,22 @@ static int pinctrl_select_state_full(struct udevice *dev, 
const char *statename)
return 0;
 }
 
+static bool ofnode_pre_reloc_recursive(ofnode parent)
+{
+   ofnode child;
+
+   if (ofnode_pre_reloc(parent))
+   return true;
+
+   if (CONFIG_IS_ENABLED(PINCONF_RECURSIVE)) {
+   ofnode_for_each_subnode(child, parent)
+   if (ofnode_pre_reloc_recursive(child))
+   return true;
+   }
+
+   return false;
+}
+
 /**
  * pinconfig_post_bind() - post binding for PINCONFIG uclass
  * Recursively bind its children as pinconfig devices.
@@ -119,7 +135,7 @@ static int pinconfig_post_bind(struct udevice *dev)
 
dev_for_each_subnode(node, dev) {
if (pre_reloc_only &&
-   !ofnode_pre_reloc(node))
+   !ofnode_pre_reloc_recursive(node))
continue;
/*
 * If this node has "compatible" property, this is not
-- 
2.43.0



Re: [PATCH V6 07/20] configs: am62x_evm_a53_defconfig: Switch to bootstd

2024-02-17 Thread Alexander Sverdlin
Hi Jan!

On Sat, 2024-02-17 at 09:42 +0100, Jan Kiszka wrote:
> > U-Boot 2024.01 (Feb 15 2024 - 01:43:17 +0100)
> > 
> > SoC:   AM62X SR1.0 HS-FS
> > Model: Texas Instruments AM625 SK
> > DRAM:  2 GiB
> > Core:  56 devices, 23 uclasses, devicetree: separate
> > MMC:   mmc@fa1: 0, mmc@fa0: 1
> > Loading Environment from nowhere... OK
> > In:    serial@280
> > Out:   serial@280
> > Err:   serial@280
> > Net:   eth0: ethernet@800port@1
> > Hit any key to stop autoboot:  0 
> > switch to partitions #0, OK
> > mmc1 is current device
> > SD/MMC found on device 1
> > Failed to load 'uEnv.txt'
> > Scanning for bootflows in all bootdevs
> > Seq  Method   State   Uclass    Part  Name  Filename
> > ---  ---  --        
> > 
> > Scanning global bootmeth 'efi_mgr':
> > No EFI system partition
> > No EFI system partition
> > Failed to persist EFI variables
> > Scanning bootdev 'mmc@fa0.bootdev':
> > Scanning bootdev 'mmc@fa1.bootdev':
> > Unknown uclass 'usb' in label
> > link up on port 1, speed 100, full duplex
> > BOOTP broadcast 1
> > BOOTP broadcast 2
> > BOOTP broadcast 3
> > ...
> > ---
> > 
> > I suppose TI's BSP has older U-Boot... So it's not providing necessary
> > script for BOOTSTD, I suppose?
> > 
> 
> You can make the BeagleBone boot via EFI, but it requires a hybrid
> partition table (ROM loader want DOS, EFI needs GPT). A Debian
> integration with this can be found for Isar [1] in this series [2]. It's
> only using upstream sources (plus still one u-boot patch to get wifi
> working).
> 
> If you want legacy script booting, I suspect you need to flip some extra
> switches explicitly by now.

Thanks for the hints!
I'm wondering, if this was a deliberate "let's stop booting all the
pre-existing embedded distros" decision? (buildroot, yocto/meta-ti...)

-- 
Alexander Sverdlin.



[PATCH v3 2/2] board: rockchip: Add support for rk3588 based Cool Pi CM5 EVB

2024-02-17 Thread Andy Yan
Cool Pi CM5 EVB works as a mother board connect with CM5.

CM5 Specification:
- Rockchip RK3588
- LPDDR4 2/4/8/16 GB
- TF scard slot
- eMMC 8/32/64/128 GB module
- SPI Nor 8MB
- Gigabit ethernet x 1 with PHY YT8531
- Gigabit ethernet x 1 drived by PCIE with YT6801S

CM5 EVB Specification:
- HDMI Type A out x 2
- HDMI Type D in x 1
- USB 2.0 Host x 2
- USB 3.0 OTG x 1
- USB 3.0 Host x 1
- PCIE M.2 E Key for Wireless connection
- PCIE M.2 M Key for NVME connection
- 40 pin header

The dts is from linux-6.8 rc1.

Signed-off-by: Andy Yan 
Reviewed-by: Kever Yang 

[0]https://patchwork.kernel.org/project/linux-rockchip/patch/2450634.jE0xQCEvom@phil/

---

Changes in v3:
- remove spl-boot-order as it is already in rk3588s-u-boot.dtsi
- Enable MMC_HS400 and MMC_HS400_ES as suggestted by Quentin

Changes in v2:
- sync dts from linux-rockchip which will be in linux-6.8 rc6[0]

 arch/arm/dts/Makefile |   1 +
 .../arm/dts/rk3588-coolpi-cm5-evb-u-boot.dtsi |  29 +
 arch/arm/dts/rk3588-coolpi-cm5-evb.dts| 216 ++
 arch/arm/dts/rk3588-coolpi-cm5.dtsi   | 649 ++
 board/rockchip/evb_rk3588/MAINTAINERS |   8 +
 configs/coolpi-cm5-evb-rk3588_defconfig   | 113 +++
 6 files changed, 1016 insertions(+)
 create mode 100644 arch/arm/dts/rk3588-coolpi-cm5-evb-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3588-coolpi-cm5-evb.dts
 create mode 100644 arch/arm/dts/rk3588-coolpi-cm5.dtsi
 create mode 100644 configs/coolpi-cm5-evb-rk3588_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index ae7c088ceb..aafc41c466 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -191,6 +191,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3568) += \
 
 dtb-$(CONFIG_ROCKCHIP_RK3588) += \
rk3588s-coolpi-4b.dts \
+   rk3588-coolpi-cm5-evb.dts \
rk3588-edgeble-neu6a-io.dtb \
rk3588-edgeble-neu6b-io.dtb \
rk3588-evb1-v10.dtb \
diff --git a/arch/arm/dts/rk3588-coolpi-cm5-evb-u-boot.dtsi 
b/arch/arm/dts/rk3588-coolpi-cm5-evb-u-boot.dtsi
new file mode 100644
index 00..ed15b14ea0
--- /dev/null
+++ b/arch/arm/dts/rk3588-coolpi-cm5-evb-u-boot.dtsi
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3588-u-boot.dtsi"
+
+_pins {
+   bootph-all;
+};
+
+ {
+   cap-mmc-highspeed;
+   mmc-hs200-1_8v;
+};
+
+ {
+   bootph-pre-ram;
+   u-boot,spl-sfc-no-dma;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   status = "okay";
+
+   flash@0 {
+   bootph-pre-ram;
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <2400>;
+   spi-rx-bus-width = <4>;
+   spi-tx-bus-width = <1>;
+   };
+};
diff --git a/arch/arm/dts/rk3588-coolpi-cm5-evb.dts 
b/arch/arm/dts/rk3588-coolpi-cm5-evb.dts
new file mode 100644
index 00..a4946cdc3b
--- /dev/null
+++ b/arch/arm/dts/rk3588-coolpi-cm5-evb.dts
@@ -0,0 +1,216 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Rockchip Electronics Co., Ltd.
+ *
+ */
+
+/dts-v1/;
+
+#include 
+#include "rk3588-coolpi-cm5.dtsi"
+
+/ {
+   model = "RK3588 CoolPi CM5 EVB";
+   compatible = "coolpi,pi-cm5-evb", "coolpi,pi-cm5", "rockchip,rk3588";
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   enable-gpios = < RK_PA3 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_en>;
+   power-supply = <_dcin>;
+   pwms = < 0 25000 0>;
+   };
+
+   leds: leds {
+   compatible = "gpio-leds";
+
+   green_led: led-0 {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = < RK_PB7 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   };
+   };
+
+   vcc12v_dcin: vcc12v-dcin-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc12v_dcin";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <1200>;
+   regulator-max-microvolt = <1200>;
+   };
+
+   vcc5v0_sys: vcc5v0-sys-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   vin-supply = <_dcin>;
+   };
+
+   vcc3v3_sys: vcc3v3-sys-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   vin-supply = <_dcin>;
+ 

[PATCH v3 1/2] board: rockchip: Add support for rk3588s based Cool Pi 4B

2024-02-17 Thread Andy Yan
CoolPi 4B is a rk3588s based SBC.

Specification:
- Rockchip RK3588S
- LPDDR4 2/4/8/16 GB
- TF scard slot
- eMMC 8/32/64/128 GB module
- SPI Nor 8MB
- Gigabit ethernet drived by PCIE with RTL8111HS
- HDMI Type D out
- Mini DP out
- USB 2.0 Host x 2
- USB 3.0 OTG x 1
- USB 3.0 Host x 1
- WIFI/BT module AIC8800
- 40 pin header

The dts is from linux-6.8 rc1.

Signed-off-by: Andy Yan 
Reviewed-by: Kever Yang 
[0]https://patchwork.kernel.org/project/linux-rockchip/patch/2450634.jE0xQCEvom@phil/

---

Changes in v3:
- remove spl-boot-order as it is already in rk3588s-u-boot.dtsi
- Enable MMC_HS400 and MMC_HS400_ES as suggestted by Quentin

Changes in v2:
- sync dts from linux-rockchip which will be in linux-6.8 rc6[0]

 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/rk3588s-coolpi-4b-u-boot.dtsi |  29 +
 arch/arm/dts/rk3588s-coolpi-4b.dts | 812 +
 board/rockchip/evb_rk3588/MAINTAINERS  |   7 +
 configs/coolpi-4b-rk3588s_defconfig| 113 +++
 5 files changed, 962 insertions(+)
 create mode 100644 arch/arm/dts/rk3588s-coolpi-4b-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3588s-coolpi-4b.dts
 create mode 100644 configs/coolpi-4b-rk3588s_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index ce10d3dbb0..ae7c088ceb 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -190,6 +190,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3568) += \
rk3568-rock-3a.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RK3588) += \
+   rk3588s-coolpi-4b.dts \
rk3588-edgeble-neu6a-io.dtb \
rk3588-edgeble-neu6b-io.dtb \
rk3588-evb1-v10.dtb \
diff --git a/arch/arm/dts/rk3588s-coolpi-4b-u-boot.dtsi 
b/arch/arm/dts/rk3588s-coolpi-4b-u-boot.dtsi
new file mode 100644
index 00..6e4b97028d
--- /dev/null
+++ b/arch/arm/dts/rk3588s-coolpi-4b-u-boot.dtsi
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3588s-u-boot.dtsi"
+
+_pins {
+   bootph-all;
+};
+
+ {
+   cap-mmc-highspeed;
+   mmc-hs200-1_8v;
+};
+
+ {
+   bootph-pre-ram;
+   u-boot,spl-sfc-no-dma;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   status = "okay";
+
+   flash@0 {
+   bootph-pre-ram;
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <2400>;
+   spi-rx-bus-width = <4>;
+   spi-tx-bus-width = <1>;
+   };
+};
diff --git a/arch/arm/dts/rk3588s-coolpi-4b.dts 
b/arch/arm/dts/rk3588s-coolpi-4b.dts
new file mode 100644
index 00..e037bf9db7
--- /dev/null
+++ b/arch/arm/dts/rk3588s-coolpi-4b.dts
@@ -0,0 +1,812 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Rockchip Electronics Co., Ltd.
+ *
+ * https://cool-pi.com/topic/130/coolpi-4b-product-spec-introduction
+ *
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include 
+#include "rk3588s.dtsi"
+
+/ {
+   model = "RK3588S CoolPi 4 Model B";
+   compatible = "coolpi,pi-4b", "rockchip,rk3588s";
+
+   aliases {
+   mmc0 = 
+   mmc1 = 
+   mmc2 = 
+   };
+
+   analog-sound {
+   compatible = "audio-graph-card";
+   dais = <_8ch_p0>;
+   label = "rk3588-es8316";
+   routing = "MIC2", "Mic Jack",
+ "Headphones", "HPOL",
+ "Headphones", "HPOR";
+   widgets = "Microphone", "Mic Jack",
+ "Headphone", "Headphones";
+   };
+
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   leds: leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_leds>;
+
+   led0: led-green {
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = < RK_PD0 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   };
+
+   led1: led-red {
+   color = ;
+   default-state = "off";
+   function = LED_FUNCTION_WLAN;
+   gpios = < RK_PC4 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "phy0tx";
+   };
+   };
+
+   sdio_pwrseq: sdio-pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   clocks = <>;
+   clock-names = "ext_clock";
+   pinctrl-names = "default";
+   pinctrl-0 = <_enable_h>;
+   /*
+* On the module itself this is one of these (depending
+* on the actual card populated):
+* - SDIO_RESET_L_WL_REG_ON
+* - PDN (power down when low)
+*/
+   post-power-on-delay-ms = <200>;
+   reset-gpios = < RK_PC7 GPIO_ACTIVE_LOW>;
+   };
+
+   vcc12v_dcin: 

Re: [PATCH] efi_loader: Don't carve out memory reservations too early

2024-02-17 Thread Heinrich Schuchardt

On 2/16/24 3:17 PM, Mark Kettenis wrote:

Date: Fri, 16 Feb 2024 00:38:25 +0100
From: Heinrich Schuchardt 

Am 16. Februar 2024 00:25:34 MEZ schrieb Mark Kettenis :

Moving the efi_carve_out_dt_rsv() call in commit 1be415b21b2d
("efi_loader: create memory reservations in ACPI case")
broke boards that create additional memory reservations in
ft_board_setup() since it is now called before those additional
memory reservations are made.  This is the case for the rk3588
boards and breaks booting OpenBSD on those boards.

Move the call back to its original location and add a call in
the code path used for ACPI.

Fixes: 1be415b21b2d ("efi_loader: create memory reservations in ACPI case")
Signed-off-by: Mark Kettenis 
---
lib/efi_loader/efi_helper.c | 11 +++
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 5dd9cc876e..58761fae78 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -456,11 +456,11 @@ efi_status_t efi_install_fdt(void *fdt)
return EFI_LOAD_ERROR;
}

-   /* Create memory reservations as indicated by the device tree */
-   efi_carve_out_dt_rsv(fdt);
-
-   if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE))
+   if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)) {
+   /* Create memory reservations as indicated by the device tree */


Imagine booting the rk3588 board with ACPI.


I'd rather not, thank you ;)


Wouldn't we miss creating the ft_board_setup() reservations before
efi_carve_out_dt_rsv(fdt)?


Yes.  And arguably the these memory reservations should be made way
earlier, at the the time that efi_memory_init() runs.  I think we're
just lucky that efi_allocate_pages() doesn't hand us memory from these
areas in copy_fdt().

Better ideas?



image_setup_libfdt(, fdt, NULL) must be called before
efi_carve_out_dt_rsv().

Could you, please, add this call in this path, too. Otherwise the patch
looks correct.

Best regards

Heinrich




+   efi_carve_out_dt_rsv(fdt);
return EFI_SUCCESS;
+   }

/* Prepare device tree for payload */
ret = copy_fdt();
@@ -474,6 +474,9 @@ efi_status_t efi_install_fdt(void *fdt)
return EFI_LOAD_ERROR;
}

+   /* Create memory reservations as indicated by the device tree */
+   efi_carve_out_dt_rsv(fdt);
+
efi_try_purge_kaslr_seed(fdt);

if (CONFIG_IS_ENABLED(EFI_TCG2_PROTOCOL_MEASURE_DTB)) {








Re: [PATCH v4 02/39] usb: dwc3-generic: support external vbus regulator

2024-02-17 Thread Jonas Karlman
On 2024-02-15 21:52, Caleb Connolly wrote:
> Add support for a vbus-supply regulator specified in devicetree. This
> provides generic support to avoid hardcoded GPIO configuration in board
> init code.
> 
> Reviewed-by: Neil Armstrong 
> Signed-off-by: Caleb Connolly 
> ---
> This patch has no dependencies
> 
> Cc: Marek Vasut 
> ---
>  drivers/usb/dwc3/dwc3-generic.c | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index 6fb2de8a5ace..48da621ba966 100644
> --- a/drivers/usb/dwc3/dwc3-generic.c
> +++ b/drivers/usb/dwc3/dwc3-generic.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include "core.h"
>  #include "gadget.h"
> @@ -47,6 +48,7 @@ struct dwc3_generic_priv {
>  struct dwc3_generic_host_priv {
>   struct xhci_ctrl xhci_ctrl;
>   struct dwc3_generic_priv gen_priv;
> + struct udevice *vbus_dev;

vbus_supply may be a better name, it is a name used by other drivers.

>  };
>  
>  static int dwc3_generic_probe(struct udevice *dev,
> @@ -240,6 +242,13 @@ static int dwc3_generic_host_probe(struct udevice *dev)
>   if (rc)
>   return rc;
>  
> + rc = device_get_supply_regulator(dev, "vbus-supply", >vbus_dev);
> + if (rc)
> + debug("%s: No vbus regulator found: %d\n", dev->name, rc);
> +
> + if (priv->vbus_dev)
> + regulator_set_enable(priv->vbus_dev, true);

This should use the following form:

rc = regulator_set_enable_if_allowed(priv->vbus_supply, true);
if (rc && rc != -ENOSYS)
return rc;

That should only report an error if there is an error enabling the
regulator, or -ENOSYS if regulator support has been disabled.

Because fixed and gpio regulators now are referenced counted you will
need to clean up and disable the supply if the call to xhci_register()
fails, something like following should probably work:

rc = xhci_register(dev, hccr, hcor);
if (rc)
regulator_set_enable_if_allowed(priv->vbus_supply, false);

return rc;

> +
>   hccr = (struct xhci_hccr *)priv->gen_priv.base;
>   hcor = (struct xhci_hcor *)(priv->gen_priv.base +
>   HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
> @@ -256,6 +265,9 @@ static int dwc3_generic_host_remove(struct udevice *dev)
>   if (rc)
>   return rc;
>  
> + if (priv->vbus_dev)
> + regulator_set_enable(priv->vbus_dev, false);

This can safely use the following without any if check:

regulator_set_enable_if_allowed(priv->vbus_supply, false);

Regards,
Jonas

> +
>   return dwc3_generic_remove(dev, >gen_priv);
>  }
>  
> 



[PATCH 1/1] efi_loader: ignore device-tree in ACPI case

2024-02-17 Thread Heinrich Schuchardt
If a device-tree is passed to the bootefi command while using ACPI, we
currently only show a warning that the device-tree will be ignored. But we
use that device-tree to create memory reservations.

To be consistent we need to fallback to the internal device-tree.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_helper.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 5dd9cc876e..e2f547b3cd 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -422,8 +422,11 @@ efi_status_t efi_install_fdt(void *fdt)
 * The EBBR spec requires that we have either an FDT or an ACPI table
 * but not both.
 */
-   if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) && fdt)
+   if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) &&
+   fdt != EFI_FDT_USE_INTERNAL) {
+   fdt = EFI_FDT_USE_INTERNAL;
log_warning("WARNING: Can't have ACPI table and device tree - 
ignoring DT.\n");
+   }
 
if (fdt == EFI_FDT_USE_INTERNAL) {
const char *fdt_opt;
-- 
2.43.0



Re: [PATCH v2 00/15] rockchip: rk3328: Update defconfigs, DTs and enable boot from SPI

2024-02-17 Thread Jonas Karlman
On 2024-02-17 01:22, Jonas Karlman wrote:
> This series contains miscellaneous updates to defconfigs, syncs latest
> device trees from linux, fixes an issue loading FIT from SD-card when
> running SPL from eMMC and enables building a bootable SPI image on
> RK3328 boards.
> 
> I am also adding myself as a reviewer for the three RK3328 boards I own.
> 
> Patch 1-7 updates boards to enable similar Kconfig options and use a
> common order for from where to try and load FIT.
> 
> Patch 8 fix loading FIT from SD-card when booting from eMMC by using
> pinctrl for emmc and sdmmc in SPL.
> 
> Patch 9-10 makes rockchip gpio and rng driver compatible with linux.
> 
> Patch 11 sync latest rk3328 device tree files from linux v6.8-rc1.
> 
> Patch 12 reverts an old commit that added duplicated code.
> 
> Patch 13-15 enables building u-boot-rockchip-spi.bin for boards with
> SPI flash.
> 
> Changes in v2:
> - Remove unused SPL drivers, I2C and PMIC
> - Add helpful CMD_GPIO and CMD_REGULATOR to boards
> - Add missing UART2 pinctrl nodes to soc u-boot.dtsi
> - Mark the pinctrl node to be included in U-Boot proper pre-reloc phase
> - Add SD-card IO-voltage related nodes to nanopi-r2 u-boot.dtsi
> - Fix an ethernet issue on orangepi-r1-plus-lts
> - Include SPI flash pinctrl nodes in SPL
> - Collect r-b tags

Forgot to mention that following has been tested with this series:
- Loading TPL/SPL and FIT from a combo of different sources, e.g. SPL in
  eMMC and FIT in SD-card or SPL in SD-card and FIT in eMMC etc.
- USB host e.g. usb start; usb tree; usb stop;
- Ethernet e.g. mdio list; mii info; net list; dhcp;
- No pinctrl issue is reported with CONFIG_LOGLEVEL=7, i.e. no print of
  "pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19"
- GPIO and regulator status using gpio status; regulator status;
- Manually inspect TPL and SPL device tree
  $ dtc -I dtb -O dts tpl/u-boot-tpl.dtb
  $ dtc -I dtb -O dts spl/u-boot-spl.dtb

On the following devices:
- Rock64 v2.0 and v3.0
- ROC-RK3328-CC v1.0 and v1.3
- ROCK Pi E v1.21
- Orange Pi R1 Plus LTS

Following devices have _not_ been tested:
- NanoPi R2C/R2C Plus/R2S
- Orange Pi R1 Plus

A USB host issue was discovered on Orange Pi R1 Plus LTS during testing
and I expect NanoPi R2* boards also have the same issue. A fix for this
will be sent separately. The issue relates to fdt address translation of
reg prop in usbdrd3 node.

Regards,
Jonas

> 
> This series depends on the "rockchip: Update stack and bss addresses on
> RK3328 and RK3399" series at [1] being applied _after_ this series.
> Some boards may go over the simple malloc limit without that series also
> applied.
> 
> See [2] for a branch with the dependent series applied.
> 
> [1] https://patchwork.ozlabs.org/cover/1887729/
> [2] https://github.com/Kwiboo/u-boot-rockchip/commits/rk3328-update-v2
> 
> Jonas Karlman (15):
>   rockchip: rk3328: Update default u-boot,spl-boot-order prop
>   rockchip: rk3328-evb: Update defconfig
>   rockchip: rk3328-rock64: Update defconfig
>   rockchip: rk3328-roc-cc: Update defconfig
>   rockchip: rk3328-rock-pi-e: Update defconfig
>   rockchip: rk3328-nanopi-r2: Update defconfig
>   rockchip: rk3328-orangepi-r1-plus: Update defconfig
>   rockchip: rk3328: Fix loading FIT from SD-card when booting from eMMC
>   gpio: rockchip: Use gpio alias id as gpio bank id
>   rng: rockchip: Use same compatible as linux
>   rockchip: rk3328: Sync device tree from linux v6.8-rc1
>   Revert "rockchip: Allow booting from SPI"
>   rockchip: rk3328: Add support to build bootable SPI image
>   rockchip: rk3328-rock64: Enable boot from SPI NOR flash
>   rockchip: rk3328-orangepi-r1-plus: Enable boot from SPI NOR flash
> 
>  arch/arm/dts/rk3328-evb-u-boot.dtsi   |   4 +
>  arch/arm/dts/rk3328-evb.dts   |   1 +
>  .../dts/rk3328-nanopi-r2c-plus-u-boot.dtsi|   6 -
>  arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi|  24 +---
>  arch/arm/dts/rk3328-nanopi-r2s.dts|   3 +-
>  .../rk3328-orangepi-r1-plus-lts-u-boot.dtsi   |  32 ++
>  arch/arm/dts/rk3328-orangepi-r1-plus-lts.dts  |   4 +-
>  .../dts/rk3328-orangepi-r1-plus-u-boot.dtsi   |  32 ++
>  arch/arm/dts/rk3328-orangepi-r1-plus.dts  |   1 +
>  arch/arm/dts/rk3328-roc-cc-u-boot.dtsi|  22 +---
>  arch/arm/dts/rk3328-roc-cc.dts|   3 +-
>  arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi |  17 ---
>  arch/arm/dts/rk3328-rock-pi-e.dts |  55 +
>  arch/arm/dts/rk3328-rock64-u-boot.dtsi|  28 ++---
>  arch/arm/dts/rk3328-rock64.dts|   1 +
>  arch/arm/dts/rk3328-u-boot.dtsi   | 108 +++---
>  arch/arm/dts/rk3328.dtsi  |  64 ---
>  arch/arm/dts/rk3399-u-boot.dtsi   |   2 +-
>  arch/arm/mach-rockchip/rk3328/rk3328.c|   1 +
>  arch/arm/mach-rockchip/spl-boot-order.c   |   3 -
>  board/rockchip/evb_rk3328/MAINTAINERS |  11 ++
>  board/rockchip/evb_rk3328/README 

Re: [PATCH V6 07/20] configs: am62x_evm_a53_defconfig: Switch to bootstd

2024-02-17 Thread Jan Kiszka
On 17.02.24 04:11, Alexander Sverdlin wrote:
> Hello Nishanth,
> 
> On Fri, 2023-08-25 at 13:02 -0500, Nishanth Menon wrote:
>> Switch to using bootstd. Note with this change, we will stop using
>> distro_bootcmd and instead depend entirely on bootflow method of
>> starting the system up.
>>
>> Suggested-by: Tom Rini 
>> Suggested-by: Simon Glass 
>> Reviewed-by: Tom Rini 
>> Tested-by: Mattijs Korpershoek 
>> Signed-off-by: Nishanth Menon 
>> Reviewed-by: Tom Rini 
>> Reviewed-by: Mattijs Korpershoek 
>> ---
>> No change other than picking up reviews, tested tags along the way.
>> V5: https://lore.kernel.org/r/20230824031101.3460411-6...@ti.com
>>  configs/am62x_evm_a53_defconfig | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/configs/am62x_evm_a53_defconfig 
>> b/configs/am62x_evm_a53_defconfig
>> index d55caabe22c9..1807df8bbee9 100644
>> --- a/configs/am62x_evm_a53_defconfig
>> +++ b/configs/am62x_evm_a53_defconfig
>> @@ -28,8 +28,9 @@ CONFIG_SPL_SPI=y
>>  # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
>>  CONFIG_SPL_LOAD_FIT=y
>>  CONFIG_SPL_LOAD_FIT_ADDRESS=0x8100
>> -CONFIG_DISTRO_DEFAULTS=y
>> -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;"
>> +CONFIG_BOOTSTD_FULL=y
>> +CONFIG_BOOTSTD_DEFAULTS=y
>> +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb"
>>  CONFIG_SPL_MAX_SIZE=0x58000
>>  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
>>  CONFIG_SPL_BSS_START_ADDR=0x80c8
> 
> could you please suggest which distro have you used for testing?
> 
> After U-Boot update to v2024.01 Buildroot is not booting any more:
> 
> ---
> U-Boot 2024.01 (Feb 15 2024 - 01:43:17 +0100)
> 
> SoC:   AM62X SR1.0 HS-FS
> Model: Texas Instruments AM625 SK
> DRAM:  2 GiB
> Core:  56 devices, 23 uclasses, devicetree: separate
> MMC:   mmc@fa1: 0, mmc@fa0: 1
> Loading Environment from nowhere... OK
> In:serial@280
> Out:   serial@280
> Err:   serial@280
> Net:   eth0: ethernet@800port@1
> Hit any key to stop autoboot:  0 
> switch to partitions #0, OK
> mmc1 is current device
> SD/MMC found on device 1
> Failed to load 'uEnv.txt'
> Scanning for bootflows in all bootdevs
> Seq  Method   State   UclassPart  Name  Filename
> ---  ---  --        
> 
> Scanning global bootmeth 'efi_mgr':
> No EFI system partition
> No EFI system partition
> Failed to persist EFI variables
> Scanning bootdev 'mmc@fa0.bootdev':
> Scanning bootdev 'mmc@fa1.bootdev':
> Unknown uclass 'usb' in label
> link up on port 1, speed 100, full duplex
> BOOTP broadcast 1
> BOOTP broadcast 2
> BOOTP broadcast 3
> ...
> ---
> 
> I suppose TI's BSP has older U-Boot... So it's not providing necessary
> script for BOOTSTD, I suppose?
> 

You can make the BeagleBone boot via EFI, but it requires a hybrid
partition table (ROM loader want DOS, EFI needs GPT). A Debian
integration with this can be found for Isar [1] in this series [2]. It's
only using upstream sources (plus still one u-boot patch to get wifi
working).

If you want legacy script booting, I suspect you need to flip some extra
switches explicitly by now.

Jan

[1] https://github.com/ilbers/isar/
[2] https://patchwork.isar-build.org/project/isar/list/?series=1049

-- 
Siemens AG, Technology
Linux Expert Center