aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sh_clk.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/sh_clk.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/linux/sh_clk.h')
-rw-r--r--include/linux/sh_clk.h55
1 files changed, 21 insertions, 34 deletions
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 875ce50719a9..9a52f72527dc 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -4,26 +4,34 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/seq_file.h> 5#include <linux/seq_file.h>
6#include <linux/cpufreq.h> 6#include <linux/cpufreq.h>
7#include <linux/types.h>
8#include <linux/kref.h>
7#include <linux/clk.h> 9#include <linux/clk.h>
8#include <linux/err.h> 10#include <linux/err.h>
9 11
10struct clk; 12struct clk;
11 13
14struct clk_mapping {
15 phys_addr_t phys;
16 void __iomem *base;
17 unsigned long len;
18 struct kref ref;
19};
20
12struct clk_ops { 21struct clk_ops {
22#ifdef CONFIG_SH_CLK_CPG_LEGACY
13 void (*init)(struct clk *clk); 23 void (*init)(struct clk *clk);
24#endif
14 int (*enable)(struct clk *clk); 25 int (*enable)(struct clk *clk);
15 void (*disable)(struct clk *clk); 26 void (*disable)(struct clk *clk);
16 unsigned long (*recalc)(struct clk *clk); 27 unsigned long (*recalc)(struct clk *clk);
17 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id); 28 int (*set_rate)(struct clk *clk, unsigned long rate);
18 int (*set_parent)(struct clk *clk, struct clk *parent); 29 int (*set_parent)(struct clk *clk, struct clk *parent);
19 long (*round_rate)(struct clk *clk, unsigned long rate); 30 long (*round_rate)(struct clk *clk, unsigned long rate);
20}; 31};
21 32
22struct clk { 33struct clk {
23 struct list_head node; 34 struct list_head node;
24 const char *name;
25 int id;
26
27 struct clk *parent; 35 struct clk *parent;
28 struct clk **parent_table; /* list of parents to */ 36 struct clk **parent_table; /* list of parents to */
29 unsigned short parent_num; /* choose between */ 37 unsigned short parent_num; /* choose between */
@@ -45,7 +53,9 @@ struct clk {
45 unsigned long arch_flags; 53 unsigned long arch_flags;
46 void *priv; 54 void *priv;
47 struct dentry *dentry; 55 struct dentry *dentry;
56 struct clk_mapping *mapping;
48 struct cpufreq_frequency_table *freq_table; 57 struct cpufreq_frequency_table *freq_table;
58 unsigned int nr_freqs;
49}; 59};
50 60
51#define CLK_ENABLE_ON_INIT (1 << 0) 61#define CLK_ENABLE_ON_INIT (1 << 0)
@@ -59,36 +69,6 @@ int clk_register(struct clk *);
59void clk_unregister(struct clk *); 69void clk_unregister(struct clk *);
60void clk_enable_init_clocks(void); 70void clk_enable_init_clocks(void);
61 71
62/**
63 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
64 * @clk: clock source
65 * @rate: desired clock rate in Hz
66 * @algo_id: algorithm id to be passed down to ops->set_rate
67 *
68 * Returns success (0) or negative errno.
69 */
70int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
71
72enum clk_sh_algo_id {
73 NO_CHANGE = 0,
74
75 IUS_N1_N1,
76 IUS_322,
77 IUS_522,
78 IUS_N11,
79
80 SB_N1,
81
82 SB3_N1,
83 SB3_32,
84 SB3_43,
85 SB3_54,
86
87 BP_N1,
88
89 IP_N1,
90};
91
92struct clk_div_mult_table { 72struct clk_div_mult_table {
93 unsigned int *divisors; 73 unsigned int *divisors;
94 unsigned int nr_divisors; 74 unsigned int nr_divisors;
@@ -111,6 +91,13 @@ int clk_rate_table_find(struct clk *clk,
111 struct cpufreq_frequency_table *freq_table, 91 struct cpufreq_frequency_table *freq_table,
112 unsigned long rate); 92 unsigned long rate);
113 93
94long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
95 unsigned int div_max, unsigned long rate);
96
97long clk_round_parent(struct clk *clk, unsigned long target,
98 unsigned long *best_freq, unsigned long *parent_freq,
99 unsigned int div_min, unsigned int div_max);
100
114#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \ 101#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \
115{ \ 102{ \
116 .parent = _parent, \ 103 .parent = _parent, \