xref: /openbmc/linux/arch/arm/mach-omap2/cm.h (revision d79b1267)
169d88a00SPaul Walmsley #ifndef __ARCH_ASM_MACH_OMAP2_CM_H
269d88a00SPaul Walmsley #define __ARCH_ASM_MACH_OMAP2_CM_H
369d88a00SPaul Walmsley 
469d88a00SPaul Walmsley /*
569d88a00SPaul Walmsley  * OMAP2/3 Clock Management (CM) register definitions
669d88a00SPaul Walmsley  *
79b47267fSRajendra Nayak  * Copyright (C) 2007-2009 Texas Instruments, Inc.
89b47267fSRajendra Nayak  * Copyright (C) 2007-2009 Nokia Corporation
969d88a00SPaul Walmsley  *
1069d88a00SPaul Walmsley  * Written by Paul Walmsley
1169d88a00SPaul Walmsley  *
1269d88a00SPaul Walmsley  * This program is free software; you can redistribute it and/or modify
1369d88a00SPaul Walmsley  * it under the terms of the GNU General Public License version 2 as
1469d88a00SPaul Walmsley  * published by the Free Software Foundation.
1569d88a00SPaul Walmsley  */
1669d88a00SPaul Walmsley 
1769d88a00SPaul Walmsley #include "prcm-common.h"
1869d88a00SPaul Walmsley 
1969d88a00SPaul Walmsley #define OMAP2420_CM_REGADDR(module, reg)				\
20233fd64eSSantosh Shilimkar 			OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
2169d88a00SPaul Walmsley #define OMAP2430_CM_REGADDR(module, reg)				\
22233fd64eSSantosh Shilimkar 			OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
2369d88a00SPaul Walmsley #define OMAP34XX_CM_REGADDR(module, reg)				\
24233fd64eSSantosh Shilimkar 			OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
259b47267fSRajendra Nayak #define OMAP44XX_CM1_REGADDR(module, reg)				\
269b47267fSRajendra Nayak 			OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) + (reg))
279b47267fSRajendra Nayak #define OMAP44XX_CM2_REGADDR(module, reg)				\
289b47267fSRajendra Nayak 			OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) + (reg))
299b47267fSRajendra Nayak 
309b47267fSRajendra Nayak #include "cm44xx.h"
3169d88a00SPaul Walmsley 
3269d88a00SPaul Walmsley /*
3369d88a00SPaul Walmsley  * Architecture-specific global CM registers
3469d88a00SPaul Walmsley  * Use cm_{read,write}_reg() with these registers.
3569d88a00SPaul Walmsley  * These registers appear once per CM module.
3669d88a00SPaul Walmsley  */
3769d88a00SPaul Walmsley 
38364dd474SKevin Hilman #define OMAP3430_CM_REVISION		OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
39364dd474SKevin Hilman #define OMAP3430_CM_SYSCONFIG		OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
40364dd474SKevin Hilman #define OMAP3430_CM_POLCTRL		OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
4169d88a00SPaul Walmsley 
428e3bd351STony Lindgren #define OMAP3_CM_CLKOUT_CTRL_OFFSET	0x0070
4369d88a00SPaul Walmsley #define OMAP3430_CM_CLKOUT_CTRL		OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
4469d88a00SPaul Walmsley 
4569d88a00SPaul Walmsley /*
4669d88a00SPaul Walmsley  * Module specific CM registers from CM_BASE + domain offset
4769d88a00SPaul Walmsley  * Use cm_{read,write}_mod_reg() with these registers.
4869d88a00SPaul Walmsley  * These register offsets generally appear in more than one PRCM submodule.
4969d88a00SPaul Walmsley  */
5069d88a00SPaul Walmsley 
5169d88a00SPaul Walmsley /* Common between 24xx and 34xx */
5269d88a00SPaul Walmsley 
5369d88a00SPaul Walmsley #define CM_FCLKEN					0x0000
5469d88a00SPaul Walmsley #define CM_FCLKEN1					CM_FCLKEN
5569d88a00SPaul Walmsley #define CM_CLKEN					CM_FCLKEN
5669d88a00SPaul Walmsley #define CM_ICLKEN					0x0010
5769d88a00SPaul Walmsley #define CM_ICLKEN1					CM_ICLKEN
5869d88a00SPaul Walmsley #define CM_ICLKEN2					0x0014
5969d88a00SPaul Walmsley #define CM_ICLKEN3					0x0018
6069d88a00SPaul Walmsley #define CM_IDLEST					0x0020
6169d88a00SPaul Walmsley #define CM_IDLEST1					CM_IDLEST
6269d88a00SPaul Walmsley #define CM_IDLEST2					0x0024
6369d88a00SPaul Walmsley #define CM_AUTOIDLE					0x0030
6469d88a00SPaul Walmsley #define CM_AUTOIDLE1					CM_AUTOIDLE
6569d88a00SPaul Walmsley #define CM_AUTOIDLE2					0x0034
6669d88a00SPaul Walmsley #define CM_AUTOIDLE3					0x0038
6769d88a00SPaul Walmsley #define CM_CLKSEL					0x0040
6869d88a00SPaul Walmsley #define CM_CLKSEL1					CM_CLKSEL
6969d88a00SPaul Walmsley #define CM_CLKSEL2					0x0044
7069d88a00SPaul Walmsley #define CM_CLKSTCTRL					0x0048
7169d88a00SPaul Walmsley 
7269d88a00SPaul Walmsley 
7369d88a00SPaul Walmsley /* Architecture-specific registers */
7469d88a00SPaul Walmsley 
7569d88a00SPaul Walmsley #define OMAP24XX_CM_FCLKEN2				0x0004
7669d88a00SPaul Walmsley #define OMAP24XX_CM_ICLKEN4				0x001c
7769d88a00SPaul Walmsley #define OMAP24XX_CM_AUTOIDLE4				0x003c
7869d88a00SPaul Walmsley 
7969d88a00SPaul Walmsley #define OMAP2430_CM_IDLEST3				0x0028
8069d88a00SPaul Walmsley 
8169d88a00SPaul Walmsley #define OMAP3430_CM_CLKEN_PLL				0x0004
8269d88a00SPaul Walmsley #define OMAP3430ES2_CM_CLKEN2				0x0004
8369d88a00SPaul Walmsley #define OMAP3430ES2_CM_FCLKEN3				0x0008
8469d88a00SPaul Walmsley #define OMAP3430_CM_IDLEST_PLL				CM_IDLEST2
8569d88a00SPaul Walmsley #define OMAP3430_CM_AUTOIDLE_PLL			CM_AUTOIDLE2
86542313ccSPaul Walmsley #define OMAP3430ES2_CM_AUTOIDLE2_PLL			CM_AUTOIDLE2
8769d88a00SPaul Walmsley #define OMAP3430_CM_CLKSEL1				CM_CLKSEL
8869d88a00SPaul Walmsley #define OMAP3430_CM_CLKSEL1_PLL				CM_CLKSEL
8969d88a00SPaul Walmsley #define OMAP3430_CM_CLKSEL2_PLL				CM_CLKSEL2
9069d88a00SPaul Walmsley #define OMAP3430_CM_SLEEPDEP				CM_CLKSEL2
9169d88a00SPaul Walmsley #define OMAP3430_CM_CLKSEL3				CM_CLKSTCTRL
9269d88a00SPaul Walmsley #define OMAP3430_CM_CLKSTST				0x004c
9369d88a00SPaul Walmsley #define OMAP3430ES2_CM_CLKSEL4				0x004c
9469d88a00SPaul Walmsley #define OMAP3430ES2_CM_CLKSEL5				0x0050
9569d88a00SPaul Walmsley #define OMAP3430_CM_CLKSEL2_EMU				0x0050
9669d88a00SPaul Walmsley #define OMAP3430_CM_CLKSEL3_EMU				0x0054
9769d88a00SPaul Walmsley 
989b47267fSRajendra Nayak /* CM2.CEFUSE_CM2 register offsets */
9969d88a00SPaul Walmsley 
100d79b1267SRajendra Nayak /* OMAP4 modulemode control */
101d79b1267SRajendra Nayak #define OMAP4430_MODULEMODE_HWCTRL			0
102d79b1267SRajendra Nayak #define OMAP4430_MODULEMODE_SWCTRL			1
103d79b1267SRajendra Nayak 
10469d88a00SPaul Walmsley /* Clock management domain register get/set */
10569d88a00SPaul Walmsley 
10669d88a00SPaul Walmsley #ifndef __ASSEMBLER__
10769d88a00SPaul Walmsley 
108a58caad1STony Lindgren extern u32 cm_read_mod_reg(s16 module, u16 idx);
109a58caad1STony Lindgren extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
110ff00fcc9STony Lindgren extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
111ff00fcc9STony Lindgren 
11271348bcaSPaul Walmsley extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
11371348bcaSPaul Walmsley 				      u8 idlest_shift);
11471348bcaSPaul Walmsley extern int omap4_cm_wait_module_ready(u32 prcm_mod, u8 prcm_dev_offs);
11571348bcaSPaul Walmsley 
116ff00fcc9STony Lindgren static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
117ff00fcc9STony Lindgren {
118ff00fcc9STony Lindgren 	return cm_rmw_mod_reg_bits(bits, bits, module, idx);
119ff00fcc9STony Lindgren }
120ff00fcc9STony Lindgren 
121ff00fcc9STony Lindgren static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
122ff00fcc9STony Lindgren {
123ff00fcc9STony Lindgren 	return cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
124ff00fcc9STony Lindgren }
125a58caad1STony Lindgren 
12669d88a00SPaul Walmsley #endif
12769d88a00SPaul Walmsley 
12869d88a00SPaul Walmsley /* CM register bits shared between 24XX and 3430 */
12969d88a00SPaul Walmsley 
13069d88a00SPaul Walmsley /* CM_CLKSEL_GFX */
13169d88a00SPaul Walmsley #define OMAP_CLKSEL_GFX_SHIFT				0
13269d88a00SPaul Walmsley #define OMAP_CLKSEL_GFX_MASK				(0x7 << 0)
13369d88a00SPaul Walmsley 
13469d88a00SPaul Walmsley /* CM_ICLKEN_GFX */
13569d88a00SPaul Walmsley #define OMAP_EN_GFX_SHIFT				0
13669d88a00SPaul Walmsley #define OMAP_EN_GFX					(1 << 0)
13769d88a00SPaul Walmsley 
13869d88a00SPaul Walmsley /* CM_IDLEST_GFX */
13969d88a00SPaul Walmsley #define OMAP_ST_GFX					(1 << 0)
14069d88a00SPaul Walmsley 
14169d88a00SPaul Walmsley 
14269d88a00SPaul Walmsley #endif
143