All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31  9:39 ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Alessandro Zummo, Arnd Bergmann, Daniel Lezcano,
	Dmitry Eremin-Solenikov, Greg Kroah-Hartman, linux-clk, linux-pm,
	linux-pwm, linux-watchdog, Michael Turquette, rtc-linux,
	Sebastian Reichel, Stephen Boyd, Thierry Reding, Thomas Gleixner,
	Wim Van Sebroeck

Hi,

It was discovered that all the slow clock user were not properly claiming it.
This can end up in a system hang because the last registered user is releasing
it, and it gets disabled.

commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
was a workaround. This series is adding the slow clock to the necessary drivers
to avoid the issue and then removes that workaround.

The Documentation updates and DT patches should probably go through the AT91
tree this cycle to avoid breakage.

Then the other patches can go through each subsystem tree. They are trivial
enough to also go in this cycle.

The final clk patch depends on the other ones and may be taken for the next
cycle to avoid synchronization issues.

I've thrown in a cleanup for at91-reset as it avoids adding support for that
clock to the platform data initialization

Changes in v2:
 - statisticize the global in the atmel-st change
 - merge at91_reset_of_probe() in at91_reset_probe()
 - added patches from Boris for the TCB
 - added the slow clock to the TCB

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-clk@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-pwm@vger.kernel.org
Cc: linux-watchdog@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: rtc-linux@googlegroups.com
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>

Alexandre Belloni (20):
  Documentation: dt: atmel-at91: add clocks to system timer, rstc and
    shdwc
  Documentation: watchdog: at91sam9_wdt: add clocks property
  Documentation: dt: rtc: at91rm9200: add clocks property
  ARM: at91/dt: at91rm9200: use slow clock where necessary
  ARM: at91/dt: at91sam9260: use slow clock where necessary
  ARM: at91/dt: at91sam9261: use slow clock where necessary
  ARM: at91/dt: at91sam9263: use slow clock where necessary
  ARM: at91/dt: at91sam9g45: use slow clock where necessary
  ARM: at91/dt: at91sam9n12: use slow clock where necessary
  ARM: at91/dt: at91sam9rl: use slow clock where necessary
  ARM: at91/dt: at91sam9x5: use slow clock where necessary
  ARM: at91/dt: sama5d3: use slow clock where necessary
  ARM: at91/dt: sama5d4: use slow clock where necessary
  rtc: at91rm9200: get and use slow clock
  watchdog: at91sam9: get and use slow clock
  power/reset: at91-reset: remove useless at91_reset_platform_probe()
  power/reset: at91-reset: get and use slow clock
  power/reset: at91-poweroff: get and use slow clock
  clocksource: atmel-st: get and use slow clock
  clk: at91: Revert "keep slow clk enabled to prevent system hang"

Boris Brezillon (3):
  Documentation: dt: atmel-at91: add slow clock to tcb
  clocksource: tcb_clksrc: fix setup_clkevents error path
  misc: atmel_tclib: get and use slow clock

 .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
 .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
 .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
 arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
 arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
 arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
 arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
 arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
 arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
 arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
 arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
 arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
 arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
 arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
 drivers/clk/at91/clk-slow.c                        | 27 ----------
 drivers/clocksource/tcb_clksrc.c                   | 10 +++-
 drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
 drivers/misc/atmel_tclib.c                         |  4 ++
 drivers/power/reset/at91-poweroff.c                | 13 +++++
 drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
 drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
 drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
 drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
 include/linux/atmel_tc.h                           |  1 +
 24 files changed, 206 insertions(+), 129 deletions(-)

-- 
2.1.4


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

* [rtc-linux] [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31  9:39 ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Alessandro Zummo, Arnd Bergmann, Daniel Lezcano,
	Dmitry Eremin-Solenikov, Greg Kroah-Hartman, linux-clk, linux-pm,
	linux-pwm, linux-watchdog, Michael Turquette, rtc-linux,
	Sebastian Reichel, Stephen Boyd, Thierry Reding, Thomas Gleixner,
	Wim Van Sebroeck

Hi,

It was discovered that all the slow clock user were not properly claiming it.
This can end up in a system hang because the last registered user is releasing
it, and it gets disabled.

commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
was a workaround. This series is adding the slow clock to the necessary drivers
to avoid the issue and then removes that workaround.

The Documentation updates and DT patches should probably go through the AT91
tree this cycle to avoid breakage.

Then the other patches can go through each subsystem tree. They are trivial
enough to also go in this cycle.

The final clk patch depends on the other ones and may be taken for the next
cycle to avoid synchronization issues.

I've thrown in a cleanup for at91-reset as it avoids adding support for that
clock to the platform data initialization

Changes in v2:
 - statisticize the global in the atmel-st change
 - merge at91_reset_of_probe() in at91_reset_probe()
 - added patches from Boris for the TCB
 - added the slow clock to the TCB

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-clk@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-pwm@vger.kernel.org
Cc: linux-watchdog@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: rtc-linux@googlegroups.com
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>

Alexandre Belloni (20):
  Documentation: dt: atmel-at91: add clocks to system timer, rstc and
    shdwc
  Documentation: watchdog: at91sam9_wdt: add clocks property
  Documentation: dt: rtc: at91rm9200: add clocks property
  ARM: at91/dt: at91rm9200: use slow clock where necessary
  ARM: at91/dt: at91sam9260: use slow clock where necessary
  ARM: at91/dt: at91sam9261: use slow clock where necessary
  ARM: at91/dt: at91sam9263: use slow clock where necessary
  ARM: at91/dt: at91sam9g45: use slow clock where necessary
  ARM: at91/dt: at91sam9n12: use slow clock where necessary
  ARM: at91/dt: at91sam9rl: use slow clock where necessary
  ARM: at91/dt: at91sam9x5: use slow clock where necessary
  ARM: at91/dt: sama5d3: use slow clock where necessary
  ARM: at91/dt: sama5d4: use slow clock where necessary
  rtc: at91rm9200: get and use slow clock
  watchdog: at91sam9: get and use slow clock
  power/reset: at91-reset: remove useless at91_reset_platform_probe()
  power/reset: at91-reset: get and use slow clock
  power/reset: at91-poweroff: get and use slow clock
  clocksource: atmel-st: get and use slow clock
  clk: at91: Revert "keep slow clk enabled to prevent system hang"

Boris Brezillon (3):
  Documentation: dt: atmel-at91: add slow clock to tcb
  clocksource: tcb_clksrc: fix setup_clkevents error path
  misc: atmel_tclib: get and use slow clock

 .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
 .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
 .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
 arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
 arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
 arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
 arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
 arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
 arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
 arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
 arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
 arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
 arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
 arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
 drivers/clk/at91/clk-slow.c                        | 27 ----------
 drivers/clocksource/tcb_clksrc.c                   | 10 +++-
 drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
 drivers/misc/atmel_tclib.c                         |  4 ++
 drivers/power/reset/at91-poweroff.c                | 13 +++++
 drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
 drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
 drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
 drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
 include/linux/atmel_tc.h                           |  1 +
 24 files changed, 206 insertions(+), 129 deletions(-)

-- 
2.1.4

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31  9:39 ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

It was discovered that all the slow clock user were not properly claiming it.
This can end up in a system hang because the last registered user is releasing
it, and it gets disabled.

commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
was a workaround. This series is adding the slow clock to the necessary drivers
to avoid the issue and then removes that workaround.

The Documentation updates and DT patches should probably go through the AT91
tree this cycle to avoid breakage.

Then the other patches can go through each subsystem tree. They are trivial
enough to also go in this cycle.

The final clk patch depends on the other ones and may be taken for the next
cycle to avoid synchronization issues.

I've thrown in a cleanup for at91-reset as it avoids adding support for that
clock to the platform data initialization

Changes in v2:
 - statisticize the global in the atmel-st change
 - merge at91_reset_of_probe() in at91_reset_probe()
 - added patches from Boris for the TCB
 - added the slow clock to the TCB

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-clk at vger.kernel.org
Cc: linux-pm at vger.kernel.org
Cc: linux-pwm at vger.kernel.org
Cc: linux-watchdog at vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: rtc-linux at googlegroups.com
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>

Alexandre Belloni (20):
  Documentation: dt: atmel-at91: add clocks to system timer, rstc and
    shdwc
  Documentation: watchdog: at91sam9_wdt: add clocks property
  Documentation: dt: rtc: at91rm9200: add clocks property
  ARM: at91/dt: at91rm9200: use slow clock where necessary
  ARM: at91/dt: at91sam9260: use slow clock where necessary
  ARM: at91/dt: at91sam9261: use slow clock where necessary
  ARM: at91/dt: at91sam9263: use slow clock where necessary
  ARM: at91/dt: at91sam9g45: use slow clock where necessary
  ARM: at91/dt: at91sam9n12: use slow clock where necessary
  ARM: at91/dt: at91sam9rl: use slow clock where necessary
  ARM: at91/dt: at91sam9x5: use slow clock where necessary
  ARM: at91/dt: sama5d3: use slow clock where necessary
  ARM: at91/dt: sama5d4: use slow clock where necessary
  rtc: at91rm9200: get and use slow clock
  watchdog: at91sam9: get and use slow clock
  power/reset: at91-reset: remove useless at91_reset_platform_probe()
  power/reset: at91-reset: get and use slow clock
  power/reset: at91-poweroff: get and use slow clock
  clocksource: atmel-st: get and use slow clock
  clk: at91: Revert "keep slow clk enabled to prevent system hang"

Boris Brezillon (3):
  Documentation: dt: atmel-at91: add slow clock to tcb
  clocksource: tcb_clksrc: fix setup_clkevents error path
  misc: atmel_tclib: get and use slow clock

 .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
 .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
 .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
 arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
 arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
 arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
 arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
 arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
 arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
 arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
 arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
 arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
 arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
 arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
 drivers/clk/at91/clk-slow.c                        | 27 ----------
 drivers/clocksource/tcb_clksrc.c                   | 10 +++-
 drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
 drivers/misc/atmel_tclib.c                         |  4 ++
 drivers/power/reset/at91-poweroff.c                | 13 +++++
 drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
 drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
 drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
 drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
 include/linux/atmel_tc.h                           |  1 +
 24 files changed, 206 insertions(+), 129 deletions(-)

-- 
2.1.4

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

* [PATCH 01/23] Documentation: dt: atmel-at91: add clocks to system timer, rstc and shdwc
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
  (?)
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Sebastian Reichel, Dmitry Eremin-Solenikov, linux-pm

The system timer (at91rm9200), the reset controller and the shutdown
controller need an input clock. This is the slow clock and they will not
function without it.

Also fix the shutdown controller example.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.org
 Documentation/devicetree/bindings/arm/atmel-at91.txt | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 424ac8cbfa08..209710cdf3aa 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -50,6 +50,7 @@ System Timer (ST) required properties:
 - reg: Should contain registers location and length
 - interrupts: Should contain interrupt for the ST which is the IRQ line
   shared across all System Controller members.
+- clocks: phandle to input clock.
 Its subnodes can be:
 - watchdog: compatible should be "atmel,at91rm9200-wdt"
 
@@ -89,12 +90,14 @@ RSTC Reset Controller required properties:
 - compatible: Should be "atmel,<chip>-rstc".
   <chip> can be "at91sam9260" or "at91sam9g45"
 - reg: Should contain registers location and length
+- clocks: phandle to input clock.
 
 Example:
 
 	rstc@fffffd00 {
 		compatible = "atmel,at91sam9260-rstc";
 		reg = <0xfffffd00 0x10>;
+		clocks = <&clk32k>;
 	};
 
 RAMC SDRAM/DDR Controller required properties:
@@ -117,6 +120,7 @@ required properties:
 - compatible: Should be "atmel,<chip>-shdwc".
   <chip> can be "at91sam9260", "at91sam9rl" or "at91sam9x5".
 - reg: Should contain registers location and length
+- clocks: phandle to input clock.
 
 optional properties:
 - atmel,wakeup-mode: String, operation mode of the wakeup mode.
@@ -135,9 +139,10 @@ optional at91sam9x5 properties:
 
 Example:
 
-	rstc@fffffd00 {
-		compatible = "atmel,at91sam9260-rstc";
-		reg = <0xfffffd00 0x10>;
+	shdwc@fffffd10 {
+		compatible = "atmel,at91sam9260-shdwc";
+		reg = <0xfffffd10 0x10>;
+		clocks = <&clk32k>;
 	};
 
 Special Function Registers (SFR)
-- 
2.1.4


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

* [PATCH 01/23] Documentation: dt: atmel-at91: add clocks to system timer, rstc and shdwc
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, linux-pm, Dmitry Eremin-Solenikov, linux-kernel,
	Sebastian Reichel, Alexandre Belloni, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel

The system timer (at91rm9200), the reset controller and the shutdown
controller need an input clock. This is the slow clock and they will not
function without it.

Also fix the shutdown controller example.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.org
 Documentation/devicetree/bindings/arm/atmel-at91.txt | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 424ac8cbfa08..209710cdf3aa 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -50,6 +50,7 @@ System Timer (ST) required properties:
 - reg: Should contain registers location and length
 - interrupts: Should contain interrupt for the ST which is the IRQ line
   shared across all System Controller members.
+- clocks: phandle to input clock.
 Its subnodes can be:
 - watchdog: compatible should be "atmel,at91rm9200-wdt"
 
@@ -89,12 +90,14 @@ RSTC Reset Controller required properties:
 - compatible: Should be "atmel,<chip>-rstc".
   <chip> can be "at91sam9260" or "at91sam9g45"
 - reg: Should contain registers location and length
+- clocks: phandle to input clock.
 
 Example:
 
 	rstc@fffffd00 {
 		compatible = "atmel,at91sam9260-rstc";
 		reg = <0xfffffd00 0x10>;
+		clocks = <&clk32k>;
 	};
 
 RAMC SDRAM/DDR Controller required properties:
@@ -117,6 +120,7 @@ required properties:
 - compatible: Should be "atmel,<chip>-shdwc".
   <chip> can be "at91sam9260", "at91sam9rl" or "at91sam9x5".
 - reg: Should contain registers location and length
+- clocks: phandle to input clock.
 
 optional properties:
 - atmel,wakeup-mode: String, operation mode of the wakeup mode.
@@ -135,9 +139,10 @@ optional at91sam9x5 properties:
 
 Example:
 
-	rstc@fffffd00 {
-		compatible = "atmel,at91sam9260-rstc";
-		reg = <0xfffffd00 0x10>;
+	shdwc@fffffd10 {
+		compatible = "atmel,at91sam9260-shdwc";
+		reg = <0xfffffd10 0x10>;
+		clocks = <&clk32k>;
 	};
 
 Special Function Registers (SFR)
-- 
2.1.4

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

* [PATCH 01/23] Documentation: dt: atmel-at91: add clocks to system timer, rstc and shdwc
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The system timer (at91rm9200), the reset controller and the shutdown
controller need an input clock. This is the slow clock and they will not
function without it.

Also fix the shutdown controller example.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm at vger.kernel.org
 Documentation/devicetree/bindings/arm/atmel-at91.txt | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 424ac8cbfa08..209710cdf3aa 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -50,6 +50,7 @@ System Timer (ST) required properties:
 - reg: Should contain registers location and length
 - interrupts: Should contain interrupt for the ST which is the IRQ line
   shared across all System Controller members.
+- clocks: phandle to input clock.
 Its subnodes can be:
 - watchdog: compatible should be "atmel,at91rm9200-wdt"
 
@@ -89,12 +90,14 @@ RSTC Reset Controller required properties:
 - compatible: Should be "atmel,<chip>-rstc".
   <chip> can be "at91sam9260" or "at91sam9g45"
 - reg: Should contain registers location and length
+- clocks: phandle to input clock.
 
 Example:
 
 	rstc at fffffd00 {
 		compatible = "atmel,at91sam9260-rstc";
 		reg = <0xfffffd00 0x10>;
+		clocks = <&clk32k>;
 	};
 
 RAMC SDRAM/DDR Controller required properties:
@@ -117,6 +120,7 @@ required properties:
 - compatible: Should be "atmel,<chip>-shdwc".
   <chip> can be "at91sam9260", "at91sam9rl" or "at91sam9x5".
 - reg: Should contain registers location and length
+- clocks: phandle to input clock.
 
 optional properties:
 - atmel,wakeup-mode: String, operation mode of the wakeup mode.
@@ -135,9 +139,10 @@ optional at91sam9x5 properties:
 
 Example:
 
-	rstc at fffffd00 {
-		compatible = "atmel,at91sam9260-rstc";
-		reg = <0xfffffd00 0x10>;
+	shdwc at fffffd10 {
+		compatible = "atmel,at91sam9260-shdwc";
+		reg = <0xfffffd10 0x10>;
+		clocks = <&clk32k>;
 	};
 
 Special Function Registers (SFR)
-- 
2.1.4

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

* [PATCH 02/23] Documentation: dt: atmel-at91: add slow clock to tcb
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Daniel Lezcano, Thomas Gleixner, Arnd Bergmann,
	Greg Kroah-Hartman, Thierry Reding, linux-pwm

From: Boris Brezillon <boris.brezillon@free-electrons.com>

The timer counters need the slow clock. It is required as they
will not function without it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm@vger.kernel.org
 Documentation/devicetree/bindings/arm/atmel-at91.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 209710cdf3aa..dc2d0f06d058 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -62,7 +62,7 @@ TC/TCLIB Timer required properties:
   Note that you can specify several interrupt cells if the TC
   block has one interrupt per channel.
 - clock-names: tuple listing input clock names.
-	Required elements: "t0_clk"
+	Required elements: "t0_clk", "slow_clk"
 	Optional elements: "t1_clk", "t2_clk"
 - clocks: phandles to input clocks.
 
-- 
2.1.4


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

* [PATCH 02/23] Documentation: dt: atmel-at91: add slow clock to tcb
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

From: Boris Brezillon <boris.brezillon@free-electrons.com>

The timer counters need the slow clock. It is required as they
will not function without it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm at vger.kernel.org
 Documentation/devicetree/bindings/arm/atmel-at91.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index 209710cdf3aa..dc2d0f06d058 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -62,7 +62,7 @@ TC/TCLIB Timer required properties:
   Note that you can specify several interrupt cells if the TC
   block has one interrupt per channel.
 - clock-names: tuple listing input clock names.
-	Required elements: "t0_clk"
+	Required elements: "t0_clk", "slow_clk"
 	Optional elements: "t1_clk", "t2_clk"
 - clocks: phandles to input clocks.
 
-- 
2.1.4

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

* [PATCH 03/23] Documentation: watchdog: at91sam9_wdt: add clocks property
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Wim Van Sebroeck, linux-watchdog

The watchdog has an input clock, the slow clock. It is required as it will
not function without it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
index a4d869744f59..86fa6de1019b 100644
--- a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
@@ -6,6 +6,7 @@ Required properties:
 - compatible: must be "atmel,at91sam9260-wdt".
 - reg: physical base address of the controller and length of memory mapped
   region.
+- clocks: phandle to input clock.
 
 Optional properties:
 - timeout-sec: contains the watchdog timeout in seconds.
@@ -39,6 +40,7 @@ Example:
 		compatible = "atmel,at91sam9260-wdt";
 		reg = <0xfffffd40 0x10>;
 		interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+		clocks = <&clk32k>;
 		timeout-sec = <15>;
 		atmel,watchdog-type = "hardware";
 		atmel,reset-type = "all";
-- 
2.1.4


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

* [PATCH 03/23] Documentation: watchdog: at91sam9_wdt: add clocks property
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog has an input clock, the slow clock. It is required as it will
not function without it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog at vger.kernel.org
 Documentation/devicetree/bindings/watchdog/atmel-wdt.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
index a4d869744f59..86fa6de1019b 100644
--- a/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/atmel-wdt.txt
@@ -6,6 +6,7 @@ Required properties:
 - compatible: must be "atmel,at91sam9260-wdt".
 - reg: physical base address of the controller and length of memory mapped
   region.
+- clocks: phandle to input clock.
 
 Optional properties:
 - timeout-sec: contains the watchdog timeout in seconds.
@@ -39,6 +40,7 @@ Example:
 		compatible = "atmel,at91sam9260-wdt";
 		reg = <0xfffffd40 0x10>;
 		interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+		clocks = <&clk32k>;
 		timeout-sec = <15>;
 		atmel,watchdog-type = "hardware";
 		atmel,reset-type = "all";
-- 
2.1.4

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

* [PATCH 04/23] Documentation: dt: rtc: at91rm9200: add clocks property
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
  (?)
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Alessandro Zummo, rtc-linux

The RTC needs an input clock, it is the slow clock. It is required as it
will not function without it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux@googlegroups.com
 Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt b/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
index 34c1505774bf..5d3791e789c6 100644
--- a/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
@@ -5,6 +5,7 @@ Required properties:
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: rtc alarm/event interrupt
+- clocks: phandle to input clock.
 
 Example:
 
@@ -12,4 +13,5 @@ rtc@fffffe00 {
 	compatible = "atmel,at91rm9200-rtc";
 	reg = <0xfffffe00 0x100>;
 	interrupts = <1 4 7>;
+	clocks = <&clk32k>;
 };
-- 
2.1.4


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

* [rtc-linux] [PATCH 04/23] Documentation: dt: rtc: at91rm9200: add clocks property
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Alessandro Zummo, rtc-linux

The RTC needs an input clock, it is the slow clock. It is required as it
will not function without it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux@googlegroups.com
 Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt b/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
index 34c1505774bf..5d3791e789c6 100644
--- a/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
@@ -5,6 +5,7 @@ Required properties:
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: rtc alarm/event interrupt
+- clocks: phandle to input clock.
 
 Example:
 
@@ -12,4 +13,5 @@ rtc@fffffe00 {
 	compatible = "atmel,at91rm9200-rtc";
 	reg = <0xfffffe00 0x100>;
 	interrupts = <1 4 7>;
+	clocks = <&clk32k>;
 };
-- 
2.1.4

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH 04/23] Documentation: dt: rtc: at91rm9200: add clocks property
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The RTC needs an input clock, it is the slow clock. It is required as it
will not function without it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux at googlegroups.com
 Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt b/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
index 34c1505774bf..5d3791e789c6 100644
--- a/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/atmel,at91rm9200-rtc.txt
@@ -5,6 +5,7 @@ Required properties:
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: rtc alarm/event interrupt
+- clocks: phandle to input clock.
 
 Example:
 
@@ -12,4 +13,5 @@ rtc at fffffe00 {
 	compatible = "atmel,at91rm9200-rtc";
 	reg = <0xfffffe00 0x100>;
 	interrupts = <1 4 7>;
+	clocks = <&clk32k>;
 };
-- 
2.1.4

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

* [PATCH 05/23] ARM: at91/dt: at91rm9200: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The system timer, the RTC and the timer counters need the slow clock, add
it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91rm9200.dtsi | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index e3cfb9972f54..60edd8baebb8 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -359,6 +359,7 @@
 				compatible = "atmel,at91rm9200-st", "syscon", "simple-mfd";
 				reg = <0xfffffd00 0x100>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 
 				watchdog {
 					compatible = "atmel,at91rm9200-wdt";
@@ -369,6 +370,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffe00 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 				status = "disabled";
 			};
 
@@ -378,8 +380,8 @@
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
 					      18 IRQ_TYPE_LEVEL_HIGH 0
 					      19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			tcb1: timer@fffa4000 {
@@ -388,8 +390,8 @@
 				interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0
 					      21 IRQ_TYPE_LEVEL_HIGH 0
 					      22 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			i2c0: i2c@fffb8000 {
-- 
2.1.4


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

* [PATCH 05/23] ARM: at91/dt: at91rm9200: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The system timer, the RTC and the timer counters need the slow clock, add
it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91rm9200.dtsi | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index e3cfb9972f54..60edd8baebb8 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -359,6 +359,7 @@
 				compatible = "atmel,at91rm9200-st", "syscon", "simple-mfd";
 				reg = <0xfffffd00 0x100>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 
 				watchdog {
 					compatible = "atmel,at91rm9200-wdt";
@@ -369,6 +370,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffe00 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 				status = "disabled";
 			};
 
@@ -378,8 +380,8 @@
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
 					      18 IRQ_TYPE_LEVEL_HIGH 0
 					      19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			tcb1: timer at fffa4000 {
@@ -388,8 +390,8 @@
 				interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0
 					      21 IRQ_TYPE_LEVEL_HIGH 0
 					      22 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			i2c0: i2c at fffb8000 {
-- 
2.1.4

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

* [PATCH 06/23] ARM: at91/dt: at91sam9260: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the real-time timer, the shutdown
controller, the timer counters need the slow clock, add it where necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9260.dtsi | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 4bc347549102..be9c027ddd97 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -359,11 +359,13 @@
 			rstc@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc@fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer@fffffd30 {
@@ -379,8 +381,8 @@
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
 					      18 IRQ_TYPE_LEVEL_HIGH 0
 					      19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			tcb1: timer@fffdc000 {
@@ -389,8 +391,8 @@
 				interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0
 					      27 IRQ_TYPE_LEVEL_HIGH 0
 					      28 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			pinctrl@fffff400 {
@@ -973,6 +975,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
-- 
2.1.4


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

* [PATCH 06/23] ARM: at91/dt: at91sam9260: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the real-time timer, the shutdown
controller, the timer counters need the slow clock, add it where necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9260.dtsi | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 4bc347549102..be9c027ddd97 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -359,11 +359,13 @@
 			rstc at fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc at fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer at fffffd30 {
@@ -379,8 +381,8 @@
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
 					      18 IRQ_TYPE_LEVEL_HIGH 0
 					      19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			tcb1: timer at fffdc000 {
@@ -389,8 +391,8 @@
 				interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0
 					      27 IRQ_TYPE_LEVEL_HIGH 0
 					      28 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc3_clk>, <&tc4_clk>, <&tc5_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			pinctrl at fffff400 {
@@ -973,6 +975,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
-- 
2.1.4

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

* [PATCH 07/23] ARM: at91/dt: at91sam9261: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the real-time timer, the shutdown
controller and the timer counter need the slow clock, add it where
necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9261.dtsi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi
index b2c44a07a3d0..ce1e3e94a40c 100644
--- a/arch/arm/boot/dts/at91sam9261.dtsi
+++ b/arch/arm/boot/dts/at91sam9261.dtsi
@@ -119,8 +119,8 @@
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <18 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			usb1: gadget@fffa4000 {
@@ -820,11 +820,13 @@
 			rstc@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			shdwc@fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			pit: timer@fffffd30 {
@@ -846,6 +848,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 				status = "disabled";
 			};
 
-- 
2.1.4


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

* [PATCH 07/23] ARM: at91/dt: at91sam9261: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the real-time timer, the shutdown
controller and the timer counter need the slow clock, add it where
necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9261.dtsi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi
index b2c44a07a3d0..ce1e3e94a40c 100644
--- a/arch/arm/boot/dts/at91sam9261.dtsi
+++ b/arch/arm/boot/dts/at91sam9261.dtsi
@@ -119,8 +119,8 @@
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <18 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			usb1: gadget at fffa4000 {
@@ -820,11 +820,13 @@
 			rstc at fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			shdwc at fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			pit: timer at fffffd30 {
@@ -846,6 +848,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 				status = "disabled";
 			};
 
-- 
2.1.4

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

* [PATCH 08/23] ARM: at91/dt: at91sam9263: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the two real-time timers, the shutdown
controller and the timer counter need the slow clock, add it where
necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9263.dtsi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index e36d966ef5e8..f1f5fa3a9e6e 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -377,18 +377,20 @@
 				compatible = "atmel,at91rm9200-tcb";
 				reg = <0xfff7c000 0x100>;
 				interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			rstc@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			shdwc@fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			pinctrl@fffff200 {
@@ -902,6 +904,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
-- 
2.1.4


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

* [PATCH 08/23] ARM: at91/dt: at91sam9263: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the two real-time timers, the shutdown
controller and the timer counter need the slow clock, add it where
necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9263.dtsi | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index e36d966ef5e8..f1f5fa3a9e6e 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -377,18 +377,20 @@
 				compatible = "atmel,at91rm9200-tcb";
 				reg = <0xfff7c000 0x100>;
 				interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb_clk>, <&slow_xtal>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			rstc at fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			shdwc at fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&slow_xtal>;
 			};
 
 			pinctrl at fffff200 {
@@ -902,6 +904,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&slow_xtal>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
-- 
2.1.4

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

* [PATCH 09/23] ARM: at91/dt: at91sam9g45: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the RTC, the real-time timer, the
shutdown controller and the timer counters need the slow clock, add it
where necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9g45.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 18177f5a7464..b8b878c25227 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -387,6 +387,7 @@
 			rstc@fffffd00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer@fffffd30 {
@@ -400,22 +401,23 @@
 			shdwc@fffffd10 {
 				compatible = "atmel,at91sam9rl-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			tcb0: timer@fff7c000 {
 				compatible = "atmel,at91rm9200-tcb";
 				reg = <0xfff7c000 0x100>;
 				interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			tcb1: timer@fffd4000 {
 				compatible = "atmel,at91rm9200-tcb";
 				reg = <0xfffd4000 0x100>;
 				interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			dma: dma-controller@ffffec00 {
@@ -1113,6 +1115,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -1247,6 +1250,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffdb0 0x30>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4


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

* [PATCH 09/23] ARM: at91/dt: at91sam9g45: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the RTC, the real-time timer, the
shutdown controller and the timer counters need the slow clock, add it
where necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9g45.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 18177f5a7464..b8b878c25227 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -387,6 +387,7 @@
 			rstc at fffffd00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer at fffffd30 {
@@ -400,22 +401,23 @@
 			shdwc at fffffd10 {
 				compatible = "atmel,at91sam9rl-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			tcb0: timer at fff7c000 {
 				compatible = "atmel,at91rm9200-tcb";
 				reg = <0xfff7c000 0x100>;
 				interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			tcb1: timer at fffd4000 {
 				compatible = "atmel,at91rm9200-tcb";
 				reg = <0xfffd4000 0x100>;
 				interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tcb0_clk>, <&tcb0_clk>, <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			dma: dma-controller at ffffec00 {
@@ -1113,6 +1115,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -1247,6 +1250,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffdb0 0x30>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4

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

* [PATCH 10/23] ARM: at91/dt: at91sam9n12: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary.
The LCD PWM will be handled later.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9n12.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 5c2a8c8c8bd4..345186f91422 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -376,6 +376,7 @@
 			rstc@fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer@fffffe30 {
@@ -388,6 +389,7 @@
 			shdwc@fffffe10 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfffffe10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			sckc@fffffe50 {
@@ -431,16 +433,16 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf8008000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			tcb1: timer@f800c000 {
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf800c000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			dma: dma-controller@ffffec00 {
@@ -891,6 +893,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffe40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -901,6 +904,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffeb0 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4


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

* [PATCH 10/23] ARM: at91/dt: at91sam9n12: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary.
The LCD PWM will be handled later.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9n12.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 5c2a8c8c8bd4..345186f91422 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -376,6 +376,7 @@
 			rstc at fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer at fffffe30 {
@@ -388,6 +389,7 @@
 			shdwc at fffffe10 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfffffe10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			sckc at fffffe50 {
@@ -431,16 +433,16 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf8008000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			tcb1: timer at f800c000 {
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf800c000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			dma: dma-controller at ffffec00 {
@@ -891,6 +893,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffe40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -901,6 +904,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffeb0 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4

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

* [PATCH 11/23] ARM: at91/dt: at91sam9rl: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the RTC, the real-time timer, the
shutdown controller and the timer counter need the slow clock, add it where
necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9rl.dtsi | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
index c9920c64791c..a0b90aedd3b8 100644
--- a/arch/arm/boot/dts/at91sam9rl.dtsi
+++ b/arch/arm/boot/dts/at91sam9rl.dtsi
@@ -121,8 +121,8 @@
 				interrupts = <16 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <17 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <18 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			mmc0: mmc@fffa4000 {
@@ -1018,11 +1018,13 @@
 			rstc@fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc@fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer@fffffd30 {
@@ -1036,6 +1038,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
@@ -1083,6 +1086,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffe00 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4


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

* [PATCH 11/23] ARM: at91/dt: at91sam9rl: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the RTC, the real-time timer, the
shutdown controller and the timer counter need the slow clock, add it where
necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9rl.dtsi | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi b/arch/arm/boot/dts/at91sam9rl.dtsi
index c9920c64791c..a0b90aedd3b8 100644
--- a/arch/arm/boot/dts/at91sam9rl.dtsi
+++ b/arch/arm/boot/dts/at91sam9rl.dtsi
@@ -121,8 +121,8 @@
 				interrupts = <16 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <17 IRQ_TYPE_LEVEL_HIGH 0>,
 					     <18 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>;
-				clock-names = "t0_clk", "t1_clk", "t2_clk";
+				clocks = <&tc0_clk>, <&tc1_clk>, <&tc2_clk>, <&clk32k>;
+				clock-names = "t0_clk", "t1_clk", "t2_clk", "slow_clk";
 			};
 
 			mmc0: mmc at fffa4000 {
@@ -1018,11 +1018,13 @@
 			rstc at fffffd00 {
 				compatible = "atmel,at91sam9260-rstc";
 				reg = <0xfffffd00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc at fffffd10 {
 				compatible = "atmel,at91sam9260-shdwc";
 				reg = <0xfffffd10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer at fffffd30 {
@@ -1036,6 +1038,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffd40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
@@ -1083,6 +1086,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffe00 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4

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

* [PATCH 12/23] ARM: at91/dt: at91sam9x5: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary,
The LCD PWM will be handled later.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9x5.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index b6c8df8d380e..1709a071c5ae 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -376,11 +376,13 @@
 			rstc@fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc@fffffe10 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfffffe10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer@fffffe30 {
@@ -418,16 +420,16 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf8008000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			tcb1: timer@f800c000 {
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf800c000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			dma0: dma-controller@ffffec00 {
@@ -1173,6 +1175,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffe40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -1183,6 +1186,7 @@
 				compatible = "atmel,at91sam9x5-rtc";
 				reg = <0xfffffeb0 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4


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

* [PATCH 12/23] ARM: at91/dt: at91sam9x5: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary,
The LCD PWM will be handled later.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/at91sam9x5.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index b6c8df8d380e..1709a071c5ae 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -376,11 +376,13 @@
 			rstc at fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc at fffffe10 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfffffe10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer at fffffe30 {
@@ -418,16 +420,16 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf8008000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			tcb1: timer at f800c000 {
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf800c000 0x100>;
 				interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			dma0: dma-controller at ffffec00 {
@@ -1173,6 +1175,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffe40 0x10>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -1183,6 +1186,7 @@
 				compatible = "atmel,at91sam9x5-rtc";
 				reg = <0xfffffeb0 0x40>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
-- 
2.1.4

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

* [PATCH 13/23] ARM: at91/dt: sama5d3: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary.

[boris.brezillon@free-electrons.com: add tcb clocks]
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/sama5d3.dtsi      | 8 ++++++--
 arch/arm/boot/dts/sama5d3_tcb1.dtsi | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 9e2444b07bce..db667f773ebe 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -145,8 +145,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf0010000 0x100>;
 				interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			i2c0: i2c@f0014000 {
@@ -1261,11 +1261,13 @@
 			rstc@fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shutdown-controller@fffffe10 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfffffe10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer@fffffe30 {
@@ -1279,6 +1281,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffe40 0x10>;
 				interrupts = <4 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -1315,6 +1318,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffeb0 0x30>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 			};
 		};
 
diff --git a/arch/arm/boot/dts/sama5d3_tcb1.dtsi b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
index f7fa58fe09f1..801f9745e82f 100644
--- a/arch/arm/boot/dts/sama5d3_tcb1.dtsi
+++ b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
@@ -31,8 +31,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf8014000 0x100>;
 				interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb1_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb1_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 		};
 	};
-- 
2.1.4


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

* [PATCH 13/23] ARM: at91/dt: sama5d3: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary.

[boris.brezillon at free-electrons.com: add tcb clocks]
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/sama5d3.dtsi      | 8 ++++++--
 arch/arm/boot/dts/sama5d3_tcb1.dtsi | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 9e2444b07bce..db667f773ebe 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -145,8 +145,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf0010000 0x100>;
 				interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			i2c0: i2c at f0014000 {
@@ -1261,11 +1261,13 @@
 			rstc at fffffe00 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfffffe00 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shutdown-controller at fffffe10 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfffffe10 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer at fffffe30 {
@@ -1279,6 +1281,7 @@
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfffffe40 0x10>;
 				interrupts = <4 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 				atmel,watchdog-type = "hardware";
 				atmel,reset-type = "all";
 				atmel,dbg-halt;
@@ -1315,6 +1318,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfffffeb0 0x30>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 			};
 		};
 
diff --git a/arch/arm/boot/dts/sama5d3_tcb1.dtsi b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
index f7fa58fe09f1..801f9745e82f 100644
--- a/arch/arm/boot/dts/sama5d3_tcb1.dtsi
+++ b/arch/arm/boot/dts/sama5d3_tcb1.dtsi
@@ -31,8 +31,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf8014000 0x100>;
 				interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb1_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb1_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 		};
 	};
-- 
2.1.4

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

* [PATCH 14/23] ARM: at91/dt: sama5d4: use slow clock where necessary
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/sama5d4.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 3ee22ee13c5a..1d3abf2605e9 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -957,8 +957,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf801c000 0x100>;
 				interrupts = <40 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			macb0: ethernet@f8020000 {
@@ -1185,8 +1185,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xfc020000 0x100>;
 				interrupts = <41 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb1_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb1_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			adc0: adc@fc034000 {
@@ -1279,11 +1279,13 @@
 			rstc@fc068600 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfc068600 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc@fc068610 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfc068610 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer@fc068630 {
@@ -1296,6 +1298,7 @@
 			watchdog@fc068640 {
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfc068640 0x10>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
@@ -1329,6 +1332,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfc0686b0 0x30>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 			};
 
 			dbgu: serial@fc069000 {
-- 
2.1.4


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

* [PATCH 14/23] ARM: at91/dt: sama5d4: use slow clock where necessary
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The watchdog, the reset controller, the RTC, the shutdown controller, the
timer counters and the LCD PWM need the slow clock, add it where necessary.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 arch/arm/boot/dts/sama5d4.dtsi | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 3ee22ee13c5a..1d3abf2605e9 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -957,8 +957,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xf801c000 0x100>;
 				interrupts = <40 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb0_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb0_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			macb0: ethernet at f8020000 {
@@ -1185,8 +1185,8 @@
 				compatible = "atmel,at91sam9x5-tcb";
 				reg = <0xfc020000 0x100>;
 				interrupts = <41 IRQ_TYPE_LEVEL_HIGH 0>;
-				clocks = <&tcb1_clk>;
-				clock-names = "t0_clk";
+				clocks = <&tcb1_clk>, <&clk32k>;
+				clock-names = "t0_clk", "slow_clk";
 			};
 
 			adc0: adc at fc034000 {
@@ -1279,11 +1279,13 @@
 			rstc at fc068600 {
 				compatible = "atmel,at91sam9g45-rstc";
 				reg = <0xfc068600 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			shdwc at fc068610 {
 				compatible = "atmel,at91sam9x5-shdwc";
 				reg = <0xfc068610 0x10>;
+				clocks = <&clk32k>;
 			};
 
 			pit: timer at fc068630 {
@@ -1296,6 +1298,7 @@
 			watchdog at fc068640 {
 				compatible = "atmel,at91sam9260-wdt";
 				reg = <0xfc068640 0x10>;
+				clocks = <&clk32k>;
 				status = "disabled";
 			};
 
@@ -1329,6 +1332,7 @@
 				compatible = "atmel,at91rm9200-rtc";
 				reg = <0xfc0686b0 0x30>;
 				interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&clk32k>;
 			};
 
 			dbgu: serial at fc069000 {
-- 
2.1.4

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

* [PATCH 15/23] rtc: at91rm9200: get and use slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
  (?)
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Alessandro Zummo, rtc-linux

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91rm9200 rtc.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux@googlegroups.com
 drivers/rtc/rtc-at91rm9200.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 35efd3f75b18..8093d9e50619 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -24,6 +24,7 @@
 #include <linux/time.h>
 #include <linux/rtc.h>
 #include <linux/bcd.h>
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 #include <linux/ioctl.h>
@@ -59,6 +60,7 @@ static bool suspended;
 static DEFINE_SPINLOCK(suspended_lock);
 static unsigned long cached_events;
 static u32 at91_rtc_imr;
+static struct clk *sclk;
 
 static void at91_rtc_write_ier(u32 mask)
 {
@@ -407,6 +409,16 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sclk))
+		return PTR_ERR(sclk);
+
+	ret = clk_prepare_enable(sclk);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return ret;
+	}
+
 	at91_rtc_write(AT91_RTC_CR, 0);
 	at91_rtc_write(AT91_RTC_MR, 0);		/* 24 hour mode */
 
@@ -420,7 +432,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 			       "at91_rtc", pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
-		return ret;
+		goto err_clk;
 	}
 
 	/* cpu init code should really have flagged this device as
@@ -431,8 +443,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
 				&at91_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc))
-		return PTR_ERR(rtc);
+	if (IS_ERR(rtc)) {
+		ret = PTR_ERR(rtc);
+		goto err_clk;
+	}
 	platform_set_drvdata(pdev, rtc);
 
 	/* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
@@ -442,6 +456,11 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
 	return 0;
+
+err_clk:
+	clk_disable_unprepare(sclk);
+
+	return ret;
 }
 
 /*
@@ -454,6 +473,8 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
 					AT91_RTC_SECEV | AT91_RTC_TIMEV |
 					AT91_RTC_CALEV);
 
+	clk_disable_unprepare(sclk);
+
 	return 0;
 }
 
-- 
2.1.4


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

* [rtc-linux] [PATCH 15/23] rtc: at91rm9200: get and use slow clock
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Alessandro Zummo, rtc-linux

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91rm9200 rtc.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux@googlegroups.com
 drivers/rtc/rtc-at91rm9200.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 35efd3f75b18..8093d9e50619 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -24,6 +24,7 @@
 #include <linux/time.h>
 #include <linux/rtc.h>
 #include <linux/bcd.h>
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 #include <linux/ioctl.h>
@@ -59,6 +60,7 @@ static bool suspended;
 static DEFINE_SPINLOCK(suspended_lock);
 static unsigned long cached_events;
 static u32 at91_rtc_imr;
+static struct clk *sclk;
 
 static void at91_rtc_write_ier(u32 mask)
 {
@@ -407,6 +409,16 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sclk))
+		return PTR_ERR(sclk);
+
+	ret = clk_prepare_enable(sclk);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return ret;
+	}
+
 	at91_rtc_write(AT91_RTC_CR, 0);
 	at91_rtc_write(AT91_RTC_MR, 0);		/* 24 hour mode */
 
@@ -420,7 +432,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 			       "at91_rtc", pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
-		return ret;
+		goto err_clk;
 	}
 
 	/* cpu init code should really have flagged this device as
@@ -431,8 +443,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
 				&at91_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc))
-		return PTR_ERR(rtc);
+	if (IS_ERR(rtc)) {
+		ret = PTR_ERR(rtc);
+		goto err_clk;
+	}
 	platform_set_drvdata(pdev, rtc);
 
 	/* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
@@ -442,6 +456,11 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
 	return 0;
+
+err_clk:
+	clk_disable_unprepare(sclk);
+
+	return ret;
 }
 
 /*
@@ -454,6 +473,8 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
 					AT91_RTC_SECEV | AT91_RTC_TIMEV |
 					AT91_RTC_CALEV);
 
+	clk_disable_unprepare(sclk);
+
 	return 0;
 }
 
-- 
2.1.4

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH 15/23] rtc: at91rm9200: get and use slow clock
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91rm9200 rtc.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux at googlegroups.com
 drivers/rtc/rtc-at91rm9200.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 35efd3f75b18..8093d9e50619 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -24,6 +24,7 @@
 #include <linux/time.h>
 #include <linux/rtc.h>
 #include <linux/bcd.h>
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 #include <linux/ioctl.h>
@@ -59,6 +60,7 @@ static bool suspended;
 static DEFINE_SPINLOCK(suspended_lock);
 static unsigned long cached_events;
 static u32 at91_rtc_imr;
+static struct clk *sclk;
 
 static void at91_rtc_write_ier(u32 mask)
 {
@@ -407,6 +409,16 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sclk))
+		return PTR_ERR(sclk);
+
+	ret = clk_prepare_enable(sclk);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return ret;
+	}
+
 	at91_rtc_write(AT91_RTC_CR, 0);
 	at91_rtc_write(AT91_RTC_MR, 0);		/* 24 hour mode */
 
@@ -420,7 +432,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 			       "at91_rtc", pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
-		return ret;
+		goto err_clk;
 	}
 
 	/* cpu init code should really have flagged this device as
@@ -431,8 +443,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
 				&at91_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc))
-		return PTR_ERR(rtc);
+	if (IS_ERR(rtc)) {
+		ret = PTR_ERR(rtc);
+		goto err_clk;
+	}
 	platform_set_drvdata(pdev, rtc);
 
 	/* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
@@ -442,6 +456,11 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
 	dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
 	return 0;
+
+err_clk:
+	clk_disable_unprepare(sclk);
+
+	return ret;
 }
 
 /*
@@ -454,6 +473,8 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
 					AT91_RTC_SECEV | AT91_RTC_TIMEV |
 					AT91_RTC_CALEV);
 
+	clk_disable_unprepare(sclk);
+
 	return 0;
 }
 
-- 
2.1.4

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

* [PATCH 16/23] watchdog: at91sam9: get and use slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Wim Van Sebroeck, linux-watchdog

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91sam9 watchdog.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
 drivers/watchdog/at91sam9_wdt.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index e4698f7c5f93..7e6acaf3ece4 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -17,6 +17,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/clk.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -90,6 +91,7 @@ struct at91wdt {
 	unsigned long heartbeat;	/* WDT heartbeat in jiffies */
 	bool nowayout;
 	unsigned int irq;
+	struct clk *sclk;
 };
 
 /* ......................................................................... */
@@ -352,15 +354,25 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	if (IS_ERR(wdt->base))
 		return PTR_ERR(wdt->base);
 
+	wdt->sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(wdt->sclk))
+		return PTR_ERR(wdt->sclk);
+
+	err = clk_prepare_enable(wdt->sclk);
+	if (err) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return err;
+	}
+
 	if (pdev->dev.of_node) {
 		err = of_at91wdt_init(pdev->dev.of_node, wdt);
 		if (err)
-			return err;
+			goto err_clk;
 	}
 
 	err = at91_wdt_init(pdev, wdt);
 	if (err)
-		return err;
+		goto err_clk;
 
 	platform_set_drvdata(pdev, wdt);
 
@@ -368,6 +380,11 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 		wdt->wdd.timeout, wdt->nowayout);
 
 	return 0;
+
+err_clk:
+	clk_disable_unprepare(wdt->sclk);
+
+	return err;
 }
 
 static int __exit at91wdt_remove(struct platform_device *pdev)
@@ -377,6 +394,7 @@ static int __exit at91wdt_remove(struct platform_device *pdev)
 
 	pr_warn("I quit now, hardware will probably reboot!\n");
 	del_timer(&wdt->timer);
+	clk_disable_unprepare(wdt->sclk);
 
 	return 0;
 }
-- 
2.1.4


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

* [PATCH 16/23] watchdog: at91sam9: get and use slow clock
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91sam9 watchdog.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog at vger.kernel.org
 drivers/watchdog/at91sam9_wdt.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index e4698f7c5f93..7e6acaf3ece4 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -17,6 +17,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/clk.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -90,6 +91,7 @@ struct at91wdt {
 	unsigned long heartbeat;	/* WDT heartbeat in jiffies */
 	bool nowayout;
 	unsigned int irq;
+	struct clk *sclk;
 };
 
 /* ......................................................................... */
@@ -352,15 +354,25 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 	if (IS_ERR(wdt->base))
 		return PTR_ERR(wdt->base);
 
+	wdt->sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(wdt->sclk))
+		return PTR_ERR(wdt->sclk);
+
+	err = clk_prepare_enable(wdt->sclk);
+	if (err) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return err;
+	}
+
 	if (pdev->dev.of_node) {
 		err = of_at91wdt_init(pdev->dev.of_node, wdt);
 		if (err)
-			return err;
+			goto err_clk;
 	}
 
 	err = at91_wdt_init(pdev, wdt);
 	if (err)
-		return err;
+		goto err_clk;
 
 	platform_set_drvdata(pdev, wdt);
 
@@ -368,6 +380,11 @@ static int __init at91wdt_probe(struct platform_device *pdev)
 		wdt->wdd.timeout, wdt->nowayout);
 
 	return 0;
+
+err_clk:
+	clk_disable_unprepare(wdt->sclk);
+
+	return err;
 }
 
 static int __exit at91wdt_remove(struct platform_device *pdev)
@@ -377,6 +394,7 @@ static int __exit at91wdt_remove(struct platform_device *pdev)
 
 	pr_warn("I quit now, hardware will probably reboot!\n");
 	del_timer(&wdt->timer);
+	clk_disable_unprepare(wdt->sclk);
 
 	return 0;
 }
-- 
2.1.4

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

* [PATCH 17/23] power/reset: at91-reset: remove useless at91_reset_platform_probe()
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Sebastian Reichel, Dmitry Eremin-Solenikov, linux-pm

Since all the at91 platforms are now DT only, at91_reset_platform_probe()
is now useless, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.or
 drivers/power/reset/at91-reset.c | 47 +++-------------------------------------
 1 file changed, 3 insertions(+), 44 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 36dc52fb2ec8..3225c8590ed0 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -169,11 +169,11 @@ static struct notifier_block at91_restart_nb = {
 	.priority = 192,
 };
 
-static int at91_reset_of_probe(struct platform_device *pdev)
+static int at91_reset_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *match;
 	struct device_node *np;
-	int idx = 0;
+	int ret, idx = 0;
 
 	at91_rstc_base = of_iomap(pdev->dev.of_node, 0);
 	if (!at91_rstc_base) {
@@ -192,49 +192,8 @@ static int at91_reset_of_probe(struct platform_device *pdev)
 
 	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
 	at91_restart_nb.notifier_call = match->data;
-	return register_restart_handler(&at91_restart_nb);
-}
-
-static int at91_reset_platform_probe(struct platform_device *pdev)
-{
-	const struct platform_device_id *match;
-	struct resource *res;
-	int idx = 0;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	at91_rstc_base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(at91_rstc_base)) {
-		dev_err(&pdev->dev, "Could not map reset controller address\n");
-		return PTR_ERR(at91_rstc_base);
-	}
-
-	for (idx = 0; idx < 2; idx++) {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, idx + 1 );
-		at91_ramc_base[idx] = devm_ioremap(&pdev->dev, res->start,
-						   resource_size(res));
-		if (!at91_ramc_base[idx]) {
-			dev_err(&pdev->dev, "Could not map ram controller address\n");
-			return -ENOMEM;
-		}
-	}
-
-	match = platform_get_device_id(pdev);
-	at91_restart_nb.notifier_call =
-		(int (*)(struct notifier_block *,
-			 unsigned long, void *)) match->driver_data;
-
-	return register_restart_handler(&at91_restart_nb);
-}
-
-static int at91_reset_probe(struct platform_device *pdev)
-{
-	int ret;
-
-	if (pdev->dev.of_node)
-		ret = at91_reset_of_probe(pdev);
-	else
-		ret = at91_reset_platform_probe(pdev);
 
+	ret = register_restart_handler(&at91_restart_nb);
 	if (ret)
 		return ret;
 
-- 
2.1.4


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

* [PATCH 17/23] power/reset: at91-reset: remove useless at91_reset_platform_probe()
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
                   ` (18 preceding siblings ...)
  (?)
@ 2015-07-31  9:39 ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Sebastian Reichel, Dmitry Eremin-Solenikov, linux-pm

Since all the at91 platforms are now DT only, at91_reset_platform_probe()
is now useless, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.or
 drivers/power/reset/at91-reset.c | 47 +++-------------------------------------
 1 file changed, 3 insertions(+), 44 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 36dc52fb2ec8..3225c8590ed0 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -169,11 +169,11 @@ static struct notifier_block at91_restart_nb = {
 	.priority = 192,
 };
 
-static int at91_reset_of_probe(struct platform_device *pdev)
+static int at91_reset_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *match;
 	struct device_node *np;
-	int idx = 0;
+	int ret, idx = 0;
 
 	at91_rstc_base = of_iomap(pdev->dev.of_node, 0);
 	if (!at91_rstc_base) {
@@ -192,49 +192,8 @@ static int at91_reset_of_probe(struct platform_device *pdev)
 
 	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
 	at91_restart_nb.notifier_call = match->data;
-	return register_restart_handler(&at91_restart_nb);
-}
-
-static int at91_reset_platform_probe(struct platform_device *pdev)
-{
-	const struct platform_device_id *match;
-	struct resource *res;
-	int idx = 0;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	at91_rstc_base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(at91_rstc_base)) {
-		dev_err(&pdev->dev, "Could not map reset controller address\n");
-		return PTR_ERR(at91_rstc_base);
-	}
-
-	for (idx = 0; idx < 2; idx++) {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, idx + 1 );
-		at91_ramc_base[idx] = devm_ioremap(&pdev->dev, res->start,
-						   resource_size(res));
-		if (!at91_ramc_base[idx]) {
-			dev_err(&pdev->dev, "Could not map ram controller address\n");
-			return -ENOMEM;
-		}
-	}
-
-	match = platform_get_device_id(pdev);
-	at91_restart_nb.notifier_call =
-		(int (*)(struct notifier_block *,
-			 unsigned long, void *)) match->driver_data;
-
-	return register_restart_handler(&at91_restart_nb);
-}
-
-static int at91_reset_probe(struct platform_device *pdev)
-{
-	int ret;
-
-	if (pdev->dev.of_node)
-		ret = at91_reset_of_probe(pdev);
-	else
-		ret = at91_reset_platform_probe(pdev);
 
+	ret = register_restart_handler(&at91_restart_nb);
 	if (ret)
 		return ret;
 
-- 
2.1.4


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

* [PATCH 17/23] power/reset: at91-reset: remove useless at91_reset_platform_probe()
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Since all the at91 platforms are now DT only, at91_reset_platform_probe()
is now useless, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm at vger.kernel.or
 drivers/power/reset/at91-reset.c | 47 +++-------------------------------------
 1 file changed, 3 insertions(+), 44 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 36dc52fb2ec8..3225c8590ed0 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -169,11 +169,11 @@ static struct notifier_block at91_restart_nb = {
 	.priority = 192,
 };
 
-static int at91_reset_of_probe(struct platform_device *pdev)
+static int at91_reset_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *match;
 	struct device_node *np;
-	int idx = 0;
+	int ret, idx = 0;
 
 	at91_rstc_base = of_iomap(pdev->dev.of_node, 0);
 	if (!at91_rstc_base) {
@@ -192,49 +192,8 @@ static int at91_reset_of_probe(struct platform_device *pdev)
 
 	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
 	at91_restart_nb.notifier_call = match->data;
-	return register_restart_handler(&at91_restart_nb);
-}
-
-static int at91_reset_platform_probe(struct platform_device *pdev)
-{
-	const struct platform_device_id *match;
-	struct resource *res;
-	int idx = 0;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	at91_rstc_base = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(at91_rstc_base)) {
-		dev_err(&pdev->dev, "Could not map reset controller address\n");
-		return PTR_ERR(at91_rstc_base);
-	}
-
-	for (idx = 0; idx < 2; idx++) {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, idx + 1 );
-		at91_ramc_base[idx] = devm_ioremap(&pdev->dev, res->start,
-						   resource_size(res));
-		if (!at91_ramc_base[idx]) {
-			dev_err(&pdev->dev, "Could not map ram controller address\n");
-			return -ENOMEM;
-		}
-	}
-
-	match = platform_get_device_id(pdev);
-	at91_restart_nb.notifier_call =
-		(int (*)(struct notifier_block *,
-			 unsigned long, void *)) match->driver_data;
-
-	return register_restart_handler(&at91_restart_nb);
-}
-
-static int at91_reset_probe(struct platform_device *pdev)
-{
-	int ret;
-
-	if (pdev->dev.of_node)
-		ret = at91_reset_of_probe(pdev);
-	else
-		ret = at91_reset_platform_probe(pdev);
 
+	ret = register_restart_handler(&at91_restart_nb);
 	if (ret)
 		return ret;
 
-- 
2.1.4

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

* [PATCH 18/23] power/reset: at91-reset: get and use slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Sebastian Reichel, Dmitry Eremin-Solenikov, linux-pm

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91 reset
controller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.org
 drivers/power/reset/at91-reset.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 3225c8590ed0..19fdd4c107dc 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -11,6 +11,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
@@ -46,6 +47,7 @@ enum reset_type {
 };
 
 static void __iomem *at91_ramc_base[2], *at91_rstc_base;
+static struct clk *sclk;
 
 /*
 * unless the SDRAM is cleanly shutdown before we hit the
@@ -193,9 +195,21 @@ static int at91_reset_probe(struct platform_device *pdev)
 	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
 	at91_restart_nb.notifier_call = match->data;
 
+	sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sclk))
+		return PTR_ERR(sclk);
+
+	ret = clk_prepare_enable(sclk);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return ret;
+	}
+
 	ret = register_restart_handler(&at91_restart_nb);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(sclk);
 		return ret;
+	}
 
 	at91_reset_status(pdev);
 
-- 
2.1.4


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

* [PATCH 18/23] power/reset: at91-reset: get and use slow clock
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91 reset
controller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm at vger.kernel.org
 drivers/power/reset/at91-reset.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 3225c8590ed0..19fdd4c107dc 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -11,6 +11,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
@@ -46,6 +47,7 @@ enum reset_type {
 };
 
 static void __iomem *at91_ramc_base[2], *at91_rstc_base;
+static struct clk *sclk;
 
 /*
 * unless the SDRAM is cleanly shutdown before we hit the
@@ -193,9 +195,21 @@ static int at91_reset_probe(struct platform_device *pdev)
 	match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
 	at91_restart_nb.notifier_call = match->data;
 
+	sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sclk))
+		return PTR_ERR(sclk);
+
+	ret = clk_prepare_enable(sclk);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return ret;
+	}
+
 	ret = register_restart_handler(&at91_restart_nb);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(sclk);
 		return ret;
+	}
 
 	at91_reset_status(pdev);
 
-- 
2.1.4

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

* [PATCH 19/23] power/reset: at91-poweroff: get and use slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Sebastian Reichel, Dmitry Eremin-Solenikov, linux-pm

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91 shutdown
controller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.org
 drivers/power/reset/at91-poweroff.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/power/reset/at91-poweroff.c b/drivers/power/reset/at91-poweroff.c
index 9847cfb7e23d..fadd1a41729b 100644
--- a/drivers/power/reset/at91-poweroff.c
+++ b/drivers/power/reset/at91-poweroff.c
@@ -10,6 +10,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -48,6 +49,7 @@ static const char *shdwc_wakeup_modes[] = {
 };
 
 static void __iomem *at91_shdwc_base;
+static struct clk *sclk;
 
 static void __init at91_wakeup_status(void)
 {
@@ -122,6 +124,7 @@ static void at91_poweroff_dt_set_wakeup_mode(struct platform_device *pdev)
 static int at91_poweroff_probe(struct platform_device *pdev)
 {
 	struct resource *res;
+	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	at91_shdwc_base = devm_ioremap_resource(&pdev->dev, res);
@@ -130,6 +133,16 @@ static int at91_poweroff_probe(struct platform_device *pdev)
 		return PTR_ERR(at91_shdwc_base);
 	}
 
+	sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sclk))
+		return PTR_ERR(sclk);
+
+	ret = clk_prepare_enable(sclk);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return ret;
+	}
+
 	at91_wakeup_status();
 
 	if (pdev->dev.of_node)
-- 
2.1.4


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

* [PATCH 19/23] power/reset: at91-poweroff: get and use slow clock
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91 shutdown
controller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm at vger.kernel.org
 drivers/power/reset/at91-poweroff.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/power/reset/at91-poweroff.c b/drivers/power/reset/at91-poweroff.c
index 9847cfb7e23d..fadd1a41729b 100644
--- a/drivers/power/reset/at91-poweroff.c
+++ b/drivers/power/reset/at91-poweroff.c
@@ -10,6 +10,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -48,6 +49,7 @@ static const char *shdwc_wakeup_modes[] = {
 };
 
 static void __iomem *at91_shdwc_base;
+static struct clk *sclk;
 
 static void __init at91_wakeup_status(void)
 {
@@ -122,6 +124,7 @@ static void at91_poweroff_dt_set_wakeup_mode(struct platform_device *pdev)
 static int at91_poweroff_probe(struct platform_device *pdev)
 {
 	struct resource *res;
+	int ret;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	at91_shdwc_base = devm_ioremap_resource(&pdev->dev, res);
@@ -130,6 +133,16 @@ static int at91_poweroff_probe(struct platform_device *pdev)
 		return PTR_ERR(at91_shdwc_base);
 	}
 
+	sclk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(sclk))
+		return PTR_ERR(sclk);
+
+	ret = clk_prepare_enable(sclk);
+	if (ret) {
+		dev_err(&pdev->dev, "Could not enable slow clock\n");
+		return ret;
+	}
+
 	at91_wakeup_status();
 
 	if (pdev->dev.of_node)
-- 
2.1.4

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

* [PATCH 20/23] clocksource: atmel-st: get and use slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Daniel Lezcano, Thomas Gleixner

The current slow clock rate is hardcoded. Properly get the slow clock
and use its rate.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
 drivers/clocksource/timer-atmel-st.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/clocksource/timer-atmel-st.c b/drivers/clocksource/timer-atmel-st.c
index 1692e17e096b..d6049ea8b081 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -22,6 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/clk.h>
 #include <linux/clockchips.h>
 #include <linux/export.h>
 #include <linux/mfd/syscon.h>
@@ -33,9 +34,8 @@ static unsigned long last_crtr;
 static u32 irqmask;
 static struct clock_event_device clkevt;
 static struct regmap *regmap_st;
-
-#define AT91_SLOW_CLOCK		32768
-#define RM9200_TIMER_LATCH	((AT91_SLOW_CLOCK + HZ/2) / HZ)
+static struct clk *sclk;
+static int timer_latch;
 
 /*
  * The ST_CRTR is updated asynchronously to the master clock ... but
@@ -82,8 +82,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
 	if (sr & AT91_ST_PITS) {
 		u32	crtr = read_CRTR();
 
-		while (((crtr - last_crtr) & AT91_ST_CRTV) >= RM9200_TIMER_LATCH) {
-			last_crtr += RM9200_TIMER_LATCH;
+		while (((crtr - last_crtr) & AT91_ST_CRTV) >= timer_latch) {
+			last_crtr += timer_latch;
 			clkevt.event_handler(&clkevt);
 		}
 		return IRQ_HANDLED;
@@ -120,7 +120,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
 	case CLOCK_EVT_MODE_PERIODIC:
 		/* PIT for periodic irqs; fixed rate of 1/HZ */
 		irqmask = AT91_ST_PITS;
-		regmap_write(regmap_st, AT91_ST_PIMR, RM9200_TIMER_LATCH);
+		regmap_write(regmap_st, AT91_ST_PIMR, timer_latch);
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
 		/* ALM for oneshot irqs, set by next_event()
@@ -182,7 +182,7 @@ static struct clock_event_device clkevt = {
  */
 static void __init atmel_st_timer_init(struct device_node *node)
 {
-	unsigned int val;
+	unsigned int sclk_rate, val;
 	int irq, ret;
 
 	regmap_st = syscon_node_to_regmap(node);
@@ -206,6 +206,19 @@ static void __init atmel_st_timer_init(struct device_node *node)
 	if (ret)
 		panic(pr_fmt("Unable to setup IRQ\n"));
 
+	sclk = of_clk_get(node, 0);
+	if (IS_ERR(sclk))
+		panic(pr_fmt("Unable to get slow clock\n"));
+
+	clk_prepare_enable(sclk);
+	if (ret)
+		panic(pr_fmt("Could not enable slow clock\n"));
+
+	sclk_rate = clk_get_rate(sclk);
+	if (!sclk_rate)
+		panic(pr_fmt("Invalid slow clock rate\n"));
+	timer_latch = (sclk_rate + HZ / 2) / HZ;
+
 	/* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
 	 * directly for the clocksource and all clockevents, after adjusting
 	 * its prescaler from the 1 Hz default.
@@ -214,11 +227,11 @@ static void __init atmel_st_timer_init(struct device_node *node)
 
 	/* Setup timer clockevent, with minimum of two ticks (important!!) */
 	clkevt.cpumask = cpumask_of(0);
-	clockevents_config_and_register(&clkevt, AT91_SLOW_CLOCK,
+	clockevents_config_and_register(&clkevt, sclk_rate,
 					2, AT91_ST_ALMV);
 
 	/* register clocksource */
-	clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK);
+	clocksource_register_hz(&clk32k, sclk_rate);
 }
 CLOCKSOURCE_OF_DECLARE(atmel_st_timer, "atmel,at91rm9200-st",
 		       atmel_st_timer_init);
-- 
2.1.4


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

* [PATCH 20/23] clocksource: atmel-st: get and use slow clock
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

The current slow clock rate is hardcoded. Properly get the slow clock
and use its rate.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
 drivers/clocksource/timer-atmel-st.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/clocksource/timer-atmel-st.c b/drivers/clocksource/timer-atmel-st.c
index 1692e17e096b..d6049ea8b081 100644
--- a/drivers/clocksource/timer-atmel-st.c
+++ b/drivers/clocksource/timer-atmel-st.c
@@ -22,6 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/clk.h>
 #include <linux/clockchips.h>
 #include <linux/export.h>
 #include <linux/mfd/syscon.h>
@@ -33,9 +34,8 @@ static unsigned long last_crtr;
 static u32 irqmask;
 static struct clock_event_device clkevt;
 static struct regmap *regmap_st;
-
-#define AT91_SLOW_CLOCK		32768
-#define RM9200_TIMER_LATCH	((AT91_SLOW_CLOCK + HZ/2) / HZ)
+static struct clk *sclk;
+static int timer_latch;
 
 /*
  * The ST_CRTR is updated asynchronously to the master clock ... but
@@ -82,8 +82,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
 	if (sr & AT91_ST_PITS) {
 		u32	crtr = read_CRTR();
 
-		while (((crtr - last_crtr) & AT91_ST_CRTV) >= RM9200_TIMER_LATCH) {
-			last_crtr += RM9200_TIMER_LATCH;
+		while (((crtr - last_crtr) & AT91_ST_CRTV) >= timer_latch) {
+			last_crtr += timer_latch;
 			clkevt.event_handler(&clkevt);
 		}
 		return IRQ_HANDLED;
@@ -120,7 +120,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
 	case CLOCK_EVT_MODE_PERIODIC:
 		/* PIT for periodic irqs; fixed rate of 1/HZ */
 		irqmask = AT91_ST_PITS;
-		regmap_write(regmap_st, AT91_ST_PIMR, RM9200_TIMER_LATCH);
+		regmap_write(regmap_st, AT91_ST_PIMR, timer_latch);
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
 		/* ALM for oneshot irqs, set by next_event()
@@ -182,7 +182,7 @@ static struct clock_event_device clkevt = {
  */
 static void __init atmel_st_timer_init(struct device_node *node)
 {
-	unsigned int val;
+	unsigned int sclk_rate, val;
 	int irq, ret;
 
 	regmap_st = syscon_node_to_regmap(node);
@@ -206,6 +206,19 @@ static void __init atmel_st_timer_init(struct device_node *node)
 	if (ret)
 		panic(pr_fmt("Unable to setup IRQ\n"));
 
+	sclk = of_clk_get(node, 0);
+	if (IS_ERR(sclk))
+		panic(pr_fmt("Unable to get slow clock\n"));
+
+	clk_prepare_enable(sclk);
+	if (ret)
+		panic(pr_fmt("Could not enable slow clock\n"));
+
+	sclk_rate = clk_get_rate(sclk);
+	if (!sclk_rate)
+		panic(pr_fmt("Invalid slow clock rate\n"));
+	timer_latch = (sclk_rate + HZ / 2) / HZ;
+
 	/* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
 	 * directly for the clocksource and all clockevents, after adjusting
 	 * its prescaler from the 1 Hz default.
@@ -214,11 +227,11 @@ static void __init atmel_st_timer_init(struct device_node *node)
 
 	/* Setup timer clockevent, with minimum of two ticks (important!!) */
 	clkevt.cpumask = cpumask_of(0);
-	clockevents_config_and_register(&clkevt, AT91_SLOW_CLOCK,
+	clockevents_config_and_register(&clkevt, sclk_rate,
 					2, AT91_ST_ALMV);
 
 	/* register clocksource */
-	clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK);
+	clocksource_register_hz(&clk32k, sclk_rate);
 }
 CLOCKSOURCE_OF_DECLARE(atmel_st_timer, "atmel,at91rm9200-st",
 		       atmel_st_timer_init);
-- 
2.1.4

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

* [PATCH 21/23] clocksource: tcb_clksrc: fix setup_clkevents error path
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Daniel Lezcano, Thomas Gleixner

From: Boris Brezillon <boris.brezillon@free-electrons.com>

t2_clk is already disabled before request_irq(), it must not be disabled
again.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
 drivers/clocksource/tcb_clksrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 8bdbc45c6dad..b9b7277173c2 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -199,7 +199,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 
 	ret = request_irq(irq, ch2_irq, IRQF_TIMER, "tc_clkevt", &clkevt);
 	if (ret) {
-		clk_disable_unprepare(t2_clk);
+		clk_unprepare(t2_clk);
 		return ret;
 	}
 
-- 
2.1.4


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

* [PATCH 21/23] clocksource: tcb_clksrc: fix setup_clkevents error path
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

From: Boris Brezillon <boris.brezillon@free-electrons.com>

t2_clk is already disabled before request_irq(), it must not be disabled
again.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
 drivers/clocksource/tcb_clksrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 8bdbc45c6dad..b9b7277173c2 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -199,7 +199,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 
 	ret = request_irq(irq, ch2_irq, IRQF_TIMER, "tc_clkevt", &clkevt);
 	if (ret) {
-		clk_disable_unprepare(t2_clk);
+		clk_unprepare(t2_clk);
 		return ret;
 	}
 
-- 
2.1.4

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

* [PATCH 22/23] misc: atmel_tclib: get and use slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Daniel Lezcano, Thomas Gleixner, Arnd Bergmann,
	Greg Kroah-Hartman, Thierry Reding, linux-pwm

From: Boris Brezillon <boris.brezillon@free-electrons.com>

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the timer counters.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm@vger.kernel.org
 drivers/clocksource/tcb_clksrc.c |  8 ++++++++
 drivers/misc/atmel_tclib.c       |  4 ++++
 drivers/pwm/pwm-atmel-tcb.c      | 23 ++++++++++++++++-------
 include/linux/atmel_tc.h         |  1 +
 4 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index b9b7277173c2..969ba03633b0 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -188,6 +188,13 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 	ret = clk_prepare_enable(t2_clk);
 	if (ret)
 		return ret;
+
+	ret = clk_prepare_enable(tc->slow_clk);
+	if (ret) {
+		clk_disable_unprepare(t2_clk);
+		return ret;
+	}
+
 	clk_disable(t2_clk);
 
 	clkevt.regs = tc->regs;
@@ -200,6 +207,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 	ret = request_irq(irq, ch2_irq, IRQF_TIMER, "tc_clkevt", &clkevt);
 	if (ret) {
 		clk_unprepare(t2_clk);
+		clk_disable_unprepare(tc->slow_clk);
 		return ret;
 	}
 
diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c
index 0ca05c3ec8d6..ac24a4bd63f7 100644
--- a/drivers/misc/atmel_tclib.c
+++ b/drivers/misc/atmel_tclib.c
@@ -125,6 +125,10 @@ static int __init tc_probe(struct platform_device *pdev)
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
+	tc->slow_clk = devm_clk_get(&pdev->dev, "slow_clk");
+	if (IS_ERR(tc->slow_clk))
+		return PTR_ERR(tc->slow_clk);
+
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	tc->regs = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(tc->regs))
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index d14e0677c92d..070a32a35295 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -305,7 +305,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	 */
 	if (i == 5) {
 		i = slowclk;
-		rate = 32768;
+		rate = clk_get_rate(tc->slow_clk);
 		min = div_u64(NSEC_PER_SEC, rate);
 		max = min << tc->tcb_config->counter_width;
 
@@ -387,9 +387,9 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 
 	tcbpwm = devm_kzalloc(&pdev->dev, sizeof(*tcbpwm), GFP_KERNEL);
 	if (tcbpwm == NULL) {
-		atmel_tc_free(tc);
+		err = -ENOMEM;
 		dev_err(&pdev->dev, "failed to allocate memory\n");
-		return -ENOMEM;
+		goto err_free_tc;
 	}
 
 	tcbpwm->chip.dev = &pdev->dev;
@@ -400,17 +400,24 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 	tcbpwm->chip.npwm = NPWM;
 	tcbpwm->tc = tc;
 
+	err = clk_prepare_enable(tc->slow_clk);
+	if (err)
+		goto err_free_tc;
+
 	spin_lock_init(&tcbpwm->lock);
 
 	err = pwmchip_add(&tcbpwm->chip);
-	if (err < 0) {
-		atmel_tc_free(tc);
-		return err;
-	}
+	if (err < 0)
+		goto err_free_tc;
 
 	platform_set_drvdata(pdev, tcbpwm);
 
 	return 0;
+
+err_free_tc:
+	atmel_tc_free(tc);
+
+	return err;
 }
 
 static int atmel_tcb_pwm_remove(struct platform_device *pdev)
@@ -418,6 +425,8 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)
 	struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
 	int err;
 
+	clk_disable_unprepare(tcbpwm->tc->slow_clk);
+
 	err = pwmchip_remove(&tcbpwm->chip);
 	if (err < 0)
 		return err;
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index b87c1c7c242a..468fdfa643f0 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -67,6 +67,7 @@ struct atmel_tc {
 	const struct atmel_tcb_config *tcb_config;
 	int			irq[3];
 	struct clk		*clk[3];
+	struct clk		*slow_clk;
 	struct list_head	node;
 	bool			allocated;
 };
-- 
2.1.4


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

* [PATCH 22/23] misc: atmel_tclib: get and use slow clock
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

From: Boris Brezillon <boris.brezillon@free-electrons.com>

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the timer counters.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-pwm at vger.kernel.org
 drivers/clocksource/tcb_clksrc.c |  8 ++++++++
 drivers/misc/atmel_tclib.c       |  4 ++++
 drivers/pwm/pwm-atmel-tcb.c      | 23 ++++++++++++++++-------
 include/linux/atmel_tc.h         |  1 +
 4 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index b9b7277173c2..969ba03633b0 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -188,6 +188,13 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 	ret = clk_prepare_enable(t2_clk);
 	if (ret)
 		return ret;
+
+	ret = clk_prepare_enable(tc->slow_clk);
+	if (ret) {
+		clk_disable_unprepare(t2_clk);
+		return ret;
+	}
+
 	clk_disable(t2_clk);
 
 	clkevt.regs = tc->regs;
@@ -200,6 +207,7 @@ static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx)
 	ret = request_irq(irq, ch2_irq, IRQF_TIMER, "tc_clkevt", &clkevt);
 	if (ret) {
 		clk_unprepare(t2_clk);
+		clk_disable_unprepare(tc->slow_clk);
 		return ret;
 	}
 
diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c
index 0ca05c3ec8d6..ac24a4bd63f7 100644
--- a/drivers/misc/atmel_tclib.c
+++ b/drivers/misc/atmel_tclib.c
@@ -125,6 +125,10 @@ static int __init tc_probe(struct platform_device *pdev)
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
+	tc->slow_clk = devm_clk_get(&pdev->dev, "slow_clk");
+	if (IS_ERR(tc->slow_clk))
+		return PTR_ERR(tc->slow_clk);
+
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	tc->regs = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(tc->regs))
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index d14e0677c92d..070a32a35295 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -305,7 +305,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	 */
 	if (i == 5) {
 		i = slowclk;
-		rate = 32768;
+		rate = clk_get_rate(tc->slow_clk);
 		min = div_u64(NSEC_PER_SEC, rate);
 		max = min << tc->tcb_config->counter_width;
 
@@ -387,9 +387,9 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 
 	tcbpwm = devm_kzalloc(&pdev->dev, sizeof(*tcbpwm), GFP_KERNEL);
 	if (tcbpwm == NULL) {
-		atmel_tc_free(tc);
+		err = -ENOMEM;
 		dev_err(&pdev->dev, "failed to allocate memory\n");
-		return -ENOMEM;
+		goto err_free_tc;
 	}
 
 	tcbpwm->chip.dev = &pdev->dev;
@@ -400,17 +400,24 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
 	tcbpwm->chip.npwm = NPWM;
 	tcbpwm->tc = tc;
 
+	err = clk_prepare_enable(tc->slow_clk);
+	if (err)
+		goto err_free_tc;
+
 	spin_lock_init(&tcbpwm->lock);
 
 	err = pwmchip_add(&tcbpwm->chip);
-	if (err < 0) {
-		atmel_tc_free(tc);
-		return err;
-	}
+	if (err < 0)
+		goto err_free_tc;
 
 	platform_set_drvdata(pdev, tcbpwm);
 
 	return 0;
+
+err_free_tc:
+	atmel_tc_free(tc);
+
+	return err;
 }
 
 static int atmel_tcb_pwm_remove(struct platform_device *pdev)
@@ -418,6 +425,8 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)
 	struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
 	int err;
 
+	clk_disable_unprepare(tcbpwm->tc->slow_clk);
+
 	err = pwmchip_remove(&tcbpwm->chip);
 	if (err < 0)
 		return err;
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index b87c1c7c242a..468fdfa643f0 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -67,6 +67,7 @@ struct atmel_tc {
 	const struct atmel_tcb_config *tcb_config;
 	int			irq[3];
 	struct clk		*clk[3];
+	struct clk		*slow_clk;
 	struct list_head	node;
 	bool			allocated;
 };
-- 
2.1.4

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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
@ 2015-07-31  9:39   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alexandre Belloni,
	Michael Turquette, Stephen Boyd, linux-clk

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Now that the slow clock is taken properly by the drivers, this workaround
is not necessary anymore, revert it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org
 drivers/clk/at91/clk-slow.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
index 98a84a865fe1..2c59d6a64dd5 100644
--- a/drivers/clk/at91/clk-slow.c
+++ b/drivers/clk/at91/clk-slow.c
@@ -70,7 +70,6 @@ struct clk_sam9x5_slow {
 
 #define to_clk_sam9x5_slow(hw) container_of(hw, struct clk_sam9x5_slow, hw)
 
-static struct clk *slow_clk;
 
 static int clk_slow_osc_prepare(struct clk_hw *hw)
 {
@@ -358,8 +357,6 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr,
 	clk = clk_register(NULL, &slowck->hw);
 	if (IS_ERR(clk))
 		kfree(slowck);
-	else
-		slow_clk = clk;
 
 	return clk;
 }
@@ -436,8 +433,6 @@ at91_clk_register_sam9260_slow(struct at91_pmc *pmc,
 	clk = clk_register(NULL, &slowck->hw);
 	if (IS_ERR(clk))
 		kfree(slowck);
-	else
-		slow_clk = clk;
 
 	return clk;
 }
@@ -470,25 +465,3 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
 
 	of_clk_add_provider(np, of_clk_src_simple_get, clk);
 }
-
-/*
- * FIXME: All slow clk users are not properly claiming it (get + prepare +
- * enable) before using it.
- * If all users properly claiming this clock decide that they don't need it
- * anymore (or are removed), it is disabled while faulty users are still
- * requiring it, and the system hangs.
- * Prevent this clock from being disabled until all users are properly
- * requesting it.
- * Once this is done we should remove this function and the slow_clk variable.
- */
-static int __init of_at91_clk_slow_retain(void)
-{
-	if (!slow_clk)
-		return 0;
-
-	__clk_get(slow_clk);
-	clk_prepare_enable(slow_clk);
-
-	return 0;
-}
-arch_initcall(of_at91_clk_slow_retain);
-- 
2.1.4


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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
@ 2015-07-31  9:39   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Now that the slow clock is taken properly by the drivers, this workaround
is not necessary anymore, revert it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk at vger.kernel.org
 drivers/clk/at91/clk-slow.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
index 98a84a865fe1..2c59d6a64dd5 100644
--- a/drivers/clk/at91/clk-slow.c
+++ b/drivers/clk/at91/clk-slow.c
@@ -70,7 +70,6 @@ struct clk_sam9x5_slow {
 
 #define to_clk_sam9x5_slow(hw) container_of(hw, struct clk_sam9x5_slow, hw)
 
-static struct clk *slow_clk;
 
 static int clk_slow_osc_prepare(struct clk_hw *hw)
 {
@@ -358,8 +357,6 @@ at91_clk_register_sam9x5_slow(void __iomem *sckcr,
 	clk = clk_register(NULL, &slowck->hw);
 	if (IS_ERR(clk))
 		kfree(slowck);
-	else
-		slow_clk = clk;
 
 	return clk;
 }
@@ -436,8 +433,6 @@ at91_clk_register_sam9260_slow(struct at91_pmc *pmc,
 	clk = clk_register(NULL, &slowck->hw);
 	if (IS_ERR(clk))
 		kfree(slowck);
-	else
-		slow_clk = clk;
 
 	return clk;
 }
@@ -470,25 +465,3 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
 
 	of_clk_add_provider(np, of_clk_src_simple_get, clk);
 }
-
-/*
- * FIXME: All slow clk users are not properly claiming it (get + prepare +
- * enable) before using it.
- * If all users properly claiming this clock decide that they don't need it
- * anymore (or are removed), it is disabled while faulty users are still
- * requiring it, and the system hangs.
- * Prevent this clock from being disabled until all users are properly
- * requesting it.
- * Once this is done we should remove this function and the slow_clk variable.
- */
-static int __init of_at91_clk_slow_retain(void)
-{
-	if (!slow_clk)
-		return 0;
-
-	__clk_get(slow_clk);
-	clk_prepare_enable(slow_clk);
-
-	return 0;
-}
-arch_initcall(of_at91_clk_slow_retain);
-- 
2.1.4

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

* Re: [PATCH 00/23] ARM: at91: Properly handle slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
  (?)
@ 2015-07-31  9:59   ` Boris Brezillon
  -1 siblings, 0 replies; 86+ messages in thread
From: Boris Brezillon @ 2015-07-31  9:59 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alessandro Zummo, Arnd Bergmann,
	Daniel Lezcano, Dmitry Eremin-Solenikov, Greg Kroah-Hartman,
	linux-clk, linux-pm, linux-pwm, linux-watchdog,
	Michael Turquette, rtc-linux, Sebastian Reichel, Stephen Boyd,
	Thierry Reding, Thomas Gleixner, Wim Van Sebroeck

Hi Alexandre,

On Fri, 31 Jul 2015 11:39:36 +0200
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> Hi,
> 
> It was discovered that all the slow clock user were not properly claiming it.
> This can end up in a system hang because the last registered user is releasing
> it, and it gets disabled.
> 
> commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
> was a workaround. This series is adding the slow clock to the necessary drivers
> to avoid the issue and then removes that workaround.
> 
> The Documentation updates and DT patches should probably go through the AT91
> tree this cycle to avoid breakage.
> 
> Then the other patches can go through each subsystem tree. They are trivial
> enough to also go in this cycle.
> 
> The final clk patch depends on the other ones and may be taken for the next
> cycle to avoid synchronization issues.
> 
> I've thrown in a cleanup for at91-reset as it avoids adding support for that
> clock to the platform data initialization

I would have squashed commit 5 to 14 into a single patch, but apart
from that it looks good to me.

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Thanks,

Boris

> 
> Changes in v2:
>  - statisticize the global in the atmel-st change
>  - merge at91_reset_of_probe() in at91_reset_probe()
>  - added patches from Boris for the TCB
>  - added the slow clock to the TCB
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-clk@vger.kernel.org
> Cc: linux-pm@vger.kernel.org
> Cc: linux-pwm@vger.kernel.org
> Cc: linux-watchdog@vger.kernel.org
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: rtc-linux@googlegroups.com
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> 
> Alexandre Belloni (20):
>   Documentation: dt: atmel-at91: add clocks to system timer, rstc and
>     shdwc
>   Documentation: watchdog: at91sam9_wdt: add clocks property
>   Documentation: dt: rtc: at91rm9200: add clocks property
>   ARM: at91/dt: at91rm9200: use slow clock where necessary
>   ARM: at91/dt: at91sam9260: use slow clock where necessary
>   ARM: at91/dt: at91sam9261: use slow clock where necessary
>   ARM: at91/dt: at91sam9263: use slow clock where necessary
>   ARM: at91/dt: at91sam9g45: use slow clock where necessary
>   ARM: at91/dt: at91sam9n12: use slow clock where necessary
>   ARM: at91/dt: at91sam9rl: use slow clock where necessary
>   ARM: at91/dt: at91sam9x5: use slow clock where necessary
>   ARM: at91/dt: sama5d3: use slow clock where necessary
>   ARM: at91/dt: sama5d4: use slow clock where necessary
>   rtc: at91rm9200: get and use slow clock
>   watchdog: at91sam9: get and use slow clock
>   power/reset: at91-reset: remove useless at91_reset_platform_probe()
>   power/reset: at91-reset: get and use slow clock
>   power/reset: at91-poweroff: get and use slow clock
>   clocksource: atmel-st: get and use slow clock
>   clk: at91: Revert "keep slow clk enabled to prevent system hang"
> 
> Boris Brezillon (3):
>   Documentation: dt: atmel-at91: add slow clock to tcb
>   clocksource: tcb_clksrc: fix setup_clkevents error path
>   misc: atmel_tclib: get and use slow clock
> 
>  .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
>  .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
>  .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
>  arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
>  arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
>  arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
>  arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
>  arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
>  arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
>  arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
>  drivers/clk/at91/clk-slow.c                        | 27 ----------
>  drivers/clocksource/tcb_clksrc.c                   | 10 +++-
>  drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
>  drivers/misc/atmel_tclib.c                         |  4 ++
>  drivers/power/reset/at91-poweroff.c                | 13 +++++
>  drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
>  drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
>  drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
>  drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
>  include/linux/atmel_tc.h                           |  1 +
>  24 files changed, 206 insertions(+), 129 deletions(-)
> 



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [rtc-linux] Re: [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31  9:59   ` Boris Brezillon
  0 siblings, 0 replies; 86+ messages in thread
From: Boris Brezillon @ 2015-07-31  9:59 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alessandro Zummo, Arnd Bergmann,
	Daniel Lezcano, Dmitry Eremin-Solenikov, Greg Kroah-Hartman,
	linux-clk, linux-pm, linux-pwm, linux-watchdog,
	Michael Turquette, rtc-linux, Sebastian Reichel, Stephen Boyd,
	Thierry Reding, Thomas Gleixner, Wim Van Sebroeck

Hi Alexandre,

On Fri, 31 Jul 2015 11:39:36 +0200
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> Hi,
> 
> It was discovered that all the slow clock user were not properly claiming it.
> This can end up in a system hang because the last registered user is releasing
> it, and it gets disabled.
> 
> commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
> was a workaround. This series is adding the slow clock to the necessary drivers
> to avoid the issue and then removes that workaround.
> 
> The Documentation updates and DT patches should probably go through the AT91
> tree this cycle to avoid breakage.
> 
> Then the other patches can go through each subsystem tree. They are trivial
> enough to also go in this cycle.
> 
> The final clk patch depends on the other ones and may be taken for the next
> cycle to avoid synchronization issues.
> 
> I've thrown in a cleanup for at91-reset as it avoids adding support for that
> clock to the platform data initialization

I would have squashed commit 5 to 14 into a single patch, but apart
from that it looks good to me.

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Thanks,

Boris

> 
> Changes in v2:
>  - statisticize the global in the atmel-st change
>  - merge at91_reset_of_probe() in at91_reset_probe()
>  - added patches from Boris for the TCB
>  - added the slow clock to the TCB
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-clk@vger.kernel.org
> Cc: linux-pm@vger.kernel.org
> Cc: linux-pwm@vger.kernel.org
> Cc: linux-watchdog@vger.kernel.org
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: rtc-linux@googlegroups.com
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> 
> Alexandre Belloni (20):
>   Documentation: dt: atmel-at91: add clocks to system timer, rstc and
>     shdwc
>   Documentation: watchdog: at91sam9_wdt: add clocks property
>   Documentation: dt: rtc: at91rm9200: add clocks property
>   ARM: at91/dt: at91rm9200: use slow clock where necessary
>   ARM: at91/dt: at91sam9260: use slow clock where necessary
>   ARM: at91/dt: at91sam9261: use slow clock where necessary
>   ARM: at91/dt: at91sam9263: use slow clock where necessary
>   ARM: at91/dt: at91sam9g45: use slow clock where necessary
>   ARM: at91/dt: at91sam9n12: use slow clock where necessary
>   ARM: at91/dt: at91sam9rl: use slow clock where necessary
>   ARM: at91/dt: at91sam9x5: use slow clock where necessary
>   ARM: at91/dt: sama5d3: use slow clock where necessary
>   ARM: at91/dt: sama5d4: use slow clock where necessary
>   rtc: at91rm9200: get and use slow clock
>   watchdog: at91sam9: get and use slow clock
>   power/reset: at91-reset: remove useless at91_reset_platform_probe()
>   power/reset: at91-reset: get and use slow clock
>   power/reset: at91-poweroff: get and use slow clock
>   clocksource: atmel-st: get and use slow clock
>   clk: at91: Revert "keep slow clk enabled to prevent system hang"
> 
> Boris Brezillon (3):
>   Documentation: dt: atmel-at91: add slow clock to tcb
>   clocksource: tcb_clksrc: fix setup_clkevents error path
>   misc: atmel_tclib: get and use slow clock
> 
>  .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
>  .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
>  .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
>  arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
>  arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
>  arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
>  arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
>  arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
>  arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
>  arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
>  drivers/clk/at91/clk-slow.c                        | 27 ----------
>  drivers/clocksource/tcb_clksrc.c                   | 10 +++-
>  drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
>  drivers/misc/atmel_tclib.c                         |  4 ++
>  drivers/power/reset/at91-poweroff.c                | 13 +++++
>  drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
>  drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
>  drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
>  drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
>  include/linux/atmel_tc.h                           |  1 +
>  24 files changed, 206 insertions(+), 129 deletions(-)
> 



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31  9:59   ` Boris Brezillon
  0 siblings, 0 replies; 86+ messages in thread
From: Boris Brezillon @ 2015-07-31  9:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alexandre,

On Fri, 31 Jul 2015 11:39:36 +0200
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> Hi,
> 
> It was discovered that all the slow clock user were not properly claiming it.
> This can end up in a system hang because the last registered user is releasing
> it, and it gets disabled.
> 
> commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
> was a workaround. This series is adding the slow clock to the necessary drivers
> to avoid the issue and then removes that workaround.
> 
> The Documentation updates and DT patches should probably go through the AT91
> tree this cycle to avoid breakage.
> 
> Then the other patches can go through each subsystem tree. They are trivial
> enough to also go in this cycle.
> 
> The final clk patch depends on the other ones and may be taken for the next
> cycle to avoid synchronization issues.
> 
> I've thrown in a cleanup for at91-reset as it avoids adding support for that
> clock to the platform data initialization

I would have squashed commit 5 to 14 into a single patch, but apart
from that it looks good to me.

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Thanks,

Boris

> 
> Changes in v2:
>  - statisticize the global in the atmel-st change
>  - merge at91_reset_of_probe() in at91_reset_probe()
>  - added patches from Boris for the TCB
>  - added the slow clock to the TCB
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-clk at vger.kernel.org
> Cc: linux-pm at vger.kernel.org
> Cc: linux-pwm at vger.kernel.org
> Cc: linux-watchdog at vger.kernel.org
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: rtc-linux at googlegroups.com
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> 
> Alexandre Belloni (20):
>   Documentation: dt: atmel-at91: add clocks to system timer, rstc and
>     shdwc
>   Documentation: watchdog: at91sam9_wdt: add clocks property
>   Documentation: dt: rtc: at91rm9200: add clocks property
>   ARM: at91/dt: at91rm9200: use slow clock where necessary
>   ARM: at91/dt: at91sam9260: use slow clock where necessary
>   ARM: at91/dt: at91sam9261: use slow clock where necessary
>   ARM: at91/dt: at91sam9263: use slow clock where necessary
>   ARM: at91/dt: at91sam9g45: use slow clock where necessary
>   ARM: at91/dt: at91sam9n12: use slow clock where necessary
>   ARM: at91/dt: at91sam9rl: use slow clock where necessary
>   ARM: at91/dt: at91sam9x5: use slow clock where necessary
>   ARM: at91/dt: sama5d3: use slow clock where necessary
>   ARM: at91/dt: sama5d4: use slow clock where necessary
>   rtc: at91rm9200: get and use slow clock
>   watchdog: at91sam9: get and use slow clock
>   power/reset: at91-reset: remove useless at91_reset_platform_probe()
>   power/reset: at91-reset: get and use slow clock
>   power/reset: at91-poweroff: get and use slow clock
>   clocksource: atmel-st: get and use slow clock
>   clk: at91: Revert "keep slow clk enabled to prevent system hang"
> 
> Boris Brezillon (3):
>   Documentation: dt: atmel-at91: add slow clock to tcb
>   clocksource: tcb_clksrc: fix setup_clkevents error path
>   misc: atmel_tclib: get and use slow clock
> 
>  .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
>  .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
>  .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
>  arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
>  arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
>  arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
>  arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
>  arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
>  arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
>  arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
>  drivers/clk/at91/clk-slow.c                        | 27 ----------
>  drivers/clocksource/tcb_clksrc.c                   | 10 +++-
>  drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
>  drivers/misc/atmel_tclib.c                         |  4 ++
>  drivers/power/reset/at91-poweroff.c                | 13 +++++
>  drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
>  drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
>  drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
>  drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
>  include/linux/atmel_tc.h                           |  1 +
>  24 files changed, 206 insertions(+), 129 deletions(-)
> 



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* Re: [PATCH 00/23] ARM: at91: Properly handle slow clock
  2015-07-31  9:59   ` [rtc-linux] " Boris Brezillon
  (?)
@ 2015-07-31 10:20     ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 10:20 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Nicolas Ferre, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alessandro Zummo, Arnd Bergmann,
	Daniel Lezcano, Dmitry Eremin-Solenikov, Greg Kroah-Hartman,
	linux-clk, linux-pm, linux-pwm, linux-watchdog,
	Michael Turquette, rtc-linux, Sebastian Reichel, Stephen Boyd,
	Thierry Reding, Thomas Gleixner, Wim Van Sebroeck

Hi,

On 31/07/2015 at 11:59:03 +0200, Boris Brezillon wrote :
> I would have squashed commit 5 to 14 into a single patch, but apart
> from that it looks good to me.
> 

I wanted to clearly list were the slow clock was needed for each soc. It
actually allowed me to find one that was missing.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [rtc-linux] Re: [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31 10:20     ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 10:20 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Nicolas Ferre, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alessandro Zummo, Arnd Bergmann,
	Daniel Lezcano, Dmitry Eremin-Solenikov, Greg Kroah-Hartman,
	linux-clk, linux-pm, linux-pwm, linux-watchdog,
	Michael Turquette, rtc-linux, Sebastian Reichel, Stephen Boyd,
	Thierry Reding, Thomas Gleixner, Wim Van Sebroeck

Hi,

On 31/07/2015 at 11:59:03 +0200, Boris Brezillon wrote :
> I would have squashed commit 5 to 14 into a single patch, but apart
> from that it looks good to me.
> 

I wanted to clearly list were the slow clock was needed for each soc. It
actually allowed me to find one that was missing.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31 10:20     ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 10:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 31/07/2015 at 11:59:03 +0200, Boris Brezillon wrote :
> I would have squashed commit 5 to 14 into a single patch, but apart
> from that it looks good to me.
> 

I wanted to clearly list were the slow clock was needed for each soc. It
actually allowed me to find one that was missing.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 00/23] ARM: at91: Properly handle slow clock
  2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
  (?)
@ 2015-07-31 15:21   ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 15:21 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alessandro Zummo, Arnd Bergmann,
	Daniel Lezcano, Dmitry Eremin-Solenikov, Greg Kroah-Hartman,
	linux-clk, linux-pm, linux-pwm, linux-watchdog,
	Michael Turquette, rtc-linux, Sebastian Reichel, Stephen Boyd,
	Thierry Reding, Thomas Gleixner, Wim Van Sebroeck

Hi,

I realize now that I forgot to add the v2 tag in the subject lines. This
is really v2 :)

On 31/07/2015 at 11:39:36 +0200, Alexandre Belloni wrote :
> Hi,
> 
> It was discovered that all the slow clock user were not properly claiming it.
> This can end up in a system hang because the last registered user is releasing
> it, and it gets disabled.
> 
> commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
> was a workaround. This series is adding the slow clock to the necessary drivers
> to avoid the issue and then removes that workaround.
> 
> The Documentation updates and DT patches should probably go through the AT91
> tree this cycle to avoid breakage.
> 
> Then the other patches can go through each subsystem tree. They are trivial
> enough to also go in this cycle.
> 
> The final clk patch depends on the other ones and may be taken for the next
> cycle to avoid synchronization issues.
> 
> I've thrown in a cleanup for at91-reset as it avoids adding support for that
> clock to the platform data initialization
> 
> Changes in v2:
>  - statisticize the global in the atmel-st change
>  - merge at91_reset_of_probe() in at91_reset_probe()
>  - added patches from Boris for the TCB
>  - added the slow clock to the TCB
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-clk@vger.kernel.org
> Cc: linux-pm@vger.kernel.org
> Cc: linux-pwm@vger.kernel.org
> Cc: linux-watchdog@vger.kernel.org
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: rtc-linux@googlegroups.com
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> 
> Alexandre Belloni (20):
>   Documentation: dt: atmel-at91: add clocks to system timer, rstc and
>     shdwc
>   Documentation: watchdog: at91sam9_wdt: add clocks property
>   Documentation: dt: rtc: at91rm9200: add clocks property
>   ARM: at91/dt: at91rm9200: use slow clock where necessary
>   ARM: at91/dt: at91sam9260: use slow clock where necessary
>   ARM: at91/dt: at91sam9261: use slow clock where necessary
>   ARM: at91/dt: at91sam9263: use slow clock where necessary
>   ARM: at91/dt: at91sam9g45: use slow clock where necessary
>   ARM: at91/dt: at91sam9n12: use slow clock where necessary
>   ARM: at91/dt: at91sam9rl: use slow clock where necessary
>   ARM: at91/dt: at91sam9x5: use slow clock where necessary
>   ARM: at91/dt: sama5d3: use slow clock where necessary
>   ARM: at91/dt: sama5d4: use slow clock where necessary
>   rtc: at91rm9200: get and use slow clock
>   watchdog: at91sam9: get and use slow clock
>   power/reset: at91-reset: remove useless at91_reset_platform_probe()
>   power/reset: at91-reset: get and use slow clock
>   power/reset: at91-poweroff: get and use slow clock
>   clocksource: atmel-st: get and use slow clock
>   clk: at91: Revert "keep slow clk enabled to prevent system hang"
> 
> Boris Brezillon (3):
>   Documentation: dt: atmel-at91: add slow clock to tcb
>   clocksource: tcb_clksrc: fix setup_clkevents error path
>   misc: atmel_tclib: get and use slow clock
> 
>  .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
>  .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
>  .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
>  arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
>  arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
>  arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
>  arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
>  arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
>  arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
>  arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
>  drivers/clk/at91/clk-slow.c                        | 27 ----------
>  drivers/clocksource/tcb_clksrc.c                   | 10 +++-
>  drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
>  drivers/misc/atmel_tclib.c                         |  4 ++
>  drivers/power/reset/at91-poweroff.c                | 13 +++++
>  drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
>  drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
>  drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
>  drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
>  include/linux/atmel_tc.h                           |  1 +
>  24 files changed, 206 insertions(+), 129 deletions(-)
> 
> -- 
> 2.1.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [rtc-linux] Re: [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31 15:21   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 15:21 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Boris Brezillon, Maxime Ripard, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel, linux-kernel, Alessandro Zummo, Arnd Bergmann,
	Daniel Lezcano, Dmitry Eremin-Solenikov, Greg Kroah-Hartman,
	linux-clk, linux-pm, linux-pwm, linux-watchdog,
	Michael Turquette, rtc-linux, Sebastian Reichel, Stephen Boyd,
	Thierry Reding, Thomas Gleixner, Wim Van Sebroeck

Hi,

I realize now that I forgot to add the v2 tag in the subject lines. This
is really v2 :)

On 31/07/2015 at 11:39:36 +0200, Alexandre Belloni wrote :
> Hi,
> 
> It was discovered that all the slow clock user were not properly claiming it.
> This can end up in a system hang because the last registered user is releasing
> it, and it gets disabled.
> 
> commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
> was a workaround. This series is adding the slow clock to the necessary drivers
> to avoid the issue and then removes that workaround.
> 
> The Documentation updates and DT patches should probably go through the AT91
> tree this cycle to avoid breakage.
> 
> Then the other patches can go through each subsystem tree. They are trivial
> enough to also go in this cycle.
> 
> The final clk patch depends on the other ones and may be taken for the next
> cycle to avoid synchronization issues.
> 
> I've thrown in a cleanup for at91-reset as it avoids adding support for that
> clock to the platform data initialization
> 
> Changes in v2:
>  - statisticize the global in the atmel-st change
>  - merge at91_reset_of_probe() in at91_reset_probe()
>  - added patches from Boris for the TCB
>  - added the slow clock to the TCB
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-clk@vger.kernel.org
> Cc: linux-pm@vger.kernel.org
> Cc: linux-pwm@vger.kernel.org
> Cc: linux-watchdog@vger.kernel.org
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: rtc-linux@googlegroups.com
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> 
> Alexandre Belloni (20):
>   Documentation: dt: atmel-at91: add clocks to system timer, rstc and
>     shdwc
>   Documentation: watchdog: at91sam9_wdt: add clocks property
>   Documentation: dt: rtc: at91rm9200: add clocks property
>   ARM: at91/dt: at91rm9200: use slow clock where necessary
>   ARM: at91/dt: at91sam9260: use slow clock where necessary
>   ARM: at91/dt: at91sam9261: use slow clock where necessary
>   ARM: at91/dt: at91sam9263: use slow clock where necessary
>   ARM: at91/dt: at91sam9g45: use slow clock where necessary
>   ARM: at91/dt: at91sam9n12: use slow clock where necessary
>   ARM: at91/dt: at91sam9rl: use slow clock where necessary
>   ARM: at91/dt: at91sam9x5: use slow clock where necessary
>   ARM: at91/dt: sama5d3: use slow clock where necessary
>   ARM: at91/dt: sama5d4: use slow clock where necessary
>   rtc: at91rm9200: get and use slow clock
>   watchdog: at91sam9: get and use slow clock
>   power/reset: at91-reset: remove useless at91_reset_platform_probe()
>   power/reset: at91-reset: get and use slow clock
>   power/reset: at91-poweroff: get and use slow clock
>   clocksource: atmel-st: get and use slow clock
>   clk: at91: Revert "keep slow clk enabled to prevent system hang"
> 
> Boris Brezillon (3):
>   Documentation: dt: atmel-at91: add slow clock to tcb
>   clocksource: tcb_clksrc: fix setup_clkevents error path
>   misc: atmel_tclib: get and use slow clock
> 
>  .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
>  .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
>  .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
>  arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
>  arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
>  arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
>  arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
>  arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
>  arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
>  arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
>  drivers/clk/at91/clk-slow.c                        | 27 ----------
>  drivers/clocksource/tcb_clksrc.c                   | 10 +++-
>  drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
>  drivers/misc/atmel_tclib.c                         |  4 ++
>  drivers/power/reset/at91-poweroff.c                | 13 +++++
>  drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
>  drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
>  drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
>  drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
>  include/linux/atmel_tc.h                           |  1 +
>  24 files changed, 206 insertions(+), 129 deletions(-)
> 
> -- 
> 2.1.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH 00/23] ARM: at91: Properly handle slow clock
@ 2015-07-31 15:21   ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 15:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I realize now that I forgot to add the v2 tag in the subject lines. This
is really v2 :)

On 31/07/2015 at 11:39:36 +0200, Alexandre Belloni wrote :
> Hi,
> 
> It was discovered that all the slow clock user were not properly claiming it.
> This can end up in a system hang because the last registered user is releasing
> it, and it gets disabled.
> 
> commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system hang")
> was a workaround. This series is adding the slow clock to the necessary drivers
> to avoid the issue and then removes that workaround.
> 
> The Documentation updates and DT patches should probably go through the AT91
> tree this cycle to avoid breakage.
> 
> Then the other patches can go through each subsystem tree. They are trivial
> enough to also go in this cycle.
> 
> The final clk patch depends on the other ones and may be taken for the next
> cycle to avoid synchronization issues.
> 
> I've thrown in a cleanup for at91-reset as it avoids adding support for that
> clock to the platform data initialization
> 
> Changes in v2:
>  - statisticize the global in the atmel-st change
>  - merge at91_reset_of_probe() in at91_reset_probe()
>  - added patches from Boris for the TCB
>  - added the slow clock to the TCB
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-clk at vger.kernel.org
> Cc: linux-pm at vger.kernel.org
> Cc: linux-pwm at vger.kernel.org
> Cc: linux-watchdog at vger.kernel.org
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: rtc-linux at googlegroups.com
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Stephen Boyd <sboyd@codeaurora.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> 
> Alexandre Belloni (20):
>   Documentation: dt: atmel-at91: add clocks to system timer, rstc and
>     shdwc
>   Documentation: watchdog: at91sam9_wdt: add clocks property
>   Documentation: dt: rtc: at91rm9200: add clocks property
>   ARM: at91/dt: at91rm9200: use slow clock where necessary
>   ARM: at91/dt: at91sam9260: use slow clock where necessary
>   ARM: at91/dt: at91sam9261: use slow clock where necessary
>   ARM: at91/dt: at91sam9263: use slow clock where necessary
>   ARM: at91/dt: at91sam9g45: use slow clock where necessary
>   ARM: at91/dt: at91sam9n12: use slow clock where necessary
>   ARM: at91/dt: at91sam9rl: use slow clock where necessary
>   ARM: at91/dt: at91sam9x5: use slow clock where necessary
>   ARM: at91/dt: sama5d3: use slow clock where necessary
>   ARM: at91/dt: sama5d4: use slow clock where necessary
>   rtc: at91rm9200: get and use slow clock
>   watchdog: at91sam9: get and use slow clock
>   power/reset: at91-reset: remove useless at91_reset_platform_probe()
>   power/reset: at91-reset: get and use slow clock
>   power/reset: at91-poweroff: get and use slow clock
>   clocksource: atmel-st: get and use slow clock
>   clk: at91: Revert "keep slow clk enabled to prevent system hang"
> 
> Boris Brezillon (3):
>   Documentation: dt: atmel-at91: add slow clock to tcb
>   clocksource: tcb_clksrc: fix setup_clkevents error path
>   misc: atmel_tclib: get and use slow clock
> 
>  .../devicetree/bindings/arm/atmel-at91.txt         | 13 +++--
>  .../bindings/rtc/atmel,at91rm9200-rtc.txt          |  2 +
>  .../devicetree/bindings/watchdog/atmel-wdt.txt     |  2 +
>  arch/arm/boot/dts/at91rm9200.dtsi                  | 10 ++--
>  arch/arm/boot/dts/at91sam9260.dtsi                 | 11 +++--
>  arch/arm/boot/dts/at91sam9261.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9263.dtsi                 |  7 ++-
>  arch/arm/boot/dts/at91sam9g45.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9n12.dtsi                 | 12 +++--
>  arch/arm/boot/dts/at91sam9rl.dtsi                  |  8 ++-
>  arch/arm/boot/dts/at91sam9x5.dtsi                  | 12 +++--
>  arch/arm/boot/dts/sama5d3.dtsi                     |  8 ++-
>  arch/arm/boot/dts/sama5d3_tcb1.dtsi                |  4 +-
>  arch/arm/boot/dts/sama5d4.dtsi                     | 12 +++--
>  drivers/clk/at91/clk-slow.c                        | 27 ----------
>  drivers/clocksource/tcb_clksrc.c                   | 10 +++-
>  drivers/clocksource/timer-atmel-st.c               | 31 ++++++++----
>  drivers/misc/atmel_tclib.c                         |  4 ++
>  drivers/power/reset/at91-poweroff.c                | 13 +++++
>  drivers/power/reset/at91-reset.c                   | 57 ++++++----------------
>  drivers/pwm/pwm-atmel-tcb.c                        | 23 ++++++---
>  drivers/rtc/rtc-at91rm9200.c                       | 27 ++++++++--
>  drivers/watchdog/at91sam9_wdt.c                    | 22 ++++++++-
>  include/linux/atmel_tc.h                           |  1 +
>  24 files changed, 206 insertions(+), 129 deletions(-)
> 
> -- 
> 2.1.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
  2015-07-31  9:39   ` Alexandre Belloni
@ 2015-07-31 19:00     ` Stephen Boyd
  -1 siblings, 0 replies; 86+ messages in thread
From: Stephen Boyd @ 2015-07-31 19:00 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Michael Turquette, linux-clk

On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
> -	clk_prepare_enable(slow_clk);
> -
> -	return 0;
> -}
> -arch_initcall(of_at91_clk_slow_retain);

Can you drop the include of clk.h in this file too?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
@ 2015-07-31 19:00     ` Stephen Boyd
  0 siblings, 0 replies; 86+ messages in thread
From: Stephen Boyd @ 2015-07-31 19:00 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
> -	clk_prepare_enable(slow_clk);
> -
> -	return 0;
> -}
> -arch_initcall(of_at91_clk_slow_retain);

Can you drop the include of clk.h in this file too?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
  2015-07-31 19:00     ` Stephen Boyd
@ 2015-07-31 21:09       ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 21:09 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Michael Turquette, linux-clk

On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
> On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
> >-	clk_prepare_enable(slow_clk);
> >-
> >-	return 0;
> >-}
> >-arch_initcall(of_at91_clk_slow_retain);
> 
> Can you drop the include of clk.h in this file too?
> 

Sure! I will do that in v3. However, I'll wait for some feedback from
the other maintainers before sending again.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
@ 2015-07-31 21:09       ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 21:09 UTC (permalink / raw)
  To: linux-arm-kernel

On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
> On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
> >-	clk_prepare_enable(slow_clk);
> >-
> >-	return 0;
> >-}
> >-arch_initcall(of_at91_clk_slow_retain);
> 
> Can you drop the include of clk.h in this file too?
> 

Sure! I will do that in v3. However, I'll wait for some feedback from
the other maintainers before sending again.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
  2015-07-31 21:09       ` Alexandre Belloni
@ 2015-07-31 21:11         ` Stephen Boyd
  -1 siblings, 0 replies; 86+ messages in thread
From: Stephen Boyd @ 2015-07-31 21:11 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Michael Turquette, linux-clk

On 07/31/2015 02:09 PM, Alexandre Belloni wrote:
> On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
>> On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
>>> -	clk_prepare_enable(slow_clk);
>>> -
>>> -	return 0;
>>> -}
>>> -arch_initcall(of_at91_clk_slow_retain);
>> Can you drop the include of clk.h in this file too?
>>
> Sure! I will do that in v3. However, I'll wait for some feedback from
> the other maintainers before sending again.
>

Cool. Also, are you going to take this through arm-soc? If so, feel free 
to add my ack.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
@ 2015-07-31 21:11         ` Stephen Boyd
  0 siblings, 0 replies; 86+ messages in thread
From: Stephen Boyd @ 2015-07-31 21:11 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/31/2015 02:09 PM, Alexandre Belloni wrote:
> On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
>> On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
>>> -	clk_prepare_enable(slow_clk);
>>> -
>>> -	return 0;
>>> -}
>>> -arch_initcall(of_at91_clk_slow_retain);
>> Can you drop the include of clk.h in this file too?
>>
> Sure! I will do that in v3. However, I'll wait for some feedback from
> the other maintainers before sending again.
>

Cool. Also, are you going to take this through arm-soc? If so, feel free 
to add my ack.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
  2015-07-31 21:11         ` Stephen Boyd
@ 2015-07-31 21:27           ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 21:27 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Michael Turquette, linux-clk

On 31/07/2015 at 14:11:27 -0700, Stephen Boyd wrote :
> On 07/31/2015 02:09 PM, Alexandre Belloni wrote:
> >On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
> >>On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
> >>>-	clk_prepare_enable(slow_clk);
> >>>-
> >>>-	return 0;
> >>>-}
> >>>-arch_initcall(of_at91_clk_slow_retain);
> >>Can you drop the include of clk.h in this file too?
> >>
> >Sure! I will do that in v3. However, I'll wait for some feedback from
> >the other maintainers before sending again.
> >
> 
> Cool. Also, are you going to take this through arm-soc? If so, feel free to
> add my ack.
> 

Actually, clk.h has never been included in that file.

I was thinking you could take it once the other patch made it in each
subsystem. It is not urgent, it can probably skip one or two cycles.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
@ 2015-07-31 21:27           ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 21:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 31/07/2015 at 14:11:27 -0700, Stephen Boyd wrote :
> On 07/31/2015 02:09 PM, Alexandre Belloni wrote:
> >On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
> >>On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
> >>>-	clk_prepare_enable(slow_clk);
> >>>-
> >>>-	return 0;
> >>>-}
> >>>-arch_initcall(of_at91_clk_slow_retain);
> >>Can you drop the include of clk.h in this file too?
> >>
> >Sure! I will do that in v3. However, I'll wait for some feedback from
> >the other maintainers before sending again.
> >
> 
> Cool. Also, are you going to take this through arm-soc? If so, feel free to
> add my ack.
> 

Actually, clk.h has never been included in that file.

I was thinking you could take it once the other patch made it in each
subsystem. It is not urgent, it can probably skip one or two cycles.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
  2015-07-31 21:27           ` Alexandre Belloni
@ 2015-07-31 21:34             ` Stephen Boyd
  -1 siblings, 0 replies; 86+ messages in thread
From: Stephen Boyd @ 2015-07-31 21:34 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Michael Turquette, linux-clk

On 07/31/2015 02:27 PM, Alexandre Belloni wrote:
> On 31/07/2015 at 14:11:27 -0700, Stephen Boyd wrote :
>> On 07/31/2015 02:09 PM, Alexandre Belloni wrote:
>>> On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
>>>> On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
>>>>> -	clk_prepare_enable(slow_clk);
>>>>> -
>>>>> -	return 0;
>>>>> -}
>>>>> -arch_initcall(of_at91_clk_slow_retain);
>>>> Can you drop the include of clk.h in this file too?
>>>>
>>> Sure! I will do that in v3. However, I'll wait for some feedback from
>>> the other maintainers before sending again.
>>>
>> Cool. Also, are you going to take this through arm-soc? If so, feel free to
>> add my ack.
>>
> Actually, clk.h has never been included in that file.
>
> I was thinking you could take it once the other patch made it in each
> subsystem. It is not urgent, it can probably skip one or two cycles.
>

Ok that's fine. I added clk.h into this file when I removed clk.h from 
clk-provider.h so that it keeps compiling. Please remind us to pick this 
up when you think it's ready.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
@ 2015-07-31 21:34             ` Stephen Boyd
  0 siblings, 0 replies; 86+ messages in thread
From: Stephen Boyd @ 2015-07-31 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/31/2015 02:27 PM, Alexandre Belloni wrote:
> On 31/07/2015 at 14:11:27 -0700, Stephen Boyd wrote :
>> On 07/31/2015 02:09 PM, Alexandre Belloni wrote:
>>> On 31/07/2015 at 12:00:28 -0700, Stephen Boyd wrote :
>>>> On 07/31/2015 02:39 AM, Alexandre Belloni wrote:
>>>>> -	clk_prepare_enable(slow_clk);
>>>>> -
>>>>> -	return 0;
>>>>> -}
>>>>> -arch_initcall(of_at91_clk_slow_retain);
>>>> Can you drop the include of clk.h in this file too?
>>>>
>>> Sure! I will do that in v3. However, I'll wait for some feedback from
>>> the other maintainers before sending again.
>>>
>> Cool. Also, are you going to take this through arm-soc? If so, feel free to
>> add my ack.
>>
> Actually, clk.h has never been included in that file.
>
> I was thinking you could take it once the other patch made it in each
> subsystem. It is not urgent, it can probably skip one or two cycles.
>

Ok that's fine. I added clk.h into this file when I removed clk.h from 
clk-provider.h so that it keeps compiling. Please remind us to pick this 
up when you think it's ready.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
  2015-07-31 21:34             ` Stephen Boyd
@ 2015-07-31 22:24               ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 22:24 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Michael Turquette, linux-clk

On 31/07/2015 at 14:34:25 -0700, Stephen Boyd wrote :
> Ok that's fine. I added clk.h into this file when I removed clk.h from
> clk-provider.h so that it keeps compiling. Please remind us to pick this up
> when you think it's ready.
> 

Ah right, then I'll try to remember to remove it before resending.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang"
@ 2015-07-31 22:24               ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-07-31 22:24 UTC (permalink / raw)
  To: linux-arm-kernel

On 31/07/2015 at 14:34:25 -0700, Stephen Boyd wrote :
> Ok that's fine. I added clk.h into this file when I removed clk.h from
> clk-provider.h so that it keeps compiling. Please remind us to pick this up
> when you think it's ready.
> 

Ah right, then I'll try to remember to remove it before resending.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 01/23] Documentation: dt: atmel-at91: add clocks to system timer, rstc and shdwc
  2015-07-31  9:39   ` Alexandre Belloni
@ 2015-08-05 18:11     ` Sebastian Reichel
  -1 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-05 18:11 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Dmitry Eremin-Solenikov, linux-pm

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

Hi,

On Fri, Jul 31, 2015 at 11:39:37AM +0200, Alexandre Belloni wrote:
> The system timer (at91rm9200), the reset controller and the shutdown
> controller need an input clock. This is the slow clock and they will not
> function without it.
> 
> Also fix the shutdown controller example.

Acked-By: Sebastian Reichel <sre@kernel.org>

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH 01/23] Documentation: dt: atmel-at91: add clocks to system timer, rstc and shdwc
@ 2015-08-05 18:11     ` Sebastian Reichel
  0 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-05 18:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Jul 31, 2015 at 11:39:37AM +0200, Alexandre Belloni wrote:
> The system timer (at91rm9200), the reset controller and the shutdown
> controller need an input clock. This is the slow clock and they will not
> function without it.
> 
> Also fix the shutdown controller example.

Acked-By: Sebastian Reichel <sre@kernel.org>

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150805/7c1a4099/attachment.sig>

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

* Re: [PATCH 18/23] power/reset: at91-reset: get and use slow clock
  2015-07-31  9:39   ` Alexandre Belloni
@ 2015-08-05 18:22     ` Sebastian Reichel
  -1 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-05 18:22 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Dmitry Eremin-Solenikov, linux-pm

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

Hi,

On Fri, Jul 31, 2015 at 11:39:54AM +0200, Alexandre Belloni wrote:
> Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> hang") added a workaround for the slow clock as it is not properly handled
> by its users.
> 
> Get and use the slow clock as it is necessary for the at91 reset
> controller.

You call clk_prepare_enable during probe without a matching
clk_disable_unprepare on module removal.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH 18/23] power/reset: at91-reset: get and use slow clock
@ 2015-08-05 18:22     ` Sebastian Reichel
  0 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-05 18:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Jul 31, 2015 at 11:39:54AM +0200, Alexandre Belloni wrote:
> Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> hang") added a workaround for the slow clock as it is not properly handled
> by its users.
> 
> Get and use the slow clock as it is necessary for the at91 reset
> controller.

You call clk_prepare_enable during probe without a matching
clk_disable_unprepare on module removal.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150805/c9c0c0ac/attachment.sig>

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

* Re: [PATCH 19/23] power/reset: at91-poweroff: get and use slow clock
  2015-07-31  9:39   ` Alexandre Belloni
@ 2015-08-05 18:22     ` Sebastian Reichel
  -1 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-05 18:22 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Dmitry Eremin-Solenikov, linux-pm

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

Hi,

On Fri, Jul 31, 2015 at 11:39:55AM +0200, Alexandre Belloni wrote:
> Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> hang") added a workaround for the slow clock as it is not properly handled
> by its users.
> 
> Get and use the slow clock as it is necessary for the at91 shutdown
> controller.

You call clk_prepare_enable during probe without a matching
clk_disable_unprepare on module removal.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH 19/23] power/reset: at91-poweroff: get and use slow clock
@ 2015-08-05 18:22     ` Sebastian Reichel
  0 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-05 18:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Jul 31, 2015 at 11:39:55AM +0200, Alexandre Belloni wrote:
> Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> hang") added a workaround for the slow clock as it is not properly handled
> by its users.
> 
> Get and use the slow clock as it is necessary for the at91 shutdown
> controller.

You call clk_prepare_enable during probe without a matching
clk_disable_unprepare on module removal.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150805/245dc99a/attachment.sig>

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

* Re: [PATCH 22/23] misc: atmel_tclib: get and use slow clock
  2015-07-31  9:39   ` Alexandre Belloni
@ 2015-08-05 20:45     ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 86+ messages in thread
From: Greg Kroah-Hartman @ 2015-08-05 20:45 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Daniel Lezcano, Thomas Gleixner, Arnd Bergmann, Thierry Reding,
	linux-pwm

On Fri, Jul 31, 2015 at 11:39:58AM +0200, Alexandre Belloni wrote:
> From: Boris Brezillon <boris.brezillon@free-electrons.com>
> 
> Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> hang") added a workaround for the slow clock as it is not properly handled
> by its users.
> 
> Get and use the slow clock as it is necessary for the timer counters.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: linux-pwm@vger.kernel.org
>  drivers/clocksource/tcb_clksrc.c |  8 ++++++++
>  drivers/misc/atmel_tclib.c       |  4 ++++
>  drivers/pwm/pwm-atmel-tcb.c      | 23 ++++++++++++++++-------
>  include/linux/atmel_tc.h         |  1 +
>  4 files changed, 29 insertions(+), 7 deletions(-)
> 

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* [PATCH 22/23] misc: atmel_tclib: get and use slow clock
@ 2015-08-05 20:45     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 86+ messages in thread
From: Greg Kroah-Hartman @ 2015-08-05 20:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 31, 2015 at 11:39:58AM +0200, Alexandre Belloni wrote:
> From: Boris Brezillon <boris.brezillon@free-electrons.com>
> 
> Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> hang") added a workaround for the slow clock as it is not properly handled
> by its users.
> 
> Get and use the slow clock as it is necessary for the timer counters.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: linux-pwm at vger.kernel.org
>  drivers/clocksource/tcb_clksrc.c |  8 ++++++++
>  drivers/misc/atmel_tclib.c       |  4 ++++
>  drivers/pwm/pwm-atmel-tcb.c      | 23 ++++++++++++++++-------
>  include/linux/atmel_tc.h         |  1 +
>  4 files changed, 29 insertions(+), 7 deletions(-)
> 

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH 18/23] power/reset: at91-reset: get and use slow clock
  2015-08-05 18:22     ` Sebastian Reichel
@ 2015-08-10 15:50       ` Alexandre Belloni
  -1 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-08-10 15:50 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Dmitry Eremin-Solenikov, linux-pm

On 05/08/2015 at 20:22:20 +0200, Sebastian Reichel wrote :
> Hi,
> 
> On Fri, Jul 31, 2015 at 11:39:54AM +0200, Alexandre Belloni wrote:
> > Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> > hang") added a workaround for the slow clock as it is not properly handled
> > by its users.
> > 
> > Get and use the slow clock as it is necessary for the at91 reset
> > controller.
> 
> You call clk_prepare_enable during probe without a matching
> clk_disable_unprepare on module removal.
> 

They will never be compiled as modules as the Kconfig option is a bool
so we don't have a .remove and the module will never be removed.

Do you want me to change at91-reset and at91-poweroff to work as
modules?


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [PATCH 18/23] power/reset: at91-reset: get and use slow clock
@ 2015-08-10 15:50       ` Alexandre Belloni
  0 siblings, 0 replies; 86+ messages in thread
From: Alexandre Belloni @ 2015-08-10 15:50 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/08/2015 at 20:22:20 +0200, Sebastian Reichel wrote :
> Hi,
> 
> On Fri, Jul 31, 2015 at 11:39:54AM +0200, Alexandre Belloni wrote:
> > Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> > hang") added a workaround for the slow clock as it is not properly handled
> > by its users.
> > 
> > Get and use the slow clock as it is necessary for the at91 reset
> > controller.
> 
> You call clk_prepare_enable during probe without a matching
> clk_disable_unprepare on module removal.
> 

They will never be compiled as modules as the Kconfig option is a bool
so we don't have a .remove and the module will never be removed.

Do you want me to change at91-reset and at91-poweroff to work as
modules?


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* Re: [PATCH 18/23] power/reset: at91-reset: get and use slow clock
  2015-08-10 15:50       ` Alexandre Belloni
@ 2015-08-10 17:11         ` Sebastian Reichel
  -1 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-10 17:11 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, Boris Brezillon, Maxime Ripard,
	Jean-Christophe Plagniol-Villard, linux-arm-kernel, linux-kernel,
	Dmitry Eremin-Solenikov, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

Hi,

On Mon, Aug 10, 2015 at 05:50:05PM +0200, Alexandre Belloni wrote:
> On 05/08/2015 at 20:22:20 +0200, Sebastian Reichel wrote :
> > On Fri, Jul 31, 2015 at 11:39:54AM +0200, Alexandre Belloni wrote:
> > > Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> > > hang") added a workaround for the slow clock as it is not properly handled
> > > by its users.
> > > 
> > > Get and use the slow clock as it is necessary for the at91 reset
> > > controller.
> > 
> > You call clk_prepare_enable during probe without a matching
> > clk_disable_unprepare on module removal.
> 
> They will never be compiled as modules as the Kconfig option is a
> bool so we don't have a .remove and the module will never be removed.

In that case the module_platform_driver() statement at the bottom
should be replaced with builtin_platform_driver().

> Do you want me to change at91-reset and at91-poweroff to work as
> modules?

That would also be fine.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH 18/23] power/reset: at91-reset: get and use slow clock
@ 2015-08-10 17:11         ` Sebastian Reichel
  0 siblings, 0 replies; 86+ messages in thread
From: Sebastian Reichel @ 2015-08-10 17:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Mon, Aug 10, 2015 at 05:50:05PM +0200, Alexandre Belloni wrote:
> On 05/08/2015 at 20:22:20 +0200, Sebastian Reichel wrote :
> > On Fri, Jul 31, 2015 at 11:39:54AM +0200, Alexandre Belloni wrote:
> > > Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
> > > hang") added a workaround for the slow clock as it is not properly handled
> > > by its users.
> > > 
> > > Get and use the slow clock as it is necessary for the at91 reset
> > > controller.
> > 
> > You call clk_prepare_enable during probe without a matching
> > clk_disable_unprepare on module removal.
> 
> They will never be compiled as modules as the Kconfig option is a
> bool so we don't have a .remove and the module will never be removed.

In that case the module_platform_driver() statement at the bottom
should be replaced with builtin_platform_driver().

> Do you want me to change at91-reset and at91-poweroff to work as
> modules?

That would also be fine.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150810/0d904b01/attachment.sig>

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

end of thread, other threads:[~2015-08-10 17:11 UTC | newest]

Thread overview: 86+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31  9:39 [PATCH 00/23] ARM: at91: Properly handle slow clock Alexandre Belloni
2015-07-31  9:39 ` Alexandre Belloni
2015-07-31  9:39 ` [rtc-linux] " Alexandre Belloni
2015-07-31  9:39 ` [PATCH 01/23] Documentation: dt: atmel-at91: add clocks to system timer, rstc and shdwc Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-08-05 18:11   ` Sebastian Reichel
2015-08-05 18:11     ` Sebastian Reichel
2015-07-31  9:39 ` [PATCH 02/23] Documentation: dt: atmel-at91: add slow clock to tcb Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 03/23] Documentation: watchdog: at91sam9_wdt: add clocks property Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 04/23] Documentation: dt: rtc: at91rm9200: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39   ` [rtc-linux] " Alexandre Belloni
2015-07-31  9:39 ` [PATCH 05/23] ARM: at91/dt: at91rm9200: use slow clock where necessary Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 06/23] ARM: at91/dt: at91sam9260: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 07/23] ARM: at91/dt: at91sam9261: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 08/23] ARM: at91/dt: at91sam9263: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 09/23] ARM: at91/dt: at91sam9g45: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 10/23] ARM: at91/dt: at91sam9n12: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 11/23] ARM: at91/dt: at91sam9rl: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 12/23] ARM: at91/dt: at91sam9x5: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 13/23] ARM: at91/dt: sama5d3: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 14/23] ARM: at91/dt: sama5d4: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 15/23] rtc: at91rm9200: get and use slow clock Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39   ` [rtc-linux] " Alexandre Belloni
2015-07-31  9:39 ` [PATCH 16/23] watchdog: at91sam9: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 17/23] power/reset: at91-reset: remove useless at91_reset_platform_probe() Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 18/23] power/reset: at91-reset: get and use slow clock Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-08-05 18:22   ` Sebastian Reichel
2015-08-05 18:22     ` Sebastian Reichel
2015-08-10 15:50     ` Alexandre Belloni
2015-08-10 15:50       ` Alexandre Belloni
2015-08-10 17:11       ` Sebastian Reichel
2015-08-10 17:11         ` Sebastian Reichel
2015-07-31  9:39 ` [PATCH 19/23] power/reset: at91-poweroff: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-08-05 18:22   ` Sebastian Reichel
2015-08-05 18:22     ` Sebastian Reichel
2015-07-31  9:39 ` [PATCH 20/23] clocksource: atmel-st: " Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 21/23] clocksource: tcb_clksrc: fix setup_clkevents error path Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31  9:39 ` [PATCH 22/23] misc: atmel_tclib: get and use slow clock Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-08-05 20:45   ` Greg Kroah-Hartman
2015-08-05 20:45     ` Greg Kroah-Hartman
2015-07-31  9:39 ` [PATCH 23/23] clk: at91: Revert "keep slow clk enabled to prevent system hang" Alexandre Belloni
2015-07-31  9:39   ` Alexandre Belloni
2015-07-31 19:00   ` Stephen Boyd
2015-07-31 19:00     ` Stephen Boyd
2015-07-31 21:09     ` Alexandre Belloni
2015-07-31 21:09       ` Alexandre Belloni
2015-07-31 21:11       ` Stephen Boyd
2015-07-31 21:11         ` Stephen Boyd
2015-07-31 21:27         ` Alexandre Belloni
2015-07-31 21:27           ` Alexandre Belloni
2015-07-31 21:34           ` Stephen Boyd
2015-07-31 21:34             ` Stephen Boyd
2015-07-31 22:24             ` Alexandre Belloni
2015-07-31 22:24               ` Alexandre Belloni
2015-07-31  9:59 ` [PATCH 00/23] ARM: at91: Properly handle slow clock Boris Brezillon
2015-07-31  9:59   ` Boris Brezillon
2015-07-31  9:59   ` [rtc-linux] " Boris Brezillon
2015-07-31 10:20   ` Alexandre Belloni
2015-07-31 10:20     ` Alexandre Belloni
2015-07-31 10:20     ` [rtc-linux] " Alexandre Belloni
2015-07-31 15:21 ` Alexandre Belloni
2015-07-31 15:21   ` Alexandre Belloni
2015-07-31 15:21   ` [rtc-linux] " Alexandre Belloni

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.