tools headers UAPI: Sync kvm.h headers with the kernel sources
[linux-2.6-microblaze.git] / drivers / clk / mxs / clk.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright 2012 Freescale Semiconductor, Inc.
4  */
5
6 #include <linux/err.h>
7 #include <linux/io.h>
8 #include <linux/jiffies.h>
9 #include <linux/spinlock.h>
10 #include "clk.h"
11
12 DEFINE_SPINLOCK(mxs_lock);
13
14 int mxs_clk_wait(void __iomem *reg, u8 shift)
15 {
16         unsigned long timeout = jiffies + msecs_to_jiffies(10);
17
18         while (readl_relaxed(reg) & (1 << shift))
19                 if (time_after(jiffies, timeout))
20                         return -ETIMEDOUT;
21
22         return 0;
23 }