From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yoshinori Sato Subject: Re: H8/300 target support patch Date: Mon, 23 Feb 2004 01:30:05 +0900 Sender: linux-ide-owner@vger.kernel.org Message-ID: References: <200402201625.42842.bzolnier@elka.pw.edu.pl> <200402201942.00232.bzolnier@elka.pw.edu.pl> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from p062096.ppp.asahi-net.or.jp ([221.113.62.96]:54507 "EHLO mitou.ysato.dip.jp") by vger.kernel.org with ESMTP id S261689AbUBVQaJ (ORCPT ); Sun, 22 Feb 2004 11:30:09 -0500 In-Reply-To: <200402201942.00232.bzolnier@elka.pw.edu.pl> List-Id: linux-ide@vger.kernel.org To: Bartlomiej Zolnierkiewicz Cc: Benjamin Herrenschmidt , linux-ide@vger.kernel.org At Fri, 20 Feb 2004 19:42:00 +0100, Bartlomiej Zolnierkiewicz wrote: > > On Friday 20 of February 2004 18:58, Yoshinori Sato wrote: > > > > - added #if !defined(__H8300H__) to ide-proc.c > > > (only place where ->OUTL is used, ->INL is unused in generic IDE code) > > > > "__H8300S__" becomes the same condition, too. > > Oh yes, it should be CONFIG_H8300. > > > > - __ide_outl() and __ide_inl() removed > > > - redundant includes removed > > > - init driver through initcall (so no need to make changes in ide.c) > > > > It seems to have been overwritten with default_hwif_iops > > setting of h8300_hwif_iops in module_init. > > Yep, h8300_ide_init() still should be called from ide.c. > (because ide_register_hw() checks "initialization" flag etc.) > I corrected it to initialize it with ide_init_default_hwifs. A correction of ide.c becomes needless. Because h8300-iops.c might change every a target, I arranged with the other directory. diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/Makefile linux-2.6.3-h8300/drivers/ide/Makefile --- linux-2.6.3/drivers/ide/Makefile 2004-02-20 01:08:02.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/Makefile 2004-02-20 17:42:40.000000000 +0900 @@ -46,5 +46,5 @@ obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ +obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ h8300/ obj-$(CONFIG_BLK_DEV_HD) += legacy/ diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/h8300/Makefile linux-2.6.3-h8300/drivers/ide/h8300/Makefile --- linux-2.6.3/drivers/ide/h8300/Makefile 1970-01-01 09:00:00.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/h8300/Makefile 2004-02-23 00:58:43.000000000 +0900 @@ -0,0 +1,2 @@ +obj-$(CONFIG_H8300H_H8MAX) := h8300-iops.o +obj-$(CONFIG_H8300H_AKI3068NET) := h8300-iops.o diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/h8300/h8300-iops.c linux-2.6.3-h8300/drivers/ide/h8300/h8300-iops.c --- linux-2.6.3/drivers/ide/h8300/h8300-iops.c 1970-01-01 09:00:00.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/h8300/h8300-iops.c 2004-02-23 00:53:24.000000000 +0900 @@ -0,0 +1,107 @@ +/* H8/300 IDE I/F I/O operations */ + +/* + support target + + AE-3068/AE-3069 + IDE Expand + H8MAX +*/ + +#include +#include +#include +#include + +static void __ide_outb(u8 d, unsigned long a) +{ + outb(d,a); +} + +static void __ide_outbsync(ide_drive_t *drive, u8 d, unsigned long a) +{ + outb(d,a); +} + +static u8 __ide_inb(unsigned long a) +{ + return inb(a); +} + +static void __ide_outw(u16 d, unsigned long a) +{ + return outw(d,a); +} + +static u16 __ide_inw(unsigned long a) +{ + return inw(a); +} + +static void __ide_outl(u32 d, unsigned long a) +{ +} + +static u32 __ide_inl(unsigned long a) +{ + return 0xffffffffUL; +} + +static void __ide_outsw(unsigned long addr, void *buf, u32 len) +{ + unsigned short *bp = (unsigned short *)buf; + while(len--) + outw(*bp++,addr); +} + +static void __ide_insw(unsigned long addr, void *buf, u32 len) +{ + unsigned short *bp = (unsigned short *)buf; + while(len--) + *bp++ = inw(addr); +} + +static void __init h8300_hwif_iops(ide_hwif_t *hwif) +{ + hwif->OUTB = __ide_outb; + hwif->OUTBSYNC = __ide_outbsync; + hwif->OUTW = __ide_outw; + hwif->OUTL = __ide_outl; + hwif->OUTSW = __ide_outsw; + hwif->OUTSL = NULL; + hwif->INB = __ide_inb; + hwif->INW = __ide_inw; + hwif->INL = __ide_inl; + hwif->INSW = __ide_insw; + hwif->INSL = NULL; +} + +void __init ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, + unsigned long ctrl_port, int *irq) +{ + hw->io_ports[IDE_DATA_OFFSET] = data_port + IDE_DATA; + hw->io_ports[IDE_ERROR_OFFSET] = data_port + IDE_ERROR; + hw->io_ports[IDE_NSECTOR_OFFSET] = data_port + IDE_NSECTOR; + hw->io_ports[IDE_SECTOR_OFFSET] = data_port + IDE_SECTOR; + hw->io_ports[IDE_LCYL_OFFSET] = data_port + IDE_LCYL; + hw->io_ports[IDE_HCYL_OFFSET] = data_port + IDE_HCYL; + hw->io_ports[IDE_SELECT_OFFSET] = data_port + IDE_SELECT; + hw->io_ports[IDE_STATUS_OFFSET] = data_port + IDE_STATUS; + hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; + hw->irq = *irq; +} + +void __init ide_init_default_hwifs(void) +{ + hw_regs_t hw; + ide_hwif_t *hwif; + int irq = IDE_IRQ; + + H8300_IDE_SETUP(); + + memset(&hw,0,sizeof(hw)); + + ide_init_hwif_ports(&hw, IDE_BASE,IDE_CTRL,&irq); + ide_register_hw(&hw, &hwif); + h8300_hwif_iops(hwif); +} + diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/ide-probe.c linux-2.6.3-h8300/drivers/ide/ide-probe.c --- linux-2.6.3/drivers/ide/ide-probe.c 2004-02-11 23:54:31.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/ide-probe.c 2004-02-20 17:45:25.000000000 +0900 @@ -983,7 +983,7 @@ unsigned int index; ide_hwgroup_t *hwgroup; ide_hwif_t *match = NULL; - + unsigned int ide_regs_gap; /* needed for H8/300 */ BUG_ON(in_interrupt()); BUG_ON(irqs_disabled()); @@ -1102,11 +1102,12 @@ spin_unlock_irq(&ide_lock); } + ide_regs_gap = hwif->io_ports[IDE_ERROR_OFFSET] - hwif->io_ports[IDE_DATA_OFFSET]; #if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__sparc__) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, hwif->io_ports[IDE_DATA_OFFSET], - hwif->io_ports[IDE_DATA_OFFSET]+7, + hwif->io_ports[IDE_DATA_OFFSET] + ide_regs_gap * 8 - 1, hwif->io_ports[IDE_CONTROL_OFFSET], hwif->irq); #elif defined(__sparc__) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name, diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/ide-proc.c linux-2.6.3-h8300/drivers/ide/ide-proc.c --- linux-2.6.3/drivers/ide/ide-proc.c 2004-02-20 15:49:23.108548664 +0100 +++ linux-2.6.3-h8300/drivers/ide/ide-proc.c 2004-02-20 15:50:25.580051552 +0100 @@ -239,8 +239,7 @@ static int proc_ide_write_config } #endif /* CONFIG_BLK_DEV_IDEPCI */ } else { /* not pci */ -#if !defined(__mc68000__) && !defined(CONFIG_APUS) - +#if !defined(__mc68000__) && !defined(CONFIG_APUS) && !defined(__H8300H__) && !defined(__H8300S__) /* * Geert Uytterhoeven * @@ -268,7 +267,7 @@ static int proc_ide_write_config case 8: hwif->OUTL(val, reg); break; } -#endif /* !__mc68000__ && !CONFIG_APUS */ +#endif /* !__mc68000__ && !CONFIG_APUS !__H8300H__ && !__H8300S__ */ } } } diff -X .exclude-diff -Nru linux-2.6.3/include/asm-h8300/ide.h linux-2.6.3-h8300/include/asm-h8300/ide.h --- linux-2.6.3/include/asm-h8300/ide.h 19 Feb 2004 17:43:11 -0000 1.5 +++ linux-2.6.3-h8300/include/asm-h8300/ide.h 22 Feb 2004 16:15:49 -0000 @@ -16,19 +16,26 @@ #ifdef __KERNEL__ /****************************************************************************/ -void h8300_ide_print_resource(char *name, hw_regs_t *hw); -static inline int ide_default_irq(unsigned long base) { return 0; }; -static inline unsigned long ide_default_io_base(int index) { return 0; }; +#define H8300_IDE_DEFINE +#include +#undef H8300_IDE_DEFINE -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) +static __inline__ int ide_default_irq(unsigned long base) { -} + return IDE_IRQ; +}; - -static inline void ide_init_default_hwifs(void) +static __inline__ unsigned long ide_default_io_base(int index) { -} + if (index == 0) + return IDE_BASE; + else + return 0; +}; + +void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, + unsigned long ctrl_port, int *irq); +void ide_init_default_hwifs(void); #define MAX_HWIFS 1 -- Yoshinori Sato