From patchwork Sat Feb 20 12:57:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume LECERF X-Patchwork-Id: 45916 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A4D38B7C33 for ; Sat, 20 Feb 2010 23:58:39 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Niot3-0004PI-Kz; Sat, 20 Feb 2010 12:56:45 +0000 Received: from smtp6-g21.free.fr ([212.27.42.6]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Niosw-00040J-0h for linux-mtd@lists.infradead.org; Sat, 20 Feb 2010 12:56:42 +0000 Received: from smtp6-g21.free.fr (localhost [127.0.0.1]) by smtp6-g21.free.fr (Postfix) with ESMTP id 87B43E0810B; Sat, 20 Feb 2010 13:56:33 +0100 (CET) Received: from shiryu.yomgui.biz (lsd.homeftp.net [82.235.75.105]) by smtp6-g21.free.fr (Postfix) with ESMTP id 6637DE080DA; Sat, 20 Feb 2010 13:56:31 +0100 (CET) Received: from localhost ([127.0.0.1] helo=shiryu.yomgui.biz ident=fox) by shiryu.yomgui.biz with esmtp (Exim 4.71) (envelope-from ) id 1NiouF-0003vt-H1; Sat, 20 Feb 2010 13:57:59 +0100 Subject: [PATCH 3/6] mtd: cfi_probe: enable Auto Select Mode for SST39VF160x/39VF320x chips To: David Woodhouse From: Guillaume LECERF Date: Sat, 20 Feb 2010 13:57:59 +0100 Message-ID: <20100220125759.14843.46780.stgit@shiryu.yomgui.biz> In-Reply-To: <20100220125748.14843.70415.stgit@shiryu.yomgui.biz> References: <20100220125748.14843.70415.stgit@shiryu.yomgui.biz> User-Agent: StGit/0.15 MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100220_075638_526419_BDEC2110 X-CRM114-Status: UNSURE ( 8.66 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: linux-mtd X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org SST 39VF160x/39VF320x chips differ from the CFI specifications, they need the 0xAA / 0x55 / 0x90 sequence to be sent to 0x5555 / 0x2AAA / 0x5555 to enter Auto Select Mode. Trying this sequence and testing for (cfi->mfr != CFI_MFR_SST) then fallback to the standard sequence seems to work and to add no regressions. Signed-off-by: Guillaume Lecerf --- drivers/mtd/chips/cfi_probe.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c index e63e674..05207f7 100644 --- a/drivers/mtd/chips/cfi_probe.c +++ b/drivers/mtd/chips/cfi_probe.c @@ -189,12 +189,31 @@ static int __xipram cfi_chip_setup(struct map_info *map, * back into Read Mode, which is a nop in this case). */ cfi_send_gen_cmd(0xf0, 0, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); - cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); + + /* SST 39VF160x/39VF320x chips differ from the CFI specifications, they need + * the 0xAA / 0x55 / 0x90 sequence to be sent to 0x5555 / 0x2AAA / 0x5555 to + * enter Auto Select Mode. + * Trying this sequence and testing for (cfi->mfr != CFI_MFR_SST) then fallback + * to the standard sequence seems to work and to add no regressions. + */ + cfi_send_gen_cmd(0xAA, 0x5555, base, map, cfi, cfi->device_type, NULL); + cfi_send_gen_cmd(0x55, 0x2AAA, base, map, cfi, cfi->device_type, NULL); + cfi_send_gen_cmd(0x90, 0x5555, base, map, cfi, cfi->device_type, NULL); + cfi->mfr = cfi_read_query16(map, base); cfi->id = cfi_read_query16(map, base + ofs_factor); + if(cfi->mfr != CFI_MFR_SST) { + cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); + + cfi_send_gen_cmd(0xaa, 0x555, base, map, cfi, cfi->device_type, NULL); + cfi_send_gen_cmd(0x55, 0x2aa, base, map, cfi, cfi->device_type, NULL); + cfi_send_gen_cmd(0x90, 0x555, base, map, cfi, cfi->device_type, NULL); + + cfi->mfr = cfi_read_query16(map, base); + cfi->id = cfi_read_query16(map, base + ofs_factor); + } + /* Get AMD/Spansion extended JEDEC ID */ if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e) cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |