All of lore.kernel.org
 help / color / mirror / Atom feed
From: hs@denx.de (Heiko Schocher)
To: linux-arm-kernel@lists.infradead.org
Subject: usb, davinci: usb 2.0 problem on an am1808 based board
Date: Thu, 17 May 2012 08:37:23 +0200	[thread overview]
Message-ID: <4FB49CA3.2080906@denx.de> (raw)
In-Reply-To: <4FA3AB27.7060205@denx.de>

Hello,

Heiko Schocher wrote:
> Hello,
> 
> a while ago (see discussion here:
> http://comments.gmane.org/gmane.linux.usb.general/54505), I found this
> "USB timing Bug" on an am1808 based board:
> 
> Heiko Schocher wrote:
>> Hello Sergei,
> [...]
>> Sergei Shtylyov wrote:
>>> Hello.
>>>
>>> On 11.11.2011 11:19, Felipe Balbi wrote:
>>>
>>>>> I try to bring up usb 2.0 support on an am1808 based
>>>>> board and Linux version 3.1.0-rc10 and I am facing
>>>>> some issues:
> [...]
>>>>>   But if I add in drivers/usb/musb/da8xx.c
>>>>>    da8xx_musb_interrupt() a 10ms delay befor the
>>>>>    "if (status&  (DA8XX_INTR_DRVVBUS<<  DA8XX_INTR_USB_SHIFT)) {"
>>>>>    line usb works fine!
>>>>>    It also works without this timeout if I change the
>>>>>    "dev_dbg(musb->controller, "USB IRQ %08x\n", status);"
>>>>>    to
>>>>>    "printk(musb->controller, "USB IRQ %08x\n", status);"
>>>>>
>>>>>    ->  some timing issue, but I have no idea why!
>>>>>       (Maybe you have an idea?)
>>>> unfortunately I don't know any details about DaVinci.
>>>    AM1808 is not exactly DaVinci, to be precise...
>>>
>>>> Sergei, are you able to help on this question ?
>>>    Maybe. :-)
>> I hope it ;-)
> 
> now I digged deeper and found this patch, which solves the
> problem (without adding a 10 ms delay):
> 
> -----------------------------
> diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
> index d32aa4d..6a6b17b 100644
> --- a/drivers/usb/musb/da8xx.c
> +++ b/drivers/usb/musb/da8xx.c
> @@ -297,6 +297,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
>         unsigned long           flags;
>         irqreturn_t             ret = IRQ_NONE;
>         u32                     status;
> +       int                     flag = 1;
> 
>         spin_lock_irqsave(&musb->lock, flags);
> 
> @@ -368,6 +363,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
>                         musb->xceiv->default_a = 0;
>                         musb->xceiv->state = OTG_STATE_B_IDLE;
>                         portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
> +                       flag = 0;
>                 }
> 
>                 dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",
> @@ -378,7 +374,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci)
>                 ret = IRQ_HANDLED;
>         }
> 
> -       if (musb->int_tx || musb->int_rx || musb->int_usb)
> +       if (flag && ((musb->int_tx || musb->int_rx || musb->int_usb)))
>                 ret |= musb_interrupt(musb);
> 
>   eoi:
> -----------------------------
> 
> If we get an DA8XX_INTR_DRVVBUS IRQ, in the else case
> 
> musb->xceiv->state = OTG_STATE_B_IDLE;
> 
> is set, but overwritten in the musb_interrupt() call, which results
> in not starting the "Poll for ID change" timer ... as I am not an USB
> expert, posting this intermediate result here, maybe someone have an
> idea/explanation if this patch is the way to go, or what would be a
> better solution?

ping? Some comments/ideas?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

  reply	other threads:[~2012-05-17  6:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4EBC9DF1.90604@denx.de>
     [not found] ` <20111111091912.GB19090@legolas.emea.dhcp.ti.com>
     [not found]   ` <4EBEB29E.50705@mvista.com>
     [not found]     ` <4EC0F87B.4010104@denx.de>
2012-05-04 10:10       ` usb, davinci: usb 2.0 problem on an am1808 based board Heiko Schocher
2012-05-17  6:37         ` Heiko Schocher [this message]
2012-05-18 10:07           ` Manjunathappa, Prakash
2012-05-18 11:27             ` Sergei Shtylyov
2012-05-21 10:12               ` Manjunathappa, Prakash
2012-05-21  6:10             ` Heiko Schocher
2012-05-21 10:18               ` Manjunathappa, Prakash
2012-05-22  7:22                 ` Heiko Schocher
2012-05-29 14:22                   ` Heiko Schocher
2012-06-27  4:36                     ` Heiko Schocher

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=4FB49CA3.2080906@denx.de \
    --to=hs@denx.de \
    --cc=linux-arm-kernel@lists.infradead.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.