diff options
author | Gabriel FERNANDEZ <gabriel.fernandez@st.com> | 2014-02-27 10:24:15 -0500 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-03-25 18:58:56 -0400 |
commit | b9b8e614b5805a99a5484c3d44fbfebaa8de4c65 (patch) | |
tree | abbc02277f367a476806f2a61bf1a89a86912210 /drivers/clk/st/clkgen.h | |
parent | 94885faf9dbcc2ca704d60e7db2f2b87e0b0fe6e (diff) |
clk: st: Support for PLLs inside ClockGenA(s)
The patch supports the c65/c32 type PLLs used by ClockGenA(s)
PLL clock : It includes support for all c65/c32 type PLLs
inside ClockGenA(s) : implemented as Fixed Parent / Fixed Rate clock,
with clock rate calculated reading H/w settings done at BOOT.
c65 PLLs have 2 outputs : HS and LS
c32 PLLs have 1-4 outputs : ODFx
Signed-off-by: Pankaj Dev <pankaj.dev@st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/st/clkgen.h')
-rw-r--r-- | drivers/clk/st/clkgen.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/clk/st/clkgen.h b/drivers/clk/st/clkgen.h new file mode 100644 index 000000000000..35c863295268 --- /dev/null +++ b/drivers/clk/st/clkgen.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /************************************************************************ | ||
2 | File : Clock H/w specific Information | ||
3 | |||
4 | Author: Pankaj Dev <pankaj.dev@st.com> | ||
5 | |||
6 | Copyright (C) 2014 STMicroelectronics | ||
7 | ************************************************************************/ | ||
8 | |||
9 | #ifndef __CLKGEN_INFO_H | ||
10 | #define __CLKGEN_INFO_H | ||
11 | |||
12 | struct clkgen_field { | ||
13 | unsigned int offset; | ||
14 | unsigned int mask; | ||
15 | unsigned int shift; | ||
16 | }; | ||
17 | |||
18 | static inline unsigned long clkgen_read(void __iomem *base, | ||
19 | struct clkgen_field *field) | ||
20 | { | ||
21 | return (readl(base + field->offset) >> field->shift) & field->mask; | ||
22 | } | ||
23 | |||
24 | |||
25 | static inline void clkgen_write(void __iomem *base, struct clkgen_field *field, | ||
26 | unsigned long val) | ||
27 | { | ||
28 | writel((readl(base + field->offset) & | ||
29 | ~(field->mask << field->shift)) | (val << field->shift), | ||
30 | base + field->offset); | ||
31 | |||
32 | return; | ||
33 | } | ||
34 | |||
35 | #define CLKGEN_FIELD(_offset, _mask, _shift) { \ | ||
36 | .offset = _offset, \ | ||
37 | .mask = _mask, \ | ||
38 | .shift = _shift, \ | ||
39 | } | ||
40 | |||
41 | #define CLKGEN_READ(pll, field) clkgen_read(pll->regs_base, \ | ||
42 | &pll->data->field) | ||
43 | |||
44 | #define CLKGEN_WRITE(pll, field, val) clkgen_write(pll->regs_base, \ | ||
45 | &pll->data->field, val) | ||
46 | |||
47 | #endif /*__CLKGEN_INFO_H*/ | ||
48 | |||