Skip to content

Commit 077b33b

Browse files
fifteenhexgeertu
authored andcommitted
m68k: mvme147: Reinstate early console
Commit a38eaa0 ("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. Fixes: a38eaa0 ("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> Link: https://lore.kernel.org/a82e8f0068a8722996a0ccfe666abb5e0a5c120d.1730850684.git.fthain@linux-m68k.org Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
1 parent b6fb218 commit 077b33b

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

arch/m68k/kernel/early_printk.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <asm/setup.h>
1414

1515

16+
#include "../mvme147/mvme147.h"
1617
#include "../mvme16x/mvme16x.h"
1718

1819
asmlinkage void __init debug_cons_nputs(const char *s, unsigned n);
@@ -22,7 +23,9 @@ static void __ref debug_cons_write(struct console *c,
2223
{
2324
#if !(defined(CONFIG_SUN3) || defined(CONFIG_M68000) || \
2425
defined(CONFIG_COLDFIRE))
25-
if (MACH_IS_MVME16x)
26+
if (MACH_IS_MVME147)
27+
mvme147_scc_write(c, s, n);
28+
else if (MACH_IS_MVME16x)
2629
mvme16x_cons_write(c, s, n);
2730
else
2831
debug_cons_nputs(s, n);

arch/m68k/mvme147/config.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <asm/mvme147hw.h>
3333
#include <asm/config.h>
3434

35+
#include "mvme147.h"
3536

3637
static void mvme147_get_model(char *model);
3738
static void __init mvme147_sched_init(void);
@@ -185,3 +186,32 @@ int mvme147_hwclk(int op, struct rtc_time *t)
185186
}
186187
return 0;
187188
}
189+
190+
static void scc_delay(void)
191+
{
192+
__asm__ __volatile__ ("nop; nop;");
193+
}
194+
195+
static void scc_write(char ch)
196+
{
197+
do {
198+
scc_delay();
199+
} while (!(in_8(M147_SCC_A_ADDR) & BIT(2)));
200+
scc_delay();
201+
out_8(M147_SCC_A_ADDR, 8);
202+
scc_delay();
203+
out_8(M147_SCC_A_ADDR, ch);
204+
}
205+
206+
void mvme147_scc_write(struct console *co, const char *str, unsigned int count)
207+
{
208+
unsigned long flags;
209+
210+
local_irq_save(flags);
211+
while (count--) {
212+
if (*str == '\n')
213+
scc_write('\r');
214+
scc_write(*str++);
215+
}
216+
local_irq_restore(flags);
217+
}

arch/m68k/mvme147/mvme147.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+
struct console;
4+
5+
/* config.c */
6+
void mvme147_scc_write(struct console *co, const char *str, unsigned int count);

0 commit comments

Comments
 (0)