Skip to contentSkip to conversation

mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

PATCH New Heiko Schocher 3 participants 7 messages Apr 12, 2015 – Apr 13, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

On the i.mx6 based aristainetos2 board a Toshiba TH58NYG3S0HBAI4 is used, which has 4096 pagesize and 256b oob. The ECC strength was not correct detected by U-Boot

---

 drivers/mtd/nand/mxs_nand.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/nand/mxs_nand.c +3 -0
index 2d2b938..00bf036 100644
@@ -163,6 +163,9 @@ static inline uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size,
 
 		if (page_oob_size == 224)
 			return 16;
+
+		if (page_oob_size == 256)
+			return 18;
 	}
 
 	return 0;
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

Hi Heiko,

Quoted 25 lines · Heiko Schocher

On the i.mx6 based aristainetos2 board a Toshiba TH58NYG3S0HBAI4 is used, which has 4096 pagesize and 256b oob. The ECC strength was not correct detected by U-Boot

---

 drivers/mtd/nand/mxs_nand.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/nand/mxs_nand.c +3 -0
index 2d2b938..00bf036 100644
@@ -163,6 +163,9 @@ static inline uint32_t 
 mxs_nand_get_ecc_strength(uint32_t page_data_size,
 
              if (page_oob_size == 224)
                      return 16;
+
+             if (page_oob_size == 256)
+                     return 18;
      }
 
Quoted 1 line
      return 0;

How about calculation the ECC strength dynamically? Peng Fan from Freescale send a patch doing this in December 2014 which was already reviewed by Marek:
https://patchwork.ozlabs.org/patch/422756/

It is also necessary to change the calculation in mxsboot...

Best regards
J?rg Krause

#2 lore raw

PATCH 1/1 mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

Quoted 31 lines · J?rg Krause

Hi Heiko,

Quoted 28 lines · Heiko Schocher

On the i.mx6 based aristainetos2 board a Toshiba TH58NYG3S0HBAI4 is used, which has 4096 pagesize and 256b oob. The ECC strength was not correct detected by U-Boot

---

 drivers/mtd/nand/mxs_nand.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mtd/nand/mxs_nand.c +3 -0
index 2d2b938..00bf036 100644
@@ -163,6 +163,9 @@ static inline uint32_t
 mxs_nand_get_ecc_strength(uint32_t page_data_size,
 
              if (page_oob_size == 224)
 
                      return 16;
 
+
+             if (page_oob_size == 256)
+                     return 18;
      }
Quoted 8 lines
Quoted 1 line
      return 0;

How about calculation the ECC strength dynamically? Peng Fan from Freescale send a patch doing this in December 2014 which was already reviewed by Marek:
https://patchwork.ozlabs.org/patch/422756/

It is also necessary to change the calculation in mxsboot...

Would be nice if the patch got applied, but I think there were some comments and the patch was never fixed/reposted. If Heiko wants to do it, that'd be nice.

Nice domain name btw ;-)

Best regards,
Marek Vasut

#3 lore raw

PATCH 1/1 mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

Hello Marek, Joerg,

Am 13.04.2015 10:42, schrieb Marek Vasut:

Quoted 39 lines · J?rg Krause
Quoted 38 lines

Hi Heiko,

Quoted 26 lines · Heiko Schocher

On the i.mx6 based aristainetos2 board a Toshiba TH58NYG3S0HBAI4 is used, which has 4096 pagesize and 256b oob. The ECC strength was not correct detected by U-Boot

---

  drivers/mtd/nand/mxs_nand.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/mtd/nand/mxs_nand.c +3 -0
index 2d2b938..00bf036 100644
@@ -163,6 +163,9 @@ static inline uint32_t
 mxs_nand_get_ecc_strength(uint32_t page_data_size,
 
               if (page_oob_size == 224)
 
                       return 16;
 
+
+             if (page_oob_size == 256)
+                     return 18;
Quoted 3 lines
       }

       return 0;

How about calculation the ECC strength dynamically? Peng Fan from Freescale send a patch doing this in December 2014 which was already reviewed by Marek:
https://patchwork.ozlabs.org/patch/422756/

Quoted 5 lines
Quoted 1 line

It is also necessary to change the calculation in mxsboot...

Would be nice if the patch got applied, but I think there were some comments and the patch was never fixed/reposted. If Heiko wants to do it, that'd be nice.

Hmm.. I feel, I have not much time left for fixing such things...

Joerg: You wrote on Jan. 27, 2015, 11:14 p.m.:
"I was able to fix mxsboot, but I had difficulties with round_down, which is a macro definition in linux/kernel.h. I've copied the macro definition to mxsboot. I will submit the patch in a seperate mail."

Did you post such a patch? Was this the onyl problem of the patch from Peng Fan?

"I would like to see a comment or a macro for the magic number 13, which is the value for the Galois Field, just for clarification"

I have no idea what 13 means ...

Quoted 1 line

Nice domain name btw ;-)

Indeed.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH 1/1 mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

Quoted 55 lines · Heiko Schocher

Hello Marek, Joerg,

Am 13.04.2015 10:42, schrieb Marek Vasut:

Quoted 39 lines · J?rg Krause
Quoted 38 lines

Hi Heiko,

Quoted 26 lines · Heiko Schocher

On the i.mx6 based aristainetos2 board a Toshiba TH58NYG3S0HBAI4 is used, which has 4096 pagesize and 256b oob. The ECC strength was not correct detected by U-Boot

---

  drivers/mtd/nand/mxs_nand.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/mtd/nand/mxs_nand.c +3 -0
index 2d2b938..00bf036 100644
@@ -163,6 +163,9 @@ static inline uint32_t
 mxs_nand_get_ecc_strength(uint32_t page_data_size,
 
               if (page_oob_size == 224)
 
                       return 16;
 
+
+             if (page_oob_size == 256)
+                     return 18;
Quoted 3 lines
       }
       
       return 0;

How about calculation the ECC strength dynamically? Peng Fan from Freescale send a patch doing this in December 2014 which was already reviewed by Marek:
https://patchwork.ozlabs.org/patch/422756/

Quoted 5 lines
Quoted 1 line

It is also necessary to change the calculation in mxsboot...

Would be nice if the patch got applied, but I think there were some comments and the patch was never fixed/reposted. If Heiko wants to do it, that'd be nice.

Hmm.. I feel, I have not much time left for fixing such things...

Joerg: You wrote on Jan. 27, 2015, 11:14 p.m.:
"I was able to fix mxsboot, but I had difficulties with round_down, which is a macro definition in linux/kernel.h. I've copied the macro definition to mxsboot. I will submit the patch in a seperate mail."

Quoted 7 lines

Did you post such a patch? Was this the onyl problem of the patch from Peng Fan?

"I would like to see a comment or a macro for the magic number 13, which is the value for the Galois Field, just for clarification"

I have no idea what 13 means ...

Well I know what GF(13) stands for, but why this particular prime (13) is chosen in the computation, that is not clear. So a comment would really be helpful here.

Best regards,

#5 lore raw

PATCH 1/1 mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

In reply to Heiko Schocher

Hi Marek, Heiko,

Quoted 44 lines · Heiko Schocher

Hello Marek, Joerg,

Am 13.04.2015 10:42, schrieb Marek Vasut:

Quoted 41 lines · J?rg Krause
Quoted 40 lines

Hi Heiko,

Quoted 27 lines · Heiko Schocher

On the i.mx6 based aristainetos2 board a Toshiba TH58NYG3S0HBAI4
is used, which has 4096 pagesize and 256b oob. The ECC strength was not correct detected by U-Boot

---

  drivers/mtd/nand/mxs_nand.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/mtd/nand/mxs_nand.c +3 -0
index 2d2b938..00bf036 100644
@@ -163,6 +163,9 @@ static inline uint32_t
 mxs_nand_get_ecc_strength(uint32_t page_data_size,
 
               if (page_oob_size == 224)
 
                       return 16;
 
+
+             if (page_oob_size == 256)
+                     return 18;
Quoted 3 lines
       }

       return 0;

How about calculation the ECC strength dynamically? Peng Fan from Freescale send a patch doing this in December 2014 which was already
reviewed by Marek:
https://patchwork.ozlabs.org/patch/422756/

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

It is also necessary to change the calculation in mxsboot...

Would be nice if the patch got applied, but I think there were some comments and the patch was never fixed/reposted. If Heiko wants to do it, that'd be nice.

Hmm.. I feel, I have not much time left for fixing such things...

I can re-submit the patch from Peng Fan together with my fixes for mxsboot.

Quoted 8 lines

Joerg: You wrote on Jan. 27, 2015, 11:14 p.m.:
"I was able to fix mxsboot, but I had difficulties with round_down, which
is a macro definition in linux/kernel.h. I've copied the macro definition to mxsboot. I will submit the patch in a seperate mail."

Did you post such a patch? Was this the onyl problem of the patch from Peng Fan?

No, I didn't. I waited for some comment and then I just forgot about it. The main problem with the patch from Peng Fan was that it was not consistent with mxsboot, which still has the hardcoded oobsizes. I copied the calculation to mxsboot.c, but failed to include linux/kernel.h, because mxsboot is compiled with the host compiler and u-boot with the cross-compiler. So I just copied the macro definition for round_down from kernel.h to mxsboot.c.

Quoted 5 lines

"I would like to see a comment or a macro for the magic number 13, which
is the value for the Galois Field, just for clarification"

I have no idea what 13 means ...

This is cited from the i.MX28 Reference Manual:
BCH-codes are a type of block-code, which implies that all error- correction is performed over a block of N-symbols. The BCH operation will be performed over GF (2^13 = 8192), which is the Galois Field consisting of 8191 one-bit symbols.

Quoted 4 lines
Quoted 2 lines

Nice domain name btw ;-)

Indeed.

Thanks :-)

Quoted 3 lines

bye,
Heiko

#6 lore raw

PATCH 1/1 mxs_nand: Fix ECC strength for NAND flash with OOB size of 256

Hello Joerg,

Am 13.04.2015 13:38, schrieb J?rg Krause:

Quoted 49 lines

Hi Marek, Heiko,

Quoted 46 lines · Heiko Schocher

Hello Marek, Joerg,

Am 13.04.2015 10:42, schrieb Marek Vasut:

Quoted 43 lines · J?rg Krause
Quoted 41 lines

Hi Heiko,

Quoted 27 lines · Heiko Schocher

On the i.mx6 based aristainetos2 board a Toshiba TH58NYG3S0HBAI4
is used, which has 4096 pagesize and 256b oob. The ECC strength was not correct detected by U-Boot

---

   drivers/mtd/nand/mxs_nand.c | 3 +++
   1 file changed, 3 insertions(+)
drivers/mtd/nand/mxs_nand.c +3 -0
index 2d2b938..00bf036 100644
@@ -163,6 +163,9 @@ static inline uint32_t
 mxs_nand_get_ecc_strength(uint32_t page_data_size,
 
                if (page_oob_size == 224)
 
                        return 16;
 
+
+             if (page_oob_size == 256)
+                     return 18;
Quoted 3 lines
        }

        return 0;

How about calculation the ECC strength dynamically? Peng Fan from Freescale send a patch doing this in December 2014 which was already
reviewed by Marek:
https://patchwork.ozlabs.org/patch/422756/

It is also necessary to change the calculation in mxsboot...

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Would be nice if the patch got applied, but I think there were some comments and the patch was never fixed/reposted. If Heiko wants to do it, that'd be nice.

Hmm.. I feel, I have not much time left for fixing such things...

I can re-submit the patch from Peng Fan together with my fixes for mxsboot.

Yes, please (and with a comment for the magic number 13 ;-)

I can test your patches then on an imx6 based board ... maybe we do not need my patch then!

Quoted 21 lines
Quoted 8 lines

Joerg: You wrote on Jan. 27, 2015, 11:14 p.m.:
"I was able to fix mxsboot, but I had difficulties with round_down, which
is a macro definition in linux/kernel.h. I've copied the macro definition to mxsboot. I will submit the patch in a seperate mail."

Did you post such a patch? Was this the onyl problem of the patch from Peng Fan?

No, I didn't. I waited for some comment and then I just forgot about it. The main problem with the patch from Peng Fan was that it was not consistent with mxsboot, which still has the hardcoded oobsizes. I copied the calculation to mxsboot.c, but failed to include linux/kernel.h, because mxsboot is compiled with the host compiler and u-boot with the cross-compiler. So I just copied the macro definition for round_down from kernel.h to mxsboot.c.

Quoted 4 lines

"I would like to see a comment or a macro for the magic number 13, which
is the value for the Galois Field, just for clarification"

Quoted 7 lines
Quoted 1 line

I have no idea what 13 means ...

This is cited from the i.MX28 Reference Manual:
BCH-codes are a type of block-code, which implies that all error- correction is performed over a block of N-symbols. The BCH operation will be performed over GF (2^13 = 8192), which is the Galois Field consisting of 8191 one-bit symbols.

Thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany