From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1ShQJN-0004cU-F7 for barebox@lists.infradead.org; Wed, 20 Jun 2012 19:11:30 +0000 From: Juergen Beisert Date: Wed, 20 Jun 2012 21:04:09 +0200 References: <1340200153-9215-1-git-send-email-jbe@pengutronix.de> <1340200153-9215-2-git-send-email-jbe@pengutronix.de> <20120620184613.GB5642@pengutronix.de> In-Reply-To: <20120620184613.GB5642@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201206202104.09381.jbe@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC To: barebox@lists.infradead.org Cc: Uwe =?iso-8859-1?q?Kleine-K=F6nig?= Hi Uwe, Uwe Kleine-K=F6nig 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 > > --- > > 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 > > + * > > + * 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 > > +#include > > +#include > > +#include > > + > > +#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 =3D 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 > > + * > > + * 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 > > +#include > > +#include > > +#include > > + > > +#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 =3D 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