mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Palmer <daniel@0x0f.com>
To: geert@linux-m68k.org, gerg@linux-m68k.org,
	linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org, Daniel Palmer <daniel@0x0f.com>
Subject: [PATCH 2/4] m68k: Add and use defines for 68060 PCR register
Date: Thu, 19 Nov 2026 21:35:56 +0900	[thread overview]
Message-ID: <20261119123558.2108296-3-daniel@0x0f.com> (raw)
In-Reply-To: <20261119123558.2108296-1-daniel@0x0f.com>

Add some defines for the various bits in the 68060s
PCR register and then remove the magic numbers in the
places that use them.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/m68k/include/asm/m68060.h | 15 +++++++++++++++
 arch/m68k/kernel/head.S        |  3 ++-
 arch/m68k/kernel/setup_mm.c    |  6 ++++--
 3 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 arch/m68k/include/asm/m68060.h

diff --git a/arch/m68k/include/asm/m68060.h b/arch/m68k/include/asm/m68060.h
new file mode 100644
index 000000000000..a69ccde11693
--- /dev/null
+++ b/arch/m68k/include/asm/m68060.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_M68K_M68060_H
+#define _ASM_M68K_M68060_H
+
+/* From MC68060 User's Manual (section 3.2.2.5) */
+#define M68060_PCR_ID		0xffff0000
+#define M68060_PCR_ID_68060	0x0430
+#define M68060_PCR_ID_68LC060	0x0431		/* LC or EC */
+#define M68060_PCR_REVISION	0x0000ff00
+#define M68060_PCR_EDEBUG	0x00000080	/* internal state on idle bus cycles */
+#define M68060_PCR_I14		0x00000020	/* Reserved: errata I14 workaround */
+#define M68060_PCR_DFP		0x00000002	/* disable the FPU */
+#define M68060_PCR_ESS		0x00000001	/* enable superscalar dispatch */
+
+#endif /* _ASM_M68K_M68060_H */
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 502eeae49eaf..7d90069e9af1 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -264,6 +264,7 @@
 #include <asm/entry.h>
 #include <asm/page.h>
 #include <asm/asm-offsets.h>
+#include <asm/m68060.h>
 #ifdef CONFIG_MAC
 #  include <asm/machw.h>
 #endif
@@ -1484,7 +1485,7 @@ L(cache68060):
 	/* MMU stuff works in copyback mode now, so enable the cache */
 	movec	%d0,%cacr
 	/* enable superscalar dispatch in PCR */
-	moveq	#1,%d0
+	moveq	#M68060_PCR_ESS,%d0
 	.chip	68060
 	movec	%d0,%pcr
 
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 51b5881078cd..7abff6266837 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -9,6 +9,7 @@
  * This file handles the architecture-dependent parts of system setup
  */
 
+#include <linux/bitfield.h>
 #include <linux/kernel.h>
 #include <linux/cpu.h>
 #include <linux/mm.h>
@@ -35,6 +36,7 @@
 #include <asm/fpu.h>
 #include <asm/irq.h>
 #include <asm/io.h>
+#include <asm/m68060.h>
 #include <asm/machdep.h>
 #ifdef CONFIG_AMIGA
 #include <asm/amigahw.h>
@@ -232,10 +234,10 @@ void __init setup_arch(char **cmdline_p)
 
 		asm (".chip 68060; movec %%pcr,%0; .chip 68k"
 		     : "=d" (pcr));
-		if (((pcr >> 8) & 0xff) <= 5) {
+		if (FIELD_GET(M68060_PCR_REVISION, pcr) <= 5) {
 			pr_warn("Enabling workaround for errata I14\n");
 			asm (".chip 68060; movec %0,%%pcr; .chip 68k"
-			     : : "d" (pcr | 0x20));
+			     : : "d" (pcr | M68060_PCR_I14));
 		}
 	}
 
-- 
2.55.0


  parent reply	other threads:[~2026-11-19 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 12:35 [PATCH 0/4] m68k: Add 060 PCR info to /proc/cpuinfo Daniel Palmer
2026-11-19 12:35 ` [PATCH 1/4] m68k: Add and use wrapper for FPU inline asm Daniel Palmer
2026-11-19 12:35 ` Daniel Palmer [this message]
2026-11-19 12:35 ` [PATCH 3/4] m68k: Add helpers to read and write the 68060's PCR Daniel Palmer
2026-11-19 12:35 ` [PATCH 4/4] m68k: show the 68060's PCR in /proc/cpuinfo Daniel Palmer

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=20261119123558.2108296-3-daniel@0x0f.com \
    --to=daniel@0x0f.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    /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

all inboxes | Powered by JetHome®