WIP FPC-III support
[linux/fpc-iii.git] / drivers / clk / mxs / clk.c
blob2fe78ba990a0c7a62332a07e55bd99bb08238597
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright 2012 Freescale Semiconductor, Inc.
4 */
6 #include <linux/err.h>
7 #include <linux/io.h>
8 #include <linux/jiffies.h>
9 #include <linux/spinlock.h>
10 #include "clk.h"
12 DEFINE_SPINLOCK(mxs_lock);
14 int mxs_clk_wait(void __iomem *reg, u8 shift)
16 unsigned long timeout = jiffies + msecs_to_jiffies(10);
18 while (readl_relaxed(reg) & (1 << shift))
19 if (time_after(jiffies, timeout))
20 return -ETIMEDOUT;
22 return 0;