Skip to contentSkip to conversation

ide arm support

PATCH New michael 3 participants 7 messages Feb 11, 2008 – Feb 12, 2008

lore
Share & tools
lore

michael

author
#0 lore raw

PATCH 1/1 ide arm support

Add ide support to the arm cpu. Tested on arm little endian machine. Include #define __io in config board file.

---

common/cmd_ide.c +14 -0
index c38be4f..e507c15 100644
@@ -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__ */
lib_arm/board.c +6 -0
index 7e7a282..ddf4d5f 100644
@@ -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 ();
#1 lore raw

PATCH 1/1 ide arm support

Quoted 11 lines · michael

Add ide support to the arm cpu. Tested on arm little endian machine. Include #define __io in config board file.

---

common/cmd_ide.c +0 -0
index c38be4f..e507c15 100644

common/cmd_ide.c output_data(int dev, ulong *sect_buf, int words) · line 940

Quoted 7 lines
common/cmd_ide.c +3 -0
@@ -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?

common/cmd_ide.c output_data(int dev, ulong *sect_buf, int words) · line 942

Quoted 2 lines
common/cmd_ide.c +2 -0
+	u16 *buf = (u16 *) sect_buf;
+	for (i = 0; i < (words << 1); i++, buf++) 
                                                 ^

not needed space

Quoted 6 lines
common/cmd_ide.c +2 -0
+		outw(ATA_CURR_BASE(dev) + ATA_DATA_REG, buf);
+#endif
 }
 #endif	/* __PPC__ */
 

common/cmd_ide.c input_data(int dev, ulong *sect_buf, int words) · line 1008

Quoted 10 lines
common/cmd_ide.c +6 -0
@@ -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?

Quoted 31 lines
common/cmd_ide.c +1 -0
+#endif
 }
 
 #endif	/* __PPC__ */
lib_arm/board.c +6 -1
index 7e7a282..ddf4d5f 100644
@@ -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 at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

#2 lore raw

PATCH 1/1 ide arm support

Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD

common/cmd_ide.c output_data(int dev, ulong *sect_buf, int words) · line 940

Quoted 10 lines · michael
common/cmd_ide.c +3 -0
@@ -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

author
#3 lore raw

PATCH 1/1 ide arm support

Hi

Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · michael

common/cmd_ide.c output_data(int dev, ulong *sect_buf, int words) · line 941

Quoted 12 lines
common/cmd_ide.c +3 -0
@@ -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?

Quoted 5 lines

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

#4 lore raw

PATCH 1/1 ide arm support

Quoted 1 line · michael

The code is fill with ugly ifdef.

That probably shouldn't be read as permission to add a few more...

Quoted 1 line

Can you suggest me something better?

Implement outsw for arm?

ladis

author
#5 lore raw

PATCH 1/1 ide arm support

Hi,

Quoted 8 lines · michael
Quoted 3 lines

The code is fill with ugly ifdef.

That probably shouldn't be read as permission to add a few more...

:(, ok

Quoted 8 lines
Quoted 2 lines

Can you suggest me something better?

Implement outsw for arm?

ladis

I will clean my patch and repost

Regards Michael

author
#6 lore raw

PATCH 1/1 ide arm support

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 6 lines · michael

Add ide support to the arm cpu. Tested on arm little endian machine. Include #define __io in config board file.

---

Quoted 15 lines

common/cmd_ide.c output_data(int dev, ulong *sect_buf, int words) · line 941

Quoted 13 lines
common/cmd_ide.c +3 -0
index c38be4f..e507c15 100644
@@ -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

Quoted 6 lines

common/cmd_ide.c output_data(int dev, ulong *sect_buf, int words) · line 947

Quoted 3 lines
common/cmd_ide.c +2 -0
+	u16 *buf = (u16 *) sect_buf;
+	for (i = 0; i < (words << 1); i++, buf++) 
 
                                                 ^

not needed space

ok

Quoted 5 lines
Quoted 5 lines
common/cmd_ide.c +2 -0
+		outw(ATA_CURR_BASE(dev) + ATA_DATA_REG, buf);
+#endif
 }

#endif /* __PPC__ */

Quoted 14 lines

common/cmd_ide.c input_data(int dev, ulong *sect_buf, int words) · line 1009

Quoted 12 lines
common/cmd_ide.c +6 -0
@@ -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