All of lore.kernel.org
 help / color / mirror / Atom feed
* ECC strength for device tree with imx6 processor
@ 2021-09-14  8:15 Torrelli, Maxime
  0 siblings, 0 replies; only message in thread
From: Torrelli, Maxime @ 2021-09-14  8:15 UTC (permalink / raw)
  To: u-boot

[-- Attachment #1: Type: text/plain, Size: 2595 bytes --]

Hello dear U-Boot members,

We recently tried to add support for 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.


Salutations/Greetings,

Maxime Torrelli
Embbeded Software Engineer
Conduent Business Solutions France

[cid:image001.png@01D7A951.8A9B5600]
1 rue Claude Chappe
07500 Guilherand-Granges

T +334 75 81 56 81
maxime.torrelli@conduent.com<mailto:maxime.torrelli@conduent.com>

Through our dedicated associates, we deliver mission-critical services and solutions on behalf of businesses and governments - creating exceptional outcomes for our clients and the millions of people who count on them. Learn more at www.conduent.com<https://www.conduent.com/>.


[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 3329 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-14 10:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  8:15 ECC strength for device tree with imx6 processor Torrelli, Maxime

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.