• David Brownell's avatar
    [PATCH] USB OTG: usbcore enumeration (3/5) · 1ae4eefe
    David Brownell authored
    Teach usbcore how to enumerate OTG devices and perform HNP:
    
     - CONFIG_USB_OTG is a boolean; it selects CONFIG_USB_SUSPEND.
       Boards with a Mini-AB connector should offer it as a config
       option; no other hardware could support OTG.
    
     - Before resetting a port, make sure it's not still suspended.
       (For example, after an HNP role switch.)
    
     - When an OTG A-Host enumerates a dual-role device, set the
       appropriate device feature:  B_HNP_ENABLE if it's connected
       to the OTG port, otherwise A_ALT_HNP_SUPPORT.
    
     - When an OTG B-Host enumerates a dual-role device, don't
       bother debouncing ... the power session is stable already,
       the A-Host already debounced.
    
     - The OTG "Targeted Peripheral List" lives in a product-customized
       "otg_whitelist.h" header.
    
     - CONFIG_USB_OTG_WHITELIST lets developers choose to ignore whitelist
       failures, so unsupported devices can be configured anyway.
    
     - If the whitelist check fails, immediately suspend the device.
    
        * For dual-role devices, that triggers HNP so the other device
          can try to act as host.
    
        * For peripheral-only devices, that conserves power ... but not
          quite as much as turning off power on that port, which should
          eventually be done with OTG ports (and all other ports that
          support SRP).
    
    The whitelist logic tries to make use of the existing usb_device_id
    logic, but since the interface info isn't available that early it's
    a bit awkward use information anywhere outside the device descriptor.
    Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    1ae4eefe
hub.c 73.8 KB