From patchwork Tue May 7 09:16:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10932657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B03D112C for ; Tue, 7 May 2019 09:17:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B4D128871 for ; Tue, 7 May 2019 09:17:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F6E2288C7; Tue, 7 May 2019 09:17:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAD0128871 for ; Tue, 7 May 2019 09:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726998AbfEGJQ6 (ORCPT ); Tue, 7 May 2019 05:16:58 -0400 Received: from mail-eopbgr40080.outbound.protection.outlook.com ([40.107.4.80]:57499 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726860AbfEGJQ6 (ORCPT ); Tue, 7 May 2019 05:16:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ty+NeUuEjZSg4Rw8zZhrdypRduOUc/wIbBosqPyPia0=; b=yIdgOXmwnRvq5itGJ8Gk8zl+W1gglFeFAVZIHDowok6M+msr9NpsLvSFhzgxSXd+CJ2ThqdZYy+qF1F1r3mQ2BboYGc6kOV9EmpRyZm3pIWSinnVvjmhe+68xrq1QS/Yd7zuYCbqje+P++7co19GzPMwl1pAh32U8LvHsUyehKc= Received: from VI1PR04MB4543.eurprd04.prod.outlook.com (20.177.55.90) by VI1PR04MB5005.eurprd04.prod.outlook.com (20.177.49.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.11; Tue, 7 May 2019 09:16:13 +0000 Received: from VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::5d07:911b:18e1:1525]) by VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::5d07:911b:18e1:1525%4]) with mapi id 15.20.1856.012; Tue, 7 May 2019 09:16:13 +0000 From: Robin Gong To: "robh@kernel.org" , "broonie@kernel.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , "mark.rutland@arm.com" , "u.kleine-koenig@pengutronix.de" , "plyatov@gmail.com" , "vkoul@kernel.org" , "dan.j.williams@intel.com" , "catalin.marinas@arm.com" , "will.deacon@arm.com" , "l.stach@pengutronix.de" CC: dl-linux-imx , "linux-spi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "dmaengine@vger.kernel.org" , "devicetree@vger.kernel.org" , "kernel@pengutronix.de" Subject: [PATCH v3 06/14] spi: imx: fix ERR009165 Thread-Topic: [PATCH v3 06/14] spi: imx: fix ERR009165 Thread-Index: AQHVBLWEuFpHOQnu6U2WCKaGedJC3w== Date: Tue, 7 May 2019 09:16:13 +0000 Message-ID: <1557249513-4903-7-git-send-email-yibin.gong@nxp.com> References: <1557249513-4903-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1557249513-4903-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR04CA0088.apcprd04.prod.outlook.com (2603:1096:202:15::32) To VI1PR04MB4543.eurprd04.prod.outlook.com (2603:10a6:803:6d::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e7451482-eede-4d7a-978e-08d6d2cca698 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB5005; x-ms-traffictypediagnostic: VI1PR04MB5005: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0030839EEE x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(366004)(136003)(39860400002)(396003)(199004)(189003)(386003)(6506007)(2501003)(36756003)(102836004)(6486002)(26005)(8676002)(4326008)(5660300002)(25786009)(68736007)(52116002)(76176011)(186003)(2201001)(6306002)(6512007)(53936002)(3846002)(71200400001)(14444005)(66556008)(966005)(86362001)(66446008)(64756008)(476003)(66476007)(7416002)(305945005)(2906002)(11346002)(7736002)(66066001)(6116002)(99286004)(54906003)(256004)(14454004)(2616005)(73956011)(110136005)(6436002)(50226002)(8936002)(81156014)(81166006)(66946007)(316002)(71190400001)(486006)(478600001)(446003)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5005;H:VI1PR04MB4543.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Lmr+FY3+TChpLev9OPRQxuCRYLzA5C+q2anrx+MEPkhtaIgmxj6x3ldlV6hL7oH+jJtYLOnXQMhjFbyZK/3kWEyxWHim6IFK6sa3x6xv1mGHzHq8FTyFSU+ed8NC6qonEFb3qn83DnxHM7mCUV1VzZpRNzqFvkCeSvgx8H6o2pMYO9jy2jocRq1Lt8oiKeERupfJuQuIbnGc1DvEFjSoW2TvsovJsuUd1kJhde1qIZLy03zyoq6GAM87xnShlSuEk5LhEGckmHiaX/FtKd83VbkOKTlizqfdMOw+lYno55igkksmNZi3FujnQRqgS3+HKqpZUVsKuEv6YBT6zJ8ibxU6C0v26c6W5A1dmCU/e5KgB4TO876tFHJZQBm4koyuHgxbL4iQXSexN8xbfb3SSiAOKuQ0+VCurDtWG55mp8w= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7451482-eede-4d7a-978e-08d6d2cca698 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 May 2019 09:16:13.1954 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5005 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: */