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 <[email protected]>
---
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
diff --git a/arch/mips/loongson32/Makefile b/arch/mips/loongson32/Makefile
index ba10954b4b21..c3881af369e9 100644
--- a/arch/mips/loongson32/Makefile
+++ b/arch/mips/loongson32/Makefile
@@ -3,6 +3,7 @@
# Common code for all Loongson 1 based systems
#
+obj-$(CONFIG_MACH_LOONGSON32) += proc.o
obj-$(CONFIG_MACH_LOONGSON32) += common/
#
diff --git a/arch/mips/loongson32/common/Makefile b/arch/mips/loongson32/common/Makefile
index f3950d308187..b44527b1a178 100644
--- a/arch/mips/loongson32/common/Makefile
+++ b/arch/mips/loongson32/common/Makefile
@@ -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
diff --git a/arch/mips/loongson32/common/setup.c b/arch/mips/loongson32/common/setup.c
deleted file mode 100644
index 4733fe037176..000000000000
--- a/arch/mips/loongson32/common/setup.c
+++ /dev/null
@@ -1,26 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (c) 2011 Zhang, Keguang <[email protected]>
- */
-
-#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)";
- }
-}
diff --git a/arch/mips/loongson32/proc.c b/arch/mips/loongson32/proc.c
new file mode 100644
index 000000000000..1ea54346b3d4
--- /dev/null
+++ b/arch/mips/loongson32/proc.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2011-2023 Keguang Zhang <[email protected]>
+ */
+
+#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";
+}
--
2.39.2