1 # SPDX-License-Identifier: GPL-2.0
2 # (C) Copyright 2023, Advanced Micro Devices, Inc.
5 Note: This test doesn't rely on boardenv_* configuration value but they can
10 # Setup env__reset_test_skip to True if reset test is not possible or desired
11 # and should be skipped.
12 env__reset_test_skip = True
14 # Setup env__reset_test to set the bootmode if 'modeboot' u-boot environment
15 # variable is not set. Test will be skipped if bootmode is not set in both
16 # places i.e, boardenv and modeboot u-boot environment variable
18 'bootmode': 'qspiboot',
21 # This test will be also skipped if the bootmode is detected to JTAG.
25 import test_000_version
27 def setup_reset_env(u_boot_console):
28 if u_boot_console.config.env.get('env__reset_test_skip', False):
29 pytest.skip('reset test is not enabled')
31 output = u_boot_console.run_command('echo $modeboot')
35 f = u_boot_console.config.env.get('env__reset_test', None)
37 pytest.skip('bootmode cannot be determined')
38 bootmode = f.get('bootmode', 'jtagboot')
40 if 'jtag' in bootmode:
41 pytest.skip('skipping reset test due to jtag bootmode')
43 @pytest.mark.buildconfigspec('hush_parser')
44 def test_reset(u_boot_console):
45 """Test the reset command in non-JTAG bootmode.
46 It does COLD reset, which resets CPU, DDR and peripherals
48 setup_reset_env(u_boot_console)
49 u_boot_console.run_command('reset', wait_for_reboot=True)
51 # Checks the u-boot command prompt's functionality after reset
52 test_000_version.test_version(u_boot_console)
54 @pytest.mark.buildconfigspec('hush_parser')
55 def test_reset_w(u_boot_console):
56 """Test the reset -w command in non-JTAG bootmode.
57 It does WARM reset, which resets CPU but keep DDR/peripherals active.
59 setup_reset_env(u_boot_console)
60 u_boot_console.run_command('reset -w', wait_for_reboot=True)
62 # Checks the u-boot command prompt's functionality after reset
63 test_000_version.test_version(u_boot_console)