From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org, Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH v2 1/3] ARM: pxa: move pxa2xx functionality to SoC specific file
Date: Fri, 9 Jan 2015 08:36:41 +0100 [thread overview]
Message-ID: <1420789003-17409-1-git-send-email-robert.jarzmik@free.fr> (raw)
Move reset_source detection and poweroff to pxa2xx.c, to prepare the
incoming pxa3xx reset_source detection.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
arch/arm/mach-pxa/Makefile | 3 +-
arch/arm/mach-pxa/common.c | 13 +--------
arch/arm/mach-pxa/pxa2xx.c | 59 ++++++++++++++++++++++++++++++++++++++++
arch/arm/mach-pxa/reset_source.c | 41 ----------------------------
4 files changed, 61 insertions(+), 55 deletions(-)
create mode 100644 arch/arm/mach-pxa/pxa2xx.c
delete mode 100644 arch/arm/mach-pxa/reset_source.c
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 6ddb6e5..a09c060 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -4,6 +4,5 @@ obj-y += gpio.o
obj-y += devices.o
obj-y += sleep.o
-obj-$(CONFIG_ARCH_PXA2XX) += mfp-pxa2xx.o
+obj-$(CONFIG_ARCH_PXA2XX) += mfp-pxa2xx.o pxa2xx.o
obj-$(CONFIG_ARCH_PXA27X) += speed-pxa27x.o
-obj-$(CONFIG_RESET_SOURCE) += reset_source.o
diff --git a/arch/arm/mach-pxa/common.c b/arch/arm/mach-pxa/common.c
index 0c114ed..1ed7931 100644
--- a/arch/arm/mach-pxa/common.c
+++ b/arch/arm/mach-pxa/common.c
@@ -27,7 +27,7 @@
#define OWER_WME (1 << 0) /* Watch-dog Match Enable */
#define OSSR_M3 (1 << 3) /* Match status channel 3 */
-extern void pxa_suspend(int mode);
+extern void pxa_clear_reset_source(void);
void reset_cpu(ulong addr)
{
@@ -41,14 +41,3 @@ void reset_cpu(ulong addr)
while (1);
}
-
-void __noreturn poweroff()
-{
- shutdown_barebox();
-
- /* Clear last reset source */
- RCSR = RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR;
-
- pxa_suspend(PWRMODE_DEEPSLEEP);
- unreachable();
-}
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
new file mode 100644
index 0000000..b712b38
--- /dev/null
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -0,0 +1,59 @@
+/*
+ * (C) Copyright 2014 Robert Jarzmik <robert.jarzmik@free.fr>
+ *
+ * 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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <reset_source.h>
+#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
+
+extern void pxa_suspend(int mode);
+
+static int pxa_detect_reset_source(void)
+{
+ u32 reg = RCSR;
+
+ /*
+ * Order is important, as many bits can be set together
+ */
+ if (reg & RCSR_GPR)
+ reset_source_set(RESET_RST);
+ else if (reg & RCSR_WDR)
+ reset_source_set(RESET_WDG);
+ else if (reg & RCSR_HWR)
+ reset_source_set(RESET_POR);
+ else if (reg & RCSR_SMR)
+ reset_source_set(RESET_WKE);
+ else
+ reset_source_set(RESET_UKWN);
+
+ return 0;
+}
+
+void pxa_clear_reset_source(void)
+{
+ RCSR = RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR;
+}
+
+device_initcall(pxa_detect_reset_source);
+
+void __noreturn poweroff(void)
+{
+ shutdown_barebox();
+
+ /* Clear last reset source */
+ pxa_clear_reset_source();
+ pxa_suspend(PWRMODE_DEEPSLEEP);
+ unreachable();
+}
diff --git a/arch/arm/mach-pxa/reset_source.c b/arch/arm/mach-pxa/reset_source.c
deleted file mode 100644
index a90584b..0000000
--- a/arch/arm/mach-pxa/reset_source.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * (C) Copyright 2014 Robert Jarzmik <robert.jarzmik@free.fr>
- *
- * 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; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <common.h>
-#include <init.h>
-#include <reset_source.h>
-#include <mach/pxa-regs.h>
-
-static int pxa_detect_reset_source(void)
-{
- u32 reg = RCSR;
-
- /*
- * Order is important, as many bits can be set together
- */
- if (reg & RCSR_GPR)
- reset_source_set(RESET_RST);
- else if (reg & RCSR_WDR)
- reset_source_set(RESET_WDG);
- else if (reg & RCSR_HWR)
- reset_source_set(RESET_POR);
- else if (reg & RCSR_SMR)
- reset_source_set(RESET_WKE);
- else
- reset_source_set(RESET_UKWN);
-
- return 0;
-}
-
-device_initcall(pxa_detect_reset_source);
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2015-01-09 7:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-09 7:36 Robert Jarzmik [this message]
2015-01-09 7:36 ` [PATCH v2 2/3] ARM: pxa: add pxa3xx architecture Robert Jarzmik
2015-01-09 7:36 ` [PATCH v2 3/3] ARM: pxa: add the zylonite board Robert Jarzmik
2015-01-13 7:44 ` [PATCH v2 1/3] ARM: pxa: move pxa2xx functionality to SoC specific file Sascha Hauer
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=1420789003-17409-1-git-send-email-robert.jarzmik@free.fr \
--to=robert.jarzmik@free.fr \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/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