|
40 | 40 | /* FUNCTION RELEASE */ |
41 | 41 | /* */ |
42 | 42 | /* _lx_nand_flash_open PORTABLE C */ |
43 | | -/* 6.1.7 */ |
| 43 | +/* 6.1.9 */ |
44 | 44 | /* AUTHOR */ |
45 | 45 | /* */ |
46 | 46 | /* William E. Lamie, Microsoft Corporation */ |
|
94 | 94 | /* resulting in version 6.1 */ |
95 | 95 | /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ |
96 | 96 | /* resulting in version 6.1.7 */ |
| 97 | +/* 10-15-2021 Bhupendra Naphade Modified comment(s), */ |
| 98 | +/* removed multiple write */ |
| 99 | +/* to page 0, */ |
| 100 | +/* resulting in version 6.1.9 */ |
97 | 101 | /* */ |
98 | 102 | /**************************************************************************/ |
99 | 103 | UINT _lx_nand_flash_open(LX_NAND_FLASH *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *)) |
@@ -282,22 +286,11 @@ LX_INTERRUPT_SAVE_AREA |
282 | 286 | } |
283 | 287 |
|
284 | 288 | /* Setup the initial erase count to 1. */ |
285 | | - page_word_ptr[0] = (((ULONG) 1) | LX_BLOCK_ERASED); |
| 289 | + page_word_ptr[0] = (((ULONG) 1)); |
286 | 290 |
|
287 | 291 | /* Write the initial erase count for the block. */ |
288 | 292 | status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); |
289 | 293 |
|
290 | | - /* Check for status after the block erase. */ |
291 | | - if (status == LX_SUCCESS) |
292 | | - { |
293 | | - |
294 | | - /* Setup the initial erase count to 1. */ |
295 | | - page_word_ptr[0] = ((ULONG) 1); |
296 | | - |
297 | | - /* Write the initial erase count for the block. */ |
298 | | - status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); |
299 | | - } |
300 | | - |
301 | 294 | /* Check for an error from flash driver. */ |
302 | 295 | if (status) |
303 | 296 | { |
@@ -497,20 +490,11 @@ LX_INTERRUPT_SAVE_AREA |
497 | 490 | /* Continue with next block. */ |
498 | 491 | continue; |
499 | 492 | } |
| 493 | + |
| 494 | + /* Write the final erase count for the block. */ |
| 495 | + page_word_ptr[0] = max_erased_count; |
| 496 | + status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, 1); |
500 | 497 |
|
501 | | - /* Write the initial erase count for the block. */ |
502 | | - page_word_ptr[0] = (max_erased_count | LX_BLOCK_ERASED); |
503 | | - status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); |
504 | | - |
505 | | - /* Determine if the write was successful. */ |
506 | | - if (status == LX_SUCCESS) |
507 | | - { |
508 | | - |
509 | | - /* Write the initial erase count for the block. */ |
510 | | - page_word_ptr[0] = max_erased_count; |
511 | | - status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); |
512 | | - } |
513 | | - |
514 | 498 | /* Check for an error from flash driver. */ |
515 | 499 | if (status) |
516 | 500 | { |
|
0 commit comments