All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock
@ 2015-01-21 19:54 Heiko Stübner
  2015-01-21 19:55 ` [PATCH 1/3] clk: rockchip: add id for watchdog pclk on rk3288 Heiko Stübner
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Heiko Stübner @ 2015-01-21 19:54 UTC (permalink / raw)
  To: linux-arm-kernel

The snps,dw-wdt needs to read the clock-rate of its supplying clock
for some operations. The clock itself is based on pclk_pd_alive
and is indeed gateable. The caveat is that the gate is living in the
so-called secure-GRF, which isn't even writeable in some boot-modes.

But to have an actual clock reference to the correct clock, implement
a fixed-factor clock, to be substituted when we can control the actual
gate safely.

Heiko Stuebner (3):
  clk: rockchip: add id for watchdog pclk on rk3288
  clk: rockchip: add a dummy clock for the watchdog pclk on rk3288
  ARM: dts: rockchip: add rk3288 watchdog clock

 arch/arm/boot/dts/rk3288.dtsi          | 1 +
 drivers/clk/rockchip/clk-rk3288.c      | 8 ++++++++
 include/dt-bindings/clock/rk3288-cru.h | 1 +
 3 files changed, 10 insertions(+)

-- 
2.1.1

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

* [PATCH 1/3] clk: rockchip: add id for watchdog pclk on rk3288
  2015-01-21 19:54 [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner
@ 2015-01-21 19:55 ` Heiko Stübner
  2015-01-21 23:28   ` Doug Anderson
  2015-01-21 19:56 ` [PATCH 2/3] clk: rockchip: add a dummy clock for the " Heiko Stübner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Heiko Stübner @ 2015-01-21 19:55 UTC (permalink / raw)
  To: linux-arm-kernel

Adds a new id for the pclk supplying the watchdog on rk3288 socs.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 include/dt-bindings/clock/rk3288-cru.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/clock/rk3288-cru.h b/include/dt-bindings/clock/rk3288-cru.h
index 1c34c24..ba0d724 100644
--- a/include/dt-bindings/clock/rk3288-cru.h
+++ b/include/dt-bindings/clock/rk3288-cru.h
@@ -157,6 +157,7 @@
 #define PCLK_PUBL0		365
 #define PCLK_DDRUPCTL1		366
 #define PCLK_PUBL1		367
+#define PCLK_WDT		368
 
 /* hclk gates */
 #define HCLK_GPS		448
-- 
2.1.1

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

* [PATCH 2/3] clk: rockchip: add a dummy clock for the watchdog pclk on rk3288
  2015-01-21 19:54 [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner
  2015-01-21 19:55 ` [PATCH 1/3] clk: rockchip: add id for watchdog pclk on rk3288 Heiko Stübner
@ 2015-01-21 19:56 ` Heiko Stübner
  2015-01-21 23:30   ` Doug Anderson
  2015-01-21 19:56 ` [PATCH 3/3] ARM: dts: rockchip: add rk3288 watchdog clock Heiko Stübner
  2015-01-28 10:15 ` [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner
  3 siblings, 1 reply; 8+ messages in thread
From: Heiko Stübner @ 2015-01-21 19:56 UTC (permalink / raw)
  To: linux-arm-kernel

The pclk supplying the watchdog is controlled via the SGRF register area.
Currently we don't have any clock-type handling external clock bits like
this one. Additionally the SGRF isn't even writable in every boot mode.

But still the clock control is available and in the future someone might
want to use it. Therefore define a simple clock for the time being so
that the watchdog driver can read its rate.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/clk/rockchip/clk-rk3288.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
index cbcddcc..6cc3e0d 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -866,6 +866,14 @@ static void __init rk3288_clk_init(struct device_node *np)
 		pr_warn("%s: could not register clock hclk_vcodec_pre: %ld\n",
 			__func__, PTR_ERR(clk));
 
+	/* Watchdog pclk is controlled by RK3288_SGRF_SOC_CON0[1]. */
+	clk = clk_register_fixed_factor(NULL, "pclk_wdt", "pclk_pd_alive", 0, 1, 1);
+	if (IS_ERR(clk))
+		pr_warn("%s: could not register clock pclk_wdt: %ld\n",
+			__func__, PTR_ERR(clk));
+	else
+		rockchip_clk_add_lookup(clk, PCLK_WDT);
+
 	rockchip_clk_register_plls(rk3288_pll_clks,
 				   ARRAY_SIZE(rk3288_pll_clks),
 				   RK3288_GRF_SOC_STATUS1);
-- 
2.1.1

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

* [PATCH 3/3] ARM: dts: rockchip: add rk3288 watchdog clock
  2015-01-21 19:54 [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner
  2015-01-21 19:55 ` [PATCH 1/3] clk: rockchip: add id for watchdog pclk on rk3288 Heiko Stübner
  2015-01-21 19:56 ` [PATCH 2/3] clk: rockchip: add a dummy clock for the " Heiko Stübner
@ 2015-01-21 19:56 ` Heiko Stübner
  2015-01-21 23:30   ` Doug Anderson
  2015-01-28 10:15 ` [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner
  3 siblings, 1 reply; 8+ messages in thread
From: Heiko Stübner @ 2015-01-21 19:56 UTC (permalink / raw)
  To: linux-arm-kernel

Add the clock property for the watchdog on rk3288 socs.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/boot/dts/rk3288.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 910dcad..6fcf74b9 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -554,6 +554,7 @@
 	wdt: watchdog at ff800000 {
 		compatible = "rockchip,rk3288-wdt", "snps,dw-wdt";
 		reg = <0xff800000 0x100>;
+		clocks = <&cru PCLK_WDT>;
 		interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
-- 
2.1.1

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

* [PATCH 1/3] clk: rockchip: add id for watchdog pclk on rk3288
  2015-01-21 19:55 ` [PATCH 1/3] clk: rockchip: add id for watchdog pclk on rk3288 Heiko Stübner
@ 2015-01-21 23:28   ` Doug Anderson
  0 siblings, 0 replies; 8+ messages in thread
From: Doug Anderson @ 2015-01-21 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

Heiko,

On Wed, Jan 21, 2015 at 11:55 AM, Heiko St?bner <heiko@sntech.de> wrote:
> Adds a new id for the pclk supplying the watchdog on rk3288 socs.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  include/dt-bindings/clock/rk3288-cru.h | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Doug Anderson <dianders@chromium.org>

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

* [PATCH 2/3] clk: rockchip: add a dummy clock for the watchdog pclk on rk3288
  2015-01-21 19:56 ` [PATCH 2/3] clk: rockchip: add a dummy clock for the " Heiko Stübner
@ 2015-01-21 23:30   ` Doug Anderson
  0 siblings, 0 replies; 8+ messages in thread
From: Doug Anderson @ 2015-01-21 23:30 UTC (permalink / raw)
  To: linux-arm-kernel

Heiko,

On Wed, Jan 21, 2015 at 11:56 AM, Heiko St?bner <heiko@sntech.de> wrote:
> The pclk supplying the watchdog is controlled via the SGRF register area.
> Currently we don't have any clock-type handling external clock bits like
> this one. Additionally the SGRF isn't even writable in every boot mode.
>
> But still the clock control is available and in the future someone might
> want to use it. Therefore define a simple clock for the time being so
> that the watchdog driver can read its rate.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/clk/rockchip/clk-rk3288.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Reviewed-by: Doug Anderson <dianders@chromium.org>

On rk3288 on a 3.14 kernel with backports, I tested this and confirmed
that the clock rate was right (when programmed to ~43 seconds, the
watchdog caused a reboot when not patted for ~43 seconds).

Tested-by: Doug Anderson <dianders@chromium.org>

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

* [PATCH 3/3] ARM: dts: rockchip: add rk3288 watchdog clock
  2015-01-21 19:56 ` [PATCH 3/3] ARM: dts: rockchip: add rk3288 watchdog clock Heiko Stübner
@ 2015-01-21 23:30   ` Doug Anderson
  0 siblings, 0 replies; 8+ messages in thread
From: Doug Anderson @ 2015-01-21 23:30 UTC (permalink / raw)
  To: linux-arm-kernel

Heiko,

On Wed, Jan 21, 2015 at 11:56 AM, Heiko St?bner <heiko@sntech.de> wrote:
> Add the clock property for the watchdog on rk3288 socs.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  arch/arm/boot/dts/rk3288.dtsi | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Doug Anderson <dianders@chromium.org>

On rk3288 on a 3.14 kernel with backports:

Tested-by: Doug Anderson <dianders@chromium.org>

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

* [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock
  2015-01-21 19:54 [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner
                   ` (2 preceding siblings ...)
  2015-01-21 19:56 ` [PATCH 3/3] ARM: dts: rockchip: add rk3288 watchdog clock Heiko Stübner
@ 2015-01-28 10:15 ` Heiko Stübner
  3 siblings, 0 replies; 8+ messages in thread
From: Heiko Stübner @ 2015-01-28 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Am Mittwoch, 21. Januar 2015, 20:54:50 schrieb Heiko St?bner:
> The snps,dw-wdt needs to read the clock-rate of its supplying clock
> for some operations. The clock itself is based on pclk_pd_alive
> and is indeed gateable. The caveat is that the gate is living in the
> so-called secure-GRF, which isn't even writeable in some boot-modes.
> 
> But to have an actual clock reference to the correct clock, implement
> a fixed-factor clock, to be substituted when we can control the actual
> gate safely.
> 
> Heiko Stuebner (3):
>   clk: rockchip: add id for watchdog pclk on rk3288
>   clk: rockchip: add a dummy clock for the watchdog pclk on rk3288
>   ARM: dts: rockchip: add rk3288 watchdog clock

with the clock changes (patches 1+2) being accepted into the clock tree, I've 
now also added the third patch to my dts branch.


Heiko

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

end of thread, other threads:[~2015-01-28 10:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 19:54 [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner
2015-01-21 19:55 ` [PATCH 1/3] clk: rockchip: add id for watchdog pclk on rk3288 Heiko Stübner
2015-01-21 23:28   ` Doug Anderson
2015-01-21 19:56 ` [PATCH 2/3] clk: rockchip: add a dummy clock for the " Heiko Stübner
2015-01-21 23:30   ` Doug Anderson
2015-01-21 19:56 ` [PATCH 3/3] ARM: dts: rockchip: add rk3288 watchdog clock Heiko Stübner
2015-01-21 23:30   ` Doug Anderson
2015-01-28 10:15 ` [PATCH 0/3] ARM: rockchip: provide the watchdog with a clock Heiko Stübner

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.