[PATCH] ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup

Antony Pavlov antonynpavlov at gmail.com
Tue Sep 13 13:04:47 EDT 2011


On 13 September 2011 16:14, Antony Pavlov <antonynpavlov at gmail.com> wrote:
> On 13 September 2011 11:34, Sascha Hauer <s.hauer at pengutronix.de> wrote:
>> On Mon, Sep 12, 2011 at 02:26:00PM +0400, Antony Pavlov wrote:
>>> Signed-off-by: Antony Pavlov <antonynpavlov at 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



More information about the barebox mailing list