Skip to content

Commit 368dd5a

Browse files
Akira Takeuchidhowells
authored andcommitted
MN10300: And Panasonic AM34 subarch and implement SMP
Implement the Panasonic MN10300 AM34 CPU subarch and implement SMP support for MN10300. Also implement support for the MN2WS0060 processor and the ASB2364 evaluation board which are AM34 based. Signed-off-by: Akira Takeuchi <takeuchi.akr@jp.panasonic.com> Signed-off-by: Kiyoshi Owada <owada.kiyoshi@jp.panasonic.com> Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 04157a6 commit 368dd5a

80 files changed

Lines changed: 4495 additions & 482 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎MAINTAINERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4448,7 +4448,7 @@ L: platform-driver-x86@vger.kernel.org
44484448
S: Maintained
44494449
F: drivers/platform/x86/panasonic-laptop.c
44504450

4451-
PANASONIC MN10300/AM33 PORT
4451+
PANASONIC MN10300/AM33/AM34 PORT
44524452
M: David Howells <dhowells@redhat.com>
44534453
M: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
44544454
L: linux-am33-list@redhat.com (moderated for non-subscribers)

‎arch/mn10300/Kconfig‎

Lines changed: 86 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ config GENERIC_CALIBRATE_DELAY
4848
def_bool y
4949

5050
config GENERIC_CMOS_UPDATE
51-
def_bool y
51+
def_bool n
5252

5353
config GENERIC_FIND_NEXT_BIT
5454
def_bool y
@@ -72,10 +72,6 @@ config GENERIC_HARDIRQS
7272
config HOTPLUG_CPU
7373
def_bool n
7474

75-
config HZ
76-
int
77-
default 1000
78-
7975
mainmenu "Matsushita MN10300/AM33 Kernel Configuration"
8076

8177
source "init/Kconfig"
@@ -98,6 +94,9 @@ config MN10300_UNIT_ASB2303
9894
config MN10300_UNIT_ASB2305
9995
bool "ASB2305"
10096

97+
config MN10300_UNIT_ASB2364
98+
bool "ASB2364"
99+
101100
endchoice
102101

103102
choice
@@ -115,17 +114,13 @@ config MN10300_PROC_MN103E010
115114
select MN10300_PROC_HAS_TTYSM1
116115
select MN10300_PROC_HAS_TTYSM2
117116

118-
endchoice
119-
120-
choice
121-
prompt "Processor core support"
122-
default MN10300_CPU_AM33V2
123-
help
124-
This option specifies the processor core for which the kernel will be
125-
compiled. It affects the instruction set used.
126-
127-
config MN10300_CPU_AM33V2
128-
bool "AM33v2"
117+
config MN10300_PROC_MN2WS0050
118+
bool "MN2WS0050"
119+
depends on MN10300_UNIT_ASB2364
120+
select AM34_2
121+
select MN10300_PROC_HAS_TTYSM0
122+
select MN10300_PROC_HAS_TTYSM1
123+
select MN10300_PROC_HAS_TTYSM2
129124

130125
endchoice
131126

@@ -138,7 +133,7 @@ config MN10300_HAS_ATOMIC_OPS_UNIT
138133
config FPU
139134
bool "FPU present"
140135
default y
141-
depends on MN10300_PROC_MN103E010
136+
depends on MN10300_PROC_MN103E010 || MN10300_PROC_MN2WS0050
142137

143138
config LAZY_SAVE_FPU
144139
bool "Save FPU state lazily"
@@ -179,24 +174,55 @@ config KERNEL_TEXT_ADDRESS
179174

180175
config KERNEL_ZIMAGE_BASE_ADDRESS
181176
hex "Base address of compressed vmlinux image"
182-
default "0x90700000"
177+
default "0x50700000"
178+
179+
config BOOT_STACK_OFFSET
180+
hex
181+
default "0xF00" if SMP
182+
default "0xFF0" if !SMP
183183

184+
config BOOT_STACK_SIZE
185+
hex
186+
depends on SMP
187+
default "0x100"
184188
endmenu
185189

186-
config PREEMPT
187-
bool "Preemptible Kernel"
188-
help
189-
This option reduces the latency of the kernel when reacting to
190-
real-time or interactive events by allowing a low priority process to
191-
be preempted even if it is in kernel mode executing a system call.
192-
This allows applications to run more reliably even when the system is
193-
under load.
190+
config SMP
191+
bool "Symmetric multi-processing support"
192+
default y
193+
depends on MN10300_PROC_MN2WS0038 || MN10300_PROC_MN2WS0050
194+
---help---
195+
This enables support for systems with more than one CPU. If you have
196+
a system with only one CPU, like most personal computers, say N. If
197+
you have a system with more than one CPU, say Y.
198+
199+
If you say N here, the kernel will run on single and multiprocessor
200+
machines, but will use only one CPU of a multiprocessor machine. If
201+
you say Y here, the kernel will run on many, but not all,
202+
singleprocessor machines. On a singleprocessor machine, the kernel
203+
will run faster if you say N here.
204+
205+
See also <file:Documentation/i386/IO-APIC.txt>,
206+
<file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
207+
<http://www.tldp.org/docs.html#howto>.
194208

195-
Say Y here if you are building a kernel for a desktop, embedded
196-
or real-time system. Say N if you are unsure.
209+
If you don't know what to do here, say N.
210+
211+
config NR_CPUS
212+
int
213+
depends on SMP
214+
default "2"
215+
216+
config USE_GENERIC_SMP_HELPERS
217+
bool
218+
depends on SMP
219+
default y
220+
221+
source "kernel/Kconfig.preempt"
197222

198223
config MN10300_CURRENT_IN_E2
199224
bool "Hold current task address in E2 register"
225+
depends on !SMP
200226
default y
201227
help
202228
This option removes the E2/R2 register from the set available to gcc
@@ -218,12 +244,14 @@ config MN10300_USING_JTAG
218244
suppresses the use of certain hardware debugging features, such as
219245
single-stepping, which are taken over completely by the JTAG unit.
220246

247+
source "kernel/Kconfig.hz"
248+
221249
config MN10300_RTC
222250
bool "Using MN10300 RTC"
223-
depends on MN10300_PROC_MN103E010
251+
depends on MN10300_PROC_MN103E010 || MN10300_PROC_MN2WS0050
252+
select GENERIC_CMOS_UPDATE
224253
default n
225254
help
226-
227255
This option enables support for the RTC, thus enabling time to be
228256
tracked, even when system is powered down. This is available on-chip
229257
on the MN103E010.
@@ -315,14 +343,23 @@ config MN10300_TTYSM1
315343

316344
choice
317345
prompt "Select the timer to supply the clock for SIF1"
318-
default MN10300_TTYSM0_TIMER9
346+
default MN10300_TTYSM1_TIMER12 \
347+
if !(AM33_2 || AM33_3)
348+
default MN10300_TTYSM1_TIMER9 \
349+
if AM33_2 || AM33_3
319350
depends on MN10300_TTYSM1
320351

352+
config MN10300_TTYSM1_TIMER12
353+
bool "Use timer 12 (16-bit)"
354+
depends on !(AM33_2 || AM33_3)
355+
321356
config MN10300_TTYSM1_TIMER9
322357
bool "Use timer 9 (16-bit)"
358+
depends on AM33_2 || AM33_3
323359

324360
config MN10300_TTYSM1_TIMER3
325361
bool "Use timer 3 (8-bit)"
362+
depends on AM33_2 || AM33_3
326363

327364
endchoice
328365

@@ -337,17 +374,33 @@ config MN10300_TTYSM2
337374

338375
choice
339376
prompt "Select the timer to supply the clock for SIF2"
340-
default MN10300_TTYSM0_TIMER10
377+
default MN10300_TTYSM2_TIMER3 \
378+
if !(AM33_2 || AM33_3)
379+
default MN10300_TTYSM2_TIMER10 \
380+
if AM33_2 || AM33_3
341381
depends on MN10300_TTYSM2
342382

383+
config MN10300_TTYSM2_TIMER9
384+
bool "Use timer 9 (16-bit)"
385+
depends on !(AM33_2 || AM33_3)
386+
387+
config MN10300_TTYSM2_TIMER1
388+
bool "Use timer 1 (8-bit)"
389+
depends on !(AM33_2 || AM33_3)
390+
391+
config MN10300_TTYSM2_TIMER3
392+
bool "Use timer 3 (8-bit)"
393+
depends on !(AM33_2 || AM33_3)
394+
343395
config MN10300_TTYSM2_TIMER10
344396
bool "Use timer 10 (16-bit)"
397+
depends on AM33_2 || AM33_3
345398

346399
endchoice
347400

348401
config MN10300_TTYSM2_CTS
349402
bool "Enable the use of the CTS line /dev/ttySM2"
350-
depends on MN10300_TTYSM2
403+
depends on MN10300_TTYSM2 && AM33_2
351404

352405
endmenu
353406

‎arch/mn10300/Makefile‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ endif
3636
ifeq ($(CONFIG_MN10300_PROC_MN103E010),y)
3737
PROCESSOR := mn103e010
3838
endif
39+
ifeq ($(CONFIG_MN10300_PROC_MN2WS0050),y)
40+
PROCESSOR := mn2ws0050
41+
endif
3942

4043
ifeq ($(CONFIG_MN10300_UNIT_ASB2303),y)
4144
UNIT := asb2303
4245
endif
4346
ifeq ($(CONFIG_MN10300_UNIT_ASB2305),y)
4447
UNIT := asb2305
4548
endif
49+
ifeq ($(CONFIG_MN10300_UNIT_ASB2364),y)
50+
UNIT := asb2364
51+
endif
4652

4753

4854
head-y := arch/mn10300/kernel/head.o arch/mn10300/kernel/init_task.o

‎arch/mn10300/boot/compressed/head.S‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,28 @@
1515
#include <linux/linkage.h>
1616
#include <asm/cpu-regs.h>
1717
#include <asm/cache.h>
18+
#ifdef CONFIG_SMP
19+
#include <proc/smp-regs.h>
20+
#endif
1821

1922
.globl startup_32
2023
startup_32:
21-
# first save off parameters from bootloader
24+
#ifdef CONFIG_SMP
25+
#
26+
# Secondary CPUs jump directly to the kernel entry point
27+
#
28+
# Must save primary CPU's D0-D2 registers as they hold boot parameters
29+
#
30+
mov (CPUID), d3
31+
and CPUID_MASK,d3
32+
beq startup_primary
33+
mov CONFIG_KERNEL_TEXT_ADDRESS,a0
34+
jmp (a0)
35+
36+
startup_primary:
37+
#endif /* CONFIG_SMP */
38+
39+
# first save parameters from bootloader
2240
mov param_save_area,a0
2341
mov d0,(a0)
2442
mov d1,(4,a0)

‎arch/mn10300/include/asm/exceptions.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ extern void die(const char *, struct pt_regs *, enum exception_code)
114114

115115
extern int die_if_no_fixup(const char *, struct pt_regs *, enum exception_code);
116116

117+
#define NUM2EXCEP_IRQ_LEVEL(num) (EXCEP_IRQ_LEVEL0 + (num) * 8)
118+
117119
#endif /* __ASSEMBLY__ */
118120

119121
#endif /* _ASM_EXCEPTIONS_H */

‎arch/mn10300/include/asm/frame.inc‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#ifndef __ASM_OFFSETS_H__
1919
#include <asm/asm-offsets.h>
2020
#endif
21+
#ifdef CONFIG_SMP
22+
#include <proc/smp-regs.h>
23+
#endif
2124

2225
#define pi break
2326

@@ -37,9 +40,25 @@
3740
movm [d2,d3,a2,a3,exreg0,exreg1,exother],(sp)
3841
mov sp,fp # FRAME pointer in A3
3942
add -12,sp # allow for calls to be made
43+
#ifdef CONFIG_SMP
44+
#ifdef CONFIG_PREEMPT /* FIXME */
45+
mov epsw,d2
46+
and ~EPSW_IE,epsw
47+
#endif
48+
mov (CPUID),a0
49+
add a0,a0
50+
add a0,a0
51+
mov (___frame,a0),a1
52+
mov a1,(REG_NEXT,fp)
53+
mov fp,(___frame,a0)
54+
#ifdef CONFIG_PREEMPT /* FIXME */
55+
mov d2,epsw
56+
#endif
57+
#else /* CONFIG_SMP */
4058
mov (__frame),a1
4159
mov a1,(REG_NEXT,fp)
4260
mov fp,(__frame)
61+
#endif /* CONFIG_SMP */
4362

4463
and ~EPSW_FE,epsw # disable the FPU inside the kernel
4564

@@ -57,10 +76,27 @@
5776
.macro RESTORE_ALL
5877
# peel back the stack to the calling frame
5978
# - this permits execve() to discard extra frames due to kernel syscalls
79+
#ifdef CONFIG_SMP
80+
#ifdef CONFIG_PREEMPT /* FIXME */
81+
mov epsw,d2
82+
and ~EPSW_IE,epsw
83+
#endif
84+
mov (CPUID),a0
85+
add a0,a0
86+
add a0,a0
87+
mov (___frame,a0),fp
88+
mov fp,sp
89+
mov (REG_NEXT,fp),d0 # userspace has regs->next == 0
90+
mov d0,(___frame,a0)
91+
#ifdef CONFIG_PREEMPT /* FIXME */
92+
mov d2,epsw
93+
#endif
94+
#else /* CONFIG_SMP */
6095
mov (__frame),fp
6196
mov fp,sp
6297
mov (REG_NEXT,fp),d0 # userspace has regs->next == 0
6398
mov d0,(__frame)
99+
#endif /* CONFIG_SMP */
64100

65101
#ifndef CONFIG_MN10300_USING_JTAG
66102
mov (REG_EPSW,fp),d0

‎arch/mn10300/include/asm/hardirq.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
/* assembly code in softirq.h is sensitive to the offsets of these fields */
2020
typedef struct {
2121
unsigned int __softirq_pending;
22+
#ifdef CONFIG_MN10300_WD_TIMER
2223
unsigned int __nmi_count; /* arch dependent */
2324
unsigned int __irq_count; /* arch dependent */
25+
#endif
2426
} ____cacheline_aligned irq_cpustat_t;
2527

2628
#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */

0 commit comments

Comments
 (0)