forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/arch/arm/mach-omap1/clock.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/mach-omap1/clock.c
34 *
....@@ -6,10 +7,6 @@
67 *
78 * Modified to use omap shared clock framework by
89 * Tony Lindgren <tony@atomide.com>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
1310 */
1411 #include <linux/kernel.h>
1512 #include <linux/export.h>
....@@ -44,7 +41,7 @@
4441 unsigned long omap1_uart_recalc(struct clk *clk)
4542 {
4643 unsigned int val = __raw_readl(clk->enable_reg);
47
- return val & clk->enable_bit ? 48000000 : 12000000;
44
+ return val & 1 << clk->enable_bit ? 48000000 : 12000000;
4845 }
4946
5047 unsigned long omap1_sossi_recalc(struct clk *clk)
....@@ -968,7 +965,7 @@
968965
969966 static struct dentry *clk_debugfs_root;
970967
971
-static int clk_dbg_show_summary(struct seq_file *s, void *unused)
968
+static int debug_clock_show(struct seq_file *s, void *unused)
972969 {
973970 struct clk *c;
974971 struct clk *pa;
....@@ -988,96 +985,46 @@
988985 return 0;
989986 }
990987
991
-static int clk_dbg_open(struct inode *inode, struct file *file)
992
-{
993
- return single_open(file, clk_dbg_show_summary, inode->i_private);
994
-}
988
+DEFINE_SHOW_ATTRIBUTE(debug_clock);
995989
996
-static const struct file_operations debug_clock_fops = {
997
- .open = clk_dbg_open,
998
- .read = seq_read,
999
- .llseek = seq_lseek,
1000
- .release = single_release,
1001
-};
1002
-
1003
-static int clk_debugfs_register_one(struct clk *c)
990
+static void clk_debugfs_register_one(struct clk *c)
1004991 {
1005
- int err;
1006992 struct dentry *d;
1007993 struct clk *pa = c->parent;
1008994
1009995 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
1010
- if (!d)
1011
- return -ENOMEM;
1012996 c->dent = d;
1013997
1014
- d = debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount);
1015
- if (!d) {
1016
- err = -ENOMEM;
1017
- goto err_out;
1018
- }
1019
- d = debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate);
1020
- if (!d) {
1021
- err = -ENOMEM;
1022
- goto err_out;
1023
- }
1024
- d = debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags);
1025
- if (!d) {
1026
- err = -ENOMEM;
1027
- goto err_out;
1028
- }
1029
- return 0;
1030
-
1031
-err_out:
1032
- debugfs_remove_recursive(c->dent);
1033
- return err;
998
+ debugfs_create_u8("usecount", S_IRUGO, c->dent, &c->usecount);
999
+ debugfs_create_ulong("rate", S_IRUGO, c->dent, &c->rate);
1000
+ debugfs_create_x8("flags", S_IRUGO, c->dent, &c->flags);
10341001 }
10351002
1036
-static int clk_debugfs_register(struct clk *c)
1003
+static void clk_debugfs_register(struct clk *c)
10371004 {
1038
- int err;
10391005 struct clk *pa = c->parent;
10401006
1041
- if (pa && !pa->dent) {
1042
- err = clk_debugfs_register(pa);
1043
- if (err)
1044
- return err;
1045
- }
1007
+ if (pa && !pa->dent)
1008
+ clk_debugfs_register(pa);
10461009
1047
- if (!c->dent) {
1048
- err = clk_debugfs_register_one(c);
1049
- if (err)
1050
- return err;
1051
- }
1052
- return 0;
1010
+ if (!c->dent)
1011
+ clk_debugfs_register_one(c);
10531012 }
10541013
10551014 static int __init clk_debugfs_init(void)
10561015 {
10571016 struct clk *c;
10581017 struct dentry *d;
1059
- int err;
10601018
10611019 d = debugfs_create_dir("clock", NULL);
1062
- if (!d)
1063
- return -ENOMEM;
10641020 clk_debugfs_root = d;
10651021
1066
- list_for_each_entry(c, &clocks, node) {
1067
- err = clk_debugfs_register(c);
1068
- if (err)
1069
- goto err_out;
1070
- }
1022
+ list_for_each_entry(c, &clocks, node)
1023
+ clk_debugfs_register(c);
10711024
1072
- d = debugfs_create_file("summary", S_IRUGO,
1073
- d, NULL, &debug_clock_fops);
1074
- if (!d)
1075
- return -ENOMEM;
1025
+ debugfs_create_file("summary", S_IRUGO, d, NULL, &debug_clock_fops);
10761026
10771027 return 0;
1078
-err_out:
1079
- debugfs_remove_recursive(clk_debugfs_root);
1080
- return err;
10811028 }
10821029 late_initcall(clk_debugfs_init);
10831030