linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] clk: imx: scu: add parsing clocks from device tree support
@ 2019-02-21 18:03 Aisheng Dong
  2019-02-21 18:03 ` [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree Aisheng Dong
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Aisheng Dong @ 2019-02-21 18:03 UTC (permalink / raw)
  To: linux-clk
  Cc: linux-arm-kernel, sboyd, mturquette, shawnguo, Fabio Estevam,
	dl-linux-imx, kernel, Aisheng Dong

This patch series is a preparation for the MX8 Architecture improvement.
As for IMX SCU based platforms like MX8QM and MX8QXP, they are comprised
of a couple of SS(Subsystems) while most of them within the same SS
can be shared. e.g. Clocks, Devices and etc.

However, current device tree is heavily depends on Clocks IDs defined which
cause some troubles in writing the common <soc>-ss-xx.dtsi file.

This patch series adds a new binding to support parsing clocks from device tree
which can fully decouple the dependency of Clock IDs in device tree.
This can make the clock driver much easily to be maintained in the future and
avoid writing a lot of duplicated codes.

Dong Aisheng (4):
  dt-bindings: firmware: imx-scu: new binding to parse clocks from
    device tree
  dt-bindings: clock: imx-lpcg: add support to parse clocks from device
    tree
  clk: imx: imx8qxp: add parsing clocks from device tree
  clk: imx: imx8qxp-lpcg: add parsing clocks from device tree

 .../devicetree/bindings/arm/freescale/fsl,scu.txt  | 29 +++++--
 .../devicetree/bindings/clock/imx8qxp-lpcg.txt     | 14 ++++
 drivers/clk/imx/clk-imx8qxp-lpcg.c                 | 90 ++++++++++++++++++++++
 drivers/clk/imx/clk-imx8qxp.c                      | 43 +++++++++++
 include/dt-bindings/firmware/imx/rsrc.h            | 17 ++++
 5 files changed, 185 insertions(+), 8 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree
@ 2019-04-15 14:37 Aisheng Dong
  0 siblings, 0 replies; 16+ messages in thread
From: Aisheng Dong @ 2019-04-15 14:37 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-clk, linux-arm-kernel, sboyd, mturquette, shawnguo,
	Fabio Estevam, dl-linux-imx, kernel, devicetree

Hi Rob,

> > > > a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
> > > > b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
> > > > index 72d481c..2816789 100644
> > > > --- a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
> > > > +++ b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
> > > > @@ -78,6 +78,19 @@ Required properties:
> > > >                       "fsl,imx8qm-clock"
> > > >                       "fsl,imx8qxp-clock"
> > > >                     followed by "fsl,scu-clk"
> > > > +- #clock-cells:            Should be 0.
> > > > +- rsrc-id:         Resource ID associated with this clock
> > > > +- clk-type:                Type of this clock.
> > > > +                   Refer to <include/dt-bindings/firmware/imx/rsrc.h>
> for
> > > > +                   available clock types supported by SCU.
> > >
> > > Can't you just make these 2 values clock cells? I'm all for getting
> > > rid of made up clock numbers.
> > >
> >
> > Thanks for the agreement to remove clock IDs.
> >
> > The 2 values clock cell seems not the best approach for i.MX because
> > it still needs to define all clocks in the driver which is exactly we
> > want to avoid now due to some special HW characteristic:
> 
> Why's that? You can walk the DT and extract the 2 cells for each clock present.
> That's not any different than walking child nodes here and getting the resource
> ids and type. That's not really fast, but if speed is really an issue we can
> consider addressing that in ways that extend rather than change the binding.
> 

Due to searching the 'clocks' property of all device nodes indirectly to 
exact the 2 cell value causes much troubles in driver implementation and
looks a bit weird and is very low efficiency ( the performance will also potentially
be affected by adding new unrelevant nodes which is bad), we found the below
alternative way to do the same 2 cell binding, but having no performance issue.
It's much similar to the ARM SCPI clock binding.
Documentation/devicetree/bindings/arm/arm,scpi.txt

Do you think if it's okay to you?

If we have to use 2 cell binding, we probably would prefer to use this way
as it can relief us a lot from indirectly searching the 'clocks' property. 

If you're ok, please let me know, I will make it in V2 for the review.

enet0_clk: clock-enet0 {
        compatible = "fsl,imx8qxp-clock", "fsl,scu-clk";
        #clock-cells = <2>;
        clock-indice = <IMX_SC_PM_CLK_PER>,		// clock cell 2 value
                       <IMX_SC_PM_CLK_BYPASS>,
                       <IMX_SC_PM_CLK_MISC0>;
        clock-output-names = "enet0_clk",
                             "enet0_bypass_clk",
                             "enet0_rgmii_clk";
		// we can use the same resource id for clock cells 1 value
		// or probably encoded in node@reg?
        power-domains = <&pd IMX_SC_R_ENET_0>; 
};

enet0_lpcg: clock-controller@5b230000 {
        compatible = "fsl,imx8qxp-lpcg";
        reg = <0x5b230000 0x10000>;
        #clock-cells = <1>;
        clocks = <&enet0_clk IMX_SC_R_ENET_0 IMX_SC_PM_CLK_PER>,
                 <&enet0_clk IMX_SC_R_ENET_0 IMX_SC_PM_CLK_PER>,
                 <&conn_axi_clk>, <&conn_ipg_clk>, <&conn_ipg_clk>;
        bit-offset = <0 4 8 16 20>;
        clock-output-names = "enet0_ipg_root_clk",
                             "enet0_tx_clk",
                             "enet0_ahb_clk",
                             "enet0_ipg_clk",
                             "enet0_ipg_s_clk";
        power-domains = <&pd IMX_SC_R_ENET_0>;
};

fec1: ethernet@5b040000 {
        reg = <0x5b040000 0x10000>;
        interrupts = <GIC_SPI 258 IRQ_TYPE_LEVEL_HIGH>,
                     <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
                     <GIC_SPI 257 IRQ_TYPE_LEVEL_HIGH>,
                     <GIC_SPI 259 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&enet0_lpcg 3>,
                 <&enet0_lpcg 2>,
                 <&enet0_lpcg 1>,
                 <&enet0_lpcg 0>;
        clock-names = "ipg", "ahb", "enet_clk_ref", "ptp";
        fsl,num-tx-queues=<3>;
        fsl,num-rx-queues=<3>;
        power-domains = <&pd IMX_SC_R_ENET_0>;
        status = "disabled";
};

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-04-15 14:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 18:03 [PATCH 0/4] clk: imx: scu: add parsing clocks from device tree support Aisheng Dong
2019-02-21 18:03 ` [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree Aisheng Dong
2019-03-26 13:47   ` Rob Herring
2019-03-27 14:35     ` Aisheng Dong
2019-04-02 14:47       ` Aisheng Dong
2019-04-09 14:04         ` Aisheng Dong
2019-04-10 15:32       ` Rob Herring
2019-04-10 17:35         ` [EXT] " Aisheng Dong
2019-02-21 18:03 ` [PATCH 2/4] dt-bindings: clock: imx-lpcg: add support " Aisheng Dong
2019-02-25 19:46   ` Stephen Boyd
2019-02-26 10:07     ` Aisheng Dong
2019-03-18 15:10     ` Aisheng Dong
2019-04-02 14:55       ` Aisheng Dong
2019-02-21 18:03 ` [PATCH 3/4] clk: imx: imx8qxp: add parsing " Aisheng Dong
2019-02-21 18:03 ` [PATCH 4/4] clk: imx: imx8qxp-lpcg: " Aisheng Dong
2019-04-15 14:37 [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse " Aisheng Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).