aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2007-10-04 02:04:57 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-08 09:38:47 -0400
commite1c1575f831ab2165732037e6d664010a0149730 (patch)
treeecfc90b06eb4b7402a3334ebe6b8287e73abc671 /arch/powerpc/platforms
parentc9438affcb7ac0dda4c6c6961637fb272f7c32d4 (diff)
[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: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/misc.c55
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx.h17
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c3
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c5
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c5
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c4
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c19
-rw-r--r--arch/powerpc/platforms/86xx/mpc8641_hpcn.h21
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c20
10 files changed, 8 insertions, 142 deletions
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 25bd9e2d4946..5eca92023ec8 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -1,7 +1,6 @@
1# 1#
2# Makefile for the PowerPC 85xx linux kernel. 2# Makefile for the PowerPC 85xx linux kernel.
3# 3#
4obj-$(CONFIG_PPC_85xx) += misc.o
5obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 4obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
6obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o 5obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
7obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o 6obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
diff --git a/arch/powerpc/platforms/85xx/misc.c b/arch/powerpc/platforms/85xx/misc.c
deleted file mode 100644
index 4fe376e9c3b6..000000000000
--- a/arch/powerpc/platforms/85xx/misc.c
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * MPC85xx generic code.
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2005 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/irq.h>
14#include <linux/module.h>
15#include <asm/irq.h>
16#include <asm/io.h>
17#include <asm/prom.h>
18#include <sysdev/fsl_soc.h>
19
20static __be32 __iomem *rstcr;
21
22extern void abort(void);
23
24static int __init mpc85xx_rstcr(void)
25{
26 struct device_node *np;
27 np = of_find_node_by_name(NULL, "global-utilities");
28 if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
29 const u32 *prop = of_get_property(np, "reg", NULL);
30 if (prop) {
31 /* map reset control register
32 * 0xE00B0 is offset of reset control register
33 */
34 rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
35 if (!rstcr)
36 printk (KERN_EMERG "Error: reset control "
37 "register not mapped!\n");
38 }
39 } else
40 printk (KERN_INFO "rstcr compatible register does not exist!\n");
41 if (np)
42 of_node_put(np);
43 return 0;
44}
45
46arch_initcall(mpc85xx_rstcr);
47
48void mpc85xx_restart(char *cmd)
49{
50 local_irq_disable();
51 if (rstcr)
52 /* set reset control register */
53 out_be32(rstcr, 0x2); /* HRESET_REQ */
54 abort();
55}
diff --git a/arch/powerpc/platforms/85xx/mpc85xx.h b/arch/powerpc/platforms/85xx/mpc85xx.h
deleted file mode 100644
index 5b34deef12b5..000000000000
--- a/arch/powerpc/platforms/85xx/mpc85xx.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/powerpc/platforms/85xx/mpc85xx.h
3 *
4 * MPC85xx soc definitions/function decls
5 *
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
7 *
8 * Copyright 2005 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17extern void mpc85xx_restart(char *);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index acb1ef932240..378a244b3bac 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -30,7 +30,6 @@
30 30
31#include <sysdev/fsl_soc.h> 31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h> 32#include <sysdev/fsl_pci.h>
33#include "mpc85xx.h"
34 33
35#ifdef CONFIG_CPM2 34#ifdef CONFIG_CPM2
36#include <linux/fs_enet_pd.h> 35#include <linux/fs_enet_pd.h>
@@ -249,7 +248,7 @@ define_machine(mpc85xx_ads) {
249 .init_IRQ = mpc85xx_ads_pic_init, 248 .init_IRQ = mpc85xx_ads_pic_init,
250 .show_cpuinfo = mpc85xx_ads_show_cpuinfo, 249 .show_cpuinfo = mpc85xx_ads_show_cpuinfo,
251 .get_irq = mpic_get_irq, 250 .get_irq = mpic_get_irq,
252 .restart = mpc85xx_restart, 251 .restart = fsl_rstcr_restart,
253 .calibrate_decr = generic_calibrate_decr, 252 .calibrate_decr = generic_calibrate_decr,
254 .progress = udbg_progress, 253 .progress = udbg_progress,
255}; 254};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index abc85b8d9f8a..afe5868cd975 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -46,7 +46,6 @@
46 46
47#include <sysdev/fsl_soc.h> 47#include <sysdev/fsl_soc.h>
48#include <sysdev/fsl_pci.h> 48#include <sysdev/fsl_pci.h>
49#include "mpc85xx.h"
50 49
51static int cds_pci_slot = 2; 50static int cds_pci_slot = 2;
52static volatile u8 *cadmus; 51static volatile u8 *cadmus;
@@ -96,7 +95,7 @@ static void mpc85xx_cds_restart(char *cmd)
96 * If we can't find the VIA chip (maybe the P2P bridge is disabled) 95 * If we can't find the VIA chip (maybe the P2P bridge is disabled)
97 * or the VIA chip reset didn't work, just use the default reset. 96 * or the VIA chip reset didn't work, just use the default reset.
98 */ 97 */
99 mpc85xx_restart(NULL); 98 fsl_rstcr_restart(NULL);
100} 99}
101 100
102static void __init mpc85xx_cds_pci_irq_fixup(struct pci_dev *dev) 101static void __init mpc85xx_cds_pci_irq_fixup(struct pci_dev *dev)
@@ -343,7 +342,7 @@ define_machine(mpc85xx_cds) {
343 .restart = mpc85xx_cds_restart, 342 .restart = mpc85xx_cds_restart,
344 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 343 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
345#else 344#else
346 .restart = mpc85xx_restart, 345 .restart = fsl_rstcr_restart,
347#endif 346#endif
348 .calibrate_decr = generic_calibrate_decr, 347 .calibrate_decr = generic_calibrate_decr,
349 .progress = udbg_progress, 348 .progress = udbg_progress,
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index d60bb2beeb55..772e8de9310e 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -33,7 +33,6 @@
33 33
34#include <sysdev/fsl_soc.h> 34#include <sysdev/fsl_soc.h>
35#include <sysdev/fsl_pci.h> 35#include <sysdev/fsl_pci.h>
36#include "mpc85xx.h"
37 36
38#undef DEBUG 37#undef DEBUG
39 38
@@ -211,7 +210,7 @@ define_machine(mpc8544_ds) {
211 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 210 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
212#endif 211#endif
213 .get_irq = mpic_get_irq, 212 .get_irq = mpic_get_irq,
214 .restart = mpc85xx_restart, 213 .restart = fsl_rstcr_restart,
215 .calibrate_decr = generic_calibrate_decr, 214 .calibrate_decr = generic_calibrate_decr,
216 .progress = udbg_progress, 215 .progress = udbg_progress,
217}; 216};
@@ -225,7 +224,7 @@ define_machine(mpc8572_ds) {
225 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 224 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
226#endif 225#endif
227 .get_irq = mpic_get_irq, 226 .get_irq = mpic_get_irq,
228 .restart = mpc85xx_restart, 227 .restart = fsl_rstcr_restart,
229 .calibrate_decr = generic_calibrate_decr, 228 .calibrate_decr = generic_calibrate_decr,
230 .progress = udbg_progress, 229 .progress = udbg_progress,
231}; 230};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index f8b6b08af848..00f4c3aef78b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -50,8 +50,6 @@
50#include <asm/qe_ic.h> 50#include <asm/qe_ic.h>
51#include <asm/mpic.h> 51#include <asm/mpic.h>
52 52
53#include "mpc85xx.h"
54
55#undef DEBUG 53#undef DEBUG
56#ifdef DEBUG 54#ifdef DEBUG
57#define DBG(fmt...) udbg_printf(fmt) 55#define DBG(fmt...) udbg_printf(fmt)
@@ -200,7 +198,7 @@ define_machine(mpc85xx_mds) {
200 .setup_arch = mpc85xx_mds_setup_arch, 198 .setup_arch = mpc85xx_mds_setup_arch,
201 .init_IRQ = mpc85xx_mds_pic_init, 199 .init_IRQ = mpc85xx_mds_pic_init,
202 .get_irq = mpic_get_irq, 200 .get_irq = mpic_get_irq,
203 .restart = mpc85xx_restart, 201 .restart = fsl_rstcr_restart,
204 .calibrate_decr = generic_calibrate_decr, 202 .calibrate_decr = generic_calibrate_decr,
205 .progress = udbg_progress, 203 .progress = udbg_progress,
206#ifdef CONFIG_PCI 204#ifdef CONFIG_PCI
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index c794d88fa55f..6390895e5e92 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -37,8 +37,6 @@
37#include <sysdev/fsl_pci.h> 37#include <sysdev/fsl_pci.h>
38#include <sysdev/fsl_soc.h> 38#include <sysdev/fsl_soc.h>
39 39
40#define MPC86XX_RSTCR_OFFSET (0xe00b0) /* Reset Control Register */
41
42void __init 40void __init
43mpc86xx_hpcd_init_irq(void) 41mpc86xx_hpcd_init_irq(void)
44{ 42{
@@ -187,21 +185,6 @@ static int __init mpc86xx_hpcd_probe(void)
187 return 0; 185 return 0;
188} 186}
189 187
190void
191mpc86xx_restart(char *cmd)
192{
193 void __iomem *rstcr;
194
195 rstcr = ioremap(get_immrbase() + MPC86XX_RSTCR_OFFSET, 0x100);
196
197 local_irq_disable();
198
199 /* Assert reset request to Reset Control Register */
200 out_be32(rstcr, 0x2);
201
202 /* not reached */
203}
204
205long __init 188long __init
206mpc86xx_time_init(void) 189mpc86xx_time_init(void)
207{ 190{
@@ -225,7 +208,7 @@ define_machine(mpc86xx_hpcd) {
225 .setup_arch = mpc86xx_hpcd_setup_arch, 208 .setup_arch = mpc86xx_hpcd_setup_arch,
226 .init_IRQ = mpc86xx_hpcd_init_irq, 209 .init_IRQ = mpc86xx_hpcd_init_irq,
227 .get_irq = mpic_get_irq, 210 .get_irq = mpic_get_irq,
228 .restart = mpc86xx_restart, 211 .restart = fsl_rstcr_restart,
229 .time_init = mpc86xx_time_init, 212 .time_init = mpc86xx_time_init,
230 .calibrate_decr = generic_calibrate_decr, 213 .calibrate_decr = generic_calibrate_decr,
231 .progress = udbg_progress, 214 .progress = udbg_progress,
diff --git a/arch/powerpc/platforms/86xx/mpc8641_hpcn.h b/arch/powerpc/platforms/86xx/mpc8641_hpcn.h
deleted file mode 100644
index 41e554c4af94..000000000000
--- a/arch/powerpc/platforms/86xx/mpc8641_hpcn.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * MPC8641 HPCN board definitions
3 *
4 * Copyright 2006 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * Author: Xianghua Xiao <x.xiao@freescale.com>
12 */
13
14#ifndef __MPC8641_HPCN_H__
15#define __MPC8641_HPCN_H__
16
17#include <linux/init.h>
18
19#define MPC86XX_RSTCR_OFFSET (0xe00b0) /* Reset Control Register */
20
21#endif /* __MPC8641_HPCN_H__ */
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 6879b83ef95a..32a531aebcb7 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -35,7 +35,6 @@
35#include <sysdev/fsl_soc.h> 35#include <sysdev/fsl_soc.h>
36 36
37#include "mpc86xx.h" 37#include "mpc86xx.h"
38#include "mpc8641_hpcn.h"
39 38
40#undef DEBUG 39#undef DEBUG
41 40
@@ -196,23 +195,6 @@ static int __init mpc86xx_hpcn_probe(void)
196 return 0; 195 return 0;
197} 196}
198 197
199
200void
201mpc86xx_restart(char *cmd)
202{
203 void __iomem *rstcr;
204
205 rstcr = ioremap(get_immrbase() + MPC86XX_RSTCR_OFFSET, 0x100);
206
207 local_irq_disable();
208
209 /* Assert reset request to Reset Control Register */
210 out_be32(rstcr, 0x2);
211
212 /* not reached */
213}
214
215
216long __init 198long __init
217mpc86xx_time_init(void) 199mpc86xx_time_init(void)
218{ 200{
@@ -237,7 +219,7 @@ define_machine(mpc86xx_hpcn) {
237 .init_IRQ = mpc86xx_hpcn_init_irq, 219 .init_IRQ = mpc86xx_hpcn_init_irq,
238 .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo, 220 .show_cpuinfo = mpc86xx_hpcn_show_cpuinfo,
239 .get_irq = mpic_get_irq, 221 .get_irq = mpic_get_irq,
240 .restart = mpc86xx_restart, 222 .restart = fsl_rstcr_restart,
241 .time_init = mpc86xx_time_init, 223 .time_init = mpc86xx_time_init,
242 .calibrate_decr = generic_calibrate_decr, 224 .calibrate_decr = generic_calibrate_decr,
243 .progress = udbg_progress, 225 .progress = udbg_progress,