@@ -3,6 +3,7 @@
# Common code for all Loongson 1 based systems
#
+obj-$(CONFIG_MACH_LOONGSON32) += proc.o
obj-$(CONFIG_MACH_LOONGSON32) += common/
#
@@ -3,4 +3,4 @@
# Makefile for common code of loongson1 based machines.
#
-obj-y += time.o irq.o platform.o prom.o setup.o
+obj-y += time.o irq.o platform.o prom.o
deleted file mode 100644
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
- */
-
-#include <linux/io.h>
-#include <linux/init.h>
-#include <linux/smp.h>
-#include <asm/cpu-info.h>
-#include <asm/bootinfo.h>
-
-const char *get_system_type(void)
-{
- unsigned int processor_id = (¤t_cpu_data)->processor_id;
-
- switch (processor_id & PRID_REV_MASK) {
- case PRID_REV_LOONGSON1B:
-#if defined(CONFIG_LOONGSON1_LS1B)
- return "LOONGSON LS1B";
-#elif defined(CONFIG_LOONGSON1_LS1C)
- return "LOONGSON LS1C";
-#endif
- default:
- return "LOONGSON (unknown)";
- }
-}
new file mode 100644
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2011-2023 Keguang Zhang <keguang.zhang@gmail.com>
+ */
+
+#include <linux/of.h>
+
+#include <asm/bootinfo.h>
+
+const char *get_system_type(void)
+{
+ const char *str;
+ int err;
+
+ err = of_property_read_string_index(of_root, "compatible", 1, &str);
+ if (!err)
+ return str;
+
+ return "Unknown";
+}
Get the system type from devicetree. And update the copyright accordingly. In addition, the system type belongs to proc info. So rename setup.c to proc.c. Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com> --- arch/mips/loongson32/Makefile | 1 + arch/mips/loongson32/common/Makefile | 2 +- arch/mips/loongson32/common/setup.c | 26 -------------------------- arch/mips/loongson32/proc.c | 20 ++++++++++++++++++++ 4 files changed, 22 insertions(+), 27 deletions(-) delete mode 100644 arch/mips/loongson32/common/setup.c create mode 100644 arch/mips/loongson32/proc.c