summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/clk/clk-composite.c1
-rw-r--r--drivers/clk/clk-qoriq.c2
-rw-r--r--drivers/clk/clk-si5341.c1
-rw-r--r--drivers/clk/clk.c58
-rw-r--r--drivers/clk/davinci/pll.c5
-rw-r--r--drivers/clk/st/clk-flexgen.c1
-rw-r--r--drivers/clk/st/clkgen-fsyn.c1
-rw-r--r--drivers/clk/st/clkgen-pll.c13
-rw-r--r--drivers/clk/ti/clk-814x.c1
-rw-r--r--drivers/clk/versatile/clk-versatile.c1
-rw-r--r--include/linux/clk.h17
11 files changed, 60 insertions, 41 deletions
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index b06038b8f658..4f13a681ddfc 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -3,7 +3,6 @@
3 * Copyright (c) 2013 NVIDIA CORPORATION. All rights reserved. 3 * Copyright (c) 2013 NVIDIA CORPORATION. All rights reserved.
4 */ 4 */
5 5
6#include <linux/clk.h>
7#include <linux/clk-provider.h> 6#include <linux/clk-provider.h>
8#include <linux/err.h> 7#include <linux/err.h>
9#include <linux/slab.h> 8#include <linux/slab.h>
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 07f3b252f3e0..bed140f7375f 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -686,7 +686,7 @@ static const struct clockgen_chipinfo chipinfo[] = {
686 .guts_compat = "fsl,qoriq-device-config-1.0", 686 .guts_compat = "fsl,qoriq-device-config-1.0",
687 .init_periph = p5020_init_periph, 687 .init_periph = p5020_init_periph,
688 .cmux_groups = { 688 .cmux_groups = {
689 &p2041_cmux_grp1, &p2041_cmux_grp2 689 &p5020_cmux_grp1, &p5020_cmux_grp2
690 }, 690 },
691 .cmux_to_group = { 691 .cmux_to_group = {
692 0, 1, -1 692 0, 1, -1
diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 72424eb7e5f8..6e780c2a9e6b 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -547,7 +547,6 @@ static int si5341_synth_clk_set_rate(struct clk_hw *hw, unsigned long rate,
547 bool is_integer; 547 bool is_integer;
548 548
549 n_num = synth->data->freq_vco; 549 n_num = synth->data->freq_vco;
550 n_den = rate;
551 550
552 /* see if there's an integer solution */ 551 /* see if there's an integer solution */
553 r = do_div(n_num, rate); 552 r = do_div(n_num, rate);
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index c0990703ce54..7783c25fb407 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -593,6 +593,8 @@ static void clk_core_get_boundaries(struct clk_core *core,
593{ 593{
594 struct clk *clk_user; 594 struct clk *clk_user;
595 595
596 lockdep_assert_held(&prepare_lock);
597
596 *min_rate = core->min_rate; 598 *min_rate = core->min_rate;
597 *max_rate = core->max_rate; 599 *max_rate = core->max_rate;
598 600
@@ -2847,9 +2849,6 @@ static struct hlist_head *orphan_list[] = {
2847static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, 2849static void clk_summary_show_one(struct seq_file *s, struct clk_core *c,
2848 int level) 2850 int level)
2849{ 2851{
2850 if (!c)
2851 return;
2852
2853 seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu %5d %6d\n", 2852 seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu %5d %6d\n",
2854 level * 3 + 1, "", 2853 level * 3 + 1, "",
2855 30 - level * 3, c->name, 2854 30 - level * 3, c->name,
@@ -2864,9 +2863,6 @@ static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
2864{ 2863{
2865 struct clk_core *child; 2864 struct clk_core *child;
2866 2865
2867 if (!c)
2868 return;
2869
2870 clk_summary_show_one(s, c, level); 2866 clk_summary_show_one(s, c, level);
2871 2867
2872 hlist_for_each_entry(child, &c->children, child_node) 2868 hlist_for_each_entry(child, &c->children, child_node)
@@ -2896,8 +2892,9 @@ DEFINE_SHOW_ATTRIBUTE(clk_summary);
2896 2892
2897static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) 2893static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level)
2898{ 2894{
2899 if (!c) 2895 unsigned long min_rate, max_rate;
2900 return; 2896
2897 clk_core_get_boundaries(c, &min_rate, &max_rate);
2901 2898
2902 /* This should be JSON format, i.e. elements separated with a comma */ 2899 /* This should be JSON format, i.e. elements separated with a comma */
2903 seq_printf(s, "\"%s\": { ", c->name); 2900 seq_printf(s, "\"%s\": { ", c->name);
@@ -2905,6 +2902,8 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level)
2905 seq_printf(s, "\"prepare_count\": %d,", c->prepare_count); 2902 seq_printf(s, "\"prepare_count\": %d,", c->prepare_count);
2906 seq_printf(s, "\"protect_count\": %d,", c->protect_count); 2903 seq_printf(s, "\"protect_count\": %d,", c->protect_count);
2907 seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); 2904 seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c));
2905 seq_printf(s, "\"min_rate\": %lu,", min_rate);
2906 seq_printf(s, "\"max_rate\": %lu,", max_rate);
2908 seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); 2907 seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c));
2909 seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c)); 2908 seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c));
2910 seq_printf(s, "\"duty_cycle\": %u", 2909 seq_printf(s, "\"duty_cycle\": %u",
@@ -2915,9 +2914,6 @@ static void clk_dump_subtree(struct seq_file *s, struct clk_core *c, int level)
2915{ 2914{
2916 struct clk_core *child; 2915 struct clk_core *child;
2917 2916
2918 if (!c)
2919 return;
2920
2921 clk_dump_one(s, c, level); 2917 clk_dump_one(s, c, level);
2922 2918
2923 hlist_for_each_entry(child, &c->children, child_node) { 2919 hlist_for_each_entry(child, &c->children, child_node) {
@@ -3013,15 +3009,15 @@ static void possible_parent_show(struct seq_file *s, struct clk_core *core,
3013 */ 3009 */
3014 parent = clk_core_get_parent_by_index(core, i); 3010 parent = clk_core_get_parent_by_index(core, i);
3015 if (parent) 3011 if (parent)
3016 seq_printf(s, "%s", parent->name); 3012 seq_puts(s, parent->name);
3017 else if (core->parents[i].name) 3013 else if (core->parents[i].name)
3018 seq_printf(s, "%s", core->parents[i].name); 3014 seq_puts(s, core->parents[i].name);
3019 else if (core->parents[i].fw_name) 3015 else if (core->parents[i].fw_name)
3020 seq_printf(s, "<%s>(fw)", core->parents[i].fw_name); 3016 seq_printf(s, "<%s>(fw)", core->parents[i].fw_name);
3021 else if (core->parents[i].index >= 0) 3017 else if (core->parents[i].index >= 0)
3022 seq_printf(s, "%s", 3018 seq_puts(s,
3023 of_clk_get_parent_name(core->of_node, 3019 of_clk_get_parent_name(core->of_node,
3024 core->parents[i].index)); 3020 core->parents[i].index));
3025 else 3021 else
3026 seq_puts(s, "(missing)"); 3022 seq_puts(s, "(missing)");
3027 3023
@@ -3064,6 +3060,34 @@ static int clk_duty_cycle_show(struct seq_file *s, void *data)
3064} 3060}
3065DEFINE_SHOW_ATTRIBUTE(clk_duty_cycle); 3061DEFINE_SHOW_ATTRIBUTE(clk_duty_cycle);
3066 3062
3063static int clk_min_rate_show(struct seq_file *s, void *data)
3064{
3065 struct clk_core *core = s->private;
3066 unsigned long min_rate, max_rate;
3067
3068 clk_prepare_lock();
3069 clk_core_get_boundaries(core, &min_rate, &max_rate);
3070 clk_prepare_unlock();
3071 seq_printf(s, "%lu\n", min_rate);
3072
3073 return 0;
3074}
3075DEFINE_SHOW_ATTRIBUTE(clk_min_rate);
3076
3077static int clk_max_rate_show(struct seq_file *s, void *data)
3078{
3079 struct clk_core *core = s->private;
3080 unsigned long min_rate, max_rate;
3081
3082 clk_prepare_lock();
3083 clk_core_get_boundaries(core, &min_rate, &max_rate);
3084 clk_prepare_unlock();
3085 seq_printf(s, "%lu\n", max_rate);
3086
3087 return 0;
3088}
3089DEFINE_SHOW_ATTRIBUTE(clk_max_rate);
3090
3067static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) 3091static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
3068{ 3092{
3069 struct dentry *root; 3093 struct dentry *root;
@@ -3075,6 +3099,8 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
3075 core->dentry = root; 3099 core->dentry = root;
3076 3100
3077 debugfs_create_ulong("clk_rate", 0444, root, &core->rate); 3101 debugfs_create_ulong("clk_rate", 0444, root, &core->rate);
3102 debugfs_create_file("clk_min_rate", 0444, root, core, &clk_min_rate_fops);
3103 debugfs_create_file("clk_max_rate", 0444, root, core, &clk_max_rate_fops);
3078 debugfs_create_ulong("clk_accuracy", 0444, root, &core->accuracy); 3104 debugfs_create_ulong("clk_accuracy", 0444, root, &core->accuracy);
3079 debugfs_create_u32("clk_phase", 0444, root, &core->phase); 3105 debugfs_create_u32("clk_phase", 0444, root, &core->phase);
3080 debugfs_create_file("clk_flags", 0444, root, core, &clk_flags_fops); 3106 debugfs_create_file("clk_flags", 0444, root, core, &clk_flags_fops);
diff --git a/drivers/clk/davinci/pll.c b/drivers/clk/davinci/pll.c
index 1c99e992d638..1ac11b6a47a3 100644
--- a/drivers/clk/davinci/pll.c
+++ b/drivers/clk/davinci/pll.c
@@ -778,12 +778,15 @@ int of_davinci_pll_init(struct device *dev, struct device_node *node,
778 int i; 778 int i;
779 779
780 clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL); 780 clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
781 if (!clk_data) 781 if (!clk_data) {
782 of_node_put(child);
782 return -ENOMEM; 783 return -ENOMEM;
784 }
783 785
784 clks = kmalloc_array(n_clks, sizeof(*clks), GFP_KERNEL); 786 clks = kmalloc_array(n_clks, sizeof(*clks), GFP_KERNEL);
785 if (!clks) { 787 if (!clks) {
786 kfree(clk_data); 788 kfree(clk_data);
789 of_node_put(child);
787 return -ENOMEM; 790 return -ENOMEM;
788 } 791 }
789 792
diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index d18e49b4976f..4413b6e04a8e 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -326,6 +326,7 @@ static void __init st_of_flexgen_setup(struct device_node *np)
326 return; 326 return;
327 327
328 reg = of_iomap(pnode, 0); 328 reg = of_iomap(pnode, 0);
329 of_node_put(pnode);
329 if (!reg) 330 if (!reg)
330 return; 331 return;
331 332
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index ca1ccdb8a3b1..a156bd0c6af7 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -67,7 +67,6 @@ struct clkgen_quadfs_data {
67}; 67};
68 68
69static const struct clk_ops st_quadfs_pll_c32_ops; 69static const struct clk_ops st_quadfs_pll_c32_ops;
70static const struct clk_ops st_quadfs_fs660c32_ops;
71 70
72static int clk_fs660c32_dig_get_params(unsigned long input, 71static int clk_fs660c32_dig_get_params(unsigned long input,
73 unsigned long output, struct stm_fs *fs); 72 unsigned long output, struct stm_fs *fs);
diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c
index d8a688bd45ec..c3952f2c42ba 100644
--- a/drivers/clk/st/clkgen-pll.c
+++ b/drivers/clk/st/clkgen-pll.c
@@ -61,19 +61,6 @@ static const struct clk_ops stm_pll3200c32_ops;
61static const struct clk_ops stm_pll3200c32_a9_ops; 61static const struct clk_ops stm_pll3200c32_a9_ops;
62static const struct clk_ops stm_pll4600c28_ops; 62static const struct clk_ops stm_pll4600c28_ops;
63 63
64static const struct clkgen_pll_data st_pll3200c32_407_a0 = {
65 /* 407 A0 */
66 .pdn_status = CLKGEN_FIELD(0x2a0, 0x1, 8),
67 .pdn_ctrl = CLKGEN_FIELD(0x2a0, 0x1, 8),
68 .locked_status = CLKGEN_FIELD(0x2a0, 0x1, 24),
69 .ndiv = CLKGEN_FIELD(0x2a4, C32_NDIV_MASK, 16),
70 .idf = CLKGEN_FIELD(0x2a4, C32_IDF_MASK, 0x0),
71 .num_odfs = 1,
72 .odf = { CLKGEN_FIELD(0x2b4, C32_ODF_MASK, 0) },
73 .odf_gate = { CLKGEN_FIELD(0x2b4, 0x1, 6) },
74 .ops = &stm_pll3200c32_ops,
75};
76
77static const struct clkgen_pll_data st_pll3200c32_cx_0 = { 64static const struct clkgen_pll_data st_pll3200c32_cx_0 = {
78 /* 407 C0 PLL0 */ 65 /* 407 C0 PLL0 */
79 .pdn_status = CLKGEN_FIELD(0x2a0, 0x1, 8), 66 .pdn_status = CLKGEN_FIELD(0x2a0, 0x1, 8),
diff --git a/drivers/clk/ti/clk-814x.c b/drivers/clk/ti/clk-814x.c
index e8cee6f3b4a0..087cfa75ac24 100644
--- a/drivers/clk/ti/clk-814x.c
+++ b/drivers/clk/ti/clk-814x.c
@@ -66,6 +66,7 @@ static int __init dm814x_adpll_early_init(void)
66 } 66 }
67 67
68 of_platform_populate(np, NULL, NULL, NULL); 68 of_platform_populate(np, NULL, NULL, NULL);
69 of_node_put(np);
69 70
70 return 0; 71 return 0;
71} 72}
diff --git a/drivers/clk/versatile/clk-versatile.c b/drivers/clk/versatile/clk-versatile.c
index 90bb0b041b7a..fd54d5c0251c 100644
--- a/drivers/clk/versatile/clk-versatile.c
+++ b/drivers/clk/versatile/clk-versatile.c
@@ -70,6 +70,7 @@ static void __init cm_osc_setup(struct device_node *np,
70 return; 70 return;
71 } 71 }
72 cm_base = of_iomap(parent, 0); 72 cm_base = of_iomap(parent, 0);
73 of_node_put(parent);
73 if (!cm_base) { 74 if (!cm_base) {
74 pr_err("could not remap core module base\n"); 75 pr_err("could not remap core module base\n");
75 return; 76 return;
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 3c096c7a51dc..7a795fd6d141 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -239,7 +239,8 @@ static inline int clk_prepare(struct clk *clk)
239 return 0; 239 return 0;
240} 240}
241 241
242static inline int __must_check clk_bulk_prepare(int num_clks, struct clk_bulk_data *clks) 242static inline int __must_check
243clk_bulk_prepare(int num_clks, const struct clk_bulk_data *clks)
243{ 244{
244 might_sleep(); 245 might_sleep();
245 return 0; 246 return 0;
@@ -263,7 +264,8 @@ static inline void clk_unprepare(struct clk *clk)
263{ 264{
264 might_sleep(); 265 might_sleep();
265} 266}
266static inline void clk_bulk_unprepare(int num_clks, struct clk_bulk_data *clks) 267static inline void clk_bulk_unprepare(int num_clks,
268 const struct clk_bulk_data *clks)
267{ 269{
268 might_sleep(); 270 might_sleep();
269} 271}
@@ -819,7 +821,8 @@ static inline int clk_enable(struct clk *clk)
819 return 0; 821 return 0;
820} 822}
821 823
822static inline int __must_check clk_bulk_enable(int num_clks, struct clk_bulk_data *clks) 824static inline int __must_check clk_bulk_enable(int num_clks,
825 const struct clk_bulk_data *clks)
823{ 826{
824 return 0; 827 return 0;
825} 828}
@@ -828,7 +831,7 @@ static inline void clk_disable(struct clk *clk) {}
828 831
829 832
830static inline void clk_bulk_disable(int num_clks, 833static inline void clk_bulk_disable(int num_clks,
831 struct clk_bulk_data *clks) {} 834 const struct clk_bulk_data *clks) {}
832 835
833static inline unsigned long clk_get_rate(struct clk *clk) 836static inline unsigned long clk_get_rate(struct clk *clk)
834{ 837{
@@ -917,8 +920,8 @@ static inline void clk_disable_unprepare(struct clk *clk)
917 clk_unprepare(clk); 920 clk_unprepare(clk);
918} 921}
919 922
920static inline int __must_check clk_bulk_prepare_enable(int num_clks, 923static inline int __must_check
921 struct clk_bulk_data *clks) 924clk_bulk_prepare_enable(int num_clks, const struct clk_bulk_data *clks)
922{ 925{
923 int ret; 926 int ret;
924 927
@@ -933,7 +936,7 @@ static inline int __must_check clk_bulk_prepare_enable(int num_clks,
933} 936}
934 937
935static inline void clk_bulk_disable_unprepare(int num_clks, 938static inline void clk_bulk_disable_unprepare(int num_clks,
936 struct clk_bulk_data *clks) 939 const struct clk_bulk_data *clks)
937{ 940{
938 clk_bulk_disable(num_clks, clks); 941 clk_bulk_disable(num_clks, clks);
939 clk_bulk_unprepare(num_clks, clks); 942 clk_bulk_unprepare(num_clks, clks);