diff options
Diffstat (limited to 'drivers/clk/hisilicon/clk-hi3xxx.c')
-rw-r--r-- | drivers/clk/hisilicon/clk-hi3xxx.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/clk/hisilicon/clk-hi3xxx.c b/drivers/clk/hisilicon/clk-hi3xxx.c index 9682517edfd..72115a5763b 100644 --- a/drivers/clk/hisilicon/clk-hi3xxx.c +++ b/drivers/clk/hisilicon/clk-hi3xxx.c @@ -561,8 +561,7 @@ void __init hi3620_clkdiv_setup(struct device_node *np) unsigned int table_num; int i; u32 data[2]; - const char *propname = "hisilicon,clkdiv-table"; - const char *cellname = "#hisilicon,clkdiv-table-cells"; + unsigned int max_div, min_div; struct of_phandle_args div_table; reg_base = hs_init_clocks(np); @@ -571,31 +570,29 @@ void __init hi3620_clkdiv_setup(struct device_node *np) if (of_property_read_string(np, "clock-output-names", &clk_name)) return; - if (of_property_read_u32_array(np, "hisilicon,clkdiv", + + /*process the div_table*/ + if (of_property_read_u32_array(np, "hisilicon,clkdiv-table", &data[0], 2)) return; - /*process the div_table*/ - for (i = 0; ; i++) { - if (of_parse_phandle_with_args(np, propname, cellname, - i, &div_table)) - break; - } + max_div = (u8)data[0]; + min_div = (u8)data[1]; + + if (of_property_read_u32_array(np, "hisilicon,clkdiv", + &data[0], 2)) + return; /*table ends with <0, 0>, so plus one to table_num*/ - table_num = i + 1; + table_num = max_div - min_div + 1; table = kzalloc(sizeof(struct clk_div_table) * table_num, GFP_KERNEL); if (!table) return ; - for (i = 0; ; i++) { - if (of_parse_phandle_with_args(np, propname, cellname, - i, &div_table)) - break; - - table[i].val = div_table.args[0]; - table[i].div = div_table.args[1]; + for (i = 0; i < table_num; i++) { + table[i].div = min_div + i; + table[i].val = table[i].div - 1; } /* gate only has the fixed parent */ @@ -626,6 +623,7 @@ void __init hi3620_clkdiv_setup(struct device_node *np) if (IS_ERR(clk)) goto err_clk; of_clk_add_provider(np, of_clk_src_simple_get, clk); + clk_register_clkdev(clk, clk_name, NULL); return; err_clk: kfree(init); |