diff options
author | Ley Foon Tan <lftan@altera.com> | 2014-11-06 02:20:19 -0500 |
---|---|---|
committer | Ley Foon Tan <lftan@altera.com> | 2014-12-07 23:56:06 -0500 |
commit | 2fc8483fdcde767795402a38a53e647811dc9abf (patch) | |
tree | 01c734b5191c6ddd5c095fb2a08494720b06f817 | |
parent | 9cce02ec7146248862ba63a41bf8eb32d9e4fb63 (diff) |
nios2: Build infrastructure
This patch adds Makefile and Kconfig files required for building a
nios2 kernel.
Signed-off-by: Ley Foon Tan <lftan@altera.com>
-rw-r--r-- | arch/nios2/Kconfig | 201 | ||||
-rw-r--r-- | arch/nios2/Kconfig.debug | 17 | ||||
-rw-r--r-- | arch/nios2/Makefile | 73 | ||||
-rw-r--r-- | arch/nios2/boot/Makefile | 52 | ||||
-rw-r--r-- | arch/nios2/boot/install.sh | 52 | ||||
-rw-r--r-- | arch/nios2/configs/3c120_defconfig | 77 | ||||
-rw-r--r-- | arch/nios2/include/asm/Kbuild | 66 | ||||
-rw-r--r-- | arch/nios2/include/uapi/asm/Kbuild | 4 | ||||
-rw-r--r-- | arch/nios2/kernel/Makefile | 24 | ||||
-rw-r--r-- | arch/nios2/kernel/nios2_ksyms.c | 33 | ||||
-rw-r--r-- | arch/nios2/kernel/vmlinux.lds.S | 75 | ||||
-rw-r--r-- | arch/nios2/lib/Makefile | 8 | ||||
-rw-r--r-- | arch/nios2/mm/Makefile | 14 | ||||
-rw-r--r-- | arch/nios2/platform/Kconfig.platform | 129 | ||||
-rw-r--r-- | arch/nios2/platform/Makefile | 1 |
15 files changed, 826 insertions, 0 deletions
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig new file mode 100644 index 000000000000..8a4889d24db1 --- /dev/null +++ b/arch/nios2/Kconfig | |||
@@ -0,0 +1,201 @@ | |||
1 | config NIOS2 | ||
2 | def_bool y | ||
3 | select ARCH_WANT_OPTIONAL_GPIOLIB | ||
4 | select CLKSRC_OF | ||
5 | select GENERIC_ATOMIC64 | ||
6 | select GENERIC_CLOCKEVENTS | ||
7 | select GENERIC_CPU_DEVICES | ||
8 | select GENERIC_IRQ_PROBE | ||
9 | select GENERIC_IRQ_SHOW | ||
10 | select HAVE_ARCH_TRACEHOOK | ||
11 | select IRQ_DOMAIN | ||
12 | select MODULES_USE_ELF_RELA | ||
13 | select OF | ||
14 | select OF_EARLY_FLATTREE | ||
15 | select SOC_BUS | ||
16 | select SPARSE_IRQ | ||
17 | select USB_ARCH_HAS_HCD if USB_SUPPORT | ||
18 | |||
19 | config GENERIC_CSUM | ||
20 | def_bool y | ||
21 | |||
22 | config GENERIC_HWEIGHT | ||
23 | def_bool y | ||
24 | |||
25 | config GENERIC_CALIBRATE_DELAY | ||
26 | def_bool y | ||
27 | |||
28 | config NO_IOPORT_MAP | ||
29 | def_bool y | ||
30 | |||
31 | config HAS_DMA | ||
32 | def_bool y | ||
33 | |||
34 | config FPU | ||
35 | def_bool n | ||
36 | |||
37 | config SWAP | ||
38 | def_bool n | ||
39 | |||
40 | config RWSEM_GENERIC_SPINLOCK | ||
41 | def_bool y | ||
42 | |||
43 | config TRACE_IRQFLAGS_SUPPORT | ||
44 | def_bool n | ||
45 | |||
46 | source "init/Kconfig" | ||
47 | |||
48 | menu "Kernel features" | ||
49 | |||
50 | source "kernel/Kconfig.preempt" | ||
51 | |||
52 | source "kernel/Kconfig.freezer" | ||
53 | |||
54 | source "kernel/Kconfig.hz" | ||
55 | |||
56 | source "mm/Kconfig" | ||
57 | |||
58 | config FORCE_MAX_ZONEORDER | ||
59 | int "Maximum zone order" | ||
60 | range 9 20 | ||
61 | default "11" | ||
62 | help | ||
63 | The kernel memory allocator divides physically contiguous memory | ||
64 | blocks into "zones", where each zone is a power of two number of | ||
65 | pages. This option selects the largest power of two that the kernel | ||
66 | keeps in the memory allocator. If you need to allocate very large | ||
67 | blocks of physically contiguous memory, then you may need to | ||
68 | increase this value. | ||
69 | |||
70 | This config option is actually maximum order plus one. For example, | ||
71 | a value of 11 means that the largest free memory block is 2^10 pages. | ||
72 | |||
73 | endmenu | ||
74 | |||
75 | source "arch/nios2/platform/Kconfig.platform" | ||
76 | |||
77 | menu "Processor type and features" | ||
78 | |||
79 | config MMU | ||
80 | def_bool y | ||
81 | |||
82 | config NIOS2_ALIGNMENT_TRAP | ||
83 | bool "Catch alignment trap" | ||
84 | default y | ||
85 | help | ||
86 | Nios II CPUs cannot fetch/store data which is not bus aligned, | ||
87 | i.e., a 2 or 4 byte fetch must start at an address divisible by | ||
88 | 2 or 4. Any non-aligned load/store instructions will be trapped and | ||
89 | emulated in software if you say Y here, which has a performance | ||
90 | impact. | ||
91 | |||
92 | comment "Boot options" | ||
93 | |||
94 | config CMDLINE_BOOL | ||
95 | bool "Default bootloader kernel arguments" | ||
96 | default y | ||
97 | |||
98 | config CMDLINE | ||
99 | string "Default kernel command string" | ||
100 | default "" | ||
101 | depends on CMDLINE_BOOL | ||
102 | help | ||
103 | On some platforms, there is currently no way for the boot loader to | ||
104 | pass arguments to the kernel. For these platforms, you can supply | ||
105 | some command-line options at build time by entering them here. In | ||
106 | other cases you can specify kernel args so that you don't have | ||
107 | to set them up in board prom initialization routines. | ||
108 | |||
109 | config CMDLINE_FORCE | ||
110 | bool "Force default kernel command string" | ||
111 | depends on CMDLINE_BOOL | ||
112 | help | ||
113 | Set this to have arguments from the default kernel command string | ||
114 | override those passed by the boot loader. | ||
115 | |||
116 | config NIOS2_CMDLINE_IGNORE_DTB | ||
117 | bool "Ignore kernel command string from DTB" | ||
118 | depends on !CMDLINE_FORCE | ||
119 | default y | ||
120 | help | ||
121 | Set this to ignore the bootargs property from the devicetree's | ||
122 | chosen node and fall back to CMDLINE if nothing is passed. | ||
123 | |||
124 | config NIOS2_PASS_CMDLINE | ||
125 | bool "Passed kernel command line from u-boot" | ||
126 | default n | ||
127 | help | ||
128 | Use bootargs env variable from u-boot for kernel command line. | ||
129 | will override "Default kernel command string". | ||
130 | Say N if you are unsure. | ||
131 | |||
132 | endmenu | ||
133 | |||
134 | menu "Advanced setup" | ||
135 | |||
136 | config ADVANCED_OPTIONS | ||
137 | bool "Prompt for advanced kernel configuration options" | ||
138 | help | ||
139 | |||
140 | comment "Default settings for advanced configuration options are used" | ||
141 | depends on !ADVANCED_OPTIONS | ||
142 | |||
143 | config NIOS2_KERNEL_MMU_REGION_BASE_BOOL | ||
144 | bool "Set custom kernel MMU region base address" | ||
145 | depends on ADVANCED_OPTIONS | ||
146 | help | ||
147 | This option allows you to set the virtual address of the kernel MMU region. | ||
148 | |||
149 | Say N here unless you know what you are doing. | ||
150 | |||
151 | config NIOS2_KERNEL_MMU_REGION_BASE | ||
152 | hex "Virtual base address of the kernel MMU region " if NIOS2_KERNEL_MMU_REGION_BASE_BOOL | ||
153 | default "0x80000000" | ||
154 | help | ||
155 | This option allows you to set the virtual base address of the kernel MMU region. | ||
156 | |||
157 | config NIOS2_KERNEL_REGION_BASE_BOOL | ||
158 | bool "Set custom kernel region base address" | ||
159 | depends on ADVANCED_OPTIONS | ||
160 | help | ||
161 | This option allows you to set the virtual address of the kernel region. | ||
162 | |||
163 | Say N here unless you know what you are doing. | ||
164 | |||
165 | config NIOS2_KERNEL_REGION_BASE | ||
166 | hex "Virtual base address of the kernel region " if NIOS2_KERNEL_REGION_BASE_BOOL | ||
167 | default "0xc0000000" | ||
168 | |||
169 | config NIOS2_IO_REGION_BASE_BOOL | ||
170 | bool "Set custom I/O region base address" | ||
171 | depends on ADVANCED_OPTIONS | ||
172 | help | ||
173 | This option allows you to set the virtual address of the I/O region. | ||
174 | |||
175 | Say N here unless you know what you are doing. | ||
176 | |||
177 | config NIOS2_IO_REGION_BASE | ||
178 | hex "Virtual base address of the I/O region" if NIOS2_IO_REGION_BASE_BOOL | ||
179 | default "0xe0000000" | ||
180 | |||
181 | endmenu | ||
182 | |||
183 | menu "Executable file formats" | ||
184 | |||
185 | source "fs/Kconfig.binfmt" | ||
186 | |||
187 | endmenu | ||
188 | |||
189 | source "net/Kconfig" | ||
190 | |||
191 | source "drivers/Kconfig" | ||
192 | |||
193 | source "fs/Kconfig" | ||
194 | |||
195 | source "arch/nios2/Kconfig.debug" | ||
196 | |||
197 | source "security/Kconfig" | ||
198 | |||
199 | source "crypto/Kconfig" | ||
200 | |||
201 | source "lib/Kconfig" | ||
diff --git a/arch/nios2/Kconfig.debug b/arch/nios2/Kconfig.debug new file mode 100644 index 000000000000..8d4e6bacd997 --- /dev/null +++ b/arch/nios2/Kconfig.debug | |||
@@ -0,0 +1,17 @@ | |||
1 | menu "Kernel hacking" | ||
2 | |||
3 | config TRACE_IRQFLAGS_SUPPORT | ||
4 | def_bool y | ||
5 | |||
6 | source "lib/Kconfig.debug" | ||
7 | |||
8 | config DEBUG_STACK_USAGE | ||
9 | bool "Enable stack utilization instrumentation" | ||
10 | depends on DEBUG_KERNEL | ||
11 | help | ||
12 | Enables the display of the minimum amount of free stack which each | ||
13 | task has ever had available in the sysrq-T and sysrq-P debug output. | ||
14 | |||
15 | This option will slow down process creation somewhat. | ||
16 | |||
17 | endmenu | ||
diff --git a/arch/nios2/Makefile b/arch/nios2/Makefile new file mode 100644 index 000000000000..e142c9ee51fa --- /dev/null +++ b/arch/nios2/Makefile | |||
@@ -0,0 +1,73 @@ | |||
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) 2013 Altera Corporation | ||
7 | # Copyright (C) 1994, 95, 96, 2003 by Wind River Systems | ||
8 | # Written by Fredrik Markstrom | ||
9 | # | ||
10 | # This file is included by the global makefile so that you can add your own | ||
11 | # architecture-specific flags and dependencies. Remember to do have actions | ||
12 | # for "archclean" cleaning up for this architecture. | ||
13 | # | ||
14 | # Nios2 port by Wind River Systems Inc trough: | ||
15 | # fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com | ||
16 | |||
17 | UTS_SYSNAME = Linux | ||
18 | |||
19 | export MMU | ||
20 | |||
21 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | ||
22 | |||
23 | KBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__ | ||
24 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul) | ||
25 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx) | ||
26 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div) | ||
27 | KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,) | ||
28 | |||
29 | KBUILD_CFLAGS += -fno-optimize-sibling-calls | ||
30 | KBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\" | ||
31 | KBUILD_CFLAGS += -fno-builtin | ||
32 | KBUILD_CFLAGS += -G 0 | ||
33 | |||
34 | head-y := arch/nios2/kernel/head.o | ||
35 | libs-y += arch/nios2/lib/ $(LIBGCC) | ||
36 | core-y += arch/nios2/kernel/ arch/nios2/mm/ | ||
37 | core-y += arch/nios2/platform/ | ||
38 | |||
39 | INSTALL_PATH ?= /tftpboot | ||
40 | nios2-boot := arch/$(ARCH)/boot | ||
41 | BOOT_TARGETS = vmImage zImage | ||
42 | PHONY += $(BOOT_TARGETS) install | ||
43 | KBUILD_IMAGE := $(nios2-boot)/vmImage | ||
44 | |||
45 | ifneq ($(CONFIG_NIOS2_DTB_SOURCE),"") | ||
46 | core-y += $(nios2-boot)/ | ||
47 | endif | ||
48 | |||
49 | all: vmImage | ||
50 | |||
51 | archclean: | ||
52 | $(Q)$(MAKE) $(clean)=$(nios2-boot) | ||
53 | |||
54 | %.dtb: | ||
55 | $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ | ||
56 | |||
57 | dtbs: | ||
58 | $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ | ||
59 | |||
60 | $(BOOT_TARGETS): vmlinux | ||
61 | $(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@ | ||
62 | |||
63 | install: | ||
64 | $(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install | ||
65 | |||
66 | define archhelp | ||
67 | echo '* vmImage - Kernel-only image for U-Boot ($(KBUILD_IMAGE))' | ||
68 | echo ' install - Install kernel using' | ||
69 | echo ' (your) ~/bin/$(INSTALLKERNEL) or' | ||
70 | echo ' (distribution) /sbin/$(INSTALLKERNEL) or' | ||
71 | echo ' install to $$(INSTALL_PATH)' | ||
72 | echo ' dtbs - Build device tree blobs for enabled boards' | ||
73 | endef | ||
diff --git a/arch/nios2/boot/Makefile b/arch/nios2/boot/Makefile new file mode 100644 index 000000000000..59392dc0bdcb --- /dev/null +++ b/arch/nios2/boot/Makefile | |||
@@ -0,0 +1,52 @@ | |||
1 | # | ||
2 | # arch/nios2/boot/Makefile | ||
3 | # | ||
4 | # This file is subject to the terms and conditions of the GNU General Public | ||
5 | # License. See the file "COPYING" in the main directory of this archive | ||
6 | # for more details. | ||
7 | # | ||
8 | |||
9 | UIMAGE_LOADADDR = $(shell $(NM) vmlinux | awk '$$NF == "_stext" {print $$1}') | ||
10 | UIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "_start" {print $$1}') | ||
11 | UIMAGE_COMPRESSION = gzip | ||
12 | |||
13 | OBJCOPYFLAGS_vmlinux.bin := -O binary | ||
14 | |||
15 | targets += vmlinux.bin vmlinux.gz vmImage | ||
16 | |||
17 | $(obj)/vmlinux.bin: vmlinux FORCE | ||
18 | $(call if_changed,objcopy) | ||
19 | |||
20 | $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE | ||
21 | $(call if_changed,gzip) | ||
22 | |||
23 | $(obj)/vmImage: $(obj)/vmlinux.gz | ||
24 | $(call if_changed,uimage) | ||
25 | @$(kecho) 'Kernel: $@ is ready' | ||
26 | |||
27 | # Rule to build device tree blobs | ||
28 | DTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE)) | ||
29 | |||
30 | # Make sure the generated dtb gets removed during clean | ||
31 | extra-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += system.dtb | ||
32 | |||
33 | $(obj)/system.dtb: $(DTB_SRC) FORCE | ||
34 | $(call cmd,dtc) | ||
35 | |||
36 | # Ensure system.dtb exists | ||
37 | $(obj)/linked_dtb.o: $(obj)/system.dtb | ||
38 | |||
39 | obj-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += linked_dtb.o | ||
40 | |||
41 | targets += $(dtb-y) | ||
42 | |||
43 | # Rule to build device tree blobs with make command | ||
44 | $(obj)/%.dtb: $(src)/dts/%.dts FORCE | ||
45 | $(call if_changed_dep,dtc) | ||
46 | |||
47 | $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) | ||
48 | |||
49 | clean-files := *.dtb | ||
50 | |||
51 | install: | ||
52 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" | ||
diff --git a/arch/nios2/boot/install.sh b/arch/nios2/boot/install.sh new file mode 100644 index 000000000000..3cb3f468bc51 --- /dev/null +++ b/arch/nios2/boot/install.sh | |||
@@ -0,0 +1,52 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # This file is subject to the terms and conditions of the GNU General Public | ||
4 | # License. See the file "COPYING" in the main directory of this archive | ||
5 | # for more details. | ||
6 | # | ||
7 | # Copyright (C) 1995 by Linus Torvalds | ||
8 | # | ||
9 | # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin | ||
10 | # | ||
11 | # "make install" script for nios2 architecture | ||
12 | # | ||
13 | # Arguments: | ||
14 | # $1 - kernel version | ||
15 | # $2 - kernel image file | ||
16 | # $3 - kernel map file | ||
17 | # $4 - default install path (blank if root directory) | ||
18 | # | ||
19 | |||
20 | verify () { | ||
21 | if [ ! -f "$1" ]; then | ||
22 | echo "" 1>&2 | ||
23 | echo " *** Missing file: $1" 1>&2 | ||
24 | echo ' *** You need to run "make" before "make install".' 1>&2 | ||
25 | echo "" 1>&2 | ||
26 | exit 1 | ||
27 | fi | ||
28 | } | ||
29 | |||
30 | # Make sure the files actually exist | ||
31 | verify "$2" | ||
32 | verify "$3" | ||
33 | |||
34 | # User may have a custom install script | ||
35 | |||
36 | if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi | ||
37 | if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi | ||
38 | |||
39 | # Default install - same as make zlilo | ||
40 | |||
41 | if [ -f $4/vmlinuz ]; then | ||
42 | mv $4/vmlinuz $4/vmlinuz.old | ||
43 | fi | ||
44 | |||
45 | if [ -f $4/System.map ]; then | ||
46 | mv $4/System.map $4/System.old | ||
47 | fi | ||
48 | |||
49 | cat $2 > $4/vmlinuz | ||
50 | cp $3 $4/System.map | ||
51 | |||
52 | sync | ||
diff --git a/arch/nios2/configs/3c120_defconfig b/arch/nios2/configs/3c120_defconfig new file mode 100644 index 000000000000..87541f0a5d6e --- /dev/null +++ b/arch/nios2/configs/3c120_defconfig | |||
@@ -0,0 +1,77 @@ | |||
1 | CONFIG_SYSVIPC=y | ||
2 | CONFIG_NO_HZ_IDLE=y | ||
3 | CONFIG_BSD_PROCESS_ACCT=y | ||
4 | CONFIG_LOG_BUF_SHIFT=14 | ||
5 | CONFIG_SYSCTL_SYSCALL=y | ||
6 | # CONFIG_ELF_CORE is not set | ||
7 | # CONFIG_EPOLL is not set | ||
8 | # CONFIG_SIGNALFD is not set | ||
9 | # CONFIG_TIMERFD is not set | ||
10 | # CONFIG_EVENTFD is not set | ||
11 | # CONFIG_SHMEM is not set | ||
12 | # CONFIG_AIO is not set | ||
13 | CONFIG_EMBEDDED=y | ||
14 | CONFIG_SLAB=y | ||
15 | CONFIG_MODULES=y | ||
16 | CONFIG_MODULE_UNLOAD=y | ||
17 | CONFIG_NIOS2_MEM_BASE=0x10000000 | ||
18 | CONFIG_NIOS2_HW_MUL_SUPPORT=y | ||
19 | CONFIG_NIOS2_HW_DIV_SUPPORT=y | ||
20 | CONFIG_CUSTOM_CACHE_SETTINGS=y | ||
21 | CONFIG_NIOS2_DCACHE_SIZE=0x8000 | ||
22 | CONFIG_NIOS2_ICACHE_SIZE=0x8000 | ||
23 | # CONFIG_NIOS2_CMDLINE_IGNORE_DTB is not set | ||
24 | CONFIG_NIOS2_PASS_CMDLINE=y | ||
25 | CONFIG_NET=y | ||
26 | CONFIG_PACKET=y | ||
27 | CONFIG_UNIX=y | ||
28 | CONFIG_INET=y | ||
29 | CONFIG_IP_MULTICAST=y | ||
30 | CONFIG_IP_PNP=y | ||
31 | CONFIG_IP_PNP_DHCP=y | ||
32 | CONFIG_IP_PNP_BOOTP=y | ||
33 | CONFIG_IP_PNP_RARP=y | ||
34 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
35 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
36 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
37 | # CONFIG_INET_LRO is not set | ||
38 | # CONFIG_IPV6 is not set | ||
39 | # CONFIG_WIRELESS is not set | ||
40 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
41 | CONFIG_DEVTMPFS=y | ||
42 | CONFIG_DEVTMPFS_MOUNT=y | ||
43 | # CONFIG_FW_LOADER is not set | ||
44 | CONFIG_MTD=y | ||
45 | CONFIG_MTD_CMDLINE_PARTS=y | ||
46 | CONFIG_MTD_BLOCK=y | ||
47 | CONFIG_MTD_CFI=y | ||
48 | CONFIG_MTD_CFI_INTELEXT=y | ||
49 | CONFIG_MTD_CFI_AMDSTD=y | ||
50 | CONFIG_MTD_PHYSMAP_OF=y | ||
51 | CONFIG_BLK_DEV_LOOP=y | ||
52 | CONFIG_NETDEVICES=y | ||
53 | CONFIG_ALTERA_TSE=y | ||
54 | CONFIG_MARVELL_PHY=y | ||
55 | # CONFIG_WLAN is not set | ||
56 | # CONFIG_INPUT_MOUSE is not set | ||
57 | # CONFIG_SERIO_SERPORT is not set | ||
58 | # CONFIG_VT is not set | ||
59 | CONFIG_SERIAL_ALTERA_JTAGUART=y | ||
60 | CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE=y | ||
61 | CONFIG_SERIAL_ALTERA_UART=y | ||
62 | # CONFIG_HW_RANDOM is not set | ||
63 | # CONFIG_HWMON is not set | ||
64 | # CONFIG_USB_SUPPORT is not set | ||
65 | CONFIG_NEW_LEDS=y | ||
66 | CONFIG_LEDS_CLASS=y | ||
67 | CONFIG_LEDS_TRIGGERS=y | ||
68 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | ||
69 | # CONFIG_DNOTIFY is not set | ||
70 | # CONFIG_INOTIFY_USER is not set | ||
71 | CONFIG_JFFS2_FS=y | ||
72 | CONFIG_NFS_FS=y | ||
73 | CONFIG_NFS_V3_ACL=y | ||
74 | CONFIG_ROOT_NFS=y | ||
75 | CONFIG_SUNRPC_DEBUG=y | ||
76 | CONFIG_DEBUG_INFO=y | ||
77 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | ||
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild new file mode 100644 index 000000000000..bb160be0dc28 --- /dev/null +++ b/arch/nios2/include/asm/Kbuild | |||
@@ -0,0 +1,66 @@ | |||
1 | generic-y += atomic.h | ||
2 | generic-y += auxvec.h | ||
3 | generic-y += barrier.h | ||
4 | generic-y += bitops.h | ||
5 | generic-y += bitsperlong.h | ||
6 | generic-y += bug.h | ||
7 | generic-y += bugs.h | ||
8 | generic-y += clkdev.h | ||
9 | generic-y += cputime.h | ||
10 | generic-y += current.h | ||
11 | generic-y += device.h | ||
12 | generic-y += div64.h | ||
13 | generic-y += dma.h | ||
14 | generic-y += emergency-restart.h | ||
15 | generic-y += errno.h | ||
16 | generic-y += exec.h | ||
17 | generic-y += fb.h | ||
18 | generic-y += fcntl.h | ||
19 | generic-y += ftrace.h | ||
20 | generic-y += futex.h | ||
21 | generic-y += hardirq.h | ||
22 | generic-y += hash.h | ||
23 | generic-y += hw_irq.h | ||
24 | generic-y += ioctl.h | ||
25 | generic-y += ioctls.h | ||
26 | generic-y += ipcbuf.h | ||
27 | generic-y += irq_regs.h | ||
28 | generic-y += irq_work.h | ||
29 | generic-y += kdebug.h | ||
30 | generic-y += kmap_types.h | ||
31 | generic-y += kvm_para.h | ||
32 | generic-y += local.h | ||
33 | generic-y += mcs_spinlock.h | ||
34 | generic-y += mman.h | ||
35 | generic-y += module.h | ||
36 | generic-y += msgbuf.h | ||
37 | generic-y += param.h | ||
38 | generic-y += pci.h | ||
39 | generic-y += percpu.h | ||
40 | generic-y += poll.h | ||
41 | generic-y += posix_types.h | ||
42 | generic-y += preempt.h | ||
43 | generic-y += resource.h | ||
44 | generic-y += scatterlist.h | ||
45 | generic-y += sections.h | ||
46 | generic-y += segment.h | ||
47 | generic-y += sembuf.h | ||
48 | generic-y += serial.h | ||
49 | generic-y += shmbuf.h | ||
50 | generic-y += shmparam.h | ||
51 | generic-y += siginfo.h | ||
52 | generic-y += signal.h | ||
53 | generic-y += socket.h | ||
54 | generic-y += sockios.h | ||
55 | generic-y += spinlock.h | ||
56 | generic-y += stat.h | ||
57 | generic-y += statfs.h | ||
58 | generic-y += termbits.h | ||
59 | generic-y += termios.h | ||
60 | generic-y += topology.h | ||
61 | generic-y += trace_clock.h | ||
62 | generic-y += types.h | ||
63 | generic-y += unaligned.h | ||
64 | generic-y += user.h | ||
65 | generic-y += vga.h | ||
66 | generic-y += xor.h | ||
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild new file mode 100644 index 000000000000..4f07ca3f8d10 --- /dev/null +++ b/arch/nios2/include/uapi/asm/Kbuild | |||
@@ -0,0 +1,4 @@ | |||
1 | include include/uapi/asm-generic/Kbuild.asm | ||
2 | |||
3 | header-y += elf.h | ||
4 | header-y += ucontext.h | ||
diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile new file mode 100644 index 000000000000..8ae76823ff93 --- /dev/null +++ b/arch/nios2/kernel/Makefile | |||
@@ -0,0 +1,24 @@ | |||
1 | # | ||
2 | # Makefile for the nios2 linux kernel. | ||
3 | # | ||
4 | |||
5 | extra-y += head.o | ||
6 | extra-y += vmlinux.lds | ||
7 | |||
8 | obj-y += cpuinfo.o | ||
9 | obj-y += entry.o | ||
10 | obj-y += insnemu.o | ||
11 | obj-y += irq.o | ||
12 | obj-y += nios2_ksyms.o | ||
13 | obj-y += process.o | ||
14 | obj-y += prom.o | ||
15 | obj-y += ptrace.o | ||
16 | obj-y += setup.o | ||
17 | obj-y += signal.o | ||
18 | obj-y += sys_nios2.o | ||
19 | obj-y += syscall_table.o | ||
20 | obj-y += time.o | ||
21 | obj-y += traps.o | ||
22 | |||
23 | obj-$(CONFIG_MODULES) += module.o | ||
24 | obj-$(CONFIG_NIOS2_ALIGNMENT_TRAP) += misaligned.o | ||
diff --git a/arch/nios2/kernel/nios2_ksyms.c b/arch/nios2/kernel/nios2_ksyms.c new file mode 100644 index 000000000000..bf2f55d10a4d --- /dev/null +++ b/arch/nios2/kernel/nios2_ksyms.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Microtronix Datacom Ltd | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General | ||
5 | * Public License. See the file COPYING in the main directory of this | ||
6 | * archive for more details. | ||
7 | */ | ||
8 | |||
9 | #include <linux/export.h> | ||
10 | #include <linux/string.h> | ||
11 | |||
12 | /* string functions */ | ||
13 | |||
14 | EXPORT_SYMBOL(memcpy); | ||
15 | EXPORT_SYMBOL(memset); | ||
16 | EXPORT_SYMBOL(memmove); | ||
17 | |||
18 | /* | ||
19 | * libgcc functions - functions that are used internally by the | ||
20 | * compiler... (prototypes are not correct though, but that | ||
21 | * doesn't really matter since they're not versioned). | ||
22 | */ | ||
23 | #define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name) | ||
24 | |||
25 | DECLARE_EXPORT(__gcc_bcmp); | ||
26 | DECLARE_EXPORT(__divsi3); | ||
27 | DECLARE_EXPORT(__moddi3); | ||
28 | DECLARE_EXPORT(__modsi3); | ||
29 | DECLARE_EXPORT(__udivmoddi4); | ||
30 | DECLARE_EXPORT(__udivsi3); | ||
31 | DECLARE_EXPORT(__umoddi3); | ||
32 | DECLARE_EXPORT(__umodsi3); | ||
33 | DECLARE_EXPORT(__muldi3); | ||
diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S new file mode 100644 index 000000000000..326fab40a9de --- /dev/null +++ b/arch/nios2/kernel/vmlinux.lds.S | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | */ | ||
18 | #include <asm/page.h> | ||
19 | #include <asm-generic/vmlinux.lds.h> | ||
20 | #include <asm/cache.h> | ||
21 | #include <asm/thread_info.h> | ||
22 | |||
23 | OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2") | ||
24 | |||
25 | OUTPUT_ARCH(nios) | ||
26 | ENTRY(_start) /* Defined in head.S */ | ||
27 | |||
28 | jiffies = jiffies_64; | ||
29 | |||
30 | SECTIONS | ||
31 | { | ||
32 | . = CONFIG_NIOS2_MEM_BASE | CONFIG_NIOS2_KERNEL_REGION_BASE; | ||
33 | |||
34 | _text = .; | ||
35 | _stext = .; | ||
36 | HEAD_TEXT_SECTION | ||
37 | .text : { | ||
38 | TEXT_TEXT | ||
39 | SCHED_TEXT | ||
40 | LOCK_TEXT | ||
41 | IRQENTRY_TEXT | ||
42 | KPROBES_TEXT | ||
43 | } =0 | ||
44 | _etext = .; | ||
45 | |||
46 | .got : { | ||
47 | *(.got.plt) | ||
48 | *(.igot.plt) | ||
49 | *(.got) | ||
50 | *(.igot) | ||
51 | } | ||
52 | |||
53 | EXCEPTION_TABLE(L1_CACHE_BYTES) | ||
54 | |||
55 | . = ALIGN(PAGE_SIZE); | ||
56 | __init_begin = .; | ||
57 | INIT_TEXT_SECTION(PAGE_SIZE) | ||
58 | INIT_DATA_SECTION(PAGE_SIZE) | ||
59 | PERCPU_SECTION(L1_CACHE_BYTES) | ||
60 | __init_end = .; | ||
61 | |||
62 | _sdata = .; | ||
63 | RO_DATA_SECTION(PAGE_SIZE) | ||
64 | RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) | ||
65 | _edata = .; | ||
66 | |||
67 | BSS_SECTION(0, 0, 0) | ||
68 | _end = .; | ||
69 | |||
70 | STABS_DEBUG | ||
71 | DWARF_DEBUG | ||
72 | NOTES | ||
73 | |||
74 | DISCARDS | ||
75 | } | ||
diff --git a/arch/nios2/lib/Makefile b/arch/nios2/lib/Makefile new file mode 100644 index 000000000000..557256628ecd --- /dev/null +++ b/arch/nios2/lib/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Makefile for Nios2-specific library files. | ||
3 | # | ||
4 | |||
5 | lib-y += delay.o | ||
6 | lib-y += memcpy.o | ||
7 | lib-y += memmove.o | ||
8 | lib-y += memset.o | ||
diff --git a/arch/nios2/mm/Makefile b/arch/nios2/mm/Makefile new file mode 100644 index 000000000000..3cbd0840873c --- /dev/null +++ b/arch/nios2/mm/Makefile | |||
@@ -0,0 +1,14 @@ | |||
1 | # | ||
2 | # Makefile for the Nios2-specific parts of the memory manager. | ||
3 | # | ||
4 | |||
5 | obj-y += cacheflush.o | ||
6 | obj-y += dma-mapping.o | ||
7 | obj-y += extable.o | ||
8 | obj-y += fault.o | ||
9 | obj-y += init.o | ||
10 | obj-y += ioremap.o | ||
11 | obj-y += mmu_context.o | ||
12 | obj-y += pgtable.o | ||
13 | obj-y += tlb.o | ||
14 | obj-y += uaccess.o | ||
diff --git a/arch/nios2/platform/Kconfig.platform b/arch/nios2/platform/Kconfig.platform new file mode 100644 index 000000000000..d3e5df9fb36b --- /dev/null +++ b/arch/nios2/platform/Kconfig.platform | |||
@@ -0,0 +1,129 @@ | |||
1 | menu "Platform options" | ||
2 | |||
3 | comment "Memory settings" | ||
4 | |||
5 | config NIOS2_MEM_BASE | ||
6 | hex "Memory base address" | ||
7 | default "0x00000000" | ||
8 | help | ||
9 | This is the physical address of the memory that the kernel will run | ||
10 | from. This address is used to link the kernel and setup initial memory | ||
11 | management. You should take the raw memory address without any MMU | ||
12 | or cache bits set. | ||
13 | Please not that this address is used directly so you have to manually | ||
14 | do address translation if it's connected to a bridge. | ||
15 | |||
16 | comment "Device tree" | ||
17 | |||
18 | config NIOS2_DTB_AT_PHYS_ADDR | ||
19 | bool "DTB at physical address" | ||
20 | default n | ||
21 | help | ||
22 | When enabled you can select a physical address to load the dtb from. | ||
23 | Normally this address is passed by a bootloader such as u-boot but | ||
24 | using this you can use a devicetree without a bootloader. | ||
25 | This way you can store a devicetree in NOR flash or an onchip rom. | ||
26 | Please note that this address is used directly so you have to manually | ||
27 | do address translation if it's connected to a bridge. Also take into | ||
28 | account that when using an MMU you'd have to ad 0xC0000000 to your | ||
29 | address | ||
30 | |||
31 | config NIOS2_DTB_PHYS_ADDR | ||
32 | hex "DTB Address" | ||
33 | depends on NIOS2_DTB_AT_PHYS_ADDR | ||
34 | default "0xC0000000" | ||
35 | help | ||
36 | Physical address of a dtb blob. | ||
37 | |||
38 | config NIOS2_DTB_SOURCE_BOOL | ||
39 | bool "Compile and link device tree into kernel image" | ||
40 | default n | ||
41 | help | ||
42 | This allows you to specify a dts (device tree source) file | ||
43 | which will be compiled and linked into the kernel image. | ||
44 | |||
45 | config NIOS2_DTB_SOURCE | ||
46 | string "Device tree source file" | ||
47 | depends on NIOS2_DTB_SOURCE_BOOL | ||
48 | default "" | ||
49 | help | ||
50 | Absolute path to the device tree source (dts) file describing your | ||
51 | system. | ||
52 | |||
53 | comment "Nios II instructions" | ||
54 | |||
55 | config NIOS2_HW_MUL_SUPPORT | ||
56 | bool "Enable MUL instruction" | ||
57 | default n | ||
58 | help | ||
59 | Set to true if you configured the Nios II to include the MUL | ||
60 | instruction. This will enable the -mhw-mul compiler flag. | ||
61 | |||
62 | config NIOS2_HW_MULX_SUPPORT | ||
63 | bool "Enable MULX instruction" | ||
64 | default n | ||
65 | help | ||
66 | Set to true if you configured the Nios II to include the MULX | ||
67 | instruction. Enables the -mhw-mulx compiler flag. | ||
68 | |||
69 | config NIOS2_HW_DIV_SUPPORT | ||
70 | bool "Enable DIV instruction" | ||
71 | default n | ||
72 | help | ||
73 | Set to true if you configured the Nios II to include the DIV | ||
74 | instruction. Enables the -mhw-div compiler flag. | ||
75 | |||
76 | config NIOS2_FPU_SUPPORT | ||
77 | bool "Custom floating point instr support" | ||
78 | default n | ||
79 | help | ||
80 | Enables the -mcustom-fpu-cfg=60-1 compiler flag. | ||
81 | |||
82 | config NIOS2_CI_SWAB_SUPPORT | ||
83 | bool "Byteswap custom instruction" | ||
84 | default n | ||
85 | help | ||
86 | Use the byteswap (endian converter) Nios II custom instruction provided | ||
87 | by Altera and which can be enabled in QSYS builder. This accelerates | ||
88 | endian conversions in the kernel (e.g. ntohs). | ||
89 | |||
90 | config NIOS2_CI_SWAB_NO | ||
91 | int "Byteswap custom instruction number" if NIOS2_CI_SWAB_SUPPORT | ||
92 | default 0 | ||
93 | help | ||
94 | Number of the instruction as configured in QSYS Builder. | ||
95 | |||
96 | comment "Cache settings" | ||
97 | |||
98 | config CUSTOM_CACHE_SETTINGS | ||
99 | bool "Custom cache settings" | ||
100 | help | ||
101 | This option allows you to tweak the cache settings used during early | ||
102 | boot (where the information from device tree is not yet available). | ||
103 | There should be no reason to change these values. Linux will work | ||
104 | perfectly fine, even if the Nios II is configured with smaller caches. | ||
105 | |||
106 | Say N here unless you know what you are doing. | ||
107 | |||
108 | config NIOS2_DCACHE_SIZE | ||
109 | hex "D-Cache size" if CUSTOM_CACHE_SETTINGS | ||
110 | range 0x200 0x10000 | ||
111 | default "0x800" | ||
112 | help | ||
113 | Maximum possible data cache size. | ||
114 | |||
115 | config NIOS2_DCACHE_LINE_SIZE | ||
116 | hex "D-Cache line size" if CUSTOM_CACHE_SETTINGS | ||
117 | range 0x10 0x20 | ||
118 | default "0x20" | ||
119 | help | ||
120 | Minimum possible data cache line size. | ||
121 | |||
122 | config NIOS2_ICACHE_SIZE | ||
123 | hex "I-Cache size" if CUSTOM_CACHE_SETTINGS | ||
124 | range 0x200 0x10000 | ||
125 | default "0x1000" | ||
126 | help | ||
127 | Maximum possible instruction cache size. | ||
128 | |||
129 | endmenu | ||
diff --git a/arch/nios2/platform/Makefile b/arch/nios2/platform/Makefile new file mode 100644 index 000000000000..46364f1d9352 --- /dev/null +++ b/arch/nios2/platform/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-y += platform.o | |||