12
12
#include <linux/of_address.h>
13
13
#include <linux/io.h>
14
14
15
+ #include <dt-bindings/clock/at91.h>
16
+
15
17
#define SLOW_CLOCK_FREQ 32768
16
18
#define SLOWCK_SW_CYCLES 5
17
19
#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)
470
472
{
471
473
void __iomem * regbase = of_iomap (np , 0 );
472
474
struct clk_hw_onecell_data * clk_data ;
473
- struct clk_hw * slow_rc , * slow_osc ;
475
+ struct clk_hw * slow_rc , * slow_osc , * hw ;
474
476
const char * xtal_name ;
475
477
const struct clk_hw * parent_hws [2 ];
476
478
static struct clk_parent_data parent_data = {
@@ -506,19 +508,19 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
506
508
507
509
/* MD_SLCK and TD_SLCK. */
508
510
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 ))
513
514
goto clk_data_free ;
515
+ clk_data -> hws [SCKC_MD_SLCK ] = hw ;
514
516
515
517
parent_hws [0 ] = slow_rc ;
516
518
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 ))
521
522
goto unregister_md_slck ;
523
+ clk_data -> hws [SCKC_TD_SLCK ] = hw ;
522
524
523
525
ret = of_clk_add_hw_provider (np , of_clk_hw_onecell_get , clk_data );
524
526
if (WARN_ON (ret ))
@@ -527,9 +529,9 @@ static void __init of_sam9x60_sckc_setup(struct device_node *np)
527
529
return ;
528
530
529
531
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 ]);
531
533
unregister_md_slck :
532
- clk_hw_unregister (clk_data -> hws [0 ]);
534
+ clk_hw_unregister (clk_data -> hws [SCKC_MD_SLCK ]);
533
535
clk_data_free :
534
536
kfree (clk_data );
535
537
unregister_slow_osc :
0 commit comments