aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Mason <jonmason@broadcom.com>2015-10-15 15:48:29 -0400
committerStephen Boyd <sboyd@codeaurora.org>2015-10-21 20:02:57 -0400
commitf713c6bf32092a259d6baf2be24f9c3dbf2462c3 (patch)
tree175ddb6a03c3187d358f50f201f22076fc47db46
parent7968d24107f5a50a11792f8a7f011877e7470dfa (diff)
clk: iproc: Split off dig_filter
The PLL loop filter/gain can be located in a separate register on some SoCs. Split these off into a separate variable, so that an offset can be added if necessary. Also, make the necessary modifications to the Cygnus and NSP drivers for this change. Signed-off-by: Jon Mason <jonmason@broadcom.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/bcm/clk-cygnus.c17
-rw-r--r--drivers/clk/bcm/clk-iproc-pll.c14
-rw-r--r--drivers/clk/bcm/clk-iproc.h10
-rw-r--r--drivers/clk/bcm/clk-nsp.c14
4 files changed, 38 insertions, 17 deletions
diff --git a/drivers/clk/bcm/clk-cygnus.c b/drivers/clk/bcm/clk-cygnus.c
index aac82c671eeb..3a228b6d4fee 100644
--- a/drivers/clk/bcm/clk-cygnus.c
+++ b/drivers/clk/bcm/clk-cygnus.c
@@ -34,9 +34,11 @@
34 { .offset = o, .en_shift = es, .high_shift = hs, \ 34 { .offset = o, .en_shift = es, .high_shift = hs, \
35 .high_width = hw, .low_shift = ls, .low_width = lw } 35 .high_width = hw, .low_shift = ls, .low_width = lw }
36 36
37#define RESET_VAL(o, rs, prs, kis, kiw, kps, kpw, kas, kaw) { .offset = o, \ 37#define RESET_VAL(o, rs, prs) { .offset = o, .reset_shift = rs, \
38 .reset_shift = rs, .p_reset_shift = prs, .ki_shift = kis, \ 38 .p_reset_shift = prs }
39 .ki_width = kiw, .kp_shift = kps, .kp_width = kpw, .ka_shift = kas, \ 39
40#define DF_VAL(o, kis, kiw, kps, kpw, kas, kaw) { .offset = o, .ki_shift = kis,\
41 .ki_width = kiw, .kp_shift = kps, .kp_width = kpw, .ka_shift = kas, \
40 .ka_width = kaw } 42 .ka_width = kaw }
41 43
42#define VCO_CTRL_VAL(uo, lo) { .u_offset = uo, .l_offset = lo } 44#define VCO_CTRL_VAL(uo, lo) { .u_offset = uo, .l_offset = lo }
@@ -56,7 +58,8 @@ static const struct iproc_pll_ctrl genpll = {
56 .flags = IPROC_CLK_AON | IPROC_CLK_PLL_HAS_NDIV_FRAC | 58 .flags = IPROC_CLK_AON | IPROC_CLK_PLL_HAS_NDIV_FRAC |
57 IPROC_CLK_PLL_NEEDS_SW_CFG, 59 IPROC_CLK_PLL_NEEDS_SW_CFG,
58 .aon = AON_VAL(0x0, 2, 1, 0), 60 .aon = AON_VAL(0x0, 2, 1, 0),
59 .reset = RESET_VAL(0x0, 11, 10, 4, 3, 0, 4, 7, 3), 61 .reset = RESET_VAL(0x0, 11, 10),
62 .dig_filter = DF_VAL(0x0, 4, 3, 0, 4, 7, 3),
60 .sw_ctrl = SW_CTRL_VAL(0x10, 31), 63 .sw_ctrl = SW_CTRL_VAL(0x10, 31),
61 .ndiv_int = REG_VAL(0x10, 20, 10), 64 .ndiv_int = REG_VAL(0x10, 20, 10),
62 .ndiv_frac = REG_VAL(0x10, 0, 20), 65 .ndiv_frac = REG_VAL(0x10, 0, 20),
@@ -114,7 +117,8 @@ CLK_OF_DECLARE(cygnus_genpll, "brcm,cygnus-genpll", cygnus_genpll_clk_init);
114static const struct iproc_pll_ctrl lcpll0 = { 117static const struct iproc_pll_ctrl lcpll0 = {
115 .flags = IPROC_CLK_AON | IPROC_CLK_PLL_NEEDS_SW_CFG, 118 .flags = IPROC_CLK_AON | IPROC_CLK_PLL_NEEDS_SW_CFG,
116 .aon = AON_VAL(0x0, 2, 5, 4), 119 .aon = AON_VAL(0x0, 2, 5, 4),
117 .reset = RESET_VAL(0x0, 31, 30, 27, 3, 23, 4, 19, 4), 120 .reset = RESET_VAL(0x0, 31, 30),
121 .dig_filter = DF_VAL(0x0, 27, 3, 23, 4, 19, 4),
118 .sw_ctrl = SW_CTRL_VAL(0x4, 31), 122 .sw_ctrl = SW_CTRL_VAL(0x4, 31),
119 .ndiv_int = REG_VAL(0x4, 16, 10), 123 .ndiv_int = REG_VAL(0x4, 16, 10),
120 .pdiv = REG_VAL(0x4, 26, 4), 124 .pdiv = REG_VAL(0x4, 26, 4),
@@ -191,7 +195,8 @@ static const struct iproc_pll_ctrl mipipll = {
191 IPROC_CLK_NEEDS_READ_BACK, 195 IPROC_CLK_NEEDS_READ_BACK,
192 .aon = AON_VAL(0x0, 4, 17, 16), 196 .aon = AON_VAL(0x0, 4, 17, 16),
193 .asiu = ASIU_GATE_VAL(0x0, 3), 197 .asiu = ASIU_GATE_VAL(0x0, 3),
194 .reset = RESET_VAL(0x0, 11, 10, 4, 3, 0, 4, 7, 4), 198 .reset = RESET_VAL(0x0, 11, 10),
199 .dig_filter = DF_VAL(0x0, 4, 3, 0, 4, 7, 4),
195 .ndiv_int = REG_VAL(0x10, 20, 10), 200 .ndiv_int = REG_VAL(0x10, 20, 10),
196 .ndiv_frac = REG_VAL(0x10, 0, 20), 201 .ndiv_frac = REG_VAL(0x10, 0, 20),
197 .pdiv = REG_VAL(0x14, 0, 4), 202 .pdiv = REG_VAL(0x14, 0, 4),
diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c
index bfa28ba1394e..2be93955262e 100644
--- a/drivers/clk/bcm/clk-iproc-pll.c
+++ b/drivers/clk/bcm/clk-iproc-pll.c
@@ -224,13 +224,17 @@ static void __pll_bring_out_reset(struct iproc_pll *pll, unsigned int kp,
224 u32 val; 224 u32 val;
225 const struct iproc_pll_ctrl *ctrl = pll->ctrl; 225 const struct iproc_pll_ctrl *ctrl = pll->ctrl;
226 const struct iproc_pll_reset_ctrl *reset = &ctrl->reset; 226 const struct iproc_pll_reset_ctrl *reset = &ctrl->reset;
227 const struct iproc_pll_dig_filter_ctrl *dig_filter = &ctrl->dig_filter;
228
229 val = readl(pll->pll_base + dig_filter->offset);
230 val &= ~(bit_mask(dig_filter->ki_width) << dig_filter->ki_shift |
231 bit_mask(dig_filter->kp_width) << dig_filter->kp_shift |
232 bit_mask(dig_filter->ka_width) << dig_filter->ka_shift);
233 val |= ki << dig_filter->ki_shift | kp << dig_filter->kp_shift |
234 ka << dig_filter->ka_shift;
235 iproc_pll_write(pll, pll->pll_base, dig_filter->offset, val);
227 236
228 val = readl(pll->pll_base + reset->offset); 237 val = readl(pll->pll_base + reset->offset);
229 val &= ~(bit_mask(reset->ki_width) << reset->ki_shift |
230 bit_mask(reset->kp_width) << reset->kp_shift |
231 bit_mask(reset->ka_width) << reset->ka_shift);
232 val |= ki << reset->ki_shift | kp << reset->kp_shift |
233 ka << reset->ka_shift;
234 val |= 1 << reset->reset_shift | 1 << reset->p_reset_shift; 238 val |= 1 << reset->reset_shift | 1 << reset->p_reset_shift;
235 iproc_pll_write(pll, pll->pll_base, reset->offset, val); 239 iproc_pll_write(pll, pll->pll_base, reset->offset, val);
236} 240}
diff --git a/drivers/clk/bcm/clk-iproc.h b/drivers/clk/bcm/clk-iproc.h
index ff7bfad48c13..b71c19737efd 100644
--- a/drivers/clk/bcm/clk-iproc.h
+++ b/drivers/clk/bcm/clk-iproc.h
@@ -94,12 +94,19 @@ struct iproc_pll_aon_pwr_ctrl {
94}; 94};
95 95
96/* 96/*
97 * Control of the PLL reset, with Ki, Kp, and Ka parameters 97 * Control of the PLL reset
98 */ 98 */
99struct iproc_pll_reset_ctrl { 99struct iproc_pll_reset_ctrl {
100 unsigned int offset; 100 unsigned int offset;
101 unsigned int reset_shift; 101 unsigned int reset_shift;
102 unsigned int p_reset_shift; 102 unsigned int p_reset_shift;
103};
104
105/*
106 * Control of the Ki, Kp, and Ka parameters
107 */
108struct iproc_pll_dig_filter_ctrl {
109 unsigned int offset;
103 unsigned int ki_shift; 110 unsigned int ki_shift;
104 unsigned int ki_width; 111 unsigned int ki_width;
105 unsigned int kp_shift; 112 unsigned int kp_shift;
@@ -129,6 +136,7 @@ struct iproc_pll_ctrl {
129 struct iproc_pll_aon_pwr_ctrl aon; 136 struct iproc_pll_aon_pwr_ctrl aon;
130 struct iproc_asiu_gate asiu; 137 struct iproc_asiu_gate asiu;
131 struct iproc_pll_reset_ctrl reset; 138 struct iproc_pll_reset_ctrl reset;
139 struct iproc_pll_dig_filter_ctrl dig_filter;
132 struct iproc_pll_sw_ctrl sw_ctrl; 140 struct iproc_pll_sw_ctrl sw_ctrl;
133 struct iproc_clk_reg_op ndiv_int; 141 struct iproc_clk_reg_op ndiv_int;
134 struct iproc_clk_reg_op ndiv_frac; 142 struct iproc_clk_reg_op ndiv_frac;
diff --git a/drivers/clk/bcm/clk-nsp.c b/drivers/clk/bcm/clk-nsp.c
index bc8ebdcdfeca..cf66f640a47d 100644
--- a/drivers/clk/bcm/clk-nsp.c
+++ b/drivers/clk/bcm/clk-nsp.c
@@ -26,9 +26,11 @@
26#define AON_VAL(o, pw, ps, is) { .offset = o, .pwr_width = pw, \ 26#define AON_VAL(o, pw, ps, is) { .offset = o, .pwr_width = pw, \
27 .pwr_shift = ps, .iso_shift = is } 27 .pwr_shift = ps, .iso_shift = is }
28 28
29#define RESET_VAL(o, rs, prs, kis, kiw, kps, kpw, kas, kaw) { .offset = o, \ 29#define RESET_VAL(o, rs, prs) { .offset = o, .reset_shift = rs, \
30 .reset_shift = rs, .p_reset_shift = prs, .ki_shift = kis, \ 30 .p_reset_shift = prs }
31 .ki_width = kiw, .kp_shift = kps, .kp_width = kpw, .ka_shift = kas, \ 31
32#define DF_VAL(o, kis, kiw, kps, kpw, kas, kaw) { .offset = o, .ki_shift = kis,\
33 .ki_width = kiw, .kp_shift = kps, .kp_width = kpw, .ka_shift = kas, \
32 .ka_width = kaw } 34 .ka_width = kaw }
33 35
34#define ENABLE_VAL(o, es, hs, bs) { .offset = o, .enable_shift = es, \ 36#define ENABLE_VAL(o, es, hs, bs) { .offset = o, .enable_shift = es, \
@@ -43,7 +45,8 @@ CLK_OF_DECLARE(nsp_armpll, "brcm,nsp-armpll", nsp_armpll_init);
43static const struct iproc_pll_ctrl genpll = { 45static const struct iproc_pll_ctrl genpll = {
44 .flags = IPROC_CLK_PLL_HAS_NDIV_FRAC | IPROC_CLK_EMBED_PWRCTRL, 46 .flags = IPROC_CLK_PLL_HAS_NDIV_FRAC | IPROC_CLK_EMBED_PWRCTRL,
45 .aon = AON_VAL(0x0, 1, 12, 0), 47 .aon = AON_VAL(0x0, 1, 12, 0),
46 .reset = RESET_VAL(0x0, 11, 10, 4, 3, 0, 4, 7, 3), 48 .reset = RESET_VAL(0x0, 11, 10),
49 .dig_filter = DF_VAL(0x0, 4, 3, 0, 4, 7, 3),
47 .ndiv_int = REG_VAL(0x14, 20, 10), 50 .ndiv_int = REG_VAL(0x14, 20, 10),
48 .ndiv_frac = REG_VAL(0x14, 0, 20), 51 .ndiv_frac = REG_VAL(0x14, 0, 20),
49 .pdiv = REG_VAL(0x18, 24, 3), 52 .pdiv = REG_VAL(0x18, 24, 3),
@@ -99,7 +102,8 @@ CLK_OF_DECLARE(nsp_genpll_clk, "brcm,nsp-genpll", nsp_genpll_clk_init);
99static const struct iproc_pll_ctrl lcpll0 = { 102static const struct iproc_pll_ctrl lcpll0 = {
100 .flags = IPROC_CLK_PLL_HAS_NDIV_FRAC | IPROC_CLK_EMBED_PWRCTRL, 103 .flags = IPROC_CLK_PLL_HAS_NDIV_FRAC | IPROC_CLK_EMBED_PWRCTRL,
101 .aon = AON_VAL(0x0, 1, 24, 0), 104 .aon = AON_VAL(0x0, 1, 24, 0),
102 .reset = RESET_VAL(0x0, 23, 22, 16, 3, 12, 4, 19, 4), 105 .reset = RESET_VAL(0x0, 23, 22),
106 .dig_filter = DF_VAL(0x0, 16, 3, 12, 4, 19, 4),
103 .ndiv_int = REG_VAL(0x4, 20, 8), 107 .ndiv_int = REG_VAL(0x4, 20, 8),
104 .ndiv_frac = REG_VAL(0x4, 0, 20), 108 .ndiv_frac = REG_VAL(0x4, 0, 20),
105 .pdiv = REG_VAL(0x4, 28, 3), 109 .pdiv = REG_VAL(0x4, 28, 3),