2019-05-27 06:55:08 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2012-04-28 16:02:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Freescale Semiconductor, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/jiffies.h>
|
|
|
|
#include <linux/spinlock.h>
|
2013-02-11 14:07:16 +00:00
|
|
|
#include "clk.h"
|
2012-04-28 16:02:34 +00:00
|
|
|
|
|
|
|
DEFINE_SPINLOCK(mxs_lock);
|
|
|
|
|
|
|
|
int mxs_clk_wait(void __iomem *reg, u8 shift)
|
|
|
|
{
|
|
|
|
unsigned long timeout = jiffies + msecs_to_jiffies(10);
|
|
|
|
|
|
|
|
while (readl_relaxed(reg) & (1 << shift))
|
|
|
|
if (time_after(jiffies, timeout))
|
|
|
|
return -ETIMEDOUT;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|