aboutsummaryrefslogtreecommitdiffstats
path: root/arch/openrisc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/openrisc')
-rw-r--r--arch/openrisc/Kconfig207
-rw-r--r--arch/openrisc/Makefile55
-rw-r--r--arch/openrisc/boot/Makefile15
-rw-r--r--arch/openrisc/configs/or1ksim_defconfig65
-rw-r--r--arch/openrisc/include/asm/Kbuild64
-rw-r--r--arch/openrisc/kernel/Makefile14
-rw-r--r--arch/openrisc/kernel/vmlinux.lds.S115
-rw-r--r--arch/openrisc/lib/Makefile5
-rw-r--r--arch/openrisc/mm/Makefile5
9 files changed, 545 insertions, 0 deletions
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
new file mode 100644
index 000000000000..4558bafbd1a2
--- /dev/null
+++ b/arch/openrisc/Kconfig
@@ -0,0 +1,207 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/config-language.txt.
4#
5
6config OPENRISC
7 def_bool y
8 select OF
9 select OF_EARLY_FLATTREE
10 select HAVE_MEMBLOCK
11 select ARCH_WANT_OPTIONAL_GPIOLIB
12 select HAVE_ARCH_TRACEHOOK
13 select HAVE_GENERIC_HARDIRQS
14 select GENERIC_IRQ_CHIP
15 select GENERIC_IRQ_PROBE
16 select GENERIC_IRQ_SHOW
17 select GENERIC_IOMAP
18
19config MMU
20 def_bool y
21
22config WISHBONE_BUS_BIG_ENDIAN
23 def_bool y
24
25config SYMBOL_PREFIX
26 string
27 default ""
28
29config HAVE_DMA_ATTRS
30 def_bool y
31
32config UID16
33 def_bool y
34
35config RWSEM_GENERIC_SPINLOCK
36 def_bool y
37
38config RWSEM_XCHGADD_ALGORITHM
39 def_bool n
40
41config GENERIC_HWEIGHT
42 def_bool y
43
44config GENERIC_IOMAP
45 def_bool y
46
47config NO_IOPORT
48 def_bool y
49
50config GENERIC_GPIO
51 def_bool y
52
53config GENERIC_CLOCKEVENTS
54 def_bool y
55
56config TRACE_IRQFLAGS_SUPPORT
57 def_bool y
58
59# For now, use generic checksum functions
60#These can be reimplemented in assembly later if so inclined
61config GENERIC_CSUM
62 def_bool y
63
64config GENERIC_FIND_NEXT_BIT
65 def_bool y
66
67source "init/Kconfig"
68
69
70menu "Processor type and features"
71
72choice
73 prompt "Subarchitecture"
74 default OR1K_1200
75
76config OR1K_1200
77 bool "OR1200"
78 help
79 Generic OpenRISC 1200 architecture
80
81endchoice
82
83config OPENRISC_BUILTIN_DTB
84 string "Builtin DTB"
85 default ""
86
87menu "Class II Instructions"
88
89config OPENRISC_HAVE_INST_FF1
90 bool "Have instruction l.ff1"
91 default y
92 help
93 Select this if your implementation has the Class II instruction l.ff1
94
95config OPENRISC_HAVE_INST_FL1
96 bool "Have instruction l.fl1"
97 default y
98 help
99 Select this if your implementation has the Class II instruction l.fl1
100
101config OPENRISC_HAVE_INST_MUL
102 bool "Have instruction l.mul for hardware multiply"
103 default y
104 help
105 Select this if your implementation has a hardware multiply instruction
106
107config OPENRISC_HAVE_INST_DIV
108 bool "Have instruction l.div for hardware divide"
109 default y
110 help
111 Select this if your implementation has a hardware divide instruction
112endmenu
113
114
115source "kernel/time/Kconfig"
116source kernel/Kconfig.hz
117source kernel/Kconfig.preempt
118source "mm/Kconfig"
119
120config OPENRISC_NO_SPR_SR_DSX
121 bool "use SPR_SR_DSX software emulation" if OR1K_1200
122 default y
123 help
124 SPR_SR_DSX bit is status register bit indicating whether
125 the last exception has happened in delay slot.
126
127 OpenRISC architecture makes it optional to have it implemented
128 in hardware and the OR1200 does not have it.
129
130 Say N here if you know that your OpenRISC processor has
131 SPR_SR_DSX bit implemented. Say Y if you are unsure.
132
133config CMDLINE
134 string "Default kernel command string"
135 default ""
136 help
137 On some architectures there is currently no way for the boot loader
138 to pass arguments to the kernel. For these architectures, you should
139 supply some command-line options at build time by entering them
140 here.
141
142menu "Debugging options"
143
144config DEBUG_STACKOVERFLOW
145 bool "Check for kernel stack overflow"
146 default y
147 help
148 Make extra checks for space avaliable on stack in some
149 critical functions. This will cause kernel to run a bit slower,
150 but will catch most of kernel stack overruns and exit gracefuly.
151
152 Say Y if you are unsure.
153
154config JUMP_UPON_UNHANDLED_EXCEPTION
155 bool "Try to die gracefully"
156 default y
157 help
158 Now this puts kernel into infinite loop after first oops. Till
159 your kernel crashes this doesn't have any influence.
160
161 Say Y if you are unsure.
162
163config OPENRISC_EXCEPTION_DEBUG
164 bool "Print processor state at each exception"
165 default n
166 help
167 This option will make your kernel unusable for all but kernel
168 debugging.
169
170 Say N if you are unsure.
171
172config OPENRISC_ESR_EXCEPTION_BUG_CHECK
173 bool "Check for possible ESR exception bug"
174 default n
175 help
176 This option enables some checks that might expose some problems
177 in kernel.
178
179 Say N if you are unsure.
180
181endmenu
182
183endmenu
184
185menu "Executable file formats"
186
187source "fs/Kconfig.binfmt"
188
189endmenu
190
191source "net/Kconfig"
192
193source "drivers/Kconfig"
194
195source "fs/Kconfig"
196
197source "security/Kconfig"
198
199source "crypto/Kconfig"
200
201source "lib/Kconfig"
202
203menu "Kernel hacking"
204
205source "lib/Kconfig.debug"
206
207endmenu
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
new file mode 100644
index 000000000000..158ae4c0dc6c
--- /dev/null
+++ b/arch/openrisc/Makefile
@@ -0,0 +1,55 @@
1# BK Id: %F% %I% %G% %U% %#%
2#
3# This file is included by the global makefile so that you can add your own
4# architecture-specific flags and dependencies. Remember to do have actions
5# for "archclean" and "archdep" for cleaning up and making dependencies for
6# 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# Modifications for the OpenRISC architecture:
14# Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
15# Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
16#
17# Based on:
18# arch/i386/Makefile
19
20KBUILD_DEFCONFIG := or1ksim_defconfig
21
22LDFLAGS :=
23OBJCOPYFLAGS := -O binary -R .note -R .comment -S
24LDFLAGS_vmlinux :=
25LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
26
27KBUILD_CFLAGS += -pipe -ffixed-r10
28
29ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y)
30 KBUILD_CFLAGS += $(call cc-option,-mhard-mul)
31else
32 KBUILD_CFLAGS += $(call cc-option,-msoft-mul)
33endif
34
35ifeq ($(CONFIG_OPENRISC_HAVE_INST_DIV),y)
36 KBUILD_CFLAGS += $(call cc-option,-mhard-div)
37else
38 KBUILD_CFLAGS += $(call cc-option,-msoft-div)
39endif
40
41head-y := arch/openrisc/kernel/head.o arch/openrisc/kernel/init_task.o
42
43core-y += arch/openrisc/lib/ \
44 arch/openrisc/kernel/ \
45 arch/openrisc/mm/
46libs-y += $(LIBGCC)
47
48ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""'
49BUILTIN_DTB := y
50else
51BUILTIN_DTB := n
52endif
53core-$(BUILTIN_DTB) += arch/openrisc/boot/
54
55all: vmlinux
diff --git a/arch/openrisc/boot/Makefile b/arch/openrisc/boot/Makefile
new file mode 100644
index 000000000000..98ca185097a5
--- /dev/null
+++ b/arch/openrisc/boot/Makefile
@@ -0,0 +1,15 @@
1
2
3ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""'
4BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o
5else
6BUILTIN_DTB :=
7endif
8obj-y += $(BUILTIN_DTB)
9
10clean-files := *.dtb.S
11
12#DTC_FLAGS ?= -p 1024
13
14$(obj)/%.dtb: $(src)/dts/%.dts
15 $(call cmd,dtc)
diff --git a/arch/openrisc/configs/or1ksim_defconfig b/arch/openrisc/configs/or1ksim_defconfig
new file mode 100644
index 000000000000..ea172bdfa36a
--- /dev/null
+++ b/arch/openrisc/configs/or1ksim_defconfig
@@ -0,0 +1,65 @@
1CONFIG_CROSS_COMPILE="or32-linux-"
2CONFIG_LOG_BUF_SHIFT=14
3CONFIG_BLK_DEV_INITRD=y
4# CONFIG_RD_GZIP is not set
5CONFIG_EXPERT=y
6# CONFIG_SYSCTL_SYSCALL is not set
7# CONFIG_KALLSYMS is not set
8# CONFIG_EPOLL is not set
9# CONFIG_TIMERFD is not set
10# CONFIG_EVENTFD is not set
11# CONFIG_AIO is not set
12# CONFIG_VM_EVENT_COUNTERS is not set
13# CONFIG_COMPAT_BRK is not set
14CONFIG_SLOB=y
15CONFIG_MODULES=y
16# CONFIG_BLOCK is not set
17CONFIG_OPENRISC_BUILTIN_DTB="or1ksim"
18CONFIG_NO_HZ=y
19CONFIG_HZ_100=y
20CONFIG_NET=y
21CONFIG_PACKET=y
22CONFIG_UNIX=y
23CONFIG_INET=y
24# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
25# CONFIG_INET_XFRM_MODE_TUNNEL is not set
26# CONFIG_INET_XFRM_MODE_BEET is not set
27# CONFIG_INET_LRO is not set
28# CONFIG_INET_DIAG is not set
29CONFIG_TCP_CONG_ADVANCED=y
30# CONFIG_TCP_CONG_BIC is not set
31# CONFIG_TCP_CONG_CUBIC is not set
32# CONFIG_TCP_CONG_WESTWOOD is not set
33# CONFIG_TCP_CONG_HTCP is not set
34# CONFIG_IPV6 is not set
35# CONFIG_WIRELESS is not set
36CONFIG_DEVTMPFS=y
37CONFIG_DEVTMPFS_MOUNT=y
38# CONFIG_PREVENT_FIRMWARE_BUILD is not set
39# CONFIG_FW_LOADER is not set
40CONFIG_PROC_DEVICETREE=y
41CONFIG_NETDEVICES=y
42CONFIG_MICREL_PHY=y
43CONFIG_NET_ETHERNET=y
44CONFIG_ETHOC=y
45# CONFIG_NETDEV_1000 is not set
46# CONFIG_NETDEV_10000 is not set
47# CONFIG_WLAN is not set
48# CONFIG_INPUT is not set
49# CONFIG_SERIO is not set
50# CONFIG_VT is not set
51# CONFIG_LEGACY_PTYS is not set
52# CONFIG_DEVKMEM is not set
53CONFIG_SERIAL_8250=y
54CONFIG_SERIAL_8250_CONSOLE=y
55CONFIG_SERIAL_OF_PLATFORM=y
56# CONFIG_HW_RANDOM is not set
57# CONFIG_HWMON is not set
58# CONFIG_MFD_SUPPORT is not set
59# CONFIG_USB_SUPPORT is not set
60# CONFIG_DNOTIFY is not set
61CONFIG_TMPFS=y
62CONFIG_NFS_FS=y
63CONFIG_NFS_V3=y
64# CONFIG_ENABLE_WARN_DEPRECATED is not set
65# CONFIG_ENABLE_MUST_CHECK is not set
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
new file mode 100644
index 000000000000..11162e6c878f
--- /dev/null
+++ b/arch/openrisc/include/asm/Kbuild
@@ -0,0 +1,64 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += spr_defs.h
4
5generic-y += atomic.h
6generic-y += auxvec.h
7generic-y += bitsperlong.h
8generic-y += bug.h
9generic-y += bugs.h
10generic-y += cacheflush.h
11generic-y += checksum.h
12generic-y += cmpxchg.h
13generic-y += cmpxchg-local.h
14generic-y += cpumask.h
15generic-y += cputime.h
16generic-y += current.h
17generic-y += device.h
18generic-y += div64.h
19generic-y += dma.h
20generic-y += emergency-restart.h
21generic-y += errno.h
22generic-y += fb.h
23generic-y += fcntl.h
24generic-y += ftrace.h
25generic-y += futex.h
26generic-y += hardirq.h
27generic-y += hw_irq.h
28generic-y += ioctl.h
29generic-y += ioctls.h
30generic-y += ipcbuf.h
31generic-y += irq_regs.h
32generic-y += kdebug.h
33generic-y += kmap_types.h
34generic-y += local.h
35generic-y += mman.h
36generic-y += module.h
37generic-y += msgbuf.h
38generic-y += pci.h
39generic-y += percpu.h
40generic-y += poll.h
41generic-y += posix_types.h
42generic-y += resource.h
43generic-y += rmap.h
44generic-y += scatterlist.h
45generic-y += sections.h
46generic-y += segment.h
47generic-y += sembuf.h
48generic-y += setup.h
49generic-y += shmbuf.h
50generic-y += shmparam.h
51generic-y += siginfo.h
52generic-y += signal.h
53generic-y += socket.h
54generic-y += sockios.h
55generic-y += statfs.h
56generic-y += stat.h
57generic-y += string.h
58generic-y += swab.h
59generic-y += termbits.h
60generic-y += termios.h
61generic-y += topology.h
62generic-y += types.h
63generic-y += ucontext.h
64generic-y += user.h
diff --git a/arch/openrisc/kernel/Makefile b/arch/openrisc/kernel/Makefile
new file mode 100644
index 000000000000..9a4c2706d795
--- /dev/null
+++ b/arch/openrisc/kernel/Makefile
@@ -0,0 +1,14 @@
1#
2# Makefile for the linux kernel.
3#
4
5extra-y := head.o vmlinux.lds init_task.o
6
7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \
8 traps.o time.o irq.o entry.o ptrace.o signal.o sys_or32.o \
9 sys_call_table.o
10
11obj-$(CONFIG_MODULES) += module.o
12obj-$(CONFIG_OF) += prom.o
13
14clean:
diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S
new file mode 100644
index 000000000000..2d69a853b742
--- /dev/null
+++ b/arch/openrisc/kernel/vmlinux.lds.S
@@ -0,0 +1,115 @@
1/*
2 * OpenRISC vmlinux.lds.S
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * Modifications for the OpenRISC architecture:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 *
17 * ld script for OpenRISC architecture
18 */
19
20/* TODO
21 * - clean up __offset & stuff
22 * - change all 8192 aligment to PAGE !!!
23 * - recheck if all aligments are really needed
24 */
25
26# define LOAD_OFFSET PAGE_OFFSET
27# define LOAD_BASE PAGE_OFFSET
28
29#include <asm/page.h>
30#include <asm/cache.h>
31#include <asm-generic/vmlinux.lds.h>
32
33OUTPUT_FORMAT("elf32-or32", "elf32-or32", "elf32-or32")
34jiffies = jiffies_64 + 4;
35
36SECTIONS
37{
38 /* Read-only sections, merged into text segment: */
39 . = LOAD_BASE ;
40
41 /* _s_kernel_ro must be page aligned */
42 . = ALIGN(PAGE_SIZE);
43 _s_kernel_ro = .;
44
45 .text : AT(ADDR(.text) - LOAD_OFFSET)
46 {
47 _stext = .;
48 TEXT_TEXT
49 SCHED_TEXT
50 LOCK_TEXT
51 KPROBES_TEXT
52 IRQENTRY_TEXT
53 *(.fixup)
54 *(.text.__*)
55 _etext = .;
56 }
57 /* TODO: Check if fixup and text.__* are really necessary
58 * fixup is definitely necessary
59 */
60
61 _sdata = .;
62
63 /* Page alignment required for RO_DATA_SECTION */
64 RO_DATA_SECTION(PAGE_SIZE)
65 _e_kernel_ro = .;
66
67 /* Whatever comes after _e_kernel_ro had better be page-aligend, too */
68
69 /* 32 here is cacheline size... recheck this */
70 RW_DATA_SECTION(32, PAGE_SIZE, PAGE_SIZE)
71
72 _edata = .;
73
74 EXCEPTION_TABLE(4)
75 NOTES
76
77 /* Init code and data */
78 . = ALIGN(PAGE_SIZE);
79 __init_begin = .;
80
81 HEAD_TEXT_SECTION
82
83 /* Page aligned */
84 INIT_TEXT_SECTION(PAGE_SIZE)
85
86 /* Align __setup_start on 16 byte boundary */
87 INIT_DATA_SECTION(16)
88
89 PERCPU_SECTION(L1_CACHE_BYTES)
90
91 __init_end = .;
92
93 . = ALIGN(PAGE_SIZE);
94 .initrd : AT(ADDR(.initrd) - LOAD_OFFSET)
95 {
96 __initrd_start = .;
97 *(.initrd)
98 __initrd_end = .;
99 FILL (0);
100 . = ALIGN (PAGE_SIZE);
101 }
102
103 __vmlinux_end = .; /* last address of the physical file */
104
105 BSS_SECTION(0, 0, 0x20)
106
107 _end = .;
108
109 /* Throw in the debugging sections */
110 STABS_DEBUG
111 DWARF_DEBUG
112
113 /* Sections to be discarded -- must be last */
114 DISCARDS
115}
diff --git a/arch/openrisc/lib/Makefile b/arch/openrisc/lib/Makefile
new file mode 100644
index 000000000000..966f65dbc6f0
--- /dev/null
+++ b/arch/openrisc/lib/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for or32 specific library files..
3#
4
5obj-y = string.o delay.o
diff --git a/arch/openrisc/mm/Makefile b/arch/openrisc/mm/Makefile
new file mode 100644
index 000000000000..324ba2634529
--- /dev/null
+++ b/arch/openrisc/mm/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for the linux openrisc-specific parts of the memory manager.
3#
4
5obj-y := fault.o tlb.o init.o ioremap.o