cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hbachmann
Adventurer
Adventurer
2,933 Views
Registered: ‎05-03-2012

NAND Flash: U-Boot is using on-die ECC instead of HW-ECC

Hello,

we've a custom board using NAND Flash 'Micron MT29F8G08ADADAH4', which is not in the approved list shown in UG908
but the nearly similar MT29F8G08AB is in the list.

Supported.flash.memory.devices.xilinx.png

I have problems in U-Boot to read correct data from our NAND Flash when it's been written in Linux and vice versa.
We're using PetaLinux and Vivado 2019.1 and ZynqMP.

It seems that U-Boot is using per default on-die ECC and the Kernel HW-ECC.
How can I bring U-Boot to use HW-ECC? In the arasan_nfc.c driver I cannot see any devicetree readings.
I've tried to hard code HW-ECC (by disabling the call to function 'arasan_check_ondie(mtd)' in 'arasan_nand_init()'), but the read errors occours even more...

Here's the relevant part of my devicetree files:

zynqmp.dtsi:

		...
		nand0: nand@ff100000 {
			compatible = "arasan,nfc-v3p10";
			status = "disabled";
			reg = <0x0 0xff100000 0x0 0x1000>;
			clock-names = "clk_sys", "clk_flash";
			interrupt-parent = <&gic>;
			interrupts = <0 14 4>;
			#address-cells = <1>;
			#size-cells = <0>;
			#stream-id-cells = <1>;
			iommus = <&smmu 0x872>;
			power-domains = <&zynqmp_firmware 44>;
		};
		...
		

pcw.dtsi:

..		
&nand0 {
	status = "okay";
};
..

system-conf.dtsi:

..
&nand0 {
	#address-cells = <1>;
	#size-cells = <1>;
};
..

zynqmp-clk-ccf.dtsi:

..
&nand0 {
	clocks = <&zynqmp_clk 60>, <&zynqmp_clk 31>;
};
..

system-user.dtsi:

..
&nand0 {
	nand@0 {
		reg = <0>;
		nand-ecc-mode = "hw";		
		nand-bus-width = <0x8>;		
		nand-on-flash-bbt = "true";	
		nand-ecc-algo = "bch";		
		nand-ecc-strength = <4>;	
		nand-ecc-step-size = <528>;	
		nand-ecc-maximize = "true";	
		nand-is-boot-medium = "true";	
		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;
			partition@0 {
				label = "BOOT1";
				reg = <0x0 0x00500000>;
			};
			partition@1 {
				label = "TEST1";
				reg = <0x00A00000 ...
			...
		};
	};
};

Thanks for any help!

0 Kudos
9 Replies
hbachmann
Adventurer
Adventurer
2,866 Views
Registered: ‎05-03-2012

Hi,

does nobody write/read to/from NAND from running U-Boot/Linux?

Also everybody using UBIFS with NAND should have a problem with 2019.1 (especially writing a ubi image in U-Boot and 'ubiattach' from linux)

Regards,

Helmut

0 Kudos
ottob
Explorer
Explorer
2,720 Views
Registered: ‎05-26-2017

Arasan NAND driver is not maintained very well. It worked OK wit Micron (On-Die) chips in 2017.3, but then in 2018.2 it was broken. Not sure if they fixed it for 2019.1. I've spent/wasted lots of time on this, see my other posts in here. Basically we opted to use On-Die ECC in both U-boot and the Kernel. Using MIcron MT29F4G08

0 Kudos
hbachmann
Adventurer
Adventurer
2,699 Views
Registered: ‎05-03-2012

Thanks OttoB to your suggestions!

 

0 Kudos
shabbirk
Moderator
Moderator
2,670 Views
Registered: ‎12-04-2016

Hi @ottob @hbachmann 

We need to use the same ECC for both the u-boot and kernel. It could be either on-die or HW ECC.  

From your device tree, it look you have enabled “hw” ECC in case of Linux. You can try changing it to have nand-ecc-mode = "on-die";

In u-boot, the driver reads parameters from NAND device. If the device supports on-die ECC, it is then enabled in the driver too.

I would recommend enabling on-die ecc in linux and see if that helps.

 

Best Regards

Shabbir

0 Kudos
hbachmann
Adventurer
Adventurer
2,664 Views
Registered: ‎05-03-2012

Thanks Shabbir for your answer,

to change the devicetree to

nand-ecc-mode = "on-die";	

has no influence on arasan linux driver in 2019.1.

I agree that u-boot and linux should use the same ECC mechanism.

Regards,

Helmut

0 Kudos
flind@mit.edu
Visitor
Visitor
1,629 Views
Registered: ‎05-02-2019

We have an identical device on a custom Zynq 7000 board. Were you ever able to solve this issue?

Thanks,

Frank

0 Kudos
ottob
Explorer
Explorer
1,623 Views
Registered: ‎05-26-2017

Hi Frank !

Here is the patch. I've learned one thing through the months spent on this - Avoid raw flash w/ On-Die ECC like the plague if you want to use it with Xilinx devices. eMMC seems to be the way everyone is going 

 

MIT ! Interesting, you working on anything exciting ?

 

/Otto

0 Kudos
flind@mit.edu
Visitor
Visitor
1,614 Views
Registered: ‎05-02-2019

Thanks very much! We are building a couple of cubesats at the moment.
0 Kudos
ottob
Explorer
Explorer
1,605 Views
Registered: ‎05-26-2017

Just to clarify - The solution was to run on-Die ECC on both u-boot and in Linux 

0 Kudos