Skip to contentSkip to conversation

usb, davinci: usb 2.0 problem on an am1808 based board

PATCH Heiko Schocher 3 participants 10 messages May 4, 2012 – Jun 27, 2012 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

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:

Quoted 1 line · Heiko Schocher

Hello Sergei,

[...]

Quoted 8 lines
Quoted 7 lines · Sergei Shtylyov

Hello.

Quoted 3 lines · Felipe Balbi
Quoted 3 lines

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:

[...]

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

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?)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

unfortunately I don't know any details about DaVinci.

AM1808 is not exactly DaVinci, to be precise...

Quoted 1 line

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):

-----------------------------

drivers/usb/musb/da8xx.c +3 -1
index d32aa4d..6a6b17b 100644
@@ -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?

bye,
Heiko

Signature · 3 lines
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
#5 lore raw

Hello,

Quoted 73 lines · Heiko Schocher

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:

Quoted 1 line · Heiko Schocher

Hello Sergei,

[...]

Quoted 8 lines
Quoted 7 lines · Sergei Shtylyov

Hello.

Quoted 3 lines · Felipe Balbi
Quoted 3 lines

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:

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

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);"

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

-> 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...

Quoted 1 line

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):

-----------------------------

drivers/usb/musb/da8xx.c +3 -2
index d32aa4d..6a6b17b 100644
@@ -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

Quoted 7 lines

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

Signature · 3 lines
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
#6 lore raw

Hi Heiko,

I do not know how putting delay helped MSC device detection.
Can you please check if MUSB is coming up in "b_idle" state(by
$cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)?
State should move to b_peripheral on connecting gadget cable.
If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +2 -0
@@ -76,6 +76,7 @@
 #define DA8XX_INTR_TX_SHIFT    0
 #define DA8XX_INTR_TX_MASK     (DA8XX_USB_TX_EP_MASK << DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT     1100            /* in ms */
 #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
 #define CFGCHIP2       IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
                 rev, __raw_readl(CFGCHIP2),
                 musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
+       musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
        musb->isr = da8xx_musb_interrupt;
        return 0;
 fail:

Thanks,
Prakash

Quoted 83 lines · Heiko Schocher

Hello,

Quoted 80 lines · Heiko Schocher

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:

Quoted 1 line · Heiko Schocher

Hello Sergei,

[...]

Quoted 8 lines
Quoted 7 lines · Sergei Shtylyov

Hello.

Quoted 3 lines · Felipe Balbi
Quoted 3 lines

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:

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

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);"

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

-> 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...

Quoted 1 line

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):

-----------------------------

drivers/usb/musb/da8xx.c +3 -2
index d32aa4d..6a6b17b 100644
@@ -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?

#7 lore raw

Hello.

Quoted 19 lines · Prakash

I do not know how putting delay helped MSC device detection.
Can you please check if MUSB is coming up in "b_idle" state(by
$cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)?
State should move to b_peripheral on connecting gadget cable.
If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +1 -0
@@ -76,6 +76,7 @@
  #define DA8XX_INTR_TX_SHIFT    0
  #define DA8XX_INTR_TX_MASK     (DA8XX_USB_TX_EP_MASK<<  DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT     1100            /* in ms */
  #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
  #define CFGCHIP2       IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)

drivers/usb/musb/da8xx.c static int da8xx_musb_init(struct musb *musb) · line 450

Quoted 7 lines
drivers/usb/musb/da8xx.c +1 -0
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
                  rev, __raw_readl(CFGCHIP2),
                  musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
+       musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
         musb->isr = da8xx_musb_interrupt;
         return 0;
  fail:
    This change shouldn't be needed as musb->a_wait_bcon is set in 

musb_core.c::allocate_instance().

Quoted 2 lines

Thanks,
Prakash

WBR, Sergei

#8 lore raw

Hi Sergei,

Quoted 26 lines · Sergei Shtylyov

Hello.

Quoted 22 lines · Prakash

I do not know how putting delay helped MSC device detection.
Can you please check if MUSB is coming up in "b_idle" state(by
$cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)?
State should move to b_peripheral on connecting gadget cable.
If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +1 -0
@@ -76,6 +76,7 @@
  #define DA8XX_INTR_TX_SHIFT    0
  #define DA8XX_INTR_TX_MASK     (DA8XX_USB_TX_EP_MASK<<  DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT     1100            /* in ms */
  #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
  #define CFGCHIP2       IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
                  rev, __raw_readl(CFGCHIP2),
                  musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
Quoted 8 lines

drivers/usb/musb/da8xx.c static int da8xx_musb_init(struct musb *musb) · line 450

Quoted 4 lines
drivers/usb/musb/da8xx.c +1 -0
+       musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
         musb->isr = da8xx_musb_interrupt;
         return 0;
  fail:
    This change shouldn't be needed as musb->a_wait_bcon is set in 

musb_core.c::allocate_instance().

Yes, It worked even without above change.

Thanks,
Prakash

#9 lore raw
In reply to Manjunathappa, Prakash

Hello Manjunathappa,

Quoted 6 lines · Prakash

Hi Heiko,

I do not know how putting delay helped MSC device detection. Can you please check if MUSB is coming up in "b_idle" state(by $cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)? State should move to b_peripheral on connecting gadget cable.

We have connected the USB0_ID pin to ground -> host only mode, so I could not try this.

Quoted 15 lines

If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +1 -0
@@ -76,6 +76,7 @@
 #define DA8XX_INTR_TX_SHIFT    0
 #define DA8XX_INTR_TX_MASK     (DA8XX_USB_TX_EP_MASK << DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT     1100            /* in ms */
 #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
 #define CFGCHIP2       IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)

drivers/usb/musb/da8xx.c static int da8xx_musb_init(struct musb *musb) · line 450

Quoted 7 lines
drivers/usb/musb/da8xx.c +1 -0
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
                 rev, __raw_readl(CFGCHIP2),
                 musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
+       musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
        musb->isr = da8xx_musb_interrupt;
        return 0;
 fail:

No, this change is not in current mainline ...

Added this patch, and I get:

$ make -s uImage
drivers/usb/musb/da8xx.c: In function 'da8xx_musb_init':
drivers/usb/musb/da8xx.c:448:22: error: 'A_WAIT_BCON_TIMEOUT' undeclared (first use in this function)
drivers/usb/musb/da8xx.c:448:22: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [drivers/usb/musb/da8xx.o] Error 1
make[2]: *** [drivers/usb/musb] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
$

Do you mean

musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;

? This is setup in musb_core.c::allocate_instance() as Sergei Shtylyov already commented ... nevertheless tried with this define your patch, and my USB stick gets detected too...

bye,
Heiko

Signature · 3 lines
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
#10 lore raw

Hi Heiko,

Quoted 5 lines · Heiko Schocher

Hello Manjunathappa,

Quoted 2 lines · Prakash

Hi Heiko,

Quoted 8 lines
Quoted 4 lines

I do not know how putting delay helped MSC device detection. Can you please check if MUSB is coming up in "b_idle" state(by $cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)? State should move to b_peripheral on connecting gadget cable.

We have connected the USB0_ID pin to ground -> host only mode, so I could not try this.

Ok, So it is coming up in which state, "$cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode"?

Quoted 37 lines
Quoted 15 lines

If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +1 -0
@@ -76,6 +76,7 @@
 #define DA8XX_INTR_TX_SHIFT    0
 #define DA8XX_INTR_TX_MASK     (DA8XX_USB_TX_EP_MASK << DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT     1100            /* in ms */
 #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
 #define CFGCHIP2       IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)

drivers/usb/musb/da8xx.c static int da8xx_musb_init(struct musb *musb) · line 450

Quoted 7 lines
drivers/usb/musb/da8xx.c +1 -0
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
                 rev, __raw_readl(CFGCHIP2),
                 musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
+       musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
        musb->isr = da8xx_musb_interrupt;
        return 0;
 fail:

No, this change is not in current mainline ...

Added this patch, and I get:

$ make -s uImage
drivers/usb/musb/da8xx.c: In function 'da8xx_musb_init':
drivers/usb/musb/da8xx.c:448:22: error: 'A_WAIT_BCON_TIMEOUT' undeclared (first use in this function)
drivers/usb/musb/da8xx.c:448:22: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [drivers/usb/musb/da8xx.o] Error 1
make[2]: *** [drivers/usb/musb] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
$
Quoted 8 lines

Do you mean

musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;

? This is setup in musb_core.c::allocate_instance() as Sergei Shtylyov already commented ... nevertheless tried with this define your patch, and my USB stick gets detected too...

Does that mean issue got fixed or Do you still have delay in da8xx_musb_interrupt handler?

Thanks,
Prakash

#11 lore raw

Hello Manjunathappa,

Quoted 12 lines · Prakash

Hi Heiko,

Quoted 9 lines · Heiko Schocher

Hello Manjunathappa,

Quoted 6 lines · Prakash

Hi Heiko,

I do not know how putting delay helped MSC device detection. Can you please check if MUSB is coming up in "b_idle" state(by $cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)? State should move to b_peripheral on connecting gadget cable.

Quoted 5 lines
Quoted 3 lines

We have connected the USB0_ID pin to ground -> host only mode, so I could not try this.

Ok, So it is coming up in which state, "$cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode"?

without the delay in da8xx_musb_interrupt() and the
+ musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;
change:

booting Linux with USB stick attached shows:
root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_host
root at armv5te:~#

booting Linux without USB stick attached:

root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_wait_vrise
root at armv5te:~#

and connecting an usb stick:

root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_host
root at armv5te:~#

Quoted 38 lines
Quoted 38 lines
Quoted 15 lines

If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +1 -0
@@ -76,6 +76,7 @@
 #define DA8XX_INTR_TX_SHIFT    0
 #define DA8XX_INTR_TX_MASK     (DA8XX_USB_TX_EP_MASK << DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT     1100            /* in ms */
 #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
 #define CFGCHIP2       IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)

drivers/usb/musb/da8xx.c static int da8xx_musb_init(struct musb *musb) · line 450

Quoted 7 lines
drivers/usb/musb/da8xx.c +1 -0
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
                 rev, __raw_readl(CFGCHIP2),
                 musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
+       musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
        musb->isr = da8xx_musb_interrupt;
        return 0;
 fail:

No, this change is not in current mainline ...

Added this patch, and I get:

$ make -s uImage
drivers/usb/musb/da8xx.c: In function 'da8xx_musb_init':
drivers/usb/musb/da8xx.c:448:22: error: 'A_WAIT_BCON_TIMEOUT' undeclared (first use in this function)
drivers/usb/musb/da8xx.c:448:22: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [drivers/usb/musb/da8xx.o] Error 1
make[2]: *** [drivers/usb/musb] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
$

Do you mean

Quoted 8 lines
Quoted 6 lines

musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;

? This is setup in musb_core.c::allocate_instance() as Sergei Shtylyov already commented ... nevertheless tried with this define your patch, and my USB stick gets detected too...

Does that mean issue got fixed or Do you still have delay in da8xx_musb_interrupt handler?

Without the delay in the da8xx_musb_interrupt() ...

bye,
Heiko

Signature · 3 lines
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
#12 lore raw

Hello Manjunathappa,

Quoted 82 lines · Heiko Schocher

Hello Manjunathappa,

Quoted 12 lines · Prakash

Hi Heiko,

Quoted 9 lines · Heiko Schocher

Hello Manjunathappa,

Quoted 6 lines · Prakash

Hi Heiko,

I do not know how putting delay helped MSC device detection. Can you please check if MUSB is coming up in "b_idle" state(by $cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)? State should move to b_peripheral on connecting gadget cable.

Quoted 5 lines
Quoted 3 lines

We have connected the USB0_ID pin to ground -> host only mode, so I could not try this.

Ok, So it is coming up in which state, "$cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode"?

without the delay in da8xx_musb_interrupt() and the
+ musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;
change:

booting Linux with USB stick attached shows:
root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_host
root at armv5te:~#

booting Linux without USB stick attached:

root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_wait_vrise
root at armv5te:~#

and connecting an usb stick:

root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_host
root at armv5te:~#

Quoted 40 lines
Quoted 40 lines
Quoted 15 lines

If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +1 -0
@@ -76,6 +76,7 @@
  #define DA8XX_INTR_TX_SHIFT    0
  #define DA8XX_INTR_TX_MASK     (DA8XX_USB_TX_EP_MASK<<  DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT     1100            /* in ms */
  #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
  #define CFGCHIP2       IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)

drivers/usb/musb/da8xx.c static int da8xx_musb_init(struct musb *musb) · line 450

Quoted 7 lines
drivers/usb/musb/da8xx.c +1 -0
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
                  rev, __raw_readl(CFGCHIP2),
                  musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
+       musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
         musb->isr = da8xx_musb_interrupt;
         return 0;
  fail:

No, this change is not in current mainline ...

Added this patch, and I get:

$ make -s uImage
drivers/usb/musb/da8xx.c: In function 'da8xx_musb_init':
drivers/usb/musb/da8xx.c:448:22: error: 'A_WAIT_BCON_TIMEOUT' undeclared (first use in this function)
drivers/usb/musb/da8xx.c:448:22: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [drivers/usb/musb/da8xx.o] Error 1
make[2]: *** [drivers/usb/musb] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
$

Do you mean

musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

? This is setup in musb_core.c::allocate_instance() as Sergei Shtylyov already commented ... nevertheless tried with this define your patch, and my USB stick gets detected too...

Does that mean issue got fixed or Do you still have delay in da8xx_musb_interrupt handler?

Without the delay in the da8xx_musb_interrupt() ...

ping!

How do we proceed here?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#13 lore raw

Hello Manjunathappa,

Quoted 90 lines · Heiko Schocher

Hello Manjunathappa,

Quoted 87 lines · Heiko Schocher

Hello Manjunathappa,

Quoted 12 lines · Prakash

Hi Heiko,

Quoted 9 lines · Heiko Schocher

Hello Manjunathappa,

Quoted 6 lines · Prakash

Hi Heiko,

I do not know how putting delay helped MSC device detection. Can you please check if MUSB is coming up in "b_idle" state(by $cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode)? State should move to b_peripheral on connecting gadget cable.

Quoted 5 lines
Quoted 3 lines

We have connected the USB0_ID pin to ground -> host only mode, so I could not try this.

Ok, So it is coming up in which state, "$cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode"?

without the delay in da8xx_musb_interrupt() and the
+ musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; change:

booting Linux with USB stick attached shows:
root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_host
root at armv5te:~#

booting Linux without USB stick attached:

root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_wait_vrise
root at armv5te:~#

and connecting an usb stick:

root at armv5te:~# cat /sys/devices/platform/musb-da8xx/musb-hdrc/mode a_host
root at armv5te:~#

Quoted 45 lines
Quoted 44 lines
Quoted 21 lines

If you connect MSC device via mini-A connector, state should change to "a_host". OTG timer is responsible for above state changes, can you please check if below changes are present?

drivers/usb/musb/da8xx.c +2 -0
@@ -76,6 +76,7 @@
 #define DA8XX_INTR_TX_SHIFT 0
 #define DA8XX_INTR_TX_MASK (DA8XX_USB_TX_EP_MASK<< DA8XX_INTR_TX_SHIFT)
 
+#define A_WAIT_BCON_TIMEOUT 1100 /* in ms */
 #define DA8XX_MENTOR_CORE_OFFSET 0x400
 
 #define CFGCHIP2 IO_ADDRESS(DA8XX_SYSCFG0_BASE + DA8XX_CFGCHIP2_REG)
@@ -443,6 +444,7 @@ static int da8xx_musb_init(struct musb *musb)
 rev, __raw_readl(CFGCHIP2),
 musb_readb(reg_base, DA8XX_USB_CTRL_REG));
 
+ musb->a_wait_bcon = A_WAIT_BCON_TIMEOUT;
 musb->isr = da8xx_musb_interrupt;
 return 0;
Quoted 1 line

fail:

No, this change is not in current mainline ...

Added this patch, and I get:

$ make -s uImage
drivers/usb/musb/da8xx.c: In function 'da8xx_musb_init':
drivers/usb/musb/da8xx.c:448:22: error: 'A_WAIT_BCON_TIMEOUT' undeclared (first use in this function)
drivers/usb/musb/da8xx.c:448:22: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [drivers/usb/musb/da8xx.o] Error 1
make[2]: *** [drivers/usb/musb] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
$

Do you mean

musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON;

? This is setup in musb_core.c::allocate_instance() as Sergei Shtylyov already commented ... nevertheless tried with this define your patch, and my USB stick gets detected too...

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Does that mean issue got fixed or Do you still have delay in da8xx_musb_interrupt handler?

Without the delay in the da8xx_musb_interrupt() ...

ping!

How do we proceed here?

ping.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany