* [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand
@ 2012-06-21 9:12 Juergen Beisert
2012-06-21 9:12 ` [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC Juergen Beisert
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-06-21 9:12 UTC (permalink / raw)
To: barebox
Currently the watchdog is occupied for system reset. This usage collides with
the dedicated usage of a watchdog. This patch series changes the behaviour of
at least i.MX23/i.MX28 where the chipset supports a simple and powerful
alternative to reset the whole SoC (including the PMIC).
This series fixes the coding style issues Uwe mentions.
Comments are welcome.
Juergen
The following changes since commit 2761ef4d4ae401887f0832d1fd496f26cdf11f20:
Merge branch 'for-next/resource-size' into next (2012-06-20 10:30:40 +0200)
are available in the git repository at:
git://git.pengutronix.de/git/jbe/barebox.git mxs_next_release_watchdogV2
for you to fetch changes up to 812279160a70cf5704c8732fe933a17e026c1780:
ARM/MXS: remove the now obsolete mxs reset routine (2012-06-21 10:38:52 +0200)
----------------------------------------------------------------
Juergen Beisert (2):
ARM/MXS: add new way to reset the whole SoC
ARM/MXS: remove the now obsolete mxs reset routine
arch/arm/mach-mxs/Makefile | 6 ++--
arch/arm/mach-mxs/reset-imx.c | 61 -----------------------------------------
arch/arm/mach-mxs/soc-imx23.c | 37 +++++++++++++++++++++++++
arch/arm/mach-mxs/soc-imx28.c | 37 +++++++++++++++++++++++++
4 files changed, 77 insertions(+), 64 deletions(-)
delete mode 100644 arch/arm/mach-mxs/reset-imx.c
create mode 100644 arch/arm/mach-mxs/soc-imx23.c
create mode 100644 arch/arm/mach-mxs/soc-imx28.c
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC
2012-06-21 9:12 [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand Juergen Beisert
@ 2012-06-21 9:12 ` Juergen Beisert
2012-06-21 9:12 ` [PATCH 2/2] ARM/MXS: remove the now obsolete mxs reset routine Juergen Beisert
2012-06-21 17:30 ` [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand Sascha Hauer
2 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-06-21 9:12 UTC (permalink / raw)
To: barebox
Currently the watchdog is occupied for system reset. This usage collides with
the dedicated usage of a watchdog. This patch change the behaviour of at least
i.MX23/i.MX28 where the chipset supports a simple and powerful alternative
to reset the whole SoC (including the PMIC).
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
arch/arm/mach-mxs/soc-imx23.c | 37 +++++++++++++++++++++++++++++++++++++
arch/arm/mach-mxs/soc-imx28.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 arch/arm/mach-mxs/soc-imx23.c
create mode 100644 arch/arm/mach-mxs/soc-imx28.c
diff --git a/arch/arm/mach-mxs/soc-imx23.c b/arch/arm/mach-mxs/soc-imx23.c
new file mode 100644
index 0000000..6819b3c
--- /dev/null
+++ b/arch/arm/mach-mxs/soc-imx23.c
@@ -0,0 +1,37 @@
+/*
+ * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
+ *
+ * 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.
+ *
+ * Collection of some SoC specific functions
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mach/imx-regs.h>
+#include <io.h>
+
+#define HW_CLKCTRL_RESET 0x120
+# define HW_CLKCTRL_RESET_CHIP (1 << 1)
+
+/* Reset the full i.MX23 SoC via a chipset feature */
+void __noreturn reset_cpu(unsigned long addr)
+{
+ u32 reg;
+
+ reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
+ writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
+
+ while (1)
+ ;
+ /*NOTREACHED*/
+}
+EXPORT_SYMBOL(reset_cpu);
diff --git a/arch/arm/mach-mxs/soc-imx28.c b/arch/arm/mach-mxs/soc-imx28.c
new file mode 100644
index 0000000..a181b75
--- /dev/null
+++ b/arch/arm/mach-mxs/soc-imx28.c
@@ -0,0 +1,37 @@
+/*
+ * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
+ *
+ * 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.
+ *
+ * Collection of some SoC specific functions
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mach/imx-regs.h>
+#include <io.h>
+
+#define HW_CLKCTRL_RESET 0x1e0
+# define HW_CLKCTRL_RESET_CHIP (1 << 1)
+
+/* Reset the full i.MX28 SoC via a chipset feature */
+void __noreturn reset_cpu(unsigned long addr)
+{
+ u32 reg;
+
+ reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
+ writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
+
+ while (1)
+ ;
+ /*NOTREACHED*/
+}
+EXPORT_SYMBOL(reset_cpu);
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] ARM/MXS: remove the now obsolete mxs reset routine
2012-06-21 9:12 [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand Juergen Beisert
2012-06-21 9:12 ` [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC Juergen Beisert
@ 2012-06-21 9:12 ` Juergen Beisert
2012-06-21 17:30 ` [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand Sascha Hauer
2 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-06-21 9:12 UTC (permalink / raw)
To: barebox
Remove the old reset routine from the buildsystem and build the new one
instead according to the selected architecture
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
arch/arm/mach-mxs/Makefile | 6 ++--
arch/arm/mach-mxs/reset-imx.c | 61 -----------------------------------------
2 files changed, 3 insertions(+), 64 deletions(-)
delete mode 100644 arch/arm/mach-mxs/reset-imx.c
diff --git a/arch/arm/mach-mxs/Makefile b/arch/arm/mach-mxs/Makefile
index 9255d15..73ce1c8 100644
--- a/arch/arm/mach-mxs/Makefile
+++ b/arch/arm/mach-mxs/Makefile
@@ -1,6 +1,6 @@
-obj-y += imx.o iomux-imx.o reset-imx.o common.o power.o
+obj-y += imx.o iomux-imx.o common.o power.o
obj-$(CONFIG_DRIVER_VIDEO_STM) += imx_lcd_clk.o
-obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o usb.o
-obj-$(CONFIG_ARCH_IMX28) += speed-imx28.o clocksource-imx28.o
+obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o usb.o soc-imx23.o
+obj-$(CONFIG_ARCH_IMX28) += speed-imx28.o clocksource-imx28.o soc-imx28.o
obj-$(CONFIG_MXS_OCOTP) += ocotp.o
obj-$(CONFIG_MXS_CMD_BCB) += bcb.o
diff --git a/arch/arm/mach-mxs/reset-imx.c b/arch/arm/mach-mxs/reset-imx.c
deleted file mode 100644
index cfb3548..0000000
--- a/arch/arm/mach-mxs/reset-imx.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * (C) Copyright 2010 Juergen Beisert - Pengutronix
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <init.h>
-#include <notifier.h>
-#include <mach/imx-regs.h>
-#include <io.h>
-
-#define HW_RTC_CTRL 0x000
-# define BM_RTC_CTRL_WATCHDOGEN (1 << 4)
-#define HW_RTC_CTRL_SET 0x004
-#define HW_RTC_CTRL_CLR 0x008
-#define HW_RTC_CTRL_TOG 0x00C
-
-#define HW_RTC_WATCHDOG 0x050
-#define HW_RTC_WATCHDOG_SET 0x054
-#define HW_RTC_WATCHDOG_CLR 0x058
-#define HW_RTC_WATCHDOG_TOG 0x05C
-
-#define WDOG_COUNTER_RATE 1000 /* 1 kHz clock */
-
-#define HW_RTC_PERSISTENT1 0x070
-# define BV_RTC_PERSISTENT1_GENERAL__RTC_FORCE_UPDATER 0x80000000
-#define HW_RTC_PERSISTENT1_SET 0x074
-#define HW_RTC_PERSISTENT1_CLR 0x078
-#define HW_RTC_PERSISTENT1_TOG 0x07C
-
-/*
- * Reset the cpu by setting up the watchdog timer and let it time out
- *
- * TODO There is a much easier way to reset the CPU: Refer bit 2 in
- * the HW_CLKCTRL_RESET register, data sheet page 106/4-30
- */
-void __noreturn reset_cpu (unsigned long addr)
-{
- writel(WDOG_COUNTER_RATE, IMX_WDT_BASE + HW_RTC_WATCHDOG);
- writel(BM_RTC_CTRL_WATCHDOGEN, IMX_WDT_BASE + HW_RTC_CTRL_SET);
- writel(BV_RTC_PERSISTENT1_GENERAL__RTC_FORCE_UPDATER, IMX_WDT_BASE + HW_RTC_PERSISTENT1);
-
- while (1)
- ;
- /*NOTREACHED*/
-}
-EXPORT_SYMBOL(reset_cpu);
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand
2012-06-21 9:12 [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand Juergen Beisert
2012-06-21 9:12 ` [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC Juergen Beisert
2012-06-21 9:12 ` [PATCH 2/2] ARM/MXS: remove the now obsolete mxs reset routine Juergen Beisert
@ 2012-06-21 17:30 ` Sascha Hauer
2 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2012-06-21 17:30 UTC (permalink / raw)
To: Juergen Beisert; +Cc: barebox
On Thu, Jun 21, 2012 at 11:12:20AM +0200, Juergen Beisert wrote:
> Currently the watchdog is occupied for system reset. This usage collides with
> the dedicated usage of a watchdog. This patch series changes the behaviour of
> at least i.MX23/i.MX28 where the chipset supports a simple and powerful
> alternative to reset the whole SoC (including the PMIC).
>
> This series fixes the coding style issues Uwe mentions.
>
> Comments are welcome.
Folded both patches into one and applied.
Thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC
2012-06-20 20:05 ` Uwe Kleine-König
@ 2012-06-21 8:33 ` Juergen Beisert
0 siblings, 0 replies; 9+ messages in thread
From: Juergen Beisert @ 2012-06-21 8:33 UTC (permalink / raw)
To: barebox; +Cc: Uwe Kleine-König
Hi Uwe,
Uwe Kleine-König wrote:
> On Wed, Jun 20, 2012 at 09:04:09PM +0200, Juergen Beisert wrote:
> > > Is it worth to introduce a common function
> > >
> > > void __noreturn sensiblename(unsigned long clkctrl_reset_offset,
> > > unsigned long unused) {
> > > ...
> > > }
> > >
> > > and make the reset_cpu functions for imx23 and imx28 just call
> > > sensiblename()?
> >
> > Refer "http://www.spinics.net/lists/u-boot-v2/msg07681.html"
>
> I don't see how this answers my question. To combine both answers, put
> sensiblename into arch/arm/mach-mxs/common.c and the imx23 and the imx28
> specific call to sensiblename into imx23.c and imx28.c respectively.
What would be the advantage? You add one more indirection but almost the same
amount of code.
jbe
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC
2012-06-20 19:04 ` Juergen Beisert
@ 2012-06-20 20:05 ` Uwe Kleine-König
2012-06-21 8:33 ` Juergen Beisert
0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2012-06-20 20:05 UTC (permalink / raw)
To: Juergen Beisert; +Cc: barebox
Hello Jürgen,
On Wed, Jun 20, 2012 at 09:04:09PM +0200, Juergen Beisert wrote:
> > Is it worth to introduce a common function
> >
> > void __noreturn sensiblename(unsigned long clkctrl_reset_offset, unsigned
> > long unused) {
> > ...
> > }
> >
> > and make the reset_cpu functions for imx23 and imx28 just call
> > sensiblename()?
>
> Refer "http://www.spinics.net/lists/u-boot-v2/msg07681.html"
I don't see how this answers my question. To combine both answers, put
sensiblename into arch/arm/mach-mxs/common.c and the imx23 and the imx28
specific call to sensiblename into imx23.c and imx28.c respectively.
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC
2012-06-20 18:46 ` Uwe Kleine-König
@ 2012-06-20 19:04 ` Juergen Beisert
2012-06-20 20:05 ` Uwe Kleine-König
0 siblings, 1 reply; 9+ messages in thread
From: Juergen Beisert @ 2012-06-20 19:04 UTC (permalink / raw)
To: barebox; +Cc: Uwe Kleine-König
Hi Uwe,
Uwe Kleine-König wrote:
> On Wed, Jun 20, 2012 at 03:49:12PM +0200, Juergen Beisert wrote:
> > Currently the watchdog is occupied for system reset. This usage collides
> > with the dedicated usage of a watchdog. This patch change the behaviour
> > of at least i.MX23/i.MX28 where the chipset supports a simple and
> > powerful alternative to reset the whole SoC (including the PMIC).
> >
> > Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> > ---
> > arch/arm/mach-mxs/soc-imx23.c | 37
> > +++++++++++++++++++++++++++++++++++++ arch/arm/mach-mxs/soc-imx28.c |
> > 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 74
> > insertions(+)
> > create mode 100644 arch/arm/mach-mxs/soc-imx23.c
> > create mode 100644 arch/arm/mach-mxs/soc-imx28.c
> >
> > diff --git a/arch/arm/mach-mxs/soc-imx23.c
> > b/arch/arm/mach-mxs/soc-imx23.c new file mode 100644
> > index 0000000..964b722
> > --- /dev/null
> > +++ b/arch/arm/mach-mxs/soc-imx23.c
> > @@ -0,0 +1,37 @@
> > +/*
> > + * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
> > + *
> > + * 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.
> > + *
> > + * Collection of some SoC specific functions
> > + */
> > +
> > +#include <common.h>
> > +#include <init.h>
> > +#include <mach/imx-regs.h>
> > +#include <io.h>
> > +
> > +#define HW_CLKCTRL_RESET 0x120
> > +# define HW_CLKCTRL_RESET_CHIP (1 << 1)
> > +
> > +/* Reset the full i.MX23 SoC via a chipset feature */
> > +void __noreturn reset_cpu (unsigned long addr)
>
> coding style ---------------^, no space here.
Okay.
> > +{
> > + u32 reg;
> > +
> > + reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
> > + writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
> > +
> > + while (1)
> > + ;
> > + /*NOTREACHED*/
> > +}
> > +EXPORT_SYMBOL(reset_cpu);
> > diff --git a/arch/arm/mach-mxs/soc-imx28.c
> > b/arch/arm/mach-mxs/soc-imx28.c new file mode 100644
> > index 0000000..c7a34a8
> > --- /dev/null
> > +++ b/arch/arm/mach-mxs/soc-imx28.c
> > @@ -0,0 +1,37 @@
> > +/*
> > + * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
> > + *
> > + * 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.
> > + *
> > + * Collection of some SoC specific functions
> > + */
> > +
> > +#include <common.h>
> > +#include <init.h>
> > +#include <mach/imx-regs.h>
> > +#include <io.h>
> > +
> > +#define HW_CLKCTRL_RESET 0x1e0
> > +# define HW_CLKCTRL_RESET_CHIP (1 << 1)
> > +
> > +/* Reset the full i.MX28 SoC via a chipset feature */
> > +void __noreturn reset_cpu (unsigned long addr)
> > +{
> > + u32 reg;
> > +
> > + reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
> > + writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
> > +
> > + while (1)
> > + ;
> > + /*NOTREACHED*/
> > +}
> > +EXPORT_SYMBOL(reset_cpu);
>
> Is it worth to introduce a common function
>
> void __noreturn sensiblename(unsigned long clkctrl_reset_offset, unsigned
> long unused) {
> ...
> }
>
> and make the reset_cpu functions for imx23 and imx28 just call
> sensiblename()?
Refer "http://www.spinics.net/lists/u-boot-v2/msg07681.html"
jbe
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC
2012-06-20 13:49 ` [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC Juergen Beisert
@ 2012-06-20 18:46 ` Uwe Kleine-König
2012-06-20 19:04 ` Juergen Beisert
0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2012-06-20 18:46 UTC (permalink / raw)
To: Juergen Beisert; +Cc: barebox
Hello Jürgen,
On Wed, Jun 20, 2012 at 03:49:12PM +0200, Juergen Beisert wrote:
> Currently the watchdog is occupied for system reset. This usage collides with
> the dedicated usage of a watchdog. This patch change the behaviour of at least
> i.MX23/i.MX28 where the chipset supports a simple and powerful alternative
> to reset the whole SoC (including the PMIC).
>
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> ---
> arch/arm/mach-mxs/soc-imx23.c | 37 +++++++++++++++++++++++++++++++++++++
> arch/arm/mach-mxs/soc-imx28.c | 37 +++++++++++++++++++++++++++++++++++++
> 2 files changed, 74 insertions(+)
> create mode 100644 arch/arm/mach-mxs/soc-imx23.c
> create mode 100644 arch/arm/mach-mxs/soc-imx28.c
>
> diff --git a/arch/arm/mach-mxs/soc-imx23.c b/arch/arm/mach-mxs/soc-imx23.c
> new file mode 100644
> index 0000000..964b722
> --- /dev/null
> +++ b/arch/arm/mach-mxs/soc-imx23.c
> @@ -0,0 +1,37 @@
> +/*
> + * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
> + *
> + * 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.
> + *
> + * Collection of some SoC specific functions
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +#include <mach/imx-regs.h>
> +#include <io.h>
> +
> +#define HW_CLKCTRL_RESET 0x120
> +# define HW_CLKCTRL_RESET_CHIP (1 << 1)
> +
> +/* Reset the full i.MX23 SoC via a chipset feature */
> +void __noreturn reset_cpu (unsigned long addr)
coding style ---------------^, no space here.
> +{
> + u32 reg;
> +
> + reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
> + writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
> +
> + while (1)
> + ;
> + /*NOTREACHED*/
> +}
> +EXPORT_SYMBOL(reset_cpu);
> diff --git a/arch/arm/mach-mxs/soc-imx28.c b/arch/arm/mach-mxs/soc-imx28.c
> new file mode 100644
> index 0000000..c7a34a8
> --- /dev/null
> +++ b/arch/arm/mach-mxs/soc-imx28.c
> @@ -0,0 +1,37 @@
> +/*
> + * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
> + *
> + * 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.
> + *
> + * Collection of some SoC specific functions
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +#include <mach/imx-regs.h>
> +#include <io.h>
> +
> +#define HW_CLKCTRL_RESET 0x1e0
> +# define HW_CLKCTRL_RESET_CHIP (1 << 1)
> +
> +/* Reset the full i.MX28 SoC via a chipset feature */
> +void __noreturn reset_cpu (unsigned long addr)
> +{
> + u32 reg;
> +
> + reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
> + writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
> +
> + while (1)
> + ;
> + /*NOTREACHED*/
> +}
> +EXPORT_SYMBOL(reset_cpu);
Is it worth to introduce a common function
void __noreturn sensiblename(unsigned long clkctrl_reset_offset, unsigned long unused)
{
...
}
and make the reset_cpu functions for imx23 and imx28 just call
sensiblename()?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC
2012-06-20 13:49 [PATCH] " Juergen Beisert
@ 2012-06-20 13:49 ` Juergen Beisert
2012-06-20 18:46 ` Uwe Kleine-König
0 siblings, 1 reply; 9+ messages in thread
From: Juergen Beisert @ 2012-06-20 13:49 UTC (permalink / raw)
To: barebox
Currently the watchdog is occupied for system reset. This usage collides with
the dedicated usage of a watchdog. This patch change the behaviour of at least
i.MX23/i.MX28 where the chipset supports a simple and powerful alternative
to reset the whole SoC (including the PMIC).
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
arch/arm/mach-mxs/soc-imx23.c | 37 +++++++++++++++++++++++++++++++++++++
arch/arm/mach-mxs/soc-imx28.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 arch/arm/mach-mxs/soc-imx23.c
create mode 100644 arch/arm/mach-mxs/soc-imx28.c
diff --git a/arch/arm/mach-mxs/soc-imx23.c b/arch/arm/mach-mxs/soc-imx23.c
new file mode 100644
index 0000000..964b722
--- /dev/null
+++ b/arch/arm/mach-mxs/soc-imx23.c
@@ -0,0 +1,37 @@
+/*
+ * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
+ *
+ * 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.
+ *
+ * Collection of some SoC specific functions
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mach/imx-regs.h>
+#include <io.h>
+
+#define HW_CLKCTRL_RESET 0x120
+# define HW_CLKCTRL_RESET_CHIP (1 << 1)
+
+/* Reset the full i.MX23 SoC via a chipset feature */
+void __noreturn reset_cpu (unsigned long addr)
+{
+ u32 reg;
+
+ reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
+ writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
+
+ while (1)
+ ;
+ /*NOTREACHED*/
+}
+EXPORT_SYMBOL(reset_cpu);
diff --git a/arch/arm/mach-mxs/soc-imx28.c b/arch/arm/mach-mxs/soc-imx28.c
new file mode 100644
index 0000000..c7a34a8
--- /dev/null
+++ b/arch/arm/mach-mxs/soc-imx28.c
@@ -0,0 +1,37 @@
+/*
+ * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
+ *
+ * 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.
+ *
+ * Collection of some SoC specific functions
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mach/imx-regs.h>
+#include <io.h>
+
+#define HW_CLKCTRL_RESET 0x1e0
+# define HW_CLKCTRL_RESET_CHIP (1 << 1)
+
+/* Reset the full i.MX28 SoC via a chipset feature */
+void __noreturn reset_cpu (unsigned long addr)
+{
+ u32 reg;
+
+ reg = readl(IMX_CCM_BASE + HW_CLKCTRL_RESET);
+ writel(reg | HW_CLKCTRL_RESET_CHIP, IMX_CCM_BASE + HW_CLKCTRL_RESET);
+
+ while (1)
+ ;
+ /*NOTREACHED*/
+}
+EXPORT_SYMBOL(reset_cpu);
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-06-21 17:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-21 9:12 [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand Juergen Beisert
2012-06-21 9:12 ` [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC Juergen Beisert
2012-06-21 9:12 ` [PATCH 2/2] ARM/MXS: remove the now obsolete mxs reset routine Juergen Beisert
2012-06-21 17:30 ` [PATCHv2] ARM/MXS: free the watchdog from acting as a system reset source on demand Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2012-06-20 13:49 [PATCH] " Juergen Beisert
2012-06-20 13:49 ` [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC Juergen Beisert
2012-06-20 18:46 ` Uwe Kleine-König
2012-06-20 19:04 ` Juergen Beisert
2012-06-20 20:05 ` Uwe Kleine-König
2012-06-21 8:33 ` Juergen Beisert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox