File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 14
14
#include <linux/clk/renesas.h>
15
15
#include <linux/device.h>
16
16
#include <linux/io.h>
17
+ #include <linux/iopoll.h>
17
18
#include <linux/of.h>
18
19
#include <linux/of_address.h>
19
20
#include <linux/pm_clock.h>
@@ -78,8 +79,8 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
78
79
struct mstp_clock_group * group = clock -> group ;
79
80
u32 bitmask = BIT (clock -> bit_index );
80
81
unsigned long flags ;
81
- unsigned int i ;
82
82
u32 value ;
83
+ int ret ;
83
84
84
85
spin_lock_irqsave (& group -> lock , flags );
85
86
@@ -101,19 +102,14 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
101
102
if (!enable || !group -> mstpsr )
102
103
return 0 ;
103
104
104
- for (i = 1000 ; i > 0 ; -- i ) {
105
- if (!(cpg_mstp_read (group , group -> mstpsr ) & bitmask ))
106
- break ;
107
- cpu_relax ();
108
- }
109
-
110
- if (!i ) {
105
+ /* group->width_8bit is always false if group->mstpsr is present */
106
+ ret = readl_poll_timeout_atomic (group -> mstpsr , value ,
107
+ !(value & bitmask ), 0 , 10 );
108
+ if (ret )
111
109
pr_err ("%s: failed to enable %p[%d]\n" , __func__ ,
112
110
group -> smstpcr , clock -> bit_index );
113
- return - ETIMEDOUT ;
114
- }
115
111
116
- return 0 ;
112
+ return ret ;
117
113
}
118
114
119
115
static int cpg_mstp_clock_enable (struct clk_hw * hw )
You can’t perform that action at this time.
0 commit comments