Since func nand_read_skip_bad is used in uboot, so just build it in
uboot build. And use func mtd_read to replace it.
Change-Id: Ic5e161f7f03cd2da0099891812360af67a2b9db8
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Since mtd_read() can not skip bad block if meet bad block, so use
nand_read_skip_bad().
Change-Id: Ic2364b7f29de193412353fad36c86dc6e289e02d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
In the nand mtd, we will use chip info to operate nand, and get the chip
through mtd_to_nand(). So we should get mtd through dev_get_priv() but not
dev_get_uclass_platdata.
Change-Id: I1bacbec49158d04dc947a880dbe3a8043fe3123d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Reserve one block space for gpt table in mtd part info,
otherwise gpt table will be erased by user program.
Change-Id: I0545c55f7da2b5518ab766ed763b074b7558fd4f
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
The desc->lba is based on mtd->size: desc->lba = mtd->size >> 9;
If the mtd storage is spi nand or nand flash, reserve 4 blocks
for BBT(Bad Block Table). Then desc->lba is
desc->lba = (mtd->size >> 9) - (mtd->erasesize >> 9) * 4;
Change-Id: I70702623895fe05cec614c4c3ca5f3f6c41d26ca
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Attach the mtd driver to block device, then we can call common interface
(blk_dread & blk_dwrite) to operate storage in application layer.
Usage:
Open CONFIG_MTD_BLK & CONFIG_MTD.
Change-Id: I47a969322e2d20c12d46898bdc88f4104e1a15bf
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>