1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) 2009 Lemote Inc.
4 * Author: Wu Zhangjin, wuzhangjin@gmail.com
5 */
6#include <asm/bootinfo.h>
7
8#include <loongson.h>
9
10void __init mach_prom_init_machtype(void)
11{
12	/* We share the same kernel image file among Lemote 2F family
13	 * of machines, and provide the machtype= kernel command line
14	 * to users to indicate their machine, this command line will
15	 * be passed by the latest PMON automatically. and fortunately,
16	 * up to now, we can get the machine type from the PMON_VER=
17	 * commandline directly except the NAS machine, In the old
18	 * machines, this will help the users a lot.
19	 *
20	 * If no "machtype=" passed, get machine type from "PMON_VER=".
21	 *	PMON_VER=LM8089		Lemote 8.9'' netbook
22	 *		 LM8101		Lemote 10.1'' netbook
23	 *	(The above two netbooks have the same kernel support)
24	 *		 LM6XXX		Lemote FuLoong(2F) box series
25	 *		 LM9XXX		Lemote LynLoong PC series
26	 */
27	if (strstr(arcs_cmdline, "PMON_VER=LM")) {
28		if (strstr(arcs_cmdline, "PMON_VER=LM8"))
29			mips_machtype = MACH_LEMOTE_YL2F89;
30		else if (strstr(arcs_cmdline, "PMON_VER=LM6"))
31			mips_machtype = MACH_LEMOTE_FL2F;
32		else if (strstr(arcs_cmdline, "PMON_VER=LM9"))
33			mips_machtype = MACH_LEMOTE_LL2F;
34		else
35			mips_machtype = MACH_LEMOTE_NAS;
36
37		strcat(arcs_cmdline, " machtype=");
38		strcat(arcs_cmdline, get_system_type());
39		strcat(arcs_cmdline, " ");
40	}
41}
42