Skip to content

Commit 9179d23

Browse files
JackyBaiabelvesa
authored andcommitted
clk: imx: Update the pfdv2 for 8ulp specific support
On i.MX8ULP, the 'CLK_SET_RATE_PARENT' flag should NOT be set and according to the laest RM, the PFD divider value range seems will be changed in the future, so update the pfdv2 to include the specific support for i.MX8ULP. Signed-off-by: Jacky Bai <[email protected]> Reviewed-by: Abel Vesa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abel Vesa <[email protected]>
1 parent ae8a10d commit 9179d23

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

drivers/clk/imx/clk-imx7ulp.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np)
8282
hws[IMX7ULP_CLK_SPLL] = imx_clk_hw_pllv4(IMX_PLLV4_IMX7ULP, "spll", "spll_pre_div", base + 0x600);
8383

8484
/* APLL PFDs */
85-
hws[IMX7ULP_CLK_APLL_PFD0] = imx_clk_hw_pfdv2("apll_pfd0", "apll", base + 0x50c, 0);
86-
hws[IMX7ULP_CLK_APLL_PFD1] = imx_clk_hw_pfdv2("apll_pfd1", "apll", base + 0x50c, 1);
87-
hws[IMX7ULP_CLK_APLL_PFD2] = imx_clk_hw_pfdv2("apll_pfd2", "apll", base + 0x50c, 2);
88-
hws[IMX7ULP_CLK_APLL_PFD3] = imx_clk_hw_pfdv2("apll_pfd3", "apll", base + 0x50c, 3);
85+
hws[IMX7ULP_CLK_APLL_PFD0] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "apll_pfd0", "apll", base + 0x50c, 0);
86+
hws[IMX7ULP_CLK_APLL_PFD1] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "apll_pfd1", "apll", base + 0x50c, 1);
87+
hws[IMX7ULP_CLK_APLL_PFD2] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "apll_pfd2", "apll", base + 0x50c, 2);
88+
hws[IMX7ULP_CLK_APLL_PFD3] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "apll_pfd3", "apll", base + 0x50c, 3);
8989

9090
/* SPLL PFDs */
91-
hws[IMX7ULP_CLK_SPLL_PFD0] = imx_clk_hw_pfdv2("spll_pfd0", "spll", base + 0x60C, 0);
92-
hws[IMX7ULP_CLK_SPLL_PFD1] = imx_clk_hw_pfdv2("spll_pfd1", "spll", base + 0x60C, 1);
93-
hws[IMX7ULP_CLK_SPLL_PFD2] = imx_clk_hw_pfdv2("spll_pfd2", "spll", base + 0x60C, 2);
94-
hws[IMX7ULP_CLK_SPLL_PFD3] = imx_clk_hw_pfdv2("spll_pfd3", "spll", base + 0x60C, 3);
91+
hws[IMX7ULP_CLK_SPLL_PFD0] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "spll_pfd0", "spll", base + 0x60C, 0);
92+
hws[IMX7ULP_CLK_SPLL_PFD1] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "spll_pfd1", "spll", base + 0x60C, 1);
93+
hws[IMX7ULP_CLK_SPLL_PFD2] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "spll_pfd2", "spll", base + 0x60C, 2);
94+
hws[IMX7ULP_CLK_SPLL_PFD3] = imx_clk_hw_pfdv2(IMX_PFDV2_IMX7ULP, "spll_pfd3", "spll", base + 0x60C, 3);
9595

9696
/* PLL Mux */
9797
hws[IMX7ULP_CLK_APLL_PFD_SEL] = imx_clk_hw_mux_flags("apll_pfd_sel", base + 0x508, 14, 2, apll_pfd_sels, ARRAY_SIZE(apll_pfd_sels), CLK_SET_RATE_PARENT | CLK_SET_PARENT_GATE);

drivers/clk/imx/clk-pfdv2.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ static const struct clk_ops clk_pfdv2_ops = {
200200
.is_enabled = clk_pfdv2_is_enabled,
201201
};
202202

203-
struct clk_hw *imx_clk_hw_pfdv2(const char *name, const char *parent_name,
204-
void __iomem *reg, u8 idx)
203+
struct clk_hw *imx_clk_hw_pfdv2(enum imx_pfdv2_type type, const char *name,
204+
const char *parent_name, void __iomem *reg, u8 idx)
205205
{
206206
struct clk_init_data init;
207207
struct clk_pfdv2 *pfd;
@@ -223,7 +223,10 @@ struct clk_hw *imx_clk_hw_pfdv2(const char *name, const char *parent_name,
223223
init.ops = &clk_pfdv2_ops;
224224
init.parent_names = &parent_name;
225225
init.num_parents = 1;
226-
init.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT;
226+
if (type == IMX_PFDV2_IMX7ULP)
227+
init.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT;
228+
else
229+
init.flags = CLK_SET_RATE_GATE;
227230

228231
pfd->hw.init = &init;
229232

drivers/clk/imx/clk.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ enum imx_pllv4_type {
4747
IMX_PLLV4_IMX8ULP,
4848
};
4949

50+
enum imx_pfdv2_type {
51+
IMX_PFDV2_IMX7ULP,
52+
IMX_PFDV2_IMX8ULP,
53+
};
54+
5055
/* NOTE: Rate table should be kept sorted in descending order. */
5156
struct imx_pll14xx_rate_table {
5257
unsigned int rate;
@@ -270,8 +275,8 @@ struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,
270275
struct clk_hw *imx_clk_hw_pfd(const char *name, const char *parent_name,
271276
void __iomem *reg, u8 idx);
272277

273-
struct clk_hw *imx_clk_hw_pfdv2(const char *name, const char *parent_name,
274-
void __iomem *reg, u8 idx);
278+
struct clk_hw *imx_clk_hw_pfdv2(enum imx_pfdv2_type type, const char *name,
279+
const char *parent_name, void __iomem *reg, u8 idx);
275280

276281
struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name,
277282
void __iomem *reg, u8 shift, u8 width,

0 commit comments

Comments
 (0)