Skip to content

Commit abd5f61

Browse files
Add menus to reset and powerdown the HPS CPU
Add a reset command to the u-boot menu. Add a reboot and powerdown command to the Linux menu. Signed-off-by: Rod Frazer <rod.frazer@intel.com>
1 parent 188791c commit abd5f61

File tree

9 files changed

+101
-2
lines changed

9 files changed

+101
-2
lines changed

common_images/fit_no-pins-demos.its

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,16 @@
536536
};
537537
};
538538

539+
script-reset {
540+
description = "script-reset";
541+
data = /incbin/("../../common_sw/u-boot_scripts/reset");
542+
type = "script";
543+
compression = "none";
544+
hash {
545+
algo = "crc32";
546+
};
547+
};
548+
539549
linux-kernel {
540550
description = "linux-kernel";
541551
data = /incbin/("../sw_builds/linux-socfpga/arch/arm64/boot/Image");

common_sw/linux_apps/boot_app.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,36 @@ int main(void)
543543
linux_j_menu_HELP_TEXT,
544544
""
545545
},
546-
/* used menu letters: abcdefg_ijklmnopqrstuvwxyz57 */
546+
{
547+
/* menu selection letter */
548+
"R",
549+
/* display name */
550+
"reboot HPS",
551+
/* software name */
552+
"",
553+
/* script name */
554+
"reboot",
555+
/* hardware name */
556+
"",
557+
/* help text */
558+
linux_R_menu_HELP_TEXT,
559+
""
560+
},
561+
{
562+
/* menu selection letter */
563+
"P",
564+
/* display name */
565+
"poweroff HPS",
566+
/* software name */
567+
"",
568+
/* script name */
569+
"poweroff",
570+
/* hardware name */
571+
"",
572+
/* help text */
573+
linux_P_menu_HELP_TEXT,
574+
""
575+
},
547576
{
548577
NULL,
549578
NULL,

common_sw/linux_apps/install_toybox_scripts.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ SCRIPTS_SCRIPTS="
6262
../../../common_sw/toybox_scripts/prog-a55-rpd
6363
../../../common_sw/toybox_scripts/prog-a76-rpd
6464
../../../common_sw/toybox_scripts/read_sensors
65+
../../../common_sw/toybox_scripts/reboot
66+
../../../common_sw/toybox_scripts/poweroff
6567
"
6668

6769
for NEXT in ${SCRIPTS_SCRIPTS:?}

common_sw/linux_apps/linux_help_text.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,13 @@
144144
//------------------------------------------------------------------------------
145145
#define linux_j_menu_HELP_TEXT j_menu_HELP_TEXT
146146

147+
//------------------------------------------------------------------------------
148+
#define linux_R_menu_HELP_TEXT \
149+
"Execute the toybox reboot command, which will cold reset the HPS CPU."
150+
151+
//------------------------------------------------------------------------------
152+
#define linux_P_menu_HELP_TEXT \
153+
"Execute the toybox poweroff command, which will shutdown and halt the\n\
154+
HPS CPU."
155+
147156
#endif /* __LINUX_HELP_TEXT_H__ */

common_sw/toybox_scripts/poweroff

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
#
3+
# SPDX-FileCopyrightText: Copyright (C) 2024 Intel Corporation
4+
# SPDX-License-Identifier: MIT-0
5+
#
6+
echo
7+
echo
8+
echo Powering off HPS CPU...
9+
echo
10+
11+
poweroff

common_sw/toybox_scripts/reboot

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
#
3+
# SPDX-FileCopyrightText: Copyright (C) 2024 Intel Corporation
4+
# SPDX-License-Identifier: MIT-0
5+
#
6+
echo
7+
echo
8+
echo Rebooting HPS CPU...
9+
echo
10+
11+
reboot

common_sw/u-boot_scripts/reset

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# SPDX-FileCopyrightText: Copyright (C) 2024 Intel Corporation
3+
# SPDX-License-Identifier: MIT-0
4+
#
5+
echo
6+
echo
7+
echo Resetting HPS CPU...
8+
echo
9+
10+
reset

common_sw/u-boot_standalone_apps/boot_app.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,20 @@ int boot_app(int argc, char *const argv[])
553553
/* help text */
554554
d_menu_HELP_TEXT
555555
},
556-
/* used menu letters: abcdefg_ijklmnopqrstuvwxyz57 */
556+
{
557+
/* menu selection letter */
558+
"R",
559+
/* display name */
560+
"reset HPS",
561+
/* software name */
562+
"",
563+
/* script name */
564+
"script-reset",
565+
/* hardware name */
566+
"",
567+
/* help text */
568+
R_menu_HELP_TEXT
569+
},
557570
{
558571
NULL,
559572
NULL,

common_sw/u-boot_standalone_apps/help_text.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,4 +491,8 @@ address 0x8600_0000. If it validates a demo.itb FIT image in memory, it\n\
491491
programs that image into the SDM QSPI flash so that it will be accessed\n\
492492
by the SSBL upon the next HPS reset."
493493

494+
//------------------------------------------------------------------------------
495+
#define R_menu_HELP_TEXT \
496+
"Resets the HPS CPU by triggering a cold reset of HPS."
497+
494498
#endif /* __HELP_TEXT_H__ */

0 commit comments

Comments
 (0)