File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 7
7
#include <linux/clk-provider.h>
8
8
#include <linux/delay.h>
9
9
#include <linux/io.h>
10
+ #include <linux/iopoll.h>
10
11
#include <linux/slab.h>
11
12
#include <linux/jiffies.h>
12
13
#include <linux/err.h>
25
26
#define IMX7_ENET_PLL_POWER (0x1 << 5)
26
27
#define IMX7_DDR_PLL_POWER (0x1 << 20)
27
28
29
+ #define PLL_LOCK_TIMEOUT 10000
30
+
28
31
/**
29
32
* struct clk_pllv3 - IMX PLL clock version 3
30
33
* @clk_hw: clock source
@@ -53,23 +56,14 @@ struct clk_pllv3 {
53
56
54
57
static int clk_pllv3_wait_lock (struct clk_pllv3 * pll )
55
58
{
56
- unsigned long timeout = jiffies + msecs_to_jiffies (10 );
57
59
u32 val = readl_relaxed (pll -> base ) & pll -> power_bit ;
58
60
59
61
/* No need to wait for lock when pll is not powered up */
60
62
if ((pll -> powerup_set && !val ) || (!pll -> powerup_set && val ))
61
63
return 0 ;
62
64
63
- /* Wait for PLL to lock */
64
- do {
65
- if (readl_relaxed (pll -> base ) & BM_PLL_LOCK )
66
- break ;
67
- if (time_after (jiffies , timeout ))
68
- break ;
69
- usleep_range (50 , 500 );
70
- } while (1 );
71
-
72
- return readl_relaxed (pll -> base ) & BM_PLL_LOCK ? 0 : - ETIMEDOUT ;
65
+ return readl_relaxed_poll_timeout (pll -> base , val , val & BM_PLL_LOCK ,
66
+ 500 , PLL_LOCK_TIMEOUT );
73
67
}
74
68
75
69
static int clk_pllv3_prepare (struct clk_hw * hw )
You can’t perform that action at this time.
0 commit comments