summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichal Simek <[email protected]>2026-05-25 13:45:43 +0200
committerMichal Simek <[email protected]>2026-06-08 10:50:06 +0200
commit724d3cafe3ba8a2b3007c579bf52cd0612e6c565 (patch)
tree4a4fb1a276e5d6ca6e43556147960378d7b89177 /test
parent19f7def2646f2ec2926e8a0fcff50d4b754eec92 (diff)
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 <[email protected]> Signed-off-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/be5411daf0de8eb64fbddf06e8ad82f50066e811.1779709539.git.michal.simek@amd.com
Diffstat (limited to 'test')
-rw-r--r--test/dm/reset.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/test/dm/reset.c b/test/dm/reset.c
index dceb6a1dad3..043d7cb7e0f 100644
--- a/test/dm/reset.c
+++ b/test/dm/reset.c
@@ -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;