Skip to contentSkip to conversation

sunxi: Use clrsetbits_le32 instead of multiple instruction

RFC PATCH Superseded Michael Trimarchi 2 participants 9 messages Feb 12, 2019 – Feb 13, 2019

Subsystems (3)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/3 sunxi: Use clrsetbits_le32 instead of multiple instruction

---
 arch/arm/mach-sunxi/dram_sun8i_a33.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arm/mach-sunxi/dram_sun8i_a33.c +2 -6
index 1da2727f98..83212aaddf 100644
@@ -148,12 +148,8 @@ static void auto_set_timing_para(struct dram_para *para)
 	reg_val = (tcksrx << 24) | (tcksre << 16) | (tckesr << 8) | (tcke << 0);
 	writel(reg_val, &mctl_ctl->dramtmg5);
 	/* Set two rank timing and exit self-refresh timing */
-	reg_val = readl(&mctl_ctl->dramtmg8);
-	reg_val &= ~(0xff << 8);
-	reg_val &= ~(0xff << 0);
-	reg_val |= (0x33 << 8);
-	reg_val |= (0x8 << 0);
-	writel(reg_val, &mctl_ctl->dramtmg8);
+	clrsetbits_le32(&mctl_ctl->dramtmg8, (0xff << 8) | (0xff << 0),
+			0x33 << 8 | (0x8 << 0));
 	/* Set phy interface time */
 	reg_val = (0x2 << 24) | (t_rdata_en << 16) | (0x1 << 8)
 			| (wr_latency << 0);
Signature · 1 line
2.17.1
#1 lore raw

RFC PATCH 2/3 sunxi: Don't change the rank in dram size detection in A33

Change the size create a glitch in the clke signal on second bank. The glitch can generate problem in memory initialiazation

---
 arch/arm/mach-sunxi/dram_sun8i_a33.c | 3 ---
 1 file changed, 3 deletions(-)
arch/arm/mach-sunxi/dram_sun8i_a33.c +0 -3
index 83212aaddf..d73a93a132 100644
@@ -45,14 +45,12 @@ static void mctl_set_cr(struct dram_para *para)
 
 static void auto_detect_dram_size(struct dram_para *para)
 {
-	u8 orig_rank = para->rank;
 	int rows, columns;
 
 	/* Row detect */
 	para->page_size = 512;
 	para->seq = 1;
 	para->rows = 16;
-	para->rank = 1;
 	mctl_set_cr(para);
 	for (rows = 11 ; rows < 16 ; rows++) {
 		if (mctl_mem_matches(1 << (rows + 9))) /* row-column */
@@ -69,7 +67,6 @@ static void auto_detect_dram_size(struct dram_para *para)
 	}
 
 	para->seq = 0;
-	para->rank = orig_rank;
 	para->rows = rows;
 	para->page_size = 1 << columns;
 	mctl_set_cr(para);
Signature · 1 line
2.17.1
#2 lore raw

RFC PATCH 2/3 sunxi: Don't change the rank in dram size detection in A33

Quoted 2 lines · Michael Trimarchi

Change the size create a glitch in the clke signal on second bank.

Which glitch?

Quoted 1 line

The glitch can generate problem in memory initialiazation

Which problem? on which board? How do we reproduce it?

Maxime

Signature · 10 lines
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190213/480f290d/attachment.sig>
#3 lore raw

RFC PATCH 2/3 sunxi: Don't change the rank in dram size detection in A33

Hi Maxime

Quoted 10 lines · Maxime Ripard
Quoted 2 lines · Michael Trimarchi

Change the size create a glitch in the clke signal on second bank.

Which glitch?

Quoted 1 line

The glitch can generate problem in memory initialiazation

Which problem? on which board? How do we reproduce it?

Yes I know. I'm working on production of a device and fix some failing board. You can check the glitch here. I will adjust the commit soon. A33, 2GB, double rank

Michael

Quoted 7 lines

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Signature · 18 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: picturemessage_n0yzw03j.vbc.png
Type: image/png
Size: 50575 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190213/cb0d232b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: picturemessage_wy0l4ijo.fxs.png
Type: image/png
Size: 51162 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190213/cb0d232b/attachment-0001.png>
#4 lore raw

RFC PATCH 2/3 sunxi: Don't change the rank in dram size detection in A33

Hi Maxime

Quoted 11 lines · Michael Nazzareno Trimarchi

Hi Maxime

Quoted 7 lines · Maxime Ripard
Quoted 2 lines · Michael Trimarchi

Change the size create a glitch in the clke signal on second bank.

Which glitch?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

The glitch can generate problem in memory initialiazation

Which problem? on which board? How do we reproduce it?

Yes I know. I'm working on production of a device and fix some failing board. You can check the glitch here. I will adjust the commit soon. A33, 2GB, double rank

Did you get the screenshot on your email?

Michael

Quoted 17 lines

Michael

Quoted 7 lines

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

--

| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
Signature · 4 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
#5 lore raw

RFC PATCH 3/3 sunxi: Fix A33 memory initialization

In reply to Michael Trimarchi

Set two rank timing and exit self-refresh timing seems not done properly. We know use the same write that we are using on H5 silicon.

---
 arch/arm/mach-sunxi/dram_sun8i_a33.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-sunxi/dram_sun8i_a33.c +1 -1
index d73a93a132..355fe30aba 100644
@@ -146,7 +146,7 @@ static void auto_set_timing_para(struct dram_para *para)
 	writel(reg_val, &mctl_ctl->dramtmg5);
 	/* Set two rank timing and exit self-refresh timing */
 	clrsetbits_le32(&mctl_ctl->dramtmg8, (0xff << 8) | (0xff << 0),
-			0x33 << 8 | (0x8 << 0));
+			0x33 << 8 | (0x10 << 0));
 	/* Set phy interface time */
 	reg_val = (0x2 << 24) | (t_rdata_en << 16) | (0x1 << 8)
 			| (wr_latency << 0);
Signature · 1 line
2.17.1
#6 lore raw

RFC PATCH 3/3 sunxi: Fix A33 memory initialization

Quoted 2 lines · Michael Trimarchi

Set two rank timing and exit self-refresh timing seems not done properly.

Why?

Seriously, a commit log isn't there to vaguely describe whatever you're doing. It's there to expose what precise issue you faced, and how you overcame it.

Maxime

Signature · 10 lines
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190213/09adfe1f/attachment.sig>
#7 lore raw

RFC PATCH 3/3 sunxi: Fix A33 memory initialization

Hi Maxime

Quoted 10 lines · Maxime Ripard
Quoted 2 lines · Michael Trimarchi

Set two rank timing and exit self-refresh timing seems not done properly.

Why?

Seriously, a commit log isn't there to vaguely describe whatever you're doing. It's there to expose what precise issue you faced, and how you overcame it.

I have no documentation, I know only the result. Test was cycling booting from FEL over usb. I was having on some sample 30% of failure and now I have 100% of success.

Michael

Quoted 7 lines

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Signature · 4 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
#8 lore raw

RFC PATCH 3/3 sunxi: Fix A33 memory initialization

Quoted 10 lines · Michael Nazzareno Trimarchi

Hi Maxime

Quoted 7 lines · Maxime Ripard
Quoted 2 lines · Michael Trimarchi

Set two rank timing and exit self-refresh timing seems not done properly.

Why?

Quoted 7 lines
Quoted 3 lines

Seriously, a commit log isn't there to vaguely describe whatever you're doing. It's there to expose what precise issue you faced, and how you overcame it.

I have no documentation, I know only the result. Test was cycling booting from FEL over usb. I was having on some sample 30% of failure and now I have 100% of success.

Well, that's still a pretty good information to give. On which boards, with which DRAM setup? with which SoC? etc.

Maxime

Signature · 10 lines
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190213/c3f432d3/attachment.sig>