aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2012-10-09 05:54:32 -0400
committerJames Hogan <james.hogan@imgtec.com>2013-03-02 15:09:54 -0500
commit5633004cc2498ff50a5b88d415d3746ff0c301f2 (patch)
treeb60265906c89e68022b8013e2aa2a19127fe3a24 /arch
parent79f83c02944ccb3dffbc5852e63e966ea34ed63e (diff)
metag: Build infrastructure
Add metag build infrastructure. Signed-off-by: James Hogan <james.hogan@imgtec.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/metag/Kconfig277
-rw-r--r--arch/metag/Kconfig.debug40
-rw-r--r--arch/metag/Kconfig.soc55
-rw-r--r--arch/metag/Makefile87
-rw-r--r--arch/metag/boot/Makefile68
-rw-r--r--arch/metag/configs/meta1_defconfig38
-rw-r--r--arch/metag/configs/meta2_defconfig39
-rw-r--r--arch/metag/configs/meta2_smp_defconfig40
-rw-r--r--arch/metag/include/asm/Kbuild55
-rw-r--r--arch/metag/include/uapi/asm/Kbuild13
-rw-r--r--arch/metag/kernel/.gitignore1
-rw-r--r--arch/metag/kernel/Makefile36
-rw-r--r--arch/metag/kernel/asm-offsets.c14
-rw-r--r--arch/metag/kernel/metag_ksyms.c75
-rw-r--r--arch/metag/kernel/vmlinux.lds.S71
-rw-r--r--arch/metag/lib/Makefile22
-rw-r--r--arch/metag/mm/Kconfig153
-rw-r--r--arch/metag/mm/Makefile19
-rw-r--r--arch/metag/tbx/Makefile21
19 files changed, 1124 insertions, 0 deletions
diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig
new file mode 100644
index 000000000000..f786e6e09700
--- /dev/null
+++ b/arch/metag/Kconfig
@@ -0,0 +1,277 @@
1config SYMBOL_PREFIX
2 string
3 default "_"
4
5config METAG
6 def_bool y
7 select EMBEDDED
8 select GENERIC_ATOMIC64
9 select GENERIC_CLOCKEVENTS
10 select GENERIC_IRQ_SHOW
11 select GENERIC_SIGALTSTACK
12 select GENERIC_SMP_IDLE_THREAD
13 select HAVE_64BIT_ALIGNED_ACCESS
14 select HAVE_ARCH_TRACEHOOK
15 select HAVE_DEBUG_KMEMLEAK
16 select HAVE_GENERIC_HARDIRQS
17 select HAVE_IRQ_WORK
18 select HAVE_KERNEL_BZIP2
19 select HAVE_KERNEL_GZIP
20 select HAVE_KERNEL_LZO
21 select HAVE_KERNEL_XZ
22 select HAVE_MEMBLOCK
23 select HAVE_MEMBLOCK_NODE_MAP
24 select HAVE_MOD_ARCH_SPECIFIC
25 select HAVE_SYSCALL_TRACEPOINTS
26 select IRQ_DOMAIN
27 select MODULES_USE_ELF_RELA
28 select OF
29 select OF_EARLY_FLATTREE
30 select SPARSE_IRQ
31
32config ARCH_NO_VIRT_TO_BUS
33 def_bool y
34
35config STACKTRACE_SUPPORT
36 def_bool y
37
38config LOCKDEP_SUPPORT
39 def_bool y
40
41config HAVE_LATENCYTOP_SUPPORT
42 def_bool y
43
44config RWSEM_GENERIC_SPINLOCK
45 def_bool y
46
47config RWSEM_XCHGADD_ALGORITHM
48 bool
49
50config GENERIC_HWEIGHT
51 def_bool y
52
53config GENERIC_CALIBRATE_DELAY
54 def_bool y
55
56config GENERIC_GPIO
57 def_bool n
58
59config NO_IOPORT
60 def_bool y
61
62source "init/Kconfig"
63
64source "kernel/Kconfig.freezer"
65
66menu "Processor type and features"
67
68config MMU
69 def_bool y
70
71config STACK_GROWSUP
72 def_bool y
73
74config HOTPLUG_CPU
75 bool "Enable CPU hotplug support"
76 depends on SMP
77 help
78 Say Y here to allow turning CPUs off and on. CPUs can be
79 controlled through /sys/devices/system/cpu.
80
81 Say N if you want to disable CPU hotplug.
82
83config HIGHMEM
84 bool "High Memory Support"
85 help
86 The address space of Meta processors is only 4 Gigabytes large
87 and it has to accommodate user address space, kernel address
88 space as well as some memory mapped IO. That means that, if you
89 have a large amount of physical memory and/or IO, not all of the
90 memory can be "permanently mapped" by the kernel. The physical
91 memory that is not permanently mapped is called "high memory".
92
93 Depending on the selected kernel/user memory split, minimum
94 vmalloc space and actual amount of RAM, you may not need this
95 option which should result in a slightly faster kernel.
96
97 If unsure, say n.
98
99source "arch/metag/mm/Kconfig"
100
101source "arch/metag/Kconfig.soc"
102
103config METAG_META12
104 bool
105 help
106 Select this from the SoC config symbol to indicate that it contains a
107 Meta 1.2 core.
108
109config METAG_META21
110 bool
111 help
112 Select this from the SoC config symbol to indicate that it contains a
113 Meta 2.1 core.
114
115config SMP
116 bool "Symmetric multi-processing support"
117 depends on METAG_META21 && METAG_META21_MMU
118 select USE_GENERIC_SMP_HELPERS
119 help
120 This enables support for systems with more than one thread running
121 Linux. If you have a system with only one thread running Linux,
122 say N. Otherwise, say Y.
123
124config NR_CPUS
125 int "Maximum number of CPUs (2-4)" if SMP
126 range 2 4 if SMP
127 default "1" if !SMP
128 default "4" if SMP
129
130config METAG_SMP_WRITE_REORDERING
131 bool
132 help
133 This attempts to prevent cache-memory incoherence due to external
134 reordering of writes from different hardware threads when SMP is
135 enabled. It adds fences (system event 0) to smp_mb and smp_rmb in an
136 attempt to catch some of the cases, and also before writes to shared
137 memory in LOCK1 protected atomics and spinlocks.
138 This will not completely prevent cache incoherency on affected cores.
139
140config METAG_LNKGET_AROUND_CACHE
141 bool
142 depends on METAG_META21
143 help
144 This indicates that the LNKGET/LNKSET instructions go around the
145 cache, which requires some extra cache flushes when the memory needs
146 to be accessed by normal GET/SET instructions too.
147
148choice
149 prompt "Atomicity primitive"
150 default METAG_ATOMICITY_LNKGET
151 help
152 This option selects the mechanism for performing atomic operations.
153
154config METAG_ATOMICITY_IRQSOFF
155 depends on !SMP
156 bool "irqsoff"
157 help
158 This option disables interrupts to achieve atomicity. This mechanism
159 is not SMP-safe.
160
161config METAG_ATOMICITY_LNKGET
162 depends on METAG_META21
163 bool "lnkget/lnkset"
164 help
165 This option uses the LNKGET and LNKSET instructions to achieve
166 atomicity. LNKGET/LNKSET are load-link/store-conditional instructions.
167 Choose this option if your system requires low latency.
168
169config METAG_ATOMICITY_LOCK1
170 depends on SMP
171 bool "lock1"
172 help
173 This option uses the LOCK1 instruction for atomicity. This is mainly
174 provided as a debugging aid if the lnkget/lnkset atomicity primitive
175 isn't working properly.
176
177endchoice
178
179config METAG_FPU
180 bool "FPU Support"
181 depends on METAG_META21
182 default y
183 help
184 This option allows processes to use FPU hardware available with this
185 CPU. If this option is not enabled FPU registers will not be saved
186 and restored on context-switch.
187
188 If you plan on running programs which are compiled to use hard floats
189 say Y here.
190
191config METAG_DSP
192 bool "DSP Support"
193 help
194 This option allows processes to use DSP hardware available
195 with this CPU. If this option is not enabled DSP registers
196 will not be saved and restored on context-switch.
197
198 If you plan on running DSP programs say Y here.
199
200config METAG_PERFCOUNTER_IRQS
201 bool "PerfCounters interrupt support"
202 depends on METAG_META21
203 help
204 This option enables using interrupts to collect information from
205 Performance Counters. This option is supported in new META21
206 (starting from HTP265).
207
208 When disabled, Performance Counters information will be collected
209 based on Timer Interrupt.
210
211menu "Boot options"
212
213config METAG_BUILTIN_DTB
214 bool "Embed DTB in kernel image"
215 default y
216 help
217 Embeds a device tree binary in the kernel image.
218
219config METAG_BUILTIN_DTB_NAME
220 string "Built in DTB"
221 depends on METAG_BUILTIN_DTB
222 help
223 Set the name of the DTB to embed (leave blank to pick one
224 automatically based on kernel configuration).
225
226config CMDLINE_BOOL
227 bool "Default bootloader kernel arguments"
228
229config CMDLINE
230 string "Kernel command line"
231 depends on CMDLINE_BOOL
232 help
233 On some architectures there is currently no way for the boot loader
234 to pass arguments to the kernel. For these architectures, you should
235 supply some command-line options at build time by entering them
236 here.
237
238config CMDLINE_FORCE
239 bool "Force default kernel command string"
240 depends on CMDLINE_BOOL
241 help
242 Set this to have arguments from the default kernel command string
243 override those passed by the boot loader.
244
245endmenu
246
247source "kernel/Kconfig.preempt"
248
249source kernel/Kconfig.hz
250
251endmenu
252
253menu "Power management options"
254
255source kernel/power/Kconfig
256
257endmenu
258
259menu "Executable file formats"
260
261source "fs/Kconfig.binfmt"
262
263endmenu
264
265source "net/Kconfig"
266
267source "drivers/Kconfig"
268
269source "fs/Kconfig"
270
271source "arch/metag/Kconfig.debug"
272
273source "security/Kconfig"
274
275source "crypto/Kconfig"
276
277source "lib/Kconfig"
diff --git a/arch/metag/Kconfig.debug b/arch/metag/Kconfig.debug
new file mode 100644
index 000000000000..e45bbf6a7a5d
--- /dev/null
+++ b/arch/metag/Kconfig.debug
@@ -0,0 +1,40 @@
1menu "Kernel hacking"
2
3config TRACE_IRQFLAGS_SUPPORT
4 bool
5 default y
6
7source "lib/Kconfig.debug"
8
9config DEBUG_STACKOVERFLOW
10 bool "Check for stack overflows"
11 depends on DEBUG_KERNEL
12 help
13 This option will cause messages to be printed if free stack space
14 drops below a certain limit.
15
16config 4KSTACKS
17 bool "Use 4Kb for kernel stacks instead of 8Kb"
18 depends on DEBUG_KERNEL
19 help
20 If you say Y here the kernel will use a 4Kb stacksize for the
21 kernel stack attached to each process/thread. This facilitates
22 running more threads on a system and also reduces the pressure
23 on the VM subsystem for higher order allocations. This option
24 will also use IRQ stacks to compensate for the reduced stackspace.
25
26config METAG_FUNCTION_TRACE
27 bool "Output Meta real-time trace data for function entry/exit"
28 help
29 If you say Y here the kernel will use the Meta hardware trace
30 unit to output information about function entry and exit that
31 can be used by a debugger for profiling and call-graphs.
32
33config METAG_POISON_CATCH_BUFFERS
34 bool "Poison catch buffer contents on kernel entry"
35 help
36 If you say Y here the kernel will write poison data to the
37 catch buffer registers on kernel entry. This will make any
38 problem with catch buffer handling much more apparent.
39
40endmenu
diff --git a/arch/metag/Kconfig.soc b/arch/metag/Kconfig.soc
new file mode 100644
index 000000000000..ec079cfb7c6a
--- /dev/null
+++ b/arch/metag/Kconfig.soc
@@ -0,0 +1,55 @@
1choice
2 prompt "SoC Type"
3 default META21_FPGA
4
5config META12_FPGA
6 bool "Meta 1.2 FPGA"
7 select METAG_META12
8 help
9 This is a Meta 1.2 FPGA bitstream, just a bare CPU.
10
11config META21_FPGA
12 bool "Meta 2.1 FPGA"
13 select METAG_META21
14 help
15 This is a Meta 2.1 FPGA bitstream, just a bare CPU.
16
17endchoice
18
19menu "SoC configuration"
20
21if METAG_META21
22
23# Meta 2.x specific options
24
25config METAG_META21_MMU
26 bool "Meta 2.x MMU mode"
27 default y
28 help
29 Use the Meta 2.x MMU in extended mode.
30
31config METAG_UNALIGNED
32 bool "Meta 2.x unaligned access checking"
33 default y
34 help
35 All memory accesses will be checked for alignment and an exception
36 raised on unaligned accesses. This feature does cost performance
37 but without it there will be no notification of this type of error.
38
39config METAG_USER_TCM
40 bool "Meta on-chip memory support for userland"
41 select GENERIC_ALLOCATOR
42 default y
43 help
44 Allow the on-chip memories of Meta SoCs to be used by user
45 applications.
46
47endif
48
49config METAG_HALT_ON_PANIC
50 bool "Halt the core on panic"
51 help
52 Halt the core when a panic occurs. This is useful when running
53 pre-production silicon or in an FPGA environment.
54
55endmenu
diff --git a/arch/metag/Makefile b/arch/metag/Makefile
new file mode 100644
index 000000000000..81bd6a1c7483
--- /dev/null
+++ b/arch/metag/Makefile
@@ -0,0 +1,87 @@
1#
2# metag/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions
6# for "archclean" cleaning up for this architecture.
7#
8# This file is subject to the terms and conditions of the GNU General Public
9# License. See the file "COPYING" in the main directory of this archive
10# for more details.
11#
12# Copyright (C) 1994 by Linus Torvalds
13# 2007,2008,2012 by Imagination Technologies Ltd.
14#
15
16LDFLAGS :=
17OBJCOPYFLAGS := -O binary -R .note -R .comment -S
18
19checkflags-$(CONFIG_METAG_META12) += -DMETAC_1_2
20checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1
21CHECKFLAGS += -D__metag__ $(checkflags-y)
22
23KBUILD_DEFCONFIG := meta2_defconfig
24
25sflags-$(CONFIG_METAG_META12) += -mmetac=1.2
26ifeq ($(CONFIG_METAG_META12),y)
27# Only use TBI API 1.4 if DSP is enabled for META12 cores
28sflags-$(CONFIG_METAG_DSP) += -DTBI_1_4
29endif
30sflags-$(CONFIG_METAG_META21) += -mmetac=2.1 -DTBI_1_4
31
32cflags-$(CONFIG_METAG_FUNCTION_TRACE) += -mhwtrace-leaf -mhwtrace-retpc
33cflags-$(CONFIG_METAG_META21) += -mextensions=bex
34
35KBUILD_CFLAGS += -pipe
36KBUILD_CFLAGS += -ffunction-sections
37
38KBUILD_CFLAGS += $(sflags-y) $(cflags-y)
39KBUILD_AFLAGS += $(sflags-y)
40
41LDFLAGS_vmlinux := $(ldflags-y)
42
43head-y := arch/metag/kernel/head.o
44
45core-y += arch/metag/boot/dts/
46core-y += arch/metag/kernel/
47core-y += arch/metag/mm/
48
49libs-y += arch/metag/lib/
50libs-y += arch/metag/tbx/
51
52boot := arch/metag/boot
53
54boot_targets += uImage
55boot_targets += uImage.gz
56boot_targets += uImage.bz2
57boot_targets += uImage.xz
58boot_targets += uImage.lzo
59boot_targets += uImage.bin
60boot_targets += vmlinux.bin
61
62PHONY += $(boot_targets)
63
64all: vmlinux.bin
65
66$(boot_targets): vmlinux
67 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
68
69%.dtb %.dtb.S %.dtb.o: scripts
70 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
71
72dtbs: scripts
73 $(Q)$(MAKE) $(build)=$(boot)/dts dtbs
74
75archclean:
76 $(Q)$(MAKE) $(clean)=$(boot)
77
78define archhelp
79 echo '* vmlinux.bin - Binary kernel image (arch/$(ARCH)/boot/vmlinux.bin)'
80 @echo ' uImage - Alias to bootable U-Boot image'
81 @echo ' uImage.bin - Kernel-only image for U-Boot (bin)'
82 @echo ' uImage.gz - Kernel-only image for U-Boot (gzip)'
83 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)'
84 @echo ' uImage.xz - Kernel-only image for U-Boot (xz)'
85 @echo ' uImage.lzo - Kernel-only image for U-Boot (lzo)'
86 @echo ' dtbs - Build device tree blobs for enabled boards'
87endef
diff --git a/arch/metag/boot/Makefile b/arch/metag/boot/Makefile
new file mode 100644
index 000000000000..5a1f88cf91e3
--- /dev/null
+++ b/arch/metag/boot/Makefile
@@ -0,0 +1,68 @@
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License. See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright (C) 2007,2012 Imagination Technologies Ltd.
7#
8
9suffix-y := bin
10suffix-$(CONFIG_KERNEL_GZIP) := gz
11suffix-$(CONFIG_KERNEL_BZIP2) := bz2
12suffix-$(CONFIG_KERNEL_XZ) := xz
13suffix-$(CONFIG_KERNEL_LZO) := lzo
14
15targets += vmlinux.bin
16targets += uImage
17targets += uImage.gz
18targets += uImage.bz2
19targets += uImage.xz
20targets += uImage.lzo
21targets += uImage.bin
22
23extra-y += vmlinux.bin
24extra-y += vmlinux.bin.gz
25extra-y += vmlinux.bin.bz2
26extra-y += vmlinux.bin.xz
27extra-y += vmlinux.bin.lzo
28
29UIMAGE_LOADADDR = $(CONFIG_PAGE_OFFSET)
30
31ifeq ($(CONFIG_FUNCTION_TRACER),y)
32orig_cflags := $(KBUILD_CFLAGS)
33KBUILD_CFLAGS = $(subst -pg, , $(orig_cflags))
34endif
35
36$(obj)/vmlinux.bin: vmlinux FORCE
37 $(call if_changed,objcopy)
38
39$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
40 $(call if_changed,gzip)
41
42$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
43 $(call if_changed,bzip2)
44
45$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
46 $(call if_changed,xzkern)
47
48$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
49 $(call if_changed,lzo)
50
51$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
52 $(call if_changed,uimage,gzip)
53
54$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE
55 $(call if_changed,uimage,bzip2)
56
57$(obj)/uImage.xz: $(obj)/vmlinux.bin.xz FORCE
58 $(call if_changed,uimage,xz)
59
60$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
61 $(call if_changed,uimage,lzo)
62
63$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
64 $(call if_changed,uimage,none)
65
66$(obj)/uImage: $(obj)/uImage.$(suffix-y)
67 @ln -sf $(notdir $<) $@
68 @echo ' Image $@ is ready'
diff --git a/arch/metag/configs/meta1_defconfig b/arch/metag/configs/meta1_defconfig
new file mode 100644
index 000000000000..837c235ab67a
--- /dev/null
+++ b/arch/metag/configs/meta1_defconfig
@@ -0,0 +1,38 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_LOG_BUF_SHIFT=13
5CONFIG_SYSFS_DEPRECATED=y
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_KALLSYMS_ALL=y
8# CONFIG_ELF_CORE is not set
9CONFIG_SLAB=y
10# CONFIG_BLK_DEV_BSG is not set
11CONFIG_PARTITION_ADVANCED=y
12# CONFIG_MSDOS_PARTITION is not set
13# CONFIG_IOSCHED_DEADLINE is not set
14# CONFIG_IOSCHED_CFQ is not set
15CONFIG_FLATMEM_MANUAL=y
16CONFIG_META12_FPGA=y
17CONFIG_HZ_100=y
18CONFIG_DEVTMPFS=y
19CONFIG_DEVTMPFS_MOUNT=y
20# CONFIG_STANDALONE is not set
21# CONFIG_PREVENT_FIRMWARE_BUILD is not set
22# CONFIG_FW_LOADER is not set
23CONFIG_BLK_DEV_RAM=y
24CONFIG_BLK_DEV_RAM_COUNT=1
25CONFIG_BLK_DEV_RAM_SIZE=16384
26# CONFIG_INPUT is not set
27# CONFIG_SERIO is not set
28# CONFIG_VT is not set
29# CONFIG_LEGACY_PTYS is not set
30# CONFIG_DEVKMEM is not set
31# CONFIG_HW_RANDOM is not set
32# CONFIG_HWMON is not set
33# CONFIG_USB_SUPPORT is not set
34# CONFIG_DNOTIFY is not set
35CONFIG_TMPFS=y
36# CONFIG_MISC_FILESYSTEMS is not set
37# CONFIG_SCHED_DEBUG is not set
38CONFIG_DEBUG_INFO=y
diff --git a/arch/metag/configs/meta2_defconfig b/arch/metag/configs/meta2_defconfig
new file mode 100644
index 000000000000..e5bada83dd76
--- /dev/null
+++ b/arch/metag/configs/meta2_defconfig
@@ -0,0 +1,39 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=13
6CONFIG_SYSFS_DEPRECATED=y
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_KALLSYMS_ALL=y
9# CONFIG_ELF_CORE is not set
10CONFIG_SLAB=y
11# CONFIG_BLK_DEV_BSG is not set
12CONFIG_PARTITION_ADVANCED=y
13# CONFIG_MSDOS_PARTITION is not set
14# CONFIG_IOSCHED_DEADLINE is not set
15# CONFIG_IOSCHED_CFQ is not set
16CONFIG_METAG_L2C=y
17CONFIG_FLATMEM_MANUAL=y
18CONFIG_METAG_HALT_ON_PANIC=y
19CONFIG_HZ_100=y
20CONFIG_DEVTMPFS=y
21# CONFIG_STANDALONE is not set
22# CONFIG_PREVENT_FIRMWARE_BUILD is not set
23# CONFIG_FW_LOADER is not set
24CONFIG_BLK_DEV_RAM=y
25CONFIG_BLK_DEV_RAM_COUNT=1
26CONFIG_BLK_DEV_RAM_SIZE=16384
27# CONFIG_INPUT is not set
28# CONFIG_SERIO is not set
29# CONFIG_VT is not set
30# CONFIG_LEGACY_PTYS is not set
31# CONFIG_DEVKMEM is not set
32# CONFIG_HW_RANDOM is not set
33# CONFIG_HWMON is not set
34# CONFIG_USB_SUPPORT is not set
35# CONFIG_DNOTIFY is not set
36CONFIG_TMPFS=y
37# CONFIG_MISC_FILESYSTEMS is not set
38# CONFIG_SCHED_DEBUG is not set
39CONFIG_DEBUG_INFO=y
diff --git a/arch/metag/configs/meta2_smp_defconfig b/arch/metag/configs/meta2_smp_defconfig
new file mode 100644
index 000000000000..41983a20db72
--- /dev/null
+++ b/arch/metag/configs/meta2_smp_defconfig
@@ -0,0 +1,40 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=13
6CONFIG_SYSFS_DEPRECATED=y
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_KALLSYMS_ALL=y
9# CONFIG_ELF_CORE is not set
10CONFIG_SLAB=y
11# CONFIG_BLK_DEV_BSG is not set
12CONFIG_PARTITION_ADVANCED=y
13# CONFIG_MSDOS_PARTITION is not set
14# CONFIG_IOSCHED_DEADLINE is not set
15# CONFIG_IOSCHED_CFQ is not set
16CONFIG_METAG_L2C=y
17CONFIG_FLATMEM_MANUAL=y
18CONFIG_METAG_HALT_ON_PANIC=y
19CONFIG_SMP=y
20CONFIG_HZ_100=y
21CONFIG_DEVTMPFS=y
22# CONFIG_STANDALONE is not set
23# CONFIG_PREVENT_FIRMWARE_BUILD is not set
24# CONFIG_FW_LOADER is not set
25CONFIG_BLK_DEV_RAM=y
26CONFIG_BLK_DEV_RAM_COUNT=1
27CONFIG_BLK_DEV_RAM_SIZE=16384
28# CONFIG_INPUT is not set
29# CONFIG_SERIO is not set
30# CONFIG_VT is not set
31# CONFIG_LEGACY_PTYS is not set
32# CONFIG_DEVKMEM is not set
33# CONFIG_HW_RANDOM is not set
34# CONFIG_HWMON is not set
35# CONFIG_USB_SUPPORT is not set
36# CONFIG_DNOTIFY is not set
37CONFIG_TMPFS=y
38# CONFIG_MISC_FILESYSTEMS is not set
39# CONFIG_SCHED_DEBUG is not set
40CONFIG_DEBUG_INFO=y
diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild
new file mode 100644
index 000000000000..3a139810559e
--- /dev/null
+++ b/arch/metag/include/asm/Kbuild
@@ -0,0 +1,55 @@
1generic-y += auxvec.h
2generic-y += bitsperlong.h
3generic-y += bugs.h
4generic-y += clkdev.h
5generic-y += cputime.h
6generic-y += current.h
7generic-y += device.h
8generic-y += dma.h
9generic-y += emergency-restart.h
10generic-y += errno.h
11generic-y += exec.h
12generic-y += fb.h
13generic-y += fcntl.h
14generic-y += ftrace.h
15generic-y += futex.h
16generic-y += hardirq.h
17generic-y += hw_irq.h
18generic-y += ioctl.h
19generic-y += ioctls.h
20generic-y += ipcbuf.h
21generic-y += irq_regs.h
22generic-y += kdebug.h
23generic-y += kmap_types.h
24generic-y += kvm_para.h
25generic-y += local.h
26generic-y += local64.h
27generic-y += msgbuf.h
28generic-y += mutex.h
29generic-y += param.h
30generic-y += pci.h
31generic-y += percpu.h
32generic-y += poll.h
33generic-y += posix_types.h
34generic-y += scatterlist.h
35generic-y += sections.h
36generic-y += sembuf.h
37generic-y += serial.h
38generic-y += shmbuf.h
39generic-y += shmparam.h
40generic-y += signal.h
41generic-y += socket.h
42generic-y += sockios.h
43generic-y += stat.h
44generic-y += statfs.h
45generic-y += switch_to.h
46generic-y += termbits.h
47generic-y += termios.h
48generic-y += timex.h
49generic-y += trace_clock.h
50generic-y += types.h
51generic-y += ucontext.h
52generic-y += unaligned.h
53generic-y += user.h
54generic-y += vga.h
55generic-y += xor.h
diff --git a/arch/metag/include/uapi/asm/Kbuild b/arch/metag/include/uapi/asm/Kbuild
new file mode 100644
index 000000000000..876c71f866de
--- /dev/null
+++ b/arch/metag/include/uapi/asm/Kbuild
@@ -0,0 +1,13 @@
1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm
3
4header-y += byteorder.h
5header-y += ptrace.h
6header-y += resource.h
7header-y += sigcontext.h
8header-y += siginfo.h
9header-y += swab.h
10header-y += unistd.h
11
12generic-y += mman.h
13generic-y += setup.h
diff --git a/arch/metag/kernel/.gitignore b/arch/metag/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/metag/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/metag/kernel/Makefile b/arch/metag/kernel/Makefile
new file mode 100644
index 000000000000..e985d0ca618c
--- /dev/null
+++ b/arch/metag/kernel/Makefile
@@ -0,0 +1,36 @@
1#
2# Makefile for the Linux/Meta kernel.
3#
4
5extra-y += head.o
6extra-y += vmlinux.lds
7
8obj-y += cachepart.o
9obj-y += clock.o
10obj-y += core_reg.o
11obj-y += devtree.o
12obj-y += dma.o
13obj-y += irq.o
14obj-y += kick.o
15obj-y += machines.o
16obj-y += process.o
17obj-y += ptrace.o
18obj-y += setup.o
19obj-y += signal.o
20obj-y += stacktrace.o
21obj-y += sys_metag.o
22obj-y += tbiunexp.o
23obj-y += time.o
24obj-y += topology.o
25obj-y += traps.o
26obj-y += user_gateway.o
27
28obj-$(CONFIG_METAG_COREMEM) += coremem.o
29obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
30obj-$(CONFIG_FUNCTION_TRACER) += ftrace_stub.o
31obj-$(CONFIG_MODULES) += metag_ksyms.o
32obj-$(CONFIG_MODULES) += module.o
33obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
34obj-$(CONFIG_SMP) += smp.o
35obj-$(CONFIG_METAG_SUSPEND_MEM) += suspend.o
36obj-$(CONFIG_METAG_USER_TCM) += tcm.o
diff --git a/arch/metag/kernel/asm-offsets.c b/arch/metag/kernel/asm-offsets.c
new file mode 100644
index 000000000000..bfc9205f9647
--- /dev/null
+++ b/arch/metag/kernel/asm-offsets.c
@@ -0,0 +1,14 @@
1/*
2 * This program is used to generate definitions needed by
3 * assembly language modules.
4 *
5 */
6
7#include <linux/kbuild.h>
8#include <linux/thread_info.h>
9
10int main(void)
11{
12 DEFINE(THREAD_INFO_SIZE, sizeof(struct thread_info));
13 return 0;
14}
diff --git a/arch/metag/kernel/metag_ksyms.c b/arch/metag/kernel/metag_ksyms.c
new file mode 100644
index 000000000000..c73ebd3db417
--- /dev/null
+++ b/arch/metag/kernel/metag_ksyms.c
@@ -0,0 +1,75 @@
1#include <linux/export.h>
2#include <linux/linkage.h>
3#include <linux/string.h>
4#include <linux/mm.h>
5#include <linux/user.h>
6#include <linux/interrupt.h>
7#include <linux/hardirq.h>
8
9#include <asm/setup.h>
10#include <asm/checksum.h>
11#include <asm/uaccess.h>
12#include <asm/traps.h>
13#include <asm/tbx.h>
14
15/* uaccess symbols */
16EXPORT_SYMBOL(__copy_user_zeroing);
17EXPORT_SYMBOL(__copy_user);
18EXPORT_SYMBOL(__get_user_asm_b);
19EXPORT_SYMBOL(__get_user_asm_w);
20EXPORT_SYMBOL(__get_user_asm_d);
21EXPORT_SYMBOL(__put_user_asm_b);
22EXPORT_SYMBOL(__put_user_asm_w);
23EXPORT_SYMBOL(__put_user_asm_d);
24EXPORT_SYMBOL(__put_user_asm_l);
25EXPORT_SYMBOL(__strncpy_from_user);
26EXPORT_SYMBOL(strnlen_user);
27EXPORT_SYMBOL(__do_clear_user);
28
29EXPORT_SYMBOL(pTBI_get);
30EXPORT_SYMBOL(meta_memoffset);
31EXPORT_SYMBOL(kick_register_func);
32EXPORT_SYMBOL(kick_unregister_func);
33#ifdef CONFIG_SMP
34EXPORT_SYMBOL(get_trigger_mask);
35#else
36EXPORT_SYMBOL(global_trigger_mask);
37#endif
38
39EXPORT_SYMBOL(empty_zero_page);
40
41EXPORT_SYMBOL(pfn_base);
42#ifdef CONFIG_FLATMEM
43/* needed for the pfn_valid macro */
44EXPORT_SYMBOL(max_pfn);
45EXPORT_SYMBOL(min_low_pfn);
46#endif
47
48/* TBI symbols */
49EXPORT_SYMBOL(__TBI);
50EXPORT_SYMBOL(__TBIFindSeg);
51EXPORT_SYMBOL(__TBIPoll);
52EXPORT_SYMBOL(__TBITimeStamp);
53
54#define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name)
55
56/* libgcc functions */
57DECLARE_EXPORT(__ashldi3);
58DECLARE_EXPORT(__ashrdi3);
59DECLARE_EXPORT(__lshrdi3);
60DECLARE_EXPORT(__udivsi3);
61DECLARE_EXPORT(__divsi3);
62DECLARE_EXPORT(__umodsi3);
63DECLARE_EXPORT(__modsi3);
64DECLARE_EXPORT(__muldi3);
65DECLARE_EXPORT(__cmpdi2);
66DECLARE_EXPORT(__ucmpdi2);
67
68/* Maths functions */
69EXPORT_SYMBOL(div_u64);
70EXPORT_SYMBOL(div_s64);
71
72/* String functions */
73EXPORT_SYMBOL(memcpy);
74EXPORT_SYMBOL(memset);
75EXPORT_SYMBOL(memmove);
diff --git a/arch/metag/kernel/vmlinux.lds.S b/arch/metag/kernel/vmlinux.lds.S
new file mode 100644
index 000000000000..e12055e88bfe
--- /dev/null
+++ b/arch/metag/kernel/vmlinux.lds.S
@@ -0,0 +1,71 @@
1/* ld script to make Meta Linux kernel */
2
3#include <asm/thread_info.h>
4#include <asm/page.h>
5#include <asm/cache.h>
6
7#include <asm-generic/vmlinux.lds.h>
8
9OUTPUT_FORMAT("elf32-metag", "elf32-metag", "elf32-metag")
10OUTPUT_ARCH(metag)
11ENTRY(__start)
12
13_jiffies = _jiffies_64;
14SECTIONS
15{
16 . = CONFIG_PAGE_OFFSET;
17 _text = .;
18 __text = .;
19 __stext = .;
20 HEAD_TEXT_SECTION
21 .text : {
22 TEXT_TEXT
23 SCHED_TEXT
24 LOCK_TEXT
25 KPROBES_TEXT
26 IRQENTRY_TEXT
27 *(.text.*)
28 *(.gnu.warning)
29 }
30
31 __etext = .; /* End of text section */
32
33 __sdata = .;
34 RO_DATA_SECTION(PAGE_SIZE)
35 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
36 __edata = .; /* End of data section */
37
38 EXCEPTION_TABLE(16)
39 NOTES
40
41 . = ALIGN(PAGE_SIZE); /* Init code and data */
42 ___init_begin = .;
43 INIT_TEXT_SECTION(PAGE_SIZE)
44 INIT_DATA_SECTION(16)
45
46 .init.arch.info : {
47 ___arch_info_begin = .;
48 *(.arch.info.init)
49 ___arch_info_end = .;
50 }
51
52 PERCPU_SECTION(L1_CACHE_BYTES)
53
54 ___init_end = .;
55
56 BSS_SECTION(0, PAGE_SIZE, 0)
57
58 __end = .;
59
60 . = ALIGN(PAGE_SIZE);
61 __heap_start = .;
62
63 DWARF_DEBUG
64
65 /* When something in the kernel is NOT compiled as a module, the
66 * module cleanup code and data are put into these segments. Both
67 * can then be thrown away, as cleanup code is never called unless
68 * it's a module.
69 */
70 DISCARDS
71}
diff --git a/arch/metag/lib/Makefile b/arch/metag/lib/Makefile
new file mode 100644
index 000000000000..a41d24e270e6
--- /dev/null
+++ b/arch/metag/lib/Makefile
@@ -0,0 +1,22 @@
1#
2# Makefile for Meta-specific library files.
3#
4
5lib-y += usercopy.o
6lib-y += copy_page.o
7lib-y += clear_page.o
8lib-y += memcpy.o
9lib-y += memmove.o
10lib-y += memset.o
11lib-y += delay.o
12lib-y += div64.o
13lib-y += muldi3.o
14lib-y += ashrdi3.o
15lib-y += ashldi3.o
16lib-y += lshrdi3.o
17lib-y += divsi3.o
18lib-y += modsi3.o
19lib-y += cmpdi2.o
20lib-y += ucmpdi2.o
21lib-y += ip_fast_csum.o
22lib-y += checksum.o
diff --git a/arch/metag/mm/Kconfig b/arch/metag/mm/Kconfig
new file mode 100644
index 000000000000..cd7f2f2ad416
--- /dev/null
+++ b/arch/metag/mm/Kconfig
@@ -0,0 +1,153 @@
1menu "Memory management options"
2
3config PAGE_OFFSET
4 hex "Kernel page offset address"
5 default "0x40000000"
6 help
7 This option allows you to set the virtual address at which the
8 kernel will be mapped to.
9endmenu
10
11config KERNEL_4M_PAGES
12 bool "Map kernel with 4MB pages"
13 depends on METAG_META21_MMU
14 default y
15 help
16 Map the kernel with large pages to reduce TLB pressure.
17
18choice
19 prompt "User page size"
20 default PAGE_SIZE_4K
21
22config PAGE_SIZE_4K
23 bool "4kB"
24 help
25 This is the default page size used by all Meta cores.
26
27config PAGE_SIZE_8K
28 bool "8kB"
29 depends on METAG_META21_MMU
30 help
31 This enables 8kB pages as supported by Meta 2.x and later MMUs.
32
33config PAGE_SIZE_16K
34 bool "16kB"
35 depends on METAG_META21_MMU
36 help
37 This enables 16kB pages as supported by Meta 2.x and later MMUs.
38
39endchoice
40
41config NUMA
42 bool "Non Uniform Memory Access (NUMA) Support"
43 help
44 Some Meta systems have MMU-mappable on-chip memories with
45 lower latencies than main memory. This enables support for
46 these blocks by binding them to nodes and allowing
47 memory policies to be used for prioritizing and controlling
48 allocation behaviour.
49
50config FORCE_MAX_ZONEORDER
51 int "Maximum zone order"
52 range 10 32
53 default "10"
54 help
55 The kernel memory allocator divides physically contiguous memory
56 blocks into "zones", where each zone is a power of two number of
57 pages. This option selects the largest power of two that the kernel
58 keeps in the memory allocator. If you need to allocate very large
59 blocks of physically contiguous memory, then you may need to
60 increase this value.
61
62 This config option is actually maximum order plus one. For example,
63 a value of 11 means that the largest free memory block is 2^10 pages.
64
65 The page size is not necessarily 4KB. Keep this in mind
66 when choosing a value for this option.
67
68config METAG_L2C
69 bool "Level 2 Cache Support"
70 depends on METAG_META21
71 help
72 Press y here to enable support for the Meta Level 2 (L2) cache. This
73 will enable the cache at start up if it hasn't already been enabled
74 by the bootloader.
75
76 If the bootloader enables the L2 you must press y here to ensure the
77 kernel takes the appropriate actions to keep the cache coherent.
78
79config NODES_SHIFT
80 int
81 default "1"
82 depends on NEED_MULTIPLE_NODES
83
84config ARCH_FLATMEM_ENABLE
85 def_bool y
86 depends on !NUMA
87
88config ARCH_SPARSEMEM_ENABLE
89 def_bool y
90 select SPARSEMEM_STATIC
91
92config ARCH_SPARSEMEM_DEFAULT
93 def_bool y
94
95config MAX_ACTIVE_REGIONS
96 int
97 default "2" if SPARSEMEM
98 default "1"
99
100config ARCH_POPULATES_NODE_MAP
101 def_bool y
102
103config ARCH_SELECT_MEMORY_MODEL
104 def_bool y
105
106config SYS_SUPPORTS_HUGETLBFS
107 def_bool y
108 depends on METAG_META21_MMU
109
110choice
111 prompt "HugeTLB page size"
112 depends on METAG_META21_MMU && HUGETLB_PAGE
113 default HUGETLB_PAGE_SIZE_1M
114
115config HUGETLB_PAGE_SIZE_8K
116 bool "8kB"
117 depends on PAGE_SIZE_4K
118
119config HUGETLB_PAGE_SIZE_16K
120 bool "16kB"
121 depends on PAGE_SIZE_4K || PAGE_SIZE_8K
122
123config HUGETLB_PAGE_SIZE_32K
124 bool "32kB"
125
126config HUGETLB_PAGE_SIZE_64K
127 bool "64kB"
128
129config HUGETLB_PAGE_SIZE_128K
130 bool "128kB"
131
132config HUGETLB_PAGE_SIZE_256K
133 bool "256kB"
134
135config HUGETLB_PAGE_SIZE_512K
136 bool "512kB"
137
138config HUGETLB_PAGE_SIZE_1M
139 bool "1MB"
140
141config HUGETLB_PAGE_SIZE_2M
142 bool "2MB"
143
144config HUGETLB_PAGE_SIZE_4M
145 bool "4MB"
146
147endchoice
148
149config METAG_COREMEM
150 bool
151 default y if SUSPEND
152
153source "mm/Kconfig"
diff --git a/arch/metag/mm/Makefile b/arch/metag/mm/Makefile
new file mode 100644
index 000000000000..994331164125
--- /dev/null
+++ b/arch/metag/mm/Makefile
@@ -0,0 +1,19 @@
1#
2# Makefile for the linux Meta-specific parts of the memory manager.
3#
4
5obj-y += cache.o
6obj-y += extable.o
7obj-y += fault.o
8obj-y += init.o
9obj-y += ioremap.o
10obj-y += maccess.o
11
12mmu-y := mmu-meta1.o
13mmu-$(CONFIG_METAG_META21_MMU) := mmu-meta2.o
14obj-y += $(mmu-y)
15
16obj-$(CONFIG_HIGHMEM) += highmem.o
17obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
18obj-$(CONFIG_METAG_L2C) += l2cache.o
19obj-$(CONFIG_NUMA) += numa.o
diff --git a/arch/metag/tbx/Makefile b/arch/metag/tbx/Makefile
new file mode 100644
index 000000000000..e994239e518c
--- /dev/null
+++ b/arch/metag/tbx/Makefile
@@ -0,0 +1,21 @@
1#
2# Makefile for TBX library files..
3#
4
5asflags-y += -mmetac=2.1 -Wa,-mfpu=metac21 -mdsp
6asflags-$(CONFIG_SMP) += -DTBX_PERCPU_SP_SAVE
7
8ccflags-y += -mmetac=2.1
9
10lib-y += tbicore.o
11lib-y += tbictx.o
12lib-y += tbidefr.o
13lib-y += tbilogf.o
14lib-y += tbipcx.o
15lib-y += tbiroot.o
16lib-y += tbisoft.o
17lib-y += tbistring.o
18lib-y += tbitimer.o
19
20lib-$(CONFIG_METAG_DSP) += tbidspram.o
21lib-$(CONFIG_METAG_FPU) += tbictxfpu.o