ECC strength from DTSI with U-Boot 2020.04 on iMX6DL

cancel
Showing results for 
Search instead for 
Did you mean: 

ECC strength from DTSI with U-Boot 2020.04 on iMX6DL

118 Views
maxime_torrelli
Contributor II

Hello,

 

We are trying to use a Nand Flash (Micron MT29F4G08ABAEAWP among others) from U-Boot 2020.04 on an iMX6DL processor.

We try to configure the ECC strength to 16 bits through the DTSI but when the U-Boot is started, the command mtd list returns that the ECC strength is 8 bits.

 

An extract of our defconfig :
CONFIG_NAND_MXS=y
CONFIG_CMD_NAND=y
CONFIG_NAND_MXS_DT=y
CONFIG_MTD_RAW_NAND=y
CONFIG_DM_MTD=y

Content of our configs/*.h file :
#define CONFIG_SYS_NAND_ONFI_DETECTION


Content of our *.dtsi file :
&gpmi {

pinctrl-names = "default";
pinctrl-0 = <&configure_nandflash_pins>;
status = "okay";
nand-ecc-strength=<16>;
nand-ecc-step-size=<512>;
nand-on-flash-bbt;

};

 

I dug into the source code of the drivers and found out the function nand_dt_init (nand_base.c) reads the nand-ecc-strength property form the dtsi and puts its value into chip->ecc.strength.

Whereas, when the function mxs_nand_set_geometry (mxs_nand.c) calls mxs_nand_calc_ecc_layout_by_info, instead of using chip->ecc.strength as a parameter of mxs_nand_calc_ecc_layout_by_info, it uses chip->ecc_strength_ds.

The ecc_strength_ds value is set to 8 bits by nand_flash_detect_onfi (nand_base.c) which reads the ONFI data of our Nand.

 

I have tried to remove the define CONFIG_SYS_NAND_ONFI_DETECTION, but doing so the driver uses Legacy BCH Geometry and set the ECC strength to 8 bits.

 

I managed to get the driver to work by changing the following line from the function mxs_nand_set_geometry (mxs_nand.c) :
return mxs_nand_calc_ecc_layout_by_info(geo, mtd, chip->ecc_strength_ds, chip->ecc_step_ds);
changed to
return mxs_nand_calc_ecc_layout_by_info(geo, mtd, chip->ecc.strength, chip->ecc_step_ds);

Even though this quick fix solves our issue, I have no clue if it works with all the different configurations supported by the U-Boot.

If you have any suggestion to solve this issue, please let me know.

And if you have any question, I will do my utmost to answer.

Labels (2)
Tags (2)
0 Kudos
1 Reply

103 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Maxime

 

>Even though this quick fix solves our issue, I have no clue if it works with all the
>different configurations supported by the U-Boot.
>If you have any suggestion to solve this issue, please let me know.

 

your solution looks as good, for " all the different configurations supported by the U-Boot"

may be recommended to post on uboot mail list :  https://lists.denx.de/listinfo/u-boot

 

Best regards
igor

0 Kudos