1/*
2 * Setup pointers to hardware dependent routines.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License.  See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1997 by Ralf Baechle
9 * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
10 *
11 */
12
13#include <linux/config.h>
14#include <linux/interrupt.h>
15#include <linux/pci.h>
16#include <linux/mc146818rtc.h>
17#include <linux/init.h>
18#include <linux/ide.h>
19
20#include <asm/bootinfo.h>
21#include <asm/time.h>
22#include <asm/io.h>
23#include <asm/irq.h>
24#include <asm/cobalt/cobalt.h>
25#include <asm/pci.h>
26#include <asm/processor.h>
27#include <asm/reboot.h>
28#include <asm/traps.h>
29
30extern void cobalt_machine_restart(char *command);
31extern void cobalt_machine_halt(void);
32extern void cobalt_machine_power_off(void);
33
34extern struct rtc_ops std_rtc_ops;
35extern struct ide_ops std_ide_ops;
36
37
38char arcs_cmdline[CL_SIZE] = {
39 "console=ttyS0,115200 "
40#ifdef CONFIG_IP_PNP
41 "ip=on "
42#endif
43#ifdef CONFIG_ROOT_NFS
44 "root=/dev/nfs "
45#else
46 "root=/dev/hda1 "
47#endif
48 };
49
50const char *get_system_type(void)
51{
52	return "MIPS Cobalt";
53}
54
55
56#define GALILEO_T0_VAL		0xb4000850
57#define GALILEO_TIMER_CTRL	0xb4000864
58#define GALILEO_CPU_MASK	0xb4000c1c
59
60#define GALILEO_ENTC0		0x01
61#define GALILEO_SELTC0		0x02
62
63static void __init cobalt_time_init(void)
64{
65	rtc_ops = &std_rtc_ops;
66}
67
68static void __init cobalt_timer_setup(struct irqaction *irq)
69{
70	/* Load timer value for 150 Hz */
71	volatile unsigned long *timer_reg = (volatile unsigned long *)GALILEO_T0_VAL;
72
73	*timer_reg = 500000;
74
75	/* Register our timer interrupt */
76	setup_irq(COBALT_TIMER_IRQ, irq);
77
78	/* Enable timer ints */
79	*((volatile unsigned long *) GALILEO_TIMER_CTRL) =
80			(unsigned long) (GALILEO_ENTC0 | GALILEO_SELTC0);
81	/* Unmask timer int */
82	*((volatile unsigned long *) GALILEO_CPU_MASK) = (unsigned long) 0x00000100;
83}
84
85
86void __init bus_error_init(void) { /* nothing */ }
87
88
89void __init cobalt_setup(void)
90{
91
92	_machine_restart = cobalt_machine_restart;
93	_machine_halt = cobalt_machine_halt;
94	_machine_power_off = cobalt_machine_power_off;
95
96	board_time_init = cobalt_time_init;
97	board_timer_setup = cobalt_timer_setup;
98
99#ifdef CONFIG_BLK_DEV_IDE
100	ide_ops = &std_ide_ops;
101#endif
102
103        set_io_port_base(KSEG1ADDR(0x10000000));
104
105	/*
106	 * This is a prom style console. We just poke at the
107	 *  UART to make it talk.
108	 * Only use this console if you really screw up and can't
109	 *  get to the stage of setting up a real serial console.
110	 */
111	/*ns16550_setup_console();*/
112}
113
114/* Prom init. We read our one and only communication with the
115    firmware. Grab the amount of installed memory */
116void __init prom_init(int argc)
117{
118	mips_machgroup = MACH_GROUP_COBALT;
119
120	add_memory_region(0x0, argc & 0x7fffffff, BOOT_MEM_RAM);
121}
122
123void __init prom_free_prom_memory(void)
124{
125	/* Nothing to do! */
126}
127