Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1c1575f authored by Kumar Gala's avatar Kumar Gala
Browse files

[POWERPC] 85xx/86xx: refactor RSTCR reset code



On the majority of 85xx & 86xx we have a register that's ability to
assert HRESET_REQ to reset the board.  We refactored that code so it
can be shared between both platforms into fsl_soc.c and removed all
the duplication in each platform directory.

Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent c9438aff
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -214,6 +214,12 @@
			device_type = "open-pic";
			big-endian;
		};

		global-utilities@e0000 {
			compatible = "fsl,mpc8641-guts";
			reg = <e0000 1000>;
			fsl,has-rstcr;
		};
	};

	pcie@f8008000 {
+0 −1
Original line number Diff line number Diff line
#
# Makefile for the PowerPC 85xx linux kernel.
#
obj-$(CONFIG_PPC_85xx)	+= misc.o
obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
+0 −55
Original line number Diff line number Diff line
/*
 * MPC85xx generic code.
 *
 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
 *
 * Copyright 2005 Freescale Semiconductor Inc.
 *
 * 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.
 */
#include <linux/irq.h>
#include <linux/module.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <sysdev/fsl_soc.h>

static __be32 __iomem *rstcr;

extern void abort(void);

static int __init mpc85xx_rstcr(void)
{
	struct device_node *np;
	np = of_find_node_by_name(NULL, "global-utilities");
	if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
		const u32 *prop = of_get_property(np, "reg", NULL);
		if (prop) {
			/* map reset control register
			 * 0xE00B0 is offset of reset control register
			 */
			rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
			if (!rstcr)
				printk (KERN_EMERG "Error: reset control "
						"register not mapped!\n");
		}
	} else
		printk (KERN_INFO "rstcr compatible register does not exist!\n");
	if (np)
		of_node_put(np);
	return 0;
}

arch_initcall(mpc85xx_rstcr);

void mpc85xx_restart(char *cmd)
{
	local_irq_disable();
	if (rstcr)
		/* set reset control register */
		out_be32(rstcr, 0x2);	/* HRESET_REQ */
	abort();
}
+0 −17
Original line number Diff line number Diff line
/*
 * arch/powerpc/platforms/85xx/mpc85xx.h
 *
 * MPC85xx soc definitions/function decls
 *
 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
 *
 * Copyright 2005 Freescale Semiconductor Inc.
 *
 * 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.
 *
 */

extern void mpc85xx_restart(char *);
+1 −2
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@

#include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h>
#include "mpc85xx.h"

#ifdef CONFIG_CPM2
#include <linux/fs_enet_pd.h>
@@ -249,7 +248,7 @@ define_machine(mpc85xx_ads) {
	.init_IRQ		= mpc85xx_ads_pic_init,
	.show_cpuinfo		= mpc85xx_ads_show_cpuinfo,
	.get_irq		= mpic_get_irq,
	.restart		= mpc85xx_restart,
	.restart		= fsl_rstcr_restart,
	.calibrate_decr		= generic_calibrate_decr,
	.progress		= udbg_progress,
};
Loading