1# SPDX-License-Identifier: GPL-2.0-only
2config CSKY
3	def_bool y
4	select ARCH_32BIT_OFF_T
5	select ARCH_HAS_DMA_PREP_COHERENT
6	select ARCH_HAS_GCOV_PROFILE_ALL
7	select ARCH_HAS_SYNC_DMA_FOR_CPU
8	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
9	select ARCH_USE_BUILTIN_BSWAP
10	select ARCH_USE_QUEUED_RWLOCKS
11	select ARCH_WANT_FRAME_POINTERS if !CPU_CK610
12	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
13	select COMMON_CLK
14	select CLKSRC_MMIO
15	select CSKY_MPINTC if CPU_CK860
16	select CSKY_MP_TIMER if CPU_CK860
17	select CSKY_APB_INTC
18	select DMA_DIRECT_REMAP
19	select IRQ_DOMAIN
20	select HANDLE_DOMAIN_IRQ
21	select DW_APB_TIMER_OF
22	select GENERIC_IOREMAP
23	select GENERIC_LIB_ASHLDI3
24	select GENERIC_LIB_ASHRDI3
25	select GENERIC_LIB_LSHRDI3
26	select GENERIC_LIB_MULDI3
27	select GENERIC_LIB_CMPDI2
28	select GENERIC_LIB_UCMPDI2
29	select GENERIC_ALLOCATOR
30	select GENERIC_ATOMIC64
31	select GENERIC_CPU_DEVICES
32	select GENERIC_IRQ_CHIP
33	select GENERIC_IRQ_PROBE
34	select GENERIC_IRQ_SHOW
35	select GENERIC_IRQ_MULTI_HANDLER
36	select GENERIC_SCHED_CLOCK
37	select GENERIC_SMP_IDLE_THREAD
38	select GENERIC_TIME_VSYSCALL
39	select GENERIC_VDSO_32
40	select GENERIC_GETTIMEOFDAY
41	select GX6605S_TIMER if CPU_CK610
42	select HAVE_ARCH_TRACEHOOK
43	select HAVE_ARCH_AUDITSYSCALL
44	select HAVE_ARCH_MMAP_RND_BITS
45	select HAVE_ARCH_SECCOMP_FILTER
46	select HAVE_CONTEXT_TRACKING
47	select HAVE_VIRT_CPU_ACCOUNTING_GEN
48	select HAVE_DEBUG_BUGVERBOSE
49	select HAVE_DEBUG_KMEMLEAK
50	select HAVE_DYNAMIC_FTRACE
51	select HAVE_DYNAMIC_FTRACE_WITH_REGS
52	select HAVE_GENERIC_VDSO
53	select HAVE_FUNCTION_TRACER
54	select HAVE_FUNCTION_GRAPH_TRACER
55	select HAVE_FUNCTION_ERROR_INJECTION
56	select HAVE_FUTEX_CMPXCHG if FUTEX && SMP
57	select HAVE_FTRACE_MCOUNT_RECORD
58	select HAVE_KERNEL_GZIP
59	select HAVE_KERNEL_LZO
60	select HAVE_KERNEL_LZMA
61	select HAVE_KPROBES if !CPU_CK610
62	select HAVE_KPROBES_ON_FTRACE if !CPU_CK610
63	select HAVE_KRETPROBES if !CPU_CK610
64	select HAVE_PERF_EVENTS
65	select HAVE_PERF_REGS
66	select HAVE_PERF_USER_STACK_DUMP
67	select HAVE_DMA_CONTIGUOUS
68	select HAVE_REGS_AND_STACK_ACCESS_API
69	select HAVE_RSEQ
70	select HAVE_STACKPROTECTOR
71	select HAVE_SYSCALL_TRACEPOINTS
72	select MAY_HAVE_SPARSE_IRQ
73	select MODULES_USE_ELF_RELA if MODULES
74	select OF
75	select OF_EARLY_FLATTREE
76	select PERF_USE_VMALLOC if CPU_CK610
77	select RTC_LIB
78	select TIMER_OF
79	select USB_ARCH_HAS_EHCI
80	select USB_ARCH_HAS_OHCI
81	select GENERIC_PCI_IOMAP
82	select HAVE_PCI
83	select PCI_DOMAINS_GENERIC if PCI
84	select PCI_SYSCALL if PCI
85	select PCI_MSI if PCI
86	select SET_FS
87
88config LOCKDEP_SUPPORT
89	def_bool y
90
91config ARCH_SUPPORTS_UPROBES
92	def_bool y if !CPU_CK610
93
94config CPU_HAS_CACHEV2
95	bool
96
97config CPU_HAS_FPUV2
98	bool
99
100config CPU_HAS_HILO
101	bool
102
103config CPU_HAS_TLBI
104	bool
105
106config CPU_HAS_LDSTEX
107	bool
108	help
109	  For SMP, CPU needs "ldex&stex" instructions for atomic operations.
110
111config CPU_NEED_TLBSYNC
112	bool
113
114config CPU_NEED_SOFTALIGN
115	bool
116
117config CPU_NO_USER_BKPT
118	bool
119	help
120	  For abiv2 we couldn't use "trap 1" as user space bkpt in gdbserver, because
121	  abiv2 is 16/32bit instruction set and "trap 1" is 32bit.
122	  So we need a 16bit instruction as user space bkpt, and it will cause an illegal
123	  instruction exception.
124	  In kernel we parse the *regs->pc to determine whether to send SIGTRAP or not.
125
126config GENERIC_CALIBRATE_DELAY
127	def_bool y
128
129config GENERIC_CSUM
130	def_bool y
131
132config GENERIC_HWEIGHT
133	def_bool y
134
135config MMU
136	def_bool y
137
138config STACKTRACE_SUPPORT
139	def_bool y
140
141config TIME_LOW_RES
142	def_bool y
143
144config TRACE_IRQFLAGS_SUPPORT
145	def_bool y
146
147config CPU_TLB_SIZE
148	int
149	default "128"	if (CPU_CK610 || CPU_CK807 || CPU_CK810)
150	default "1024"	if (CPU_CK860)
151
152config CPU_ASID_BITS
153	int
154	default "8"	if (CPU_CK610 || CPU_CK807 || CPU_CK810)
155	default "12"	if (CPU_CK860)
156
157config L1_CACHE_SHIFT
158	int
159	default "4"	if (CPU_CK610)
160	default "5"	if (CPU_CK807 || CPU_CK810)
161	default "6"	if (CPU_CK860)
162
163config ARCH_MMAP_RND_BITS_MIN
164	default 8
165
166# max bits determined by the following formula:
167#  VA_BITS - PAGE_SHIFT - 3
168config ARCH_MMAP_RND_BITS_MAX
169	default 17
170
171menu "Processor type and features"
172
173choice
174	prompt "CPU MODEL"
175	default CPU_CK807
176
177config CPU_CK610
178	bool "CSKY CPU ck610"
179	select CPU_NEED_TLBSYNC
180	select CPU_NEED_SOFTALIGN
181	select CPU_NO_USER_BKPT
182
183config CPU_CK810
184	bool "CSKY CPU ck810"
185	select CPU_HAS_HILO
186	select CPU_NEED_TLBSYNC
187
188config CPU_CK807
189	bool "CSKY CPU ck807"
190	select CPU_HAS_HILO
191
192config CPU_CK860
193	bool "CSKY CPU ck860"
194	select CPU_HAS_TLBI
195	select CPU_HAS_CACHEV2
196	select CPU_HAS_LDSTEX
197	select CPU_HAS_FPUV2
198endchoice
199
200choice
201	prompt "PAGE OFFSET"
202	default PAGE_OFFSET_80000000
203
204config PAGE_OFFSET_80000000
205	bool "PAGE OFFSET 2G (user:kernel = 2:2)"
206
207config PAGE_OFFSET_A0000000
208	bool "PAGE OFFSET 2.5G (user:kernel = 2.5:1.5)"
209endchoice
210
211config PAGE_OFFSET
212	hex
213	default 0x80000000 if PAGE_OFFSET_80000000
214	default 0xa0000000 if PAGE_OFFSET_A0000000
215choice
216
217	prompt "C-SKY PMU type"
218	depends on PERF_EVENTS
219	depends on CPU_CK807 || CPU_CK810 || CPU_CK860
220
221config CPU_PMU_NONE
222	bool "None"
223
224config CSKY_PMU_V1
225	bool "Performance Monitoring Unit Ver.1"
226
227endchoice
228
229choice
230	prompt "Power Manager Instruction (wait/doze/stop)"
231	default CPU_PM_NONE
232
233config CPU_PM_NONE
234	bool "None"
235
236config CPU_PM_WAIT
237	bool "wait"
238
239config CPU_PM_DOZE
240	bool "doze"
241
242config CPU_PM_STOP
243	bool "stop"
244endchoice
245
246menuconfig HAVE_TCM
247	bool "Tightly-Coupled/Sram Memory"
248	select GENERIC_ALLOCATOR
249	help
250	  The implementation are not only used by TCM (Tightly-Coupled Meory)
251	  but also used by sram on SOC bus. It follow existed linux tcm
252	  software interface, so that old tcm application codes could be
253	  re-used directly.
254
255if HAVE_TCM
256config ITCM_RAM_BASE
257	hex "ITCM ram base"
258	default 0xffffffff
259
260config ITCM_NR_PAGES
261	int "Page count of ITCM size: NR*4KB"
262	range 1 256
263	default 32
264
265config HAVE_DTCM
266	bool "DTCM Support"
267
268config DTCM_RAM_BASE
269	hex "DTCM ram base"
270	depends on HAVE_DTCM
271	default 0xffffffff
272
273config DTCM_NR_PAGES
274	int "Page count of DTCM size: NR*4KB"
275	depends on HAVE_DTCM
276	range 1 256
277	default 32
278endif
279
280config CPU_HAS_VDSP
281	bool "CPU has VDSP coprocessor"
282	depends on CPU_HAS_FPU && CPU_HAS_FPUV2
283
284config CPU_HAS_FPU
285	bool "CPU has FPU coprocessor"
286	depends on CPU_CK807 || CPU_CK810 || CPU_CK860
287
288config CPU_HAS_ICACHE_INS
289	bool "CPU has Icache invalidate instructions"
290	depends on CPU_HAS_CACHEV2
291
292config CPU_HAS_TEE
293	bool "CPU has Trusted Execution Environment"
294	depends on CPU_CK810
295
296config SMP
297	bool "Symmetric Multi-Processing (SMP) support for C-SKY"
298	depends on CPU_CK860
299	default n
300
301config NR_CPUS
302	int "Maximum number of CPUs (2-32)"
303	range 2 32
304	depends on SMP
305	default "4"
306
307config HIGHMEM
308	bool "High Memory Support"
309	depends on !CPU_CK610
310	select KMAP_LOCAL
311	default y
312
313config FORCE_MAX_ZONEORDER
314	int "Maximum zone order"
315	default "11"
316
317config DRAM_BASE
318	hex "DRAM start addr (the same with memory-section in dts)"
319	default 0x0
320
321config HOTPLUG_CPU
322	bool "Support for hot-pluggable CPUs"
323	select GENERIC_IRQ_MIGRATION
324	depends on SMP
325	help
326	  Say Y here to allow turning CPUs off and on. CPUs can be
327	  controlled through /sys/devices/system/cpu/cpu1/hotplug/target.
328
329	  Say N if you want to disable CPU hotplug.
330endmenu
331
332source "arch/csky/Kconfig.platforms"
333
334source "kernel/Kconfig.hz"
335