[U-Boot] [PATCH v4 3/4] drivers: musb-new: Add USB DRC driver for Microchip PIC32 OTG controller.

Marek Vasut marex at denx.de
Fri Mar 18 15:21:54 CET 2016


On 03/18/2016 02:50 PM, Purna Chandra Mandal wrote:
> This driver adds support of PIC32 MUSB OTG controller as dual role device.
> It implements platform specific glue to reuse musb core.
> 
> Signed-off-by: Cristian Birsan <cristian.birsan at microchip.com>
> Signed-off-by: Purna Chandra Mandal <purna.mandal at microchip.com>
> 
> ---
> 
> Changes in v4:
> - add support to handle multiple MUSB controllers.
> - remove unaligned buffer handling in musb_read_fifo
> - update comment and error prints

Nice, thanks.

> Changes in v3: None
> Changes in v2: None
> 
>  drivers/usb/musb-new/Kconfig     |   7 +
>  drivers/usb/musb-new/Makefile    |   1 +
>  drivers/usb/musb-new/musb_core.c |   2 +-
>  drivers/usb/musb-new/pic32.c     | 288 +++++++++++++++++++++++++++++++++++++++
>  4 files changed, 297 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/usb/musb-new/pic32.c

[...]

> +static irqreturn_t pic32_interrupt(int irq, void *hci)
> +{
> +	struct musb  *musb = hci;
> +	irqreturn_t ret = IRQ_NONE;
> +	u32 epintr, usbintr;
> +
> +	/* ack usb core interrupts */
> +	musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
> +	if (musb->int_usb)
> +		musb_writeb(musb->mregs, MUSB_INTRUSB, musb->int_usb);
> +
> +	/* ack endpoint interrupts */
> +	musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX) & PIC32_RX_EP_MASK;
> +	if (musb->int_rx)
> +		musb_writew(musb->mregs, MUSB_INTRRX, musb->int_rx);
> +
> +	musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX) & PIC32_TX_EP_MASK;
> +	if (musb->int_tx)
> +		musb_writew(musb->mregs, MUSB_INTRTX, musb->int_tx);
> +
> +	/* drop spurious RX and TX if device is disconnected */
> +	if (musb->int_usb & MUSB_INTR_DISCONNECT) {
> +		musb->int_tx = 0;
> +		musb->int_rx = 0;
> +	}
> +
> +	if (musb->int_tx || musb->int_rx || musb->int_usb)
> +		ret |= musb_interrupt(musb);

Use ret = , don't ORR the return value as that's wrong and can produce
completely mangled return value.

> +	return ret;
> +}

[...]

The rest is good, thanks for persevering :) Please drop me a V5 so I can
apply the series.

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list