[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150903155125.GC4031@saruman.tx.rr.com>
Date: Thu, 3 Sep 2015 10:51:25 -0500
From: Felipe Balbi <balbi@...com>
To: Roger Quadros <rogerq@...com>
CC: <balbi@...com>, <tony@...mide.com>, <Joao.Pinto@...opsys.com>,
<sergei.shtylyov@...entembedded.com>, <peter.chen@...escale.com>,
<jun.li@...escale.com>, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-omap@...r.kernel.org>
Subject: Re: [PATCH v4 5/9] usb: dwc3: core: make dual-role work with OTG irq
Hi,
On Thu, Sep 03, 2015 at 04:52:02PM +0300, Roger Quadros wrote:
> >> if (on) {
> >> - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
> >> + /* OCTL.PeriMode = 0 */
> >> + reg = dwc3_readl(dwc->regs, DWC3_OCTL);
> >> + reg &= ~DWC3_OCTL_PERIMODE;
> >> + dwc3_writel(dwc->regs, DWC3_OCTL, reg);
> >> + /* unconditionally turn on VBUS */
> >> + reg |= DWC3_OCTL_PRTPWRCTL;
> >> + dwc3_writel(dwc->regs, DWC3_OCTL, reg);
> >> /* start the HCD */
> >> usb_otg_start_host(fsm, true);
> >> } else {
> >> /* stop the HCD */
> >> usb_otg_start_host(fsm, false);
> >> + /* turn off VBUS */
> >> + reg = dwc3_readl(dwc->regs, DWC3_OCTL);
> >> + reg &= ~DWC3_OCTL_PRTPWRCTL;
> >> + dwc3_writel(dwc->regs, DWC3_OCTL, reg);
> >> + /* OCTL.PeriMode = 1 */
> >> + reg = dwc3_readl(dwc->regs, DWC3_OCTL);
> >> + reg |= DWC3_OCTL_PERIMODE;
> >> + dwc3_writel(dwc->regs, DWC3_OCTL, reg);
> >> }
> >
> > it looks like you're not really following the fluxchart from SNPS
> > documentation, see Figure 11-4 on section 11.1.4.5
>
> Did you mean that I'm ignoring all OTG bits (HNP/SRP/ADP)?
yes and no :-) There's a rather complex flux chart which details how we
switch from host to peripheral and vice versa. We need to follow that to
the smallest details since that's what IP provider considers to be
correct. If we deviate from that we should have very strong reasons for
doing so and we also want big, fat, long comments in source code
detailing why and how we're deviating :-)
--
balbi
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists