From: Przemek Rudy <prudy1@o2.pl>
To: Felipe Balbi <felipe.balbi@linux.intel.com>,
John Youn <John.Youn@synopsys.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup
Date: Wed, 30 Mar 2016 17:08:29 +0200 [thread overview]
Message-ID: <56FBEBED.6040008@o2.pl> (raw)
In-Reply-To: <87bn5wqnkh.fsf@intel.com>
On 03/30/2016 12:15 PM, Felipe Balbi wrote:
> John Youn <John.Youn@synopsys.com> writes:
>> [ text/plain ]
>> On 3/16/2016 3:10 PM, Przemek Rudy wrote:
>>> The host/device mode set with dr_mode should be kept all the time,
>>> not being changed to OTG in gadget setup (by overriding CFGUSB_FORCEDEVMODE
>>> and CFGUSB_FORCEHOSTMODE bits).
>>>
>>> Signed-off-by: Przemek Rudy <prudy1@o2.pl>
>>> ---
>>> drivers/usb/dwc2/gadget.c | 23 ++++++++++++++++++-----
>>> 1 file changed, 18 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>>> index e9940dd..818f158 100644
>>> --- a/drivers/usb/dwc2/gadget.c
>>> +++ b/drivers/usb/dwc2/gadget.c
>>> @@ -2254,6 +2254,7 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>> {
>>> u32 intmsk;
>>> u32 val;
>>> + u32 usbcfg;
>>>
>>> /* Kill any ep0 requests as controller will be reinitialized */
>>> kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET);
>>> @@ -2267,10 +2268,16 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
>>> * set configuration.
>>> */
>>>
>>> + /* keep other bits untouched (so e.g. forced modes are not lost) */
>>> + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>>> + usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>>> + GUSBCFG_HNPCAP);
>>> +
>>> /* set the PLL on, remove the HNP/SRP and set the PHY */
>>> val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>>> - dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> - (val << GUSBCFG_USBTRDTIM_SHIFT), hsotg->regs + GUSBCFG);
>>> + usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> + (val << GUSBCFG_USBTRDTIM_SHIFT);
>>> + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>>
>>> dwc2_hsotg_init_fifo(hsotg);
>>>
>>> @@ -3031,6 +3038,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = {
>>> static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>> {
>>> u32 trdtim;
>>> + u32 usbcfg;
>>> /* unmask subset of endpoint interrupts */
>>>
>>> dwc2_writel(DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
>>> @@ -3054,11 +3062,16 @@ static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
>>>
>>> dwc2_hsotg_init_fifo(hsotg);
>>>
>>> + /* keep other bits untouched (so e.g. forced modes are not lost) */
>>> + usbcfg = dwc2_readl(hsotg->regs + GUSBCFG);
>>> + usbcfg &= ~(GUSBCFG_TOUTCAL_MASK | GUSBCFG_PHYIF16 | GUSBCFG_SRPCAP |
>>> + GUSBCFG_HNPCAP);
>>> +
>>> /* set the PLL on, remove the HNP/SRP and set the PHY */
>>> trdtim = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
>>> - dwc2_writel(hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> - (trdtim << GUSBCFG_USBTRDTIM_SHIFT),
>>> - hsotg->regs + GUSBCFG);
>>> + usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
>>> + (trdtim << GUSBCFG_USBTRDTIM_SHIFT);
>>> + dwc2_writel(usbcfg, hsotg->regs + GUSBCFG);
>>>
>>> if (using_dma(hsotg))
>>> __orr32(hsotg->regs + GAHBCFG, GAHBCFG_DMA_EN);
>>>
>>
>>
>> Acked-by: John Youn <johnyoun@synopsys.com>
>> Tested-by: John Youn <johnyoun@synopsys.com>
>
> I suppose this is for v4.7 merge window ?
>
Technically - patch was started against 4.5, as there are no conflict changes around the file it fits for 4.6, 4.7.
next prev parent reply other threads:[~2016-03-30 15:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 22:10 [PATCH] usb: dwc2: do not override forced dr_mode in gadget setup Przemek Rudy
2016-03-24 21:21 ` John Youn
2016-03-30 10:15 ` Felipe Balbi
2016-03-30 15:08 ` Przemek Rudy [this message]
2016-03-30 22:47 ` John Youn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56FBEBED.6040008@o2.pl \
--to=prudy1@o2.pl \
--cc=John.Youn@synopsys.com \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.