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.

AM5728 USB client port configuration

Other Parts Discussed in Thread: TPS659037

USB_schema_split_1.pdf

Hi,

Our design is heavily based on Beagle X-15 and we have followed the same for USB as well. As in X-15, we intend to use the same USB port as used in X-15 as client port. So, there has been absolute no change in the USB part of the my device tree as i have been using the default X-15 DT. I have configured the kernel to support the same. 

My "lsusb" output shows that there is a USB port present and it is configured as ethernet gadget (We intend to use USB to login via SSH to the board). But still, i don't see any activity when i connect the USB to my PC. 

Am i missing anything here? Attached herewith my schematics as well.

Please provide with any possible leads.

Thanks,

Sri

  • Which USB are you talking about? There are 2 on your schematic.
  • Thanks for the reply..

    We are concerned about USB CLIENT PORT Connected to JP7 from Ball number AE11 & AF11. HEADER 2X2 DF11-4DP-2DSA(24)

    Please Discard the connector P5. That's not mounted on our hardware. We just had it as an option.


    Best Regards,
    Sri
  • Where is VBUS going?
  • USB2_VBUS is running to VBUS pin of PMIC. (Ball Number: D8) (PMIC: TPS659037)


    Best Regards,
    Sri
  • That's fine then. Next, do you have the PMIC_VBUS_DET from PMIC ball C13 to AM572X ball B11 (GPIO4_21)?
  • No. We don't have that.

    And also, we are not using the Inverter (U42) section as shown in the schematics of Beagle X-15.

    Best Regards,
    Sri
  • The inverter is not relevant as it's not mounted on the PCB anyway. However the PMIC_VBUS_DET from PMIC ball C13 to AM572X ball B11 is important, because this is the signal that tells the processor that VBUS supply is present on the USB connector. The USB driver will not work without this signal.
  • One other question: Do you have anything connected to AM572X ball E25 (GPIO7_24)? This pin is used as ID. If it isn't connected externally please turn on the internal pullup for this pin. Try this first, please.
  • AM572X ball B11 is GPIO4 21 in X-15 and unfortunately we have not brought that pin out. :( So, can i use any other GPIO instead of GPIO4 21? If so, where do i define it? I don't see it defined anywhere in the DT. Infact, the offset of that pin is defined in "mmc2_iodelay_ddr_1_8v_conf" of the DT.

    Best Regards,
    Sri
  • We configured GPIO7_24 as pull-up and defined it "0x3E8 (PIN_INPUT_PULLUP | MUX_MODE14)" and tried to see if that made any difference. But this didn't work. :(


    Best Regards,
    Sri
  • Seems like there also are some PMIC configurations to be done. Could you please let us know what are to be done?


    Best Regards,
    Sri
  • I have asked the USB experts to review this thread and comment.
  • Yes, you can use any spare am57x GPIO pin for VBUS detection.

    Srinidhi S said:
    We configured GPIO7_24 as pull-up and defined it "0x3E8 (PIN_INPUT_PULLUP | MUX_MODE14)" and tried to see if that made any difference. But this didn't work. :(

    Other than the pinmux setting, you also have to specify that the pin is for vbus detection. The evm uses GPIO4_21, so am57xx-beagle-x15.dts defines:

    535                 extcon_usb2: tps659038_usb {
    536                         compatible = "ti,palmas-usb-vid";
    537                         ti,enable-vbus-detection;
    538                         interrupts-extended = <&gpio4 21 IRQ_TYPE_EDGE_RISING>;
    539                 };
    
  • Thanks for the reply.

    Tried doing this. But it didn't work. Am I still missing something?

    Best regards,
    Sri
  • When you connect the am57x usb client port to the usb host, does the PMIC vbusdet pin (which connects to am57x gpio7_24) go high or not?
  • Yes, you are. Bin is talking for the PMIC_VBUS_DET signal, not about ID.
  • Yes.. It is going high but only after writing to 2 PMIC registers..

    i2cset -f -y 0 0x58 0xfa 0x08 (PRIMARY_SECONDARY_PAD1 Register - changing the functionality to Secondary function (VBUSDET))
    i2cset -f -y 0 0x59 0x1f 0x02 (INT4_STATUS Register - Enabling for Rising or Falling edge detection)


    Best Regards,
    Sri
  • Hello,

    Any help?

    Best Regards,
    Sri
  • Srinidhi S said:
    i2cset -f -y 0 0x58 0xfa 0x08 (PRIMARY_SECONDARY_PAD1 Register - changing the functionality to Secondary function (VBUSDET))

    So you do have the PMIC vbusdet pin brought out? You previously mentioned this pin was not brought out.

    If your PMIC does have output signal to am57x for vbus detection, please run the following attached script on your board to check if you have any software problem. Please post the output of the script.

    #!/bin/sh
    #
    # Util to check USB subsystem on for Linux kernel 3.12+
    #
    # TODO: usage
    
    VERSION=0.2.2
    
    
    ### functions ###
    
    has_supported_kernel() {
    	local _ver
    	local _t
    
        uname -a
    	_ver=`uname -r`
        _t=${_ver%%.*}
        # 2.x.x, unsupported
        [ $_t -ge 3 ] || return 1
        # 4.x.x, supported
        [ $_t -lt 4 ] || return 0
    
        _ver=${_ver#*.}
        _t=${_ver%%.*}
        # < 3.12.x, unsupported
        [ $_t -ge 12 ] || return 1
        return 0
    }
    
    check_platform () {
    	local _hw
        [ "$PLATFORM" != "" ] || {
    	    _hw=`grep '^Hardware' /proc/cpuinfo`
    	    DBG_PRINT $_hw
    
            if [ "${_hw#*AM33XX}" != "$_hw" ]; then
                PLATFORM="am335x"
            elif [ "${_hw#*AM43}" != "$_hw" ]; then
                PLATFORM="am437x"
            elif [ "${_hw#*DRA7}" != "$_hw" ]; then
                PLATFORM="am57x"
            elif [ "${_hw#*Keystone}" != "$_hw" ]; then
                PLATFORM="keystone"
            else
                PLATFORM="unknown"
            fi
        }
    
        DBG_PRINT $PLATFORM
        case $PLATFORM in
            "am335x")
                USB0='usb@47400000/usb@47401000'
                USB1='usb@47400000/usb@47401800'
                return 0;;
            "am437x")
                USB0='omap_dwc3@48380000/usb@48390000'
                USB1='omap_dwc3@483c0000/usb@483d0000'
                return 0;;
            "am57x")
                USB0='omap_dwc3_1@48880000/usb@48890000'
                USB1='omap_dwc3_2@488c0000/usb@488d0000'
                return 0;;
            "keystone")
                USB0='omap_dwc3_1@48880000/usb@48890000'
                USB1='omap_dwc3_2@488c0000/usb@488d0000'
                return 0;;
            *)
                echo "Unsupported $PLATFORM"
                return 1;;
        esac
    }
    
    # check a kernel CONFIG option
    # params $1 - the config option
    #        $2 = '-q', quiet output
    # return 0 - undefined
    #        1 - defined as 'm', kernel module
    #        2 - defined as 'y', kernel builtin
    check_kernel_config() {
        local _cfg
    
        [ -n "$1" ] || return 0
        _cfg=`zcat /proc/config.gz | grep "^$1\>"`
    
        case ${_cfg#*=} in
            "y") return 2;;
            "m") return 1;;
              *) [ "$2" = "-q" ] ||
                  echo "Error: $1 is undefined in kernel config"
              return 0;;
        esac
    }
    
    # check a kernel module
    # $1 - module name, relative path from drivers/, with .ko surfix
    # return 0 - found
    #        1 - error
    check_module() {
        local _modname
        local _moddep
    
        [ -n "$1" ] || return 1
    
        _modname="/lib/modules/`uname -r`/kernel/drivers/${1}.ko"
        _moddep="/lib/modules/`uname -r`/modules.dep"
    
        DBG_PRINT 1
        [ -f $_modname ] || {
            echo "Error: $_modname not found."
            echo "       Please ensure 'make module_install' is done properly."
            return 1
        }
    
        DBG_PRINT 2
        [ -f $_moddep ] || $moddep_checked || {
            echo "Error: $_moddep not found."
            echo "       Please ensure 'make module_install' is done properly."
            moddep_checked=true
        }
    
        DBG_PRINT 3
        lsmod | grep `basename $1 | tr '-' '_'` > /dev/null || {
            DBG_PRINT ">>>> ${1}.ko:"
            if grep "${1}.ko:" $_moddep > /dev/null; then
                DBG_PRINT 5
                echo "Error: $_moddep seems to be valid,"
                echo "       but `basename $1`.ko is not loaded."
                echo "       Please provide /proc/config.gz and /lib/module/`uname -r`/*"
                echo "       for further investigation."
            else
                DBG_PRINT 6
                echo "Error: `basename $1`: $_moddep is invalid."
                echo "       Please run command 'depmod' on the target to re-generate it,"
                echo "       then reboot the target. If the issue still exists, please"
                echo "       ensure 'make module_install' is done properly."
            fi
    
            DBG_PRINT 7
            return 1
        }
        DBG_PRINT 8
        return 0
    }
    
    check_musb_drivers() {
        check_kernel_config CONFIG_USB_MUSB_HDRC
        [ $? != 1 ] || check_module 'usb/musb/musb_hdrc'
    
        check_kernel_config CONFIG_USB_MUSB_DUAL_ROLE -q
        [ $? != 0 ] || echo "Warning: CONFIG_USB_MUSB_DUAL_ROLE undefined."
    
        check_kernel_config CONFIG_USB_MUSB_DSPS
        [ $? != 1 ] || {
            check_module 'usb/musb/musb_dsps'
            check_module 'usb/musb/musb_am335x'
        }
    
        check_kernel_config CONFIG_AM335X_PHY_USB
        [ $? != 1 ] || {
            check_module 'usb/phy/phy-am335x'
            check_module 'usb/phy/phy-am335x-control'
        }
    
        check_kernel_config CONFIG_MUSB_PIO_ONLY -q
        [ $? != 0 ] || {
           if check_kernel_config CONFIG_TI_CPPI41 -q; then
               echo "Error: MUSB CPPI DMA mode is enabled, but CPPI moudle is not enabled in DMA Engine."
               echo "       Please enable CONFIG_TI_CPPI41 under DMA Engine Support in kernel config."
           fi
        }
    }
    
    check_dwc3_drivers() {
        check_kernel_config CONFIG_USB_DWC3
        [ $? != 1 ] || check_module 'usb/dwc3/dwc3'
    
        check_kernel_config CONFIG_USB_DWC3_DUAL_ROLE -q
        [ $? != 0 ] || echo "Warning: CONFIG_USB_DWC3_DUAL_ROLE undefined."
    
        check_kernel_config CONFIG_USB_OTG -q
        [ $? != 0 ] || echo "Warning: CONFIG_USB_OTG undefined, which is required for DRD mode."
    
        check_kernel_config CONFIG_USB_DWC3_OMAP
        [ $? != 1 ] || check_module 'usb/dwc3/dwc3-omap'
    
        check_kernel_config CONFIG_USB_XHCI_HCD
        [ $? != 1 ] || {
            check_module 'usb/host/xhci-plat-hcd'
            check_module 'usb/host/xhci-hcd'
        }
    
        check_kernel_config CONFIG_OMAP_CONTROL_PHY
        [ $? != 1 ] || check_module 'phy/phy-omap-control'
    
        if [ $PLATFORM = am437x ]; then
            check_kernel_config CONFIG_OMAP_USB2
            [ $? != 1 ] || check_module 'phy/phy-omap-usb2'
        else
            check_kernel_config CONFIG_TI_PIPE3
            [ $? != 1 ] || check_module 'phy/phy-ti-pipe3'
        fi
    }
    
    ### debug ###
    
    g_log_file=/tmp/chmusb.log
    
    DBG_ENABLE() { g_dbg_enabled=true; }
    DBG_DISABLE() { g_dbg_enabled=false; }
    DBG_LOG_RESET() { ! $g_dbg_enabled || echo > $g_log_file; }
    DBG_PRINT() { ! $g_dbg_enabled || echo "$(date +%H:%M:%S) [$(basename $0)]: $*"; }
    DBG_LOG() { DBG_PRINT $* >> $g_log_file; }
    DBG_LOG_MARK() { DBG_PRINT "----------------" >> $g_log_file; }
    
    
    ### main ####
    
    moddep_checked=false
    
    echo "chkusb.sh Version $VERSION"
    
    [ "$V" = "1" ] && DBG_ENABLE && DBG_LOG_RESET || DBG_DISABLE
    
    has_supported_kernel ||
        { echo "Unsupported kernel version: `uname -r`"; exit 1; }
    check_platform || exit 2
    DBG_PRINT device: $PLATFORM
    
    which lsusb > /dev/null ||
        { echo "Error: lsusb command not found"; exit 3; }
    
    if lsusb > /dev/null 2>&1; then
        echo "USB is initialized"
    else
        echo "USB initialization failed"
    
        # failed, continue checking
        [ -f /proc/config.gz ] ||
            { echo "Error: /proc/config.gz not found"; exit 4; }
    
        case $PLATFORM in
            am335x) check_musb_drivers;;
            am437x | am57x | keystone) check_dwc3_drivers;;
            *)
                echo "Error: unsupported platform $PLATFORM"
                exit 5;;
        esac
    fi
    
    # check dr_mode & gadget drivers
    
    [ -d /proc/device-tree ] || {
        echo "Warning: /proc/device-tree/ not found"
        if [ -d "/lib/modules/`uname -r`/" ]; then
            echo "The list of USB gadget drivers installed:"
            ls -1Rp "/lib/modules/`uname -r`/kernel/drivers/usb/gadget/"
        fi
        exit 0
    }
    
    for _usb in "${USB0}" "${USB1}"; do
        _usb_dir="/proc/device-tree/ocp/${_usb}"
        _status=`cat $_usb_dir/status 2> /dev/null`
        _dr_mode=`cat $_usb_dir/dr_mode`
        echo `basename $_usb`: $_dr_mode, $_status
    
        [ "$_status" = "disabled" -o "$_dr_mode" = "host" ] || gadget_mode=true
    done
    
    DBG_PRINT $gadget_mode
    $gadget_mode || exit 0
    
    echo
    
    check_kernel_config CONFIG_USB_LIBCOMPOSITE
    case $? in
        0) echo "Error: no any gadget driver enabled"
           exit 6;;
        1) is_gadget_builtin=false;;
        2) echo "The gadget driver is built-in"
           is_gadget_builtin=true;;
    esac
    
    check_kernel_config CONFIG_USB_ZERO -q ||
        echo "Gadget Kernel Config: g_zero is enabled"
    check_kernel_config CONFIG_USB_AUDIO -q ||
        echo "Gadget Kernel Config: g_audio is enabled"
    check_kernel_config CONFIG_USB_ETH -q ||
        echo "Gadget Kernel Config: g_ether is enabled"
    check_kernel_config CONFIG_USB_G_NCM -q ||
        echo "Gadget Kernel Config: g_ncm is enabled"
    check_kernel_config CONFIG_USB_MASS_STORAGE -q ||
        echo "Gadget Kernel Config: g_mass_storage is enabled"
    check_kernel_config CONFIG_USB_G_SERIAL -q ||
        echo "Gadget Kernel Config: g_serial is enabled"
    check_kernel_config CONFIG_USB_G_PRINTER -q ||
        echo "Gadget Kernel Config: g_printer is enabled"
    
    g_driver=`grep '^DRIVER=' /sys/class/udc/*/uevent 2>/dev/null`
    echo "gadget driver loaded: ${g_driver:-(none)}"
    
    echo
    
    if ! $is_gadget_builtin; then
        if [ -d "/lib/modules/`uname -r`/" ]; then
            echo "The list of USB gadget drivers installed:"
            ls -1Rp "/lib/modules/`uname -r`/kernel/drivers/usb/gadget/"
        else
            echo "Error: /lib/modules/`uname -r`/ not found"
            echo "       Please ensure 'make modules_install' is done properly."
            exit 7
        fi
    fi
    
    # vim: ft=sh:ts=4:sw=4:et
    

  • Hi Bin,

    Thanks for sharing the script.

    Yes we have VBUSdet brought out. Sorry about the earlier confusion.

    Here's the output of the Script.
    *************************************************************************************
    chkusb.sh Version 0.2.2
    Linux am57xx-evm 4.1.13+ #19 PREEMPT Wed Apr 13 20:22:21 IST 2016 armv7l GNU/Linux
    USB is initialized
    usb@48890000: host, disabled
    usb@488d0000: peripheral,

    The gadget driver is built-in
    Gadget Kernel Config: g_ether is enabled
    gadget driver loaded: DRIVER=g_ether
    *************************************************************************************
    FYI,
    We have purposefully disabled USB1 as we are not using it. We only want 1 USB to be configured as client port for SSH.

    Best Regards,
    Sri
  • Please attach your kernel config /proc/config.gz.

    Is this 4.1.13 kernel from TI or the community?

  • am5728_USB_defconfig.txt

    We are using the SDK packaged with kernel 4.1.13

    Best Regards,

    sri

  • How did you generate this .config? I believe It is not possible to create such .config from menuconfig command in kernel 4.1.13, which has 'CONFIG_USB_DWC3=y' and 'CONFIG_USB_DWC3_DUAL_ROLE=y'.

    Please generate the .config from omap2plus_defconfig and don't modify any option which is related to usb, and see if the g_ether works on the host.
  • Thanks Bin & Biser,

    Problem solved. I was trying to statically build the g_ether module and that was the problem. While i dynamically inserted the .ko file the driver worked.

    Best regards,
    Sri