From: <oh...@ma...> - 2009-04-02 23:22:15
|
Author: oharboe Date: 2009-04-02 23:22:14 +0200 (Thu, 02 Apr 2009) New Revision: 1443 Modified: trunk/src/flash/nand.c Log: Nicolas Pitre nico at cam.org This at least should make the "nand info" command a little more useful. Modified: trunk/src/flash/nand.c =================================================================== --- trunk/src/flash/nand.c 2009-04-02 21:20:35 UTC (rev 1442) +++ trunk/src/flash/nand.c 2009-04-02 21:22:14 UTC (rev 1443) @@ -689,6 +689,8 @@ LOG_ERROR("erase operation didn't pass, status: 0x%2.2x", status); return ERROR_NAND_OPERATION_FAILED; } + + device->blocks[i].is_erased = 1; } return ERROR_OK; @@ -770,9 +772,15 @@ int nand_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size) { + u32 block; + if (!device->device) return ERROR_NAND_DEVICE_NOT_PROBED; + block = page / (device->erase_size / device->page_size); + if (device->blocks[block].is_erased == 1) + device->blocks[block].is_erased = 0; + if (device->use_raw || device->controller->write_page == NULL) return nand_write_page_raw(device, page, data, data_size, oob, oob_size); else |