diff options
author | Bartlomiej Sieka <tur@semihalf.com> | 2007-12-11 13:59:57 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2007-12-13 12:00:37 +0100 |
commit | 42026c9cb3a76849b41e6e24abfb7b56807a5c1a (patch) | |
tree | afa2597b10e02c1c3f8464b90cc3805d552f11ff /drivers | |
parent | 9692c2734a47f23b44a0f68042a3e2ca8d1bfb39 (diff) | |
download | u-boot-imx-42026c9cb3a76849b41e6e24abfb7b56807a5c1a.zip u-boot-imx-42026c9cb3a76849b41e6e24abfb7b56807a5c1a.tar.gz u-boot-imx-42026c9cb3a76849b41e6e24abfb7b56807a5c1a.tar.bz2 |
CFI: synchronize command offsets with Linux CFI driver
Fixes non-working CFI Flash on the Inka4x0 board.
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/cfi_flash.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 66754cd..c3293d0 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1231,9 +1231,26 @@ static int flash_detect_cfi (flash_info_t * info) debug ("port %d bits chip %d bits\n", info->portwidth << CFI_FLASH_SHIFT_WIDTH, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); - /* this probably only works if info->interface == FLASH_CFI_X8X16 */ - info->addr_unlock1 = (info->portwidth == FLASH_CFI_8BIT) ? 0xAAA : 0x555; - info->addr_unlock2 = (info->portwidth == FLASH_CFI_8BIT) ? 0x555 : 0x2AA; + + /* calculate command offsets as in the Linux driver */ + info->addr_unlock1 = 0x555; + info->addr_unlock2 = 0x2aa; + + /* + * modify the unlock address if we are + * in compatibility mode + */ + if ( /* x8/x16 in x8 mode */ + ((info->chipwidth == FLASH_CFI_BY8) && + (info->interface == FLASH_CFI_X8X16)) || + /* x16/x32 in x16 mode */ + ((info->chipwidth == FLASH_CFI_BY16) && + (info->interface == FLASH_CFI_X16X32))) + { + info->addr_unlock1 = 0xaaa; + info->addr_unlock2 = 0x555; + } + info->name = "CFI conformant"; return 1; } |