From: michael Date: Mon, 11 Feb 2008 22:55:40 +0100 Subject: [U-Boot-Users] [PATCH] ide arm support In-Reply-To: <20080211213008.GA11994@game.jcrosoft.org> References: <47B0B2D5.5040000@gandalf.sssup.it> <20080211213008.GA11994@game.jcrosoft.org> Message-ID: <47B0C45C.4000609@gandalf.sssup.it> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Jean-Christophe PLAGNIOL-VILLARD wrote: > On 21:40 Mon 11 Feb , michael wrote: > >> Add ide support to the arm cpu. Tested on arm little endian >> machine. Include #define __io in config board file. >> >> Signed-off-by: Michael Trimarchi >> --- >> >> diff --git a/common/cmd_ide.c b/common/cmd_ide.c >> index c38be4f..e507c15 100644 >> --- a/common/cmd_ide.c >> +++ b/common/cmd_ide.c >> @@ -934,7 +934,14 @@ output_data(int dev, ulong *sect_buf, int words) >> static void >> output_data(int dev, ulong *sect_buf, int words) >> { >> +#ifndef __ARM__ >> outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1); >> +#else >> + int i = words; >> > Why do you initialise "i" with words and re-initialize it at 0 in for? > Is a mistake >> + u16 *buf = (u16 *) sect_buf; >> + for (i = 0; i < (words << 1); i++, buf++) >> > ^ > not needed space > ok >> + outw(ATA_CURR_BASE(dev) + ATA_DATA_REG, buf); >> +#endif >> } >> #endif /* __PPC__ */ >> >> @@ -992,7 +999,14 @@ input_data(int dev, ulong *sect_buf, int words) >> static void >> input_data(int dev, ulong *sect_buf, int words) >> { >> +#ifndef __ARM__ >> insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1); >> +#else >> + int i; >> + volatile u16 *buf = (u16 *) sect_buf; >> + for(i = 0; i < (words << 1); i++, buf++) >> + *buf = inw(ATA_CURR_BASE(dev) + ATA_DATA_REG); >> > Why don"t you use readw and writew? > I'm not sure if inw resolve endianes issues in arm bigendian regards Michael