15
15
#include "clk.h"
16
16
17
17
#define GNRL_CTL 0x0
18
- #define DIV_CTL 0x4
18
+ #define DIV_CTL0 0x4
19
+ #define DIV_CTL1 0x8
19
20
#define LOCK_STATUS BIT(31)
20
21
#define LOCK_SEL_MASK BIT(29)
21
22
#define CLKE_MASK BIT(11)
@@ -122,7 +123,7 @@ static unsigned long clk_pll1416x_recalc_rate(struct clk_hw *hw,
122
123
u32 mdiv , pdiv , sdiv , pll_div ;
123
124
u64 fvco = parent_rate ;
124
125
125
- pll_div = readl_relaxed (pll -> base + 4 );
126
+ pll_div = readl_relaxed (pll -> base + DIV_CTL0 );
126
127
mdiv = (pll_div & MDIV_MASK ) >> MDIV_SHIFT ;
127
128
pdiv = (pll_div & PDIV_MASK ) >> PDIV_SHIFT ;
128
129
sdiv = (pll_div & SDIV_MASK ) >> SDIV_SHIFT ;
@@ -141,8 +142,8 @@ static unsigned long clk_pll1443x_recalc_rate(struct clk_hw *hw,
141
142
short int kdiv ;
142
143
u64 fvco = parent_rate ;
143
144
144
- pll_div_ctl0 = readl_relaxed (pll -> base + 4 );
145
- pll_div_ctl1 = readl_relaxed (pll -> base + 8 );
145
+ pll_div_ctl0 = readl_relaxed (pll -> base + DIV_CTL0 );
146
+ pll_div_ctl1 = readl_relaxed (pll -> base + DIV_CTL1 );
146
147
mdiv = (pll_div_ctl0 & MDIV_MASK ) >> MDIV_SHIFT ;
147
148
pdiv = (pll_div_ctl0 & PDIV_MASK ) >> PDIV_SHIFT ;
148
149
sdiv = (pll_div_ctl0 & SDIV_MASK ) >> SDIV_SHIFT ;
@@ -172,7 +173,7 @@ static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll)
172
173
{
173
174
u32 val ;
174
175
175
- return readl_poll_timeout (pll -> base , val , val & LOCK_STATUS , 0 ,
176
+ return readl_poll_timeout (pll -> base + GNRL_CTL , val , val & LOCK_STATUS , 0 ,
176
177
LOCK_TIMEOUT_US );
177
178
}
178
179
@@ -191,32 +192,32 @@ static int clk_pll1416x_set_rate(struct clk_hw *hw, unsigned long drate,
191
192
return - EINVAL ;
192
193
}
193
194
194
- tmp = readl_relaxed (pll -> base + 4 );
195
+ tmp = readl_relaxed (pll -> base + DIV_CTL0 );
195
196
196
197
if (!clk_pll14xx_mp_change (rate , tmp )) {
197
198
tmp &= ~(SDIV_MASK ) << SDIV_SHIFT ;
198
199
tmp |= rate -> sdiv << SDIV_SHIFT ;
199
- writel_relaxed (tmp , pll -> base + 4 );
200
+ writel_relaxed (tmp , pll -> base + DIV_CTL0 );
200
201
201
202
return 0 ;
202
203
}
203
204
204
205
/* Bypass clock and set lock to pll output lock */
205
- tmp = readl_relaxed (pll -> base );
206
+ tmp = readl_relaxed (pll -> base + GNRL_CTL );
206
207
tmp |= LOCK_SEL_MASK ;
207
- writel_relaxed (tmp , pll -> base );
208
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
208
209
209
210
/* Enable RST */
210
211
tmp &= ~RST_MASK ;
211
- writel_relaxed (tmp , pll -> base );
212
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
212
213
213
214
/* Enable BYPASS */
214
215
tmp |= BYPASS_MASK ;
215
- writel (tmp , pll -> base );
216
+ writel (tmp , pll -> base + GNRL_CTL );
216
217
217
218
div_val = (rate -> mdiv << MDIV_SHIFT ) | (rate -> pdiv << PDIV_SHIFT ) |
218
219
(rate -> sdiv << SDIV_SHIFT );
219
- writel_relaxed (div_val , pll -> base + 0x4 );
220
+ writel_relaxed (div_val , pll -> base + DIV_CTL0 );
220
221
221
222
/*
222
223
* According to SPEC, t3 - t2 need to be greater than
@@ -228,7 +229,7 @@ static int clk_pll1416x_set_rate(struct clk_hw *hw, unsigned long drate,
228
229
229
230
/* Disable RST */
230
231
tmp |= RST_MASK ;
231
- writel_relaxed (tmp , pll -> base );
232
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
232
233
233
234
/* Wait Lock */
234
235
ret = clk_pll14xx_wait_lock (pll );
@@ -237,7 +238,7 @@ static int clk_pll1416x_set_rate(struct clk_hw *hw, unsigned long drate,
237
238
238
239
/* Bypass */
239
240
tmp &= ~BYPASS_MASK ;
240
- writel_relaxed (tmp , pll -> base );
241
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
241
242
242
243
return 0 ;
243
244
}
@@ -257,32 +258,32 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate,
257
258
return - EINVAL ;
258
259
}
259
260
260
- tmp = readl_relaxed (pll -> base + 4 );
261
+ tmp = readl_relaxed (pll -> base + DIV_CTL0 );
261
262
262
263
if (!clk_pll14xx_mp_change (rate , tmp )) {
263
264
tmp &= ~(SDIV_MASK ) << SDIV_SHIFT ;
264
265
tmp |= rate -> sdiv << SDIV_SHIFT ;
265
- writel_relaxed (tmp , pll -> base + 4 );
266
+ writel_relaxed (tmp , pll -> base + DIV_CTL0 );
266
267
267
268
tmp = rate -> kdiv << KDIV_SHIFT ;
268
- writel_relaxed (tmp , pll -> base + 8 );
269
+ writel_relaxed (tmp , pll -> base + DIV_CTL1 );
269
270
270
271
return 0 ;
271
272
}
272
273
273
274
/* Enable RST */
274
- tmp = readl_relaxed (pll -> base );
275
+ tmp = readl_relaxed (pll -> base + GNRL_CTL );
275
276
tmp &= ~RST_MASK ;
276
- writel_relaxed (tmp , pll -> base );
277
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
277
278
278
279
/* Enable BYPASS */
279
280
tmp |= BYPASS_MASK ;
280
- writel_relaxed (tmp , pll -> base );
281
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
281
282
282
283
div_val = (rate -> mdiv << MDIV_SHIFT ) | (rate -> pdiv << PDIV_SHIFT ) |
283
284
(rate -> sdiv << SDIV_SHIFT );
284
- writel_relaxed (div_val , pll -> base + 0x4 );
285
- writel_relaxed (rate -> kdiv << KDIV_SHIFT , pll -> base + 0x8 );
285
+ writel_relaxed (div_val , pll -> base + DIV_CTL0 );
286
+ writel_relaxed (rate -> kdiv << KDIV_SHIFT , pll -> base + DIV_CTL1 );
286
287
287
288
/*
288
289
* According to SPEC, t3 - t2 need to be greater than
@@ -294,7 +295,7 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate,
294
295
295
296
/* Disable RST */
296
297
tmp |= RST_MASK ;
297
- writel_relaxed (tmp , pll -> base );
298
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
298
299
299
300
/* Wait Lock*/
300
301
ret = clk_pll14xx_wait_lock (pll );
@@ -303,7 +304,7 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate,
303
304
304
305
/* Bypass */
305
306
tmp &= ~BYPASS_MASK ;
306
- writel_relaxed (tmp , pll -> base );
307
+ writel_relaxed (tmp , pll -> base + GNRL_CTL );
307
308
308
309
return 0 ;
309
310
}
0 commit comments