Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp401179ybh; Tue, 10 Mar 2020 00:40:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsmuFsemscUfRXXz1BQDipTASuZnc0tIWApnobdhI6DpQUW7FQlZoxcyy8YCEmD8pVXIGkE X-Received: by 2002:a9d:de8:: with SMTP id 95mr13808980ots.160.1583826023291; Tue, 10 Mar 2020 00:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583826023; cv=none; d=google.com; s=arc-20160816; b=IeHM4cg5QN9FTTC5NZpMyaZnTFwYcdQ7Nxy5zwjQEt3BQIY9Kd25YrI28g6mJRarut MFE93KEkfFYuPWU3orqfHIsU/bblHazv5kyb5WJUc+ZuwCq7mIuu/H13nRwiiFEckLSi kL+s1I4RebXv5EYOEh8YvDWCK1kMxs2Q25fHlUNDlVqtCt40RvbHFkhOLD3qqWoozxdQ UzdiGDH6rG7KRX/F13cNlNl+AEcBGOQGtYPgxGddAVME/kgBdxQo8KFq2eD9zMs/LcsD rSC2tHncVe5v2EWH6z03+NqwTOo+/hbjykDO++7+fu9iaeah4GJz4KCvD1sBpmBiDQ/J W1aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=f/kJst5dIh9qeyi1NEL2ikkn4e7qUxG3g2S2iBV4OZQ=; b=VwLBZC4w72xq/lgiyFDHg5WLg+njW7FJxkblk2Nf2B/GAfFiIp9fFFkLIxF+QzGyLo cpsz8MOh92FGunReFaXDoZ0oYnsgkR5HDkKYvTyB/dn0h5O8gmDifwdGXkIXDEVxpyZA YdoeOkxlb+IU4HAYGtPax8B15Bn+O69hG5xBfhFPnu7rUG6QVAeVU1mPIbqNP2sCm0xy hP15S4OL5zuWX2ZOKId9KRyYcawCYhTJopcQ1B35i5/nPS/z+x3Mls6JPI2ZcD5A9buO tocwzBzUthx1wG4VDsU0YnzErELnpEXN9wb809ZBfE10T5+Wy+B29BhVPCWXx6mUvHFp 668Q== 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 c6si8029719otk.233.2020.03.10.00.40.11; Tue, 10 Mar 2020 00:40:23 -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 S1726390AbgCJHjm (ORCPT + 99 others); Tue, 10 Mar 2020 03:39:42 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:42217 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgCJHjm (ORCPT ); Tue, 10 Mar 2020 03:39:42 -0400 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBZU3-0001OK-GJ; Tue, 10 Mar 2020 08:39:23 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1jBZU0-00089j-OU; Tue, 10 Mar 2020 08:39:20 +0100 Date: Tue, 10 Mar 2020 08:39:20 +0100 From: Sascha Hauer To: Robin Gong Cc: vkoul@kernel.org, shawnguo@kernel.org, u.kleine-koenig@pengutronix.de, broonie@kernel.org, robh+dt@kernel.org, festevam@gmail.com, dan.j.williams@intel.com, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, l.stach@pengutronix.de, martin.fuzzey@flowbird.group, kernel@pengutronix.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, dmaengine@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [RESEND v6 06/13] spi: imx: fix ERR009165 Message-ID: <20200310073920.GR3335@pengutronix.de> References: <1583839922-22699-1-git-send-email-yibin.gong@nxp.com> <1583839922-22699-7-git-send-email-yibin.gong@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1583839922-22699-7-git-send-email-yibin.gong@nxp.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:28:52 up 19 days, 14:59, 43 users, load average: 0.01, 0.14, 0.20 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2020 at 07:31:55PM +0800, Robin Gong wrote: > Change to XCH mode even in dma mode, please refer to the below > errata: > https://www.nxp.com/docs/en/errata/IMX6DQCE.pdf > > Signed-off-by: Robin Gong > Acked-by: Mark Brown > --- > drivers/spi/spi-imx.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > > diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c > index f4f28a4..842a86e 100644 > --- a/drivers/spi/spi-imx.c > +++ b/drivers/spi/spi-imx.c > @@ -585,8 +585,9 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, > ctrl |= mx51_ecspi_clkdiv(spi_imx, t->speed_hz, &clk); > spi_imx->spi_bus_clk = clk; > > + /* ERR009165: work in XHC mode as PIO */ > if (spi_imx->usedma) > - ctrl |= MX51_ECSPI_CTRL_SMC; > + ctrl &= ~MX51_ECSPI_CTRL_SMC; 'ctrl' was read from the hardware. In the dma case it was set explicitly, but it was never cleared for a PIO transfer. This looked wrong before this patch. Now with this patch it looks even more wrong: We clear a bit that has never been set and we only do this for DMA, when for the PIO case it definitly must be cleared. Drop the if clause. > > writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); > > @@ -612,12 +613,14 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, > > static void mx51_setup_wml(struct spi_imx_data *spi_imx) > { > + u32 tx_wml = 0; > + > /* > * Configure the DMA register: setup the watermark > * and enable DMA request. > */ > writel(MX51_ECSPI_DMA_RX_WML(spi_imx->wml - 1) | > - MX51_ECSPI_DMA_TX_WML(spi_imx->wml) | > + MX51_ECSPI_DMA_TX_WML(tx_wml) | tx_wml is never assigned any other value than 0. Drop the variable. > MX51_ECSPI_DMA_RXT_WML(spi_imx->wml) | > MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN | > MX51_ECSPI_DMA_RXTDEN, spi_imx->base + MX51_ECSPI_DMA); > @@ -1171,7 +1174,11 @@ static int spi_imx_dma_configure(struct spi_master *master) > tx.direction = DMA_MEM_TO_DEV; > tx.dst_addr = spi_imx->base_phys + MXC_CSPITXDATA; > tx.dst_addr_width = buswidth; > - tx.dst_maxburst = spi_imx->wml; > + /* > + * For ERR009165 with tx_wml = 0 could enlarge burst size to fifo size > + * to speed up fifo filling as possible. > + */ > + tx.dst_maxburst = spi_imx->devtype_data->fifo_size; > ret = dmaengine_slave_config(master->dma_tx, &tx); > if (ret) { > dev_err(spi_imx->dev, "TX dma configuration failed with %d\n", ret); > @@ -1265,10 +1272,6 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx, > { > int ret; > > - /* use pio mode for i.mx6dl chip TKT238285 */ > - if (of_machine_is_compatible("fsl,imx6dl")) > - return 0; So with this patch it becomes possible to do DMA on i.MX6dl, but it is mentioned nowhere. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |