diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-26 15:42:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-26 15:42:29 -0400 |
commit | 27953437059c64d14086196eb96f43c78caa9db3 (patch) | |
tree | 0cfd5fb21262a6db3de0c64462847b4c0c43e9df /arch/arm/mach-imx/clk-pllv1.c | |
parent | 2c757fd5d1a92086f225a75a8fac7cab242d11b0 (diff) | |
parent | 3c0dec5f58b3c7b3627715126d1bf9b030a076f0 (diff) |
Merge tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull arm-soc clock driver changes from Olof Johansson:
"The new clock subsystem was merged in linux-3.4 without any users,
this now moves the first three platforms over to it: imx, mxs and
spear.
The series also contains the changes for the clock subsystem itself,
since Mike preferred to have it together with the platforms that
require these changes, in order to avoid interdependencies and
conflicts."
Fix up trivial conflicts in arch/arm/mach-kirkwood/common.c (code
removed in one branch, added OF support in another) and
drivers/dma/imx-sdma.c (independent changes next to each other).
* tag 'clock' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (97 commits)
clk: Fix CLK_SET_RATE_GATE flag validation in clk_set_rate().
clk: Provide dummy clk_unregister()
SPEAr: Update defconfigs
SPEAr: Add SMI NOR partition info in dts files
SPEAr: Switch to common clock framework
SPEAr: Call clk_prepare() before calling clk_enable
SPEAr: clk: Add General Purpose Timer Synthesizer clock
SPEAr: clk: Add Fractional Synthesizer clock
SPEAr: clk: Add Auxiliary Synthesizer clock
SPEAr: clk: Add VCO-PLL Synthesizer clock
SPEAr: Add DT bindings for SPEAr's timer
ARM i.MX: remove now unused clock files
ARM: i.MX6: implement clocks using common clock framework
ARM i.MX35: implement clocks using common clock framework
ARM i.MX5: implement clocks using common clock framework
ARM: Kirkwood: Replace clock gating
ARM: Orion: Audio: Add clk/clkdev support
ARM: Orion: PCIE: Add support for clk
ARM: Orion: XOR: Add support for clk
ARM: Orion: CESA: Add support for clk
...
Diffstat (limited to 'arch/arm/mach-imx/clk-pllv1.c')
-rw-r--r-- | arch/arm/mach-imx/clk-pllv1.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/clk-pllv1.c b/arch/arm/mach-imx/clk-pllv1.c new file mode 100644 index 000000000000..2d856f9ccf59 --- /dev/null +++ b/arch/arm/mach-imx/clk-pllv1.c | |||
@@ -0,0 +1,66 @@ | |||
1 | #include <linux/clk.h> | ||
2 | #include <linux/clk-provider.h> | ||
3 | #include <linux/io.h> | ||
4 | #include <linux/slab.h> | ||
5 | #include <linux/kernel.h> | ||
6 | #include <linux/err.h> | ||
7 | #include <mach/common.h> | ||
8 | #include <mach/hardware.h> | ||
9 | #include <mach/clock.h> | ||
10 | #include "clk.h" | ||
11 | |||
12 | /** | ||
13 | * pll v1 | ||
14 | * | ||
15 | * @clk_hw clock source | ||
16 | * @parent the parent clock name | ||
17 | * @base base address of pll registers | ||
18 | * | ||
19 | * PLL clock version 1, found on i.MX1/21/25/27/31/35 | ||
20 | */ | ||
21 | struct clk_pllv1 { | ||
22 | struct clk_hw hw; | ||
23 | void __iomem *base; | ||
24 | }; | ||
25 | |||
26 | #define to_clk_pllv1(clk) (container_of(clk, struct clk_pllv1, clk)) | ||
27 | |||
28 | static unsigned long clk_pllv1_recalc_rate(struct clk_hw *hw, | ||
29 | unsigned long parent_rate) | ||
30 | { | ||
31 | struct clk_pllv1 *pll = to_clk_pllv1(hw); | ||
32 | |||
33 | return mxc_decode_pll(readl(pll->base), parent_rate); | ||
34 | } | ||
35 | |||
36 | struct clk_ops clk_pllv1_ops = { | ||
37 | .recalc_rate = clk_pllv1_recalc_rate, | ||
38 | }; | ||
39 | |||
40 | struct clk *imx_clk_pllv1(const char *name, const char *parent, | ||
41 | void __iomem *base) | ||
42 | { | ||
43 | struct clk_pllv1 *pll; | ||
44 | struct clk *clk; | ||
45 | struct clk_init_data init; | ||
46 | |||
47 | pll = kmalloc(sizeof(*pll), GFP_KERNEL); | ||
48 | if (!pll) | ||
49 | return ERR_PTR(-ENOMEM); | ||
50 | |||
51 | pll->base = base; | ||
52 | |||
53 | init.name = name; | ||
54 | init.ops = &clk_pllv1_ops; | ||
55 | init.flags = 0; | ||
56 | init.parent_names = &parent; | ||
57 | init.num_parents = 1; | ||
58 | |||
59 | pll->hw.init = &init; | ||
60 | |||
61 | clk = clk_register(NULL, &pll->hw); | ||
62 | if (IS_ERR(clk)) | ||
63 | kfree(pll); | ||
64 | |||
65 | return clk; | ||
66 | } | ||