All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20121007015407.522256287@gmail.com>

diff --git a/a/1.txt b/N1/1.txt
index 2965fa7..66afde7 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -1,3 +1,147 @@
-An embedded and charset-unspecified text was scrubbed...
-Name: arm-bcm476x-add-restart-hook.patch
-URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121007/d0a941f9/attachment.ksh>
+From: Domenico Andreoli <domenico.andreoli@linux.com>
+
+Restart hook implementation for the BCM476x SoC (uses the watchdog).
+
+Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>
+---
+ Documentation/devicetree/bindings/watchdog/brcm,bcm476x-pm-wdt.txt |   13 ++
+ arch/arm/boot/dts/bcm476x.dtsi                                     |    5 +
+ arch/arm/mach-bcm476x/bcm476x.c                                    |   66 ++++++++++
+ 3 files changed, 84 insertions(+)
+
+Index: b/Documentation/devicetree/bindings/watchdog/brcm,bcm476x-pm-wdt.txt
+===================================================================
+--- /dev/null
++++ b/Documentation/devicetree/bindings/watchdog/brcm,bcm476x-pm-wdt.txt
+@@ -0,0 +1,13 @@
++BCM476x Watchdog timer
++
++Required properties:
++
++- compatible : should be "brcm,bcm476x-pm-wdt"
++- reg : Specifies base physical address and size of the registers.
++
++Example:
++
++watchdog {
++	compatible = "brcm,bcm476x-pm-wdt";
++	reg = <0xbd000 0x1000>;
++};
+Index: b/arch/arm/boot/dts/bcm476x.dtsi
+===================================================================
+--- a/arch/arm/boot/dts/bcm476x.dtsi
++++ b/arch/arm/boot/dts/bcm476x.dtsi
+@@ -28,6 +28,11 @@
+ 			clock-frequency = <32000>;
+ 		};
+ 
++		watchdog {
++			compatible = "brcm,bcm476x-pm-wdt";
++			reg = <0xbd000 0x1000>;
++		};
++
+ 		vic0: interrupt-controller@80000 {
+ 			compatible = "brcm,bcm476x-pl192", "arm,pl192-vic", "arm,primecell";
+ 			reg = <0x80000 0x1000>;
+Index: b/arch/arm/mach-bcm476x/bcm476x.c
+===================================================================
+--- a/arch/arm/mach-bcm476x/bcm476x.c
++++ b/arch/arm/mach-bcm476x/bcm476x.c
+@@ -15,7 +15,9 @@
+  */
+ 
+ #include <linux/init.h>
++#include <linux/delay.h>
+ #include <linux/of_irq.h>
++#include <linux/of_address.h>
+ #include <linux/of_platform.h>
+ #include <linux/bcm476x_timer.h>
+ #include <linux/clk/bcm476x.h>
+@@ -28,6 +30,17 @@
+ #define BCM476X_PERIPH_VIRT   0xd0080000
+ #define BCM476X_PERIPH_SIZE   SZ_512K
+ 
++#define BCM476X_WDT_LOAD      0x000
++#define BCM476X_WDT_CTRL      0x008
++#define BCM476X_WDT_INTCLR    0x00c
++#define BCM476X_WDT_LOCK      0xc00
++
++#define BCM476X_WDT_PASSWORD  0x1acce551
++#define BCM476X_WDT_INTEN     BIT(0)
++#define BCM476X_WDT_RESEN     BIT(1)
++
++static void __iomem *wdt_regs;
++
+ static struct map_desc io_map __initdata = {
+ 	.virtual = BCM476X_PERIPH_VIRT,
+ 	.pfn = __phys_to_pfn(BCM476X_PERIPH_PHYS),
+@@ -40,10 +53,62 @@ void __init bcm476x_map_io(void)
+ 	iotable_init(&io_map, 1);
+ }
+ 
++/*
++ * The machine restart method can be called from an atomic context so we won't
++ * be able to ioremap the regs then.
++ */
++static void bcm476x_setup_restart(void)
++{
++	struct device_node *np;
++
++	np = of_find_compatible_node(NULL, NULL, "brcm,bcm476x-pm-wdt");
++	if (WARN(!np, "unable to setup watchdog restart"))
++		return;
++
++	wdt_regs = of_iomap(np, 0);
++	WARN(!wdt_regs, "Can't remap watchdog registers");
++
++	/* unlock watchdog registers */
++	writel(BCM476X_WDT_PASSWORD, wdt_regs + BCM476X_WDT_LOCK);
++	/* disable watchdog */
++	writel(0, wdt_regs + BCM476X_WDT_CTRL);
++	/* lock watchdog registers */
++	writel(1, wdt_regs + BCM476X_WDT_LOCK);
++}
++
++static void bcm476x_restart(char mode, const char *cmd)
++{
++	if (!wdt_regs)
++		return;
++
++	/* unlock watchdog registers */
++	writel(BCM476X_WDT_PASSWORD, wdt_regs + BCM476X_WDT_LOCK);
++
++	/* disable watchdog */
++	writel(0, wdt_regs + BCM476X_WDT_CTRL);
++	udelay(20);
++
++	/* clear the irq status */
++	writel(1, wdt_regs + BCM476X_WDT_INTCLR);
++	udelay(20);
++
++	/* expire after 5 cycles (~156us) */
++	writel(5, wdt_regs + BCM476X_WDT_LOAD);
++	/* enable watchdog */
++	writel(BCM476X_WDT_INTEN | BCM476X_WDT_RESEN,
++		wdt_regs + BCM476X_WDT_CTRL);
++
++	/* lock watchdog registers */
++	writel(1, wdt_regs + BCM476X_WDT_LOCK);
++	/* wait the bite */
++	udelay(400);
++}
++
+ void __init bcm476x_init(void)
+ {
+ 	int ret;
+ 
++	bcm476x_setup_restart();
+ 	bcm476x_init_clocks();
+ 
+ 	ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+@@ -74,5 +139,6 @@ DT_MACHINE_START(BCM476X, "Broadcom BCM4
+ 	.handle_irq = vic_handle_irq,
+ 	.init_machine = bcm476x_init,
+ 	.timer = &bcm476x_timer,
++	.restart = bcm476x_restart,
+ 	.dt_compat = bcm476x_compat
+ MACHINE_END
diff --git a/a/content_digest b/N1/content_digest
index c3b5cb0..a34e879 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -1,12 +1,159 @@
  "ref\020121007015300.828366635@gmail.com\0"
- "From\0cavokz@gmail.com (Domenico Andreoli)\0"
+ "From\0Domenico Andreoli <cavokz@gmail.com>\0"
  "Subject\0[PATCH 5/6] ARM: bcm476x: Add restart hook\0"
  "Date\0Sun, 07 Oct 2012 03:53:05 +0200\0"
  "To\0linux-arm-kernel@lists.infradead.org\0"
+ "Cc\0Domenico Andreoli <domenico.andreoli@linux.com>"
+ " devicetree-discuss@lists.ozlabs.org\0"
  "\00:1\0"
+ "fn\0arm-bcm476x-add-restart-hook.patch\0"
  "b\0"
- "An embedded and charset-unspecified text was scrubbed...\n"
- "Name: arm-bcm476x-add-restart-hook.patch\n"
- URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121007/d0a941f9/attachment.ksh>
+ "From: Domenico Andreoli <domenico.andreoli@linux.com>\n"
+ "\n"
+ "Restart hook implementation for the BCM476x SoC (uses the watchdog).\n"
+ "\n"
+ "Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>\n"
+ "---\n"
+ " Documentation/devicetree/bindings/watchdog/brcm,bcm476x-pm-wdt.txt |   13 ++\n"
+ " arch/arm/boot/dts/bcm476x.dtsi                                     |    5 +\n"
+ " arch/arm/mach-bcm476x/bcm476x.c                                    |   66 ++++++++++\n"
+ " 3 files changed, 84 insertions(+)\n"
+ "\n"
+ "Index: b/Documentation/devicetree/bindings/watchdog/brcm,bcm476x-pm-wdt.txt\n"
+ "===================================================================\n"
+ "--- /dev/null\n"
+ "+++ b/Documentation/devicetree/bindings/watchdog/brcm,bcm476x-pm-wdt.txt\n"
+ "@@ -0,0 +1,13 @@\n"
+ "+BCM476x Watchdog timer\n"
+ "+\n"
+ "+Required properties:\n"
+ "+\n"
+ "+- compatible : should be \"brcm,bcm476x-pm-wdt\"\n"
+ "+- reg : Specifies base physical address and size of the registers.\n"
+ "+\n"
+ "+Example:\n"
+ "+\n"
+ "+watchdog {\n"
+ "+\tcompatible = \"brcm,bcm476x-pm-wdt\";\n"
+ "+\treg = <0xbd000 0x1000>;\n"
+ "+};\n"
+ "Index: b/arch/arm/boot/dts/bcm476x.dtsi\n"
+ "===================================================================\n"
+ "--- a/arch/arm/boot/dts/bcm476x.dtsi\n"
+ "+++ b/arch/arm/boot/dts/bcm476x.dtsi\n"
+ "@@ -28,6 +28,11 @@\n"
+ " \t\t\tclock-frequency = <32000>;\n"
+ " \t\t};\n"
+ " \n"
+ "+\t\twatchdog {\n"
+ "+\t\t\tcompatible = \"brcm,bcm476x-pm-wdt\";\n"
+ "+\t\t\treg = <0xbd000 0x1000>;\n"
+ "+\t\t};\n"
+ "+\n"
+ " \t\tvic0: interrupt-controller@80000 {\n"
+ " \t\t\tcompatible = \"brcm,bcm476x-pl192\", \"arm,pl192-vic\", \"arm,primecell\";\n"
+ " \t\t\treg = <0x80000 0x1000>;\n"
+ "Index: b/arch/arm/mach-bcm476x/bcm476x.c\n"
+ "===================================================================\n"
+ "--- a/arch/arm/mach-bcm476x/bcm476x.c\n"
+ "+++ b/arch/arm/mach-bcm476x/bcm476x.c\n"
+ "@@ -15,7 +15,9 @@\n"
+ "  */\n"
+ " \n"
+ " #include <linux/init.h>\n"
+ "+#include <linux/delay.h>\n"
+ " #include <linux/of_irq.h>\n"
+ "+#include <linux/of_address.h>\n"
+ " #include <linux/of_platform.h>\n"
+ " #include <linux/bcm476x_timer.h>\n"
+ " #include <linux/clk/bcm476x.h>\n"
+ "@@ -28,6 +30,17 @@\n"
+ " #define BCM476X_PERIPH_VIRT   0xd0080000\n"
+ " #define BCM476X_PERIPH_SIZE   SZ_512K\n"
+ " \n"
+ "+#define BCM476X_WDT_LOAD      0x000\n"
+ "+#define BCM476X_WDT_CTRL      0x008\n"
+ "+#define BCM476X_WDT_INTCLR    0x00c\n"
+ "+#define BCM476X_WDT_LOCK      0xc00\n"
+ "+\n"
+ "+#define BCM476X_WDT_PASSWORD  0x1acce551\n"
+ "+#define BCM476X_WDT_INTEN     BIT(0)\n"
+ "+#define BCM476X_WDT_RESEN     BIT(1)\n"
+ "+\n"
+ "+static void __iomem *wdt_regs;\n"
+ "+\n"
+ " static struct map_desc io_map __initdata = {\n"
+ " \t.virtual = BCM476X_PERIPH_VIRT,\n"
+ " \t.pfn = __phys_to_pfn(BCM476X_PERIPH_PHYS),\n"
+ "@@ -40,10 +53,62 @@ void __init bcm476x_map_io(void)\n"
+ " \tiotable_init(&io_map, 1);\n"
+ " }\n"
+ " \n"
+ "+/*\n"
+ "+ * The machine restart method can be called from an atomic context so we won't\n"
+ "+ * be able to ioremap the regs then.\n"
+ "+ */\n"
+ "+static void bcm476x_setup_restart(void)\n"
+ "+{\n"
+ "+\tstruct device_node *np;\n"
+ "+\n"
+ "+\tnp = of_find_compatible_node(NULL, NULL, \"brcm,bcm476x-pm-wdt\");\n"
+ "+\tif (WARN(!np, \"unable to setup watchdog restart\"))\n"
+ "+\t\treturn;\n"
+ "+\n"
+ "+\twdt_regs = of_iomap(np, 0);\n"
+ "+\tWARN(!wdt_regs, \"Can't remap watchdog registers\");\n"
+ "+\n"
+ "+\t/* unlock watchdog registers */\n"
+ "+\twritel(BCM476X_WDT_PASSWORD, wdt_regs + BCM476X_WDT_LOCK);\n"
+ "+\t/* disable watchdog */\n"
+ "+\twritel(0, wdt_regs + BCM476X_WDT_CTRL);\n"
+ "+\t/* lock watchdog registers */\n"
+ "+\twritel(1, wdt_regs + BCM476X_WDT_LOCK);\n"
+ "+}\n"
+ "+\n"
+ "+static void bcm476x_restart(char mode, const char *cmd)\n"
+ "+{\n"
+ "+\tif (!wdt_regs)\n"
+ "+\t\treturn;\n"
+ "+\n"
+ "+\t/* unlock watchdog registers */\n"
+ "+\twritel(BCM476X_WDT_PASSWORD, wdt_regs + BCM476X_WDT_LOCK);\n"
+ "+\n"
+ "+\t/* disable watchdog */\n"
+ "+\twritel(0, wdt_regs + BCM476X_WDT_CTRL);\n"
+ "+\tudelay(20);\n"
+ "+\n"
+ "+\t/* clear the irq status */\n"
+ "+\twritel(1, wdt_regs + BCM476X_WDT_INTCLR);\n"
+ "+\tudelay(20);\n"
+ "+\n"
+ "+\t/* expire after 5 cycles (~156us) */\n"
+ "+\twritel(5, wdt_regs + BCM476X_WDT_LOAD);\n"
+ "+\t/* enable watchdog */\n"
+ "+\twritel(BCM476X_WDT_INTEN | BCM476X_WDT_RESEN,\n"
+ "+\t\twdt_regs + BCM476X_WDT_CTRL);\n"
+ "+\n"
+ "+\t/* lock watchdog registers */\n"
+ "+\twritel(1, wdt_regs + BCM476X_WDT_LOCK);\n"
+ "+\t/* wait the bite */\n"
+ "+\tudelay(400);\n"
+ "+}\n"
+ "+\n"
+ " void __init bcm476x_init(void)\n"
+ " {\n"
+ " \tint ret;\n"
+ " \n"
+ "+\tbcm476x_setup_restart();\n"
+ " \tbcm476x_init_clocks();\n"
+ " \n"
+ " \tret = of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);\n"
+ "@@ -74,5 +139,6 @@ DT_MACHINE_START(BCM476X, \"Broadcom BCM4\n"
+ " \t.handle_irq = vic_handle_irq,\n"
+ " \t.init_machine = bcm476x_init,\n"
+ " \t.timer = &bcm476x_timer,\n"
+ "+\t.restart = bcm476x_restart,\n"
+ " \t.dt_compat = bcm476x_compat\n"
+  MACHINE_END
 
-dd178dba24b13a89e46de5238c79f34876dbf10cbe9e9a4aa934f9878c96f09b
+317c1284d2300c9fd24646793ffa524b9764c08b8d90d91be08c85f9369e1195

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.