Skip to content

Commit

Permalink
Merge tag 'nios2-v3.19-rc1' of git://git.rocketboards.org/linux-socfp…
Browse files Browse the repository at this point in the history
…ga-next

Pull Altera Nios II processor support from Ley Foon Tan:
 "Here is the Linux port for Nios II processor (from Altera) arch/nios2/
  tree for v3.19.

  The patchset has been discussed on the kernel mailing lists since
  April and has gone through 6 revisions of review.  The additional
  changes since then have been mostly further cleanups and fixes when
  merged with other trees.

  The arch code is in arch/nios2 and one asm-generic change (acked by
  Arnd)"

Arnd Bergmann says:
 "I've reviewed the architecture port in the past and it looks good in
  its latest version"

Acked-by: Arnd Bergmann <[email protected]>

* tag 'nios2-v3.19-rc1' of git://git.rocketboards.org/linux-socfpga-next: (40 commits)
  nios2: Make NIOS2_CMDLINE_IGNORE_DTB depend on CMDLINE_BOOL
  nios2: Add missing NR_CPUS to Kconfig
  nios2: asm-offsets: Remove unused definition TI_TASK
  nios2: Remove write-only struct member from nios2_timer
  nios2: Remove unused extern declaration of shm_align_mask
  nios2: include linux/type.h in io.h
  nios2: move include asm-generic/io.h to end of file
  nios2: remove include asm-generic/iomap.h from io.h
  nios2: remove unnecessary space before define
  nios2: fix error handling of irq_of_parse_and_map
  nios2: Use IS_ENABLED instead of #ifdefs to check config symbols
  nios2: Build infrastructure
  Documentation: Add documentation for Nios2 architecture
  MAINTAINERS: Add nios2 maintainer
  nios2: ptrace support
  nios2: Module support
  nios2: Nios2 registers
  nios2: Miscellaneous header files
  nios2: Cpuinfo handling
  nios2: Time keeping
  ...
  • Loading branch information
torvalds committed Dec 9, 2014
2 parents f3f62a3 + 2b2b407 commit a4a26e8
Show file tree
Hide file tree
Showing 100 changed files with 10,208 additions and 0 deletions.
62 changes: 62 additions & 0 deletions Documentation/devicetree/bindings/nios2/nios2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
* Nios II Processor Binding

This binding specifies what properties available in the device tree
representation of a Nios II Processor Core.

Users can use sopc2dts tool for generating device tree sources (dts) from a
Qsys system. See more detail in: http://www.alterawiki.com/wiki/Sopc2dts

Required properties:

- compatible: Compatible property value should be "altr,nios2-1.0".
- reg: Contains CPU index.
- interrupt-controller: Specifies that the node is an interrupt controller
- #interrupt-cells: Specifies the number of cells needed to encode an
interrupt source, should be 1.
- clock-frequency: Contains the clock frequency for CPU, in Hz.
- dcache-line-size: Contains data cache line size.
- icache-line-size: Contains instruction line size.
- dcache-size: Contains data cache size.
- icache-size: Contains instruction cache size.
- altr,pid-num-bits: Specifies the number of bits to use to represent the process
identifier (PID).
- altr,tlb-num-ways: Specifies the number of set-associativity ways in the TLB.
- altr,tlb-num-entries: Specifies the number of entries in the TLB.
- altr,tlb-ptr-sz: Specifies size of TLB pointer.
- altr,has-mul: Specifies CPU hardware multipy support, should be 1.
- altr,has-mmu: Specifies CPU support MMU support, should be 1.
- altr,has-initda: Specifies CPU support initda instruction, should be 1.
- altr,reset-addr: Specifies CPU reset address
- altr,fast-tlb-miss-addr: Specifies CPU fast TLB miss exception address
- altr,exception-addr: Specifies CPU exception address

Optional properties:
- altr,has-div: Specifies CPU hardware divide support
- altr,implementation: Nios II core implementation, this should be "fast";

Example:

cpu@0x0 {
device_type = "cpu";
compatible = "altr,nios2-1.0";
reg = <0>;
interrupt-controller;
#interrupt-cells = <1>;
clock-frequency = <125000000>;
dcache-line-size = <32>;
icache-line-size = <32>;
dcache-size = <32768>;
icache-size = <32768>;
altr,implementation = "fast";
altr,pid-num-bits = <8>;
altr,tlb-num-ways = <16>;
altr,tlb-num-entries = <128>;
altr,tlb-ptr-sz = <7>;
altr,has-div = <1>;
altr,has-mul = <1>;
altr,reset-addr = <0xc2800000>;
altr,fast-tlb-miss-addr = <0xc7fff400>;
altr,exception-addr = <0xd0000020>;
altr,has-initda = <1>;
altr,has-mmu = <1>;
};
19 changes: 19 additions & 0 deletions Documentation/devicetree/bindings/nios2/timer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Altera Timer

Required properties:

- compatible : should be "altr,timer-1.0"
- reg : Specifies base physical address and size of the registers.
- interrupt-parent: phandle of the interrupt controller
- interrupts : Should contain the timer interrupt number
- clock-frequency : The frequency of the clock that drives the counter, in Hz.

Example:

timer {
compatible = "altr,timer-1.0";
reg = <0x00400000 0x00000020>;
interrupt-parent = <&cpu>;
interrupts = <11>;
clock-frequency = <125000000>;
};
23 changes: 23 additions & 0 deletions Documentation/nios2/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Linux on the Nios II architecture
=================================

This is a port of Linux to Nios II (nios2) processor.

In order to compile for Nios II, you need a version of GCC with support for the generic
system call ABI. Please see this link for more information on how compiling and booting
software for the Nios II platform:
http://www.rocketboards.org/foswiki/Documentation/NiosIILinuxUserManual

For reference, please see the following link:
http://www.altera.com/literature/lit-nio2.jsp

What is Nios II?
================
Nios II is a 32-bit embedded-processor architecture designed specifically for the
Altera family of FPGAs. In order to support Linux, Nios II needs to be configured
with MMU and hardware multiplier enabled.

Nios II ABI
===========
Please refer to chapter "Application Binary Interface" in Nios II Processor Reference
Handbook.
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6562,6 +6562,13 @@ S: Maintained
F: Documentation/scsi/NinjaSCSI.txt
F: drivers/scsi/nsp32*

NIOS2 ARCHITECTURE
M: Ley Foon Tan <[email protected]>
L: [email protected] (moderated for non-subscribers)
T: git git://git.rocketboards.org/linux-socfpga.git
S: Maintained
F: arch/nios2/

NTB DRIVER
M: Jon Mason <[email protected]>
M: Dave Jiang <[email protected]>
Expand Down
206 changes: 206 additions & 0 deletions arch/nios2/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
config NIOS2
def_bool y
select ARCH_WANT_OPTIONAL_GPIOLIB
select CLKSRC_OF
select GENERIC_ATOMIC64
select GENERIC_CLOCKEVENTS
select GENERIC_CPU_DEVICES
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
select HAVE_ARCH_TRACEHOOK
select IRQ_DOMAIN
select MODULES_USE_ELF_RELA
select OF
select OF_EARLY_FLATTREE
select SOC_BUS
select SPARSE_IRQ
select USB_ARCH_HAS_HCD if USB_SUPPORT

config GENERIC_CSUM
def_bool y

config GENERIC_HWEIGHT
def_bool y

config GENERIC_CALIBRATE_DELAY
def_bool y

config NO_IOPORT_MAP
def_bool y

config HAS_DMA
def_bool y

config FPU
def_bool n

config SWAP
def_bool n

config RWSEM_GENERIC_SPINLOCK
def_bool y

config TRACE_IRQFLAGS_SUPPORT
def_bool n

source "init/Kconfig"

menu "Kernel features"

source "kernel/Kconfig.preempt"

source "kernel/Kconfig.freezer"

source "kernel/Kconfig.hz"

source "mm/Kconfig"

config FORCE_MAX_ZONEORDER
int "Maximum zone order"
range 9 20
default "11"
help
The kernel memory allocator divides physically contiguous memory
blocks into "zones", where each zone is a power of two number of
pages. This option selects the largest power of two that the kernel
keeps in the memory allocator. If you need to allocate very large
blocks of physically contiguous memory, then you may need to
increase this value.

This config option is actually maximum order plus one. For example,
a value of 11 means that the largest free memory block is 2^10 pages.

endmenu

source "arch/nios2/platform/Kconfig.platform"

menu "Processor type and features"

config MMU
def_bool y

config NR_CPUS
int
default "1"

config NIOS2_ALIGNMENT_TRAP
bool "Catch alignment trap"
default y
help
Nios II CPUs cannot fetch/store data which is not bus aligned,
i.e., a 2 or 4 byte fetch must start at an address divisible by
2 or 4. Any non-aligned load/store instructions will be trapped and
emulated in software if you say Y here, which has a performance
impact.

comment "Boot options"

config CMDLINE_BOOL
bool "Default bootloader kernel arguments"
default y

config CMDLINE
string "Default kernel command string"
default ""
depends on CMDLINE_BOOL
help
On some platforms, there is currently no way for the boot loader to
pass arguments to the kernel. For these platforms, you can supply
some command-line options at build time by entering them here. In
other cases you can specify kernel args so that you don't have
to set them up in board prom initialization routines.

config CMDLINE_FORCE
bool "Force default kernel command string"
depends on CMDLINE_BOOL
help
Set this to have arguments from the default kernel command string
override those passed by the boot loader.

config NIOS2_CMDLINE_IGNORE_DTB
bool "Ignore kernel command string from DTB"
depends on CMDLINE_BOOL
depends on !CMDLINE_FORCE
default y
help
Set this to ignore the bootargs property from the devicetree's
chosen node and fall back to CMDLINE if nothing is passed.

config NIOS2_PASS_CMDLINE
bool "Passed kernel command line from u-boot"
default n
help
Use bootargs env variable from u-boot for kernel command line.
will override "Default kernel command string".
Say N if you are unsure.

endmenu

menu "Advanced setup"

config ADVANCED_OPTIONS
bool "Prompt for advanced kernel configuration options"
help

comment "Default settings for advanced configuration options are used"
depends on !ADVANCED_OPTIONS

config NIOS2_KERNEL_MMU_REGION_BASE_BOOL
bool "Set custom kernel MMU region base address"
depends on ADVANCED_OPTIONS
help
This option allows you to set the virtual address of the kernel MMU region.

Say N here unless you know what you are doing.

config NIOS2_KERNEL_MMU_REGION_BASE
hex "Virtual base address of the kernel MMU region " if NIOS2_KERNEL_MMU_REGION_BASE_BOOL
default "0x80000000"
help
This option allows you to set the virtual base address of the kernel MMU region.

config NIOS2_KERNEL_REGION_BASE_BOOL
bool "Set custom kernel region base address"
depends on ADVANCED_OPTIONS
help
This option allows you to set the virtual address of the kernel region.

Say N here unless you know what you are doing.

config NIOS2_KERNEL_REGION_BASE
hex "Virtual base address of the kernel region " if NIOS2_KERNEL_REGION_BASE_BOOL
default "0xc0000000"

config NIOS2_IO_REGION_BASE_BOOL
bool "Set custom I/O region base address"
depends on ADVANCED_OPTIONS
help
This option allows you to set the virtual address of the I/O region.

Say N here unless you know what you are doing.

config NIOS2_IO_REGION_BASE
hex "Virtual base address of the I/O region" if NIOS2_IO_REGION_BASE_BOOL
default "0xe0000000"

endmenu

menu "Executable file formats"

source "fs/Kconfig.binfmt"

endmenu

source "net/Kconfig"

source "drivers/Kconfig"

source "fs/Kconfig"

source "arch/nios2/Kconfig.debug"

source "security/Kconfig"

source "crypto/Kconfig"

source "lib/Kconfig"
17 changes: 17 additions & 0 deletions arch/nios2/Kconfig.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
menu "Kernel hacking"

config TRACE_IRQFLAGS_SUPPORT
def_bool y

source "lib/Kconfig.debug"

config DEBUG_STACK_USAGE
bool "Enable stack utilization instrumentation"
depends on DEBUG_KERNEL
help
Enables the display of the minimum amount of free stack which each
task has ever had available in the sysrq-T and sysrq-P debug output.

This option will slow down process creation somewhat.

endmenu
Loading

0 comments on commit a4a26e8

Please sign in to comment.