3 * Copyright (c) 1999-2000 Grant Erickson <grant@lcse.umn.edu>
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
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>
28 #include <asm/bootinfo.h>
29 #include <asm/ppc4xx_pic.h>
34 /* Function Prototypes */
36 extern void abort(void);
38 /* Global Variables */
40 unsigned char __res
[sizeof(bd_t
)];
44 * void __init oak_init()
50 * r3 - Optional pointer to a board information structure.
51 * r4 - Optional pointer to the physical starting address of the init RAM
53 * r5 - Optional pointer to the physical ending address of the init RAM
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.
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
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.
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. */
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() */
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
;
124 /* XXX - Implement me */
128 * int oak_show_percpuinfo()
131 * This routine pretty-prints the platform's internal CPU and bus clock
132 * frequencies into the buffer for usage in /proc/cpuinfo.
135 * *buffer - Buffer into which CPU and bus clock frequencies are to be
139 * *buffer - Buffer with the CPU and bus clock frequencies.
142 * The number of bytes copied into 'buffer' if OK, otherwise zero or less
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);
162 oak_restart(char *cmd
)
191 /* XXX - Implement me */
199 oak_set_rtc_time(unsigned long time
)
201 /* XXX - Implement me */
210 oak_get_rtc_time(void)
212 /* XXX - Implement me */
218 * void __init oak_calibrate_decr()
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.
237 oak_calibrate_decr(void)
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
);