···318 ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS);319320 if (ctrl & ONENAND_CTRL_ERROR) {321- /* It maybe occur at initial bad block */322 DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: controller error = 0x%04x\n", ctrl);323- /* Clear other interrupt bits for preventing ECC error */324- interrupt &= ONENAND_INT_MASTER;325- }326-327- if (ctrl & ONENAND_CTRL_LOCK) {328- DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: it's locked error = 0x%04x\n", ctrl);329- return -EACCES;330 }331332 if (interrupt & ONENAND_INT_READ) {···745746 ret = this->wait(mtd, FL_READING);747 /* First copy data and check return value for ECC handling */748- onenand_update_bufferram(mtd, from, 1);749 }750751 this->read_bufferram(mtd, ONENAND_DATARAM, buf, column, thislen);752-753- read += thislen;754-755- if (read == len)756- break;757758 if (ret) {759 DEBUG(MTD_DEBUG_LEVEL0, "onenand_read: read failed = %d\n", ret);760 goto out;761 }00000762763 from += thislen;764 buf += thislen;···827828 this->read_bufferram(mtd, ONENAND_SPARERAM, buf, column, thislen);82900000830 read += thislen;831832 if (read == len)833 break;834-835- if (ret) {836- DEBUG(MTD_DEBUG_LEVEL0, "onenand_read_oob: read failed = %d\n", ret);837- goto out;838- }839840 buf += thislen;841···1194 ret = this->wait(mtd, FL_ERASING);1195 /* Check, if it is write protected */1196 if (ret) {1197- if (ret == -EPERM)1198- DEBUG(MTD_DEBUG_LEVEL0, "onenand_erase: Device is write protected!!!\n");1199- else1200- DEBUG(MTD_DEBUG_LEVEL0, "onenand_erase: Failed erase, block %d\n", (unsigned) (addr >> this->erase_shift));1201 instr->state = MTD_ERASE_FAILED;1202 instr->fail_addr = addr;1203 goto erase_exit;
···318 ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS);319320 if (ctrl & ONENAND_CTRL_ERROR) {0321 DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: controller error = 0x%04x\n", ctrl);322+ if (ctrl & ONENAND_CTRL_LOCK)323+ DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: it's locked error.\n");324+ return ctrl;0000325 }326327 if (interrupt & ONENAND_INT_READ) {···750751 ret = this->wait(mtd, FL_READING);752 /* First copy data and check return value for ECC handling */753+ onenand_update_bufferram(mtd, from, !ret);754 }755756 this->read_bufferram(mtd, ONENAND_DATARAM, buf, column, thislen);00000757758 if (ret) {759 DEBUG(MTD_DEBUG_LEVEL0, "onenand_read: read failed = %d\n", ret);760 goto out;761 }762+763+ read += thislen;764+765+ if (read == len)766+ break;767768 from += thislen;769 buf += thislen;···832833 this->read_bufferram(mtd, ONENAND_SPARERAM, buf, column, thislen);834835+ if (ret) {836+ DEBUG(MTD_DEBUG_LEVEL0, "onenand_read_oob: read failed = 0x%x\n", ret);837+ goto out;838+ }839+840 read += thislen;841842 if (read == len)843 break;00000844845 buf += thislen;846···1199 ret = this->wait(mtd, FL_ERASING);1200 /* Check, if it is write protected */1201 if (ret) {1202+ DEBUG(MTD_DEBUG_LEVEL0, "onenand_erase: Failed erase, block %d\n", (unsigned) (addr >> this->erase_shift));0001203 instr->state = MTD_ERASE_FAILED;1204 instr->fail_addr = addr;1205 goto erase_exit;
+2-1
drivers/mtd/onenand/onenand_bbt.c
···93 ret = onenand_do_read_oob(mtd, from + j * mtd->writesize + bd->offs,94 readlen, &retlen, &buf[0]);9596- if (ret)097 return ret;9899 if (check_short_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) {
···93 ret = onenand_do_read_oob(mtd, from + j * mtd->writesize + bd->offs,94 readlen, &retlen, &buf[0]);9596+ /* If it is a initial bad block, just ignore it */97+ if (ret && !(ret & ONENAND_CTRL_LOAD))98 return ret;99100 if (check_short_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) {