[EXT] [PATCH] mtd: mxs_nand: default to legacy bch and rename to modern bch option

Stefano Babic sbabic at denx.de
Tue Mar 22 11:26:12 CET 2022


Hi Frieder,

sorry for late answer.
On 17.03.22 14:24, Frieder Schrempf wrote:
> Hi Stefano,
> 
> this old patch was delegated to you in patchwork. If you're not the
> correct maintainer to address, please let me know. As the NAND layer
> seems to be unmaintained at the moment, I'm not sure whom to ask.
> 

I am not the maintainer, but I picked up also in the past patches for 
NAND else they could not be merged. I will do this time, too.

Han has sent a patch yesterday to align u-boot and kernel, and it is 
okay if it is assigned to me, I will then merge it. I see from Sean he 
can test on thursday.

Regards,
Stefano

> This patch fixes a regression that was introduced by 616f03dabacb ("
> mtd: gpmi: change the BCH layout setting for large oob NAND") which
> alters the BCH layout in a way that doesn't match with the
> implementation in the Linux kernel.
> 
> This causes failures when loading an UBI image in U-Boot that was
> flashed by Linux or vice versa (see [1]).
> 
> There has been an approach to fix this through an optional devicetree
> property in 51cdf83eea ("mtd: gpmi: provide the option to use legacy bch
> geometry"), but this is not acceptable. The "legacy" BCH layout
> compatible with Linux should be used by default.
> 
> The approach to upstream the "new" layout to the kernel [2] seems to be
> stalled and even if it would succeed, it would break systems that use an
> old U-Boot and a new kernel, which is again not really acceptable in my
> opinion.
> 
> For the reasons above I would like to ask U-Boot maintainers to pick up
> this patch.
> 
> Thanks
> Frieder
> 
> [1] https://lists.denx.de/pipermail/u-boot/2022-March/477828.html
> [2]
> https://patchwork.ozlabs.org/project/linux-mtd/patch/20210522205136.19465-2-han.xu@nxp.com/
> 
> Am 20.05.21 um 11:09 schrieb Sean Nyekjaer:
>> On 13/05/2021 22.02, han.xu wrote:
>>> On 21/05/11 07:08AM, Sean Nyekjaer wrote:
>>>> Caution: EXT Email
>>>>
>>>> On 11/05/2021 04.49, han.xu wrote:
>>>>> On 21/05/10 12:00PM, Sean Nyekjaer wrote:
>>>>>> Caution: EXT Email
>>>>>>
>>>>>> Linux kernel defaults to use legacy bch setting, this was creating a
>>>>>> mismatch between U-boot and Linux default settings.
>>>>> Kernel uses the NAND chip specified minimum ecc strength and steps by default
>>>>> not the legacy bch setting, unless users enable it in DT file.
>>>>>
>>>>
>>>> Hi,
>>>>
>>>> Adding, mtd-list and Miquel
>>>>
>>>> With u-boot dtb:
>>>> &gpmi {
>>>>          pinctrl-names = "default";
>>>>          pinctrl-0 = <&pinctrl_gpmi_nand1>;
>>>>          compatible = "fsl,imx7d-gpmi-nand";
>>>>          nand-on-flash-bbt;
>>>>          status = "okay";
>>>> };
>>>>
>>>> With linux dtb (mainline 5.10):
>>>> &gpmi {
>>>>          pinctrl-names = "default";
>>>>          pinctrl-0 = <&pinctrl_gpmi_nand1>;
>>>>          nand-on-flash-bbt;
>>>>          status = "okay";
>>>> };
>>>>
>>>> U-boot prior to commit 51cdf83eea selected 18 bit ECC, after that commit it selects 8 bits.
>>>> With legacy option it selects 18.
>>>> Linux is selecting 18 bits ;) So now we have a mismatch.
>>>>
>>>> I have been searching for the legacy option in the mainline kernel can't find it ;)
>>>> Please show me where it is (is it in the NXP fork?)
>>>
>>> You are right, it's only fixed in NXP fork, with kernel driver modification. We
>>> prefer the current u-boot bch geometry, so I will send out a kernel patch to
>>> make them align.
>>>
>> Any progress on this?
>>
>> I see your patch in:
>> https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.codeaurora.org%2Fexternal%2Fimx%2Flinux-imx%2Fcommit%2Fdrivers%2Fmtd%2Fnand%2Fraw%2Fgpmi-nand%3Fh%3Dimx_5.4.70_2.3.0%26id%3Dae980dccc6189956fab047958ad0a70ec4951439&data=04%7C01%7Cfrieder.schrempf%40kontron.de%7C275b7f11361e4fd3eb7e08d91b6f0e45%7C8c9d3c973fd941c8a2b1646f3942daf1%7C0%7C0%7C637570986066857865%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=L4xAN9HDl68dmA%2FX6nnP%2Buqh6CUKTQZJeFWja5EvmPI%3D&reserved=0
>>
>> But I can't find the option for selecting legacy mode in the devicetree...
>>
>> /Sean


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list