diff options
-rw-r--r-- | drivers/clk/mvebu/common.c | 17 | ||||
-rw-r--r-- | drivers/clk/mvebu/common.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c index 0d4d1216f2dd..15b370ff3748 100644 --- a/drivers/clk/mvebu/common.c +++ b/drivers/clk/mvebu/common.c | |||
@@ -121,6 +121,11 @@ void __init mvebu_coreclk_setup(struct device_node *np, | |||
121 | 121 | ||
122 | /* Allocate struct for TCLK, cpu clk, and core ratio clocks */ | 122 | /* Allocate struct for TCLK, cpu clk, and core ratio clocks */ |
123 | clk_data.clk_num = 2 + desc->num_ratios; | 123 | clk_data.clk_num = 2 + desc->num_ratios; |
124 | |||
125 | /* One more clock for the optional refclk */ | ||
126 | if (desc->get_refclk_freq) | ||
127 | clk_data.clk_num += 1; | ||
128 | |||
124 | clk_data.clks = kzalloc(clk_data.clk_num * sizeof(struct clk *), | 129 | clk_data.clks = kzalloc(clk_data.clk_num * sizeof(struct clk *), |
125 | GFP_KERNEL); | 130 | GFP_KERNEL); |
126 | if (WARN_ON(!clk_data.clks)) { | 131 | if (WARN_ON(!clk_data.clks)) { |
@@ -162,6 +167,18 @@ void __init mvebu_coreclk_setup(struct device_node *np, | |||
162 | WARN_ON(IS_ERR(clk_data.clks[2+n])); | 167 | WARN_ON(IS_ERR(clk_data.clks[2+n])); |
163 | }; | 168 | }; |
164 | 169 | ||
170 | /* Register optional refclk */ | ||
171 | if (desc->get_refclk_freq) { | ||
172 | const char *name = "refclk"; | ||
173 | of_property_read_string_index(np, "clock-output-names", | ||
174 | 2 + desc->num_ratios, &name); | ||
175 | rate = desc->get_refclk_freq(base); | ||
176 | clk_data.clks[2 + desc->num_ratios] = | ||
177 | clk_register_fixed_rate(NULL, name, NULL, | ||
178 | CLK_IS_ROOT, rate); | ||
179 | WARN_ON(IS_ERR(clk_data.clks[2 + desc->num_ratios])); | ||
180 | } | ||
181 | |||
165 | /* SAR register isn't needed anymore */ | 182 | /* SAR register isn't needed anymore */ |
166 | iounmap(base); | 183 | iounmap(base); |
167 | 184 | ||
diff --git a/drivers/clk/mvebu/common.h b/drivers/clk/mvebu/common.h index 783b5631a453..f0de6c8a494a 100644 --- a/drivers/clk/mvebu/common.h +++ b/drivers/clk/mvebu/common.h | |||
@@ -30,6 +30,7 @@ struct coreclk_soc_desc { | |||
30 | u32 (*get_tclk_freq)(void __iomem *sar); | 30 | u32 (*get_tclk_freq)(void __iomem *sar); |
31 | u32 (*get_cpu_freq)(void __iomem *sar); | 31 | u32 (*get_cpu_freq)(void __iomem *sar); |
32 | void (*get_clk_ratio)(void __iomem *sar, int id, int *mult, int *div); | 32 | void (*get_clk_ratio)(void __iomem *sar, int id, int *mult, int *div); |
33 | u32 (*get_refclk_freq)(void __iomem *sar); | ||
33 | bool (*is_sscg_enabled)(void __iomem *sar); | 34 | bool (*is_sscg_enabled)(void __iomem *sar); |
34 | u32 (*fix_sscg_deviation)(u32 system_clk); | 35 | u32 (*fix_sscg_deviation)(u32 system_clk); |
35 | const struct coreclk_ratio *ratios; | 36 | const struct coreclk_ratio *ratios; |