* RE: [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.
@ 2014-08-07 20:18 ` Paul Zimmerman
0 siblings, 0 replies; 12+ messages in thread
From: Paul Zimmerman @ 2014-08-07 20:18 UTC (permalink / raw)
To: Doug Anderson, Greg Kroah-Hartman
Cc: Dinh Nguyen, Kever Yang, Sonny Rao, Heiko Stuebner,
linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
> From: Doug Anderson [mailto:dianders@chromium.org]
> Sent: Thursday, August 07, 2014 12:48 PM
>
> The documentation for GNPTXFSIZ says that "For host mode, this field
> is always valid." Since we're already switching to host mode for
> HPTXFSIZ, let's also read GNPTXFSIZ in host mode.
>
> On an rk3288 SoC, without this change we see this at bootup:
> dwc2 ff580000.usb: gnptxfsiz=00100400
> dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.
>
> After this change we see:
> dwc2 ff580000.usb: gnptxfsiz=04000400
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
> ---
> drivers/usb/dwc2/core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index 27d2c9b..c184ed43 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
> hwcfg2 = readl(hsotg->regs + GHWCFG2);
> hwcfg3 = readl(hsotg->regs + GHWCFG3);
> hwcfg4 = readl(hsotg->regs + GHWCFG4);
> - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
> grxfsiz = readl(hsotg->regs + GRXFSIZ);
>
> dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
> dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
> dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
> dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
> - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
> dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
>
> - /* Force host mode to get HPTXFSIZ exact power on value */
> + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
> gusbcfg = readl(hsotg->regs + GUSBCFG);
> gusbcfg |= GUSBCFG_FORCEHOSTMODE;
> writel(gusbcfg, hsotg->regs + GUSBCFG);
> usleep_range(100000, 150000);
>
> + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
> hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
> + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
> dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
> gusbcfg = readl(hsotg->regs + GUSBCFG);
> gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
Nice! I wonder if this is a bug in the original driver, and they
actually meant to read this register instead of HPTXFSIZ? Well, it
doesn't really matter I guess.
Acked-by: Paul Zimmerman <paulz@synopsys.com>
You may want to resend this to Greg after -rc1 is out and he reopens
his usb-next tree.
--
Paul
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.
2014-08-07 20:18 ` Paul Zimmerman
@ 2014-08-08 0:11 ` Doug Anderson
-1 siblings, 0 replies; 12+ messages in thread
From: Doug Anderson @ 2014-08-08 0:11 UTC (permalink / raw)
To: linux-arm-kernel
Paul,
On Thu, Aug 7, 2014 at 1:18 PM, Paul Zimmerman
<Paul.Zimmerman@synopsys.com> wrote:
>> From: Doug Anderson [mailto:dianders at chromium.org]
>> Sent: Thursday, August 07, 2014 12:48 PM
>>
>> The documentation for GNPTXFSIZ says that "For host mode, this field
>> is always valid." Since we're already switching to host mode for
>> HPTXFSIZ, let's also read GNPTXFSIZ in host mode.
>>
>> On an rk3288 SoC, without this change we see this at bootup:
>> dwc2 ff580000.usb: gnptxfsiz=00100400
>> dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.
>>
>> After this change we see:
>> dwc2 ff580000.usb: gnptxfsiz=04000400
>>
>> Signed-off-by: Doug Anderson <dianders@chromium.org>
>> ---
>> drivers/usb/dwc2/core.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
>> index 27d2c9b..c184ed43 100644
>> --- a/drivers/usb/dwc2/core.c
>> +++ b/drivers/usb/dwc2/core.c
>> @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
>> hwcfg2 = readl(hsotg->regs + GHWCFG2);
>> hwcfg3 = readl(hsotg->regs + GHWCFG3);
>> hwcfg4 = readl(hsotg->regs + GHWCFG4);
>> - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> grxfsiz = readl(hsotg->regs + GRXFSIZ);
>>
>> dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
>> dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
>> dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
>> dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
>> - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
>>
>> - /* Force host mode to get HPTXFSIZ exact power on value */
>> + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg |= GUSBCFG_FORCEHOSTMODE;
>> writel(gusbcfg, hsotg->regs + GUSBCFG);
>> usleep_range(100000, 150000);
>>
>> + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
>> + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
>
> Nice! I wonder if this is a bug in the original driver, and they
> actually meant to read this register instead of HPTXFSIZ? Well, it
> doesn't really matter I guess.
>
> Acked-by: Paul Zimmerman <paulz@synopsys.com>
>
> You may want to resend this to Greg after -rc1 is out and he reopens
> his usb-next tree.
Thanks!
...do you think this is a fix that needs to go in for 3.17? Is it
affecting anyone there?
-Doug
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.
@ 2014-08-08 0:11 ` Doug Anderson
0 siblings, 0 replies; 12+ messages in thread
From: Doug Anderson @ 2014-08-08 0:11 UTC (permalink / raw)
To: Paul Zimmerman
Cc: Greg Kroah-Hartman, Dinh Nguyen, Kever Yang, Sonny Rao,
Heiko Stuebner, linux-arm-kernel@lists.infradead.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Paul,
On Thu, Aug 7, 2014 at 1:18 PM, Paul Zimmerman
<Paul.Zimmerman@synopsys.com> wrote:
>> From: Doug Anderson [mailto:dianders@chromium.org]
>> Sent: Thursday, August 07, 2014 12:48 PM
>>
>> The documentation for GNPTXFSIZ says that "For host mode, this field
>> is always valid." Since we're already switching to host mode for
>> HPTXFSIZ, let's also read GNPTXFSIZ in host mode.
>>
>> On an rk3288 SoC, without this change we see this at bootup:
>> dwc2 ff580000.usb: gnptxfsiz=00100400
>> dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.
>>
>> After this change we see:
>> dwc2 ff580000.usb: gnptxfsiz=04000400
>>
>> Signed-off-by: Doug Anderson <dianders@chromium.org>
>> ---
>> drivers/usb/dwc2/core.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
>> index 27d2c9b..c184ed43 100644
>> --- a/drivers/usb/dwc2/core.c
>> +++ b/drivers/usb/dwc2/core.c
>> @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
>> hwcfg2 = readl(hsotg->regs + GHWCFG2);
>> hwcfg3 = readl(hsotg->regs + GHWCFG3);
>> hwcfg4 = readl(hsotg->regs + GHWCFG4);
>> - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> grxfsiz = readl(hsotg->regs + GRXFSIZ);
>>
>> dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
>> dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
>> dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
>> dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
>> - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
>>
>> - /* Force host mode to get HPTXFSIZ exact power on value */
>> + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg |= GUSBCFG_FORCEHOSTMODE;
>> writel(gusbcfg, hsotg->regs + GUSBCFG);
>> usleep_range(100000, 150000);
>>
>> + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
>> + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
>
> Nice! I wonder if this is a bug in the original driver, and they
> actually meant to read this register instead of HPTXFSIZ? Well, it
> doesn't really matter I guess.
>
> Acked-by: Paul Zimmerman <paulz@synopsys.com>
>
> You may want to resend this to Greg after -rc1 is out and he reopens
> his usb-next tree.
Thanks!
...do you think this is a fix that needs to go in for 3.17? Is it
affecting anyone there?
-Doug
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.
2014-08-08 0:11 ` Doug Anderson
@ 2014-08-08 0:52 ` Paul Zimmerman
-1 siblings, 0 replies; 12+ messages in thread
From: Paul Zimmerman @ 2014-08-08 0:52 UTC (permalink / raw)
To: linux-arm-kernel
> From: dianders at google.com [mailto:dianders at google.com] On Behalf Of Doug Anderson
> Sent: Thursday, August 07, 2014 5:12 PM
>
> On Thu, Aug 7, 2014 at 1:18 PM, Paul Zimmerman
> <Paul.Zimmerman@synopsys.com> wrote:
> >> From: Doug Anderson [mailto:dianders at chromium.org]
> >> Sent: Thursday, August 07, 2014 12:48 PM
> >>
> >> The documentation for GNPTXFSIZ says that "For host mode, this field
> >> is always valid." Since we're already switching to host mode for
> >> HPTXFSIZ, let's also read GNPTXFSIZ in host mode.
> >>
> >> On an rk3288 SoC, without this change we see this at bootup:
> >> dwc2 ff580000.usb: gnptxfsiz=00100400
> >> dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.
> >>
> >> After this change we see:
> >> dwc2 ff580000.usb: gnptxfsiz=04000400
> >>
> >> Signed-off-by: Doug Anderson <dianders@chromium.org>
> >> ---
> >> drivers/usb/dwc2/core.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> >> index 27d2c9b..c184ed43 100644
> >> --- a/drivers/usb/dwc2/core.c
> >> +++ b/drivers/usb/dwc2/core.c
> >> @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
> >> hwcfg2 = readl(hsotg->regs + GHWCFG2);
> >> hwcfg3 = readl(hsotg->regs + GHWCFG3);
> >> hwcfg4 = readl(hsotg->regs + GHWCFG4);
> >> - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
> >> grxfsiz = readl(hsotg->regs + GRXFSIZ);
> >>
> >> dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
> >> dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
> >> dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
> >> dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
> >> - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
> >> dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
> >>
> >> - /* Force host mode to get HPTXFSIZ exact power on value */
> >> + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
> >> gusbcfg = readl(hsotg->regs + GUSBCFG);
> >> gusbcfg |= GUSBCFG_FORCEHOSTMODE;
> >> writel(gusbcfg, hsotg->regs + GUSBCFG);
> >> usleep_range(100000, 150000);
> >>
> >> + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
> >> hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
> >> + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
> >> dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
> >> gusbcfg = readl(hsotg->regs + GUSBCFG);
> >> gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
> >
> > Nice! I wonder if this is a bug in the original driver, and they
> > actually meant to read this register instead of HPTXFSIZ? Well, it
> > doesn't really matter I guess.
> >
> > Acked-by: Paul Zimmerman <paulz@synopsys.com>
> >
> > You may want to resend this to Greg after -rc1 is out and he reopens
> > his usb-next tree.
>
> Thanks!
>
> ...do you think this is a fix that needs to go in for 3.17? Is it
> affecting anyone there?
I don't think so. It only has an effect if the controller starts up in
peripheral mode and then later switches to host mode, right? I think
yours is the first dwc2 platform in the kernel with that capability.
--
Paul
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.
@ 2014-08-08 0:52 ` Paul Zimmerman
0 siblings, 0 replies; 12+ messages in thread
From: Paul Zimmerman @ 2014-08-08 0:52 UTC (permalink / raw)
To: Doug Anderson
Cc: Greg Kroah-Hartman, Dinh Nguyen, Kever Yang, Sonny Rao,
Heiko Stuebner, linux-arm-kernel@lists.infradead.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3351 bytes --]
> From: dianders@google.com [mailto:dianders@google.com] On Behalf Of Doug Anderson
> Sent: Thursday, August 07, 2014 5:12 PM
>
> On Thu, Aug 7, 2014 at 1:18 PM, Paul Zimmerman
> <Paul.Zimmerman@synopsys.com> wrote:
> >> From: Doug Anderson [mailto:dianders@chromium.org]
> >> Sent: Thursday, August 07, 2014 12:48 PM
> >>
> >> The documentation for GNPTXFSIZ says that "For host mode, this field
> >> is always valid." Since we're already switching to host mode for
> >> HPTXFSIZ, let's also read GNPTXFSIZ in host mode.
> >>
> >> On an rk3288 SoC, without this change we see this at bootup:
> >> dwc2 ff580000.usb: gnptxfsiz=00100400
> >> dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.
> >>
> >> After this change we see:
> >> dwc2 ff580000.usb: gnptxfsiz=04000400
> >>
> >> Signed-off-by: Doug Anderson <dianders@chromium.org>
> >> ---
> >> drivers/usb/dwc2/core.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> >> index 27d2c9b..c184ed43 100644
> >> --- a/drivers/usb/dwc2/core.c
> >> +++ b/drivers/usb/dwc2/core.c
> >> @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
> >> hwcfg2 = readl(hsotg->regs + GHWCFG2);
> >> hwcfg3 = readl(hsotg->regs + GHWCFG3);
> >> hwcfg4 = readl(hsotg->regs + GHWCFG4);
> >> - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
> >> grxfsiz = readl(hsotg->regs + GRXFSIZ);
> >>
> >> dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
> >> dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
> >> dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
> >> dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
> >> - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
> >> dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
> >>
> >> - /* Force host mode to get HPTXFSIZ exact power on value */
> >> + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
> >> gusbcfg = readl(hsotg->regs + GUSBCFG);
> >> gusbcfg |= GUSBCFG_FORCEHOSTMODE;
> >> writel(gusbcfg, hsotg->regs + GUSBCFG);
> >> usleep_range(100000, 150000);
> >>
> >> + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
> >> hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
> >> + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
> >> dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
> >> gusbcfg = readl(hsotg->regs + GUSBCFG);
> >> gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
> >
> > Nice! I wonder if this is a bug in the original driver, and they
> > actually meant to read this register instead of HPTXFSIZ? Well, it
> > doesn't really matter I guess.
> >
> > Acked-by: Paul Zimmerman <paulz@synopsys.com>
> >
> > You may want to resend this to Greg after -rc1 is out and he reopens
> > his usb-next tree.
>
> Thanks!
>
> ...do you think this is a fix that needs to go in for 3.17? Is it
> affecting anyone there?
I don't think so. It only has an effect if the controller starts up in
peripheral mode and then later switches to host mode, right? I think
yours is the first dwc2 platform in the kernel with that capability.
--
Paul
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.
2014-08-07 20:18 ` Paul Zimmerman
@ 2014-09-08 18:48 ` Doug Anderson
-1 siblings, 0 replies; 12+ messages in thread
From: Doug Anderson @ 2014-09-08 18:48 UTC (permalink / raw)
To: linux-arm-kernel
Greg,
On Thu, Aug 7, 2014 at 1:18 PM, Paul Zimmerman
<Paul.Zimmerman@synopsys.com> wrote:
>> From: Doug Anderson [mailto:dianders at chromium.org]
>> Sent: Thursday, August 07, 2014 12:48 PM
>>
>> The documentation for GNPTXFSIZ says that "For host mode, this field
>> is always valid." Since we're already switching to host mode for
>> HPTXFSIZ, let's also read GNPTXFSIZ in host mode.
>>
>> On an rk3288 SoC, without this change we see this at bootup:
>> dwc2 ff580000.usb: gnptxfsiz=00100400
>> dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.
>>
>> After this change we see:
>> dwc2 ff580000.usb: gnptxfsiz=04000400
>>
>> Signed-off-by: Doug Anderson <dianders@chromium.org>
>> ---
>> drivers/usb/dwc2/core.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
>> index 27d2c9b..c184ed43 100644
>> --- a/drivers/usb/dwc2/core.c
>> +++ b/drivers/usb/dwc2/core.c
>> @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
>> hwcfg2 = readl(hsotg->regs + GHWCFG2);
>> hwcfg3 = readl(hsotg->regs + GHWCFG3);
>> hwcfg4 = readl(hsotg->regs + GHWCFG4);
>> - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> grxfsiz = readl(hsotg->regs + GRXFSIZ);
>>
>> dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
>> dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
>> dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
>> dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
>> - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
>>
>> - /* Force host mode to get HPTXFSIZ exact power on value */
>> + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg |= GUSBCFG_FORCEHOSTMODE;
>> writel(gusbcfg, hsotg->regs + GUSBCFG);
>> usleep_range(100000, 150000);
>>
>> + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
>> + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
>
> Nice! I wonder if this is a bug in the original driver, and they
> actually meant to read this register instead of HPTXFSIZ? Well, it
> doesn't really matter I guess.
>
> Acked-by: Paul Zimmerman <paulz@synopsys.com>
>
> You may want to resend this to Greg after -rc1 is out and he reopens
> his usb-next tree.
Is this something you want me to resend with Paul's Acked-by and
Kever's Reviewed-by? Please let me know and I'm happy to repost.
-Doug
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] usb: dwc2: Read GNPTXFSIZ when in forced HOST mode.
@ 2014-09-08 18:48 ` Doug Anderson
0 siblings, 0 replies; 12+ messages in thread
From: Doug Anderson @ 2014-09-08 18:48 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dinh Nguyen, Kever Yang, Sonny Rao, Heiko Stuebner,
linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Paul Zimmerman
Greg,
On Thu, Aug 7, 2014 at 1:18 PM, Paul Zimmerman
<Paul.Zimmerman@synopsys.com> wrote:
>> From: Doug Anderson [mailto:dianders@chromium.org]
>> Sent: Thursday, August 07, 2014 12:48 PM
>>
>> The documentation for GNPTXFSIZ says that "For host mode, this field
>> is always valid." Since we're already switching to host mode for
>> HPTXFSIZ, let's also read GNPTXFSIZ in host mode.
>>
>> On an rk3288 SoC, without this change we see this at bootup:
>> dwc2 ff580000.usb: gnptxfsiz=00100400
>> dwc2 ff580000.usb: 128 invalid for host_nperio_tx_fifo_size. Check HW configuration.
>>
>> After this change we see:
>> dwc2 ff580000.usb: gnptxfsiz=04000400
>>
>> Signed-off-by: Doug Anderson <dianders@chromium.org>
>> ---
>> drivers/usb/dwc2/core.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
>> index 27d2c9b..c184ed43 100644
>> --- a/drivers/usb/dwc2/core.c
>> +++ b/drivers/usb/dwc2/core.c
>> @@ -2674,23 +2674,23 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
>> hwcfg2 = readl(hsotg->regs + GHWCFG2);
>> hwcfg3 = readl(hsotg->regs + GHWCFG3);
>> hwcfg4 = readl(hsotg->regs + GHWCFG4);
>> - gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> grxfsiz = readl(hsotg->regs + GRXFSIZ);
>>
>> dev_dbg(hsotg->dev, "hwcfg1=%08x\n", hwcfg1);
>> dev_dbg(hsotg->dev, "hwcfg2=%08x\n", hwcfg2);
>> dev_dbg(hsotg->dev, "hwcfg3=%08x\n", hwcfg3);
>> dev_dbg(hsotg->dev, "hwcfg4=%08x\n", hwcfg4);
>> - dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "grxfsiz=%08x\n", grxfsiz);
>>
>> - /* Force host mode to get HPTXFSIZ exact power on value */
>> + /* Force host mode to get HPTXFSIZ / GNPTXFSIZ exact power on value */
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg |= GUSBCFG_FORCEHOSTMODE;
>> writel(gusbcfg, hsotg->regs + GUSBCFG);
>> usleep_range(100000, 150000);
>>
>> + gnptxfsiz = readl(hsotg->regs + GNPTXFSIZ);
>> hptxfsiz = readl(hsotg->regs + HPTXFSIZ);
>> + dev_dbg(hsotg->dev, "gnptxfsiz=%08x\n", gnptxfsiz);
>> dev_dbg(hsotg->dev, "hptxfsiz=%08x\n", hptxfsiz);
>> gusbcfg = readl(hsotg->regs + GUSBCFG);
>> gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
>
> Nice! I wonder if this is a bug in the original driver, and they
> actually meant to read this register instead of HPTXFSIZ? Well, it
> doesn't really matter I guess.
>
> Acked-by: Paul Zimmerman <paulz@synopsys.com>
>
> You may want to resend this to Greg after -rc1 is out and he reopens
> his usb-next tree.
Is this something you want me to resend with Paul's Acked-by and
Kever's Reviewed-by? Please let me know and I'm happy to repost.
-Doug
^ permalink raw reply [flat|nested] 12+ messages in thread