Skip to content

Commit

Permalink
sunxi: musb: Implement dfu_usb_get_reset()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
  • Loading branch information
ssvb authored and jwrdegoede committed Nov 22, 2015
1 parent 2a909c5 commit 6047a3a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/usb/musb-new/sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ static void USBC_ConfigFIFO_Base(void)
writel(reg_value, SUNXI_SRAMC_BASE + 0x04);
}

/******************************************************************************
* 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
******************************************************************************/
Expand All @@ -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);
Expand Down

0 comments on commit 6047a3a

Please sign in to comment.