[PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms

Grant Likely grant.likely at secretlab.ca
Thu Oct 18 01:30:04 EST 2007


On 10/17/07, Marian Balakowicz <m8 at semihalf.com> wrote:
>
> Add common helper routines: mpc52xx_map_wdt() and mpc52xx_restart().
>
> This patch relies on Sascha Hauer's patch published in:
> http://patchwork.ozlabs.org/linuxppc/patch?id=8910.
>
> Signed-off-by: Marian Balakowicz <m8 at semihalf.com>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>
>  arch/powerpc/platforms/52xx/mpc52xx_common.c |   45 +++++++++++++++++++++++++++
>  include/asm-powerpc/mpc52xx.h                |    3 +
>  2 files changed, 48 insertions(+)
>
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
> index 74b4b41..553937b 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
> @@ -18,6 +18,13 @@ #include <asm/io.h>
>  #include <asm/prom.h>
>  #include <asm/mpc52xx.h>
>
> +/*
> + * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart().
> + * Permanent mapping is required because mpc52xx_restart() can be called
> + * from interrupt context while node mapping (which calls iorenmap())
> + * cannot be used at such point.
> + */
> +static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
>
>  static void __iomem *
>  mpc52xx_map_node(struct device_node *ofn)
> @@ -126,3 +133,41 @@ mpc52xx_declare_of_platform_devices(void
>                         "Error while probing of_platform bus\n");
>  }
>
> +void __init
> +mpc52xx_map_wdt(void)
> +{
> +        const void *has_wdt;
> +       struct device_node *np;
> +
> +       /* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
> +        * possibly from a interrupt context. */
> +
> +       for (np = NULL;
> +           (np = of_find_compatible_node(np, NULL, "fsl,mpc5200-gpt")) != NULL;
> +           ) {
> +               /* wdt is only implement on gpt0, check has-wdt property. */
> +               has_wdt = of_get_property(np, "fsl,has-wdt", NULL);

Test for both "has-wdt" and "fsl,has-wdt" for now.

Otherwise, looks good.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195



More information about the Linuxppc-dev mailing list