Skip to content

Commit 423f042

Browse files
Eugeniy Paltsevbebarino
authored andcommitted
CLK: HSDK: CGU: support PLL bypassing
Support setting PLL to bypass mode to support output frequency equal to input one. Signed-off-by: Eugeniy Paltsev <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 907f929 commit 423f042

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

drivers/clk/clk-hsdk-pll.c

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -53,35 +53,37 @@ struct hsdk_pll_cfg {
5353
u32 fbdiv;
5454
u32 odiv;
5555
u32 band;
56+
u32 bypass;
5657
};
5758

5859
static const struct hsdk_pll_cfg asdt_pll_cfg[] = {
59-
{ 100000000, 0, 11, 3, 0 },
60-
{ 133000000, 0, 15, 3, 0 },
61-
{ 200000000, 1, 47, 3, 0 },
62-
{ 233000000, 1, 27, 2, 0 },
63-
{ 300000000, 1, 35, 2, 0 },
64-
{ 333000000, 1, 39, 2, 0 },
65-
{ 400000000, 1, 47, 2, 0 },
66-
{ 500000000, 0, 14, 1, 0 },
67-
{ 600000000, 0, 17, 1, 0 },
68-
{ 700000000, 0, 20, 1, 0 },
69-
{ 800000000, 0, 23, 1, 0 },
70-
{ 900000000, 1, 26, 0, 0 },
71-
{ 1000000000, 1, 29, 0, 0 },
72-
{ 1100000000, 1, 32, 0, 0 },
73-
{ 1200000000, 1, 35, 0, 0 },
74-
{ 1300000000, 1, 38, 0, 0 },
75-
{ 1400000000, 1, 41, 0, 0 },
76-
{ 1500000000, 1, 44, 0, 0 },
77-
{ 1600000000, 1, 47, 0, 0 },
60+
{ 100000000, 0, 11, 3, 0, 0 },
61+
{ 133000000, 0, 15, 3, 0, 0 },
62+
{ 200000000, 1, 47, 3, 0, 0 },
63+
{ 233000000, 1, 27, 2, 0, 0 },
64+
{ 300000000, 1, 35, 2, 0, 0 },
65+
{ 333000000, 1, 39, 2, 0, 0 },
66+
{ 400000000, 1, 47, 2, 0, 0 },
67+
{ 500000000, 0, 14, 1, 0, 0 },
68+
{ 600000000, 0, 17, 1, 0, 0 },
69+
{ 700000000, 0, 20, 1, 0, 0 },
70+
{ 800000000, 0, 23, 1, 0, 0 },
71+
{ 900000000, 1, 26, 0, 0, 0 },
72+
{ 1000000000, 1, 29, 0, 0, 0 },
73+
{ 1100000000, 1, 32, 0, 0, 0 },
74+
{ 1200000000, 1, 35, 0, 0, 0 },
75+
{ 1300000000, 1, 38, 0, 0, 0 },
76+
{ 1400000000, 1, 41, 0, 0, 0 },
77+
{ 1500000000, 1, 44, 0, 0, 0 },
78+
{ 1600000000, 1, 47, 0, 0, 0 },
7879
{}
7980
};
8081

8182
static const struct hsdk_pll_cfg hdmi_pll_cfg[] = {
82-
{ 297000000, 0, 21, 2, 0 },
83-
{ 540000000, 0, 19, 1, 0 },
84-
{ 594000000, 0, 21, 1, 0 },
83+
{ 27000000, 0, 0, 0, 0, 1 },
84+
{ 297000000, 0, 21, 2, 0, 0 },
85+
{ 540000000, 0, 19, 1, 0, 0 },
86+
{ 594000000, 0, 21, 1, 0, 0 },
8587
{}
8688
};
8789

@@ -134,11 +136,16 @@ static inline void hsdk_pll_set_cfg(struct hsdk_pll_clk *clk,
134136
{
135137
u32 val = 0;
136138

137-
/* Powerdown and Bypass bits should be cleared */
138-
val |= cfg->idiv << CGU_PLL_CTRL_IDIV_SHIFT;
139-
val |= cfg->fbdiv << CGU_PLL_CTRL_FBDIV_SHIFT;
140-
val |= cfg->odiv << CGU_PLL_CTRL_ODIV_SHIFT;
141-
val |= cfg->band << CGU_PLL_CTRL_BAND_SHIFT;
139+
if (cfg->bypass) {
140+
val = hsdk_pll_read(clk, CGU_PLL_CTRL);
141+
val |= CGU_PLL_CTRL_BYPASS;
142+
} else {
143+
/* Powerdown and Bypass bits should be cleared */
144+
val |= cfg->idiv << CGU_PLL_CTRL_IDIV_SHIFT;
145+
val |= cfg->fbdiv << CGU_PLL_CTRL_FBDIV_SHIFT;
146+
val |= cfg->odiv << CGU_PLL_CTRL_ODIV_SHIFT;
147+
val |= cfg->band << CGU_PLL_CTRL_BAND_SHIFT;
148+
}
142149

143150
dev_dbg(clk->dev, "write configuration: %#x\n", val);
144151

0 commit comments

Comments
 (0)