SPL variant of sunxi nand module
Hi all,
While fighting with this A20-olinuxino nand boot process I've initially found that some essential nand-related parameters are apparently missing by default, preventing reasonable nand operation, so I started debugging this gradually.
Quoted 4 lines
U-Boot SPL 2019.01-rc2 (Dec 20 2018 - 16:30:46 +0300)
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2DRAM: 1024 MiB
Trying to boot from NAND
Now I've discovered that SPL-build variant of sunxi_nand module is missing the sunxi_nand_init() whatsoever. Apparently it is on purpose, because:
#ifndef CONFIG_SPL_BUILD
sunxi_nand_init();#endif
And I cannot simply un-ifdef sunxi_nand_init() here, because the SPL build would fail with undefined symbol then, but I'm wondering, where are all values (like ECC strength and such) are expected to come from instead? Is SPL nand loader is supposed to be usable at all currently?
Thank you,
Regards,
Nikolai
Hi again,
Quoted 5 lines · 23.12.2018 16:29, I wrote:
Quoted 4 lines
U-Boot SPL 2019.01-rc2 (Dec 20 2018 - 16:30:46 +0300)
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2DRAM: 1024 MiB
Trying to boot from NAND
Ok, discovered a special SPL-only sunxi_nand_spl variant, added some debugging, so the detection is visible:
In nand_detect_config(), start detection... Considering addr_cycles=5, page_size=2048
Considering ecc_size=1024, ecc_strength=0 failed(a).
Considering addr_cycles=5, page_size=2048 rejected. Considering addr_cycles=5, page_size=4096
Considering ecc_size=1024, ecc_strength=3 failed(a).
Considering addr_cycles=5, page_size=4096 rejected. Considering addr_cycles=5, page_size=8192
Considering ecc_size=1024, ecc_strength=4 good(b).
Considering addr_cycles=5, page_size=8192 accepted.
I'm almost 100% sure that correct config would be page_size=8192, ecc_size=1024, ecc_strength=40 (from nand chip identification structure for regular linux kernel)
Now the detection routine in sunxi_nand_spl apparently comes up with a value of ecc_strength=4 instead... Why is that?
Thank you,
Regards,
Nikolai
Quoted 10 lines
Thank you,
Regards,
Nikolai
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Hi
Quoted 24 lines · Nikolai Zhubr
Hi again,
Quoted 5 lines · 23.12.2018 16:29, I wrote:
Quoted 4 lines
U-Boot SPL 2019.01-rc2 (Dec 20 2018 - 16:30:46 +0300)
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2DRAM: 1024 MiB
Trying to boot from NANDOk, discovered a special SPL-only
sunxi_nand_splvariant, added some debugging, so the detection is visible:In
nand_detect_config(), start detection... Considering addr_cycles=5, page_size=2048
Considering ecc_size=1024, ecc_strength=0 failed(a).
Considering addr_cycles=5, page_size=2048 rejected. Considering addr_cycles=5, page_size=4096
Considering ecc_size=1024, ecc_strength=3 failed(a).
Considering addr_cycles=5, page_size=4096 rejected. Considering addr_cycles=5, page_size=8192
Considering ecc_size=1024, ecc_strength=4 good(b).
Considering addr_cycles=5, page_size=8192 accepted.
Quoted 3 lines
I'm almost 100% sure that correct config would be page_size=8192, ecc_size=1024, ecc_strength=40 (from nand chip identification structure for regular linux kernel)
That is an index on an array. Am I wrong? so the max is 74
Michael
Quoted 3 lines
Now the detection routine in
sunxi_nand_splapparently comes up with a value of ecc_strength=4 instead... Why is that?
n - 1 using an index, if the code that I have is aligned so
Michael
Quoted 23 lines
Thank you,
Regards,
NikolaiQuoted 10 lines
Thank you,
Regards,
Nikolai
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
Hi Michael,
23.12.2018 18:54, Michael Nazzareno Trimarchi:
[...]
Quoted 8 lines
Quoted 6 lines
Considering ecc_size=1024, ecc_strength=4 good(b).Considering addr_cycles=5, page_size=8192 accepted.
I'm almost 100% sure that correct config would be page_size=8192, ecc_size=1024, ecc_strength=40 (from nand chip identification structure for regular linux kernel)
That is an index on an array. Am I wrong? so the max is 74
Indeed, its an index, and therefore it appears SPL's detection actually gives correct values! Nevertheless, SPL reads all zeroes from nand.
On the other hand, normal U-boot variant reads correct data from nand, but I'm not yet sure if it uses correct parameters and specifically, if they match those of SPL version. Need to add yet more debugging output.
Thank you,
Regards,
Nikolai
Quoted 36 lines
Michael
Quoted 3 lines
Now the detection routine in
sunxi_nand_splapparently comes up with a value of ecc_strength=4 instead... Why is that?n - 1 using an index, if the code that I have is aligned so
Michael
Quoted 23 lines
Thank you,
Regards,
NikolaiQuoted 10 lines
Thank you,
Regards,
Nikolai
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Hi again,
23.12.2018 21:11, I wrote:
[...]
Quoted 2 lines
Indeed, its an index, and therefore it appears SPL's detection actually gives correct values! Nevertheless, SPL reads all zeroes from nand.
Regarding the sunxi_nand_spl.c module, I can not find any mention if it implies NAND_ECC_HW, NAND_ECC_HW_SYNDROME, or rather some other mode, or if these modes are irrelevant in this case?
Can not guess browsing through the code, it looks too different from sunxi_nand.c to compare.
Thank you,
Regards,
Nikolai
Quoted 51 lines
On the other hand, normal U-boot variant reads correct data from nand, but I'm not yet sure if it uses correct parameters and specifically, if they match those of SPL version. Need to add yet more debugging output.
Thank you,
Regards,
NikolaiQuoted 36 lines
Michael
Quoted 3 lines
Now the detection routine in
sunxi_nand_splapparently comes up with a value of ecc_strength=4 instead... Why is that?n - 1 using an index, if the code that I have is aligned so
Michael
Quoted 23 lines
Thank you,
Regards,
NikolaiQuoted 10 lines
Thank you,
Regards,
Nikolai
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
23.12.2018 21:58, I wrote:
[...]
Quoted 3 lines
Regarding the
sunxi_nand_spl.cmodule, I can not find any mention if it impliesNAND_ECC_HW,NAND_ECC_HW_SYNDROME, or rather some other mode, or if these modes are irrelevant in this case?
So far I'm observing that sunxi_nand_spl module refuses to load erased nand pages (500000 in the example below), which is correct, but it "successfully" loads filled nand pages as totally zeroed out, which is supposedly incorrect. This is in contrast with sunxi_nand module, that loads filled pages correctly, at least in my simple tests.
So while detection in sunxi_nand_spl seems fine, reading seems not.
I think digging deeper without some additional advice is a bit beyond my capabilities, although most probably some very tiny bits are missing...
Thank you,
Regards,
Nikolai
U-Boot SPL 2019.01-rc2 (Dec 23 2018 - 23:23:57 +0300)
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
DRAM: 1024 MiB
Quoted 1 line
Quoted 1 line
SPL:
board_init_r()
Trying to boot from NAND
spl: nand - using hw ecc
[zh]nand_spl_load_image(500000, 40)=-22
[zh]Read dump of page 768 (nand offs 600000, page_size 8192):
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[zh]Read dump of page 768 (nand offs 600000, page_size 8192):
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
=====================================================
U-Boot 2019.01-rc2 (Dec 23 2018 - 22:30:35 +0300) Allwinner Technology
CPU: Allwinner A20 (SUN7I) Model: Olimex A20-Olinuxino Micro I2C: ready DRAM: 1 GiB NAND: nand_base: device found, Manufacturer ID: 0xad, Chip ID: 0xd7 nand_base: Hynix H27UBG8T2BTR-BC 32G 3.3V 8-bit nand_base: Hynix H27UBG8T2BTR-BC 32G 3.3V 8-bit nand_base: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 640 Using ECC step 1024, strength 40, mode 2 4096 MiB In: serial Out: serial Err: serial SCSI: SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst
Net: Can't get reset: -524 eth0: ethernet at 1c50000 Hit any key to stop autoboot: 0
=> nand read 0x45000000 0x400000 0x1000
NAND read: device 0 offset 0x400000, size 0x1000 Scanning device for bad blocks
Bad eraseblock 0 at 0x0000001fe000
Bad eraseblock 1 at 0x0000003fe000
4096 bytes read: OK
=> md.b 0x45000000 100
45000000: b8 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5
................
=====================================================
Quoted 63 lines
Can not guess browsing through the code, it looks too different from
sunxi_nand.cto compare.Thank you,
Regards,
NikolaiQuoted 51 lines
On the other hand, normal U-boot variant reads correct data from nand, but I'm not yet sure if it uses correct parameters and specifically, if they match those of SPL version. Need to add yet more debugging output.
Thank you,
Regards,
NikolaiQuoted 36 lines
Michael
Quoted 3 lines
Now the detection routine in
sunxi_nand_splapparently comes up with a value of ecc_strength=4 instead... Why is that?n - 1 using an index, if the code that I have is aligned so
Michael
Quoted 23 lines
Thank you,
Regards,
NikolaiQuoted 10 lines
Thank you,
Regards,
Nikolai
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Hi again,
The following commit (titled "use PIO instead of DMA") apparently broke actual reading of nand pages in SPL at least for A20:
http://git.denx.de/?p=u-boot.git;a=commit;h=6ddbb1e936c78cdef1e7395039fa7020c5c75326
Instead of reading page contents, non-dma (current) version just feeds zeroes here.
Tested on A20-olinuxino-micro with a Hynix 4GB nand chip.
It'd be nice to somehow fix it back eventually :)
Other than that, nand boot seems usable (with added necessary chip id).
Thank you,
Regards,
Nikolai
Quoted 134 lines · 24.12.2018 0:00, I wrote:
23.12.2018 21:58, I wrote:
[...]Quoted 3 lines
Regarding the
sunxi_nand_spl.cmodule, I can not find any mention if it impliesNAND_ECC_HW,NAND_ECC_HW_SYNDROME, or rather some other mode, or if these modes are irrelevant in this case?So far I'm observing that
sunxi_nand_splmodule refuses to load erased nand pages (500000 in the example below), which is correct, but it "successfully" loads filled nand pages as totally zeroed out, which is supposedly incorrect. This is in contrast withsunxi_nandmodule, that loads filled pages correctly, at least in my simple tests.So while detection in
sunxi_nand_splseems fine, reading seems not.I think digging deeper without some additional advice is a bit beyond my capabilities, although most probably some very tiny bits are missing...
Thank you,
Regards,
NikolaiU-Boot SPL 2019.01-rc2 (Dec 23 2018 - 23:23:57 +0300)
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2DRAM: 1024 MiB
Quoted 1 line
Quoted 1 line
SPL:
board_init_r()Trying to boot from NAND
spl: nand - using hw ecc
[zh]nand_spl_load_image(500000, 40)=-22
[zh]Read dump of page 768 (nand offs 600000,page_size8192):
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
[zh]Read dump of page 768 (nand offs 600000,page_size8192):
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
=====================================================
U-Boot 2019.01-rc2 (Dec 23 2018 - 22:30:35 +0300) Allwinner TechnologyCPU: Allwinner A20 (SUN7I)
Model: Olimex A20-Olinuxino Micro
I2C: ready
DRAM: 1 GiB
NAND:nand_base: device found, Manufacturer ID:0xad, Chip ID:0xd7nand_base: Hynix H27UBG8T2BTR-BC 32G 3.3V 8-bitnand_base: Hynix H27UBG8T2BTR-BC 32G 3.3V 8-bitnand_base: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB
size: 640
Using ECC step 1024, strength 40, mode 2
4096 MiB
In: serial
Out: serial
Err: serial
SCSI: SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps0x1impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apstNet: Can't get reset: -524
eth0: ethernet at 1c50000
Hit any key to stop autoboot: 0
=> nand read0x450000000x4000000x1000NAND read: device 0 offset
0x400000, size0x1000
Scanning device for bad blocks
Bad eraseblock 0 at0x0000001fe000
Bad eraseblock 1 at0x0000003fe000
4096 bytes read: OK
=> md.b0x45000000100
45000000: b8 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 ................
=====================================================Quoted 63 lines
Can not guess browsing through the code, it looks too different from
sunxi_nand.cto compare.Thank you,
Regards,
NikolaiQuoted 51 lines
On the other hand, normal U-boot variant reads correct data from nand, but I'm not yet sure if it uses correct parameters and specifically, if they match those of SPL version. Need to add yet more debugging output.
Thank you,
Regards,
NikolaiQuoted 36 lines
Michael
Quoted 3 lines
Now the detection routine in
sunxi_nand_splapparently comes up with a value of ecc_strength=4 instead... Why is that?n - 1 using an index, if the code that I have is aligned so
Michael
Quoted 23 lines
Thank you,
Regards,
NikolaiQuoted 10 lines
Thank you,
Regards,
Nikolai
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Hi,
Its just to remind sunxi_nand_spl.c is still broken. (And probably has been for a couple releases or so).
I'm unable to fix it myself (other than reverting the mentioned commit locally.)
Thank you,
Regards,
Nikolai
24.12.2018 0:47, Nikolai Zhubr:
Quoted 22 lines
Hi again,
The following commit (titled "use PIO instead of DMA") apparently broke actual reading of nand pages in SPL at least for A20:
http://git.denx.de/?p=u-boot.git;a=commit;h=6ddbb1e936c78cdef1e7395039fa7020c5c75326
Instead of reading page contents, non-dma (current) version just feeds zeroes here.
Tested on A20-olinuxino-micro with a Hynix 4GB nand chip.It'd be nice to somehow fix it back eventually :)
Other than that, nand boot seems usable (with added necessary chip id).
Thank you,
Regards,
Nikolai