xref: /linux/arch/powerpc/platforms/83xx/misc.c (revision 14b42963f64b98ab61fa9723c03d71aa5ef4f862)
1 /*
2  * misc setup functions for MPC83xx
3  *
4  * Maintainer: Kumar Gala <galak@kernel.crashing.org>
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 
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 
15 #include <asm/io.h>
16 #include <asm/hw_irq.h>
17 #include <sysdev/fsl_soc.h>
18 
19 #include "mpc83xx.h"
20 
21 void mpc83xx_restart(char *cmd)
22 {
23 #define RST_OFFSET	0x00000900
24 #define RST_PROT_REG	0x00000018
25 #define RST_CTRL_REG	0x0000001c
26 	__be32 __iomem *reg;
27 
28 	/* map reset register space */
29 	reg = ioremap(get_immrbase() + 0x900, 0xff);
30 
31 	local_irq_disable();
32 
33 	/* enable software reset "RSTE" */
34 	out_be32(reg + (RST_PROT_REG >> 2), 0x52535445);
35 
36 	/* set software hard reset */
37 	out_be32(reg + (RST_CTRL_REG >> 2), 0x2);
38 	for (;;) ;
39 }
40 
41 long __init mpc83xx_time_init(void)
42 {
43 #define SPCR_OFFSET	0x00000110
44 #define SPCR_TBEN	0x00400000
45 	__be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);
46 	__be32 tmp;
47 
48 	tmp = in_be32(spcr);
49 	out_be32(spcr, tmp | SPCR_TBEN);
50 
51 	iounmap(spcr);
52 
53 	return 0;
54 }
55