Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / ppc / platforms / 4xx / oak.c
blobfa25ee1fa733f3722fe310a0afb5618503005089
1 /*
3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
5 * Module name: oak.c
7 * Description:
8 * Architecture- / platform-specific boot-time initialization code for
9 * the IBM PowerPC 403GCX "Oak" evaluation board. Adapted from original
10 * code by Gary Thomas, Cort Dougan <cort@fsmlabs.com>, and Dan Malek
11 * <dan@net4x.com>.
15 #include <linux/config.h>
16 #include <linux/init.h>
17 #include <linux/smp.h>
18 #include <linux/threads.h>
19 #include <linux/param.h>
20 #include <linux/string.h>
21 #include <linux/initrd.h>
22 #include <linux/irq.h>
23 #include <linux/seq_file.h>
25 #include <asm/board.h>
26 #include <asm/machdep.h>
27 #include <asm/page.h>
28 #include <asm/bootinfo.h>
29 #include <asm/ppc4xx_pic.h>
30 #include <asm/time.h>
32 #include "oak.h"
34 /* Function Prototypes */
36 extern void abort(void);
38 /* Global Variables */
40 unsigned char __res[sizeof(bd_t)];
44 * void __init oak_init()
46 * Description:
47 * This routine...
49 * Input(s):
50 * r3 - Optional pointer to a board information structure.
51 * r4 - Optional pointer to the physical starting address of the init RAM
52 * disk.
53 * r5 - Optional pointer to the physical ending address of the init RAM
54 * disk.
55 * r6 - Optional pointer to the physical starting address of any kernel
56 * command-line parameters.
57 * r7 - Optional pointer to the physical ending address of any kernel
58 * command-line parameters.
60 * Output(s):
61 * N/A
63 * Returns:
64 * N/A
67 void __init
68 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
69 unsigned long r6, unsigned long r7)
71 parse_bootinfo(find_bootinfo());
74 * If we were passed in a board information, copy it into the
75 * residual data area.
77 if (r3) {
78 memcpy((void *)__res, (void *)(r3 + KERNELBASE), sizeof(bd_t));
81 #if defined(CONFIG_BLK_DEV_INITRD)
83 * If the init RAM disk has been configured in, and there's a valid
84 * starting address for it, set it up.
86 if (r4) {
87 initrd_start = r4 + KERNELBASE;
88 initrd_end = r5 + KERNELBASE;
90 #endif /* CONFIG_BLK_DEV_INITRD */
92 /* Copy the kernel command line arguments to a safe place. */
94 if (r6) {
95 *(char *)(r7 + KERNELBASE) = 0;
96 strcpy(cmd_line, (char *)(r6 + KERNELBASE));
99 /* Initialize machine-dependency vectors */
101 ppc_md.setup_arch = oak_setup_arch;
102 ppc_md.show_percpuinfo = oak_show_percpuinfo;
103 ppc_md.irq_canonicalize = NULL;
104 ppc_md.init_IRQ = ppc4xx_pic_init;
105 ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
106 ppc_md.init = NULL;
108 ppc_md.restart = oak_restart;
109 ppc_md.power_off = oak_power_off;
110 ppc_md.halt = oak_halt;
112 ppc_md.time_init = oak_time_init;
113 ppc_md.set_rtc_time = oak_set_rtc_time;
114 ppc_md.get_rtc_time = oak_get_rtc_time;
115 ppc_md.calibrate_decr = oak_calibrate_decr;
119 * Document me.
121 void __init
122 oak_setup_arch(void)
124 /* XXX - Implement me */
128 * int oak_show_percpuinfo()
130 * Description:
131 * This routine pretty-prints the platform's internal CPU and bus clock
132 * frequencies into the buffer for usage in /proc/cpuinfo.
134 * Input(s):
135 * *buffer - Buffer into which CPU and bus clock frequencies are to be
136 * printed.
138 * Output(s):
139 * *buffer - Buffer with the CPU and bus clock frequencies.
141 * Returns:
142 * The number of bytes copied into 'buffer' if OK, otherwise zero or less
143 * on error.
146 oak_show_percpuinfo(struct seq_file *m, int i)
148 bd_t *bp = (bd_t *)__res;
150 seq_printf(m, "clock\t\t: %dMHz\n"
151 "bus clock\t\t: %dMHz\n",
152 bp->bi_intfreq / 1000000,
153 bp->bi_busfreq / 1000000);
155 return 0;
159 * Document me.
161 void
162 oak_restart(char *cmd)
164 abort();
168 * Document me.
170 void
171 oak_power_off(void)
173 oak_restart(NULL);
177 * Document me.
179 void
180 oak_halt(void)
182 oak_restart(NULL);
186 * Document me.
188 long __init
189 oak_time_init(void)
191 /* XXX - Implement me */
192 return 0;
196 * Document me.
198 int __init
199 oak_set_rtc_time(unsigned long time)
201 /* XXX - Implement me */
203 return (0);
207 * Document me.
209 unsigned long __init
210 oak_get_rtc_time(void)
212 /* XXX - Implement me */
214 return (0);
218 * void __init oak_calibrate_decr()
220 * Description:
221 * This routine retrieves the internal processor frequency from the board
222 * information structure, sets up the kernel timer decrementer based on
223 * that value, enables the 403 programmable interval timer (PIT) and sets
224 * it up for auto-reload.
226 * Input(s):
227 * N/A
229 * Output(s):
230 * N/A
232 * Returns:
233 * N/A
236 void __init
237 oak_calibrate_decr(void)
239 unsigned int freq;
240 bd_t *bip = (bd_t *)__res;
242 freq = bip->bi_intfreq;
244 decrementer_count = freq / HZ;
245 count_period_num = 1;
246 count_period_den = freq;
248 /* Enable the PIT and set auto-reload of its value */
250 mtspr(SPRN_TCR, TCR_PIE | TCR_ARE);
252 /* Clear any pending timer interrupts */
254 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_PIS | TSR_FIS);