Resend: NAND 16bit ONFI problem
Subsystems (2)
Hello.
Updated: Same effect for 3.10 kernel.
--------
I have a problem with attach NAND UBI in 16 bit mode. NAND works fine if I specify NAND_BUSWIDTH_16 option, but not working with NAND_BUSWIDTH_AUTO option. In second case NAND chip is identifyed with ONFI. Logs below.
Can anyone help me with this issue? Is it a known problem? Thanks.
PS: Kernel 3.9.3
New chip, first start, NAND_BUSWIDTH_AUTO:
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xca (Micron MT29F2G16ABAEAWP), 256MiB, page size: 2048, OOB size: 64 Scanning device for bad blocks
Creating 1 MTD partitions on "MT29F2G16ABAEAWP":
0x000000000000-0x000010000000 : "nand-gpio"
UBI: attaching mtd4 to ubi0
UBI: scanning is finished
UBI: empty MTD device detected
UBI: attached mtd4 (name "nand-gpio", size 256 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 512 (aligned 512), data offset: 2048
UBI: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 2920475650
UBI: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
UBI: background thread "ubi_bgt0d" started, PID 22
sync && reboot:
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xca (Micron MT29F2G16ABAEAWP), 256MiB, page size: 2048, OOB size: 64 Scanning device for bad blocks
Creating 1 MTD partitions on "MT29F2G16ABAEAWP":
0x000000000000-0x000010000000 : "nand-gpio"
UBI: attaching mtd4 to ubi0
UBI: fixable bit-flip detected at PEB 2
UBI: fixable bit-flip detected at PEB 3
UBI: fixable bit-flip detected at PEB 4
UBI: fixable bit-flip detected at PEB 5
UBI: fixable bit-flip detected at PEB 6
UBI: fixable bit-flip detected at PEB 7
...
NAND_BUSWIDTH_16:
Trying ONFI probe in 16 bits mode, aborting !
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xca (Micron NAND 256MiB 3,3V 16-bit), 256MiB, page size: 2048, OOB size: 64 Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 256MiB 3,3V 16-bit":
0x000000000000-0x000010000000 : "nand-gpio"
UBI: attaching mtd4 to ubi0
UBI: scanning is finished
UBI: empty MTD device detected
UBI: attached mtd4 (name "nand-gpio", size 256 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 512 (aligned 512), data offset: 2048
UBI: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 2573182024
UBI: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
UBI: background thread "ubi_bgt0d" started, PID 23
----------------
---
Adding Matthieu, since he introduced NAND_BUSWIDTH. Leaving full context intact.
Quoted 6 lines · Alexander Shiyan
Hello.
Updated: Same effect for 3.10 kernel.
--------
Quoted 7 lines
I have a problem with attach NAND UBI in 16 bit mode. NAND works fine if I specify
NAND_BUSWIDTH_16option, but not working withNAND_BUSWIDTH_AUTOoption. In second case NAND chip is identifyed with ONFI. Logs below.
Can anyone help me with this issue? Is it a known problem? Thanks.
PS: Kernel 3.9.3
I'm inspecting the NAND_BUSWIDTH_AUTO code and it looks rather broken. For chips with NAND_BUSWIDTH_AUTO, it calls nand_set_defaults() twice. The second call will do exactly nothing. To do this right, you'll probably have to hack up nand_set_defaults() so that it will check if the function pointer is one of two options:
1. NULL
2. the 8-bit version
My (untested, not compiled, and possibly line-wrapped) patch:
drivers/mtd/nand/nand_base.c +0 -0
@@ -2786,7 +2786,7 @@ static void nand_set_defaults(struct nand_chip
*chip, int busw)
if (!chip->select_chip)
chip->select_chip = nand_select_chip;
- if (!chip->read_byte)
+ if (!chip->read_byte || chip->read_byte == nand_read_byte)
chip->read_byte = busw ? nand_read_byte16 : nand_read_byte;
if (!chip->read_word)
chip->read_word = nand_read_word;
@@ -2794,9 +2794,9 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)
chip->block_bad = nand_block_bad;
if (!chip->block_markbad)
chip->block_markbad = nand_default_block_markbad;
- if (!chip->write_buf)
+ if (!chip->write_buf || chip->write_buf == nand_write_buf)
chip->write_buf = busw ? nand_write_buf16 : nand_write_buf;
- if (!chip->read_buf)
+ if (!chip->read_buf || chip->read_buf == nand_read_buf)
chip->read_buf = busw ? nand_read_buf16 : nand_read_buf;
if (!chip->scan_bbt)
chip->scan_bbt = nand_default_bbt;
Quoted 60 lines
New chip, first start,
NAND_BUSWIDTH_AUTO:ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID:0x2c, Chip ID:0xca(Micron MT29F2G16ABAEAWP), 256MiB, page size: 2048, OOB size: 64 Scanning device for bad blocks
Creating 1 MTD partitions on "MT29F2G16ABAEAWP":
0x000000000000-0x000010000000 : "nand-gpio"
UBI: attaching mtd4 to ubi0
UBI: scanning is finished
UBI: empty MTD device detected
UBI: attached mtd4 (name "nand-gpio", size 256 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 512 (aligned 512), data offset: 2048
UBI: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 2920475650
UBI: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
UBI: background thread "ubi_bgt0d" started, PID 22sync && reboot:
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID:0x2c, Chip ID:0xca(Micron MT29F2G16ABAEAWP), 256MiB, page size: 2048, OOB size: 64 Scanning device for bad blocks
Creating 1 MTD partitions on "MT29F2G16ABAEAWP":
0x000000000000-0x000010000000 : "nand-gpio"
UBI: attaching mtd4 to ubi0
UBI: fixable bit-flip detected at PEB 2
UBI: fixable bit-flip detected at PEB 3
UBI: fixable bit-flip detected at PEB 4
UBI: fixable bit-flip detected at PEB 5
UBI: fixable bit-flip detected at PEB 6
UBI: fixable bit-flip detected at PEB 7
...
NAND_BUSWIDTH_16:Trying ONFI probe in 16 bits mode, aborting !
NAND device: Manufacturer ID:0x2c, Chip ID:0xca(Micron NAND 256MiB 3,3V 16-bit), 256MiB, page size: 2048, OOB size: 64 Scanning device for bad blocks
Creating 1 MTD partitions on "NAND 256MiB 3,3V 16-bit":
0x000000000000-0x000010000000 : "nand-gpio"
UBI: attaching mtd4 to ubi0
UBI: scanning is finished
UBI: empty MTD device detected
UBI: attached mtd4 (name "nand-gpio", size 256 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 512 (aligned 512), data offset: 2048
UBI: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 0, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence number: 2573182024
UBI: available PEBs: 2004, total reserved PEBs: 44, PEBs reserved for bad PEB handling: 40
UBI: background thread "ubi_bgt0d" started, PID 23
Quoted 2 lines
----------------
Brian
Quoted 54 lines
Adding Matthieu, since he introduced
NAND_BUSWIDTH. Leaving full context intact.Quoted 6 lines · Alexander Shiyan
Hello.
Updated: Same effect for 3.10 kernel.
--------
Quoted 7 lines
I have a problem with attach NAND UBI in 16 bit mode. NAND works fine if I specify
NAND_BUSWIDTH_16option, but not working withNAND_BUSWIDTH_AUTOoption. In second case NAND chip is identifyed with ONFI. Logs below.
Can anyone help me with this issue? Is it a known problem? Thanks.
PS: Kernel 3.9.3I'm inspecting the
NAND_BUSWIDTH_AUTOcode and it looks rather broken. For chips withNAND_BUSWIDTH_AUTO, it callsnand_set_defaults()twice. The second call will do exactly nothing. To do this right, you'll probably have to hack upnand_set_defaults()so that it will check if the function pointer is one of two options:1. NULL
2. the 8-bit versionMy (untested, not compiled, and possibly line-wrapped) patch:
drivers/mtd/nand/nand_base.c +1
-1@@ -2786,7 +2786,7 @@ static void nand_set_defaults(struct nand_chip *chip, int busw)if (!chip->select_chip) chip->select_chip = nand_select_chip; -if (!chip->read_byte) +if (!chip->read_byte || chip->read_byte == nand_read_byte) chip->read_byte = busw ? nand_read_byte16 : nand_read_byte;if (!chip->read_word)drivers/mtd/nand/nand_base.c +2
-2chip->read_word = nand_read_word;@@ -2794,9 +2794,9 @@ static void nand_set_defaults(struct nand_chip *chip, int busw) chip->block_bad = nand_block_bad;if (!chip->block_markbad) chip->block_markbad = nand_default_block_markbad; -if (!chip->write_buf) +if (!chip->write_buf || chip->write_buf == nand_write_buf) chip->write_buf = busw ? nand_write_buf16 : nand_write_buf; -if (!chip->read_buf) +if (!chip->read_buf || chip->read_buf == nand_read_buf) chip->read_buf = busw ? nand_read_buf16 : nand_read_buf;if (!chip->scan_bbt)
Quoted 2 lines
chip->scan_bbt=nand_default_bbt;
Thanks Brian! Tested by me and it works now as expected.
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xca (Micron MT29F2G16ABAEAWP), 256MiB, page size: 2048, OOB size: 64 Scanning device for bad blocks
Creating 1 MTD partitions on "MT29F2G16ABAEAWP":
0x000000000000-0x000010000000 : "nand-gpio"
UBI: attaching mtd4 to ubi0
UBI: scanning is finished
UBI: attached mtd4 (name "nand-gpio", size 256 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 512 (aligned 512), data offset: 2048
UBI: good PEBs: 2048, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 3483347360
UBI: available PEBs: 0, total reserved PEBs: 2048, PEBs reserved for bad PEB handling: 40
UBI: background thread "ubi_bgt0d" started, PID 28
...
UBIFS: default file-system created
UBIFS: background thread "ubifs_bgt0_0" started, PID 45
UBIFS: mounted UBI device 0, volume 0, name "bbox"(null)
UBIFS: LEB size: 129024 bytes (126 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
UBIFS: FS size: 256886784 bytes (244 MiB, 1991 LEBs), journal size 12902400 bytes (12 MiB, 100 LEBs)
UBIFS: reserved for root: 4952683 bytes (4836 KiB)
UBIFS: media format: w4/r0 (latest is w4/r0), UUID 39D861DA-6C42-4A27-97F2-F11FA4A5B334, small LPT model
Can you make a patch for stable?
Thanks again.
---
Quoted 1 line · Alexander Shiyan
Quoted 1 line
My (untested, not compiled, and possibly line-wrapped) patch:
...
Quoted 1 line
Thanks Brian! Tested by me and it works now as expected.
Great, glad to hear.
...
Quoted 1 line
Can you make a patch for stable?
Sent.
Quoted 1 line
Thanks again.
You're welcome.
Brian