blob: bf21375eee7a438c0509665e8c77e33638e161af [file] [log] [blame]
Paul Walmsley69d88a02008-03-18 10:02:50 +02001#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
2#define __ARCH_ASM_MACH_OMAP2_CM_H
3
4/*
5 * OMAP2/3 Clock Management (CM) register definitions
6 *
Rajendra Nayak9b472672009-12-08 18:24:50 -07007 * Copyright (C) 2007-2009 Texas Instruments, Inc.
8 * Copyright (C) 2007-2009 Nokia Corporation
Paul Walmsley69d88a02008-03-18 10:02:50 +02009 *
10 * Written by Paul Walmsley
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include "prcm-common.h"
18
Paul Walmsley69d88a02008-03-18 10:02:50 +020019#define OMAP2420_CM_REGADDR(module, reg) \
Santosh Shilimkar233fd642009-10-19 15:25:31 -070020 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
Paul Walmsley69d88a02008-03-18 10:02:50 +020021#define OMAP2430_CM_REGADDR(module, reg) \
Santosh Shilimkar233fd642009-10-19 15:25:31 -070022 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
Paul Walmsley69d88a02008-03-18 10:02:50 +020023#define OMAP34XX_CM_REGADDR(module, reg) \
Santosh Shilimkar233fd642009-10-19 15:25:31 -070024 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
Paul Walmsleyd198b512010-12-21 15:30:54 -070025
Rajendra Nayak9b472672009-12-08 18:24:50 -070026
27#include "cm44xx.h"
Paul Walmsley69d88a02008-03-18 10:02:50 +020028
29/*
30 * Architecture-specific global CM registers
31 * Use cm_{read,write}_reg() with these registers.
32 * These registers appear once per CM module.
33 */
34
Kevin Hilman364dd472009-06-09 11:45:30 -070035#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
36#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
37#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
Paul Walmsley69d88a02008-03-18 10:02:50 +020038
Tony Lindgren8e3bd352009-05-25 11:26:42 -070039#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
Paul Walmsley69d88a02008-03-18 10:02:50 +020040#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
41
42/*
43 * Module specific CM registers from CM_BASE + domain offset
44 * Use cm_{read,write}_mod_reg() with these registers.
45 * These register offsets generally appear in more than one PRCM submodule.
46 */
47
48/* Common between 24xx and 34xx */
49
50#define CM_FCLKEN 0x0000
51#define CM_FCLKEN1 CM_FCLKEN
52#define CM_CLKEN CM_FCLKEN
53#define CM_ICLKEN 0x0010
54#define CM_ICLKEN1 CM_ICLKEN
55#define CM_ICLKEN2 0x0014
56#define CM_ICLKEN3 0x0018
57#define CM_IDLEST 0x0020
58#define CM_IDLEST1 CM_IDLEST
59#define CM_IDLEST2 0x0024
60#define CM_AUTOIDLE 0x0030
61#define CM_AUTOIDLE1 CM_AUTOIDLE
62#define CM_AUTOIDLE2 0x0034
63#define CM_AUTOIDLE3 0x0038
64#define CM_CLKSEL 0x0040
65#define CM_CLKSEL1 CM_CLKSEL
66#define CM_CLKSEL2 0x0044
Abhijit Pagare84c0c392010-01-26 20:12:53 -070067#define OMAP2_CM_CLKSTCTRL 0x0048
68#define OMAP4_CM_CLKSTCTRL 0x0000
Paul Walmsley69d88a02008-03-18 10:02:50 +020069
70
71/* Architecture-specific registers */
72
73#define OMAP24XX_CM_FCLKEN2 0x0004
74#define OMAP24XX_CM_ICLKEN4 0x001c
75#define OMAP24XX_CM_AUTOIDLE4 0x003c
76
77#define OMAP2430_CM_IDLEST3 0x0028
78
79#define OMAP3430_CM_CLKEN_PLL 0x0004
80#define OMAP3430ES2_CM_CLKEN2 0x0004
81#define OMAP3430ES2_CM_FCLKEN3 0x0008
82#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
83#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
Paul Walmsley542313c2008-07-03 12:24:45 +030084#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
Paul Walmsley69d88a02008-03-18 10:02:50 +020085#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
86#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
87#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
88#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
Abhijit Pagare84c0c392010-01-26 20:12:53 -070089#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
Paul Walmsley69d88a02008-03-18 10:02:50 +020090#define OMAP3430_CM_CLKSTST 0x004c
91#define OMAP3430ES2_CM_CLKSEL4 0x004c
92#define OMAP3430ES2_CM_CLKSEL5 0x0050
93#define OMAP3430_CM_CLKSEL2_EMU 0x0050
94#define OMAP3430_CM_CLKSEL3_EMU 0x0054
95
Rajendra Nayak9b472672009-12-08 18:24:50 -070096/* CM2.CEFUSE_CM2 register offsets */
Paul Walmsley69d88a02008-03-18 10:02:50 +020097
Rajendra Nayakd79b1262009-12-09 00:01:44 +053098/* OMAP4 modulemode control */
99#define OMAP4430_MODULEMODE_HWCTRL 0
100#define OMAP4430_MODULEMODE_SWCTRL 1
101
Paul Walmsley69d88a02008-03-18 10:02:50 +0200102/* Clock management domain register get/set */
103
104#ifndef __ASSEMBLER__
Paul Walmsley69d88a02008-03-18 10:02:50 +0200105
Tony Lindgrena58caad2008-07-03 12:24:44 +0300106extern u32 cm_read_mod_reg(s16 module, u16 idx);
107extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
Tony Lindgrenff00fcc2008-07-03 12:24:44 +0300108extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
109
Paul Walmsley71348bc2009-09-03 20:14:02 +0300110extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
111 u8 idlest_shift);
Benoit Cousson9a23dfe2010-05-20 12:31:08 -0600112extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
Paul Walmsley71348bc2009-09-03 20:14:02 +0300113
Tony Lindgrenff00fcc2008-07-03 12:24:44 +0300114static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
115{
116 return cm_rmw_mod_reg_bits(bits, bits, module, idx);
117}
118
119static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
120{
121 return cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
122}
Tony Lindgrena58caad2008-07-03 12:24:44 +0300123
Paul Walmsley69d88a02008-03-18 10:02:50 +0200124#endif
125
126/* CM register bits shared between 24XX and 3430 */
127
128/* CM_CLKSEL_GFX */
129#define OMAP_CLKSEL_GFX_SHIFT 0
130#define OMAP_CLKSEL_GFX_MASK (0x7 << 0)
131
132/* CM_ICLKEN_GFX */
133#define OMAP_EN_GFX_SHIFT 0
Paul Walmsley2fd0f752010-05-18 18:40:23 -0600134#define OMAP_EN_GFX_MASK (1 << 0)
Paul Walmsley69d88a02008-03-18 10:02:50 +0200135
136/* CM_IDLEST_GFX */
Paul Walmsley2fd0f752010-05-18 18:40:23 -0600137#define OMAP_ST_GFX_MASK (1 << 0)
138
Paul Walmsley69d88a02008-03-18 10:02:50 +0200139
Ranjith Lohithakshan419cc972010-02-24 12:05:54 -0700140/* CM_IDLEST indicator */
141#define OMAP24XX_CM_IDLEST_VAL 0
142#define OMAP34XX_CM_IDLEST_VAL 1
Paul Walmsley69d88a02008-03-18 10:02:50 +0200143
Benoit Coussond9e66252010-05-20 12:31:08 -0600144/*
145 * MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
146 * PRCM to request that a module exit the inactive state in the case of
147 * OMAP2 & 3.
148 * In the case of OMAP4 this is the max duration in microseconds for the
149 * module to reach the functionnal state from an inactive state.
150 */
151#define MAX_MODULE_READY_TIME 2000
152
Paul Walmsley69d88a02008-03-18 10:02:50 +0200153#endif