This source file includes following definitions.
- omap2_clkt_iclk_allow_idle
- omap2_clkt_iclk_deny_idle
- omap2430_clk_i2chs_find_idlest
1
2
3
4
5
6
7
8 #undef DEBUG
9
10 #include <linux/kernel.h>
11 #include <linux/clk-provider.h>
12 #include <linux/io.h>
13 #include <linux/clk/ti.h>
14
15 #include "clock.h"
16
17
18 #define OMAP24XX_CM_FCLKEN2 0x04
19 #define CM_AUTOIDLE 0x30
20 #define CM_ICLKEN 0x10
21 #define CM_IDLEST 0x20
22
23 #define OMAP24XX_CM_IDLEST_VAL 0
24
25
26
27
28 void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
29 {
30 u32 v;
31 struct clk_omap_reg r;
32
33 memcpy(&r, &clk->enable_reg, sizeof(r));
34 r.offset ^= (CM_AUTOIDLE ^ CM_ICLKEN);
35
36 v = ti_clk_ll_ops->clk_readl(&r);
37 v |= (1 << clk->enable_bit);
38 ti_clk_ll_ops->clk_writel(v, &r);
39 }
40
41
42 void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
43 {
44 u32 v;
45 struct clk_omap_reg r;
46
47 memcpy(&r, &clk->enable_reg, sizeof(r));
48
49 r.offset ^= (CM_AUTOIDLE ^ CM_ICLKEN);
50
51 v = ti_clk_ll_ops->clk_readl(&r);
52 v &= ~(1 << clk->enable_bit);
53 ti_clk_ll_ops->clk_writel(v, &r);
54 }
55
56
57
58
59
60
61
62
63
64
65
66
67
68 static void omap2430_clk_i2chs_find_idlest(struct clk_hw_omap *clk,
69 struct clk_omap_reg *idlest_reg,
70 u8 *idlest_bit,
71 u8 *idlest_val)
72 {
73 memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
74 idlest_reg->offset ^= (OMAP24XX_CM_FCLKEN2 ^ CM_IDLEST);
75 *idlest_bit = clk->enable_bit;
76 *idlest_val = OMAP24XX_CM_IDLEST_VAL;
77 }
78
79
80
81 const struct clk_hw_omap_ops clkhwops_iclk = {
82 .allow_idle = omap2_clkt_iclk_allow_idle,
83 .deny_idle = omap2_clkt_iclk_deny_idle,
84 };
85
86 const struct clk_hw_omap_ops clkhwops_iclk_wait = {
87 .allow_idle = omap2_clkt_iclk_allow_idle,
88 .deny_idle = omap2_clkt_iclk_deny_idle,
89 .find_idlest = omap2_clk_dflt_find_idlest,
90 .find_companion = omap2_clk_dflt_find_companion,
91 };
92
93
94 const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait = {
95 .find_idlest = omap2430_clk_i2chs_find_idlest,
96 .find_companion = omap2_clk_dflt_find_companion,
97 };