ARM: OMAP4: clock: Convert to common clk
[deliverable/linux.git] / arch / arm / mach-omap2 / clock34xx.c
CommitLineData
02e19a96
PW
1/*
2 * OMAP3-specific clock framework functions
3 *
542313cc 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
ec538e30 5 * Copyright (C) 2007-2011 Nokia Corporation
02e19a96 6 *
da4d2904
PW
7 * Paul Walmsley
8 * Jouni Högander
02e19a96
PW
9 *
10 * Parts of this code are based on code written by
657ebfad
PW
11 * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu,
12 * Russell King
02e19a96
PW
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18#undef DEBUG
19
02e19a96 20#include <linux/kernel.h>
02e19a96
PW
21#include <linux/clk.h>
22#include <linux/io.h>
23
02e19a96 24#include "clock.h"
82e9bd58 25#include "clock34xx.h"
ff4ae5d9 26#include "cm3xxx.h"
02e19a96
PW
27#include "cm-regbits-34xx.h"
28
3c82e229
PW
29/**
30 * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI
31 * @clk: struct clk * being enabled
32 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
33 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
419cc97d 34 * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
3c82e229
PW
35 *
36 * The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift
37 * from the CM_{I,F}CLKEN bit. Pass back the correct info via
38 * @idlest_reg and @idlest_bit. No return value.
39 */
40static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
41 void __iomem **idlest_reg,
419cc97d
RL
42 u8 *idlest_bit,
43 u8 *idlest_val)
3c82e229
PW
44{
45 u32 r;
46
47 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
48 *idlest_reg = (__force void __iomem *)r;
49 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
419cc97d 50 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
3c82e229
PW
51}
52
82e9bd58
PW
53const struct clkops clkops_omap3430es2_ssi_wait = {
54 .enable = omap2_dflt_clk_enable,
55 .disable = omap2_dflt_clk_disable,
56 .find_idlest = omap3430es2_clk_ssi_find_idlest,
57 .find_companion = omap2_clk_dflt_find_companion,
58};
59
ec538e30
PW
60const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
61 .enable = omap2_dflt_clk_enable,
62 .disable = omap2_dflt_clk_disable,
63 .find_idlest = omap3430es2_clk_ssi_find_idlest,
64 .find_companion = omap2_clk_dflt_find_companion,
65 .allow_idle = omap2_clkt_iclk_allow_idle,
66 .deny_idle = omap2_clkt_iclk_deny_idle,
67};
68
3c82e229
PW
69/**
70 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
71 * @clk: struct clk * being enabled
72 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
73 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
419cc97d 74 * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
3c82e229
PW
75 *
76 * Some OMAP modules on OMAP3 ES2+ chips have both initiator and
77 * target IDLEST bits. For our purposes, we are concerned with the
78 * target IDLEST bits, which exist at a different bit position than
79 * the *CLKEN bit position for these modules (DSS and USBHOST) (The
80 * default find_idlest code assumes that they are at the same
81 * position.) No return value.
82 */
83static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
84 void __iomem **idlest_reg,
419cc97d
RL
85 u8 *idlest_bit,
86 u8 *idlest_val)
3c82e229
PW
87{
88 u32 r;
89
90 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
91 *idlest_reg = (__force void __iomem *)r;
92 /* USBHOST_IDLE has same shift */
93 *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
419cc97d 94 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
3c82e229
PW
95}
96
82e9bd58
PW
97const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
98 .enable = omap2_dflt_clk_enable,
99 .disable = omap2_dflt_clk_disable,
100 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
101 .find_companion = omap2_clk_dflt_find_companion,
102};
103
ec538e30
PW
104const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
105 .enable = omap2_dflt_clk_enable,
106 .disable = omap2_dflt_clk_disable,
107 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
108 .find_companion = omap2_clk_dflt_find_companion,
109 .allow_idle = omap2_clkt_iclk_allow_idle,
110 .deny_idle = omap2_clkt_iclk_deny_idle,
111};
112
3c82e229
PW
113/**
114 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
115 * @clk: struct clk * being enabled
116 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
117 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
419cc97d 118 * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
3c82e229
PW
119 *
120 * The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different
121 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
122 * @idlest_reg and @idlest_bit. No return value.
123 */
124static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
125 void __iomem **idlest_reg,
419cc97d
RL
126 u8 *idlest_bit,
127 u8 *idlest_val)
3c82e229
PW
128{
129 u32 r;
130
131 r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20);
132 *idlest_reg = (__force void __iomem *)r;
133 *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
419cc97d 134 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
3c82e229
PW
135}
136
82e9bd58
PW
137const struct clkops clkops_omap3430es2_hsotgusb_wait = {
138 .enable = omap2_dflt_clk_enable,
139 .disable = omap2_dflt_clk_disable,
140 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
141 .find_companion = omap2_clk_dflt_find_companion,
142};
ec538e30
PW
143
144const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait = {
145 .enable = omap2_dflt_clk_enable,
146 .disable = omap2_dflt_clk_disable,
147 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
148 .find_companion = omap2_clk_dflt_find_companion,
149 .allow_idle = omap2_clkt_iclk_allow_idle,
150 .deny_idle = omap2_clkt_iclk_deny_idle,
151};
This page took 0.320766 seconds and 5 git commands to generate.