public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@marvell.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: <robh+dt@kernel.org>, <pawel.moll@arm.com>,
	<mark.rutland@arm.com>, <ijc+devicetree@hellion.org.uk>,
	<galak@codeaurora.org>, <catalin.marinas@arm.com>,
	<will.deacon@arm.com>, <mturquette@baylibre.com>,
	<sboyd@codeaurora.org>, <antoine.tenart@free-electrons.com>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-clk@vger.kernel.org>
Subject: Re: [PATCH v2 6/6] arm64: dts: berlin4ct: add pll and clock nodes
Date: Mon, 23 Nov 2015 15:21:58 +0800	[thread overview]
Message-ID: <20151123152158.483aa6b5@xhacker> (raw)
In-Reply-To: <564F8B73.7070403@gmail.com>

Dear Sebastian,

On Fri, 20 Nov 2015 22:06:59 +0100
Sebastian Hesselbarth wrote:

> On 20.11.2015 09:42, Jisheng Zhang wrote:
> > Add syspll, mempll, cpupll, gateclk and berlin-clk nodes.
> >=20
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > ---
> >  arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 38 ++++++++++++++++++++++=
++++++++
> >  1 file changed, 38 insertions(+)
> >=20
> > diff --git a/arch/arm64/boot/dts/marvell/berlin4ct.dtsi b/arch/arm64/bo=
ot/dts/marvell/berlin4ct.dtsi
> > index a4a1876..808a997 100644
> > --- a/arch/arm64/boot/dts/marvell/berlin4ct.dtsi
> > +++ b/arch/arm64/boot/dts/marvell/berlin4ct.dtsi
> > @@ -42,6 +42,7 @@
> >   *     OTHER DEALINGS IN THE SOFTWARE.
> >   */
> > =20
> > +#include <dt-bindings/clock/berlin4ct.h>
> >  #include <dt-bindings/interrupt-controller/arm-gic.h>
> > =20
> >  / {
> > @@ -135,6 +136,22 @@
> >  			interrupts =3D <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_=
HIGH)>;
> >  		};
> > =20
> > +		cpupll: cpupll {
> > +			compatible =3D "marvell,berlin-pll";
> > +			reg =3D <0x922000 0x14>, <0xea0710 4>;
> > +			#clock-cells =3D <0>;
> > +			clocks =3D <&osc>, <&clk CLK_CPUFASTREF>;
> > +			bypass-shift =3D /bits/ 8 <2>;
> > +		};
> > +
> > +		mempll: mempll {
> > +			compatible =3D "marvell,berlin-pll";
> > +			reg =3D <0x940034 0x14>, <0xea0710 4>; =20
>=20
> Whenever you see overlapping/repeating reg ranges, e.g. <0xea0710 4>
> you can be sure you are not representing HW structure but driver
> structure here.
>=20
> Please merge clocks/gates/plls to a single clock complex node
> and deal with the internals by using "simple-mfd" and "syscon" regmaps.
>=20
> > +			#clock-cells =3D <0>;
> > +			clocks =3D <&osc>, <&clk CLK_MEMFASTREF>;
> > +			bypass-shift =3D /bits/ 8 <1>;
> > +		};
> > +
> >  		apb@e80000 {
> >  			compatible =3D "simple-bus";
> >  			#address-cells =3D <1>;
> > @@ -225,6 +242,27 @@
> >  			};
> >  		};
> > =20
> > +		syspll: syspll {
> > +			compatible =3D "marvell,berlin-pll";
> > +			reg =3D <0xea0200 0x14>, <0xea0710 4>;
> > +			#clock-cells =3D <0>;
> > +			clocks =3D <&osc>;
> > +			bypass-shift =3D /bits/ 8 <0>;
> > +		};
> > +
> > +		gateclk: gateclk {
> > +			compatible =3D "marvell,berlin4ct-gateclk";
> > +			reg =3D <0xea0700 4>;
> > +			#clock-cells =3D <1>;
> > +		};
> > +
> > +		clk: clk {
> > +			compatible =3D "marvell,berlin4ct-clk";
> > +			reg =3D <0xea0720 0x144>; =20
>=20
> Looking at the reg ranges, I'd say that they are all clock related
> and pretty close to each other:
>=20
> gateclk: reg =3D <0xea0700 4>;
> bypass:  reg =3D <0xea0710 4>;
> clk:     reg =3D <0xea0720 0x144>;

Although these ranges sit close, but we should represent HW structure as you
said.

First of all, let me describe the clks/plls in BG4CT. BG4CT contains:

two kinds of PLL: normal PLL and AVPLL. These PLLs are put with their users
together. For example: mempll pll registers <0xf7940034, 0x14> is put toget=
her
with mem controller registers. AVPLL control registers are put with AV devi=
ces.
You can also check mempll, cpupll and syspll ranges:

cpupll: <0x922000 0x14>

mempll: <0x940034 0x14>

syspll: <0xea0200 0x14>


We have three normal PLLS: cpupll, mempll and syspll. All these three PLLs =
use
25MHZ osc as clocksource. These plls can be bypassed. when syspll is bypass=
ed
the 25MHZ osc is directly output to syspllclk. When mempll/cpupll is bypass=
ed,
its corresponding fastrefclk is directly output to ddrphyclk/cpuclk:=20


       ---25MHZ osc----------|\
           ________            | |-- syspllclk
       ---| SYSPLL |---------|/



       ---cpufastrefclk------|\
           ________            | |-- cpuclk
       ---| CPUPLL |---------|/


       ---memfastrefclk------|\
           ________            | |-- ddrphyclk
       ---| MEMPLL |---------|/

NOTE: the fastrefclk is the so called normal clk below.



two kinds of clk: normal clk and gate clk. The normal clk supports changing
divider, selecting clock source, disabling/enabling etc. The gate clk only
supports disabling/enabling. normal clks use syspllclk as clocksource, while
gate clks use perifsysclk as clocksource.


So what's the representing HW structure in fact? Here is my proposal:

1. have mempll, cpupll and syspll node in dts

2. one gateclk node in dts for gateclks

3. one normalclk node in dts for normal clks

4. one ccf clock-mux for cpuclk, ddrphyclk and syspllclk.

what do you think?


=46rom another side, let's have a look at driver/clk/mvebu. As can be seen,
different clks register are close each other, for example, gateclk and core=
clk
in arch/arm/boot/dts/armada-xp.dtsi.

And drivers/clk/sunxi, arch/arm/boot/dts/sun7i-a20.dtsi, the pll4, pll12, g=
t_clk
and ahb*, apb* etc...=20

why these SoCs don't merge clocks/gates/plls to a single clock complex node=
?=20
I think that's because they are representing real HW structure.

Thanks,
Jisheng


>=20
> So, please just follow the OF/driver structure we already
> have for Berlin2.
>=20
> Sebastian
>=20
> > +			#clock-cells =3D <1>;
> > +			clocks =3D <&syspll>;
> > +		};
> > +
> >  		soc_pinctrl: pin-controller@ea8000 {
> >  			compatible =3D "marvell,berlin4ct-soc-pinctrl";
> >  			reg =3D <0xea8000 0x14>;
> >  =20
>=20

  reply	other threads:[~2015-11-23  7:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20  8:42 [PATCH v2 0/6] Add Marvell berlin4ct clk support Jisheng Zhang
2015-11-20  8:42 ` [PATCH v2 1/6] clk: berlin: add common pll driver Jisheng Zhang
2015-11-20 20:46   ` Sebastian Hesselbarth
2015-11-20  8:42 ` [PATCH v2 2/6] clk: berlin: add common clk driver for newer SoCs Jisheng Zhang
2015-11-20 20:54   ` Sebastian Hesselbarth
2015-11-20  8:42 ` [PATCH v2 3/6] clk: berlin: add common gateclk " Jisheng Zhang
2015-11-20  8:42 ` [PATCH v2 4/6] clk: berlin: add clk support for berlin4ct Jisheng Zhang
2015-11-20 20:56   ` Sebastian Hesselbarth
2015-11-23  5:56     ` Jisheng Zhang
2015-11-20  8:42 ` [PATCH v2 5/6] dt-bindings: add binding for marvell berlin4ct SoC Jisheng Zhang
2015-11-20 14:37   ` Rob Herring
2015-11-20  8:42 ` [PATCH v2 6/6] arm64: dts: berlin4ct: add pll and clock nodes Jisheng Zhang
2015-11-20 21:06   ` Sebastian Hesselbarth
2015-11-23  7:21     ` Jisheng Zhang [this message]
2015-11-23  8:14       ` Jisheng Zhang
2015-11-23  8:30       ` Sebastian Hesselbarth
2015-11-23  8:54         ` Jisheng Zhang
2015-11-24  2:35           ` Jisheng Zhang
2015-11-27  7:51             ` Sebastian Hesselbarth
2015-11-27  8:39               ` Jisheng Zhang
2015-11-27  8:45                 ` Jisheng Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151123152158.483aa6b5@xhacker \
    --to=jszhang@marvell.com \
    --cc=antoine.tenart@free-electrons.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox