From patchwork Thu Dec 7 05:21:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Appana Durga Kedareswara rao X-Patchwork-Id: 10097659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2ABA60325 for ; Thu, 7 Dec 2017 05:37:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2FCF28BE8 for ; Thu, 7 Dec 2017 05:37:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 961CA2A32A; Thu, 7 Dec 2017 05:37:21 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 D580528BE8 for ; Thu, 7 Dec 2017 05:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752452AbdLGFhI (ORCPT ); Thu, 7 Dec 2017 00:37:08 -0500 Received: from mail-by2nam01on0088.outbound.protection.outlook.com ([104.47.34.88]:62662 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750967AbdLGFgF (ORCPT ); Thu, 7 Dec 2017 00:36:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=139ScGXCxP9wLCyE3nxkaxyLLz+idp4jhkM5oIFoAK4=; b=RX7MH52+atxw9MDO+MnzIU/koOP6oo/qe2WRutIn0yGkaIBW0gXRrR4mg2FhyC3KFmSi5ZvMV/Di4vLRFc8f/5v7ZrtDTgi731v+3EEEddDqYySCpck5EKo6b3xPB6jv2bGqSOtq3bNDq8G+4wHkGY3TyP9+xBlOIIIRgklNW48= Received: from BLUPR0201CA0002.namprd02.prod.outlook.com (10.163.116.12) by CY1PR02MB1335.namprd02.prod.outlook.com (10.161.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Thu, 7 Dec 2017 05:36:02 +0000 Received: from BL2NAM02FT024.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::207) by BLUPR0201CA0002.outlook.office365.com (2a01:111:e400:52e7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Thu, 7 Dec 2017 05:36:02 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT024.mail.protection.outlook.com (10.152.77.62) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.282.5 via Frontend Transport; Thu, 7 Dec 2017 05:35:57 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1eMoqi-00049P-Rk; Wed, 06 Dec 2017 21:35:56 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eMoqi-0003fB-Oe; Wed, 06 Dec 2017 21:35:56 -0800 Received: from xsj-pvapsmtp01 (smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id vB75Zmc5031507; Wed, 6 Dec 2017 21:35:48 -0800 Received: from [172.23.37.82] (helo=xhdpunnaia40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eMoqZ-0003aq-LQ; Wed, 06 Dec 2017 21:35:48 -0800 From: Kedareswara rao Appana To: , , , , , , , , CC: , , Subject: [PATCH v7 2/6] dmaeninge: xilinx_dma: Fix bug in multiple frame stores scenario in vdma Date: Thu, 7 Dec 2017 10:51:03 +0530 Message-ID: <1512624067-13554-3-git-send-email-appanad@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512624067-13554-1-git-send-email-appanad@xilinx.com> References: <1512624067-13554-1-git-send-email-appanad@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-23512.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(2980300002)(438002)(199004)(189003)(77096006)(54906003)(39060400002)(50466002)(48376002)(4326008)(47776003)(478600001)(5660300001)(2201001)(106466001)(356003)(51416003)(106002)(7696005)(76176011)(2906002)(6666003)(63266004)(316002)(305945005)(36756003)(81156014)(81166006)(8676002)(33646002)(16586007)(50226002)(36386004)(9786002)(7416002)(110136005)(8936002)(2950100002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR02MB1335; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT024; 1:iEH+JqhYqBzUIwoHuVNBeKSk/ffA4h994mEK4/zWfmNjeXK2EH9bw0sH5WgcuJ4ZVfZr3+zVrQeTn1ta/Z0LTVqO/fJOyya/Uj8oPwY3tFTHqeQAgnjzf5kjSOEMfkWP MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 64150acb-05ac-4d71-fa76-08d53d3466cd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603286); SRVR:CY1PR02MB1335; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1335; 3:YVw7K+XFAL/mVgu7kGe+sgpNSYrnLqA6HiinmpwvFOuON/Ad1izg+QapxAhfsh+oPjuDegNIetBb7PzmYj+jqUgz1sDXkR1PrTUbIcCmU09t43YdZrsBYsvNCTx14RuYsrAWW1tm8AUgI6Bv5Cfl85CJolc5VJrMSZsqsfLWV9Kfcg7BYqTVAht7mf4GvL4uh7Rd5mg0/DTvcSbeTElKHnSEjr3wdhIFkFWK2RoN+BxP5JfLy1hSkmgvhHzQ8SiHbyUtNT5ywNlmkWpEtEAB6AzZvRIPT3EDDdK9thO6WlTyJQ1NI7E4olt7v+QNkhVQ34gSaa0Pc8AmfJyS2kZXoftofwa0rzabqqVbjaOaTYc=; 25:E82lV/tGBvpO8h23go1bpthVd20fUY9XVdzs26suOw8qxab4TRjdYSVgNKfJQ09pezlnrF5Nk/uxLI1A5wk7mVN5zNspqHEANgtVLEyQ0AlMj1QpqQlcaJ607ajApFqri4uHleARKB0b1Lk13C/bHhBzewJLuDIAbKC6Xs8Z1jNppj2MplO3DRpB1Y4zpbaSStBKwVe7z/mWxTpELcsZ0EW50AVmV5+cbSXClNqA6DQr8slBXD96aX+X2fY9RELu1HMda+cIjqWoThcwdymC1WuweGcW7hLBHCfAeSgnwWT+VCV4r3NDXX2/m+DxkZ7yxxmOhcrEPRslTStt7K9nlA== X-MS-TrafficTypeDiagnostic: CY1PR02MB1335: X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1335; 31:fnhId0E0XUoLOhZY4guZu/ckC6biw9ajXP0eQ18a4U46m5JmrZQmp1Q3YnIPz2ZSjRnJflcefKtJssoC8c0bPIXms5eQ6A2lJExCZymLx36nzrO9/58TugdiAfkbRwIgDNP184cxtWlTdbLnP+AXbTwvqS7kZch7EHFpj5MuAP0BWTt61FiFnMxhbq8gQfQrm/8xWstKKksUjimUQi+GXMAt08xxLN1sxDDQHWaMjIw=; 20:Tpnko05wOUNS1PWc00ti8GZgjsM1ipMqMEgKtK/FmIIYvzEySmzmd+C7pltaQLuvxGgodDHzmlh2QwHQVopUjm2tO+8W+RQ6b7a8FnIh9hYk1HPbUfXctHwmJTE21d0GNfg0UaEu/QDnSWvk/DfgBIEr12CEpB6gweWTxbd+nB6JBfGQ/PFHMU1FCdCQDP1AA50EM9gqb9tLReEVWCWpNdq+8Z9pK++wEQOdMX1poyZVrefvLx3CJgBPvtsq/mqjSdi8I31qqmEwUAwQyqdSf8/+e64bd1CQdlzzZr8U1+3kOseU9BX1Uhu4dWD9l9drcbVSSx6ltKUgatVzZAdVnd8gVsQV6mtxld2PUjLMZAM6/8BU0g7aRBDp+7j+djn5OCXAdAACHclj0PNk8V5BVM+dy0zBss5hHIyYRlknjy6zLU0zrkpA3TNbJp01AZKYBRDdE/RILugCUiRzHMYy0oZPaFhHLoAxVBybCmpGwr0dIVvbTcAzCYKxeSlavPmP X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(3231022)(10201501046)(3002001)(93006095)(93004095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(20161123558100)(6072148)(201708071742011); SRVR:CY1PR02MB1335; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR02MB1335; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1335; 4:EEMp+qn0KKigbzXJgHUQGaFueQVaGKeQ6GqapTzBTz/q7cn0Y1e1QQgsg+9vNEly4wFMFdm1gAF8XsUgmkcjRmidPUNhJyquUGtsIkI0k6L33VfGmJEDavRZnYr+dMpdkhpKHifgOqrQN3Ghk0ypGM4o1LbmBS6reWlNcnixmcqG+sqO8KK4eRAQCtUbAuOJ7w1UnQt8bHqrntvECEVRf9m4sHJSVvg7glUr1S5hlvv7Hr2gTXkF5UrPqq5as2aOG7V57CFZlvDhjJlJ856iq2FsWlk0XPd7LdGu3M4Y3N3DZv8CGPJmhfWTT2QOBSh2 X-Forefront-PRVS: 05143A8241 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR02MB1335; 23:nm/RX2sBJ/xXMwYqD5o5P0qfBeD58l0ILbhFfTx0e?= =?us-ascii?Q?ru181d27Qh4eP7O3TyemKIZI0cX87qarr+WTEA0VNbCTr1VinCNtSGzGCtqS?= =?us-ascii?Q?B/rrYklpZrdQcU6bZ43+DVRED97kkCRr7vah79TiH4LcuA3QDlyvEV9W4Pz/?= =?us-ascii?Q?akrwzkG3H6L4XQlNzQYCYVv5edzrLhncglo7Dq8HHg4Uv2KFX7J+0ww42UBT?= =?us-ascii?Q?/90X/nWBO92AAecYYIgmNwJjKgca9mVrEdNKXcMASf8hClYmfpOPyuZR2Dbm?= =?us-ascii?Q?rAX43lo6KDwJSRpUShG0N8yNvnBUV9S0qYusOYqnn6IEMDMchq96nv6pvdZU?= =?us-ascii?Q?GIXc5j4xxe90rVwpV8kNcmkU0pPKPF6sEoj5V5nRHcpX7vQIC8Lx3vFdZsJN?= =?us-ascii?Q?U7RhGFwR3sfy1j7sSgaFOvRQXDRiP/vavCmrcRwOvUgAej5ht4MdaJsk52FT?= =?us-ascii?Q?niWVPtQnHTm1glMHCMIDNnZJQtn8vBwcXaN1JeIYuKtV1jVtr9JY7Z2nNxig?= =?us-ascii?Q?LtL0deckvcun9yF1mE5ZKdTBIaaPskI/ANiwcgmgO+INzzXjZx7wva7qRKaw?= =?us-ascii?Q?tF7tVSCGJtUZDwlumMuUYG5AmWjzhGeUynqWIxpoR7wRqBBqxX4VrIyat7zY?= =?us-ascii?Q?1pkqbi+k9Cf1PophyZC8XPzVrgFBDTTlHdOxfCtR6tkUDnCCPkyCUqS3nVEP?= =?us-ascii?Q?otTTefKyWtmAsLJW8+uq9GweGF+oi2ay6F9jAO2wvRbXaC05GuLtrCFOB0df?= =?us-ascii?Q?nVvezLDEfU40yJokIWDxo/9Bp9MwCGwZqIU+SNDVs6Jaap8+vGnBaHpO5tfD?= =?us-ascii?Q?QzFNE6C3L+xOW1Cz0sYY2UBs0KPFWVUiACm4xDqnxhhnKf7/b0w9vsAaKsuy?= =?us-ascii?Q?ePHaQraWUlclMgxvgdQ1edc3ADBSNrQjK++DqMibFkEICvD0N8eCusALsPof?= =?us-ascii?Q?vaJROAHBZa4X/5DKs+9nMCZAignRf90+wk972JJsUS9FOuyvRGPywWWfVEos?= =?us-ascii?Q?3Q=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1335; 6:V6kJJhX3aFRs+7ITPcrq8Tgye9aLd6vQoAdkOy4R3XWqoynTYxnvwuYz9GbUjbdKQsOiAJpnWi8CosbHW/5zdJt5ns8K+TPKCSCKMCFJPQO/WdHxNM2yLlyxeiOhccKmWzxjhti+bovBDznTi0H0TM+MwYbOmYew0LFCTjhI4y530dfEo/2ywqnys5cHUBS9Tt4YIt6rRFcMJimxf3fkwWrnbuNSoEF3YSTTUM7sYPYUd16ojaT+HxnEFZhSBm3aCr4vRe7E1/4Uos1BY6xazeJKvZnjlG9HB/jltlk3gqaNMC3zIxph0M6pSqzbEwJMHRC6TQ75TSPD7k0kDDBpxJkV/KeSrJUR62S58WAdEoc=; 5:3FW0G0ylnzvqhnD7mx3tRJVx/vCWM2AHKFtOhIHm9OOCz3S5a0hLXoaC7GcGY05BQeOI7U3Do+QtLUfUxtobi7C4JpUpQSYTkhasBzSRAApwTbWDeyIOONhs///a05MP7O6FKKZadsZGzKnviYIYWQJF4ulRir0VAOgGZQkcb6A=; 24:M3s5ycNBQtMIyQbv9Kr057mt3pMBCgFNbvg/PnR14qvVsicMUli3BCg92bEGGGqtF/8cxTZjTG+gqo5K31tOSeEfpG6nxOHrHiIL5ploqJc=; 7:jaz4s6BSclE0BW+MwNXYlUAkfTJ8BEjnYYDMmyu+Z5NXSlB/BvdMLKKA8tPtLiB6X1NAo1eFVeQ7waRUe+eC6gpITsgZyssi4GftxDzNJpScaHdNFILdj3x+bO98HzjPCA//IhEYc4L7YztZsnmYkPi1jij8e1zBQU465LNvtHudVzFn1pAhPuEZGycJh+LDcDMvwVSKZqudXL1Cqmmhpt92a7yK4tPtdouTPDW8mIWRkTxWfNCKFxnsDvWOK5je SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2017 05:35:57.7028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64150acb-05ac-4d71-fa76-08d53d3466cd X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR02MB1335 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP VDMA engine default frame buffer configuration is cirular mode. in this mode dmaengine continuously circles through h/w configured fstore frame buffers. When vdma h/w is configured for more than one frame. for example h/w is configured for n number of frames, user submits less than n number of frames and triggered the dmaengine using issue_pending API. since the h/w (or) driver default configuraiton is circular mode h/w tries to write/read from an invalid frame buffer resulting errors from the vdma dmaengine. This patch fixes this issue by enabling the park mode as default mode configuration for frame buffers in s/w, so that driver can handle all cases for "k" frames where n%k==0 (n is a multiple of k) by simply replicating the frame pointers. Signed-off-by: Kedareswara rao Appana --- Changes for v7: ---> Used park mode as default configuration as suggested by Mike Looijmans. ---> Updated commit message as suggested by Vinod(No need to start each line with Title cases). Changes for v6: ---> Added Rob Acked-by ---> Updated commit message as suggested by Vinod. Changes for v5: ---> Updated xlnx,fstore-config property to xlnx,fstore-enable and updated description as suggested by Rob. Changes for v4: ---> Add Check for framestore configuration on Transmit case as well as suggested by Jose Abreu. ---> Modified the dev_dbg checks to dev_warn checks as suggested by Jose Abreu. Changes for v3: ---> Added Checks for frame store configuration. If frame store Configuration is not present at the h/w level and user Submits less frames added debug prints in the driver as relevant. Changes for v2: ---> Fixed race conditions in the driver as suggested by Jose Abreu ---> Fixed unnecessray if else checks in the vdma_start_transfer as suggested by Laurent Pinchart. drivers/dma/xilinx/xilinx_dma.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index c246563..9063ca0 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -99,7 +99,9 @@ #define XILINX_DMA_REG_FRMPTR_STS 0x0024 #define XILINX_DMA_REG_PARK_PTR 0x0028 #define XILINX_DMA_PARK_PTR_WR_REF_SHIFT 8 +#define XILINX_DMA_PARK_PTR_WR_REF_MASK GENMASK(12, 8) #define XILINX_DMA_PARK_PTR_RD_REF_SHIFT 0 +#define XILINX_DMA_PARK_PTR_RD_REF_MASK GENMASK(4, 0) #define XILINX_DMA_REG_VDMA_VERSION 0x002c /* Register Direct Mode Registers */ @@ -998,7 +1000,7 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) { struct xilinx_vdma_config *config = &chan->config; struct xilinx_dma_tx_descriptor *desc, *tail_desc; - u32 reg; + u32 reg, j; struct xilinx_vdma_tx_segment *tail_segment; /* This function was invoked with lock held */ @@ -1035,10 +1037,6 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) else reg &= ~XILINX_DMA_DMACR_FRAMECNT_EN; - /* Configure channel to allow number frame buffers */ - dma_ctrl_write(chan, XILINX_DMA_REG_FRMSTORE, - chan->desc_pendingcount); - /* * With SG, start with circular mode, so that BDs can be fetched. * In direct register mode, if not parking, enable circular mode @@ -1051,17 +1049,16 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, reg); - if (config->park && (config->park_frm >= 0) && - (config->park_frm < chan->num_frms)) { - if (chan->direction == DMA_MEM_TO_DEV) - dma_write(chan, XILINX_DMA_REG_PARK_PTR, - config->park_frm << - XILINX_DMA_PARK_PTR_RD_REF_SHIFT); - else - dma_write(chan, XILINX_DMA_REG_PARK_PTR, - config->park_frm << - XILINX_DMA_PARK_PTR_WR_REF_SHIFT); + j = chan->desc_submitcount; + reg = dma_read(chan, XILINX_DMA_REG_PARK_PTR); + if (chan->direction == DMA_MEM_TO_DEV) { + reg &= ~XILINX_DMA_PARK_PTR_RD_REF_MASK; + reg |= j << XILINX_DMA_PARK_PTR_RD_REF_SHIFT; + } else { + reg &= ~XILINX_DMA_PARK_PTR_WR_REF_MASK; + reg |= j << XILINX_DMA_PARK_PTR_WR_REF_SHIFT; } + dma_write(chan, XILINX_DMA_REG_PARK_PTR, reg); /* Start the hardware */ xilinx_dma_start(chan); @@ -1073,6 +1070,8 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) if (chan->has_sg) { dma_ctrl_write(chan, XILINX_DMA_REG_TAILDESC, tail_segment->phys); + list_splice_tail_init(&chan->pending_list, &chan->active_list); + chan->desc_pendingcount = 0; } else { struct xilinx_vdma_tx_segment *segment, *last = NULL; int i = 0; @@ -1102,18 +1101,13 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) vdma_desc_write(chan, XILINX_DMA_REG_FRMDLY_STRIDE, last->hw.stride); vdma_desc_write(chan, XILINX_DMA_REG_VSIZE, last->hw.vsize); - } - if (!chan->has_sg) { - list_del(&desc->node); - list_add_tail(&desc->node, &chan->active_list); chan->desc_submitcount++; chan->desc_pendingcount--; + list_del(&desc->node); + list_add_tail(&desc->node, &chan->active_list); if (chan->desc_submitcount == chan->num_frms) chan->desc_submitcount = 0; - } else { - list_splice_tail_init(&chan->pending_list, &chan->active_list); - chan->desc_pendingcount = 0; } chan->idle = false; @@ -1364,6 +1358,7 @@ static int xilinx_dma_reset(struct xilinx_dma_chan *chan) chan->err = false; chan->idle = true; + chan->desc_submitcount = 0; return err; } @@ -2363,6 +2358,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, chan->ctrl_offset = XILINX_DMA_MM2S_CTRL_OFFSET; if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { chan->desc_offset = XILINX_VDMA_MM2S_DESC_OFFSET; + chan->config.park = 1; if (xdev->flush_on_fsync == XILINX_DMA_FLUSH_BOTH || xdev->flush_on_fsync == XILINX_DMA_FLUSH_MM2S) @@ -2379,6 +2375,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, chan->ctrl_offset = XILINX_DMA_S2MM_CTRL_OFFSET; if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { chan->desc_offset = XILINX_VDMA_S2MM_DESC_OFFSET; + chan->config.park = 1; if (xdev->flush_on_fsync == XILINX_DMA_FLUSH_BOTH || xdev->flush_on_fsync == XILINX_DMA_FLUSH_S2MM)