首先拜谢一下这几位作者
具体解决办法
http://www.61ic.com/Article/DaVinci/TMS320DM3x/201307/49496.html
遇到类似问题 K9K8G08U0E替换K9K8G08U0B的blog
http://blog.youkuaiyun.com/daidi1989/article/details/32335331
如何编写linux下nand flash驱动(具体讲解)
http://www.crifan.com/files/doc/docbook/linux_nand_driver/release/html/linux_nand_driver.html#nand_flash_page
本文主要讲述flash的替换SAMSUNG K9K8G08U0E替换K9K8G08U0B中遇到的问题
一、出现的问题
主要是两点
1.boot能够烧入,但是kernel,rootfs烧不进去,使用nand read/write 会报-74错,校验错误
2.使用ubi文件系统,同样会报错
UBI error: ubi_io_read: error -74 while reading 64 bytes from PEB 0:0, read 64 bytes
二、解决办法
下面说一下解决办法
我的u-boot版本:u-boot-2009.11-rc1
linux kernel版本:2.6.29.6
前面改法作废。
1. 代码修改
u-boot,kernel都需要改,改法相同,如下:
/drivers/mtd/nand/nand_base.c 修改函数nand_get_flash_type
/* Get chip options, preserve non chip based options */
chip->options &= ~NAND_CHIPOPTIONS_MSK;
/*Add by zhangjj 2015-8-6*/
chip->options |= NAND_NO_SUBPAGE_WRITE; /*close subpage write mode to compatibale K9K8G08U0B with K9K8G08U0E*/
/*add end*/
chip->options |= type->options & NAND_CHIPOPTIONS_MSK;
2. 修改mkfs.ubifs -e参数
例如:
mkfs.ubifs -r ./bin -m 2048 -e 129024 -c 300 -o kernel.img
改为:
mkfs.ubifs -r ./bin -m 2048 -e 126976 -c 300 -o kernel.img
说明:
第1步是将小页模式关闭,使同时兼容两种芯片
第2步是因为大页模式下,UBI可擦除逻辑块大小少了2个page(2048),(64-2)*2KiB=124KiB
K9K8G08U0D应该是与 K9K8G08U0B差不多,所以改法应该一样
三、问题解决过程
1.原厂咨询
1) 新芯片不支持小页模式写入,驱动里面的读写方式需要修改
(老芯片一个块为2048,可以分多次写入,新芯片一个块为2048+64,只能一次写入)
2) Device id不同
2.通过对比datasheet,两flash的功能块表和 阵列组织相同,如下
3.继续对比手册,如下不同:
4.Program/Erase Characteristics Nop有差异
对比参考上面链接
三星原厂就K9K8G08U0D升级为K9K8G08U0E的回信:
1. please check the below timing first.
K9F1G08U0E vs K9F1G08U0D Timing difference
tR tPROG tBERS NOP
K9F1G08U0E Max. 40us Max. 900us Max. 16ms 1
K9F1G08U0D Max. 40us Max. 750us Max. 10ms 4
2. if timing is OK, please kindly know the 21nm SLC NOP=1 , not 4
it means every NAND page you can just write one time,
if you want to write the data in the same page again, you need to erase first
3. please note :
due to 21nm SLC NOP=1, it means you can not use "Partial Program" for it
if you use this function in our 42 nm SLC and want to change to 21nm SLC
the way to solve it is modify host FTL algorithm
there is FTL (flash transfer layer) between file-system and raw NAND
( FTL : flash transfer layer ; such as bad blocks, page size write /read, ECC , wearleveling.....)
in solution base such as eMMC or SSD, the inside controller handle FTL
but for Raw NAND, it has NO controller inside and needs host to handle this algorithm
4. image-partition FAT table error
please kindly check the physcial to logical table
in logical, you can write the data in the same area
but, in physical, when you want to write or update the new data to the same page
you can not write directly in the same page due to NOP=1
you need to write to another page
总共就这几点差异,1.读写的时钟,2.nop差异导致小页模式失效(这一点与当初技术支持的沟通相同)
关于时钟,网上大神修改过,还是不行,基本就定位在第二点
关于子页操作
后来遇到这篇文章:http://www.61ic.com/Article/DaVinci/TMS320DM3x/201307/49496.html
按照他的步骤以及nand操作过程http://www.cnblogs.com/dyllove98/archive/2013/07/16/3194139.html
修改后已基本跑起来了,中间遇到需要调整ubi的问题,将在《ubi问题汇总》进行总结。
具体步骤参照如下链接
http://blog.youkuaiyun.com/davion_zhang/article/details/47400419