• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » Linux » Linux forum » Linux 2.6.27.18 USB Hotplug with OMAP3530
Share
Linux
  • Forum
Options
  • Subscribe via RSS

Forums

Linux 2.6.27.18 USB Hotplug with OMAP3530

This question is answered
David Eastburn
Posted by David Eastburn
on Mar 06 2012 06:58 AM
Prodigy100 points

Anyone know of hotplugging issues with this version of the kernel?  I'm trying to get hotplugging working with gadget Ethernet.  I have the USB driver, including the gadget drivers built as modules.  The gadget Ethernet does work.  However, I can only get hotplug events when I manually install/uninstall the USB modules.  I have tried building the drivers into the kernel, but get the same result.  I've haven't found any patches for newer kernel versions that address this issue.  Any ideas?

USB driver Kernel omap3530
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Brad Griffis
    Posted by Brad Griffis
    on Mar 06 2012 08:28 AM
    Guru57330 points

    I assume this is with respect to OMAP3530 since your previous post was related to OMAP3530.  It's a good practice to always include that info in a new thread.

    I've seen similar behavior even with later kernels.  Can you do something like this:

    • insmod your gadget driver. 
    • Now the USB is "ready" for when something gets plugged in.
    • Device gets plugged in
    • Device gets removed
    • rmmod/insmod to "re-arm" the USB

    Are you building the kernel with OTG support turned on?  The behavior I saw was definitely with OTG support enabled.  It may have behaved different when I just built it as a straight-up host or device (sorry, it was several months ago!).

    Do you need to support both host and device modes?  If not, which one do you need?  Can you attach your kernel config (please don't copy/paste into the editor!).

    Brad

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

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Brad Griffis
    Posted by Brad Griffis
    on Mar 06 2012 08:43 AM
    Guru57330 points

    Duh, sorry, I just noticed that the subject says OMAP3530!

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

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • David Eastburn
    Posted by David Eastburn
    on Mar 06 2012 09:50 AM
    Prodigy100 points

    In the sequence you listed, I only get hotplug events when insmod g_ether module (and musb_hdrc module which is a dependency for g_ether) and rmmod g_ether & musb_hdrc modules.  I do NOT get any hotplug event when plugging device into or removing from host PC via USB cable).

    • OTG is enabled
    • Only using in device mode (connecting to host PC and using Windows RNDIS driver)
    • Hotplug events only when g_ether/musb_hdrc modules installed or removed
    • Needing hotplug to detect device connection and removal from host PC to start/stop DHCP client and TFTP server via mdev; mdev part is working; just can't get hotplug events from kernel
    • For debugging, I've created a bash script that just dumps the env vars to a log file in tmp when a hotplug event occurs 'echo /usr/bin/hpdbg.sh > /proc/sys/kernel/hotplug'

    Attached is the

    • kernel cfg
    • bash shell script that is run when a hotplug event occurs
    • log files for hotplug events when installing/removing g_ether/musb_hdrc driver modules

    4213.hpdbg_rmmod.log

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • David Eastburn
    Posted by David Eastburn
    on Mar 06 2012 14:16 PM
    Prodigy100 points

    Attached is an archive of all the files mentioned in the previous post.  I didn't realize forum only allows one file per post.

    3660.hotplugging.zip

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • David Eastburn
    Posted by David Eastburn
    on Mar 07 2012 09:06 AM
    Prodigy100 points

    Found this post indicating that hot plug is not functional in musb driver in kernel ver 2.6.31, but may be fixed in 2.6.33

    http://gumstix.8.n6.nabble.com/USB-OTG-not-working-as-host-td662224.html


    On Thu, Jan 7, 2010 at 12:46 PM, zachlac <[hidden email]> wrote: 
    > 
    > I'd like to have two free USB ports, the normal Host port and the OTG port as 
    > a second host port.  The first host port works properly, but when I plug a 
    > slave device into the OTG port, nothing happens.  No messages on dmesg. 
    > It's configured in the kernel as Host through the linux-omap3-2.6.31.bb 
    > recipe.  Is there a module I need to load?  I'm using the Overo Water with 
    > the Tobi board. 

    On the musb (OTG) port devices must be plugged in at boot time to be 
    recognized -- hot plug is not yet functional. 

    I believe that this should be fixed in the 2.6.33 musb driver, but I 
    haven't verified that yet. 

    Steve 


    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Brad Griffis
    Posted by Brad Griffis
    on Mar 08 2012 08:28 AM
    Guru57330 points

    That's a good find.  I'm going to move this thread over to our Linux forum so we can get some commentary from the USB developers.

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

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Brad Griffis
    Posted by Brad Griffis
    on Mar 12 2012 10:12 AM
    Guru57330 points

    FYI, I'm still trying to get this in front of the right person.

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

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ajay
    Posted by Ajay
    on Mar 13 2012 01:19 AM
    Suggested Answer
    Genius9470 points

    David,

    musb controller while in OTG mode is known to switch of the SESSION when the device is disconnected and later reconnecting the device would not get detected on their own. One has to restart the session using either of below command available in particular kernel version:

    1) echo F > /proc/driver/musb_hdrc

    2) echo 1 > /sys/platform/devices/musb_hdrc/srp

    We have created a patch to resolve the same for v2.6.37 based TI PSP 04.02.00.07 release available at http://arago-project.org/git/projects/?p=linux-omap3.git;a=shortlog;h=refs/heads/OMAPPSP_04.02.00.07.

    The patch is attached here:

    3252.0001-usb-musb-omap-auto-vbus-control-across-host-and-devi.patch.txt

    This patch would not apply on v2.6.27 as there have been lot of changes in musb driver in v2.6.37.

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • David Eastburn
    Posted by David Eastburn
    on Mar 20 2012 11:35 AM
    Prodigy100 points

    Thanks for the response Ajay.  My only concern is I don't get a hot plug event when the device is initially connected.  I only get hot plug events when the driver is installed and uninstalled.  Does this work around cause a hot plug event for initial device connection?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ajay
    Posted by Ajay
    on Mar 20 2012 22:58 PM
    Verified Answer
    Verified by David Eastburn
    Genius9470 points

    Yes, this patch will help.

    Ajay

    If my reply answers your question then please click on the green button "Verify Answer"

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Anuj Aggarwal
    Posted by Anuj Aggarwal
    on May 02 2012 03:41 AM
    Expert3960 points

    Ajay,

    One of my customers is facing a similar issue, summary of the problem is captured below:

    ---

    We need to get hot-plug event with AM37x EVM as USB Gadget. There is requirement to mount/unmount encrypted file system (dm-crypt) in USB Mass Storage mode on the USB Plugin/out events.

    We do NOT get any hotplug event when plugging device into or removing from host PC via USB cable).

    • Peripheral mode is enabled
    • Only using in device mode (connecting to host PC via HUSB_OTG port and using Windows Mass Storage driver)
    • Hotplug events only when g_file_strorage or g_mass_storage modules installed or removed
    • Needing hotplug to detect device connection and removal from host PC to mount/unmount via cryptsetup; cryptsetup part is working; just can't get hotplug events from kernel
    • For debugging, there is a bash script that just dumps the env vars to a log file when a hotplug event occurs 'echo /usr/hotplug/hpdbg.sh > /proc/sys/kernel/hotplug'

    Attached is the:

    • kernel cfg
    • bash shell script that is run when a hotplug event occurs
    • log files for hotplug events when installing/removing g_file_strorage or g_mass_storage driver
    • dmesg log
    ----------

    They have also tried the patch, enabling the OTG, mentioned in this link but no difference observed in behavior. Can you help?

    Thanks.

    2311.hotplug-issue.zip

    Best Regards,

    Anuj Aggarwal

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

    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------------------------------

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Arun Joseph
    Posted by Arun Joseph
    on May 04 2012 00:31 AM
    Intellectual2260 points

    Hi,

    I have tried a patch for the usb connection detection and it is working in android.

    The following sysfs entry is changed whenever a host/peripheral connected

    /sys/devices/platform/musb-omap2430.0/musb-hdrc.0/mode

    In kernel, whenever the sysfs entry is changed we pass a uevent with this patch

    diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
    index efef5ff..2c240e1 100644
    --- a/drivers/usb/musb/musb_core.c
    +++ b/drivers/usb/musb/musb_core.c
    @@ -1894,6 +1894,7 @@ static void musb_irq_work(struct work_struct *data)
    if (musb->xceiv->state != old_state) {
    old_state = musb->xceiv->state;
    sysfs_notify(&musb->controller->kobj, NULL, "mode");
    + kobject_uevent(&musb->controller->kobj, KOBJ_CHANGE);
    }
    }

    The android vold (volume deamon) service listen to this uevent notification and does the required things. The android patch is available at 

    http://gitorious.org/rowboat/system-vold/commit/ea55061d003609eecafd26e62ea4e8786f3866df

    Regards,

    Arun

    If this post answers your query, consider clicking the Verify Answer button.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use