[PATCH] OneNAND: Simple Bad Block handling support

Kyungmin Park kyungmin.park at samsung.com
Wed Aug 24 19:36:29 EDT 2005


Thank you for replay and check the code

> 
> Is the following code valid (assuming patch has been run)?
>  > ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS);
> 
>  > if (ctrl & ONENAND_CTRL_ERROR) {
>  > 	/* It maybe occur at initial bad block */
>  > 	DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: controller error 
> = 0x%04x\n", 
> ctrl);
>  > 	/* Clear other interrupt bits for preventing ECC error */
>  > 	interrupt &= ONENAND_INT_MASTER;
>  > }
> 
>  > if (ctrl & ONENAND_CTRL_LOCK) {
>  > 	DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: it's locked error = 
> 0x%04x\n", ctrl);
>  > 	return -EACCES;
>  > }
> 
>  > if (interrupt & ONENAND_INT_READ) {
>  > 	ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS);
>  > 	if (ecc & ONENAND_ECC_2BIT_ALL) {
>  > 		DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: ECC 
> error = 0x%04x\n", ecc);
>  > 		return -EBADMSG;
>  > 	}
>  > }
> 
> 1) interrupt &= ONENAND_INT_MASTER instead of return?

	=> Yes It's valid. During the initial bad block scanning, the
OneNAND controller return ctrl error. If we use return -EIO then OneNAND
scan failed, then we can't detect OneNAND chip. So we don't return any ctrl
error.
	=> interrupt &= ONENAND_INT_MASTER. we always set master interrupt
bit in any case

> 2) return -EACCES instead of return -EIO?
	=> I don't know which error code are correct. but I think locked
block access is EACCES instead of EIO



Kyungmin Park






More information about the linux-mtd mailing list