From: Masahiro A. <m-...@aa...> - 2001-07-11 07:03:00
|
Hello all, today I desperately need someone's help (as usual;-) I've checked out CVS kernel last night (before Niibe-san updated it to 2.4.7-pre5/6). Today I've made modifications to it to run on our custom board. It booted, but somehow, system is reset while INIT process. I have applied changes to the source for irq, machvec, CompactFlash handling only. I haven't applied ext3 and RTLinux patch yet. System reset occurs at random location of INIT process. Sometimes I can see several lines of output from rc.sysinit. Sometimes I can see nothing after "Freeing unused kernel memory" message from kernel, just reset happens. If I make /sbin/init as link to /bin/bash, sometimes I can see bash prompt and type some command, but sometimes system resets before that. Our custom board has 32MB SRAM in area 2, CompactFlash in area 5. With 2.4.5 kernel and similar modifications, our custom board can run without problem. I've tried same kernel on SolutionEngine 7750S. It has no problem like this. Can anybody suggest me something/some place to look into? I can't think of anything how to nail down this problem now. For reference, I've attached patch for CompactFlash handling. This is basically the same as what I've posted before, but uses newly renamed p3_ioremap(). This one or "irq_maskreg" patch I've posted before may be the source of this? Thanks in advance for your help. --------- diff -ruN linux-2.4.6-cvs-mr/arch/sh/config.in linux-2.4.6-cvs-mr-cf/arch/sh/config.in --- linux-2.4.6-cvs-mr/arch/sh/config.in Wed Jul 11 09:40:56 2001 +++ linux-2.4.6-cvs-mr-cf/arch/sh/config.in Wed Jul 11 10:45:10 2001 @@ -130,6 +130,18 @@ bool 'Compact Flash Enabler support' CONFIG_CF_ENABLER fi +if [ "$CONFIG_CF_ENABLER" = "y" ]; then + choice 'Compact Flash Area' \ + "Area5 CONFIG_CF_AREA5 \ + Area6 CONFIG_CF_AREA6" Area6 + if [ "$CONFIG_CF_AREA5" = "y" ]; then + define_hex CONFIG_CF_BASE_ADDR b4000000 + fi + if [ "$CONFIG_CF_AREA6" = "y" ]; then + define_hex CONFIG_CF_BASE_ADDR b8000000 + fi +fi + bool 'Hitachi HD64461 companion chip support' CONFIG_HD64461 if [ "$CONFIG_HD64461" = "y" ]; then int 'HD64461 IRQ' CONFIG_HD64461_IRQ 36 diff -ruN linux-2.4.6-cvs-mr/arch/sh/kernel/cf-enabler.c linux-2.4.6-cvs-mr-cf/arch/sh/kernel/cf-enabler.c --- linux-2.4.6-cvs-mr/arch/sh/kernel/cf-enabler.c Wed Jul 11 09:40:56 2001 +++ linux-2.4.6-cvs-mr-cf/arch/sh/kernel/cf-enabler.c Wed Jul 11 14:20:41 2001 @@ -14,7 +14,8 @@ #include <asm/io.h> #include <asm/irq.h> -#define CF_CIS_BASE 0xb8000000 +/* this must be done in boot-loader - Masahiro Abe +#define CF_CIS_BASE 0xb8000000 */ /* * You can connect Compact Flash directly to the bus of SuperH. * This is the enabler for that. @@ -29,15 +30,58 @@ * 0xB8001000 : Common Memory * 0xBA000000 : I/O */ +#if defined(CONFIG_IDE) && defined(__SH4__) +/* SH4 can't access PCMCIA interface through P2 area. + * we must remap it with appropreate attribute bit of the page set. + * this part is based on Greg Banks' hd64465_ss.c implementation - Masahiro Abe */ +#include <linux/mm.h> +#include <linux/vmalloc.h> + +#if defined(CONFIG_CF_AREA6) +#define slot_no 0 +#else +#define slot_no 1 +#endif + +extern void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags); + +void *cf_io_base; + +static int __init allocate_cf_area(void) +{ + pgprot_t prot; + unsigned long paddrbase, psize; + +/* open I/O area window */ + paddrbase = virt_to_phys((void*)CONFIG_CF_BASE_ADDR); + psize = PAGE_SIZE; + prot = PAGE_KERNEL_PCC(slot_no, _PAGE_PCC_IO16); + cf_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); + if (!cf_io_base) { + printk("allocate_cf_area : can't open CF I/O window!\n"); + return -ENOMEM; + } +/* printk("p3_ioremap(paddr=0x%08lx, psize=0x%08lx, prot=0x%08lx)=0x%08lx\n", + paddrbase, psize, prot.pgprot, cf_io_base);*/ + + /* XXX : do we need attribute and common-memory area also? */ + + return 0; +} +#endif static int __init cf_init_default(void) { #ifdef CONFIG_IDE +#if defined(CONFIG_IDE) && defined(__SH4__) + allocate_cf_area(); +#endif /* Enable the card, and set the level interrupt */ - ctrl_outw(0x0042, CF_CIS_BASE+0x0200); +/* this must be done in boot-loader - Masahiro Abe + ctrl_outw(0x0042, CF_CIS_BASE+0x0200);*/ #endif - make_imask_irq(14); - disable_irq(14); +/* make_imask_irq(14); + disable_irq(14);*/ return 0; } ---------- +-------------------------------------+ | Masahiro Abe, Software Engineer | | A&D Co., Ltd. of Tokyo, Japan | | mailto:m-...@aa... | +-------------------------------------+ |This is my opinion, not my employer's| +-------------------------------------+ |