diff options
author | Scott Sweeny <scott.sweeny@timesys.com> | 2009-04-30 10:00:27 -0400 |
---|---|---|
committer | Scott Sweeny <scott.sweeny@timesys.com> | 2009-04-30 10:00:27 -0400 |
commit | d5ff67d2e262acd59ad187b907e9589f06aca02b (patch) | |
tree | 456a98e8b2ee0da368cc83c02374e095d89b40e8 | |
parent | c3ab737e5446b9bc1cd9581748c31f4d8c6fdfc5 (diff) |
Compensate for unusual NAND behavior
This patch originally from LogicPD OMAP35x Release 1.5.0
Original Patch Name: u-boot-1.1.4-omap3430-lv-som-15-nand-unlock.patch
-rw-r--r-- | board/omap3430lv_som/nand.c | 17 | ||||
-rw-r--r-- | common/env_nand.c | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/board/omap3430lv_som/nand.c b/board/omap3430lv_som/nand.c index 914f75fe33..4d970fdf7f 100644 --- a/board/omap3430lv_som/nand.c +++ b/board/omap3430lv_som/nand.c @@ -45,8 +45,17 @@ volatile unsigned long gpmc_cs_base_add; #define ECC_P512_2048_O(val) (((val) & 0x0F000000)>>24) /* Bit 24 to Bit 27 */ extern int debug_nand_actions; +// Since the 256MiB NAND can only unlock a range (and leave the rest +// of the chip locked, then the "nand unlock" command won't work as +// expected. As a result, unlock the whole block on startup and fake +// the unlock... int nand_unlock(struct mtd_info *mtd, unsigned long off, unsigned long size) { + return 0; +} + +static int private_nand_unlock(struct mtd_info *mtd, unsigned long off, unsigned long size) +{ register struct nand_chip *this = mtd->priv; unsigned int start_block, end_block; u8 val; @@ -84,6 +93,7 @@ int nand_unlock(struct mtd_info *mtd, unsigned long off, unsigned long size) this->cmdfunc(mtd, 0x24, -1, end_block); ndelay (100); +#if 0 // Now scan the same block range looking for lock status for (block = start_block; block <= end_block; block+= pages_per_block) { this->cmdfunc(mtd, 0x7a, -1, block); @@ -96,6 +106,7 @@ int nand_unlock(struct mtd_info *mtd, unsigned long off, unsigned long size) } exit: +#endif debug_nand_actions = 0; return ret; @@ -533,7 +544,13 @@ void board_post_nand_init(struct mtd_info *mtd) boot_flash_off = this->chipsize - (1<<this->phys_erase_shift); // printk("%s: boot_flash_off 0x%x\n", __FUNCTION__, boot_flash_off); + // puts("Unlocking *entire* NAND... "); + // Since the Micron NAND on the OMAP board comes up with + // blocks locked, *and* can only unlock a range of blocks, + // just unlock the whole thing and trust the user not to kill it + private_nand_unlock(mtd, 0x0, this->chipsize); + // puts("done\n"); } #endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */ diff --git a/common/env_nand.c b/common/env_nand.c index b00d649197..3fbee9fafb 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -181,7 +181,7 @@ int saveenv(void) mode = omap_nand_get_ecc(&nand_info[0]); omap_nand_switch_ecc(&nand_info[0], 0); -#if defined(CONFIG_3430LV_SOM) +#if 0 && defined(CONFIG_3430LV_SOM) // Unlock the entire NAND chip { struct nand_chip *this; |