From patchwork Wed Sep 26 22:07:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975458 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hyB7BigT"; 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 42LBwb1s50z9s4V for ; Thu, 27 Sep 2018 08:11:11 +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=VIZJ0iRA2Ax8m0rpd9SqA/BImLhw9T8SP3+YFe9mBjY=; b=hyB7BigTxRNPL4EHq/Ka+iMGEP sSDzG0YwqKMj55H8XOIhOxFaSvNrwIL/AslR9cBeJPIk3pmvEuy9FgNJV8N/vG7u8GkQzK/gaj9ya ymnXM6PsNVBrqL/TMStZMCNsExcBtFS+cdiStocd14RZm7uRh9Ez0LRAtbGDKp3VpDtV7/nD3NHxH pYitcLtFzfsUFBZc75SQLj1NkqGJXCol1ViIHs017JJuPL/ZJSf5w1NIZ/2vVSutt1fiNq1QjrHhV 9g4vzle1xU4rTtmGg5wC0sVAo1j9Hd/7vOSYD9bhXdm+We6kJDyJFPIZq0Sp0UnDtYc1E5Rq2XNKg VDtEEXCA==; 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 1g5I1M-00060x-2V; Wed, 26 Sep 2018 22:11:00 +0000 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5Hz0-0005dt-Ak for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:08:36 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBrx3TJGz1qwfC; Thu, 27 Sep 2018 00:08:01 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBrx1P0Vz1qqkx; Thu, 27 Sep 2018 00:08:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id fFBveWxGRQwl; Thu, 27 Sep 2018 00:07:59 +0200 (CEST) X-Auth-Info: 4fuGYoV94tzqyna2Ua0QR59XuKTyhqaAwGevCIYuzi8= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:07:59 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 1/9] Revert "mtd: fsl-quadspi: Rename SEQID_QUAD_READ to SEQID_READ" Date: Thu, 27 Sep 2018 00:07:31 +0200 Message-Id: <20180926220739.620-2-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150834_536006_20EDDE2C X-CRM114-Status: GOOD ( 10.97 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2001:a60:0:28:0:1:25:1 listed in] [list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This reverts commit 9b2a34906c917e6dacfa08f2eafa5beb8baff5e1, as it is misleading to have READ_QSPI only when we do plan to use READ_DUAL_QSPI. Lets bring back the old naming (explicitly showing the QUAD operation). Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 7d9620c7ff6c..f67f3fa5b9c9 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -193,7 +193,7 @@ #define QUADSPI_LUT_NUM 64 /* SEQID -- we can have 16 seqids at most. */ -#define SEQID_READ 0 +#define SEQID_QUAD_READ 0 #define SEQID_WREN 1 #define SEQID_WRDI 2 #define SEQID_RDSR 3 @@ -396,8 +396,8 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) for (i = 0; i < QUADSPI_LUT_NUM; i++) qspi_writel(q, 0, base + QUADSPI_LUT_BASE + i * 4); - /* Read */ - lut_base = SEQID_READ * 4; + /* Quad Read */ + lut_base = SEQID_QUAD_READ * 4; qspi_writel(q, LUT0(CMD, PAD1, read_op) | LUT1(ADDR, PAD1, addrlen), base + QUADSPI_LUT(lut_base)); @@ -478,7 +478,7 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd) { switch (cmd) { case SPINOR_OP_READ_1_1_4: - return SEQID_READ; + return SEQID_QUAD_READ; case SPINOR_OP_WREN: return SEQID_WREN; case SPINOR_OP_WRDI: From patchwork Wed Sep 26 22:07:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975460 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SbIEpN23"; 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 42LByJ27P6z9s2P for ; Thu, 27 Sep 2018 08:12:40 +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=M2qzJinlK0ItkYl9a1L3gsMLGqQ3DTWXMVAei3nsZEg=; b=SbIEpN23zkfmbXUHsia6JkfESN PAotaZgPn27bL2hiFrhd1piwo3punmThTF+ZwU+k1oS5jyCjBfGLf5wMEePpIC11nw5Uj+A0nuPOG RIJWpEjfaksLYeLTuxLdKSgUKzJr8BlJFr0xCmdO9NfMxczYemliAuJddOhnKCqswNBtuH4/rl/bV 4jiNNfwZTU8xtmVDNO8ez5eq1k/OPAxyPkNmkMHUcSgpajSWRf3w7mqndsbFqkTnAHRt9XdMDyPiB 2NFDewn6t/A2LD8UrVJGwUxB7FlGb+FSkdGozEGrjvS/i+ReRkuNafAWVAeJtHxqr+KKjn0UKOGLq nQACXUdQ==; 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 1g5I2g-0007Z5-Te; Wed, 26 Sep 2018 22:12:22 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5Hz0-0005du-9z for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:08:38 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBrz5qnVz1qxxf; Thu, 27 Sep 2018 00:08:03 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBrz4R4zz1qqkx; Thu, 27 Sep 2018 00:08:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id kr8_Z9pKI__g; Thu, 27 Sep 2018 00:08:01 +0200 (CEST) X-Auth-Info: hku7XZxTv9S2//bjEAyT7brOvOxhLiMUKQbqqMV7gZ4= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:01 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 2/9] mtd: qspi: Provide quirk to read only half of RX buffer (NXP's vybrid) Date: Thu, 27 Sep 2018 00:07:32 +0200 Message-Id: <20180926220739.620-3-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150834_710395_88CBC3A7 X-CRM114-Status: GOOD ( 13.19 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.18.0.9 listed in list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This commit introduces new quirk for the NXP's quadspi driver for vybrid SoC. It turns out that when reading for example 256B as single bytes: dd if=/dev/mtd7 of=aaa.img bs=1 count=256 root@nix:~# hexdump aaa.img 0000000 464c eec0 baa5 c5ff 7b99 4dfb e0b6 8a2e 0000010 e98e 5265 683c a635 c069 e402 303f d936 0000020 c243 01a7 7064 fce8 e3a9 200a 7e85 28bc 0000030 4296 a30e 1bb4 88d4 b456 b4a6 f3aa 8cff 0000040 01c9 462d 0a43 f893 0e42 67f1 57f0 787c 0000050 49c0 fb2a e514 e954 1d21 affa bac4 38f1 0000060 1ca5 ec46 77eb a854 285b 8e21 12d7 f377 0000070 ffff ffff ffff ffff ffff ffff ffff ffff * 0000100 Data got corrupted. Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index f67f3fa5b9c9..2ef5bfc41d32 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -41,6 +41,8 @@ #define QUADSPI_QUIRK_TKT253890 (1 << 2) /* Controller cannot wake up from wait mode, TKT245618 */ #define QUADSPI_QUIRK_TKT245618 (1 << 3) +/* Controller can only read half a rx fifo through AHB */ +#define QUADSPI_QUIRK_AHB_READ_HALF_FIFO (1 << 4) /* The registers */ #define QUADSPI_MCR 0x00 @@ -230,7 +232,8 @@ static const struct fsl_qspi_devtype_data vybrid_data = { .rxfifo = 128, .txfifo = 64, .ahb_buf_size = 1024, - .driver_data = QUADSPI_QUIRK_SWAP_ENDIAN, + .driver_data = QUADSPI_QUIRK_SWAP_ENDIAN + | QUADSPI_QUIRK_AHB_READ_HALF_FIFO, }; static const struct fsl_qspi_devtype_data imx6sx_data = { @@ -341,6 +344,11 @@ static u32 qspi_readl(struct fsl_qspi *q, void __iomem *addr) return ioread32(addr); } +static inline int needs_half_fifo(struct fsl_qspi *q) +{ + return q->devtype_data->driver_data & QUADSPI_QUIRK_AHB_READ_HALF_FIFO; +} + /* * An IC bug makes us to re-arrange the 32-bit data. * The following chips, such as IMX6SLX, have fixed this bug. @@ -390,6 +398,10 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) u8 read_op = nor->read_opcode; u8 read_dm = nor->read_dummy; + /* use only half fifo if controller needs that */ + if (needs_half_fifo(q)) + rxfifo /= 2; + fsl_qspi_unlock_lut(q); /* Clear all the LUT table */ @@ -675,6 +687,7 @@ static void fsl_qspi_init_ahb_read(struct fsl_qspi *q) { void __iomem *base = q->iobase; int seqid; + u32 buf3cr; /* AHB configuration for access buffer 0/1/2 .*/ qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF0CR); @@ -682,12 +695,14 @@ static void fsl_qspi_init_ahb_read(struct fsl_qspi *q) qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF2CR); /* * Set ADATSZ with the maximum AHB buffer size to improve the - * read performance. + * read performance, except when the controller should not use + * more than half its RX fifo in AHB reads, in which case read + * size is given in the LUT FSL_READ instructions. */ - qspi_writel(q, QUADSPI_BUF3CR_ALLMST_MASK | - ((q->devtype_data->ahb_buf_size / 8) - << QUADSPI_BUF3CR_ADATSZ_SHIFT), - base + QUADSPI_BUF3CR); + buf3cr = QUADSPI_BUF3CR_ALLMST_MASK + | ( (needs_half_fifo(q)? 0 : q->devtype_data->ahb_buf_size / 8) + << QUADSPI_BUF3CR_ADATSZ_SHIFT); + writel(buf3cr, base + QUADSPI_BUF3CR); /* We only use the buffer3 */ qspi_writel(q, 0, base + QUADSPI_BUF0IND); From patchwork Wed Sep 26 22:07:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975455 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qbrkYvTj"; 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 42LBv83scGz9s3x for ; Thu, 27 Sep 2018 08:09:53 +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=LUTHZL3sgKOR4HJfP5kx0i6H4v9sl+X4ruAfG5cJbWU=; b=qbrkYvTjdfV3P95XRiULJ6oJP7 B2Wr+bSBVf9p344aocqfNnZPFqHLqo64Dmsj3Aa8XX7cdqi3D95NTopfCoh2SEwNI/SmGK1utzKeg Gaor2Y1ZyZF7EeXeBOAXwBQuYzLIWco7nh4TIgtr+QQHP/3D2dZyWje9WEezPDNRU/Z07zzT61SSw nrWni7V/JgSWCDwbyZaRQfcWcirD1/fgFdpHqqB35A6k9i6VHAZQl0WLiLxPhA3J1I0c2ex9Pa4g7 P383a+TEtOsvKg11xphzGNeV6CbMRGTxN8gRys21gIUoOt8DLAIxZ6M+c0a6yy+/+ELsh9KZnonWa mZ78W60g==; 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 1g5Hzz-0005ih-RM; Wed, 26 Sep 2018 22:09:35 +0000 Received: from mail-out.m-online.net ([212.18.0.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5Hz0-0005dv-A0 for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:08:36 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBs20MwMz1r8Sj; Thu, 27 Sep 2018 00:08:06 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBs15th9z1qqkx; Thu, 27 Sep 2018 00:08:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id VY_CAiFV086f; Thu, 27 Sep 2018 00:08:03 +0200 (CEST) X-Auth-Info: pmJFyPFt2hlWNGS/bJUrr4wHGs+Ay2NFmUGNaeDRlj4= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:03 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 3/9] mtd: spi: Do not setup the default seqid as we got it set for DUAL and QUAD Date: Thu, 27 Sep 2018 00:07:33 +0200 Message-Id: <20180926220739.620-4-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150834_522610_C5C83337 X-CRM114-Status: UNSURE ( 9.90 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.18.0.10 listed in list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 2ef5bfc41d32..ad951a46a628 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -686,7 +686,6 @@ static void fsl_qspi_set_map_addr(struct fsl_qspi *q) static void fsl_qspi_init_ahb_read(struct fsl_qspi *q) { void __iomem *base = q->iobase; - int seqid; u32 buf3cr; /* AHB configuration for access buffer 0/1/2 .*/ @@ -708,11 +707,6 @@ static void fsl_qspi_init_ahb_read(struct fsl_qspi *q) qspi_writel(q, 0, base + QUADSPI_BUF0IND); qspi_writel(q, 0, base + QUADSPI_BUF1IND); qspi_writel(q, 0, base + QUADSPI_BUF2IND); - - /* Set the default lut sequence for AHB Read. */ - seqid = fsl_qspi_get_seqid(q, q->nor[0].read_opcode); - qspi_writel(q, seqid << QUADSPI_BFGENCR_SEQID_SHIFT, - q->iobase + QUADSPI_BFGENCR); } /* This function was used to prepare and enable QSPI clock */ From patchwork Wed Sep 26 22:07:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975462 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K7I4kNuP"; 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 42LC1Q411Dz9s2P for ; Thu, 27 Sep 2018 08:15:22 +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=GlTN1hPl6MarTUDLWXSBxnyEBJx5DqWuYVkjm4ir9ts=; b=K7I4kNuPJiAQco5Y1dUg4kCVT7 77K8uyBV9d5sYNwHZeTW6PDtfJUtpFteGMGvkw/k+jsoR+hAsEoU6gBGw04xeGDcirM33IaIee/mp b/SWl1+mBjIXwm6nKjvEuKJ/SiELQxOfkLXWu4/GGRaFYNwxVjQVdwmSIExU0aA+2y2vRouqpDwY9 p5nwJLzGoHxvvwu1vsW6UEMTqsraWVWCzT9eLygNV/7gaNUIargaAFRLNuP8Z3BIGRvcLQSOmYT60 Cngb7F0I+6++dexGTx+VMNMtCAsHyRq4Ru9H+AtF3lHL1kpGicT9E0Pz/7za3RCrhrl5wIQzne1CX m7OwZcLw==; 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 1g5I5O-0008WH-BC; Wed, 26 Sep 2018 22:15:10 +0000 Received: from mail-out.m-online.net ([212.18.0.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5HzU-0005iY-62 for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:09:06 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBs42lZWz1qtP7; Thu, 27 Sep 2018 00:08:08 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBs41Dskz1qqkx; Thu, 27 Sep 2018 00:08:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id tOchIFRPIMRU; Thu, 27 Sep 2018 00:08:06 +0200 (CEST) X-Auth-Info: Wxfm2S9qmloT8Vy+aKMyypntjCdysvVnKakzALTAo+U= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:06 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 4/9] mtd: spi: Modify the HW capability mask according to supported RX lanes Date: Thu, 27 Sep 2018 00:07:34 +0200 Message-Id: <20180926220739.620-5-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150904_393823_5FBE67F1 X-CRM114-Status: GOOD ( 13.28 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.18.0.10 listed in list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It may happen that we got two identical SPI devices connected to the QSPI controller with asymmetrical number of RX lanes. Due to PCB constraints, one can work as DUAL and second as QUAD. For such scenario we do need support for setting different read commands. Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index ad951a46a628..4f0c78ba6fcb 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -977,7 +977,7 @@ static void fsl_qspi_unprep(struct spi_nor *nor, enum spi_nor_ops ops) static int fsl_qspi_probe(struct platform_device *pdev) { - const struct spi_nor_hwcaps hwcaps = { + struct spi_nor_hwcaps hwcaps = { .mask = SNOR_HWCAPS_READ_1_1_4 | SNOR_HWCAPS_PP, }; @@ -987,7 +987,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) struct resource *res; struct spi_nor *nor; struct mtd_info *mtd; - int ret, i = 0; + int ret, i = 0, width; q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL); if (!q) @@ -1104,6 +1104,14 @@ static int fsl_qspi_probe(struct platform_device *pdev) if (ret < 0) goto mutex_failed; + if (!of_property_read_u32(np, "spi-rx-bus-width", &width)) { + if (width == 2) { + hwcaps.mask &= ~SNOR_HWCAPS_READ_QUAD; + hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2; + } else if (width != 4) + return -EINVAL; + } + /* set the chip address for READID */ fsl_qspi_set_base_addr(q, nor); From patchwork Wed Sep 26 22:07:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975463 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WmETCU5S"; 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 42LC2t2TVtz9s2P for ; Thu, 27 Sep 2018 08:16:38 +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=tyKttIWmH6szi24JjFfKfLz/9YaLwu5BCYTAHtFSVls=; b=WmETCU5Smpg5D4BDFuKBwJL0HD kk7mehb+OIrFiMYMXEXHE+EKrclJx6oeF2k69dKnIwSSXzpwBWABN6wPzFVu8W9j0zkW2Ho9xEpAd 7VFhlDDa9pONZuCxTh1ZTxS5r8UnHATxR/jfh9ItJxNhgQWT55O4OVCxucDISZgul/N4YB+37qknM +b4BuvCxTg+ucTde5MaVHLYOPYZJ5wLiMTDXgMPHDhua9QhZAHXDOV1u9wc2QPAv3rv4uX0aTgRld HL2kOKb5j0orPWkpJ2HeE/Upgbkt8TxUhcv0Od/lhNt0CN+99/e9sGlfkkDtLe+P2oxO89zMk1BhA PXNbEwzg==; 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 1g5I6e-0001yu-BK; Wed, 26 Sep 2018 22:16:28 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5HzU-0005j1-64 for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:09:06 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBs63tdjz1qxy2; Thu, 27 Sep 2018 00:08:10 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBs63QBxz1qql9; Thu, 27 Sep 2018 00:08:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id Xw99BNNE2cJ7; Thu, 27 Sep 2018 00:08:08 +0200 (CEST) X-Auth-Info: RTW0KObLlgTB2RenOxqEUUWGX3ReabjVPGTaVElirp0= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:08 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 5/9] mtd: spi: Provide LUT entry to perform DUAL read Date: Thu, 27 Sep 2018 00:07:35 +0200 Message-Id: <20180926220739.620-6-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150904_402927_BF3CD622 X-CRM114-Status: GOOD ( 10.34 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.18.0.9 listed in list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This commit adds LUT sequence to perform DUAL read (as opposite to the default QUAD for this controller). Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 4f0c78ba6fcb..0c381cdfb39f 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -207,6 +207,7 @@ #define SEQID_RDCR 9 #define SEQID_EN4B 10 #define SEQID_BRWR 11 +#define SEQID_DUAL_READ 12 #define QUADSPI_MIN_IOMAP SZ_4M @@ -482,6 +483,15 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) qspi_writel(q, LUT0(CMD, PAD1, SPINOR_OP_BRWR), base + QUADSPI_LUT(lut_base)); + /* Dual Read */ + lut_base = SEQID_DUAL_READ * 4; + + qspi_writel(q, LUT0(CMD, PAD1, SPINOR_OP_READ_1_1_2) | + LUT1(ADDR, PAD1, addrlen), base + QUADSPI_LUT(lut_base)); + qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) | + LUT1(FSL_READ, PAD2, rxfifo), + base + QUADSPI_LUT(lut_base + 1)); + fsl_qspi_lock_lut(q); } @@ -513,6 +523,8 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd) return SEQID_EN4B; case SPINOR_OP_BRWR: return SEQID_BRWR; + case SPINOR_OP_READ_1_1_2: + return SEQID_DUAL_READ; default: if (cmd == q->nor[0].erase_opcode) return SEQID_SE; From patchwork Wed Sep 26 22:07:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975464 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZTu1a5PS"; 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 42LC4X2d4kz9s2P for ; Thu, 27 Sep 2018 08:18:04 +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=whdCMZ/LHE/1D41/F/pZiLdVF9y+H0VpdCsSfoE4DJk=; b=ZTu1a5PSuHvE8rQLd689KfH2D+ Go7BJKu9iElkDxQLp+h1soYt9nZLvV5Q/2oXK7jCzGmHiFcnXQt1DGSPLBPYh0K80STuoQLSkYvLs 4M8o/4HnKez+mPBpdVveil/j0iCi+yJkIRorLTtGz9Y5ap8cvMZIxMK5uJS5gUxoQ33p5oSDhYIvo A3r/T/vvVh/hNfcWeYMKzIuYwpEh3H5CZxC23BYqzr1MreyhNcnxhewi5LGxkDsPUT01hVPTA6El1 DiPG8473NWYyTA1czxDox7QIjIttVIE2GKiRmIgEE73tDqSRDEe4ydopAvdQU06Ukn91FQ05H/6+l Ldqn1QSg==; 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 1g5I80-0002Vg-1p; Wed, 26 Sep 2018 22:17:52 +0000 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5HzU-0005ia-68 for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:09:06 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBs86MPhz1qtPb; Thu, 27 Sep 2018 00:08:12 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBs84wh0z1qqkx; Thu, 27 Sep 2018 00:08:12 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id fJ9kkklT1FUg; Thu, 27 Sep 2018 00:08:10 +0200 (CEST) X-Auth-Info: G1LAftSGVrkM3pbRMIXCVGXxxhH75Q8HzephrSM4QBQ= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:10 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 6/9] mtd: spi: Enhance the fsl_qspi_read() method to support DUAL and QUAD Date: Thu, 27 Sep 2018 00:07:36 +0200 Message-Id: <20180926220739.620-7-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150904_414558_5D607C44 X-CRM114-Status: GOOD ( 10.67 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2001:a60:0:28:0:1:25:1 listed in] [list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This commit not only provides the DUAL and QUAD read capability for QSPI controller, but also resets the AHB pointer sequence (as recommended) and makes sure that AHB - not IP - mode is used for reading SPI-NOR data to internal buffer. Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 0c381cdfb39f..97546fa70b79 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -119,6 +119,10 @@ #define QUADSPI_FR 0x160 #define QUADSPI_FR_TFF_MASK 0x1 +#define QUADSPI_SPTRCLR 0x16c +#define QUADSPI_SPTRCLR_BFPTRC_SHIFT 0 +#define QUADSPI_SPTRCLR_BFPTRC_MASK (0x1 << QUADSPI_SPTRCLR_BFPTRC_SHIFT) + #define QUADSPI_SFA1AD 0x180 #define QUADSPI_SFA2AD 0x184 #define QUADSPI_SFB1AD 0x188 @@ -903,6 +907,22 @@ static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, { struct fsl_qspi *q = nor->priv; u8 cmd = nor->read_opcode; + int seqid; + + /* Set the actual lut sequence for AHB Read from the considered nor. */ + seqid = fsl_qspi_get_seqid(q, nor->read_opcode); + if (seqid < 0) + return seqid; + + qspi_writel(q, seqid << QUADSPI_BFGENCR_SEQID_SHIFT, + q->iobase + QUADSPI_BFGENCR); + + /* Reset the AHB sequence pointer */ + qspi_writel(q, QUADSPI_SPTRCLR_BFPTRC_MASK, + q->iobase + QUADSPI_SPTRCLR); + + /* make sure the Rx buffer is read through AHB, not IP */ + qspi_writel(q, QUADSPI_RBCT_WMRK_MASK, q->iobase + QUADSPI_RBCT); /* if necessary,ioremap buffer before AHB read, */ if (!q->ahb_addr) { From patchwork Wed Sep 26 22:07:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975469 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PZSTdmrX"; 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 42LC9x0sHrz9s3x for ; Thu, 27 Sep 2018 08:22:45 +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=wCJv1u70yUS8io04jxMkmdyNYVknNlRwhE83YOO8VSA=; b=PZSTdmrXVHQqr45nhzIXihyvvT pk37h025Zvrd1q5nbWFTBb3f3eTN/XnDVWDLghd3UPyXA/Eeji8cIBm0tLx2cYx7pKHfeb1+ru9y1 pzmdRX3mAJ6Xs0ZwdL/fJtBLX0yn9PIXoaJuxdUVhSLPK9e1/7fAFFCkU6Chaa94ekmO0QIt/LJtK q1CbkJyQeDrY9i//TDxecB55a5GxrCNQm7D13HjLrKOqJCJ9PKVB4JBEz3LRpGrd5X2/oOy3XcSNH SXYG22XCpQPfIPHe6IBagsEylaKdKYR4A66fXXUn9XZOBqBUtXUrRFIpeBB12oSb9aMrFdJHp1YDe Cofj5yGw==; 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 1g5ICX-0004uw-SA; Wed, 26 Sep 2018 22:22:33 +0000 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5I02-0005oh-B2 for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:09:45 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBsH1qNpz1qv3Q; Thu, 27 Sep 2018 00:08:19 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBsH1W0gz1qqkx; Thu, 27 Sep 2018 00:08:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id mBFi4u0Ixaea; Thu, 27 Sep 2018 00:08:13 +0200 (CEST) X-Auth-Info: G3cSlPus583s1B3MpaxwZBJlKKP9u6bINvQCeZ682LM= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:12 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 7/9] mtd: spi: Add SPI_NOR_DUAL_READ property for the 'n25q128a13' Micron memory Date: Thu, 27 Sep 2018 00:07:37 +0200 Message-Id: <20180926220739.620-8-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150938_609049_72D80682 X-CRM114-Status: GOOD ( 11.09 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2001:a60:0:28:0:1:25:1 listed in] [list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This memory supports not only QUAD reads, but DUAL as well. Those are needed when two identical memories are used, but one is not using four lines for read I/O. Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index f028277fb1ce..442102be174e 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1103,7 +1103,7 @@ static const struct flash_info spi_nor_ids[] = { { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, - { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, + { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) }, { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "n25q256ax1", INFO(0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) }, From patchwork Wed Sep 26 22:07:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975465 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tXbM7Mhe"; 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 42LC6l3xLvz9s3x for ; Thu, 27 Sep 2018 08:19:59 +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=46eqhOMsHvh45oVdXudRTTq5t6lKQHQ37W2ij4FtGqE=; b=tXbM7Mhe+EfHdzFihsoaLAlLkG MFnDrdRvktwOIyFgXwnATNyt4/g4RER1yDFwGWY3r8HcO9yhYGfrw3Jcm4U87PdE5yUFEBjvcnFqw 1LPVBOrfae6GvVrCg4K11hNbb2UsfJrDuti3k7giEnG8zNei9fjc4V46pJrFQO3Jg3yEXtetDhQzV 1rza7Slr+3ZOmubRhWj39Pmp0T3CN9YHFS2zs/XNnjfl2Ib54sXO1UTs/ToUUfKgt09lc0pp3yYyE 8jxAHlpr++Q2iqqAhATbl7gV/KFoAbDoC9FKzlhDbh5VaElA6eSneYXNOKQW5FyjnaRmzj2HudvJ4 cga5fSAw==; 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 1g5I9t-00033y-4P; Wed, 26 Sep 2018 22:19:49 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5HzU-0005j8-67 for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:09:08 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBsK56v8z1qyLM; Thu, 27 Sep 2018 00:08:21 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBsK3TQ2z1qql9; Thu, 27 Sep 2018 00:08:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id sEcYjIMFJ6Wj; Thu, 27 Sep 2018 00:08:19 +0200 (CEST) X-Auth-Info: +VfsWiVnptGs8R0euN51ovntDv15rdXxE4yZJw5LG28= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:19 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 8/9] mtd: spi: Allocate memory corresponding to maximal fsl-quadspi.c controller area Date: Thu, 27 Sep 2018 00:07:38 +0200 Message-Id: <20180926220739.620-9-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150904_571185_8890D453 X-CRM114-Status: GOOD ( 11.92 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.18.0.9 listed in list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This commit changes the way how QUADSPI controller allocates memory for reading data via AHB. After this change it is a fixed buffer with maximal size (for up to four SPI-NOR memories connected). In my case: ----------------- 0x0 SPI0 (QSPI0, A1 -> QUAD) ----------------- 0x1000000 HOLE ----------------- 0x2000000 SPI1 (QSPI0, B1 -> DUAL) ----------------- 0x3000000 HOLE ----------------- 0x4000000 Without this change, some single bytes are missing when reading single bytes from 256B buffer. dd if=/dev/mtd7 of=aaa.img bs=1 count=256 root@nix:~# hexdump aaa.img 0000000 464c eec0 baa5 c5ff 7b99 4dfb e0b6 8a2e 0000010 e98e 5265 683c a635 c069 e402 303f d936 0000020 c243 01a7 7064 fce8 e3a9 200a 7e85 28bc 0000030 4296 a30e 1bb4 88d4 b456 b4a6 f3aa 8cff 0000040 01c9 462d 0a43 f893 0e42 67f1 57f0 787c 0000050 49c0 fb2a e514 e954 1d21 affa bac4 38f1 0000060 1ca5 ec46 77eb a854 98b6 e71a c1cb 876c 0000070 b441 2baf ee33 596c 98b6 e71a c1cb 876c 0000080 7d8b 5739 5cca 873f c3df 8aca 2d5b 2bbb 0000090 5afe 6ad9 6072 b092 5ace 905b e217 faee 00000a0 58c6 6851 a1b9 c756 5ace 905b e217 faee 00000b0 b3dd 98be 0412 73d2 cbca c47c 6ab0 7c6d 00000c0 65cf b1e2 1457 a3cf 502b 6449 9a84 d83f 00000d0 a6e7 df30 b0e6 ea23 502b 6449 9a84 d83f 00000e0 5638 26bf d680 c47a 0225 6762 cf65 75fc 00000f0 2faa edf1 f8b6 dc13 ffff ffff ffff ffff 0000100 Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/fsl-quadspi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 97546fa70b79..915e5a203895 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -908,6 +908,9 @@ static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, struct fsl_qspi *q = nor->priv; u8 cmd = nor->read_opcode; int seqid; + size_t qlen = q->nor_size * 4; + int nor_idx = nor - q->nor; + size_t nor_ofs = q->nor_size * nor_idx; /* Set the actual lut sequence for AHB Read from the considered nor. */ seqid = fsl_qspi_get_seqid(q, nor->read_opcode); @@ -926,8 +929,9 @@ static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, /* if necessary,ioremap buffer before AHB read, */ if (!q->ahb_addr) { - q->memmap_offs = q->chip_base_addr + from; - q->memmap_len = len > QUADSPI_MIN_IOMAP ? len : QUADSPI_MIN_IOMAP; + q->memmap_offs = q->chip_base_addr; + q->memmap_len = qlen > QUADSPI_MIN_IOMAP ? + qlen : QUADSPI_MIN_IOMAP; q->ahb_addr = ioremap_nocache( q->memmap_phy + q->memmap_offs, @@ -942,8 +946,9 @@ static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, q->memmap_offs + q->memmap_len) { iounmap(q->ahb_addr); - q->memmap_offs = q->chip_base_addr + from; - q->memmap_len = len > QUADSPI_MIN_IOMAP ? len : QUADSPI_MIN_IOMAP; + q->memmap_offs = q->chip_base_addr; + q->memmap_len = qlen > QUADSPI_MIN_IOMAP ? + qlen : QUADSPI_MIN_IOMAP; q->ahb_addr = ioremap_nocache( q->memmap_phy + q->memmap_offs, q->memmap_len); @@ -954,12 +959,11 @@ static ssize_t fsl_qspi_read(struct spi_nor *nor, loff_t from, } dev_dbg(q->dev, "cmd [%x],read from %p, len:%zd\n", - cmd, q->ahb_addr + q->chip_base_addr + from - q->memmap_offs, + cmd, q->ahb_addr + nor_ofs + from - q->memmap_offs, len); /* Read out the data directly from the AHB buffer.*/ - memcpy(buf, q->ahb_addr + q->chip_base_addr + from - q->memmap_offs, - len); + memcpy(buf, q->ahb_addr + nor_ofs + from - q->memmap_offs, len); return len; } From patchwork Wed Sep 26 22:07:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 975468 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=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CDDUXOqO"; 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 42LC8N1GBTz9s3x for ; Thu, 27 Sep 2018 08:21:24 +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=0eswkchvfgiDwhgC6KpxMpezr02WxXxZaQ05erIPEbY=; b=CDDUXOqOAoHQoEzYcaKxUHs6ba LWNYacVvWRRMOO4UcWciO3wkPt+sPbhjNRFCT2lQAT0O+Aj+f//byqakI5V9FcoUK+bC2yvxSZqGN +ibNjooYToN16bsbeyr+cZBxW/pAkDZbksxmrkM20x063mDHWnCkd9AnmH1XDghX2OmwJZHcNGlg4 +xJCB6DCG0JOrJ8a5jIkdAsiJd3ywElG+qnrmL7g2oUQYvS8XT7cvk0eciPxnmJTRAR2v0Po2jlpU ZUDUrEYw2kG2AHrUiP0SZowvfLm38pnvVn0jVwY5cbeDu6O2bJ23k5BkMTSoT8a2dkF1ES5Ms9BOy E+qTE3sA==; 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 1g5IBD-0003qn-AG; Wed, 26 Sep 2018 22:21:11 +0000 Received: from mail-out.m-online.net ([212.18.0.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5I02-0005oj-B1 for linux-mtd@lists.infradead.org; Wed, 26 Sep 2018 22:09:45 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42LBsM5gSLz1qvP2; Thu, 27 Sep 2018 00:08:23 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42LBsM5HZZz1qqkx; Thu, 27 Sep 2018 00:08:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id sAXd_w-82tFh; Thu, 27 Sep 2018 00:08:21 +0200 (CEST) X-Auth-Info: ImGhTvzKu1uyr4+X6nXkNtVcWDtm6o3ohc9bDdais2g= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 27 Sep 2018 00:08:21 +0200 (CEST) From: Lukasz Majewski To: Frieder Schrempf , boris.brezillon@bootlin.com, Mark Rutland Subject: [RFC/RFT PATCH v1 9/9] mtd: spi: Skip reading the Serial Flash Discoverable Parameters Date: Thu, 27 Sep 2018 00:07:39 +0200 Message-Id: <20180926220739.620-10-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180926220739.620-1-lukma@denx.de> References: <20180926220739.620-1-lukma@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180926_150938_631211_A0AC81E0 X-CRM114-Status: GOOD ( 11.48 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.18.0.10 listed in list.dnswl.org] 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: yogeshnarayan.gaur@nxp.com, richard@nod.at, broonie@kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , linux-spi@vger.kernel.org, albert.aribaud@3adev.fr, prabhakar.kushwaha@nxp.com, linux-mtd@lists.infradead.org, david.wolfe@nxp.com, Fabio Estevam , han.xu@nxp.com, computersforpeace@gmail.com, Fabio Estevam , dwmw2@infradead.org, Lukasz Majewski MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The fsl-quadspi.c driver is not supporting SPINOR_OP_RDSFDP (0x5a) read opcode - in the legacy driver we do read some garbage data from AHB mapped area and then return on the first check (L2376 @ ./mtd/spi-nor/spi-nor.c) Signed-off-by: Lukasz Majewski --- drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 442102be174e..c79b8c33aeeb 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1103,7 +1103,7 @@ static const struct flash_info spi_nor_ids[] = { { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ) }, - { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) }, + { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ | SPI_NOR_SKIP_SFDP) }, { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "n25q256ax1", INFO(0x20bb19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) }, { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },