From: Fredrik Noring <noring@nocrew.org>
To: "Maciej W. Rozycki" <macro@imgtec.com>
Cc: linux-mips@linux-mips.org
Subject: [PATCH v2] MIPS: Add basic R5900 support
Date: Sat, 2 Sep 2017 16:10:13 +0200 [thread overview]
Message-ID: <20170902141013.GB2602@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.2.00.1708271511430.17596@tp.orcam.me.uk>
Signed-off-by: Fredrik Noring <noring@nocrew.org>
---
Hi Maciej,
Here is revised patch. I've added arch/mips/mm/c-r4k.c and I'm unsure about
c->options |= MIPS_CPU_CACHE_CDEX_P | MIPS_CPU_PREFETCH;
but similar architectures have MIPS_CPU_CACHE_CDEX_P and R5900 has a PREF
instruction. As indicated in the comment, it's not entirely clear why
if (c->dcache.waysize > PAGE_SIZE)
c->dcache.flags |= MIPS_CACHE_ALIASES;
is necessary. I've also added arch/mips/Makefile.
arch/mips/Kconfig | 12 ++++++++++++
arch/mips/Makefile | 2 ++
arch/mips/include/asm/cpu-type.h | 4 ++++
arch/mips/include/asm/cpu.h | 3 ++-
arch/mips/include/asm/module.h | 2 ++
arch/mips/kernel/cpu-probe.c | 11 +++++++++++
arch/mips/mm/c-r4k.c | 25 +++++++++++++++++++++++++
7 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2828ecde133d..aec56966484b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1708,6 +1708,15 @@ config CPU_BMIPS
help
Support for BMIPS32/3300/4350/4380 and BMIPS5000 processors.
+config CPU_R5900
+ bool "R5900"
+ depends on SYS_HAS_CPU_R5900
+ select CPU_SUPPORTS_32BIT_KERNEL
+ select CPU_SUPPORTS_64BIT_KERNEL
+ select IRQ_MIPS_CPU
+ help
+ MIPS Technologies R5900 processor (Emotion Engine in Sony Playstation 2).
+
config CPU_XLR
bool "Netlogic XLR SoC"
depends on SYS_HAS_CPU_XLR
@@ -1938,6 +1947,9 @@ config SYS_HAS_CPU_R5432
config SYS_HAS_CPU_R5500
bool
+config SYS_HAS_CPU_R5900
+ bool
+
config SYS_HAS_CPU_R6000
bool
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 02a1787c888c..e8e2805a05c4 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -171,6 +171,8 @@ cflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \
-Wa,--trap
cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \
-Wa,--trap
+cflags-$(CONFIG_CPU_R5900) += -march=r5900 -mtune=r5900 \
+ -Wa,--trap -mno-llsc
cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
-Wa,--trap
cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h
index bdd6dc18e65c..5613ae2a0fe0 100644
--- a/arch/mips/include/asm/cpu-type.h
+++ b/arch/mips/include/asm/cpu-type.h
@@ -150,6 +150,10 @@ static inline int __pure __get_cpu_type(const int cpu_type)
case CPU_R5500:
#endif
+#ifdef CONFIG_SYS_HAS_CPU_R5900
+ case CPU_R5900:
+#endif
+
#ifdef CONFIG_SYS_HAS_CPU_R6000
case CPU_R6000:
case CPU_R6000A:
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 98f59307e6a3..19da9e4be440 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -80,6 +80,7 @@
#define PRID_IMP_R4650 0x2200 /* Same as R4640 */
#define PRID_IMP_R5000 0x2300
#define PRID_IMP_TX49 0x2d00
+#define PRID_IMP_R5900 0x2e00 /* Playstation 2 */
#define PRID_IMP_SONIC 0x2400
#define PRID_IMP_MAGIC 0x2500
#define PRID_IMP_RM7000 0x2700
@@ -296,7 +297,7 @@ enum cpu_type_enum {
CPU_R4700, CPU_R5000, CPU_R5500, CPU_NEVADA, CPU_R5432, CPU_R10000,
CPU_R12000, CPU_R14000, CPU_R16000, CPU_VR41XX, CPU_VR4111, CPU_VR4121,
CPU_VR4122, CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000,
- CPU_SR71000, CPU_TX49XX,
+ CPU_SR71000, CPU_TX49XX, CPU_R5900,
/*
* R8000 class processors
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h
index 702c273e67a9..5025b321604f 100644
--- a/arch/mips/include/asm/module.h
+++ b/arch/mips/include/asm/module.h
@@ -114,6 +114,8 @@ search_module_dbetables(unsigned long addr)
#define MODULE_PROC_FAMILY "R5432 "
#elif defined CONFIG_CPU_R5500
#define MODULE_PROC_FAMILY "R5500 "
+#elif defined CONFIG_CPU_R5900
+#define MODULE_PROC_FAMILY "R5900 "
#elif defined CONFIG_CPU_R6000
#define MODULE_PROC_FAMILY "R6000 "
#elif defined CONFIG_CPU_NEVADA
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 1aba27786bd5..c9431900d11f 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1383,6 +1383,17 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
MIPS_CPU_WATCH | MIPS_CPU_LLSC;
c->tlbsize = 48;
break;
+ case PRID_IMP_R5900:
+ c->cputype = CPU_R5900;
+ __cpu_name[cpu] = "R5900";
+ c->isa_level = MIPS_CPU_ISA_III;
+ c->fpu_msk31 |= FPU_CSR_CONDX;
+ c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE |
+ MIPS_CPU_4KEX | MIPS_CPU_DIVEC |
+ MIPS_CPU_FPU | MIPS_CPU_32FPR |
+ MIPS_CPU_COUNTER;
+ c->tlbsize = 48;
+ break;
case PRID_IMP_NEVADA:
c->cputype = CPU_NEVADA;
__cpu_name[cpu] = "Nevada";
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 3fe99cb271a9..0420ce8fb086 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1192,6 +1192,20 @@ static void probe_pcache(void)
c->options |= MIPS_CPU_CACHE_CDEX_P | MIPS_CPU_PREFETCH;
break;
+ case CPU_R5900:
+ icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
+ c->icache.linesz = 64;
+ c->icache.ways = 2;
+ c->icache.waybit = 0;
+
+ dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
+ c->dcache.linesz = 64;
+ c->dcache.ways = 2;
+ c->dcache.waybit = 0;
+
+ c->options |= MIPS_CPU_CACHE_CDEX_P | MIPS_CPU_PREFETCH;
+ break;
+
case CPU_TX49XX:
icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
@@ -1465,6 +1479,17 @@ static void probe_pcache(void)
case CPU_R16000:
break;
+ case CPU_R5900:
+ if (c->icache.waysize > PAGE_SIZE)
+ c->dcache.flags |= MIPS_CACHE_ALIASES;
+ /*
+ * There seems to be a missing d-cache flush which is fixed
+ * with MIPS_CACHE_ALIASES.
+ */
+ if (c->dcache.waysize > PAGE_SIZE)
+ c->dcache.flags |= MIPS_CACHE_ALIASES;
+ break;
+
case CPU_74K:
case CPU_1074K:
has_74k_erratum = alias_74k_erratum(c);
--
2.13.4
next prev parent reply other threads:[~2017-09-02 14:10 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-27 13:23 [PATCH] MIPS: Add basic R5900 support Fredrik Noring
2017-08-28 13:53 ` Ralf Baechle
2017-08-28 17:11 ` Maciej W. Rozycki
2017-08-29 17:33 ` Fredrik Noring
2017-08-29 17:24 ` Maciej W. Rozycki
2017-08-29 17:24 ` Maciej W. Rozycki
2017-08-30 13:23 ` Fredrik Noring
2017-08-31 15:11 ` Maciej W. Rozycki
2017-08-31 15:11 ` Maciej W. Rozycki
2017-09-02 10:28 ` Fredrik Noring
2017-09-09 10:13 ` Maciej W. Rozycki
2017-09-09 10:13 ` Maciej W. Rozycki
2017-09-11 5:21 ` Maciej W. Rozycki
2017-09-11 5:21 ` Maciej W. Rozycki
2017-09-12 17:59 ` Fredrik Noring
2017-09-15 11:12 ` Maciej W. Rozycki
2017-09-15 11:12 ` Maciej W. Rozycki
2017-09-15 13:19 ` Fredrik Noring
2017-09-15 18:28 ` Maciej W. Rozycki
2017-09-15 18:28 ` Maciej W. Rozycki
2017-09-02 14:10 ` Fredrik Noring [this message]
2017-09-11 5:18 ` [PATCH v2] " Maciej W. Rozycki
2017-09-11 5:18 ` Maciej W. Rozycki
2017-09-11 15:17 ` Fredrik Noring
2017-09-14 13:50 ` Maciej W. Rozycki
2017-09-14 13:50 ` Maciej W. Rozycki
2017-09-16 13:34 ` Fredrik Noring
2017-09-18 17:05 ` Maciej W. Rozycki
2017-09-18 17:05 ` Maciej W. Rozycki
2017-09-18 19:24 ` Fredrik Noring
2017-09-19 12:44 ` Maciej W. Rozycki
2017-09-19 12:44 ` Maciej W. Rozycki
2017-09-20 14:54 ` Fredrik Noring
2017-09-26 11:50 ` Maciej W. Rozycki
2017-09-26 11:50 ` Maciej W. Rozycki
2017-09-27 17:21 ` Fredrik Noring
2017-09-28 12:13 ` Maciej W. Rozycki
2017-09-28 12:13 ` Maciej W. Rozycki
2017-09-30 6:56 ` Fredrik Noring
2017-10-02 9:05 ` Maciej W. Rozycki
2017-10-02 9:05 ` Maciej W. Rozycki
2017-10-02 16:33 ` Fredrik Noring
2017-10-29 17:20 ` Fredrik Noring
2017-11-10 23:34 ` Maciej W. Rozycki
2017-11-10 23:34 ` Maciej W. Rozycki
2017-11-11 16:04 ` Fredrik Noring
2018-01-29 20:27 ` Fredrik Noring
2018-01-31 23:01 ` Maciej W. Rozycki
2018-02-11 7:29 ` [RFC] MIPS: R5900: Workaround for the short loop bug Fredrik Noring
2018-02-12 9:25 ` Maciej W. Rozycki
2018-02-12 15:22 ` Fredrik Noring
2018-02-11 7:46 ` [RFC] MIPS: R5900: Use SYNC.L for data cache and SYNC.P for instruction cache Fredrik Noring
2018-02-11 7:56 ` [RFC] MIPS: R5900: Workaround exception NOP execution bug (FLX05) Fredrik Noring
2018-02-12 9:28 ` Maciej W. Rozycki
2018-02-15 19:15 ` [RFC v2] " Fredrik Noring
2018-02-15 20:49 ` Maciej W. Rozycki
2018-02-17 11:16 ` Fredrik Noring
2018-02-17 11:57 ` Maciej W. Rozycki
2018-02-17 13:38 ` Fredrik Noring
2018-02-17 15:03 ` Maciej W. Rozycki
2018-02-17 20:04 ` Fredrik Noring
2018-02-20 14:09 ` Maciej W. Rozycki
2018-02-22 17:04 ` Fredrik Noring
2018-02-18 8:47 ` Fredrik Noring
2018-02-20 14:41 ` Maciej W. Rozycki
2018-02-22 17:27 ` Fredrik Noring
2018-02-11 8:01 ` [RFC] MIPS: R5900: Workaround for CACHE instruction near branch delay slot Fredrik Noring
2018-02-11 11:16 ` Aw: " "Jürgen Urban"
2018-02-11 8:09 ` [RFC] MIPS: R5900: The ERET instruction has issues with delay slot and CACHE Fredrik Noring
2018-02-11 11:07 ` Aw: " "Jürgen Urban"
2018-02-11 8:29 ` [RFC] MIPS: R5900: Use mandatory SYNC.L in exception handlers Fredrik Noring
2018-02-11 10:33 ` Aw: " "Jürgen Urban"
2018-02-12 9:22 ` Maciej W. Rozycki
2018-02-12 9:22 ` Maciej W. Rozycki
2018-02-18 10:30 ` Fredrik Noring
2018-02-17 14:43 ` [RFC] MIPS: R5900: Workaround for saving and restoring FPU registers Fredrik Noring
2018-02-17 15:18 ` Maciej W. Rozycki
2018-02-17 17:47 ` Fredrik Noring
2018-02-17 19:33 ` Maciej W. Rozycki
2018-02-18 9:26 ` [RFC] MIPS: R5900: Workaround where MSB must be 0 for the instruction cache Fredrik Noring
2018-02-18 11:08 ` [RFC] MIPS: R5900: Add mandatory SYNC.P to all M[FT]C0 instructions Fredrik Noring
2018-03-03 12:26 ` [RFC] MIPS: PS2: Interrupt request (IRQ) support Fredrik Noring
2018-03-03 13:09 ` Maciej W. Rozycki
2018-03-03 14:14 ` Fredrik Noring
2018-04-09 15:51 ` Fredrik Noring
2018-03-18 10:45 ` Fredrik Noring
2018-03-19 19:15 ` Thomas Gleixner
2018-06-18 18:52 ` [RFC v2] " Fredrik Noring
2017-10-30 17:55 ` [PATCH v2] MIPS: Add basic R5900 support Fredrik Noring
2017-11-24 10:26 ` Maciej W. Rozycki
2017-11-24 10:26 ` Maciej W. Rozycki
2017-11-24 10:39 ` Maciej W. Rozycki
2017-11-24 10:39 ` Maciej W. Rozycki
2017-09-20 14:07 ` Fredrik Noring
2017-09-21 21:07 ` Maciej W. Rozycki
2017-09-21 21:07 ` Maciej W. Rozycki
2017-09-22 16:37 ` Fredrik Noring
2017-09-22 16:37 ` Fredrik Noring
2017-09-29 23:55 ` Maciej W. Rozycki
2017-09-29 23:55 ` Maciej W. Rozycki
2017-09-30 18:26 ` Fredrik Noring
2017-10-02 9:11 ` Maciej W. Rozycki
2017-10-02 9:11 ` Maciej W. Rozycki
2017-10-03 19:49 ` Fredrik Noring
2017-10-05 19:04 ` Fredrik Noring
2017-10-06 20:28 ` Fredrik Noring
2017-10-15 16:39 ` Fredrik Noring
2017-10-17 12:23 ` Maciej W. Rozycki
2017-10-17 12:23 ` Maciej W. Rozycki
2017-10-21 18:00 ` Fredrik Noring
2017-10-23 16:10 ` Maciej W. Rozycki
2017-10-23 16:10 ` Maciej W. Rozycki
2017-09-21 18:11 ` Paul Burton
2017-09-21 18:11 ` Paul Burton
2017-09-21 19:48 ` Maciej W. Rozycki
2017-09-21 19:48 ` Maciej W. Rozycki
2017-10-29 18:42 ` Fredrik Noring
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=20170902141013.GB2602@localhost.localdomain \
--to=noring@nocrew.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@imgtec.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox