mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Juergen Beisert <jbe@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] ARM/MXS: add new way to reset the whole SoC
Date: Wed, 20 Jun 2012 20:46:13 +0200	[thread overview]
Message-ID: <20120620184613.GB5642@pengutronix.de> (raw)
In-Reply-To: <1340200153-9215-2-git-send-email-jbe@pengutronix.de>

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

  reply	other threads:[~2012-06-20 18:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 13:49 [PATCH] ARM/MXS: free the watchdog from acting as a system reset source on demand 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 [this message]
2012-06-20 19:04     ` Juergen Beisert
2012-06-20 20:05       ` Uwe Kleine-König
2012-06-21  8:33         ` Juergen Beisert
2012-06-20 13:49 ` [PATCH 2/2] ARM/MXS: remove the now obsolete mxs reset routine Juergen Beisert
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

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=20120620184613.GB5642@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@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