]>
Commit | Line | Data |
---|---|---|
530e544f PW |
1 | /* |
2 | * OMAP2/3 interface clock control | |
3 | * | |
4 | * Copyright (C) 2011 Nokia Corporation | |
5 | * Paul Walmsley | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License version 2 as | |
9 | * published by the Free Software Foundation. | |
10 | */ | |
11 | #undef DEBUG | |
12 | ||
13 | #include <linux/kernel.h> | |
32cc0021 | 14 | #include <linux/clk-provider.h> |
530e544f PW |
15 | #include <linux/io.h> |
16 | ||
530e544f | 17 | #include "clock.h" |
acd052bb TK |
18 | |
19 | /* Register offsets */ | |
20 | #define CM_AUTOIDLE 0x30 | |
21 | #define CM_ICLKEN 0x10 | |
530e544f PW |
22 | |
23 | /* Private functions */ | |
24 | ||
25 | /* XXX */ | |
b4777a21 | 26 | void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk) |
530e544f | 27 | { |
519ab8b2 TK |
28 | u32 v; |
29 | void __iomem *r; | |
530e544f | 30 | |
519ab8b2 TK |
31 | r = (__force void __iomem *) |
32 | ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); | |
530e544f | 33 | |
519ab8b2 | 34 | v = omap2_clk_readl(clk, r); |
530e544f | 35 | v |= (1 << clk->enable_bit); |
519ab8b2 | 36 | omap2_clk_writel(v, clk, r); |
530e544f PW |
37 | } |
38 | ||
39 | /* XXX */ | |
b4777a21 | 40 | void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk) |
530e544f | 41 | { |
519ab8b2 TK |
42 | u32 v; |
43 | void __iomem *r; | |
530e544f | 44 | |
519ab8b2 TK |
45 | r = (__force void __iomem *) |
46 | ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); | |
530e544f | 47 | |
519ab8b2 | 48 | v = omap2_clk_readl(clk, r); |
530e544f | 49 | v &= ~(1 << clk->enable_bit); |
519ab8b2 | 50 | omap2_clk_writel(v, clk, r); |
530e544f PW |
51 | } |
52 | ||
53 | /* Public data */ | |
54 | ||
b4777a21 RN |
55 | const struct clk_hw_omap_ops clkhwops_iclk = { |
56 | .allow_idle = omap2_clkt_iclk_allow_idle, | |
57 | .deny_idle = omap2_clkt_iclk_deny_idle, | |
58 | }; | |
59 | ||
32cc0021 MT |
60 | const struct clk_hw_omap_ops clkhwops_iclk_wait = { |
61 | .allow_idle = omap2_clkt_iclk_allow_idle, | |
62 | .deny_idle = omap2_clkt_iclk_deny_idle, | |
63 | .find_idlest = omap2_clk_dflt_find_idlest, | |
64 | .find_companion = omap2_clk_dflt_find_companion, | |
65 | }; | |
530e544f | 66 | |
530e544f | 67 | |
530e544f | 68 |