Commit 3eab3304 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

usb: musb: Use read_poll_timeout()

Use read_poll_timeout() instead of open coding it.
In the same time, fix the typo in the error message.
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230710094645.42111-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ce9daa2e
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
...@@ -1029,7 +1030,7 @@ static int tusb_musb_start(struct musb *musb) ...@@ -1029,7 +1030,7 @@ static int tusb_musb_start(struct musb *musb)
void __iomem *tbase = musb->ctrl_base; void __iomem *tbase = musb->ctrl_base;
unsigned long flags; unsigned long flags;
u32 reg; u32 reg;
int i; int ret;
/* /*
* Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
...@@ -1037,17 +1038,13 @@ static int tusb_musb_start(struct musb *musb) ...@@ -1037,17 +1038,13 @@ static int tusb_musb_start(struct musb *musb)
* provide then PGOOD signal to TUSB6010 which will release it from reset. * provide then PGOOD signal to TUSB6010 which will release it from reset.
*/ */
gpiod_set_value(glue->enable, 1); gpiod_set_value(glue->enable, 1);
msleep(1);
/* Wait for 100ms until TUSB6010 pulls INT pin down */ /* Wait for 100ms until TUSB6010 pulls INT pin down */
i = 100; ret = read_poll_timeout(gpiod_get_value, reg, !reg, 5000, 100000, true,
while (i && gpiod_get_value(glue->intpin)) { glue->intpin);
msleep(1); if (ret) {
i--; pr_err("tusb: Powerup response failed\n");
} return ret;
if (!i) {
pr_err("tusb: Powerup respones failed\n");
return -ENODEV;
} }
spin_lock_irqsave(&musb->lock, flags); spin_lock_irqsave(&musb->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment