Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2947240ybi; Mon, 10 Jun 2019 01:18:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxU+XV9zZLFBYnBRyVQgTyrfgNJ8ZiEVQJ4jqWDqk6xXYEFA8pTquWSt1IMfJuc6Meluvqc X-Received: by 2002:aa7:9190:: with SMTP id x16mr60376238pfa.86.1560154694485; Mon, 10 Jun 2019 01:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560154694; cv=none; d=google.com; s=arc-20160816; b=JQ6mUnaIcIxyPs6U0I2OaYSOOc7YCBFNbhbONbO5Xy9gqoSwJnM/9SacIpcPqZzFh8 ajqBjIOu8A/D2AD3Z2jv5zl4aTyTbxFUyrqk/Y6uEn1QlsDCzP2dDTOTI7lIQMUsJNfL QKMgPrcluHj5SFhz0/1bcZqIYaltRHzOxArGEW0f3I6GZUOaOznhPYXhVpW0jiWM/LIN MDN758KKnawUXv0niM33rMeXahwCL0C7obfj5BhKf5VpOmBCv4XDGGHOVxyyJ0Ow1uWY G/SAkzLVcxL7YzWepEIbIxoJX9l+ifWlV9LiKHSmUu0D5dqi424a/ABYnSSrDJHlsn4i JFgw== 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=XcbJaopeV/U6b3Ew+xf1UHJ/tv8ljmmT4qheKZI3WjY=; b=DTo7WlYynjgOhvLS2Pd5QDWB6LoL+P7PkjlinznjdcNXxjcl1YqhVt3vJfdl+bxUCk j6LNHHlhHxqRLIMsXjhgfQgtSrp9hpvp3cJxqaqSi79JpFRtxdRn+3difvkWjdrN8I0s E/46/1prTcaVgpzayLaA0UwfAURK4XVPhaBnGWdVhuqZ/XUevKfPwGQ3BZf3U3cAIRtb NmvrIJWGHTUFcABRqY1GugvHWTlktYwEr4dtFpeu+vOU7nkeUuzcyoTnh1y2MEQTgFQv ySLpXU/Jbiro4ELtjNo0tDan+mT+YXQlryv6tnra6Zjthp6oCfHAb4jC3kOcbKQyagDt EMTQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22si9354569pgl.124.2019.06.10.01.17.59; Mon, 10 Jun 2019 01:18:14 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388431AbfFJIQe (ORCPT + 99 others); Mon, 10 Jun 2019 04:16:34 -0400 Received: from inva020.nxp.com ([92.121.34.13]:37134 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388393AbfFJIQc (ORCPT ); Mon, 10 Jun 2019 04:16:32 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6A23E1A07C5; Mon, 10 Jun 2019 10:16:30 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 68BDE1A07D5; Mon, 10 Jun 2019 10:16:22 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 68E4640310; Mon, 10 Jun 2019 16:16:12 +0800 (SGT) From: yibin.gong@nxp.com To: robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, broonie@kernel.org, festevam@gmail.com, vkoul@kernel.org, dan.j.williams@intel.com, u.kleine-koenig@pengutronix.de, catalin.marinas@arm.com, l.stach@pengutronix.de, will.deacon@arm.com Cc: linux-spi@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 06/15] spi: imx: fix ERR009165 Date: Mon, 10 Jun 2019 16:17:44 +0800 Message-Id: <20190610081753.11422-7-yibin.gong@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610081753.11422-1-yibin.gong@nxp.com> References: <20190610081753.11422-1-yibin.gong@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robin Gong 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 09c9a1e..6795910 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; 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) | 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; - spi_imx->wml = spi_imx->devtype_data->fifo_size / 2; /* Prepare for TX DMA: */ -- 2.7.4