]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/mips/ar7/setup.c
Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspe...
[net-next-2.6.git] / arch / mips / ar7 / setup.c
CommitLineData
7ca5dc14
FF
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 */
7ca5dc14
FF
18#include <linux/init.h>
19#include <linux/ioport.h>
20#include <linux/pm.h>
21#include <linux/time.h>
22
23#include <asm/reboot.h>
24#include <asm/mach-ar7/ar7.h>
25#include <asm/mach-ar7/prom.h>
238dd317 26#include <asm/mach-ar7/gpio.h>
7ca5dc14
FF
27
28static void ar7_machine_restart(char *command)
29{
4d1da8c2
AC
30 u32 *softres_reg = ioremap(AR7_REGS_RESET + AR7_RESET_SOFTWARE, 1);
31
7ca5dc14
FF
32 writel(1, softres_reg);
33}
34
35static void ar7_machine_halt(void)
36{
37 while (1)
38 ;
39}
40
41static void ar7_machine_power_off(void)
42{
43 u32 *power_reg = (u32 *)ioremap(AR7_REGS_POWER, 1);
44 u32 power_state = readl(power_reg) | (3 << 30);
4d1da8c2 45
7ca5dc14
FF
46 writel(power_state, power_reg);
47 ar7_machine_halt();
48}
49
50const char *get_system_type(void)
51{
52 u16 chip_id = ar7_chip_id();
238dd317
FF
53 u16 titan_variant_id = titan_chip_id();
54
7ca5dc14 55 switch (chip_id) {
7ca5dc14
FF
56 case AR7_CHIP_7100:
57 return "TI AR7 (TNETD7100)";
58 case AR7_CHIP_7200:
59 return "TI AR7 (TNETD7200)";
4d1da8c2
AC
60 case AR7_CHIP_7300:
61 return "TI AR7 (TNETD7300)";
238dd317
FF
62 case AR7_CHIP_TITAN:
63 switch (titan_variant_id) {
64 case TITAN_CHIP_1050:
65 return "TI AR7 (TNETV1050)";
66 case TITAN_CHIP_1055:
67 return "TI AR7 (TNETV1055)";
68 case TITAN_CHIP_1056:
69 return "TI AR7 (TNETV1056)";
70 case TITAN_CHIP_1060:
71 return "TI AR7 (TNETV1060)";
72 }
7ca5dc14 73 default:
4d1da8c2 74 return "TI AR7 (unknown)";
7ca5dc14
FF
75 }
76}
77
78static int __init ar7_init_console(void)
79{
80 return 0;
81}
82console_initcall(ar7_init_console);
83
84/*
85 * Initializes basic routines and structures pointers, memory size (as
86 * given by the bios and saves the command line.
87 */
7ca5dc14
FF
88void __init plat_mem_setup(void)
89{
90 unsigned long io_base;
91
92 _machine_restart = ar7_machine_restart;
93 _machine_halt = ar7_machine_halt;
94 pm_power_off = ar7_machine_power_off;
95 panic_timeout = 3;
96
97 io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);
98 if (!io_base)
99 panic("Can't remap IO base!\n");
100 set_io_port_base(io_base);
101
102 prom_meminit();
103
104 printk(KERN_INFO "%s, ID: 0x%04x, Revision: 0x%02x\n",
4d1da8c2 105 get_system_type(), ar7_chip_id(), ar7_chip_rev());
7ca5dc14 106}