Skip to content

Commit 01eb454

Browse files
committed
sh/cpu: Switch to arch_cpu_finalize_init()
check_bugs() is about to be phased out. Switch over to the new arch_cpu_finalize_init() implementation. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230613224545.371697797@linutronix.de
1 parent 7f066a2 commit 01eb454

File tree

5 files changed

+59
-74
lines changed

5 files changed

+59
-74
lines changed

arch/sh/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config SUPERH
66
select ARCH_ENABLE_MEMORY_HOTREMOVE if SPARSEMEM && MMU
77
select ARCH_HAVE_NMI_SAFE_CMPXCHG if (GUSA_RB || CPU_SH4A)
88
select ARCH_HAS_BINFMT_FLAT if !MMU
9+
select ARCH_HAS_CPU_FINALIZE_INIT
910
select ARCH_HAS_CURRENT_STACK_POINTER
1011
select ARCH_HAS_GIGANTIC_PAGE
1112
select ARCH_HAS_GCOV_PROFILE_ALL

arch/sh/include/asm/bugs.h

Lines changed: 0 additions & 74 deletions
This file was deleted.

arch/sh/include/asm/processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ extern unsigned int instruction_size(unsigned int insn);
166166
#define instruction_size(insn) (2)
167167
#endif
168168

169+
void select_idle_routine(void);
170+
169171
#endif /* __ASSEMBLY__ */
170172

171173
#include <asm/processor_32.h>

arch/sh/kernel/idle.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/irqflags.h>
1616
#include <linux/smp.h>
1717
#include <linux/atomic.h>
18+
#include <asm/processor.h>
1819
#include <asm/smp.h>
1920
#include <asm/bl_bit.h>
2021

arch/sh/kernel/setup.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <asm/smp.h>
4444
#include <asm/mmu_context.h>
4545
#include <asm/mmzone.h>
46+
#include <asm/processor.h>
4647
#include <asm/sparsemem.h>
4748
#include <asm/platform_early.h>
4849

@@ -354,3 +355,57 @@ int test_mode_pin(int pin)
354355
{
355356
return sh_mv.mv_mode_pins() & pin;
356357
}
358+
359+
void __init arch_cpu_finalize_init(void)
360+
{
361+
char *p = &init_utsname()->machine[2]; /* "sh" */
362+
363+
select_idle_routine();
364+
365+
current_cpu_data.loops_per_jiffy = loops_per_jiffy;
366+
367+
switch (current_cpu_data.family) {
368+
case CPU_FAMILY_SH2:
369+
*p++ = '2';
370+
break;
371+
case CPU_FAMILY_SH2A:
372+
*p++ = '2';
373+
*p++ = 'a';
374+
break;
375+
case CPU_FAMILY_SH3:
376+
*p++ = '3';
377+
break;
378+
case CPU_FAMILY_SH4:
379+
*p++ = '4';
380+
break;
381+
case CPU_FAMILY_SH4A:
382+
*p++ = '4';
383+
*p++ = 'a';
384+
break;
385+
case CPU_FAMILY_SH4AL_DSP:
386+
*p++ = '4';
387+
*p++ = 'a';
388+
*p++ = 'l';
389+
*p++ = '-';
390+
*p++ = 'd';
391+
*p++ = 's';
392+
*p++ = 'p';
393+
break;
394+
case CPU_FAMILY_UNKNOWN:
395+
/*
396+
* Specifically use CPU_FAMILY_UNKNOWN rather than
397+
* default:, so we're able to have the compiler whine
398+
* about unhandled enumerations.
399+
*/
400+
break;
401+
}
402+
403+
pr_info("CPU: %s\n", get_cpu_subtype(&current_cpu_data));
404+
405+
#ifndef __LITTLE_ENDIAN__
406+
/* 'eb' means 'Endian Big' */
407+
*p++ = 'e';
408+
*p++ = 'b';
409+
#endif
410+
*p = '\0';
411+
}

0 commit comments

Comments
 (0)