[PATCH] m68k/mvme147: Fix console for mvme147

Daniel Palmer posted 1 patch 1 year, 5 months ago
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
[PATCH] m68k/mvme147: Fix console for mvme147
Posted by Daniel Palmer 1 year, 5 months ago
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
Re: [PATCH] m68k/mvme147: Fix console for mvme147
Posted by kernel test robot 1 year, 5 months ago
Hi Daniel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on geert-m68k/for-next]
[also build test WARNING on geert-m68k/for-linus gerg-m68knommu/for-next linus/master v6.11-rc5 next-20240830]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Daniel-Palmer/m68k-mvme147-Fix-console-for-mvme147/20240901-014003
base:   https://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git for-next
patch link:    https://lore.kernel.org/r/20240831173802.2805586-1-daniel%400x0f.com
patch subject: [PATCH] m68k/mvme147: Fix console for mvme147
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240901/202409011229.VWSluBzx-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240901/202409011229.VWSluBzx-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409011229.VWSluBzx-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/m68k/mvme147/config.c: In function 'scc_delay':
>> arch/m68k/mvme147/config.c:193:22: warning: variable 'trash' set but not used [-Wunused-but-set-variable]
     193 |         volatile int trash;
         |                      ^~~~~


vim +/trash +193 arch/m68k/mvme147/config.c

   189	
   190	static void scc_delay(void)
   191	{
   192		int n;
 > 193		volatile int trash;
   194	
   195		for (n = 0; n < 20; n++)
   196			trash = n;
   197	}
   198	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki