summaryrefslogtreecommitdiff
path: root/drivers/usb/musb-new/sunxi.c
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>2015-10-25 04:44:47 (GMT)
committerHans de Goede <hdegoede@redhat.com>2015-11-22 10:30:59 (GMT)
commit6047a3a9c9cf88c38b0b7b99bfeb4edf6661acc8 (patch)
tree39c098c0e263ed78b1a7a422eda089386dbe8243 /drivers/usb/musb-new/sunxi.c
parent2a909c5f7a4e645260e5d01313e15371a8c55eba (diff)
downloadu-boot-6047a3a9c9cf88c38b0b7b99bfeb4edf6661acc8.tar.xz
sunxi: musb: Implement dfu_usb_get_reset()
This is necessary to distinguish between the "dfu-util --detach" and the "dfu-util --reset" requests. The default weak implementation of dfu_usb_get_reset() unconditionally reboots the device, but we want to be able to continue the boot.scr execution after writing the kernel, fdt and ramdisk to RAM via DFU. Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/usb/musb-new/sunxi.c')
-rw-r--r--drivers/usb/musb-new/sunxi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index a146c08..5eb8d19 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -166,6 +166,17 @@ static void USBC_ConfigFIFO_Base(void)
}
/******************************************************************************
+ * Needed for the DFU polling magic
+ ******************************************************************************/
+
+static u8 last_int_usb;
+
+bool dfu_usb_get_reset(void)
+{
+ return !!(last_int_usb & MUSB_INTR_RESET);
+}
+
+/******************************************************************************
* MUSB Glue code
******************************************************************************/
@@ -176,6 +187,7 @@ static irqreturn_t sunxi_musb_interrupt(int irq, void *__hci)
/* read and flush interrupts */
musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
+ last_int_usb = musb->int_usb;
if (musb->int_usb)
musb_writeb(musb->mregs, MUSB_INTRUSB, musb->int_usb);
musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);