reset: Add sandbox tests for reset_reset() and reset_reset_bulk()

Add DM test coverage for the new reset_reset() and reset_reset_bulk()
API functions.
The sandbox reset driver implements rst_reset so these tests exercise that
op (not the assert/udelay/deassert fallback in reset_reset()).
reset_reset_bulk() calls reset_reset() on each bulk entry in order, so each
line's rst_reset runs in sequence.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/be5411daf0de8eb64fbddf06e8ad82f50066e811.1779709539.git.michal.simek@amd.com
This commit is contained in:
Michal Simek
2026-06-08 10:50:06 +02:00
parent 19f7def264
commit 724d3cafe3
4 changed files with 115 additions and 0 deletions
+67
View File
@@ -120,6 +120,73 @@ static int dm_test_reset_devm(struct unit_test_state *uts)
}
DM_TEST(dm_test_reset_devm, UTF_SCAN_FDT);
static int dm_test_reset_reset(struct unit_test_state *uts)
{
struct udevice *dev_reset;
struct udevice *dev_test;
ut_assertok(uclass_get_device_by_name(UCLASS_RESET, "reset-ctl",
&dev_reset));
ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID));
ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "reset-ctl-test",
&dev_test));
ut_assertok(sandbox_reset_test_get(dev_test));
/* Verify reset_count starts at 0 */
ut_asserteq(0, sandbox_reset_get_count(dev_reset, TEST_RESET_ID));
ut_assertok(sandbox_reset_test_assert(dev_test));
ut_asserteq(1, sandbox_reset_query(dev_reset, TEST_RESET_ID));
ut_assertok(sandbox_reset_test_reset(dev_test));
/* Verify reset was pulsed (count incremented) */
ut_asserteq(1, sandbox_reset_get_count(dev_reset, TEST_RESET_ID));
ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID));
ut_assertok(sandbox_reset_test_free(dev_test));
return 0;
}
DM_TEST(dm_test_reset_reset, UTF_SCAN_FDT);
static int dm_test_reset_reset_bulk(struct unit_test_state *uts)
{
struct udevice *dev_reset;
struct udevice *dev_test;
ut_assertok(uclass_get_device_by_name(UCLASS_RESET, "reset-ctl",
&dev_reset));
ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID));
ut_asserteq(0, sandbox_reset_query(dev_reset, OTHER_RESET_ID));
ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "reset-ctl-test",
&dev_test));
ut_assertok(sandbox_reset_test_get_bulk(dev_test));
/* Verify reset_count starts at 0 */
ut_asserteq(0, sandbox_reset_get_count(dev_reset, TEST_RESET_ID));
ut_asserteq(0, sandbox_reset_get_count(dev_reset, OTHER_RESET_ID));
ut_assertok(sandbox_reset_test_assert_bulk(dev_test));
ut_asserteq(1, sandbox_reset_query(dev_reset, TEST_RESET_ID));
ut_asserteq(1, sandbox_reset_query(dev_reset, OTHER_RESET_ID));
ut_assertok(sandbox_reset_test_reset_bulk(dev_test));
/* Verify resets were pulsed (counts incremented) */
ut_asserteq(1, sandbox_reset_get_count(dev_reset, TEST_RESET_ID));
ut_asserteq(1, sandbox_reset_get_count(dev_reset, OTHER_RESET_ID));
ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID));
ut_asserteq(0, sandbox_reset_query(dev_reset, OTHER_RESET_ID));
ut_assertok(sandbox_reset_test_release_bulk(dev_test));
return 0;
}
DM_TEST(dm_test_reset_reset_bulk, UTF_SCAN_FDT);
static int dm_test_reset_bulk(struct unit_test_state *uts)
{
struct udevice *dev_reset;