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 3/4] m68k: Add helpers to read and write the 68060's PCR
Date: Thu, 19 Nov 2026 21:35:57 +0900 [thread overview]
Message-ID: <20261119123558.2108296-4-daniel@0x0f.com> (raw)
In-Reply-To: <20261119123558.2108296-1-daniel@0x0f.com>
We access the PCR in a few places and the next commit will
add another so refactor the PCR accesses into a little helper.
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
arch/m68k/atari/config.c | 7 ++-----
arch/m68k/include/asm/m68060.h | 19 +++++++++++++++++++
arch/m68k/kernel/setup_mm.c | 7 ++-----
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index bdafc86241b7..a63117891410 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -47,6 +47,7 @@
#include <asm/hwtest.h>
#include <asm/io.h>
#include <asm/config.h>
+#include <asm/m68060.h>
#include "atari.h"
@@ -512,11 +513,7 @@ static void atari_reset(void)
unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
if (CPU_IS_060) {
/* 68060: clear PCR to turn off superscalar operation */
- asm volatile ("\n"
- " .chip 68060\n"
- " movec %0,%%pcr\n"
- " .chip 68k"
- : : "d" (0));
+ m68060_set_pcr(0);
}
asm volatile ("\n"
diff --git a/arch/m68k/include/asm/m68060.h b/arch/m68k/include/asm/m68060.h
index a69ccde11693..3d9d0f1a741f 100644
--- a/arch/m68k/include/asm/m68060.h
+++ b/arch/m68k/include/asm/m68060.h
@@ -12,4 +12,23 @@
#define M68060_PCR_DFP 0x00000002 /* disable the FPU */
#define M68060_PCR_ESS 0x00000001 /* enable superscalar dispatch */
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+
+static inline u32 m68060_get_pcr(void)
+{
+ u32 pcr;
+
+ asm volatile (".chip 68060; movec %%pcr,%0; .chip 68k" : "=d" (pcr));
+ return pcr;
+}
+
+static inline void m68060_set_pcr(u32 pcr)
+{
+ asm volatile (".chip 68060; movec %0,%%pcr; .chip 68k" : : "d" (pcr));
+}
+
+#endif /* __ASSEMBLY__ */
+
#endif /* _ASM_M68K_M68060_H */
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 7abff6266837..41b595256ad1 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -230,14 +230,11 @@ void __init setup_arch(char **cmdline_p)
#endif
if (CPU_IS_060) {
- u32 pcr;
+ u32 pcr = m68060_get_pcr();
- asm (".chip 68060; movec %%pcr,%0; .chip 68k"
- : "=d" (pcr));
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 | M68060_PCR_I14));
+ m68060_set_pcr(pcr | M68060_PCR_I14);
}
}
--
2.55.0
next prev 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 ` [PATCH 2/4] m68k: Add and use defines for 68060 PCR register Daniel Palmer
2026-11-19 12:35 ` Daniel Palmer [this message]
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-4-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®