From: dinguyen@altera.com (dinguyen at altera.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv1 1/2] ARM: socfpga: Enable hotplug and soft reset
Date: Wed, 13 Mar 2013 16:55:21 -0500 [thread overview]
Message-ID: <1363211722-27237-2-git-send-email-dinguyen@altera.com> (raw)
In-Reply-To: <1363211722-27237-1-git-send-email-dinguyen@altera.com>
From: Dinh Nguyen <dinguyen@altera.com>
Put CPU1 into reset when it is hotplugged.
Enable a cold or warm reset to the HW from userspace.
Also fix a few sparse errors:
warning: symbol 'sys_manager_base_addr' was not declared. Should it be static?
warning: symbol 'rst_manager_base_addr' was not declared. Should it be static?
Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
---
arch/arm/mach-socfpga/core.h | 17 +++++++++++++++++
arch/arm/mach-socfpga/platsmp.c | 9 ++++++---
arch/arm/mach-socfpga/socfpga.c | 10 +++++++++-
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-socfpga/core.h b/arch/arm/mach-socfpga/core.h
index 315edff..d2a251f 100644
--- a/arch/arm/mach-socfpga/core.h
+++ b/arch/arm/mach-socfpga/core.h
@@ -20,12 +20,29 @@
#ifndef __MACH_CORE_H
#define __MACH_CORE_H
+#define SOCFPGA_RSTMGR_CTRL 0x04
+#define SOCFPGA_RSTMGR_MODPERRST 0x14
+#define SOCFPGA_RSTMGR_BRGMODRST 0x1c
+
+/* System Manager bits */
+#define RSTMGR_CTRL_SWCOLDRSTREQ 0x1 /* Cold Reset */
+#define RSTMGR_CTRL_SWWARMRSTREQ 0x2 /* Warm Reset */
+/*MPU Module Reset Register */
+#define RSTMGR_MPUMODRST_CPU0 0x1 /*CPU0 Reset*/
+#define RSTMGR_MPUMODRST_CPU1 0x2 /*CPU1 Reset*/
+#define RSTMGR_MPUMODRST_WDS 0x4 /*Watchdog Reset*/
+#define RSTMGR_MPUMODRST_SCUPER 0x8 /*SCU and periphs reset*/
+#define RSTMGR_MPUMODRST_L2 0x10 /*L2 Cache reset*/
+
extern void socfpga_secondary_startup(void);
extern void __iomem *socfpga_scu_base_addr;
extern void socfpga_init_clocks(void);
extern void socfpga_sysmgr_init(void);
+extern void __iomem *sys_manager_base_addr;
+extern void __iomem *rst_manager_base_addr;
+
extern struct smp_operations socfpga_smp_ops;
extern char secondary_trampoline, secondary_trampoline_end;
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index 84c60fa..c75c33d 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -30,9 +30,6 @@
#include "core.h"
-extern void __iomem *sys_manager_base_addr;
-extern void __iomem *rst_manager_base_addr;
-
static void __cpuinit socfpga_secondary_init(unsigned int cpu)
{
/*
@@ -100,6 +97,12 @@ static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
*/
static void socfpga_cpu_die(unsigned int cpu)
{
+ /* Flush the L1 data cache. */
+ flush_cache_all();
+
+ /* This will put CPU1 into reset.*/
+ __raw_writel(RSTMGR_MPUMODRST_CPU1, rst_manager_base_addr + 0x10);
+
cpu_do_idle();
/* We should have never returned from idle */
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 1042c02..b41a945 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -87,7 +87,15 @@ static void __init socfpga_init_irq(void)
static void socfpga_cyclone5_restart(char mode, const char *cmd)
{
- /* TODO: */
+ u32 temp;
+
+ temp = __raw_readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
+
+ if (mode == 'h')
+ temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
+ else
+ temp |= RSTMGR_CTRL_SWWARMRSTREQ;
+ __raw_writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
}
static void __init socfpga_cyclone5_init(void)
--
1.7.9.5
next prev parent reply other threads:[~2013-03-13 21:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 21:55 [PATCHv1 0/2] ARM: socfpga: Soft reset, hotplug and device tree clocks dinguyen at altera.com
2013-03-13 21:55 ` dinguyen at altera.com [this message]
2013-03-17 18:18 ` [PATCHv1 1/2] ARM: socfpga: Enable hotplug and soft reset Pavel Machek
2013-03-13 21:55 ` [PATCHv1 2/2] ARM: socfpga: Add clock entries into device tree dinguyen at altera.com
2013-03-17 18:35 ` Pavel Machek
2013-03-14 1:04 ` [PATCHv1 0/2] ARM: socfpga: Soft reset, hotplug and device tree clocks Rob Herring
2013-03-14 11:03 ` Pavel Machek
2013-03-14 13:26 ` Arnd Bergmann
2013-03-14 13:39 ` Dinh Nguyen
2013-03-17 18:13 ` Pavel Machek
2013-03-18 13:01 ` Rob Herring
2013-03-18 14:24 ` Pavel Machek
2013-03-18 14:39 ` Dinh Nguyen
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=1363211722-27237-2-git-send-email-dinguyen@altera.com \
--to=dinguyen@altera.com \
--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 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.