All of lore.kernel.org
 help / color / mirror / Atom feed
From: Binbin Zhou <zhoubb@lemote.com>
To: Ralf Baechle <ralf@linux-mips.org>, James Hogan <james.hogan@imgtec.com>
Cc: "John Crispin" <john@phrozen.org>,
	"Steven J . Hill" <Steven.Hill@imgtec.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Fuxin Zhang" <zhangfx@lemote.com>,
	"Zhangjin Wu" <wuzhangjin@gmail.com>,
	"Kelvin Cheung" <keguang.zhang@gmail.com>,
	"Yang Ling" <gnaygnil@gmail.com>, 谢致邦 <Yeking@Red54.com>,
	"Stephen Boyd" <sboyd@codeaurora.org>,
	"Michael Turquette" <mturquette@baylibre.com>,
	linux-mips@linux-mips.org, linux-clk@vger.kernel.org,
	"Binbin Zhou" <zhoubb@lemote.com>,
	"HuaCai Chen" <chenhc@lemote.com>
Subject: [PATCH RESEND v8 3/9] MIPS: Loongson: Add basic Loongson-1A CPU support
Date: Tue, 29 Aug 2017 16:38:40 +0800	[thread overview]
Message-ID: <1503995926-17125-4-git-send-email-zhoubb@lemote.com> (raw)
In-Reply-To: <1503995926-17125-1-git-send-email-zhoubb@lemote.com>

The Loongson-1A CPU is similar with Loongson-1B/1C, which is a 32-bit SoC.
It implements the MIPS32 release 2 instruction set.

It's a cost-effective single chip system based on LS232 processor core, and
is applicable to fields such as industrial control.

Signed-off-by: Binbin Zhou <zhoubb@lemote.com>
Signed-off-by: HuaCai Chen <chenhc@lemote.com>
---
 arch/mips/include/asm/cpu-type.h    |  3 ++-
 arch/mips/kernel/cpu-probe.c        |  4 +++-
 arch/mips/loongson32/Platform       |  1 +
 arch/mips/loongson32/common/setup.c |  4 +++-
 arch/mips/mm/c-r4k.c                | 10 ++++++++++
 5 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h
index 175fe56..2202be8 100644
--- a/arch/mips/include/asm/cpu-type.h
+++ b/arch/mips/include/asm/cpu-type.h
@@ -24,7 +24,8 @@ static inline int __pure __get_cpu_type(const int cpu_type)
 	case CPU_LOONGSON3:
 #endif
 
-#if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
+#if defined(CONFIG_SYS_HAS_CPU_LOONGSON1A) || \
+    defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
     defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
 	case CPU_LOONGSON1:
 #endif
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 25f729c..c23fa20 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1514,7 +1514,9 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
 
 		switch (c->processor_id & PRID_REV_MASK) {
 		case PRID_REV_LOONGSON1ABC:
-#ifdef CONFIG_CPU_LOONGSON1B
+#if defined(CONFIG_LOONGSON1_LS1A)
+			__cpu_name[cpu] = "Loongson 1A";
+#elif defined(CONFIG_CPU_LOONGSON1B)
 			__cpu_name[cpu] = "Loongson 1B";
 #endif
 			break;
diff --git a/arch/mips/loongson32/Platform b/arch/mips/loongson32/Platform
index ffe01c6..a9e0fa7 100644
--- a/arch/mips/loongson32/Platform
+++ b/arch/mips/loongson32/Platform
@@ -4,5 +4,6 @@ cflags-$(CONFIG_CPU_LOONGSON1)	+= \
 
 platform-$(CONFIG_MACH_LOONGSON32)	+= loongson32/
 cflags-$(CONFIG_MACH_LOONGSON32)	+= -I$(srctree)/arch/mips/include/asm/mach-loongson32
+load-$(CONFIG_LOONGSON1_LS1A)		+= 0xffffffff80200000
 load-$(CONFIG_LOONGSON1_LS1B)		+= 0xffffffff80100000
 load-$(CONFIG_LOONGSON1_LS1C)		+= 0xffffffff80100000
diff --git a/arch/mips/loongson32/common/setup.c b/arch/mips/loongson32/common/setup.c
index c8e8b3e..1c3324a 100644
--- a/arch/mips/loongson32/common/setup.c
+++ b/arch/mips/loongson32/common/setup.c
@@ -22,7 +22,9 @@ const char *get_system_type(void)
 
 	switch (processor_id & PRID_REV_MASK) {
 	case PRID_REV_LOONGSON1ABC:
-#if defined(CONFIG_LOONGSON1_LS1B)
+#if defined(CONFIG_LOONGSON1_LS1A)
+		return "LOONGSON LS1A";
+#elif defined(CONFIG_LOONGSON1_LS1B)
 		return "LOONGSON LS1B";
 #elif defined(CONFIG_LOONGSON1_LS1C)
 		return "LOONGSON LS1C";
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 81d6a15..567beef 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1366,6 +1366,16 @@ static void probe_pcache(void)
 		c->options |= MIPS_CPU_PREFETCH;
 		break;
 
+	case CPU_LOONGSON1:
+		if (read_c0_config7() & MIPS_CONF7_AR) {
+			/*
+			 * effectively physically indexed dcache,
+			 * thus no virtual aliases.
+			 */
+			c->dcache.flags |= MIPS_CACHE_PINDEX;
+			break;
+		}
+
 	default:
 		if (!(config & MIPS_CONF_M))
 			panic("Don't know how to probe P-caches on this cpu.");
-- 
2.9.4

  parent reply	other threads:[~2017-08-29  8:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29  8:38 [PATCH RESEND v8 0/9] MIPS: Loongson: Add the Loongson-1A processor support Binbin Zhou
2017-08-29  8:38 ` [PATCH RESEND v8 1/9] MIPS: Loongson: Merge PRID macro for Loongson-1A/1B/1C Binbin Zhou
2017-08-29  8:38 ` [PATCH RESEND v8 2/9] MIPS: Loongson: Expand Loongson-1's register definition Binbin Zhou
2017-08-29  8:38 ` Binbin Zhou [this message]
2017-08-29  8:38 ` [PATCH RESEND v8 4/9] MIPS: Loongson: Add Loongson-1A Kconfig options Binbin Zhou
2017-08-29  8:38 ` [PATCH RESEND v8 5/9] MIPS: Loongson: Add platform devices for Loongson-1A Binbin Zhou
2017-08-29  8:38 ` [PATCH RESEND v8 6/9] MIPS: Loongson: Add Loongson-1A board support Binbin Zhou
2017-08-29  8:38 ` [PATCH RESEND v8 7/9] clk: Loongson: A descriptive spinlock name for Loongson1's clk driver Binbin Zhou
2017-08-29  8:38 ` [PATCH RESEND v8 8/9] clk: Loongson: Add Loongson-1A clock support Binbin Zhou
2017-08-29  8:38 ` [PATCH RESEND v8 9/9] MIPS: Loongson: Add Loongson-1A default config file Binbin Zhou

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=1503995926-17125-4-git-send-email-zhoubb@lemote.com \
    --to=zhoubb@lemote.com \
    --cc=Steven.Hill@imgtec.com \
    --cc=Yeking@Red54.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhc@lemote.com \
    --cc=gnaygnil@gmail.com \
    --cc=james.hogan@imgtec.com \
    --cc=john@phrozen.org \
    --cc=keguang.zhang@gmail.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mturquette@baylibre.com \
    --cc=ralf@linux-mips.org \
    --cc=sboyd@codeaurora.org \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /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.