1
2
3
4
5
6
7
8 #ifndef __CLK_DAVINCI_PLL_H___
9 #define __CLK_DAVINCI_PLL_H___
10
11 #include <linux/bitops.h>
12 #include <linux/clk-provider.h>
13 #include <linux/of.h>
14 #include <linux/regmap.h>
15 #include <linux/types.h>
16
17 #define PLL_HAS_CLKMODE BIT(0)
18 #define PLL_HAS_PREDIV BIT(1)
19 #define PLL_PREDIV_ALWAYS_ENABLED BIT(2)
20 #define PLL_PREDIV_FIXED_DIV BIT(3)
21 #define PLL_HAS_POSTDIV BIT(4)
22 #define PLL_POSTDIV_ALWAYS_ENABLED BIT(5)
23 #define PLL_POSTDIV_FIXED_DIV BIT(6)
24 #define PLL_HAS_EXTCLKSRC BIT(7)
25 #define PLL_PLLM_2X BIT(8)
26 #define PLL_PREDIV_FIXED8 BIT(9)
27
28
29
30
31
32
33
34
35
36
37
38
39 struct davinci_pll_clk_info {
40 const char *name;
41 u32 unlock_reg;
42 u32 unlock_mask;
43 u32 pllm_mask;
44 u32 pllm_min;
45 u32 pllm_max;
46 unsigned long pllout_min_rate;
47 unsigned long pllout_max_rate;
48 u32 flags;
49 };
50
51 #define SYSCLK_ARM_RATE BIT(0)
52 #define SYSCLK_ALWAYS_ENABLED BIT(1)
53 #define SYSCLK_FIXED_DIV BIT(2)
54
55
56
57
58
59
60
61
62 struct davinci_pll_sysclk_info {
63 const char *name;
64 const char *parent_name;
65 u32 id;
66 u32 ratio_width;
67 u32 flags;
68 };
69
70 #define SYSCLK(i, n, p, w, f) \
71 static const struct davinci_pll_sysclk_info n = { \
72 .name = #n, \
73 .parent_name = #p, \
74 .id = (i), \
75 .ratio_width = (w), \
76 .flags = (f), \
77 }
78
79
80
81
82
83
84
85
86
87 struct davinci_pll_obsclk_info {
88 const char *name;
89 const char * const *parent_names;
90 u8 num_parents;
91 u32 *table;
92 u32 ocsrc_mask;
93 };
94
95 struct clk *davinci_pll_clk_register(struct device *dev,
96 const struct davinci_pll_clk_info *info,
97 const char *parent_name,
98 void __iomem *base,
99 struct regmap *cfgchip);
100 struct clk *davinci_pll_auxclk_register(struct device *dev,
101 const char *name,
102 void __iomem *base);
103 struct clk *davinci_pll_sysclkbp_clk_register(struct device *dev,
104 const char *name,
105 void __iomem *base);
106 struct clk *
107 davinci_pll_obsclk_register(struct device *dev,
108 const struct davinci_pll_obsclk_info *info,
109 void __iomem *base);
110 struct clk *
111 davinci_pll_sysclk_register(struct device *dev,
112 const struct davinci_pll_sysclk_info *info,
113 void __iomem *base);
114
115 int of_davinci_pll_init(struct device *dev, struct device_node *node,
116 const struct davinci_pll_clk_info *info,
117 const struct davinci_pll_obsclk_info *obsclk_info,
118 const struct davinci_pll_sysclk_info **div_info,
119 u8 max_sysclk_id,
120 void __iomem *base,
121 struct regmap *cfgchip);
122
123
124
125 #ifdef CONFIG_ARCH_DAVINCI_DA850
126 int da850_pll1_init(struct device *dev, void __iomem *base, struct regmap *cfgchip);
127 void of_da850_pll0_init(struct device_node *node);
128 int of_da850_pll1_init(struct device *dev, void __iomem *base, struct regmap *cfgchip);
129 #endif
130 #ifdef CONFIG_ARCH_DAVINCI_DM355
131 int dm355_pll2_init(struct device *dev, void __iomem *base, struct regmap *cfgchip);
132 #endif
133 #ifdef CONFIG_ARCH_DAVINCI_DM644x
134 int dm644x_pll2_init(struct device *dev, void __iomem *base, struct regmap *cfgchip);
135 #endif
136 #ifdef CONFIG_ARCH_DAVINCI_DM646x
137 int dm646x_pll2_init(struct device *dev, void __iomem *base, struct regmap *cfgchip);
138 #endif
139
140 #endif