Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / arch / ppc / kernel / m8260_setup.c
blob6e006a8677f5b050b7a172f11a20867671a2480d
1 /*
2 * $Id: m8xx_setup.c,v 1.4 1999/09/18 18:40:36 dmalek Exp $
4 * linux/arch/ppc/kernel/setup.c
6 * Copyright (C) 1995 Linus Torvalds
7 * Adapted from 'alpha' version by Gary Thomas
8 * Modified by Cort Dougan (cort@cs.nmt.edu)
9 * Modified for MBX using prep/chrp/pmac functions by Dan (dmalek@jlc.net)
10 * Further modified for generic 8xx and 8260 by Dan.
14 * bootup setup stuff..
17 #include <linux/config.h>
18 #include <linux/errno.h>
19 #include <linux/sched.h>
20 #include <linux/kernel.h>
21 #include <linux/mm.h>
22 #include <linux/stddef.h>
23 #include <linux/unistd.h>
24 #include <linux/ptrace.h>
25 #include <linux/malloc.h>
26 #include <linux/user.h>
27 #include <linux/a.out.h>
28 #include <linux/tty.h>
29 #include <linux/major.h>
30 #include <linux/interrupt.h>
31 #include <linux/reboot.h>
32 #include <linux/init.h>
33 #include <linux/blk.h>
34 #include <linux/ioport.h>
35 #include <linux/ide.h>
37 #include <asm/mmu.h>
38 #include <asm/processor.h>
39 #include <asm/residual.h>
40 #include <asm/io.h>
41 #include <asm/pgtable.h>
42 #include <asm/ide.h>
43 #include <asm/mpc8260.h>
44 #include <asm/immap_8260.h>
45 #include <asm/machdep.h>
47 #include <asm/time.h>
48 #include "ppc8260_pic.h"
50 static int m8260_set_rtc_time(unsigned long time);
51 unsigned long m8260_get_rtc_time(void);
52 void m8260_calibrate_decr(void);
54 #if 0
55 extern int mackbd_setkeycode(unsigned int scancode, unsigned int keycode);
56 extern int mackbd_getkeycode(unsigned int scancode);
57 extern int mackbd_pretranslate(unsigned char scancode, char raw_mode);
58 extern int mackbd_translate(unsigned char scancode, unsigned char *keycode,
59 char raw_mode);
60 extern char mackbd_unexpected_up(unsigned char keycode);
61 extern void mackbd_leds(unsigned char leds);
62 extern void mackbd_init_hw(void);
63 #endif
65 extern unsigned long loops_per_sec;
67 unsigned char __res[sizeof(bd_t)];
68 unsigned long empty_zero_page[1024];
70 #ifdef CONFIG_BLK_DEV_RAM
71 extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */
72 extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */
73 extern int rd_image_start; /* starting block # of image */
74 #endif
76 extern char saved_command_line[256];
78 extern unsigned long find_available_memory(void);
79 extern void m8260_cpm_reset(void);
81 void __init adbdev_init(void)
85 void __init
86 m8260_setup_arch(void)
88 extern char cmd_line[];
90 printk("Boot arguments: %s\n", cmd_line);
92 /* Reset the Communication Processor Module.
94 m8260_cpm_reset();
97 void
98 abort(void)
100 #ifdef CONFIG_XMON
101 extern void xmon(void *);
102 xmon(0);
103 #endif
104 machine_restart(NULL);
107 /* The decrementer counts at the system (internal) clock frequency
108 * divided by four.
110 void __init m8260_calibrate_decr(void)
112 bd_t *binfo = (bd_t *)__res;
113 int freq, divisor;
115 freq = (binfo->bi_busfreq * 1000000);
116 divisor = 4;
117 tb_ticks_per_jiffy = freq / HZ / divisor;
118 tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
121 /* The 8260 has an internal 1-second timer update register that
122 * we should use for this purpose.
124 static uint rtc_time;
125 static int
126 m8260_set_rtc_time(unsigned long time)
128 rtc_time = time;
129 return(0);
132 unsigned long __init
133 m8260_get_rtc_time(void)
136 /* Get time from the RTC.
138 return((unsigned long)rtc_time);
141 void
142 m8260_restart(char *cmd)
144 extern void m8260_gorom(bd_t *bi, uint addr);
145 uint startaddr;
147 /* Most boot roms have a warmstart as the second instruction
148 * of the reset vector. If that doesn't work for you, change this
149 * or the reboot program to send a proper address.
151 startaddr = 0xff000104;
153 if (cmd != NULL) {
154 if (!strncmp(cmd, "startaddr=", 10))
155 startaddr = simple_strtoul(&cmd[10], NULL, 0);
158 m8260_gorom((uint)__pa(__res), startaddr);
161 void
162 m8260_power_off(void)
164 m8260_restart(NULL);
167 void
168 m8260_halt(void)
170 m8260_restart(NULL);
174 int m8260_setup_residual(char *buffer)
176 int len = 0;
177 bd_t *bp;
179 bp = (bd_t *)__res;
181 len += sprintf(len+buffer,"core clock\t: %d MHz\n"
182 "CPM clock\t: %d MHz\n"
183 "bus clock\t: %d MHz\n",
184 bp->bi_intfreq /*/ 1000000*/,
185 bp->bi_cpmfreq /*/ 1000000*/,
186 bp->bi_busfreq /*/ 1000000*/);
188 return len;
191 /* Initialize the internal interrupt controller. The number of
192 * interrupts supported can vary with the processor type, and the
193 * 8260 family can have up to 64.
194 * External interrupts can be either edge or level triggered, and
195 * need to be initialized by the appropriate driver.
197 void __init
198 m8260_init_IRQ(void)
200 int i;
201 void cpm_interrupt_init(void);
203 #if 0
204 ppc8260_pic.irq_offset = 0;
205 #endif
206 for ( i = 0 ; i < NR_SIU_INTS ; i++ )
207 irq_desc[i].handler = &ppc8260_pic;
209 /* Initialize the default interrupt mapping priorities,
210 * in case the boot rom changed something on us.
212 immr->im_intctl.ic_sicr = 0;
213 immr->im_intctl.ic_siprr = 0x05309770;
214 immr->im_intctl.ic_scprrh = 0x05309770;
215 immr->im_intctl.ic_scprrl = 0x05309770;
220 void __init
221 m8260_init(unsigned long r3, unsigned long r4, unsigned long r5,
222 unsigned long r6, unsigned long r7)
225 if ( r3 )
226 memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) );
228 #ifdef CONFIG_BLK_DEV_INITRD
229 /* take care of initrd if we have one */
230 if ( r4 )
232 initrd_start = r4 + KERNELBASE;
233 initrd_end = r5 + KERNELBASE;
235 #endif /* CONFIG_BLK_DEV_INITRD */
236 /* take care of cmd line */
237 if ( r6 )
240 *(char *)(r7+KERNELBASE) = 0;
241 strcpy(cmd_line, (char *)(r6+KERNELBASE));
244 ppc_md.setup_arch = m8260_setup_arch;
245 ppc_md.setup_residual = m8260_setup_residual;
246 ppc_md.get_cpuinfo = NULL;
247 ppc_md.irq_cannonicalize = NULL;
248 ppc_md.init_IRQ = m8260_init_IRQ;
249 ppc_md.get_irq = m8260_get_irq;
250 ppc_md.init = NULL;
252 ppc_md.restart = m8260_restart;
253 ppc_md.power_off = m8260_power_off;
254 ppc_md.halt = m8260_halt;
256 ppc_md.time_init = NULL;
257 ppc_md.set_rtc_time = m8260_set_rtc_time;
258 ppc_md.get_rtc_time = m8260_get_rtc_time;
259 ppc_md.calibrate_decr = m8260_calibrate_decr;
261 #if 0
262 ppc_md.kbd_setkeycode = pckbd_setkeycode;
263 ppc_md.kbd_getkeycode = pckbd_getkeycode;
264 ppc_md.kbd_pretranslate = pckbd_pretranslate;
265 ppc_md.kbd_translate = pckbd_translate;
266 ppc_md.kbd_unexpected_up = pckbd_unexpected_up;
267 ppc_md.kbd_leds = pckbd_leds;
268 ppc_md.kbd_init_hw = pckbd_init_hw;
269 #ifdef CONFIG_MAGIC_SYSRQ
270 ppc_md.kbd_sysrq_xlate = pckbd_sysrq_xlate;
271 #endif
272 #else
273 ppc_md.kbd_setkeycode = NULL;
274 ppc_md.kbd_getkeycode = NULL;
275 ppc_md.kbd_translate = NULL;
276 ppc_md.kbd_unexpected_up = NULL;
277 ppc_md.kbd_leds = NULL;
278 ppc_md.kbd_init_hw = NULL;
279 #ifdef CONFIG_MAGIC_SYSRQ
280 ppc_md.kbd_sysrq_xlate = NULL;
281 #endif
282 #endif
284 #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
285 ppc_ide_md.insw = m8xx_ide_insw;
286 ppc_ide_md.outsw = m8xx_ide_outsw;
287 ppc_ide_md.default_irq = m8xx_ide_default_irq;
288 ppc_ide_md.default_io_base = m8xx_ide_default_io_base;
289 ppc_ide_md.check_region = m8xx_ide_check_region;
290 ppc_ide_md.request_region = m8xx_ide_request_region;
291 ppc_ide_md.release_region = m8xx_ide_release_region;
292 ppc_ide_md.fix_driveid = m8xx_ide_fix_driveid;
293 ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports;
294 ppc_ide_md.ide_request_irq = m8xx_ide_request_irq;
296 ppc_ide_md.io_base = _IO_BASE;
297 #endif
300 void
301 prom_init(uint r3, uint r4, uint r5, uint r6)
303 /* Nothing to do now, but we are called immediatedly upon
304 * kernel start up with MMU disabled, so if there is
305 * anything we need to do......
309 /* Mainly for ksyms.
312 request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
313 unsigned long flag, const char *naem, void *dev)
315 panic("request IRQ\n");