Kumar Gala | 30f5933 | 2006-02-02 13:50:44 -0600 | [diff] [blame] | 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/config.h> |
| 13 | #include <linux/stddef.h> |
| 14 | #include <linux/kernel.h> |
| 15 | |
| 16 | #include <asm/io.h> |
| 17 | #include <asm/hw_irq.h> |
| 18 | #include <sysdev/fsl_soc.h> |
| 19 | |
| 20 | #include "mpc83xx.h" |
| 21 | |
| 22 | void mpc83xx_restart(char *cmd) |
| 23 | { |
| 24 | #define RST_OFFSET 0x00000900 |
| 25 | #define RST_PROT_REG 0x00000018 |
| 26 | #define RST_CTRL_REG 0x0000001c |
| 27 | __be32 __iomem *reg; |
| 28 | |
| 29 | /* map reset register space */ |
| 30 | reg = ioremap(get_immrbase() + 0x900, 0xff); |
| 31 | |
| 32 | local_irq_disable(); |
| 33 | |
| 34 | /* enable software reset "RSTE" */ |
| 35 | out_be32(reg + (RST_PROT_REG >> 2), 0x52535445); |
| 36 | |
| 37 | /* set software hard reset */ |
Kumar Gala | 8b0d551 | 2006-02-16 14:32:08 -0600 | [diff] [blame^] | 38 | out_be32(reg + (RST_CTRL_REG >> 2), 0x2); |
Kumar Gala | 30f5933 | 2006-02-02 13:50:44 -0600 | [diff] [blame] | 39 | for (;;) ; |
| 40 | } |
| 41 | |
| 42 | long __init mpc83xx_time_init(void) |
| 43 | { |
| 44 | #define SPCR_OFFSET 0x00000110 |
| 45 | #define SPCR_TBEN 0x00400000 |
| 46 | __be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4); |
| 47 | __be32 tmp; |
| 48 | |
| 49 | tmp = in_be32(spcr); |
| 50 | out_be32(spcr, tmp | SPCR_TBEN); |
| 51 | |
| 52 | iounmap(spcr); |
| 53 | |
| 54 | return 0; |
| 55 | } |