dm: usb: Add tests for the USB uclass
This adds a simple test for probing and a functional test using the flash
stick emulator, which tests a large chunk of the USB stack.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
diff --git a/test/dm/test.dts b/test/dm/test.dts
index 0ab0916..d0c40be 100644
--- a/test/dm/test.dts
+++ b/test/dm/test.dts
@@ -20,6 +20,9 @@
testfdt8 = "/a-test";
eth0 = "/eth@10002000";
eth5 = ð_5;
+ usb0 = &usb_0;
+ usb1 = &usb_1;
+ usb2 = &usb_2;
};
uart0: serial {
@@ -186,4 +189,42 @@
fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x22>;
};
+ usb_0: usb@0 {
+ compatible = "sandbox,usb";
+ status = "disabled";
+ hub {
+ compatible = "sandbox,usb-hub";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ flash-stick {
+ reg = <0>;
+ compatible = "sandbox,usb-flash";
+ };
+ };
+ };
+
+ usb_1: usb@1 {
+ compatible = "sandbox,usb";
+ hub {
+ compatible = "usb-hub";
+ usb,device-class = <9>;
+ hub-emul {
+ compatible = "sandbox,usb-hub";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ flash-stick {
+ reg = <0>;
+ compatible = "sandbox,usb-flash";
+ sandbox,filepath = "testflash.bin";
+ };
+
+ };
+ };
+ };
+
+ usb_2: usb@2 {
+ compatible = "sandbox,usb";
+ status = "disabled";
+ };
+
};