diff options
author | Michael Walle <michael@walle.cc> | 2020-06-02 01:47:07 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-06-11 20:52:11 -0600 |
commit | c03b7612ea346ad7454086d1623fb57098faf315 (patch) | |
tree | da4ebd8231c72e896d0de8dd9b09ea254934fa13 /test | |
parent | 77007f9543a0fac8c4f60800de6ddccfacd9af5d (diff) | |
download | u-boot-c03b7612ea346ad7454086d1623fb57098faf315.tar.gz |
usb: provide a device tree node to USB devices
It is possible to specify a device tree node for an USB device. This is
useful if you have a static USB setup and want to use aliases which
point to these nodes, like on the Raspberry Pi.
The nodes are matched against their hub port number, the compatible
strings are not matched for now.
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/usb.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dm/usb.c b/test/dm/usb.c index a25c2c1482..b273a515ef 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -78,6 +78,28 @@ static int dm_test_usb_multi(struct unit_test_state *uts) } DM_TEST(dm_test_usb_multi, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +/* test that we have an associated ofnode with the usb device */ +static int dm_test_usb_fdt_node(struct unit_test_state *uts) +{ + struct udevice *dev; + ofnode node; + + state_set_skip_delays(true); + ut_assertok(usb_init()); + ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 0, &dev)); + node = ofnode_path("/usb@1/hub/usbstor@1"); + ut_asserteq(1, ofnode_equal(node, dev_ofnode(dev))); + ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 1, &dev)); + ut_asserteq(1, ofnode_equal(ofnode_null(), dev_ofnode(dev))); + ut_assertok(uclass_get_device(UCLASS_MASS_STORAGE, 2, &dev)); + node = ofnode_path("/usb@1/hub/usbstor@3"); + ut_asserteq(1, ofnode_equal(node, dev_ofnode(dev))); + ut_assertok(usb_stop()); + + return 0; +} +DM_TEST(dm_test_usb_fdt_node, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + static int count_usb_devices(void) { struct udevice *hub; |