Skip to content

Commit b1a4cad

Browse files
committed
uboot: Att uboot patches for 2025.01
- Fix CTRL-C misbehave - Add new command to detect RPI standard display
1 parent a6c05b9 commit b1a4cad

File tree

2 files changed

+173
-0
lines changed

2 files changed

+173
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From 989ef8436df2ee48d308981098c44b1b8257c23b Mon Sep 17 00:00:00 2001
2+
From: Tobias Waldekranz <[email protected]>
3+
Date: Mon, 10 Jun 2024 13:25:31 +0200
4+
Subject: [PATCH 8/8] hush: Remove Ctrl-C detection in loops
5+
Organization: Addiva Elektronik
6+
7+
Assume that the original intent was to emulate SIGINT to a shell. This
8+
only works as expected if the loop in question is the ouermost, and
9+
last, statement. In all other cases, it completely breaks the expected
10+
execution flow. It more or less resurrects Visual Basic's "On Error
11+
Resume Next".
12+
13+
Disable this behavior and delegate the problem of loop termination to
14+
the writer of the script instead.
15+
16+
Signed-off-by: Tobias Waldekranz <[email protected]>
17+
---
18+
common/cli_hush.c | 7 -------
19+
1 file changed, 7 deletions(-)
20+
21+
diff --git a/common/cli_hush.c b/common/cli_hush.c
22+
index 171069f5f4..d6d487893f 100644
23+
--- a/common/cli_hush.c
24+
+++ b/common/cli_hush.c
25+
@@ -1796,13 +1796,6 @@ static int run_list_real(struct pipe *pi)
26+
for (; pi; pi = (flag_restore != 0) ? rpipe : pi->next) {
27+
if (pi->r_mode == RES_WHILE || pi->r_mode == RES_UNTIL ||
28+
pi->r_mode == RES_FOR) {
29+
-#ifdef __U_BOOT__
30+
- /* check Ctrl-C */
31+
- ctrlc();
32+
- if ((had_ctrlc())) {
33+
- return 1;
34+
- }
35+
-#endif
36+
flag_restore = 0;
37+
if (!rpipe) {
38+
flag_rep = 0;
39+
--
40+
2.34.1
41+
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
diff --git a/cmd/Kconfig b/cmd/Kconfig
2+
index 1d7ddb4ed36..8572dc4353e 100644
3+
--- a/cmd/Kconfig
4+
+++ b/cmd/Kconfig
5+
@@ -176,6 +176,20 @@ config CMD_CPU
6+
internal name) and clock frequency. Other information may be
7+
available depending on the CPU driver.
8+
9+
+config CMD_RPI_DISPLAY
10+
+ bool "rpidisplay"
11+
+ depends on ARCH_BCM283X
12+
+ help
13+
+ Enable commands to detect Raspberry Pi 7" DSI display connection.
14+
+
15+
+ This provides two commands:
16+
+ - rpidisplay: Shows detailed detection information
17+
+ - testrpidisplay: Silent test for use in boot scripts
18+
+
19+
+ Detection is performed by querying the VideoCore GPU for the
20+
+ active display resolution. The official Raspberry Pi 7" DSI
21+
+ display uses 800x480 resolution.
22+
+
23+
config CMD_FWU_METADATA
24+
bool "fwu metadata read"
25+
depends on FWU_MULTI_BANK_UPDATE
26+
diff --git a/cmd/Makefile b/cmd/Makefile
27+
index d1f369deec0..033ea1312ed 100644
28+
--- a/cmd/Makefile
29+
+++ b/cmd/Makefile
30+
@@ -48,6 +48,7 @@ obj-$(CONFIG_CMD_CLK) += clk.o
31+
obj-$(CONFIG_CMD_CLS) += cls.o
32+
obj-$(CONFIG_CMD_CONFIG) += config.o
33+
obj-$(CONFIG_CMD_CONITRACE) += conitrace.o
34+
+obj-$(CONFIG_CMD_RPI_DISPLAY) += rpi_display.o
35+
obj-$(CONFIG_CMD_CONSOLE) += console.o
36+
obj-$(CONFIG_CMD_CPU) += cpu.o
37+
obj-$(CONFIG_CMD_DATE) += date.o
38+
@@ -201,7 +202,6 @@ obj-$(CONFIG_CMD_LZMADEC) += lzmadec.o
39+
obj-$(CONFIG_CMD_UFS) += ufs.o
40+
obj-$(CONFIG_CMD_USB) += usb.o disk.o
41+
obj-$(CONFIG_CMD_VIDCONSOLE) += video.o
42+
-
43+
obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o
44+
obj-$(CONFIG_CMD_FS_UUID) += fs_uuid.o
45+
46+
diff --git a/cmd/rpi_display.c b/cmd/rpi_display.c
47+
new file mode 100644
48+
index 00000000000..07abdc08552
49+
--- /dev/null
50+
+++ b/cmd/rpi_display.c
51+
@@ -0,0 +1,81 @@
52+
+// SPDX-License-Identifier: GPL-2.0+
53+
+/*
54+
+ * Raspberry Pi 7" DSI Display Detection Command
55+
+ * Detects if the official Raspberry Pi 7" DSI display is connected
56+
+ */
57+
+
58+
+#include <command.h>
59+
+#include <asm/arch/msg.h>
60+
+
61+
+static int do_rpi_display(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
62+
+{
63+
+ int width, height;
64+
+ int ret;
65+
+
66+
+ printf("=== Raspberry Pi 7\" DSI Display Detection ===\n");
67+
+
68+
+ /* Use official VideoCore mailbox interface to get display resolution */
69+
+ ret = bcm2835_get_video_size(&width, &height);
70+
+ if (ret) {
71+
+ printf("Failed to query VideoCore display size (ret=%d)\n", ret);
72+
+ printf("Display Status: NOT DETECTED\n");
73+
+ return 2;
74+
+ }
75+
+
76+
+ printf("VideoCore reports display: %dx%d", width, height);
77+
+
78+
+ /* Official Raspberry Pi 7" DSI display is 800x480 */
79+
+ if (width == 800 && height == 480) {
80+
+ printf(" - RASPBERRY PI 7\" DSI DISPLAY DETECTED!\n");
81+
+ printf("Display Status: CONNECTED\n");
82+
+ return 0;
83+
+ }
84+
+ /* No resolution could indicate no display */
85+
+ else if (width == 0 || height == 0) {
86+
+ printf(" - No active display\n");
87+
+ printf("Display Status: NOT DETECTED\n");
88+
+ return 1;
89+
+ }
90+
+ else {
91+
+ printf(" - Not Raspberry Pi DSI display (resolution %dx%d)\n", width, height);
92+
+ printf("Display Status: NOT DETECTED\n");
93+
+ return 1;
94+
+ }
95+
+}
96+
+
97+
+static int do_test_rpi_display(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
98+
+{
99+
+ int width, height;
100+
+ int ret;
101+
+
102+
+ /* Silent test using VideoCore mailbox interface */
103+
+ ret = bcm2835_get_video_size(&width, &height);
104+
+ if (ret) {
105+
+ return 2; /* Failed to query VideoCore */
106+
+ }
107+
+
108+
+ /* Check for Raspberry Pi DSI display resolutions */
109+
+ if ((width == 800 && height == 480)) {
110+
+ return 0; /* DSI display found */
111+
+ }
112+
+
113+
+ return 1; /* DSI display not found */
114+
+}
115+
+
116+
+U_BOOT_CMD(
117+
+ rpidisplay, 1, 1, do_rpi_display,
118+
+ "detect Raspberry Pi DSI display",
119+
+ "\n"
120+
+ "Detects Raspberry Pi 7\" DSI display by checking resolution:\n"
121+
+ " - 800x480 = Official Raspberry Pi 7\" DSI display\n"
122+
+ "Returns: 0=connected, 1=not detected, 2=no video"
123+
+);
124+
+
125+
+U_BOOT_CMD(
126+
+ testrpidisplay, 1, 1, do_test_rpi_display,
127+
+ "silent test for Raspberry Pi DSI display",
128+
+ "\n"
129+
+ "Silent test for Raspberry Pi DSI display (for use in scripts):\n"
130+
+ "Returns: 0=connected, 1=not detected, 2=no video\n"
131+
+ "Usage: if testrpidisplay; then echo DSI found; fi"
132+
+);

0 commit comments

Comments
 (0)