Skip to contentSkip to conversation

orion5x: optimize window size computation

PATCH New Albert Aribaud 4 participants 20 messages Oct 4, 2010 – Oct 7, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 orion5x: optimize window size computation

---

This is a simple optimization of the orion5x window size computation. This code was contributed by Chris Moore so I put his Signed-off-by rather than mine.

See <http://www.mail-archive.com/[email protected]/msg37075.html>

 arch/arm/cpu/arm926ejs/orion5x/cpu.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/cpu/arm926ejs/orion5x/cpu.c +20 -10
index c36d7bf..5c443fe 100644
@@ -48,24 +48,34 @@ void reset_cpu(unsigned long ignored)
 }
 
 /*
- * Window Size
+ * Compute Window Size field value from size expressed in bytes
  * Used with the Base register to set the address window size and location.
  * Must be programmed from LSB to MSB as sequence of ones followed by
  * sequence of zeros. The number of ones specifies the size of the window in
  * 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte).
- * NOTE: A value of 0x0 specifies 64-KByte size.
+ * NOTES:
+ * 1) A sizeval equal to 0x0 specifies 4 TB.
+ * 2) A return value of 0x0 specifies 64 KB.
  */
 unsigned int orion5x_winctrl_calcsize(unsigned int sizeval)
 {
-	int i;
-	unsigned int j = 0;
-	u32 val = sizeval >> 1;
+	/*
+	 * Calculate the number of 64 KiB blocks needed minus one (rounding up).
+	 * For sizeval > 0 this is equivalent to:
+	 * sizeval = (u32) ceil((double) sizeval / 65536.0) - 1
+	 */
+	sizeval = (sizeval - 1) >> 16;
 
-	for (i = 0; val >= 0x10000; i++) {
-		j |= (1 << i);
-		val = val >> 1;
-	}
-	return 0x0000ffff & j;
+	/*
+	 * Propagate 'one' bits to the right by 'oring' them.
+	 * We need only treat bits 15-0.
+	 */
+	sizeval |= sizeval >> 1;  /* 'Or' bit 15 onto bit 14 */
+	sizeval |= sizeval >> 2;  /* 'Or' bits 15-14 onto bits 13-12 */
+	sizeval |= sizeval >> 4;  /* 'Or' bits 15-12 onto bits 11-8 */
+	sizeval |= sizeval >> 8;  /* 'Or' bits 15-8 onto bits 7-0*/
+
+	return sizeval;
 }
 
 /*
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 orion5x: optimize window size computation

Quoted 10 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
Sent: Tuesday, October 05, 2010 3:52 AM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH] orion5x: optimize window size computation

Quoted 6 lines

---

This is a simple optimization of the orion5x window size computation. This code was contributed by Chris Moore so I put his Signed-off-by rather than mine.

This is wrong, you should be singed-off since you are posting and Chris can be contributor Or let him post the patch.

Quoted 48 lines

See <http://www.mail-archive.com/[email protected]/msg37075.html>

 arch/arm/cpu/arm926ejs/orion5x/cpu.c |   30 
++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/cpu/arm926ejs/orion5x/cpu.c +1 -1
index c36d7bf..5c443fe 100644
@@ -48,24 +48,34 @@ void reset_cpu(unsigned long ignored)
 }
 
 /*
- * Window Size
+ * Compute Window Size field value from size expressed in bytes
  * Used with the Base register to set the address window 

size and location.
* Must be programmed from LSB to MSB as sequence of ones followed by
* sequence of zeros. The number of ones specifies the size
of the window in
* 64 KByte granularity (e.g., a value of 0x00FF specifies
256 = 16 MByte).
- * NOTE: A value of 0x0 specifies 64-KByte size.
+ * NOTES:
+ * 1) A sizeval equal to 0x0 specifies 4 TB.
+ * 2) A return value of 0x0 specifies 64 KB.
*/
unsigned int orion5x_winctrl_calcsize(unsigned int sizeval) {

arch/arm/cpu/arm926ejs/orion5x/cpu.c +2 -3
-	int i;
-	unsigned int j = 0;
-	u32 val = sizeval >> 1;
+	/*
+	 * Calculate the number of 64 KiB blocks needed minus 

one (rounding up).

arch/arm/cpu/arm926ejs/orion5x/cpu.c +4 -5
+	 * For sizeval > 0 this is equivalent to:
+	 * sizeval = (u32) ceil((double) sizeval / 65536.0) - 1
+	 */
+	sizeval = (sizeval - 1) >> 16;
 
-	for (i = 0; val >= 0x10000; i++) {
-		j |= (1 << i);
-		val = val >> 1;
-	}
-	return 0x0000ffff & j;

arch/arm/cpu/arm926ejs/orion5x/cpu.c void reset_cpu(unsigned long ignored) · line 78

Quoted 10 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +10 -0
+	/*
+	 * Propagate 'one' bits to the right by 'oring' them.
+	 * We need only treat bits 15-0.
+	 */
+	sizeval |= sizeval >> 1;  /* 'Or' bit 15 onto bit 14 */
+	sizeval |= sizeval >> 2;  /* 'Or' bits 15-14 onto bits 13-12 */
+	sizeval |= sizeval >> 4;  /* 'Or' bits 15-12 onto bits 11-8 */
+	sizeval |= sizeval >> 8;  /* 'Or' bits 15-8 onto bits 7-0*/
+
+	return sizeval;

BTW: How much this saves on size?

Regards..
Prafulla ..

#2 lore raw

PATCH 1/1 orion5x: optimize window size computation

Hi Prafulla,

Le 05/10/2010 07:57, Prafulla Wadaskar a ?crit :

Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
Sent: Tuesday, October 05, 2010 3:52 AM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH] orion5x: optimize window size computation

Quoted 9 lines
Quoted 6 lines

---

This is a simple optimization of the orion5x window size computation. This code was contributed by Chris Moore so I put his Signed-off-by rather than mine.

This is wrong, you should be singed-off since you are posting and Chris can be contributor Or let him post the patch.

I asked Albert to post the patch as I am mainly a U-Boot lurker and I have no U-Boot git tree.
If there is a problem I don't mind if he signs off either with or without me.

Quoted 42 lines
Quoted 42 lines

See<http://www.mail-archive.com/[email protected]/msg37075.html>

  arch/arm/cpu/arm926ejs/orion5x/cpu.c |   30
++++++++++++++++++++----------
  1 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/cpu/arm926ejs/orion5x/cpu.c +1 -1
index c36d7bf..5c443fe 100644
@@ -48,24 +48,34 @@ void reset_cpu(unsigned long ignored)
  }
 
  /*
- * Window Size
+ * Compute Window Size field value from size expressed in bytes
   * Used with the Base register to set the address window

size and location.
* Must be programmed from LSB to MSB as sequence of ones followed by
* sequence of zeros. The number of ones specifies the size
of the window in
* 64 KByte granularity (e.g., a value of 0x00FF specifies
256 = 16 MByte).
- * NOTE: A value of 0x0 specifies 64-KByte size.
+ * NOTES:
+ * 1) A sizeval equal to 0x0 specifies 4 TB.
+ * 2) A return value of 0x0 specifies 64 KB.
*/
unsigned int orion5x_winctrl_calcsize(unsigned int sizeval) {

arch/arm/cpu/arm926ejs/orion5x/cpu.c +2 -3
-	int i;
-	unsigned int j = 0;
-	u32 val = sizeval>>  1;
+	/*
+	 * Calculate the number of 64 KiB blocks needed minus

one (rounding up).

arch/arm/cpu/arm926ejs/orion5x/cpu.c +4 -0
+	 * For sizeval>  0 this is equivalent to:
+	 * sizeval = (u32) ceil((double) sizeval / 65536.0) - 1
+	 */
+	sizeval = (sizeval - 1)>>  16;
Quoted 17 lines
Quoted 5 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +0 -5
-	for (i = 0; val>= 0x10000; i++) {
-		j |= (1<<  i);
-		val = val>>  1;
-	}
-	return 0x0000ffff&  j;

arch/arm/cpu/arm926ejs/orion5x/cpu.c

Quoted 10 lines
arch/arm/cpu/arm926ejs/orion5x/cpu.c +10 -0
+	/*
+	 * Propagate 'one' bits to the right by 'oring' them.
+	 * We need only treat bits 15-0.
+	 */
+	sizeval |= sizeval>>  1;  /* 'Or' bit 15 onto bit 14 */
+	sizeval |= sizeval>>  2;  /* 'Or' bits 15-14 onto bits 13-12 */
+	sizeval |= sizeval>>  4;  /* 'Or' bits 15-12 onto bits 11-8 */
+	sizeval |= sizeval>>  8;  /* 'Or' bits 15-8 onto bits 7-0*/
+
+	return sizeval;

BTW: How much this saves on size?

It is not so much a question of size. I am afraid that the other version was just plain *wrong* :(
See my previous post here:
http://www.mail-archive.com/u-boot at lists.denx.de/msg36996.html In this post I presented two versions:
a) a corrected version along the lines of the original,
b) a version similar to the above.

The loop version may be slightly shorter in code size, particularly if one removes the unnecessary and with 0x0000ffff at the end. But aesthetically I find the version above much more pleasing. (Didn't Donald Knuth write "The *Art* of Computer Programming"?) It is also much faster for large window sizes but this probably doesn't matter here.

Cheers,
Chris

#3 lore raw

PATCH 1/1 orion5x: optimize window size computation

Le 05/10/2010 23:40, Chris Moore a ?crit :

Quoted 19 lines

Hi Prafulla,

Le 05/10/2010 07:57, Prafulla Wadaskar a ?crit :

Quoted 16 lines
Quoted 16 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
Sent: Tuesday, October 05, 2010 3:52 AM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH] orion5x: optimize window size computation

---

This is a simple optimization of the orion5x window size computation. This code was contributed by Chris Moore so I put his Signed-off-by rather than mine.

Quoted 8 lines
Quoted 3 lines

This is wrong, you should be singed-off since you are posting and Chris can be contributor
Or let him post the patch.

I asked Albert to post the patch as I am mainly a U-Boot lurker and I have no U-Boot git tree.
If there is a problem I don't mind if he signs off either with or without me.

Or how about a double Signed-off-by?

Quoted 1 line
Quoted 1 line

BTW: How much this saves on size?

More than 53% of the code size! That's 28 bytes instead of 60. :)

Quoted 2 lines

It is not so much a question of size. I am afraid that the other version was just plain *wrong* :(

Indeed. Prafulla, you'll remember that there was a generally horribly wrong version before, which I'd fixed with what I thought was a correct version, and is for many sizes, principally those of the for 2**N, but not all. Chris' version fixes all cases.

Quoted 2 lines

The loop version may be slightly shorter in code size, particularly if one removes the unnecessary and with 0x0000ffff at the end.

It's not: yours is shorter, thanks to the compiler being able to optimize things.

Quoted 4 lines

But aesthetically I find the version above much more pleasing. (Didn't Donald Knuth write "The *Art* of Computer Programming"?) It is also much faster for large window sizes but this probably doesn't matter here.

Your code is 7 instructions flat whatever the size, whereas the loop has a fixed 9 instruction setup and exit penalty, plus 5 instructions per bit shift (plus one literal). So your code is *always* faster.

Quoted 2 lines

Cheers,
Chris

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 1/1 orion5x: optimize window size computation

Quoted 17 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Wednesday, October 06, 2010 11:22 AM
To: Chris Moore
Cc: Prafulla Wadaskar; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] orion5x: optimize window size computation

Le 05/10/2010 23:40, Chris Moore a ?crit :

Quoted 5 lines

Hi Prafulla,

Le 05/10/2010 07:57, Prafulla Wadaskar a ?crit :

Quoted 2 lines
Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
Sent: Tuesday, October 05, 2010 3:52 AM
To: u-boot at lists.denx.de
Subject: [U-Boot] [PATCH] orion5x: optimize window size

computation

Quoted 11 lines
Quoted 11 lines
Quoted 8 lines

---

This is a simple optimization of the orion5x window size computation. This code was contributed by Chris Moore so I put his Signed-off-by rather than mine.

This is wrong, you should be singed-off since you are posting and Chris can be contributor
Or let him post the patch.

Ack

Quoted 8 lines
Quoted 2 lines

I asked Albert to post the patch as I am mainly a U-Boot

lurker and I

Quoted 3 lines

have no U-Boot git tree.
If there is a problem I don't mind if he signs off either with or without me.

Or how about a double Signed-off-by?

BTW: double Signed-off-by is not a bad idea, lot other patches follows the same. I wouldn't mind to ack such patches.
May be Wolfgang can better comment on this.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

BTW: How much this saves on size?

More than 53% of the code size! That's 28 bytes instead of 60. :)

Great!! Thanks Chris, we will update the same for Kirkwood too.

Regards..
Prafulla . .

#5 lore raw

PATCH 1/1 orion5x: optimize window size computation

Dear Prafulla Wadaskar,

Quoted 7 lines · In message <[email protected]>…
Quoted 2 lines

Or how about a double Signed-off-by?

BTW: double Signed-off-by is not a bad idea, lot other patches follows the = same.
I wouldn't mind to ack such patches.
May be Wolfgang can better comment on this.

Yes, double SoB is OK here. [Too many SoBs never hurt; it's too few that are bad.]

Best regards,

Wolfgang Denk

Signature · 6 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
We Klingons believe as you do -- the sick should die. Only the strong
should live.
	-- Kras, "Friday's Child", stardate 3497.2
#6 lore raw

PATCH 1/1 orion5x: optimize window size computation

Le 06/10/2010 15:29, Wolfgang Denk a ?crit :

Quoted 6 lines

Dear Prafulla Wadaskar,

Quoted 3 lines · In message<[email protected]>…
Quoted 2 lines

Or how about a double Signed-off-by?

Quoted 7 lines
Quoted 4 lines

BTW: double Signed-off-by is not a bad idea, lot other patches follows the = same.
I wouldn't mind to ack such patches.
May be Wolfgang can better comment on this.

Yes, double SoB is OK here. [Too many SoBs never hurt; it's too few that are bad.]

Thanks. Do I need to repost this patch with a double SoB?

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#7 lore raw

PATCH 1/1 orion5x: optimize window size computation

Quoted 21 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Wednesday, October 06, 2010 7:17 PM
To: Wolfgang Denk
Cc: Prafulla Wadaskar; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [PATCH] orion5x: optimize window size computation

Le 06/10/2010 15:29, Wolfgang Denk a ?crit :

Quoted 3 lines

Dear Prafulla Wadaskar,

In

message<[email protected]

Quoted 4 lines · arvell.com> you wrote:
Quoted 4 lines
Quoted 2 lines

Or how about a double Signed-off-by?

BTW: double Signed-off-by is not a bad idea, lot other

patches follows the =

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

same.
I wouldn't mind to ack such patches.
May be Wolfgang can better comment on this.

Yes, double SoB is OK here. [Too many SoBs never hurt; it's too few that are bad.]

Thanks. Do I need to repost this patch with a double SoB?

Yes, that will be good

Regards..
Prafulla . .

#8 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

In reply to Albert ARIBAUD

Hi Albert

After rebasing to new ARM relocation code base and updating Kirkwood board support. I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check the same with Kirkwood platform?

Regards..
Prafulla . .

#9 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Dear Prafulla Wadaskar,

Quoted 6 lines · In message <[email protected]>…

After rebasing to new ARM relocation code base and updating Kirkwood board support. I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check the same with Kirkwood platform?

Try running the "dcache off" command before accessing the network and see if this changes anything.

Best regards,

Wolfgang Denk

Signature · 6 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
Extended Epstein-Heisenberg Principle: In an R & D orbit, only  2  of
the  existing 3 parameters can be defined simultaneously. The parame-
ters are: task, time and resources ($).
#10 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 15:30, Wolfgang Denk a ?crit :

Quoted 9 lines

Dear Prafulla Wadaskar,

Quoted 6 lines · In message<[email protected]>…

After rebasing to new ARM relocation code base and updating Kirkwood board support. I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check the same with Kirkwood platform?

I am positive that mvgbe driver works, because it initially did not on my edminiv2, and I traced the root cause to gd being trashed between board_init_f and board_init_r; that was fixed before I submitted this patch.

I will test on the openrd platform.

Quoted 2 lines

Try running the "dcache off" command before accessing the network and see if this changes anything.

Good suggestion. FTR, I did all of my tests with dcache off only -- never tried to activate any cache.

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#11 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 15:54, Albert ARIBAUD a ?crit :

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check the same with Kirkwood platform?

I am positive that mvgbe driver works, because it initially did not on my edminiv2, and I traced the root cause to gd being trashed between board_init_f and board_init_r; that was fixed before I submitted this patch.

I will test on the openrd platform.

BTW: Prafulla, what toolchain are you using for your kirkwood platforms?

Amicalement,

Signature · 1 line
Albert.
#12 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Quoted 19 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: Wednesday, October 06, 2010 7:26 PM
To: Albert ARIBAUD
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 15:54, Albert ARIBAUD a ?crit :

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check

the same with Kirkwood platform?

Quoted 2 lines

I am positive that mvgbe driver works, because it initially

did not on

Quoted 8 lines
Quoted 2 lines

my edminiv2, and I traced the root cause to gd being trashed between board_init_f and board_init_r; that was fixed before I

submitted this patch.

Quoted 2 lines

I will test on the openrd platform.

BTW: Prafulla, what toolchain are you using for your kirkwood platforms?

Hi Albert

I tried with Gcc ver 4.1.2 (Red Hat 4.1.2-33.fa1) and gcc ver 4.4.1 (Sourcery G++ Lite 2009q3-68) In both the cases it fails.

Further I debugged the issue and found that- it fails in drivers/net/mvgbe.c at mvgbe_send() in while loop. It is clear that the Scheduled tx DMA xter is not getting completed, nor reporting error.

Then I checked with other board having switch instead of phy, and it works !!.

Whereas any release earlier to ARM relocation patches works very well (i.e. diff against u-boot-marvell.git/master and u-boot-arm.git)

So I am unable to figure out whom to address?

For me this happened since I moved to new ARM relocation code base. So initial doubt goes there.

If you have openrd_base you can give a try

Regards..
Prafulla . .

Quoted 9 lines

Amicalement,

Signature · 5 lines
Albert.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
#13 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 16:14, Prafulla Wadaskar a ?crit :

Quoted 40 lines
Quoted 19 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: Wednesday, October 06, 2010 7:26 PM
To: Albert ARIBAUD
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 15:54, Albert ARIBAUD a ?crit :

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check

the same with Kirkwood platform?

Quoted 2 lines

I am positive that mvgbe driver works, because it initially

did not on

Quoted 8 lines
Quoted 2 lines

my edminiv2, and I traced the root cause to gd being trashed between board_init_f and board_init_r; that was fixed before I

submitted this patch.

Quoted 2 lines

I will test on the openrd platform.

BTW: Prafulla, what toolchain are you using for your kirkwood platforms?

Hi Albert

I tried with Gcc ver 4.1.2 (Red Hat 4.1.2-33.fa1) and gcc ver 4.4.1 (Sourcery G++ Lite 2009q3-68) In both the cases it fails.

Further I debugged the issue and found that- it fails in drivers/net/mvgbe.c at mvgbe_send() in while loop. It is clear that the Scheduled tx DMA xter is not getting completed, nor reporting error.

Then I checked with other board having switch instead of phy, and it works !!.

Whereas any release earlier to ARM relocation patches works very well (i.e. diff against u-boot-marvell.git/master and u-boot-arm.git)

Quoted 8 lines

So I am unable to figure out whom to address?

For me this happened since I moved to new ARM relocation code base. So initial doubt goes there.

If you have openrd_base you can give a try

Regards..
Prafulla . .

This is suspiciously similar to the symptoms I had, which were: the loop checking for end of TX would never exit, because the TX descriptor's state word would never reflect the ownership change from DMA back to MPU that should happen at end of transfer, because the controllers BAR that was assumed to give it access to DRAM was trashed, because gd was trashed in the first place.

OTOH, if the same code works or not depending on whether you have a switch or phy, it rules out gd trashing.

Still... Please check the BARs in the controller.

I'll try on my openrd board. It has a phy, so I should be able to witness the issue.

Amicalement,

Signature · 1 line
Albert.
#14 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

In reply to Wolfgang Denk
Quoted 19 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, October 06, 2010 7:00 PM
To: Prafulla Wadaskar
Cc: Albert ARIBAUD; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Dear Prafulla Wadaskar,

In message <[email protected].

Quoted 2 lines · com> you wrote:

After rebasing to new ARM relocation code base and updating

Kirkwood board support.

Quoted 8 lines
Quoted 4 lines

I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check

the same with Kirkwood platform?

Try running the "dcache off" command before accessing the network and see if this changes anything.

I tried this too, I have disabled dcache in init.
.. no difference.

Debugging continued..

Regards..
Prafulla . .

#15 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 16:22, Prafulla Wadaskar a ?crit :

Quoted 28 lines
Quoted 19 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, October 06, 2010 7:00 PM
To: Prafulla Wadaskar
Cc: Albert ARIBAUD; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Dear Prafulla Wadaskar,

In message <[email protected].

Quoted 2 lines · com> you wrote:

After rebasing to new ARM relocation code base and updating

Kirkwood board support.

Quoted 8 lines
Quoted 4 lines

I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check

the same with Kirkwood platform?

Try running the "dcache off" command before accessing the network and see if this changes anything.

Quoted 7 lines

I tried this too, I have disabled dcache in init.
.. no difference.

Debugging continued..

Regards..
Prafulla . .

Trying this on an openrd client board with the openrd_base config. Both boards have the same exact RAMs, however the DRAM: line is acting funny on me: fresh with my relocation patch above master, it says:

	SoC:   Kirkwood 88F6281_A0
	DRAM:  192.5 MiB

... while the actual RAM size is 512 MiB.

(Even considering that the original Marvell code may have the count-only-half bug that Chris' patch fixes, that's only 385 MiB... Weirder yet: adding Chris' patch above mine, I get 3.6 GiB... But let's chase only one rabbit at a time)

Prafulla, how much RAM does your build see on your board(s)?

Amicalement,

Signature · 1 line
Albert.
#16 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 17:56, Albert ARIBAUD a ?crit :

Quoted 44 lines

Le 06/10/2010 16:22, Prafulla Wadaskar a ?crit :

Quoted 28 lines
Quoted 19 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, October 06, 2010 7:00 PM
To: Prafulla Wadaskar
Cc: Albert ARIBAUD; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Dear Prafulla Wadaskar,

In message <[email protected].

Quoted 2 lines · com> you wrote:

After rebasing to new ARM relocation code base and updating

Kirkwood board support.

Quoted 8 lines
Quoted 4 lines

I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check

the same with Kirkwood platform?

Try running the "dcache off" command before accessing the network and see if this changes anything.

Quoted 7 lines

I tried this too, I have disabled dcache in init.
.. no difference.

Debugging continued..

Regards..
Prafulla . .

Trying this on an openrd client board with the openrd_base config. Both boards have the same exact RAMs, however the DRAM: line is acting funny on me: fresh with my relocation patch above master, it says:

	SoC:   Kirkwood 88F6281_A0
	DRAM:  192.5 MiB
Quoted 8 lines

... while the actual RAM size is 512 MiB.

(Even considering that the original Marvell code may have the count-only-half bug that Chris' patch fixes, that's only 385 MiB... Weirder yet: adding Chris' patch above mine, I get 3.6 GiB... But let's chase only one rabbit at a time)

Prafulla, how much RAM does your build see on your board(s)?

globally defining DEBUG gives:

U-Boot 2010.09-00102-gb4a7c1c-dirty (Oct 06 2010 - 19:13:59) OpenRD_base

	U-Boot code: 00600000 -> 0065DFBC  BSS: -> 006A46E0
	SoC:   Kirkwood 88F6281_A0
	monitor len: 000A46E0
	ramsize: 00000000

Obviously RAM detection is bugged. This explains the following computations:

TLB table at: ffff0000
Top of RAM usable for U-Boot at: ffff0000 Reserving 657k for U-Boot at: fff4b000 Reserving 1152k for malloc() at: ffe2b000 Reserving 48 Bytes for Board Info at: ffe2afd0 Reserving 92 Bytes for Global Data at: ffe2af74 New Stack Pointer is: ffe2af70

RAM Configuration:
Bank #0: 00000000 0 Bytes
Bank #1: 00000000 0 Bytes
Bank #2: 00000000 0 Bytes
Bank #3: 00000000 3.3 GiB

This weird bank #3 one may be a consequence, or not, of the buggy RAM computation.

relocation Offset is: ff94b000

Further debugging going on.

Amicalement,

Signature · 1 line
Albert.
#17 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 19:36, Albert ARIBAUD a ?crit :

Quoted 82 lines

Le 06/10/2010 17:56, Albert ARIBAUD a ?crit :

Quoted 44 lines

Le 06/10/2010 16:22, Prafulla Wadaskar a ?crit :

Quoted 28 lines
Quoted 19 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, October 06, 2010 7:00 PM
To: Prafulla Wadaskar
Cc: Albert ARIBAUD; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Dear Prafulla Wadaskar,

In message <[email protected].

Quoted 2 lines · com> you wrote:

After rebasing to new ARM relocation code base and updating

Kirkwood board support.

Quoted 8 lines
Quoted 4 lines

I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check

the same with Kirkwood platform?

Try running the "dcache off" command before accessing the network and see if this changes anything.

Quoted 7 lines

I tried this too, I have disabled dcache in init.
.. no difference.

Debugging continued..

Regards..
Prafulla . .

Trying this on an openrd client board with the openrd_base config. Both boards have the same exact RAMs, however the DRAM: line is acting funny on me: fresh with my relocation patch above master, it says:

SoC: Kirkwood 88F6281_A0
DRAM: 192.5 MiB

Quoted 8 lines

... while the actual RAM size is 512 MiB.

(Even considering that the original Marvell code may have the count-only-half bug that Chris' patch fixes, that's only 385 MiB... Weirder yet: adding Chris' patch above mine, I get 3.6 GiB... But let's chase only one rabbit at a time)

Prafulla, how much RAM does your build see on your board(s)?

globally defining DEBUG gives:

U-Boot 2010.09-00102-gb4a7c1c-dirty (Oct 06 2010 - 19:13:59) OpenRD_base

U-Boot code: 00600000 -> 0065DFBC BSS: -> 006A46E0
SoC: Kirkwood 88F6281_A0
monitor len: 000A46E0
ramsize: 00000000

Obviously RAM detection is bugged. This explains the following computations:

TLB table at: ffff0000
Top of RAM usable for U-Boot at: ffff0000
Reserving 657k for U-Boot at: fff4b000
Reserving 1152k for malloc() at: ffe2b000
Reserving 48 Bytes for Board Info at: ffe2afd0
Reserving 92 Bytes for Global Data at: ffe2af74
New Stack Pointer is: ffe2af70

RAM Configuration:
Bank #0: 00000000 0 Bytes
Bank #1: 00000000 0 Bytes
Bank #2: 00000000 0 Bytes
Bank #3: 00000000 3.3 GiB

Quoted 6 lines

This weird bank #3 one may be a consequence, or not, of the buggy RAM computation.

relocation Offset is: ff94b000

Further debugging going on.

I think I got it.

You must define dram_init() and dram_init_banksize() in your board code (or in the SoC code if you can factorize it). Without it, default functions get called, and that does not work out well.

You can probably define dram_init() and dram_init_banksize() in the kirkwood SoC support code, like it is for orion5x.

Amicalement,

Signature · 1 line
Albert.
#18 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Quoted 108 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Wednesday, October 06, 2010 11:24 PM
To: Albert ARIBAUD
Cc: Prafulla Wadaskar; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan at theia.denx.de; Prabhanjan Sarnaik
Subject: Re: Mvbge driver broken on kirkwood platforms after ARM relocation

Le 06/10/2010 19:36, Albert ARIBAUD a ?crit :

Quoted 28 lines

Le 06/10/2010 17:56, Albert ARIBAUD a ?crit :

Quoted 27 lines

Le 06/10/2010 16:22, Prafulla Wadaskar a ?crit :

Quoted 26 lines
Quoted 26 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, October 06, 2010 7:00 PM
To: Prafulla Wadaskar
Cc: Albert ARIBAUD; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

Dear Prafulla Wadaskar,

In message <[email protected].

Quoted 2 lines · com> you wrote:

After rebasing to new ARM relocation code base and updating

Kirkwood board support.

Quoted 4 lines

I am unable to get my network driver through (mvgbe)

Have you tested this on edminv2 platform?
If it is working at your end? Can you please cross check

the same with Kirkwood platform?

Try running the "dcache off" command before accessing

the network and

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 1 line

see if this changes anything.

I tried this too, I have disabled dcache in init.
.. no difference.

Debugging continued..

Regards..
Prafulla . .

Trying this on an openrd client board with the openrd_base

config. Both

Quoted 1 line
Quoted 1 line

boards have the same exact RAMs, however the DRAM: line is

acting funny

Quoted 10 lines
Quoted 10 lines

on me: fresh with my relocation patch above master, it says:

SoC: Kirkwood 88F6281_A0
DRAM: 192.5 MiB

... while the actual RAM size is 512 MiB.

(Even considering that the original Marvell code may have the count-only-half bug that Chris' patch fixes, that's only 385 MiB... Weirder yet: adding Chris' patch above mine, I get 3.6

GiB... But let's

Quoted 26 lines
Quoted 3 lines

chase only one rabbit at a time)

Prafulla, how much RAM does your build see on your board(s)?

globally defining DEBUG gives:

U-Boot 2010.09-00102-gb4a7c1c-dirty (Oct 06 2010 - 19:13:59) OpenRD_base

U-Boot code: 00600000 -> 0065DFBC BSS: -> 006A46E0
SoC: Kirkwood 88F6281_A0
monitor len: 000A46E0
ramsize: 00000000

Obviously RAM detection is bugged. This explains the following computations:

TLB table at: ffff0000
Top of RAM usable for U-Boot at: ffff0000
Reserving 657k for U-Boot at: fff4b000
Reserving 1152k for malloc() at: ffe2b000
Reserving 48 Bytes for Board Info at: ffe2afd0
Reserving 92 Bytes for Global Data at: ffe2af74
New Stack Pointer is: ffe2af70

Quoted 7 lines

RAM Configuration:
Bank #0: 00000000 0 Bytes
Bank #1: 00000000 0 Bytes
Bank #2: 00000000 0 Bytes
Bank #3: 00000000 3.3 GiB

This weird bank #3 one may be a consequence, or not, of the

buggy RAM

Quoted 5 lines

computation.

relocation Offset is: ff94b000

Further debugging going on.

I think I got it.

Quoted 7 lines

You must define dram_init() and dram_init_banksize() in your board code
(or in the SoC code if you can factorize it). Without it, default functions get called, and that does not work out well.

You can probably define dram_init() and dram_init_banksize() in the kirkwood SoC support code, like it is for orion5x.

Hi Albert

You should apply these patches to get build errors and dram size fixed
http://lists.denx.de/pipermail/u-boot/2010-September/078069.html
http://lists.denx.de/pipermail/u-boot/2010-September/078071.html
http://lists.denx.de/pipermail/u-boot/2010-September/078070.html

Regards..
Prafulla . .

Quoted 5 lines

Amicalement,

Signature · 1 line
Albert.
#19 lore raw

[U-Boot] Mvbge driver broken on kirkwood platforms after ARM relocation

In reply to Albert ARIBAUD
Quoted 11 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Wednesday, October 06, 2010 11:24 PM
To: Albert ARIBAUD
Cc: Prafulla Wadaskar; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan at theia.denx.de; Prabhanjan Sarnaik
Subject: Re: Mvbge driver broken on kirkwood platforms after ARM relocation

Snip...

This is resolved now.
dram_init_banksize() is need to be defined, if not done then it alters pre-configured dram bank0 by dram_init

Regards..
Prafulla . .