Yoichi Koyanagi
yk****@tinyw*****
2004年 2月 2日 (月) 15:59:34 JST
こんにちは。 > > 秋月3069ネットボードに IDE disk をつけて、stand-alone で動作させるところまで > > できました。回路は、 (省略) > > uClinux の方のパッチはまだ整理できていないので、準備ができたらまたこちらに > > 出したいと思っています。 H8MAXのコードにならって、aki3068net の方のコードを修正しました。 また、IDEのレジスタを、エリア3 以外にエリア4-7にもマップできるように するために、eCos の方で CS を enable するコードを CYGHWR_HAL_IDE_REGISTER の値から判定して挿入する修正を加えました。 (uClinuxの方では、アドレスは define で埋め込まれています) もしよろしければ、取り込んでいただけると幸いです。 -Koya ****** uClinux へのパッチ ******* Index: drivers/ide/h8300/aki3068_ide.c =================================================================== RCS file: /cvsroot/uclinux-h8/uClinux-2.4.x/drivers/ide/h8300/aki3068_ide.c,v retrieving revision 1.1 diff -c -r1.1 aki3068_ide.c *** drivers/ide/h8300/aki3068_ide.c 23 Jul 2003 12:21:21 -0000 1.1 --- drivers/ide/h8300/aki3068_ide.c 2 Feb 2004 05:09:45 -0000 *************** *** 26,43 **** #include <asm/regs306x.h> /* IDE I/F configuration */ ! #define IDE_BASE 0x600000 ! #define IDE_CTRL 0x600206 #define IDE_IRQ EXT_IRQ4 #define IDE_DATA 0x00 ! #define IDE_ERROR 0x01 ! #define IDE_NSECTOR 0x02 ! #define IDE_SECTOR 0x03 ! #define IDE_LCYL 0x04 ! #define IDE_HCYL 0x05 ! #define IDE_SELECT 0x06 ! #define IDE_STATUS 0x07 const static int offsets[IDE_NR_PORTS] = { IDE_DATA, IDE_ERROR, IDE_NSECTOR, IDE_SECTOR, IDE_LCYL, --- 26,45 ---- #include <asm/regs306x.h> /* IDE I/F configuration */ ! // #define IDE_BASE 0x600000 ! // #define IDE_CTRL 0x60002C ! #define IDE_BASE 0x800000 ! #define IDE_CTRL 0x80002C #define IDE_IRQ EXT_IRQ4 #define IDE_DATA 0x00 ! #define IDE_ERROR 0x02 ! #define IDE_NSECTOR 0x04 ! #define IDE_SECTOR 0x06 ! #define IDE_LCYL 0x08 ! #define IDE_HCYL 0x0A ! #define IDE_SELECT 0x0C ! #define IDE_STATUS 0x0E const static int offsets[IDE_NR_PORTS] = { IDE_DATA, IDE_ERROR, IDE_NSECTOR, IDE_SECTOR, IDE_LCYL, *************** *** 46,72 **** static void _outb(u8 d, unsigned long a) { ! *(unsigned char *)a = (d & 0xff); } static void _outbsync(ide_drive_t *drive, u8 d, unsigned long a) { ! *(unsigned char *)a = (d & 0xff); } static u8 _inb(unsigned long a) { ! return *(unsigned char *)a; } static void _outw(u16 d, unsigned long a) { ! *(unsigned short *)a = d; } static u16 _inw(unsigned long a) { ! return *(unsigned short *)a; } static void _outl(u32 d, unsigned long a) --- 48,76 ---- static void _outb(u8 d, unsigned long a) { ! *(unsigned short *)a = (d & 0xff); } static void _outbsync(ide_drive_t *drive, u8 d, unsigned long a) { ! *(unsigned short *)a = (d & 0xff); } static u8 _inb(unsigned long a) { ! return (*(unsigned short *)a) & 0xff; } static void _outw(u16 d, unsigned long a) { ! *(unsigned short *)a = (d << 8) | (d >> 8); } static u16 _inw(unsigned long a) { ! unsigned short d; ! d = *(unsigned short *)a; ! return ((d << 8) | (d >> 8)); } static void _outl(u32 d, unsigned long a) *************** *** 82,89 **** { unsigned volatile short *ap = (unsigned volatile short *)addr; unsigned short *bp = (unsigned short *)buf; while(len--) { ! *ap = *bp++; } } --- 86,95 ---- { unsigned volatile short *ap = (unsigned volatile short *)addr; unsigned short *bp = (unsigned short *)buf; + unsigned short d; while(len--) { ! d = *bp++; ! *ap = (d >> 8) | (d << 8); } } *************** *** 91,98 **** { unsigned volatile short *ap = (unsigned volatile short *)addr; unsigned short *bp = (unsigned short *)buf; while(len--) { ! *bp++ = *ap; } } --- 97,106 ---- { unsigned volatile short *ap = (unsigned volatile short *)addr; unsigned short *bp = (unsigned short *)buf; + unsigned short d; while(len--) { ! d = *ap; ! *bp++ = (d >> 8) | (d << 8); } } *************** *** 101,107 **** hw_regs_t hw; ide_hwif_t *hwif; ! *(volatile unsigned char *)ABWCR |= (1<<3); memset(&hw,0,sizeof(hw)); ide_setup_ports(&hw, IDE_BASE, (int *)offsets, IDE_CTRL, 0, NULL,IDE_IRQ); --- 109,115 ---- hw_regs_t hw; ide_hwif_t *hwif; ! *(volatile unsigned char *)ABWCR &= ~(1<<3); memset(&hw,0,sizeof(hw)); ide_setup_ports(&hw, IDE_BASE, (int *)offsets, IDE_CTRL, 0, NULL,IDE_IRQ); *************** *** 125,131 **** { printk("%s at 0x%08x-0x%08x,0x%08x on irq %d", name, (unsigned int)hw->io_ports[IDE_DATA_OFFSET], ! (unsigned int)hw->io_ports[IDE_DATA_OFFSET]+7, (unsigned int)hw->io_ports[IDE_CONTROL_OFFSET], hw->irq); } --- 133,139 ---- { printk("%s at 0x%08x-0x%08x,0x%08x on irq %d", name, (unsigned int)hw->io_ports[IDE_DATA_OFFSET], ! (unsigned int)hw->io_ports[IDE_DATA_OFFSET]+15, (unsigned int)hw->io_ports[IDE_CONTROL_OFFSET], hw->irq); } ********* eCos へのパッチ *********** Index: packages/hal/h8300/aki3068net/current/include/platform.inc =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/include/platform.inc,v retrieving revision 1.13 diff -r1.13 platform.inc 108a109,126 > #if (CYGINT_HAL_PLF_IF_IDE != 0 &&) > #if ((0x00800000 <= CYGHWR_HAL_IDE_REGISTER) && \ > (CYGHWR_HAL_IDE_REGISTER <= 0x009FFFFF)) > INIT_REGS_DATA(CYGARC_CSCR,0x1f) > #endif > #if ((0x00A00000 <= CYGHWR_HAL_IDE_REGISTER) && \ > (CYGHWR_HAL_IDE_REGISTER <= 0x00BFFFFF)) > INIT_REGS_DATA(CYGARC_CSCR,0x2f) > #endif > #if ((0x00C00000 <= CYGHWR_HAL_IDE_REGISTER) && \ > (CYGHWR_HAL_IDE_REGISTER <= 0x00DFFFFF)) > INIT_REGS_DATA(CYGARC_CSCR,0x4f) > #endif > #if ((0x00E00000 <= CYGHWR_HAL_IDE_REGISTER) && \ > (CYGHWR_HAL_IDE_REGISTER <= 0x00FFFFFF)) > INIT_REGS_DATA(CYGARC_CSCR,0x8f) > #endif > #endif