Skip to content

Commit

Permalink
Merge tag 'cris-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jesper/cris

Pull arch/cris updates from Jesper Nilsson:
 "Some much needed love for the CRIS-port.

  There's a bunch of changes this time, giving the CRISv32 port a bit of
  modern makeover with device-tree, irq domain and gpiolib support, and
  more switchover to generic frameworks.

  Some small fixes and removal of the theoretical SMP support brings up
  the rear"

* tag 'cris-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris:
  cris: fix integer overflow in ELF_ET_DYN_BASE
  CRISv32: use GENERIC_SCHED_CLOCK
  CRISv32: use MMIO clocksource
  CRISv32: use generic clockevents
  CRIS: use generic headers via Kbuild
  CRIS: use generic cmpxchg.h
  CRIS: use generic atomic.h
  CRIS: use generic atomic bitops
  CRISv10: remove redundant macros from system.h
  CRIS: remove SMP code
  CRISv32: don't enable irqs in INIT_THREAD
  CRISv32: handle multiple signals
  CRISv32: prevent bogus restarts on sigreturn
  CRISv32: don't attempt syscall restart on irq exit
  Add binding documentation for CRIS
  CRIS: add Axis 88 board device tree
  CRISv32: add device tree support
  CRISv32: add irq domains support
  CRIS: enable GPIOLIB
  • Loading branch information
torvalds committed Apr 26, 2015
2 parents 63905bb + d939b52 commit 7f9f443
Show file tree
Hide file tree
Showing 50 changed files with 325 additions and 1,145 deletions.
9 changes: 9 additions & 0 deletions Documentation/devicetree/bindings/cris/axis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Axis Communications AB
ARTPEC series SoC Device Tree Bindings


CRISv32 based SoCs are ETRAX FS and ARTPEC-3:

- compatible = "axis,crisv32";


8 changes: 8 additions & 0 deletions Documentation/devicetree/bindings/cris/boards.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Boards based on the CRIS SoCs:

Required root node properties:
- compatible = should be one or more of the following:
- "axis,dev88" - for Axis devboard 88 with ETRAX FS

Optional:

23 changes: 23 additions & 0 deletions Documentation/devicetree/bindings/cris/interrupts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
* CRISv32 Interrupt Controller

Interrupt controller for the CRISv32 SoCs.

Main node required properties:

- compatible : should be:
"axis,crisv32-intc"
- interrupt-controller : Identifies the node as an interrupt controller
- #interrupt-cells : Specifies the number of cells needed to encode an
interrupt source. The type shall be a <u32> and the value shall be 1.
- reg: physical base address and size of the intc registers map.

Example:

intc: interrupt-controller {
compatible = "axis,crisv32-intc";
reg = <0xb001c000 0x1000>;
interrupt-controller;
#interrupt-cells = <1>;
};


12 changes: 11 additions & 1 deletion arch/cris/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ config CRIS
select ARCH_WANT_IPC_PARSE_VERSION
select GENERIC_IRQ_SHOW
select GENERIC_IOMAP
select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32
select GENERIC_CMOS_UPDATE
select MODULES_USE_ELF_RELA
select CLONE_BACKWARDS2
select OLD_SIGSUSPEND
select OLD_SIGACTION
select ARCH_REQUIRE_GPIOLIB
select IRQ_DOMAIN if ETRAX_ARCH_V32
select OF if ETRAX_ARCH_V32
select OF_EARLY_FLATTREE if ETRAX_ARCH_V32
select CLKSRC_MMIO if ETRAX_ARCH_V32
select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32
select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32

config HZ
int
Expand All @@ -61,6 +67,10 @@ config NR_CPUS
int
default "1"

config BUILTIN_DTB
string "DTB to build into the kernel image"
depends on OF

source "init/Kconfig"

source "kernel/Kconfig.freezer"
Expand Down
4 changes: 4 additions & 0 deletions arch/cris/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ else
MACH :=
endif

ifneq ($(CONFIG_BUILTIN_DTB),"")
core-$(CONFIG_OF) += arch/cris/boot/dts/
endif

LD = $(CROSS_COMPILE)ld -mcrislinux

OBJCOPYFLAGS := -O binary -R .note -R .comment -S
Expand Down
1 change: 0 additions & 1 deletion arch/cris/arch-v32/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ obj-y := entry.o traps.o irq.o debugport.o \
process.o ptrace.o setup.o signal.o traps.o time.o \
cache.o cacheflush.o

obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_ETRAX_KGDB) += kgdb.o kgdb_asm.o
obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o
obj-$(CONFIG_MODULES) += crisksyms.o
Expand Down
42 changes: 8 additions & 34 deletions arch/cris/arch-v32/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ ret_from_kernel_thread:

.type ret_from_intr,@function
ret_from_intr:
moveq 0, $r9 ; not a syscall

;; Check for resched if preemptive kernel, or if we're going back to
;; user-mode. This test matches the user_regs(regs) macro. Don't simply
;; test CCS since that doesn't necessarily reflect what mode we'll
Expand Down Expand Up @@ -145,7 +147,7 @@ system_call:
;; Stack-frame similar to the irq heads, which is reversed in
;; ret_from_sys_call.

sub.d 92, $sp ; Skip EXS and EDA.
sub.d 92, $sp ; Skip EDA.
movem $r13, [$sp]
move.d $sp, $r8
addq 14*4, $r8
Expand All @@ -156,8 +158,9 @@ system_call:
move $ccs, $r4
move $srp, $r5
move $erp, $r6
move.d $r9, $r7 ; Store syscall number in EXS
subq 4, $sp
movem $r6, [$r8]
movem $r7, [$r8]
ei ; Enable interrupts while processing syscalls.
move.d $r10, [$sp]

Expand Down Expand Up @@ -277,44 +280,15 @@ _syscall_exit_work:

.type _work_pending,@function
_work_pending:
addoq +TI_flags, $r0, $acr
move.d [$acr], $r10
btstq TIF_NEED_RESCHED, $r10 ; Need resched?
bpl _work_notifysig ; No, must be signal/notify.
nop
.size _work_pending, . - _work_pending

.type _work_resched,@function
_work_resched:
move.d $r9, $r1 ; Preserve R9.
jsr schedule
nop
move.d $r1, $r9
di

addoq +TI_flags, $r0, $acr
move.d [$acr], $r1
and.d _TIF_WORK_MASK, $r1 ; Ignore sycall trace counter.
beq _Rexit
nop
btstq TIF_NEED_RESCHED, $r1
bmi _work_resched ; current->work.need_resched.
nop
.size _work_resched, . - _work_resched

.type _work_notifysig,@function
_work_notifysig:
;; Deal with pending signals and notify-resume requests.

addoq +TI_flags, $r0, $acr
move.d [$acr], $r12 ; The thread_info_flags parameter.
move.d $sp, $r11 ; The regs param.
jsr do_notify_resume
move.d $r9, $r10 ; do_notify_resume syscall/irq param.
jsr do_work_pending
move.d $r9, $r10 ; The syscall/irq param.

ba _Rexit
nop
.size _work_notifysig, . - _work_notifysig
.size _work_pending, . - _work_pending

;; We get here as a sidetrack when we've entered a syscall with the
;; trace-bit set. We need to call do_syscall_trace and then continue
Expand Down
32 changes: 0 additions & 32 deletions arch/cris/arch-v32/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ tstart:

GIO_INIT

#ifdef CONFIG_SMP
secondary_cpu_entry: /* Entry point for secondary CPUs */
di
#endif

;; Setup and enable the MMU. Use same configuration for both the data
;; and the instruction MMU.
;;
Expand Down Expand Up @@ -164,33 +159,6 @@ secondary_cpu_entry: /* Entry point for secondary CPUs */
nop
nop

#ifdef CONFIG_SMP
;; Read CPU ID
move 0, $srs
nop
nop
nop
move $s12, $r0
cmpq 0, $r0
beq master_cpu
nop
slave_cpu:
; Time to boot-up. Get stack location provided by master CPU.
move.d smp_init_current_idle_thread, $r1
move.d [$r1], $sp
add.d 8192, $sp
move.d ebp_start, $r0 ; Defined in linker-script.
move $r0, $ebp
jsr smp_callin
nop
master_cpu:
/* Set up entry point for secondary CPUs. The boot ROM has set up
* EBP at start of internal memory. The CPU will get there
* later when we issue an IPI to them... */
move.d MEM_INTMEM_START + IPI_INTR_VECT * 4, $r0
move.d secondary_cpu_entry, $r1
move.d $r1, [$r0]
#endif
; Check if starting from DRAM (network->RAM boot or unpacked
; compressed kernel), or directly from flash.
lapcq ., $r0
Expand Down
31 changes: 25 additions & 6 deletions arch/cris/arch-v32/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/profile.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/threads.h>
Expand Down Expand Up @@ -56,9 +58,6 @@ struct cris_irq_allocation irq_allocations[NR_REAL_IRQS] =
static unsigned long irq_regs[NR_CPUS] =
{
regi_irq,
#ifdef CONFIG_SMP
regi_irq2,
#endif
};

#if NR_REAL_IRQS > 32
Expand Down Expand Up @@ -431,6 +430,19 @@ crisv32_do_multiple(struct pt_regs* regs)
irq_exit();
}

static int crisv32_irq_map(struct irq_domain *h, unsigned int virq,
irq_hw_number_t hw_irq_num)
{
irq_set_chip_and_handler(virq, &crisv32_irq_type, handle_simple_irq);

return 0;
}

static struct irq_domain_ops crisv32_irq_ops = {
.map = crisv32_irq_map,
.xlate = irq_domain_xlate_onecell,
};

/*
* This is called by start_kernel. It fixes the IRQ masks and setup the
* interrupt vector table to point to bad_interrupt pointers.
Expand All @@ -441,6 +453,8 @@ init_IRQ(void)
int i;
int j;
reg_intr_vect_rw_mask vect_mask = {0};
struct device_node *np;
struct irq_domain *domain;

/* Clear all interrupts masks. */
for (i = 0; i < NBR_REGS; i++)
Expand All @@ -449,10 +463,15 @@ init_IRQ(void)
for (i = 0; i < 256; i++)
etrax_irv->v[i] = weird_irq;

/* Point all IRQ's to bad handlers. */
np = of_find_compatible_node(NULL, NULL, "axis,crisv32-intc");
domain = irq_domain_add_legacy(np, NR_IRQS - FIRST_IRQ,
FIRST_IRQ, FIRST_IRQ,
&crisv32_irq_ops, NULL);
BUG_ON(!domain);
irq_set_default_host(domain);
of_node_put(np);

for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
irq_set_chip_and_handler(j, &crisv32_irq_type,
handle_simple_irq);
set_exception_vector(i, interrupt[j]);
}

Expand Down
5 changes: 0 additions & 5 deletions arch/cris/arch-v32/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ int show_cpuinfo(struct seq_file *m, void *v)

info = &cpinfo[ARRAY_SIZE(cpinfo) - 1];

#ifdef CONFIG_SMP
if (!cpu_online(cpu))
return 0;
#endif

revision = rdvr();

for (i = 0; i < ARRAY_SIZE(cpinfo); i++) {
Expand Down
5 changes: 5 additions & 0 deletions arch/cris/arch-v32/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
/* Make that the user-mode flag is set. */
regs->ccs |= (1 << (U_CCS_BITNR + CCS_SHIFT));

/* Don't perform syscall restarting */
regs->exs = -1;

/* Restore the old USP. */
err |= __get_user(old_usp, &sc->usp);
wrusp(old_usp);
Expand Down Expand Up @@ -425,6 +428,8 @@ do_signal(int canrestart, struct pt_regs *regs)
{
struct ksignal ksig;

canrestart = canrestart && ((int)regs->exs >= 0);

/*
* The common case should go fast, which is why this point is
* reached from kernel-mode. If that's the case, just return
Expand Down
Loading

0 comments on commit 7f9f443

Please sign in to comment.