• Jonas Bonn's avatar
    usb: gadget: atmel: support USB suspend · 70a7f8be
    Jonas Bonn authored
    This patch adds support for USB suspend to the Atmel UDC.
    
    When suspended, the UDC clock can be stopped, resulting in some power
    savings.  The "wake up" interrupt will fire irregardless of whether the
    clock is running or not, allowing the UDC clock to be restarted when the
    USB master wants to wake the device again.
    
    The IRQ state of this device is somewhat fiddly.  The "wake up" IRQ
    seems to actually be a "bus activity" indicator; the IRQ is almost
    continuously asserted so enabling this IRQ should only be done after a
    suspend when the wake IRQ becomes relevant.  Similarly, the "suspend"
    IRQ detects "bus inactivity" and may therefore fire together with a
    "wake" if the two types of activity coincide during the period between
    two IRQ handler invocations; therefore, it's important to ignore the
    "suspend" IRQ while waiting for a wake-up.
    
    This has been tested on a SAMA5D2 board.
    Signed-off-by: default avatarJonas Bonn <jonas@norrbonn.se>
    CC: Cristian Birsan <cristian.birsan@microchip.com>
    CC: Felipe Balbi <balbi@kernel.org>
    CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    CC: Nicolas Ferre <nicolas.ferre@microchip.com>
    CC: Alexandre Belloni <alexandre.belloni@bootlin.com>
    CC: Ludovic Desroches <ludovic.desroches@microchip.com>
    CC: linux-arm-kernel@lists.infradead.org
    CC: linux-usb@vger.kernel.org
    Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
    70a7f8be
atmel_usba_udc.h 9.77 KB