From patchwork Mon Aug 28 21:14:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 806767 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=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CFnIivZ3"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=semihalf-com.20150623.gappssmtp.com header.i=@semihalf-com.20150623.gappssmtp.com header.b="RLD2FL1U"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 3xh4GZ60cfz9t9B for ; Tue, 29 Aug 2017 07:12:14 +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=gIUmtHhyikVmdLibTPMUiB/b64lpHwujEfMGt5JdhU8=; b=CFnIivZ3Ki7KdajTysW0fK7fB+ qtoojqwsDGTf+EhyKZ2EhBHbOnKUyRYI0rbZ2ZLEO3k52fFBx8rnqQk3gFa+KnUn2M29olsFnRjHh GcBq1w1VuY4oOFxddOZaU3YYP2fpXUFR4Fo+8K3JZPStFne/hrDeYOXXTuf1MNh9EaL95HuF38bvk u/L2GR87Xh3+AY2WnkyOicAzKwwL+dBqoe/Yd22z88plK0uvd/ODWxZ4mKeW9Vz2dGYKEof5ahfdy 6CAGWVnk/mzYaGsGAkIuwwhmPXjiIe6Jb+Bn6mYurDlBrt+0yfzW9ZD00FtnILwNoRrHoDx4RMZ9O I4hs9Zag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dmRK1-00068w-LI; Mon, 28 Aug 2017 21:11:49 +0000 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmRJA-0005Fa-Qd for linux-mtd@lists.infradead.org; Mon, 28 Aug 2017 21:10:59 +0000 Received: by mail-lf0-x22e.google.com with SMTP id k186so6611821lfe.2 for ; Mon, 28 Aug 2017 14:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zhWS0XdU1zqONUS2YMad+6tNGEUNcUgC1w2uuLqJQSU=; b=RLD2FL1UG5zrhE7uSv19h4/ciSSp97ItTdbQ+up7oV91PJ2YaSAMhYVH39ioxlkmAQ xjTSr8B6cUVwZFxesGCW+tGT3ZZ2RHKlcnVUFCzx+YDi9jn3gtyk5v18x7ObFYP/VPsl 39sMEcXGiTo7OdtSOMv4SzsIqbo1EqCYJ9RTfTN0OsPdhEAkt7X3nIjtvyHGuOdy9v0v jRxSqve7DZGoyifUKp1sqSiW3AkfB99I0newDIA76oSOvo5QEuSBa+GtczDC/BDtWdTH oB5zPHtwfnzFuXl2SZLHGVd78xxP4JEkU6BM9r3ms2FFtcMubuJrEhubcmlPhydtOYSE jpTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zhWS0XdU1zqONUS2YMad+6tNGEUNcUgC1w2uuLqJQSU=; b=W29XxXbg5h8XEiiq822VLhrnjc7d8W2op6pIA9S/sBjpyzHPfTN57HeH3XYKUmkS5s uNx30ep618CdHkRxvxMTAv+kyoMub8orw6DwfSeYnLhxnor2qMMsRrs+fcCyktUjX+6C AqlcW9WXHIkgIEVcCWDL1nxNERXg1AtZUL0U+yrb/n6XRBvICUqjKPsru6Cf7h46Yq9I EhjFgyoj1weEvEY4anjFJbcTDf+BPuLoXNnaWJSJKZ+RdHlipi0PjZfK+n1Fa3OuwNBP QGbtvA7I6NjJRbGdnww9d68oPliUMyqKOLyxl8ZLQ6k26Me9mfcIjFlSVya0iuf8pr95 YKug== X-Gm-Message-State: AHYfb5il3V/xYGKS+UI4x3cBDeR7zPHw0FdrKuOayFtfXWcgvIdmPG4Y JDOWEZ67VsDNdLH9 X-Received: by 10.25.178.70 with SMTP id b67mr579733lff.246.1503954634853; Mon, 28 Aug 2017 14:10:34 -0700 (PDT) Received: from enkidu.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id k29sm267032lje.6.2017.08.28.14.10.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 14:10:34 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org Subject: [PATCH 1/2] mtd: spi-nor: add an option to force 3byte adressing mode Date: Mon, 28 Aug 2017 23:14:13 +0200 Message-Id: <1503954854-30963-2-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1503954854-30963-1-git-send-email-mw@semihalf.com> References: <1503954854-30963-1-git-send-email-mw@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170828_141057_062536_15EF2D37 X-CRM114-Status: GOOD ( 14.91 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:22e listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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 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: mark.rutland@arm.com, thomas.petazzoni@free-electrons.com, jaz@semihalf.com, hannah@marvell.com, omrii@marvell.com, will.deacon@arm.com, robh+dt@kernel.org, nadavh@marvell.com, marek.vasut@gmail.com, broonie@kernel.org, neta@marvell.com, cyrille.pitchen@wedev4u.fr, gregory.clement@free-electrons.com, tn@semihalf.com, mw@semihalf.com MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hitherto code set 4B addressing mode for all SPI flashes whose size exceeds 16MB. However, changing the default 3B access in some cases may be harmful - it may happen that the Boot ROM is not capable of handling non-default state of the SPI NOR (e.g. after soft reset). Some flash devices allow to access the memory above 128Mib without changing mode to 4byte thanks to special op codes (see SPI_NOR_4B_OPCODES flag). Unfortunately for those which don't support them, the problem persists. This patch adds optional property that can be added to the SPI flash node and which will force to use 3B addressing mode, limiting the accessible memory size to 16MiB. Binding documentation is updated accordingly. Signed-off-by: Marcin Wojtas --- Documentation/devicetree/bindings/spi/spi-bus.txt | 2 ++ drivers/mtd/spi-nor/spi-nor.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt index 1f6e86f..f13b773 100644 --- a/Documentation/devicetree/bindings/spi/spi-bus.txt +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt @@ -77,6 +77,8 @@ All slave nodes can contain the following optional properties: Defaults to 1 if not present. - spi-rx-delay-us - Microsecond delay after a read transfer. - spi-tx-delay-us - Microsecond delay after a write transfer. +- spi-3byte-addressing - Empty property indicating device access to be done + only in 3byte addressing mode. Some SPI controllers and devices support Dual and Quad SPI transfer mode. It allows data in the SPI system to be transferred using 2 wires (DUAL) or 4 diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 1413828..029c87d 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2002,7 +2002,17 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, if (JEDEC_MFR(info) == SNOR_MFR_SPANSION || info->flags & SPI_NOR_4B_OPCODES) spi_nor_set_4byte_opcodes(nor, info); - else + else if (of_property_read_bool(np, "spi-3byte-addressing")) { + /* + * Do not enter 4byte mode in order to prevent + * the early bootloader to come up on non-default + * SPI NOR memory during boot. Limit accessible + * size to 16MiB. + */ + nor->addr_width = 3; + mtd->size = 0x1000000; + dev_info(dev, "Force 3B addressing mode\n"); + } else set_4byte(nor, info, 1); } else { nor->addr_width = 3; From patchwork Mon Aug 28 21:14:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 806772 X-Patchwork-Delegate: cyrille.pitchen@atmel.com 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=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y4fOzHPo"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=semihalf-com.20150623.gappssmtp.com header.i=@semihalf-com.20150623.gappssmtp.com header.b="lBj3Pmci"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 3xh4bK5b0qz9s0g for ; Tue, 29 Aug 2017 07:26:46 +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=9N7M9KMeb0VEDjvi0DXIFmWXbgY41/CdnKgYcH0xY2Y=; b=Y4fOzHPoxMEDRa3ZRH+01jb2sC uM6QIrSKNBboH2cATaWF/hFNXWAL0Ziifmq+Zwdy/BU5VbuL9fsS+jGxGN/azTa8dQqZ4X07XEolT jMmZ28wFjp2PuUA7eJs9oPP3Q4eIys9WvMNcCfvPejAHxtC5p7uGiGoV12ImyYEpb8HcxhYjA71Qo 1AT78HE7/V0lsxHErFmuYwqux7T8vQ1IlPKAaSBNJb9pfEpHnNWeRnOLIXVPcY6YAORJVCa7vzIGx I7EmIC13AhWKDHGZW2Vkkqf6l6/ENKtlEb/ahcxa60UaGhqt7LWAsZdLA7+FwbeZ2PQ2hl+zbYL7U 4N/fVmBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dmRVb-0003QP-3z; Mon, 28 Aug 2017 21:23:47 +0000 Received: from mail-lf0-x232.google.com ([2a00:1450:4010:c07::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmRJC-0005Fk-Bt for linux-mtd@lists.infradead.org; Mon, 28 Aug 2017 21:11:00 +0000 Received: by mail-lf0-x232.google.com with SMTP id k186so6612007lfe.2 for ; Mon, 28 Aug 2017 14:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VcTZOPE1uGxbYJSa0tC+gHA9iP8v/MGPhkw6jlRpevs=; b=lBj3Pmci8vlONyAw2ix/ehN5JgKlOjC2ZPRj+h7HnNa6yF6THXLiqgGp5ccncYRtsP 04h4l9kA759OAbwDfpETK02wETLVtlJSGQ0azg8LCL74/QgcQQd6503cPjVwDeKZKIc7 tLEQOFz7LMERoOX77tWkJcrrYnIhgS2DYl0dx6+EweLS1gQgrx7IRp0/LthBTJYl4/ls slxQJW29l6jGr9BYLGf4nPegmJ68YKtL3biO61SK8JtgvGiZRXA1EqoO+3aJwoaLGxXg dHmFJ7dhIVCrhn7dVQoXQP5b5wIRvViwKI+W+iMZEs5i2/gbv/UoD7ODfKEZXq8XyGVy pOvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VcTZOPE1uGxbYJSa0tC+gHA9iP8v/MGPhkw6jlRpevs=; b=NxZBBnDkMme9GVlPLPGV9QGp3a0pwDApkLZe+En7JxSBu1+43Ofwy3H0ALm6MucrJ1 aDciHMBRT+3R5ZM8pB+1m0d4084oZmi/56pQnBLTt9P9fOxxKpqbYSokkYC271j9pk37 tEfw00aO82wh8Dfq3w7WJut6mIo6OkqyPWNlCO0KVzXlaL5HI/fXvZb1t50dKi+U6ahE 67pafSGLDTIQdDG6MYBlbDPmL/UU+ETXMg03eHgRDMfK0z+KKuiYWh+fvVgPSfrMghSA cS6rb/fXtJmstZrPTcPfgQlOBOwdzR6zTkrJXFbIxf9yWM5+W79OvDpidPaEJB2MNzyi vxlg== X-Gm-Message-State: AHYfb5hz7kx3ZLxAenENoEZah2fWXJg2PhhVOcT3ZZCUH17fpxEHqu0u PdJ4oVg0ekaDpFDS X-Received: by 10.46.0.134 with SMTP id e6mr745363lji.142.1503954636366; Mon, 28 Aug 2017 14:10:36 -0700 (PDT) Received: from enkidu.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id k29sm267032lje.6.2017.08.28.14.10.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 14:10:35 -0700 (PDT) From: Marcin Wojtas To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org Subject: [PATCH 2/2] arm64: dts: marvell: Force 3byte addressing mode for SPI on A7040 DB Date: Mon, 28 Aug 2017 23:14:14 +0200 Message-Id: <1503954854-30963-3-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1503954854-30963-1-git-send-email-mw@semihalf.com> References: <1503954854-30963-1-git-send-email-mw@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170828_141058_655564_4EE790B9 X-CRM114-Status: GOOD ( 10.07 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:232 listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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 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: mark.rutland@arm.com, thomas.petazzoni@free-electrons.com, jaz@semihalf.com, hannah@marvell.com, omrii@marvell.com, will.deacon@arm.com, robh+dt@kernel.org, nadavh@marvell.com, marek.vasut@gmail.com, broonie@kernel.org, neta@marvell.com, cyrille.pitchen@wedev4u.fr, gregory.clement@free-electrons.com, tn@semihalf.com, mw@semihalf.com MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Armada 7040 DB boards can be shipped with various models of boot SPI flash devices. An issue can emerge, when their size exceeds 16MB - in such case the kernel driver will switch automatically to 4B addressing mode. Later, in case of soft reset, the Boot ROM will fail to fetch the firmware during the board initialization. In order to prevent such behavior, this patch forces 3B addressing mode used on affected boards by adding newly introduced 'spi-3byte-addressing' property to the SPI flash nodes. Signed-off-by: Marcin Wojtas --- arch/arm64/boot/dts/marvell/armada-7040-db.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/marvell/armada-7040-db.dts b/arch/arm64/boot/dts/marvell/armada-7040-db.dts index 92c761c..d0bd296 100644 --- a/arch/arm64/boot/dts/marvell/armada-7040-db.dts +++ b/arch/arm64/boot/dts/marvell/armada-7040-db.dts @@ -116,6 +116,7 @@ compatible = "jedec,spi-nor"; reg = <0x0>; spi-max-frequency = <20000000>; + spi-3byte-addressing; partitions { compatible = "fixed-partitions";