* [RFC 0/4] arm64: Realtek RTD1295 clocks
@ 2017-08-17 11:20 Andreas Färber
2017-08-17 11:20 ` [RFC 1/4] dt-bindings: clock: Add Realtek RTD1295 Andreas Färber
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andreas Färber @ 2017-08-17 11:20 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, linux-clk-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Roc He,
蒋丽琴, Andreas Färber,
devicetree-u79uwXL29TY76Z2rM5mHXA
Hello,
This series adds two clock controllers for the Realtek RTD1295 SoC.
Based on my reset controller and IRQ mux series.
There being no public source code for RTD1295, the implementation is based on
register offsets, fields and names seen in the vendor DT, unified into 2 nodes.
The PLL calculations were experimentally found by comparing vendor Android
/sys/kernel/debug/clk/clk_summary to the register field values in /dev/mem -
thus the formulas may be incomplete or incorrect.
Together with the reset driver and IRQ mux, the clock gates allow to
initialize UART1.
Code needs cleanups - sharing this for calculation findings and design.
More experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next
Have a lot of fun!
Cheers,
Andreas
Cc: Michael Turquette <mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
Cc: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Roc He <hepeng-qoVzM6YEWSw@public.gmane.org>
Cc: 蒋丽琴 <jiang.liqin-31gW8twSeR21Z/+hSey0Gg@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Andreas Färber (4):
dt-bindings: clock: Add Realtek RTD1295
arm64: dts: realtek: Add clock nodes for RTD1295
clk: Add Realtek RTD1295
arm64: dts: realtek: Update RTD1295 UART nodes with clocks
.../devicetree/bindings/clock/realtek,rtd129x.txt | 20 ++
arch/arm64/boot/dts/realtek/rtd1295.dtsi | 28 +-
drivers/clk/Kconfig | 7 +
drivers/clk/Makefile | 1 +
drivers/clk/clk-rtd1295.c | 385 +++++++++++++++++++++
include/dt-bindings/clock/realtek,rtd1295.h | 99 ++++++
6 files changed, 537 insertions(+), 3 deletions(-)
create mode 100644 Documentation/devicetree/bindings/clock/realtek,rtd129x.txt
create mode 100644 drivers/clk/clk-rtd1295.c
create mode 100644 include/dt-bindings/clock/realtek,rtd1295.h
--
2.12.3
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC 1/4] dt-bindings: clock: Add Realtek RTD1295
2017-08-17 11:20 [RFC 0/4] arm64: Realtek RTD1295 clocks Andreas Färber
@ 2017-08-17 11:20 ` Andreas Färber
2017-08-22 2:21 ` Rob Herring
2017-08-17 11:20 ` [RFC 2/4] arm64: dts: realtek: Add clock nodes for RTD1295 Andreas Färber
2017-08-17 11:20 ` [RFC 4/4] arm64: dts: realtek: Update RTD1295 UART nodes with clocks Andreas Färber
2 siblings, 1 reply; 5+ messages in thread
From: Andreas Färber @ 2017-08-17 11:20 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, linux-clk, linux-arm-kernel
Cc: linux-kernel, Roc He, 蒋丽琴,
Andreas Färber, Rob Herring, Mark Rutland, devicetree
Naming inspired from Zidoo X9S Device Tree and clk_summary.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
.../devicetree/bindings/clock/realtek,rtd129x.txt | 20 +++++
include/dt-bindings/clock/realtek,rtd1295.h | 99 ++++++++++++++++++++++
2 files changed, 119 insertions(+)
create mode 100644 Documentation/devicetree/bindings/clock/realtek,rtd129x.txt
create mode 100644 include/dt-bindings/clock/realtek,rtd1295.h
diff --git a/Documentation/devicetree/bindings/clock/realtek,rtd129x.txt b/Documentation/devicetree/bindings/clock/realtek,rtd129x.txt
new file mode 100644
index 000000000000..b55da39faf58
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/realtek,rtd129x.txt
@@ -0,0 +1,20 @@
+Realtek RTD129x clock controllers
+=================================
+
+Requires properties:
+- compatible : Should be one of the following:
+ - "realtek,rtd1295-clk"
+ - "realtek,rtd1295-iso-clk"
+- reg : Specifies physical base address and size
+- clocks : Specifies the oscillator node
+- #clock-cells : Shall be 1
+
+
+Example:
+
+ clock-controller@98000000 {
+ compatible = "realtek,rtd1295-clk";
+ reg = <0x98000000 0x1000>;
+ clocks = <&osc27M>;
+ #clock-cells = <1>;
+ };
diff --git a/include/dt-bindings/clock/realtek,rtd1295.h b/include/dt-bindings/clock/realtek,rtd1295.h
new file mode 100644
index 000000000000..278148bff2ac
--- /dev/null
+++ b/include/dt-bindings/clock/realtek,rtd1295.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017 Andreas Färber
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+#ifndef DT_BINDINGS_CLOCK_RTD1295_H
+#define DT_BINDINGS_CLOCK_RTD1295_H
+
+#define RTD1295_CLK_PLL_SCPU 0
+#define RTD1295_CLK_PLL_BUS 1
+#define RTD1295_CLK_PLL_BUS_DIV2 2
+#define RTD1295_CLK_SYS 3
+#define RTD1295_CLK_PLL_BUS_H 4
+#define RTD1295_CLK_SYSH 5
+#define RTD1295_CLK_PLL_DDSA 6
+#define RTD1295_CLK_PLL_DDSB 7
+#define RTD1295_CLK_PLL_VODMA 8
+#define RTD1295_CLK_PLL_VE1 9
+#define RTD1295_CLK_PLL_VE2 10
+#define RTD1295_CLK_PLL_GPU 14
+#define RTD1295_CLK_PLL_ACPU 15
+
+#define RTD1295_CLK_EN_BASE 16
+#define RTD1295_CLK_EN_MISC (RTD1295_CLK_EN_BASE + 0)
+#define RTD1295_CLK_EN_PCIE0 (RTD1295_CLK_EN_BASE + 1)
+#define RTD1295_CLK_EN_SATA_0 (RTD1295_CLK_EN_BASE + 2)
+#define RTD1295_CLK_EN_GSPI (RTD1295_CLK_EN_BASE + 3)
+#define RTD1295_CLK_EN_USB (RTD1295_CLK_EN_BASE + 4)
+#define RTD1295_CLK_EN_PCR (RTD1295_CLK_EN_BASE + 5)
+#define RTD1295_CLK_EN_ISO_MISC (RTD1295_CLK_EN_BASE + 6)
+#define RTD1295_CLK_EN_SATA_ALIVE_0 (RTD1295_CLK_EN_BASE + 7)
+#define RTD1295_CLK_EN_HDMI (RTD1295_CLK_EN_BASE + 8)
+#define RTD1295_CLK_EN_ETN (RTD1295_CLK_EN_BASE + 9)
+#define RTD1295_CLK_EN_AIO (RTD1295_CLK_EN_BASE + 10)
+#define RTD1295_CLK_EN_GPU (RTD1295_CLK_EN_BASE + 11)
+#define RTD1295_CLK_EN_VE1 (RTD1295_CLK_EN_BASE + 12)
+#define RTD1295_CLK_EN_VE2 (RTD1295_CLK_EN_BASE + 13)
+#define RTD1295_CLK_EN_TVE (RTD1295_CLK_EN_BASE + 14)
+#define RTD1295_CLK_EN_VO (RTD1295_CLK_EN_BASE + 15)
+#define RTD1295_CLK_EN_LVDS (RTD1295_CLK_EN_BASE + 16)
+#define RTD1295_CLK_EN_SE (RTD1295_CLK_EN_BASE + 17)
+#define RTD1295_CLK_EN_DCU (RTD1295_CLK_EN_BASE + 18)
+#define RTD1295_CLK_EN_CP (RTD1295_CLK_EN_BASE + 19)
+#define RTD1295_CLK_EN_MD (RTD1295_CLK_EN_BASE + 20)
+#define RTD1295_CLK_EN_TP (RTD1295_CLK_EN_BASE + 21)
+#define RTD1295_CLK_EN_RSA (RTD1295_CLK_EN_BASE + 22)
+#define RTD1295_CLK_EN_NF (RTD1295_CLK_EN_BASE + 23)
+#define RTD1295_CLK_EN_EMMC (RTD1295_CLK_EN_BASE + 24)
+#define RTD1295_CLK_EN_CR (RTD1295_CLK_EN_BASE + 25)
+#define RTD1295_CLK_EN_SDIO_IP (RTD1295_CLK_EN_BASE + 26)
+#define RTD1295_CLK_EN_MIPI (RTD1295_CLK_EN_BASE + 27)
+#define RTD1295_CLK_EN_EMMC_IP (RTD1295_CLK_EN_BASE + 28)
+#define RTD1295_CLK_EN_VE3 (RTD1295_CLK_EN_BASE + 29)
+#define RTD1295_CLK_EN_SDIO (RTD1295_CLK_EN_BASE + 30)
+#define RTD1295_CLK_EN_SD_IP (RTD1295_CLK_EN_BASE + 31)
+
+#define RTD1295_CLK_EN_BASE2 (RTD1295_CLK_EN_BASE + 32)
+#define RTD1295_CLK_EN_NAT (RTD1295_CLK_EN_BASE2 + 0)
+#define RTD1295_CLK_EN_MISC_I2C_5 (RTD1295_CLK_EN_BASE2 + 1)
+#define RTD1295_CLK_EN_SCPU (RTD1295_CLK_EN_BASE2 + 2)
+#define RTD1295_CLK_EN_JPEG (RTD1295_CLK_EN_BASE2 + 3)
+#define RTD1295_CLK_EN_APU (RTD1295_CLK_EN_BASE2 + 4)
+#define RTD1295_CLK_EN_PCIE1 (RTD1295_CLK_EN_BASE2 + 5)
+#define RTD1295_CLK_EN_MISC_SC (RTD1295_CLK_EN_BASE2 + 6)
+#define RTD1295_CLK_EN_CBUS_TX (RTD1295_CLK_EN_BASE2 + 7)
+#define RTD1295_CLK_EN_MISC_RTC (RTD1295_CLK_EN_BASE2 + 10)
+#define RTD1295_CLK_EN_MISC_I2C_4 (RTD1295_CLK_EN_BASE2 + 13)
+#define RTD1295_CLK_EN_MISC_I2C_3 (RTD1295_CLK_EN_BASE2 + 14)
+#define RTD1295_CLK_EN_MISC_I2C_2 (RTD1295_CLK_EN_BASE2 + 15)
+#define RTD1295_CLK_EN_MISC_I2C_1 (RTD1295_CLK_EN_BASE2 + 16)
+#define RTD1295_CLK_EN_AIO_AU_CODEC (RTD1295_CLK_EN_BASE2 + 17)
+#define RTD1295_CLK_EN_AIO_MOD (RTD1295_CLK_EN_BASE2 + 18)
+#define RTD1295_CLK_EN_AIO_DA (RTD1295_CLK_EN_BASE2 + 19)
+#define RTD1295_CLK_EN_AIO_HDMI (RTD1295_CLK_EN_BASE2 + 20)
+#define RTD1295_CLK_EN_AIO_SPDIF (RTD1295_CLK_EN_BASE2 + 21)
+#define RTD1295_CLK_EN_AIO_I2S (RTD1295_CLK_EN_BASE2 + 22)
+#define RTD1295_CLK_EN_AIO_MCLK (RTD1295_CLK_EN_BASE2 + 23)
+#define RTD1295_CLK_EN_HDMIRX (RTD1295_CLK_EN_BASE2 + 24)
+#define RTD1295_CLK_EN_SATA_1 (RTD1295_CLK_EN_BASE2 + 25)
+#define RTD1295_CLK_EN_SATA_ALIVE_1 (RTD1295_CLK_EN_BASE2 + 26)
+#define RTD1295_CLK_EN_UR2 (RTD1295_CLK_EN_BASE2 + 27)
+#define RTD1295_CLK_EN_UR1 (RTD1295_CLK_EN_BASE2 + 28)
+#define RTD1295_CLK_EN_FAN (RTD1295_CLK_EN_BASE2 + 29)
+#define RTD1295_CLK_EN_DCPHY_0 (RTD1295_CLK_EN_BASE2 + 30)
+#define RTD1295_CLK_EN_DCPHY_1 (RTD1295_CLK_EN_BASE2 + 31)
+
+#define RTD1295_ISO_CLK_EN_MISC_CEC0 2
+#define RTD1295_ISO_CLK_EN_CBUSRX_SYS 3
+#define RTD1295_ISO_CLK_EN_CBUSTX_SYS 4
+#define RTD1295_ISO_CLK_EN_CBUS_SYS 5
+#define RTD1295_ISO_CLK_EN_CBUS_OSC 6
+#define RTD1295_ISO_CLK_EN_MISC_IR 7
+#define RTD1295_ISO_CLK_EN_MISC_UR0 8
+#define RTD1295_ISO_CLK_EN_I2C_0 9
+#define RTD1295_ISO_CLK_EN_I2C_1 10
+#define RTD1295_ISO_CLK_EN_ETN_250M 11
+#define RTD1295_ISO_CLK_EN_ETN_SYS 12
+
+#endif
--
2.12.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC 2/4] arm64: dts: realtek: Add clock nodes for RTD1295
2017-08-17 11:20 [RFC 0/4] arm64: Realtek RTD1295 clocks Andreas Färber
2017-08-17 11:20 ` [RFC 1/4] dt-bindings: clock: Add Realtek RTD1295 Andreas Färber
@ 2017-08-17 11:20 ` Andreas Färber
2017-08-17 11:20 ` [RFC 4/4] arm64: dts: realtek: Update RTD1295 UART nodes with clocks Andreas Färber
2 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2017-08-17 11:20 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, linux-clk, linux-arm-kernel
Cc: linux-kernel, Roc He, 蒋丽琴,
Andreas Färber, Rob Herring, Mark Rutland, Catalin Marinas,
Will Deacon, devicetree
Add 27 MHz oscillator and two clock controller nodes.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
arch/arm64/boot/dts/realtek/rtd1295.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/realtek/rtd1295.dtsi b/arch/arm64/boot/dts/realtek/rtd1295.dtsi
index 77063e984db9..078a11506876 100644
--- a/arch/arm64/boot/dts/realtek/rtd1295.dtsi
+++ b/arch/arm64/boot/dts/realtek/rtd1295.dtsi
@@ -81,6 +81,13 @@
(GIC_CPU_MASK_RAW(0xf) | IRQ_TYPE_LEVEL_LOW)>;
};
+ osc27M: osc {
+ compatible = "fixed-clock";
+ clock-frequency = <27000000>;
+ #clock-cells = <0>;
+ clock-output-names = "osc27M";
+ };
+
soc {
compatible = "simple-bus";
#address-cells = <1>;
@@ -88,6 +95,13 @@
/* Exclude up to 2 GiB of RAM */
ranges = <0x80000000 0x80000000 0x80000000>;
+ clkc: clock-controller@98000000 {
+ compatible = "realtek,rtd1295-clk";
+ reg = <0x98000000 0x1000>;
+ clocks = <&osc27M>;
+ #clock-cells = <1>;
+ };
+
reset1: reset-controller@98000000 {
compatible = "realtek,rtd1295-reset";
reg = <0x98000000 0x4>;
@@ -112,6 +126,13 @@
#reset-cells = <1>;
};
+ iso_clkc: clock-controller@98007000 {
+ compatible = "realtek,rtd1295-iso-clk";
+ reg = <0x98007000 0x100>;
+ clocks = <&osc27M>;
+ #clock-cells = <1>;
+ };
+
iso_irq_mux: interrupt-controller@98007000 {
compatible = "realtek,rtd1295-iso-irq-mux";
reg = <0x98007000 0x100>;
--
2.12.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC 4/4] arm64: dts: realtek: Update RTD1295 UART nodes with clocks
2017-08-17 11:20 [RFC 0/4] arm64: Realtek RTD1295 clocks Andreas Färber
2017-08-17 11:20 ` [RFC 1/4] dt-bindings: clock: Add Realtek RTD1295 Andreas Färber
2017-08-17 11:20 ` [RFC 2/4] arm64: dts: realtek: Add clock nodes for RTD1295 Andreas Färber
@ 2017-08-17 11:20 ` Andreas Färber
2 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2017-08-17 11:20 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, linux-clk, linux-arm-kernel
Cc: Mark Rutland, devicetree, Roc He, 蒋丽琴,
Catalin Marinas, Will Deacon, linux-kernel, Rob Herring,
Andreas Färber
Replace clock-frequency with a reference to the respective clock gates.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
arch/arm64/boot/dts/realtek/rtd1295.dtsi | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/boot/dts/realtek/rtd1295.dtsi b/arch/arm64/boot/dts/realtek/rtd1295.dtsi
index 078a11506876..503e2d5fc334 100644
--- a/arch/arm64/boot/dts/realtek/rtd1295.dtsi
+++ b/arch/arm64/boot/dts/realtek/rtd1295.dtsi
@@ -6,6 +6,7 @@
* SPDX-License-Identifier: (GPL-2.0+ OR MIT)
*/
+#include <dt-bindings/clock/realtek,rtd1295.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/reset/realtek,rtd1295.h>
@@ -152,7 +153,7 @@
reg = <0x98007800 0x400>;
reg-shift = <2>;
reg-io-width = <4>;
- clock-frequency = <27000000>;
+ clocks = <&iso_clkc RTD1295_ISO_CLK_EN_MISC_UR0>;
interrupt-parent = <&iso_irq_mux>;
interrupts = <2>;
resets = <&iso_reset RTD1295_ISO_RSTN_UR0>;
@@ -172,7 +173,7 @@
reg = <0x9801b200 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
- clock-frequency = <432000000>;
+ clocks = <&clkc RTD1295_CLK_EN_UR1>;
interrupt-parent = <&irq_mux>;
interrupts = <3>, <5>;
resets = <&reset2 RTD1295_RSTN_UR1>;
@@ -184,7 +185,7 @@
reg = <0x9801b400 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
- clock-frequency = <432000000>;
+ clocks = <&clkc RTD1295_CLK_EN_UR2>;
interrupt-parent = <&irq_mux>;
interrupts = <8>, <13>;
resets = <&reset2 RTD1295_RSTN_UR2>;
--
2.12.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFC 1/4] dt-bindings: clock: Add Realtek RTD1295
2017-08-17 11:20 ` [RFC 1/4] dt-bindings: clock: Add Realtek RTD1295 Andreas Färber
@ 2017-08-22 2:21 ` Rob Herring
0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2017-08-22 2:21 UTC (permalink / raw)
To: Andreas Färber
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-arm-kernel,
linux-kernel, Roc He, 蒋丽琴, Mark Rutland,
devicetree
On Thu, Aug 17, 2017 at 01:20:22PM +0200, Andreas Färber wrote:
> Naming inspired from Zidoo X9S Device Tree and clk_summary.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> .../devicetree/bindings/clock/realtek,rtd129x.txt | 20 +++++
> include/dt-bindings/clock/realtek,rtd1295.h | 99 ++++++++++++++++++++++
> 2 files changed, 119 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/clock/realtek,rtd129x.txt
> create mode 100644 include/dt-bindings/clock/realtek,rtd1295.h
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-22 2:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 11:20 [RFC 0/4] arm64: Realtek RTD1295 clocks Andreas Färber
2017-08-17 11:20 ` [RFC 1/4] dt-bindings: clock: Add Realtek RTD1295 Andreas Färber
2017-08-22 2:21 ` Rob Herring
2017-08-17 11:20 ` [RFC 2/4] arm64: dts: realtek: Add clock nodes for RTD1295 Andreas Färber
2017-08-17 11:20 ` [RFC 4/4] arm64: dts: realtek: Update RTD1295 UART nodes with clocks Andreas Färber
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).