Skip to content

Commit

Permalink
feat: u-boot: add rk2410
Browse files Browse the repository at this point in the history
Signed-off-by: ZHANG Yuntian <[email protected]>
  • Loading branch information
RadxaYuntian committed Nov 22, 2024
1 parent e9cd6a3 commit 8f649a0
Show file tree
Hide file tree
Showing 9 changed files with 874 additions and 5 deletions.
1 change: 1 addition & 0 deletions u-boot/rk2410/0001-common
1 change: 1 addition & 0 deletions u-boot/rk2410/0002-rockchip
79 changes: 79 additions & 0 deletions u-boot/rk2410/0010-backport/0001-menu-fix-timeout-duration.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <[email protected]>
Date: Thu, 24 May 2018 17:04:57 +0900
Subject: [PATCH] menu: fix timeout duration

For distro-boot, the TIMEOUT directive in the boot script specifies
how long to pause in units of 1/10 sec. [1]

Commit 8594753ba0a7 ("menu: only timeout when menu is displayed")
corrected this by simply dividing the timeout value by 10 in
menu_interactive_choice().

I see two problems:

- For example, "TIMEOUT 5" should wait for 0.5 sec, but the current
implementation cannot handle the granularity of 1/10 sec.
In fact, it never breaks because "m->timeout / 10" is zero,
which means no timeout.

- The menu API is used not only by cmd/pxe.c but also by
common/autoboot.c . For the latter case, the unit of the
timeout value is _second_ because its default is associated
with CONFIG_BOOTDELAY.

To fix the first issue, use DIV_ROUND_UP() so that the timeout value
is rounded up to the closest integer.

For the second issue, move the division to the boundary between
cmd/pxe.c and common/menu.c . This is a more desirable place because
the comment of struct pxe_menu says:

* timeout - time in tenths of a second to wait for a user key-press before
* booting the default label.

Then, the comment of menu_create() says:

* timeout - A delay in seconds to wait for user input. If 0, timeout is
* disabled, and the default choice will be returned unless prompt is 1.

[1] https://www.syslinux.org/wiki/index.php?title=SYSLINUX#TIMEOUT_timeout

Signed-off-by: Masahiro Yamada <[email protected]>
---
cmd/pxe.c | 4 ++--
common/menu.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/cmd/pxe.c b/cmd/pxe.c
index cce48e01e..32fc299f6 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -1558,8 +1558,8 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg)
/*
* Create a menu and add items for all the labels.
*/
- m = menu_create(cfg->title, cfg->timeout, cfg->prompt, label_print,
- NULL, NULL);
+ m = menu_create(cfg->title, DIV_ROUND_UP(cfg->timeout, 10),
+ cfg->prompt, label_print, NULL, NULL);

if (!m)
return NULL;
diff --git a/common/menu.c b/common/menu.c
index c53030f36..69f98ff33 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -195,8 +195,7 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)

if (!m->item_choice) {
readret = cli_readline_into_buffer("Enter choice: ",
- cbuf,
- m->timeout / 10);
+ cbuf, m->timeout);

if (readret >= 0) {
choice_item = menu_item_by_key(m, cbuf);
--
2.37.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Yuntian Zhang <[email protected]>
Date: Tue, 26 Apr 2022 14:16:32 +0800
Subject: [PATCH] rockchip: move crypto functions to rk3588s

rkbin uses crypto device to verify hash before passing control to bootloader. If this device is missing boot will fail.

Signed-off-by: Yuntian Zhang <[email protected]>
---
arch/arm/dts/rk3588.dtsi | 15 ---------------
arch/arm/dts/rk3588s.dtsi | 15 +++++++++++++++
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/arm/dts/rk3588.dtsi b/arch/arm/dts/rk3588.dtsi
index 8a13e8edd8..f7eb5936a8 100644
--- a/arch/arm/dts/rk3588.dtsi
+++ b/arch/arm/dts/rk3588.dtsi
@@ -429,21 +429,6 @@
status = "disabled";
};

- crypto: crypto@fe370000 {
- compatible = "rockchip,rk3588-crypto";
- reg = <0x0 0xfe370000 0x0 0x4000>;
- clocks = <&scmi_clk SCMI_CRYPTO_CORE>, <&scmi_clk SCMI_CRYPTO_PKA>;
- clock-names = "sclk_crypto", "apkclk_crypto";
- clock-frequency = <350000000>, <350000000>;
- status = "disabled";
- };
-
- rng: rng@fe378000 {
- compatible = "rockchip,trngv1";
- reg = <0x0 0xfe378000 0x0 0x200>;
- status = "disabled";
- };
-
hdptxphy1: phy@fed70000 {
compatible = "rockchip,rk3588-hdptx-phy";
reg = <0x0 0xfed70000 0x0 0x2000>;
diff --git a/arch/arm/dts/rk3588s.dtsi b/arch/arm/dts/rk3588s.dtsi
index 53ccfbaeed..ca18d3bd0c 100644
--- a/arch/arm/dts/rk3588s.dtsi
+++ b/arch/arm/dts/rk3588s.dtsi
@@ -2220,6 +2220,21 @@
arm,pl330-periph-burst;
};

+ crypto: crypto@fe370000 {
+ compatible = "rockchip,rk3588-crypto";
+ reg = <0x0 0xfe370000 0x0 0x4000>;
+ clocks = <&scmi_clk SCMI_CRYPTO_CORE>, <&scmi_clk SCMI_CRYPTO_PKA>;
+ clock-names = "sclk_crypto", "apkclk_crypto";
+ clock-frequency = <350000000>, <350000000>;
+ status = "disabled";
+ };
+
+ rng: rng@fe378000 {
+ compatible = "rockchip,trngv1";
+ reg = <0x0 0xfe378000 0x0 0x200>;
+ status = "disabled";
+ };
+
hdptxphy0: phy@fed60000 {
compatible = "rockchip,rk3588-hdptx-phy";
reg = <0x0 0xfed60000 0x0 0x2000>;
--
2.36.1

Loading

0 comments on commit 8f649a0

Please sign in to comment.