[U-Boot-Users] [PATCH] ide arm support

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 trimarchimichael@yahoo.it ---
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; + u16 *buf = (u16 *) sect_buf; + for (i = 0; i < (words << 1); i++, buf++) + 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); +#endif }
#endif /* __PPC__ */ diff --git a/lib_arm/board.c b/lib_arm/board.c index 7e7a282..ddf4d5f 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -435,6 +435,12 @@ extern void dm644x_eth_set_mac_addr (const u_int8_t *addr); reset_phy(); #endif #endif + +#if defined(CONFIG_CMD_IDE) + puts("IDE: "); + ide_init(); +#endif + /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) { main_loop ();

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 trimarchimichael@yahoo.it
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?
- u16 *buf = (u16 *) sect_buf;
- for (i = 0; i < (words << 1); i++, buf++)
^ not needed space
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?
+#endif }
#endif /* __PPC__ */ diff --git a/lib_arm/board.c b/lib_arm/board.c index 7e7a282..ddf4d5f 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -435,6 +435,12 @@ extern void dm644x_eth_set_mac_addr (const u_int8_t *addr); reset_phy(); #endif #endif
+#if defined(CONFIG_CMD_IDE)
- puts("IDE: ");
- ide_init();
+#endif
- /* main_loop() can return to retry autoboot, if so just run it again. */ for (;;) { main_loop ();
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users

On Mon, Feb 11, 2008 at 10:30:08PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
On 21:40 Mon 11 Feb , michael wrote:
--- 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?
And why do you need this ungly #ifdef at all?
ladis

Hi
On Mon, Feb 11, 2008 at 10:30:08PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
On 21:40 Mon 11 Feb , michael wrote:
--- 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?
And why do you need this ungly #ifdef at all?
ladis
The code is fill with ugly ifdef. Can you suggest me something better?
Michael

Hi,
On Mon, Feb 11, 2008 at 10:58:23PM +0100, michael wrote:
The code is fill with ugly ifdef.
That probably shouldn't be read as permission to add a few more...
:(, ok
Can you suggest me something better?
Implement outsw for arm?
ladis
I will clean my patch and repost
Regards Michael

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 trimarchimichael@yahoo.it
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
participants (3)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Ladislav Michl
-
michael