__s32 PHY_SimpleErase_2CH (struct boot_physical_param *eraseop ) { __s32 status; __s32 ret = 0; __u32 rb; for(NandIndex = 0; NandIndex<CHANNEL_CNT;NandIndex++) { ret = _erase_single_block(eraseop); if (ret) return -1; rb = _cal_real_rb(eraseop->chip); NFC_SelectChip(eraseop->chip); NFC_SelectRb(rb); /*get status*/ while(1){ status = _read_status(0x70,eraseop->chip); if (status & NAND_STATUS_READY) break; } if (status & NAND_OPERATE_FAIL) ret = -2; NFC_DeSelectChip(eraseop->chip); NFC_DeSelectRb(rb); if(NandIndex == (CHANNEL_CNT-1)) break; } NandIndex = 0; return ret; }
__s32 PHY_SimpleWrite_CurCH(struct boot_physical_param * writeop) { __s32 status; __u32 rb; __s32 ret; //NandIndex = 0; ret = _write_single_page(writeop,0x80,0x10,0,0); if (ret) return -1; rb = _cal_real_rb(writeop->chip); NFC_SelectChip(writeop->chip); NFC_SelectRb(rb); /*get status*/ while(1){ status = _read_status(0x70,writeop->chip); if (status < 0) return status; if (status & NAND_STATUS_READY) break; } if (status & NAND_OPERATE_FAIL) ret = -2; NFC_DeSelectChip(writeop->chip); NFC_DeSelectRb(rb); return ret; }
__s32 _write_single_page_wait (struct boot_physical_param *writeop,__u32 program1,__u32 program2,__u8 dma_wait_mode, __u8 rb_wait_mode ) { __s32 ret = 0; __u32 rb; ret = NFC_Write_Wait( NULL, writeop->mainbuf, NULL, dma_wait_mode, rb_wait_mode, NFC_PAGE_MODE); if(SUPPORT_RANDOM) NFC_RandomDisable(); rb = _cal_real_rb(writeop->chip); NFC_DeSelectChip(writeop->chip); NFC_DeSelectRb(rb); if (dma_wait_mode) _pending_dma_irq_sem(); return ret; }