From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yoshinori Sato Subject: Re: H8/300 target support patch Date: Fri, 20 Feb 2004 21:28:24 +0900 Sender: linux-ide-owner@vger.kernel.org Message-ID: References: <1077022554.1080.7.camel@gaston> <200402191734.49496.bzolnier@elka.pw.edu.pl> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Fri_Feb_20_21:28:24_2004-1" Return-path: Received: from p062096.ppp.asahi-net.or.jp ([221.113.62.96]:19704 "EHLO mitou.ysato.dip.jp") by vger.kernel.org with ESMTP id S261163AbUBTM23 (ORCPT ); Fri, 20 Feb 2004 07:28:29 -0500 In-Reply-To: <200402191734.49496.bzolnier@elka.pw.edu.pl> List-Id: linux-ide@vger.kernel.org To: Bartlomiej Zolnierkiewicz Cc: Benjamin Herrenschmidt , linux-ide@vger.kernel.org --Multipart_Fri_Feb_20_21:28:24_2004-1 Content-Type: text/plain; charset=US-ASCII At Thu, 19 Feb 2004 17:34:49 +0100, Bartlomiej Zolnierkiewicz wrote: > > > Hi, > > Can you send updated patch? > I am lost in incremental changes. :-) > > Thanks. > Difference with linux-2.6.3. -- Yoshinori Sato --Multipart_Fri_Feb_20_21:28:24_2004-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="linux-2.6.3-h8300-ide.diff" Content-Transfer-Encoding: 7bit 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 2003-08-27 22:59:37.000000000 +0900 @@ -0,0 +1,3 @@ +obj-$(CONFIG_H8300H_H8MAX) := h8max_ide.o +obj-$(CONFIG_H8300H_AKI3068NET) := aki3068_ide.o +obj-m := diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/h8300/aki3068_ide.c linux-2.6.3-h8300/drivers/ide/h8300/aki3068_ide.c --- linux-2.6.3/drivers/ide/h8300/aki3068_ide.c 1970-01-01 09:00:00.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/h8300/aki3068_ide.c 2004-02-20 18:11:36.000000000 +0900 @@ -0,0 +1,72 @@ +/****************************************************************************/ +/* + * linux/drivers/ide/h8300/aki3068_ide.c + * aki3068net IDE I/F support + * + * Copyright (C) 2003 Yoshinori Sato + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + * + */ +/****************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "h8_ide_iops.h" + +/* IDE I/F configuration */ +#define IDE_BASE CONFIG_H8300_IDE_BASE +#define IDE_CTRL CONFIG_H8300_IDE_ALT +#define IDE_IRQ (EXT_IRQ0 + CONFIG_H8300_IDE_IRQNO) + +#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 + +static void __init h8300_ide_ports(hw_regs_t *hw, unsigned long ioaddr) +{ + hw->io_ports[IDE_DATA_OFFSET] = ioaddr + IDE_DATA; + hw->io_ports[IDE_ERROR_OFFSET] = ioaddr + IDE_ERROR; + hw->io_ports[IDE_NSECTOR_OFFSET] = ioaddr + IDE_NSECTOR; + hw->io_ports[IDE_SECTOR_OFFSET] = ioaddr + IDE_SECTOR; + hw->io_ports[IDE_LCYL_OFFSET] = ioaddr + IDE_LCYL; + hw->io_ports[IDE_HCYL_OFFSET] = ioaddr + IDE_HCYL; + hw->io_ports[IDE_SELECT_OFFSET] = ioaddr + IDE_SELECT; + hw->io_ports[IDE_STATUS_OFFSET] = ioaddr + IDE_STATUS; +} + +void __init h8300_ide_init(void) +{ + hw_regs_t hw; + ide_hwif_t *hwif; + volatile unsigned char *abwcr = (volatile unsigned char *)ABWCR; + volatile unsigned char *cscr = (volatile unsigned char *)CSCR; + *abwcr &= ~((1 << ((IDE_BASE >> 21) & 7)) | (1 << ((IDE_CTRL >> 21) & 7))); + *cscr |= (1 << ((IDE_BASE >> 21) & 7)) | (1 << ((IDE_CTRL >> 21) & 7)) | 0x0f; + + memset(&hw,0,sizeof(hw)); + + h8300_ide_ports(&hw, IDE_BASE); + hw.io_ports[IDE_CONTROL_OFFSET] = IDE_CTRL; + hw.irq = IDE_IRQ; + + if (ide_register_hw(&hw, &hwif) != -1) + h8300_hwif_iops(hwif); +} diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/h8300/h8_ide_iops.h linux-2.6.3-h8300/drivers/ide/h8300/h8_ide_iops.h --- linux-2.6.3/drivers/ide/h8300/h8_ide_iops.h 1970-01-01 09:00:00.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/h8300/h8_ide_iops.h 2004-02-20 17:40:15.000000000 +0900 @@ -0,0 +1,66 @@ +/* H8/300 IDE I/F I/O operations */ + +#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; +} diff -X .exclude-diff -Nru linux-2.6.3/drivers/ide/h8300/h8max_ide.c linux-2.6.3-h8300/drivers/ide/h8300/h8max_ide.c --- linux-2.6.3/drivers/ide/h8300/h8max_ide.c 1970-01-01 09:00:00.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/h8300/h8max_ide.c 2004-02-20 18:11:36.000000000 +0900 @@ -0,0 +1,67 @@ +/****************************************************************************/ +/* + * linux/drivers/ide/h8300/h8max_ide.c + * H8MAX IDE Interface support + * + * Copyright (C) 2003 Yoshinori Sato + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive for + * more details. + * + */ +/****************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "h8_ide_iops.h" + +/* IDE I/F configuration */ +#define IDE_BASE 0x200000 +#define IDE_CTRL 0x60000c +#define IDE_IRQ EXT_IRQ5 + +#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 + +static void __init h8300_ide_ports(hw_regs_t *hw, unsigned long ioaddr) +{ + hw->io_ports[IDE_DATA_OFFSET] = ioaddr + IDE_DATA; + hw->io_ports[IDE_ERROR_OFFSET] = ioaddr + IDE_ERROR; + hw->io_ports[IDE_NSECTOR_OFFSET] = ioaddr + IDE_NSECTOR; + hw->io_ports[IDE_SECTOR_OFFSET] = ioaddr + IDE_SECTOR; + hw->io_ports[IDE_LCYL_OFFSET] = ioaddr + IDE_LCYL; + hw->io_ports[IDE_HCYL_OFFSET] = ioaddr + IDE_HCYL; + hw->io_ports[IDE_SELECT_OFFSET] = ioaddr + IDE_SELECT; + hw->io_ports[IDE_STATUS_OFFSET] = ioaddr + IDE_STATUS; +} + +void __init h8300_ide_init(void) +{ + hw_regs_t hw; + ide_hwif_t *hwif; + + memset(&hw,0,sizeof(hw)); + + h8300_ide_ports(&hw, IDE_BASE); + hw.io_ports[IDE_CONTROL_OFFSET] = IDE_CTRL; + hw.irq = IDE_IRQ; + + if (ide_register_hw(&hw, &hwif) != -1) + 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; - + int ide_regs_gap; BUG_ON(in_interrupt()); BUG_ON(irqs_disabled()); @@ -1102,10 +1102,11 @@ 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.c linux-2.6.3-h8300/drivers/ide/ide.c --- linux-2.6.3/drivers/ide/ide.c 2004-02-20 01:08:02.000000000 +0900 +++ linux-2.6.3-h8300/drivers/ide/ide.c 2004-02-20 17:46:52.000000000 +0900 @@ -2239,6 +2239,12 @@ pnpide_init(1); } #endif /* CONFIG_BLK_DEV_IDEPNP */ +#if defined(__H8300H__) || defined(__H8300S__) + { + extern void h8300_ide_init(void); + h8300_ide_init(); + } +#endif /* defined(__H8300H__) || defined(__H8300S__) */ } /* --Multipart_Fri_Feb_20_21:28:24_2004-1--