All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux-ide@vger.kernel.org
Subject: Re: H8/300 target support patch
Date: Fri, 20 Feb 2004 01:12:34 +0900	[thread overview]
Message-ID: <m27jyjhwul.wl%ysato@users.sourceforge.jp> (raw)
In-Reply-To: <1077022554.1080.7.camel@gaston>

At Tue, 17 Feb 2004 23:55:54 +1100,
Benjamin Herrenschmidt wrote:
> 
> 
> > > Your IDE bus is flipped backward ? The next one who do that should
> > > lose all rights to do any kind of HW design... Or is it a big endian
> > > platform ? In this case, use normal flipping inw/outw for IOs and
> > > non-flipping for stream IOs (insw/outsw)
> > 
> > This architecture is big endian.
> 
> A big endian architecture needs the standard inx/outx macros to
> be byteswapped, but _not_ the insw/outsw. That should be all 
> done properly from the standard macros in your asm/io.h, you
> should _not_ have to byteswap normal transfers.

I appreciated incorrectly.
 
> > It was my misunderstanding that did not use asm/io.h.
> > It is the patch which it corrected to use it.
> > h8300/h8_ide_iops.h becomes needless.
> 
> Ben.
> 
> 

I corrected it.

--- aki3068_ide.c.orig	2004-02-16 22:48:00.000000000 +0900
+++ aki3068_ide.c	2004-02-20 00:03:49.000000000 +0900
@@ -40,7 +40,7 @@
 #define IDE_SELECT	0x0C
 #define IDE_STATUS	0x0E
 
-static void h8300_ide_ports(hw_regs_t *hw, unsigned long ioaddr)
+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;
@@ -70,12 +70,3 @@
 	if (ide_register_hw(&hw, &hwif) != -1)
 		h8300_hwif_iops(hwif);
 }
-
-void __init h8300_ide_print_resource(char *name, hw_regs_t *hw)
-{
-	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);
-}
--- h8max_ide.c.orig	2004-02-17 19:45:46.000000000 +0900
+++ h8max_ide.c	2004-02-19 22:56:41.000000000 +0900
@@ -39,7 +39,7 @@
 #define IDE_SELECT	0x0C
 #define IDE_STATUS	0x0E
 
-static void h8300_ide_ports(hw_regs_t *hw, unsigned long ioaddr)
+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;
@@ -65,12 +65,3 @@
 	if (ide_register_hw(&hw, &hwif) != -1)
 		h8300_hwif_iops(hwif);
 }
-
-void __init h8300_ide_print_resource(char *name, hw_regs_t *hw)
-{
-	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);
-}
--- h8_ide_iops.h.orig	2004-02-19 23:54:06.000000000 +0900
+++ h8_ide_iops.h	2004-02-19 23:54:58.000000000 +0900
@@ -1,28 +1,30 @@
+/* H8/300 IDE I/F I/O operations */
+
+#include <asm/io.h>
+
 static void __ide_outb(u8 d, unsigned long a)
 {
-	*(unsigned short *)a = d;
+	outb(d,a); 
 }
 
 static void __ide_outbsync(ide_drive_t *drive, u8 d, unsigned long a)
 {
-	*(unsigned short *)a = d;
+	outb(d,a); 
 }
 
 static u8 __ide_inb(unsigned long a)
 {
-	return *(unsigned short *)a;
+	return inb(a);
 }
 
 static void __ide_outw(u16 d, unsigned long a)
 {
-	*(unsigned short *)a = (d << 8) | (d >> 8);
+	outw(d,a);
 }
 
 static u16 __ide_inw(unsigned long a)
 {
-	unsigned short d;
-	d = *(unsigned short *)a;
-	return (d << 8) | (d >> 8);
+	return inw(a);
 }
 
 static void __ide_outl(u32 d, unsigned long a)
@@ -36,27 +38,19 @@
 
 static void __ide_outsw(unsigned long addr, void *buf, u32 len)
 {
-	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);
-	}
+	while(len--)
+		outw(*bp++,addr);
 }
 
 static void __ide_insw(unsigned long addr, void *buf, u32 len)
 {
-	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);
-	}
+	while(len--)
+		*bp++ = inw(addr);
 }
 
-static void h8300_hwif_iops(ide_hwif_t *hwif)
+static void __init h8300_hwif_iops(ide_hwif_t *hwif)
 {
 	hwif->OUTB 	= __ide_outb;
 	hwif->OUTBSYNC	= __ide_outbsync;

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

  reply	other threads:[~2004-02-19 16:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-15  6:05 H8/300 target support patch Yoshinori Sato
2004-02-15 14:40 ` Bartlomiej Zolnierkiewicz
2004-02-16 16:09   ` Yoshinori Sato
2004-02-16 16:40     ` Bartlomiej Zolnierkiewicz
2004-02-16 22:07       ` Benjamin Herrenschmidt
2004-02-16 22:09     ` Benjamin Herrenschmidt
2004-02-17 11:33       ` Yoshinori Sato
2004-02-17 12:55         ` Benjamin Herrenschmidt
2004-02-19 16:12           ` Yoshinori Sato [this message]
2004-02-19 16:34             ` Bartlomiej Zolnierkiewicz
2004-02-20 12:28               ` Yoshinori Sato
2004-02-20 15:25                 ` Bartlomiej Zolnierkiewicz
2004-02-20 17:58                   ` Yoshinori Sato
2004-02-20 18:42                     ` Bartlomiej Zolnierkiewicz
2004-02-22 16:30                       ` Yoshinori Sato
2004-02-22 17:08                         ` Bartlomiej Zolnierkiewicz
2004-02-22 17:28                           ` Bartlomiej Zolnierkiewicz
2004-02-26 16:46                             ` Yoshinori Sato
2004-02-26 19:26                               ` Bartlomiej Zolnierkiewicz
2004-02-28 17:02                                 ` Yoshinori Sato
2004-02-28 17:55                                   ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m27jyjhwul.wl%ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=benh@kernel.crashing.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.