From patchwork Thu Apr 30 21:13:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 466749 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7DAD3140761 for ; Fri, 1 May 2015 07:56:57 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YnwQw-00089L-1x; Thu, 30 Apr 2015 21:55:50 +0000 Received: from dec59.ruk.cuni.cz ([2001:718:1e03:4::11]) by bombadil.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YnwQV-0006oI-J0 for linux-mtd@lists.infradead.org; Thu, 30 Apr 2015 21:55:27 +0000 Received: (qmail 86612 invoked by uid 2313); 30 Apr 2015 21:54:56 -0000 MBOX-Line: From 35add8df33b17e2354d9496eba8597d9d8488f30 Mon Sep 17 00:00:00 2001 Message-Id: <35add8df33b17e2354d9496eba8597d9d8488f30.1430430153.git.hramrach@gmail.com> In-Reply-To: References: From: Michal Suchanek Date: Thu, 30 Apr 2015 23:13:12 +0200 Subject: [PATCH 3/3] MTD: spi-nor: add flag to not use sector erase. To: David Woodhouse , Brian Norris , , Marek Vasut , Alison Chaiken , Michal Suchanek , Ben Hutchings , Geert Uytterhoeven , "Bean Huo \(beanhuo\)" , "grmoore@altera.com" , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150430_145524_046908_169247F0 X-CRM114-Status: GOOD ( 11.31 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [2001:718:1e03:4:0:0:0:11 listed in] [list.dnswl.org] 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (hramrach[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 1.2 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The sector size of the flash memory is unclear from datasheet or may possibly vary between chips so add a flag to always use 4k blocks. Currently 4k blocks are always used when possible but in the future somebody might want to do some optimizations with sector erase. Signed-off-by: Michal Suchanek --- drivers/mtd/spi-nor/spi-nor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index de73cf5..371e91c 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -55,6 +55,7 @@ struct flash_info { #define SPI_NOR_DUAL_READ 0x20 /* Flash supports Dual Read */ #define SPI_NOR_QUAD_READ 0x40 /* Flash supports Quad Read */ #define USE_FSR 0x80 /* use flag status register */ +#define NO_SPINOR_OP_SE 0x100 /* do not erase sectors */ }; #define JEDEC_MFR(info) ((info)->id[0]) @@ -333,6 +334,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) /* REVISIT in some cases we could speed up erasing large regions * by using SPINOR_OP_SE instead of SPINOR_OP_BE_4K. We may have set up * to use "small sector erase", but that's not always optimal. + * The block size for SPINOR_OP_SE is unknown/untested for some flashes. */ /* "sector"-at-a-time erase */ @@ -551,7 +553,7 @@ static const struct spi_device_id spi_nor_ids[] = { { "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) }, /* GigaDevice */ - { "gd25q41b", INFO(0xc84013, 0, 64 * 1024, 8, SECT_4K) }, + { "gd25q41b", INFO(0xc84013, 0, 64 * 1024, 8, SECT_4K | NO_SPINOR_OP_SE) }, { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) },