Skip to content

Commit 7d14098

Browse files
Sowjanya Komatinenithierryreding
authored andcommitted
gpu: host1x: mipi: Use readl_relaxed_poll_timeout() in tegra_mipi_wait()
Use readl_relaxed_poll_timeout() in tegra_mipi_wait() to simplify the code. Signed-off-by: Sowjanya Komatineni <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 767598d commit 7d14098

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

drivers/gpu/host1x/mipi.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
*/
2222

2323
#include <linux/clk.h>
24-
#include <linux/delay.h>
2524
#include <linux/host1x.h>
2625
#include <linux/io.h>
26+
#include <linux/iopoll.h>
2727
#include <linux/of_platform.h>
2828
#include <linux/platform_device.h>
2929
#include <linux/slab.h>
@@ -295,19 +295,15 @@ EXPORT_SYMBOL(tegra_mipi_disable);
295295

296296
static int tegra_mipi_wait(struct tegra_mipi *mipi)
297297
{
298-
unsigned long timeout = jiffies + msecs_to_jiffies(250);
298+
void __iomem *status_reg = mipi->regs + (MIPI_CAL_STATUS << 2);
299299
u32 value;
300+
int err;
300301

301-
while (time_before(jiffies, timeout)) {
302-
value = tegra_mipi_readl(mipi, MIPI_CAL_STATUS);
303-
if ((value & MIPI_CAL_STATUS_ACTIVE) == 0 &&
304-
(value & MIPI_CAL_STATUS_DONE) != 0)
305-
return 0;
306-
307-
usleep_range(10, 50);
308-
}
309-
310-
return -ETIMEDOUT;
302+
err = readl_relaxed_poll_timeout(status_reg, value,
303+
!(value & MIPI_CAL_STATUS_ACTIVE) &&
304+
(value & MIPI_CAL_STATUS_DONE), 50,
305+
250000);
306+
return err;
311307
}
312308

313309
int tegra_mipi_calibrate(struct tegra_mipi_device *device)

0 commit comments

Comments
 (0)