diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2010-01-04 04:16:43 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:53:09 -0500 |
commit | 1b39a0bad50779177ebca818c6c3380463bfca7d (patch) | |
tree | 2c0ecf8f110ee22646d3dea494ff1562625f0ce2 /arch/mips/loongson | |
parent | 081f6749ae33f72b4fafea4c02976e163ef6ef37 (diff) |
MIPS: Loongson: Lemote-2F: Get the machine type from PMON_VER
Lemote have used the PMON_VER strings to indicate the loongson-2f
machine series:
PMON_VER=LM8089 Lemote 8.9'' netbook
LM8101 Lemote 10.1'' netbook
(The above two netbooks have the same kernel support)
LM6XXX Lemote FuLoong(2F) box series
LM9XXX Lemote LynLoong PC series
Before the machtype is supported by the PMON, we can get the machine
type from the PMON_VER for these machines, this will help the users a
lot.
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: yanh@lemote.com
Cc: huhb@lemote.com
Cc: zhangfx@lemote.com
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/821/
Patchwork: http://patchwork.linux-mips.org/patch/908/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/loongson')
-rw-r--r-- | arch/mips/loongson/common/machtype.c | 10 | ||||
-rw-r--r-- | arch/mips/loongson/lemote-2f/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/loongson/lemote-2f/machtype.c | 45 |
3 files changed, 54 insertions, 3 deletions
diff --git a/arch/mips/loongson/common/machtype.c b/arch/mips/loongson/common/machtype.c index 0ed52b3f5314..3799098e1e95 100644 --- a/arch/mips/loongson/common/machtype.c +++ b/arch/mips/loongson/common/machtype.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2009 Lemote Inc. & Insititute of Computing Technology | 2 | * Copyright (C) 2009 Lemote Inc. |
3 | * Author: Wu Zhangjin, wuzj@lemote.com | 3 | * Author: Wu Zhangjin, wuzj@lemote.com |
4 | * | 4 | * |
5 | * Copyright (c) 2009 Zhang Le <r0bertz@gentoo.org> | 5 | * Copyright (c) 2009 Zhang Le <r0bertz@gentoo.org> |
@@ -35,6 +35,10 @@ const char *get_system_type(void) | |||
35 | return system_types[mips_machtype]; | 35 | return system_types[mips_machtype]; |
36 | } | 36 | } |
37 | 37 | ||
38 | void __weak __init mach_prom_init_machtype(void) | ||
39 | { | ||
40 | } | ||
41 | |||
38 | void __init prom_init_machtype(void) | 42 | void __init prom_init_machtype(void) |
39 | { | 43 | { |
40 | char *p, str[MACHTYPE_LEN]; | 44 | char *p, str[MACHTYPE_LEN]; |
@@ -43,8 +47,10 @@ void __init prom_init_machtype(void) | |||
43 | mips_machtype = LOONGSON_MACHTYPE; | 47 | mips_machtype = LOONGSON_MACHTYPE; |
44 | 48 | ||
45 | p = strstr(arcs_cmdline, "machtype="); | 49 | p = strstr(arcs_cmdline, "machtype="); |
46 | if (!p) | 50 | if (!p) { |
51 | mach_prom_init_machtype(); | ||
47 | return; | 52 | return; |
53 | } | ||
48 | p += strlen("machtype="); | 54 | p += strlen("machtype="); |
49 | strncpy(str, p, MACHTYPE_LEN); | 55 | strncpy(str, p, MACHTYPE_LEN); |
50 | p = strstr(str, " "); | 56 | p = strstr(str, " "); |
diff --git a/arch/mips/loongson/lemote-2f/Makefile b/arch/mips/loongson/lemote-2f/Makefile index 4d84b27dc41b..8699a53f0477 100644 --- a/arch/mips/loongson/lemote-2f/Makefile +++ b/arch/mips/loongson/lemote-2f/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for lemote loongson2f family machines | 2 | # Makefile for lemote loongson2f family machines |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y += irq.o reset.o ec_kb3310b.o | 5 | obj-y += machtype.o irq.o reset.o ec_kb3310b.o |
6 | 6 | ||
7 | # | 7 | # |
8 | # Suspend Support | 8 | # Suspend Support |
diff --git a/arch/mips/loongson/lemote-2f/machtype.c b/arch/mips/loongson/lemote-2f/machtype.c new file mode 100644 index 000000000000..610f43173148 --- /dev/null +++ b/arch/mips/loongson/lemote-2f/machtype.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Lemote Inc. | ||
3 | * Author: Wu Zhangjin, wuzj@lemote.com | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | #include <asm/bootinfo.h> | ||
11 | |||
12 | #include <loongson.h> | ||
13 | |||
14 | void __init mach_prom_init_machtype(void) | ||
15 | { | ||
16 | /* We share the same kernel image file among Lemote 2F family | ||
17 | * of machines, and provide the machtype= kernel command line | ||
18 | * to users to indicate their machine, this command line will | ||
19 | * be passed by the latest PMON automatically. and fortunately, | ||
20 | * up to now, we can get the machine type from the PMON_VER= | ||
21 | * commandline directly except the NAS machine, In the old | ||
22 | * machines, this will help the users a lot. | ||
23 | * | ||
24 | * If no "machtype=" passed, get machine type from "PMON_VER=". | ||
25 | * PMON_VER=LM8089 Lemote 8.9'' netbook | ||
26 | * LM8101 Lemote 10.1'' netbook | ||
27 | * (The above two netbooks have the same kernel support) | ||
28 | * LM6XXX Lemote FuLoong(2F) box series | ||
29 | * LM9XXX Lemote LynLoong PC series | ||
30 | */ | ||
31 | if (strstr(arcs_cmdline, "PMON_VER=LM")) { | ||
32 | if (strstr(arcs_cmdline, "PMON_VER=LM8")) | ||
33 | mips_machtype = MACH_LEMOTE_YL2F89; | ||
34 | else if (strstr(arcs_cmdline, "PMON_VER=LM6")) | ||
35 | mips_machtype = MACH_LEMOTE_FL2F; | ||
36 | else if (strstr(arcs_cmdline, "PMON_VER=LM9")) | ||
37 | mips_machtype = MACH_LEMOTE_LL2F; | ||
38 | else | ||
39 | mips_machtype = MACH_LEMOTE_NAS; | ||
40 | |||
41 | strcat(arcs_cmdline, " machtype="); | ||
42 | strcat(arcs_cmdline, get_system_type()); | ||
43 | strcat(arcs_cmdline, " "); | ||
44 | } | ||
45 | } | ||