blob: 3da47d9ec7a2d8fce1df6a4dbed0324383195aae [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * Board setup routines for the SBS PalomarIV.
3 *
4 * Author: Dan Cox
5 *
6 * 2002 (c) MontaVista, Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/types.h>
15#include <linux/errno.h>
16#include <linux/reboot.h>
17#include <linux/time.h>
18#include <linux/irq.h>
19#include <linux/kdev_t.h>
20#include <linux/initrd.h>
21#include <linux/console.h>
22#include <linux/seq_file.h>
23#include <linux/root_dev.h>
24
25#include <asm/io.h>
26#include <asm/todc.h>
27#include <asm/bootinfo.h>
Paul Mackerrasfd582ec2005-10-11 22:08:12 +100028#include <asm/machdep.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
30#include <syslib/cpc700.h>
31
32#include "pal4.h"
33
34extern void pal4_find_bridges(void);
35
36unsigned int cpc700_irq_assigns[][2] = {
37 {1, 1}, /* IRQ 0: ECC correctable error */
38 {1, 1}, /* IRQ 1: PCI write to memory range */
39 {0, 1}, /* IRQ 2: PCI write to command register */
40 {0, 1}, /* IRQ 3: UART 0 */
41 {0, 1}, /* IRQ 4: UART 1 */
42 {0, 1}, /* IRQ 5: ICC 0 */
43 {0, 1}, /* IRQ 6: ICC 1 */
44 {0, 1}, /* IRQ 7: GPT compare 0 */
45 {0, 1}, /* IRQ 8: GPT compare 1 */
46 {0, 1}, /* IRQ 9: GPT compare 2 */
47 {0, 1}, /* IRQ 10: GPT compare 3 */
48 {0, 1}, /* IRQ 11: GPT compare 4 */
49 {0, 1}, /* IRQ 12: GPT capture 0 */
50 {0, 1}, /* IRQ 13: GPT capture 1 */
51 {0, 1}, /* IRQ 14: GPT capture 2 */
52 {0, 1}, /* IRQ 15: GPT capture 3 */
53 {0, 1}, /* IRQ 16: GPT capture 4 */
54 {0, 0}, /* IRQ 17: reserved */
55 {0, 0}, /* IRQ 18: reserved */
56 {0, 0}, /* IRQ 19: reserved */
57 {0, 0}, /* IRQ 20: reserved */
58 {0, 1}, /* IRQ 21: Ethernet */
59 {0, 0}, /* IRQ 22: reserved */
60 {0, 0}, /* IRQ 23: reserved */
61 {0, 0}, /* IRQ 24: resreved */
62 {0, 0}, /* IRQ 25: reserved */
63 {0, 0}, /* IRQ 26: reserved */
64 {0, 0}, /* IRQ 27: reserved */
65 {0, 0}, /* IRQ 28: reserved */
66 {0, 0}, /* IRQ 29: reserved */
67 {0, 0}, /* IRQ 30: reserved */
68 {0, 0}, /* IRQ 31: reserved */
69};
70
71static int
72pal4_show_cpuinfo(struct seq_file *m)
73{
74 seq_printf(m, "board\t\t: SBS Palomar IV\n");
75
76 return 0;
77}
78
79static void
80pal4_restart(char *cmd)
81{
82 local_irq_disable();
83 __asm__ __volatile__("lis 3,0xfff0\n \
84 ori 3,3,0x100\n \
85 mtspr 26,3\n \
86 li 3,0\n \
87 mtspr 27,3\n \
88 rfi");
89
90 for(;;);
91}
92
93static void
94pal4_power_off(void)
95{
96 local_irq_disable();
97 for(;;);
98}
99
100static void
101pal4_halt(void)
102{
103 pal4_power_off();
104}
105
106TODC_ALLOC();
107
108static void __init
109pal4_setup_arch(void)
110{
111 unsigned long l2;
112
113 TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
114 ioremap(PAL4_NVRAM, PAL4_NVRAM_SIZE), 8);
115
116 pal4_find_bridges();
117
118#ifdef CONFIG_BLK_DEV_INITRD
119 if (initrd_start)
120 ROOT_DEV = Root_RAM0;
121 else
122#endif
123 ROOT_DEV = Root_NFS;
124
125 /* The L2 gets disabled in the bootloader, but all the proper
126 bits should be present from the fw, so just re-enable it */
127 l2 = _get_L2CR();
128 if (!(l2 & L2CR_L2E)) {
129 /* presume that it was initially set if the size is
130 still present. */
131 if (l2 ^ L2CR_L2SIZ_MASK)
132 _set_L2CR(l2 | L2CR_L2E);
133 else
134 printk("L2 not set by firmware; left disabled.\n");
135 }
136}
137
138static void __init
139pal4_map_io(void)
140{
141 io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
142}
143
144void __init
145platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
146 unsigned long r6, unsigned long r7)
147{
148 parse_bootinfo(find_bootinfo());
149
150 isa_io_base = 0 /*PAL4_ISA_IO_BASE*/;
151 pci_dram_offset = 0 /*PAL4_PCI_SYS_MEM_BASE*/;
152
153 ppc_md.setup_arch = pal4_setup_arch;
154 ppc_md.show_cpuinfo = pal4_show_cpuinfo;
155
156 ppc_md.setup_io_mappings = pal4_map_io;
157
158 ppc_md.init_IRQ = cpc700_init_IRQ;
159 ppc_md.get_irq = cpc700_get_irq;
160
161 ppc_md.restart = pal4_restart;
162 ppc_md.halt = pal4_halt;
163 ppc_md.power_off = pal4_power_off;
164
165 ppc_md.time_init = todc_time_init;
166 ppc_md.set_rtc_time = todc_set_rtc_time;
167 ppc_md.get_rtc_time = todc_get_rtc_time;
168 ppc_md.calibrate_decr = todc_calibrate_decr;
169
170 ppc_md.nvram_read_val = todc_direct_read_val;
171 ppc_md.nvram_write_val = todc_direct_write_val;
172}
173