Skip to contentSkip to conversation

ARM: bcm2835: implement machine restart hook

PATCH New Stephen Warren 3 participants 6 messages Sep 28, 2012 – Oct 26, 2012

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: bcm2835: implement machine restart hook

Implement the machine restart hook using the SoC's watchdog timer module. To support this, define a DT binding for the watchdog module, and add it to the device tree.

The downstream rpi-split branch contains a full watchdog timer driver implementation, which also implements the restart hook. However, the restart function is largely separate from the watchdog driver, so for simplicity, the restart hook is implemented here directly in the main machine source file.

Overall structure (separate setup/restart) functions derived from the picoxcell ARM support.

Watchdog register IO sequence taken from code by Simon Arlott. Note that the watchdog module is not documented in BCM2835-ARM-Peripherals.pdf.

---
 .../bindings/watchdog/brcm,bcm2835-pm-wdog.txt     |   13 ++++++
 arch/arm/boot/dts/bcm2835.dtsi                     |    5 +++
 arch/arm/mach-bcm2835/bcm2835.c                    |   46 ++++++++++++++++++++
 3 files changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt new file +13 -0
new file mode 100644
index 0000000..03138e6
@@ -0,0 +1,13 @@
+BCM2835 Watchdog timer
+
+Required properties:
+
+- compatible : should be "brcm,bcm2835-pm-wdog"
+- reg : Specifies base physical address and size of the registers.
+
+Example:
+
+intc: interrupt-controller {
+	compatible = "brcm,bcm2835-pm-wdog";
+	reg = <0x7e100000 0x28>;
+};
arch/arm/boot/dts/bcm2835.dtsi +5 -0
index 0b61939..7e0d515 100644
@@ -29,6 +29,11 @@
 			#interrupt-cells = <2>;
 		};
 
+		watchdog {
+			compatible = "brcm,bcm2835-pm-wdog";
+			reg = <0x7e100000 0x28>;
+		};
+
 		uart at 20201000 {
 			compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell";
 			reg = <0x7e201000 0x1000>;
arch/arm/mach-bcm2835/bcm2835.c +46 -0

71 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ARM: bcm2835: implement machine restart hook

Stephen,

Quoted 1 line · Stephen Warren

+intc: interrupt-controller {

Isn't this a bizarre name for a watchdog device?

Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt line 13

Quoted 3 lines
Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt new file +3 -0
+	compatible = "brcm,bcm2835-pm-wdog";
+	reg = <0x7e100000 0x28>;
+};

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 ARM: bcm2835: implement machine restart hook

Quoted 7 lines · Thomas Petazzoni

Stephen,

Quoted 1 line · Stephen Warren

+intc: interrupt-controller {

Isn't this a bizarre name for a watchdog device?

Yes, certainly! It looks like I only made this cut/paste mistake in the binding document, which is why the code actually worked...

Quoted 3 lines
Quoted 3 lines
Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt new file +3 -0
+	compatible = "brcm,bcm2835-pm-wdog";
+	reg = <0x7e100000 0x28>;
+};
#3 lore raw

PATCH 1/1 ARM: bcm2835: implement machine restart hook

In reply to Stephen Warren
Quoted 31 lines · Stephen Warren

Implement the machine restart hook using the SoC's watchdog timer module. To support this, define a DT binding for the watchdog module, and add it to the device tree.

The downstream rpi-split branch contains a full watchdog timer driver implementation, which also implements the restart hook. However, the restart function is largely separate from the watchdog driver, so for simplicity, the restart hook is implemented here directly in the main machine source file.

Overall structure (separate setup/restart) functions derived from the picoxcell ARM support.

Watchdog register IO sequence taken from code by Simon Arlott. Note that the watchdog module is not documented in BCM2835-ARM-Peripherals.pdf.

---
 .../bindings/watchdog/brcm,bcm2835-pm-wdog.txt     |   13 ++++++
 arch/arm/boot/dts/bcm2835.dtsi                     |    5 +++
 arch/arm/mach-bcm2835/bcm2835.c                    |   46 ++++++++++++++++++++
 3 files changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt new file +1 -0
new file mode 100644
index 0000000..03138e6
@@ -0,0 +1,13 @@
+BCM2835 Watchdog timer

Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt new file +10 -0
+
+Required properties:
+
+- compatible : should be "brcm,bcm2835-pm-wdog"
+- reg : Specifies base physical address and size of the registers.
+
+Example:
+
+intc: interrupt-controller {
+	compatible = "brcm,bcm2835-pm-wdog";

it's seems everyone use -wdt

Best Regards,
J.

#4 lore raw

PATCH 1/1 ARM: bcm2835: implement machine restart hook

Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines · Stephen Warren

Implement the machine restart hook using the SoC's watchdog timer module. To support this, define a DT binding for the watchdog module, and add it to the device tree.

The downstream rpi-split branch contains a full watchdog timer driver implementation, which also implements the restart hook. However, the restart function is largely separate from the watchdog driver, so for simplicity, the restart hook is implemented here directly in the main machine source file.

Quoted 8 lines

Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt line 11

Quoted 6 lines

+++ b/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt

Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt new file +4 -0
+Example:
+
+intc: interrupt-controller {
+	compatible = "brcm,bcm2835-pm-wdog";

it's seems everyone use -wdt

That is true. "-wdog" is what was in the downstream patch, but I guess it makes sense to fix it up to be consistent with everything already in the kernel.

author Applied
#5 lore raw

PATCH 1/1 ARM: bcm2835: implement machine restart hook

In reply to Stephen Warren
Quoted 10 lines · Stephen Warren

Implement the machine restart hook using the SoC's watchdog timer module. To support this, define a DT binding for the watchdog module, and add it to the device tree.

The downstream rpi-split branch contains a full watchdog timer driver implementation, which also implements the restart hook. However, the restart function is largely separate from the watchdog driver, so for simplicity, the restart hook is implemented here directly in the main machine source file.

Quoted 5 lines

Overall structure (separate setup/restart) functions derived from the picoxcell ARM support.

Watchdog register IO sequence taken from code by Simon Arlott. Note that the watchdog module is not documented in BCM2835-ARM-Peripherals.pdf.

Applied to rpi's for-3.8/soc branch.