From patchwork Mon Dec 27 01:35:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick X-Patchwork-Id: 1573277 X-Patchwork-Delegate: tudor.ambarus@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pUz5PG7U; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=systemli.org header.i=@systemli.org header.a=rsa-sha256 header.s=default header.b=Lmnf7Wlq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) 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=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JMgJD0JxYz9sRR for ; Mon, 27 Dec 2021 12:37:00 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ipXxeMn5ajJqWlS6PulCJrtGsXrJS0W7Tz4i0q9/rLA=; b=pUz5PG7Ur6Nj04 DEF/ZMbdDOG9gvH72A+RhBMSNJLZ2t1NqCoagsKworyYRL3dAsctOp+qyQKKNuTf1lzjtkeST3I5S 7qDBdA6M+zZkp1zhlhnFbktSCUZYpzc8tMIOa6QZ2cABoU2EJloAFFx602YaDUx7IHk8zrIEQEyld +MRlojk9o60Rl08ZHWPWamxHbiLKjqZojkzEtAuRnV6BJ2H3xUvgdghEujCYi7D810mfZHIp11W6/ zgmAOGotb/7bIC+NguKW9awUTuKhVLtXX578Mj6QTtZKVQFNJrEwOE3UiZlMMuBM1GviFVUy8CzQ/ CEl8R1dPrJB/UEhh7Duw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1evZ-00Fzdt-An; Mon, 27 Dec 2021 01:35:53 +0000 Received: from mail1.systemli.org ([212.103.72.247]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1evX-00FzdX-3B for linux-mtd@lists.infradead.org; Mon, 27 Dec 2021 01:35:52 +0000 From: vincent@systemli.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemli.org; s=default; t=1640568947; bh=pBGw2in93wvElXpOJ5wOGA09re3QZeq3M/lNxQ0hx7g=; h=From:To:Cc:Subject:Date:From; b=Lmnf7WlqSLYom8CR5j04XTHN9rowQvjfxUTuufdiRdcDuwyaUXo7FyNcVFjTFkAbw NoPZDxF0c4sif73g/qHLjy4L03MK5YRL22smPa0HFoCDVvH6bnbISzXUmnjUFo4WSe SeFtLTyVfYUtNnDZXdFDYG/gzxYxKY3mOop/nj8dShu5q8Iv86Gfm9P6Lz9ms31W7T op52SXBtunx5TG/DQZ9Mp7rOUKwN/NQWT6hj+4Xud2343HNf1TTbEQ0deX/N0f2awq 32GA8s1l1l05fdGChLjaWtscWLEepiCeNUzjo+0XGjNLTFFbA47m37MYAqSpZXLMha rVk9mT+bAM53w== To: linux-mtd@lists.infradead.org Cc: Nick Hainke , David Bauer Subject: [PATCH] mtd: spi-nor: fix reading/writing of MX25L6405D Date: Mon, 27 Dec 2021 02:35:42 +0100 Message-Id: <20211227013542.1240124-1-vincent@systemli.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_173551_294539_BC76C148 X-CRM114-Status: GOOD ( 10.56 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Nick Hainke Macronix MX25L6405D supports locking with four block protection bits in its status register. Furthermore, the chip will not work with the "16-bit Write Status (01h) Command". Add flash-specific fixup [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.103.72.247 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Nick Hainke Macronix MX25L6405D supports locking with four block protection bits in its status register. Furthermore, the chip will not work with the "16-bit Write Status (01h) Command". Add flash-specific fixup that disables the SNOR_F_HAS_16BIT_SR flag. Tested on Nanostation M2 XM. Fixes: 39d1e3340c73 ("mtd: spi-nor: Fix clearing of QE bit on lock()/unlock()") Signed-off-by: David Bauer Signed-off-by: Nick Hainke --- drivers/mtd/spi-nor/macronix.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index 27498ed0cc0d..6dd148e9f660 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -8,6 +8,15 @@ #include "core.h" +static void mx25l6405d_default_init_fixups(struct spi_nor *nor) +{ + nor->flags &= ~SNOR_F_HAS_16BIT_SR; +} + +static struct spi_nor_fixups mx25l6405d_fixups = { + .default_init = mx25l6405d_default_init_fixups, +}; + static int mx25l25635_post_bfpt_fixups(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header, @@ -41,7 +50,9 @@ static const struct flash_info macronix_parts[] = { { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) }, { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) }, { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) }, - { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) }, + { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K | + SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) + .fixups = &mx25l6405d_fixups }, { "mx25u2033e", INFO(0xc22532, 0, 64 * 1024, 4, SECT_4K) }, { "mx25u3235f", INFO(0xc22536, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ |