Commit fb14b47f authored by Yoshinori Sato's avatar Yoshinori Sato Committed by Linus Torvalds

[PATCH] h8300 support fix (1/2)

o build script update
o interrupt management fix
o mtd support fix
o signal handling fix
parent 4a7f0bf3
...@@ -2169,6 +2169,12 @@ W: http://www.ic.nec.co.jp/micro/uclinux/eng/ ...@@ -2169,6 +2169,12 @@ W: http://www.ic.nec.co.jp/micro/uclinux/eng/
W: http://www.ee.nec.de/uclinux/ W: http://www.ee.nec.de/uclinux/
S: Supported S: Supported
UCLINUX FOR RENESAS H8/300
P: Yoshinori Sato
M: ysato@users.sourceforge.jp
W: http://uclinux-h8.sourceforge.jp/
S: Supported
USB DIAMOND RIO500 DRIVER USB DIAMOND RIO500 DRIVER
P: Cesar Miquel P: Cesar Miquel
M: miquel@df.uba.ar M: miquel@df.uba.ar
......
...@@ -190,6 +190,8 @@ endmenu ...@@ -190,6 +190,8 @@ endmenu
source "drivers/base/Kconfig" source "drivers/base/Kconfig"
source "drivers/mtd/Kconfig"
source "drivers/block/Kconfig" source "drivers/block/Kconfig"
source "drivers/ide/Kconfig" source "drivers/ide/Kconfig"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# License. See the file "COPYING" in the main directory of this archive # License. See the file "COPYING" in the main directory of this archive
# for more details. # for more details.
# #
# (C) Copyright 2002, Yoshinori Sato <ysato@users.sourceforge.jp> # (C) Copyright 2002,2003 Yoshinori Sato <ysato@users.sourceforge.jp>
# #
ifndef include-config ifndef include-config
-include $(TOPDIR)/.config -include $(TOPDIR)/.config
...@@ -37,8 +37,8 @@ CFLAGS += $(cflags-y) ...@@ -37,8 +37,8 @@ CFLAGS += $(cflags-y)
CFLAGS += -mint32 -fno-builtin -Os CFLAGS += -mint32 -fno-builtin -Os
CFLAGS += -g CFLAGS += -g
CFLAGS += -D__linux__ CFLAGS += -D__linux__
CFLAGS += -DUTS_SYSNAME=\"uClinux\" -DTARGET=$(BOARD) CFLAGS += -DUTS_SYSNAME=\"uClinux\"
AFLAGS += -DPLATFORM=$(PLATFORM) -DTARGET=$(BOARD) -DMODEL=$(MODEL) $(cflags-y) AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y)
LDFLAGS += $(ldflags-y) LDFLAGS += $(ldflags-y)
CROSS_COMPILE = h8300-elf- CROSS_COMPILE = h8300-elf-
...@@ -53,28 +53,32 @@ core-y += arch/$(ARCH)/kernel/ \ ...@@ -53,28 +53,32 @@ core-y += arch/$(ARCH)/kernel/ \
libs-y += arch/$(ARCH)/lib/ $(LIBGCC) libs-y += arch/$(ARCH)/lib/ $(LIBGCC)
export MODEL boot := arch/h8300/boot
export MODEL PLATFORM BOARD
archmrproper: archmrproper:
archclean: archclean:
$(call descend arch/$(ARCH), subdirclean) $(Q)$(MAKE) $(clean)=$(boot)
prepare: include/asm-$(ARCH)/machine-depend.h include/asm-$(ARCH)/asm-offsets.h
prepare: include/asm-$(ARCH)/asm-offsets.h include/asm-$(ARCH)/machine-depend.h: include/asm-$(ARCH)/$(BOARD)/machine-depend.h
$(Q)ln -sf $(BOARD)/machine-depend.h \
include/asm-$(ARCH)/machine-depend.h
@echo ' Create include/asm-$(ARCH)/machine-depend.h'
include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \ include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
include/asm include/linux/version.h include/asm include/linux/version.h
$(call filechk,gen-asm-offsets) $(call filechk,gen-asm-offsets)
vmlinux.bin: vmlinux vmlinux.srec vmlinux.bin: vmlinux
$(OBJCOPY) -Obinary $< $@ $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
vmlinux.srec: vmlinux
$(OBJCOPY) -Osrec $< $@
define archhelp define archhelp
echo 'vmlinux.bin - Create raw binary' echo 'vmlinux.bin - Create raw binary'
echo 'vmlinux.srec - Create srec binary' echo 'vmlinux.srec - Create srec binary'
endef endef
CLEAN_FILES += arch/$(ARCH)/vmlinux.bin arch/$(ARCH)/vmlinux.srec CLEAN_FILES += include/asm-$(ARCH)/asm-offsets.h include/asm-$(ARCH)/machine-depend.h
# arch/h8300/boot/Makefile
targets := vmlinux.srec vmlinux.bin
OBJCOPYFLAGS_vmlinux.srec := -Osrec
OBJCOPYFLAGS_vmlinux.bin := -Obinary
$(obj)/vmlinux.srec $(obj)/vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy)
@echo ' Kernel: $@ is ready'
CLEAN_FILES += arch/$(ARCH)/vmlinux.bin arch/$(ARCH)/vmlinux.srec
...@@ -157,6 +157,7 @@ struct sigframe ...@@ -157,6 +157,7 @@ struct sigframe
#if defined(CONFIG_CPU_H8S) #if defined(CONFIG_CPU_H8S)
short dummy_exr; short dummy_exr;
#endif #endif
long dummy_pc;
char *pretcode; char *pretcode;
unsigned char retcode[8]; unsigned char retcode[8];
unsigned long extramask[_NSIG_WORDS-1]; unsigned long extramask[_NSIG_WORDS-1];
...@@ -170,6 +171,7 @@ struct rt_sigframe ...@@ -170,6 +171,7 @@ struct rt_sigframe
#if defined(CONFIG_CPU_H8S) #if defined(CONFIG_CPU_H8S)
short dummy_exr; short dummy_exr;
#endif #endif
long dummy_pc;
char *pretcode; char *pretcode;
unsigned char retcode[8]; unsigned char retcode[8];
struct siginfo info; struct siginfo info;
...@@ -241,7 +243,7 @@ rt_restore_ucontext(struct pt_regs *regs, struct ucontext *uc, int *pd0) ...@@ -241,7 +243,7 @@ rt_restore_ucontext(struct pt_regs *regs, struct ucontext *uc, int *pd0)
asmlinkage int do_sigreturn(unsigned long __unused,...) asmlinkage int do_sigreturn(unsigned long __unused,...)
{ {
struct pt_regs *regs = (struct pt_regs *) &__unused; struct pt_regs *regs = (struct pt_regs *) (&__unused - 1);
unsigned long usp = rdusp(); unsigned long usp = rdusp();
struct sigframe *frame = (struct sigframe *)(usp - 4); struct sigframe *frame = (struct sigframe *)(usp - 4);
sigset_t set; sigset_t set;
...@@ -416,7 +418,6 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -416,7 +418,6 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
/* Set up to return from userspace. */ /* Set up to return from userspace. */
err |= __put_user(frame->retcode, &frame->pretcode); err |= __put_user(frame->retcode, &frame->pretcode);
/* moveq #,d0; notb d0; movea.l #,a5; trap #0 */
/* sub.l er0,er0; mov.b #__NR_rt_sigreturn,r0l; trapa #0 */ /* sub.l er0,er0; mov.b #__NR_rt_sigreturn,r0l; trapa #0 */
err != __put_user(0x1a80f800 + (__NR_rt_sigreturn & 0xff), err != __put_user(0x1a80f800 + (__NR_rt_sigreturn & 0xff),
(long *)(frame->retcode + 0)); (long *)(frame->retcode + 0));
......
...@@ -283,6 +283,10 @@ SYMBOL_NAME_LABEL(sys_call_table) ...@@ -283,6 +283,10 @@ SYMBOL_NAME_LABEL(sys_call_table)
.long SYMBOL_NAME(sys_clock_gettime) /* 265 */ .long SYMBOL_NAME(sys_clock_gettime) /* 265 */
.long SYMBOL_NAME(sys_clock_getres) .long SYMBOL_NAME(sys_clock_getres)
.long SYMBOL_NAME(sys_clock_nanosleep) .long SYMBOL_NAME(sys_clock_nanosleep)
.long SYMBOL_NAME(sys_statfs64)
.long SYMBOL_NAME(sys_fstatfs64)
.long SYMBOL_NAME(sys_tgkill) /* 270 */
.long SYMBOL_NAME(sys_utimes)
.rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4 .rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4
.long SYMBOL_NAME(sys_ni_syscall) .long SYMBOL_NAME(sys_ni_syscall)
......
...@@ -2,58 +2,62 @@ ...@@ -2,58 +2,62 @@
#ifdef CONFIG_H8300H_GENERIC #ifdef CONFIG_H8300H_GENERIC
#ifdef CONFIG_ROMKERNEL #ifdef CONFIG_ROMKERNEL
#include "platform/h8300h/generic/rom.ld" #include "../platform/h8300h/generic/rom.ld"
#endif #endif
#ifdef CONFIG_RAMKERNEL #ifdef CONFIG_RAMKERNEL
#include "platform/h8300h/generic/ram.ld" #include "../platform/h8300h/generic/ram.ld"
#endif #endif
#endif #endif
#ifdef CONFIG_H8300H_AKI3068NET #ifdef CONFIG_H8300H_AKI3068NET
#ifdef CONFIG_ROMKERNEL #ifdef CONFIG_ROMKERNEL
#include "platform/h8300h/aki3068net/rom.ld" #include "../platform/h8300h/aki3068net/rom.ld"
#endif #endif
#ifdef CONFIG_RAMKERNEL #ifdef CONFIG_RAMKERNEL
#include "platform/h8300h/aki3068net/ram.ld" #include "../platform/h8300h/aki3068net/ram.ld"
#endif #endif
#endif #endif
#ifdef CONFIG_H8300H_H8MAX #ifdef CONFIG_H8300H_H8MAX
#ifdef CONFIG_ROMKERNEL #ifdef CONFIG_ROMKERNEL
#include "platform/h8300h/h8max/rom.ld" #include "../platform/h8300h/h8max/rom.ld"
#endif #endif
#ifdef CONFIG_RAMKERNEL #ifdef CONFIG_RAMKERNEL
#include "platform/h8300h/h8max/ram.ld" #include "../platform/h8300h/h8max/ram.ld"
#endif #endif
#endif #endif
#ifdef CONFIG_H8300H_SIM #ifdef CONFIG_H8300H_SIM
#ifdef CONFIG_ROMKERNEL #ifdef CONFIG_ROMKERNEL
#include "platform/h8300h/generic/rom.ld" #include "../platform/h8300h/generic/rom.ld"
#endif #endif
#ifdef CONFIG_RAMKERNEL #ifdef CONFIG_RAMKERNEL
#include "platform/h8300h/generic/ram.ld" #include "../platform/h8300h/generic/ram.ld"
#endif #endif
#endif #endif
#ifdef CONFIG_H8S_SIM #ifdef CONFIG_H8S_SIM
#ifdef CONFIG_ROMKERNEL #ifdef CONFIG_ROMKERNEL
#include "platform/h8s/generic/rom.ld" #include "../platform/h8s/generic/rom.ld"
#endif #endif
#ifdef CONFIG_RAMKERNEL #ifdef CONFIG_RAMKERNEL
#include "platform/h8s/generic/ram.ld" #include "../platform/h8s/generic/ram.ld"
#endif #endif
#endif #endif
#ifdef CONFIG_H8S_EDOSK2674 #ifdef CONFIG_H8S_EDOSK2674
#ifdef CONFIG_ROMKERNEL #ifdef CONFIG_ROMKERNEL
#include "platform/h8s/edosk2674/rom.ld" #include "../platform/h8s/edosk2674/rom.ld"
#endif #endif
#ifdef CONFIG_RAMKERNEL #ifdef CONFIG_RAMKERNEL
#include "platform/h8s/edosk2674/ram.ld" #include "../platform/h8s/edosk2674/ram.ld"
#endif #endif
#endif #endif
#if defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)
INPUT(romfs.o)
#endif
_jiffies = _jiffies_64 + 4; _jiffies = _jiffies_64 + 4;
SECTIONS SECTIONS
...@@ -169,6 +173,10 @@ SECTIONS ...@@ -169,6 +173,10 @@ SECTIONS
__end = . ; __end = . ;
__ramstart = .; __ramstart = .;
} > ram } > ram
.romfs :
{
*(.romfs*)
} > ram
.dummy : .dummy :
{ {
COMMAND_START = . - 0x200 ; COMMAND_START = . - 0x200 ;
......
/* romfs move to __ebss */
#include <asm/linkage.h>
#if defined(__H8300H__)
.h8300h
#endif
#if defined(__H8300S__)
.h8300s
#endif
.text
.globl __move_romfs
_romfs_sig_len = 8
__move_romfs:
mov.l #__sbss,er0
mov.l #_romfs_sig,er1
mov.b #_romfs_sig_len,r3l
1: /* check romfs image */
mov.b @er0+,r2l
mov.b @er1+,r2h
cmp.b r2l,r2h
bne 2f
dec.b r3l
bne 1b
/* find romfs image */
mov.l @__sbss+8,er0 /* romfs length(be) */
mov.l #__sbss,er1
add.l er0,er1 /* romfs image end */
mov.l #__ebss,er2
add.l er0,er2 /* distination address */
adds #2,er0
adds #1,er0
shlr er0
shlr er0 /* transfer length */
1:
mov.l @er1,er3 /* copy image */
mov.l er3,@er2
subs #4,er1
subs #4,er2
dec.l #1,er0
bpl 1b
2:
rts
.section .rodata
_romfs_sig:
.ascii "-rom1fs-"
.end
...@@ -25,15 +25,11 @@ ...@@ -25,15 +25,11 @@
#define CMFA 6 #define CMFA 6
extern int request_irq_boot(unsigned int,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long, const char *, void *);
void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{ {
outb(H8300_TIMER_COUNT_DATA,TCORA2); outb(H8300_TIMER_COUNT_DATA,TCORA2);
outb(0x00,_8TCSR2); outb(0x00,_8TCSR2);
request_irq_boot(40,timer_int,0,"timer",0); request_irq(40,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR2); outb(0x40|0x08|0x03,_8TCR2);
} }
......
...@@ -111,7 +111,7 @@ LRET = 38 ...@@ -111,7 +111,7 @@ LRET = 38
mov.l er1,@(8:16,er0) mov.l er1,@(8:16,er0)
mov.l @sp+,er1 mov.l @sp+,er1
add.l #(LRET-LORIG),sp /* remove LORIG - LRET */ add.l #(LRET-LER1),sp /* remove LORIG - LRET */
mov.l sp,@SYMBOL_NAME(sw_ksp) mov.l sp,@SYMBOL_NAME(sw_ksp)
mov.l er0,sp mov.l er0,sp
bra 8f bra 8f
...@@ -255,6 +255,7 @@ SYMBOL_NAME_LABEL(ret_from_exception) ...@@ -255,6 +255,7 @@ SYMBOL_NAME_LABEL(ret_from_exception)
btst #TIF_NEED_RESCHED,r1l btst #TIF_NEED_RESCHED,r1l
bne @SYMBOL_NAME(reschedule):16 bne @SYMBOL_NAME(reschedule):16
mov.l sp,er1 mov.l sp,er1
subs #4,er1 /* adjust retpc */
mov.l er2,er0 mov.l er2,er0
jsr @SYMBOL_NAME(do_signal) jsr @SYMBOL_NAME(do_signal)
3: 3:
......
...@@ -44,14 +44,19 @@ SYMBOL_NAME_LABEL(_start) ...@@ -44,14 +44,19 @@ SYMBOL_NAME_LABEL(_start)
/* copy .data */ /* copy .data */
#if !defined(CONFIG_H8300H_SIM) #if !defined(CONFIG_H8300H_SIM)
/* copy .data */
mov.l #__begin_data,er5 mov.l #__begin_data,er5
mov.l #__sdata,er6 mov.l #__sdata,er6
mov.l #__edata,er4 mov.l #__edata,er4
sub.l er6,er4 sub.l er6,er4
shlr.l er4
shlr.l er4
1: 1:
eepmov.w mov.l @er5+,er0
dec.w #1,e4 mov.l er0,@er6
bpl 1b adds #4,er6
dec.l #1,er4
bne 1b
#endif #endif
/* copy kernel commandline */ /* copy kernel commandline */
......
...@@ -25,15 +25,11 @@ ...@@ -25,15 +25,11 @@
#define CMFA 6 #define CMFA 6
extern int request_irq_boot(unsigned int,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long, const char *, void *);
void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{ {
outb(H8300_TIMER_COUNT_DATA,TCORA2); outb(H8300_TIMER_COUNT_DATA,TCORA2);
outb(0x00,_8TCSR2); outb(0x00,_8TCSR2);
request_irq_boot(40,timer_int,0,"timer",0); request_irq(40,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR2); outb(0x40|0x08|0x03,_8TCR2);
} }
......
...@@ -52,7 +52,8 @@ typedef struct irq_handler { ...@@ -52,7 +52,8 @@ typedef struct irq_handler {
const char *devname; const char *devname;
} irq_handler_t; } irq_handler_t;
irq_handler_t *irq_list[NR_IRQS]; static irq_handler_t *irq_list[NR_IRQS];
static int use_kmalloc;
extern unsigned long *interrupt_redirect_table; extern unsigned long *interrupt_redirect_table;
...@@ -119,20 +120,6 @@ void __init init_IRQ(void) ...@@ -119,20 +120,6 @@ void __init init_IRQ(void)
#endif #endif
} }
void __init request_irq_boot(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id)
{
irq_handler_t *irq_handle;
irq_handle = alloc_bootmem(sizeof(irq_handler_t));
irq_handle->handler = handler;
irq_handle->flags = flags;
irq_handle->count = 0;
irq_handle->dev_id = dev_id;
irq_handle->devname = devname;
irq_list[irq] = irq_handle;
}
int request_irq(unsigned int irq, int request_irq(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *), irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id) unsigned long flags, const char *devname, void *dev_id)
...@@ -154,7 +141,14 @@ int request_irq(unsigned int irq, ...@@ -154,7 +141,14 @@ int request_irq(unsigned int irq,
return -EBUSY; return -EBUSY;
H8300_GPIO_DDR(H8300_GPIO_P9, (irq - EXT_IRQ0), 0); H8300_GPIO_DDR(H8300_GPIO_P9, (irq - EXT_IRQ0), 0);
} }
if (use_kmalloc)
irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
else {
irq_handle = alloc_bootmem(sizeof(irq_handler_t));
(unsigned long)irq_handle |= 0x80000000; /* bootmem allocater */
}
if (irq_handle == NULL) if (irq_handle == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -177,8 +171,10 @@ void free_irq(unsigned int irq, void *dev_id) ...@@ -177,8 +171,10 @@ void free_irq(unsigned int irq, void *dev_id)
irq, irq_list[irq]->devname); irq, irq_list[irq]->devname);
if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5) if (irq >= EXT_IRQ0 && irq <= EXT_IRQ5)
*(volatile unsigned char *)IER &= ~(1 << (irq - EXT_IRQ0)); *(volatile unsigned char *)IER &= ~(1 << (irq - EXT_IRQ0));
if ((irq_list[irq] & 0x80000000) == 0) {
kfree(irq_list[irq]); kfree(irq_list[irq]);
irq_list[irq] = NULL; irq_list[irq] = NULL;
}
} }
/* /*
...@@ -244,3 +240,9 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -244,3 +240,9 @@ int show_interrupts(struct seq_file *p, void *v)
void init_irq_proc(void) void init_irq_proc(void)
{ {
} }
static void __init enable_kmalloc(void)
{
use_kmalloc = 1;
}
__initcall(enable_kmalloc);
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
/* CPU Reset entry */ /* CPU Reset entry */
SYMBOL_NAME_LABEL(_start) SYMBOL_NAME_LABEL(_start)
mov.l #RAMEND,sp mov.l #RAMEND,sp
ldc #0x07,exr ldc #0x80,ccr
ldc #0x00,exr
/* Peripheral Setup */ /* Peripheral Setup */
bclr #4,@INTCR:8 /* interrupt mode 2 */ bclr #4,@INTCR:8 /* interrupt mode 2 */
...@@ -46,7 +47,7 @@ SYMBOL_NAME_LABEL(_start) ...@@ -46,7 +47,7 @@ SYMBOL_NAME_LABEL(_start)
bset #1,@ISCRL+1:16 /* IRQ0 Positive Edge */ bset #1,@ISCRL+1:16 /* IRQ0 Positive Edge */
bclr #0,@ISCRL+1:16 bclr #0,@ISCRL+1:16
#if defined(CONFIG_BLK_DEV_BLKMEM) #if defined(CONFIG_MTD_UCLINUX)
/* move romfs image */ /* move romfs image */
jsr @__move_romfs jsr @__move_romfs
#endif #endif
...@@ -71,7 +72,7 @@ SYMBOL_NAME_LABEL(_start) ...@@ -71,7 +72,7 @@ SYMBOL_NAME_LABEL(_start)
eepmov.w eepmov.w
/* uClinux kernel start */ /* uClinux kernel start */
ldc #0x10,ccr /* running kernel */ ldc #0x90,ccr /* running kernel */
mov.l #SYMBOL_NAME(init_thread_union),sp mov.l #SYMBOL_NAME(init_thread_union),sp
add.l #0x2000,sp add.l #0x2000,sp
jsr @_start_kernel jsr @_start_kernel
......
...@@ -26,10 +26,6 @@ ...@@ -26,10 +26,6 @@
#define REGS(regs) __REGS(regs) #define REGS(regs) __REGS(regs)
#define __REGS(regs) #regs #define __REGS(regs) #regs
extern int request_irq_boot(unsigned int,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long, const char *, void *);
int __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) int __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{ {
unsigned char mstpcrl; unsigned char mstpcrl;
...@@ -38,7 +34,7 @@ int __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_ ...@@ -38,7 +34,7 @@ int __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_
outb(mstpcrl,MSTPCRL); outb(mstpcrl,MSTPCRL);
outb(H8300_TIMER_COUNT_DATA,_8TCORA1); outb(H8300_TIMER_COUNT_DATA,_8TCORA1);
outb(0x00,_8TCSR1); outb(0x00,_8TCSR1);
request_irq_boot(76,timer_int,0,"timer",0); request_irq(76,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR1); outb(0x40|0x08|0x03,_8TCR1);
return 0; return 0;
} }
......
...@@ -112,7 +112,7 @@ LRET = 40 ...@@ -112,7 +112,7 @@ LRET = 40
mov.l er1,@(10:16,er0) mov.l er1,@(10:16,er0)
mov.l @sp+,er1 mov.l @sp+,er1
add.l #(LRET-LORIG),sp /* remove LORIG - LRET */ add.l #(LRET-LER1),sp /* remove LORIG - LRET */
mov.l sp,@SYMBOL_NAME(sw_ksp) mov.l sp,@SYMBOL_NAME(sw_ksp)
mov.l er0,sp mov.l er0,sp
bra 8f bra 8f
...@@ -252,6 +252,7 @@ SYMBOL_NAME_LABEL(ret_from_exception) ...@@ -252,6 +252,7 @@ SYMBOL_NAME_LABEL(ret_from_exception)
btst #TIF_NEED_RESCHED,r1l btst #TIF_NEED_RESCHED,r1l
bne @SYMBOL_NAME(reschedule):16 bne @SYMBOL_NAME(reschedule):16
mov.l sp,er1 mov.l sp,er1
subs #4,er1 /* adjust retpc */
mov.l er2,er0 mov.l er2,er0
jsr @SYMBOL_NAME(do_signal) jsr @SYMBOL_NAME(do_signal)
3: 3:
......
...@@ -37,13 +37,14 @@ ...@@ -37,13 +37,14 @@
/* CPU Reset entry */ /* CPU Reset entry */
SYMBOL_NAME_LABEL(_start) SYMBOL_NAME_LABEL(_start)
mov.l #RAMEND,sp mov.l #RAMEND,sp
ldc #0x07,exr ldc #0x80,ccr
ldc #0x00,exr
/* Peripheral Setup */ /* Peripheral Setup */
bclr #4,@INTCR:8 /* interrupt mode 2 */ bclr #4,@INTCR:8 /* interrupt mode 2 */
bset #5,@INTCR:8 bset #5,@INTCR:8
#if defined(CONFIG_BLK_DEV_BLKMEM) #if defined(CONFIG_MTD_UCLINUX)
/* move romfs image */ /* move romfs image */
jsr @__move_romfs jsr @__move_romfs
#endif #endif
...@@ -68,7 +69,7 @@ SYMBOL_NAME_LABEL(_start) ...@@ -68,7 +69,7 @@ SYMBOL_NAME_LABEL(_start)
eepmov.w eepmov.w
/* uClinux kernel start */ /* uClinux kernel start */
ldc #0x10,ccr /* running kernel */ ldc #0x90,ccr /* running kernel */
mov.l #SYMBOL_NAME(init_thread_union),sp mov.l #SYMBOL_NAME(init_thread_union),sp
add.l #0x2000,sp add.l #0x2000,sp
jsr @_start_kernel jsr @_start_kernel
......
...@@ -33,36 +33,32 @@ SYMBOL_NAME_LABEL(_start) ...@@ -33,36 +33,32 @@ SYMBOL_NAME_LABEL(_start)
/* Peripheral Setup */ /* Peripheral Setup */
/* .bss clear */
mov.l #__sbss,er5
mov.l er5,er6
inc.l #1,er6
mov.l #__ebss,er4
sub.l er5,er4
sub.w r0,r0
mov.b r0l,@er5
1:
eepmov.w
dec.w #1,e4
bpl 1b
/* copy .data */ /* copy .data */
#if !defined(CONFIG_H8S_SIM) #if !defined(CONFIG_H8S_SIM)
mov.l #__begin_data,er5 mov.l #__begin_data,er5
mov.l #__sdata,er6 mov.l #__sdata,er6
mov.l #__edata,er4 mov.l #__edata,er4
sub.l er6,er4 sub.l er6,er4
shlr.l #2,er4
1: 1:
eepmov.w mov.l @er5+,er0
dec.w #1,e4 mov.l er0,@er6
bpl 1b adds #4,er6
dec.l #1,er4
bne 1b
#endif #endif
/* copy kernel commandline */ /* .bss clear */
mov.l #COMMAND_START,er5 mov.l #__sbss,er5
mov.l #SYMBOL_NAME(_command_line),er6 mov.l #__ebss,er4
mov.w #512,r4 sub.l er5,er4
eepmov.w shlr.l #2,er4
sub.l er0,er0
1:
mov.l er0,@er5
adds #4,er5
dec.l #1,er4
bne 1b
/* linux kernel start */ /* linux kernel start */
ldc #0x90,ccr /* running kernel */ ldc #0x90,ccr /* running kernel */
......
...@@ -6,6 +6,6 @@ MEMORY ...@@ -6,6 +6,6 @@ MEMORY
vector : ORIGIN = 0x000000, LENGTH = 0x000200 vector : ORIGIN = 0x000000, LENGTH = 0x000200
rom : ORIGIN = 0x000200, LENGTH = 0x200000-0x000200 rom : ORIGIN = 0x000200, LENGTH = 0x200000-0x000200
erom : ORIGIN = 0x200000, LENGTH = 0 erom : ORIGIN = 0x200000, LENGTH = 0
ram : ORIGIN = 0x200000, LENGTH = 0x200000 ram : ORIGIN = 0x200000, LENGTH = 0x400000
eram : ORIGIN = 0x400000, LENGTH = 0 eram : ORIGIN = 0x600000, LENGTH = 0
} }
...@@ -23,15 +23,11 @@ ...@@ -23,15 +23,11 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/regs267x.h> #include <asm/regs267x.h>
extern int request_irq_boot(unsigned int,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long, const char *, void *);
int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *)) int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
{ {
outb(H8300_TIMER_COUNT_DATA,_8TCORA1); outb(H8300_TIMER_COUNT_DATA,_8TCORA1);
outb(0x00,_8TCSR1); outb(0x00,_8TCSR1);
request_irq_boot(76,timer_int,0,"timer",0); request_irq(76,timer_int,0,"timer",0);
outb(0x40|0x08|0x03,_8TCR1); outb(0x40|0x08|0x03,_8TCR1);
return 0; return 0;
} }
......
...@@ -91,6 +91,8 @@ const static struct irq_pins irq_assign_table1[16]={ ...@@ -91,6 +91,8 @@ const static struct irq_pins irq_assign_table1[16]={
{H8300_GPIO_P2,H8300_GPIO_B6},{H8300_GPIO_P2,H8300_GPIO_B7}, {H8300_GPIO_P2,H8300_GPIO_B6},{H8300_GPIO_P2,H8300_GPIO_B7},
}; };
static int use_kmalloc;
extern unsigned long *interrupt_redirect_table; extern unsigned long *interrupt_redirect_table;
static inline unsigned long *get_vector_address(void) static inline unsigned long *get_vector_address(void)
...@@ -159,22 +161,6 @@ void __init init_IRQ(void) ...@@ -159,22 +161,6 @@ void __init init_IRQ(void)
#endif #endif
} }
/* special request_irq */
/* used bootmem allocater */
void __init request_irq_boot(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id)
{
irq_handler_t *irq_handle;
irq_handle = alloc_bootmem(sizeof(irq_handler_t));
irq_handle->handler = handler;
irq_handle->flags = flags;
irq_handle->count = 0;
irq_handle->dev_id = dev_id;
irq_handle->devname = devname;
irq_list[irq] = irq_handle;
}
int request_irq(unsigned int irq, int request_irq(unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *), irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id) unsigned long flags, const char *devname, void *dev_id)
...@@ -202,7 +188,14 @@ int request_irq(unsigned int irq, ...@@ -202,7 +188,14 @@ int request_irq(unsigned int irq,
H8300_GPIO_DDR(port_no, bit_no, H8300_GPIO_INPUT); H8300_GPIO_DDR(port_no, bit_no, H8300_GPIO_INPUT);
*(volatile unsigned short *)ISR &= ~ptn; /* ISR clear */ *(volatile unsigned short *)ISR &= ~ptn; /* ISR clear */
} }
if (use_kmalloc)
irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
else {
irq_handle = alloc_bootmem(sizeof(irq_handler_t));
(unsigned long)irq_handle |= 0x80000000; /* bootmem allocater */
}
if (irq_handle == NULL) if (irq_handle == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -243,8 +236,10 @@ void free_irq(unsigned int irq, void *dev_id) ...@@ -243,8 +236,10 @@ void free_irq(unsigned int irq, void *dev_id)
} }
H8300_GPIO_FREE(port_no, bit_no); H8300_GPIO_FREE(port_no, bit_no);
} }
if (((unsigned long)irq_list[irq] & 0x80000000) == 0) {
kfree(irq_list[irq]); kfree(irq_list[irq]);
irq_list[irq] = NULL; irq_list[irq] = NULL;
}
} }
unsigned long probe_irq_on (void) unsigned long probe_irq_on (void)
...@@ -306,3 +301,10 @@ int show_interrupts(struct seq_file *p, void *v) ...@@ -306,3 +301,10 @@ int show_interrupts(struct seq_file *p, void *v)
void init_irq_proc(void) void init_irq_proc(void)
{ {
} }
static int __init enable_kmalloc(void)
{
use_kmalloc = 1;
return 0;
}
__initcall(enable_kmalloc);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment