diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-10-04 02:04:57 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-10-08 09:38:47 -0400 |
commit | e1c1575f831ab2165732037e6d664010a0149730 (patch) | |
tree | ecfc90b06eb4b7402a3334ebe6b8287e73abc671 /arch/powerpc/sysdev | |
parent | c9438affcb7ac0dda4c6c6961637fb272f7c32d4 (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/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 38 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.h | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index c765d7a5217b..be5e0bda2318 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -1298,3 +1298,41 @@ err: | |||
1298 | 1298 | ||
1299 | return spi_register_board_info(board_infos, num_board_infos); | 1299 | return spi_register_board_info(board_infos, num_board_infos); |
1300 | } | 1300 | } |
1301 | |||
1302 | #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) | ||
1303 | static __be32 __iomem *rstcr; | ||
1304 | |||
1305 | static int __init setup_rstcr(void) | ||
1306 | { | ||
1307 | struct device_node *np; | ||
1308 | np = of_find_node_by_name(NULL, "global-utilities"); | ||
1309 | if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) { | ||
1310 | const u32 *prop = of_get_property(np, "reg", NULL); | ||
1311 | if (prop) { | ||
1312 | /* map reset control register | ||
1313 | * 0xE00B0 is offset of reset control register | ||
1314 | */ | ||
1315 | rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff); | ||
1316 | if (!rstcr) | ||
1317 | printk (KERN_EMERG "Error: reset control " | ||
1318 | "register not mapped!\n"); | ||
1319 | } | ||
1320 | } else | ||
1321 | printk (KERN_INFO "rstcr compatible register does not exist!\n"); | ||
1322 | if (np) | ||
1323 | of_node_put(np); | ||
1324 | return 0; | ||
1325 | } | ||
1326 | |||
1327 | arch_initcall(setup_rstcr); | ||
1328 | |||
1329 | void fsl_rstcr_restart(char *cmd) | ||
1330 | { | ||
1331 | local_irq_disable(); | ||
1332 | if (rstcr) | ||
1333 | /* set reset control register */ | ||
1334 | out_be32(rstcr, 0x2); /* HRESET_REQ */ | ||
1335 | |||
1336 | while (1) ; | ||
1337 | } | ||
1338 | #endif | ||
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h index 618d91d1e103..63e7db30a4cd 100644 --- a/arch/powerpc/sysdev/fsl_soc.h +++ b/arch/powerpc/sysdev/fsl_soc.h | |||
@@ -15,5 +15,6 @@ extern int fsl_spi_init(struct spi_board_info *board_infos, | |||
15 | void (*activate_cs)(u8 cs, u8 polarity), | 15 | void (*activate_cs)(u8 cs, u8 polarity), |
16 | void (*deactivate_cs)(u8 cs, u8 polarity)); | 16 | void (*deactivate_cs)(u8 cs, u8 polarity)); |
17 | 17 | ||
18 | extern void fsl_rstcr_restart(char *cmd); | ||
18 | #endif | 19 | #endif |
19 | #endif | 20 | #endif |