diff options
author | Wu Zhangjin <wuzj@lemote.com> | 2009-07-02 11:22:36 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-09-17 14:07:46 -0400 |
commit | bd92aa013e8fcd17328ec8e060477761cf3380d9 (patch) | |
tree | 0435f611a87d8be266c44629c80a2fd7459ef026 /arch/mips/lemote/lm2e/env.c | |
parent | f54a40ee6b3cb4da638d7705e433bc80aa4f49f6 (diff) |
MIPS: Loongson: Split the implementation of prom and setup parts
This patch split the old initilization and setup implementation to
several file, one file one logic function.
the other main changes include:
1. as the script/checkpatch.pl suggests, use strict_strtol instead
of simple_strtol in arch/mips/lemote/lm2e/cmdline.c
2. use the existed macros in asm/mips-boards/bonito64.h as the
arguments of set_io_port_base() and remove the un-needed ones in
asm/mach-lemote/pci.h
Signed-off-by: Wu Zhangjin <wuzj@lemote.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lemote/lm2e/env.c')
-rw-r--r-- | arch/mips/lemote/lm2e/env.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/arch/mips/lemote/lm2e/env.c b/arch/mips/lemote/lm2e/env.c new file mode 100644 index 000000000000..9e88409f7a3a --- /dev/null +++ b/arch/mips/lemote/lm2e/env.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Based on Ocelot Linux port, which is | ||
3 | * Copyright 2001 MontaVista Software Inc. | ||
4 | * Author: jsun@mvista.com or jsun@junsun.net | ||
5 | * | ||
6 | * Copyright 2003 ICT CAS | ||
7 | * Author: Michael Guo <guoyi@ict.ac.cn> | ||
8 | * | ||
9 | * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology | ||
10 | * Author: Fuxin Zhang, zhangfx@lemote.com | ||
11 | * | ||
12 | * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology | ||
13 | * Author: Wu Zhangjin, wuzj@lemote.com | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | */ | ||
20 | |||
21 | #include <linux/io.h> | ||
22 | #include <linux/init.h> | ||
23 | |||
24 | #include <asm/bootinfo.h> | ||
25 | |||
26 | unsigned long bus_clock, cpu_clock_freq; | ||
27 | unsigned long memsize, highmemsize; | ||
28 | |||
29 | /* pmon passes arguments in 32bit pointers */ | ||
30 | int *_prom_envp; | ||
31 | |||
32 | #define parse_even_earlier(res, option, p) \ | ||
33 | do { \ | ||
34 | if (strncmp(option, (char *)p, strlen(option)) == 0) \ | ||
35 | strict_strtol((char *)p + strlen(option"="), \ | ||
36 | 10, &res); \ | ||
37 | } while (0) | ||
38 | |||
39 | void __init prom_init_env(void) | ||
40 | { | ||
41 | long l; | ||
42 | |||
43 | /* firmware arguments are initialized in head.S */ | ||
44 | _prom_envp = (int *)fw_arg2; | ||
45 | |||
46 | l = (long)*_prom_envp; | ||
47 | while (l != 0) { | ||
48 | parse_even_earlier(bus_clock, "busclock", l); | ||
49 | parse_even_earlier(cpu_clock_freq, "cpuclock", l); | ||
50 | parse_even_earlier(memsize, "memsize", l); | ||
51 | parse_even_earlier(highmemsize, "highmemsize", l); | ||
52 | _prom_envp++; | ||
53 | l = (long)*_prom_envp; | ||
54 | } | ||
55 | if (memsize == 0) | ||
56 | memsize = 256; | ||
57 | |||
58 | pr_info("busclock=%ld, cpuclock=%ld, memsize=%ld, highmemsize=%ld\n", | ||
59 | bus_clock, cpu_clock_freq, memsize, highmemsize); | ||
60 | } | ||