Skip to content

Commit 7f9f443

Browse files
committed
Merge tag 'cris-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/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
2 parents 63905bb + d939b52 commit 7f9f443

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+325
-1145
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Axis Communications AB
2+
ARTPEC series SoC Device Tree Bindings
3+
4+
5+
CRISv32 based SoCs are ETRAX FS and ARTPEC-3:
6+
7+
- compatible = "axis,crisv32";
8+
9+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Boards based on the CRIS SoCs:
2+
3+
Required root node properties:
4+
- compatible = should be one or more of the following:
5+
- "axis,dev88" - for Axis devboard 88 with ETRAX FS
6+
7+
Optional:
8+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
* CRISv32 Interrupt Controller
2+
3+
Interrupt controller for the CRISv32 SoCs.
4+
5+
Main node required properties:
6+
7+
- compatible : should be:
8+
"axis,crisv32-intc"
9+
- interrupt-controller : Identifies the node as an interrupt controller
10+
- #interrupt-cells : Specifies the number of cells needed to encode an
11+
interrupt source. The type shall be a <u32> and the value shall be 1.
12+
- reg: physical base address and size of the intc registers map.
13+
14+
Example:
15+
16+
intc: interrupt-controller {
17+
compatible = "axis,crisv32-intc";
18+
reg = <0xb001c000 0x1000>;
19+
interrupt-controller;
20+
#interrupt-cells = <1>;
21+
};
22+
23+

arch/cris/Kconfig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ config CRIS
4646
select ARCH_WANT_IPC_PARSE_VERSION
4747
select GENERIC_IRQ_SHOW
4848
select GENERIC_IOMAP
49-
select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32
5049
select GENERIC_CMOS_UPDATE
5150
select MODULES_USE_ELF_RELA
5251
select CLONE_BACKWARDS2
5352
select OLD_SIGSUSPEND
5453
select OLD_SIGACTION
54+
select ARCH_REQUIRE_GPIOLIB
55+
select IRQ_DOMAIN if ETRAX_ARCH_V32
56+
select OF if ETRAX_ARCH_V32
57+
select OF_EARLY_FLATTREE if ETRAX_ARCH_V32
58+
select CLKSRC_MMIO if ETRAX_ARCH_V32
59+
select GENERIC_CLOCKEVENTS if ETRAX_ARCH_V32
60+
select GENERIC_SCHED_CLOCK if ETRAX_ARCH_V32
5561

5662
config HZ
5763
int
@@ -61,6 +67,10 @@ config NR_CPUS
6167
int
6268
default "1"
6369

70+
config BUILTIN_DTB
71+
string "DTB to build into the kernel image"
72+
depends on OF
73+
6474
source "init/Kconfig"
6575

6676
source "kernel/Kconfig.freezer"

arch/cris/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ else
4040
MACH :=
4141
endif
4242

43+
ifneq ($(CONFIG_BUILTIN_DTB),"")
44+
core-$(CONFIG_OF) += arch/cris/boot/dts/
45+
endif
46+
4347
LD = $(CROSS_COMPILE)ld -mcrislinux
4448

4549
OBJCOPYFLAGS := -O binary -R .note -R .comment -S

arch/cris/arch-v32/kernel/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ obj-y := entry.o traps.o irq.o debugport.o \
99
process.o ptrace.o setup.o signal.o traps.o time.o \
1010
cache.o cacheflush.o
1111

12-
obj-$(CONFIG_SMP) += smp.o
1312
obj-$(CONFIG_ETRAX_KGDB) += kgdb.o kgdb_asm.o
1413
obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o
1514
obj-$(CONFIG_MODULES) += crisksyms.o

arch/cris/arch-v32/kernel/entry.S

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ ret_from_kernel_thread:
9999

100100
.type ret_from_intr,@function
101101
ret_from_intr:
102+
moveq 0, $r9 ; not a syscall
103+
102104
;; Check for resched if preemptive kernel, or if we're going back to
103105
;; user-mode. This test matches the user_regs(regs) macro. Don't simply
104106
;; test CCS since that doesn't necessarily reflect what mode we'll
@@ -145,7 +147,7 @@ system_call:
145147
;; Stack-frame similar to the irq heads, which is reversed in
146148
;; ret_from_sys_call.
147149

148-
sub.d 92, $sp ; Skip EXS and EDA.
150+
sub.d 92, $sp ; Skip EDA.
149151
movem $r13, [$sp]
150152
move.d $sp, $r8
151153
addq 14*4, $r8
@@ -156,8 +158,9 @@ system_call:
156158
move $ccs, $r4
157159
move $srp, $r5
158160
move $erp, $r6
161+
move.d $r9, $r7 ; Store syscall number in EXS
159162
subq 4, $sp
160-
movem $r6, [$r8]
163+
movem $r7, [$r8]
161164
ei ; Enable interrupts while processing syscalls.
162165
move.d $r10, [$sp]
163166

@@ -277,44 +280,15 @@ _syscall_exit_work:
277280

278281
.type _work_pending,@function
279282
_work_pending:
280-
addoq +TI_flags, $r0, $acr
281-
move.d [$acr], $r10
282-
btstq TIF_NEED_RESCHED, $r10 ; Need resched?
283-
bpl _work_notifysig ; No, must be signal/notify.
284-
nop
285-
.size _work_pending, . - _work_pending
286-
287-
.type _work_resched,@function
288-
_work_resched:
289-
move.d $r9, $r1 ; Preserve R9.
290-
jsr schedule
291-
nop
292-
move.d $r1, $r9
293-
di
294-
295-
addoq +TI_flags, $r0, $acr
296-
move.d [$acr], $r1
297-
and.d _TIF_WORK_MASK, $r1 ; Ignore sycall trace counter.
298-
beq _Rexit
299-
nop
300-
btstq TIF_NEED_RESCHED, $r1
301-
bmi _work_resched ; current->work.need_resched.
302-
nop
303-
.size _work_resched, . - _work_resched
304-
305-
.type _work_notifysig,@function
306-
_work_notifysig:
307-
;; Deal with pending signals and notify-resume requests.
308-
309283
addoq +TI_flags, $r0, $acr
310284
move.d [$acr], $r12 ; The thread_info_flags parameter.
311285
move.d $sp, $r11 ; The regs param.
312-
jsr do_notify_resume
313-
move.d $r9, $r10 ; do_notify_resume syscall/irq param.
286+
jsr do_work_pending
287+
move.d $r9, $r10 ; The syscall/irq param.
314288

315289
ba _Rexit
316290
nop
317-
.size _work_notifysig, . - _work_notifysig
291+
.size _work_pending, . - _work_pending
318292

319293
;; We get here as a sidetrack when we've entered a syscall with the
320294
;; trace-bit set. We need to call do_syscall_trace and then continue

arch/cris/arch-v32/kernel/head.S

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ tstart:
5252

5353
GIO_INIT
5454

55-
#ifdef CONFIG_SMP
56-
secondary_cpu_entry: /* Entry point for secondary CPUs */
57-
di
58-
#endif
59-
6055
;; Setup and enable the MMU. Use same configuration for both the data
6156
;; and the instruction MMU.
6257
;;
@@ -164,33 +159,6 @@ secondary_cpu_entry: /* Entry point for secondary CPUs */
164159
nop
165160
nop
166161

167-
#ifdef CONFIG_SMP
168-
;; Read CPU ID
169-
move 0, $srs
170-
nop
171-
nop
172-
nop
173-
move $s12, $r0
174-
cmpq 0, $r0
175-
beq master_cpu
176-
nop
177-
slave_cpu:
178-
; Time to boot-up. Get stack location provided by master CPU.
179-
move.d smp_init_current_idle_thread, $r1
180-
move.d [$r1], $sp
181-
add.d 8192, $sp
182-
move.d ebp_start, $r0 ; Defined in linker-script.
183-
move $r0, $ebp
184-
jsr smp_callin
185-
nop
186-
master_cpu:
187-
/* Set up entry point for secondary CPUs. The boot ROM has set up
188-
* EBP at start of internal memory. The CPU will get there
189-
* later when we issue an IPI to them... */
190-
move.d MEM_INTMEM_START + IPI_INTR_VECT * 4, $r0
191-
move.d secondary_cpu_entry, $r1
192-
move.d $r1, [$r0]
193-
#endif
194162
; Check if starting from DRAM (network->RAM boot or unpacked
195163
; compressed kernel), or directly from flash.
196164
lapcq ., $r0

arch/cris/arch-v32/kernel/irq.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <linux/errno.h>
1111
#include <linux/init.h>
1212
#include <linux/profile.h>
13+
#include <linux/of.h>
14+
#include <linux/of_irq.h>
1315
#include <linux/proc_fs.h>
1416
#include <linux/seq_file.h>
1517
#include <linux/threads.h>
@@ -56,9 +58,6 @@ struct cris_irq_allocation irq_allocations[NR_REAL_IRQS] =
5658
static unsigned long irq_regs[NR_CPUS] =
5759
{
5860
regi_irq,
59-
#ifdef CONFIG_SMP
60-
regi_irq2,
61-
#endif
6261
};
6362

6463
#if NR_REAL_IRQS > 32
@@ -431,6 +430,19 @@ crisv32_do_multiple(struct pt_regs* regs)
431430
irq_exit();
432431
}
433432

433+
static int crisv32_irq_map(struct irq_domain *h, unsigned int virq,
434+
irq_hw_number_t hw_irq_num)
435+
{
436+
irq_set_chip_and_handler(virq, &crisv32_irq_type, handle_simple_irq);
437+
438+
return 0;
439+
}
440+
441+
static struct irq_domain_ops crisv32_irq_ops = {
442+
.map = crisv32_irq_map,
443+
.xlate = irq_domain_xlate_onecell,
444+
};
445+
434446
/*
435447
* This is called by start_kernel. It fixes the IRQ masks and setup the
436448
* interrupt vector table to point to bad_interrupt pointers.
@@ -441,6 +453,8 @@ init_IRQ(void)
441453
int i;
442454
int j;
443455
reg_intr_vect_rw_mask vect_mask = {0};
456+
struct device_node *np;
457+
struct irq_domain *domain;
444458

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

452-
/* Point all IRQ's to bad handlers. */
466+
np = of_find_compatible_node(NULL, NULL, "axis,crisv32-intc");
467+
domain = irq_domain_add_legacy(np, NR_IRQS - FIRST_IRQ,
468+
FIRST_IRQ, FIRST_IRQ,
469+
&crisv32_irq_ops, NULL);
470+
BUG_ON(!domain);
471+
irq_set_default_host(domain);
472+
of_node_put(np);
473+
453474
for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
454-
irq_set_chip_and_handler(j, &crisv32_irq_type,
455-
handle_simple_irq);
456475
set_exception_vector(i, interrupt[j]);
457476
}
458477

arch/cris/arch-v32/kernel/setup.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ int show_cpuinfo(struct seq_file *m, void *v)
6363

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

66-
#ifdef CONFIG_SMP
67-
if (!cpu_online(cpu))
68-
return 0;
69-
#endif
70-
7166
revision = rdvr();
7267

7368
for (i = 0; i < ARRAY_SIZE(cpinfo); i++) {

arch/cris/arch-v32/kernel/signal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
7272
/* Make that the user-mode flag is set. */
7373
regs->ccs |= (1 << (U_CCS_BITNR + CCS_SHIFT));
7474

75+
/* Don't perform syscall restarting */
76+
regs->exs = -1;
77+
7578
/* Restore the old USP. */
7679
err |= __get_user(old_usp, &sc->usp);
7780
wrusp(old_usp);
@@ -425,6 +428,8 @@ do_signal(int canrestart, struct pt_regs *regs)
425428
{
426429
struct ksignal ksig;
427430

431+
canrestart = canrestart && ((int)regs->exs >= 0);
432+
428433
/*
429434
* The common case should go fast, which is why this point is
430435
* reached from kernel-mode. If that's the case, just return

0 commit comments

Comments
 (0)