From c31243e1739a4ba21d45e3569341aa671939cb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sun, 28 Oct 2012 01:50:08 +0000 Subject: Add support for Winbond W39F010/W39L010/W39L020 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit W39F010 is a 128kB parallel 5V flash chip, 16k bootblocks. W39L010 is a 128kB parallel 3.3V flash chip, 8k bootblocks. W39L020 is a 256kB parallel 3.3V flash chip, 64k/16k bootblocks. The W39F010 code was tested with a satasii programmer. The first write attempt after an erase returned with verify failure, but the second write attempt was succesful: http://paste.flashrom.org/view.php?id=1418 Corresponding to flashrom svn r1620. Signed-off-by: Kyösti Mälkki Acked-by: Stefan Tauner --- w39.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'w39.c') diff --git a/w39.c b/w39.c index da61d23..9dcb06a 100644 --- a/w39.c +++ b/w39.c @@ -115,6 +115,15 @@ static int printlock_w39_tblwp(uint8_t lock) return 0; } +static int printlock_w39_single_bootblock(uint8_t lock, uint16_t kB) +{ + msg_cdbg("Software %d kB bootblock locking is %sactive.\n", kB, (lock & 0x03) ? "" : "not "); + if (lock & 0x03) + return -1; + + return 0; +} + static int printlock_w39_bootblock_64k16k(uint8_t lock) { msg_cdbg("Software 64 kB bootblock locking is %sactive.\n", @@ -160,6 +169,54 @@ static int unlock_w39_fwh(struct flashctx *flash) return 0; } +int printlock_w39f010(struct flashctx *flash) +{ + uint8_t lock; + int ret; + + lock = w39_idmode_readb(flash, 0x00002); + msg_cdbg("Bottom boot block:\n"); + ret = printlock_w39_single_bootblock(lock, 16); + + lock = w39_idmode_readb(flash, 0x1fff2); + msg_cdbg("Top boot block:\n"); + ret |= printlock_w39_single_bootblock(lock, 16); + + return ret; +} + +int printlock_w39l010(struct flashctx *flash) +{ + uint8_t lock; + int ret; + + lock = w39_idmode_readb(flash, 0x00002); + msg_cdbg("Bottom boot block:\n"); + ret = printlock_w39_single_bootblock(lock, 8); + + lock = w39_idmode_readb(flash, 0x1fff2); + msg_cdbg("Top boot block:\n"); + ret |= printlock_w39_single_bootblock(lock, 8); + + return ret; +} + +int printlock_w39l020(struct flashctx *flash) +{ + uint8_t lock; + int ret; + + lock = w39_idmode_readb(flash, 0x00002); + msg_cdbg("Bottom boot block:\n"); + ret = printlock_w39_bootblock_64k16k(lock); + + lock = w39_idmode_readb(flash, 0x3fff2); + msg_cdbg("Top boot block:\n"); + ret |= printlock_w39_bootblock_64k16k(lock); + + return ret; +} + int printlock_w39l040(struct flashctx *flash) { uint8_t lock; -- cgit v1.1