Received: by 10.223.185.116 with SMTP id b49csp1111626wrg; Sat, 3 Mar 2018 15:55:30 -0800 (PST) X-Google-Smtp-Source: AG47ELuddD7VntQQ8g7YowlWrRErZtkhTGhT8zQTKLMN8bQVXZ7XJ7FPP+yeQCg5v5kn5V+w2DdZ X-Received: by 10.101.93.71 with SMTP id e7mr8500543pgt.248.1520121330710; Sat, 03 Mar 2018 15:55:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520121330; cv=none; d=google.com; s=arc-20160816; b=bfAjwWtar4QvIhC0HExKN6WIWORyT4P+iJlkgCjJjpYjUS5hEsCO/D+QFWWE+S26Dv Jw9Ua4aerTHbyDtt9byhWtcMRSjUgzQCKHtsNJaWNicb0UcIuL+VBih0PP8I6ficYeQ3 rcOi33sIHOk/3XeHI/PsfsV6DsZdV4pj4hHCvkshsBoPKvJzCpT9yH8E7+6uf/2Xwwqb vDyNPsUVmuRdB/psZvTK03SQgD9ZLCJFhStT9CWMzGUgls/XiS0MH1770kB58x35Y1G2 YRABS+9CSd8Rz5vukja+cpz7lIyI4C24jnnek5eU5sL/+KY6jpDC+Bqhq1fO6dqXYflq 9fRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=q+xcTDGfsfzSu8eFBcfIH/f45J4pY80CRSmZx8tgaW4=; b=iUIcUH2i0b7XVmTP3R0SaYykBkkv7GAKBHuziK69K90BwNA6MRpSMSO1hIJutQFjuU FAxST3c7k5oWaDIYjTgHf1eQIO4YlIDis2zOLUwtrgKi3MCvsTbsSBC8NyuLdUCAUnGS deVARNW1L5u/OCdWYAMITUBUIKBfzHt7GPTYww4bDPSabCmfKJ8MBfZQm2lRpDq2YR+9 jb2bGbMJPzKfXs6yrAFqX0JptfHIauZEKM/3Swelu07Psx9N7L9/yQd9+4BJKkqdgEC2 V1MKFb4taHOTmY2dqFSX1H/pfnHN1ai8DEpX2jG4OGwLW+RVN/v2jkZpJIjVbag2DIUT taxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=hGsYJMDE; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s125si7585334pfb.37.2018.03.03.15.55.16; Sat, 03 Mar 2018 15:55:30 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=hGsYJMDE; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbeCCXyW (ORCPT + 99 others); Sat, 3 Mar 2018 18:54:22 -0500 Received: from mail-cys01nam02on0126.outbound.protection.outlook.com ([104.47.37.126]:47215 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933518AbeCCWc5 (ORCPT ); Sat, 3 Mar 2018 17:32:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=q+xcTDGfsfzSu8eFBcfIH/f45J4pY80CRSmZx8tgaW4=; b=hGsYJMDE4wRUWZ1+OFBaMV/PxFzwth24HdsWc+iZZ/Q7GyWm41UHaWYTFMNRcUl1OUnpae1ZWfXUUufDOwvx4/nous+3MTXHIUv3oF2zHGLE1rkLZhq5ACbw3AQVTwdUKpBys+NrJTIRjKeWjcz/PzwtHa/z7WKRDj9ZTgqrjQI= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1098.namprd21.prod.outlook.com (52.132.149.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Sat, 3 Mar 2018 22:32:52 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:32:52 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Jiada Wang , Vinod Koul , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 067/219] dmaengine: imx-sdma: add 1ms delay to ensure SDMA channel is stopped Thread-Topic: [PATCH AUTOSEL for 4.9 067/219] dmaengine: imx-sdma: add 1ms delay to ensure SDMA channel is stopped Thread-Index: AQHTsz73PIYhn7ZVWE2wo9GxKLY0uQ== Date: Sat, 3 Mar 2018 22:28:35 +0000 Message-ID: <20180303222716.26640-67-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1098;7:QCwyACAmJ9Kq6u3ZjaNWUCdNFWKpVbTepv+CEP6JyaKcDEqC9ex4B3YYRG4lSTiepEC/ehFoFQm+2ecjHrD1oXUitmENNaeYhVWfaQhcFgn9peXxpVyQz4qfF3Z8J0UJbf+GBx15knqPJ+wU3wJtihWOCrziOaVC5g1F7dM8SJrZzGjtgysv4ELfkh69yR+mGaNS4Jx3JCTMEDcM4PKmwOzj2rOypHlpUiYHPFFwfzPZxmiEMoLwlRWvX+e7+wo+ x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: faff538d-1469-48ad-6a17-08d58156b391 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1098; x-ms-traffictypediagnostic: MW2PR2101MB1098: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3231220)(944501244)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1098;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1098; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(376002)(39380400002)(366004)(396003)(346002)(199004)(189003)(2906002)(8936002)(36756003)(6512007)(81156014)(10290500003)(81166006)(99286004)(6436002)(68736007)(478600001)(3846002)(22452003)(53936002)(8676002)(110136005)(54906003)(4326008)(316002)(76176011)(6116002)(7736002)(105586002)(305945005)(3660700001)(1076002)(14454004)(97736004)(25786009)(186003)(72206003)(26005)(102836004)(86362001)(6666003)(2501003)(3280700002)(6506007)(5660300001)(10090500001)(59450400001)(66066001)(106356001)(5250100002)(2900100001)(2950100002)(86612001)(6486002)(107886003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1098;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: sUnrRME66qLHn5VdwWkdbJn/AU/0IaxOTQFomxxFbumm/6lmORUGc1XLiYG+32UN4whTa8b63wRqrSeaKYDrGmPRBvlbcLR/gv58oOMcStbo37nn+F46JRTTlF2xmve8MyRCkwzG8hyZq4M9JReDDQ0yLpwHtxPJCSUwgn75bsA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: faff538d-1469-48ad-6a17-08d58156b391 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:35.0569 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1098 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiada Wang [ Upstream commit 7f3ff14b7eb1ffad132117f08a1973b48e653d43 ] sdma_disable_channel() cannot ensure dma is stopped to access module's FIFOs. There is chance SDMA core is running and accessing BD when disable of corresponding channel, this may cause sometimes even after call of .sdma_disable_channel(), SDMA core still be running and accessing module's FIFOs. According to NXP R&D team a delay of one BD SDMA cost time (maximum is 1ms) should be added after disable of the channel bit, to ensure SDMA core has really been stopped after SDMA clients call .device_terminate_all. This patch introduces adds a new function sdma_disable_channel_with_delay() which simply adds 1ms delay after call sdma_disable_channel(), and set it as .device_terminate_all. Signed-off-by: Jiada Wang Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/imx-sdma.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index d1651a50c349..21726a270fc4 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -937,6 +937,21 @@ static int sdma_disable_channel(struct dma_chan *chan) return 0; } =20 +static int sdma_disable_channel_with_delay(struct dma_chan *chan) +{ + sdma_disable_channel(chan); + + /* + * According to NXP R&D team a delay of one BD SDMA cost time + * (maximum is 1ms) should be added after disable of the channel + * bit, to ensure SDMA core has really been stopped after SDMA + * clients call .device_terminate_all. + */ + mdelay(1); + + return 0; +} + static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac) { struct sdma_engine *sdma =3D sdmac->sdma; @@ -1828,7 +1843,7 @@ static int sdma_probe(struct platform_device *pdev) sdma->dma_device.device_prep_slave_sg =3D sdma_prep_slave_sg; sdma->dma_device.device_prep_dma_cyclic =3D sdma_prep_dma_cyclic; sdma->dma_device.device_config =3D sdma_config; - sdma->dma_device.device_terminate_all =3D sdma_disable_channel; + sdma->dma_device.device_terminate_all =3D sdma_disable_channel_with_delay= ; sdma->dma_device.src_addr_widths =3D BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); sdma->dma_device.dst_addr_widths =3D BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); sdma->dma_device.directions =3D BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV)= ; --=20 2.14.1