Skip to content

Commit 802244f

Browse files
committed
clk: at91: sckc: Use SCKC_{TD, MD}_SLCK IDs for clk32k clocks
Use the newly introduced macros instead of raw numbers. With this the code is a bit easier to understand. Reviewed-by: Alexander Dahl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Claudiu Beznea <[email protected]>
1 parent d87daa1 commit 802244f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

drivers/clk/at91/sckc.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <linux/of_address.h>
1313
#include <linux/io.h>
1414

15+
#include <dt-bindings/clock/at91.h>
16+
1517
#define SLOW_CLOCK_FREQ 32768
1618
#define SLOWCK_SW_CYCLES 5
1719
#define SLOWCK_SW_TIME_USEC ((SLOWCK_SW_CYCLES * USEC_PER_SEC) / \
@@ -470,7 +472,7 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
470472
{
471473
void __iomem *regbase = of_iomap(np, 0);
472474
struct clk_hw_onecell_data *clk_data;
473-
struct clk_hw *slow_rc, *slow_osc;
475+
struct clk_hw *slow_rc, *slow_osc, *hw;
474476
const char *xtal_name;
475477
const struct clk_hw *parent_hws[2];
476478
static struct clk_parent_data parent_data = {
@@ -506,19 +508,19 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
506508

507509
/* MD_SLCK and TD_SLCK. */
508510
clk_data->num = 2;
509-
clk_data->hws[0] = clk_hw_register_fixed_rate_parent_hw(NULL, "md_slck",
510-
slow_rc,
511-
0, 32768);
512-
if (IS_ERR(clk_data->hws[0]))
511+
hw = clk_hw_register_fixed_rate_parent_hw(NULL, "md_slck", slow_rc,
512+
0, 32768);
513+
if (IS_ERR(hw))
513514
goto clk_data_free;
515+
clk_data->hws[SCKC_MD_SLCK] = hw;
514516

515517
parent_hws[0] = slow_rc;
516518
parent_hws[1] = slow_osc;
517-
clk_data->hws[1] = at91_clk_register_sam9x5_slow(regbase, "td_slck",
518-
parent_hws, 2,
519-
&at91sam9x60_bits);
520-
if (IS_ERR(clk_data->hws[1]))
519+
hw = at91_clk_register_sam9x5_slow(regbase, "td_slck", parent_hws,
520+
2, &at91sam9x60_bits);
521+
if (IS_ERR(hw))
521522
goto unregister_md_slck;
523+
clk_data->hws[SCKC_TD_SLCK] = hw;
522524

523525
ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data);
524526
if (WARN_ON(ret))
@@ -527,9 +529,9 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
527529
return;
528530

529531
unregister_td_slck:
530-
at91_clk_unregister_sam9x5_slow(clk_data->hws[1]);
532+
at91_clk_unregister_sam9x5_slow(clk_data->hws[SCKC_TD_SLCK]);
531533
unregister_md_slck:
532-
clk_hw_unregister(clk_data->hws[0]);
534+
clk_hw_unregister(clk_data->hws[SCKC_MD_SLCK]);
533535
clk_data_free:
534536
kfree(clk_data);
535537
unregister_slow_osc:

0 commit comments

Comments
 (0)