usb: cdns3: core: get role switch node from firmware
authorPeter Chen <peter.chen@nxp.com>
Tue, 31 Mar 2020 08:10:02 +0000 (16:10 +0800)
committerFelipe Balbi <balbi@kernel.org>
Mon, 25 May 2020 08:09:37 +0000 (11:09 +0300)
After that, the role switch device (eg, Type-C device) could call
cdns3_role_set to finish the role switch.

Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/cdns3/core.c

index 4aafba20f4506ba8a2ab1a607c2655676c80122c..704c679a0c5da0835ccb6d267d96c899905a43f4 100644 (file)
@@ -528,6 +528,8 @@ static int cdns3_probe(struct platform_device *pdev)
        sw_desc.get = cdns3_role_get;
        sw_desc.allow_userspace_control = true;
        sw_desc.driver_data = cdns;
+       if (device_property_read_bool(dev, "usb-role-switch"))
+               sw_desc.fwnode = dev->fwnode;
 
        cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
        if (IS_ERR(cdns->role_sw)) {