From: Daniel Palmer <daniel@0x0f.com>
To: linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org, geert@linux-m68k.org,
gerg@linux-m68k.org, Daniel Palmer <daniel@0x0f.com>
Subject: [PATCH] m68k/mvme147: Fix console for mvme147
Date: Sun, 1 Sep 2024 02:38:02 +0900 [thread overview]
Message-ID: <20240831173802.2805586-1-daniel@0x0f.com> (raw)
Commit a38eaa07a0ce ("m68k/mvme147: config.c - Remove unused functions"),
removed the console functionality for the mvme147 and it never got put
back and/or wired up again.
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.
Fixes: a38eaa07a0ce ("m68k/mvme147: config.c - Remove unused functions")
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
arch/m68k/kernel/early_printk.c | 3 +++
arch/m68k/mvme147/config.c | 37 +++++++++++++++++++++++++++++++++
arch/m68k/mvme147/mvme147.h | 6 ++++++
3 files changed, 46 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..260179d2ed93 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)
+ m147_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..d62a0be13796 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,39 @@ int mvme147_hwclk(int op, struct rtc_time *t)
}
return 0;
}
+
+static void scc_delay(void)
+{
+ int n;
+ volatile int trash;
+
+ for (n = 0; n < 20; n++)
+ trash = n;
+}
+
+static void scc_write(char ch)
+{
+ volatile char *p = (volatile char *) M147_SCC_A_ADDR;
+
+ do {
+ scc_delay();
+ } while (!(*p & 4));
+ scc_delay();
+ *p = 8;
+ scc_delay();
+ *p = ch;
+}
+
+void m147_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..a6611b540bb2
--- /dev/null
+++ b/arch/m68k/mvme147/mvme147.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+struct console;
+
+/* config.c */
+void m147_scc_write(struct console *co, const char *str, unsigned int count);
--
2.43.0
next reply other threads:[~2024-08-31 17:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-31 17:38 Daniel Palmer [this message]
2024-09-01 4:21 ` [PATCH] m68k/mvme147: Fix console for mvme147 kernel test robot
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=20240831173802.2805586-1-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