xref: /linux/arch/arm/mach-omap2/clock.h (revision e9e63088e4f93cf4ed7999294c09905b7dcb4d32)
1543d9378SPaul Walmsley /*
2543d9378SPaul Walmsley  *  linux/arch/arm/mach-omap2/clock.h
3543d9378SPaul Walmsley  *
4d8a94458SPaul Walmsley  *  Copyright (C) 2005-2009 Texas Instruments, Inc.
5530e544fSPaul Walmsley  *  Copyright (C) 2004-2011 Nokia Corporation
6a16e9703STony Lindgren  *
7a16e9703STony Lindgren  *  Contacts:
8543d9378SPaul Walmsley  *  Richard Woodruff <r-woodruff2@ti.com>
9543d9378SPaul Walmsley  *  Paul Walmsley
10543d9378SPaul Walmsley  *
11543d9378SPaul Walmsley  * This program is free software; you can redistribute it and/or modify
12543d9378SPaul Walmsley  * it under the terms of the GNU General Public License version 2 as
13543d9378SPaul Walmsley  * published by the Free Software Foundation.
14543d9378SPaul Walmsley  */
15543d9378SPaul Walmsley 
16543d9378SPaul Walmsley #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_H
17543d9378SPaul Walmsley #define __ARCH_ARM_MACH_OMAP2_CLOCK_H
18543d9378SPaul Walmsley 
1912706c54SPaul Walmsley #include <linux/kernel.h>
20a135eaaeSPaul Walmsley #include <linux/list.h>
2112706c54SPaul Walmsley 
22e10dd62fSPaul Walmsley #include <linux/clkdev.h>
23f9ae32a7SMike Turquette #include <linux/clk-provider.h>
24f38b0dd6STero Kristo #include <linux/clk/ti.h>
25e10dd62fSPaul Walmsley 
26a135eaaeSPaul Walmsley /* struct clksel_rate.flags possibilities */
27a135eaaeSPaul Walmsley #define RATE_IN_242X		(1 << 0)
28a135eaaeSPaul Walmsley #define RATE_IN_243X		(1 << 1)
29a135eaaeSPaul Walmsley #define RATE_IN_3430ES1		(1 << 2)	/* 3430ES1 rates only */
30a135eaaeSPaul Walmsley #define RATE_IN_3430ES2PLUS	(1 << 3)	/* 3430 ES >= 2 rates only */
31a135eaaeSPaul Walmsley #define RATE_IN_36XX		(1 << 4)
32a135eaaeSPaul Walmsley #define RATE_IN_4430		(1 << 5)
33a135eaaeSPaul Walmsley #define RATE_IN_TI816X		(1 << 6)
34a135eaaeSPaul Walmsley #define RATE_IN_4460		(1 << 7)
35a135eaaeSPaul Walmsley #define RATE_IN_AM33XX		(1 << 8)
36a135eaaeSPaul Walmsley #define RATE_IN_TI814X		(1 << 9)
37a135eaaeSPaul Walmsley 
38a135eaaeSPaul Walmsley #define RATE_IN_24XX		(RATE_IN_242X | RATE_IN_243X)
39a135eaaeSPaul Walmsley #define RATE_IN_34XX		(RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
40a135eaaeSPaul Walmsley #define RATE_IN_3XXX		(RATE_IN_34XX | RATE_IN_36XX)
41a135eaaeSPaul Walmsley #define RATE_IN_44XX		(RATE_IN_4430 | RATE_IN_4460)
42a135eaaeSPaul Walmsley 
43a135eaaeSPaul Walmsley /* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
44a135eaaeSPaul Walmsley #define RATE_IN_3430ES2PLUS_36XX	(RATE_IN_3430ES2PLUS | RATE_IN_36XX)
45a135eaaeSPaul Walmsley 
46c0bf3132SRussell King /* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
47c0bf3132SRussell King #define CORE_CLK_SRC_32K		0x0
48c0bf3132SRussell King #define CORE_CLK_SRC_DPLL		0x1
49c0bf3132SRussell King #define CORE_CLK_SRC_DPLL_X2		0x2
50c0bf3132SRussell King 
51c0bf3132SRussell King /* OMAP2xxx CM_CLKEN_PLL.EN_DPLL bits - for omap2_get_dpll_rate() */
52c0bf3132SRussell King #define OMAP2XXX_EN_DPLL_LPBYPASS		0x1
53c0bf3132SRussell King #define OMAP2XXX_EN_DPLL_FRBYPASS		0x2
54c0bf3132SRussell King #define OMAP2XXX_EN_DPLL_LOCKED			0x3
55c0bf3132SRussell King 
56c0bf3132SRussell King /* OMAP3xxx CM_CLKEN_PLL*.EN_*_DPLL bits - for omap2_get_dpll_rate() */
57c0bf3132SRussell King #define OMAP3XXX_EN_DPLL_LPBYPASS		0x5
58c0bf3132SRussell King #define OMAP3XXX_EN_DPLL_FRBYPASS		0x6
59c0bf3132SRussell King #define OMAP3XXX_EN_DPLL_LOCKED			0x7
60c0bf3132SRussell King 
6116975a79SRajendra Nayak /* OMAP4xxx CM_CLKMODE_DPLL*.EN_*_DPLL bits - for omap2_get_dpll_rate() */
6216975a79SRajendra Nayak #define OMAP4XXX_EN_DPLL_MNBYPASS		0x4
6316975a79SRajendra Nayak #define OMAP4XXX_EN_DPLL_LPBYPASS		0x5
6416975a79SRajendra Nayak #define OMAP4XXX_EN_DPLL_FRBYPASS		0x6
6516975a79SRajendra Nayak #define OMAP4XXX_EN_DPLL_LOCKED			0x7
6616975a79SRajendra Nayak 
674d30e82cSPaul Walmsley void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
684d30e82cSPaul Walmsley 			       const char *core_ck_name,
694d30e82cSPaul Walmsley 			       const char *mpu_ck_name);
70543d9378SPaul Walmsley 
713ada6b10STero Kristo u32 omap2_clk_readl(struct clk_hw_omap *clk, void __iomem *reg);
723ada6b10STero Kristo void omap2_clk_writel(u32 val, struct clk_hw_omap *clk, void __iomem *reg);
733ada6b10STero Kristo 
7499541195SAfzal Mohammed extern u16 cpu_mask;
75d8a94458SPaul Walmsley 
76b36ee724SRussell King extern const struct clkops clkops_omap2_dflt_wait;
77bc51da4eSRussell King extern const struct clkops clkops_omap2_dflt;
78b36ee724SRussell King 
7982e9bd58SPaul Walmsley extern struct clk_functions omap2_clk_functions;
8082e9bd58SPaul Walmsley 
8180cbb224STero Kristo struct regmap;
8280cbb224STero Kristo 
839f029b15STero Kristo int __init omap2_clk_provider_init(struct device_node *np, int index,
8480cbb224STero Kristo 				   struct regmap *syscon, void __iomem *mem);
859f029b15STero Kristo void __init omap2_clk_legacy_provider_init(int index, void __iomem *mem);
86*e9e63088STero Kristo int __init omap2_clk_setup_ll_ops(void);
879f029b15STero Kristo 
888111e010STero Kristo void __init ti_clk_init_features(void);
89543d9378SPaul Walmsley #endif
90