Browse Source

[PATCH] mtd onenand driver: fix unlock problem in DDP

Kyungmin Park 19 years ago
parent
commit
20ba89a361
1 changed files with 6 additions and 4 deletions
  1. 6 4
      drivers/mtd/onenand/onenand_base.c

+ 6 - 4
drivers/mtd/onenand/onenand_base.c

@@ -1296,6 +1296,12 @@ static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
 
 
 	/* Block lock scheme */
 	/* Block lock scheme */
 	for (block = start; block < end; block++) {
 	for (block = start; block < end; block++) {
+		/* Set block address */
+		value = onenand_block_address(this, block);
+		this->write_word(value, this->base + ONENAND_REG_START_ADDRESS1);
+		/* Select DataRAM for DDP */
+		value = onenand_bufferram_address(this, block);
+		this->write_word(value, this->base + ONENAND_REG_START_ADDRESS2);
 		/* Set start block address */
 		/* Set start block address */
 		this->write_word(block, this->base + ONENAND_REG_START_BLOCK_ADDRESS);
 		this->write_word(block, this->base + ONENAND_REG_START_BLOCK_ADDRESS);
 		/* Write unlock command */
 		/* Write unlock command */
@@ -1309,10 +1315,6 @@ static int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len)
 		    & ONENAND_CTRL_ONGO)
 		    & ONENAND_CTRL_ONGO)
 			continue;
 			continue;
 
 
-		/* Set block address for read block status */
-		value = onenand_block_address(this, block);
-		this->write_word(value, this->base + ONENAND_REG_START_ADDRESS1);
-
 		/* Check lock status */
 		/* Check lock status */
 		status = this->read_word(this->base + ONENAND_REG_WP_STATUS);
 		status = this->read_word(this->base + ONENAND_REG_WP_STATUS);
 		if (!(status & ONENAND_WP_US))
 		if (!(status & ONENAND_WP_US))