arch/m68k/kernel/early_printk.c | 3 +++ arch/m68k/mvme147/config.c | 27 +++++++++++++++++++++++++++ arch/m68k/mvme147/mvme147.h | 6 ++++++ 3 files changed, 36 insertions(+) create mode 100644 arch/m68k/mvme147/mvme147.h
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>
Reviewed-by: Finn Thain <fthain@linux-m68k.org>
---
arch/m68k/kernel/early_printk.c | 3 +++
arch/m68k/mvme147/config.c | 27 +++++++++++++++++++++++++++
arch/m68k/mvme147/mvme147.h | 6 ++++++
3 files changed, 36 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 e2560c6d10b4..536244a181ef 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -33,6 +33,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);
@@ -177,3 +178,29 @@ static u64 mvme147_read_clk(struct clocksource *cs)
return ticks;
}
+
+#define SCC_DELAY do { __asm__ __volatile__ ("nop; nop;"); } while (0)
+
+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.39.5
Hi Finn, Daniel, On Thu, Oct 3, 2024 at 5:32 AM Finn Thain <fthain@linux-m68k.org> wrote: > 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. Thanks for your patch! > 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> > Reviewed-by: Finn Thain <fthain@linux-m68k.org> As this patch differs from Daniel's original, I guess you want Co-deloped-by: Daniel Palmer <daniel@0x0f.com> Signed-off-by: Daniel Palmer <daniel@0x0f.com> Co-deloped-by: Finn Thain <fthain@linux-m68k.org> Signed-off-by: Finn Thain <fthain@linux-m68k.org> instead? > --- a/arch/m68k/mvme147/config.c > +++ b/arch/m68k/mvme147/config.c > @@ -33,6 +33,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); > @@ -177,3 +178,29 @@ static u64 mvme147_read_clk(struct clocksource *cs) > > return ticks; > } > + > +#define SCC_DELAY do { __asm__ __volatile__ ("nop; nop;"); } while (0) Please keep on using a static (inline) function instead of a macro. > + > +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); > +} The rest LGTM, so Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
On Tue, 5 Nov 2024, Geert Uytterhoeven wrote: > > 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> > > Reviewed-by: Finn Thain <fthain@linux-m68k.org> > > As this patch differs from Daniel's original, I guess you want > > Co-deloped-by: Daniel Palmer <daniel@0x0f.com> > Signed-off-by: Daniel Palmer <daniel@0x0f.com> > Co-deloped-by: Finn Thain <fthain@linux-m68k.org> > Signed-off-by: Finn Thain <fthain@linux-m68k.org> > > instead? > No problem. > > --- a/arch/m68k/mvme147/config.c > > +++ b/arch/m68k/mvme147/config.c > > @@ -33,6 +33,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); > > @@ -177,3 +178,29 @@ static u64 mvme147_read_clk(struct clocksource *cs) > > > > return ticks; > > } > > + > > +#define SCC_DELAY do { __asm__ __volatile__ ("nop; nop;"); } while (0) > > Please keep on using a static (inline) function instead of a macro. > Will do. > > + > > +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); > > +} > > The rest LGTM, so > Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> > Thanks.
© 2016 - 2024 Red Hat, Inc.