Commit f158afec authored by Chunfeng Yun's avatar Chunfeng Yun Committed by Greg Kroah-Hartman
Browse files

usb: phy: phy-mv-usb: convert to readl_poll_timeout_atomic()

parent a3e20fbd
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/uaccess.h>
#include <linux/device.h>
#include <linux/proc_fs.h>
@@ -135,8 +136,8 @@ static int mv_otg_set_timer(struct mv_otg *mvotg, unsigned int id,

static int mv_otg_reset(struct mv_otg *mvotg)
{
	unsigned int loops;
	u32 tmp;
	int ret;

	/* Stop the controller */
	tmp = readl(&mvotg->op_regs->usbcmd);
@@ -146,15 +147,12 @@ static int mv_otg_reset(struct mv_otg *mvotg)
	/* Reset the controller to get default values */
	writel(USBCMD_CTRL_RESET, &mvotg->op_regs->usbcmd);

	loops = 500;
	while (readl(&mvotg->op_regs->usbcmd) & USBCMD_CTRL_RESET) {
		if (loops == 0) {
	ret = readl_poll_timeout_atomic(&mvotg->op_regs->usbcmd, tmp,
				(tmp & USBCMD_CTRL_RESET), 10, 10000);
	if (ret < 0) {
		dev_err(&mvotg->pdev->dev,
			"Wait for RESET completed TIMEOUT\n");
			return -ETIMEDOUT;
		}
		loops--;
		udelay(20);
		return ret;
	}

	writel(0x0, &mvotg->op_regs->usbintr);