Commit 077b33b9 authored by Daniel Palmer's avatar Daniel Palmer Committed by Geert Uytterhoeven
Browse files

m68k: mvme147: Reinstate early console



Commit a38eaa07 ("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: a38eaa07 ("m68k/mvme147: config.c - Remove unused functions")
Signed-off-by: default avatarDaniel Palmer <daniel@0x0f.com>
Co-developed-by: default avatarFinn Thain <fthain@linux-m68k.org>
Signed-off-by: default avatarFinn Thain <fthain@linux-m68k.org>
Reviewed-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/a82e8f0068a8722996a0ccfe666abb5e0a5c120d.1730850684.git.fthain@linux-m68k.org


Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent b6fb218c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <asm/setup.h>


#include "../mvme147/mvme147.h"
#include "../mvme16x/mvme16x.h"

asmlinkage void __init debug_cons_nputs(const char *s, unsigned n);
@@ -22,7 +23,9 @@ static void __ref debug_cons_write(struct console *c,
{
#if !(defined(CONFIG_SUN3) || defined(CONFIG_M68000) || \
      defined(CONFIG_COLDFIRE))
	if (MACH_IS_MVME16x)
	if (MACH_IS_MVME147)
		mvme147_scc_write(c, s, n);
	else if (MACH_IS_MVME16x)
		mvme16x_cons_write(c, s, n);
	else
		debug_cons_nputs(s, n);
+30 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
#include <asm/mvme147hw.h>
#include <asm/config.h>

#include "mvme147.h"

static void mvme147_get_model(char *model);
static void __init 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);
}
+6 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */

struct console;

/* config.c */
void mvme147_scc_write(struct console *co, const char *str, unsigned int count);