[PATCH 3/3] efi_selftest: add tests for QueryVariableInfo at boottime

2024-04-23 Thread Ilias Apalodimas
Previous patches added QueryVariableInfo at runtime tests and
split a common function that can be used at boottime. Weire it
up and run a similar set of tets. While at it move a test which is
checiking for 0 available storage in the common code

Add tests for
- Test QueryVariableInfo returns EFI_SUCCESS
- Test null pointers for the function arguments
- Test invalid combination of attributes

Signed-off-by: Ilias Apalodimas 
---
 lib/efi_selftest/efi_selftest_variables.c| 11 ---
 lib/efi_selftest/efi_selftest_variables_common.c |  3 +++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_variables.c 
b/lib/efi_selftest/efi_selftest_variables.c
index 39ad03a090d4..3c55938be1ce 100644
--- a/lib/efi_selftest/efi_selftest_variables.c
+++ b/lib/efi_selftest/efi_selftest_variables.c
@@ -52,14 +52,11 @@ static int execute(void)
int flag;
efi_guid_t guid;
u64 max_storage, rem_storage, max_size;
+   int test_ret;
 
-   ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS,
-  _storage, _storage,
-  _size);
-   if (ret != EFI_SUCCESS) {
-   efi_st_todo("QueryVariableInfo failed\n");
-   } else if (!max_storage || !rem_storage || !max_size) {
-   efi_st_error("QueryVariableInfo: wrong info\n");
+   test_ret = efi_st_query_variable_common(runtime);
+   if (test_ret != EFI_ST_SUCCESS) {
+   efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
}
/* Set variable 0 */
diff --git a/lib/efi_selftest/efi_selftest_variables_common.c 
b/lib/efi_selftest/efi_selftest_variables_common.c
index 36bdfe6ff9c3..435ccf4ac13a 100644
--- a/lib/efi_selftest/efi_selftest_variables_common.c
+++ b/lib/efi_selftest/efi_selftest_variables_common.c
@@ -22,6 +22,9 @@ int efi_st_query_variable_common(struct efi_runtime_services 
*runtime)
if (ret != EFI_SUCCESS) {
efi_st_error("QueryVariableInfo failed\n");
return EFI_ST_FAILURE;
+   } else if (!max_storage || !rem_storage || !max_size) {
+   efi_st_error("QueryVariableInfo: wrong info\n");
+   return EFI_ST_FAILURE;
}
 
ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS,
-- 
2.40.1



[PATCH 2/3] efi_selftest: add tests for QueryVariableInfo at runtime

2024-04-23 Thread Ilias Apalodimas
Since we support QueryVariableInfo at runtime now add the relevant
tests. Since we want those to be reusable at bootime, add them
in a separate file

Add tests for
- Test QueryVariableInfo returns EFI_SUCCESS
- Test null pointers for the function arguments
- Test invalid combination of attributes

Signed-off-by: Ilias Apalodimas 
---
 include/efi_selftest.h|   9 ++
 lib/efi_selftest/Makefile |   1 +
 .../efi_selftest_variables_common.c   | 102 ++
 .../efi_selftest_variables_runtime.c  |  10 +-
 4 files changed, 118 insertions(+), 4 deletions(-)
 create mode 100644 lib/efi_selftest/efi_selftest_variables_common.c

diff --git a/include/efi_selftest.h b/include/efi_selftest.h
index 5bcebb368287..ca7ae948663e 100644
--- a/include/efi_selftest.h
+++ b/include/efi_selftest.h
@@ -147,6 +147,15 @@ void *efi_st_get_config_table(const efi_guid_t *guid);
  */
 u16 efi_st_get_key(void);
 
+/**
+ * efi_st_query_variable_common - Common variable tests for boottime/runtime
+ *
+ * @runtime:   Pointer to services table
+ *
+ * Return: EFI_ST_SUCCESS/FAILURE
+ */
+int efi_st_query_variable_common(struct efi_runtime_services *runtime);
+
 /**
  * struct efi_unit_test - EFI unit test
  *
diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index e4d75420bff6..414701893f65 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -45,6 +45,7 @@ efi_selftest_textinputex.o \
 efi_selftest_textoutput.o \
 efi_selftest_tpl.o \
 efi_selftest_util.o \
+efi_selftest_variables_common.o \
 efi_selftest_variables.o \
 efi_selftest_variables_runtime.o \
 efi_selftest_watchdog.o
diff --git a/lib/efi_selftest/efi_selftest_variables_common.c 
b/lib/efi_selftest/efi_selftest_variables_common.c
new file mode 100644
index ..36bdfe6ff9c3
--- /dev/null
+++ b/lib/efi_selftest/efi_selftest_variables_common.c
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * efi_selftest_variables_runtime
+ *
+ * Copyright (c) 2024 Ilias Apalodimas 
+ *
+ * This unit test checks common service across boottime/runtime
+ */
+
+#include 
+
+#define EFI_INVALID_ATTR BIT(30)
+
+int efi_st_query_variable_common(struct efi_runtime_services *runtime)
+{
+   efi_status_t ret;
+   u64 max_storage, rem_storage, max_size;
+
+   ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS,
+  _storage, _storage,
+  _size);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("QueryVariableInfo failed\n");
+   return EFI_ST_FAILURE;
+   }
+
+   ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS,
+  NULL, _storage,
+  _size);
+   if (ret != EFI_INVALID_PARAMETER) {
+   efi_st_error("QueryVariableInfo failed\n");
+   return EFI_ST_FAILURE;
+   }
+
+   ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS,
+  _storage, NULL,
+  _size);
+   if (ret != EFI_INVALID_PARAMETER) {
+   efi_st_error("QueryVariableInfo failed\n");
+   return EFI_ST_FAILURE;
+   }
+
+   ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS,
+  _storage, _storage,
+  NULL);
+   if (ret != EFI_INVALID_PARAMETER) {
+   efi_st_error("QueryVariableInfo failed\n");
+   return EFI_ST_FAILURE;
+   }
+
+   ret = runtime->query_variable_info(0, _storage, _storage,
+  _size);
+   if (ret != EFI_INVALID_PARAMETER) {
+   efi_st_error("QueryVariableInfo failed\n");
+   return EFI_ST_FAILURE;
+   }
+
+   ret = 
runtime->query_variable_info(EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS |
+  EFI_VARIABLE_NON_VOLATILE,
+  _storage, _storage,
+  _size);
+   if (ret != EFI_UNSUPPORTED) {
+   efi_st_error("QueryVariableInfo failed\n");
+   return EFI_ST_FAILURE;
+   }
+
+   /* Use an attribute bit not described in the EFI spec */
+   ret = runtime->query_variable_info(EFI_INVALID_ATTR, _storage,
+  _storage, _size);
+   if (ret != EFI_UNSUPPORTED) {
+   efi_st_error("QueryVariableInfo failed\n");
+   return EFI_ST_FAILURE;
+   }
+
+   ret = runtime->query_variable_info(EFI_VARIABLE_RUNTIME_ACCESS, 
_storage, _storage,
+  _size);
+   if (ret != EFI_INVALID_PARAMETER) {
+   efi_st_error("QueryVariableInfo failed\n");
+   

[PATCH 1/3] efi_loader: enable QueryVariableInfo at runtime for file backed variables

2024-04-23 Thread Ilias Apalodimas
Since commit c28d32f946f0 ("efi_loader: conditionally enable SetvariableRT")
we are enabling the last bits of missing runtime services.
Add support for QueryVariableInfo which we already support at boottime
and we just need to mark some fucntions available at runtime and move
some checks around.

It's worth noting that pointer checks for maxmimum and remaining
variable storage aren't when we store variables on the RPMB, since the
Secure World backend is already performing them.

Signed-off-by: Ilias Apalodimas 
---
 lib/efi_loader/efi_runtime.c   |  4 
 lib/efi_loader/efi_var_common.c|  6 --
 lib/efi_loader/efi_variable.c  | 18 --
 lib/efi_loader/efi_variable_tee.c  |  5 +
 .../efi_selftest_variables_runtime.c   | 14 +++---
 5 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 73831c527e00..011bcd04836d 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -129,6 +129,10 @@ efi_status_t efi_init_runtime_supported(void)
EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP |
EFI_RT_SUPPORTED_CONVERT_POINTER;
 
+   if (IS_ENABLED(CONFIG_EFI_VARIABLE_FILE_STORE))
+   rt_table->runtime_services_supported |=
+   EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO;
+
if (IS_ENABLED(CONFIG_EFI_RT_VOLATILE_STORE)) {
u8 s = 0;
 
diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c
index 961139f005af..ea8d2a4cf98c 100644
--- a/lib/efi_loader/efi_var_common.c
+++ b/lib/efi_loader/efi_var_common.c
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0+
 /*
  * UEFI runtime variable services
  *
@@ -163,11 +162,6 @@ efi_status_t EFIAPI efi_query_variable_info(
EFI_ENTRY("%x %p %p %p", attributes, maximum_variable_storage_size,
  remaining_variable_storage_size, maximum_variable_size);
 
-   if (!maximum_variable_storage_size ||
-   !remaining_variable_storage_size ||
-   !maximum_variable_size)
-   return EFI_EXIT(EFI_INVALID_PARAMETER);
-
ret = efi_query_variable_info_int(attributes,
  maximum_variable_storage_size,
  remaining_variable_storage_size,
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 0cbed53d1dbf..e039cecd82b6 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -406,12 +406,15 @@ efi_status_t efi_set_variable_int(const u16 
*variable_name,
return EFI_SUCCESS;
 }
 
-efi_status_t efi_query_variable_info_int(u32 attributes,
-u64 *maximum_variable_storage_size,
-u64 *remaining_variable_storage_size,
-u64 *maximum_variable_size)
+efi_status_t __efi_runtime
+efi_query_variable_info_int(u32 attributes,
+   u64 *maximum_variable_storage_size,
+   u64 *remaining_variable_storage_size,
+   u64 *maximum_variable_size)
 {
-   if (attributes == 0)
+   if (!maximum_variable_storage_size ||
+   !remaining_variable_storage_size ||
+   !maximum_variable_size || !attributes)
return EFI_INVALID_PARAMETER;
 
/* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */
@@ -460,7 +463,10 @@ static efi_status_t __efi_runtime EFIAPI 
efi_query_variable_info_runtime(
u64 *remaining_variable_storage_size,
u64 *maximum_variable_size)
 {
-   return EFI_UNSUPPORTED;
+   return efi_query_variable_info_int(attributes,
+  maximum_variable_storage_size,
+  remaining_variable_storage_size,
+  maximum_variable_size);
 }
 
 /**
diff --git a/lib/efi_loader/efi_variable_tee.c 
b/lib/efi_loader/efi_variable_tee.c
index 4f1aa298da13..8b6b0a390869 100644
--- a/lib/efi_loader/efi_variable_tee.c
+++ b/lib/efi_loader/efi_variable_tee.c
@@ -873,6 +873,11 @@ efi_status_t efi_query_variable_info_int(u32 attributes,
efi_status_t ret;
u8 *comm_buf;
 
+   if (!max_variable_storage_size ||
+   !remain_variable_storage_size ||
+   !max_variable_size || !attributes)
+   return EFI_INVALID_PARAMETER;
+
payload_size = sizeof(*mm_query_info);
comm_buf = setup_mm_hdr((void **)_query_info, payload_size,
SMM_VARIABLE_FUNCTION_QUERY_VARIABLE_INFO,
diff --git a/lib/efi_selftest/efi_selftest_variables_runtime.c 
b/lib/efi_selftest/efi_selftest_variables_runtime.c
index afa91be62c85..5794a7b2d405 100644
--- 

Re: [PATCH] sysreset: psci: drop reliance on SPL support

2024-04-23 Thread Tom Rini
On Wed, Apr 24, 2024 at 12:46:04AM +0100, Andre Przywara wrote:
> At the moment enabling CONFIG_SYSRESET_PSCI *selects* SPL_ARM_PSCI_FW,
> even though this is a platform design property, so nothing any driver
> should enforce. Some platforms load the PSCI runtime (TF-A) only in the
> SPL, so PSCI is naturally not available during SPL runtime.
> 
> Spit CONFIG_SYSRESET_PSCI up into an SPL and a U-Boot proper version,
> and let the former *depend* on SPL_ARM_PSCI_FW.
> 
> This allows to enable CONFIG_SYSRESET_PSCI on platforms without SPL PSCI
> support.
> 
> Signed-off-by: Andre Przywara 
> ---
>  drivers/sysreset/Kconfig  | 8 +++-
>  drivers/sysreset/Makefile | 2 +-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
> index 49c0787b26d..62fe9eb6220 100644
> --- a/drivers/sysreset/Kconfig
> +++ b/drivers/sysreset/Kconfig
> @@ -119,11 +119,17 @@ config SYSRESET_PALMAS
>  config SYSRESET_PSCI
>   bool "Enable support for PSCI System Reset"
>   depends on ARM_PSCI_FW
> - select SPL_ARM_PSCI_FW if SPL
>   help
> Enable PSCI SYSTEM_RESET function call.  To use this, PSCI firmware
> must be running on your system.
>  
> +config SYSRESET_SPL_PSCI

This should be SPL_SYSRESET_PSCI so that..

[snip]
> -obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
> +obj-$(CONFIG_$(SPL_TPL_)SYSRESET_PSCI) += sysreset_psci.o

This works.

-- 
Tom


signature.asc
Description: PGP signature


Re: [GIT PULL] please pull fsl-qoriq-2024-4-24

2024-04-23 Thread Tom Rini
On Tue, Apr 23, 2024 at 11:34:08PM +, Peng Fan wrote:

> Hi Tom,
> 
> Please pull fsl-qoriq-2024-4-24
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH 3/4] [DO NOT MERGE] sunxi: dts: arm64: add Tanix TX1 DT from Linux

2024-04-23 Thread Andre Przywara
Add the board DT file for the Tanix TX1 TV box, with the H313 SoC.
This has been taken from the sunxi/for-next tree, though it has not been
merged into any other tree yet.
So this is a placeholder for now, to enable the board support, and will be
superseded by the regular sync of the DT files later.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/sun50i-h313-tanix-tx1.dts | 183 +
 1 file changed, 183 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-h313-tanix-tx1.dts

diff --git a/arch/arm/dts/sun50i-h313-tanix-tx1.dts 
b/arch/arm/dts/sun50i-h313-tanix-tx1.dts
new file mode 100644
index 000..bb2cde59bd0
--- /dev/null
+++ b/arch/arm/dts/sun50i-h313-tanix-tx1.dts
@@ -0,0 +1,183 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (C) 2024 Arm Ltd.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h616.dtsi"
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Tanix TX1";
+   compatible = "oranth,tanix-tx1", "allwinner,sun50i-h616";
+
+   aliases {
+   serial0 = 
+   ethernet0 = _wifi;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+
+   key {
+   label = "hidden";
+   linux,code = ;
+   gpios = < 7 9 GPIO_ACTIVE_LOW>; /* PH9 */
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led-0 {
+   function = LED_FUNCTION_POWER;
+   color = ;
+   gpios = < 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
+   default-state = "on";
+   };
+   };
+
+   wifi_pwrseq: pwrseq {
+   compatible = "mmc-pwrseq-simple";
+   clocks = < CLK_OSC32K_FANOUT>;
+   clock-names = "ext_clock";
+   pinctrl-0 = <_fanout_pin>;
+   pinctrl-names = "default";
+   reset-gpios = < 6 18 GPIO_ACTIVE_LOW>; /* PG18 */
+   };
+
+   reg_vcc5v: vcc5v {
+   /* board wide 5V supply directly from the DC input */
+   compatible = "regulator-fixed";
+   regulator-name = "vcc-5v";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   regulator-always-on;
+   };
+};
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vmmc-supply = <_dldo1>;
+   vqmmc-supply = <_aldo1>;
+   mmc-pwrseq = <_pwrseq>;
+   bus-width = <4>;
+   non-removable;
+   status = "okay";
+
+   sdio_wifi: wifi@1 {
+   reg = <1>;
+   };
+};
+
+ {
+   vmmc-supply = <_dldo1>;
+   vqmmc-supply = <_aldo1>;
+   bus-width = <8>;
+   non-removable;
+   max-frequency = <1>;
+   cap-mmc-hw-reset;
+   mmc-ddr-1_8v;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   vcc-pc-supply = <_aldo1>;
+   vcc-pf-supply = <_dldo1>;
+   vcc-pg-supply = <_aldo1>;
+   vcc-ph-supply = <_dldo1>;
+   vcc-pi-supply = <_dldo1>;
+};
+
+_i2c {
+   status = "okay";
+
+   axp313: pmic@36 {
+   compatible = "x-powers,axp313a";
+   reg = <0x36>;
+   #interrupt-cells = <1>;
+   interrupt-controller;
+
+   vin1-supply = <_vcc5v>;
+   vin2-supply = <_vcc5v>;
+   vin3-supply = <_vcc5v>;
+
+   regulators {
+   /* Supplies VCC-PLL, so needs to be always on. */
+   reg_aldo1: aldo1 {
+   regulator-always-on;
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   regulator-name = "vcc1v8";
+   };
+
+   /* Supplies VCC-IO, so needs to be always on. */
+   reg_dldo1: dldo1 {
+   regulator-always-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-name = "vcc3v3";
+   };
+
+   reg_dcdc1: dcdc1 {
+   regulator-always-on;
+   regulator-min-microvolt = <81>;
+   regulator-max-microvolt = <99>;
+   regulator-name = "vdd-gpu-sys";
+   };
+
+   reg_dcdc2: dcdc2 {
+   regulator-always-on;
+   regulator-min-microvolt = <81>;
+   regulator-max-microvolt = <112>;
+

[PATCH 4/4] sunxi: H616: add Tanix TX1 support

2024-04-23 Thread Andre Przywara
The Tanix TX1 is a tiny TV box, featuring the Allwinner H313 SoC with up
to 2GB of DRAM and 16GB of eMMC. There is no SD card or Ethernet port on
this small device, but it can be booted via the USB debug "FEL" mode.
The bootloader could then be written to the eMMC.

Add the defconfig for that board, and add the devicetree file to the
Makefile, for it to be built.
The DRAM parameters were taken from the vendor firmware on the eMMC.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/Makefile   |  1 +
 configs/tanix_tx1_defconfig | 25 +
 2 files changed, 26 insertions(+)
 create mode 100644 configs/tanix_tx1_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 127345975ef..69b0d6a9ad7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -779,6 +779,7 @@ dtb-$(CONFIG_MACH_SUN50I_H6) += \
sun50i-h6-tanix-tx6.dtb \
sun50i-h6-tanix-tx6-mini.dtb
 dtb-$(CONFIG_MACH_SUN50I_H616) += \
+   sun50i-h313-tanix-tx1.dtb \
sun50i-h616-orangepi-zero2.dtb \
sun50i-h618-orangepi-zero2w.dtb \
sun50i-h618-orangepi-zero3.dtb \
diff --git a/configs/tanix_tx1_defconfig b/configs/tanix_tx1_defconfig
new file mode 100644
index 000..9915fff4a00
--- /dev/null
+++ b/configs/tanix_tx1_defconfig
@@ -0,0 +1,25 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h313-tanix-tx1"
+CONFIG_SPL=y
+CONFIG_DRAM_SUN50I_H616_DX_ODT=0x06060606
+CONFIG_DRAM_SUN50I_H616_DX_DRI=0x0d0d0d0d
+CONFIG_DRAM_SUN50I_H616_CA_DRI=0x1919
+CONFIG_DRAM_SUN50I_H616_ODT_EN=0x9988
+CONFIG_DRAM_SUN50I_H616_TPR6=0x2fb08080
+CONFIG_DRAM_SUN50I_H616_TPR10=0x402f4469
+CONFIG_DRAM_SUN50I_H616_TPR11=0x0e0f0d0d
+CONFIG_DRAM_SUN50I_H616_TPR12=0x11131213
+CONFIG_MACH_SUN50I_H616=y
+CONFIG_SUNXI_DRAM_H616_LPDDR3=y
+CONFIG_R_I2C_ENABLE=y
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL_I2C=y
+CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_SYS_I2C_MVTWSI=y
+CONFIG_SYS_I2C_SLAVE=0x7f
+CONFIG_SYS_I2C_SPEED=40
+CONFIG_AXP313_POWER=y
+CONFIG_AXP_DCDC3_VOLT=1200
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
-- 
2.35.8



[PATCH 1/4] sunxi: dts: arm/arm64: update devicetree files from Linux-v6.9-rc4

2024-04-23 Thread Andre Przywara
Sync the devicetree files from the official Linux kernel tree, v6.9-rc4.
This is covering Allwinner SoCs with 32-bit and 64-bit ARM cores.

Besides some cosmectic changes, this adds S/PDIF, DMA, and thermal
support to the H616 .dtsi. Nothing that U-Boot needs for itself, but
helpful to pass on to kernels.
This also adds new devicetrees, for some LonganPi H616 board, and the
Remix Mini PC. The latter will get a defconfig next.

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

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/sun50i-h6-beelink-gs1.dts|   2 +
 arch/arm/dts/sun50i-h6-tanix.dtsi |   2 +
 arch/arm/dts/sun50i-h6.dtsi   |   7 +-
 .../dts/sun50i-h616-bigtreetech-cb1-manta.dts |   2 +-
 arch/arm/dts/sun50i-h616-bigtreetech-cb1.dtsi |   4 +-
 arch/arm/dts/sun50i-h616-bigtreetech-pi.dts   |   2 +-
 arch/arm/dts/sun50i-h616.dtsi | 155 
 .../arm/dts/sun50i-h618-longan-module-3h.dtsi |  75 
 arch/arm/dts/sun50i-h618-longanpi-3h.dts  | 144 +++
 .../arm/dts/sun50i-h618-transpeed-8k618-t.dts |  23 ++
 arch/arm/dts/sun50i-h64-remix-mini-pc.dts | 356 ++
 arch/arm/dts/sun8i-r40-feta40i.dtsi   |   7 +
 12 files changed, 771 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-h618-longan-module-3h.dtsi
 create mode 100644 arch/arm/dts/sun50i-h618-longanpi-3h.dts
 create mode 100644 arch/arm/dts/sun50i-h64-remix-mini-pc.dts

diff --git a/arch/arm/dts/sun50i-h6-beelink-gs1.dts 
b/arch/arm/dts/sun50i-h6-beelink-gs1.dts
index d6897ec9799..87432c4f1ff 100644
--- a/arch/arm/dts/sun50i-h6-beelink-gs1.dts
+++ b/arch/arm/dts/sun50i-h6-beelink-gs1.dts
@@ -291,6 +291,8 @@
 };
 
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_tx_pin>;
status = "okay";
 };
 
diff --git a/arch/arm/dts/sun50i-h6-tanix.dtsi 
b/arch/arm/dts/sun50i-h6-tanix.dtsi
index 4903d635811..855b7d43bc5 100644
--- a/arch/arm/dts/sun50i-h6-tanix.dtsi
+++ b/arch/arm/dts/sun50i-h6-tanix.dtsi
@@ -166,6 +166,8 @@
 };
 
  {
+   pinctrl-names = "default";
+   pinctrl-0 = <_tx_pin>;
status = "okay";
 };
 
diff --git a/arch/arm/dts/sun50i-h6.dtsi b/arch/arm/dts/sun50i-h6.dtsi
index 3c85c8cc8ea..09e21689284 100644
--- a/arch/arm/dts/sun50i-h6.dtsi
+++ b/arch/arm/dts/sun50i-h6.dtsi
@@ -405,6 +405,7 @@
function = "spi1";
};
 
+   /omit-if-no-ref/
spdif_tx_pin: spdif-tx-pin {
pins = "PH7";
function = "spdif";
@@ -654,10 +655,8 @@
clocks = < CLK_BUS_SPDIF>, < CLK_SPDIF>;
clock-names = "apb", "spdif";
resets = < RST_BUS_SPDIF>;
-   dmas = < 2>;
-   dma-names = "tx";
-   pinctrl-names = "default";
-   pinctrl-0 = <_tx_pin>;
+   dmas = < 2>, < 2>;
+   dma-names = "rx", "tx";
status = "disabled";
};
 
diff --git a/arch/arm/dts/sun50i-h616-bigtreetech-cb1-manta.dts 
b/arch/arm/dts/sun50i-h616-bigtreetech-cb1-manta.dts
index dbce61b355d..4bfb52609c9 100644
--- a/arch/arm/dts/sun50i-h616-bigtreetech-cb1-manta.dts
+++ b/arch/arm/dts/sun50i-h616-bigtreetech-cb1-manta.dts
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Copyright (C) 2023 Martin Botka .
  */
diff --git a/arch/arm/dts/sun50i-h616-bigtreetech-cb1.dtsi 
b/arch/arm/dts/sun50i-h616-bigtreetech-cb1.dtsi
index 1fed2b46cfe..af421ba24ce 100644
--- a/arch/arm/dts/sun50i-h616-bigtreetech-cb1.dtsi
+++ b/arch/arm/dts/sun50i-h616-bigtreetech-cb1.dtsi
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Copyright (C) 2023 Martin Botka .
  */
@@ -93,7 +93,7 @@
interrupt-controller;
#interrupt-cells = <1>;
 
-   regulators{
+   regulators {
reg_dcdc1: dcdc1 {
regulator-name = "vdd-gpu-sys";
regulator-min-microvolt = <81>;
diff --git a/arch/arm/dts/sun50i-h616-bigtreetech-pi.dts 
b/arch/arm/dts/sun50i-h616-bigtreetech-pi.dts
index 832f08b2b26..ff84a379447 100644
--- a/arch/arm/dts/sun50i-h616-bigtreetech-pi.dts
+++ b/arch/arm/dts/sun50i-h616-bigtreetech-pi.dts
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Copyright (C) 2023 Martin Botka .
  */
diff --git a/arch/arm/dts/sun50i-h616.dtsi b/arch/arm/dts/sun50i-h616.dtsi
index d549d277d97..b2e85e52d1a 100644
--- a/arch/arm/dts/sun50i-h616.dtsi
+++ b/arch/arm/dts/sun50i-h616.dtsi
@@ -9,6 +9,7 @@
 #include 
 #include 
 

[PATCH 2/4] sunxi: a64: Add Remix Mini PC support

2024-04-23 Thread Andre Przywara
The Remix Mini PC is a "mini computer" using the Allwinner H64 SoC,
which appears to be just a relabelled A64. It was launched in 2015 by
the now defunct company Jide, and shipped with a desktop optimised
version of Android. Its appearance and feature set is close to a
typical TV box.

The devicetree file has been imported from the Linux tree already, so
just add a defconfig and enable the DTB build in the Makefile. The SoC
has the "secure boot" fuse burnt, so we need to generate a TOC0 image
instead of the standard Allwinner eGON image format for the SPL.

Signed-off-by: Andre Przywara 
---
 arch/arm/dts/Makefile   |  3 ++-
 configs/remix-mini-pc_defconfig | 14 ++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 configs/remix-mini-pc_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b1c9c6222e5..127345975ef 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -801,7 +801,8 @@ dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-pinephone-1.2.dtb \
sun50i-a64-pinetab.dtb \
sun50i-a64-sopine-baseboard.dtb \
-   sun50i-a64-teres-i.dtb
+   sun50i-a64-teres-i.dtb \
+   sun50i-h64-remix-mini-pc.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
sun9i-a80-optimus.dtb \
sun9i-a80-cubieboard4.dtb \
diff --git a/configs/remix-mini-pc_defconfig b/configs/remix-mini-pc_defconfig
new file mode 100644
index 000..fa427a027f8
--- /dev/null
+++ b/configs/remix-mini-pc_defconfig
@@ -0,0 +1,14 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h64-remix-mini-pc"
+CONFIG_SPL=y
+CONFIG_MACH_SUN50I=y
+CONFIG_DRAM_CLK=672
+CONFIG_DRAM_ZQ=4013533
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_SPL_IMAGE_TYPE_SUNXI_TOC0=y
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_CMD_POWEROFF=y
+CONFIG_SUPPORT_EMMC_BOOT=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
-- 
2.35.8



[PATCH 0/4] sunxi: devicetree updates plus new boards

2024-04-23 Thread Andre Przywara
This updates the Allwinner related devicetree files from the Linux
kernel repository. The files were taken from Linux v6.9-rc4, and
adjusted to increase compatibility with older kernels.

This also adds board support for two new devices: the old Remix Mini PC,
a TV box like "Android desktop" device from 2015, and the Tanix TX1,
which is a tiny TV box with an H313 SoC.
The DT for the latter is preliminary for now, as it hasn't been merged
into Linus' tree yet - though that's supposed to happen in about a few
weeks time.

Please have a look!

Cheers,
Andre

Andre Przywara (4):
  sunxi: dts: arm/arm64: update devicetree files from Linux-v6.9-rc4
  sunxi: a64: Add Remix Mini PC support
  [DO NOT MERGE] sunxi: dts: arm64: add Tanix TX1 DT from Linux
  sunxi: H616: add Tanix TX1 support

 arch/arm/dts/Makefile |   4 +-
 arch/arm/dts/sun50i-h313-tanix-tx1.dts| 183 +
 arch/arm/dts/sun50i-h6-beelink-gs1.dts|   2 +
 arch/arm/dts/sun50i-h6-tanix.dtsi |   2 +
 arch/arm/dts/sun50i-h6.dtsi   |   7 +-
 .../dts/sun50i-h616-bigtreetech-cb1-manta.dts |   2 +-
 arch/arm/dts/sun50i-h616-bigtreetech-cb1.dtsi |   4 +-
 arch/arm/dts/sun50i-h616-bigtreetech-pi.dts   |   2 +-
 arch/arm/dts/sun50i-h616.dtsi | 155 
 .../arm/dts/sun50i-h618-longan-module-3h.dtsi |  75 
 arch/arm/dts/sun50i-h618-longanpi-3h.dts  | 144 +++
 .../arm/dts/sun50i-h618-transpeed-8k618-t.dts |  23 ++
 arch/arm/dts/sun50i-h64-remix-mini-pc.dts | 356 ++
 arch/arm/dts/sun8i-r40-feta40i.dtsi   |   7 +
 configs/remix-mini-pc_defconfig   |  14 +
 configs/tanix_tx1_defconfig   |  25 ++
 16 files changed, 996 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-h313-tanix-tx1.dts
 create mode 100644 arch/arm/dts/sun50i-h618-longan-module-3h.dtsi
 create mode 100644 arch/arm/dts/sun50i-h618-longanpi-3h.dts
 create mode 100644 arch/arm/dts/sun50i-h64-remix-mini-pc.dts
 create mode 100644 configs/remix-mini-pc_defconfig
 create mode 100644 configs/tanix_tx1_defconfig

-- 
2.35.8



[PATCH] sysreset: psci: drop reliance on SPL support

2024-04-23 Thread Andre Przywara
At the moment enabling CONFIG_SYSRESET_PSCI *selects* SPL_ARM_PSCI_FW,
even though this is a platform design property, so nothing any driver
should enforce. Some platforms load the PSCI runtime (TF-A) only in the
SPL, so PSCI is naturally not available during SPL runtime.

Spit CONFIG_SYSRESET_PSCI up into an SPL and a U-Boot proper version,
and let the former *depend* on SPL_ARM_PSCI_FW.

This allows to enable CONFIG_SYSRESET_PSCI on platforms without SPL PSCI
support.

Signed-off-by: Andre Przywara 
---
 drivers/sysreset/Kconfig  | 8 +++-
 drivers/sysreset/Makefile | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 49c0787b26d..62fe9eb6220 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -119,11 +119,17 @@ config SYSRESET_PALMAS
 config SYSRESET_PSCI
bool "Enable support for PSCI System Reset"
depends on ARM_PSCI_FW
-   select SPL_ARM_PSCI_FW if SPL
help
  Enable PSCI SYSTEM_RESET function call.  To use this, PSCI firmware
  must be running on your system.
 
+config SYSRESET_SPL_PSCI
+   bool "Enable support for PSCI System Reset in SPL"
+   depends on SPL_ARM_PSCI_FW
+   help
+ Enable PSCI SYSTEM_RESET function call in the SPL. To use this, PSCI
+ firmware must be running on your system before the SPL.
+
 config SYSRESET_SBI
bool "Enable support for SBI System Reset"
depends on RISCV_SMODE && SBI_V02
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index e0e732205df..8d992ae0930 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_SYSRESET_MPC83XX) += sysreset_mpc83xx.o
 obj-$(CONFIG_SYSRESET_MICROBLAZE) += sysreset_microblaze.o
 obj-$(CONFIG_SYSRESET_OCTEON) += sysreset_octeon.o
 obj-$(CONFIG_$(SPL_TPL_)SYSRESET_PALMAS) += sysreset_palmas.o
-obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
+obj-$(CONFIG_$(SPL_TPL_)SYSRESET_PSCI) += sysreset_psci.o
 obj-$(CONFIG_SYSRESET_SBI) += sysreset_sbi.o
 obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o
 obj-$(CONFIG_SYSRESET_SOCFPGA_SOC64) += sysreset_socfpga_soc64.o
-- 
2.35.8



[GIT PULL] please pull fsl-qoriq-2024-4-24

2024-04-23 Thread Peng Fan
Hi Tom,

Please pull fsl-qoriq-2024-4-24

---
move to OF_UPSTREAM for sl28
---
CI: https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq/-/pipelines/20501

Thanks,
Peng.

The following changes since commit 38ea74d6d5c05224acdb03f799897c1bdd56f8cc:

  Prepare v2024.07-rc1 (2024-04-22 15:10:21 -0600)

are available in the Git repository at:

  https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq.git 
tags/fsl-qoriq-2024-4-24

for you to fetch changes up to 61ff13283c3b3858989c038a5dc57b1370e5d8ce:

  board: sl28: move to OF_UPSTREAM (2024-04-24 00:22:09 +0800)


Michael Walle (1):
  board: sl28: move to OF_UPSTREAM

 arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dts |  59 
 arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dts |  65 -
 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3.dts |  15 ---
 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4.dts |  47 -
 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts  | 308 
---
 board/kontron/sl28/spl.c   |  11 +--
 configs/kontron_sl28_defconfig |   5 +-
 7 files changed, 8 insertions(+), 502 deletions(-)
 delete mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var1.dts
 delete mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var2.dts
 delete mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var3.dts
 delete mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28-var4.dts
 delete mode 100644 arch/arm/dts/fsl-ls1028a-kontron-sl28.dts


Re: [PATCH] ARM: imx: Enable kaslrseed command on DH i.MX8M Plus DHCOM

2024-04-23 Thread Marek Vasut

On 4/19/24 5:24 PM, Tim Harvey wrote:

On Thu, Apr 18, 2024 at 11:42 AM Marek Vasut  wrote:


On 4/18/24 8:02 PM, Fabio Estevam wrote:

Hi Tim,

On Thu, Apr 18, 2024 at 2:54 PM Tim Harvey  wrote:


Fabio, if you enable CONFIG_DM_RNG on an imx8m{m,p}_evk do you get the
following in the SPL?
Couldn't bind rng driver (-96)
SEC0:  RNG instantiated

sec_init failed!


Yes, if I add CONFIG_DM_RNG=y to imx8mm_evk_defconfig I get:

U-Boot SPL 2024.04-00793-g3434b88d2c2f-dirty (Apr 18 2024 - 14:58:57 -0300)
No pmic
Couldn't bind rng driver (-96)
SEC0:  RNG instantiated

sec_init failed!


Interesting. Which TFA blob version do you use ? I used the mainline
2.10 for my tests.


Marek,

Were you able to reproduce this as well with the board you enabled
DM_RNG for? If it does work fine what dtb were you using... perhaps
there is something in its u-boot.dtsi that we need?


This one arch/arm/dts/imx8mp-dhcom-pdk3.dts , see log below. The build 
has a few extra patches in it, but nothing which affects the KASLR:


$ export SOURCE_DATE_EPOCH=1672531200 ; echo tst > .scmversion
$ make imx8mp_dhcom_pdk3_defconfig ; make

U-Boot SPL 2024.07-rc1tst (Jan 01 2023 - 00:00:00 +)
DDR:   4096 MiB [0x5]
DDR:   Inline ECC enabled
WDT:   Started watchdog@3028 with servicing every 1000ms (60s timeout)
Trying to boot from BOOTROM
Boot Stage: Primary boot
image offset 0x1000, pagesize 0x1, ivt offset 0x0
NOTICE:  Do not release JR0 to NS as it can be used by HAB
NOTICE:  BL31: v2.10.0  (release):v2.10.0-5-gfb51ca229
NOTICE:  BL31: Built : 20:30:36, Apr 23 2024


U-Boot 2024.07-rc1tst (Jan 01 2023 - 00:00:00 +)

CPU:   Freescale i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 70C
Reset cause: POR
Model: DH electronics i.MX8M Plus DHCOM Premium Developer Kit (3)
DRAM:  3.5 GiB
Core:  183 devices, 34 uclasses, devicetree: separate
WDT:   Started watchdog@3028 with servicing every 1000ms (60s timeout)
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from SPIFlash... SF: Detected w25q128jw with page 
size 256 Bytes, erase size 4 KiB, total 16 MiB

OK
In:serial
Out:   serial
Err:   serial
SEC0:  RNG instantiated
Net:   eth1: ethernet@30be, eth0: ethernet@30bf
...


The error -EPFNOSUPPORT is interesting and helps point to the only
place it can be where the comment says the strange errno is to make
this easier to find:
https://elixir.bootlin.com/u-boot/latest/source/drivers/core/uclass.c#L70:
 if (!uc_drv) {
 debug("Cannot find uclass for id %d: please add the
UCLASS_DRIVER() declaration for this UCLASS_... id\n",
   id);
 /*
  * Use a strange error to make this case easier to find. When
  * a uclass is not available it can prevent driver model from
  * starting up and this failure is otherwise hard to debug.
  */
 return -EPFNOSUPPORT;
 }

I'm not very familiar with the dm driver binding - does the
U-BOOT_DRIVER usage in drivers/crypto/fsl/rng.c need to be refactored
to use UCLASS_DRIVER for it to be usable in both SPL and U-Boot?


I don't think you need the CAAM RNG in SPL in the first place, or do you ?


Honestly I don't know why we need DM_RNG in SPL anyway and we could
just add support for disabling it there to avoid unwanted bloat.


I think you can disable it , yes.


Re: [PATCH] usb: dwc2: Add in version 4xx compatibility

2024-04-23 Thread Marek Vasut

On 4/23/24 9:09 AM, Mattijs Korpershoek wrote:

Hi Greg,

On ven., avril 19, 2024 at 15:21, Greg Malysa  wrote:


Hi Mattijs,


Please avoid top-posting when replying, it makes following the
discussion more difficult:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#use-trimmed-interleaved-replies-in-email-discussions


Will do. Sorry about that; I'm still learning about this approach to email.


No worries. There are quite some things to learn and we probably all did
this wrong when starting. Thank you for taking the time to learn and to 
contribute!




Looking at
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c

we can see that the following is added:
#define DWC2_CORE_REV_MASK  0x

This makes me believe that the versioning follows a well known pattern.


I can submit a v2 next week to bring it in line with the kernel's approach.


To me, it's fine as is.




Note that this change is also part of:
https://lore.kernel.org/all/20240328131811.94559-1-seashell11234...@gmail.com/


Or if you prefer I can also drop our patch and we can pursue this
linked patch with both 4xx compatibility and the 420a reset handling.


I think the patch you submitted is fine by itself, but I'd let Marek
decide since he is the maintainer for this part.

If you have access to the hardware that has a 4.20a dwc2 controller,
maybe you can help testing the patch above patch as well?


+CC Liu on this thread, maybe it is best if the two of you figure out 
the best common approach that works for you both ?


Re: [PATCH v4] mmc: Poll CD in case cyclic framework is enabled

2024-04-23 Thread Marek Vasut

On 3/16/24 9:13 PM, Marek Vasut wrote:

In case the cyclic framework is enabled, poll the card detect of already
initialized cards and deinitialize them in case they are removed. Since
the card initialization is a longer process and card initialization is
done on first access to an uninitialized card anyway, avoid initializing
newly detected uninitialized cards in the cyclic callback.


Any input on this ?


[PATCH] ARM: dts: imx: Enable PCIe and NVMe on DH i.MX8M Plus DHCOM PDK3

2024-04-23 Thread Marek Vasut
Enable PCIe/NVMe support on DH i.MX8M Plus DHCOM PDK3. Except for
the configuration options which are enabled, add slight adjustment
to board u-boot.dtsi, which is necessary as there is currently no
driver for the I2C PCIe clock generator. Since the generator is
strapped to be always on, it is possible to supplant the generator
functionality by fixed-clock.

Signed-off-by: Marek Vasut 
---
Cc: "NXP i.MX U-Boot Team" 
Cc: Fabio Estevam 
Cc: Simon Glass 
Cc: Stefano Babic 
Cc: Tom Rini 
Cc: u-b...@dh-electronics.com
Cc: u-boot@lists.denx.de
---
 arch/arm/dts/imx8mp-dhcom-pdk3-u-boot.dtsi | 12 
 configs/imx8mp_dhcom_pdk3_defconfig|  5 +
 2 files changed, 17 insertions(+)

diff --git a/arch/arm/dts/imx8mp-dhcom-pdk3-u-boot.dtsi 
b/arch/arm/dts/imx8mp-dhcom-pdk3-u-boot.dtsi
index 040f333c52d..b0b99d51856 100644
--- a/arch/arm/dts/imx8mp-dhcom-pdk3-u-boot.dtsi
+++ b/arch/arm/dts/imx8mp-dhcom-pdk3-u-boot.dtsi
@@ -4,3 +4,15 @@
  */
 
 #include "imx8mp-dhcom-u-boot.dtsi"
+
+/ {
+   clk_pcie100: clk-pcie100 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <1>;
+   };
+};
+
+_phy {
+   clocks = <_pcie100>;
+};
diff --git a/configs/imx8mp_dhcom_pdk3_defconfig 
b/configs/imx8mp_dhcom_pdk3_defconfig
index a42dc27aff8..019595edda8 100644
--- a/configs/imx8mp_dhcom_pdk3_defconfig
+++ b/configs/imx8mp_dhcom_pdk3_defconfig
@@ -31,6 +31,7 @@ CONFIG_ENV_OFFSET_REDUND=0xFF
 CONFIG_IMX_BOOTAUX=y
 CONFIG_SPL_IMX_ROMAPI_LOADADDR=0x4800
 CONFIG_SYS_LOAD_ADDR=0x5000
+CONFIG_PCI=y
 CONFIG_DEBUG_UART=y
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
 CONFIG_FIT=y
@@ -104,6 +105,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_BKOPS_ENABLE=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_PART=y
+CONFIG_CMD_PCI=y
 CONFIG_CMD_READ=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
@@ -218,7 +220,10 @@ CONFIG_DWC_ETH_QOS_IMX=y
 CONFIG_FEC_MXC=y
 CONFIG_RGMII=y
 CONFIG_MII=y
+CONFIG_NVME_PCI=y
+CONFIG_PCIE_DW_IMX=y
 CONFIG_PHY_IMX8MQ_USB=y
+CONFIG_PHY_IMX8M_PCIE=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
-- 
2.43.0



Re: [PATCH v3 01/11] rockchip: sdram: Support getting banks from TPL for rk3568 and rk3588

2024-04-23 Thread Jonas Karlman
Hi Quentin,

On 2024-04-15 16:16, Quentin Schulz wrote:
> From: Quentin Schulz 
> 
> Allow RK3568 and RK3588 based boards to get the RAM bank configuration
> from the ROCKCHIP_TPL stage instead of the current logic. This fixes
> both an issue where 256MB of RAM is blocked for devices with >= 4GB
> of RAM and where memory holes need to be defined for devices with
> more than 16GB of RAM. In the event that neither SoC is used or the
> ROCKCHIP_TPL stage is not used, fall back to existing logic.
> 
> The logic handles creating memory holes from reserved memory areas
> defined in mem_map data struct in SoC C files, but only if the DRAM area
> overlaps with one reserved memory area.
> 
> Since mem_map data struct is used, it should be rather straightforward
> to add support for other SoCs if needed.
> 
> The logic is taken from Rockchip's U-Boot tag linux-5.10-gen-rkr4.1
> (e08e32143dd).
> 
> Note that Rockchip's U-Boot/TF-A/OP-TEE modify the ATAGS at runtime as
> well, but the DDR_MEM tag seems to be pretty much stable (though BL31
> seems to be reserving only 1MB for itself at the moment).
> 
> u32 for ATAGS is used because it simplifies the pointer arithmetic and
> it's expected that ATAGS are always below the 4GB limit allowed by u32.
> 
> Co-developed-by: Chris Morgan 
> Signed-off-by: Chris Morgan 
> Signed-off-by: Quentin Schulz 
> ---
>  arch/arm/mach-rockchip/sdram.c | 240 
> +
>  1 file changed, 240 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c
> index 0d9a0aef6f5..5b1ff1e5495 100644
> --- a/arch/arm/mach-rockchip/sdram.c
> +++ b/arch/arm/mach-rockchip/sdram.c
> @@ -8,6 +8,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -35,12 +36,251 @@ struct tos_parameter_t {
>   s64 reserve[8];
>  };
>  
> +/* Tag size and offset */
> +#define ATAGS_SIZE   SZ_8K
> +#define ATAGS_OFFSET (SZ_2M - ATAGS_SIZE)
> +#define ATAGS_PHYS_BASE  (CFG_SYS_SDRAM_BASE + ATAGS_OFFSET)
> +#define ATAGS_PHYS_END   (ATAGS_PHYS_BASE + ATAGS_SIZE)
> +
> +/* ATAGS memory structures */
> +
> +enum tag_magic {
> + ATAG_NONE,
> + ATAG_CORE = 0x54410001,
> + ATAG_SERIAL = 0x54410050,
> + ATAG_DDR_MEM = 0x54410052,
> + ATAG_MAX = 0x544100ff,
> +};
> +
> +/*
> + * An ATAG contains the following data:
> + *  - header
> + *u32 size // sizeof(header + tag data) / sizeof(u32)
> + *u32 magic
> + *  - tag data
> + */
> +
> +struct tag_header {
> + u32 size;
> + u32 magic;
> +} __packed;
> +
> +/*
> + * DDR_MEM tag bank is storing data this way:
> + *  - address0
> + *  - address1
> + *  - [...]
> + *  - addressX
> + *  - size0
> + *  - size1
> + *  - [...]
> + *  - sizeX
> + *
> + *  with X being tag_ddr_mem.count - 1.
> + */
> +struct tag_ddr_mem {
> + u32 count;
> + u32 version;
> + u64 bank[20];
> + u32 flags;
> + u32 data[2];
> + u32 hash;
> +} __packed;
> +
> +static u32 js_hash(const void *buf, u32 len)
> +{
> + u32 i, hash = 0x47C6A7E6;
> +
> + if (!buf || !len)
> + return hash;
> +
> + for (i = 0; i < len; i++)
> + hash ^= ((hash << 5) + ((const char *)buf)[i] + (hash >> 2));
> +
> + return hash;
> +}
> +
> +static int rockchip_dram_init_banksize(void)
> +{
> + const struct tag_header *tag_h = NULL;
> + u32 *addr = (void *)ATAGS_PHYS_BASE;
> + struct tag_ddr_mem *ddr_info;
> + u32 calc_hash;
> + u8 i, j;
> +
> + if (!IS_ENABLED(CONFIG_ROCKCHIP_RK3588) &&
> + !IS_ENABLED(CONFIG_ROCKCHIP_RK3568))
> + return -ENOTSUPP;
> +
> + if (!IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL))
> + return -ENOTSUPP;
> +
> + /* Find DDR_MEM tag */
> + while (addr < (u32 *)ATAGS_PHYS_END) {
> + tag_h = (const struct tag_header *)addr;
> +
> + if (!tag_h->size) {
> + debug("End of ATAGS (0-size tag), no DDR_MEM found\n");
> + return -ENODATA;
> + }
> +
> + if (tag_h->magic == ATAG_DDR_MEM)
> + break;
> +
> + switch (tag_h->magic) {
> + case ATAG_NONE:
> + case ATAG_CORE:
> + case ATAG_SERIAL ... ATAG_MAX:
> + addr += tag_h->size;
> + continue;
> + default:
> + debug("Invalid magic (0x%08x) for ATAG at 0x%p\n",
> +   tag_h->magic, addr);
> + return -EINVAL;
> + }
> + }
> +
> + if (addr >= (u32 *)ATAGS_PHYS_END ||
> + (tag_h && (addr + tag_h->size > (u32 *)ATAGS_PHYS_END))) {
> + debug("End of ATAGS, no DDR_MEM found\n");
> + return -ENODATA;
> + }
> +
> + /* Data is right after the magic member of the tag_header struct */
> + ddr_info = (struct tag_ddr_mem *)(_h->magic + 1);
> + if 

Re: [PULL] Please pull qcom/qcom-main

2024-04-23 Thread Tom Rini
On Tue, Apr 23, 2024 at 03:46:19PM +0200, Caleb Connolly wrote:

> Overshot the -rc1 deadline, but I hope these can still make in for 2024.07.
> 
> Support is added for 5 new Qualcomm SoCs:
> 
> * QCM2290 and SM6115 are low and mid range SoCs used on the RB1 and RB2
>   respectively. SM6115 is also used in some mid-range smartphones/tablets.
>   Initial support includes buttons and USB (host and gadget).
> * SM8250 is a flagship SoC from 2020 used on the RB5, as well as many flagship
>   smartphones. The board can boot to a U-Boot prompt, but is missing 
> regulators
>   necessary for USB support.
> * SM8550, and SM8650 are flagship mobile SoCs from 2023 and 2024
>   respectively. Found on many high end smartphones.
> 
> In addition:
> 
> * Support is added for the Schneider HMIBSC board.
> * mach-snapdragon switches to OF_UPSTREAM
> * IPQ40xx gets several regressions fixed and some overall cleanup.
> * The MSM serial driver gains the ability to generate the bit-clock
>   automatically, no longer relying on a custom DT property.
> * The Qualcomm SMMU driver gets a generic compatible (so per-SoC compatibles
>   don't need to be added).
> * Support for the GENI I2C controller is added.
> * The qcom SPMI driver has SPMI v5 support fixed, and v7 support added.
> * The qcom sdhci driver gets some fixes for SDCC v5 support.
> * SDM845 gains sdcard support
> * Support is added for the Synopsys eUSB2 PHY driver (used on SM8550 and 
> SM8650)
> * SYS_INIT_SP_BSS_OFFSET is set to 1.5M to give us more space for FDTs.
> * RB2 gets a work-around to fix the USB dr_mode property before booting Linux.
> 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH] cmd: gpt: initialize partition table

2024-04-23 Thread Kishan Dudhatra
Yes, You are right I observed the issue in MMC device, device required reboot 
after writing partitions.

I have checked the fix is required for all the blk device's not just mmc device.

I have updated the changes in v2.

Thanks,
Kishan






From: Tom Rini 
Sent: Monday, April 22, 2024 11:14:47 PM
To: Kishan Dudhatra 
Cc: u-boot@lists.denx.de 
Subject: Re: [PATCH] cmd: gpt: initialize partition table

CAUTION: This email originated from outside the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.



[PATCH 3/3] ARM: dts: imx: Convert i.MX8M flash.bin image generation to binman

2024-04-23 Thread Marek Vasut
Rework the flash.bin image generation such that it uses the new binman
nxp_imx8mimage etype. This way, the flash.bin is assembled in correct
order using plain binman, without any workarounds or sections assembled
in special DT node order.

Signed-off-by: Marek Vasut 
---
WARNING: This is very likely to break corner case uses, so please do
 test this on your platform.
NOTE: This also opens the implementation for proper CST signing etype,
  the CST signing would look similar to nxp-imx8mimage section, and
  it would likely wrap the whole topmost section {} in the binman
  node.
---
Cc: "NXP i.MX U-Boot Team" 
Cc: Adam Ford 
Cc: Alper Nebi Yasak 
Cc: Andrejs Cainikovs 
Cc: Angus Ainslie 
Cc: Emanuele Ghidoli 
Cc: Fabio Estevam 
Cc: Francesco Dolcini 
Cc: Marcel Ziswiler 
Cc: Rasmus Villemoes 
Cc: Simon Glass 
Cc: Stefan Eichenberger 
Cc: Stefano Babic 
Cc: Tim Harvey 
Cc: Tom Rini 
Cc: ker...@puri.sm
Cc: u-b...@dh-electronics.com
Cc: u-boot@lists.denx.de
---
 arch/arm/dts/imx8mm-u-boot.dtsi   | 126 ++-
 .../dts/imx8mm-verdin-wifi-dev-u-boot.dtsi|   8 +-
 arch/arm/dts/imx8mn-u-boot.dtsi   | 147 +++---
 arch/arm/dts/imx8mp-dhcom-u-boot.dtsi |   2 +-
 arch/arm/dts/imx8mp-rsb3720-a1-u-boot.dtsi|   2 +-
 arch/arm/dts/imx8mp-u-boot.dtsi   |  96 +---
 arch/arm/dts/imx8mq-librem5-r4-u-boot.dtsi|  15 +-
 arch/arm/dts/imx8mq-u-boot.dtsi   | 109 +
 8 files changed, 203 insertions(+), 302 deletions(-)

diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi
index 06f2f73a03f..6ab8f66256e 100644
--- a/arch/arm/dts/imx8mm-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-u-boot.dtsi
@@ -5,7 +5,6 @@
 
 / {
binman: binman {
-   multiple-images;
};
 
 #ifdef CONFIG_OPTEE
@@ -43,56 +42,61 @@
 };
 
  {
-   u-boot-spl-ddr {
-   align = <4>;
-   align-size = <4>;
-   filename = "u-boot-spl-ddr.bin";
-   pad-byte = <0xff>;
-
-   u-boot-spl {
-   align-end = <4>;
-   filename = "u-boot-spl.bin";
-   };
+   filename = "flash.bin";
+   section {
+   pad-byte = <0x00>;
 
-   ddr-1d-imem-fw {
-   filename = "lpddr4_pmu_train_1d_imem.bin";
-   align-end = <4>;
+#ifdef CONFIG_FSPI_CONF_HEADER
+   fspi_conf_block {
+   filename = CONFIG_FSPI_CONF_FILE;
type = "blob-ext";
+   size = <0x1000>;
};
+#endif
 
-   ddr-1d-dmem-fw {
-   filename = "lpddr4_pmu_train_1d_dmem.bin";
-   align-end = <4>;
-   type = "blob-ext";
-   };
+   nxp-imx8mimage {
+   filename = "u-boot-spl-mkimage.bin";
+   nxp,boot-from = "sd";
+   nxp,rom-version = <1>;
+   nxp,loader-address = ;
+   args;   /* Needed by mkimage etype superclass */
 
-   ddr-2d-imem-fw {
-   filename = "lpddr4_pmu_train_2d_imem.bin";
-   align-end = <4>;
-   type = "blob-ext";
-   };
+   section {
+   align = <4>;
+   align-size = <4>;
+   filename = "u-boot-spl-ddr.bin";
+   pad-byte = <0xff>;
 
-   ddr-2d-dmem-fw {
-   filename = "lpddr4_pmu_train_2d_dmem.bin";
-   align-end = <4>;
-   type = "blob-ext";
-   };
-   };
+   u-boot-spl {
+   align-end = <4>;
+   filename = "u-boot-spl.bin";
+   };
 
-   spl {
-   filename = "spl.bin";
+   ddr-1d-imem-fw {
+   filename = 
"lpddr4_pmu_train_1d_imem.bin";
+   align-end = <4>;
+   type = "blob-ext";
+   };
 
-   mkimage {
-   args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
0x7e1000";
+   ddr-1d-dmem-fw {
+   filename = 
"lpddr4_pmu_train_1d_dmem.bin";
+   align-end = <4>;
+   type = "blob-ext";
+   };
 
-   blob {
-   filename = "u-boot-spl-ddr.bin";
+   ddr-2d-imem-fw {
+   filename = 

[PATCH 2/3] ARM: dts: imx: Switch Ronetix iMX8MQ-CM to imx8mq-u-boot.dtsi

2024-04-23 Thread Marek Vasut
Include imx8mq-u-boot.dtsi in the board -u-boot.dtsi to pull in binman
configuration instead of duplicating it in the board -u-boot.dtsi again.
Drop the duplicate binman configuration.

Signed-off-by: Marek Vasut 
---
Cc: "NXP i.MX U-Boot Team" 
Cc: Adam Ford 
Cc: Alper Nebi Yasak 
Cc: Andrejs Cainikovs 
Cc: Angus Ainslie 
Cc: Emanuele Ghidoli 
Cc: Fabio Estevam 
Cc: Francesco Dolcini 
Cc: Marcel Ziswiler 
Cc: Rasmus Villemoes 
Cc: Simon Glass 
Cc: Stefan Eichenberger 
Cc: Stefano Babic 
Cc: Tim Harvey 
Cc: Tom Rini 
Cc: ker...@puri.sm
Cc: u-b...@dh-electronics.com
Cc: u-boot@lists.denx.de
---
 arch/arm/dts/imx8mq-cm-u-boot.dtsi | 111 +
 1 file changed, 1 insertion(+), 110 deletions(-)

diff --git a/arch/arm/dts/imx8mq-cm-u-boot.dtsi 
b/arch/arm/dts/imx8mq-cm-u-boot.dtsi
index e23998f5aba..819501337e9 100644
--- a/arch/arm/dts/imx8mq-cm-u-boot.dtsi
+++ b/arch/arm/dts/imx8mq-cm-u-boot.dtsi
@@ -3,11 +3,7 @@
  * Copyright 2019 NXP
  */
 
-/ {
-   binman: binman {
-   multiple-images;
-   };
-};
+#include "imx8mq-u-boot.dtsi"
 
 _uart1 {
bootph-pre-ram;
@@ -16,108 +12,3 @@
  {
bootph-pre-ram;
 };
-
- {
-u-boot-spl-ddr {
-   filename = "u-boot-spl-ddr.bin";
-   pad-byte = <0xff>;
-   align-size = <4>;
-   align = <4>;
-
-   u-boot-spl {
-   align-end = <4>;
-   };
-
-   ddr-1d-imem-fw {
-   filename = "lpddr4_pmu_train_1d_imem.bin";
-   type = "blob-ext";
-   align-end = <4>;
-   };
-
-   ddr-1d-dmem-fw {
-   filename = "lpddr4_pmu_train_1d_dmem.bin";
-   type = "blob-ext";
-   align-end = <4>;
-   };
-
-   ddr-2d-imem-fw {
-   filename = "lpddr4_pmu_train_2d_imem.bin";
-   type = "blob-ext";
-   align-end = <4>;
-   };
-
-   ddr-2d-dmem-fw {
-   filename = "lpddr4_pmu_train_2d_dmem.bin";
-   type = "blob-ext";
-   align-end = <4>;
-   };
-   };
-
-   flash {
-   mkimage {
-   args = "-n spl/u-boot-spl.cfgout -T imx8mimage -e 
0x7e1000";
-
-   blob {
-   filename = "u-boot-spl-ddr.bin";
-   };
-   };
-   };
-
-   itb {
-   filename = "u-boot.itb";
-
-   fit {
-   description = "Configuration to load ATF before U-Boot";
-   #address-cells = <1>;
-   fit,external-offset = ;
-
-   images {
-   uboot {
-   description = "U-Boot (64-bit)";
-   type = "standalone";
-   arch = "arm64";
-   compression = "none";
-   load = ;
-
-   uboot_blob: blob-ext {
-   filename = "u-boot-nodtb.bin";
-   };
-   };
-
-   atf {
-   description = "ARM Trusted Firmware";
-   type = "firmware";
-   arch = "arm64";
-   compression = "none";
-   load = <0x91>;
-   entry = <0x91>;
-
-   atf_blob: blob-ext {
-   filename = "bl31.bin";
-   };
-   };
-
-   fdt {
-   description = "NAME";
-   type = "flat_dt";
-   compression = "none";
-
-   uboot_fdt_blob: blob-ext {
-   filename = "u-boot.dtb";
-   };
-   };
-   };
-
-   configurations {
-   default = "conf";
-
-   conf {
-   description = "NAME";
-   firmware = "uboot";
-   loadables = "atf";
-   fdt = "fdt";
-   };
-   };
-   };
-   };
-};
-- 
2.43.0



[PATCH 1/3] binman: Add nxp_imx8mimage etype

2024-04-23 Thread Marek Vasut
Add new binman etype derived from mkimage etype which generates configuration
input file for mkimage -T imx8mimage, and runs the mkimage on input data. The
mkimage -T imx8mimage is used to generate combined image with SPL and DDR PHY
blobs which is bootable on i.MX8M.

The configuration file generated here is equivalent of imx8mimage.cfg, which
is the file passed to '$ mkimage -T imx8mimage -n imx8mimage.cfg ...' . The
settings generated into the imx8mimage.cfg file are configured via supported
binman DT properties, nxp,boot-from, nxp,loader-address, nxp,rom-version.

Signed-off-by: Marek Vasut 
---
Cc: "NXP i.MX U-Boot Team" 
Cc: Adam Ford 
Cc: Alper Nebi Yasak 
Cc: Andrejs Cainikovs 
Cc: Angus Ainslie 
Cc: Emanuele Ghidoli 
Cc: Fabio Estevam 
Cc: Francesco Dolcini 
Cc: Marcel Ziswiler 
Cc: Rasmus Villemoes 
Cc: Simon Glass 
Cc: Stefan Eichenberger 
Cc: Stefano Babic 
Cc: Tim Harvey 
Cc: Tom Rini 
Cc: ker...@puri.sm
Cc: u-b...@dh-electronics.com
Cc: u-boot@lists.denx.de
---
 tools/binman/etype/nxp_imx8mimage.py | 73 
 1 file changed, 73 insertions(+)
 create mode 100644 tools/binman/etype/nxp_imx8mimage.py

diff --git a/tools/binman/etype/nxp_imx8mimage.py 
b/tools/binman/etype/nxp_imx8mimage.py
new file mode 100644
index 000..5a106e0a76e
--- /dev/null
+++ b/tools/binman/etype/nxp_imx8mimage.py
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2023-2024 Marek Vasut 
+# Written with much help from Simon Glass 
+#
+# Entry-type module for generating the i.MX8M mkimage -T imx8mimage
+# configuration file and invocation of mkimage -T imx8mimage on the
+# configuration file and input data.
+#
+
+from collections import OrderedDict
+
+from binman.entry import Entry
+from binman.etype.mkimage import Entry_mkimage
+from binman import elf
+from dtoc import fdt_util
+from u_boot_pylib import tools
+
+class Entry_nxp_imx8mimage(Entry_mkimage):
+"""NXP i.MX8M imx8mimage .cfg file generator and mkimage invoker
+
+Properties / Entry arguments:
+- nxp,boot-from - device to boot from (e.g. 'sd')
+- nxp,loader-address - loader address (SPL text base)
+- nxp,rom-version - BootROM version ('2' for i.MX8M Nano and Plus)
+"""
+
+def __init__(self, section, etype, node):
+super().__init__(section, etype, node)
+self.required_props = ['nxp,boot-from', 'nxp,rom-version', 
'nxp,loader-address']
+
+def ReadNode(self):
+super().ReadNode()
+self.boot_from = fdt_util.GetString(self._node, 'nxp,boot-from')
+self.loader_address = fdt_util.GetInt(self._node, 'nxp,loader-address')
+self.rom_version = fdt_util.GetInt(self._node, 'nxp,rom-version')
+self.ReadEntries()
+
+def BuildSectionData(self, required):
+_, input_fname, uniq = self.collect_contents_to_file(
+self._entries.values(), 'input')
+# Generate mkimage configuration file similar to imx8mimage.cfg
+# and pass it to mkimage to generate SPL image for us here.
+cfg_fname = tools.get_output_filename('nxp.imx8mimage.cfg.%s' % uniq)
+with open(cfg_fname, 'w') as outf:
+print('ROM_VERSION v%d' % self.rom_version, file=outf)
+print('BOOT_FROM %s' % self.boot_from, file=outf)
+print('LOADER %s %#x' % (input_fname, self.loader_address), 
file=outf)
+
+output_fname = tools.get_output_filename(f'cfg-out.{uniq}')
+args = ['-d', input_fname, '-n', cfg_fname, '-T', 'imx8mimage',
+output_fname]
+if self.mkimage.run_cmd(*args) is not None:
+return tools.read_file(output_fname)
+else:
+# Bintool is missing; just use the input data as the output
+self.record_missing_bintool(self.mkimage)
+return data
+
+def SetImagePos(self, image_pos):
+# Customized SoC specific SetImagePos which skips the mkimage etype
+# implementation and removes the 0x48 offset introduced there. That
+# offset is only used for uImage/fitImage, which is not the case in
+# here.
+upto = 0x00
+for entry in super().GetEntries().values():
+entry.SetOffsetSize(upto, None)
+
+# Give up if any entries lack a size
+if entry.size is None:
+return
+upto += entry.size
+
+super(Entry_mkimage, self).SetImagePos(image_pos)
-- 
2.43.0



Re: [PATCH 2/2] tools: type arguemnts

2024-04-23 Thread Fabio Estevam
On Fri, Apr 19, 2024 at 9:13 AM Heinrich Schuchardt
 wrote:
>
> %s/arguemnts/arguemnts/

There is a typo in the Subject: %s/type/typo/


[PATCH v1] board: toradex: colibri-imx(6ull|imx7): Fix missing fdt_fixup boot error

2024-04-23 Thread Francesco Dolcini
From: Francesco Dolcini 

In commit 51aaaf5e7975 ("board: toradex: imx: Remove not needed env variables")
the empty definition of fdt_fixup variable was removed, however this was
still referenced from the boot command leading to boot failures:
 ## Error: \"fdt_fixup\" not defined`

Fix this by removing "run fdt_fixup" from the boot command and instead
enable CONFIG_OF_ENV_SETUP in the defconfig that would achieve the same
but in a more robust way (it works fine even if the variable is not
defined).

Fixes: 51aaaf5e7975 ("board: toradex: imx: Remove not needed env variables")
Signed-off-by: Francesco Dolcini 
---
 configs/colibri-imx6ull_defconfig | 1 +
 configs/colibri_imx7_defconfig| 1 +
 include/configs/colibri-imx6ull.h | 2 +-
 include/configs/colibri_imx7.h| 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configs/colibri-imx6ull_defconfig 
b/configs/colibri-imx6ull_defconfig
index fc10d7f66a60..4a0ff029ac75 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -18,6 +18,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
+CONFIG_OF_ENV_SETUP=y
 CONFIG_BOOTCOMMAND="run ubiboot || run distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
imx6ull-colibri${variant}-${fdt_board}.dtb"
diff --git a/configs/colibri_imx7_defconfig b/configs/colibri_imx7_defconfig
index 16f923b07c22..f2802b10fa8a 100644
--- a/configs/colibri_imx7_defconfig
+++ b/configs/colibri_imx7_defconfig
@@ -19,6 +19,7 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
+CONFIG_OF_ENV_SETUP=y
 CONFIG_BOOTCOMMAND="run ubiboot ; echo ; echo ubiboot failed ; run 
distro_bootcmd;"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile 
${soc}-colibri-${fdt_board}.dtb "
diff --git a/include/configs/colibri-imx6ull.h 
b/include/configs/colibri-imx6ull.h
index 7c9d633b68d9..8860ceec1a0a 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -53,7 +53,7 @@
"ubi part ubi &&" \
"ubi read ${kernel_addr_r} kernel && " \
"ubi read ${fdt_addr_r} dtb && " \
-   "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
+   "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
 
 #if defined(CONFIG_TARGET_COLIBRI_IMX6ULL_NAND)
 /* Run Distro Boot script if ubiboot fails */
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index c34f1f903df6..33133a0b96e1 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -94,7 +94,7 @@
"ubi part ubi && run m4boot && " \
"ubi read ${kernel_addr_r} kernel && " \
"ubi read ${fdt_addr_r} dtb && " \
-   "run fdt_fixup && bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
+   "bootz ${kernel_addr_r} - ${fdt_addr_r}\0" \
 
 #if defined(CONFIG_TARGET_COLIBRI_IMX7_NAND)
 #define MODULE_EXTRA_ENV_SETTINGS \
-- 
2.39.2



Re: RISC-V u-boot unable to boot QEMU using '-cpu max'

2024-04-23 Thread Conor Dooley
On Tue, Apr 23, 2024 at 09:52:06AM -0300, Daniel Henrique Barboza wrote:
> 
> 
> On 4/23/24 09:41, Conor Dooley wrote:
> > On Tue, Apr 23, 2024 at 01:34:42PM +0800, Leo Liang wrote:
> > > On Mon, Apr 22, 2024 at 04:43:59PM -0300, Daniel Henrique Barboza wrote:
> > > > [EXTERNAL MAIL]
> > > > 
> > > > Hi,
> > > > 
> > > > In QEMU we have a 'max' type CPU that implements (almost) all 
> > > > extensions that QEMU
> > > > is able to emulate. Recently, in QEMU commit 249e0905d05, we bumped the 
> > > > extensions
> > > > for this CPU.
> > > > 
> > > > And after this commit this CPU is now unable to boot a guest using 
> > > > upstream
> > > > u-boot. Here's the error being thrown:
> > > > 
> > > > qemu-system-riscv64 \
> > > >  -machine virt -nographic -m 8G -smp 8 \
> > > >  -cpu max -kernel uboot.elf (...)
> > > > (...)
> > > > 
> > > > initcall sequence 8027c3e8 failed at call 8021259e 
> > > > (err=-28)
> > > > ### ERROR ### Please RESET the board ###
> > > > 
> > > > 
> > > > I can get the guest to boot if I disable the following extensions from 
> > > > the 'max' CPU:
> > > > 
> > > >   -cpu max,zfbfmin=false,zvfbfmin=false,zvfbfwma=false
> > > > 
> > > > Due to QEMU extension dependencies I'm not able to disable these 
> > > > individually. What I can
> > > > say is that u-boot isn't playing ball to at least one of them.
> > > > 
> > > > Is this an u-boot bug? Up to this point I was assuming that u-boot 
> > > > would silently ignore
> > > > hart extensions that it doesn't support.
> > > 
> > > Hi Daniel,
> > > 
> > > Which u-boot version are you using?
> > > 
> > > I think this issue is fixed by the following patch set sent by Conor.
> > > 
> > >   f39b1b77d8 riscv: support extension probing using riscv, isa-extensions
> > >   b90edde701 riscv: don't read riscv, isa in the riscv cpu's get_desc()
> > > 
> > > I've tested and can reproduce the issue you mentioned if these two 
> > > patches are reverted.
> > > 
> > > Could you try with the lastest u-boot master branch again?
> > > 
> > > 
> > > For reference, my testing commands are as follows:
> > > 1. cd ${u-boot} && make qemu-riscv64_defconfig && make -j`nproc`
> > > 2. ./${qemu}/build/qemu-system-riscv64 -nographic -machine virt -cpu max 
> > > -bios u-boot.bin -m 8G -smp 8
> > > 
> > > - u-boot branch (commit): master (38ea74d6d5c0 "Prepare v2024.07-rc1")
> > > - qemu branch (commit): master (62dbe54c24db "Update version for 
> > > v9.0.0-rc4 release")
> > 
> > I'll go take a look at this, it's possible that my patches only hide the
> > problem due to the new property being prioritised.
> 
> 
> Don't bother. I just checked with most recent u-boot master and I can't 
> reproduce the
> problem, as Leo said.

My "fear" was that new QEMU + new U-Boot meant that the
riscv,isa-extensions codepath was in use and there was something lurking in
the riscv,isa parsing which had a problem. Fortunately, I think that's
not the case, as the fix seems to be b90edde701 "riscv: don't read riscv,isa
in the riscv cpu's get_desc()" rather than f39b1b77d8 "riscv: support
extension probing using riscv, isa-extensions".

I am, however, not going to look into why exactly it was failing before,
I'm satisfied once the riscv,isa parsing isn't broken in master.

> 
> I apologize for the noise. I failed to fetch the latest upstream and do a last
> test before posting it here.
> 
> We were discussing here and there about disabling these extensions in the 
> 'max'
> CPU in QEMU if u-boot wasn't able to handle them. I'm happy to see that u-boot
> is now able to do so and we can keep the 'max' CPU as is.
> 
> 
> Thanks for the help,
> 
> Daniel
> 


signature.asc
Description: PGP signature


[PATCH v2] usb: dwc3: support USB 3.1 controllers

2024-04-23 Thread Caleb Connolly
The revision is different for these, add the additional check as in
xhci-dwc3 core_init code.

Equivalent upstream Linux patch:
690fb3718a70 ("usb: dwc3: Support Synopsys USB 3.1 IP")

Reviewed-by: Neil Armstrong 
Tested-by: Neil Armstrong  # on SM8550
Reviewed-by: Mattijs Korpershoek 
Reviewed-by: Marek Vasut 
Signed-off-by: Caleb Connolly 
---
Changes since v1:
* Reference Linux patch
* V1: 
https://lore.kernel.org/u-boot/20240411160527.835767-1-caleb.conno...@linaro.org
---
 drivers/usb/dwc3/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 96e850b7170f..db045f5822d4 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -594,9 +594,10 @@ static int dwc3_core_init(struct dwc3 *dwc)
int ret;
 
reg = dwc3_readl(dwc->regs, DWC3_GSNPSID);
/* This should read as U3 followed by revision number */
-   if ((reg & DWC3_GSNPSID_MASK) != 0x5533) {
+   if ((reg & DWC3_GSNPSID_MASK) != 0x5533 &&
+   (reg & DWC3_GSNPSID_MASK) != 0x3331) {
dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
ret = -ENODEV;
goto err0;
}
-- 
2.44.0



Re: [PATCH] sysreset: add Qualcomm PSHOLD reset driver

2024-04-23 Thread Caleb Connolly

Hi Robert,

On 23/04/2024 13:33, Robert Marko wrote:

Number of Qualcomm ARMv7 SoC-s did not use PSCI but rather used PSHOLD
(Qualcomm Power Supply Hold Reset) bit to trigger reset or poweroff.

Qualcomm IPQ40XX is one of them, so provide a simple sysreset driver based
on the upstream Linux one, it is DT compatible as well.


Thanks for the patch.


Signed-off-by: Robert Marko 
---
  drivers/sysreset/Kconfig   |  6 +++
  drivers/sysreset/Makefile  |  1 +
  drivers/sysreset/sysreset_msm-pshold.c | 56 ++
  3 files changed, 63 insertions(+)
  create mode 100644 drivers/sysreset/sysreset_msm-pshold.c

diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 49c0787b26..30ff9e576d 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -235,6 +235,12 @@ config SYSRESET_RAA215300
help
  Add support for the system reboot via the Renesas RAA215300 PMIC.
  
+config SYSRESET_MSM_PSHOLD


For the sake of consistency, please use QCOM instead of MSM (ditto for 
the driver).


With that,

Reviewed-by: Caleb Connolly 

+   bool "Support sysreset for Qualcomm SoCs via PSHOLD"
+   depends on ARCH_IPQ40XX
+   help
+ Add support for the system reboot on Qualcomm SoCs via PSHOLD.
+
  endif
  
  endmenu

diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index e0e732205d..da61dca8e2 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -28,4 +28,5 @@ obj-$(CONFIG_SYSRESET_RESETCTL) += sysreset_resetctl.o
  obj-$(CONFIG_$(SPL_TPL_)SYSRESET_AT91) += sysreset_at91.o
  obj-$(CONFIG_$(SPL_TPL_)SYSRESET_X86) += sysreset_x86.o
  obj-$(CONFIG_SYSRESET_RAA215300) += sysreset_raa215300.o
+obj-$(CONFIG_SYSRESET_MSM_PSHOLD) += sysreset_msm-pshold.o
  obj-$(CONFIG_TARGET_XTFPGA) += sysreset_xtfpga.o
diff --git a/drivers/sysreset/sysreset_msm-pshold.c 
b/drivers/sysreset/sysreset_msm-pshold.c
new file mode 100644
index 00..d25a412954
--- /dev/null
+++ b/drivers/sysreset/sysreset_msm-pshold.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm PSHOLD reset driver
+ *
+ * Copyright (c) 2024 Sartura Ltd.
+ *
+ * Author: Robert Marko 
+ * Based on the Linux msm-poweroff driver.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct msm_pshold_priv {
+   phys_addr_t base;
+};
+
+static int msm_pshold_request(struct udevice *dev, enum sysreset_t type)
+{
+   struct msm_pshold_priv *priv = dev_get_priv(dev);
+
+   writel(0, priv->base);
+   mdelay(1);
+
+   return 0;
+}
+
+static struct sysreset_ops msm_pshold_ops = {
+   .request = msm_pshold_request,
+};
+
+static int msm_pshold_probe(struct udevice *dev)
+{
+   struct msm_pshold_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr(dev);
+   return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0;
+}
+
+static const struct udevice_id msm_pshold_ids[] = {
+   { .compatible = "qcom,pshold", },
+   { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(msm_pshold) = {
+   .name   = "msm_pshold",
+   .id = UCLASS_SYSRESET,
+   .of_match   = msm_pshold_ids,
+   .probe  = msm_pshold_probe,
+   .priv_auto  = sizeof(struct msm_pshold_priv),
+   .ops= _pshold_ops,
+};


--
// Caleb (they/them)


Re: [PATCH] arm: mach-k3: am642: Fix reset for workaround errata ID i2331

2024-04-23 Thread Wadim Egorov




Am 18.04.24 um 19:58 schrieb Andrew Davis:

To workaround an issue in AM642 we reset the SoC in early boot. For that
we first probed the sysreset driver by calling uclass_get_device(). The
ti-sci sysreset driver is now probed during the ti-sci firmware probe.
Update this call to probe the firmware driver which will then probe
the sysreset driver allowing do_reset() to again function as expected.

Reported-by: Jonathan Humphreys 
Fixes: fc5d40283483 ("firmware: ti_sci: Bind sysreset driver when enabled")
Signed-off-by: Andrew Davis 


Tested-by: Wadim Egorov 

on phycore-am64x


---
  arch/arm/mach-k3/am642_init.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c
index ddf47ef0a9b..80c3cb3479f 100644
--- a/arch/arm/mach-k3/am642_init.c
+++ b/arch/arm/mach-k3/am642_init.c
@@ -226,7 +226,7 @@ void board_init_f(ulong dummy)
 * The warm reset realigns internal clocks and prevents the lockup from
 * happening.
 */
-   ret = uclass_first_device_err(UCLASS_SYSRESET, );
+   ret = uclass_get_device_by_driver(UCLASS_FIRMWARE, DM_DRIVER_GET(ti_sci), 
);
if (ret)
printf("\n%s:uclass device error [%d]\n",__func__,ret);
  


[PULL] Please pull qcom/qcom-main

2024-04-23 Thread Caleb Connolly
Overshot the -rc1 deadline, but I hope these can still make in for 2024.07.

Support is added for 5 new Qualcomm SoCs:

* QCM2290 and SM6115 are low and mid range SoCs used on the RB1 and RB2
  respectively. SM6115 is also used in some mid-range smartphones/tablets.
  Initial support includes buttons and USB (host and gadget).
* SM8250 is a flagship SoC from 2020 used on the RB5, as well as many flagship
  smartphones. The board can boot to a U-Boot prompt, but is missing regulators
  necessary for USB support.
* SM8550, and SM8650 are flagship mobile SoCs from 2023 and 2024
  respectively. Found on many high end smartphones.

In addition:

* Support is added for the Schneider HMIBSC board.
* mach-snapdragon switches to OF_UPSTREAM
* IPQ40xx gets several regressions fixed and some overall cleanup.
* The MSM serial driver gains the ability to generate the bit-clock
  automatically, no longer relying on a custom DT property.
* The Qualcomm SMMU driver gets a generic compatible (so per-SoC compatibles
  don't need to be added).
* Support for the GENI I2C controller is added.
* The qcom SPMI driver has SPMI v5 support fixed, and v7 support added.
* The qcom sdhci driver gets some fixes for SDCC v5 support.
* SDM845 gains sdcard support
* Support is added for the Synopsys eUSB2 PHY driver (used on SM8550 and SM8650)
* SYS_INIT_SP_BSS_OFFSET is set to 1.5M to give us more space for FDTs.
* RB2 gets a work-around to fix the USB dr_mode property before booting Linux.

---

The following changes since commit 38ea74d6d5c05224acdb03f799897c1bdd56f8cc:

  Prepare v2024.07-rc1 (2024-04-22 15:10:21 -0600)

are available in the Git repository at:

  g...@source.denx.de:u-boot/custodians/u-boot-snapdragon.git qcom-main

for you to fetch changes up to ad12acd7a8f5aeea5816d5c2fc37c205c403eee0:

  configs: qcom_defconfig: enable GENI I2C Driver (2024-04-23 13:29:32 +0200)


Caleb Connolly (32):
  pinctrl: qcom: add qcm2290 pinctrl driver
  pinctrl: qcom: add sm6115 pinctrl driver
  pinctrl: qcom: add sm8250 pinctrl driver
  qcom_defconfig: enable pinctrl for new qcm2290/sm6115/sm8250
  clk/qcom: add driver for qcm2290 GCC
  clk/qcom: add driver for sm6115 GCC
  clk/qcom: add driver for sm8250 GCC
  qcom_defconfig: enable clocks for qcm2290/sm6115/sm8250
  mmc: msm_sdhci: correct vendor_spec_cap0 register for v5
  mmc: msm_sdhci: use modern DT handling
  mmc: msm_sdhci: print core version
  mmc: msm_sdhci: use a more sensible default clock rate
  clk/qcom: sdm845: enable SDCC2 core clock
  pinctrl: qcom: sdm845: add special pin names
  dts: sdm845-db845c-u-boot: adjust MMC clocks
  MAINTAINERS: add Qualcomm mailing list
  mmc: msm_sdhci: fix vendor_spec_cap0 registers
  clk/qcom: apq8016: return valid rate when setting UART clock
  clk/qcom: ipq4019: return valid rate when setting UART clock
  serial: msm: calculate bit clock divider
  mach-snapdragon: use OF_UPSTREAM
  arm: dts: drop qcom dts files
  qcom_defconfig: set SYS_INIT_SP_BSS_OFFSET
  gpio: qcom_pmic: add pm6125
  gpio: qcom_pmic: add pm8150l
  iommu: qcom-smmu: add qcom generic compatible
  phy: qcom: snps-femto-v2: drop clocks
  arm: dts: qrb4210-rb2-u-boot: add u-boot fixups
  mach-snapdragon: implement ft_board_setup() for USB role selection
  qcom_defconfig: enable OF_BOARD_SETUP
  qcom_defconfig: define safe default SYS_LOAD_ADDR
  qcom_defconfig: generate SMBIOS tables

Neil Armstrong (17):
  phy: qcom: add Synopsys eUSB2 PHY driver
  qcom_defconfig: enable the Qualcomm Synopsys eUSB2 PHY driver
  pinctrl: qcom: Add SM8550 pinctrl driver
  pinctrl: qcom: Add SM8650 pinctrl driver
  qcom_defconfig: enable SM8550 & SM8650 pinctrl driver
  gpio: qcom_pmic_gpio: add support for pm8550-gpio
  button: qcom-pmic: move node name checks to btn_data struct
  button: qcom-pmic: add support for pmk8350 button configs
  clk: qcom: Add SM8550 clock driver
  clk: qcom: Add SM8650 clock driver
  qcom_defconfig: enable SM8550 & SM8650 clock driver
  spmi: msm: fix version 5 support
  spmi: msm: properly format command
  spmi: msm: handle peripheral ownership
  spmi: msm: support controller version 7
  i2c: Add support for Qualcomm Generic Interface (GENI) I2C controller
  configs: qcom_defconfig: enable GENI I2C Driver

Robert Marko (8):
  serial: allow selecting MSM debug UART with ARCH_IPQ40XX
  serial: msm_serial: remove .clk_rate from debug UART
  arm: mach-ipq40xx: dont select SMEM by default
  pinctrl: qcom: allow selecting with ARCH_IPQ40XX
  mach-ipq40xx: import GPIO header from mach-snapgradon
  pinctrl: qcom: ipq4019: adapt pin name lookup to upstream DTS
  pinctrl: qcom: ipq4019: enable DM_FLAG_PRE_RELOC
  pinctrl: qcom: ipq4019: support all pin functions

Sumit Garg (8):
 

Re: [PATCH v2 1/3] net: eth-uclass: Introduce NET_PREFER_ROM_MAC_ADDR

2024-04-23 Thread Marek Vasut

On 4/23/24 3:35 PM, Detlev Casanova wrote:

On Monday, April 22, 2024 3:47:21 P.M. EDT Marek Vasut wrote:

On 4/22/24 3:56 PM, Detlev Casanova wrote:

On some boards, a MAC address is set based on the CPU ID or other
information. This is usually done in the misc_init_r() function.

This becomes a problem for net devices that are probed after the call to
misc_init_r(), for example, when the ethernet is on a PCI port, which
needs to be enumerated.

In this case, misc_init_r() will set the ethaddr variable, then, when
the ethernet device is probed, if it has a ROM address, u-boot will warn
about a MAC address mismatch and use the misc_init_r() address instead
of the one in ROM.

The operating system later will most likely use the ROM MAC address,
which can be confusing.

To avoid that, this commit introduces NET_PREFER_ROM_MAC_ADDR that can
be set for boards that have such an interface.

Signed-off-by: Detlev Casanova 


Won't the system pick ROM MAC if $ethaddr is not set ?


Yes, and in the case of rockchip, misc_init_r() will set an $ethaddr based on
the cpuid, which makes the eth driver use that instead of the ROM one.


Shouldn't the rockchip misc_init_r be fixed then ?


Re: [PATCH v2 1/3] net: eth-uclass: Introduce NET_PREFER_ROM_MAC_ADDR

2024-04-23 Thread Detlev Casanova
On Monday, April 22, 2024 3:47:21 P.M. EDT Marek Vasut wrote:
> On 4/22/24 3:56 PM, Detlev Casanova wrote:
> > On some boards, a MAC address is set based on the CPU ID or other
> > information. This is usually done in the misc_init_r() function.
> > 
> > This becomes a problem for net devices that are probed after the call to
> > misc_init_r(), for example, when the ethernet is on a PCI port, which
> > needs to be enumerated.
> > 
> > In this case, misc_init_r() will set the ethaddr variable, then, when
> > the ethernet device is probed, if it has a ROM address, u-boot will warn
> > about a MAC address mismatch and use the misc_init_r() address instead
> > of the one in ROM.
> > 
> > The operating system later will most likely use the ROM MAC address,
> > which can be confusing.
> > 
> > To avoid that, this commit introduces NET_PREFER_ROM_MAC_ADDR that can
> > be set for boards that have such an interface.
> > 
> > Signed-off-by: Detlev Casanova 
> 
> Won't the system pick ROM MAC if $ethaddr is not set ?

Yes, and in the case of rockchip, misc_init_r() will set an $ethaddr based on 
the cpuid, which makes the eth driver use that instead of the ROM one.


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH v2] usb: cdns3: gadget.c: Set fast access bit

2024-04-23 Thread Marek Vasut

On 4/23/24 10:24 AM, Ravi Gunasekaran wrote:

From: Aswath Govindraju 

When the device port is in a low power state [U3/L2/Not Connected],
accesses to usb device registers may take a long time. This could lead to
potential core hang when the controller registers are accessed after the
port is disabled by setting DEVDS field. Setting the fast register access
bit ensures that the PHY clock is keeping up in active state.

Therefore, set fast access bit to ensure the accesses to device registers
are quick even in low power states.

Signed-off-by: Aswath Govindraju 
Signed-off-by: Ravi Gunasekaran 
Reviewed-by: Roger Quadros 
---
v1 was posted and was reviewed as well. But it did not get merged.
This change is present in upstream linux kernel as well.
Upstream Linux kernel commit: b5148d946f45 ("usb: cdns3: gadget: set fast access 
bit")


This commit ^ should be mentioned in the commit message.

With that fixed:

Reviewed-by: Marek Vasut 

Thanks !


Re: [RFC PATCH 1/1] net: dwc_eth_qos: mdio: Implement clause 45

2024-04-23 Thread Marek Vasut

On 4/23/24 10:51 AM, Philip Oberfichtner wrote:

Bevor this commit, only clause 22 access was possible. After this commit,
clause 45 direct access will available as well.

Note that there is a slight change of behavior: Before this commit, the
C45E bit was set to whatever value was left in the register from the
previous access. After this commit, we adopt the common practice of
discerning C45 from C22 using the devad argument.

Signed-off-by: Philip Oberfichtner 
---

Notes:
 This patch is labeled RFC as there is a slight change of behavior (see
 commit message). I'm not sure in fact if this solution works for
 everybody - this is up for discussion!
 
 My implementation is tested on an Intel Elkhart lake SOC. Driver code

 for dwc_eth_qos_intel coming soon in a separate patch series.

  drivers/net/dwc_eth_qos.c | 66 ++-
  drivers/net/dwc_eth_qos.h |  1 +
  2 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 86d989e244..64a9bff6bb 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -162,6 +162,25 @@ static int eqos_mdio_wait_idle(struct eqos_priv *eqos)
 100, true);
  }
  
+/* Bitmask common for mdio_read and mdio_write */

+#define EQOS_MDIO_BITFIELD(pa, rda, cr) \
+   (pa  << EQOS_MAC_MDIO_ADDRESS_PA_SHIFT)  | \


Parenthesis around (pa) are missing, DTTO for the rest of this.

However, better use FIELD_GET/FIELD_PREP macros instead.

[...]


Re: RISC-V u-boot unable to boot QEMU using '-cpu max'

2024-04-23 Thread Daniel Henrique Barboza




On 4/23/24 09:41, Conor Dooley wrote:

On Tue, Apr 23, 2024 at 01:34:42PM +0800, Leo Liang wrote:

On Mon, Apr 22, 2024 at 04:43:59PM -0300, Daniel Henrique Barboza wrote:

[EXTERNAL MAIL]

Hi,

In QEMU we have a 'max' type CPU that implements (almost) all extensions that 
QEMU
is able to emulate. Recently, in QEMU commit 249e0905d05, we bumped the 
extensions
for this CPU.

And after this commit this CPU is now unable to boot a guest using upstream
u-boot. Here's the error being thrown:

qemu-system-riscv64 \
 -machine virt -nographic -m 8G -smp 8 \
 -cpu max -kernel uboot.elf (...)
(...)

initcall sequence 8027c3e8 failed at call 8021259e (err=-28)
### ERROR ### Please RESET the board ###


I can get the guest to boot if I disable the following extensions from the 
'max' CPU:

  -cpu max,zfbfmin=false,zvfbfmin=false,zvfbfwma=false

Due to QEMU extension dependencies I'm not able to disable these individually. 
What I can
say is that u-boot isn't playing ball to at least one of them.

Is this an u-boot bug? Up to this point I was assuming that u-boot would 
silently ignore
hart extensions that it doesn't support.


Hi Daniel,

Which u-boot version are you using?

I think this issue is fixed by the following patch set sent by Conor.

f39b1b77d8 riscv: support extension probing using riscv, isa-extensions
b90edde701 riscv: don't read riscv, isa in the riscv cpu's get_desc()

I've tested and can reproduce the issue you mentioned if these two patches are 
reverted.

Could you try with the lastest u-boot master branch again?


For reference, my testing commands are as follows:
1. cd ${u-boot} && make qemu-riscv64_defconfig && make -j`nproc`
2. ./${qemu}/build/qemu-system-riscv64 -nographic -machine virt -cpu max -bios 
u-boot.bin -m 8G -smp 8

- u-boot branch (commit): master (38ea74d6d5c0 "Prepare v2024.07-rc1")
- qemu branch (commit): master (62dbe54c24db "Update version for v9.0.0-rc4 
release")


I'll go take a look at this, it's possible that my patches only hide the
problem due to the new property being prioritised.



Don't bother. I just checked with most recent u-boot master and I can't 
reproduce the
problem, as Leo said.

I apologize for the noise. I failed to fetch the latest upstream and do a last
test before posting it here.

We were discussing here and there about disabling these extensions in the 'max'
CPU in QEMU if u-boot wasn't able to handle them. I'm happy to see that u-boot
is now able to do so and we can keep the 'max' CPU as is.


Thanks for the help,

Daniel



Re: RISC-V u-boot unable to boot QEMU using '-cpu max'

2024-04-23 Thread Conor Dooley
On Tue, Apr 23, 2024 at 01:34:42PM +0800, Leo Liang wrote:
> On Mon, Apr 22, 2024 at 04:43:59PM -0300, Daniel Henrique Barboza wrote:
> > [EXTERNAL MAIL]
> > 
> > Hi,
> > 
> > In QEMU we have a 'max' type CPU that implements (almost) all extensions 
> > that QEMU
> > is able to emulate. Recently, in QEMU commit 249e0905d05, we bumped the 
> > extensions
> > for this CPU.
> > 
> > And after this commit this CPU is now unable to boot a guest using upstream
> > u-boot. Here's the error being thrown:
> > 
> > qemu-system-riscv64 \
> > -machine virt -nographic -m 8G -smp 8 \
> > -cpu max -kernel uboot.elf (...)
> > (...)
> > 
> > initcall sequence 8027c3e8 failed at call 8021259e (err=-28)
> > ### ERROR ### Please RESET the board ###
> > 
> > 
> > I can get the guest to boot if I disable the following extensions from the 
> > 'max' CPU:
> > 
> >  -cpu max,zfbfmin=false,zvfbfmin=false,zvfbfwma=false
> > 
> > Due to QEMU extension dependencies I'm not able to disable these 
> > individually. What I can
> > say is that u-boot isn't playing ball to at least one of them.
> > 
> > Is this an u-boot bug? Up to this point I was assuming that u-boot would 
> > silently ignore
> > hart extensions that it doesn't support.
> 
> Hi Daniel,
> 
> Which u-boot version are you using?
> 
> I think this issue is fixed by the following patch set sent by Conor.
> 
>   f39b1b77d8 riscv: support extension probing using riscv, isa-extensions
>   b90edde701 riscv: don't read riscv, isa in the riscv cpu's get_desc()
> 
> I've tested and can reproduce the issue you mentioned if these two patches 
> are reverted.
> 
> Could you try with the lastest u-boot master branch again?
> 
> 
> For reference, my testing commands are as follows:
> 1. cd ${u-boot} && make qemu-riscv64_defconfig && make -j`nproc`
> 2. ./${qemu}/build/qemu-system-riscv64 -nographic -machine virt -cpu max 
> -bios u-boot.bin -m 8G -smp 8
> 
> - u-boot branch (commit): master (38ea74d6d5c0 "Prepare v2024.07-rc1")
> - qemu branch (commit): master (62dbe54c24db "Update version for v9.0.0-rc4 
> release")

I'll go take a look at this, it's possible that my patches only hide the
problem due to the new property being prioritised.


signature.asc
Description: PGP signature


[PATCH v2] rockchip: rv1108: Convert to OF_UPSTREAM

2024-04-23 Thread Fabio Estevam
Instead of using the local rv1108 devicetree copies from U-Boot,
let's convert the rv1108 boards to OF_UPSTREAM so that the upstream kernel
devicetrees can be used instead.

Tested on a rv1108-elgin-r1 board.

Signed-off-by: Fabio Estevam 
---
Changes since v1:
- Fixed typo in commit log.

 arch/arm/dts/rv1108-elgin-r1.dts |  59 
 arch/arm/dts/rv1108-evb.dts  |  79 -
 arch/arm/dts/rv1108.dtsi | 581 ---
 arch/arm/mach-rockchip/Kconfig   |   1 +
 configs/elgin-rv1108_defconfig   |   2 +-
 configs/evb-rv1108_defconfig |   2 +-
 6 files changed, 3 insertions(+), 721 deletions(-)
 delete mode 100644 arch/arm/dts/rv1108-elgin-r1.dts
 delete mode 100644 arch/arm/dts/rv1108-evb.dts
 delete mode 100644 arch/arm/dts/rv1108.dtsi

diff --git a/arch/arm/dts/rv1108-elgin-r1.dts b/arch/arm/dts/rv1108-elgin-r1.dts
deleted file mode 100644
index 83e8b3183847..
--- a/arch/arm/dts/rv1108-elgin-r1.dts
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
-
-/dts-v1/;
-
-#include "rv1108.dtsi"
-
-/ {
-   model = "Elgin RV1108 R1 board";
-   compatible = "elgin,rv1108-elgin", "rockchip,rv1108";
-
-   memory@6000 {
-   device_type = "memory";
-   reg = <0x6000 0x0800>;
-   };
-
-   chosen {
-   stdout-path = "serial2:150n8";
-   };
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_clk _cmd _bus8>;
-   bus-width = <8>;
-   cap-mmc-highspeed;
-   disable-wp;
-   non-removable;
-   status = "okay";
-};
-
- {
-   status = "okay";
-
-   u2phy_otg: otg-port {
-   status = "okay";
-   };
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_xfer_pullup>;
-   status = "okay";
-};
-
-_otg {
-   status = "okay";
-};
-
- {
-   uart2m0 {
-   uart2m0_xfer_pullup: uart2m0-xfer-pullup {
-   rockchip,pins = <2 RK_PD2 RK_FUNC_1 
_pull_up_drv_8ma>,
-   <2 RK_PD1 RK_FUNC_1 
_pull_up_drv_8ma>;
-   };
-   };
-};
diff --git a/arch/arm/dts/rv1108-evb.dts b/arch/arm/dts/rv1108-evb.dts
deleted file mode 100644
index c91776bc106e..
--- a/arch/arm/dts/rv1108-evb.dts
+++ /dev/null
@@ -1,79 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
-
-/dts-v1/;
-
-#include "rv1108.dtsi"
-
-/ {
-   model = "Rockchip RV1108 Evaluation board";
-   compatible = "rockchip,rv1108-evb", "rockchip,rv1108";
-
-   memory@6000 {
-   device_type = "memory";
-   reg = <0x6000 0x0800>;
-   };
-
-   chosen {
-   stdout-path = "serial2:150n8";
-   };
-
-   vcc5v0_otg: vcc5v0-otg-drv {
-   compatible = "regulator-fixed";
-   enable-active-high;
-   regulator-name = "vcc5v0_otg";
-   gpio = < RK_PB0 GPIO_ACTIVE_HIGH>;
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   };
-};
-
- {
-   status = "okay";
-   clock_in_out = <0>;
-   snps,reset-active-low;
-   snps,reset-delays-us = <0 1 100>;
-   snps,reset-gpio = < RK_PC1 GPIO_ACTIVE_LOW>;
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-   flash@0 {
-   compatible = "gd25q256","jedec,spi-nor";
-   reg = <0>;
-   spi-tx-bus-width = <1>;
-   spi-rx-bus-width = <1>;
-   spi-max-frequency = <9600>;
-   };
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
-_otg {
-   vbus-supply = <_otg>;
-   status = "okay";
-};
-
-_host_ehci {
-   status = "okay";
-};
-
-_host_ohci {
-   status = "okay";
-};
diff --git a/arch/arm/dts/rv1108.dtsi b/arch/arm/dts/rv1108.dtsi
deleted file mode 100644
index 215d88522587..
--- a/arch/arm/dts/rv1108.dtsi
+++ /dev/null
@@ -1,581 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-/ {
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   compatible = "rockchip,rv1108";
-
-   interrupt-parent = <>;
-
-   aliases {
-   serial0 = 
-   serial1 = 
-   serial2 = 
-   spi0= 
-   };
-
-   cpus {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   cpu0: cpu@f00 {
-   device_type = "cpu";
-   compatible = "arm,cortex-a7";
-   reg = <0xf00>;
-   };
-   };
-
-   arm-pmu {
-   compatible = "arm,cortex-a7-pmu";
-   interrupts = ;
-   };
-
-   

[PATCH] rockchip: rv1108: Convert to OF_UPSTREAM

2024-04-23 Thread Fabio Estevam
Instead of using the local rv1108 devicetree copies from U-Boot,
let's convert the rv11008 board to OF_UPSTREAM so that the upstream kernel
devicetrees can be used instead.

Tested on a rv1108-elgin-r1 board.

Signed-off-by: Fabio Estevam 
---
 arch/arm/dts/rv1108-elgin-r1.dts |  59 
 arch/arm/dts/rv1108-evb.dts  |  79 -
 arch/arm/dts/rv1108.dtsi | 581 ---
 arch/arm/mach-rockchip/Kconfig   |   1 +
 configs/elgin-rv1108_defconfig   |   2 +-
 configs/evb-rv1108_defconfig |   2 +-
 6 files changed, 3 insertions(+), 721 deletions(-)
 delete mode 100644 arch/arm/dts/rv1108-elgin-r1.dts
 delete mode 100644 arch/arm/dts/rv1108-evb.dts
 delete mode 100644 arch/arm/dts/rv1108.dtsi

diff --git a/arch/arm/dts/rv1108-elgin-r1.dts b/arch/arm/dts/rv1108-elgin-r1.dts
deleted file mode 100644
index 83e8b3183847..
--- a/arch/arm/dts/rv1108-elgin-r1.dts
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
-
-/dts-v1/;
-
-#include "rv1108.dtsi"
-
-/ {
-   model = "Elgin RV1108 R1 board";
-   compatible = "elgin,rv1108-elgin", "rockchip,rv1108";
-
-   memory@6000 {
-   device_type = "memory";
-   reg = <0x6000 0x0800>;
-   };
-
-   chosen {
-   stdout-path = "serial2:150n8";
-   };
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_clk _cmd _bus8>;
-   bus-width = <8>;
-   cap-mmc-highspeed;
-   disable-wp;
-   non-removable;
-   status = "okay";
-};
-
- {
-   status = "okay";
-
-   u2phy_otg: otg-port {
-   status = "okay";
-   };
-};
-
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_xfer_pullup>;
-   status = "okay";
-};
-
-_otg {
-   status = "okay";
-};
-
- {
-   uart2m0 {
-   uart2m0_xfer_pullup: uart2m0-xfer-pullup {
-   rockchip,pins = <2 RK_PD2 RK_FUNC_1 
_pull_up_drv_8ma>,
-   <2 RK_PD1 RK_FUNC_1 
_pull_up_drv_8ma>;
-   };
-   };
-};
diff --git a/arch/arm/dts/rv1108-evb.dts b/arch/arm/dts/rv1108-evb.dts
deleted file mode 100644
index c91776bc106e..
--- a/arch/arm/dts/rv1108-evb.dts
+++ /dev/null
@@ -1,79 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
-
-/dts-v1/;
-
-#include "rv1108.dtsi"
-
-/ {
-   model = "Rockchip RV1108 Evaluation board";
-   compatible = "rockchip,rv1108-evb", "rockchip,rv1108";
-
-   memory@6000 {
-   device_type = "memory";
-   reg = <0x6000 0x0800>;
-   };
-
-   chosen {
-   stdout-path = "serial2:150n8";
-   };
-
-   vcc5v0_otg: vcc5v0-otg-drv {
-   compatible = "regulator-fixed";
-   enable-active-high;
-   regulator-name = "vcc5v0_otg";
-   gpio = < RK_PB0 GPIO_ACTIVE_HIGH>;
-   regulator-min-microvolt = <500>;
-   regulator-max-microvolt = <500>;
-   };
-};
-
- {
-   status = "okay";
-   clock_in_out = <0>;
-   snps,reset-active-low;
-   snps,reset-delays-us = <0 1 100>;
-   snps,reset-gpio = < RK_PC1 GPIO_ACTIVE_LOW>;
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-   flash@0 {
-   compatible = "gd25q256","jedec,spi-nor";
-   reg = <0>;
-   spi-tx-bus-width = <1>;
-   spi-rx-bus-width = <1>;
-   spi-max-frequency = <9600>;
-   };
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
- {
-   status = "okay";
-};
-
-_otg {
-   vbus-supply = <_otg>;
-   status = "okay";
-};
-
-_host_ehci {
-   status = "okay";
-};
-
-_host_ohci {
-   status = "okay";
-};
diff --git a/arch/arm/dts/rv1108.dtsi b/arch/arm/dts/rv1108.dtsi
deleted file mode 100644
index 215d88522587..
--- a/arch/arm/dts/rv1108.dtsi
+++ /dev/null
@@ -1,581 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-/ {
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   compatible = "rockchip,rv1108";
-
-   interrupt-parent = <>;
-
-   aliases {
-   serial0 = 
-   serial1 = 
-   serial2 = 
-   spi0= 
-   };
-
-   cpus {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   cpu0: cpu@f00 {
-   device_type = "cpu";
-   compatible = "arm,cortex-a7";
-   reg = <0xf00>;
-   };
-   };
-
-   arm-pmu {
-   compatible = "arm,cortex-a7-pmu";
-   interrupts = ;
-   };
-
-   timer {
-   compatible = 

Re: [PATCH v4 0/7] Add SE HMBSC board support

2024-04-23 Thread Sumit Garg
On Tue, 23 Apr 2024 at 17:29, Caleb Connolly  wrote:
>
> Applied, thanks.

Thanks.

>
> (b4 didn't seem to detect this series properly, hence the manual mail).
>

Switching my workflow to b4 is on my ToDo list. I hope to do it sooner
rather than later.

-Sumit

> On 12/04/2024 11:54, Sumit Garg wrote:
> > SE HMIBSC board is based on Qcom APQ8016 SoC. One of the major
> > difference from db410c is serial port where HMIBSC board uses UART1 as
> > the debug console with an RS232 port, patch #2 - #5 adds corresponding
> > driver support.
> >
> > Patch #6 adds main HMIBSC board specific bits, features:
> > - Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
> > - 2GiB RAM
> > - 64GiB eMMC, SD slot
> > - WiFi and Bluetooth
> > - 2x Host, 1x Device USB port
> > - HDMI
> > - Discrete TPM2 chip over SPI
> >
> > Features enabled in U-Boot:
> > - RAUC updates (refer [2] for more details)
> > - Environment protection
> > - USB based ethernet adaptors
> >
> > Feedback is very much welcome.
> >
> > Changes in v4:
> > - Rebased on top of qcom-main [4].
> > - Split out board DTS patch as #6.
> > - Convert to text based environment as hmibsc.env.
> > - MMC regression has been reported for qcom-main branch here [5].
> > - Collected further review tag.
> >
> > Changes in v3:
> > - Rebased on top of qcom-next [1].
> > - Collected some review tags.
> > - Incorporated misc. comments from Caleb and Stephen.
> > - Split patch#4 as requested.
> > - Linux HMIBSC board DTS has already been reviewed here [3], I have
> >incorporated that for U-Boot too.
> >
> > Changes in v2:
> > - Rebased on top on qcom-next [1].
> > - Added patch#1 as a fix for generic qcom board support.
> > - Added patch#4 to enable driving GPIO pins based on pinctrl
> >configuration. This replaces the custom GPIO configuration.
> > - Added proper DTS file for HMIBSC board based on Linux DT pattern.
> > - Merged board support patches into a single patch#5.
> >
> > [1] 
> > https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commits/qcom-next?ref_type=heads
> > [2] https://rauc.readthedocs.io/en/latest/
> > [3] 
> > https://lore.kernel.org/linux-kernel/20240403043416.3800259-4-sumit.g...@linaro.org/
> > [4] 
> > https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commits/qcom-main/?ref_type=heads
> > [5] 
> > https://lore.kernel.org/all/cafa6wyo+3vroudfuvh390taviqx8pmqroqdtsn0yu6bd5yy...@mail.gmail.com/
> >
> > Sumit Garg (7):
> >qcom: Don't enable LINUX_KERNEL_IMAGE_HEADER by default
> >apq8016: Add support for UART1 clocks and pinmux
> >serial_msm: Enable RS232 flow control
> >pinctrl: qcom: Add support for driving GPIO pins output
> >pinctrl: qcom: apq8016: Add GPIO pinctrl function
> >arm: dts: qcom: Add Schneider HMIBSC board dts
> >board: add support for Schneider HMIBSC board
> >
> >   arch/arm/Kconfig  |   2 +-
> >   arch/arm/dts/apq8016-schneider-hmibsc.dts | 491 ++
> >   board/schneider/hmibsc/MAINTAINERS|   6 +
> >   board/schneider/hmibsc/hmibsc.env |  40 ++
> >   configs/hmibsc_defconfig  |  87 
> >   doc/board/index.rst   |   1 +
> >   doc/board/schneider/hmibsc.rst|  45 ++
> >   doc/board/schneider/index.rst |   9 +
> >   drivers/clk/qcom/clock-apq8016.c  |  38 +-
> >   drivers/pinctrl/qcom/pinctrl-apq8016.c|   2 +
> >   drivers/pinctrl/qcom/pinctrl-qcom.c   |  25 +-
> >   drivers/serial/serial_msm.c   |  24 +-
> >   include/configs/hmibsc.h  |  16 +
> >   13 files changed, 760 insertions(+), 26 deletions(-)
> >   create mode 100644 arch/arm/dts/apq8016-schneider-hmibsc.dts
> >   create mode 100644 board/schneider/hmibsc/MAINTAINERS
> >   create mode 100644 board/schneider/hmibsc/hmibsc.env
> >   create mode 100644 configs/hmibsc_defconfig
> >   create mode 100644 doc/board/schneider/hmibsc.rst
> >   create mode 100644 doc/board/schneider/index.rst
> >   create mode 100644 include/configs/hmibsc.h
> >
>
> --
> // Caleb (they/them)


Re: [PATCH v2 3/3] board: starfive: Call spl_dram_init() for DRAM initialization

2024-04-23 Thread Heinrich Schuchardt

On 23.04.24 11:14, lukas.funke-...@weidmueller.com wrote:

From: Lukas Funke 

Call spl_dram_init() since this is commonly used for dram initialization
in u-boot.

Signed-off-by: Lukas Funke 
---

Changes in v2:
  - capitalized acronym DRAM

  board/starfive/visionfive2/spl.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c
index 45848db6d8..ca61b5be22 100644
--- a/board/starfive/visionfive2/spl.c
+++ b/board/starfive/visionfive2/spl.c
@@ -285,9 +285,9 @@ int spl_board_init_f(void)

jh7110_jtag_init();

-   ret = spl_soc_init();
+   ret = spl_dram_init();


We want to be able to use git bisect. This requires that the source
builds after each individual patch.

This change must be in the same patch in which you rename the function
for the VisionFive 2.

Please, resubmit your series with two patches: one for SiFive, one for
StarFive.

Best regards

Heinrich


if (ret) {
-   debug("JH7110 SPL init failed: %d\n", ret);
+   debug("JH7110 DRAM init failed: %d\n", ret);
return ret;
}





Re: [PATCH v3 02/19] board: am64x: Define capsule update firmware info

2024-04-23 Thread Roger Quadros



On 19/04/2024 23:56, Jonathan Humphreys wrote:
> Define the firmware components updatable via EFI capsule update, including
> defining capsule GUIDs for the various firmware components for the AM64x SK.
> 
> Signed-off-by: Jonathan Humphreys 
> ---
>  board/ti/am64x/evm.c| 33 +
>  include/configs/am64x_evm.h | 24 
>  2 files changed, 57 insertions(+)
> 
> diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
> index b8de69da06c..83df75a6911 100644
> --- a/board/ti/am64x/evm.c
> +++ b/board/ti/am64x/evm.c
> @@ -7,6 +7,7 @@
>   *
>   */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -27,6 +28,38 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)

Checkpatch warns:

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where 
possible
#31: FILE: board/ti/am64x/evm.c:31:
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)


How about we drop the #if here and instead see possible solution below.

> +struct efi_fw_image fw_images[] = {
> + {
> + .image_type_id = AM64X_SK_TIBOOT3_IMAGE_GUID,
> + .fw_name = u"AM64X_SK_TIBOOT3",
> + .image_index = 1,
> + },
> + {
> + .image_type_id = AM64X_SK_SPL_IMAGE_GUID,
> + .fw_name = u"AM64X_SK_SPL",
> + .image_index = 2,
> + },
> + {
> + .image_type_id = AM64X_SK_UBOOT_IMAGE_GUID,
> + .fw_name = u"AM64X_SK_UBOOT",
> + .image_index = 3,
> + }
> +};
> +
> +struct efi_capsule_update_info update_info = {
> + .dfu_string = "sf 0:0=tiboot3.bin raw 0 10;tispl.bin raw 10 
> 20;u-boot.img raw 30 40",
> + .num_images = ARRAY_SIZE(fw_images),
> + .images = fw_images,
> +};
> +
> +void set_dfu_alt_info(char *interface, char *devstr)
> +{

set the environment variable only if relevant config is enabled.

if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))

> + env_set("dfu_alt_info", update_info.dfu_string);

> +}
> +
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>  int board_init(void)
>  {
>   return 0;
> diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h
> index f9f8c7bc2f6..9db83621ea8 100644
> --- a/include/configs/am64x_evm.h
> +++ b/include/configs/am64x_evm.h
> @@ -9,6 +9,30 @@
>  #ifndef __CONFIG_AM642_EVM_H
>  #define __CONFIG_AM642_EVM_H
>  
> +/**
> + * define AM64X_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM64X sk 
> tiboot3.bin
> + * define AM64X_SK_SPL_IMAGE_GUID - firmware GUID for AM64X sk SPL
> + * define AM64X_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM64X sk UBOOT
> + *
> + * These GUIDs are used in capsules updates to identify the corresponding
> + * firmware object.
> + *
> + * Board developers using this as a starting reference should
> + * define their own GUIDs to ensure that firmware repositories (like
> + * LVFS) do not confuse them.
> + */
> +#define AM64X_SK_TIBOOT3_IMAGE_GUID \
> + EFI_GUID(0xede0a0d5, 0x9116, 0x4bfb, 0xaa, 0x54, \
> + 0x09, 0xe9, 0x7b, 0x5a, 0xfe, 0x1a)
> +
> +#define AM64X_SK_SPL_IMAGE_GUID \
> + EFI_GUID(0x77678f5c, 0x64d4, 0x4910, 0xad, 0x75, \
> + 0x52, 0xc9, 0xd9, 0x5c, 0xdb, 0x1d)
> +
> +#define AM64X_SK_UBOOT_IMAGE_GUID \
> + EFI_GUID(0xc6ad43a9, 0x7d31, 0x4f5d, 0x83, 0xe9, \
> + 0xb8, 0xef, 0xec, 0xae, 0x05, 0xbf)
> +
>  /* Now for the remaining common defines */
>  #include 
>  

-- 
cheers,
-roger


Re: [PATCH v3 03/19] configs: am64x: Enable EFI capsule update

2024-04-23 Thread Roger Quadros
Checkpatch warns:

WARNING: Missing commit description - Add an appropriate one


On 19/04/2024 23:56, Jonathan Humphreys wrote:
> Signed-off-by: Jonathan Humphreys 
> ---
>  configs/am64x_evm_a53_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/configs/am64x_evm_a53_defconfig b/configs/am64x_evm_a53_defconfig
> index e000549d6d0..c9bdd7b54cc 100644
> --- a/configs/am64x_evm_a53_defconfig
> +++ b/configs/am64x_evm_a53_defconfig
> @@ -178,3 +178,5 @@ CONFIG_USB_FUNCTION_MASS_STORAGE=y
>  CONFIG_SPL_DFU=y
>  CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
>  CONFIG_EFI_SET_TIME=y
> +CONFIG_EFI_CAPSULE_ON_DISK=y
> +CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y

-- 
cheers,
-roger


Re: [PATCH v4 0/7] Add SE HMBSC board support

2024-04-23 Thread Caleb Connolly

Applied, thanks.

(b4 didn't seem to detect this series properly, hence the manual mail).

On 12/04/2024 11:54, Sumit Garg wrote:

SE HMIBSC board is based on Qcom APQ8016 SoC. One of the major
difference from db410c is serial port where HMIBSC board uses UART1 as
the debug console with an RS232 port, patch #2 - #5 adds corresponding
driver support.

Patch #6 adds main HMIBSC board specific bits, features:
- Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
- 2GiB RAM
- 64GiB eMMC, SD slot
- WiFi and Bluetooth
- 2x Host, 1x Device USB port
- HDMI
- Discrete TPM2 chip over SPI

Features enabled in U-Boot:
- RAUC updates (refer [2] for more details)
- Environment protection
- USB based ethernet adaptors

Feedback is very much welcome.

Changes in v4:
- Rebased on top of qcom-main [4].
- Split out board DTS patch as #6.
- Convert to text based environment as hmibsc.env.
- MMC regression has been reported for qcom-main branch here [5].
- Collected further review tag.

Changes in v3:
- Rebased on top of qcom-next [1].
- Collected some review tags.
- Incorporated misc. comments from Caleb and Stephen.
- Split patch#4 as requested.
- Linux HMIBSC board DTS has already been reviewed here [3], I have
   incorporated that for U-Boot too.

Changes in v2:
- Rebased on top on qcom-next [1].
- Added patch#1 as a fix for generic qcom board support.
- Added patch#4 to enable driving GPIO pins based on pinctrl
   configuration. This replaces the custom GPIO configuration.
- Added proper DTS file for HMIBSC board based on Linux DT pattern.
- Merged board support patches into a single patch#5.

[1] 
https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commits/qcom-next?ref_type=heads
[2] https://rauc.readthedocs.io/en/latest/
[3] 
https://lore.kernel.org/linux-kernel/20240403043416.3800259-4-sumit.g...@linaro.org/
[4] 
https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commits/qcom-main/?ref_type=heads
[5] 
https://lore.kernel.org/all/cafa6wyo+3vroudfuvh390taviqx8pmqroqdtsn0yu6bd5yy...@mail.gmail.com/

Sumit Garg (7):
   qcom: Don't enable LINUX_KERNEL_IMAGE_HEADER by default
   apq8016: Add support for UART1 clocks and pinmux
   serial_msm: Enable RS232 flow control
   pinctrl: qcom: Add support for driving GPIO pins output
   pinctrl: qcom: apq8016: Add GPIO pinctrl function
   arm: dts: qcom: Add Schneider HMIBSC board dts
   board: add support for Schneider HMIBSC board

  arch/arm/Kconfig  |   2 +-
  arch/arm/dts/apq8016-schneider-hmibsc.dts | 491 ++
  board/schneider/hmibsc/MAINTAINERS|   6 +
  board/schneider/hmibsc/hmibsc.env |  40 ++
  configs/hmibsc_defconfig  |  87 
  doc/board/index.rst   |   1 +
  doc/board/schneider/hmibsc.rst|  45 ++
  doc/board/schneider/index.rst |   9 +
  drivers/clk/qcom/clock-apq8016.c  |  38 +-
  drivers/pinctrl/qcom/pinctrl-apq8016.c|   2 +
  drivers/pinctrl/qcom/pinctrl-qcom.c   |  25 +-
  drivers/serial/serial_msm.c   |  24 +-
  include/configs/hmibsc.h  |  16 +
  13 files changed, 760 insertions(+), 26 deletions(-)
  create mode 100644 arch/arm/dts/apq8016-schneider-hmibsc.dts
  create mode 100644 board/schneider/hmibsc/MAINTAINERS
  create mode 100644 board/schneider/hmibsc/hmibsc.env
  create mode 100644 configs/hmibsc_defconfig
  create mode 100644 doc/board/schneider/hmibsc.rst
  create mode 100644 doc/board/schneider/index.rst
  create mode 100644 include/configs/hmibsc.h



--
// Caleb (they/them)


Re: [PATCH v2 0/2] i2c: Add support for Qualcomm Generic Interface (GENI) I2C controller

2024-04-23 Thread Caleb Connolly


On Mon, 22 Apr 2024 11:33:51 +0200, Neil Armstrong wrote:
> Add Support for the Qualcomm Generic Interface (GENI) I2C interface
> found on newer Qualcomm SoCs.
> 
> The Generic Interface (GENI) is a firmware based Qualcomm Universal
> Peripherals (QUP) Serial Engine (SE) Wrapper which can support multiple
> bus protocols depending on the firmware type loaded at early boot time
> based on system configuration.
> 
> [...]

Applied, thanks!

[1/2] i2c: Add support for Qualcomm Generic Interface (GENI) I2C controller
  commit: 75db9ede12d06693a3ced8c901b74065a1922a23
[2/2] configs: qcom_defconfig: enable GENI I2C Driver
  commit: ad12acd7a8f5aeea5816d5c2fc37c205c403eee0

Best regards,
-- 
Caleb Connolly 



Re: [PATCH 0/9] qcom: RBx fixes and USB support

2024-04-23 Thread Caleb Connolly


On Thu, 18 Apr 2024 18:25:43 +0100, Caleb Connolly wrote:
> This series is a few loosely connected patches to get the RB1 and 2
> boards booting from USB with upstream U-Boot, and a few preperatory
> patches for rb5.
> 
> Unfortunately the RB5 board requires a regulator on the RPMh peripheral
> to be turned on for the USB VBUS rail. Support for this will be added in
> future patches.
> 
> [...]

Applied, thanks!

[1/9] gpio: qcom_pmic: add pm6125
  commit: 733f6d982099c639c0872ed535be9eede2765a2d
[2/9] gpio: qcom_pmic: add pm8150l
  commit: 8bf1eb9a2e1e68ee18db084f24e8961e655926c4
[3/9] iommu: qcom-smmu: add qcom generic compatible
  commit: 2bd5bcaf7d23fc6ad9b2caf351fdb0b1bf712999
[4/9] phy: qcom: snps-femto-v2: drop clocks
  commit: 82a99b3ab8f022656a13e6dffdac93f5b1bc1d54
[5/9] arm: dts: qrb4210-rb2-u-boot: add u-boot fixups
  commit: 956f6e4de48f5f6c549d403a9f6db78a8deef689
[6/9] mach-snapdragon: implement ft_board_setup() for USB role selection
  commit: e64503f1fcdfa4e836c192ab7d16075fda864d19
[7/9] qcom_defconfig: enable OF_BOARD_SETUP
  commit: 9050686c1b9d9d9ac03a3f685458ab5eb2969e15
[8/9] qcom_defconfig: define safe default SYS_LOAD_ADDR
  commit: 9861ebac77d46674243886136275aac1deb7f982
[9/9] qcom_defconfig: generate SMBIOS tables
  commit: d286220078505727c8c0baf9cd9c832a1fcad805

Best regards,
-- 
Caleb Connolly 



Re: [PATCH 0/4] smpi: msm: fix version 5 and add version 7 support

2024-04-23 Thread Caleb Connolly


On Fri, 05 Apr 2024 10:21:52 +0200, Neil Armstrong wrote:
> First, fix version 5 support by using the right ch_offset in
> then msm_spmi_write() reg accesses.
> 
> Then:
> - properly format command by importing helpers from Linux driver and
>   use a switch/case to handle all versions in msm_spmi_write/read() command.
> - handle peripheral ownership by poking into the cnfg registers and
>   mark periperal as read-only when the owner id doesn't match
> - finally add version 7 defines
> 
> [...]

Applied, thanks!

[1/4] spmi: msm: fix version 5 support
  commit: c2de620d64d462c1404ca383ad55aecf3f5a972e
[2/4] spmi: msm: properly format command
  commit: f0b604d9491dc92c9cb092a9e4c0fdf2036cdb8d
[3/4] spmi: msm: handle peripheral ownership
  commit: 59e0482b5edc1fceded3967306561a57f60ba4b3
[4/4] spmi: msm: support controller version 7
  commit: ee1d8aa5ecf77991d3bbcfea2d5b37d88bb19473

Best regards,
-- 
Caleb Connolly 



Re: [PATCH v2] mach-snapdragon: Allow other board vendors apart from Qcom

2024-04-23 Thread Caleb Connolly


On Thu, 11 Apr 2024 18:07:26 +0530, Sumit Garg wrote:
> Qcom SoCs derived boards can come from various OEMs/ODMs and not just
> Qcom itself. So allow CONFIG_SYS_VENDOR to be set correctly
> corressponding to the actual board vendor.
> 
> 

Applied, thanks!

[1/1] mach-snapdragon: Allow other board vendors apart from Qcom
  commit: b01c8a8ea420a422bbb0550f7dff8ec5a2a03979

Best regards,
-- 
Caleb Connolly 



Re: [PATCH v2 1/5] pinctrl: qcom: allow selecting with ARCH_IPQ40XX

2024-04-23 Thread Caleb Connolly


On Mon, 22 Apr 2024 13:43:24 +0200, Robert Marko wrote:
> IPQ4019 pinctrl driver was moved to the dedicated Qualcomm pinctrl
> directory, but the KConfig depends on ARCH_SNAPDRAGON only and thus
> PINCTRL_QCOM_IPQ4019 cannot be selected when ARCH_IPQ40XX is used.
> 
> 

Applied, thanks!

[1/5] pinctrl: qcom: allow selecting with ARCH_IPQ40XX
  commit: 622f676801f3d4a45524874ab8bf6ee498acbb5c
[2/5] mach-ipq40xx: import GPIO header from mach-snapgradon
  commit: a2830931490952b3130c22fd3259123b27ee9889
[3/5] pinctrl: qcom: ipq4019: adapt pin name lookup to upstream DTS
  commit: c88f0b12595f250ae7192c7427a9ca75dbdc59d9
[4/5] pinctrl: qcom: ipq4019: enable DM_FLAG_PRE_RELOC
  commit: 1dd073b3a9738325569c71028962924ab69a3e1c
[5/5] pinctrl: qcom: ipq4019: support all pin functions
  commit: 8c4c6a268e35523e6a8130f93c51b60a6341e8a2

Best regards,
-- 
Caleb Connolly 



Re: [PATCH] arm: mach-ipq40xx: dont select SMEM by default

2024-04-23 Thread Caleb Connolly


On Thu, 18 Apr 2024 11:17:00 +0200, Robert Marko wrote:
> IPQ40xx SoC-s dont have proper SMEM support like more modern Qualcomm
> SoC-s so there is no point in selecting the required drivers.
> 
> 

Applied, thanks!

[1/1] arm: mach-ipq40xx: dont select SMEM by default
  commit: c38dcb217c8be0aae7e8e1bb1fb3c31850fa89c3

Best regards,
-- 
Caleb Connolly 



Re: [PATCH 0/3] qcom: switch to OF_UPSTREAM

2024-04-23 Thread Caleb Connolly


On Thu, 18 Apr 2024 18:24:08 +0100, Caleb Connolly wrote:
> This series does the initial switch to OF_UPSTREAM for Qualcomm
> platforms. The DT files we have in U-Boot are outdated by now, so drop
> them and move to upstream.
> 
> Patch 2 drops all the Qualcomm dts files that are now provided in
> dts/upstream. As some of the files exceed the 100k size limit by
> themselves I thought it would be easier to just lump them together
> rather than trying to split them up.
> 
> [...]

Applied, thanks!

[1/3] mach-snapdragon: use OF_UPSTREAM
  commit: a149974d3cf81dfc11254e3093f645bec3d5d88e
[2/3] arm: dts: drop qcom dts files
  commit: 4a30052dee8726cfa9b1f6873496389ae1732ba4
[3/3] qcom_defconfig: set SYS_INIT_SP_BSS_OFFSET
  commit: 813bc424871caf3decffb50119906bcdbf33d973

Best regards,
-- 
Caleb Connolly 



Re: [PATCH v3] rockchip: px30-board-tpl: Sync ifdef guards with full TPL

2024-04-23 Thread Kever Yang



On 2024/4/17 19:21, lukasz.czechow...@thaumatec.com wrote:

From: Lukasz Czechowski 

Display TPL init information message only when TPL_BANNER_PRINT
configuration entry is set. This allows to disable information
message in case logs on UART are unwanted.
Update parent ifdef condition to check also CONFIG_TPL_SERIAL
to match logic of the non-PX30 TPL implementation.

Signed-off-by: Lukasz Czechowski 

Reviewed-by: Kever Yang 

Thanks,
- Kever


---
Changes for v2:
- Updated parent ifdef condition

Changes for v3:
- Updated commit title
---
  arch/arm/mach-rockchip/px30-board-tpl.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/px30-board-tpl.c 
b/arch/arm/mach-rockchip/px30-board-tpl.c
index 637a5e1b18..db368a7b8c 100644
--- a/arch/arm/mach-rockchip/px30-board-tpl.c
+++ b/arch/arm/mach-rockchip/px30-board-tpl.c
@@ -36,7 +36,7 @@ void board_init_f(ulong dummy)
  {
int ret;
  
-#ifdef CONFIG_DEBUG_UART

+#if defined(CONFIG_DEBUG_UART) && defined(CONFIG_TPL_SERIAL)
debug_uart_init();
/*
 * Debug UART can be used from here if required:
@@ -46,7 +46,9 @@ void board_init_f(ulong dummy)
 * printhex8(0x1234);
 * printascii("string");
 */
+#if CONFIG_TPL_BANNER_PRINT
printascii("U-Boot TPL board init\n");
+#endif
  #endif
  
  	secure_timer_init();


Re: [RESEND PATCH v2] configs: rk3588-turing-rk1: disable SPI flash by default

2024-04-23 Thread Kever Yang

Hi Sam,

    Please help to rebase on latest code, or else I'm not able to apply it.


Thanks,

- Kever

On 2024/4/14 04:56, Sam Edwards wrote:

While the Turing RK1 board has a pad on the PCB for SPI flash, it is
not populated at the factory: supporting SPI flash boot is a user
modification, not an out-of-the-box feature. The defconfig for this
board should therefore not be enabling the SPI flash image nor SPI
support in the SPL, as it causes confusion among downstream users as to
whether the SPI image needs to be distributed.

Fixes: 153ac950a599 ("board: rockchip: Add the Turing RK1 SoM")
Suggested-by: Florian Klink 
Signed-off-by: Sam Edwards 
Acked-by: Joshua Riek 
Reviewed-by: Jonas Karlman 
---

Changes v1->v2 (both requested by Jonas):
- Added back (i.e. made unremoved by patch) CONFIG_USB_GADGET_PRODUCT_NUM value
   previously automatically removed by savedefconfig.
- Also disable SPI/SFC driver entirely until SPI/SFC lands in the DT (if ever).

---
  configs/turing-rk1-rk3588_defconfig | 14 +-
  1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/configs/turing-rk1-rk3588_defconfig 
b/configs/turing-rk1-rk3588_defconfig
index 07f7b84852..f500b0cf75 100644
--- a/configs/turing-rk1-rk3588_defconfig
+++ b/configs/turing-rk1-rk3588_defconfig
@@ -4,17 +4,12 @@ CONFIG_SYS_HAS_NONCACHED_MEMORY=y
  CONFIG_COUNTER_FREQUENCY=2400
  CONFIG_ARCH_ROCKCHIP=y
  CONFIG_NR_DRAM_BANKS=2
-CONFIG_SF_DEFAULT_SPEED=2400
-CONFIG_SF_DEFAULT_MODE=0x2000
  CONFIG_DEFAULT_DEVICE_TREE="rk3588-turing-rk1"
  CONFIG_ROCKCHIP_RK3588=y
-CONFIG_ROCKCHIP_SPI_IMAGE=y
  CONFIG_SPL_SERIAL=y
  CONFIG_TARGET_TURINGRK1_RK3588=y
  CONFIG_DEBUG_UART_BASE=0xFEBC
  CONFIG_DEBUG_UART_CLOCK=2400
-CONFIG_SPL_SPI_FLASH_SUPPORT=y
-CONFIG_SPL_SPI=y
  CONFIG_SYS_LOAD_ADDR=0xc00800
  CONFIG_PCI=y
  CONFIG_DEBUG_UART=y
@@ -31,8 +26,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_SPL_MAX_SIZE=0x4
  CONFIG_SPL_PAD_TO=0x7f8000
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
-CONFIG_SPL_SPI_LOAD=y
-CONFIG_SYS_SPI_U_BOOT_OFFS=0x6
  CONFIG_SPL_ATF=y
  CONFIG_CMD_GPIO=y
  CONFIG_CMD_GPT=y
@@ -66,11 +59,7 @@ CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
-CONFIG_SF_DEFAULT_BUS=5
-CONFIG_SPI_FLASH_SFDP_SUPPORT=y
-CONFIG_SPI_FLASH_MACRONIX=y
-CONFIG_SPI_FLASH_XMC=y
-CONFIG_SPI_FLASH_XTX=y
+# CONFIG_SPI_FLASH is not set
  CONFIG_PHY_REALTEK=y
  CONFIG_DWC_ETH_QOS=y
  CONFIG_DWC_ETH_QOS_ROCKCHIP=y
@@ -87,7 +76,6 @@ CONFIG_SPL_RAM=y
  CONFIG_SCSI=y
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
-CONFIG_ROCKCHIP_SFC=y
  CONFIG_SYSRESET=y
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y


[PATCH] sysreset: add Qualcomm PSHOLD reset driver

2024-04-23 Thread Robert Marko
Number of Qualcomm ARMv7 SoC-s did not use PSCI but rather used PSHOLD
(Qualcomm Power Supply Hold Reset) bit to trigger reset or poweroff.

Qualcomm IPQ40XX is one of them, so provide a simple sysreset driver based
on the upstream Linux one, it is DT compatible as well.

Signed-off-by: Robert Marko 
---
 drivers/sysreset/Kconfig   |  6 +++
 drivers/sysreset/Makefile  |  1 +
 drivers/sysreset/sysreset_msm-pshold.c | 56 ++
 3 files changed, 63 insertions(+)
 create mode 100644 drivers/sysreset/sysreset_msm-pshold.c

diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 49c0787b26..30ff9e576d 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -235,6 +235,12 @@ config SYSRESET_RAA215300
help
  Add support for the system reboot via the Renesas RAA215300 PMIC.
 
+config SYSRESET_MSM_PSHOLD
+   bool "Support sysreset for Qualcomm SoCs via PSHOLD"
+   depends on ARCH_IPQ40XX
+   help
+ Add support for the system reboot on Qualcomm SoCs via PSHOLD.
+
 endif
 
 endmenu
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index e0e732205d..da61dca8e2 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -28,4 +28,5 @@ obj-$(CONFIG_SYSRESET_RESETCTL) += sysreset_resetctl.o
 obj-$(CONFIG_$(SPL_TPL_)SYSRESET_AT91) += sysreset_at91.o
 obj-$(CONFIG_$(SPL_TPL_)SYSRESET_X86) += sysreset_x86.o
 obj-$(CONFIG_SYSRESET_RAA215300) += sysreset_raa215300.o
+obj-$(CONFIG_SYSRESET_MSM_PSHOLD) += sysreset_msm-pshold.o
 obj-$(CONFIG_TARGET_XTFPGA) += sysreset_xtfpga.o
diff --git a/drivers/sysreset/sysreset_msm-pshold.c 
b/drivers/sysreset/sysreset_msm-pshold.c
new file mode 100644
index 00..d25a412954
--- /dev/null
+++ b/drivers/sysreset/sysreset_msm-pshold.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Qualcomm PSHOLD reset driver
+ *
+ * Copyright (c) 2024 Sartura Ltd.
+ *
+ * Author: Robert Marko 
+ * Based on the Linux msm-poweroff driver.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct msm_pshold_priv {
+   phys_addr_t base;
+};
+
+static int msm_pshold_request(struct udevice *dev, enum sysreset_t type)
+{
+   struct msm_pshold_priv *priv = dev_get_priv(dev);
+
+   writel(0, priv->base);
+   mdelay(1);
+
+   return 0;
+}
+
+static struct sysreset_ops msm_pshold_ops = {
+   .request = msm_pshold_request,
+};
+
+static int msm_pshold_probe(struct udevice *dev)
+{
+   struct msm_pshold_priv *priv = dev_get_priv(dev);
+
+   priv->base = dev_read_addr(dev);
+   return priv->base == FDT_ADDR_T_NONE ? -EINVAL : 0;
+}
+
+static const struct udevice_id msm_pshold_ids[] = {
+   { .compatible = "qcom,pshold", },
+   { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(msm_pshold) = {
+   .name   = "msm_pshold",
+   .id = UCLASS_SYSRESET,
+   .of_match   = msm_pshold_ids,
+   .probe  = msm_pshold_probe,
+   .priv_auto  = sizeof(struct msm_pshold_priv),
+   .ops= _pshold_ops,
+};
-- 
2.44.0



Re: [PATCH 00/31] rockchip: rk3399: Sync DT with linux v6.8 and update defconfigs

2024-04-23 Thread Kever Yang

Hi Jonas,


On 2024/4/1 04:28, Jonas Karlman wrote:

This series adds support for new clocks used in linux v6.8 device trees,
enables use of FIT signature check for checksum validation and fixes
loading FIT from SD-card when loading FIT from eMMC fails.

After this series it should be possible to move RK3399 boards to use
OF_UPSTREAM in a future patch once dts/upstream move to a v6.8+ tag.

I have runtime tested this series on following devices:
- 96boards Rock960
- Khadas Edge Captain
- Pine64 PineBook Pro
- Pine64 RockPro64
- Radxa ROCK 4C+
- Radxa ROCK 4SE
- Radxa ROCK Pi 4A
- Radxa ROCK Pi 4B+

This series depends on the following series:
- Enable booting from SPI flash on ROCK Pi 4 [1]
- rockchip: spl: Cache boot source id for later use [2]


    This patch set not able to apply after this dependent patchset 
update to v2,


please help to send a new version.


Thanks,

- Kever



A copy of this series and all its depends can be found at [3]

[1] https://patchwork.ozlabs.org/cover/1912469/
[2] https://patchwork.ozlabs.org/cover/1915071/
[3] https://github.com/Kwiboo/u-boot-rockchip/commits/rk3399-dt-sync-v1

Jonas Karlman (31):
   rockchip: rk3399-gru: Fix max SPL size on bob and kevin
   rockchip: rk3399-ficus: Enable TPL and use common bss and stack addr
   rockchip: rk3399: Sort imply statements alphabetically
   rockchip: rk3399: Enable ARMv8 crypto and FIT checksum validation
   rockchip: rk3399: Enable random generator on all boards
   rockchip: rk3399: Imply support for GbE PHY
   rockchip: rk3399: Enable DT overlay support on all boards
   rockchip: rk3399: Remove use of xPL_MISC_DRIVERS options
   rockchip: rk3399: Add a default spl-boot-order prop
   rockchip: rk3399: Fix loading FIT from SD-card when booting from eMMC
   clk: rockchip: rk3399: Rename SCLK_DDRCLK to SCLK_DDRC
   clk: rockchip: rk3399: Add dummy support for ACLK_VDU clock
   clk: rockchip: rk3399: Add dummy support for SCLK_PCIEPHY_REF clock
   clk: rockchip: rk3399: Add SCLK_USB3OTGx_REF support
   rockchip: rk3399: Sync soc device tree from linux v6.8
   rockchip: rk3399-gru: Sync device tree from linux v6.8
   rockchip: rk3399-puma: Sync DT from linux v6.8
   rockchip: rk3399-rock-pi-n10: Sync device tree from linux v6.8
   rockchip: rk3399-eaidk-610: Sync device tree from linux v6.8
   rockchip: rk3399-leez: Sync device tree from linux v6.8
   rockchip: rk3399-evb: Sync device tree from linux v6.8
   rockchip: rk3399-firefly: Sync device tree from linux v6.8
   rockchip: rk3399-orangepi: Sync device tree from linux v6.8
   rockchip: rk3399-roc-pc: Sync device tree from linux v6.8
   rockchip: rk3399-nanopi-4: Sync device tree from linux v6.8
   rockchip: rk3399-rock960: Sync device tree from linux v6.8
   rockchip: rk3399-khadas: Sync device tree from linux v6.8
   rockchip: rk3399-rock-pi-4: Sync device tree from linux v6.8
   rockchip: rk3399-rockpro64: Sync device tree from linux v6.8
   rockchip: rk3399-pinebook-pro: Sync device tree from linux v6.8
   rockchip: rk3399-pinephone-pro: Sync device tree from linux v6.8

  arch/arm/dts/rk3288-vmarc-som.dtsi|  48 +++
  arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi |   1 -
  arch/arm/dts/rk3399-eaidk-610.dts |   3 +-
  arch/arm/dts/rk3399-evb-u-boot.dtsi   |  13 +-
  arch/arm/dts/rk3399-evb.dts   |   3 +-
  arch/arm/dts/rk3399-ficus-u-boot.dtsi |  10 +-
  arch/arm/dts/rk3399-ficus.dts |   4 +
  arch/arm/dts/rk3399-firefly-u-boot.dtsi   |   6 -
  arch/arm/dts/rk3399-firefly.dts   |  17 +-
  arch/arm/dts/rk3399-gru-bob.dts   |   8 +-
  arch/arm/dts/rk3399-gru-chromebook.dtsi   | 200 +++-
  arch/arm/dts/rk3399-gru-kevin.dts |   3 +-
  arch/arm/dts/rk3399-gru-u-boot.dtsi   |  34 ++-
  arch/arm/dts/rk3399-gru.dtsi  |  52 +++-
  arch/arm/dts/rk3399-khadas-edge-captain.dts   |   4 +
  arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi   |   7 +-
  arch/arm/dts/rk3399-khadas-edge-v.dts |   4 +
  arch/arm/dts/rk3399-khadas-edge.dtsi  |  10 +-
  arch/arm/dts/rk3399-leez-p710-u-boot.dtsi |   6 -
  arch/arm/dts/rk3399-leez-p710.dts |   8 +-
  arch/arm/dts/rk3399-nanopc-t4.dts |   2 +-
  arch/arm/dts/rk3399-nanopi-m4-2gb.dts |  55 +---
  arch/arm/dts/rk3399-nanopi-m4b.dts|   2 +-
  arch/arm/dts/rk3399-nanopi-r4s.dts|   4 +-
  arch/arm/dts/rk3399-nanopi4-u-boot.dtsi   |  18 +-
  arch/arm/dts/rk3399-nanopi4.dtsi  |   7 +-
  arch/arm/dts/rk3399-op1-opp.dtsi  |  31 +-
  arch/arm/dts/rk3399-opp.dtsi  |   6 +-
  arch/arm/dts/rk3399-orangepi-u-boot.dtsi  |  12 +
  arch/arm/dts/rk3399-orangepi.dts  |  12 +-
  arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi  |  23 +-
  arch/arm/dts/rk3399-pinebook-pro.dts  |  24 +-
  arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi |  24 +-
  arch/arm/dts/rk3399-pinephone-pro.dts

Re: [PATCH] board: sl28: move to OF_UPSTREAM

2024-04-23 Thread Peng Fan
On Mon, Apr 15, 2024 at 10:14:56AM +0200, Michael Walle wrote:
>On Wed Mar 6, 2024 at 5:19 PM CET, Michael Walle wrote:
>> Use the new device devicetree files in dts/upstream/ and delete the old
>> ones. Still keep the -u-boot.dtsi with all u-boot specifics around.
>>
>> There is one catch and that is fsl-ls1028a-kontron-sl28-var3.dts which
>> is not available upstream (yet!). For now, the base dts is used for this
>> variant as this only differ in the compatible and the (human readable)
>> model name.
>>
>> Signed-off-by: Michael Walle 
>
>Ping. Any news here?

Applied.

Thanks,
Peng.

>
>-michael



-- 


Re: [PATCH 31/31] rockchip: rk3399-pinephone-pro: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-pinephone-pro device tree from linux v6.8.

Add SPI flash related node and options to support booting from SPI flash.

Remove REGULATOR_PWM=y, board does not use pwm-regulator compatible.

Add SYS_NS16550_MEM32=y to use readl/writel for serial console.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi |  12 ++
  arch/arm/dts/rk3399-pinephone-pro.dts | 147 ++
  configs/pinephone-pro-rk3399_defconfig|   8 +-
  3 files changed, 163 insertions(+), 4 deletions(-)

diff --git a/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi 
b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi
index dcfcec4f3072..6a248691e29d 100644
--- a/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi
@@ -13,3 +13,15 @@
   {
max-frequency = <2000>;
  };
+
+ {
+   status = "okay";
+
+   flash@0 {
+   bootph-pre-ram;
+   bootph-some-ram;
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <1000>;
+   };
+};
diff --git a/arch/arm/dts/rk3399-pinephone-pro.dts 
b/arch/arm/dts/rk3399-pinephone-pro.dts
index 04403a76238b..61f3fec5a8b1 100644
--- a/arch/arm/dts/rk3399-pinephone-pro.dts
+++ b/arch/arm/dts/rk3399-pinephone-pro.dts
@@ -10,6 +10,7 @@
   */
  
  /dts-v1/;

+#include 
  #include 
  #include "rk3399.dtsi"
  #include "rk3399-opp.dtsi"
@@ -29,6 +30,31 @@
stdout-path = "serial2:115200n8";
};
  
+	adc-keys {

+   compatible = "adc-keys";
+   io-channels = < 1>;
+   io-channel-names = "buttons";
+   keyup-threshold-microvolt = <160>;
+   poll-interval = <100>;
+
+   button-up {
+   label = "Volume Up";
+   linux,code = ;
+   press-threshold-microvolt = <10>;
+   };
+
+   button-down {
+   label = "Volume Down";
+   linux,code = ;
+   press-threshold-microvolt = <60>;
+   };
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 5 0>;
+   };
+
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
@@ -102,6 +128,37 @@
/* WL_REG_ON on module */
reset-gpios = < RK_PB2 GPIO_ACTIVE_LOW>;
};
+
+   /* MIPI DSI panel 1.8v supply */
+   vcc1v8_lcd: vcc1v8-lcd {
+   compatible = "regulator-fixed";
+   enable-active-high;
+   regulator-name = "vcc1v8_lcd";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   vin-supply = <_sys>;
+   gpio = < RK_PA5 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   };
+
+   /* MIPI DSI panel 2.8v supply */
+   vcc2v8_lcd: vcc2v8-lcd {
+   compatible = "regulator-fixed";
+   enable-active-high;
+   regulator-name = "vcc2v8_lcd";
+   regulator-min-microvolt = <280>;
+   regulator-max-microvolt = <280>;
+   vin-supply = <_sys>;
+   gpio = < RK_PA1 GPIO_ACTIVE_HIGH>;
+   pinctrl-names = "default";
+   };
+};
+
+_alert0 {
+   temperature = <65000>;
+};
+_alert1 {
+   temperature = <68000>;
  };
  
  _l0 {

@@ -132,6 +189,11 @@
status = "okay";
  };
  
+ {

+   mali-supply = <_gpu>;
+   status = "okay";
+};
+
   {
clock-frequency = <40>;
i2c-scl-rising-time-ns = <168>;
@@ -326,6 +388,25 @@
};
  };
  
+ {

+   i2c-scl-rising-time-ns = <450>;
+   i2c-scl-falling-time-ns = <15>;
+   status = "okay";
+
+   touchscreen@14 {
+   compatible = "goodix,gt1158";
+   reg = <0x14>;
+   interrupt-parent = <>;
+   interrupts = ;
+   irq-gpios = < RK_PB5 GPIO_ACTIVE_HIGH>;
+   reset-gpios = < RK_PB4 GPIO_ACTIVE_HIGH>;
+   AVDD28-supply = <_touch>;
+   VDDIO-supply = <_touch>;
+   touchscreen-size-x = <720>;
+   touchscreen-size-y = <1440>;
+   };
+};
+
  _opp {
opp04 {
status = "disabled";
@@ -355,6 +436,39 @@
status = "okay";
  };
  
+_dsi {

+   status = "okay";
+   clock-master;
+
+   ports {
+   mipi_out: port@1 {
+   #address-cells = <0>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   mipi_out_panel: endpoint {
+   remote-endpoint = <_in_panel>;
+ 

Re: [PATCH 30/31] rockchip: rk3399-pinebook-pro: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-pinebook-pro device tree from linux v6.8.

Add SF_DEFAULT_SPEED=1000 and SPI_FLASH_SFDP_SUPPORT=y to improve
support for booting from SPI flash.

Add CMD_POWEROFF=y to support poweroff using cmdline and power on using
the pwr button on the board.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-pinebook-pro.dts  | 24 +++-
  configs/pinebook-pro-rk3399_defconfig |  6 --
  2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts 
b/arch/arm/dts/rk3399-pinebook-pro.dts
index d6b68d77d63a..054c6a4d1a45 100644
--- a/arch/arm/dts/rk3399-pinebook-pro.dts
+++ b/arch/arm/dts/rk3399-pinebook-pro.dts
@@ -50,19 +50,9 @@
pinctrl-0 = <_en_pin>;
power-supply = <_panel>;
  
-		ports {

-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   port@0 {
-   reg = <0>;
-   #address-cells = <1>;
-   #size-cells = <0>;
-
-   panel_in_edp: endpoint@0 {
-   reg = <0>;
-   remote-endpoint = <_out_panel>;
-   };
+   port {
+   panel_in_edp: endpoint {
+   remote-endpoint = <_out_panel>;
};
};
};
@@ -76,7 +66,7 @@
pinctrl-names = "default";
pinctrl-0 = <_pin>;
  
-		lid {

+   switch-lid {
debounce-interval = <20>;
gpios = < RK_PA1 GPIO_ACTIVE_LOW>;
label = "Lid";
@@ -92,7 +82,7 @@
pinctrl-names = "default";
pinctrl-0 = <_pin>;
  
-		power {

+   key-power {
debounce-interval = <20>;
gpios = < RK_PA5 GPIO_ACTIVE_LOW>;
label = "Power";
@@ -675,7 +665,7 @@
i2c-scl-rising-time-ns = <168>;
status = "okay";
  
-	es8316: es8316@11 {

+   es8316: audio-codec@11 {
compatible = "everest,es8316";
reg = <0x11>;
clocks = < SCLK_I2S_8CH_OUT>;
@@ -943,7 +933,7 @@
disable-wp;
pinctrl-names = "default";
pinctrl-0 = <_clk _cmd _bus4>;
-   sd-uhs-sdr104;
+   sd-uhs-sdr50;
vmmc-supply = <_sd>;
vqmmc-supply = <_sdio>;
status = "okay";
diff --git a/configs/pinebook-pro-rk3399_defconfig 
b/configs/pinebook-pro-rk3399_defconfig
index dd8bc2b72cc3..8ac6ddd49dea 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -4,7 +4,7 @@ CONFIG_COUNTER_FREQUENCY=2400
  CONFIG_ARCH_ROCKCHIP=y
  CONFIG_SPL_GPIO=y
  CONFIG_NR_DRAM_BANKS=1
-CONFIG_SF_DEFAULT_SPEED=2000
+CONFIG_SF_DEFAULT_SPEED=1000
  CONFIG_ENV_SIZE=0x8000
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-pinebook-pro"
@@ -36,6 +36,7 @@ CONFIG_CMD_GPT=y
  CONFIG_CMD_I2C=y
  CONFIG_CMD_MMC=y
  CONFIG_CMD_PCI=y
+CONFIG_CMD_POWEROFF=y
  CONFIG_CMD_USB=y
  # CONFIG_CMD_SETEXPR is not set
  CONFIG_CMD_TIME=y
@@ -64,7 +65,9 @@ CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
  CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
  CONFIG_SPI_FLASH_GIGADEVICE=y
+CONFIG_SPI_FLASH_SILICONKAISER=y
  CONFIG_SPI_FLASH_WINBOND=y
  CONFIG_NVME_PCI=y
  CONFIG_PHY_ROCKCHIP_INNO_USB2=y
@@ -98,5 +101,4 @@ CONFIG_VIDEO=y
  CONFIG_DISPLAY=y
  CONFIG_VIDEO_ROCKCHIP=y
  CONFIG_DISPLAY_ROCKCHIP_EDP=y
-CONFIG_SPL_TINY_MEMSET=y
  CONFIG_ERRNO_STR=y


Re: [PATCH 29/31] rockchip: rk3399-rockpro64: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-rockpro64 device tree from linux v6.8.

Add SF_DEFAULT_SPEED=1000 and SPI_FLASH_SFDP_SUPPORT=y to improve
support for booting from SPI flash.

Remove USE_PREBOOT=y to speed up booting, standard boot will init USB
after faster boot media has been evaluated.

Add CMD_POWEROFF=y to support poweroff using cmdline and power on using
the pwr button on the board.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-rockpro64.dtsi | 98 --
  configs/rockpro64-rk3399_defconfig |  7 ++-
  2 files changed, 97 insertions(+), 8 deletions(-)

diff --git a/arch/arm/dts/rk3399-rockpro64.dtsi 
b/arch/arm/dts/rk3399-rockpro64.dtsi
index 6bff8db7d33e..f30b82a10ca3 100644
--- a/arch/arm/dts/rk3399-rockpro64.dtsi
+++ b/arch/arm/dts/rk3399-rockpro64.dtsi
@@ -11,6 +11,7 @@
  
  / {

aliases {
+   ethernet0 = 
mmc0 = 
mmc1 = 
mmc2 = 
@@ -20,6 +21,15 @@
stdout-path = "serial2:150n8";
};
  
+	/* enable for panel backlight support */

+   backlight: backlight {
+   compatible = "pwm-backlight";
+   brightness-levels = <0 4 8 16 32 64 128 255>;
+   default-brightness-level = <5>;
+   pwms = < 0 100 0>;
+   status = "disabled";
+   };
+
clkin_gmac: external-gmac-clock {
compatible = "fixed-clock";
clock-frequency = <12500>;
@@ -33,7 +43,7 @@
pinctrl-names = "default";
pinctrl-0 = <>;
  
-		power {

+   key-power {
debounce-interval = <100>;
gpios = < RK_PA5 GPIO_ACTIVE_LOW>;
label = "GPIO Key Power";
@@ -69,6 +79,7 @@
  
  	fan: pwm-fan {

compatible = "pwm-fan";
+   cooling-levels = <0 100 150 200 255>;
#cooling-cells = <2>;
fan-supply = <_dcin>;
pwms = < 0 5 0>;
@@ -106,6 +117,14 @@
};
};
  
+	avdd: avdd-regulator {

+   compatible = "regulator-fixed";
+   regulator-name = "avdd";
+   regulator-min-microvolt = <1100>;
+   regulator-max-microvolt = <1100>;
+   vin-supply = <_s0>;
+   };
+
vcc12v_dcin: vcc12v-dcin {
compatible = "regulator-fixed";
regulator-name = "vcc12v_dcin";
@@ -212,12 +231,12 @@
vdd_log: vdd-log {
compatible = "pwm-regulator";
pwms = < 0 25000 1>;
+   pwm-supply = <_sys>;
regulator-name = "vdd_log";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <80>;
regulator-max-microvolt = <170>;
-   vin-supply = <_sys>;
};
  };
  
@@ -245,6 +264,34 @@

cpu-supply = <_cpu_b>;
  };
  
+_thermal {

+   trips {
+   cpu_warm: cpu_warm {
+   temperature = <55000>;
+   hysteresis = <2000>;
+   type = "active";
+   };
+
+   cpu_hot: cpu_hot {
+   temperature = <65000>;
+   hysteresis = <2000>;
+   type = "active";
+   };
+   };
+
+   cooling-maps {
+   map2 {
+   trip = <_warm>;
+   cooling-device = < THERMAL_NO_LIMIT 1>;
+   };
+
+   map3 {
+   trip = <_hot>;
+   cooling-device = < 2 THERMAL_NO_LIMIT>;
+   };
+   };
+};
+
  _phy {
status = "okay";
  };
@@ -371,8 +418,6 @@
  
  			vcc3v0_touch: LDO_REG2 {

regulator-name = "vcc3v0_touch";
-   regulator-always-on;
-   regulator-boot-on;
regulator-min-microvolt = <300>;
regulator-max-microvolt = <300>;
regulator-state-mem {
@@ -461,8 +506,6 @@
  
  			vcc3v3_s0: SWITCH_REG2 {

regulator-name = "vcc3v3_s0";
-   regulator-always-on;
-   regulator-boot-on;
regulator-state-mem {
regulator-off-in-suspend;
};
@@ -536,6 +579,19 @@
vbus-supply = <_typec>;
status = "okay";
};
+
+   /* enable for pine64 touch screen support */
+   touch: touchscreen@5d {
+   compatible = 

Re: [PATCH 28/31] rockchip: rk3399-rock-pi-4: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-rock-pi-4 related device tree from linux v6.8.

Add SPI flash related options to support booting from SPI flash.

Add AHCI=y, SCSI_AHCI=y, AHCI_PCI=y and SCSI=y to support PCIe SATA boot.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi | 12 ++
  arch/arm/dts/rk3399-rock-4c-plus.dts |  1 +
  arch/arm/dts/rk3399-rock-4se-u-boot.dtsi | 12 ++
  arch/arm/dts/rk3399-rock-pi-4.dtsi   |  4 +++-
  arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi   |  7 ++
  arch/arm/dts/rk3399-rock-pi-4c.dts   | 10 
  configs/rock-4c-plus-rk3399_defconfig| 24 +++-
  configs/rock-4se-rk3399_defconfig| 23 +--
  configs/rock-pi-4-rk3399_defconfig   |  8 +++
  configs/rock-pi-4c-rk3399_defconfig  | 24 ++--
  10 files changed, 114 insertions(+), 11 deletions(-)

diff --git a/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi 
b/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
index 9785b97b9eea..b5ee644a83dd 100644
--- a/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi
@@ -11,3 +11,15 @@
  _pull_up_8ma {
bootph-pre-ram;
  };
+
+ {
+   status = "okay";
+
+   flash@0 {
+   bootph-pre-ram;
+   bootph-some-ram;
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <1000>;
+   };
+};
diff --git a/arch/arm/dts/rk3399-rock-4c-plus.dts 
b/arch/arm/dts/rk3399-rock-4c-plus.dts
index 8bfd5f88d1ef..7baf9d1b22fd 100644
--- a/arch/arm/dts/rk3399-rock-4c-plus.dts
+++ b/arch/arm/dts/rk3399-rock-4c-plus.dts
@@ -15,6 +15,7 @@
compatible = "radxa,rock-4c-plus", "rockchip,rk3399";
  
  	aliases {

+   ethernet0 = 
mmc0 = 
mmc1 = 
};
diff --git a/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi 
b/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
index 85ee5770add0..2213d0093052 100644
--- a/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock-4se-u-boot.dtsi
@@ -4,3 +4,15 @@
   */
  
  #include "rk3399-rock-pi-4-u-boot.dtsi"

+
+ {
+   status = "okay";
+
+   flash@0 {
+   bootph-pre-ram;
+   bootph-some-ram;
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <1000>;
+   };
+};
diff --git a/arch/arm/dts/rk3399-rock-pi-4.dtsi 
b/arch/arm/dts/rk3399-rock-pi-4.dtsi
index b1b7f4ffb1d4..281a12180703 100644
--- a/arch/arm/dts/rk3399-rock-pi-4.dtsi
+++ b/arch/arm/dts/rk3399-rock-pi-4.dtsi
@@ -12,6 +12,7 @@
  
  / {

aliases {
+   ethernet0 = 
mmc0 = 
mmc1 = 
};
@@ -44,7 +45,7 @@
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
clocks = < 1>;
-   clock-names = "ext_clock";
+   clock-names = "lpo";
pinctrl-names = "default";
pinctrl-0 = <_enable_h>;
reset-gpios = < RK_PB2 GPIO_ACTIVE_LOW>;
@@ -492,6 +493,7 @@
  
   {

pinctrl-0 = <_2ch_bus>;
+   pinctrl-1 = <_2ch_bus_bclk_off>;
rockchip,capture-channels = <2>;
rockchip,playback-channels = <2>;
status = "okay";
diff --git a/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi 
b/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
index 85ee5770add0..38385621deb1 100644
--- a/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock-pi-4c-u-boot.dtsi
@@ -4,3 +4,10 @@
   */
  
  #include "rk3399-rock-pi-4-u-boot.dtsi"

+
+ {
+   flash@0 {
+   bootph-pre-ram;
+   bootph-some-ram;
+   };
+};
diff --git a/arch/arm/dts/rk3399-rock-pi-4c.dts 
b/arch/arm/dts/rk3399-rock-pi-4c.dts
index d32efab74e94..de2ebe4cb4f3 100644
--- a/arch/arm/dts/rk3399-rock-pi-4c.dts
+++ b/arch/arm/dts/rk3399-rock-pi-4c.dts
@@ -43,6 +43,16 @@
hp-det-gpio = < RK_PA0 GPIO_ACTIVE_HIGH>;
  };
  
+ {

+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <1000>;
+   };
+};
+
   {
status = "okay";
  
diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig

index 2024defb2bf0..e97fde17acc2 100644
--- a/configs/rock-4c-plus-rk3399_defconfig
+++ b/configs/rock-4c-plus-rk3399_defconfig
@@ -3,22 +3,27 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
  CONFIG_COUNTER_FREQUENCY=2400
  CONFIG_ARCH_ROCKCHIP=y
  CONFIG_NR_DRAM_BANKS=1
+CONFIG_SF_DEFAULT_SPEED=1000
  

Re: [PATCH 27/31] rockchip: rk3399-khadas: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-khadas related device tree from linux v6.8.

Add SPI flash related options to support booting from SPI flash.

Add DM_RESET=y to support reset signals.

Add PCI=y, CMD_PCI=y and NVME_PCI=y to support PCIe and NVMe boot.

Add AHCI=y, SCSI_AHCI=y, AHCI_PCI=y and SCSI=y to support PCIe SATA boot.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Add CMD_ROCKUSB=y, CMD_USB_MASS_STORAGE=y and USB_GADGET=y to support
RockUSB and UMS gadget.

Remove CONFIG_NET_RANDOM_ETHADDR=y, ethaddr and eth1addr is set based on
cpuid read from eFUSE.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add DM_ETH_PHY=y to support ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y and PHY_ROCKCHIP_TYPEC=y to support USB PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-khadas-edge-captain.dts  |  4 +++
  arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi  |  5 +++
  arch/arm/dts/rk3399-khadas-edge-v.dts|  4 +++
  arch/arm/dts/rk3399-khadas-edge.dtsi | 10 +++---
  configs/khadas-edge-captain-rk3399_defconfig | 33 ++--
  configs/khadas-edge-rk3399_defconfig | 27 +---
  configs/khadas-edge-v-rk3399_defconfig   | 33 ++--
  7 files changed, 100 insertions(+), 16 deletions(-)

diff --git a/arch/arm/dts/rk3399-khadas-edge-captain.dts 
b/arch/arm/dts/rk3399-khadas-edge-captain.dts
index 8302e51def52..99ac4ed0f13f 100644
--- a/arch/arm/dts/rk3399-khadas-edge-captain.dts
+++ b/arch/arm/dts/rk3399-khadas-edge-captain.dts
@@ -10,6 +10,10 @@
  / {
model = "Khadas Edge-Captain";
compatible = "khadas,edge-captain", "rockchip,rk3399";
+
+   aliases {
+   ethernet0 = 
+   };
  };
  
   {

diff --git a/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi 
b/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
index 4a3b23e48313..dd7a84d2b4a8 100644
--- a/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
@@ -6,6 +6,11 @@
  #include "rk3399-u-boot.dtsi"
  #include "rk3399-sdram-lpddr4-100.dtsi"
  
+ {

+   bootph-pre-ram;
+   bootph-some-ram;
+};
+
  _log {
regulator-init-microvolt = <95>;
  };
diff --git a/arch/arm/dts/rk3399-khadas-edge-v.dts 
b/arch/arm/dts/rk3399-khadas-edge-v.dts
index f5dcb99dc349..e12e7b4d64ca 100644
--- a/arch/arm/dts/rk3399-khadas-edge-v.dts
+++ b/arch/arm/dts/rk3399-khadas-edge-v.dts
@@ -10,6 +10,10 @@
  / {
model = "Khadas Edge-V";
compatible = "khadas,edge-v", "rockchip,rk3399";
+
+   aliases {
+   ethernet0 = 
+   };
  };
  
   {

diff --git a/arch/arm/dts/rk3399-khadas-edge.dtsi 
b/arch/arm/dts/rk3399-khadas-edge.dtsi
index d5c7648c841d..9d9297bc5f04 100644
--- a/arch/arm/dts/rk3399-khadas-edge.dtsi
+++ b/arch/arm/dts/rk3399-khadas-edge.dtsi
@@ -6,6 +6,7 @@
  
  /dts-v1/;

  #include 
+#include 
  #include 
  #include "rk3399.dtsi"
  #include "rk3399-opp.dtsi"
@@ -80,12 +81,12 @@
vdd_log: vdd-log {
compatible = "pwm-regulator";
pwms = < 0 25000 1>;
+   pwm-supply = <_3v3>;
regulator-name = "vdd_log";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <80>;
regulator-max-microvolt = <140>;
-   vin-supply = <_3v3>;
};
  
  	vsys: vsys {

@@ -122,7 +123,7 @@
keyup-threshold-microvolt = <180>;
poll-interval = <100>;
  
-		recovery {

+   button-recovery {
label = "Recovery";
linux,code = ;
press-threshold-microvolt = <18000>;
@@ -135,7 +136,7 @@
pinctrl-names = "default";
pinctrl-0 = <>;
  
-		power {

+   key-power {
debounce-interval = <100>;
gpios = < RK_PA5 GPIO_ACTIVE_LOW>;
label = "GPIO Key Power";
@@ -682,7 +683,7 @@
reg = <1>;
compatible = "brcm,bcm4329-fmac";
interrupt-parent = <>;
-   interrupts = ;
+   interrupts = ;
interrupt-names = "host-wake";
brcm,drive-strength = <5>;
pinctrl-names = "default";
@@ -705,7 +706,6 @@
   {
bus-width = <8>;
mmc-hs400-1_8v;
-   mmc-hs400-enhanced-strobe;
non-removable;
status = "okay";
  };
diff --git a/configs/khadas-edge-captain-rk3399_defconfig 
b/configs/khadas-edge-captain-rk3399_defconfig
index 230b9d796442..cf6516656e9a 100644
--- a/configs/khadas-edge-captain-rk3399_defconfig
+++ b/configs/khadas-edge-captain-rk3399_defconfig
@@ -3,51 +3,76 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
  CONFIG_COUNTER_FREQUENCY=2400
  

Re: [PATCH 26/31] rockchip: rk3399-rock960: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-rock960 related device tree from linux v6.8.

Add DM_RESET=y to support reset signals.

Add PCI=y, CMD_PCI=y and NVME_PCI=y to support PCIe and NVMe boot.

Add AHCI=y, SCSI_AHCI=y, AHCI_PCI=y and SCSI=y to support PCIe SATA boot.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Remove CONFIG_NET_RANDOM_ETHADDR=y, ethaddr and eth1addr is set based on
cpuid read from eFUSE.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y and PHY_ROCKCHIP_TYPEC=y to support USB PHY.

Remove REGULATOR_PWM=y and DM_REGULATOR_GPIO=y, boards does not use
pwm-regulator or regulator-gpio compatible.

Add USB_XHCI_HCD=y, USB_DWC3=y and USB_DWC3_GENERIC=y to support USB3.

Remove USE_PREBOOT=y to speed up booting, standard boot will init USB
after faster boot media has been evaluated.

Add CMD_ROCKUSB=y, CMD_USB_MASS_STORAGE=y and USB_GADGET=y to support
RockUSB and UMS gadget.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-ficus.dts|  4 
  arch/arm/dts/rk3399-rock960.dtsi |  5 -
  configs/ficus-rk3399_defconfig   | 22 +-
  configs/rock960-rk3399_defconfig | 14 +++---
  4 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/arch/arm/dts/rk3399-ficus.dts b/arch/arm/dts/rk3399-ficus.dts
index 1ce85a5816e4..30e4879f322c 100644
--- a/arch/arm/dts/rk3399-ficus.dts
+++ b/arch/arm/dts/rk3399-ficus.dts
@@ -13,6 +13,10 @@
model = "96boards RK3399 Ficus";
compatible = "vamrs,ficus", "rockchip,rk3399";
  
+	aliases {

+   ethernet0 = 
+   };
+
chosen {
stdout-path = "serial2:150n8";
};
diff --git a/arch/arm/dts/rk3399-rock960.dtsi b/arch/arm/dts/rk3399-rock960.dtsi
index 25dc61c26a94..c920ddf44baf 100644
--- a/arch/arm/dts/rk3399-rock960.dtsi
+++ b/arch/arm/dts/rk3399-rock960.dtsi
@@ -7,6 +7,7 @@
  
  #include "rk3399.dtsi"

  #include "rk3399-opp.dtsi"
+#include 
  
  / {

aliases {
@@ -127,6 +128,8 @@
  };
  
   {

+   avdd-0v9-supply = <_hdmi>;
+   avdd-1v8-supply = <_hdmi>;
ddc-i2c-bus = <>;
pinctrl-names = "default";
pinctrl-0 = <_cec>;
@@ -528,7 +531,7 @@
compatible = "brcm,bcm4329-fmac";
reg = <1>;
interrupt-parent = <>;
-   interrupts = ;
+   interrupts = ;
interrupt-names = "host-wake";
pinctrl-names = "default";
pinctrl-0 = <_host_wake_l>;
diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig
index f4e3ebba8f46..0d97b7ecb3c7 100644
--- a/configs/ficus-rk3399_defconfig
+++ b/configs/ficus-rk3399_defconfig
@@ -5,15 +5,18 @@ CONFIG_ARCH_ROCKCHIP=y
  CONFIG_SF_DEFAULT_SPEED=2000
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-ficus"
+CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_TARGET_ROCK960_RK3399=y
  CONFIG_DEBUG_UART_BASE=0xFF1A
  CONFIG_DEBUG_UART_CLOCK=2400
  CONFIG_SYS_LOAD_ADDR=0x800800
+CONFIG_PCI=y
  CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-ficus.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
  CONFIG_SPL_PAD_TO=0x7f8000
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
@@ -21,6 +24,7 @@ CONFIG_TPL=y
  CONFIG_CMD_BOOTZ=y
  CONFIG_CMD_GPT=y
  CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
  CONFIG_CMD_USB=y
  # CONFIG_CMD_SETEXPR is not set
  CONFIG_CMD_TIME=y
@@ -29,27 +33,35 @@ CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent 
assigned-clocks assigne
  CONFIG_ENV_IS_IN_MMC=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  CONFIG_SYS_MMC_ENV_DEV=1
-CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_PCI=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
+CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
  CONFIG_ETH_DESIGNWARE=y
-CONFIG_RGMII=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_NVME_PCI=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_TYPEC=y
  CONFIG_PMIC_RK8XX=y
-CONFIG_REGULATOR_PWM=y
-CONFIG_DM_REGULATOR_GPIO=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
+CONFIG_SCSI=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
  CONFIG_SYSRESET=y
  CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
  CONFIG_ERRNO_STR=y
diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index 3b5ab7dc5781..e19b28753156 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -12,11 +12,11 @@ 

Re: [PATCH 25/31] rockchip: rk3399-nanopi-4: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-nanopi-4 related device tree from linux v6.8.

Add DM_RESET=y to support reset signals.

Add PCI=y, CMD_PCI=y and NVME_PCI=y to support PCIe and NVMe boot.

Add AHCI=y, SCSI_AHCI=y, AHCI_PCI=y and SCSI=y to support PCIe SATA boot.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y and PHY_ROCKCHIP_TYPEC=y to support USB PHY.

Remove REGULATOR_PWM=y, boards does not use pwm-regulator compatible.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-nanopc-t4.dts   |  2 +-
  arch/arm/dts/rk3399-nanopi-m4-2gb.dts   | 55 +
  arch/arm/dts/rk3399-nanopi-m4b.dts  |  2 +-
  arch/arm/dts/rk3399-nanopi-r4s.dts  |  4 +-
  arch/arm/dts/rk3399-nanopi4-u-boot.dtsi |  4 ++
  arch/arm/dts/rk3399-nanopi4.dtsi|  7 ++--
  configs/nanopc-t4-rk3399_defconfig  | 14 +--
  configs/nanopi-m4-2gb-rk3399_defconfig  | 18 ++--
  configs/nanopi-m4-rk3399_defconfig  | 18 ++--
  configs/nanopi-m4b-rk3399_defconfig | 18 ++--
  configs/nanopi-neo4-rk3399_defconfig| 18 ++--
  configs/nanopi-r4s-rk3399_defconfig | 12 +++---
  12 files changed, 91 insertions(+), 81 deletions(-)

diff --git a/arch/arm/dts/rk3399-nanopc-t4.dts 
b/arch/arm/dts/rk3399-nanopc-t4.dts
index 452728b82e42..3bf8f959e42c 100644
--- a/arch/arm/dts/rk3399-nanopc-t4.dts
+++ b/arch/arm/dts/rk3399-nanopc-t4.dts
@@ -39,7 +39,7 @@
keyup-threshold-microvolt = <180>;
poll-interval = <100>;
  
-		recovery {

+   button-recovery {
label = "Recovery";
linux,code = ;
press-threshold-microvolt = <18000>;
diff --git a/arch/arm/dts/rk3399-nanopi-m4-2gb.dts 
b/arch/arm/dts/rk3399-nanopi-m4-2gb.dts
index 60358ab8c7df..e9cf71f224a3 100644
--- a/arch/arm/dts/rk3399-nanopi-m4-2gb.dts
+++ b/arch/arm/dts/rk3399-nanopi-m4-2gb.dts
@@ -10,57 +10,4 @@
   */
  
  /dts-v1/;

-#include "rk3399-nanopi4.dtsi"
-
-/ {
-   model = "FriendlyElec NanoPi M4";
-   compatible = "friendlyarm,nanopi-m4", "rockchip,rk3399";
-
-   vdd_5v: vdd-5v {
-   compatible = "regulator-fixed";
-   regulator-name = "vdd_5v";
-   regulator-always-on;
-   regulator-boot-on;
-   };
-
-   vcc5v0_core: vcc5v0-core {
-   compatible = "regulator-fixed";
-   regulator-name = "vcc5v0_core";
-   regulator-always-on;
-   regulator-boot-on;
-   vin-supply = <_5v>;
-   };
-
-   vcc5v0_usb1: vcc5v0-usb1 {
-   compatible = "regulator-fixed";
-   regulator-name = "vcc5v0_usb1";
-   regulator-always-on;
-   regulator-boot-on;
-   vin-supply = <_sys>;
-   };
-
-   vcc5v0_usb2: vcc5v0-usb2 {
-   compatible = "regulator-fixed";
-   regulator-name = "vcc5v0_usb2";
-   regulator-always-on;
-   regulator-boot-on;
-   vin-supply = <_sys>;
-   };
-};
-
-_sys {
-   vin-supply = <_core>;
-};
-
-_host {
-   phy-supply = <_usb1>;
-};
-
-_host {
-   phy-supply = <_usb2>;
-};
-
-_typec {
-   regulator-always-on;
-   vin-supply = <_5v>;
-};
+#include "rk3399-nanopi-m4.dts"
diff --git a/arch/arm/dts/rk3399-nanopi-m4b.dts 
b/arch/arm/dts/rk3399-nanopi-m4b.dts
index 72182c58cc46..65cb21837b0c 100644
--- a/arch/arm/dts/rk3399-nanopi-m4b.dts
+++ b/arch/arm/dts/rk3399-nanopi-m4b.dts
@@ -19,7 +19,7 @@
keyup-threshold-microvolt = <150>;
poll-interval = <100>;
  
-		recovery {

+   button-recovery {
label = "Recovery";
linux,code = ;
press-threshold-microvolt = <18000>;
diff --git a/arch/arm/dts/rk3399-nanopi-r4s.dts 
b/arch/arm/dts/rk3399-nanopi-r4s.dts
index cef4d18b599d..fe5b52610010 100644
--- a/arch/arm/dts/rk3399-nanopi-r4s.dts
+++ b/arch/arm/dts/rk3399-nanopi-r4s.dts
@@ -46,9 +46,9 @@
gpio-keys {
pinctrl-0 = <_button_pin>;
  
-		/delete-node/ power;

+   /delete-node/ key-power;
  
-		reset {

+   key-reset {
debounce-interval = <50>;
gpios = < RK_PC6 GPIO_ACTIVE_LOW>;
label = "reset";
diff --git a/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi 
b/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi
index e0d7a518dfc2..757361249968 100644
--- a/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi
@@ -20,3 +20,7 @@
  _sd {
bootph-pre-ram;
  };
+
+_sdio {
+   regulator-init-microvolt = <300>;
+};
diff --git 

Re: [PATCH 24/31] rockchip: rk3399-roc-pc: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-roc-pc related device tree from linux v6.8.

Add SF_DEFAULT_SPEED=3000 and SPI_FLASH_SFDP_SUPPORT=y to improve
support for booting from SPI flash.

Add AHCI=y, SCSI_AHCI=y, AHCI_PCI=y and SCSI=y to support PCIe SATA.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Remove USE_PREBOOT=y to speed up booting, standard boot will init USB
after faster boot media has been evaluated.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-roc-pc.dtsi   | 15 ---
  configs/roc-pc-mezzanine-rk3399_defconfig | 11 ++-
  configs/roc-pc-rk3399_defconfig   |  7 +--
  3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/arch/arm/dts/rk3399-roc-pc.dtsi b/arch/arm/dts/rk3399-roc-pc.dtsi
index d1aaf8e83391..ca7a446b6568 100644
--- a/arch/arm/dts/rk3399-roc-pc.dtsi
+++ b/arch/arm/dts/rk3399-roc-pc.dtsi
@@ -14,6 +14,7 @@
compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399";
  
  	aliases {

+   ethernet0 = 
mmc0 = 
mmc1 = 
};
@@ -41,7 +42,7 @@
keyup-threshold-microvolt = <150>;
poll-interval = <100>;
  
-		recovery {

+   button-recovery {
label = "Recovery";
linux,code = ;
press-threshold-microvolt = <18000>;
@@ -54,7 +55,7 @@
pinctrl-names = "default";
pinctrl-0 = <_key_l>;
  
-		power {

+   key-power {
debounce-interval = <100>;
gpios = < RK_PA5 GPIO_ACTIVE_LOW>;
label = "GPIO Key Power";
@@ -271,6 +272,8 @@
  };
  
   {

+   avdd-0v9-supply = <_hdmi>;
+   avdd-1v8-supply = <_hdmi>;
ddc-i2c-bus = <>;
pinctrl-names = "default";
pinctrl-0 = <_cec>;
@@ -310,8 +313,6 @@
vcc10-supply = <_sys>;
vcc11-supply = <_sys>;
vcc12-supply = <_sys>;
-   vcc13-supply = <_sys>;
-   vcc14-supply = <_sys>;
vddio-supply = <_3v0>;
  
  		regulators {

@@ -371,8 +372,8 @@
};
};
  
-			vcc1v8_hdmi: LDO_REG2 {

-   regulator-name = "vcc1v8_hdmi";
+   vcca1v8_hdmi: LDO_REG2 {
+   regulator-name = "vcca1v8_hdmi";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <180>;
@@ -735,7 +736,7 @@
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
-   spi-max-frequency = <1000>;
+   spi-max-frequency = <3000>;
};
  };
  
diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig

index e13356faabbc..85a20957fa37 100644
--- a/configs/roc-pc-mezzanine-rk3399_defconfig
+++ b/configs/roc-pc-mezzanine-rk3399_defconfig
@@ -4,6 +4,7 @@ CONFIG_COUNTER_FREQUENCY=2400
  CONFIG_ARCH_ROCKCHIP=y
  CONFIG_SPL_GPIO=y
  CONFIG_NR_DRAM_BANKS=1
+CONFIG_SF_DEFAULT_SPEED=3000
  CONFIG_ENV_SIZE=0x8000
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_ENV_SECT_SIZE=0x1000
@@ -19,6 +20,7 @@ CONFIG_SPL_SPI=y
  CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_PCI=y
  CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
  # CONFIG_ANDROID_BOOT_IMAGE is not set
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
@@ -41,14 +43,21 @@ CONFIG_SPL_OF_CONTROL=y
  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks 
assigned-clock-rates assigned-clock-parents"
  CONFIG_ENV_IS_IN_SPI_FLASH=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_PCI=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
+CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
  CONFIG_SF_DEFAULT_BUS=1
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
  CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
  CONFIG_NVME_PCI=y
@@ -61,6 +70,7 @@ CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
  # CONFIG_RAM_ROCKCHIP_DEBUG is not set
  CONFIG_RAM_ROCKCHIP_LPDDR4=y
+CONFIG_SCSI=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
@@ -84,5 +94,4 @@ CONFIG_VIDEO=y
  CONFIG_DISPLAY=y
  CONFIG_VIDEO_ROCKCHIP=y
  CONFIG_DISPLAY_ROCKCHIP_HDMI=y
-CONFIG_SPL_TINY_MEMSET=y
  CONFIG_ERRNO_STR=y
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index dee342898d1f..b8adf430e9ea 

Re: [PATCH 23/31] rockchip: rk3399-orangepi: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-orangepi device tree from linux v6.8.

Add DM_RESET=y to support reset signals.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y and PHY_ROCKCHIP_TYPEC=y to support USB PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-orangepi.dts  | 12 +++-
  configs/orangepi-rk3399_defconfig | 10 --
  2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/rk3399-orangepi.dts b/arch/arm/dts/rk3399-orangepi.dts
index 04b54abea3cc..e7551449e718 100644
--- a/arch/arm/dts/rk3399-orangepi.dts
+++ b/arch/arm/dts/rk3399-orangepi.dts
@@ -7,6 +7,7 @@
  
  #include "dt-bindings/pwm/pwm.h"

  #include "dt-bindings/input/input.h"
+#include 
  #include "dt-bindings/usb/pd.h"
  #include "rk3399.dtsi"
  #include "rk3399-opp.dtsi"
@@ -16,6 +17,7 @@
compatible = "rockchip,rk3399-orangepi", "rockchip,rk3399";
  
  	aliases {

+   ethernet0 = 
mmc0 = 
mmc1 = 
mmc2 = 
@@ -51,13 +53,13 @@
press-threshold-microvolt = <30>;
};
  
-		back {

+   button-back {
label = "Back";
linux,code = ;
press-threshold-microvolt = <985000>;
};
  
-		menu {

+   button-menu {
label = "Menu";
linux,code = ;
press-threshold-microvolt = <1314000>;
@@ -77,7 +79,7 @@
compatible = "gpio-keys";
autorepeat;
  
-		power {

+   key-power {
debounce-interval = <100>;
gpios = < RK_PA5 GPIO_ACTIVE_LOW>;
label = "GPIO Power";
@@ -166,12 +168,12 @@
vdd_log: vdd-log {
compatible = "pwm-regulator";
pwms = < 0 25000 1>;
+   pwm-supply = <_sys>;
regulator-name = "vdd_log";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <80>;
regulator-max-microvolt = <140>;
-   vin-supply = <_sys>;
};
  };
  
@@ -735,7 +737,7 @@

reg = <1>;
compatible = "brcm,bcm4329-fmac";
interrupt-parent = <>;
-   interrupts = ;
+   interrupts = ;
interrupt-names = "host-wake";
pinctrl-names = "default";
pinctrl-0 = <_host_wake_l>;
diff --git a/configs/orangepi-rk3399_defconfig 
b/configs/orangepi-rk3399_defconfig
index 703732ad15f0..2d0c9b77e584 100644
--- a/configs/orangepi-rk3399_defconfig
+++ b/configs/orangepi-rk3399_defconfig
@@ -6,6 +6,7 @@ CONFIG_SPL_GPIO=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-orangepi"
+CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_TARGET_EVB_RK3399=y
  CONFIG_DEBUG_UART_BASE=0xFF1A
@@ -14,7 +15,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-orangepi.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
  CONFIG_SPL_PAD_TO=0x7f8000
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
@@ -31,12 +32,18 @@ CONFIG_ENV_IS_IN_MMC=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=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
+CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_TYPEC=y
  CONFIG_PMIC_RK8XX=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_SPL_DM_REGULATOR_FIXED=y
@@ -58,5 +65,4 @@ CONFIG_USB_ETHER_ASIX88179=y
  CONFIG_USB_ETHER_MCS7830=y
  CONFIG_USB_ETHER_RTL8152=y
  CONFIG_USB_ETHER_SMSC95XX=y
-CONFIG_SPL_TINY_MEMSET=y
  CONFIG_ERRNO_STR=y


Re: [PATCH 22/31] rockchip: rk3399-firefly: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-firefly device tree from linux v6.8.

Add AHCI=y, SCSI_AHCI=y, AHCI_PCI=y and SCSI=y to support PCIe SATA.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y and PHY_ROCKCHIP_TYPEC=y to support USB PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-firefly.dts  | 17 -
  configs/firefly-rk3399_defconfig | 13 +++--
  2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/rk3399-firefly.dts b/arch/arm/dts/rk3399-firefly.dts
index c4dd2a6b4836..260415d99aeb 100644
--- a/arch/arm/dts/rk3399-firefly.dts
+++ b/arch/arm/dts/rk3399-firefly.dts
@@ -5,6 +5,7 @@
  
  /dts-v1/;

  #include 
+#include 
  #include 
  #include 
  #include "rk3399.dtsi"
@@ -15,6 +16,7 @@
compatible = "firefly,firefly-rk3399", "rockchip,rk3399";
  
  	aliases {

+   ethernet0 = 
mmc0 = 
mmc1 = 
mmc2 = 
@@ -86,7 +88,7 @@
pinctrl-names = "default";
pinctrl-0 = <>;
  
-		power {

+   key-power {
debounce-interval = <100>;
gpios = < RK_PA5 GPIO_ACTIVE_LOW>;
label = "GPIO Key Power";
@@ -245,12 +247,12 @@
vdd_log: vdd-log {
compatible = "pwm-regulator";
pwms = < 0 25000 1>;
+   pwm-supply = <_sys>;
regulator-name = "vdd_log";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <43>;
regulator-max-microvolt = <140>;
-   vin-supply = <_sys>;
};
  };
  
@@ -298,6 +300,11 @@

status = "okay";
  };
  
+ {

+   mali-supply = <_gpu>;
+   status = "okay";
+};
+
   {
ddc-i2c-bus = <>;
pinctrl-names = "default";
@@ -770,8 +777,8 @@
sd-uhs-sdr104;
  
  	/* Power supply */

-   vqmmc-supply = _s3;  /* IO line */
-   vmmc-supply = _sdio;/* card's power */
+   vqmmc-supply = <_s3>;  /* IO line */
+   vmmc-supply = <_sdio>;/* card's power */
  
  	#address-cells = <1>;

#size-cells = <0>;
@@ -781,7 +788,7 @@
reg = <1>;
compatible = "brcm,bcm4329-fmac";
interrupt-parent = <>;
-   interrupts = ;
+   interrupts = ;
interrupt-names = "host-wake";
brcm,drive-strength = <5>;
pinctrl-names = "default";
diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig
index db98926b627a..2f81a2ed0da6 100644
--- a/configs/firefly-rk3399_defconfig
+++ b/configs/firefly-rk3399_defconfig
@@ -14,9 +14,10 @@ CONFIG_DEBUG_UART_CLOCK=2400
  CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_PCI=y
  CONFIG_DEBUG_UART=y
+CONFIG_AHCI=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-firefly.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
  CONFIG_SPL_PAD_TO=0x7f8000
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
@@ -32,19 +33,28 @@ CONFIG_SPL_OF_CONTROL=y
  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks 
assigned-clock-rates assigned-clock-parents"
  CONFIG_ENV_IS_IN_MMC=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_PCI=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
+CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
  CONFIG_NVME_PCI=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_TYPEC=y
  CONFIG_PMIC_RK8XX=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
+CONFIG_SCSI=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
@@ -61,5 +71,4 @@ CONFIG_USB_ETHER_ASIX88179=y
  CONFIG_USB_ETHER_MCS7830=y
  CONFIG_USB_ETHER_RTL8152=y
  CONFIG_USB_ETHER_SMSC95XX=y
-CONFIG_SPL_TINY_MEMSET=y
  CONFIG_ERRNO_STR=y


Re: [PATCH 21/31] rockchip: rk3399-evb: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-evb device tree from linux v6.8.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Remove CONFIG_NET_RANDOM_ETHADDR=y, ethaddr and eth1addr is set based on
cpuid read from eFUSE.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-evb-u-boot.dtsi | 11 +--
  arch/arm/dts/rk3399-evb.dts |  3 ++-
  configs/evb-rk3399_defconfig|  6 +++---
  3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/arch/arm/dts/rk3399-evb-u-boot.dtsi 
b/arch/arm/dts/rk3399-evb-u-boot.dtsi
index 9df4a02c3e74..68d86194cc4c 100644
--- a/arch/arm/dts/rk3399-evb-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-evb-u-boot.dtsi
@@ -12,14 +12,6 @@
};
  };
  
- {

-   bootph-all;
-};
-
- {
-   bootph-all;
-};
-
   {
status = "okay";
  };
@@ -41,10 +33,9 @@
bus-width = <4>;
cap-mmc-highspeed;
cap-sd-highspeed;
-   cd-gpios = < 7 GPIO_ACTIVE_LOW>;
disable-wp;
max-frequency = <15000>;
pinctrl-names = "default";
-   pinctrl-0 = <_clk _cmd _bus4>;
+   pinctrl-0 = <_clk _cmd _cd _bus4>;
status = "okay";
  };
diff --git a/arch/arm/dts/rk3399-evb.dts b/arch/arm/dts/rk3399-evb.dts
index 7b717ebec8ff..55eca7a50a1f 100644
--- a/arch/arm/dts/rk3399-evb.dts
+++ b/arch/arm/dts/rk3399-evb.dts
@@ -12,6 +12,7 @@
compatible = "rockchip,rk3399-evb", "rockchip,rk3399";
  
  	aliases {

+   ethernet0 = 
mmc0 = 
};
  
@@ -55,7 +56,7 @@

};
  
  	edp_panel: edp-panel {

-   compatible ="lg,lp079qx1-sp0v";
+   compatible = "lg,lp079qx1-sp0v";
backlight = <>;
enable-gpios = < RK_PB5 GPIO_ACTIVE_HIGH>;
power-supply = <_s0>;
diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index afb79987464f..334259f73eb2 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -15,7 +15,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-evb.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
  CONFIG_SPL_PAD_TO=0x7f8000
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
@@ -30,7 +30,6 @@ CONFIG_SPL_OF_CONTROL=y
  CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks 
assigned-clock-rates assigned-clock-parents"
  CONFIG_ENV_IS_IN_MMC=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
-CONFIG_NET_RANDOM_ETHADDR=y
  CONFIG_ROCKCHIP_GPIO=y
  CONFIG_SYS_I2C_ROCKCHIP=y
  CONFIG_MMC_HS400_SUPPORT=y
@@ -39,6 +38,8 @@ CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
  CONFIG_PHY_ROCKCHIP_INNO_USB2=y
@@ -69,5 +70,4 @@ CONFIG_DISPLAY=y
  CONFIG_VIDEO_ROCKCHIP=y
  CONFIG_VIDEO_ROCKCHIP_MAX_YRES=1200
  CONFIG_DISPLAY_ROCKCHIP_MIPI=y
-CONFIG_SPL_TINY_MEMSET=y
  CONFIG_ERRNO_STR=y


Re: [PATCH 20/31] rockchip: rk3399-leez: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-leez-p710 device tree from linux v6.8.

Add DM_RESET=y to support reset signals.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y and PHY_ROCKCHIP_TYPEC=y to support USB PHY.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-leez-p710.dts |  8 +---
  configs/leez-rk3399_defconfig | 10 --
  2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/arm/dts/rk3399-leez-p710.dts 
b/arch/arm/dts/rk3399-leez-p710.dts
index 7c93f840bc64..cb69e2145fa9 100644
--- a/arch/arm/dts/rk3399-leez-p710.dts
+++ b/arch/arm/dts/rk3399-leez-p710.dts
@@ -5,6 +5,7 @@
  
  /dts-v1/;

  #include 
+#include 
  #include 
  #include "rk3399.dtsi"
  #include "rk3399-opp.dtsi"
@@ -14,6 +15,7 @@
compatible = "leez,p710", "rockchip,rk3399";
  
  	aliases {

+   ethernet0 = 
mmc0 = 
mmc1 = 
mmc2 = 
@@ -55,7 +57,7 @@
regulator-boot-on;
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
-   vim-supply = <_sys>;
+   vin-supply = <_sys>;
};
  
  	vcc3v3_sys: vcc3v3-sys {

@@ -102,12 +104,12 @@
vdd_log: vdd-log {
compatible = "pwm-regulator";
pwms = < 0 25000 1>;
+   pwm-supply = <_sys>;
regulator-name = "vdd_log";
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <80>;
regulator-max-microvolt = <140>;
-   vin-supply = <_sys>;
};
  };
  
@@ -509,7 +511,7 @@

compatible = "brcm,bcm4329-fmac";
reg = <1>;
interrupt-parent = <>;
-   interrupts = ;
+   interrupts = ;
interrupt-names = "host-wake";
pinctrl-names = "default";
pinctrl-0 = <_host_wake_l>;
diff --git a/configs/leez-rk3399_defconfig b/configs/leez-rk3399_defconfig
index 13453e523444..903125aa5c1d 100644
--- a/configs/leez-rk3399_defconfig
+++ b/configs/leez-rk3399_defconfig
@@ -5,6 +5,7 @@ CONFIG_ARCH_ROCKCHIP=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-leez-p710"
+CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_TARGET_EVB_RK3399=y
  CONFIG_DEBUG_UART_BASE=0xFF1A
@@ -13,7 +14,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-leez-p710.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
  CONFIG_SPL_PAD_TO=0x7f8000
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
@@ -30,12 +31,18 @@ CONFIG_ENV_IS_IN_MMC=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=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
+CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_TYPEC=y
  CONFIG_PMIC_RK8XX=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
@@ -57,5 +64,4 @@ CONFIG_USB_ETHER_ASIX88179=y
  CONFIG_USB_ETHER_MCS7830=y
  CONFIG_USB_ETHER_RTL8152=y
  CONFIG_USB_ETHER_SMSC95XX=y
-CONFIG_SPL_TINY_MEMSET=y
  CONFIG_ERRNO_STR=y


Re: [PATCH 19/31] rockchip: rk3399-eaidk-610: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-eaidk-610 device tree from linux v6.8.

Add DM_RESET=y to support reset signals.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y and PHY_ROCKCHIP_TYPEC=y to support USB PHY.

Remove REGULATOR_PWM=y, board does not use pwm-regulator compatible.

Remove SPL_TINY_MEMSET=y to use full memset in SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-eaidk-610.dts  |  3 ++-
  configs/eaidk-610-rk3399_defconfig | 11 ---
  2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm/dts/rk3399-eaidk-610.dts 
b/arch/arm/dts/rk3399-eaidk-610.dts
index d1f343345f67..173da81fc231 100644
--- a/arch/arm/dts/rk3399-eaidk-610.dts
+++ b/arch/arm/dts/rk3399-eaidk-610.dts
@@ -15,6 +15,7 @@
compatible = "openailab,eaidk-610", "rockchip,rk3399";
  
  	aliases {

+   ethernet0 = 
mmc0 = 
mmc1 = 
mmc2 = 
@@ -773,7 +774,7 @@
compatible = "brcm,bcm4329-fmac";
reg = <1>;
interrupt-parent = <>;
-   interrupts = ;
+   interrupts = ;
interrupt-names = "host-wake";
pinctrl-names = "default";
pinctrl-0 = <_host_wake_l>;
diff --git a/configs/eaidk-610-rk3399_defconfig 
b/configs/eaidk-610-rk3399_defconfig
index eba6f90c605b..d9cde9ecced5 100644
--- a/configs/eaidk-610-rk3399_defconfig
+++ b/configs/eaidk-610-rk3399_defconfig
@@ -5,6 +5,7 @@ CONFIG_ARCH_ROCKCHIP=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-eaidk-610"
+CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_TARGET_EVB_RK3399=y
  CONFIG_DEBUG_UART_BASE=0xFF1A
@@ -13,7 +14,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-eaidk-610.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x4
  CONFIG_SPL_PAD_TO=0x7f8000
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
@@ -30,14 +31,19 @@ CONFIG_ENV_IS_IN_MMC=y
  CONFIG_SYS_RELOC_GD_ENV_ADDR=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
+CONFIG_MMC_SDHCI_SDMA=y
  CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_TYPEC=y
  CONFIG_PMIC_RK8XX=y
-CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
  CONFIG_BAUDRATE=150
@@ -50,5 +56,4 @@ CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
  CONFIG_USB_DWC3=y
  CONFIG_USB_DWC3_GENERIC=y
-CONFIG_SPL_TINY_MEMSET=y
  CONFIG_ERRNO_STR=y


Re: [PATCH 18/31] rockchip: rk3399-rock-pi-n10: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-rock-pi-n10 related device tree from linux v6.8.

Remove SPL_GPIO=y, board does not use gpio in SPL.

Change to SPL_MAX_SIZE=0x4, SPL can be up to 256 KiB.

Add ROCKCHIP_IODOMAIN=y to configure io-domain voltage.

Add MMC_SDHCI_SDMA=y to use DMA transfer for eMMC.

Add PHY_REALTEK=y and DM_ETH_PHY=y to support ethernet PHY.

Remove REGULATOR_PWM=y, board does not use pwm-regulator compatible.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3288-vmarc-som.dtsi| 48 +++
  arch/arm/dts/rk3399pro-vmarc-som.dtsi | 20 ++--
  .../dts/rockchip-radxa-dalang-carrier.dtsi| 21 
  configs/rock-pi-n10-rk3399pro_defconfig   |  8 ++--
  4 files changed, 89 insertions(+), 8 deletions(-)

diff --git a/arch/arm/dts/rk3288-vmarc-som.dtsi 
b/arch/arm/dts/rk3288-vmarc-som.dtsi
index 717cb3dc816e..793951655b73 100644
--- a/arch/arm/dts/rk3288-vmarc-som.dtsi
+++ b/arch/arm/dts/rk3288-vmarc-som.dtsi
@@ -231,11 +231,43 @@
};
  };
  
+ {

+   clock-frequency = <40>;
+   status = "okay";
+
+   hym8563: rtc@51 {
+   compatible = "haoyu,hym8563";
+   reg = <0x51>;
+   interrupt-parent = <>;
+   interrupts = ;
+   #clock-cells = <0>;
+   clock-output-names = "hym8563";
+   pinctrl-names = "default";
+   pinctrl-0 = <_int>;
+   };
+};
+
   {
status = "okay";
  };
  
+_domains {

+   bb-supply = <_io>;
+   flash0-supply = <_flash>;
+   gpio1830-supply = <_18>;
+   gpio30-supply = <_io>;
+   sdcard-supply = <_sd>;
+   wifi-supply = <_wl>;
+   status = "okay";
+};
+
   {
+   hym8563 {
+   hym8563_int: hym8563-int {
+   rockchip,pins = <5 RK_PC3 RK_FUNC_GPIO _pull_up>;
+   };
+   };
+
pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
drive-strength = <8>;
};
@@ -251,6 +283,12 @@
};
};
  
+	sdio-pwrseq {

+   wifi_enable_h: wifi-enable-h {
+   rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO _pull_none>;
+   };
+   };
+
sdmmc {
sdmmc_bus4: sdmmc-bus4 {
rockchip,pins =
@@ -282,6 +320,16 @@
};
  };
  
+_pwrseq {

+   /*
+* 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)
+*/
+   reset-gpios = < RK_PD4 GPIO_ACTIVE_LOW>;/* WIFI_REG_ON */
+};
+
   {
status = "okay";
  };
diff --git a/arch/arm/dts/rk3399pro-vmarc-som.dtsi 
b/arch/arm/dts/rk3399pro-vmarc-som.dtsi
index e1cb426f2aa5..8823c924dc1d 100644
--- a/arch/arm/dts/rk3399pro-vmarc-som.dtsi
+++ b/arch/arm/dts/rk3399pro-vmarc-som.dtsi
@@ -13,8 +13,9 @@
compatible = "vamrs,rk3399pro-vmarc-som", "rockchip,rk3399pro";
  
  	aliases {

-   mmc0 = 
-   mmc1 = 
+   ethernet0 = 
+   mmc0 = 
+   mmc1 = 
};
  
  	vcc3v3_pcie: vcc-pcie-regulator {

@@ -297,11 +298,10 @@
clock-frequency = <40>;
status = "okay";
  
-	hym8563: hym8563@51 {

+   hym8563: rtc@51 {
compatible = "haoyu,hym8563";
reg = <0x51>;
#clock-cells = <0>;
-   clock-frequency = <32768>;
clock-output-names = "hym8563";
pinctrl-names = "default";
pinctrl-0 = <_int>;
@@ -347,7 +347,7 @@
  
  	pcie {

pcie_pwr: pcie-pwr {
-   rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO _pull_up>;
+   rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO _pull_up>;
};
};
  
@@ -381,6 +381,16 @@

pmu1830-supply = <_1v8>;
  };
  
+_pwrseq {

+   /*
+* 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)
+*/
+   reset-gpios = < RK_PD3 GPIO_ACTIVE_LOW>;
+};
+
   {
bus-width = <8>;
mmc-hs400-1_8v;
diff --git a/arch/arm/dts/rockchip-radxa-dalang-carrier.dtsi 
b/arch/arm/dts/rockchip-radxa-dalang-carrier.dtsi
index 26b53eac4706..da1d548b7330 100644
--- a/arch/arm/dts/rockchip-radxa-dalang-carrier.dtsi
+++ b/arch/arm/dts/rockchip-radxa-dalang-carrier.dtsi
@@ -15,6 +15,14 @@
#clock-cells = <0>;
};
  
+	sdio_pwrseq: sdio-pwrseq {

+   compatible = "mmc-pwrseq-simple";
+   clocks = <>;
+   clock-names = "ext_clock";
+   pinctrl-names = "default";
+   pinctrl-0 = <_enable_h>;
+   };
+
vcc12v_dcin: vcc12v-dcin-regulator {
compatible = "regulator-fixed";
  

Re: [PATCH 17/31] rockchip: rk3399-puma: Sync DT from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-puma related device tree from linux v6.8.

SPL_MAX_SIZE is not adjusted to the now common 0x4 (256 KiB) due to
TPL+SPL combined (idbloader.img) is limited to max 224 KiB because of:

   SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200

Because FIT payload is located at sector 0x200 instead of the more
Rockchip common 0x4000, TPL+SPL cannot take up more than 224 KiB:

   (0x200 - 64) x 512 = 0x38000 (224 KiB)

Also adjust SPL_PAD_TO to match the 0x200 sector offset.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi | 20 ++
  arch/arm/dts/rk3399-puma-haikou.dts | 42 ++---
  arch/arm/dts/rk3399-puma.dtsi   | 17 -
  configs/puma-rk3399_defconfig   |  2 +-
  4 files changed, 57 insertions(+), 24 deletions(-)

diff --git a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi 
b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
index f48d395f972a..65340f98d595 100644
--- a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
@@ -30,18 +30,6 @@
aliases {
spi5 = 
};
-
-   vdd_log: vdd-log {
-   compatible = "pwm-regulator";
-   pwms = < 0 25000 1>;
-   regulator-name = "vdd_log";
-   regulator-always-on;
-   regulator-boot-on;
-   regulator-min-microvolt = <80>;
-   regulator-max-microvolt = <140>;
-   regulator-init-microvolt = <95>;
-   vin-supply = <_sys>;
-   };
  };
  
   {

@@ -87,10 +75,6 @@
bootph-all;
  };
  
-_pin_hog {

-   bootph-all;
-};
-
   {
bootph-pre-ram;
bootph-some-ram;
@@ -111,3 +95,7 @@
  _xfer {
bootph-all;
  };
+
+_log {
+   regulator-init-microvolt = <95>;
+};
diff --git a/arch/arm/dts/rk3399-puma-haikou.dts 
b/arch/arm/dts/rk3399-puma-haikou.dts
index 115c14c0a3c6..18a98c4648ea 100644
--- a/arch/arm/dts/rk3399-puma-haikou.dts
+++ b/arch/arm/dts/rk3399-puma-haikou.dts
@@ -5,6 +5,7 @@
  
  /dts-v1/;

  #include "rk3399-puma.dtsi"
+#include 
  
  / {

model = "Theobroma Systems RK3399-Q7 SoM";
@@ -18,6 +19,38 @@
stdout-path = "serial0:115200n8";
};
  
+	gpio-keys {

+   compatible = "gpio-keys";
+   pinctrl-0 = <_keys_pin>;
+   pinctrl-names = "default";
+
+   button-batlow-n {
+   gpios = < RK_PB2 GPIO_ACTIVE_LOW>;
+   label = "BATLOW#";
+   linux,code = ;
+   };
+
+   button-slp-btn-n {
+   gpios = < RK_PB3 GPIO_ACTIVE_LOW>;
+   label = "SLP_BTN#";
+   linux,code = ;
+   };
+
+   button-wake-n {
+   gpios = < RK_PB1 GPIO_ACTIVE_LOW>;
+   label = "WAKE#";
+   linux,code = ;
+   wakeup-source;
+   };
+
+   switch-lid-btn-n {
+   gpios = < RK_PA4 GPIO_ACTIVE_LOW>;
+   label = "LID_BTN#";
+   linux,code = ;
+   linux,input-type = ;
+   };
+   };
+
leds {
pinctrl-0 = <_led_pin>, <_card_led_pin>;
  
@@ -165,11 +198,8 @@

  };
  
   {

-   pinctrl-names = "default";
-   pinctrl-0 = <_pin_hog>;
-
-   hog {
-   haikou_pin_hog: haikou-pin-hog {
+   buttons {
+   haikou_keys_pin: haikou-keys-pin {
rockchip,pins =
  /* LID_BTN */
  <0 RK_PA4 RK_FUNC_GPIO _pull_up>,
@@ -177,7 +207,7 @@
  <0 RK_PB2 RK_FUNC_GPIO _pull_up>,
  /* SLP_BTN# */
  <0 RK_PB3 RK_FUNC_GPIO _pull_up>,
- /* BIOS_DISABLE# */
+ /* WAKE# */
  <0 RK_PB1 RK_FUNC_GPIO _pull_up>;
};
};
diff --git a/arch/arm/dts/rk3399-puma.dtsi b/arch/arm/dts/rk3399-puma.dtsi
index aa3e21bd6c8f..c08e69391c01 100644
--- a/arch/arm/dts/rk3399-puma.dtsi
+++ b/arch/arm/dts/rk3399-puma.dtsi
@@ -9,6 +9,7 @@
  
  / {

aliases {
+   ethernet0 = 
mmc0 = 
};
  
@@ -27,7 +28,7 @@
  
  	extcon_usb3: extcon-usb3 {

compatible = "linux,extcon-usb-gpio";
-   id-gpio = < RK_PC2 GPIO_ACTIVE_HIGH>;
+   id-gpios = < RK_PC2 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <_id>;
};
@@ -119,6 +120,20 @@
drive-impedance-ohm = <33>;
  };
  
+ {

+   /*
+* The BIOS_DISABLE hog is a feedback pin for the actual status of the
+* signal. This usually represents the state of a 

[PATCH] .gitignore: add LTO generated file

2024-04-23 Thread Robert Marko
Currently, keep-syms-lto.c is being generated if LTO is enabled but unlike
keep-syms-lto.o it is not being ignored, so lets add keep-syms-lto.* to
.gitignore.

Signed-off-by: Robert Marko 
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index be137040a2..324078769b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,6 +67,7 @@ fit-dtb.blob*
 /Test*
 /capsule.*.efi-capsule
 /capsule*.map
+/keep-syms-lto.*
 
 #
 # Generated include files
-- 
2.44.0



Re: [PATCH 15/31] rockchip: rk3399: Sync soc device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync RK3399 SoC common .dtsi-files from linux v6.8.

The ethernet0 alias is removed from rk3399.dtsi in this patch, it will
be restored in board specific .dts-files. There is no other intended
change with this patch.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-op1-opp.dtsi  |  31 +-
  arch/arm/dts/rk3399-opp.dtsi  |   6 +-
  arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi |   4 -
  arch/arm/dts/rk3399-u-boot.dtsi   |  52 ++--
  arch/arm/dts/rk3399.dtsi  | 289 --
  5 files changed, 308 insertions(+), 74 deletions(-)

diff --git a/arch/arm/dts/rk3399-op1-opp.dtsi b/arch/arm/dts/rk3399-op1-opp.dtsi
index 69cc9b05baa5..783120e9cebe 100644
--- a/arch/arm/dts/rk3399-op1-opp.dtsi
+++ b/arch/arm/dts/rk3399-op1-opp.dtsi
@@ -4,7 +4,7 @@
   */
  
  / {

-   cluster0_opp: opp-table0 {
+   cluster0_opp: opp-table-0 {
compatible = "operating-points-v2";
opp-shared;
  
@@ -39,7 +39,7 @@

};
};
  
-	cluster1_opp: opp-table1 {

+   cluster1_opp: opp-table-1 {
compatible = "operating-points-v2";
opp-shared;
  
@@ -82,7 +82,7 @@

};
};
  
-	gpu_opp_table: opp-table2 {

+   gpu_opp_table: opp-table-2 {
compatible = "operating-points-v2";
  
  		opp00 {

@@ -110,6 +110,27 @@
opp-microvolt = <1075000>;
};
};
+
+   dmc_opp_table: opp-table-3 {
+   compatible = "operating-points-v2";
+
+   opp00 {
+   opp-hz = /bits/ 64 <4>;
+   opp-microvolt = <90>;
+   };
+   opp01 {
+   opp-hz = /bits/ 64 <66600>;
+   opp-microvolt = <90>;
+   };
+   opp02 {
+   opp-hz = /bits/ 64 <8>;
+   opp-microvolt = <90>;
+   };
+   opp03 {
+   opp-hz = /bits/ 64 <92800>;
+   opp-microvolt = <925000>;
+   };
+   };
  };
  
  _l0 {

@@ -136,6 +157,10 @@
operating-points-v2 = <_opp>;
  };
  
+ {

+   operating-points-v2 = <_opp_table>;
+};
+
   {
operating-points-v2 = <_opp_table>;
  };
diff --git a/arch/arm/dts/rk3399-opp.dtsi b/arch/arm/dts/rk3399-opp.dtsi
index da41cd81ebb7..fee5e7111279 100644
--- a/arch/arm/dts/rk3399-opp.dtsi
+++ b/arch/arm/dts/rk3399-opp.dtsi
@@ -4,7 +4,7 @@
   */
  
  / {

-   cluster0_opp: opp-table0 {
+   cluster0_opp: opp-table-0 {
compatible = "operating-points-v2";
opp-shared;
  
@@ -35,7 +35,7 @@

};
};
  
-	cluster1_opp: opp-table1 {

+   cluster1_opp: opp-table-1 {
compatible = "operating-points-v2";
opp-shared;
  
@@ -74,7 +74,7 @@

};
};
  
-	gpu_opp_table: opp-table2 {

+   gpu_opp_table: opp-table-2 {
compatible = "operating-points-v2";
  
  		opp00 {

diff --git a/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi 
b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi
index b8f95b86d86b..dcfcec4f3072 100644
--- a/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi
@@ -6,10 +6,6 @@
  #include "rk3399-u-boot.dtsi"
  #include "rk3399-sdram-lpddr4-100.dtsi"
  
- {

-   status = "okay";
-};
-
   {
max-frequency = <2500>;
  };
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index adb64d17e040..d2648abd0a44 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -2,8 +2,6 @@
  /*
   * Copyright (C) 2019 Jagan Teki 
   */
-#define USB_CLASS_HUB  9
-
  #include "rockchip-u-boot.dtsi"
  
  / {

@@ -24,44 +22,11 @@
reg = <0x0 0xff62 0x0 0x100>;
};
  
-	dfi: dfi@ff63 {

-   bootph-all;
-   reg = <0x00 0xff63 0x00 0x4000>;
-   compatible = "rockchip,rk3399-dfi";
-   rockchip,pmu = <>;
-   clocks = < PCLK_DDR_MON>;
-   clock-names = "pclk_ddr_mon";
-   };
-
-   rng: rng@ff8b8000 {
-   compatible = "rockchip,rk3399-crypto";
-   reg = <0x0 0xff8b8000 0x0 0x1000>;
-   status = "okay";
-   };
-
-   dmc: dmc {
-   bootph-all;
-   compatible = "rockchip,rk3399-dmc";
-   devfreq-events = <>;
-   interrupts = ;
-   clocks = < SCLK_DDRC>;
-   clock-names = "dmc_clk";
-   reg = <0x0 0xffa8 0x0 0x0800
-  0x0 0xffa80800 0x0 0x1800
-  0x0 0xffa82000 0x0 0x2000
-  0x0 0xffa84000 0x0 0x1000
- 

Re: [PATCH 16/31] rockchip: rk3399-gru: Sync device tree from linux v6.8

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-gru related device tree from linux v6.8.

The spi_flash symbol is no longer part of upstream DT, it is re-defined
to allow exising use in related u-boot.dtsi-files.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-gru-bob.dts |   8 +-
  arch/arm/dts/rk3399-gru-chromebook.dtsi | 200 +++-
  arch/arm/dts/rk3399-gru-kevin.dts   |   3 +-
  arch/arm/dts/rk3399-gru-u-boot.dtsi |  10 +-
  arch/arm/dts/rk3399-gru.dtsi|  52 +-
  5 files changed, 254 insertions(+), 19 deletions(-)

diff --git a/arch/arm/dts/rk3399-gru-bob.dts b/arch/arm/dts/rk3399-gru-bob.dts
index e6c1c94c8d69..1cba1d857c96 100644
--- a/arch/arm/dts/rk3399-gru-bob.dts
+++ b/arch/arm/dts/rk3399-gru-bob.dts
@@ -16,6 +16,7 @@
 "google,bob-rev7", "google,bob-rev6",
 "google,bob-rev5", "google,bob-rev4",
 "google,bob", "google,gru", "rockchip,rk3399";
+   chassis-type = "convertible";
  
  	edp_panel: edp-panel {

compatible = "boe,nv101wxmn51";
@@ -69,7 +70,7 @@
   {
status = "okay";
  
-	cr50@0 {

+   tpm@0 {
compatible = "google,cr50";
reg = <0>;
interrupt-parent = <>;
@@ -87,3 +88,8 @@
};
};
  };
+
+_host_wake_l {
+   /* Kevin has an external pull up, but Bob does not. */
+   rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO _pull_up>;
+};
diff --git a/arch/arm/dts/rk3399-gru-chromebook.dtsi 
b/arch/arm/dts/rk3399-gru-chromebook.dtsi
index 1384dabbdf40..cacbad35cfc8 100644
--- a/arch/arm/dts/rk3399-gru-chromebook.dtsi
+++ b/arch/arm/dts/rk3399-gru-chromebook.dtsi
@@ -198,7 +198,6 @@
power-supply = <_disp>;
pinctrl-names = "default";
pinctrl-0 = <_en>;
-   pwm-delay-us = <1>;
};
  
  	gpio_keys: gpio-keys {

@@ -206,7 +205,7 @@
pinctrl-names = "default";
pinctrl-0 = <_host_wake_l>;
  
-		wake_on_bt: wake-on-bt {

+   wake_on_bt: key-wake-on-bt {
label = "Wake-on-Bluetooth";
gpios = < 3 GPIO_ACTIVE_LOW>;
linux,code = ;
@@ -234,9 +233,24 @@
extcon = <_extcon0>, <_extcon1>;
  };
  
+ {

+   center-supply = <_centerlogic>;
+   rockchip,pd-idle-dis-freq-hz = <8>;
+   rockchip,sr-idle-dis-freq-hz = <8>;
+   rockchip,sr-mc-gate-idle-dis-freq-hz = <8>;
+};
+
   {
status = "okay";
  
+	/*

+* eDP PHY/clk don't sync reliably at anything other than 24 MHz. Only
+* set this here, because rk3399-gru.dtsi ensures we can generate this
+* off GPLL=600MHz, whereas some other RK3399 boards may not.
+*/
+   assigned-clocks = < PCLK_EDP>;
+   assigned-clock-rates = <2400>;
+
ports {
edp_out: port@1 {
reg = <1>;
@@ -251,6 +265,182 @@
};
  };
  
+ {

+   gpio-line-names = /* GPIO0 A 0-7 */
+ "AP_RTC_CLK_IN",
+ "EC_AP_INT_L",
+ "PP1800_AUDIO_EN",
+ "BT_HOST_WAKE_L",
+ "WLAN_MODULE_PD_L",
+ "H1_INT_OD_L",
+ "CENTERLOGIC_DVS_PWM",
+ "",
+
+ /* GPIO0 B 0-4 */
+ "WIFI_HOST_WAKE_L",
+ "PMUIO2_33_18_L",
+ "PP1500_EN",
+ "AP_EC_WARM_RESET_REQ",
+ "PP3000_EN";
+};
+
+ {
+   gpio-line-names = /* GPIO1 A 0-7 */
+ "",
+ "",
+ "SPK_PA_EN",
+ "",
+ "TRACKPAD_INT_L",
+ "AP_EC_S3_S0_L",
+ "AP_EC_OVERTEMP",
+ "AP_SPI_FLASH_MISO",
+
+ /* GPIO1 B 0-7 */
+ "AP_SPI_FLASH_MOSI_R",
+ "AP_SPI_FLASH_CLK_R",
+ "AP_SPI_FLASH_CS_L_R",
+ "WLAN_MODULE_RESET_L",
+ "WIFI_DISABLE_L",
+ "MIC_INT",
+ "",
+ "AP_I2C_DVS_SDA",
+
+ /* GPIO1 C 0-7 */
+ "AP_I2C_DVS_SCL",
+ "AP_BL_EN",
+ /*
+  * AP_FLASH_WP is crossystem ABI. Schematics call it
+  * AP_FW_WP or CPU1_FW_WP, depending on the variant.
+  */
+ "AP_FLASH_WP",
+ "LITCPU_DVS_PWM",
+ "AP_I2C_AUDIO_SDA",
+ 

Re: [PATCH 14/31] clk: rockchip: rk3399: Add SCLK_USB3OTGx_REF support

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

The SCLK_USB3OTGx_REF clocks is used as reference clock for USB3 block.

Add simple support to get rate of SCLK_USB3OTGx_REF clocks to fix
reference clock period configuration.

Also replace use of 2400 with the OSC_HZ constant.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  drivers/clk/rockchip/clk_rk3399.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk_rk3399.c 
b/drivers/clk/rockchip/clk_rk3399.c
index 29b01abeca06..6408c5d0aa6a 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -956,7 +956,9 @@ static ulong rk3399_clk_get_rate(struct clk *clk)
case SCLK_UART1:
case SCLK_UART2:
case SCLK_UART3:
-   return 2400;
+   case SCLK_USB3OTG0_REF:
+   case SCLK_USB3OTG1_REF:
+   return OSC_HZ;
case PCLK_HDMI_CTRL:
break;
case DCLK_VOP0:


Re: [PATCH 13/31] clk: rockchip: rk3399: Add dummy support for SCLK_PCIEPHY_REF clock

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

rk3399-nanopi-4.dtsi try to set parent of and set rate to 100 MHz of the
SCLK_PCIEPHY_REF clock.

The existing enable/disable ops for SCLK_PCIEPHY_REF already handles
setting correct parent once the clock gets enabled. And 100 MHz is the
default rate used for this clock.

Add dummy support for setting parent, getting and setting clock rate of
the SCLK_PCIEPHY_REF clock to allow use of PCIe on affected boards.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  drivers/clk/rockchip/clk_rk3399.c | 4 
  1 file changed, 4 insertions(+)

diff --git a/drivers/clk/rockchip/clk_rk3399.c 
b/drivers/clk/rockchip/clk_rk3399.c
index 5934771b4096..29b01abeca06 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -972,6 +972,7 @@ static ulong rk3399_clk_get_rate(struct clk *clk)
case ACLK_GIC_PRE:
case PCLK_DDR:
case ACLK_VDU:
+   case SCLK_PCIEPHY_REF:
break;
case PCLK_ALIVE:
case PCLK_WDT:
@@ -1063,6 +1064,7 @@ static ulong rk3399_clk_set_rate(struct clk *clk, ulong 
rate)
case ACLK_GIC_PRE:
case PCLK_DDR:
case ACLK_VDU:
+   case SCLK_PCIEPHY_REF:
return 0;
default:
log_debug("Unknown clock %lu\n", clk->id);
@@ -1114,6 +1116,8 @@ static int __maybe_unused rk3399_clk_set_parent(struct 
clk *clk,
switch (clk->id) {
case SCLK_RMII_SRC:
return rk3399_gmac_set_parent(clk, parent);
+   case SCLK_PCIEPHY_REF:
+   return 0;
}
  
  	debug("%s: unsupported clk %ld\n", __func__, clk->id);


Re: [PATCH 12/31] clk: rockchip: rk3399: Add dummy support for ACLK_VDU clock

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

rk3399.dtsi from linux v5.19 and newer try to set VDU clock rate to
400 MHz using an assigned-clock-rates prop of the CRU node.

U-Boot does not use or need this clock so add dummy support for getting
and setting ACLK_VDU clock rate to allow CRU driver to be loaded with an
updated rk3399.dtsi.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  drivers/clk/rockchip/clk_rk3399.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/clk/rockchip/clk_rk3399.c 
b/drivers/clk/rockchip/clk_rk3399.c
index f0ce54067f8c..5934771b4096 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -971,6 +971,7 @@ static ulong rk3399_clk_get_rate(struct clk *clk)
case ACLK_HDCP:
case ACLK_GIC_PRE:
case PCLK_DDR:
+   case ACLK_VDU:
break;
case PCLK_ALIVE:
case PCLK_WDT:
@@ -1061,6 +1062,7 @@ static ulong rk3399_clk_set_rate(struct clk *clk, ulong 
rate)
case ACLK_HDCP:
case ACLK_GIC_PRE:
case PCLK_DDR:
+   case ACLK_VDU:
return 0;
default:
log_debug("Unknown clock %lu\n", clk->id);


Re: [PATCH 10/31] rockchip: rk3399: Fix loading FIT from SD-card when booting from eMMC

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

When RK3399 boards run SPL from eMMC and fail to load FIT from eMMC due
to it being missing or checksum validation fails there can be a fallback
to read FIT from SD-card. However, without proper pinctrl configuration
reading FIT from SD-card may fail:

   U-Boot SPL 2024.04-rc4 (Mar 17 2024 - 22:54:45 +)
   Trying to boot from MMC2
   mmc_load_image_raw_sector: mmc block read error
   Trying to boot from MMC2
   mmc_load_image_raw_sector: mmc block read error
   Trying to boot from MMC1
   Card did not respond to voltage select! : -110
   mmc_init: -95, time 12
   spl: mmc init failed with error: -95
   SPL: failed to boot from all boot devices (err=-6)
   ### ERROR ### Please RESET the board ###

Fix this by tagging related sdhci and sdmmc pinctrl nodes with bootph
props. Also sort and move common nodes shared by all boards to the SoC
u-boot.dtsi. Finally imply the SPL_DM_SEQ_ALIAS Kconfig option to enable
it on all RK3399 boards.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-evb-u-boot.dtsi   |  1 -
  arch/arm/dts/rk3399-ficus-u-boot.dtsi |  8 ++
  arch/arm/dts/rk3399-gru-u-boot.dtsi   | 24 ++
  arch/arm/dts/rk3399-nanopi4-u-boot.dtsi   | 12 +++
  arch/arm/dts/rk3399-orangepi-u-boot.dtsi  | 12 +++
  arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi  | 17 -
  arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi |  2 -
  arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi   | 19 ++---
  arch/arm/dts/rk3399-roc-pc-u-boot.dtsi| 41 ++
  arch/arm/dts/rk3399-rock-4c-plus-u-boot.dtsi  |  8 ++
  arch/arm/dts/rk3399-rock960-u-boot.dtsi   |  8 ++
  arch/arm/dts/rk3399-rockpro64-u-boot.dtsi | 17 -
  arch/arm/dts/rk3399-u-boot.dtsi   | 75 +++
  arch/arm/mach-rockchip/Kconfig|  1 +
  configs/chromebook_bob_defconfig  |  1 -
  configs/chromebook_kevin_defconfig|  1 -
  configs/eaidk-610-rk3399_defconfig|  2 +-
  configs/evb-rk3399_defconfig  |  2 +-
  configs/ficus-rk3399_defconfig|  2 +-
  configs/firefly-rk3399_defconfig  |  2 +-
  configs/khadas-edge-captain-rk3399_defconfig  |  2 +-
  configs/khadas-edge-rk3399_defconfig  |  2 +-
  configs/khadas-edge-v-rk3399_defconfig|  2 +-
  configs/leez-rk3399_defconfig |  2 +-
  configs/nanopc-t4-rk3399_defconfig|  4 +-
  configs/nanopi-m4-2gb-rk3399_defconfig|  4 +-
  configs/nanopi-m4-rk3399_defconfig|  4 +-
  configs/nanopi-m4b-rk3399_defconfig   |  4 +-
  configs/nanopi-neo4-rk3399_defconfig  |  4 +-
  configs/nanopi-r4s-rk3399_defconfig   |  4 +-
  configs/orangepi-rk3399_defconfig |  4 +-
  configs/pinebook-pro-rk3399_defconfig |  5 +-
  configs/pinephone-pro-rk3399_defconfig|  3 +-
  configs/puma-rk3399_defconfig |  1 -
  configs/roc-pc-mezzanine-rk3399_defconfig |  4 +-
  configs/roc-pc-rk3399_defconfig   |  4 +-
  configs/rock-4c-plus-rk3399_defconfig |  2 +-
  configs/rock-4se-rk3399_defconfig |  2 +-
  configs/rock-pi-4-rk3399_defconfig|  3 +-
  configs/rock-pi-4c-rk3399_defconfig   |  2 +-
  configs/rock-pi-n10-rk3399pro_defconfig   |  2 +-
  configs/rock960-rk3399_defconfig  |  2 +-
  configs/rockpro64-rk3399_defconfig|  5 +-
  43 files changed, 243 insertions(+), 83 deletions(-)

diff --git a/arch/arm/dts/rk3399-evb-u-boot.dtsi 
b/arch/arm/dts/rk3399-evb-u-boot.dtsi
index 796ac9642399..9df4a02c3e74 100644
--- a/arch/arm/dts/rk3399-evb-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-evb-u-boot.dtsi
@@ -38,7 +38,6 @@
  };
  
   {

-   bootph-all;
bus-width = <4>;
cap-mmc-highspeed;
cap-sd-highspeed;
diff --git a/arch/arm/dts/rk3399-ficus-u-boot.dtsi 
b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
index 67b63a835238..d821cabfaa67 100644
--- a/arch/arm/dts/rk3399-ficus-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
@@ -5,3 +5,11 @@
  
  #include "rk3399-u-boot.dtsi"

  #include "rk3399-sdram-ddr3-1600.dtsi"
+
+_pull_none_18ma {
+   bootph-pre-ram;
+};
+
+_pull_up_8ma {
+   bootph-pre-ram;
+};
diff --git a/arch/arm/dts/rk3399-gru-u-boot.dtsi 
b/arch/arm/dts/rk3399-gru-u-boot.dtsi
index b1604a6872c0..0cc40eb6d6f6 100644
--- a/arch/arm/dts/rk3399-gru-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-gru-u-boot.dtsi
@@ -54,6 +54,30 @@
enable-gpios = < 2 GPIO_ACTIVE_HIGH>;
  };
  
+ {

+   /delete-property/ bootph-pre-ram;
+};
+
+ {
+   /delete-property/ bootph-pre-ram;
+};
+
+_bus4 {
+   /delete-property/ bootph-pre-ram;
+};
+
+_cd {
+   /delete-property/ bootph-pre-ram;
+};
+
+_clk {
+   /delete-property/ bootph-pre-ram;
+};
+
+_cmd {
+   /delete-property/ bootph-pre-ram;
+};
+
   {
spi-activate-delay = <100>;

Re: [PATCH 11/31] clk: rockchip: rk3399: Rename SCLK_DDRCLK to SCLK_DDRC

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sync rk3399-cru.h with one from linux v6.2+ and fix use of the
SCLK_DDRCLK name that was only used by U-Boot.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-u-boot.dtsi|  2 +-
  drivers/clk/rockchip/clk_rk3399.c  |  2 +-
  include/dt-bindings/clock/rk3399-cru.h | 30 ++
  3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 69e6b808a69b..adb64d17e040 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -44,7 +44,7 @@
compatible = "rockchip,rk3399-dmc";
devfreq-events = <>;
interrupts = ;
-   clocks = < SCLK_DDRCLK>;
+   clocks = < SCLK_DDRC>;
clock-names = "dmc_clk";
reg = <0x0 0xffa8 0x0 0x0800
   0x0 0xffa80800 0x0 0x1800
diff --git a/drivers/clk/rockchip/clk_rk3399.c 
b/drivers/clk/rockchip/clk_rk3399.c
index 80f65a237e8e..f0ce54067f8c 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -1049,7 +1049,7 @@ static ulong rk3399_clk_set_rate(struct clk *clk, ulong 
rate)
 * return 0 to satisfy clk_set_defaults during device probe.
 */
return 0;
-   case SCLK_DDRCLK:
+   case SCLK_DDRC:
ret = rk3399_ddr_set_clk(priv->cru, rate);
break;
case PCLK_EFUSE1024NS:
diff --git a/include/dt-bindings/clock/rk3399-cru.h 
b/include/dt-bindings/clock/rk3399-cru.h
index 211faf8fa891..39169d94a44e 100644
--- a/include/dt-bindings/clock/rk3399-cru.h
+++ b/include/dt-bindings/clock/rk3399-cru.h
@@ -1,6 +1,7 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
  /*
   * Copyright (c) 2016 Rockchip Electronics Co. Ltd.
+ * Author: Xing Zheng 
   */
  
  #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3399_H

@@ -121,16 +122,17 @@
  #define SCLK_DPHY_RX0_CFG 165
  #define SCLK_RMII_SRC 166
  #define SCLK_PCIEPHY_REF100M  167
-#define SCLK_USBPHY0_480M_SRC  168
-#define SCLK_USBPHY1_480M_SRC  169
-#define SCLK_DDRCLK170
-#define SCLK_TESTOUT2  171
+#define SCLK_DDRC  168
+#define SCLK_TESTCLKOUT1   169
+#define SCLK_TESTCLKOUT2   170
  
  #define DCLK_VOP0			180

  #define DCLK_VOP1 181
  #define DCLK_VOP0_DIV 182
  #define DCLK_VOP1_DIV 183
  #define DCLK_M0_PERILP184
+#define DCLK_VOP0_FRAC 185
+#define DCLK_VOP1_FRAC 186
  
  #define FCLK_CM0S			190
  
@@ -545,8 +547,8 @@

  #define SRST_H_PERILP0171
  #define SRST_H_PERILP0_NOC172
  #define SRST_ROM  173
-#define SRST_CRYPTO_S  174
-#define SRST_CRYPTO_M  175
+#define SRST_CRYPTO0_S 174
+#define SRST_CRYPTO0_M 175
  
  /* cru_softrst_con11 */

  #define SRST_P_DCF176
@@ -554,7 +556,7 @@
  #define SRST_CM0S 178
  #define SRST_CM0S_DBG 179
  #define SRST_CM0S_PO  180
-#define SRST_CRYPTO181
+#define SRST_CRYPTO0   181
  #define SRST_P_PERILP1_SGRF   182
  #define SRST_P_PERILP1_GRF183
  #define SRST_CRYPTO1_S184
@@ -592,13 +594,13 @@
  #define SRST_P_SPI0   214
  #define SRST_P_SPI1   215
  #define SRST_P_SPI2   216
-#define SRST_P_SPI4217
-#define SRST_P_SPI5218
+#define SRST_P_SPI3217
+#define SRST_P_SPI4218
  #define SRST_SPI0 219
  #define SRST_SPI1 220
  #define SRST_SPI2 221
-#define SRST_SPI4  222
-#define SRST_SPI5  223
+#define SRST_SPI3  222
+#define SRST_SPI4  223
  
  /* cru_softrst_con14 */

  #define SRST_I2S0_8CH 224
@@ -720,8 +722,8 @@
  #define SRST_H_CM0S_NOC   3
  #define SRST_DBG_CM0S 4
  #define SRST_PO_CM0S  5
-#define SRST_P_SPI36
-#define SRST_SPI3  7
+#define SRST_P_SPI66
+#define SRST_SPI6  7
  #define SRST_P_TIMER_0_1  8
  #define SRST_P_TIMER_09
  #define SRST_P_TIMER_110


Re: [PATCH 09/31] rockchip: rk3399: Add a default spl-boot-order prop

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

A lot of RK3399 boards use a u-boot,spl-boot-order of "same-as-spl",
 and 

Move this to rk3399-u-boot.dtsi and make this default for boards
currently missing a u-boot,spl-boot-order prop.

The _flash reference has been dropped from spl-boot-order now that
boot source id is cached and "same-as-spl" can be resolved into the SPI
flash node.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi  | 1 -
  arch/arm/dts/rk3399-evb-u-boot.dtsi| 1 -
  arch/arm/dts/rk3399-ficus-u-boot.dtsi  | 6 --
  arch/arm/dts/rk3399-firefly-u-boot.dtsi| 6 --
  arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi| 6 --
  arch/arm/dts/rk3399-leez-p710-u-boot.dtsi  | 6 --
  arch/arm/dts/rk3399-nanopi4-u-boot.dtsi| 6 --
  arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi   | 6 --
  arch/arm/dts/rk3399-pinephone-pro-u-boot.dtsi  | 6 --
  arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 4 
  arch/arm/dts/rk3399-rock-pi-4-u-boot.dtsi  | 6 --
  arch/arm/dts/rk3399-rock960-u-boot.dtsi| 5 -
  arch/arm/dts/rk3399-rockpro64-u-boot.dtsi  | 5 +
  arch/arm/dts/rk3399-u-boot.dtsi| 4 
  arch/arm/dts/rk3399pro-rock-pi-n10-u-boot.dtsi | 6 --
  15 files changed, 5 insertions(+), 69 deletions(-)

diff --git a/arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi 
b/arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi
index a3f27566e438..6c07de98fa01 100644
--- a/arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-eaidk-610-u-boot.dtsi
@@ -9,7 +9,6 @@
  / {
chosen {
stdout-path = "serial2:150n8";
-   u-boot,spl-boot-order = "same-as-spl", , 
};
  };
  
diff --git a/arch/arm/dts/rk3399-evb-u-boot.dtsi b/arch/arm/dts/rk3399-evb-u-boot.dtsi

index dfce63e4d428..796ac9642399 100644
--- a/arch/arm/dts/rk3399-evb-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-evb-u-boot.dtsi
@@ -9,7 +9,6 @@
  / {
chosen {
stdout-path = "serial2:150n8";
-   u-boot,spl-boot-order = "same-as-spl", , 
};
  };
  
diff --git a/arch/arm/dts/rk3399-ficus-u-boot.dtsi b/arch/arm/dts/rk3399-ficus-u-boot.dtsi

index 38e0897db91d..67b63a835238 100644
--- a/arch/arm/dts/rk3399-ficus-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
@@ -5,9 +5,3 @@
  
  #include "rk3399-u-boot.dtsi"

  #include "rk3399-sdram-ddr3-1600.dtsi"
-
-/ {
-   chosen {
-   u-boot,spl-boot-order = "same-as-spl", , 
-   };
-};
diff --git a/arch/arm/dts/rk3399-firefly-u-boot.dtsi 
b/arch/arm/dts/rk3399-firefly-u-boot.dtsi
index c58ad95d120a..1f5fda1d0f1d 100644
--- a/arch/arm/dts/rk3399-firefly-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-firefly-u-boot.dtsi
@@ -6,12 +6,6 @@
  #include "rk3399-u-boot.dtsi"
  #include "rk3399-sdram-ddr3-1600.dtsi"
  
-/ {

-   chosen {
-   u-boot,spl-boot-order = "same-as-spl", , 
-   };
-};
-
  _log {
regulator-init-microvolt = <95>;
  };
diff --git a/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi 
b/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
index a7039d74a016..4a3b23e48313 100644
--- a/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-khadas-edge-u-boot.dtsi
@@ -6,12 +6,6 @@
  #include "rk3399-u-boot.dtsi"
  #include "rk3399-sdram-lpddr4-100.dtsi"
  
-/ {

-   chosen {
-   u-boot,spl-boot-order = "same-as-spl", , 
-   };
-};
-
  _log {
regulator-init-microvolt = <95>;
  };
diff --git a/arch/arm/dts/rk3399-leez-p710-u-boot.dtsi 
b/arch/arm/dts/rk3399-leez-p710-u-boot.dtsi
index c638ce259731..03b596850635 100644
--- a/arch/arm/dts/rk3399-leez-p710-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-leez-p710-u-boot.dtsi
@@ -6,12 +6,6 @@
  #include "rk3399-u-boot.dtsi"
  #include "rk3399-sdram-lpddr4-100.dtsi"
  
-/ {

-   chosen {
-   u-boot,spl-boot-order = "same-as-spl", , 
-   };
-};
-
  _log {
regulator-init-microvolt = <95>;
  };
diff --git a/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi 
b/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi
index a9d10592d573..a126bbaf086f 100644
--- a/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-nanopi4-u-boot.dtsi
@@ -5,12 +5,6 @@
  
  #include "rk3399-u-boot.dtsi"
  
-/{

-   chosen {
-   u-boot,spl-boot-order = "same-as-spl", , 
-   };
-};
-
   {
pinctrl-0 = <_bus4 _clk _cmd _cd>;
  };
diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi 
b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
index 88a77cad8d43..83b0c44e9ec5 100644
--- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi
@@ -6,12 +6,6 @@
  #include "rk3399-u-boot.dtsi"
  #include "rk3399-sdram-lpddr4-100.dtsi"
  
-/ {

-   chosen {
-   u-boot,spl-boot-order = "same-as-spl", , , 

-   };
-};
-
   {
rockchip,panel = <_panel>;
  };
diff --git 

Re: [PATCH 08/31] rockchip: rk3399: Remove use of xPL_MISC_DRIVERS options

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

The TPL and/or SPL control FDT on RK3399 boards does not contain any
node with a compatible that is supported by driver/misc/ drivers.

Remove use of xPL_MISC_DRIVERS options to stop including e.g an unused
efuse driver in TPL and/or SPL.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/mach-rockchip/Kconfig | 2 --
  1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 8dca9d2853b4..bc03d69a7f5c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -250,7 +250,6 @@ config ROCKCHIP_RK3399
select TPL_NEEDS_SEPARATE_STACK if TPL
select SPL_SEPARATE_BSS
select SPL_SERIAL
-   select SPL_DRIVERS_MISC
select CLK
select FIT
select PINCTRL
@@ -282,7 +281,6 @@ config ROCKCHIP_RK3399
imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT
imply TPL_CLK
imply TPL_DM
-   imply TPL_DRIVERS_MISC
imply TPL_LIBCOMMON_SUPPORT
imply TPL_LIBGENERIC_SUPPORT
imply TPL_OF_CONTROL


Re: [PATCH 07/31] rockchip: rk3399: Enable DT overlay support on all boards

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Imply OF_LIBFDT_OVERLAY Kconfig options to add device tree overlay
support on all RK3399 boards.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/mach-rockchip/Kconfig| 1 +
  configs/rock-4c-plus-rk3399_defconfig | 1 -
  configs/rock-4se-rk3399_defconfig | 1 -
  configs/rock-pi-4-rk3399_defconfig| 1 -
  configs/rock-pi-4c-rk3399_defconfig   | 1 -
  5 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index a07ad38f2efc..8dca9d2853b4 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -268,6 +268,7 @@ config ROCKCHIP_RK3399
imply LEGACY_IMAGE_FORMAT
imply MISC
imply MISC_INIT_R
+   imply OF_LIBFDT_OVERLAY
imply OF_LIVE
imply PARTITION_TYPE_GUID
imply PHY_GIGE if GMAC_ROCKCHIP
diff --git a/configs/rock-4c-plus-rk3399_defconfig 
b/configs/rock-4c-plus-rk3399_defconfig
index bebea4fd0691..6c69e8bdcb92 100644
--- a/configs/rock-4c-plus-rk3399_defconfig
+++ b/configs/rock-4c-plus-rk3399_defconfig
@@ -5,7 +5,6 @@ CONFIG_ARCH_ROCKCHIP=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4c-plus"
-CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_TARGET_ROCKPI4_RK3399=y
diff --git a/configs/rock-4se-rk3399_defconfig 
b/configs/rock-4se-rk3399_defconfig
index 04622df3c0a0..e5ed81022bd6 100644
--- a/configs/rock-4se-rk3399_defconfig
+++ b/configs/rock-4se-rk3399_defconfig
@@ -5,7 +5,6 @@ CONFIG_ARCH_ROCKCHIP=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se"
-CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_TARGET_ROCKPI4_RK3399=y
diff --git a/configs/rock-pi-4-rk3399_defconfig 
b/configs/rock-pi-4-rk3399_defconfig
index 9036c51de421..2801becedb4b 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -6,7 +6,6 @@ CONFIG_NR_DRAM_BANKS=1
  CONFIG_SF_DEFAULT_SPEED=1000
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a"
-CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_ROCKCHIP_SPI_IMAGE=y
diff --git a/configs/rock-pi-4c-rk3399_defconfig 
b/configs/rock-pi-4c-rk3399_defconfig
index e1adec600174..72d37bff9e9a 100644
--- a/configs/rock-pi-4c-rk3399_defconfig
+++ b/configs/rock-pi-4c-rk3399_defconfig
@@ -5,7 +5,6 @@ CONFIG_ARCH_ROCKCHIP=y
  CONFIG_NR_DRAM_BANKS=1
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4c"
-CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3399=y
  CONFIG_TARGET_ROCKPI4_RK3399=y


Re: [PATCH 06/31] rockchip: rk3399: Imply support for GbE PHY

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Imply support for GbE PHY status parsing and configuration when support
for onboard ethernet is enabled.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/mach-rockchip/Kconfig | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index e18d7f373f77..a07ad38f2efc 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -270,6 +270,7 @@ config ROCKCHIP_RK3399
imply MISC_INIT_R
imply OF_LIVE
imply PARTITION_TYPE_GUID
+   imply PHY_GIGE if GMAC_ROCKCHIP
imply PRE_CONSOLE_BUFFER
imply RNG_ROCKCHIP
imply ROCKCHIP_COMMON_BOARD


Re: [PATCH 05/31] rockchip: rk3399: Enable random generator on all boards

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

The RK3399 SoC contain a crypto engine block that can generate random
numbers.

Imply DM_RNG and RNG_ROCKCHIP Kconfig options to take advantage of the
random generator on all RK3399 boards.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/mach-rockchip/Kconfig | 2 ++
  configs/chromebook_bob_defconfig   | 2 --
  configs/chromebook_kevin_defconfig | 2 --
  configs/evb-rk3399_defconfig   | 2 --
  configs/firefly-rk3399_defconfig   | 2 --
  configs/pinebook-pro-rk3399_defconfig  | 2 --
  configs/pinephone-pro-rk3399_defconfig | 2 --
  configs/roc-pc-rk3399_defconfig| 2 --
  configs/rock960-rk3399_defconfig   | 2 --
  configs/rockpro64-rk3399_defconfig | 2 --
  10 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index eb74cd850409..e18d7f373f77 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -264,12 +264,14 @@ config ROCKCHIP_RK3399
imply ARMV8_SET_SMPEN
imply BOOTSTD_FULL
imply CMD_BOOTCOUNT if BOOTCOUNT_LIMIT
+   imply DM_RNG
imply LEGACY_IMAGE_FORMAT
imply MISC
imply MISC_INIT_R
imply OF_LIVE
imply PARTITION_TYPE_GUID
imply PRE_CONSOLE_BUFFER
+   imply RNG_ROCKCHIP
imply ROCKCHIP_COMMON_BOARD
imply ROCKCHIP_EFUSE
imply ROCKCHIP_SDRAM_COMMON
diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
index 5d8037d31422..6e203a6cf0e1 100644
--- a/configs/chromebook_bob_defconfig
+++ b/configs/chromebook_bob_defconfig
@@ -89,8 +89,6 @@ CONFIG_DM_REGULATOR_GPIO=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_CROS_EC=y
  CONFIG_PWM_ROCKCHIP=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
  CONFIG_ROCKCHIP_SPI=y
diff --git a/configs/chromebook_kevin_defconfig 
b/configs/chromebook_kevin_defconfig
index 54ba2fdd136f..e3d16f44d62a 100644
--- a/configs/chromebook_kevin_defconfig
+++ b/configs/chromebook_kevin_defconfig
@@ -90,8 +90,6 @@ CONFIG_DM_REGULATOR_GPIO=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_CROS_EC=y
  CONFIG_PWM_ROCKCHIP=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
  CONFIG_ROCKCHIP_SPI=y
diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index d81c7f9604e1..c4936768ffb6 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -47,8 +47,6 @@ CONFIG_PMIC_RK8XX=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig
index 545c047c6df8..8f68ffbd3a49 100644
--- a/configs/firefly-rk3399_defconfig
+++ b/configs/firefly-rk3399_defconfig
@@ -45,8 +45,6 @@ CONFIG_PMIC_RK8XX=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
diff --git a/configs/pinebook-pro-rk3399_defconfig 
b/configs/pinebook-pro-rk3399_defconfig
index 23ac24a0bffe..e4aad1b710cb 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -75,8 +75,6 @@ CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
  CONFIG_RAM_ROCKCHIP_LPDDR4=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
diff --git a/configs/pinephone-pro-rk3399_defconfig 
b/configs/pinephone-pro-rk3399_defconfig
index 8c6323f6c516..285c47d76b6e 100644
--- a/configs/pinephone-pro-rk3399_defconfig
+++ b/configs/pinephone-pro-rk3399_defconfig
@@ -65,8 +65,6 @@ CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
  CONFIG_RAM_ROCKCHIP_LPDDR4=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_ROCKCHIP_SPI=y
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index a41f71d9e167..5d6e6b17091f 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -60,8 +60,6 @@ CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
  # CONFIG_RAM_ROCKCHIP_DEBUG is not set
  CONFIG_RAM_ROCKCHIP_LPDDR4=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  CONFIG_BAUDRATE=150
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_SYS_NS16550_MEM32=y
diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index 13575c580054..7a4a3df85b1b 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -52,8 +52,6 @@ CONFIG_PMIC_RK8XX=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_REGULATOR_RK8XX=y
  CONFIG_PWM_ROCKCHIP=y
-CONFIG_DM_RNG=y
-CONFIG_RNG_ROCKCHIP=y
  

Re: [PATCH 04/31] rockchip: rk3399: Enable ARMv8 crypto and FIT checksum validation

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

The RK3399 SoC support the ARMv8 Cryptography Extensions, use of ARMv8
crypto can speed up FIT checksum validation in SPL.

Imply ARMV8_SET_SMPEN and ARMV8_CRYPTO to take advantage of the crypto
extensions for SHA256 when validating checksum of FIT images.

Imply SPL_FIT_SIGNATURE and LEGACY_IMAGE_FORMAT to enable FIT checksum
validation to almost all RK3399 boards.

The following boards have been excluded:
- chromebook_bob: SPL max size limitation of 120 KiB
- chromebook_kevin: SPL max size limitation of 120 KiB
- puma-rk3399: SPL stack in SRAM and TPL+SPL combined max size
limitation of 224 KiB

Also imply OF_LIVE to help speed up init of U-Boot proper and disable
CONFIG_SPL_RAW_IMAGE_SUPPORT on leez-rk3399 to ensure SPL does not try
to jump to code that failed checksum validation.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/mach-rockchip/Kconfig | 5 +
  configs/chromebook_bob_defconfig   | 1 +
  configs/chromebook_kevin_defconfig | 1 +
  configs/leez-rk3399_defconfig  | 1 +
  configs/puma-rk3399_defconfig  | 2 +-
  configs/rock-4se-rk3399_defconfig  | 2 --
  configs/rock-pi-4-rk3399_defconfig | 1 -
  configs/rockpro64-rk3399_defconfig | 2 --
  8 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index c0010fbb6887..eb74cd850409 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -260,15 +260,20 @@ config ROCKCHIP_RK3399
select DM_PMIC
select DM_REGULATOR_FIXED
select BOARD_LATE_INIT
+   imply ARMV8_CRYPTO
+   imply ARMV8_SET_SMPEN
imply BOOTSTD_FULL
imply CMD_BOOTCOUNT if BOOTCOUNT_LIMIT
+   imply LEGACY_IMAGE_FORMAT
imply MISC
imply MISC_INIT_R
+   imply OF_LIVE
imply PARTITION_TYPE_GUID
imply PRE_CONSOLE_BUFFER
imply ROCKCHIP_COMMON_BOARD
imply ROCKCHIP_EFUSE
imply ROCKCHIP_SDRAM_COMMON
+   imply SPL_FIT_SIGNATURE
imply SPL_ROCKCHIP_COMMON_BOARD
imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT
imply TPL_CLK
diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
index 58e76f11472c..5d8037d31422 100644
--- a/configs/chromebook_bob_defconfig
+++ b/configs/chromebook_bob_defconfig
@@ -23,6 +23,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
  CONFIG_SPL_SPI=y
  CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
+# CONFIG_SPL_FIT_SIGNATURE is not set
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-gru-bob.dtb"
  # CONFIG_DISPLAY_CPUINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/chromebook_kevin_defconfig 
b/configs/chromebook_kevin_defconfig
index 5adc276a746a..54ba2fdd136f 100644
--- a/configs/chromebook_kevin_defconfig
+++ b/configs/chromebook_kevin_defconfig
@@ -24,6 +24,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
  CONFIG_SPL_SPI=y
  CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
+# CONFIG_SPL_FIT_SIGNATURE is not set
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-gru-kevin.dtb"
  # CONFIG_DISPLAY_CPUINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
diff --git a/configs/leez-rk3399_defconfig b/configs/leez-rk3399_defconfig
index e5088341389a..2831cfb36689 100644
--- a/configs/leez-rk3399_defconfig
+++ b/configs/leez-rk3399_defconfig
@@ -15,6 +15,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-leez-p710.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_SPL_MAX_SIZE=0x2e000
  CONFIG_SPL_PAD_TO=0x7f8000
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
  CONFIG_TPL=y
  CONFIG_CMD_BOOTZ=y
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index c2759e1a9520..fe7aac791271 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -23,6 +23,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
  CONFIG_SPL_SPI=y
  CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
+# CONFIG_SPL_FIT_SIGNATURE is not set
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_SPL_MAX_SIZE=0x2e000
@@ -52,7 +53,6 @@ CONFIG_CMD_TIME=y
  CONFIG_CMD_PMIC=y
  CONFIG_CMD_REGULATOR=y
  CONFIG_SPL_OF_CONTROL=y
-CONFIG_OF_LIVE=y
  CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-rates 
assigned-clock-parents"
  CONFIG_ENV_OVERWRITE=y
  CONFIG_ENV_IS_IN_MMC=y
diff --git a/configs/rock-4se-rk3399_defconfig 
b/configs/rock-4se-rk3399_defconfig
index 712502517eb2..04622df3c0a0 100644
--- a/configs/rock-4se-rk3399_defconfig
+++ b/configs/rock-4se-rk3399_defconfig
@@ -15,8 +15,6 @@ CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_PCI=y
  CONFIG_DEBUG_UART=y
  # CONFIG_ANDROID_BOOT_IMAGE is not set
-CONFIG_SPL_FIT_SIGNATURE=y
-CONFIG_LEGACY_IMAGE_FORMAT=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4se.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_SPL_MAX_SIZE=0x2e000
diff --git a/configs/rock-pi-4-rk3399_defconfig 

Re: [PATCH 03/31] rockchip: rk3399: Sort imply statements alphabetically

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Sort imply statements under ROCKCHIP_RK3399 alphabetically.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  arch/arm/mach-rockchip/Kconfig | 28 ++--
  1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 22eccaaf5cb1..c0010fbb6887 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -260,30 +260,30 @@ config ROCKCHIP_RK3399
select DM_PMIC
select DM_REGULATOR_FIXED
select BOARD_LATE_INIT
+   imply BOOTSTD_FULL
+   imply CMD_BOOTCOUNT if BOOTCOUNT_LIMIT
+   imply MISC
+   imply MISC_INIT_R
imply PARTITION_TYPE_GUID
imply PRE_CONSOLE_BUFFER
imply ROCKCHIP_COMMON_BOARD
+   imply ROCKCHIP_EFUSE
imply ROCKCHIP_SDRAM_COMMON
imply SPL_ROCKCHIP_COMMON_BOARD
-   imply TPL_SERIAL
+   imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT
+   imply TPL_CLK
+   imply TPL_DM
+   imply TPL_DRIVERS_MISC
imply TPL_LIBCOMMON_SUPPORT
imply TPL_LIBGENERIC_SUPPORT
+   imply TPL_OF_CONTROL
+   imply TPL_RAM
+   imply TPL_REGMAP
+   imply TPL_ROCKCHIP_COMMON_BOARD
+   imply TPL_SERIAL
imply TPL_SYS_MALLOC_SIMPLE
-   imply TPL_DRIVERS_MISC
-   imply TPL_OF_CONTROL
-   imply TPL_DM
-   imply TPL_REGMAP
imply TPL_SYSCON
-   imply TPL_RAM
-   imply TPL_CLK
imply TPL_TINY_MEMSET
-   imply TPL_ROCKCHIP_COMMON_BOARD
-   imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT
-   imply BOOTSTD_FULL
-   imply CMD_BOOTCOUNT if BOOTCOUNT_LIMIT
-   imply MISC
-   imply ROCKCHIP_EFUSE
-   imply MISC_INIT_R
help
  The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
  and quad-core Cortex-A53.


Re: [PATCH 02/31] rockchip: rk3399-ficus: Enable TPL and use common bss and stack addr

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

The rk3399-ficus board is only using SPL and not TPL+SPL like all other
RK3399 boards, chromebook bob/kevin excluded. It does not seem to be any
technical reason why this board was left using only SPL.

Switch to use TPL+SPL and use common bss and stack addresses to allow
for more options to be enabled in a future patch. Also add the missing
DEFAULT_FDT_FILE option.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  configs/ficus-rk3399_defconfig | 14 ++
  1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig
index 4859042d6b56..3bcd0fd66b91 100644
--- a/configs/ficus-rk3399_defconfig
+++ b/configs/ficus-rk3399_defconfig
@@ -2,32 +2,22 @@ CONFIG_ARM=y
  CONFIG_SKIP_LOWLEVEL_INIT=y
  CONFIG_COUNTER_FREQUENCY=2400
  CONFIG_ARCH_ROCKCHIP=y
-CONFIG_TEXT_BASE=0x0020
-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x30
  CONFIG_SF_DEFAULT_SPEED=2000
  CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3399-ficus"
-CONFIG_SPL_TEXT_BASE=0xff8c2000
  CONFIG_ROCKCHIP_RK3399=y
-CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x4000
  CONFIG_TARGET_ROCK960_RK3399=y
-CONFIG_SPL_STACK=0xff8e
  CONFIG_DEBUG_UART_BASE=0xFF1A
  CONFIG_DEBUG_UART_CLOCK=2400
  CONFIG_SYS_LOAD_ADDR=0x800800
  CONFIG_DEBUG_UART=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-ficus.dtb"
  CONFIG_DISPLAY_BOARDINFO_LATE=y
  CONFIG_SPL_MAX_SIZE=0x2e000
  CONFIG_SPL_PAD_TO=0x7f8000
-CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0xff8e
-CONFIG_SPL_BSS_MAX_SIZE=0x1
  # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
-# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK_R=y
-CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
+CONFIG_TPL=y
  CONFIG_CMD_BOOTZ=y
  CONFIG_CMD_GPT=y
  CONFIG_CMD_MMC=y


Re: [PATCH 01/31] rockchip: rk3399-gru: Fix max SPL size on bob and kevin

2024-04-23 Thread Kever Yang



On 2024/4/1 04:28, Jonas Karlman wrote:

Chromebook bob and kevin only use SPL and not TPL+SPL like other RK3399
boards, this mean that SPL is loaded to and run from SRAM instead of
DRAM. The SPL and U-Boot payload is loaded from SPI flash.

The U-Boot payload is located at 0x4 (256 KiB) offset in SPI flash
and because the BROM only read first 2 KiB for each 4 KiB page, the size
of SPL (idbloader.img) is limited to max 128 KiB.

The chosen bss start address further limits the size of SPL to 120 KiB.

   0xff8e (SPL_BSS_START_ADDR) - 0xff8c2000 (SPL_TEXT_BASE) = 0x1e000

Update SPL_MAX_SIZE to reflect the 120 KiB max size limitation.

Signed-off-by: Jonas Karlman 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  configs/chromebook_bob_defconfig   | 2 +-
  configs/chromebook_kevin_defconfig | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
index d0321948697b..58e76f11472c 100644
--- a/configs/chromebook_bob_defconfig
+++ b/configs/chromebook_bob_defconfig
@@ -30,7 +30,7 @@ CONFIG_BOARD_EARLY_INIT_R=y
  CONFIG_BLOBLIST=y
  CONFIG_BLOBLIST_ADDR=0x10
  CONFIG_BLOBLIST_SIZE=0x1000
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x1e000
  CONFIG_SPL_PAD_TO=0x7f8000
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0xff8e
diff --git a/configs/chromebook_kevin_defconfig 
b/configs/chromebook_kevin_defconfig
index 120c11c04972..5adc276a746a 100644
--- a/configs/chromebook_kevin_defconfig
+++ b/configs/chromebook_kevin_defconfig
@@ -31,7 +31,7 @@ CONFIG_BOARD_EARLY_INIT_R=y
  CONFIG_BLOBLIST=y
  CONFIG_BLOBLIST_ADDR=0x10
  CONFIG_BLOBLIST_SIZE=0x1000
-CONFIG_SPL_MAX_SIZE=0x2e000
+CONFIG_SPL_MAX_SIZE=0x1e000
  CONFIG_SPL_PAD_TO=0x7f8000
  CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
  CONFIG_SPL_BSS_START_ADDR=0xff8e


Re: [PATCH 2/2] armv8: generic_timer: Use event stream for udelay

2024-04-23 Thread Quentin Schulz

Hi Peter,

On 4/23/24 10:10, Peter Hoyes wrote:

From: Peter Hoyes 

Polling cntpct_el0 in a tight loop for delays is inefficient.
This is particularly apparent on Arm FVPs, which do not simulate
real time, meaning that a 1s sleep can take a couple of orders
of magnitude longer to execute in wall time.

If running at EL2 or above (where CNTHCTL_EL2 is available), enable
the cntpct_el0 event stream temporarily and use wfe to implement
the delay more efficiently. The event period is chosen as a
trade-off between efficiency and the fact that Arm FVPs do not
typically simulate real time.

This is only implemented for Armv8 boards, where an architectural
timer exists.

Some mach-socfpga AArch64 boards already override __udelay to make
it always inline, so guard the functionality with a new
ARMV8_UDELAY_EVENT_STREAM Kconfig, enabled by default.

Signed-off-by: Peter Hoyes 
---
  arch/arm/cpu/armv8/Kconfig |  8 
  arch/arm/cpu/armv8/generic_timer.c | 27 +++
  arch/arm/include/asm/system.h  |  6 --
  3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig
index 9f0fb369f7..544c5e2d74 100644
--- a/arch/arm/cpu/armv8/Kconfig
+++ b/arch/arm/cpu/armv8/Kconfig
@@ -191,6 +191,14 @@ config ARMV8_EA_EL3_FIRST
  Exception handling at all exception levels for External Abort and
  SError interrupt exception are taken in EL3.
  
+config ARMV8_UDELAY_EVENT_STREAM

+   bool "Use the event stream for udelay"
+   default y if !ARCH_SOCFPGA
+   help
+ Use the event stream provided by the AArch64 architectural timer for
+ delays. This is more efficient than the default polling
+ implementation.
+
  menuconfig ARMV8_CRYPTO
bool "ARM64 Accelerated Cryptographic Algorithms"
  
diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c

index 8f83372cbc..e18b5c8187 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -115,3 +115,30 @@ ulong timer_get_boot_us(void)
  
  	return val / get_tbclk();

  }
+
+#if CONFIG_IS_ENABLED(ARMV8_UDELAY_EVENT_STREAM)
+void __udelay(unsigned long usec)
+{
+   u64 target = get_ticks() + usec_to_tick(usec);
+


This can theoretically overflow, do we have any guarantee this cannot 
happen in real life, like... we would need U-Boot to be running for 100 
years without being powered-down/reset or something like that? Can we 
document this assumption? Does this make sense?



+   /* At EL2 or above, use the event stream to avoid polling CNTPCT_EL0 so 
often */
+   if (current_el() >= 2) {
+   u32 cnthctl_val;
+   const u8 event_period = 0x7;
+
+   asm volatile("mrs %0, cnthctl_el2" : "=r" (cnthctl_val));
+   asm volatile("msr cnthctl_el2, %0" : : "r"
+   (cnthctl_val | CNTHCTL_EL2_EVNT_EN | 
CNTHCTL_EL2_EVNT_I(event_period)));
+
+   while (get_ticks() + (1ULL << event_period) <= target)


This could be an overflow as well.


+   wfe();
+
+   /* Reset the event stream */
+   asm volatile("msr cnthctl_el2, %0" : : "r" (cnthctl_val));
+   }
+
+   /* Fall back to polling CNTPCT_EL0 */
+   while (get_ticks() <= target)


get_ticks() could wrap around here maybe?

Cheers,
Quentin


[PATCH v2] rockchip: add support for Theobroma Systems SOM-RK3588-Q7 Tiger module

2024-04-23 Thread Quentin Schulz
From: Quentin Schulz 

The RK3588-Q7 SoM is a Qseven-compatible (70mm x 70mm, MXM-230
connector) system-on-module from Theobroma Systems, featuring the
Rockchip RK3588.

It provides the following feature set:
 * up to 16GB LPDDR4x
 * on-module eMMC
 * SD card (on a baseboard) via edge connector
 * Gigabit Ethernet with on-module GbE PHY
 * HDMI/eDP
 * MIPI-DSI
 * 4x MIPI-CSI (3x on FPC connectors, 1x over Q7)
 * HDMI input over FPC connector
 * CAN
 * USB
   - 1x USB 3.0 dual-role (direct connection)
   - 2x USB 3.0 host + 1x USB 2.0 host
 * PCIe
   - 1x PCIe 2.1 Gen3, 4 lanes
   - 2xSATA / 2x PCIe 2.1 Gen1, 2 lanes
 * on-module ATtiny816 companion controller, implementing:
   - low-power RTC functionality (ISL1208 emulation)
   - fan controller (AMC6821 emulation)
  * on-module Secure Element with Global Platform 2.2.1 compliant
JavaCard environment

The support is added for Tiger on Haikou devkit, similarly to RK3399
Puma and PX30 Ringneck.

The DTS and DTSI are taken from upstream Linux kernel v6.9-rc4.

Cc: Quentin Schulz 
Signed-off-by: Quentin Schulz 
---
This has a light dependency on
https://lore.kernel.org/u-boot/20240415-rk35xx-dram-atags-v3-0-5bc5475b3...@theobroma-systems.com/
(the Tiger defconfig can be updated to remove the dependency if required)

To: Tom Rini 
To: Klaus Goger 
To: Heiko Stuebner 
To: Simon Glass 
To: Philipp Tomsich 
To: Kever Yang 
Cc: u-boot@lists.denx.de
Signed-off-by: Quentin Schulz 

Changes in v2:
- removed uart controller muxing patch as not necessary until we get
  open-source DRAM init,
- disabled DEBUG_UART_BOARD_INIT as it's only used for muxing the UART
  controller and it's not necessary since DDR bin does this for us
  already,
- added missing uart2 mux bootph in U-Boot dtsi (though not required
  yet),
- switched to USB_DWC3_GENERIC from USB_XHCI_DWC3 as requested by Jonas,
- Link to v1: 
https://lore.kernel.org/r/20240422-tiger-v1-0-8816b070d...@theobroma-systems.com
---
 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi   |  59 ++
 arch/arm/dts/rk3588-tiger-haikou.dts   | 266 
 arch/arm/dts/rk3588-tiger.dtsi | 690 +
 arch/arm/mach-rockchip/rk3588/Kconfig  |  31 +
 board/theobroma-systems/tiger_rk3588/Kconfig   |  16 +
 board/theobroma-systems/tiger_rk3588/MAINTAINERS   |  13 +
 board/theobroma-systems/tiger_rk3588/Makefile  |  10 +
 .../theobroma-systems/tiger_rk3588/tiger_rk3588.c  |  53 ++
 configs/tiger-rk3588_defconfig | 114 
 doc/board/rockchip/rockchip.rst|   1 +
 doc/board/theobroma-systems/index.rst  |   1 +
 doc/board/theobroma-systems/tiger_rk3588.rst   | 102 +++
 include/configs/tiger_rk3588.h |  15 +
 14 files changed, 1372 insertions(+)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b1c9c6222e5..ef901642a0a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -180,6 +180,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3588) += \
rk3588-quartzpro64.dtb \
rk3588s-rock-5a.dtb \
rk3588-rock-5b.dtb \
+   rk3588-tiger-haikou.dtb \
rk3588-turing-rk1.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RV1108) += \
diff --git a/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi 
b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
new file mode 100644
index 000..bfcefe256b0
--- /dev/null
+++ b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2024 Theobroma Systems Design und Consulting GmbH
+ */
+
+#include "rk3588-u-boot.dtsi"
+
+/ {
+   chosen {
+   u-boot,spl-boot-order = "same-as-spl", , 
+   };
+};
+
+_pwrseq {
+   bootph-pre-ram;
+   bootph-some-ram;
+};
+
+_reset {
+   bootph-pre-ram;
+   bootph-some-ram;
+};
+
+ {
+   bootph-pre-ram;
+   bootph-some-ram;
+};
+
+ {
+   /* U-Boot currently cannot handle anything below HS200 for eMMC on 
RK3588 */
+   /delete-property/ mmc-ddr-1_8v;
+   /delete-property/ cap-mmc-highspeed;
+};
+
+/* Q7 USB P0 */
+ {
+   status = "okay";
+};
+
+_otg {
+   status = "okay";
+};
+
+_xfer {
+   bootph-all;
+};
+
+/* Q7 USB P0 */
+_phy1 {
+   status = "okay";
+};
+
+_phy1_u3 {
+   status = "okay";
+};
+
+_host1_xhci {
+   status = "okay";
+};
diff --git a/arch/arm/dts/rk3588-tiger-haikou.dts 
b/arch/arm/dts/rk3588-tiger-haikou.dts
new file mode 100644
index 000..d672198c6b6
--- /dev/null
+++ b/arch/arm/dts/rk3588-tiger-haikou.dts
@@ -0,0 +1,266 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Theobroma Systems Design und Consulting GmbH
+ */
+
+/dts-v1/;
+#include 
+#include "rk3588-tiger.dtsi"
+
+/ {
+   model = "Theobroma Systems RK3588-Q7 SoM on Haikou devkit";
+   compatible = "tsd,rk3588-tiger-haikou", "tsd,rk3588-tiger", 
"rockchip,rk3588";
+
+   aliases {
+   

Re: [PATCH 2/2] rockchip: add support for Theobroma Systems SOM-RK3588-Q7 Tiger module

2024-04-23 Thread Quentin Schulz

Hi Jonas,

On 4/22/24 19:54, Jonas Karlman wrote:

Hi Quentin,

On 2024-04-22 18:41, Quentin Schulz wrote:

From: Quentin Schulz 

[...]

diff --git a/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi 
b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi
new file mode 100644
index 000..4259399193a
--- /dev/null
+++ b/arch/arm/dts/rk3588-tiger-haikou-u-boot.dtsi

[...]


Following should be added to possible fix uart2 pinctrl in SPL:

   _xfer {
bootph-all;
   };



Would only be useful once we get rid of DDR bin, but will do it now 
because I have a feeling I would forget otherwise :)


Thanks for catching this though.

[...]


[snip]


diff --git a/configs/tiger-rk3588_defconfig b/configs/tiger-rk3588_defconfig
new file mode 100644
index 000..6545445bba1
--- /dev/null
+++ b/configs/tiger-rk3588_defconfig

[...]

+CONFIG_USB_XHCI_DWC3=y


Please use USB_DWC3_GENERIC instead of USB_XHCI_DWC3.



Dang, I thought I was using "the correct one".

It's very difficult to know which one to pick right now, would it be 
possible to update the help message to guide the users a bit more in 
their choice? I don't really have a clue why one is "better" than the 
other so wouldn't be able to suggest something.


Cheers,
Quentin


Re: [PATCH 1/2] rockchip: rk3588: add support for UART2 M1 and M2 in SPL

2024-04-23 Thread Kever Yang

Hi Quentin,

On 2024/4/23 17:31, Quentin Schulz wrote:

Hi Kever,

On 4/23/24 03:09, Kever Yang wrote:

Hi Quentin,

On 2024/4/23 00:41, Quentin Schulz wrote:

From: Quentin Schulz 

UART2 controller is the controller in the reference design for debug
console. The default mux is M0 in that reference design. Until now, all
boards seemed to be using UART2M0 but RK3588 Tiger for example will be
using UART2M2 instead.
This feature already been supported, please use 
CONFIG_DEBUG_UART_BASE and

CONFIG_ROCKCHIP_UART_MUX_SEL_M to select your output channel.



CONFIG_ROCKCHIP_UART_MUX_SEL_M is only available in Rockchip's 
downstream U-Boot.


Sorry, my mistake, I'm searching the wrong code.

I though we should already have solution for this, it should be 
DEBUG_UART_CHANNEL then.



Thanks,

- Kever



git log -p -S ROCKCHIP_UART_MUX_SEL_M

returns nothing upstream, neither does git grep.

I used the same mechanism as for PX30.

This patch will be removed though as it's not needed until we have an 
open-source DRAM init. Until then we have to rely on the DDR bin to 
setup the UART.


Cheers,
Quentin


Re: [PATCH 1/2] rockchip: rk3588: add support for UART2 M1 and M2 in SPL

2024-04-23 Thread Quentin Schulz

Hi Kever,

On 4/23/24 03:09, Kever Yang wrote:

Hi Quentin,

On 2024/4/23 00:41, Quentin Schulz wrote:

From: Quentin Schulz 

UART2 controller is the controller in the reference design for debug
console. The default mux is M0 in that reference design. Until now, all
boards seemed to be using UART2M0 but RK3588 Tiger for example will be
using UART2M2 instead.

This feature already been supported, please use CONFIG_DEBUG_UART_BASE and
CONFIG_ROCKCHIP_UART_MUX_SEL_M to select your output channel.



CONFIG_ROCKCHIP_UART_MUX_SEL_M is only available in Rockchip's 
downstream U-Boot.


git log -p -S ROCKCHIP_UART_MUX_SEL_M

returns nothing upstream, neither does git grep.

I used the same mechanism as for PX30.

This patch will be removed though as it's not needed until we have an 
open-source DRAM init. Until then we have to rely on the DDR bin to 
setup the UART.


Cheers,
Quentin


Re: [PATCH 1/2] rockchip: rk3588: add support for UART2 M1 and M2 in SPL

2024-04-23 Thread Quentin Schulz

Hi Jonas,

On 4/22/24 19:41, Jonas Karlman wrote:

Hi Quentin,

On 2024-04-22 18:41, Quentin Schulz wrote:

From: Quentin Schulz 

UART2 controller is the controller in the reference design for debug
console. The default mux is M0 in that reference design. Until now, all
boards seemed to be using UART2M0 but RK3588 Tiger for example will be
using UART2M2 instead.

Therefore, let's add support for UART2M1 and M2 as possible muxes for
the UART2 controller used as debug console. UART2M1 support was not
tested.

The default value is M0 to match the one used currently by all devices
and the reference design.


Is this really necessary?

Use of board_debug_uart_init() should typically only be needed in TPL on
Rockchip platform, and with ROCKCHIP_TPL being used it should be enough
to use rkbin/ddrbin_tool to change uart config and just ensure correct
pinctrl is used for uart node, and that the uart node is included in SPL
for correct serial console use.



ddrbin_tool is a blob that Rockchip refuses to provide sources of. 
Running a blob on the target is one thing, requiring our users to run a 
blob on their build machine is another thing (though I document it in 
the rST).


However... I don't think we have another way around because I just 
remembered that if you have two muxes selected for the same UART 
controller, RX won't work. So while we would have UART output for U-Boot 
if Rockchip's TPL is one mux (e.g. m0, the default) and upstream U-Boot 
another one, we wouldn't be able to interact with it.


It'll be necessary the day we have an open-source DRAM init though (I 
had to do this for PX30 for example).


The issue is that since ddrbin_tool is a blob, it's not possible to use 
it in Yocto for automatically generating the appropriate ddr bin blob 
based on uart controller, mux and baudrate. So that will be my cross to 
bear.



May I suggest you try adding following to defconfig and drop this patch?

   # CONFIG_DEBUG_UART_BOARD_INIT is not set

I would expect that should result in same/working behavior without
having to add any new code.



It does work, thanks for the suggestion, will send a v2.

Cheers,
Quentin


Re: [PATCH v2 11/14] rockchip: rk3308-evb: Update defconfig

2024-04-23 Thread Kever Yang

Hi Jonas,

On 2024/4/22 17:16, Jonas Karlman wrote:

Hi Kever,

On 2024-04-22 10:50, Kever Yang wrote:

Hi Jonas,

On 2024/4/9 02:14, Jonas Karlman wrote:

Update defconfig for rk3308-evb with new defaults.

Add OF_LIBFDT_OVERLAY=y to support device tree overlays.

Remove the SPL_DRIVERS_MISC=y option, no misc driver is used in SPL.

Use DEBUG_UART_BASE=0xFF0E and disable DEBUG_UART_BOARD_INIT to
make debug uart use uart4, same as stdout-path prop.

Why this change happen? I think rk3308-evb is using UART2 on 0xFF0C.


The device tree both used in U-Boot [1] and Linux [2] both use:

   stdout-path = "serial4:150n8"

and only enable the uart4 node. Yet the defconfig in U-Boot use a
DEBUG_UART_BASE for uart2 instead of uart4.


Thanks for this info, rk3308b evb which is for customer do use the uart4 
instead of uart2.


Reviewed-by: Kever Yang 

Thanks,
- Kever



Having U-Boot defconfig matching the upstream device tree seem like a
good thing, but maybe the device tree is wrong?

[1] 
https://source.denx.de/u-boot/u-boot/-/blob/master/arch/arm/dts/rk3308-evb.dts
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3308-evb.dts

Regards,
Jonas


Thanks,

- Kever


Remove BOOTDELAY=0, SYS_CONSOLE_INFO_QUIET=y and enable more CMD to
allow use of U-Boot cmdline.

Add DM_ETH_PHY=y and PHY_REALTEK=y to support onboard ethernet PHY.

Add PHY_ROCKCHIP_INNO_USB2=y, DM_USB_GADGET=y and remove USB_DWC2=y to
allow full use of USB 2.0 host and otg ports.

Enable EFI_LOADER to allow EFI boot.

Signed-off-by: Jonas Karlman
---
v2: Fix DEBUG_UART_BASE and disable DEBUG_UART_BOARD_INIT
---
   configs/evb-rk3308_defconfig | 37 +++-
   1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/configs/evb-rk3308_defconfig b/configs/evb-rk3308_defconfig
index 9dc7d9c0caea..04a94e13a68a 100644
--- a/configs/evb-rk3308_defconfig
+++ b/configs/evb-rk3308_defconfig
@@ -3,41 +3,32 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
   CONFIG_COUNTER_FREQUENCY=2400
   CONFIG_ARCH_ROCKCHIP=y
   CONFIG_DEFAULT_DEVICE_TREE="rk3308-evb"
+CONFIG_OF_LIBFDT_OVERLAY=y
   CONFIG_DM_RESET=y
   CONFIG_ROCKCHIP_RK3308=y
-CONFIG_SPL_DRIVERS_MISC=y
   CONFIG_TARGET_EVB_RK3308=y
-CONFIG_DEBUG_UART_BASE=0xFF0C
+CONFIG_DEBUG_UART_BASE=0xFF0E
   CONFIG_DEBUG_UART_CLOCK=2400
+# CONFIG_DEBUG_UART_BOARD_INIT is not set
   CONFIG_SYS_LOAD_ADDR=0xc00800
   CONFIG_DEBUG_UART=y
   CONFIG_ANDROID_BOOT_IMAGE=y
   CONFIG_FIT=y
   CONFIG_FIT_VERBOSE=y
-CONFIG_BOOTDELAY=0
   CONFIG_DEFAULT_FDT_FILE="rockchip/rk3308-evb.dtb"
-CONFIG_SYS_CONSOLE_INFO_QUIET=y
   # CONFIG_DISPLAY_CPUINFO is not set
-CONFIG_SPL_MAX_SIZE=0x2
+CONFIG_SPL_MAX_SIZE=0x4
   CONFIG_SPL_PAD_TO=0x7f8000
   # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
-# CONFIG_CMD_BDI is not set
-# CONFIG_CMD_CONSOLE is not set
-# CONFIG_CMD_ELF is not set
-# CONFIG_CMD_IMI is not set
-# CONFIG_CMD_XIMG is not set
+CONFIG_CMD_GPIO=y
   CONFIG_CMD_GPT=y
-# CONFIG_CMD_LOADB is not set
-# CONFIG_CMD_LOADS is not set
   CONFIG_CMD_MMC=y
   CONFIG_CMD_USB=y
+CONFIG_CMD_ROCKUSB=y
   CONFIG_CMD_USB_MASS_STORAGE=y
-# CONFIG_CMD_ITEST is not set
-# CONFIG_CMD_SETEXPR is not set
-# CONFIG_CMD_SLEEP is not set
-# CONFIG_SPL_DOS_PARTITION is not set
-# CONFIG_ISO_PARTITION is not set
-CONFIG_EFI_PARTITION_ENTRIES_NUMBERS=64
+CONFIG_CMD_RNG=y
+CONFIG_CMD_KASLRSEED=y
+CONFIG_CMD_REGULATOR=y
   CONFIG_SPL_OF_CONTROL=y
   CONFIG_OF_LIVE=y
   CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks 
assigned-clock-rates assigned-clock-parents"
@@ -51,9 +42,11 @@ CONFIG_SYS_I2C_ROCKCHIP=y
   CONFIG_SUPPORT_EMMC_RPMB=y
   CONFIG_MMC_DW=y
   CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_ETH_PHY=y
   CONFIG_ETH_DESIGNWARE=y
   CONFIG_GMAC_ROCKCHIP=y
-CONFIG_PHY=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
   CONFIG_PINCTRL=y
   CONFIG_REGULATOR_PWM=y
   CONFIG_DM_REGULATOR_FIXED=y
@@ -62,15 +55,15 @@ CONFIG_RAM=y
   CONFIG_BAUDRATE=150
   CONFIG_DEBUG_UART_SHIFT=2
   CONFIG_SYS_NS16550_MEM32=y
+CONFIG_SYSINFO=y
   CONFIG_SYSRESET=y
   CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
   CONFIG_USB_EHCI_HCD=y
   CONFIG_USB_EHCI_GENERIC=y
-CONFIG_USB_DWC2=y
   CONFIG_USB_GADGET=y
   CONFIG_USB_GADGET_DWC2_OTG=y
   CONFIG_USB_GADGET_DOWNLOAD=y
-CONFIG_SPL_TINY_MEMSET=y
+CONFIG_USB_FUNCTION_ROCKUSB=y
   CONFIG_LZO=y
   CONFIG_ERRNO_STR=y
-# CONFIG_EFI_LOADER is not set


Re: [PATCH v2 2/4] doc: Document capsule generation through a config file

2024-04-23 Thread Sughosh Ganu
hi Heinrich,

On Fri, 19 Apr 2024 at 13:01, Heinrich Schuchardt  wrote:
>
> On 19.04.24 08:55, Sughosh Ganu wrote:
> > The UEFI capsule can now be generated by specifying the capsule
> > parameters through a config file. Highlight these changes in the
> > documentation.
> >
> > Signed-off-by: Sughosh Ganu 
> > ---
> >   doc/develop/uefi/uefi.rst | 70 +++
> >   1 file changed, 70 insertions(+)
> >
> > diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst
> > index 0389b269c0..8586127a83 100644
> > --- a/doc/develop/uefi/uefi.rst
> > +++ b/doc/develop/uefi/uefi.rst
> > @@ -318,6 +318,76 @@ Run the following command
> > --guid  \
> > 
>
> The users deserve a man-page mkeficapsule.1 that can be installed by
> distros as /usr/share/doc/man/man1/mkeficapsule.1.
>
> Do not expect the user to look up the information online.

Will add a man-page.

>
> >
> > +Alternatively, the capsules can be generated through a config
> > +file. When generating the capsules through a config file, the Kconfig
> > +symbol CONFIG_EFI_CAPSULE_CFG_FILE is to be used for specifying the
> > +path to the config file.
>
> Why do we need CONFIG_EFI_CAPSULE_CFG_FILE? You could use a fixed path
> or an environment parameter.

Will remove the config flags.

>
> > +
> > +The config file describes the parameters that are used for generating
> > +one or more capsules. The parameters for a given capsule file are
> > +specified within curly braces, in the form of "key:value" pairs. All
> > +the parameters that are currently supported by the mkeficapsule tool
> > +can be specified through the config file.
> > +
> > +The following are some example payload parameters specified through
> > +the config file.
> > +
> > +.. code-block:: none
> > +
> > + {
> > + image-guid: 02f4d760-cfd5-43bd-8e2d-a42acb33c660
> > + hardware-instance: 0
> > + monotonic-count: 1
> > + payload: u-boot.bin
> > + image-index: 1
> > + fw-version: 2
> > + private-key: /path/to/priv/key
> > + pub-key-cert: /path/to/pub/key
> > + capsule: u-boot.capsule
> > + }
> > + {
> > + image-guid: 4ce292da-1dd8-428d-a1c2-77743ef8b96e
> > + hardware-instance: 0
> > + payload: u-boot.itb
> > + image-index: 2
> > + fw-version: 7
> > + oemflags: 0x8000
> > + capsule: fit.capsule
> > + }
> > + {
> > + capsule-type: accept
> > + image-guid: 4ce292da-1dd8-428d-a1c2-77743ef8b96e
> > + capsule: accept.capsule
> > + }
> > + {
> > + capsule-type: revert
> > + capsule: revert.capsule
> > + }
>
> Is this one file? Are these multiple files? If these are multiple files,
> please, put them in different code blocks.

These are multiple files. But eventually, we will be using this
feature to generate a multi-payload capsule. Again, this is on similar
lines to how this is done with the EDKII script.

>
> What are the curly braces good for? Please, use an established file
> format like YAML or JSON.

As discussed over IRC, I will check if I can use the YAML format and
keep the format similar to the one used above -- in key:value pairs. I
would prefer keeping the format similar to what is used in the EDKII
capsule generation tool. But if I can use the mapping node type in
YAML for providing this information, I will explore using YAML with
the libcyaml library for parsing the configs.
>
> > +
> > +The following are the keys that specify the capsule parameters
> > +
> > +..code-block:: none
> > +
> > +image-guid: Image GUID
>
> Please use the following formatting:
>
> image-guid
>  Image GUID
>
> fw-version
>  Image version

I have kept the format similar to what is used in EDKII.

>
> > +image-index: Image index value
> > +fw-version: Image version
> > +private-key: Path to the private key file used for capsule signing
> > +pub-key-cert: Path to the public key crt file used for capsule signing
> > +payload: Path to the capsule payload file
> > +capsule: Path to the output capsule file that is generated
> > +hardware-instance: Hardware Instance value
>
> Please, explain what a hardware instance is.

Okay

>
> > +monotonic-count: Monotonic count value
>
> Please, explain what it is used for.

Okay

>
> > +capsule-type: Specifies capsule type. normal(default), accept or revert
>
> ditto
>
> > +oemflags: 16bit Oemflags value to be used(populated in capsule header)
>
> ditto
>
> > +
> > +When generating capsules through a config file, the command would look
> > +like
> > +
> > +.. code-block:: console
> > +
> > +$ mkeficapsule --cfg-file 
>
> All available command line parameters of mkeficapsule should be
> described in one place.

Will fix

-sughosh

>
> Best regards
>
> Heinrich
>
> > +
> > +
> >   Capsule with firmware version
> >   *
> >
>


[PATCH v2 3/3] board: starfive: Call spl_dram_init() for DRAM initialization

2024-04-23 Thread lukas . funke-oss
From: Lukas Funke 

Call spl_dram_init() since this is commonly used for dram initialization
in u-boot.

Signed-off-by: Lukas Funke 
---

Changes in v2:
 - capitalized acronym DRAM

 board/starfive/visionfive2/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c
index 45848db6d8..ca61b5be22 100644
--- a/board/starfive/visionfive2/spl.c
+++ b/board/starfive/visionfive2/spl.c
@@ -285,9 +285,9 @@ int spl_board_init_f(void)
 
jh7110_jtag_init();
 
-   ret = spl_soc_init();
+   ret = spl_dram_init();
if (ret) {
-   debug("JH7110 SPL init failed: %d\n", ret);
+   debug("JH7110 DRAM init failed: %d\n", ret);
return ret;
}
 
-- 
2.30.2



[PATCH v2 1/3] arch: riscv: Rename spl_soc_init() to spl_dram_init()

2024-04-23 Thread lukas . funke-oss
From: Lukas Funke 

Rename spl_soc_init() to spl_dram_init() because the generic function
name does not reflect what the function is actually doing. In addition
spl_dram_init() is commonly used for dram initialization and should
be called from board_init_f().

Signed-off-by: Lukas Funke 
---

(no changes since v1)

 arch/riscv/cpu/fu540/spl.c   | 2 +-
 arch/riscv/cpu/fu740/spl.c   | 2 +-
 arch/riscv/cpu/jh7110/spl.c  | 2 +-
 arch/riscv/include/asm/arch-fu540/spl.h  | 2 +-
 arch/riscv/include/asm/arch-fu740/spl.h  | 2 +-
 arch/riscv/include/asm/arch-jh7110/spl.h | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/riscv/cpu/fu540/spl.c b/arch/riscv/cpu/fu540/spl.c
index 45657b7909..cedb70b66a 100644
--- a/arch/riscv/cpu/fu540/spl.c
+++ b/arch/riscv/cpu/fu540/spl.c
@@ -7,7 +7,7 @@
 #include 
 #include 
 
-int spl_soc_init(void)
+int spl_dram_init(void)
 {
int ret;
struct udevice *dev;
diff --git a/arch/riscv/cpu/fu740/spl.c b/arch/riscv/cpu/fu740/spl.c
index c6816e9ed4..16b307f036 100644
--- a/arch/riscv/cpu/fu740/spl.c
+++ b/arch/riscv/cpu/fu740/spl.c
@@ -10,7 +10,7 @@
 
 #define CSR_U74_FEATURE_DISABLE0x7c1
 
-int spl_soc_init(void)
+int spl_dram_init(void)
 {
int ret;
struct udevice *dev;
diff --git a/arch/riscv/cpu/jh7110/spl.c b/arch/riscv/cpu/jh7110/spl.c
index 6bdf8b9c72..87aaf86524 100644
--- a/arch/riscv/cpu/jh7110/spl.c
+++ b/arch/riscv/cpu/jh7110/spl.c
@@ -28,7 +28,7 @@ static bool check_ddr_size(phys_size_t size)
}
 }
 
-int spl_soc_init(void)
+int spl_dram_init(void)
 {
int ret;
struct udevice *dev;
diff --git a/arch/riscv/include/asm/arch-fu540/spl.h 
b/arch/riscv/include/asm/arch-fu540/spl.h
index 4697279f43..519e7eb210 100644
--- a/arch/riscv/include/asm/arch-fu540/spl.h
+++ b/arch/riscv/include/asm/arch-fu540/spl.h
@@ -9,6 +9,6 @@
 #ifndef _SPL_SIFIVE_H
 #define _SPL_SIFIVE_H
 
-int spl_soc_init(void);
+int spl_dram_init(void);
 
 #endif /* _SPL_SIFIVE_H */
diff --git a/arch/riscv/include/asm/arch-fu740/spl.h 
b/arch/riscv/include/asm/arch-fu740/spl.h
index 15ad9e7c8b..b327ac5036 100644
--- a/arch/riscv/include/asm/arch-fu740/spl.h
+++ b/arch/riscv/include/asm/arch-fu740/spl.h
@@ -9,6 +9,6 @@
 #ifndef _SPL_SIFIVE_H
 #define _SPL_SIFIVE_H
 
-int spl_soc_init(void);
+int spl_dram_init(void);
 
 #endif /* _SPL_SIFIVE_H */
diff --git a/arch/riscv/include/asm/arch-jh7110/spl.h 
b/arch/riscv/include/asm/arch-jh7110/spl.h
index 23ce8871b3..d73355bf35 100644
--- a/arch/riscv/include/asm/arch-jh7110/spl.h
+++ b/arch/riscv/include/asm/arch-jh7110/spl.h
@@ -7,6 +7,6 @@
 #ifndef _SPL_STARFIVE_H
 #define _SPL_STARFIVE_H
 
-int spl_soc_init(void);
+int spl_dram_init(void);
 
 #endif /* _SPL_STARFIVE_H */
-- 
2.30.2



[PATCH v2 2/3] board: sifive: Call spl_dram_init() for DRAM initialization

2024-04-23 Thread lukas . funke-oss
From: Lukas Funke 

Call spl_dram_init() since this is commonly used for DRAM initialization
in u-boot.

Signed-off-by: Lukas Funke 
---

(no changes since v1)

 board/sifive/unleashed/spl.c | 4 ++--
 board/sifive/unmatched/spl.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/board/sifive/unleashed/spl.c b/board/sifive/unleashed/spl.c
index fe27316b2d..9df9c68604 100644
--- a/board/sifive/unleashed/spl.c
+++ b/board/sifive/unleashed/spl.c
@@ -27,9 +27,9 @@ int spl_board_init_f(void)
 {
int ret;
 
-   ret = spl_soc_init();
+   ret = spl_dram_init();
if (ret) {
-   debug("FU540 SPL init failed: %d\n", ret);
+   debug("FU540 DRAM init failed: %d\n", ret);
return ret;
}
 
diff --git a/board/sifive/unmatched/spl.c b/board/sifive/unmatched/spl.c
index e69bed9d99..6fc1d80954 100644
--- a/board/sifive/unmatched/spl.c
+++ b/board/sifive/unmatched/spl.c
@@ -134,9 +134,9 @@ int spl_board_init_f(void)
 {
int ret;
 
-   ret = spl_soc_init();
+   ret = spl_dram_init();
if (ret) {
-   debug("HiFive Unmatched FU740 SPL init failed: %d\n", ret);
+   debug("HiFive Unmatched FU740 DRAM init failed: %d\n", ret);
goto end;
}
 
-- 
2.30.2



[PATCH v2 0/3] riscv: Rename spl_soc_init() to spl_dram_init()

2024-04-23 Thread lukas . funke-oss
From: Lukas Funke 


This patch series renames spl_soc_init() to spl_dram_init() since the
purpose of the function is to initialization the DRAM on sifive/starfive
boards. spl_dram_init() is a commonly used function for this purpose.

Changes in v2:
 - capitalized acronym DRAM

Lukas Funke (3):
  arch: riscv: Rename spl_soc_init() to spl_dram_init()
  board: sifive: Call spl_dram_init() for DRAM initialization
  board: starfive: Call spl_dram_init() for DRAM initialization

 arch/riscv/cpu/fu540/spl.c   | 2 +-
 arch/riscv/cpu/fu740/spl.c   | 2 +-
 arch/riscv/cpu/jh7110/spl.c  | 2 +-
 arch/riscv/include/asm/arch-fu540/spl.h  | 2 +-
 arch/riscv/include/asm/arch-fu740/spl.h  | 2 +-
 arch/riscv/include/asm/arch-jh7110/spl.h | 2 +-
 board/sifive/unleashed/spl.c | 4 ++--
 board/sifive/unmatched/spl.c | 4 ++--
 board/starfive/visionfive2/spl.c | 4 ++--
 9 files changed, 12 insertions(+), 12 deletions(-)

-- 
2.30.2



Re: [PATCH v2 1/4] tools: mkeficapsule: Add support for parsing capsule params from config file

2024-04-23 Thread Sughosh Ganu
hi Heinrich,

On Fri, 19 Apr 2024 at 12:44, Heinrich Schuchardt  wrote:
>
> On 19.04.24 08:55, Sughosh Ganu wrote:
> > Add support for specifying the parameters needed for capsule
> > generation through a config file, instead of passing them through
> > command-line. Parameters for more than a single capsule file can be
> > specified, resulting in generation of multiple capsules through a
> > single invocation of the command.
> >
> > The config file can be passed to the mkeficapsule tool in such manner
> >
> >   $ ./tools/mkeficapsule -f 
>
> Please, mention the long option.

Okay

>
> >
> > Signed-off-by: Sughosh Ganu 
> > ---
> >   tools/Kconfig  |  15 ++
> >   tools/Makefile |   1 +
> >   tools/eficapsule.h | 114 
> >   tools/mkeficapsule.c   |  87 +
> >   tools/mkeficapsule_parse.c | 352 +
> >   5 files changed, 538 insertions(+), 31 deletions(-)
> >   create mode 100644 tools/mkeficapsule_parse.c
> >
> > diff --git a/tools/Kconfig b/tools/Kconfig
> > index 667807b331..0362ca8e45 100644
> > --- a/tools/Kconfig
> > +++ b/tools/Kconfig
> > @@ -104,6 +104,21 @@ config TOOLS_MKEFICAPSULE
> > optionally sign that file. If you want to enable UEFI capsule
> > update feature on your target, you certainly need this.
> >
> > +config EFI_CAPSULE_CFG_FILE
> > + string "Path to the EFI Capsule Config File"
> > + help
> > +   Path to the EFI capsule config file which provides the
> > +   parameters needed to build capsule(s). Parameters can be
> > +   provided for multiple payloads resulting in corresponding
> > +   capsule images being generated.
>
> This help test does not explain if this is a parameter for binman or
> something built into mkeficapsule.
>
> We should not hard code any path inside mkeficapsule.
>
> I can't see the new CONFIG parameters used within the code changes of
> this patch. Please, add them into the patches where they are needed.

As discussed over IRC, I need these config options only for the CI
testing. I will replace these with hard-coded paths for the tests.

>
> > +
> > +config EFI_USE_CAPSULE_CFG_FILE
> > + bool "Use the config file for generating capsules"
> > + help
> > +   Boolean option used to specify if the EFI capsules are to
> > +   be generated through parameters specified via the config
> > +   file or through command line.
>
> Given this help text I would not know if this option changes how
> mkeficapsule is built or how binman invokes it.
>
> I would expect that mkeficapsule is always built in a way that a
> configuration file can be passed.
>
> Furthermore I would expect binman to invoke mkeficapsule with the
> appropriate command line parameters if you have enabled building capsules.
>
> Why do we need this configuration parameter? Just always build
> mkeficapsule with support for the -f parameter.

Will remove these config flags.

-sughosh

>
> Best regards
>
> Heinrich
>
> > +
> >   menuconfig FSPI_CONF_HEADER
> >   bool "FlexSPI Header Configuration"
> >   help
> > diff --git a/tools/Makefile b/tools/Makefile
> > index 6a4280e366..4311f5914f 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -253,6 +253,7 @@ HOSTLDLIBS_mkeficapsule += \
> >   HOSTLDLIBS_mkeficapsule += \
> >   $(shell pkg-config --libs uuid 2> /dev/null || echo "-luuid")
> >   hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule
> > +mkeficapsule-objs := mkeficapsule.o mkeficapsule_parse.o
> >
> >   mkfwumdata-objs := mkfwumdata.o generated/lib/crc32.o
> >   HOSTLDLIBS_mkfwumdata += -luuid
> > diff --git a/tools/eficapsule.h b/tools/eficapsule.h
> > index 6efd07d2eb..71a08b62e6 100644
> > --- a/tools/eficapsule.h
> > +++ b/tools/eficapsule.h
> > @@ -54,6 +54,12 @@ typedef struct {
> >   /* flags */
> >   #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET  0x0001
> >
> > +enum capsule_type {
> > + CAPSULE_NORMAL_BLOB = 0,
> > + CAPSULE_ACCEPT,
> > + CAPSULE_REVERT,
> > +};
> > +
> >   struct efi_capsule_header {
> >   efi_guid_t capsule_guid;
> >   uint32_t header_size;
> > @@ -145,4 +151,112 @@ struct fmp_payload_header_params {
> >   uint32_t fw_version;
> >   };
> >
> > +/**
> > + * struct efi_capsule_params - Capsule parameters
> > + * @image_guid: Guid value of the payload input image
> > + * @image_index: Image index value
> > + * @hardware_instance: Hardware instance to be used for the image
> > + * @fmp: FMP payload header used for storing firmware version
> > + * @monotonic_count: Monotonic count value to be used for signed capsule
> > + * @privkey_file: Path to private key used in capsule signing
> > + * @cert_file: Path to public key certificate used in capsule signing
> > + * @input_file: Path to payload input image
> > + * @capsule_file: Path to the output capsule file
> > + * @oemflags: Oemflags to be populated in the capsule header
> > + * @capsule: Capsule Type, normal or accept or 

[RFC PATCH 1/1] net: dwc_eth_qos: mdio: Implement clause 45

2024-04-23 Thread Philip Oberfichtner
Bevor this commit, only clause 22 access was possible. After this commit,
clause 45 direct access will available as well.

Note that there is a slight change of behavior: Before this commit, the
C45E bit was set to whatever value was left in the register from the
previous access. After this commit, we adopt the common practice of
discerning C45 from C22 using the devad argument.

Signed-off-by: Philip Oberfichtner 
---

Notes:
This patch is labeled RFC as there is a slight change of behavior (see
commit message). I'm not sure in fact if this solution works for
everybody - this is up for discussion!

My implementation is tested on an Intel Elkhart lake SOC. Driver code
for dwc_eth_qos_intel coming soon in a separate patch series.

 drivers/net/dwc_eth_qos.c | 66 ++-
 drivers/net/dwc_eth_qos.h |  1 +
 2 files changed, 45 insertions(+), 22 deletions(-)

diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 86d989e244..64a9bff6bb 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -162,6 +162,25 @@ static int eqos_mdio_wait_idle(struct eqos_priv *eqos)
 100, true);
 }
 
+/* Bitmask common for mdio_read and mdio_write */
+#define EQOS_MDIO_BITFIELD(pa, rda, cr) \
+   (pa  << EQOS_MAC_MDIO_ADDRESS_PA_SHIFT)  | \
+   (rda << EQOS_MAC_MDIO_ADDRESS_RDA_SHIFT) | \
+   (cr << EQOS_MAC_MDIO_ADDRESS_CR_SHIFT)   | \
+EQOS_MAC_MDIO_ADDRESS_GB
+
+static u32 eqos_mdio_bitfield(struct eqos_priv *eqos, int addr, int devad, int 
reg)
+{
+   int cr = eqos->config->config_mac_mdio;
+   bool c22 = devad == MDIO_DEVAD_NONE ? true : false;
+
+   if (c22)
+   return EQOS_MDIO_BITFIELD(addr, reg, cr);
+   else
+   return EQOS_MDIO_BITFIELD(addr, devad, cr) |
+  EQOS_MAC_MDIO_ADDRESS_C45E;
+}
+
 static int eqos_mdio_read(struct mii_dev *bus, int mdio_addr, int mdio_devad,
  int mdio_reg)
 {
@@ -179,15 +198,17 @@ static int eqos_mdio_read(struct mii_dev *bus, int 
mdio_addr, int mdio_devad,
}
 
val = readl(>mac_regs->mdio_address);
-   val &= EQOS_MAC_MDIO_ADDRESS_SKAP |
-   EQOS_MAC_MDIO_ADDRESS_C45E;
-   val |= (mdio_addr << EQOS_MAC_MDIO_ADDRESS_PA_SHIFT) |
-   (mdio_reg << EQOS_MAC_MDIO_ADDRESS_RDA_SHIFT) |
-   (eqos->config->config_mac_mdio <<
-EQOS_MAC_MDIO_ADDRESS_CR_SHIFT) |
-   (EQOS_MAC_MDIO_ADDRESS_GOC_READ <<
-EQOS_MAC_MDIO_ADDRESS_GOC_SHIFT) |
-   EQOS_MAC_MDIO_ADDRESS_GB;
+   val &= EQOS_MAC_MDIO_ADDRESS_SKAP;
+
+   val |= eqos_mdio_bitfield(eqos, mdio_addr, mdio_devad, mdio_reg) |
+  EQOS_MAC_MDIO_ADDRESS_GOC_READ <<
+  EQOS_MAC_MDIO_ADDRESS_GOC_SHIFT;
+
+   if (val & EQOS_MAC_MDIO_ADDRESS_C45E) {
+   writel(mdio_reg << EQOS_MAC_MDIO_DATA_RA_SHIFT,
+  >mac_regs->mdio_data);
+   }
+
writel(val, >mac_regs->mdio_address);
 
udelay(eqos->config->mdio_wait);
@@ -210,7 +231,8 @@ static int eqos_mdio_write(struct mii_dev *bus, int 
mdio_addr, int mdio_devad,
   int mdio_reg, u16 mdio_val)
 {
struct eqos_priv *eqos = bus->priv;
-   u32 val;
+   u32 v_addr;
+   u32 v_data;
int ret;
 
debug("%s(dev=%p, addr=%x, reg=%d, val=%x):\n", __func__, eqos->dev,
@@ -222,20 +244,20 @@ static int eqos_mdio_write(struct mii_dev *bus, int 
mdio_addr, int mdio_devad,
return ret;
}
 
-   writel(mdio_val, >mac_regs->mdio_data);
+   v_addr = readl(>mac_regs->mdio_address);
+   v_addr &= EQOS_MAC_MDIO_ADDRESS_SKAP;
+
+   v_addr |= eqos_mdio_bitfield(eqos, mdio_addr, mdio_devad, mdio_reg) |
+ EQOS_MAC_MDIO_ADDRESS_GOC_WRITE <<
+ EQOS_MAC_MDIO_ADDRESS_GOC_SHIFT;
+
+   v_data = mdio_val;
+   if (v_addr & EQOS_MAC_MDIO_ADDRESS_C45E)
+   v_data |=  mdio_reg << EQOS_MAC_MDIO_DATA_RA_SHIFT;
 
-   val = readl(>mac_regs->mdio_address);
-   val &= EQOS_MAC_MDIO_ADDRESS_SKAP |
-   EQOS_MAC_MDIO_ADDRESS_C45E;
-   val |= (mdio_addr << EQOS_MAC_MDIO_ADDRESS_PA_SHIFT) |
-   (mdio_reg << EQOS_MAC_MDIO_ADDRESS_RDA_SHIFT) |
-   (eqos->config->config_mac_mdio <<
-EQOS_MAC_MDIO_ADDRESS_CR_SHIFT) |
-   (EQOS_MAC_MDIO_ADDRESS_GOC_WRITE <<
-EQOS_MAC_MDIO_ADDRESS_GOC_SHIFT) |
-   EQOS_MAC_MDIO_ADDRESS_GB;
-   writel(val, >mac_regs->mdio_address);
 
+   writel(v_data, >mac_regs->mdio_data);
+   writel(v_addr, >mac_regs->mdio_address);
udelay(eqos->config->mdio_wait);
 
ret = eqos_mdio_wait_idle(eqos);
diff --git a/drivers/net/dwc_eth_qos.h b/drivers/net/dwc_eth_qos.h
index 8b3d0d464d..d6ed3830be 100644
--- a/drivers/net/dwc_eth_qos.h
+++ 

  1   2   >