All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Add support for the R_CCU on Allwinner H3/A64 SoCs
@ 2017-03-15 17:28 ` Icenowy Zheng
  0 siblings, 0 replies; 33+ messages in thread
From: Icenowy Zheng @ 2017-03-15 17:28 UTC (permalink / raw)
  To: Rob Herring, Maxime Ripard, Chen-Yu Tsai
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng

Allwinner SoCs after sun6i-a31 nearly all have a R_CCU in PRCM part.
(V3s and R40 do not have it, as they have even no PRCM)

This patch adds support for the ones on H3/A64.

Some clock/reset values are reserved for easier extending the support to
A31/A23, but for this I think some changes to the PRCM MFD should be made,
see [1] (Although this is only a sketch).

The r_pio device node is also added for A64, as the driver is already
merged, and its depends (r_ccu) is now met.

[1] https://github.com/wens/linux/commits/sunxi-ng-prcm

Icenowy Zheng (5):
  dt-bindings: update device tree binding for Allwinner PRCM CCUs
  clk: sunxi-ng: add support for PRCM CCUs
  arm64: allwinner: a64: add r_ccu node
  ARM: sun8i: h3: switch apb0-related clocks to r_ccu
  arm64: allwinner: a64: add R_PIO pinctrl node

 .../devicetree/bindings/clock/sunxi-ccu.txt        |  18 +-
 arch/arm/boot/dts/sunxi-h3-h5.dtsi                 |  46 ++---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi      |  30 +++
 drivers/clk/sunxi-ng/Kconfig                       |   6 +
 drivers/clk/sunxi-ng/Makefile                      |   1 +
 drivers/clk/sunxi-ng/ccu-sun8i-r.c                 | 211 +++++++++++++++++++++
 drivers/clk/sunxi-ng/ccu-sun8i-r.h                 |  27 +++
 include/dt-bindings/clock/sun8i-r-ccu.h            |  59 ++++++
 include/dt-bindings/reset/sun8i-r-ccu.h            |  53 ++++++
 9 files changed, 419 insertions(+), 32 deletions(-)
 create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-r.c
 create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-r.h
 create mode 100644 include/dt-bindings/clock/sun8i-r-ccu.h
 create mode 100644 include/dt-bindings/reset/sun8i-r-ccu.h

-- 
2.12.0

^ permalink raw reply	[flat|nested] 33+ messages in thread
* Re: [PATCH v2 1/5] dt-bindings: update device tree binding for Allwinner PRCM CCUs
@ 2017-03-27  9:11 Icenowy Zheng
  0 siblings, 0 replies; 33+ messages in thread
From: Icenowy Zheng @ 2017-03-27  9:11 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Icenowy Zheng, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Chen-Yu Tsai


2017年3月26日 21:10于 Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>写道:
>
> On Thu, Mar 23, 2017 at 07:17:03AM +0800, Icenowy Zheng wrote: 
> > 
> > 
> > 23.03.2017, 04:09, "Maxime Ripard" <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>: 
> > > On Wed, Mar 22, 2017 at 02:22:22AM +0800, Icenowy Zheng wrote: 
> > >>  21.03.2017, 15:41, "Maxime Ripard" <maxime.ripard@free-electrons.com>: 
> > >>  > On Thu, Mar 16, 2017 at 01:28:04AM +0800, Icenowy Zheng wrote: 
> > >>  >>  Many Allwinner SoCs after A31 have a CCU in PRCM block. 
> > >>  >> 
> > >>  >>  Give the ones on H3 and A64 compatible strings. 
> > >>  >> 
> > >>  >>  Signed-off-by: Icenowy Zheng <icenowy-ymACFijhrKM@public.gmane.org> 
> > >>  >>  --- 
> > >>  >>  Changes in v2: 
> > >>  >>  - Add iosc for R_CCU's on H3/A64. (A31, A23 and A33 seem to have different 
> > >>  >>    clock for mux 3 of ar100 clk. Investgations are needed for them.) 
> > >>  >> 
> > >>  >>   Documentation/devicetree/bindings/clock/sunxi-ccu.txt | 18 +++++++++++++++++- 
> > >>  >>   1 file changed, 17 insertions(+), 1 deletion(-) 
> > >>  >> 
> > >>  >>  diff --git a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
> > >>  >>  index 68512aa398a9..4a4addff595d 100644 
> > >>  >>  --- a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
> > >>  >>  +++ b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
> > >>  >>  @@ -7,9 +7,11 @@ Required properties : 
> > >>  >>                   - "allwinner,sun8i-a23-ccu" 
> > >>  >>                   - "allwinner,sun8i-a33-ccu" 
> > >>  >>                   - "allwinner,sun8i-h3-ccu" 
> > >>  >>  + - "allwinner,sun8i-h3-r-ccu" 
> > >>  >>                   - "allwinner,sun8i-v3s-ccu" 
> > >>  >>                   - "allwinner,sun9i-a80-ccu" 
> > >>  >>                   - "allwinner,sun50i-a64-ccu" 
> > >>  >>  + - "allwinner,sun50i-a64-r-ccu" 
> > >>  >>                   - "allwinner,sun50i-h5-ccu" 
> > >>  >> 
> > >>  >>   - reg: Must contain the registers base address and length 
> > >>  >>  @@ -20,7 +22,11 @@ Required properties : 
> > >>  >>   - #clock-cells : must contain 1 
> > >>  >>   - #reset-cells : must contain 1 
> > >>  >> 
> > >>  >>  -Example: 
> > >>  >>  +For the PRCM CCUs on H3/A64, one more clock is needed: 
> > >>  >>  +- "iosc": another frequency oscillator used for CPUS (usually at 32000Hz, 
> > >>  >>  + not the same with losc) 
> > >>  > 
> > >>  > This is called the internal oscillator in the datasheet, it would 
> > >>  > probably make more sense to call it that way in the documentation too. 
> > >>  > 
> > >>  > This oscillator seems to be clocked at 16MHz, so we should represent 
> > >>  > it as such. 
> > >>  > 
> > >>  > And I'm wondering, are you *sure* that it's fed directly from the 
> > >>  > internal oscillator, or goes through the registers in the RTC, with 
> > >>  > the 32 divider and 16 prescaler by default that makes it at roughly 
> > >>  > the same rate (31.25kHz). 
> > >> 
> > >>  In fact I know nothing about it -- I only represented the code in BSP 
> > >>  clock driver. 
> > >> 
> > >>  The mux value 3 varies from SoC to SoC. For A64/H5 it's 32000, 
> > >>  for A33 it's 667000 (seems to be directly the internal OSC, as the 
> > >>  user manual says the internal OSC is 600~700kHz; but it's named 
> > >>  cpuosc rather than iosc in A33 BSP clock driver); for A80 it's even 
> > >>  PLL_AUDIO. 
> > > 
> > > Where are you getting those info from? 
> > > 
> > > As far as I know, the A33 PRCM takes the hosc, losc, pll6 and CPU 
> > > (internal) oscillator: 
> > > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/drivers/clk/sunxi/clk-sun8iw5.c#L508 
> > > 
> > > The H3 takes the hosc and losc: 
> > > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/drivers/clk/sunxi/clk-sun8iw7.c#L379 
> > > 
> > > The A80 takes the hosc and losc: 
> > > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/drivers/clk/sunxi/clk-sun9iw1.c#L281 
> > > 
> > > The A64 takes the hosc, losc, pll-periph0 and the iosc, which indeed 
> > > seems to be fed from the internal oscillator with the divider in the 
> > > RTC: 
> > > https://github.com/longsleep/linux-pine64/blob/lichee-dev-v3.10.65-bsp2.0/arch/arm64/boot/dts/sun50iw1p1-clk.dtsi#L19 
> > > https://github.com/longsleep/linux-pine64/blob/lichee-dev-v3.10.65-bsp2.0/drivers/clk/sunxi/clk-sun50iw1.c#L603 
> > 
> > But then in sunxi_init_clocks function, the iosc clock is initialized 
> > as a fixed clock with 32000Hz. 
> > 
> > The clock node in BSP device tree have a compatible of 
> > allwinner,fixed-clock, but not fixed-clock, which makes it not able 
> > to be really probed. 
>
> That clock is registered: 
> https://github.com/longsleep/linux-pine64/blob/lichee-dev-v3.10.65-bsp2.0/drivers/clk/sunxi/clk-sun50iw1.c#L1193 
>

Oh yes, but conflicts exist between the iosc registered in clk-sun50iw1.c and described in sun50iw1p1-clk.dtsi . The former is 32000, and the latter is 16000000.

What should we do then?

(Maybe it will be better to temporarily ignore this mux, as it's difficult to finally find out this correct mux...)

> Maxime 
>
> -- 
> Maxime Ripard, Free Electrons 
> Embedded Linux and Kernel engineering 
> http://free-electrons.com 

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 33+ messages in thread
* Re: [PATCH v2 1/5] dt-bindings: update device tree binding for Allwinner PRCM CCUs
@ 2017-03-27  9:11 Icenowy Zheng
  2017-03-27 13:47   ` Maxime Ripard
  0 siblings, 1 reply; 33+ messages in thread
From: Icenowy Zheng @ 2017-03-27  9:11 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Icenowy Zheng, Rob Herring, linux-kernel, linux-arm-kernel,
	linux-sunxi, devicetree, Chen-Yu Tsai


2017年3月26日 21:10于 Maxime Ripard <maxime.ripard@free-electrons.com>写道:
>
> On Thu, Mar 23, 2017 at 07:17:03AM +0800, Icenowy Zheng wrote: 
> > 
> > 
> > 23.03.2017, 04:09, "Maxime Ripard" <maxime.ripard@free-electrons.com>: 
> > > On Wed, Mar 22, 2017 at 02:22:22AM +0800, Icenowy Zheng wrote: 
> > >>  21.03.2017, 15:41, "Maxime Ripard" <maxime.ripard@free-electrons.com>: 
> > >>  > On Thu, Mar 16, 2017 at 01:28:04AM +0800, Icenowy Zheng wrote: 
> > >>  >>  Many Allwinner SoCs after A31 have a CCU in PRCM block. 
> > >>  >> 
> > >>  >>  Give the ones on H3 and A64 compatible strings. 
> > >>  >> 
> > >>  >>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz> 
> > >>  >>  --- 
> > >>  >>  Changes in v2: 
> > >>  >>  - Add iosc for R_CCU's on H3/A64. (A31, A23 and A33 seem to have different 
> > >>  >>    clock for mux 3 of ar100 clk. Investgations are needed for them.) 
> > >>  >> 
> > >>  >>   Documentation/devicetree/bindings/clock/sunxi-ccu.txt | 18 +++++++++++++++++- 
> > >>  >>   1 file changed, 17 insertions(+), 1 deletion(-) 
> > >>  >> 
> > >>  >>  diff --git a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
> > >>  >>  index 68512aa398a9..4a4addff595d 100644 
> > >>  >>  --- a/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
> > >>  >>  +++ b/Documentation/devicetree/bindings/clock/sunxi-ccu.txt 
> > >>  >>  @@ -7,9 +7,11 @@ Required properties : 
> > >>  >>                   - "allwinner,sun8i-a23-ccu" 
> > >>  >>                   - "allwinner,sun8i-a33-ccu" 
> > >>  >>                   - "allwinner,sun8i-h3-ccu" 
> > >>  >>  + - "allwinner,sun8i-h3-r-ccu" 
> > >>  >>                   - "allwinner,sun8i-v3s-ccu" 
> > >>  >>                   - "allwinner,sun9i-a80-ccu" 
> > >>  >>                   - "allwinner,sun50i-a64-ccu" 
> > >>  >>  + - "allwinner,sun50i-a64-r-ccu" 
> > >>  >>                   - "allwinner,sun50i-h5-ccu" 
> > >>  >> 
> > >>  >>   - reg: Must contain the registers base address and length 
> > >>  >>  @@ -20,7 +22,11 @@ Required properties : 
> > >>  >>   - #clock-cells : must contain 1 
> > >>  >>   - #reset-cells : must contain 1 
> > >>  >> 
> > >>  >>  -Example: 
> > >>  >>  +For the PRCM CCUs on H3/A64, one more clock is needed: 
> > >>  >>  +- "iosc": another frequency oscillator used for CPUS (usually at 32000Hz, 
> > >>  >>  + not the same with losc) 
> > >>  > 
> > >>  > This is called the internal oscillator in the datasheet, it would 
> > >>  > probably make more sense to call it that way in the documentation too. 
> > >>  > 
> > >>  > This oscillator seems to be clocked at 16MHz, so we should represent 
> > >>  > it as such. 
> > >>  > 
> > >>  > And I'm wondering, are you *sure* that it's fed directly from the 
> > >>  > internal oscillator, or goes through the registers in the RTC, with 
> > >>  > the 32 divider and 16 prescaler by default that makes it at roughly 
> > >>  > the same rate (31.25kHz). 
> > >> 
> > >>  In fact I know nothing about it -- I only represented the code in BSP 
> > >>  clock driver. 
> > >> 
> > >>  The mux value 3 varies from SoC to SoC. For A64/H5 it's 32000, 
> > >>  for A33 it's 667000 (seems to be directly the internal OSC, as the 
> > >>  user manual says the internal OSC is 600~700kHz; but it's named 
> > >>  cpuosc rather than iosc in A33 BSP clock driver); for A80 it's even 
> > >>  PLL_AUDIO. 
> > > 
> > > Where are you getting those info from? 
> > > 
> > > As far as I know, the A33 PRCM takes the hosc, losc, pll6 and CPU 
> > > (internal) oscillator: 
> > > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/drivers/clk/sunxi/clk-sun8iw5.c#L508 
> > > 
> > > The H3 takes the hosc and losc: 
> > > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/drivers/clk/sunxi/clk-sun8iw7.c#L379 
> > > 
> > > The A80 takes the hosc and losc: 
> > > https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/drivers/clk/sunxi/clk-sun9iw1.c#L281 
> > > 
> > > The A64 takes the hosc, losc, pll-periph0 and the iosc, which indeed 
> > > seems to be fed from the internal oscillator with the divider in the 
> > > RTC: 
> > > https://github.com/longsleep/linux-pine64/blob/lichee-dev-v3.10.65-bsp2.0/arch/arm64/boot/dts/sun50iw1p1-clk.dtsi#L19 
> > > https://github.com/longsleep/linux-pine64/blob/lichee-dev-v3.10.65-bsp2.0/drivers/clk/sunxi/clk-sun50iw1.c#L603 
> > 
> > But then in sunxi_init_clocks function, the iosc clock is initialized 
> > as a fixed clock with 32000Hz. 
> > 
> > The clock node in BSP device tree have a compatible of 
> > allwinner,fixed-clock, but not fixed-clock, which makes it not able 
> > to be really probed. 
>
> That clock is registered: 
> https://github.com/longsleep/linux-pine64/blob/lichee-dev-v3.10.65-bsp2.0/drivers/clk/sunxi/clk-sun50iw1.c#L1193 
>

Oh yes, but conflicts exist between the iosc registered in clk-sun50iw1.c and described in sun50iw1p1-clk.dtsi . The former is 32000, and the latter is 16000000.

What should we do then?

(Maybe it will be better to temporarily ignore this mux, as it's difficult to finally find out this correct mux...)

> Maxime 
>
> -- 
> Maxime Ripard, Free Electrons 
> Embedded Linux and Kernel engineering 
> http://free-electrons.com 

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

end of thread, other threads:[~2017-03-27 19:13 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15 17:28 [PATCH v2 0/5] Add support for the R_CCU on Allwinner H3/A64 SoCs Icenowy Zheng
2017-03-15 17:28 ` Icenowy Zheng
     [not found] ` <20170315172808.64011-1-icenowy-ymACFijhrKM@public.gmane.org>
2017-03-15 17:28   ` [PATCH v2 1/5] dt-bindings: update device tree binding for Allwinner PRCM CCUs Icenowy Zheng
2017-03-15 17:28     ` Icenowy Zheng
2017-03-21  7:41     ` Maxime Ripard
2017-03-21  7:41       ` Maxime Ripard
2017-03-21  7:41       ` Maxime Ripard
2017-03-21 18:22       ` Icenowy Zheng
2017-03-21 18:22         ` Icenowy Zheng
2017-03-22 20:09         ` Maxime Ripard
2017-03-22 20:09           ` Maxime Ripard
2017-03-22 20:09           ` Maxime Ripard
2017-03-22 23:17           ` Icenowy Zheng
2017-03-22 23:17             ` Icenowy Zheng
2017-03-26 13:10             ` Maxime Ripard
2017-03-26 13:10               ` Maxime Ripard
2017-03-26 13:10               ` Maxime Ripard
2017-03-15 17:28   ` [PATCH v2 2/5] clk: sunxi-ng: add support for " Icenowy Zheng
2017-03-15 17:28     ` Icenowy Zheng
2017-03-15 17:28   ` [PATCH v2 3/5] arm64: allwinner: a64: add r_ccu node Icenowy Zheng
2017-03-15 17:28     ` Icenowy Zheng
2017-03-15 17:28   ` [PATCH v2 4/5] ARM: sun8i: h3: switch apb0-related clocks to r_ccu Icenowy Zheng
2017-03-15 17:28     ` Icenowy Zheng
2017-03-15 17:28   ` [PATCH v2 5/5] arm64: allwinner: a64: add R_PIO pinctrl node Icenowy Zheng
2017-03-15 17:28     ` Icenowy Zheng
2017-03-27  9:11 [PATCH v2 1/5] dt-bindings: update device tree binding for Allwinner PRCM CCUs Icenowy Zheng
2017-03-27  9:11 Icenowy Zheng
2017-03-27 13:47 ` Maxime Ripard
2017-03-27 13:47   ` Maxime Ripard
2017-03-27 13:47   ` Maxime Ripard
2017-03-27 19:13   ` icenowy
2017-03-27 19:13     ` icenowy at aosc.io
2017-03-27 19:13     ` icenowy-h8G6r0blFSE

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.