• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/arch/powerpc/platforms/83xx/
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
21static __be32 __iomem *restart_reg_base;
22
23static int __init mpc83xx_restart_init(void)
24{
25	/* map reset restart_reg_baseister space */
26	restart_reg_base = ioremap(get_immrbase() + 0x900, 0xff);
27
28	return 0;
29}
30
31arch_initcall(mpc83xx_restart_init);
32
33void mpc83xx_restart(char *cmd)
34{
35#define RST_OFFSET	0x00000900
36#define RST_PROT_REG	0x00000018
37#define RST_CTRL_REG	0x0000001c
38
39	local_irq_disable();
40
41	if (restart_reg_base) {
42		/* enable software reset "RSTE" */
43		out_be32(restart_reg_base + (RST_PROT_REG >> 2), 0x52535445);
44
45		/* set software hard reset */
46		out_be32(restart_reg_base + (RST_CTRL_REG >> 2), 0x2);
47	} else {
48		printk (KERN_EMERG "Error: Restart registers not mapped, spinning!\n");
49	}
50
51	for (;;) ;
52}
53
54long __init mpc83xx_time_init(void)
55{
56#define SPCR_OFFSET	0x00000110
57#define SPCR_TBEN	0x00400000
58	__be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);
59	__be32 tmp;
60
61	tmp = in_be32(spcr);
62	out_be32(spcr, tmp | SPCR_TBEN);
63
64	iounmap(spcr);
65
66	return 0;
67}
68