Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 309d6d2b authored by Neil Zhang's avatar Neil Zhang Committed by Felipe Balbi
Browse files

usb: gadget: mv_udc: disable ISR when stopped



When device is stopped, there is no need to handle ISR.
Especially when otg switch to HOST mode.

Signed-off-by: default avatarNeil Zhang <zhangwm@marvell.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 487d54d1
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -211,7 +211,8 @@ struct mv_udc {
				softconnected:1,
				softconnected:1,
				force_fs:1,
				force_fs:1,
				clock_gating:1,
				clock_gating:1,
				active:1;
				active:1,
				stopped:1;      /* stop bit is setted */


	struct work_struct	vbus_work;
	struct work_struct	vbus_work;
	struct workqueue_struct *qwork;
	struct workqueue_struct *qwork;
+8 −0
Original line number Original line Diff line number Diff line
@@ -1056,6 +1056,8 @@ static void udc_stop(struct mv_udc *udc)
		USBINTR_PORT_CHANGE_DETECT_EN | USBINTR_RESET_EN);
		USBINTR_PORT_CHANGE_DETECT_EN | USBINTR_RESET_EN);
	writel(tmp, &udc->op_regs->usbintr);
	writel(tmp, &udc->op_regs->usbintr);


	udc->stopped = 1;

	/* Reset the Run the bit in the command register to stop VUSB */
	/* Reset the Run the bit in the command register to stop VUSB */
	tmp = readl(&udc->op_regs->usbcmd);
	tmp = readl(&udc->op_regs->usbcmd);
	tmp &= ~USBCMD_RUN_STOP;
	tmp &= ~USBCMD_RUN_STOP;
@@ -1072,6 +1074,8 @@ static void udc_start(struct mv_udc *udc)
	/* Enable interrupts */
	/* Enable interrupts */
	writel(usbintr, &udc->op_regs->usbintr);
	writel(usbintr, &udc->op_regs->usbintr);


	udc->stopped = 0;

	/* Set the Run bit in the command register */
	/* Set the Run bit in the command register */
	writel(USBCMD_RUN_STOP, &udc->op_regs->usbcmd);
	writel(USBCMD_RUN_STOP, &udc->op_regs->usbcmd);
}
}
@@ -2040,6 +2044,10 @@ static irqreturn_t mv_udc_irq(int irq, void *dev)
	struct mv_udc *udc = (struct mv_udc *)dev;
	struct mv_udc *udc = (struct mv_udc *)dev;
	u32 status, intr;
	u32 status, intr;


	/* Disable ISR when stopped bit is set */
	if (udc->stopped)
		return IRQ_NONE;

	spin_lock(&udc->lock);
	spin_lock(&udc->lock);


	status = readl(&udc->op_regs->usbsts);
	status = readl(&udc->op_regs->usbsts);