h8300 generic irq
PATCH 1/1 h8300 generic irq
h8300 using generic irq handler patch.
arch/h8300/Kconfig +4 -0
@@ -49,6 +49,10 @@ config GENERIC_HWEIGHT bool default y +config GENERIC_HARDIRQS + bool + default y + config GENERIC_CALIBRATE_DELAY bool default y
arch/h8300/Makefile +1 -1
@@ -41,7 +41,7 @@ LDFLAGS += $(ldflags-y) CROSS_COMPILE = h8300-elf- LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(CFLAGS) -print-libgcc-file-name) -head-y := arch/$(ARCH)/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o +head-y := arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/crt0_$(MODEL).o core-y += arch/$(ARCH)/kernel/ \ arch/$(ARCH)/mm/
arch/h8300/kernel/Makefile +2 -4
@@ -4,10 +4,8 @@ extra-y := vmlinux.lds -obj-y := process.o traps.o ptrace.o ints.o \ +obj-y := process.o traps.o ptrace.o irq.o \ sys_h8300.o time.o semaphore.o signal.o \ - setup.o gpio.o init_task.o syscalls.o devres.o - -devres-y = ../../../kernel/irq/devres.o + setup.o gpio.o init_task.o syscalls.o obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o
arch/h8300/kernel/irq.c new file +211 -0
211 lines not on this page · raw message
arch/h8300/kernel/setup.c +0 -3
@@ -33,10 +33,7 @@#include <asm/setup.h> #include <asm/irq.h> - -#ifdef CONFIG_BLK_DEV_INITRD #include <asm/pgtable.h> -#endif #if defined(__H8300H__)#define CPU "H8/300H"
arch/h8300/kernel/time.c +1 -1
@@ -44,7 +44,7 @@ static void timer_interrupt(int irq, void *dummy, struct pt_regs * regs)#ifndef CONFIG_SMP update_process_times (user_mode (regs));#endif -profile_tick (CPU_PROFILING , regs); +profile_tick (CPU_PROFILING ); }void time_init (void )
arch/h8300/mm/kmap.c +3 -1
@@ -24,12 +24,14 @@#undef DEBUG +#define VIRT_OFFSET (0x01000000) +/* * Map some physical address range into the kernel address space. */ void *__ioremap (unsigned long physaddr,unsigned long size,int cacheflag) { -return (void *)physaddr; +return (void *)(physaddr +VIRT_OFFSET ); }/*
arch/h8300/platform/h8300h/Makefile +1 -1
@@ -4,4 +4,4 @@ # Reuse any files we can from the H8/300H # -obj-y := entry.o ints_h8300h.o ptrace_h8300h.o +obj-y := entry.o irq_pin.o ptrace_h8300h.o
arch/h8300/platform/h8300h/entry.S +2 -2
@@ -30,12 +30,12 @@ mov.l er0,@-sp stc ccr,r0l /* check kernel mode */ - orc #0x10,ccr btst #4,r0l bne 5f mov.l sp,@SYMBOL_NAME(sw_usp) /* user mode */ mov.l @sp,er0 + orc #0x10,ccr mov.l @SYMBOL_NAME(sw_ksp),sp sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ mov.l er0,@-sp
@@ -165,7 +165,7 @@ SYMBOL_NAME_LABEL(interrupt_entry) dec.l #1,er0 mov.l sp,er1 subs #4,er1 /* adjust ret_pc */ - jsr @SYMBOL_NAME(process_int) + jsr @SYMBOL_NAME(do_IRQ) mov.l @SYMBOL_NAME(irq_stat)+CPUSTAT_SOFTIRQ_PENDING,er0 beq 1f jsr @SYMBOL_NAME(do_softirq)
arch/h8300/platform/h8300h/generic/Makefile +1 -1
@@ -2,5 +2,5 @@ # Makefile for the linux kernel. # +extra-y := crt0_$(MODEL).o obj-y := timer.o -extra-y = crt0_$(MODEL).o
arch/h8300/platform/h8300h/ints_h8300h.c deleted +0 -85
85 lines not on this page · raw message
arch/h8300/platform/h8s/entry.S +9 -8
@@ -31,12 +31,13 @@ mov.l er0,@-sp stc ccr,r0l /* check kernel mode */ - orc #0x10,ccr btst #4,r0l bne 5f - mov.l sp,@SYMBOL_NAME(sw_usp) /* user mode */ - mov.l @sp,er0 + /* user mode */ + mov.l sp,@SYMBOL_NAME(sw_usp) + mov.l @sp,er0 /* restore saved er0 */ + orc #0x10,ccr /* switch kernel stack */ mov.l @SYMBOL_NAME(sw_ksp),sp sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ stm.l er0-er3,@-sp
@@ -55,8 +56,9 @@ mov.l er0,@(LER0-LER3:16,sp) /* copy ER0 */ bra 6f 5: - mov.l @sp,er0 /* kernel mode */ - subs #2,sp /* dummy ccr */ + /* kernel mode */ + mov.l @sp,er0 /* restore saved er0 */ + subs #2,sp /* set dummy ccr */ stm.l er0-er3,@-sp mov.w @(LRET-LER3:16,sp),r1 /* copy old ccr */ mov.b r1h,r1l
@@ -94,6 +96,7 @@ mov.l @sp+,er1 add.l #(LRET-LER1),sp /* remove LORIG - LRET */ mov.l sp,@SYMBOL_NAME(sw_ksp) + andc #0xef,ccr /* switch to user mode */ mov.l er0,sp bra 8f 7:
@@ -173,9 +176,6 @@ SYMBOL_NAME_LABEL(interrupt_entry) SYMBOL_NAME_LABEL(system_call) subs #4,sp /* dummy LVEC */ SAVE_ALL - mov.w @(LCCR:16,sp),r1 - bset #4,r1l - ldc r1l,ccr /* restore ccr */ mov.l er0,er4 mov.l #-ENOSYS,er0 mov.l er0,@(LER0:16,sp)
@@ -198,6 +198,7 @@ SYMBOL_NAME_LABEL(system_call) mov.l @(LER1:16,sp),er0 mov.l @(LER2:16,sp),er1 mov.l @(LER3:16,sp),er2 + andc #0x7f,ccr jsr @er4 mov.l er0,@(LER0:16,sp) /* save the return value */ #if defined(CONFIG_SYSCALL_PRINT)
include/asm-h8300/irq.h +0 -1
@@ -61,6 +61,5 @@ static __inline__ int irq_canonicalize(int irq)extern void enable_irq (unsigned int );extern void disable_irq (unsigned int ); -#define disable_irq_nosync (x) disable_irq(x)#endif /* _H8300_IRQ_H_ */
include/asm-h8300/irq_regs.h new file +1 -0
@@ -0,0 +1 @@ +#include <asm-generic/irq_regs.h>
include/asm-h8300/pgtable.h +1 -0
@@ -73,4 +73,5 @@ extern int is_in_rom(unsigned long);#define VMALLOC_START 0#define VMALLOC_END 0xffffffff +#define arch_enter_lazy_cpu_mode () do {} while (0)#endif /* _H8300_PGTABLE_H */
Signature · 2 lines
Yoshinori Sato <[email protected]>
Quoted 4 lines · On Thu, 26 Apr 2007 17:34:37 +0900 Yoshinori Sato <[email protected]>…
h8300 using generic irq handler patch.
Signed-off-by Yoshinori Sato <[email protected]>
Minor things:
Quoted 24 lines
arch/h8300/kernel/irq.c new file +20
-0@@ -0,0 +1,211 @@ +/* +* linux/arch/h8300/kernel/irq.c +* +* Copyright 2007 Yoshinori Sato <[email protected]> +*/ + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/kernel_stat.h> +#include <linux/seq_file.h> +#include <linux/init.h> +#include <linux/random.h> +#include <linux/bootmem.h> +#include <linux/irq.h> + +#include <asm/system.h> +#include <asm/traps.h> +#include <asm/io.h>
arch/h8300/kernel/irq.c line 30
Quoted 10 lines
arch/h8300/kernel/irq.c new file +10
-0+#include <asm/setup.h> +#include <asm/errno.h> + +/*#define DEBUG*/ + +extern unsigned long *interrupt_redirect_table; +extern const int h8300_saved_vectors[]; +extern const unsigned long h8300_trap_table[]; +int h8300_enable_irq_pin (unsigned int irq); +void h8300_disable_irq_pin (unsigned int irq);
Please always avoid putting extern declarations into C files. Please them in a header file which is visible tot he definition site asw well as all callers/users.
For something which is defined in assembly code (like interrupt_redirect_table) it isn't so clear, because we cannot do typechecking. But I think it's still best to include the declaration in a header file so that we only have to declare it once. Plus it _is_ a global symbol.
arch/h8300/kernel/irq.c line 81
Quoted 13 lines
arch/h8300/kernel/irq.c new file +13
-0+ +/* +* h8300 interrupt controler implementation +*/ +struct irq_chip h8300irq_chip = { + .name ="H8300-INTC" , + .startup = h8300_startup_irq, + .shutdown = h8300_shutdown_irq, + .enable = h8300_enable_irq, + .disable = h8300_disable_irq, + .ack =NULL , + .end = h8300_end_irq, +};
I think this could have static scope.
arch/h8300/kernel/irq.c line 86
Quoted 4 lines
arch/h8300/kernel/irq.c new file +4
-0+void ack_bad_irq (unsigned int irq) +{ +printk ("unexpected IRQ trap at vector %02x\n" , irq); +}
printks should generally have facility levels (KERN_*)
arch/h8300/kernel/irq.c line 123
Quoted 1 line
arch/h8300/kernel/irq.c new file +1
-0+panic ("interrupt vector serup failed." );
typo
arch/h8300/kernel/irq.c line 131
Quoted 1 line
arch/h8300/kernel/irq.c new file +1
-0+for ( i =0 ; i <NR_IRQS ; i++) {
for (i = 0
arch/h8300/kernel/irq.c line 136
Quoted 5 lines
arch/h8300/kernel/irq.c new file +5
-0+if (i == *saved_vector) { + ramvec_p++; + saved_vector++; + }else { +if ( i <NR_TRAPS ) {
if (i < NR_TRAPS)
Quoted 6 lines · Andrew Morton
Quoted 6 lines
arch/h8300/kernel/irq.c new file +6
-0+/* +* h8300 interrupt controler implementation +*/ +struct irq_chip h8300irq_chip = { + .name ="H8300-INTC" , + .startup = h8300_startup_irq,
Quoted 8 lines
arch/h8300/kernel/irq.c line 81
Quoted 6 lines
arch/h8300/kernel/irq.c new file +6
-0+ .shutdown = h8300_shutdown_irq, + .enable = h8300_enable_irq, + .disable = h8300_disable_irq, + .ack = NULL, + .end = h8300_end_irq, +};I think this could have static scope.
Pluse there's not need to set .ack to NULL explicitly.
At Fri, 27 Apr 2007 19:09:35 -0700,
Quoted 50 lines · Andrew Morton
Quoted 4 lines · On Thu, 26 Apr 2007 17:34:37 +0900 Yoshinori Sato <[email protected]>…
h8300 using generic irq handler patch.
Signed-off-by Yoshinori Sato <[email protected]>Minor things:
Quoted 24 lines
arch/h8300/kernel/irq.c new file +20
-0@@ -0,0 +1,211 @@ +/* +* linux/arch/h8300/kernel/irq.c +* +* Copyright 2007 Yoshinori Sato <[email protected]> +*/ + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/kernel_stat.h> +#include <linux/seq_file.h> +#include <linux/init.h> +#include <linux/random.h> +#include <linux/bootmem.h> +#include <linux/irq.h> + +#include <asm/system.h> +#include <asm/traps.h> +#include <asm/io.h> arch/h8300/kernel/irq.c line 30
Quoted 10 lines
arch/h8300/kernel/irq.c new file +10
-0+#include <asm/setup.h> +#include <asm/errno.h> + +/*#define DEBUG*/ + +extern unsigned long *interrupt_redirect_table; +extern const int h8300_saved_vectors[]; +extern const unsigned long h8300_trap_table[]; +int h8300_enable_irq_pin (unsigned int irq); +void h8300_disable_irq_pin (unsigned int irq);Please always avoid putting extern declarations into C files. Please them in a header file which is visible tot he definition site asw well as all callers/users.
Quoted 5 lines
For something which is defined in assembly code (like
interrupt_redirect_table) it isn't so clear, because we cannot do typechecking. But I think it's still best to include the declaration in a header file so that we only have to declare it once. Plus it _is_ a global symbol.
I was sure. correct it.
Quoted 7 lines
Quoted 7 lines
arch/h8300/kernel/irq.c new file +7
-0+ +/* +* h8300 interrupt controler implementation +*/ +struct irq_chip h8300irq_chip = { + .name ="H8300-INTC" , + .startup = h8300_startup_irq,
Quoted 8 lines
arch/h8300/kernel/irq.c line 81
Quoted 6 lines
arch/h8300/kernel/irq.c new file +6
-0+ .shutdown = h8300_shutdown_irq, + .enable = h8300_enable_irq, + .disable = h8300_disable_irq, + .ack = NULL, + .end = h8300_end_irq, +};I think this could have static scope.
I do not need to refer from the outside.
I make a change in static.
Quoted 24 lines
arch/h8300/kernel/irq.c line 86
Quoted 4 lines
arch/h8300/kernel/irq.c new file +4
-0+void ack_bad_irq (unsigned int irq) +{ +printk ("unexpected IRQ trap at vector %02x\n" , irq); +}printks should generally have facility levels (KERN_*)
arch/h8300/kernel/irq.c line 123
Quoted 1 line
arch/h8300/kernel/irq.c new file +1
-0+panic ("interrupt vector serup failed." );typo
arch/h8300/kernel/irq.c line 131
Quoted 1 line
arch/h8300/kernel/irq.c new file +1
-0+for ( i =0 ; i <NR_IRQS ; i++) {for (i = 0arch/h8300/kernel/irq.c line 136
Quoted 5 lines
arch/h8300/kernel/irq.c new file +5
-0+if (i == *saved_vector) { + ramvec_p++; + saved_vector++; + }else { +if ( i <NR_TRAPS ) {if (i <
NR_TRAPS)