linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] arm: mach-mvebu: system-controller only registers restart if device exists
Date: Wed, 27 Jun 2012 17:26:46 +0100	[thread overview]
Message-ID: <1340814406-26010-4-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1340814406-26010-1-git-send-email-ben.dooks@codethink.co.uk>

Change to only registering the restart hook if the device exists
and can be enumerated in the device tree. Remove the header definiton
and the restart entry in the machine file.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/mach-mvebu/armada-370-xp.c     |    1 -
 arch/arm/mach-mvebu/common.h            |    2 --
 arch/arm/mach-mvebu/system-controller.c |   40 ++++++++++++++++---------------
 3 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 4ef923b..a27639e 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -58,6 +58,5 @@ DT_MACHINE_START(ARMADA_XP_DT, "Marvell Aramada 370/XP (Device Tree)")
 	.init_irq	= armada_370_xp_init_irq,
 	.handle_irq     = armada_370_xp_handle_irq,
 	.timer		= &armada_370_xp_timer,
-	.restart	= mvebu_restart,
 	.dt_compat	= armada_370_xp_dt_board_dt_compat,
 MACHINE_END
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index 1b1e679..5d57784 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -15,8 +15,6 @@
 #ifndef __ARCH_MVEBU_COMMON_H
 #define __ARCH_MVEBU_COMMON_H
 
-void mvebu_restart(char mode, const char *cmd);
-
 void armada_370_xp_init_irq(void);
 asmlinkage void  armada_370_xp_handle_irq(struct pt_regs *regs);
 
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index 850f8d2..3405ecf 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -27,6 +27,8 @@
 #include <linux/of_address.h>
 #include <linux/io.h>
 
+#include <asm/system_misc.h>
+
 static void __iomem *system_controller_base;
 
 struct mvebu_system_controller {
@@ -63,26 +65,22 @@ static struct of_device_id of_system_controller_table[] = {
 	{ /* end of list */ },
 };
 
-void mvebu_restart(char mode, const char *cmd)
+static void mvebu_restart(char mode, const char *cmd)
 {
-	if (!system_controller_base) {
-		pr_warn("Cannot restart, system-controller not available\n");
-	} else {
-		/*
-		 * Enable soft reset to assert RSTOUTn.
-		 */
-		writel(mvebu_sc->rstoutn_mask_reset_out_en,
-			system_controller_base +
-			mvebu_sc->rstoutn_mask_offset);
-		/*
-		 * Assert soft reset.
-		 */
-		writel(mvebu_sc->system_soft_reset,
-			system_controller_base +
-			mvebu_sc->system_soft_reset_offset);
-	}
-	while (1)
-		;
+	/*
+	 * Enable soft reset to assert RSTOUTn.
+	 */
+	writel(mvebu_sc->rstoutn_mask_reset_out_en,
+	       system_controller_base +
+	       mvebu_sc->rstoutn_mask_offset);
+	/*
+	 * Assert soft reset.
+	 */
+	writel(mvebu_sc->system_soft_reset,
+	       system_controller_base +
+	       mvebu_sc->system_soft_reset_offset);
+
+	while (1) ;
 }
 
 static int __init mvebu_system_controller_init(void)
@@ -95,7 +93,11 @@ static int __init mvebu_system_controller_init(void)
 		    of_match_node(of_system_controller_table, np);
 		BUG_ON(!match);
 		system_controller_base = of_iomap(np, 0);
+		if (!WARN_ON(!system_controller_base))
+			return -EINVAL;
+
 		mvebu_sc = (struct mvebu_system_controller *)match->data;
+		arm_pm_restart = mvebu_restart;
 	}
 
 	return 0;
-- 
1.7.10

  parent reply	other threads:[~2012-06-27 16:26 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 13:54 [PATCH v5] arm: Add basic support for new Marvell Armada 370 and Armada XP SoC Gregory Clement
2012-06-27 13:54 ` [PATCH v5 1/9] clocksource: time-armada-370-xp: Marvell Armada 370/XP SoC timer driver Gregory Clement
2012-06-27 13:54 ` [PATCH v5 2/9] arm: mach-mvebu: add header Gregory Clement
2012-06-27 13:54 ` [PATCH v5 3/9] arm: mach-mvebu: add source files Gregory Clement
2012-06-27 15:36   ` Andrew Lunn
2012-06-28 18:07     ` Nicolas Pitre
2012-07-02 11:36     ` Thomas Petazzoni
2012-06-27 13:54 ` [PATCH v5 4/9] arm: mach-mvebu: add support for Armada 370 and Armada XP with DT Gregory Clement
2012-06-27 16:11   ` Ben Dooks
2012-07-02 11:37     ` Thomas Petazzoni
2012-06-27 13:54 ` [PATCH v5 5/9] arm: mach-mvebu: add documentation for new device tree bindings Gregory Clement
2012-06-27 13:54 ` [PATCH v5 6/9] arm: mach-mvebu: add defconfig Gregory Clement
2012-06-27 13:54 ` [PATCH v5 7/9] arm: mach-mvebu: add compilation/configuration change Gregory Clement
2012-06-27 13:54 ` [PATCH v5 8/9] arm: mach-mvebu: add entry to MAINTAINERS Gregory Clement
2012-06-27 13:54 ` [PATCH v5 9/9] ARM: mvebu: MPIC: read number of interrupts from control register Gregory Clement
2012-06-27 15:54 ` [PATCH v5] arm: Add basic support for new Marvell Armada 370 and Armada XP SoC Ben Dooks
2012-07-02  8:30   ` Thomas Petazzoni
2012-07-02  9:19     ` Ben Dooks
2012-07-02  9:19       ` Thomas Petazzoni
2012-07-02  9:25         ` Ben Dooks
2012-07-02  9:26           ` Thomas Petazzoni
2012-06-27 16:26 ` review comments Ben Dooks
2012-06-27 16:26   ` [PATCH 1/3] arm: mach-mvebu: fixup style error in system-controller Ben Dooks
2012-06-27 16:26   ` [PATCH 2/3] arm: mach-mvebu: check result of of_match_node() Ben Dooks
2012-06-27 16:26   ` Ben Dooks [this message]
2012-06-27 19:19     ` [PATCH 3/3] arm: mach-mvebu: system-controller only registers restart if device exists Russell King - ARM Linux
2012-06-28  9:23       ` Ben Dooks
2012-06-28 10:17         ` Russell King - ARM Linux
2012-07-02 11:35   ` review comments Thomas Petazzoni
2012-06-28 12:10 ` [PATCH v5] arm: Add basic support for new Marvell Armada 370 and Armada XP SoC Lior Amsalem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340814406-26010-4-git-send-email-ben.dooks@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).