Skip to content

Commit c3aa8c7

Browse files
nunojsabebarino
authored andcommitted
clk: clk-axi-clkgen: fix coding style issues
This is just cosmetics and so no functional changes intended. While at it, sort header in alphabetical order. Signed-off-by: Nuno Sá <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: David Lechner <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 34e42e9 commit c3aa8c7

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

drivers/clk/clk-axi-clkgen.c

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
#include <linux/adi-axi-common.h>
1010
#include <linux/bits.h>
11-
#include <linux/platform_device.h>
1211
#include <linux/clk.h>
1312
#include <linux/clk-provider.h>
14-
#include <linux/slab.h>
13+
#include <linux/err.h>
1514
#include <linux/io.h>
16-
#include <linux/of.h>
1715
#include <linux/module.h>
1816
#include <linux/mod_devicetable.h>
19-
#include <linux/err.h>
17+
#include <linux/of.h>
18+
#include <linux/platform_device.h>
19+
#include <linux/slab.h>
2020

2121
#define AXI_CLKGEN_V2_REG_RESET 0x40
2222
#define AXI_CLKGEN_V2_REG_CLKSEL 0x44
@@ -96,7 +96,7 @@ static uint32_t axi_clkgen_lookup_filter(unsigned int m)
9696
}
9797
}
9898

99-
static const uint32_t axi_clkgen_lock_table[] = {
99+
static const u32 axi_clkgen_lock_table[] = {
100100
0x060603e8, 0x060603e8, 0x080803e8, 0x0b0b03e8,
101101
0x0e0e03e8, 0x111103e8, 0x131303e8, 0x161603e8,
102102
0x191903e8, 0x1c1c03e8, 0x1f1f0384, 0x1f1f0339,
@@ -108,7 +108,7 @@ static const uint32_t axi_clkgen_lock_table[] = {
108108
0x1f1f012c, 0x1f1f0113, 0x1f1f0113, 0x1f1f0113,
109109
};
110110

111-
static uint32_t axi_clkgen_lookup_lock(unsigned int m)
111+
static u32 axi_clkgen_lookup_lock(unsigned int m)
112112
{
113113
if (m < ARRAY_SIZE(axi_clkgen_lock_table))
114114
return axi_clkgen_lock_table[m];
@@ -130,8 +130,9 @@ static const struct axi_clkgen_limits axi_clkgen_zynq_default_limits = {
130130
};
131131

132132
static void axi_clkgen_calc_params(const struct axi_clkgen_limits *limits,
133-
unsigned long fin, unsigned long fout,
134-
unsigned int *best_d, unsigned int *best_m, unsigned int *best_dout)
133+
unsigned long fin, unsigned long fout,
134+
unsigned int *best_d, unsigned int *best_m,
135+
unsigned int *best_dout)
135136
{
136137
unsigned long d, d_min, d_max, _d_min, _d_max;
137138
unsigned long m, m_min, m_max;
@@ -198,9 +199,9 @@ struct axi_clkgen_div_params {
198199
};
199200

200201
static void axi_clkgen_calc_clk_params(unsigned int divider,
201-
unsigned int frac_divider, struct axi_clkgen_div_params *params)
202+
unsigned int frac_divider,
203+
struct axi_clkgen_div_params *params)
202204
{
203-
204205
memset(params, 0x0, sizeof(*params));
205206

206207
if (divider == 1) {
@@ -228,21 +229,21 @@ static void axi_clkgen_calc_clk_params(unsigned int divider,
228229
if (params->edge == 0 || frac_divider == 1)
229230
params->low--;
230231
if (((params->edge == 0) ^ (frac_divider == 1)) ||
231-
(divider == 2 && frac_divider == 1))
232+
(divider == 2 && frac_divider == 1))
232233
params->frac_wf_f = 1;
233234

234235
params->frac_phase = params->edge * 4 + frac_divider / 2;
235236
}
236237
}
237238

238239
static void axi_clkgen_write(struct axi_clkgen *axi_clkgen,
239-
unsigned int reg, unsigned int val)
240+
unsigned int reg, unsigned int val)
240241
{
241242
writel(val, axi_clkgen->base + reg);
242243
}
243244

244245
static void axi_clkgen_read(struct axi_clkgen *axi_clkgen,
245-
unsigned int reg, unsigned int *val)
246+
unsigned int reg, unsigned int *val)
246247
{
247248
*val = readl(axi_clkgen->base + reg);
248249
}
@@ -263,7 +264,7 @@ static int axi_clkgen_wait_non_busy(struct axi_clkgen *axi_clkgen)
263264
}
264265

265266
static int axi_clkgen_mmcm_read(struct axi_clkgen *axi_clkgen,
266-
unsigned int reg, unsigned int *val)
267+
unsigned int reg, unsigned int *val)
267268
{
268269
unsigned int reg_val;
269270
int ret;
@@ -287,7 +288,8 @@ static int axi_clkgen_mmcm_read(struct axi_clkgen *axi_clkgen,
287288
}
288289

289290
static int axi_clkgen_mmcm_write(struct axi_clkgen *axi_clkgen,
290-
unsigned int reg, unsigned int val, unsigned int mask)
291+
unsigned int reg, unsigned int val,
292+
unsigned int mask)
291293
{
292294
unsigned int reg_val = 0;
293295
int ret;
@@ -308,8 +310,7 @@ static int axi_clkgen_mmcm_write(struct axi_clkgen *axi_clkgen,
308310
return 0;
309311
}
310312

311-
static void axi_clkgen_mmcm_enable(struct axi_clkgen *axi_clkgen,
312-
bool enable)
313+
static void axi_clkgen_mmcm_enable(struct axi_clkgen *axi_clkgen, bool enable)
313314
{
314315
unsigned int val = AXI_CLKGEN_V2_RESET_ENABLE;
315316

@@ -325,31 +326,31 @@ static struct axi_clkgen *clk_hw_to_axi_clkgen(struct clk_hw *clk_hw)
325326
}
326327

327328
static void axi_clkgen_set_div(struct axi_clkgen *axi_clkgen,
328-
unsigned int reg1, unsigned int reg2, unsigned int reg3,
329-
struct axi_clkgen_div_params *params)
329+
unsigned int reg1, unsigned int reg2,
330+
unsigned int reg3,
331+
struct axi_clkgen_div_params *params)
330332
{
331333
axi_clkgen_mmcm_write(axi_clkgen, reg1,
332-
(params->high << 6) | params->low, 0xefff);
334+
(params->high << 6) | params->low, 0xefff);
333335
axi_clkgen_mmcm_write(axi_clkgen, reg2,
334-
(params->frac << 12) | (params->frac_en << 11) |
335-
(params->frac_wf_r << 10) | (params->edge << 7) |
336-
(params->nocount << 6), 0x7fff);
336+
(params->frac << 12) | (params->frac_en << 11) |
337+
(params->frac_wf_r << 10) | (params->edge << 7) |
338+
(params->nocount << 6), 0x7fff);
337339
if (reg3 != 0) {
338340
axi_clkgen_mmcm_write(axi_clkgen, reg3,
339-
(params->frac_phase << 11) | (params->frac_wf_f << 10), 0x3c00);
341+
(params->frac_phase << 11) | (params->frac_wf_f << 10),
342+
0x3c00);
340343
}
341344
}
342345

343-
static int axi_clkgen_set_rate(struct clk_hw *clk_hw,
344-
unsigned long rate, unsigned long parent_rate)
346+
static int axi_clkgen_set_rate(struct clk_hw *clk_hw, unsigned long rate,
347+
unsigned long parent_rate)
345348
{
346349
struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw);
347350
const struct axi_clkgen_limits *limits = &axi_clkgen->limits;
348351
unsigned int d, m, dout;
349352
struct axi_clkgen_div_params params;
350-
uint32_t power = 0;
351-
uint32_t filter;
352-
uint32_t lock;
353+
u32 power = 0, filter, lock;
353354

354355
if (parent_rate == 0 || rate == 0)
355356
return -EINVAL;
@@ -369,22 +370,22 @@ static int axi_clkgen_set_rate(struct clk_hw *clk_hw,
369370

370371
axi_clkgen_calc_clk_params(dout >> 3, dout & 0x7, &params);
371372
axi_clkgen_set_div(axi_clkgen, MMCM_REG_CLKOUT0_1, MMCM_REG_CLKOUT0_2,
372-
MMCM_REG_CLKOUT5_2, &params);
373+
MMCM_REG_CLKOUT5_2, &params);
373374

374375
axi_clkgen_calc_clk_params(d, 0, &params);
375376
axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_CLK_DIV,
376-
(params.edge << 13) | (params.nocount << 12) |
377-
(params.high << 6) | params.low, 0x3fff);
377+
(params.edge << 13) | (params.nocount << 12) |
378+
(params.high << 6) | params.low, 0x3fff);
378379

379380
axi_clkgen_calc_clk_params(m >> 3, m & 0x7, &params);
380381
axi_clkgen_set_div(axi_clkgen, MMCM_REG_CLK_FB1, MMCM_REG_CLK_FB2,
381-
MMCM_REG_CLKOUT6_2, &params);
382+
MMCM_REG_CLKOUT6_2, &params);
382383

383384
axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK1, lock & 0x3ff, 0x3ff);
384385
axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK2,
385-
(((lock >> 16) & 0x1f) << 10) | 0x1, 0x7fff);
386+
(((lock >> 16) & 0x1f) << 10) | 0x1, 0x7fff);
386387
axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_LOCK3,
387-
(((lock >> 24) & 0x1f) << 10) | 0x3e9, 0x7fff);
388+
(((lock >> 24) & 0x1f) << 10) | 0x3e9, 0x7fff);
388389
axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_FILTER1, filter >> 16, 0x9900);
389390
axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_FILTER2, filter, 0x9900);
390391

@@ -413,7 +414,7 @@ static int axi_clkgen_determine_rate(struct clk_hw *hw,
413414
}
414415

415416
static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen,
416-
unsigned int reg1, unsigned int reg2)
417+
unsigned int reg1, unsigned int reg2)
417418
{
418419
unsigned int val1, val2;
419420
unsigned int div;
@@ -440,17 +441,17 @@ static unsigned int axi_clkgen_get_div(struct axi_clkgen *axi_clkgen,
440441
}
441442

442443
static unsigned long axi_clkgen_recalc_rate(struct clk_hw *clk_hw,
443-
unsigned long parent_rate)
444+
unsigned long parent_rate)
444445
{
445446
struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw);
446447
unsigned int d, m, dout;
447448
unsigned long long tmp;
448449
unsigned int val;
449450

450451
dout = axi_clkgen_get_div(axi_clkgen, MMCM_REG_CLKOUT0_1,
451-
MMCM_REG_CLKOUT0_2);
452+
MMCM_REG_CLKOUT0_2);
452453
m = axi_clkgen_get_div(axi_clkgen, MMCM_REG_CLK_FB1,
453-
MMCM_REG_CLK_FB2);
454+
MMCM_REG_CLK_FB2);
454455

455456
axi_clkgen_mmcm_read(axi_clkgen, MMCM_REG_CLK_DIV, &val);
456457
if (val & MMCM_CLK_DIV_NOCOUNT)
@@ -623,7 +624,7 @@ static int axi_clkgen_probe(struct platform_device *pdev)
623624

624625
clk_name = pdev->dev.of_node->name;
625626
of_property_read_string(pdev->dev.of_node, "clock-output-names",
626-
&clk_name);
627+
&clk_name);
627628

628629
init.name = clk_name;
629630
init.ops = &axi_clkgen_ops;

0 commit comments

Comments
 (0)