diff options
| author | Tom Rini <[email protected]> | 2026-01-28 09:21:17 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-01-28 09:21:17 -0600 |
| commit | e8ec8d980a31c4a1d665e4aa9089d6aa27cb0d0b (patch) | |
| tree | 629a81743f41c1ab97ddc1ce75f6a192ab7ab788 /test | |
| parent | cd4f4f74213aa02df1a0f2c533cd2cabfac6aa2e (diff) | |
| parent | c7e0e3fd33ca9809605a6de0a58809daf1224bff (diff) | |
Merge patch series "dm: core: Support same compatible in host/gadget musb drivers"
Markus Schneider-Pargmann (TI.com) <[email protected]> says:
musb currently uses a wrapper driver that binds on the parent device of
the actual musb devices to manage the differentiation between gadget and
host modes. However in the upstream devicetree this parent devicetree
node can not be used to match the wrapper driver.
To be able to probe the musb devices in host/gadget mode directly, this
series introduces support for returning -ENODEV in bind functions
resulting in iterating the remaining drivers potentially binding to
other drivers that match the compatible.
Link: https://lore.kernel.org/r/20260127-topic-musb-probing-v2026-01-v4-0-ea3201e0f809@baylibre.com
Diffstat (limited to 'test')
| -rw-r--r-- | test/dm/core.c | 15 | ||||
| -rw-r--r-- | test/dm/test-driver.c | 26 |
2 files changed, 41 insertions, 0 deletions
diff --git a/test/dm/core.c b/test/dm/core.c index 53693f4f7ed..78ee14af228 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -1410,3 +1410,18 @@ static int dm_test_try_first_device(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_try_first_device, 0); + +/* Test that all drivers are iterated when bind returns -ENODEV */ +static int dm_test_multimatch(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_find_device_by_name(UCLASS_TEST, "multimatch-test", + &dev)); + ut_assertnonnull(dev); + ut_asserteq_str("test_multimatch_second", dev->driver->name); + ut_asserteq(2, dm_testdrv_op_count[DM_TEST_OP_BIND]); + + return 0; +} +DM_TEST(dm_test_multimatch, UTF_SCAN_FDT); diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c index 759de3a5f77..d628a6d766f 100644 --- a/test/dm/test-driver.c +++ b/test/dm/test-driver.c @@ -197,3 +197,29 @@ U_BOOT_DRIVER(test_act_dma_vital_clk_drv) = { .unbind = test_manual_unbind, .flags = DM_FLAG_VITAL | DM_FLAG_ACTIVE_DMA, }; + +static int test_multimatch_first_bind(struct udevice *dev) +{ + dm_testdrv_op_count[DM_TEST_OP_BIND]++; + + return -ENODEV; +} + +static const struct udevice_id test_multimatch_ids[] = { + { .compatible = "sandbox,multimatch-test" }, + { } +}; + +U_BOOT_DRIVER(test_multimatch_first) = { + .name = "test_multimatch_first", + .id = UCLASS_TEST, + .of_match = test_multimatch_ids, + .bind = test_multimatch_first_bind, +}; + +U_BOOT_DRIVER(test_multimatch_second) = { + .name = "test_multimatch_second", + .id = UCLASS_TEST, + .of_match = test_multimatch_ids, + .bind = test_manual_bind, +}; |
