Path: blob/master/arch/powerpc/platforms/83xx/misc.c
10819 views
/*1* misc setup functions for MPC83xx2*3* Maintainer: Kumar Gala <[email protected]>4*5* This program is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License as published by the7* Free Software Foundation; either version 2 of the License, or (at your8* option) any later version.9*/1011#include <linux/stddef.h>12#include <linux/kernel.h>1314#include <asm/io.h>15#include <asm/hw_irq.h>16#include <sysdev/fsl_soc.h>1718#include "mpc83xx.h"1920static __be32 __iomem *restart_reg_base;2122static int __init mpc83xx_restart_init(void)23{24/* map reset restart_reg_baseister space */25restart_reg_base = ioremap(get_immrbase() + 0x900, 0xff);2627return 0;28}2930arch_initcall(mpc83xx_restart_init);3132void mpc83xx_restart(char *cmd)33{34#define RST_OFFSET 0x0000090035#define RST_PROT_REG 0x0000001836#define RST_CTRL_REG 0x0000001c3738local_irq_disable();3940if (restart_reg_base) {41/* enable software reset "RSTE" */42out_be32(restart_reg_base + (RST_PROT_REG >> 2), 0x52535445);4344/* set software hard reset */45out_be32(restart_reg_base + (RST_CTRL_REG >> 2), 0x2);46} else {47printk (KERN_EMERG "Error: Restart registers not mapped, spinning!\n");48}4950for (;;) ;51}5253long __init mpc83xx_time_init(void)54{55#define SPCR_OFFSET 0x0000011056#define SPCR_TBEN 0x0040000057__be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);58__be32 tmp;5960tmp = in_be32(spcr);61out_be32(spcr, tmp | SPCR_TBEN);6263iounmap(spcr);6465return 0;66}676869