Re: [PATCH V4 3/6] soc: qcom: eud: Add driver support for Embedded USB Debugger(EUD)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 1/28/2022 9:41 PM, Bjorn Andersson wrote:
On Thu 27 Jan 04:01 PST 2022, Souradeep Chowdhury wrote:

On 1/26/2022 10:17 AM, Bjorn Andersson wrote:
On Fri 21 Jan 07:53 CST 2022, Souradeep Chowdhury wrote:
[..]
+		return PTR_ERR(chip->base);
+
+	chip->mode_mgr = devm_platform_ioremap_resource(pdev, 1);
+	if (IS_ERR(chip->mode_mgr))
+		return PTR_ERR(chip->mode_mgr);
+
+	chip->irq = platform_get_irq(pdev, 0);
+	ret = devm_request_threaded_irq(&pdev->dev, chip->irq, handle_eud_irq,
+			handle_eud_irq_thread, IRQF_ONESHOT, NULL, chip);
+	if (ret)
+		return dev_err_probe(chip->dev, ret, "failed to allocate irq\n");
+
+	enable_irq_wake(chip->irq);
+
+	platform_set_drvdata(pdev, chip);
+
+	return 0;
Per the updated binding, the EUD would now be a usb-role-switch as well
and when not enabled should simply propagate the incoming requests. So I
was expecting this to register as a usb_role_switch as well...
Can you please elaborate on this?

Do I need to define a separate 'usb_role_switch_desc' here and register
using 'usb_role_switch_register'?

Also what should be the set method in this case for usb_role_switch_desc?

My expectation is that in normal operation pmic_glink will provide role
switching requests and then as you enable the EUD it will force the role
to gadget.

So my suggestion was that you make eud a role-switch and as long as EUD
is disabled you just pass through the role-switch vote from pmic_glink
onto the dwc3.

Perhaps I'm misunderstanding how this is really working.

As per the code, the role-switching on dwc3 is enabled from drivers/usb/dwc3/drd.c on setting the usb mode to "otg " ,

that is being done on the 5th patch of this series. There is no other entity that is switching role for dwc3 other than EUD.

Also the role-switch registration happens from drivers/usb/dwc3/drd.c as follows

static int dwc3_setup_role_switch(struct dwc3 *dwc)
{
        struct usb_role_switch_desc dwc3_role_switch = {NULL};
        u32 mode;

        dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev);
        if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) {
                mode = DWC3_GCTL_PRTCAP_HOST;
        } else {
                dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
                mode = DWC3_GCTL_PRTCAP_DEVICE;
        }

        dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
        dwc3_role_switch.set = dwc3_usb_role_switch_set;
        dwc3_role_switch.get = dwc3_usb_role_switch_get;
        dwc3_role_switch.driver_data = dwc;
        dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
        if (IS_ERR(dwc->role_sw))
                return PTR_ERR(dwc->role_sw);

        dwc3_set_mode(dwc, mode);
        return 0;
}

Can you please point out the pmic_glink driver upstream and how it is related in this case?


Regards,
Bjorn



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux