• Daniel Mack's avatar
    usb: musb: use is_host_active() to distinguish between host and gadget mode · c03da38d
    Daniel Mack authored
    On AM33xx platforms, unplugging a device in the middle of an active
    transfer leads to a drop of MUSB_DEVCTL_HM in MUSB_DEVCTL before the
    system is informed about a disconnect. This consequently makes the musb
    core call the gadget code to handle the interrupt request, which then
    crashes the kernel because the relevant pointers haven't been set up
    for gadget mode.
    
    To fix this, use is_host_active() rather than (devctl & MUSB_DEVCTL_HM)
    in musb_interrupt() and musb_dma_completion() to detect whether the
    controller is in host or peripheral mode. This information is provided
    by the driver logic and does not rely on register contents.
    Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
    Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
    c03da38d
musb_core.c 65.2 KB