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.

Linux/OMAP-L138: USB0 in HOST mode

Part Number: OMAP-L138
Other Parts Discussed in Thread: OMAPL138, DA8XX,

Tool/software: Linux

Hi,

I'm using OMAPL138 LCDK (TMDSLCDK138), PROCESSOR-SDK-LINUX-OMAPL138 04_01_00_06.

I need both USB0 and USB1 in HOST mode simultaneously (in order to connect usb flash and usb network (ethernet) devices). USB1 operates successfully. USB0 don't work in default SDK configuration.

I found many similar questions on this forum related to USB OTG (USB0) but no one from them don't help me. All they about old SDKs.

Could any one help how to enable USB0 in HOST mode in actual Linux SDK?

I read Linux Software Developer's Guide → Linux Kernel → USB  but it contains information about am335x only.

dmesg snippet related to USB:

usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
[ OK ] Started udev Coldplug all Devices.
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-da8xx: DA8XX
ohci-da8xx ohci-da8xx: USB Host Controller
ohci-da8xx ohci-da8xx: new USB bus registered, assigned bus number 1
ohci-da8xx ohci-da8xx: irq 59, io mem 0x01e25000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected

lsusb output:

root@omapl138-lcdk:~# lsusb
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Thanks

  • Hi Petr,

    lsmod returns:
    usbcore 197578 3 musb_hdrc,ohci_hcd,ohci_da8xx

    for the usb. So you should follow the above cited wiki ( processors.wiki.ti.com/.../Processor_SDK_Linux_MUSB ) for enabling the USB driver.
    Once you enable the driver in the defconfig file, you should add both usb instances in the dts file (arch/arm/boot/dts/da850-lcdk.dts). Follow the instructions in the wiki.

    Best Regards,
    Yordan
  • Thanks for fast reply.

    I tried to follow this wiki but it didn't help. Page http://processors.wiki.ti.com/index.php/MUSB_Linux_Porting_Guide contains only am335x info.
    Can any body share dts file with configured usb0 for OMAP-L138? Wiki doesn't explains how to configure it.

    In result of attempts to build kernel I have musb_hdrc kernel module but it don't loads automatically.
    If modprobe it:
    root@omapl138-lcdk:~# modprobe musb_hdrc
    root@omapl138-lcdk:~# lsmod | grep usb
    musb_hdrc 84153 0
    udc_core 19576 1 musb_hdrc
    usbcore 196362 3 musb_hdrc,ohci_hcd,ohci_da8xx
    usb_common 4500 3 udc_core,musb_hdrc,usbcore
    phy_da8xx_usb 3357 1


    After that usb0 also don't work.

  • Hi,

    I tried to follow this wiki but it didn't help. Page processors.wiki.ti.com/.../MUSB_Linux_Porting_Guide contains only am335x info.

    The wiki clearly states that usb dts configuraion is explained in kernel doc: Documentation/devicetree/bindings/usb/am33xx-usb.txt. This is in the Linux kernel sources provided with the SDK. The configurations of the usb are similar, you just have to do them in arch/arm/boot/dts/da850-lcdk.dts.

    You can see in arch/arm/boot/dts/da859.dtsi that usb0 dr-mode is currently set as "otg". You can set try setting this to "host":

    usb0: usb@47401000 {
    compatible = "ti,musb-am33xx";
    reg = <0x47401400 0x400
    0x47401000 0x200>;
    reg-names = "mc", "control";

    interrupts = <18>;
    interrupt-names = "mc";
    - dr_mode = "otg";
    + dr_mode = "host";

    Best Regards,
    Yordan
  • Hi,

    Setting dr_mode to "host" in arch/arm/boot/dts/da850.dtsi didn't help.

    usb0 and usb1 are enabled in arch/arm/boot/dts/da850-lcdk.dts by default.

    I tried to setup da850.dtsi according to Documentation/devicetree/bindings/usb/da8xx-usb.txt but it also didn't help.

    My kernel config: tiusb.config

    boot log: 

    U-Boot SPL 2017.01-g590c7d7fe1 (Sep 26 2017 - 18:58:02)
    Trying to boot from MMC1
    
    
    U-Boot 2017.01-g590c7d7fe1 (Sep 26 2017 - 18:58:02 -0400)
    
    I2C:   ready
    DRAM:  128 MiB
    WARNING: Caches not enabled
    NAND:  512 MiB
    MMC:   davinci: 0
    In:    serial
    Out:   serial
    Err:   serial
    Invalid MAC address read.
    Net:   DaVinci-EMAC
    Warning: DaVinci-EMAC (eth0) using random MAC address - f2:e7:70:50:93:18
    
    Hit any key to stop autoboot:  0 
    BOOTP broadcast 1
    DHCP client bound to address 192.168.0.143 (26 ms)
    Using DaVinci-EMAC device
    TFTP from server 192.168.0.223; our IP address is 192.168.0.143
    Filename 'zImage'.
    Load address: 0xc0700000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################
             420.9 KiB/s
    done
    Bytes transferred = 2497776 (261cf0 hex)
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Booting Linux on physical CPU 0x0
    Linux version 4.9.41-ge3a80a1c5c (user@userVM) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 PREEMPT Tue Feb 6 14:29:02 +06 2018
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
    CPU: VIVT data cache, VIVT instruction cache
    Machine: AM18x/OMAP-L138 Hawkboard
    da8xx_rproc_reserve_cma: 'rproc_mem=nn@address' badly specified
        'nn' and 'address' must both be non-zero
    cma: Reserved 16 MiB at 0xc6c00000
    Memory policy: Data cache writethrough
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32480
    Kernel command line: console=ttyS2,115200n8 rw noinitrd root=/dev/nfs nfsroot=192.168.0.223:/home/user/ti-processor-sdk-linux-omapl138-lcdk-04.01.00.06/targetNFS,nolock,rsize=1024,wsize=1024 ip=dhcp
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 106304K/131072K available (4796K kernel code, 315K rwdata, 1512K rodata, 228K init, 164K bss, 8384K reserved, 16384K cma-reserved)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0xc8800000 - 0xff800000   ( 880 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .text : 0xc0008000 - 0xc04b7518   (4798 kB)
          .init : 0xc0633000 - 0xc066c000   ( 228 kB)
          .data : 0xc066c000 - 0xc06bae70   ( 316 kB)
           .bss : 0xc06bae70 - 0xc06e3f08   ( 165 kB)
    SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptible hierarchical RCU implementation.
            Build-time adjustment of leaf fanout to 32.
    NR_IRQS:245
    clocksource: timer0_1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
    sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
    Console: colour dummy device 80x30
    Calibrating delay loop... 227.32 BogoMIPS (lpj=1136640)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    CPU: Testing write buffer coherency: ok
    Setting up static identity map for 0xc0008400 - 0xc0008458
    devtmpfs: initialized
    VFP support v0.3: not present
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    futex hash table entries: 256 (order: -1, 3072 bytes)
    pinctrl core: initialized pinctrl subsystem
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor ladder
    cpuidle: using governor menu
    EMAC: MII PHY configured
    mux: initialized GPIO3_12
    mux: Setting register GPIO3_12
    mux:    PINMUX7 (0x0000001c) = 0x00110110 -> 0x00118110
    mux: initialized GPIO3_13
    mux: Setting register GPIO3_13
    mux:    PINMUX7 (0x0000001c) = 0x00118110 -> 0x00118810
    mux: initialized GPIO2_4
    mux: Setting register GPIO2_4
    mux:    PINMUX6 (0x00000018) = 0x00000000 -> 0x00008000
    mux: initialized GPIO6_13
    mux: Setting register GPIO6_13
    mux:    PINMUX13 (0x00000034) = 0x00000000 -> 0x00000800
    da8xx_register_rproc: memory not reserved for DSP, not registering DSP device
    omapl138_hawk_init: dsp/rproc registration failed: -12
    edma edma.0: Legacy memcpy is enabled, things might not work
    edma edma.0: TI EDMA DMA engine driver
    edma edma.1: Legacy memcpy is enabled, things might not work
    edma edma.1: TI EDMA DMA engine driver
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    clocksource: Switched to clocksource timer0_1
    NET: Registered protocol family 2
    TCP established hash table entries: 1024 (order: 0, 4096 bytes)
    TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
    TCP: Hash tables configured (established 1024 bind 1024)
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    workingset: timestamp_bits=14 max_order=15 bucket_order=1
    Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
    io scheduler noop registered (default)
    Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25, base_baud = 14250000) is a 16550A
    serial8250.1: ttyS1 at MMIO 0x1d0c000 (irq = 53, base_baud = 8250000) is a 16550A
    serial8250.2: ttyS2 at MMIO 0x1d0d000 (irq = 61, base_baud = 8250000) is a 16550A
    console [ttyS2] enabled
    brd: module loaded
    libphy: Fixed MDIO Bus: probed
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask ffffff7f
    libphy: davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[7]: device davinci_mdio-0:07, driver SMSC LAN8710/LAN8720
    ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    ohci-da8xx: DA8XX
    ohci-da8xx ohci-da8xx: USB Host Controller
    ohci-da8xx ohci-da8xx: new USB bus registered, assigned bus number 1
    ohci-da8xx ohci-da8xx: irq 59, io mem 0x01e25000
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    usbcore: registered new interface driver usbtest
    i2c /dev entries driver
    davinci_mmc da830-mmc.0: cannot find GPIO chip davinci_gpio.1
    davinci_mmc da830-mmc.0: cannot find GPIO chip davinci_gpio.1
    davinci_mmc da830-mmc.0: Using DMA, 4-bit mode
    NET: Registered protocol family 10
    sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
    NET: Registered protocol family 17
    console [netcon0] enabled
    netconsole: network logging started
    davinci_emac davinci_emac.1: using random MAC addr: 4a:a6:b6:67:46:86
    hctosys: unable to open rtc device (rtc0)
    davinci_mdio davinci_mdio.0: resetting idled controller
    mmc0: host does not support reading read-only switch, assuming write-enable
    mmc0: new high speed SDHC card at address 0007
    mmcblk0: mmc0:0007 SD8GB 7.42 GiB 
     mmcblk0: p1 p2
    SMSC LAN8710/LAN8720 davinci_mdio-0:07: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=davinci_mdio-0:07, irq=-1)
    IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    random: fast init done
    davinci_emac davinci_emac.1 eth0: Link is Up - 100Mbps/Full - flow control rx/tx
    IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    Sending DHCP requests .., OK
    IP-Config: Got DHCP answer from 192.168.0.1, my address is 192.168.0.109
    IP-Config: Complete:
         device=eth0, hwaddr=4a:a6:b6:67:46:86, ipaddr=192.168.0.109, mask=255.255.255.0, gw=192.168.0.1
         host=192.168.0.109, domain=Dlink, nis-domain=(none)
         bootserver=192.168.0.1, rootserver=192.168.0.223, rootpath=     nameserver0=192.168.0.1
    VFS: Mounted root (nfs filesystem) on device 0:13.
    devtmpfs: mounted
    Freeing unused kernel memory: 228K (c0633000 - c066c000)
    This architecture does not have kernel memory protection.
    systemd[1]: System time before build time, advancing clock.
    systemd[1]: systemd 230 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN)
    systemd[1]: Detected architecture arm.
    
    Welcome to Arago 2017.06!
    
    systemd[1]: Set hostname to <omapl138-lcdk>.
    systemd[1]: Created slice System Slice.
    [  OK  ] Created slice System Slice.
    systemd[1]: Listening on udev Control Socket.
    [  OK  ] Listening on udev Control Socket.
    systemd[1]: Created slice system-getty.slice.
    [  OK  ] Created slice system-getty.slice.
    systemd[1]: Listening on udev Kernel Socket.
    [  OK  ] Listening on udev Kernel Socket.
    systemd[1]: Listening on Syslog Socket.
    [  OK  ] Listening on Syslog Socket.
    systemd[1]: Listening on Journal Socket.
    [  OK  ] Listening on Journal Socket.
    systemd[1]: Starting Load Kernel Modules...
             Starting Load Kernel Modules...
             Starting Create list of required st... nodes for the current kernel...
             Mounting POSIX Message Queue File System...
             Starting Setup Virtual Console...
    [  OK  ] Listening on Journal Socket (/dev/log).
    cryptodev: loading out-of-tree module taints kernel.
    [  OK  ] Listening on Network Service Netlink Socket.
    cryptodev: driver 1.8 loaded.
             Starting Remount Root and Kernel File Systems...
    [  OK  ] Listening on Process Core Dump Socket.
    [  OK  ] Reached target Remote File Systems.
    [  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
    [  OK  ] Started Dispatch Password Requests to Console Directory Watch.
             Starting Journal Service...
    [  OK  ] Reached target Swap.
             Mounting Temporary Directory...
             Mounting Debug File System...
    [  OK  ] Created slice User and Session Slice.
    [  OK  ] Reached target Slices.
    [  OK  ] Created slice system-serial\x2dgetty.slice.
    [  OK  ] Started Forward Password Requests to Wall Directory Watch.
    [  OK  ] Reached target Paths.
    systemd[1]: Mounted POSIX Message Queue File System.
    [  OK  ] Mounted POSIX Message Queue File System.
    systemd[1]: Mounted Debug File System.
    [  OK  ] Mounted Debug File System.
    systemd[1]: Mounted Temporary Directory.
    [  OK  ] Mounted Temporary Directory.
    systemd[1]: Started Load Kernel Modules.
    [  OK  ] Started Load Kernel Modules.
    systemd[1]: Started Create list of required static device nodes for the current kernel.
    [  OK  ] Started Create list of required sta...ce nodes for the current kernel.
    systemd[1]: Started Setup Virtual Console.
    [  OK  ] Started Setup Virtual Console.
    systemd[1]: Started Remount Root and Kernel File Systems.
    [  OK  ] Started Remount Root and Kernel File Systems.
    systemd[1]: Starting udev Coldplug all Devices...
             Starting udev Coldplug all Devices...
    systemd[1]: Starting Create Static Device Nodes in /dev...
             Starting Create Static Device Nodes in /dev...
    systemd[1]: Starting Apply Kernel Variables...
             Starting Apply Kernel Variables...
    [  OK  ] Started Journal Service.
             Starting Flush Journal to Persistent Storage...
    random: crng init done
    [  OK  ] Started Apply Kernel Variables.
    systemd-journald[65]: Received request to flush runtime journal from PID 1
    [  OK  ] Started Flush Journal to Persistent Storage.
    [  OK  ] Started Create Static Device Nodes in /dev.
    [  OK  ] Reached target Local File Systems (Pre).
             Mounting /var/volatile...
             Mounting /media/ram...
             Starting udev Kernel Device Manager...
    [  OK  ] Mounted /var/volatile.
    [  OK  ] Mounted /media/ram.
             Starting Load/Save Random Seed...
    [  OK  ] Reached target Local File Systems.
             Starting Create Volatile Files and Directories...
    [  OK  ] Started Load/Save Random Seed.
    [  OK  ] Started udev Kernel Device Manager.
    [  OK  ] Started Create Volatile Files and Directories.
             Starting Network Time Synchronization...
             Starting Update UTMP about System Boot/Shutdown...
    [  OK  ] Started Update UTMP about System Boot/Shutdown.
    [  OK  ] Started Network Time Synchronization.
    [  OK  ] Reached target System Time Synchronized.
    davinci-wdt davinci-wdt: heartbeat 60 sec
    [  OK  ] Started udev Coldplug all Devices.
    [  OK  ] Reached target System Initialization.
    [  OK  ] Started Daily Cleanup of Temporary Directories.
    [  OK  ] Reached target Timers.
    [  OK  ] Listening on RPCbind Server Activation Socket.
    [  OK  ] Listening on dropbear.socket.
    [  OK  ] Listening on D-Bus System Message Bus Socket.
    [  OK  ] Reached target Sockets.
    [  OK  ] Reached target Basic System.
    [  OK  ] Started System Logging Service.
    [  OK  ] Started System Logger Daemon.
             Starting Print notice about GPLv3 packages...
             Starting Ethernet Bridge Filtering Tables...
             Starting telnetd.service...
    [  OK  ] Started Kernel Logging Service.
             Starting tiipclad-daemon.service...
             Starting Login Service...
    [  OK  ] Started D-Bus System Message Bus.
             Starting Network Service...
    [  OK  ] Started Ethernet Bridge Filtering Tables.
    [  OK  ] Started telnetd.service.
    [  OK  ] Started tiipclad-daemon.service.
    EXT4-fs (mmcblk0p2): mounting ext3 file system using the ext4 subsystem
    EXT4-fs (mmcblk0p2): recovery complete
    EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    [  OK  ] Started Network Service.
    [  OK  ] Found device /dev/ttyS2.
    ***************************************************************
    ***************************************************************
    NOTICE: This file system contains the following GPLv3 packages:
            autoconf
            binutils
            cifs-utils
            cpp-symlinks
            cpp
            dosfstools
            g++-symlinks
            g++
            gawk
            gcc-symlinks
            gcc
            gdb
            gdbserver
            gstreamer1.0-libav
            hidapi
            libgmp10
            libidn11
            libmpc3
            libmpfr4
            libreadline6
            m4
            make
            nettle
    
    If you do not wish to distribute GPLv3 components please remove
    the above packages prior to distribution.  This can be done using
    the opkg remove command.  i.e.:
        opkg remove <package>
    Where <package> is the name printed in the list above
    
    NOTE: If the package is a dependency of another package you
          will be notified of the dependent packages.  You should
          use the --force-removal-of-dependent-packages option to
          also remove the dependent packages as well
    ***************************************************************
    ***************************************************************
    [  OK  ] Started Print notice about GPLv3 packages.
    [  OK  ] Reached target Network.
             Starting Simple Network Management Protocol (SNMP) Daemon....
    [  OK  ] Started strongSwan IPsec IKEv1/IKEv2 daemon using ipsec.conf.
             Starting Permit User Sessions...
    [  OK  ] Started Vsftpd ftp daemon.
             Starting Lightning Fast Webserver With Light System Requirements...
             Starting Network Name Resolution...
             Starting thttpd.service...
    [  OK  ] Started Permit User Sessions.
    [  OK  ] Started Login Service.
    [  OK  ] Started Getty on tty1.
    [  OK  ] Started Serial Getty on ttyS2.
    [  OK  ] Reached target Login Prompts.
             Starting Synchronize System and HW clocks...
    [FAILED] Failed to start Synchronize System and HW clocks.
    See 'systemctl status sync-clocks.service' for details.
    [  OK  ] Started Lightning Fast Webserver With Light System Requirements.
    [  OK  ] Started thttpd.service.
             Starting rng-tools.service...
    [  OK  ] Started Network Name Resolution.
    [  OK  ] Started rng-tools.service.
             Starting matrix-gui-2.0.service...
    [  OK  ] Started matrix-gui-2.0.service.
             Starting thermal-zone-init.service...
    
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org omapl138-lcdk ttyS2
    
    Arago 2017.06 omapl138-lcdk ttyS2
    
    omapl138-lcdk login: root
    root@omapl138-lcdk:~# lsusb
    Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    root@omapl138-lcdk:~#
    
    

  • Just a guess. The older kernels allowed manual mode selection. In the newer kernels, the mode tended to be controlled by the ID pin. Have you tried grounding the USB ID pin on your LCDK. There should be a jumper for it.
  • Hi Norman,

    Actually you're correct. Bellow is an excerpt from the musb_core.c driver, specifically the musb_start():
    /* session started after:
    * (a) ID-grounded irq, host mode;
    * (b) vbus present/connect IRQ, peripheral mode;
    * (c) peripheral initiates, using SRP
    */


    Best Regards,
    Yordan
  • Hi all,

    Yes, I have tried to connect ID pin to ground (JP1). Furthermore USB OTG cable connects ID pin to ground. When I connect USB devices via OTG cable to J2 there isn't +5V on it.

  • Hi Petr,

    I hardcoded the phy_mode = PHY_MODE_USB_HOST; by modifying drivers/usb/musb/da8xx.c:

    static int da8xx_musb_set_mode(struct musb *musb, u8 musb_mode)
    {
        struct da8xx_glue *glue = dev_get_drvdata(musb->controller->parent);
        enum phy_mode phy_mode;

    /*
    * The PHY has some issues when it is forced in device or host mode.
    * Unless the user request another mode, configure the PHY in OTG mode.
    */
       if (!musb->is_initialized)

    +         return phy_set_mode(glue->phy, PHY_MODE_USB_HOST);

    -          return phy_set_mode(glue->phy, PHY_MODE_USB_OTG);

    +  phy_mode = PHY_MODE_USB_HOST;

    -  switch (musb_mode) {

    -          case MUSB_HOST: /* Force VBUS valid, ID = 0 */

    -                phy_mode = PHY_MODE_USB_HOST;

    -                break;

    -           case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */

    -                phy_mode = PHY_MODE_USB_DEVICE;

    -                break;

    -            case MUSB_OTG: /* Don't override the VBUS/ID comparators */

    -               phy_mode = PHY_MODE_USB_OTG;

    -               break;

    -            default:

    -            return -EINVAL;

    - }

      return phy_set_mode(glue->phy, phy_mode);
    }

    After the above modification I was able to connect USB flash drive on the USB_OTG port (J2) on OMAP-L138 LCDK (OTG port is working in HOST mode). Here is the log after attaching the flash drive:
    root@omapl138-lcdk:~# da8xx_musb_interrupt 302: VBUS error workaround (delay coming)
    usb 2-1: new high-speed USB device number 2 using musb-hdrc
    usb-storage 2-1:1.0: USB Mass Storage device detected
    scsi host1: usb-storage 2-1:1.0
    usbcore: registered new interface driver usb-storage
    scsi 1:0:0:0: Direct-Access Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 4
    sd 1:0:0:0: [sda] 15240576 512-byte logical blocks: (7.80 GB/7.27 GiB)
    sd 1:0:0:0: [sda] Write Protect is off
    sd 1:0:0:0: [sda] No Caching mode page found
    sd 1:0:0:0: [sda] Assuming drive cache: write through
    sda: sda1
    sd 1:0:0:0: [sda] Attached SCSI removable disk

    I realize this may not be the most elegant solution, but try it and see if it will work in your case. I didn't see anything strange in the bootlog after the above modification to the da8xx.c driver.

    Best Regards,
    Yordan

  • I had modified drivers/usb/musb/da8xx.c but USB_OTG port doesn't provide +5V. Kernel has been compiled with "host" and "otg" dr_mode (in arch/arm/boot/dts/da850.dtsi).

    When I tried to run old linux image with kernel 3.3 (it has been written on SD card in LCDK kit) USB_OTG port does provide +5V but usb devices hasn't been recognized (possibly needed drivers hasn't been compiled in that image). I payed attention to strings:

    musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
    musb-hdrc musb-hdrc: dma type: dma-cppi41
    MUSB255 controller's USBSS revision = 4ea11003
    Waiting for USB PHY clock good...
    musb-hdrc musb-hdrc: USB OTG mode controller at fee00000 using DMA, IRQ 58

    In my boot log there aren't strings like those. It seems like MUSB driver is configured wrong in kernel config. My boot log attached above.

    Thanks

  • Hi,

    The USB_OTG port (pin 1 on J2 (mini USB port)):

    actually provides +5V on my LCDK, see the scope measurement bellow:

    And as I told you, with the modifications I did in da8xx.c I was able to connect a USB flash drive on the USB_OTG port (LCDK is working as host). 

    Are you using LCDK or a customized board? If this is a custom board, check your hw design.

    Best Regards,
    Yordan

  • I'm using LCDK.

    Do you modify only drivers/usb/musb/da8xx.c against default configurations? How about kernel config and arch/arm/boot/dts/da850.dtsi?
  • Hi,

    I use the default configuration. I in arch/arm/boot/dts/da850.dtsi I set the dr_mode to "host" and hardcode the phy_mode to USB_HOST in da8xx.c driver.

    Best Regards,
    Yordan
  • Hi, Yordan

    Thanks for helpful tips. This modifications are successful.

    My changes hadn't been applied because I used TFTP and NFS boot. Minicom script created by setup.sh setups uboot environment for load kernel through TFTP only. Device tree blob (*.dtb) had been loaded from MMC (by default). So only kernel and modules had been updated (not da850-lcdk.dtb).

    I fixed minicom script for that porpose: setup_uboot-env.minicom.zip

    Result: to use USB_OTG in HOST mode we need to modify usb0 in arch/arm/boot/dts/da850-lcdk.dts:

    &usb0 {
    dr_mode = "host";
    status = "okay";
    };

    It is single modification against default configs. It had been tested with SDK 04_01_00_06.

    Thanks, Yordan

    Best regards