
5 Aug
2008
5 Aug
'08
5:21 p.m.
On Tue, Aug 05, 2008 at 03:36:43PM +0200, Guennadi Liakhovetski wrote:
/*
* offs has to be aligned to a block address!
*/ block = offs / CFG_NAND_BLOCK_SIZE;* offs has to be aligned to a page address!
- /* Recalculate offs as an offset inside a block */
- offs -= CFG_NAND_BLOCK_SIZE * block; blockcopy_count = 0;
- while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
if (!nand_is_bad_block(mtd, block)) {
/*
* Skip bad blocks
*/
for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
nand_read_page(mtd, block, page, dst);
dst += CFG_NAND_PAGE_SIZE;
- while (blockcopy_count < ((uboot_size + CFG_NAND_BLOCK_SIZE - 1) /
CFG_NAND_BLOCK_SIZE)) {
If you're going to allow offs to be block-unaligned, I think this calculation needs to change. For example: blocksize 16K, offset 14K, and length 256K would try to read 16 blocks, when it needs to read 17.
-Scott