aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sh_clk.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-10-15 03:46:37 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-10-15 03:46:37 -0400
commit28085bc5de19cad365bcff98e9c8785c397c7c36 (patch)
tree710d9b8e506cd408e8cf715ce0672f06a3375404 /include/linux/sh_clk.h
parenta80be1680502f99de5f9565c491208e90a9a3afe (diff)
sh: clkfwk: support clock remapping.
This implements support for ioremapping of register windows that encapsulate clock control registers used by a struct clk, with transparent sibling inheritance. Root clocks at the top of a given topology often encapsulate the entire register space of all of their sibling clocks, so this mapping can be done once and handed down. A given clock enable/disable case maps out to a single bit in a shared register, so this prevents creating multiple overlapping mappings. The mapping case breaks down in to a couple of different situations: - Sibling clocks without a specific mapping. - Root clocks without a specific mapping. - Any of sibling/root clocks with a specific mapping. Sibling clocks with no specified mapping will grovel up the clock chain and install the root clock mapping unconditionally at registration time. Root clocks without their own mappings have a dummy BSS-initialized mapping inserted that is handed down the chain just like any other mapping. This permits all of the sibling clock ops to read/write using the mapping offsets without any special configuration, enabling them to not care whether access ultimately goes through translatable or untranslatable memory. Any clock with its own mapping will have the window initialized at registration time and be ready for use by its clock ops. Failure to establish the mapping will prevent registration, so no additional sanity checks are needed. Sibling clocks that double as parents for the moment will not propagate their mapping down, but this is easily tunable if the need arises. All clock mappings are kref refcounted, with each instance of mapping inheritance incrementing the refcount. Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/linux/sh_clk.h')
-rw-r--r--include/linux/sh_clk.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index ecdfea54a49e..8ae37707a4a4 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -4,11 +4,20 @@
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 {
13 void (*init)(struct clk *clk); 22 void (*init)(struct clk *clk);
14 int (*enable)(struct clk *clk); 23 int (*enable)(struct clk *clk);
@@ -42,6 +51,7 @@ struct clk {
42 unsigned long arch_flags; 51 unsigned long arch_flags;
43 void *priv; 52 void *priv;
44 struct dentry *dentry; 53 struct dentry *dentry;
54 struct clk_mapping *mapping;
45 struct cpufreq_frequency_table *freq_table; 55 struct cpufreq_frequency_table *freq_table;
46}; 56};
47 57