2019-10-31 10:03:25

by Peng Fan

[permalink] [raw]
Subject: [PATCH 0/2] clk: imx: imx7d: move setting clk parent to dts

From: Peng Fan <[email protected]>

This patchset is to move the clk_set_parent operation from driver
to dts, because assigned-clock-parents could do the job and we
could simplify the driver then.

Peng Fan (2):
arm: dts: imx7s: ccm: add assigned-clocks
clk: imx: imx7d: remove clk_set_parent

arch/arm/boot/dts/imx7s.dtsi | 20 ++++++++++++++++++++
drivers/clk/imx/clk-imx7d.c | 12 ------------
2 files changed, 20 insertions(+), 12 deletions(-)

--
2.16.4


2019-10-31 10:03:41

by Peng Fan

[permalink] [raw]
Subject: [PATCH 2/2] clk: imx: imx7d: remove clk_set_parent

From: Peng Fan <[email protected]>

Since the set parent could be done by assigned-clock-parents in
dts, so no need clk_set_parent in driver.

Signed-off-by: Peng Fan <[email protected]>
---
drivers/clk/imx/clk-imx7d.c | 12 ------------
1 file changed, 12 deletions(-)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index 0c9f7adb41ae..b73e3e148497 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -878,18 +878,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)

of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);

- clk_set_parent(hws[IMX7D_PLL_ARM_MAIN_BYPASS]->clk, hws[IMX7D_PLL_ARM_MAIN]->clk);
- clk_set_parent(hws[IMX7D_PLL_DRAM_MAIN_BYPASS]->clk, hws[IMX7D_PLL_DRAM_MAIN]->clk);
- clk_set_parent(hws[IMX7D_PLL_SYS_MAIN_BYPASS]->clk, hws[IMX7D_PLL_SYS_MAIN]->clk);
- clk_set_parent(hws[IMX7D_PLL_ENET_MAIN_BYPASS]->clk, hws[IMX7D_PLL_ENET_MAIN]->clk);
- clk_set_parent(hws[IMX7D_PLL_AUDIO_MAIN_BYPASS]->clk, hws[IMX7D_PLL_AUDIO_MAIN]->clk);
- clk_set_parent(hws[IMX7D_PLL_VIDEO_MAIN_BYPASS]->clk, hws[IMX7D_PLL_VIDEO_MAIN]->clk);
-
- clk_set_parent(hws[IMX7D_MIPI_CSI_ROOT_SRC]->clk, hws[IMX7D_PLL_SYS_PFD3_CLK]->clk);
-
- /* use old gpt clk setting, gpt1 root clk must be twice as gpt counter freq */
- clk_set_parent(hws[IMX7D_GPT1_ROOT_SRC]->clk, hws[IMX7D_OSC_24M_CLK]->clk);
-
/* Set clock rate for USBPHY, the USB_PLL at CCM is from USBOTG2 */
hws[IMX7D_USB1_MAIN_480M_CLK] = imx_clk_hw_fixed_factor("pll_usb1_main_clk", "osc", 20, 1);
hws[IMX7D_USB_MAIN_480M_CLK] = imx_clk_hw_fixed_factor("pll_usb_main_clk", "osc", 20, 1);
--
2.16.4

2019-10-31 10:04:53

by Peng Fan

[permalink] [raw]
Subject: [PATCH 1/2] arm: dts: imx7s: ccm: add assigned-clocks

From: Peng Fan <[email protected]>

Add assigned-clocks and assigned-clock-parents, then
we could remove the clk_set_parent code in clk-imx7d.c.

Signed-off-by: Peng Fan <[email protected]>
---
arch/arm/boot/dts/imx7s.dtsi | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 1b812f4e7453..36ae864d9b7c 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -625,6 +625,26 @@
#clock-cells = <1>;
clocks = <&ckil>, <&osc>;
clock-names = "ckil", "osc";
+ /*
+ * gpt1 root clk must be twice as gpt
+ * counter freq
+ */
+ assigned-clocks = <&clks IMX7D_PLL_ARM_MAIN_BYPASS>,
+ <&clks IMX7D_PLL_DRAM_MAIN_BYPASS>,
+ <&clks IMX7D_PLL_SYS_MAIN_BYPASS>,
+ <&clks IMX7D_PLL_ENET_MAIN_BYPASS>,
+ <&clks IMX7D_PLL_AUDIO_MAIN_BYPASS>,
+ <&clks IMX7D_PLL_VIDEO_MAIN_BYPASS>,
+ <&clks IMX7D_MIPI_CSI_ROOT_SRC>,
+ <&clks IMX7D_GPT1_ROOT_SRC>;
+ assigned-clock-parents = <&clks IMX7D_PLL_ARM_MAIN>,
+ <&clks IMX7D_PLL_DRAM_MAIN>,
+ <&clks IMX7D_PLL_SYS_MAIN>,
+ <&clks IMX7D_PLL_ENET_MAIN>,
+ <&clks IMX7D_PLL_AUDIO_MAIN>,
+ <&clks IMX7D_PLL_VIDEO_MAIN>,
+ <&clks IMX7D_PLL_SYS_PFD3_CLK>,
+ <&clks IMX7D_OSC_24M_CLK>;
};

src: src@30390000 {
--
2.16.4

2019-10-31 12:08:21

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 2/2] clk: imx: imx7d: remove clk_set_parent

Hi Peng,

On Thu, Oct 31, 2019 at 7:02 AM Peng Fan <[email protected]> wrote:
>
> From: Peng Fan <[email protected]>
>
> Since the set parent could be done by assigned-clock-parents in
> dts, so no need clk_set_parent in driver.

It looks like this will cause breakage if someone is using an old dtb, right?

We try not to break existing dtbs.

2019-10-31 12:11:46

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 1/2] arm: dts: imx7s: ccm: add assigned-clocks

Hi Peng,

On Thu, Oct 31, 2019 at 7:01 AM Peng Fan <[email protected]> wrote:
>
> From: Peng Fan <[email protected]>
>
> Add assigned-clocks and assigned-clock-parents, then
> we could remove the clk_set_parent code in clk-imx7d.c.

Change itself looks good, but please do not mention the clock driver
in the commit log.

Devicetree should be OS agnostic.

2019-11-01 01:44:16

by Peng Fan

[permalink] [raw]
Subject: RE: [PATCH 2/2] clk: imx: imx7d: remove clk_set_parent

> Subject: Re: [PATCH 2/2] clk: imx: imx7d: remove clk_set_parent
>
> Hi Peng,
>
> On Thu, Oct 31, 2019 at 7:02 AM Peng Fan <[email protected]> wrote:
> >
> > From: Peng Fan <[email protected]>
> >
> > Since the set parent could be done by assigned-clock-parents in dts,
> > so no need clk_set_parent in driver.
>
> It looks like this will cause breakage if someone is using an old dtb, right?

Yes.

>
> We try not to break existing dtbs.

ok. Then there will be lots code in tree for compatibility.

Thanks,
Peng.