Skip to contentSkip to conversation

ARM: add IDE init to lib_arm/board.c Part 1/1

PATCH New Stefan Althoefer 3 participants 13 messages Dec 4, 2008 – Dec 17, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

[PATCH] ARM: add IDE init to lib_arm/board.c

This patch adds ide_init() to the arm boot process.

The patch is against "latest" u-boot git-repository

Please (still) be patient if style of submission or patches are offending.

----

lib_arm/board.c renamed from /lib_arm/board.c +5 -0
diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */
+
 #ifdef BOARD_LATE_INIT
 	board_late_init ();
 #endif
#1 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

Quoted 17 lines · Stefan Althoefer

[PATCH] ARM: add IDE init to lib_arm/board.c

This patch adds ide_init() to the arm boot process.

The patch is against "latest" u-boot git-repository

Please (still) be patient if style of submission or patches are offending.

----

diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c

lib_arm/board.c extern void davinci_eth_set_mac_addr (co · line 447

Quoted 7 lines
lib_arm/board.c renamed from /lib_arm/board.c +4 -0
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */

are you sure it will work?

Best Regards,
J.

#2 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines

diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c

lib_arm/board.c renamed from /lib_arm/board.c +0 -0
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
Quoted 8 lines

lib_arm/board.c extern void davinci_eth_set_mac_addr (co · line 447

Quoted 4 lines
lib_arm/board.c renamed from /lib_arm/board.c +4 -0
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */

are you sure it will work?

Best Regards,
J.

On my board (Janz emPC-A400 with IXP425) it does. With some more patches to add IDE to this board.

What is your doubt?

If you see problems, drop this. I can also add IDE to board_late_init().

-- Stefan

#3 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

Quoted 21 lines · Stefan Althoefer
Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD

lib_arm/board.c extern void davinci_eth_set_mac_addr (co · line 448

Quoted 12 lines

diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c

lib_arm/board.c renamed from /lib_arm/board.c +4 -0
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */
 

are you sure it will work?

Quoted 3 lines

Best Regards,
J.

Quoted 7 lines

On my board (Janz emPC-A400 with IXP425) it does. With some more patches to add IDE to this board.

What is your doubt?

If you see problems, drop this. I can also add IDE to board_late_init().

I don't sure if the outsw/insw are implemented in arm.

Regards Michael

#4 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

Quoted 33 lines · michael
Quoted 23 lines · Stefan Althoefer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD

lib_arm/board.c extern void davinci_eth_set_mac_addr (co · line 449

Quoted 13 lines

diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c

lib_arm/board.c renamed from /lib_arm/board.c +4 -0
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */
 
 

are you sure it will work?

Quoted 4 lines

Best Regards,
J.

Quoted 8 lines

On my board (Janz emPC-A400 with IXP425) it does. With some more patches to add IDE to this board.

What is your doubt?

If you see problems, drop this. I can also add IDE to board_late_init().

Quoted 9 lines

I don't sure if the outsw/insw are implemented in arm.

Regards Michael
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Well, I'm not sure :( if the outsw/insw are implemented in arm.

Regards Michael

#5 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

Quoted 36 lines · michael
Quoted 35 lines · michael
Quoted 23 lines · Stefan Althoefer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD

lib_arm/board.c extern void davinci_eth_set_mac_addr (co · line 449

Quoted 13 lines

diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c

lib_arm/board.c renamed from /lib_arm/board.c +4 -0
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */
 
 

are you sure it will work?

Quoted 4 lines

Best Regards,
J.

Quoted 8 lines

On my board (Janz emPC-A400 with IXP425) it does. With some more patches to add IDE to this board.

What is your doubt?

If you see problems, drop this. I can also add IDE to board_late_init().

I don't sure if the outsw/insw are implemented in arm.

Quoted 8 lines
Quoted 7 lines

Regards Michael
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Well, I'm not sure :( if the outsw/insw are implemented in arm.

IIRC they are not. I'll check but in u-boot we do not have the asm implementtion.

Best Regards,
J.

#6 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

Quoted 44 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 43 lines · michael
Quoted 42 lines · michael
Quoted 23 lines · Stefan Althoefer
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD

lib_arm/board.c extern void davinci_eth_set_mac_addr (co · line 449

Quoted 13 lines

diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c

lib_arm/board.c renamed from /lib_arm/board.c +4 -0
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */
 
 

are you sure it will work?

Quoted 4 lines

Best Regards,
J.

Quoted 8 lines

On my board (Janz emPC-A400 with IXP425) it does. With some more patches to add IDE to this board.

What is your doubt?

If you see problems, drop this. I can also add IDE to board_late_init().

I don't sure if the outsw/insw are implemented in arm.

Regards Michael
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Quoted 6 lines
Quoted 1 line

Well, I'm not sure :( if the outsw/insw are implemented in arm.

IIRC they are not. I'll check but in u-boot we do not have the asm implementtion.

Best Regards,
J.

Indeed, I have patched ide.c so it does not use insw/outsw if compiled for my board. Refer to patch with msg-id <49384735.e5PYiIdAjpxLwq8V%[email protected]> to see what I did.

-- Stefan

#7 lore raw

PATCH 1/1 ARM: add IDE init to lib_arm/board.c Part 1/1

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 29 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Stefan Althoefer

[PATCH] ARM: add IDE init to lib_arm/board.c

This patch adds ide_init() to the arm boot process.

The patch is against "latest" u-boot git-repository

Please (still) be patient if style of submission or patches are offending.

----

diff -uprN u-boot-orig//lib_arm/board.c u-boot/lib_arm/board.c

lib_arm/board.c extern void davinci_eth_set_mac_addr (co · line 448

Quoted 8 lines
lib_arm/board.c renamed from /lib_arm/board.c +4 -0
@@ -441,6 +441,11 @@ extern void davinci_eth_set_mac_addr (co
 	}
 #endif
 
+#if defined(CONFIG_CMD_IDE)
+        puts("IDE:   ");
+        ide_init();
+#endif /* CONFIG_CMD_IDE */
 

are you sure it will work?

Quoted 8 lines

Best Regards,
J.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

I submit a patch series for ide support in ARM. I don't think that it will work

Michael

#8 lore raw

PATCH 1/1 IXP425: Improving print_cpuinfo code Part 1/1

[PATCH] IXP425: Improving print_cpuinfo code

The existing version of print_cpuinfo did read the processor ID and detects clock speed from this.

This is not correct, as the IXP425 has the ability to "downgrade" clock speed by using strapping resistors.

The improved code reads strapping information from register and corrects the actual clock speed. Both information are displayed.

The patch is against "latest" u-boot git-repository

Please (still) be patient if style of submission or patches are offending.

----

cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +44 -8
diff -uprN u-boot-orig//cpu/ixp/cpu.c u-boot/cpu/ixp/cpu.c
@@ -45,32 +45,68 @@ DECLARE_GLOBAL_DATA_PTR;
 int print_cpuinfo (void)
 {
 	unsigned long id;
+	unsigned long cfg_clk;
 	int speed = 0;
+	int model = 0;
 
 	asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id));
+	cfg_clk = *IXP425_EXP_CFG0 >> 21;
 
-	puts("CPU:   Intel IXP425 at ");
+	puts("CPU:   Intel IXP42X");
 	switch ((id & 0x000003f0) >> 4) {
 	case 0x1c:
-		loops_per_jiffy = 887467;
-		speed = 533;
+		model = 533;
+		switch (cfg_clk) {
+		case 0x1:
+			speed = 400;
+			break;
+		case 0x3:
+			speed = 266;
+			break;
+		default:
+			speed = 533;
+			break;
+		}
 		break;
 
 	case 0x1d:
-		loops_per_jiffy = 666016;
-		speed = 400;
+		model = 400;
+		switch (cfg_clk) {
+		case 0x3:
+			speed = 266;
+			break;
+		default:
+			speed = 400;
+			break;
+		}
 		break;
 
 	case 0x1f:
-		loops_per_jiffy = 442901;
+		model = 266;
 		speed = 266;
 		break;
 	}
 
+	/* FIXME: is there any need for the jiffies? */
+	switch (speed) {
+	case 266:
+		loops_per_jiffy = 442901;
+		break;
+	case 400:
+		loops_per_jiffy = 666016;
+		break;
+	case 533:
+		loops_per_jiffy = 887467;
+		break;
+	}
+
+	if (model)
+		printf("-%d", model);
+
 	if (speed)
-		printf("%d MHz\n", speed);
+		printf(" at %d MHz\n", speed);
 	else
-		puts("unknown revision\n");
+		puts(" unknown revision\n");
 
 	return 0;
 }
#9 lore raw

PATCH 1/1 IXP425: Improving print_cpuinfo code Part 1/1

Quoted 25 lines · Stefan Althoefer

[PATCH] IXP425: Improving print_cpuinfo code

The existing version of print_cpuinfo did read the processor ID and detects clock speed from this.

This is not correct, as the IXP425 has the ability to "downgrade" clock speed by using strapping resistors.

The improved code reads strapping information from register and corrects the actual clock speed. Both information are displayed.

The patch is against "latest" u-boot git-repository

Please (still) be patient if style of submission or patches are offending.

----

diff -uprN u-boot-orig//cpu/ixp/cpu.c u-boot/cpu/ixp/cpu.c

cpu/ixp/cpu.c DECLARE_GLOBAL_DATA_PTR; · line 53

Quoted 9 lines
cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +3 -0
@@ -45,32 +45,68 @@ DECLARE_GLOBAL_DATA_PTR;
 int print_cpuinfo (void)
 {
 	unsigned long id;
+	unsigned long cfg_clk;
 	int speed = 0;
+	int model = 0;
 
 	asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id));
+	cfg_clk = *IXP425_EXP_CFG0 >> 21;

please use readx/writex

Quoted 33 lines
cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +22 -5
-	puts("CPU:   Intel IXP425 at ");
+	puts("CPU:   Intel IXP42X");
 	switch ((id & 0x000003f0) >> 4) {
 	case 0x1c:
-		loops_per_jiffy = 887467;
-		speed = 533;
+		model = 533;
+		switch (cfg_clk) {
+		case 0x1:
+			speed = 400;
+			break;
+		case 0x3:
+			speed = 266;
+			break;
+		default:
+			speed = 533;
+			break;
+		}
 		break;
 
 	case 0x1d:
-		loops_per_jiffy = 666016;
-		speed = 400;
+		model = 400;
+		switch (cfg_clk) {
+		case 0x3:
+			speed = 266;
+			break;
+		default:
+			speed = 400;
+			break;
+		}

cpu/ixp/cpu.c DECLARE_GLOBAL_DATA_PTR; · line 90

Quoted 10 lines
cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +2 -1
 		break;
 
 	case 0x1f:
-		loops_per_jiffy = 442901;
+		model = 266;
 		speed = 266;
 		break;
 	}
 
+	/* FIXME: is there any need for the jiffies? */

for the IRQ delay

cpu/ixp/cpu.c DECLARE_GLOBAL_DATA_PTR; · line 101

Quoted 11 lines
cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +11 -0
+	switch (speed) {
+	case 266:
+		loops_per_jiffy = 442901;
+		break;
+	case 400:
+		loops_per_jiffy = 666016;
+		break;
+	case 533:
+		loops_per_jiffy = 887467;
+		break;
+	}

Best Regards,
J.

#10 lore raw

PATCH 1/1 IXP425: Improving print_cpuinfo code Part 1/1

Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

cpu/ixp/cpu.c DECLARE_GLOBAL_DATA_PTR; · line 53

Quoted 1 line
cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +1 -0
+	cfg_clk = *IXP425_EXP_CFG0 >> 21;

please use readx/writex

The pointer dereference style is used throughout the other files in the IXP port as well. Shouldn't this be handled the same way in all files?

Quoted 3 lines

cpu/ixp/cpu.c DECLARE_GLOBAL_DATA_PTR; · line 90

Quoted 2 lines
cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +1 -0
+	/* FIXME: is there any need for the jiffies? */

for the IRQ delay

Ok, I overlooked it is used in start.S.

-- Stefan

#11 lore raw

PATCH 1/1 IXP425: Improving print_cpuinfo code Part 1/1

Quoted 7 lines · Stefan Althoefer
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

cpu/ixp/cpu.c DECLARE_GLOBAL_DATA_PTR; · line 53

Quoted 1 line
cpu/ixp/cpu.c renamed from /cpu/ixp/cpu.c +1 -0
+	cfg_clk = *IXP425_EXP_CFG0 >> 21;

please use readx/writex

The pointer dereference style is used throughout the other files in the IXP port as well. Shouldn't this be handled the same way in all files?

yes it's old wrong way code
for new we to use the good accessor

for old code patch are welcome

Best Regards,
J.

#12 lore raw

PATCH 1/1 IXP425: Changing serial port initialization sequence Part 1/1

[PATCH] IXP425: Changing serial port initialization sequence

On my IXP425 board (Janz emPC-A400), the first few characters of the u-boot startup message were missing.

I fixed it by enabling the UART before all other initialization.

I also enabled (and flushed) the FIFO of the UART.

The patch is against "latest" u-boot git-repository

Please (still) be patient if style of submission or patches are offending.

----

cpu/ixp/serial.c renamed from /cpu/ixp/serial.c +4 -3
diff -uprN u-boot-orig//cpu/ixp/serial.c u-boot/cpu/ixp/serial.c
@@ -50,8 +50,10 @@ void serial_setbrg (void)
 	else
 		hang ();
 
-	IER(uart) = 0;					/* Disable for now */
-	FCR(uart) = 0;					/* No fifos enabled */
+	IER(uart) = IER_UUE;
+
+	/* Enable an clear FIFOs */
+	FCR(uart) = FCR_RESETTF | FCR_RESETRF | FCR_TRFIFOE;
 
 	/* set baud rate */
 	LCR(uart) = LCR_WLS0 | LCR_WLS1 | LCR_DLAB;
@@ -63,7 +65,6 @@ void serial_setbrg (void)
 #else
 	MCR(uart) = 0;					/* set RTS inactive */
 #endif
-	IER(uart) = IER_UUE;
 }
 
 /*