[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AM5PR0402MB286587BA0B90A50FB0AC8A58F1600@AM5PR0402MB2865.eurprd04.prod.outlook.com>
Date: Fri, 15 Feb 2019 08:39:19 +0000
From: Ran Wang <ran.wang_1@....com>
To: Felipe Balbi <balbi@...nel.org>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] usb: dwc3: Add workaround for host mode VBUS glitch
when boot
Hi Felipe,
Sorry for the late response, I didn't receive your mail.
Felipe Balbi <balbi@...nel.org> wrotes:
>Hi,
>
>Ran Wang <ran.wang_1@....com> writes:
>> +static void dwc3_power_off_all_roothub_ports(struct dwc3 *dwc)
>> +{
>> + int i, port_num;
>> + u32 reg, op_regs_base, offset;
>> + void __iomem *xhci_regs;
>> +
>> + /* xhci regs is not mapped yet, do it temperary here */
>> + if (dwc->xhci_resources[0].start) {
>> + xhci_regs = ioremap(dwc->xhci_resources[0].start,
>> + DWC3_XHCI_REGS_END);
>> + if (IS_ERR(xhci_regs)) {
>> + dev_err(dwc->dev, "Failed to ioremap xhci_regs\n");
>> + return;
>> + }
>> +
>> + op_regs_base = HC_LENGTH(readl(xhci_regs));
>> + reg = readl(xhci_regs + XHCI_HCSPARAMS1);
>> + port_num = HCS_MAX_PORTS(reg);
>> +
>> + for (i = 1; i <= port_num; i++) {
>> + offset = op_regs_base + XHCI_PORTSC_BASE + 0x10*(i-1);
>> + reg = readl(xhci_regs + offset);
>> + reg &= ~PORT_POWER;
>> + writel(reg, xhci_regs + offset);
>> + }
>> +
>> + iounmap(xhci_regs);
>
>why can't this be done during xhci_gen_setup()?
Actually I have done experiment like what you suggested (in xhci-plat.c), but the timing
seems too late--making VBUS waveform look like a square wave as below:
Here DWC3 enable host mode, VBUS on
|
+5V /---------\ 40ms /---------------------------....
0V ________/ 90ms \______/
| |
| Here do xhci reset, VBUS back to +5V again
Here set all PORTSC[PP] to 0 in xhci_gen_setup()
So I am afraid the solution might have to be added in DWC3 core driver where just after host mode enabling code if want fix this :(
Regards,
Ran
Powered by blists - more mailing lists