usb: dwc3: dwc3-generic: check the parent nodes
authorAngus Ainslie <angus@akkea.ca>
Wed, 2 Feb 2022 23:08:54 +0000 (15:08 -0800)
committerMarek Vasut <marex@denx.de>
Wed, 16 Feb 2022 15:52:56 +0000 (16:52 +0100)
commitc08db05455bcb2259849a096acf2e90cce258849
tree5a4ce756f120dd0b7df3c838496c3751ca91e9b4
parentab8903a24db11571d634ef255976bb364c3ba64d
usb: dwc3: dwc3-generic: check the parent nodes

The kernel devicetree has definitions for port and hub nodes as subnodes
to the USB devices. These subnodes don't contain all of the data required
to properly configure the dwc3. Check the parent nodes if the data is not
in the port/hub node.

Here's an example from the librem5 kernel dts file

&usb_dwc3_0 {
#address-cells = <1>;
#size-cells = <0>;
dr_mode = "otg";
snps,dis_u3_susphy_quirk;
status = "okay";

port@0 {
reg = <0>;

typec_hs: endpoint {
remote-endpoint = <&usb_con_hs>;
};
};

port@1 {
reg = <1>;

typec_ss: endpoint {
remote-endpoint = <&usb_con_ss>;
};
};
};

&usb_dwc3_1 {
dr_mode = "host";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

/* Microchip USB2642 */
hub@1 {
compatible = "usb424,2640";
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

mass-storage@1 {
compatible = "usb424,4041";
reg = <1>;
};
};
};

Signed-off-by: Angus Ainslie <angus@akkea.ca>
drivers/usb/dwc3/dwc3-generic.c