From patchwork Wed Oct 3 14:40:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 978402 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pdhE9QtE"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="zabUAbyt"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QKjF3VKwz9s7W for ; Thu, 4 Oct 2018 01:30:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qQ24gwsaXm1zh3PYpY/lxwWJEjLCgDCgGaQCOj5tdBM=; b=pdhE9QtEXp/KoCHpjB9x9m4T2/ CHdDRAglkRi5kDi1N7MxID886knJOWmGDx2yXlGlxXBZA34eIPoUUViH6g4aXkCrvAnRi2zPrbx4+ +FIWijxtaagigFdWoBgJ02uDOVQuVjLR8pFshsObtaZxfdgWpFtkH8ZptezTvyUVEhUzaeiFWMc84 ShbBRDpPPOazbESPl/42tFQGbh3Ak0xKyTBnuJdQY5jJbxjKnlh0WaVQX3XgVTsLXughRY5UAXm/H SsFAg7lH1QK1PWPwbCWU+1MtmvXrqsexFa+CE847PBUn7O+I+6E9D03ejeZoUTueelbpGRv8Qr3E5 VDYr2GJg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7j6d-0007rH-1D; Wed, 03 Oct 2018 15:30:31 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7j2j-0004qU-Me for linux-mtd@bombadil.infradead.org; Wed, 03 Oct 2018 15:26:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6g5MVpqNqZzAwljYUqgzJjEq2KReoNatoibVhA7wNZ4=; b=zabUAbytQPc7bZ2PLRCxQD4ya XKssixREkmzi641hSDcI/tLNWq3QXDCUKoIhPEcARHzO+7EgjS2KkCRFvraAM7qiScZ2voXeGO3Y4 g5b7ndkzhPyfDIP5sdMBsEgRYf5I3na9DMYtFKRJBfsCtrAnUHA3XPJEEgwpWSBOdfKvSrKWBY7mW +QK4lOhZxpp5n7Yuxg2D53qLQk6MqBw5HDop/QL++52MK/wF6jBldkzVxgmU0Vmu4vXFXUmljPZ42 q8ppM93iSGgG7NRX1urjs/1aoNFcoSTBRAEwb8GAW8sIK8+MH5qYrNIlys0NXjYWFKvX8eiYiAtQj 3l2GFIgVA==; Received: from mail.bootlin.com ([62.4.15.54]) by merlin.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7iKg-0002SJ-AW for linux-mtd@lists.infradead.org; Wed, 03 Oct 2018 14:40:59 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 45714207C8; Wed, 3 Oct 2018 16:40:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon.fritz.box (AAubervilliers-681-1-24-95.w90-88.abo.wanadoo.fr [90.88.144.95]) by mail.bootlin.com (Postfix) with ESMTPSA id ED1E4207BB; Wed, 3 Oct 2018 16:40:43 +0200 (CEST) From: Boris Brezillon To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 1/8] mtd: spi-nor: Set SPI_NOR_4B_OPCODES on all >16MB Spansion NORs Date: Wed, 3 Oct 2018 16:40:36 +0200 Message-Id: <20181003144043.21529-2-boris.brezillon@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20181003144043.21529-1-boris.brezillon@bootlin.com> References: <20181003144043.21529-1-boris.brezillon@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181003_104058_583926_B449FBBF X-CRM114-Status: GOOD ( 17.69 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [62.4.15.54 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julien Su , Cyrille Pitchen , Mason Yang , Tudor Ambarus , zhengxunli@mxic.com.tw MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The code was treating >16MB Spansion NORs as a special case, while they could just be flagged with SPI_NOR_4B_OPCODES and be treated as other NORs. This change simplifies the code and makes it explicit that those parts are supporting 4B addressing. Signed-off-by: Boris Brezillon --- I've checked the datasheet of s25fl512s, s70fl01gs, s25fl256s0 and s25fl256s1, and they indeed support 4B opcodes. Other Spansion NORs might also support 4B opcodes, but those that do not already have SPI_NOR_4B_OPCODES set are anyway <=16MB in size. Also, I kept NOR definitions on a single line, since those were already over 80chars. Marek, let me know if you want me to change that for the GigaDevice formatting: { "gd25q16", INFO(0xc84015, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, Changes in v2: - Add SPI_NOR_4B_OPCODES to s25fl256s0 and s25fl256s1 entries --- drivers/mtd/spi-nor/spi-nor.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 9407ca5f9443..27ea10dc0395 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1414,10 +1414,10 @@ static const struct flash_info spi_nor_ids[] = { */ { "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, - { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, USE_CLSR) }, - { "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) }, - { "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) }, - { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, + { "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, USE_CLSR | SPI_NOR_4B_OPCODES) }, + { "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR | SPI_NOR_4B_OPCODES) }, + { "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR | SPI_NOR_4B_OPCODES) }, + { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, SPI_NOR_4B_OPCODES) }, { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, { "s25fl128s", INFO6(0x012018, 0x4d0180, 64 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | USE_CLSR) }, @@ -3551,7 +3551,6 @@ static int spi_nor_init(struct spi_nor *nor) } if ((nor->addr_width == 4) && - (JEDEC_MFR(nor->info) != SNOR_MFR_SPANSION) && !(nor->info->flags & SPI_NOR_4B_OPCODES)) { /* * If the RESET# pin isn't hooked up properly, or the system @@ -3585,7 +3584,6 @@ void spi_nor_restore(struct spi_nor *nor) { /* restore the addressing mode */ if ((nor->addr_width == 4) && - (JEDEC_MFR(nor->info) != SNOR_MFR_SPANSION) && !(nor->info->flags & SPI_NOR_4B_OPCODES) && (nor->flags & SNOR_F_BROKEN_RESET)) set_4byte(nor, nor->info, 0); @@ -3742,8 +3740,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, } else if (mtd->size > 0x1000000) { /* enable 4-byte addressing if the device exceeds 16MiB */ nor->addr_width = 4; - if (JEDEC_MFR(info) == SNOR_MFR_SPANSION || - info->flags & SPI_NOR_4B_OPCODES) + if (info->flags & SPI_NOR_4B_OPCODES) spi_nor_set_4byte_opcodes(nor, info); } else { nor->addr_width = 3;