$ git diff --patch-with-stat --summary ac7004320376171d607e420db02f43356ab2a421..e5730398d9bbd05d4270df7b1c6c4ceff6820098
board-rockpro64-advanced-recovery.patch | 27 +++++
...-otg-fix.patch => general-dwc-otg-usb-fix.patch | 0
rk3399-always-init-rkclk.patch | 22 ++++
rk3399-ehci-probe-usb2.patch | 118 +++++++++++++++++++++
rk3399-populate-child-node-of-syscon.patch | 27 +++++
rk3399-rp64-rng.patch | 17 +++
u-boot-rk-rk3399-usb-start.patch | 14 +++
uboot-tools.spec | 15 ++-
8 files changed, 235 insertions(+), 5 deletions(-)
create mode 100644 board-rockpro64-advanced-recovery.patch
rename zzz-usb-otg-fix.patch => general-dwc-otg-usb-fix.patch (100%)
create mode 100644 rk3399-always-init-rkclk.patch
create mode 100644 rk3399-ehci-probe-usb2.patch
create mode 100644 rk3399-populate-child-node-of-syscon.patch
create mode 100644 rk3399-rp64-rng.patch
create mode 100644 u-boot-rk-rk3399-usb-start.patch
diff --git a/board-rockpro64-advanced-recovery.patch b/board-rockpro64-advanced-recovery.patch
new file mode 100644
index 0000000..c5e0a7e
--- /dev/null
+++ b/board-rockpro64-advanced-recovery.patch
@@ -0,0 +1,27 @@
+diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
+index ad0c6ab2..57e129ac 100644
+--- a/configs/rockpro64-rk3399_defconfig
++++ b/configs/rockpro64-rk3399_defconfig
+@@ -24,6 +24,11 @@ CONFIG_CMD_GPT=y
+ CONFIG_CMD_MMC=y
+ CONFIG_CMD_PCI=y
+ CONFIG_CMD_USB=y
++CONFIG_LED=y
++CONFIG_LED_GPIO=y
++CONFIG_CMD_LED=y
++CONFIG_CMD_ROCKUSB=y
++CONFIG_CMD_USB_MASS_STORAGE=y
+ # CONFIG_CMD_SETEXPR is not set
+ CONFIG_CMD_TIME=y
+ CONFIG_SPL_OF_CONTROL=y
+@@ -71,6 +76,10 @@ CONFIG_USB_EHCI_HCD=y
+ CONFIG_USB_DWC3=y
+ CONFIG_USB_DWC3_GENERIC=y
+ CONFIG_USB_KEYBOARD=y
++CONFIG_USB_GADGET=y
++CONFIG_USB_FUNCTION_ROCKUSB=y
++CONFIG_ROCKCHIP_ADVANCED_RECOVERY=y
++CONFIG_ROCKCHIP_ADVANCED_RECOVERY_LED="work"
+ CONFIG_USB_HOST_ETHER=y
+ CONFIG_USB_ETHER_ASIX=y
+ CONFIG_USB_ETHER_ASIX88179=y
diff --git a/zzz-usb-otg-fix.patch b/general-dwc-otg-usb-fix.patch
similarity index 100%
rename from zzz-usb-otg-fix.patch
rename to general-dwc-otg-usb-fix.patch
diff --git a/rk3399-always-init-rkclk.patch b/rk3399-always-init-rkclk.patch
new file mode 100644
index 0000000..1653fc1
--- /dev/null
+++ b/rk3399-always-init-rkclk.patch
@@ -0,0 +1,22 @@
+This patch forces clk initialisation of rk3399 cpu in u-boot proper.
+
+Normally it should only be initialised in SPL as it is "time consuming".
+Doing so however leaves cpus clocked to low frequencies
+for Rockchip's DDR/loader/trust with mainline u-boot scenario
+which does not involve SPL phase.
+
+Signed-off-by: Piotr Szczepanik <piter75@gmail.com>
+
+diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
+index f8cbda44..687c3ad7 100644
+--- a/drivers/clk/rockchip/clk_rk3399.c
++++ b/drivers/clk/rockchip/clk_rk3399.c
+@@ -1394,7 +1394,7 @@ static int rk3399_clk_probe(struct udevice *dev)
+ }
+ #endif
+
+- if (init_clocks)
++ if (init_clocks || 1 == 1)
+ rkclk_init(priv->cru);
+
+ return 0;
diff --git a/rk3399-ehci-probe-usb2.patch b/rk3399-ehci-probe-usb2.patch
new file mode 100644
index 0000000..0676625
--- /dev/null
+++ b/rk3399-ehci-probe-usb2.patch
@@ -0,0 +1,118 @@
+From git@z Thu Jan 1 00:00:00 1970
+Subject: [PATCH] arm: dts: rockchip: rk3399: usb: ehci: Fix EHCI probe in rk3399 to access peripherals by USB 2.
+From: Xavier Drudis Ferran <xdrudis@tinet.cat>
+Date: Fri, 01 Jul 2022 20:59:59 +0200
+Message-Id: <20220701185959.GC1700@begut>
+To: u-boot@lists.denx.de
+Cc: Simon Glass <sjg@chromium.org>, Philipp Tomsich <philipp.tomsich@vrull.eu>, Kever Yang <kever.yang@rock-chips.com>, Lukasz Majewski <lukma@denx.de>, Sean Anderson <seanga2@gmail.com>, Marek Vasut <marex@denx.de>
+List-Id: U-Boot discussion <u-boot.lists.denx.de>
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 7bit
+
+arch/arm/dts/rk3399.dtsi has a node
+
+ usb_host0_ehci: usb@fe380000 {
+ compatible = "generic-ehci";
+
+with clocks:
+
+ clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST0_ARB>,
+ <&u2phy0>;
+
+The first 2 refer to nodes with class UCLASS_CLK, but &u2phy0
+has class UCLASS_PHY.
+
+ u2phy0: usb2phy@e450 {
+ compatible = "rockchip,rk3399-usb2phy";
+
+Since clk_get_bulk() only looks for devices with UCLASS_CLK,
+it fails with -ENODEV and then ehci_usb_probe() aborts.
+
+The consequence is peripherals connected to a USB 2 port (e.g. in a
+Rock Pi 4 the white port, nearer the edge) not being detected.
+They're detected if CONFIG_USB_OHCI_GENERIC is selected in Kconfig,
+because ohci_usb_probe() does not abort when one clk_get_by_index()
+fails, but then they work in USB 1 mode,.
+
+rk3399.dtsi comes from linux and the u2phy0 was added[1] to the clock
+list in:
+
+ commit b5d1c57299734f5b54035ef2e61706b83041f20c
+ Author: William wu <wulf@rock-chips.com>
+ Date: Wed Dec 21 18:41:05 2016 +0800
+
+ arm64: dts: rockchip: add u2phy clock for ehci and ohci of rk3399
+
+ We found that the suspend process was blocked when it run into
+ ehci/ohci module due to clk-480m of usb2-phy was disabled.
+ [...]
+
+Suspend concerns don't apply to U-Boot, and the problem with U-Boot
+failing to probe EHCI doesn't apply to linux, because in linux
+rockchip_usb2phy_clk480m_register makes u2phy0 a proper clock provider
+when called by rockchip_usb2phy_probe().
+
+So I can think of a few alternative solutions:
+
+1- Change ehci_usb_probe() to make it more similar to
+ ohci_usb_probe(), and survive failure to get one clock. Looks a
+ little harder, and I don't know whether it could break something if
+ it ignored a clock that was important for something else than
+ suspend.
+
+2- Change rk3399.dtsi effecttively reverting the linux commit
+ b5d1c57299734f5b54035ef2e61706b83041f20c. This dealigns the .dtsi
+ from linux and seems fragile at the next synchronisation.
+
+3- Change the clock list in rk3399-u-boot.dtsi or somewhere else.
+ This survives .dts* sync but may survive "too much" and miss some
+ change from linux that we might want.
+
+4- Enable CONFIG_USB_OHCI_GENERIC and use the ports in USB 1 mode.
+ This would need to be made for all boards using rk3399. In a
+ simple test reading one file from USB storage it gave 769.5 KiB/s
+ instead of 20.5 MiB/s with solution 2.
+
+5- Trying to replicate linux and have usb2phy somehow provide a clk,
+ or have a separate clock device for usb2phy in addition to the phy
+ device. I just can't seem to imagine how to achieve this with the
+ U-Boot driver model, maybe because of my limited familiarity with
+ it.
+
+This patch is option 3. Looked like the simplest and most performant.
+But it might not be what's wanted, so comments wellcome.
+
+Link: [1] https://lkml.kernel.org/lkml/1731551.Q6cHK6n5ZM@phil/T/
+
+Cc: Simon Glass <sjg@chromium.org>
+Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
+Cc: Kever Yang <kever.yang@rock-chips.com>
+Cc: Lukasz Majewski <lukma@denx.de>
+Cc: Sean Anderson <seanga2@gmail.com>
+Cc: Marek Vasut <marex@denx.de>
+
+Signed-off-by: Xavier Drudis Ferran <xdrudis@tinet.cat>
+---
+ arch/arm/dts/rk3399-u-boot.dtsi | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
+index 716b9a433a..63c7b10405 100644
+--- a/arch/arm/dts/rk3399-u-boot.dtsi
++++ b/arch/arm/dts/rk3399-u-boot.dtsi
+@@ -147,3 +147,11 @@
+ &vopl {
+ u-boot,dm-pre-reloc;
+ };
++
++&usb_host0_ehci {
++ clocks = <&cru HCLK_HOST0>, <&cru HCLK_HOST0_ARB>;
++};
++
++&usb_host1_ehci {
++ clocks = <&cru HCLK_HOST1>, <&cru HCLK_HOST1_ARB>;
++};
+--
+2.20.1
+
diff --git a/rk3399-populate-child-node-of-syscon.patch b/rk3399-populate-child-node-of-syscon.patch
new file mode 100644
index 0000000..c883063
--- /dev/null
+++ b/rk3399-populate-child-node-of-syscon.patch
@@ -0,0 +1,27 @@
+From 91cbd5f4fb25281319034c33b6e0c0f9b7d1e12b Mon Sep 17 00:00:00 2001
+Message-Id: <91cbd5f4fb25281319034c33b6e0c0f9b7d1e12b.1585676333.git.aditya@kobol.io>
+In-Reply-To: <ef8793354dbb6bce3027a3492ffc1fee3588f41f.1585676333.git.aditya@kobol.io>
+References: <ef8793354dbb6bce3027a3492ffc1fee3588f41f.1585676333.git.aditya@kobol.io>
+From: Aditya Prayoga <aditya@kobol.io>
+Date: Wed, 4 Mar 2020 22:10:31 +0700
+Subject: [PATCH 4/4] arm:rockchip:rk3399: Populate child node of syscon
+
+U-Boot only populate first level of node.
+Scan child node so device such as PHY can be initialized.
+---
+ arch/arm/mach-rockchip/rk3399/syscon_rk3399.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff -Naur a/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c b/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c
+--- a/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c 2022-10-03 19:25:32.000000000 +0000
++++ b/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c 2023-01-05 13:33:42.466472243 +0000
+@@ -25,6 +25,9 @@
+ .bind = dm_scan_fdt_dev,
+ #endif
+ .of_match = rk3399_syscon_ids,
++#if !CONFIG_IS_ENABLED(OF_PLATDATA)
++ .bind = dm_scan_fdt_dev,
++#endif
+ };
+
+ #if CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/rk3399-rp64-rng.patch b/rk3399-rp64-rng.patch
new file mode 100644
index 0000000..26612ab
--- /dev/null
+++ b/rk3399-rp64-rng.patch
@@ -0,0 +1,17 @@
+diff --git a/arch/arm/dts/rk3399.dtsi b/arch/arm/dts/rk3399.dtsi
+index 3871c7fd..fda51508 100644
+--- a/arch/arm/dts/rk3399.dtsi
++++ b/arch/arm/dts/rk3399.dtsi
+@@ -1937,6 +1937,12 @@
+ };
+ };
+
++ rng: rng@ff8b8000 {
++ compatible = "rockchip,cryptov1-rng";
++ reg = <0x0 0xff8b8000 0x0 0x1000>;
++ status = "okay";
++ };
++
+ gpu: gpu@ff9a0000 {
+ compatible = "rockchip,rk3399-mali", "arm,mali-t860";
+ reg = <0x0 0xff9a0000 0x0 0x10000>;
diff --git a/u-boot-rk-rk3399-usb-start.patch b/u-boot-rk-rk3399-usb-start.patch
new file mode 100644
index 0000000..a8ee724
--- /dev/null
+++ b/u-boot-rk-rk3399-usb-start.patch
@@ -0,0 +1,14 @@
+--- a/include/configs/rockchip-common.h
++++ b/include/configs/rockchip-common.h
+@@ -61,10 +61,10 @@
+
+ #ifdef CONFIG_ROCKCHIP_RK3399
+ #define BOOT_TARGET_DEVICES(func) \
++ BOOT_TARGET_USB(func) \
+ BOOT_TARGET_MMC(func) \
+ BOOT_TARGET_NVME(func) \
+ BOOT_TARGET_SCSI(func) \
+- BOOT_TARGET_USB(func) \
+ BOOT_TARGET_PXE(func) \
+ BOOT_TARGET_DHCP(func) \
+ BOOT_TARGET_SF(func)
diff --git a/uboot-tools.spec b/uboot-tools.spec
index e81d610..d5e13b6 100644
--- a/uboot-tools.spec
+++ b/uboot-tools.spec
@@ -1,9 +1,9 @@
%undefine candidate
+Summary: U-Boot utilities
Name: uboot-tools
Version: 2022.10
-Release: %{?candidate:0.%{candidate}.}1
-Summary: U-Boot utilities
+Release: %{?candidate:0.%{candidate}.}3
License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+
URL: http://www.denx.de/wiki/U-Boot
Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candidate}}.tar.bz2
@@ -26,9 +26,14 @@ Patch8: https://src.fedoraproject.org/rpms/uboot-tools/raw/rawhide/f/0001-Rever
# Misc patches
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973323
-Patch101: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip/zzz-usb-otg-fix.patch
-Patch107: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/rk3399-disable-hdmi.patch
-
+Patch101: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/general-dwc-otg-usb-fix.patch
+Patch102: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/rk3399-disable-hdmi.patch
+Patch103: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/rk3399-always-init-rkclk.patch
+Patch104: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/rk3399-rp64-rng.patch
+Patch105: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/u-boot-rk-rk3399-usb-start.patch
+Patch106: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/rk3399-ehci-probe-usb2.patch
+Patch107: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/rk3399-populate-child-node-of-syscon.patch
+Patch108: https://raw.githubusercontent.com/armbian/build/master/patch/u-boot/u-boot-rockchip64/board-rockpro64-advanced-recovery.patch
BuildRequires: bc
BuildRequires: dtc
BuildRequires: make