171e2f4ddSJiaxun Yang // SPDX-License-Identifier: GPL-2.0-or-later
271e2f4ddSJiaxun Yang /*
371e2f4ddSJiaxun Yang  * Copyright (C) 2009 Lemote Inc.
471e2f4ddSJiaxun Yang  * Author: Wu Zhangjin, wuzhangjin@gmail.com
571e2f4ddSJiaxun Yang  */
671e2f4ddSJiaxun Yang #include <asm/bootinfo.h>
771e2f4ddSJiaxun Yang 
871e2f4ddSJiaxun Yang #include <loongson.h>
971e2f4ddSJiaxun Yang 
mach_prom_init_machtype(void)1071e2f4ddSJiaxun Yang void __init mach_prom_init_machtype(void)
1171e2f4ddSJiaxun Yang {
1271e2f4ddSJiaxun Yang 	/* We share the same kernel image file among Lemote 2F family
1371e2f4ddSJiaxun Yang 	 * of machines, and provide the machtype= kernel command line
1471e2f4ddSJiaxun Yang 	 * to users to indicate their machine, this command line will
1571e2f4ddSJiaxun Yang 	 * be passed by the latest PMON automatically. and fortunately,
1671e2f4ddSJiaxun Yang 	 * up to now, we can get the machine type from the PMON_VER=
1771e2f4ddSJiaxun Yang 	 * commandline directly except the NAS machine, In the old
1871e2f4ddSJiaxun Yang 	 * machines, this will help the users a lot.
1971e2f4ddSJiaxun Yang 	 *
2071e2f4ddSJiaxun Yang 	 * If no "machtype=" passed, get machine type from "PMON_VER=".
2171e2f4ddSJiaxun Yang 	 *	PMON_VER=LM8089		Lemote 8.9'' netbook
2271e2f4ddSJiaxun Yang 	 *		 LM8101		Lemote 10.1'' netbook
2371e2f4ddSJiaxun Yang 	 *	(The above two netbooks have the same kernel support)
2471e2f4ddSJiaxun Yang 	 *		 LM6XXX		Lemote FuLoong(2F) box series
2571e2f4ddSJiaxun Yang 	 *		 LM9XXX		Lemote LynLoong PC series
2671e2f4ddSJiaxun Yang 	 */
2771e2f4ddSJiaxun Yang 	if (strstr(arcs_cmdline, "PMON_VER=LM")) {
2871e2f4ddSJiaxun Yang 		if (strstr(arcs_cmdline, "PMON_VER=LM8"))
2971e2f4ddSJiaxun Yang 			mips_machtype = MACH_LEMOTE_YL2F89;
3071e2f4ddSJiaxun Yang 		else if (strstr(arcs_cmdline, "PMON_VER=LM6"))
3171e2f4ddSJiaxun Yang 			mips_machtype = MACH_LEMOTE_FL2F;
3271e2f4ddSJiaxun Yang 		else if (strstr(arcs_cmdline, "PMON_VER=LM9"))
3371e2f4ddSJiaxun Yang 			mips_machtype = MACH_LEMOTE_LL2F;
3471e2f4ddSJiaxun Yang 		else
3571e2f4ddSJiaxun Yang 			mips_machtype = MACH_LEMOTE_NAS;
3671e2f4ddSJiaxun Yang 
3771e2f4ddSJiaxun Yang 		strcat(arcs_cmdline, " machtype=");
3871e2f4ddSJiaxun Yang 		strcat(arcs_cmdline, get_system_type());
3971e2f4ddSJiaxun Yang 		strcat(arcs_cmdline, " ");
4071e2f4ddSJiaxun Yang 	}
4171e2f4ddSJiaxun Yang }
42