This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am1808, kernel 3.17, usb detection issue

Other Parts Discussed in Thread: AM1808, DA8XX

Dar all,


i succesffully had USB working on kernel 3.17 on a AM1808 based board.

After reboot, with key inserted, automount detect the key and mount it correctly.

Once removed, i see a message as:

[root@test local]# usb 1-1: USB disconnect, device number 2
FAT-fs (sda1): unable to read boot sector to mark fs as dirty

But once the key is re-inserted, i don't see it detected nor mounted.

also lsusb doesn't show the usb pen anymore.

Could i have some issue with udev / automount  or menuconfig ?

Thanks

  • Hi Steven,

    After reboot, with key inserted, automount detect the key and mount it correctly.

    How you are doing "reboot" ?

    init 6 / reboot / or switch ON/OFF ?

    After reboot, are you getting any USB error messages while booting or inserting pendrive ?

    Share your complete bootup log of before and after reboot.

  • Hi Stalin,

    i explain a bit better the story of this issue.

    I ported my board to work from a kernel 3.5.1 to a recent 3.17.0.

    Actually, after several issues, i have all working, except for USB.

    The original issue at boot was:

    da8xx_musb_interrupt 346: VBUS error workaround (delay coming)
    musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 00080108
    

    So, to solve this issue, as find in this forum, i added into my board.c, (usb controller is an host), the line

    cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;

    this caused usb to work properly, but the pen, after that is removed and re-plugged is not detected anymore.

    So i rolled back now to the original board.c code that was working perfect in kernel 3.5.1.

    The "VBUS error workaround" is detected since "musb->int_usb & MUSB_INTR_VBUSERROR;"  in da8xx.c da8xx_musb_interrupt() routine is set.

    Now, i measured, i have 5V fixed on vbus, and all was working properly in the older kernel. So i suspect in some issue introduced in the recent kernel.

    Regards

  • Had some progresses:

    on kernel 3.17, musb controller driver is set to start as OTG mode as default. So as first thing, since my board has ID pin shorted to ground, i changed the default mode to MUSB_HOST., as it was on kernel 3.5.1

    So with same settings of 3.5.1 now key is detected correctly at first insertion, but after a removal, the stick is not detected anymore.

    Issue is visible in drivers/usb/musb/da8xx.c, inside irqreturn_t da8xx_musb_interrupt() routine.

    looking the /sys fs, i see that the mode moves in time order as:

    boot:       vbus off  b_idle
    boot:       vbus off  a_wait_vrise
    insertion:  vbus off  a_host
    removal:    vbus off  b_idle

    After last b_host, the state never moves back to a_wait_vrise.

    After the removal, the interrupt call irqreturn_t da8xx_musb_interrupt() seems broken and seems never called anymore.

    Regards

  • Hi Steven,

    I'm trying to reproduce the problem.

    I have tried linux kernel 3.17.1 from kernel.org and able to enable USB1.1 and not USB2.0.

    Could you share your latest .config with board file.

    If you not wish to share here then, send me the files to "x0213399@ti.com"

  • Hi Titus,

    i am temporary moved to another task, but will be back on this in some days, have to solve it in any case.

    many thanks for testing the case, it seams to me the interrupt get disabled after the second reconnection.

    I attached 3 files

    - board C support and initializations

    - .config

    - modified arc/arm/mach-davinci/usb.c to run as musb_host mode as default.

    Thanks

    for_ti.tar.gz
  • Hi, i am back on this and still fighting. Any news or idea ?

    Reagrds

  • Hi
    
    don't know if you have already fixed this, anyway,
    i finally solved with this patch,
    diff --git a/drivers/usb/musb/da8xx.c 
    b/../linux-3.17/drivers/usb/musb/da8xx.c
    index 4e13fe2..058775e 100644
    --- a/drivers/usb/musb/da8xx.c
    +++ b/../linux-3.17/drivers/usb/musb/da8xx.c
     <at>  <at>  -184,11 +184,6  <at>  <at>  static void da8xx_musb_set_vbus(struct musb *musb, 
    int is_on)
      #define    POLL_SECONDS    2
    
      static struct timer_list otg_workaround;
    -/*
    - * angelo,
    - * usb host fix must triggered from inside interrupt
    - */
    -static int reset_fix = 0;
    
      static void otg_timer(unsigned long _musb)
      {
     <at>  <at>  -254,33 +249,6  <at>  <at>  static void otg_timer(unsigned long _musb)
                  mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
              else
                  musb->xceiv->state = OTG_STATE_A_IDLE;
    -
    -        if (reset_fix) {
    -            u32 cfgchip2;
    -
    -            reset_fix = 0;
    -
    -            MUSB_HST_MODE(musb);
    -            musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
    -
    -            cfgchip2 = __raw_readl(
    -                DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    -
    -            /*
    -             * angelo, fix step 2
    -             *
    -             * after have set force_host in a first step,
    -             * we need now to set as OTG and re-enable
    -             * bus comparators so that DRVVBUS interrupt
    -             * can be triggered at 5V presence
    -             */
    -            cfgchip2 &= ~CFGCHIP2_OTGMODE;
    -            cfgchip2 |= (CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN);
    -
    -            __raw_writel(cfgchip2,
    -                DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    -        }
    -
              break;
          default:
              break;
     <at>  <at>  -388,25 +356,6  <at>  <at>  static irqreturn_t da8xx_musb_interrupt(int irq, 
    void *hci)
                  otg->default_a = 0;
                  musb->xceiv->state = OTG_STATE_B_IDLE;
                  portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
    -
    -            if (devctl == 0x98) {
    -                u32 cfgchip2;
    -                /*
    -                 * angelo, fix, part 2
    -                 * - set host mode only
    -                 * - override vbus / id comparators
    -                 */
    -                cfgchip2 = __raw_readl(
    - DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    -
    -                cfgchip2 |=   CFGCHIP2_FORCE_HOST;
    -                cfgchip2 &= ~(CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN);
    -
    -                __raw_writel(cfgchip2,
    - DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    

  • Hi Angelo,

    Sounds good.

    Really I'm glad that you were able to solve the problem.

    No. I haven't tried and was busy with some other priority issues.

    Also thanks for sharing the fix and it will be helpful to other community members as well.

  • Angelo,

    It looks like the last portion of the patch was clipped in the forum posting.  I found the full patch in your linux-usb mailinglist thread on this issue (http://www.spinics.net/lists/linux-usb/msg117252.html)

    (the following should be tacked on directly to the end of the original patch posted above):

    -
    -                reset_fix = 1;
    -            }
             }
    
             dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",

    Thanks,
    Scott

  • Hi Scott,

    Thanks for sharing the link.