From: Finn Thain <fthain@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Daniel Palmer <daniel@0x0f.com>,
stable@kernel.org, linux-m68k@lists.linux-m68k.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] m68k: mvme147: Reinstate early console
Date: Wed, 06 Nov 2024 10:51:24 +1100 [thread overview]
Message-ID: <a82e8f0068a8722996a0ccfe666abb5e0a5c120d.1730850684.git.fthain@linux-m68k.org> (raw)
From: Daniel Palmer <daniel@0x0f.com>
Commit a38eaa07a0ce ("m68k/mvme147: config.c - Remove unused functions"),
removed the console functionality for the mvme147 instead of wiring it
up to an early console. Put the console write function back and wire it up
like mvme16x does so it's possible to see Linux boot on this fine hardware
once more.
Cc: Daniel Palmer <daniel@0x0f.com>
Cc: stable@kernel.org
Fixes: a38eaa07a0ce ("m68k/mvme147: config.c - Remove unused functions")
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
Co-developed-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Changed since previous submission:
- Added co-developed-by and reviewed-by tags.
- Use a static scc_delay() function instead of a macro.
This revision produces the same object code as the previous one.
Hence it doesn't need further testing.
---
arch/m68k/kernel/early_printk.c | 3 +++
arch/m68k/mvme147/config.c | 30 ++++++++++++++++++++++++++++++
arch/m68k/mvme147/mvme147.h | 6 ++++++
3 files changed, 39 insertions(+)
create mode 100644 arch/m68k/mvme147/mvme147.h
diff --git a/arch/m68k/kernel/early_printk.c b/arch/m68k/kernel/early_printk.c
index 3cc944df04f6..d9399be89ad3 100644
--- a/arch/m68k/kernel/early_printk.c
+++ b/arch/m68k/kernel/early_printk.c
@@ -14,6 +14,7 @@
#include "../mvme16x/mvme16x.h"
+#include "../mvme147/mvme147.h"
asmlinkage void __init debug_cons_nputs(const char *s, unsigned n);
@@ -24,6 +25,8 @@ static void __ref debug_cons_write(struct console *c,
defined(CONFIG_COLDFIRE))
if (MACH_IS_MVME16x)
mvme16x_cons_write(c, s, n);
+ else if (MACH_IS_MVME147)
+ mvme147_scc_write(c, s, n);
else
debug_cons_nputs(s, n);
#endif
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index 8b5dc07f0811..cc2fb0a83cf0 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -32,6 +32,7 @@
#include <asm/mvme147hw.h>
#include <asm/config.h>
+#include "mvme147.h"
static void mvme147_get_model(char *model);
extern void mvme147_sched_init(void);
@@ -185,3 +186,32 @@ int mvme147_hwclk(int op, struct rtc_time *t)
}
return 0;
}
+
+static void scc_delay(void)
+{
+ __asm__ __volatile__ ("nop; nop;");
+}
+
+static void scc_write(char ch)
+{
+ do {
+ scc_delay();
+ } while (!(in_8(M147_SCC_A_ADDR) & BIT(2)));
+ scc_delay();
+ out_8(M147_SCC_A_ADDR, 8);
+ scc_delay();
+ out_8(M147_SCC_A_ADDR, ch);
+}
+
+void mvme147_scc_write(struct console *co, const char *str, unsigned int count)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ while (count--) {
+ if (*str == '\n')
+ scc_write('\r');
+ scc_write(*str++);
+ }
+ local_irq_restore(flags);
+}
diff --git a/arch/m68k/mvme147/mvme147.h b/arch/m68k/mvme147/mvme147.h
new file mode 100644
index 000000000000..140bc98b0102
--- /dev/null
+++ b/arch/m68k/mvme147/mvme147.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+struct console;
+
+/* config.c */
+void mvme147_scc_write(struct console *co, const char *str, unsigned int count);
--
2.44.2
next reply other threads:[~2024-11-05 23:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 23:51 Finn Thain [this message]
2024-11-06 8:17 ` Geert Uytterhoeven
-- strict thread matches above, loose matches on Subject: below --
2024-10-03 3:29 Finn Thain
2024-11-05 14:48 ` Geert Uytterhoeven
2024-11-05 23:17 ` Finn Thain
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=a82e8f0068a8722996a0ccfe666abb5e0a5c120d.1730850684.git.fthain@linux-m68k.org \
--to=fthain@linux-m68k.org \
--cc=daniel@0x0f.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=stable@kernel.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®