mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup
@ 2011-09-16  6:04 Antony Pavlov
  2011-09-19  9:23 ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Antony Pavlov @ 2011-09-16  6:04 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 drivers/usb/host/ehci-hcd.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 60fc181..bc180af 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -922,10 +922,7 @@ static int ehci_probe(struct device_d *dev)
 	host->submit_bulk_msg = submit_bulk_msg;
 
 	if (ehci->flags & EHCI_HAS_TT) {
-		/* Set to host mode */
-		reg = ehci_readl(ehci->hcor + USBMODE);
-		reg |= USBMODE_CM_HC;
-		writel(reg, ehci->hcor + USBMODE);
+		ehci_reset(ehci);
 	}
 
 	usb_register_host(host);
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup
  2011-09-16  6:04 [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup Antony Pavlov
@ 2011-09-19  9:23 ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2011-09-19  9:23 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Fri, Sep 16, 2011 at 10:04:57AM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>

Applied to next.

Sascha

> ---
>  drivers/usb/host/ehci-hcd.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 60fc181..bc180af 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -922,10 +922,7 @@ static int ehci_probe(struct device_d *dev)
>  	host->submit_bulk_msg = submit_bulk_msg;
>  
>  	if (ehci->flags & EHCI_HAS_TT) {
> -		/* Set to host mode */
> -		reg = ehci_readl(ehci->hcor + USBMODE);
> -		reg |= USBMODE_CM_HC;
> -		writel(reg, ehci->hcor + USBMODE);
> +		ehci_reset(ehci);
>  	}
>  
>  	usb_register_host(host);
> -- 
> 1.7.5.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup
  2011-09-13 12:14   ` Antony Pavlov
@ 2011-09-13 17:04     ` Antony Pavlov
  0 siblings, 0 replies; 6+ messages in thread
From: Antony Pavlov @ 2011-09-13 17:04 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 13 September 2011 16:14, Antony Pavlov <antonynpavlov@gmail.com> wrote:
> On 13 September 2011 11:34, Sascha Hauer <s.hauer@pengutronix.de> wrote:
>> On Mon, Sep 12, 2011 at 02:26:00PM +0400, Antony Pavlov wrote:
>>> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
>>> ---
>>>  drivers/usb/host/ehci-hcd.c |    9 ++-------
>>>  1 files changed, 2 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
>>> index 60fc181..883dc07 100644
>>> --- a/drivers/usb/host/ehci-hcd.c
>>> +++ b/drivers/usb/host/ehci-hcd.c
>>> @@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
>>>       host->submit_control_msg = submit_control_msg;
>>>       host->submit_bulk_msg = submit_bulk_msg;
>>>
>>> -     if (ehci->flags & EHCI_HAS_TT) {
>>> -             /* Set to host mode */
>>> -             reg = ehci_readl(ehci->hcor + USBMODE);
>>> -             reg |= USBMODE_CM_HC;
>>> -             writel(reg, ehci->hcor + USBMODE);
>>> -     }
>>> -
>>>       usb_register_host(host);
>>>
>>> +     ehci_reset(ehci);
>>> +
>>
>> ehci_reset is called from ehci_init. Isn't that enough or do we have to
>> call it explicitely here?
>
> I suppose it's preferable reset the controller after changing "host
> controller mode" bit (USBMODE_CM_HC). Let's check the file
> drivers/usb/host/ehci-hcd.c from linux kernel sources, in ehci_reset()
> we have:
>
>    if (ehci_is_TDI(ehci))
>                    tdi_reset (ehci);
>

May be this "patch" (linux-style) will be better?

      host->submit_control_msg = submit_control_msg;
      host->submit_bulk_msg = submit_bulk_msg;

      if (ehci->flags & EHCI_HAS_TT) {
-             /* Set to host mode */
-             reg = ehci_readl(ehci->hcor + USBMODE);
-             reg |= USBMODE_CM_HC;
-             writel(reg, ehci->hcor + USBMODE);
+             ehci_reset(ehci);
      }

      usb_register_host(host);

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup
  2011-09-13  7:34 ` Sascha Hauer
@ 2011-09-13 12:14   ` Antony Pavlov
  2011-09-13 17:04     ` Antony Pavlov
  0 siblings, 1 reply; 6+ messages in thread
From: Antony Pavlov @ 2011-09-13 12:14 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 13 September 2011 11:34, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Mon, Sep 12, 2011 at 02:26:00PM +0400, Antony Pavlov wrote:
>> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
>> ---
>>  drivers/usb/host/ehci-hcd.c |    9 ++-------
>>  1 files changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
>> index 60fc181..883dc07 100644
>> --- a/drivers/usb/host/ehci-hcd.c
>> +++ b/drivers/usb/host/ehci-hcd.c
>> @@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
>>       host->submit_control_msg = submit_control_msg;
>>       host->submit_bulk_msg = submit_bulk_msg;
>>
>> -     if (ehci->flags & EHCI_HAS_TT) {
>> -             /* Set to host mode */
>> -             reg = ehci_readl(ehci->hcor + USBMODE);
>> -             reg |= USBMODE_CM_HC;
>> -             writel(reg, ehci->hcor + USBMODE);
>> -     }
>> -
>>       usb_register_host(host);
>>
>> +     ehci_reset(ehci);
>> +
>
> ehci_reset is called from ehci_init. Isn't that enough or do we have to
> call it explicitely here?

I suppose it's preferable reset the controller after changing "host
controller mode" bit (USBMODE_CM_HC). Let's check the file
drivers/usb/host/ehci-hcd.c from linux kernel sources, in ehci_reset()
we have:

    if (ehci_is_TDI(ehci))
                    tdi_reset (ehci);

On my Tegra board I found the problem: board hangs up on the first
ehci_readl() after setting USBMODE_CM_HC bit.

>>       reg = HC_VERSION(ehci_readl(&ehci->hccr->cr_capbase));
>>       dev_info(dev, "USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
>>
>> --
>> 1.7.5.4
>>

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup
  2011-09-12 10:26 Antony Pavlov
@ 2011-09-13  7:34 ` Sascha Hauer
  2011-09-13 12:14   ` Antony Pavlov
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2011-09-13  7:34 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Mon, Sep 12, 2011 at 02:26:00PM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  drivers/usb/host/ehci-hcd.c |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 60fc181..883dc07 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
>  	host->submit_control_msg = submit_control_msg;
>  	host->submit_bulk_msg = submit_bulk_msg;
>  
> -	if (ehci->flags & EHCI_HAS_TT) {
> -		/* Set to host mode */
> -		reg = ehci_readl(ehci->hcor + USBMODE);
> -		reg |= USBMODE_CM_HC;
> -		writel(reg, ehci->hcor + USBMODE);
> -	}
> -
>  	usb_register_host(host);
>  
> +	ehci_reset(ehci);
> +

ehci_reset is called from ehci_init. Isn't that enough or do we have to
call it explicitely here?

Sascha

>  	reg = HC_VERSION(ehci_readl(&ehci->hccr->cr_capbase));
>  	dev_info(dev, "USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
>  
> -- 
> 1.7.5.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup
@ 2011-09-12 10:26 Antony Pavlov
  2011-09-13  7:34 ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Antony Pavlov @ 2011-09-12 10:26 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 drivers/usb/host/ehci-hcd.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 60fc181..883dc07 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
 	host->submit_control_msg = submit_control_msg;
 	host->submit_bulk_msg = submit_bulk_msg;
 
-	if (ehci->flags & EHCI_HAS_TT) {
-		/* Set to host mode */
-		reg = ehci_readl(ehci->hcor + USBMODE);
-		reg |= USBMODE_CM_HC;
-		writel(reg, ehci->hcor + USBMODE);
-	}
-
 	usb_register_host(host);
 
+	ehci_reset(ehci);
+
 	reg = HC_VERSION(ehci_readl(&ehci->hccr->cr_capbase));
 	dev_info(dev, "USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
 
-- 
1.7.5.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-19  9:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16  6:04 [PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup Antony Pavlov
2011-09-19  9:23 ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2011-09-12 10:26 Antony Pavlov
2011-09-13  7:34 ` Sascha Hauer
2011-09-13 12:14   ` Antony Pavlov
2011-09-13 17:04     ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox