Skip to contentSkip to conversation

cmd_ide: Convert to [read,write][b,w]

PATCH New Marek Vasut 2 participants 2 messages Jul 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cmd_ide: Convert to [read,write][b,w]

---
 common/cmd_ide.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
common/cmd_ide.c +13 -9
index 093ca9f..9c4b250 100644
@@ -161,8 +161,8 @@ static uchar ide_wait  (int dev, ulong t);
 
 #define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
 
-static void input_data(int dev, ulong *sect_buf, int words);
-static void output_data(int dev, ulong *sect_buf, int words);
+static void input_data(int dev, uint16_t *sect_buf, int words);
+static void output_data(int dev, uint16_t *sect_buf, int words);
 static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
 
 #ifndef CONFIG_SYS_ATA_PORT_ADDR
@@ -526,7 +526,7 @@ __ide_outb(int dev, int port, unsigned char val)
 {
 	debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
 		dev, port, val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
-	outb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
+	writeb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
 }
 void ide_outb (int dev, int port, unsigned char val)
 		__attribute__((weak, alias("__ide_outb")));
@@ -535,7 +535,7 @@ unsigned char inline
 __ide_inb(int dev, int port)
 {
 	uchar val;
-	val = inb((ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
+	val = readb((ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
 	debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
 		dev, port, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)), val);
 	return val;
@@ -937,9 +937,11 @@ output_data(int dev, ulong *sect_buf, int words)
 }
 #else	/* ! __PPC__ */
 static void
-output_data(int dev, ulong *sect_buf, int words)
+output_data(int dev, uint16_t *sect_buf, int words)
 {
-	outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
+	int i;
+	for (i = 0; i < (words << 1); i++)
+		writew(sect_buf[i], ATA_CURR_BASE(dev)+ATA_DATA_REG);
 }
 #endif	/* __PPC__ */
 
@@ -995,9 +997,11 @@ input_data(int dev, ulong *sect_buf, int words)
 }
 #else	/* ! __PPC__ */
 static void
-input_data(int dev, ulong *sect_buf, int words)
+input_data(int dev, uint16_t *sect_buf, int words)
 {
-	insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1);
+	int i;
+	for (i = 0; i < (words << 1); i++)
+		sect_buf[i] = readw(ATA_CURR_BASE(dev)+ATA_DATA_REG);
 }
 
 #endif	/* __PPC__ */
@@ -1115,7 +1119,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)
 		return;
 #endif
 
-	input_swap_data (device, iobuf, ATA_SECTORWORDS);
+	input_swap_data (device, (uint16_t *)iobuf, ATA_SECTORWORDS);
 
 	ident_cpy ((unsigned char*)dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision));
 	ident_cpy ((unsigned char*)dev_desc->vendor, iop->model, sizeof(dev_desc->vendor));
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/2 cmd_ide: Convert to [read,write][b,w]

Dear Marek Vasut,

Quoted 4 lines · In message <[email protected]> you wrote:
---
 common/cmd_ide.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

It's not really helpful to resend old patches, without reference and without keeping mail threads in place. Please don't.

I tend to reject your patch in favour of Albert Aribaud's one, see
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/81117

Do you have any strong argument why your patch would be better?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Committee, n.:  A group of men who individually can do nothing but as
a group decide that nothing can be done.                 - Fred Allen