All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keguang Zhang <keguang.zhang@gmail.com>
To: linux-mips@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Keguang Zhang <keguang.zhang@gmail.com>
Subject: [PATCH 01/17] MIPS: loongson32: Get the system type from DT
Date: Sat, 29 Jul 2023 21:43:02 +0800	[thread overview]
Message-ID: <20230729134318.1694467-2-keguang.zhang@gmail.com> (raw)
In-Reply-To: <20230729134318.1694467-1-keguang.zhang@gmail.com>

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

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 <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 = (&current_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 <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";
+}
-- 
2.39.2


  reply	other threads:[~2023-07-29 13:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-29 13:43 [PATCH 00/17] MIPS: loongson32: Convert all platform devices to DT Keguang Zhang
2023-07-29 13:43 ` Keguang Zhang [this message]
2023-07-29 13:43 ` [PATCH 02/17] MIPS: Modify the Loongson1 PRID_REV Keguang Zhang
2023-08-01 13:52   ` Philippe Mathieu-Daudé
2023-07-29 13:43 ` [PATCH 03/17] MIPS: dts: Add basic DT support for Loongson-1 boards Keguang Zhang
2023-07-30 17:11   ` Du Huanpeng
2023-07-31  3:06     ` Keguang Zhang
2023-07-29 13:43 ` [PATCH 04/17] MIPS: loongson32: Modify Loongson-1B/1C related Kconfig options Keguang Zhang
2023-07-29 13:43 ` [PATCH 05/17] MIPS: loongson32: Adapt the common code to support DT Keguang Zhang
2023-07-29 13:43 ` [PATCH 06/17] MIPS: loongson32: Convert platform IRQ driver to DT Keguang Zhang
2023-07-30  8:24   ` Krzysztof Kozlowski
2023-07-31  2:52     ` Keguang Zhang
2023-07-29 13:43 ` [PATCH 07/17] MIPS: loongson32: Convert UART platform device " Keguang Zhang
2023-07-30  8:26   ` Krzysztof Kozlowski
2023-07-31  3:04     ` Keguang Zhang
2023-07-31  3:32       ` Keguang Zhang
2023-07-31  6:56         ` Krzysztof Kozlowski
2023-07-29 13:43 ` [PATCH 08/17] MIPS: loongson32: Convert Ethernet " Keguang Zhang
2023-08-01 18:21   ` Serge Semin
2023-08-02  3:10     ` Keguang Zhang
2023-08-02  9:44       ` Serge Semin
2023-08-02 11:19         ` Keguang Zhang
2023-08-02 12:42           ` Serge Semin
2023-08-02 10:31       ` Du Huanpeng
2023-08-02 11:30         ` Keguang Zhang
2023-07-29 13:43 ` [PATCH 09/17] MIPS: loongson32: Convert GPIO " Keguang Zhang
2023-07-29 13:43 ` [PATCH 10/17] MIPS: loongson32: Convert GPIO LED " Keguang Zhang
2023-07-29 13:43 ` [PATCH 11/17] MIPS: loongson32: Convert USB host " Keguang Zhang
2023-07-29 13:43 ` [PATCH 12/17] MIPS: loongson32: Convert RTC " Keguang Zhang
2023-07-29 13:43 ` [PATCH 13/17] MIPS: loongson32: Convert watchdog " Keguang Zhang
2023-07-29 13:43 ` [PATCH 14/17] mips: dts: loongson1b: Add PWM timer clocksource Keguang Zhang
2023-07-30  8:27   ` Krzysztof Kozlowski
2023-07-29 13:43 ` [PATCH 15/17] MIPS: loongson32: Remove all the obsolete code of platform device Keguang Zhang
2023-07-29 13:43 ` [PATCH 16/17] MIPS: configs: Update and rename loongson1b_defconfig Keguang Zhang
2023-07-29 13:43 ` [PATCH 17/17] MIPS: configs: Update and rename loongson1c_defconfig Keguang Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230729134318.1694467-2-keguang.zhang@gmail.com \
    --to=keguang.zhang@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.