Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1285150imm; Wed, 26 Sep 2018 15:08:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV627KbfX/3U5qbo+7gvH+peaRKigmpQfxNndHLINMVxup9C8sDqE5Gpy8VGXCjsHSwdZGfn4 X-Received: by 2002:a17:902:a504:: with SMTP id s4-v6mr8078273plq.101.1537999726309; Wed, 26 Sep 2018 15:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537999726; cv=none; d=google.com; s=arc-20160816; b=qCRq1x7px+MhYmr5DY3a5swaCJxr9b741y+1lmxeNAtIdRYAP18B1BpwafEL4B0BkD Pb9Zi5Y+JRJ3YOJvSYdfOb8gFEEbnu/dDUXLflhn96yqbNFOJV5M+TL9gV8JqcZiONSY zy8Ai2ylEkclfnveFOokGgTPgaynL/gXFK0pxFo+DYNZfmcaqEbIQ0sSPuML8IahFOrB vhZHbC/vOLgCAW30Z3NVmP4JwbwXpa1KmEUwmoyH6HedEY5/9AySlqHkw3wBDqFVMJax hwyVQA+BZDgvqPGI8a5Z9GwrJVCbV3W4urOAMXI3vfuZNZ68cxMaDELgALcwkKk62JU5 LguQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=knhhnPFJu7sWFWvqN01bldisgi/BiDlBQP+Uc3wXUgM=; b=UhvwdpuTNoVSeAkIe58tOHGMCt/dnQiMUelKAo85CPX1qrn9EgG74/xP/5hkFgsYod sILCqR1440F9nKiX/uaxJ+TrsQsGs7ji1XLdne6rOo1kwXBBVAeP6xJbh9ykV/2taGiE UBFFP+ltL3ZZaeTjmOUoAN1GvT5Vp8U/kQcjT5OgoF66nJp6Ssci+GdE1csldS5pgYhx +izMfPWIHbt3VPGa8SPiWflzA/12e6Ut5BSaiWQBU7SMABO2/NlYZJahPzfwQNEgitMB oZj5ZORy2wgwJDLTpo85KdQlKouOaTAlwWQ7MJFntFwaBLS2TsU3OjNoMFi5kjC21ueJ Q4SQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si168666plt.223.2018.09.26.15.08.31; Wed, 26 Sep 2018 15:08:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727163AbeI0EXS (ORCPT + 99 others); Thu, 27 Sep 2018 00:23:18 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:55253 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbeI0EXR (ORCPT ); Thu, 27 Sep 2018 00:23:17 -0400 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 Cc: linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, yogeshnarayan.gaur@nxp.com, richard@nod.at, Stefan Agner , Fabio Estevam , Fabio Estevam , prabhakar.kushwaha@nxp.com, han.xu@nxp.com, broonie@kernel.org, david.wolfe@nxp.com, computersforpeace@gmail.com, dwmw2@infradead.org, albert.aribaud@3adev.fr, Lukasz Majewski 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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) { -- 2.11.0