.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/arch/arm/mach-omap1/clock.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * |
---|
7 | 8 | * Modified to use omap shared clock framework by |
---|
8 | 9 | * 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. |
---|
13 | 10 | */ |
---|
14 | 11 | #include <linux/kernel.h> |
---|
15 | 12 | #include <linux/export.h> |
---|
.. | .. |
---|
44 | 41 | unsigned long omap1_uart_recalc(struct clk *clk) |
---|
45 | 42 | { |
---|
46 | 43 | 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; |
---|
48 | 45 | } |
---|
49 | 46 | |
---|
50 | 47 | unsigned long omap1_sossi_recalc(struct clk *clk) |
---|
.. | .. |
---|
968 | 965 | |
---|
969 | 966 | static struct dentry *clk_debugfs_root; |
---|
970 | 967 | |
---|
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) |
---|
972 | 969 | { |
---|
973 | 970 | struct clk *c; |
---|
974 | 971 | struct clk *pa; |
---|
.. | .. |
---|
988 | 985 | return 0; |
---|
989 | 986 | } |
---|
990 | 987 | |
---|
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); |
---|
995 | 989 | |
---|
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) |
---|
1004 | 991 | { |
---|
1005 | | - int err; |
---|
1006 | 992 | struct dentry *d; |
---|
1007 | 993 | struct clk *pa = c->parent; |
---|
1008 | 994 | |
---|
1009 | 995 | d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root); |
---|
1010 | | - if (!d) |
---|
1011 | | - return -ENOMEM; |
---|
1012 | 996 | c->dent = d; |
---|
1013 | 997 | |
---|
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); |
---|
1034 | 1001 | } |
---|
1035 | 1002 | |
---|
1036 | | -static int clk_debugfs_register(struct clk *c) |
---|
| 1003 | +static void clk_debugfs_register(struct clk *c) |
---|
1037 | 1004 | { |
---|
1038 | | - int err; |
---|
1039 | 1005 | struct clk *pa = c->parent; |
---|
1040 | 1006 | |
---|
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); |
---|
1046 | 1009 | |
---|
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); |
---|
1053 | 1012 | } |
---|
1054 | 1013 | |
---|
1055 | 1014 | static int __init clk_debugfs_init(void) |
---|
1056 | 1015 | { |
---|
1057 | 1016 | struct clk *c; |
---|
1058 | 1017 | struct dentry *d; |
---|
1059 | | - int err; |
---|
1060 | 1018 | |
---|
1061 | 1019 | d = debugfs_create_dir("clock", NULL); |
---|
1062 | | - if (!d) |
---|
1063 | | - return -ENOMEM; |
---|
1064 | 1020 | clk_debugfs_root = d; |
---|
1065 | 1021 | |
---|
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); |
---|
1071 | 1024 | |
---|
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); |
---|
1076 | 1026 | |
---|
1077 | 1027 | return 0; |
---|
1078 | | -err_out: |
---|
1079 | | - debugfs_remove_recursive(clk_debugfs_root); |
---|
1080 | | - return err; |
---|
1081 | 1028 | } |
---|
1082 | 1029 | late_initcall(clk_debugfs_init); |
---|
1083 | 1030 | |
---|