xref: /openbmc/u-boot/arch/powerpc/lib/bootm.c (revision eef1cf2d5cf1cae5fb76713e912263dedf110aeb)
1a47a12beSStefan Roese /*
2a47a12beSStefan Roese  * (C) Copyright 2008 Semihalf
3a47a12beSStefan Roese  *
4a47a12beSStefan Roese  * (C) Copyright 2000-2006
5a47a12beSStefan Roese  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6a47a12beSStefan Roese  *
7a47a12beSStefan Roese  * See file CREDITS for list of people who contributed to this
8a47a12beSStefan Roese  * project.
9a47a12beSStefan Roese  *
10a47a12beSStefan Roese  * This program is free software; you can redistribute it and/or
11a47a12beSStefan Roese  * modify it under the terms of the GNU General Public License as
12a47a12beSStefan Roese  * published by the Free Software Foundation; either version 2 of
13a47a12beSStefan Roese  * the License, or (at your option) any later version.
14a47a12beSStefan Roese  *
15a47a12beSStefan Roese  * This program is distributed in the hope that it will be useful,
16a47a12beSStefan Roese  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17a47a12beSStefan Roese  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18a47a12beSStefan Roese  * GNU General Public License for more details.
19a47a12beSStefan Roese  *
20a47a12beSStefan Roese  * You should have received a copy of the GNU General Public License
21a47a12beSStefan Roese  * along with this program; if not, write to the Free Software
22a47a12beSStefan Roese  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23a47a12beSStefan Roese  * MA 02111-1307 USA
24a47a12beSStefan Roese  */
25a47a12beSStefan Roese 
26a47a12beSStefan Roese 
27a47a12beSStefan Roese #include <common.h>
28a47a12beSStefan Roese #include <watchdog.h>
29a47a12beSStefan Roese #include <command.h>
30a47a12beSStefan Roese #include <image.h>
31a47a12beSStefan Roese #include <malloc.h>
32a47a12beSStefan Roese #include <u-boot/zlib.h>
33a47a12beSStefan Roese #include <bzlib.h>
34a47a12beSStefan Roese #include <environment.h>
35a47a12beSStefan Roese #include <asm/byteorder.h>
36561e710aSKumar Gala #include <asm/mp.h>
37a47a12beSStefan Roese 
38a47a12beSStefan Roese #if defined(CONFIG_OF_LIBFDT)
39a47a12beSStefan Roese #include <fdt.h>
40a47a12beSStefan Roese #include <libfdt.h>
41a47a12beSStefan Roese #include <fdt_support.h>
42a47a12beSStefan Roese 
43a47a12beSStefan Roese #endif
44a47a12beSStefan Roese 
45a47a12beSStefan Roese #ifdef CONFIG_SYS_INIT_RAM_LOCK
46a47a12beSStefan Roese #include <asm/cache.h>
47a47a12beSStefan Roese #endif
48a47a12beSStefan Roese 
49a47a12beSStefan Roese DECLARE_GLOBAL_DATA_PTR;
50a47a12beSStefan Roese 
51a47a12beSStefan Roese extern ulong get_effective_memsize(void);
52a47a12beSStefan Roese static ulong get_sp (void);
53a47a12beSStefan Roese static void set_clocks_in_mhz (bd_t *kbd);
54a47a12beSStefan Roese 
55a47a12beSStefan Roese #ifndef CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE
56a47a12beSStefan Roese #define CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE	(768*1024*1024)
57a47a12beSStefan Roese #endif
58a47a12beSStefan Roese 
59a47a12beSStefan Roese static void boot_jump_linux(bootm_headers_t *images)
60a47a12beSStefan Roese {
61a47a12beSStefan Roese 	void	(*kernel)(bd_t *, ulong r4, ulong r5, ulong r6,
62a47a12beSStefan Roese 			  ulong r7, ulong r8, ulong r9);
63a47a12beSStefan Roese #ifdef CONFIG_OF_LIBFDT
64a47a12beSStefan Roese 	char *of_flat_tree = images->ft_addr;
65a47a12beSStefan Roese #endif
66a47a12beSStefan Roese 
67a47a12beSStefan Roese 	kernel = (void (*)(bd_t *, ulong, ulong, ulong,
68a47a12beSStefan Roese 			   ulong, ulong, ulong))images->ep;
69a47a12beSStefan Roese 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
70a47a12beSStefan Roese 		(ulong)kernel);
71a47a12beSStefan Roese 
72770605e4SSimon Glass 	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
73a47a12beSStefan Roese 
74a47a12beSStefan Roese #if defined(CONFIG_SYS_INIT_RAM_LOCK) && !defined(CONFIG_E500)
75a47a12beSStefan Roese 	unlock_ram_in_cache();
76a47a12beSStefan Roese #endif
77a47a12beSStefan Roese 
78a47a12beSStefan Roese #if defined(CONFIG_OF_LIBFDT)
79a47a12beSStefan Roese 	if (of_flat_tree) {	/* device tree; boot new style */
80a47a12beSStefan Roese 		/*
81a47a12beSStefan Roese 		 * Linux Kernel Parameters (passing device tree):
82a47a12beSStefan Roese 		 *   r3: pointer to the fdt
83a47a12beSStefan Roese 		 *   r4: 0
84a47a12beSStefan Roese 		 *   r5: 0
85a47a12beSStefan Roese 		 *   r6: epapr magic
86a47a12beSStefan Roese 		 *   r7: size of IMA in bytes
87a47a12beSStefan Roese 		 *   r8: 0
88a47a12beSStefan Roese 		 *   r9: 0
89a47a12beSStefan Roese 		 */
9070bfb032SKumar Gala #if defined(CONFIG_MPC85xx) || defined(CONFIG_440)
91a47a12beSStefan Roese  #define EPAPR_MAGIC	(0x45504150)
92a47a12beSStefan Roese #else
93a47a12beSStefan Roese  #define EPAPR_MAGIC	(0x65504150)
94a47a12beSStefan Roese #endif
95a47a12beSStefan Roese 
96a47a12beSStefan Roese 		debug ("   Booting using OF flat tree...\n");
97a47a12beSStefan Roese 		WATCHDOG_RESET ();
98a47a12beSStefan Roese 		(*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
99c3624e6eSGrant Likely 			   getenv_bootm_mapsize(), 0, 0);
100a47a12beSStefan Roese 		/* does not return */
101a47a12beSStefan Roese 	} else
102a47a12beSStefan Roese #endif
103a47a12beSStefan Roese 	{
104a47a12beSStefan Roese 		/*
105a47a12beSStefan Roese 		 * Linux Kernel Parameters (passing board info data):
106a47a12beSStefan Roese 		 *   r3: ptr to board info data
107a47a12beSStefan Roese 		 *   r4: initrd_start or 0 if no initrd
108a47a12beSStefan Roese 		 *   r5: initrd_end - unused if r4 is 0
109a47a12beSStefan Roese 		 *   r6: Start of command line string
110a47a12beSStefan Roese 		 *   r7: End   of command line string
111a47a12beSStefan Roese 		 *   r8: 0
112a47a12beSStefan Roese 		 *   r9: 0
113a47a12beSStefan Roese 		 */
114a47a12beSStefan Roese 		ulong cmd_start = images->cmdline_start;
115a47a12beSStefan Roese 		ulong cmd_end = images->cmdline_end;
116a47a12beSStefan Roese 		ulong initrd_start = images->initrd_start;
117a47a12beSStefan Roese 		ulong initrd_end = images->initrd_end;
118a47a12beSStefan Roese 		bd_t *kbd = images->kbd;
119a47a12beSStefan Roese 
120a47a12beSStefan Roese 		debug ("   Booting using board info...\n");
121a47a12beSStefan Roese 		WATCHDOG_RESET ();
122a47a12beSStefan Roese 		(*kernel) (kbd, initrd_start, initrd_end,
123a47a12beSStefan Roese 			   cmd_start, cmd_end, 0, 0);
124a47a12beSStefan Roese 		/* does not return */
125a47a12beSStefan Roese 	}
126a47a12beSStefan Roese 	return ;
127a47a12beSStefan Roese }
128a47a12beSStefan Roese 
129a47a12beSStefan Roese void arch_lmb_reserve(struct lmb *lmb)
130a47a12beSStefan Roese {
131a47a12beSStefan Roese 	phys_size_t bootm_size;
132a47a12beSStefan Roese 	ulong size, sp, bootmap_base;
133a47a12beSStefan Roese 
134a47a12beSStefan Roese 	bootmap_base = getenv_bootm_low();
135a47a12beSStefan Roese 	bootm_size = getenv_bootm_size();
136a47a12beSStefan Roese 
137a47a12beSStefan Roese #ifdef DEBUG
138a47a12beSStefan Roese 	if (((u64)bootmap_base + bootm_size) >
139a47a12beSStefan Roese 	    (CONFIG_SYS_SDRAM_BASE + (u64)gd->ram_size))
140a47a12beSStefan Roese 		puts("WARNING: bootm_low + bootm_size exceed total memory\n");
141a47a12beSStefan Roese 	if ((bootmap_base + bootm_size) > get_effective_memsize())
142a47a12beSStefan Roese 		puts("WARNING: bootm_low + bootm_size exceed eff. memory\n");
143a47a12beSStefan Roese #endif
144a47a12beSStefan Roese 
145a47a12beSStefan Roese 	size = min(bootm_size, get_effective_memsize());
146a47a12beSStefan Roese 	size = min(size, CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE);
147a47a12beSStefan Roese 
148a47a12beSStefan Roese 	if (size < bootm_size) {
149a47a12beSStefan Roese 		ulong base = bootmap_base + size;
150a47a12beSStefan Roese 		printf("WARNING: adjusting available memory to %lx\n", size);
151a47a12beSStefan Roese 		lmb_reserve(lmb, base, bootm_size - size);
152a47a12beSStefan Roese 	}
153a47a12beSStefan Roese 
154a47a12beSStefan Roese 	/*
155a47a12beSStefan Roese 	 * Booting a (Linux) kernel image
156a47a12beSStefan Roese 	 *
157a47a12beSStefan Roese 	 * Allocate space for command line and board info - the
158a47a12beSStefan Roese 	 * address should be as high as possible within the reach of
159a47a12beSStefan Roese 	 * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
160a47a12beSStefan Roese 	 * memory, which means far enough below the current stack
161a47a12beSStefan Roese 	 * pointer.
162a47a12beSStefan Roese 	 */
163a47a12beSStefan Roese 	sp = get_sp();
164a47a12beSStefan Roese 	debug ("## Current stack ends at 0x%08lx\n", sp);
165a47a12beSStefan Roese 
1663882d7a5SNorbert van Bolhuis 	/* adjust sp by 4K to be safe */
1673882d7a5SNorbert van Bolhuis 	sp -= 4096;
168a47a12beSStefan Roese 	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - sp));
169a47a12beSStefan Roese 
170561e710aSKumar Gala #ifdef CONFIG_MP
171561e710aSKumar Gala 	cpu_mp_lmb_reserve(lmb);
172561e710aSKumar Gala #endif
173561e710aSKumar Gala 
174a47a12beSStefan Roese 	return ;
175a47a12beSStefan Roese }
176a47a12beSStefan Roese 
1773b200110SKumar Gala static void boot_prep_linux(bootm_headers_t *images)
1783b200110SKumar Gala {
1793b200110SKumar Gala #ifdef CONFIG_MP
1803b200110SKumar Gala 	/*
1813b200110SKumar Gala 	 * if we are MP make sure to flush the device tree so any changes are
1823b200110SKumar Gala 	 * made visibile to all other cores.  In AMP boot scenarios the cores
1833b200110SKumar Gala 	 * might not be HW cache coherent with each other.
1843b200110SKumar Gala 	 */
1853b200110SKumar Gala 	flush_cache((unsigned long)images->ft_addr, images->ft_len);
1863b200110SKumar Gala #endif
1873b200110SKumar Gala }
1883b200110SKumar Gala 
189a47a12beSStefan Roese static int boot_cmdline_linux(bootm_headers_t *images)
190a47a12beSStefan Roese {
191a47a12beSStefan Roese 	ulong of_size = images->ft_len;
192a47a12beSStefan Roese 	struct lmb *lmb = &images->lmb;
193a47a12beSStefan Roese 	ulong *cmd_start = &images->cmdline_start;
194a47a12beSStefan Roese 	ulong *cmd_end = &images->cmdline_end;
195a47a12beSStefan Roese 
196a47a12beSStefan Roese 	int ret = 0;
197a47a12beSStefan Roese 
198a47a12beSStefan Roese 	if (!of_size) {
199a47a12beSStefan Roese 		/* allocate space and init command line */
200590d3cacSGrant Likely 		ret = boot_get_cmdline (lmb, cmd_start, cmd_end);
201a47a12beSStefan Roese 		if (ret) {
202a47a12beSStefan Roese 			puts("ERROR with allocation of cmdline\n");
203a47a12beSStefan Roese 			return ret;
204a47a12beSStefan Roese 		}
205a47a12beSStefan Roese 	}
206a47a12beSStefan Roese 
207a47a12beSStefan Roese 	return ret;
208a47a12beSStefan Roese }
209a47a12beSStefan Roese 
210a47a12beSStefan Roese static int boot_bd_t_linux(bootm_headers_t *images)
211a47a12beSStefan Roese {
212a47a12beSStefan Roese 	ulong of_size = images->ft_len;
213a47a12beSStefan Roese 	struct lmb *lmb = &images->lmb;
214a47a12beSStefan Roese 	bd_t **kbd = &images->kbd;
215a47a12beSStefan Roese 
216a47a12beSStefan Roese 	int ret = 0;
217a47a12beSStefan Roese 
218a47a12beSStefan Roese 	if (!of_size) {
219a47a12beSStefan Roese 		/* allocate space for kernel copy of board info */
220590d3cacSGrant Likely 		ret = boot_get_kbd (lmb, kbd);
221a47a12beSStefan Roese 		if (ret) {
222a47a12beSStefan Roese 			puts("ERROR with allocation of kernel bd\n");
223a47a12beSStefan Roese 			return ret;
224a47a12beSStefan Roese 		}
225a47a12beSStefan Roese 		set_clocks_in_mhz(*kbd);
226a47a12beSStefan Roese 	}
227a47a12beSStefan Roese 
228a47a12beSStefan Roese 	return ret;
229a47a12beSStefan Roese }
230a47a12beSStefan Roese 
23190f89f09STimur Tabi /*
23290f89f09STimur Tabi  * Verify the device tree.
23390f89f09STimur Tabi  *
23490f89f09STimur Tabi  * This function is called after all device tree fix-ups have been enacted,
23590f89f09STimur Tabi  * so that the final device tree can be verified.  The definition of "verified"
23690f89f09STimur Tabi  * is up to the specific implementation.  However, it generally means that the
23790f89f09STimur Tabi  * addresses of some of the devices in the device tree are compared with the
23890f89f09STimur Tabi  * actual addresses at which U-Boot has placed them.
23990f89f09STimur Tabi  *
24090f89f09STimur Tabi  * Returns 1 on success, 0 on failure.  If 0 is returned, U-boot will halt the
24190f89f09STimur Tabi  * boot process.
24290f89f09STimur Tabi  */
24390f89f09STimur Tabi static int __ft_verify_fdt(void *fdt)
24490f89f09STimur Tabi {
24590f89f09STimur Tabi 	return 1;
24690f89f09STimur Tabi }
24790f89f09STimur Tabi __attribute__((weak, alias("__ft_verify_fdt"))) int ft_verify_fdt(void *fdt);
24890f89f09STimur Tabi 
249a47a12beSStefan Roese static int boot_body_linux(bootm_headers_t *images)
250a47a12beSStefan Roese {
251a47a12beSStefan Roese 	ulong rd_len;
252a47a12beSStefan Roese 	struct lmb *lmb = &images->lmb;
253a47a12beSStefan Roese 	ulong *initrd_start = &images->initrd_start;
254a47a12beSStefan Roese 	ulong *initrd_end = &images->initrd_end;
255a47a12beSStefan Roese #if defined(CONFIG_OF_LIBFDT)
256a47a12beSStefan Roese 	ulong of_size = images->ft_len;
257a47a12beSStefan Roese 	char **of_flat_tree = &images->ft_addr;
258a47a12beSStefan Roese #endif
259a47a12beSStefan Roese 
260a47a12beSStefan Roese 	int ret;
261a47a12beSStefan Roese 
26255b0a393SGrant Likely #if defined(CONFIG_OF_LIBFDT)
26355b0a393SGrant Likely 	boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
26455b0a393SGrant Likely #endif
26555b0a393SGrant Likely 
266a47a12beSStefan Roese 	/* allocate space and init command line */
267a47a12beSStefan Roese 	ret = boot_cmdline_linux(images);
268a47a12beSStefan Roese 	if (ret)
269a47a12beSStefan Roese 		return ret;
270a47a12beSStefan Roese 
271a47a12beSStefan Roese 	/* allocate space for kernel copy of board info */
272a47a12beSStefan Roese 	ret = boot_bd_t_linux(images);
273a47a12beSStefan Roese 	if (ret)
274a47a12beSStefan Roese 		return ret;
275a47a12beSStefan Roese 
276a47a12beSStefan Roese 	rd_len = images->rd_end - images->rd_start;
277a47a12beSStefan Roese 	ret = boot_ramdisk_high (lmb, images->rd_start, rd_len, initrd_start, initrd_end);
278a47a12beSStefan Roese 	if (ret)
279a47a12beSStefan Roese 		return ret;
280a47a12beSStefan Roese 
281ed59e587SGrant Likely #if defined(CONFIG_OF_LIBFDT)
282590d3cacSGrant Likely 	ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
283a47a12beSStefan Roese 	if (ret)
284a47a12beSStefan Roese 		return ret;
285a47a12beSStefan Roese 
286a47a12beSStefan Roese 	/*
287a47a12beSStefan Roese 	 * Add the chosen node if it doesn't exist, add the env and bd_t
288a47a12beSStefan Roese 	 * if the user wants it (the logic is in the subroutines).
289a47a12beSStefan Roese 	 */
290a47a12beSStefan Roese 	if (of_size) {
291a47a12beSStefan Roese 		if (fdt_chosen(*of_flat_tree, 1) < 0) {
292a47a12beSStefan Roese 			puts ("ERROR: ");
293a47a12beSStefan Roese 			puts ("/chosen node create failed");
294a47a12beSStefan Roese 			puts (" - must RESET the board to recover.\n");
295a47a12beSStefan Roese 			return -1;
296a47a12beSStefan Roese 		}
297a47a12beSStefan Roese #ifdef CONFIG_OF_BOARD_SETUP
298a47a12beSStefan Roese 		/* Call the board-specific fixup routine */
299a47a12beSStefan Roese 		ft_board_setup(*of_flat_tree, gd->bd);
300a47a12beSStefan Roese #endif
301a47a12beSStefan Roese 
302a47a12beSStefan Roese 		/* Delete the old LMB reservation */
303a47a12beSStefan Roese 		lmb_free(lmb, (phys_addr_t)(u32)*of_flat_tree,
304a47a12beSStefan Roese 				(phys_size_t)fdt_totalsize(*of_flat_tree));
305a47a12beSStefan Roese 
306a47a12beSStefan Roese 		ret = fdt_resize(*of_flat_tree);
307a47a12beSStefan Roese 		if (ret < 0)
308a47a12beSStefan Roese 			return ret;
309a47a12beSStefan Roese 		of_size = ret;
310a47a12beSStefan Roese 
3119e9579bbSKumar Gala 		if (*initrd_start && *initrd_end) {
312a47a12beSStefan Roese 			of_size += FDT_RAMDISK_OVERHEAD;
3139e9579bbSKumar Gala 			fdt_set_totalsize(*of_flat_tree, of_size);
3149e9579bbSKumar Gala 		}
315a47a12beSStefan Roese 		/* Create a new LMB reservation */
316a47a12beSStefan Roese 		lmb_reserve(lmb, (ulong)*of_flat_tree, of_size);
317a47a12beSStefan Roese 
318a47a12beSStefan Roese 		/* fixup the initrd now that we know where it should be */
319a47a12beSStefan Roese 		if (*initrd_start && *initrd_end)
320a47a12beSStefan Roese 			fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 1);
32190f89f09STimur Tabi 
32290f89f09STimur Tabi 		if (!ft_verify_fdt(*of_flat_tree))
32390f89f09STimur Tabi 			return -1;
324a47a12beSStefan Roese 	}
325ed59e587SGrant Likely #endif	/* CONFIG_OF_LIBFDT */
326a47a12beSStefan Roese 	return 0;
327a47a12beSStefan Roese }
328a47a12beSStefan Roese 
329*eef1cf2dSKim Phillips noinline
33054841ab5SWolfgang Denk int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
331a47a12beSStefan Roese {
332a47a12beSStefan Roese 	int	ret;
333a47a12beSStefan Roese 
334a47a12beSStefan Roese 	if (flag & BOOTM_STATE_OS_CMDLINE) {
335a47a12beSStefan Roese 		boot_cmdline_linux(images);
336a47a12beSStefan Roese 		return 0;
337a47a12beSStefan Roese 	}
338a47a12beSStefan Roese 
339a47a12beSStefan Roese 	if (flag & BOOTM_STATE_OS_BD_T) {
340a47a12beSStefan Roese 		boot_bd_t_linux(images);
341a47a12beSStefan Roese 		return 0;
342a47a12beSStefan Roese 	}
343a47a12beSStefan Roese 
3443b200110SKumar Gala 	if (flag & BOOTM_STATE_OS_PREP) {
3453b200110SKumar Gala 		boot_prep_linux(images);
346a47a12beSStefan Roese 		return 0;
3473b200110SKumar Gala 	}
348a47a12beSStefan Roese 
349a47a12beSStefan Roese 	if (flag & BOOTM_STATE_OS_GO) {
350a47a12beSStefan Roese 		boot_jump_linux(images);
351a47a12beSStefan Roese 		return 0;
352a47a12beSStefan Roese 	}
353a47a12beSStefan Roese 
3543b200110SKumar Gala 	boot_prep_linux(images);
355a47a12beSStefan Roese 	ret = boot_body_linux(images);
356a47a12beSStefan Roese 	if (ret)
357a47a12beSStefan Roese 		return ret;
358a47a12beSStefan Roese 	boot_jump_linux(images);
359a47a12beSStefan Roese 
360a47a12beSStefan Roese 	return 0;
361a47a12beSStefan Roese }
362a47a12beSStefan Roese 
363a47a12beSStefan Roese static ulong get_sp (void)
364a47a12beSStefan Roese {
365a47a12beSStefan Roese 	ulong sp;
366a47a12beSStefan Roese 
367a47a12beSStefan Roese 	asm( "mr %0,1": "=r"(sp) : );
368a47a12beSStefan Roese 	return sp;
369a47a12beSStefan Roese }
370a47a12beSStefan Roese 
371a47a12beSStefan Roese static void set_clocks_in_mhz (bd_t *kbd)
372a47a12beSStefan Roese {
373a47a12beSStefan Roese 	char	*s;
374a47a12beSStefan Roese 
375a47a12beSStefan Roese 	if ((s = getenv ("clocks_in_mhz")) != NULL) {
376a47a12beSStefan Roese 		/* convert all clock information to MHz */
377a47a12beSStefan Roese 		kbd->bi_intfreq /= 1000000L;
378a47a12beSStefan Roese 		kbd->bi_busfreq /= 1000000L;
379a47a12beSStefan Roese #if defined(CONFIG_MPC8220)
380a47a12beSStefan Roese 		kbd->bi_inpfreq /= 1000000L;
381a47a12beSStefan Roese 		kbd->bi_pcifreq /= 1000000L;
382a47a12beSStefan Roese 		kbd->bi_pevfreq /= 1000000L;
383a47a12beSStefan Roese 		kbd->bi_flbfreq /= 1000000L;
384a47a12beSStefan Roese 		kbd->bi_vcofreq /= 1000000L;
385a47a12beSStefan Roese #endif
386a47a12beSStefan Roese #if defined(CONFIG_CPM2)
387a47a12beSStefan Roese 		kbd->bi_cpmfreq /= 1000000L;
388a47a12beSStefan Roese 		kbd->bi_brgfreq /= 1000000L;
389a47a12beSStefan Roese 		kbd->bi_sccfreq /= 1000000L;
390a47a12beSStefan Roese 		kbd->bi_vco	/= 1000000L;
391a47a12beSStefan Roese #endif
392a47a12beSStefan Roese #if defined(CONFIG_MPC5xxx)
393a47a12beSStefan Roese 		kbd->bi_ipbfreq /= 1000000L;
394a47a12beSStefan Roese 		kbd->bi_pcifreq /= 1000000L;
395a47a12beSStefan Roese #endif /* CONFIG_MPC5xxx */
396a47a12beSStefan Roese 	}
397a47a12beSStefan Roese }
398