Skip to contentSkip to conversation

ARM: bcm281xx: Board specific reboot code

PATCH New Markus Mayer 2 participants 7 messages Jun 28, 2013 – Jul 19, 2013

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

cover ARM: bcm281xx: Board specific reboot code

This patch series adds reboot code and related device tree bindings needed for the bcm281xx family.

Markus Mayer (2):
ARM: bcm281xx: Board specific reboot code
ARM: bcm281xx: DT changes for reboot code

 .../devicetree/bindings/arm/bcm/bcm,kona-wdt.txt   |   15 ++++++
 arch/arm/boot/dts/bcm11351.dtsi                    |    7 ++-
 arch/arm/mach-bcm/Makefile                         |    4 +-
 arch/arm/mach-bcm/board_bcm.c                      |   20 ++++++--
 arch/arm/mach-bcm/kona.c                           |   54 ++++++++++++++++++++
 arch/arm/mach-bcm/kona.h                           |   15 ++++++
 6 files changed, 109 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/bcm,kona-wdt.txt
 create mode 100644 arch/arm/mach-bcm/kona.c
 create mode 100644 arch/arm/mach-bcm/kona.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 ARM: bcm281xx: Board specific reboot code

This patch adds the code needed to trigger a reboot on the bcm281xx family.

---
 arch/arm/mach-bcm/Makefile    |    4 +--
 arch/arm/mach-bcm/board_bcm.c |   20 ++++++++++++---
 arch/arm/mach-bcm/kona.c      |   54 +++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-bcm/kona.h      |   15 ++++++++++++
 4 files changed, 88 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-bcm/kona.c
 create mode 100644 arch/arm/mach-bcm/kona.h
arch/arm/mach-bcm/Makefile +2 -2
index 6adb6aec..7e5ca0a 100644
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2012 Broadcom Corporation
+# Copyright (C) 2012-2013 Broadcom Corporation
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -10,6 +10,6 @@
 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-obj-$(CONFIG_ARCH_BCM)		:= board_bcm.o bcm_kona_smc.o bcm_kona_smc_asm.o
+obj-$(CONFIG_ARCH_BCM)	:= board_bcm.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_bcm_kona_smc_asm.o	:=-Wa,-march=armv7-a$(plus_sec)
arch/arm/mach-bcm/board_bcm.c +17 -3
index 22e8421..2dc9f95 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Broadcom Corporation
+ * Copyright (C) 2012-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -22,8 +22,8 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/cache-l2x0.h>
 
-
 #include "bcm_kona_smc.h"
+#include "kona.h"
 
 static int __init kona_l2_cache_init(void)
 {
@@ -41,13 +41,26 @@ static int __init kona_l2_cache_init(void)
 	return 0;
 }
 
+static void bcm_board_setup_restart(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "bcm,bcm11351");
+	if (np) {
+		if (of_device_is_available(np))
+			bcm_kona_setup_restart();
+		of_node_put(np);
+	}
+	/* Restart setup for other boards goes here */
+}
+
 static void __init board_init(void)
 {
 	of_platform_populate(NULL, of_default_bus_match_table, NULL,
 		&platform_bus);
 
 	bcm_kona_smc_init();
-
+	bcm_board_setup_restart();
 	kona_l2_cache_init();
 }
 
@@ -57,5 +70,6 @@ DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
 	.init_irq = irqchip_init,
 	.init_time = clocksource_of_init,
 	.init_machine = board_init,
+	.restart = bcm_kona_restart,
 	.dt_compat = bcm11351_dt_compat,
 MACHINE_END
arch/arm/mach-bcm/kona.c new file +54 -0

54 lines not on this page · raw message

arch/arm/mach-bcm/kona.h new file +15 -0
new file mode 100644
index 0000000..ecb417e
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2013 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+void bcm_kona_setup_restart(void);
+void bcm_kona_restart(char mode, const char *cmd);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/2 ARM: bcm281xx: Board specific reboot code

Adding Christian who got dropped from the Cc list.

-Markus

Quoted 175 lines · Markus Mayer

This patch adds the code needed to trigger a reboot on the bcm281xx family.

---
 arch/arm/mach-bcm/Makefile    |    4 +--
 arch/arm/mach-bcm/board_bcm.c |   20 ++++++++++++---
 arch/arm/mach-bcm/kona.c      |   54 +++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-bcm/kona.h      |   15 ++++++++++++
 4 files changed, 88 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-bcm/kona.c
 create mode 100644 arch/arm/mach-bcm/kona.h
arch/arm/mach-bcm/Makefile +2 -2
index 6adb6aec..7e5ca0a 100644
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2012 Broadcom Corporation
+# Copyright (C) 2012-2013 Broadcom Corporation
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -10,6 +10,6 @@
 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-obj-$(CONFIG_ARCH_BCM)         := board_bcm.o bcm_kona_smc.o bcm_kona_smc_asm.o
+obj-$(CONFIG_ARCH_BCM) := board_bcm.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o
 plus_sec := $(call as-instr,.arch_extension sec,+sec)
 AFLAGS_bcm_kona_smc_asm.o      :=-Wa,-march=armv7-a$(plus_sec)
arch/arm/mach-bcm/board_bcm.c +17 -3
index 22e8421..2dc9f95 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Broadcom Corporation
+ * Copyright (C) 2012-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -22,8 +22,8 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/cache-l2x0.h>
 
-
 #include "bcm_kona_smc.h"
+#include "kona.h"
 
 static int __init kona_l2_cache_init(void)
 {
@@ -41,13 +41,26 @@ static int __init kona_l2_cache_init(void)
        return 0;
 }
 
+static void bcm_board_setup_restart(void)
+{
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, NULL, "bcm,bcm11351");
+       if (np) {
+               if (of_device_is_available(np))
+                       bcm_kona_setup_restart();
+               of_node_put(np);
+       }
+       /* Restart setup for other boards goes here */
+}
+
 static void __init board_init(void)
 {
        of_platform_populate(NULL, of_default_bus_match_table, NULL,
                &platform_bus);
 
        bcm_kona_smc_init();
-
+       bcm_board_setup_restart();
        kona_l2_cache_init();
 }
 
@@ -57,5 +70,6 @@ DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
        .init_irq = irqchip_init,
        .init_time = clocksource_of_init,
        .init_machine = board_init,
+       .restart = bcm_kona_restart,
        .dt_compat = bcm11351_dt_compat,
 MACHINE_END
arch/arm/mach-bcm/kona.c new file +54 -0
new file mode 100644
index 0000000..4492b9f
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/of_address.h>
+#include <asm/io.h>
+
+#include "kona.h"
+
+static void __iomem *watchdog_base;
+
+void bcm_kona_setup_restart(void)
+{
+       struct device_node *np_wdog;
+
+       np_wdog = of_find_compatible_node(NULL, NULL, "bcm,kona-wdt");
+       watchdog_base = of_iomap(np_wdog, 0);
+       WARN(!watchdog_base, "failed to map watchdog base");
+       of_node_put(np_wdog);
+}
+
+#define GICDIST_ENABLE_OFFSET          0x00000000
+#define SECWDOG_OFFSET                 0x00000000
+#define SECWDOG_RESERVED_MASK          0xE2000000
+#define SECWDOG_WD_LOAD_FLAG_MASK      0x10000000
+#define SECWDOG_EN_MASK                        0x08000000
+#define SECWDOG_SRSTEN_MASK            0x04000000
+#define SECWDOG_CLKS_SHIFT             20
+#define SECWDOG_LOCK_SHIFT             0
+
+void bcm_kona_restart(char mode, const char *cmd)
+{
+       uint32_t val;
+
+       /* Enable watchdog 2 with very short timeout. */
+       val = readl(watchdog_base + SECWDOG_OFFSET);
+       val &= SECWDOG_RESERVED_MASK | SECWDOG_WD_LOAD_FLAG_MASK;
+       val |= SECWDOG_EN_MASK | SECWDOG_SRSTEN_MASK |
+               (0x8 << SECWDOG_CLKS_SHIFT) |
+               (0x8 << SECWDOG_LOCK_SHIFT);
+       writel(val, watchdog_base + SECWDOG_OFFSET);
+
+       while (1)
+               ;
+}
arch/arm/mach-bcm/kona.h new file +15 -1
new file mode 100644
index 0000000..ecb417e
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2013 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+void bcm_kona_setup_restart(void);
+void bcm_kona_restart(char mode, const char *cmd);
--

1.7.9.5

#3 lore raw

PATCH 2/2 ARM: bcm281xx: DT changes for reboot code

In reply to Markus Mayer

This patch adds the device tree bindings for the bcm281xx reboot code.

---
 .../devicetree/bindings/arm/bcm/bcm,kona-wdt.txt   |   15 +++++++++++++++
 arch/arm/boot/dts/bcm11351.dtsi                    |    7 ++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/bcm,kona-wdt.txt
Documentation/devicetree/bindings/arm/bcm/bcm,kona-wdt.txt new file +15 -0
new file mode 100644
index 0000000..ac349e7
@@ -0,0 +1,15 @@
+Broadcom Kona Family Watchdog Timer
+-----------------------------------
+
+This watchdog timer is used in the following Broadcom SoCs:
+  BCM11130, BCM11140, BCM11351, BCM28145, BCM28155
+
+Required properties:
+  - compatible = "bcm,kona-wdt";
+  - reg: memory range
+
+Example:
+	watchdog at 35002f40 {
+		compatible = "bcm,kona-wdt";
+		reg = <0x35002f40 0x6c>;
+	};
arch/arm/boot/dts/bcm11351.dtsi +6 -1
index 41b2c6c..cabeade 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Broadcom Corporation
+ * Copyright (C) 2012-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -53,6 +53,11 @@
 		    cache-level = <2>;
 	};
 
+	watchdog at 35002f40 {
+		compatible = "bcm,kona-wdt";
+		reg = <0x35002f40 0x6c>;
+	};
+
 	timer at 35006000 {
 		compatible = "bcm,kona-timer";
 		reg = <0x35006000 0x1000>;
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 2/2 ARM: bcm281xx: DT changes for reboot code

Adding Christian who got dropped from the Cc list.

-Markus

Quoted 59 lines · Markus Mayer

This patch adds the device tree bindings for the bcm281xx reboot code.

---
 .../devicetree/bindings/arm/bcm/bcm,kona-wdt.txt   |   15 +++++++++++++++
 arch/arm/boot/dts/bcm11351.dtsi                    |    7 ++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/bcm,kona-wdt.txt
Documentation/devicetree/bindings/arm/bcm/bcm,kona-wdt.txt new file +15 -0
new file mode 100644
index 0000000..ac349e7
@@ -0,0 +1,15 @@
+Broadcom Kona Family Watchdog Timer
+-----------------------------------
+
+This watchdog timer is used in the following Broadcom SoCs:
+  BCM11130, BCM11140, BCM11351, BCM28145, BCM28155
+
+Required properties:
+  - compatible = "bcm,kona-wdt";
+  - reg: memory range
+
+Example:
+       watchdog at 35002f40 {
+               compatible = "bcm,kona-wdt";
+               reg = <0x35002f40 0x6c>;
+       };
arch/arm/boot/dts/bcm11351.dtsi +6 -2
index 41b2c6c..cabeade 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Broadcom Corporation
+ * Copyright (C) 2012-2013 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -53,6 +53,11 @@
                    cache-level = <2>;
        };
 
+       watchdog at 35002f40 {
+               compatible = "bcm,kona-wdt";
+               reg = <0x35002f40 0x6c>;
+       };
+
        timer at 35006000 {
                compatible = "bcm,kona-timer";
                reg = <0x35006000 0x1000>;
--

1.7.9.5

#5 lore raw

cover ARM: bcm281xx: Board specific reboot code

In reply to Markus Mayer

Adding Christian who got dropped from the Cc list.

-Markus

Quoted 22 lines · Markus Mayer

This patch series adds reboot code and related device tree bindings needed for the bcm281xx family.

Markus Mayer (2):
ARM: bcm281xx: Board specific reboot code
ARM: bcm281xx: DT changes for reboot code

 .../devicetree/bindings/arm/bcm/bcm,kona-wdt.txt   |   15 ++++++
 arch/arm/boot/dts/bcm11351.dtsi                    |    7 ++-
 arch/arm/mach-bcm/Makefile                         |    4 +-
 arch/arm/mach-bcm/board_bcm.c                      |   20 ++++++--
 arch/arm/mach-bcm/kona.c                           |   54 ++++++++++++++++++++
 arch/arm/mach-bcm/kona.h                           |   15 ++++++
 6 files changed, 109 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/bcm,kona-wdt.txt
 create mode 100644 arch/arm/mach-bcm/kona.c
 create mode 100644 arch/arm/mach-bcm/kona.h

--
1.7.9.5

#6 lore raw

cover ARM: bcm281xx: Board specific reboot code

Quoted 27 lines · Markus Mayer

Adding Christian who got dropped from the Cc list.

-Markus

Quoted 22 lines · Markus Mayer

This patch series adds reboot code and related device tree bindings needed for the bcm281xx family.

Markus Mayer (2):
ARM: bcm281xx: Board specific reboot code
ARM: bcm281xx: DT changes for reboot code

  .../devicetree/bindings/arm/bcm/bcm,kona-wdt.txt   |   15 ++++++
  arch/arm/boot/dts/bcm11351.dtsi                    |    7 ++-
  arch/arm/mach-bcm/Makefile                         |    4 +-
  arch/arm/mach-bcm/board_bcm.c                      |   20 ++++++--
  arch/arm/mach-bcm/kona.c                           |   54 ++++++++++++++++++++
  arch/arm/mach-bcm/kona.h                           |   15 ++++++
  6 files changed, 109 insertions(+), 6 deletions(-)

create mode 100644 Documentation/devicetree/bindings/arm/bcm/bcm,kona-wdt.txt create mode 100644 arch/arm/mach-bcm/kona.c
create mode 100644 arch/arm/mach-bcm/kona.h

--
1.7.9.5

Pulled into bcm tree branch for-3.12/dt

thanks,
csd