From patchwork Thu Apr 14 23:37:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7A6DC433F5 for ; Thu, 14 Apr 2022 23:37:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343565AbiDNXkD (ORCPT ); Thu, 14 Apr 2022 19:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234563AbiDNXkC (ORCPT ); Thu, 14 Apr 2022 19:40:02 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60085.outbound.protection.outlook.com [40.107.6.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3462FBB912; Thu, 14 Apr 2022 16:37:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lxxN4d6rvutUJEntIUgEzUezqx603zgloXU3jeVJd1tGgs+kw0OfwwltiHX47YrHlVu/bQ4y1ka6SngTB9XsMlVKzqMGtvtm93S9JacdJ3N7oUybu9F6Dfgy/zhfpjLlGcmLCM0L3gHYSQ7Hmd/P3skKQVKfWEASjgrEFNtk5UxdqcilbJ+Yq1p3xoeIfl8Ww7ZY/VI8RAxNjsGJEvbLjR+mtxDnaLKQAHe0N1Vv3BR4Xap9Izkg7ttNFvClQuEoyXw0h+D7lKHuA+N11AMX+79XalPBFEk82xcXM8U8SOPmQZvxN5UKCK7l2ksSEtbCUXLjzX44lQ1TdWP4d2dP1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IY639MmIbGsFEoxOX54Szwhv9JhLysX57Dj8g8fV2tM=; b=JSq3VqVvvJylkmm1MuLr+60T3uTFct0YlQoiTO25+IMdyBNTmDFgAbFMkC66CARDmcLc6syKuXa6Znwo5ApRi5EMesLIEV8v0G+NZ1rkMwJfEGHeecaRTUVbyHzvVw/IrMDTNfsH2qsOeOmt9ObTtk9dGvY0VmZv7KuXCEGaubY/2mEw5pOhBkJMP12+zL4G6rc6dGtsppjnDqKZFmfi04Hda/C62fS1WX53/ctAi0LYeovkkNiFvxqQ+tpwfTOMneAbv92cBz71+qWKEEUK+rEPRVCmXFzMOIREZw6eF7UGCJ9hxzrPpi8YQ6e9ZYgR416bskjHDN9tLatzSZeksQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IY639MmIbGsFEoxOX54Szwhv9JhLysX57Dj8g8fV2tM=; b=MZz2rznmhmsAHkjpscGnvI0l+lcNuCXiBKHKHqXcLHCpxzZlwwyAiZBHmQ1119NTvv9hxcD+8iKvri0kjIur90ZAYYfWpYiF37qSEzmqN5zmLDMNIr8H/m9fPB2NhjBUZS/fXudTAoEW2yXkEvUzbhZzOlKd8me/jZrjGUrgDsI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:37:34 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:37:34 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 1/9] dmaengine: dw-edma: Remove unused field irq in struct dw_edma_chip Date: Thu, 14 Apr 2022 18:37:01 -0500 Message-Id: <20220414233709.412275-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43ec1908-cf7a-4b08-2bfe-08da1e6fc00d X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a6avdAg1H5YRkmysLBaKb8dgfBAR0xDRItr/lDx2DO0/Ej9XUZhM7Y2lFPT1wTwFu8fuyZWu9kI+MbNjfecHsbSYex0g9ir5VIn7m0UzoBl14aJKXIAiTiLXC7SlvBVOw2LaHzVS0WMlal1SDFG8cEeBA/z7XnuNc4pU2TqMotRWDaw6M4mMQ5VpdU0+JkeDl2b9+UY7i2RIYixlJwJ1lYajTUL1Rrg+Ae5U0fKXW8gS7xGqLoOQl9yldxDnJYC0QHamo80EBgzK5FBo59l7rDdL4DtNNkDpWUyA5HtnA+pIob1bTaxXlEfFkjI9US0CLT2JDTsVGBlkiC7PiHNQ3htSWCR/rdoKF7JOF/NFioatUOoXMVS1XbYphOZqJl3NIAXAU9ehvTjXLINFOeTBTf+CWPemNifUMTO9CtvuWFkSoNR003CuxfN4sAkqPSyN53rpqQ84PTfxLooksoYarW7ZAYKuNIIGDHahukbPLgDWut0tny3+P8PMslJtZrEFoMaiG/sFg293yMHiKzPi11Kvh6xubhy8W3E9DUxMMBjj2150ywjdwBSt2vWUvN+7CHFu0TYeKB2+6y1EBQ98WzDBJDKkOvLw3nG/WIrh3Qk9Bw2Re24dQvnx4zfzM2A18BgbzWoe9o6C/j12x9BaTI5qUhYUFyp+4EXbp9l3Wqp/kKkVt13/NcZOPGhiWM65nqptJiELHS++/j38casmsA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(6666004)(4326008)(8676002)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xm3U2f9nNOvS+uvhofRiqZI4CBFuNO5e8s5fIQYNcy/BIZnMAh3eRxR9HCvH4kBbpsa5l0DrfnSE2RU6JOrdoPncG6//u7BXRkQ+TsSG2t3YMtxcaVeXfH9VkNrjlLacPV1mnPTTQH5nrgg5yJYEmoCr/as0EEA+DD2clEw1SaokhMHG1ryL4/Cry1LQQPn3UoocBQP07kRCKSYfXb8zGYq5/RZ4+j+FcsvtqgDukyUewy/2KMAeuysNSm0v1ROroqWnDgyFHQnMhc5E0bsQrZYix0ceYz7L9unGCURam3SXvaYuEUclwWlVn7ZIxZr2aWll67rM/lWSLI4YlSclFfJ/g698vQahVw9pE9fiAYkDDyhrB3RpNJ/VY3RXfXBSDVXS/kcmuYed/ToHwdC+yVkpay52YVGYCYNSLqX8F0fMjn6IgJhOqsHq3t1fCOFBNnhgZ2/5T6AsXgZlVqWkjjQHMPLQMyJOu9lkgAsPanS+dbkov23yGiyZLcgwE88+FxFnow95I9ixVFcKEQLPt9AUTXKaW0lc29tcOGgyyzC66U7X9w5YDMj7ayQtEOXPagPJTejMuqjJJRVaki4KtqHtn/eL5COyrWHfrvTn7nDMSPfFBEz8qK4MVv4U/SGo+rZSAvTV0fgCaxAz+iQxiHXSu+yXblqWS2x2bqTsiY3DR38BogDhzbyL6AatMe45H6C5zgwSEG7sYjsDetNlfLO193T4VapqVcrvpHNnc0A8GAxVOhdv99kElxhGKwM23Pok7rNpQZSkOpfxHsanGT4o3qJ0gjGKEK3kmHWs/g6Xq+bbdd/Lev/5xrb4Teb45AogjvE4SwEa6Ua2H2FrGaEjZjJAP4Iv0Tul7136l+5Pq0hCi40Yn5UEFOBVD34ZR+Rx/CiavuYIyDq1sh8+C2inNsFOhY6c57JMt7G7NY9URGFaxWDCWsm2OUr6fGKNMWbzn/53CwfkMIUvHc7W7RbNTbJ4AtTo4l171nGnokQ/9y5rCl3iVYY/BX2tF990+ZziMYtSTxLVoN7zb6nqBZ1j5OvJ8xL8I0I0X4rbx84R17kxdsYF5Gqn/+/4OqTd8KN6LkPWUuLQ9lEYo5/YrzOokIohSgipIItefaySThGKsErT4GewykQ5XGKqvdoAtme9Vlchg62lv6Ei5DW2JDh7mHDmWbio6zgSuNFhcckUN2zWXfCzNv1SxVYlhVnjrcHYlN17YjN7g/nl5NezOuucLy4ayh6id5wT4LxZJTWUs5jkm+InaPKciI3HxS3L+yRSEAP3iHzCpy9jQpTbqJ8vyxxoyb75Ve0xxXbfHvMmTsA0oaTgrtUJJjSQUFXTtojkUuoUA3NYICZMNYL9kpEDS2Rkzk4Rqf2a7suzgg8kqIWNfpVWars0ZYlKDxHysQVDzRmhLYFKzzwxvVFS2g5qhpD8reV7XVAtKW3x27c/+obC5gASOHHLh//pvvIrT82eOzob8l1YUm7zzuMzcPdc5og+rWgfHIGZ9LnallNDFaFzqZPiy00soQ5SYKQu0YQxSWkbserv616TnwrAOAsVT4tXR0Bx47UcdPPa5tiH7SAKvf3pDaSx9T5M/tAzJZ50veFslBPdg0pXOlP8pw03pc2v1kzYz7X9Q6muCRKTxIuKGV868SfR6G1wmxkQ0roQX+754RO0Mm/INrKUgtKg/t/INrQsvHTPgLHQVw+gv2Xyth68c/vOabGFG0LY/fYB0kBcY5qVA7/MGkPfpw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43ec1908-cf7a-4b08-2bfe-08da1e6fc00d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:37:34.1762 (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-CrossTenant-UserPrincipalName: JkJWzQIbnmHYlUHUZMaAVQl3JpuIHacw7Cpwqo5VwcYH0ZTYHhRpWvPNJR8t2iXao/Zr+62llnrmtJCEEDUF1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org irq of struct dw_edma_chip was never used. It can be removed safely. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v7 - move to 1st patch Change from v5 to v6 - s/remove/Remove/ at subject Change from v4 to v5 - none new patch at v4 drivers/dma/dw-edma/dw-edma-pcie.c | 1 - include/linux/dma/edma.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 44f6e09bdb531..b8f52ca10fa91 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -231,7 +231,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->dw = dw; chip->dev = dev; chip->id = pdev->devfn; - chip->irq = pdev->irq; dw->mf = vsec_data.mf; dw->nr_irqs = nr_irqs; diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index cab6e18773dad..d4333e721588d 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -18,13 +18,11 @@ struct dw_edma; * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID - * @irq: irq line * @dw: struct dw_edma that is filed by dw_edma_probe() */ struct dw_edma_chip { struct device *dev; int id; - int irq; struct dw_edma *dw; }; From patchwork Thu Apr 14 23:37:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39B2FC433FE for ; Thu, 14 Apr 2022 23:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344114AbiDNXkK (ORCPT ); Thu, 14 Apr 2022 19:40:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234563AbiDNXkI (ORCPT ); Thu, 14 Apr 2022 19:40:08 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60055.outbound.protection.outlook.com [40.107.6.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED957BB912; Thu, 14 Apr 2022 16:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NdPSQ971uvH6wbo4Iill4tA0qR/bMLaY/u37wvCA5gpI0Pd+ykbipJs7jxQH5a/tqCDvHKwcL0xSl803AGdrf36q0l1WXoLo+SOH3KVXoHcx4i96XFSqngmvghGsbO0ACHX6GxCRhhNJ2uhlAEin7Wj8UTzLFgbMgIolTZA9QCMe+lBrOdTEAUTGjdtegTdSqfbwyqRBrR7Azv/e9lDU/DvkFM/APWI20t3rC4OCuA+x4hAGyqh+fkOIYP2DXP5O+S4vxfoVIX1p42+hsxhz1TZttuf+blVeXmmV7+Ah5A5SizMqLnWtGYW9J8yKa+Cd89F/riOOkZ4LaRZHwX1KiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Bu6OZsZXfOo1YcV0H3n8ccoOqm+TlEmWnrzfTTbhGEw=; b=AVTtS52VbXWezEFFPFocdXEg77ITzZWZnYwmGCk6Cp9AhvfWgpbsXJyxXIeeJoIyTIaj9a5bibT8TqvzkUJTZBdOpYalkc7MFRvYG09VU9ZD4FBb7mm4F3H/9j4niVKP8kVgWqYqi+9Mj5mpbPPGzp18XGu6I56afh4v4hlWjGzh9uk6YnjY+/l6sPhYPSTuU5yhx0BZC2+MNhrSheR3ElUtd1wDYXbW+TaejLbjr4BbeW09GKwvqi6v9qaKtuHWL8K0jfWNb3XLyE/mDjWBxiey/shdNLs4hZKxfP9z2Lkepi5bMCpidtFqZYIXOqwZzU3dFGgjdEw9TjrP4OePhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bu6OZsZXfOo1YcV0H3n8ccoOqm+TlEmWnrzfTTbhGEw=; b=A8jXDvdc8O8UHlz1MXynnvOE09kpjWew+2Xz5n5/r5OAjmj097HPtUyK8KTIjZ1Kv+Id5K2DdDtYR4cr81UazltxbzDsK5q5pB3dIbhua8Dqf7xI8Ta/zO4MeH3gyQpUqW2wkEeyKJtYxdFS29GiMTJOIwI+7XDa2nARYVmD3Vo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:37:38 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:37:38 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 2/9] dmaengine: dw-edma: Detach the private data and chip info structures Date: Thu, 14 Apr 2022 18:37:02 -0500 Message-Id: <20220414233709.412275-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae76c3f6-eef3-479f-ec71-08da1e6fc274 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ckm7w9gAZ63+OX29ybv0TFpGuWM3+56IhQU/MtVqe7m2aO34XwA0aTZih64ygYgo++klq+CXv0xAdm7JoFpqoZeboaj1+ywKwsZwp3JeCStfJeLO724I1AdNuepQ3Etc/ZNp+JzoDtFBV0uLYBhLwCMrIsi4UHf/S14h46c4s8g6fdRTLosYwrNr4UQQVXo43JHk6G3APAUG7nTgHfL2fcc/aquugi0LkFGfeWYB6v4c+gvLBbclV9PaY2UEknWxlBtjKITYdC/HGFWhtFyyaoYsj+uS6UUbAmMzk57Iajd+Zm1ojWz2j2XNJl8iCEXePmF0M+hmoeWGPzyNUnp+nSeobJ0qprf3ABfzRMBuTHVXqqR9CGN45RfzMccJa4ranlwXV+EqcmogK0NtWtnLVywImqfx+CHG2s+B+AIVkPWmfumWqAOupT78jbNitMrAhbDl80KiGGYyxFz/RMyvsMnPd4vVngNUEevXXypgC836zPdSPshN27j4BkKQt2W97c9kjzKVPv3CCjo20SdB+xMx0M/AcR09uHvp6tPsaP443zU+I3q8bX/mgNj4gVlOFBixH3oHpy70NljDZsP0DUWeRGw1BQhI3YaCTbPxBGHqgXvLhQH/ziOLrO5yVk6wi5evNOADWedV6IbNiyKTJdO9Emgn1Es0aot2SwdqWpXKDVyZbRM/MUiaOh8r2P+q+U25pGniWu90eN6JNYeVVA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(6666004)(4326008)(8676002)(30864003)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XtDu2GwGQEoBWkMzhzSCu2cEieSG8FGM8Owe2Jwkm7jqfFJepaIy3f+DjIkwj+I6oAgvRorYMHgpkm8UvmfAU6PMfiYoUtt8MEUGgQO+P/6wmuyjtRXlPTWCbJyAnck6fYPZLGlaV1yw3Wi6i4wzWtBSlCIup1mlw/7yfjtwf6tH1LAzafS9WuhWRjO/4lz+GQ9jvHeAU79yK6bzvQpwlPGnjsP3SMum0b0wfI9n5A7Orsh9oRuk/7E2fh2jdasn5LFsuDT2AcSPT9K1rW9LuZN80pUFva1qRtB1uA7YWQUCBDc78ie44HgF+WymUAuhK5oBAl90mgwaFn7QMg4IzdUxL1z917BnQ/9AEN6rij1AIHmKLapuiuQsajZVOwgOpAPasX2CtmBj6OxXwLmwurVvfHu8NHYMF8WBqK4heGCB3ZxsshhhKI5ar6xZbrFsb9kcRPzLYRbTWwzXzLA/bsPQM6g0Q5bMVts+Tfjs6v8pY+ieZhpxR7d2aqA4yNCvwbhNLb3amUtJYPKQzphlJY6IokwLKa/VqvBNfNoYQHXPcan0E/6I1bDwqods2vQqHiz6FHqy/uXyQ4aEOVE13FRUeoQo842eQt4UlDJYqWeuSVt8j2Phqa7+n+MM0Fy0BzEIf8x0uEfX6wbotwefUQh1ezMms5rTXoCfA2cEBqueITXTjh7vnK2u844ojbKAux6e2dY12jIqveYvl+njVnY9S1S3p99pBEOpYVtd3Na7J8VR1hpIitiIrnr1qv3/vfVu+n2wYwmFFgUP41su1KHnWnxrTnEgJFyH8B58WR160bK7f2CYm06ivXYTOLYnOuE0/pCVajDgPBUwD5LMmafNKOd1GxLB8T7v4i+Jph3ve3BEBEZWReZrsmh4H6ZWTY3fvq9Z2YSkmR1ZMq7FhZodRwEpvPWvtSxKabSG3/lAGi3CxJTgD7+rLUIps7oeCmvHWHjZjueIo96beutxBYx2wdMwpNb30omjLU42oYlz8lpur5uWyV9Z0tDwQDAPIVvLIJ1EXvwHkJE8uz/dfHJHJCMg1kxfVqwefMSmNKWfCtspQJJ03CJidXaOzr30OGx4tyxzCIU2eeiiCVPKchQFsCnaOPxq6A8qO3Jaz0yjMrQeZq0AuA8V7/VLzZ07IoUmVAHHjgy6jIoP+QH6q4B8E93v8ERPw7ZVCTLc8idhahCWrl01Gof6QrV0wOmrr6hKqrs7O94gHqpSC07jRqvW/5gRJ1UuGwZv2RitNv6xLsS/AgdwrBjcvlB37CpgrsqGVyN5CyG7/BriMVZGfRfO478LPMZ4deFkPX6L4dmLSzH+HhmW54USlo3fxVPAuOEE/ixovtbJ7ao+mH5maQy/JlkjLzP38UpQ1WXjpU8JKpl6mjA6eO+SfH8pBojdwyxGvkJd8xyn6LwN9xvjVm7ghpQ/QogAtsmCnYsYHF2RLyHSqM0hL+L4Z4VA3gbVPr4f+aTQn2zTGG9Kre1KmzGLxrimQKqPAF8BrZY/ZAeKbCsJNeZkSPyYsJYFkExKEkwiPceO83/xaHIomG5x6W2XmGOsKkVZWN88QvxReIf0UTRGoTIi2DwFoacODozfsEhMKjqvr9gbEX4F7VMdeMptn5ycKRddr5LN2mA5wBOjVi0WLuYkpvLQj6Vh1pA99328/fIeHPa+bykT/zUl7tD/l2yTjml/tg0TSrfVkI7/AH0Ae7n4fetu/YbEob9qYkNtBFDKT5aYcQbWytOBJw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae76c3f6-eef3-479f-ec71-08da1e6fc274 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:37:38.2284 (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-CrossTenant-UserPrincipalName: HslXN3aFfbEabMDqzz3aDwgNGHm/n8ud44Rrbz+0X1fR9GJ3aLSkCfRssJMq3/9A78XxUO/YXX3K1iqZnqJKiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org "struct dw_edma_chip" contains an internal structure "struct dw_edma" that is used by the eDMA core internally. This structure should not be touched by the eDMA controller drivers themselves. But currently, the eDMA controller drivers like "dw-edma-pci" allocates and populates this internal structure then passes it on to eDMA core. The eDMA core further populates the structure and uses it. This is wrong! Hence, move all the "struct dw_edma" specifics from controller drivers to the eDMA core. Signed-off-by: Frank Li --- Change from v6 to v7 - Move nr_irqs and chip->ops check into dw_edma_irq_request() - Move dw->irq devm_kcalloc() into dw_edma_irq_request() - Change dw->nr_irqs after request success - Fix wrong use chip->nr_irqs when remove Change from v5 to v6 - Don't touch chip->nr_irqs - Don't set chip->dw utill everything is okay - dw_edma_channel_setup() and dw_edma_v0_core_debugfs_on/off() methods take dw_edma structure pointer as a parameter Change from v4 to v5 - Move chip->nr_irqs before allocate dw_edma Change from v3 to v4 - Accept most suggestions of Serge Semin Change from v2 to v3 - none Change from v1 to v2 - rework commit message - remove duplicate field in struct dw_edma drivers/dma/dw-edma/dw-edma-core.c | 88 +++++++++++++----------- drivers/dma/dw-edma/dw-edma-core.h | 31 +-------- drivers/dma/dw-edma/dw-edma-pcie.c | 82 +++++++++------------- drivers/dma/dw-edma/dw-edma-v0-core.c | 32 ++++----- drivers/dma/dw-edma/dw-edma-v0-core.h | 4 +- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 10 +-- include/linux/dma/edma.h | 44 ++++++++++++ 7 files changed, 152 insertions(+), 139 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 53289927dd0d6..8cdc66e17c069 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -64,8 +64,8 @@ static struct dw_edma_burst *dw_edma_alloc_burst(struct dw_edma_chunk *chunk) static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) { + struct dw_edma_chip *chip = desc->chan->dw->chip; struct dw_edma_chan *chan = desc->chan; - struct dw_edma *dw = chan->chip->dw; struct dw_edma_chunk *chunk; chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT); @@ -82,11 +82,11 @@ static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) */ chunk->cb = !(desc->chunks_alloc % 2); if (chan->dir == EDMA_DIR_WRITE) { - chunk->ll_region.paddr = dw->ll_region_wr[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_wr[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_wr[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_wr[chan->id].vaddr; } else { - chunk->ll_region.paddr = dw->ll_region_rd[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_rd[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_rd[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_rd[chan->id].vaddr; } if (desc->chunk) { @@ -664,7 +664,7 @@ static int dw_edma_alloc_chan_resources(struct dma_chan *dchan) if (chan->status != EDMA_ST_IDLE) return -EBUSY; - pm_runtime_get(chan->chip->dev); + pm_runtime_get(chan->dw->chip->dev); return 0; } @@ -686,15 +686,15 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan) cpu_relax(); } - pm_runtime_put(chan->chip->dev); + pm_runtime_put(chan->dw->chip->dev); } -static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, +static int dw_edma_channel_setup(struct dw_edma *dw, bool write, u32 wr_alloc, u32 rd_alloc) { + struct dw_edma_chip *chip = dw->chip; struct dw_edma_region *dt_region; struct device *dev = chip->dev; - struct dw_edma *dw = chip->dw; struct dw_edma_chan *chan; struct dw_edma_irq *irq; struct dma_device *dma; @@ -727,7 +727,7 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->vc.chan.private = dt_region; - chan->chip = chip; + chan->dw = dw; chan->id = j; chan->dir = write ? EDMA_DIR_WRITE : EDMA_DIR_READ; chan->configured = false; @@ -735,9 +735,9 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->status = EDMA_ST_IDLE; if (write) - chan->ll_max = (dw->ll_region_wr[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_wr[j].sz / EDMA_LL_SZ); else - chan->ll_max = (dw->ll_region_rd[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_rd[j].sz / EDMA_LL_SZ); chan->ll_max -= 1; dev_vdbg(dev, "L. List:\tChannel %s[%u] max_cnt=%u\n", @@ -767,13 +767,13 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, vchan_init(&chan->vc, dma); if (write) { - dt_region->paddr = dw->dt_region_wr[j].paddr; - dt_region->vaddr = dw->dt_region_wr[j].vaddr; - dt_region->sz = dw->dt_region_wr[j].sz; + dt_region->paddr = chip->dt_region_wr[j].paddr; + dt_region->vaddr = chip->dt_region_wr[j].vaddr; + dt_region->sz = chip->dt_region_wr[j].sz; } else { - dt_region->paddr = dw->dt_region_rd[j].paddr; - dt_region->vaddr = dw->dt_region_rd[j].vaddr; - dt_region->sz = dw->dt_region_rd[j].sz; + dt_region->paddr = chip->dt_region_rd[j].paddr; + dt_region->vaddr = chip->dt_region_rd[j].vaddr; + dt_region->sz = chip->dt_region_rd[j].sz; } dw_edma_v0_core_device_config(chan); @@ -827,11 +827,11 @@ static inline void dw_edma_add_irq_mask(u32 *mask, u32 alloc, u16 cnt) (*mask)++; } -static int dw_edma_irq_request(struct dw_edma_chip *chip, +static int dw_edma_irq_request(struct dw_edma *dw, u32 *wr_alloc, u32 *rd_alloc) { - struct device *dev = chip->dev; - struct dw_edma *dw = chip->dw; + struct dw_edma_chip *chip = dw->chip; + struct device *dev = dw->chip->dev; u32 wr_mask = 1; u32 rd_mask = 1; int i, err = 0; @@ -840,12 +840,16 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, ch_cnt = dw->wr_ch_cnt + dw->rd_ch_cnt; - if (dw->nr_irqs < 1) + if (chip->nr_irqs < 1 || !chip->ops || !chip->ops->irq_vector) return -EINVAL; - if (dw->nr_irqs == 1) { + dw->irq = devm_kcalloc(dev, chip->nr_irqs, sizeof(*dw->irq), GFP_KERNEL); + if (!dw->irq) + return -ENOMEM; + + if (chip->nr_irqs == 1) { /* Common IRQ shared among all channels */ - irq = dw->ops->irq_vector(dev, 0); + irq = chip->ops->irq_vector(dev, 0); err = request_irq(irq, dw_edma_interrupt_common, IRQF_SHARED, dw->name, &dw->irq[0]); if (err) { @@ -855,9 +859,11 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, if (irq_get_msi_desc(irq)) get_cached_msi_msg(irq, &dw->irq[0].msi); + + dw->nr_irqs = 1; } else { /* Distribute IRQs equally among all channels */ - int tmp = dw->nr_irqs; + int tmp = chip->nr_irqs; while (tmp && (*wr_alloc + *rd_alloc) < ch_cnt) { dw_edma_dec_irq_alloc(&tmp, wr_alloc, dw->wr_ch_cnt); @@ -868,7 +874,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, dw_edma_add_irq_mask(&rd_mask, *rd_alloc, dw->rd_ch_cnt); for (i = 0; i < (*wr_alloc + *rd_alloc); i++) { - irq = dw->ops->irq_vector(dev, i); + irq = chip->ops->irq_vector(dev, i); err = request_irq(irq, i < *wr_alloc ? dw_edma_interrupt_write : @@ -905,17 +911,19 @@ int dw_edma_probe(struct dw_edma_chip *chip) if (!dev) return -EINVAL; - dw = chip->dw; - if (!dw || !dw->irq || !dw->ops || !dw->ops->irq_vector) - return -EINVAL; + dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); + if (!dw) + return -ENOMEM; + + dw->chip = chip; raw_spin_lock_init(&dw->lock); - dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, + dw->wr_ch_cnt = min_t(u16, chip->wr_ch_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_WRITE)); dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); - dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, + dw->rd_ch_cnt = min_t(u16, chip->rd_ch_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_READ)); dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); @@ -937,17 +945,17 @@ int dw_edma_probe(struct dw_edma_chip *chip) dw_edma_v0_core_off(dw); /* Request IRQs */ - err = dw_edma_irq_request(chip, &wr_alloc, &rd_alloc); + err = dw_edma_irq_request(dw, &wr_alloc, &rd_alloc); if (err) return err; /* Setup write channels */ - err = dw_edma_channel_setup(chip, true, wr_alloc, rd_alloc); + err = dw_edma_channel_setup(dw, true, wr_alloc, rd_alloc); if (err) goto err_irq_free; /* Setup read channels */ - err = dw_edma_channel_setup(chip, false, wr_alloc, rd_alloc); + err = dw_edma_channel_setup(dw, false, wr_alloc, rd_alloc); if (err) goto err_irq_free; @@ -955,15 +963,15 @@ int dw_edma_probe(struct dw_edma_chip *chip) pm_runtime_enable(dev); /* Turn debugfs on */ - dw_edma_v0_core_debugfs_on(chip); + dw_edma_v0_core_debugfs_on(dw); + + chip->dw = dw; return 0; err_irq_free: for (i = (dw->nr_irqs - 1); i >= 0; i--) - free_irq(dw->ops->irq_vector(dev, i), &dw->irq[i]); - - dw->nr_irqs = 0; + free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); return err; } @@ -981,7 +989,7 @@ int dw_edma_remove(struct dw_edma_chip *chip) /* Free irqs */ for (i = (dw->nr_irqs - 1); i >= 0; i--) - free_irq(dw->ops->irq_vector(dev, i), &dw->irq[i]); + free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); /* Power management */ pm_runtime_disable(dev); @@ -1002,7 +1010,7 @@ int dw_edma_remove(struct dw_edma_chip *chip) } /* Turn debugfs off */ - dw_edma_v0_core_debugfs_off(chip); + dw_edma_v0_core_debugfs_off(dw); return 0; } diff --git a/drivers/dma/dw-edma/dw-edma-core.h b/drivers/dma/dw-edma/dw-edma-core.h index 60316d408c3e0..85df2d511907b 100644 --- a/drivers/dma/dw-edma/dw-edma-core.h +++ b/drivers/dma/dw-edma/dw-edma-core.h @@ -15,20 +15,12 @@ #include "../virt-dma.h" #define EDMA_LL_SZ 24 -#define EDMA_MAX_WR_CH 8 -#define EDMA_MAX_RD_CH 8 enum dw_edma_dir { EDMA_DIR_WRITE = 0, EDMA_DIR_READ }; -enum dw_edma_map_format { - EDMA_MF_EDMA_LEGACY = 0x0, - EDMA_MF_EDMA_UNROLL = 0x1, - EDMA_MF_HDMA_COMPAT = 0x5 -}; - enum dw_edma_request { EDMA_REQ_NONE = 0, EDMA_REQ_STOP, @@ -57,12 +49,6 @@ struct dw_edma_burst { u32 sz; }; -struct dw_edma_region { - phys_addr_t paddr; - void __iomem *vaddr; - size_t sz; -}; - struct dw_edma_chunk { struct list_head list; struct dw_edma_chan *chan; @@ -87,7 +73,7 @@ struct dw_edma_desc { struct dw_edma_chan { struct virt_dma_chan vc; - struct dw_edma_chip *chip; + struct dw_edma *dw; int id; enum dw_edma_dir dir; @@ -109,10 +95,6 @@ struct dw_edma_irq { struct dw_edma *dw; }; -struct dw_edma_core_ops { - int (*irq_vector)(struct device *dev, unsigned int nr); -}; - struct dw_edma { char name[20]; @@ -122,21 +104,14 @@ struct dw_edma { struct dma_device rd_edma; u16 rd_ch_cnt; - struct dw_edma_region rg_region; /* Registers */ - struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; - struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; - struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH]; - struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH]; - struct dw_edma_irq *irq; int nr_irqs; - enum dw_edma_map_format mf; - struct dw_edma_chan *chan; - const struct dw_edma_core_ops *ops; raw_spinlock_t lock; /* Only for legacy */ + + struct dw_edma_chip *chip; #ifdef CONFIG_DEBUG_FS struct dentry *debugfs; #endif /* CONFIG_DEBUG_FS */ diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index b8f52ca10fa91..2c1c5fa4e9f28 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -148,7 +148,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, struct dw_edma_pcie_data vsec_data; struct device *dev = &pdev->dev; struct dw_edma_chip *chip; - struct dw_edma *dw; int err, nr_irqs; int i, mask; @@ -214,10 +213,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, if (!chip) return -ENOMEM; - dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); - if (!dw) - return -ENOMEM; - /* IRQs allocation */ nr_irqs = pci_alloc_irq_vectors(pdev, 1, vsec_data.irqs, PCI_IRQ_MSI | PCI_IRQ_MSIX); @@ -228,28 +223,23 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } /* Data structure initialization */ - chip->dw = dw; chip->dev = dev; chip->id = pdev->devfn; - dw->mf = vsec_data.mf; - dw->nr_irqs = nr_irqs; - dw->ops = &dw_edma_pcie_core_ops; - dw->wr_ch_cnt = vsec_data.wr_ch_cnt; - dw->rd_ch_cnt = vsec_data.rd_ch_cnt; + chip->mf = vsec_data.mf; + chip->nr_irqs = nr_irqs; + chip->ops = &dw_edma_pcie_core_ops; - dw->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; - if (!dw->rg_region.vaddr) - return -ENOMEM; + chip->wr_ch_cnt = vsec_data.wr_ch_cnt; + chip->rd_ch_cnt = vsec_data.rd_ch_cnt; - dw->rg_region.vaddr += vsec_data.rg.off; - dw->rg_region.paddr = pdev->resource[vsec_data.rg.bar].start; - dw->rg_region.paddr += vsec_data.rg.off; - dw->rg_region.sz = vsec_data.rg.sz; + chip->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; + if (!chip->rg_region.vaddr) + return -ENOMEM; - for (i = 0; i < dw->wr_ch_cnt; i++) { - struct dw_edma_region *ll_region = &dw->ll_region_wr[i]; - struct dw_edma_region *dt_region = &dw->dt_region_wr[i]; + for (i = 0; i < chip->wr_ch_cnt; i++) { + struct dw_edma_region *ll_region = &chip->ll_region_wr[i]; + struct dw_edma_region *dt_region = &chip->dt_region_wr[i]; struct dw_edma_block *ll_block = &vsec_data.ll_wr[i]; struct dw_edma_block *dt_block = &vsec_data.dt_wr[i]; @@ -272,9 +262,9 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dt_region->sz = dt_block->sz; } - for (i = 0; i < dw->rd_ch_cnt; i++) { - struct dw_edma_region *ll_region = &dw->ll_region_rd[i]; - struct dw_edma_region *dt_region = &dw->dt_region_rd[i]; + for (i = 0; i < chip->rd_ch_cnt; i++) { + struct dw_edma_region *ll_region = &chip->ll_region_rd[i]; + struct dw_edma_region *dt_region = &chip->dt_region_rd[i]; struct dw_edma_block *ll_block = &vsec_data.ll_rd[i]; struct dw_edma_block *dt_block = &vsec_data.dt_rd[i]; @@ -298,45 +288,45 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } /* Debug info */ - if (dw->mf == EDMA_MF_EDMA_LEGACY) - pci_dbg(pdev, "Version:\teDMA Port Logic (0x%x)\n", dw->mf); - else if (dw->mf == EDMA_MF_EDMA_UNROLL) - pci_dbg(pdev, "Version:\teDMA Unroll (0x%x)\n", dw->mf); - else if (dw->mf == EDMA_MF_HDMA_COMPAT) - pci_dbg(pdev, "Version:\tHDMA Compatible (0x%x)\n", dw->mf); + if (chip->mf == EDMA_MF_EDMA_LEGACY) + pci_dbg(pdev, "Version:\teDMA Port Logic (0x%x)\n", chip->mf); + else if (chip->mf == EDMA_MF_EDMA_UNROLL) + pci_dbg(pdev, "Version:\teDMA Unroll (0x%x)\n", chip->mf); + else if (chip->mf == EDMA_MF_HDMA_COMPAT) + pci_dbg(pdev, "Version:\tHDMA Compatible (0x%x)\n", chip->mf); else - pci_dbg(pdev, "Version:\tUnknown (0x%x)\n", dw->mf); + pci_dbg(pdev, "Version:\tUnknown (0x%x)\n", chip->mf); - pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", + pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p)\n", vsec_data.rg.bar, vsec_data.rg.off, vsec_data.rg.sz, - dw->rg_region.vaddr, &dw->rg_region.paddr); + chip->rg_region.vaddr); - for (i = 0; i < dw->wr_ch_cnt; i++) { + for (i = 0; i < chip->wr_ch_cnt; i++) { pci_dbg(pdev, "L. List:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_wr[i].bar, - vsec_data.ll_wr[i].off, dw->ll_region_wr[i].sz, - dw->ll_region_wr[i].vaddr, &dw->ll_region_wr[i].paddr); + vsec_data.ll_wr[i].off, chip->ll_region_wr[i].sz, + chip->ll_region_wr[i].vaddr, &chip->ll_region_wr[i].paddr); pci_dbg(pdev, "Data:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.dt_wr[i].bar, - vsec_data.dt_wr[i].off, dw->dt_region_wr[i].sz, - dw->dt_region_wr[i].vaddr, &dw->dt_region_wr[i].paddr); + vsec_data.dt_wr[i].off, chip->dt_region_wr[i].sz, + chip->dt_region_wr[i].vaddr, &chip->dt_region_wr[i].paddr); } - for (i = 0; i < dw->rd_ch_cnt; i++) { + for (i = 0; i < chip->rd_ch_cnt; i++) { pci_dbg(pdev, "L. List:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_rd[i].bar, - vsec_data.ll_rd[i].off, dw->ll_region_rd[i].sz, - dw->ll_region_rd[i].vaddr, &dw->ll_region_rd[i].paddr); + vsec_data.ll_rd[i].off, chip->ll_region_rd[i].sz, + chip->ll_region_rd[i].vaddr, &chip->ll_region_rd[i].paddr); pci_dbg(pdev, "Data:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.dt_rd[i].bar, - vsec_data.dt_rd[i].off, dw->dt_region_rd[i].sz, - dw->dt_region_rd[i].vaddr, &dw->dt_region_rd[i].paddr); + vsec_data.dt_rd[i].off, chip->dt_region_rd[i].sz, + chip->dt_region_rd[i].vaddr, &chip->dt_region_rd[i].paddr); } - pci_dbg(pdev, "Nr. IRQs:\t%u\n", dw->nr_irqs); + pci_dbg(pdev, "Nr. IRQs:\t%u\n", chip->nr_irqs); /* Validating if PCI interrupts were enabled */ if (!pci_dev_msi_enabled(pdev)) { @@ -344,10 +334,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, return -EPERM; } - dw->irq = devm_kcalloc(dev, nr_irqs, sizeof(*dw->irq), GFP_KERNEL); - if (!dw->irq) - return -ENOMEM; - /* Starting eDMA driver */ err = dw_edma_probe(chip); if (err) { diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 329fc2e57b703..082049d53ca73 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -25,7 +25,7 @@ enum dw_edma_control { static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) { - return dw->rg_region.vaddr; + return dw->chip->rg_region.vaddr; } #define SET_32(dw, name, value) \ @@ -96,7 +96,7 @@ static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) static inline struct dw_edma_v0_ch_regs __iomem * __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) return &(__dw_regs(dw)->type.legacy.ch); if (dir == EDMA_DIR_WRITE) @@ -108,7 +108,7 @@ __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) static inline void writel_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u32 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -133,7 +133,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -169,7 +169,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, static inline void writeq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u64 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -194,7 +194,7 @@ static inline u64 readq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -256,7 +256,7 @@ u16 dw_edma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; tmp = FIELD_GET(EDMA_V0_CH_STATUS_MASK, @@ -272,7 +272,7 @@ enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_DONE_INT_MASK, BIT(chan->id))); @@ -280,7 +280,7 @@ void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_abort_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_ABORT_INT_MASK, BIT(chan->id))); @@ -357,7 +357,7 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) { struct dw_edma_chan *chan = chunk->chan; - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; dw_edma_v0_core_write_chunk(chunk); @@ -365,7 +365,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) if (first) { /* Enable engine */ SET_RW_32(dw, chan->dir, engine_en, BIT(0)); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { switch (chan->id) { case 0: SET_RW_COMPAT(dw, chan->dir, ch0_pwr_en, @@ -431,7 +431,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp = 0; /* MSI done addr - low, high */ @@ -501,12 +501,12 @@ int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) } /* eDMA debugfs callbacks */ -void dw_edma_v0_core_debugfs_on(struct dw_edma_chip *chip) +void dw_edma_v0_core_debugfs_on(struct dw_edma *dw) { - dw_edma_v0_debugfs_on(chip); + dw_edma_v0_debugfs_on(dw->chip); } -void dw_edma_v0_core_debugfs_off(struct dw_edma_chip *chip) +void dw_edma_v0_core_debugfs_off(struct dw_edma *dw) { - dw_edma_v0_debugfs_off(chip); + dw_edma_v0_debugfs_off(dw->chip); } diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.h b/drivers/dma/dw-edma/dw-edma-v0-core.h index 2afa626b8300c..75aec6d31b210 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.h +++ b/drivers/dma/dw-edma/dw-edma-v0-core.h @@ -22,7 +22,7 @@ u32 dw_edma_v0_core_status_abort_int(struct dw_edma *chan, enum dw_edma_dir dir) void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first); int dw_edma_v0_core_device_config(struct dw_edma_chan *chan); /* eDMA debug fs callbacks */ -void dw_edma_v0_core_debugfs_on(struct dw_edma_chip *chip); -void dw_edma_v0_core_debugfs_off(struct dw_edma_chip *chip); +void dw_edma_v0_core_debugfs_on(struct dw_edma *dw); +void dw_edma_v0_core_debugfs_off(struct dw_edma *dw); #endif /* _DW_EDMA_V0_CORE_H */ diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index 4b3bcffd15ef1..edb7e137cb35a 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -54,7 +54,7 @@ struct debugfs_entries { static int dw_edma_debugfs_u32_get(void *data, u64 *val) { void __iomem *reg = (void __force __iomem *)data; - if (dw->mf == EDMA_MF_EDMA_LEGACY && + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY && reg >= (void __iomem *)®s->type.legacy.ch) { void __iomem *ptr = ®s->type.legacy.ch; u32 viewport_sel = 0; @@ -173,7 +173,7 @@ static void dw_edma_debugfs_regs_wr(struct dentry *dir) nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { nr_entries = ARRAY_SIZE(debugfs_unroll_regs); dw_edma_debugfs_create_x32(debugfs_unroll_regs, nr_entries, regs_dir); @@ -242,7 +242,7 @@ static void dw_edma_debugfs_regs_rd(struct dentry *dir) nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { nr_entries = ARRAY_SIZE(debugfs_unroll_regs); dw_edma_debugfs_create_x32(debugfs_unroll_regs, nr_entries, regs_dir); @@ -288,7 +288,7 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) if (!dw) return; - regs = dw->rg_region.vaddr; + regs = dw->chip->rg_region.vaddr; if (!regs) return; @@ -296,7 +296,7 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) if (!dw->debugfs) return; - debugfs_create_u32("mf", 0444, dw->debugfs, &dw->mf); + debugfs_create_u32("mf", 0444, dw->debugfs, &dw->chip->mf); debugfs_create_u16("wr_ch_cnt", 0444, dw->debugfs, &dw->wr_ch_cnt); debugfs_create_u16("rd_ch_cnt", 0444, dw->debugfs, &dw->rd_ch_cnt); diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index d4333e721588d..6fd374cc72c8e 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -12,17 +12,61 @@ #include #include +#define EDMA_MAX_WR_CH 8 +#define EDMA_MAX_RD_CH 8 + struct dw_edma; +struct dw_edma_region { + phys_addr_t paddr; + void __iomem *vaddr; + size_t sz; +}; + +struct dw_edma_core_ops { + int (*irq_vector)(struct device *dev, unsigned int nr); +}; + +enum dw_edma_map_format { + EDMA_MF_EDMA_LEGACY = 0x0, + EDMA_MF_EDMA_UNROLL = 0x1, + EDMA_MF_HDMA_COMPAT = 0x5 +}; + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID + * @nr_irqs: total dma irq number + * @ops DMA channel to IRQ number mapping + * @wr_ch_cnt DMA write channel number + * @rd_ch_cnt DMA read channel number + * @rg_region DMA register region + * @ll_region_wr DMA descriptor link list memory for write channel + * @ll_region_rd DMA descriptor link list memory for read channel + * @mf DMA register map format * @dw: struct dw_edma that is filed by dw_edma_probe() */ struct dw_edma_chip { struct device *dev; int id; + int nr_irqs; + const struct dw_edma_core_ops *ops; + + struct dw_edma_region rg_region; + + u16 wr_ch_cnt; + u16 rd_ch_cnt; + /* link list address */ + struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; + + /* data region */ + struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH]; + + enum dw_edma_map_format mf; + struct dw_edma *dw; }; From patchwork Thu Apr 14 23:37:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8EBEC433F5 for ; Thu, 14 Apr 2022 23:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234563AbiDNXkL (ORCPT ); Thu, 14 Apr 2022 19:40:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343998AbiDNXkJ (ORCPT ); Thu, 14 Apr 2022 19:40:09 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60055.outbound.protection.outlook.com [40.107.6.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7077EBB922; Thu, 14 Apr 2022 16:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SkJBvdGlOkUEI/7n7xbQwxKBAg9Obzi8H3CAR2H9ysbzDKMe2qDfN+lqtP0csOIEfSzsJxdG74RFIjz1ZyWCi5M9n439ppdV4uGueh6/t77AVZ7mbDWnNuggrg1G4LRY9lKb/qwlrdLseqsy5VX1EYZadsQMl0YLlagsy6IZajvRRdPUnFUU6LFDu3hb6Apo1oMU4KCly8H9G9c3SMB9aWxd6Hy9q/GIUDpuurylQz866r9eKckxWMVYAUVYwnKwQsGxo+Tp+/llbErlQ9Lnmcm0Zax6jDSCGKU6zKO/yGDh+Gk1i3wm9t4Pra8lovQMdrRZ36giKbxyMgMgRG3DYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o2CyGTQBABSv/msMfywsSjN7c+y46Hjdw6vr2il8tos=; b=Knmhkr5VYpxCnENVElstSQh7aQZnNTc1Dzr4HZqVC1MfU1bsVDLnEnhPbHELmLepdpBS3jgx6PcCsaugLiizbowVvx7HRCgNmgxbuKVH8ueZCSAWlFw26JnQPxK0TaZIzjQ7uwplB6e51VZzBOlAGPBj4WSjBqbyVZNuawNHBN1r90WYI6BSmoIHegE3eDx5BP/FjwEaeYSkVHKFvezzEAbBZqDAOdtK0vucVH1GNU7pGg+TkOElNZ90a0H7TDLN66hYz+2wStsEZqnEvLkgMnn2Xq6XsWgJH4LsQ0rNWcK+jiny5xa1eQgahvLzv2XCQjSYCJ/O4o9CpC5tq29yTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o2CyGTQBABSv/msMfywsSjN7c+y46Hjdw6vr2il8tos=; b=WZMZeRejXVn7zE2JtM5QeDKs56jm6TwOYZ7czs7W2GZEOyr5LESr37dfjqzYQCVvxKoJZeLHX33KhTsJZv771uUqaOZI++1tHuSUzlvQwgICWVYC57ec4jdANsrHZIgyQmsxPbMjUrvUZVnbajoIHP2CPHlNgNJG1ARq9b+ONnk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:37:42 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:37:42 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 3/9] dmaengine: dw-edma: Change rg_region to reg_base in struct dw_edma_chip Date: Thu, 14 Apr 2022 18:37:03 -0500 Message-Id: <20220414233709.412275-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49ca8efd-b65a-4123-9ef8-08da1e6fc4dc X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sCy/4cGye5gGy2mZY82IB4jOlmgUkviffz2Ii3w8bBm9NzOBiICufVIr1b48J1fiObc/I0iEwuci6BvD6gkq2WRu3qRS9Nlyafz6ibHyALg9Lns6ZlBk3g8RsatkRtX0b6DUjXVZqqcpoB5qkyvzBzrFS94QzMdyequA4dDY0RpOTSI0DqUdz5yZamC2h8F8LADa4HOxAqPnVPnBMKxhpIoeKnPYTFIjkaQHfeL7d6Y4gugiDIUZjKYSn3jw6He6GtreL1jmLkaa5mrdwNKLoFEDRIov4YDfinTmnyQFUUkZXEVwZHdtV8/H8H6bfK73gAvCKz9uvjEMjrTItHO+FX6/gE4lT692ailGev8WkGEbP6KG0bPjG1ZTqvE2EwlrgutQSxjBJRRKduh5uuswfAwPVjAemdP7m1DeXk9GAPKBBOHn6fkbsV3BDmIux4sujj9TPyVYywMvnCC22Fo3FxUFfpVMRmUSho6VTqKcvSW5hliox+9Z4UHluOwgJq5mKkvLHTzoUo2q79dQxApr8iOK4Oaa2rKwGBKjgi9k9QPrs55preQ92y3CYRIl2AWiYNTJ7Gd3aDmZA8Z4VML12MaThjYPReWGw/4+10v4sT8lPfzuKawj+KltiFXSffUEIHf1dW7D78pOIrtN4PM/eBCG8enQVGSTM44MROF76Y/CmTj2iYgwb40KdK1CPCLggxSTUw6y0H84BdpXCJnsEA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(6666004)(4326008)(8676002)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 31og2JdJIOEU88Mi+/tOADVUo6dzAEVghY/dFKbcsJkfiT6ziTXvKCKCQkRcWcueJwHBjGWAjCFaX2d3lgYv8UD7dIjXJzoO5eXeDA8BbXM1Ssx7tuIUoTDpjByXy+jqAizUD75SXjIztghHxDXxQaObl6tcLz3OIQusVvUEvdFOCkqURSx51YaE7NVz/4Fl8nN+j9zJIzQftot74HrOd3lIpzH/wXSEjtUYvPSJ7q40nqP7F7ts6dNLJgaOcuXfIQ9zgsYSt1E0LKT6sr70MrsQ95khfiB0uEAP4JzRAqBEFLwhhyBOtUP871ccTJ2v837U81YPF9NWGf9nLJJqOsZXtHtkmRL8qW2wKZ6gxEDRlNkBRareDWw7r5dyQKJzuxWC2adVrGCewZpHQWcSRoLabNOlcXHB+aBkX4rKro8GdKcjc3GEUY2IwuVMM3qh1a+w9NK619lY2ysY7anCutYYTLKQVtYaGDqZkn3J4JOA5B+H9WuSfPCCG6bDWkPZG5kPQB0h6QjxvnuDIkqH0E9TnJOYF7lFbg953HBY61bEOT33fLt5ipI0HOmfilpNiesiMb8tlBev6XpXSZQVAJJUBmA7vjCw33fwOCRRwvTOavsnj0145658VmY7Z94h5lFRmwswdtAqao2iymif0DZhqw4qSSUo1105FUA5JQZtc6Q2uuGzN8wGZfIrAgSQPkARqdZ9PMBaPHYEG3IP64PUMN9wtYkn7cPdsm6t+jIEOj7FtGI0QK1GWLKVgpKLJySR9pNegsATj+zemtuj3KaKtDLFyo83layOx5LXWrkiDtOYM2dqxP9ggkpCHIG1D75iLN09FVZBASgnnDD9+6VZeuNberMyna7ouT5R33R4j9iNWF3G5hYlVdg/IEWOpPmpgGrSpNz75k12XZa/q5qM9d91OH1ZS74DW0Lb4G1nL1I5QdIsCXgB2DtajnPwPMxhEYyhKAbBRqLhi4UAZa8svuTLFU6V5nIxwI3gOWsWzOQGY9aUWvee6DCSw7KJZ/cUjXovwMmGcnsk9lHz+X5ljg6gNSQ5nj/yaYLs2P2yMWReJRdCHwL1QSZbvboi2WPaiwnsbFZbxhk0rEooAv7n0QPxzoasKxB4bomed5T0OfzBjxNU63fKyoKF+5FUxLQ2sj6rtYYh1/NnFvciGk8UUZ989lB+rP/DRahkaSavWfHjOHANz4ufMh1Z4p8jPQXbw3avJE/JVY34WDAIKQsqyxugfuWRzy8I2uylYmxJ/1Iw9PA8kZJn+6FD1if4EReZ7ulkob2X6fHTVxsA5dKRum4pwTh4pO7yoIIGG0UdBXtAomEDsJsb2iDM61RivJotWRMwjLLiUITTvnw8ZG3gzjAN5w6tFcU0Xw2vu5KxOFPINyaiKSMFBmWOT/Aw6bB6wDNKPStmTja4WDjvopiWyqKT7lyJfLJ0g6ZcjO+N0GDufQB02ywMeRJUNcRlkuGh/+dYBSh4X0tn2BQkSwN2COmfzZ63yItNmSrApPWyPFvarLbqrZ0+WUSHQq5TxlR/jkNBlWrKFzPnmDVeJWe2faC9O+YDVqtsx4as+tvztscGsCXjMA1My/Nf4DiO0vWy8x9YX/xb0BxHuSjGSv4+JM4mJJTTHrAapE/o5c012Ghr4IBjxteYmoLwLvDX+0wNI4VjMarj8aecmianLAa3gdTZqYFLlkDM0s21YaomTEdQmgCC7vESuTgzx4ZrG4+TZb6QLwRRsSZPxjuS5Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49ca8efd-b65a-4123-9ef8-08da1e6fc4dc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:37:42.1061 (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-CrossTenant-UserPrincipalName: PQqxvh2qencUrdZddWHAjkF6bfuJR6Fe85hQYEi25GB2Rn5TBoKFWJAufk4lxZtONOwzN53uS0WdlhPgOaMtHw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org struct dw_edma_region rg_region included virtual address, physical address and size informaiton. But only virtual address is used by EDMA driver. Change it to void __iomem *reg_base to clean up code. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v7: - none Change from v5 to v6: -s/change/Change at subject New patch at v4 drivers/dma/dw-edma/dw-edma-pcie.c | 6 +++--- drivers/dma/dw-edma/dw-edma-v0-core.c | 2 +- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 2 +- include/linux/dma/edma.h | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 2c1c5fa4e9f28..ae42bad24dd5a 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -233,8 +233,8 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->wr_ch_cnt = vsec_data.wr_ch_cnt; chip->rd_ch_cnt = vsec_data.rd_ch_cnt; - chip->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; - if (!chip->rg_region.vaddr) + chip->reg_base = pcim_iomap_table(pdev)[vsec_data.rg.bar]; + if (!chip->reg_base) return -ENOMEM; for (i = 0; i < chip->wr_ch_cnt; i++) { @@ -299,7 +299,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p)\n", vsec_data.rg.bar, vsec_data.rg.off, vsec_data.rg.sz, - chip->rg_region.vaddr); + chip->reg_base); for (i = 0; i < chip->wr_ch_cnt; i++) { diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 082049d53ca73..8ddc537d11fd6 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -25,7 +25,7 @@ enum dw_edma_control { static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) { - return dw->chip->rg_region.vaddr; + return dw->chip->reg_base; } #define SET_32(dw, name, value) \ diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index edb7e137cb35a..3a899f7f4e8d8 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -288,7 +288,7 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) if (!dw) return; - regs = dw->chip->rg_region.vaddr; + regs = dw->chip->reg_base; if (!regs) return; diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 6fd374cc72c8e..e9ce652b88233 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -39,6 +39,7 @@ enum dw_edma_map_format { * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * @reg_base DMA register base address * @wr_ch_cnt DMA write channel number * @rd_ch_cnt DMA read channel number * @rg_region DMA register region @@ -53,7 +54,7 @@ struct dw_edma_chip { int nr_irqs; const struct dw_edma_core_ops *ops; - struct dw_edma_region rg_region; + void __iomem *reg_base; u16 wr_ch_cnt; u16 rd_ch_cnt; From patchwork Thu Apr 14 23:37:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B95C0C433F5 for ; Thu, 14 Apr 2022 23:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343998AbiDNXkQ (ORCPT ); Thu, 14 Apr 2022 19:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239685AbiDNXkP (ORCPT ); Thu, 14 Apr 2022 19:40:15 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140083.outbound.protection.outlook.com [40.107.14.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC27BBB922; Thu, 14 Apr 2022 16:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fFXHgP+dsGRUbwTJn7Hn9NZAYW873mI/Fx5x0e9lxDZVv5pufMNab+AW1JfMkbUY8lwcb+ONJvkjPzr6hRnqOIqiM7OV64t4A7JhyHi+V1Ye6TzrWDshy5hDepEgNrCzPI2SahAkkGAagGrseP82QxCqYZCxRNgRQQOh98hIagPiiFbkCwu6IB0EskA5OE1ccpO+e+MeFx5msitgB9NjbAjN39+59+M9i8hGdZi/ij6Cpzl9Ar9M8XOEQnxux8d4/ISnXIDAmhkAT5bosaRnnJitYVRnpZdSbPGfCHM/+G8YpZEWnkKkiCxoSjvs1uaacPQOQ5xAF355P8ok6nOjBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rXnmQD9ma5SPGGUPjZjl3AR5tt/f8itLUAyMgo+Wy2I=; b=f8X6NW84Q+M2J4BS3j8nn4nykMM3TGcvlU/aXLKa+JMB1/hA2/7uD8fjcHsPCDus/YnSEckQNFhKKpu2P51+A3s9AFMyVirDKQDUPaVNuGgmF6xK5nSf03uBgd3PCKZOU2Fnm1Teioc0VO5JlKZMTVZ/CZjZtU6TbkRhKBJjBr4aaImfeGrA3RgysSXWpd1JTPmWjIHaIK7Q5Cdsm+TAiazSNEBYT5mXYmVEh7d3PEomPgt2cPrGUObSnAYnOkwpfCaO7CeUDf1Vn9RCUNfeJltO80p3v27wWSNPwSvb/LVgfN8OHpqufivKalyHK1OPUqqRXrTkNxbHdory+P7mJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rXnmQD9ma5SPGGUPjZjl3AR5tt/f8itLUAyMgo+Wy2I=; b=NhsDhlRErCrqxPE8V4pPG3sDd3x5ZieTlFxGonXQD0UwCaDkbVLoD1oVc4ZMUd7rx+zHkxgS0QWQQKneHNOtqsZHtGE/lYlDo/rTHJTsFOoA5MwrZm3CdTpdd3jSyUMDApRgtft3BPsSurDMsNDQAK0m0cfErxi5nAt7APNoP/c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:37:46 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:37:46 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 4/9] dmaengine: dw-edma: Rename wr(rd)_ch_cnt to ll_wr(rd)_cnt in struct dw_edma_chip Date: Thu, 14 Apr 2022 18:37:04 -0500 Message-Id: <20220414233709.412275-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b2fcb70-17bd-406e-4844-08da1e6fc72e X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DLv4H3+6WeKbSvuZkUNlIr1xB4OKIK5sNTY9iEMkpPoFpCna2uyKrX778RGqgZGVdgesqoEUXW1H1uk6q/17R6hxLHzdoKl1vs4I8cz/5XCdVjsf4R0WAvRuxSOT5cdvYrbkv7EoXRdWOSILBReq58PHuEQsSHiwoFpcuuOcZoSdM+XDn6THaorsd3b2hbjAkzHR+597QztO/AF/a+WeVeBa8854kcY8yu/4UZ0jwZr7FFICU9qK5nCLvrSyNnfESpuroMsRrdmjBpF0Q+mLRSAEoEi1t2pBWPYYul0qL3kHu8kSFF+9Md2t2O+BQU4/6pfCm3NGNxR5V5oT2eb1HJkyncqwWdm1AonOVuIXehzgcmjslPBRVu3vDzxAZXStsdRNw1199ljvFMnasM3cRCAWWsU4rXUi2JfEVfr2lstwavbgZA35bPn2Z2eIIAZBxaXT0g4pid9dwu4dyhXMkiugsXNCEs1sdEvOxq13TuCyoJItsL2DMUiT0Wdlh+s+MKfgxFrv6pjW3XV2LCDu4OC/EQ1n+W8Yna7t/UlexBHnPh/Gv7XdeDDAH8LHqxshukPS4x5Jsz4DKyPxpIump3tzVxnoMkKd+iCV4zWzcx4xlc7OmYXePFI1m4zMo+bAnR1rbEL0fJQUFRcBoMocTXU8SsIAt/erIsuNnmJ58W8tQcGtE9gGKs4O7EPySBODTK4xt7JFm7nRQZh+MAF6xg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(6666004)(4326008)(8676002)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /EPP2VFhfTbUNWkrsXMD/jpkGAlbCXhhF3LG7ZCTZUUEa0ti4ziLF/GuvTZH+/YMwI6Vf5j+U3zDCCbSs3voPd7ElYdE57tvDDy4TxyMQKRqZMxzazzI4Ng4yCAQE9QgqMIPtI45wLYbpZ0G4CqNOWRKKUdD7LnZn1kaQCXLxJ0o4YDjQf6dj9Vyw2yr5jKTA9b3pDGCGGl0sz4pnRBrL7RAjEBjgIZD/GZelpVXX53Si1XOWoycXZXfOe8BeT3I8/igwQqMW6raG6rDdrKGqjCtEegH87HgnzvraUeBmp6sihFE2hWj93gW4lwqncDz3R4xfprji0FfLchwP6kFNi/c3sAdzlNBgDqjsaPbHONMw7ZSRqka1UB/l/8HLkWvN5kLWnFps+wO20J/AR3J7gzI/n4TinY4Kmuee73vTDrqgMA6Cd5uTw+6V63TrB9mlT3t8MuIMv7B8Qny8yYLNTmBG2P8eAiipdd/BsRhOo4mS1vQ19/9rDYsCqBN4IyLM/RlmSca10VsDEAVJCa29f1PWJkO+TTYp/qa/V88BmVkL9M3iIwbKH1YXwnEO9q1sv6WyZ3DL7DEG1XUYrVfMoOIh/i0vIIPA832Fy2Wc9sU10LAlL7++SHgL7qY5pW6wDS7EHTaL5D3Dfi5QeILL8Fa08ADMRlRLwcWrTos0m1jVYyxRT8c1bz+31kkINiCwPgnRNgqN4c3BYOpPVaqlZT6k4hMDKgsF+IEVwmMy06pQ6SonB2+mAJ+m8zIUhK86fQTl2P2a9F/VvHVsC55Dg1FQPazHuF/K3+MVXmW/isbBI+rbcF6b5IOwJP7lGKbsBy6Tbq7WsEJpdhP4ZQ0ya0cmbeXqIoluo8R6zz3CybkEpx4oiMKhJU1iQiHhrm6AT+NDkUfW17gR3pAJuuHruWbCiUAhUyycb9Vx+XKOc3lFIHeJLjz8VNMvC/k8Bzv3EHoXHWGRf5iuGVUGyjcgQK/nYoCf1ZjIJJ1LyZ6klobAcXZSR78szR/x/XD4vhVJV+7mcw5leLKE0IJWbeGRxPG80+uKOJG2f+KLTzqcK1C7vzzCqggiWZYI84rub0GdzFxpI0y5mVBhv8lYQq5X2G5Yvy9DHVnCWm9m9929UyBmw6OjTLSvFsvyH4fuwWaCIc8UHatwxVHAzAZPx9ColHaU1HT1PJ/MBNPqU4MF4KwA7qXKABU+mKtwB5SuCYU/lyZ6iY0y5hUT/CuPbeq/DtKTcwcHv2P/pwrvYgfNuuf5jmhas3MFYrrfApWb5whlTSnLmsNNjj0J2VsoScjb7Zdpho62GogyGyJUtw8LpoesCzkS9qiYPp4L1zw7t9LEPFSJS6lY7qVgqu0NqyAMRO4RE3sdjua+PLbl7FneTFgRv3n0r5xPFGj8AyYCb9rN3E7G2KWfrmbanWsRnLXJAKTkTeZCfYVo5Ahz289o5nxXCwg1eoNcLDgebEbxp5AyQf8dCRAU71L+Y3nPX8nQ1izOdad/b9rBXmCWMiUv4W2cEt5lUIMYM/m+1S7i4wth1oAOSQLFwmlFYH2zks0uv4BiiFcjoCobjLYRfblHR6sJvOidAncpLcCeZnsGL5M3uo4lyU+G1h2BaqYShetGyD56BM7POQEimfObT2HR22Fkn2y2HddBNnfYdG26t/DwGqmr2IsKzB9MHJBnAkMYjkBUAuozXMB+d4AAH9In6gfGCWz/fFEKCW1Ewss5NdjvAh569x3J0jIgrrwAKHFDQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b2fcb70-17bd-406e-4844-08da1e6fc72e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:37:45.9498 (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-CrossTenant-UserPrincipalName: QuMG00UJmyunjRVFub4ULzPl5phNF7eTYzbKljlLEtS+9KTiVfxfdUEu9x7f+O4O5DA5Vb/gRQnIyOnyYxxNpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org There are same name wr(rd)_ch_cnt in struct dw_edma. EDMA driver get write(read) channel number from register, then save these into dw_edma. Old wr(rd)_ch_cnt in dw_edma_chip actuall means how many link list memory are available in ll_region_wr(rd)[EDMA_MAX_WR_CH]. So rename it to ll_wr(rd)_cnt to indicate actual usage. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v7 - none Change from v5 to v6 - s/rename/Rename/ at subject new patch at v4 drivers/dma/dw-edma/dw-edma-core.c | 4 ++-- drivers/dma/dw-edma/dw-edma-pcie.c | 12 ++++++------ include/linux/dma/edma.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 8cdc66e17c069..8c440cd7ca0e2 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -919,11 +919,11 @@ int dw_edma_probe(struct dw_edma_chip *chip) raw_spin_lock_init(&dw->lock); - dw->wr_ch_cnt = min_t(u16, chip->wr_ch_cnt, + dw->wr_ch_cnt = min_t(u16, chip->ll_wr_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_WRITE)); dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); - dw->rd_ch_cnt = min_t(u16, chip->rd_ch_cnt, + dw->rd_ch_cnt = min_t(u16, chip->ll_rd_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_READ)); dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index ae42bad24dd5a..7732537f96086 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -230,14 +230,14 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->nr_irqs = nr_irqs; chip->ops = &dw_edma_pcie_core_ops; - chip->wr_ch_cnt = vsec_data.wr_ch_cnt; - chip->rd_ch_cnt = vsec_data.rd_ch_cnt; + chip->ll_wr_cnt = vsec_data.wr_ch_cnt; + chip->ll_rd_cnt = vsec_data.rd_ch_cnt; chip->reg_base = pcim_iomap_table(pdev)[vsec_data.rg.bar]; if (!chip->reg_base) return -ENOMEM; - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_wr[i]; struct dw_edma_region *dt_region = &chip->dt_region_wr[i]; struct dw_edma_block *ll_block = &vsec_data.ll_wr[i]; @@ -262,7 +262,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dt_region->sz = dt_block->sz; } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_rd[i]; struct dw_edma_region *dt_region = &chip->dt_region_rd[i]; struct dw_edma_block *ll_block = &vsec_data.ll_rd[i]; @@ -302,7 +302,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->reg_base); - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { pci_dbg(pdev, "L. List:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_wr[i].bar, vsec_data.ll_wr[i].off, chip->ll_region_wr[i].sz, @@ -314,7 +314,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->dt_region_wr[i].vaddr, &chip->dt_region_wr[i].paddr); } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { pci_dbg(pdev, "L. List:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_rd[i].bar, vsec_data.ll_rd[i].off, chip->ll_region_rd[i].sz, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index e9ce652b88233..c2039246fc08c 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -40,8 +40,8 @@ enum dw_edma_map_format { * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping * @reg_base DMA register base address - * @wr_ch_cnt DMA write channel number - * @rd_ch_cnt DMA read channel number + * @ll_wr_cnt DMA write link list number + * @ll_rd_cnt DMA read link list number * @rg_region DMA register region * @ll_region_wr DMA descriptor link list memory for write channel * @ll_region_rd DMA descriptor link list memory for read channel @@ -56,8 +56,8 @@ struct dw_edma_chip { void __iomem *reg_base; - u16 wr_ch_cnt; - u16 rd_ch_cnt; + u16 ll_wr_cnt; + u16 ll_rd_cnt; /* link list address */ struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; From patchwork Thu Apr 14 23:37:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814136 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D74BFC433FE for ; Thu, 14 Apr 2022 23:37:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347720AbiDNXkU (ORCPT ); Thu, 14 Apr 2022 19:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239685AbiDNXkS (ORCPT ); Thu, 14 Apr 2022 19:40:18 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140072.outbound.protection.outlook.com [40.107.14.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 710E1BB92E; Thu, 14 Apr 2022 16:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jYuO7g3rRpW3iBwJ1Kwy3PDH/YxHXBxLmzcxwLUFHh4zzbuEnCvc4UPA9OhsGaBCDdWg9NidMNGx1+PO+12JR8W5j8P3SjNtg1JpOWkaQo0zX4YTguFcOfBWra+9oBNeFogi4WTRreI1Mp9pIX98aBIvBW+MSya7Kkk614tUFyWc94raZXDwOQmbJqmCrtdFJO88OsRUFmXyOloHRBrZE8LjJI0dFtV/qEInGQDs75fEgJylim8OPuTe9kMgfxJ3pyW4NqEi+FJKQmclvP4RWElkF4pul8D4d7MWv9xTlhkw/QJ5EB+0UTllR6gzksuViBVcBGdVS8yTI4TaXBkH7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ujmBwN8Skl5YVXKpH66vPLqMo+p93BVk0tewwsLHYQA=; b=l5Poy0y+ngI5oMnap457s9KajAIrnlujM+NCGz/ee/rxD27d/MuUku+UzCWHhHKA0W5bFJSLtd37ngOSfGY2ZxLyL8FqjlXycz+JPJAXW8YCyzstafKfGdmQ2DI06+wAPCVRa543Oub6hXb2Nc39Ji42gHuWKvRcURwS2wFPW5r4ARFsfdg1zpdNhtovKg9XixFF2RE1dmEywwauISe4fe0Ru+Gqu0/SsiZLVs8PcoT5l+SxL/UCFWl7vqZy2k1OvoKf/V+fzoEtSqFQoxiqhlzvfd+KbbJauDMMjVZ73Gja/BloHDiNL0P28sWMYlAYlBkY27LMeT3IgZGDN1iaAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ujmBwN8Skl5YVXKpH66vPLqMo+p93BVk0tewwsLHYQA=; b=KzSLKCNWnfbbliRJOal0wWsNU3pMZWCJQxuYPpm8kHlRJlle/cK8GPlK1RIxmJyfQtTbglzn9P/jWHoVnmKDKH40o81IChNtBNz1pWRPX0wQThhadJ0+XJ/Qu7JJElweZUqIjXbS2FfnZHXaH3bq1abakqQGBiwoTxmxsXE1NW8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:37:49 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:37:49 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 5/9] dmaengine: dw-edma: Drop dma_slave_config.direction field usage Date: Thu, 14 Apr 2022 18:37:05 -0500 Message-Id: <20220414233709.412275-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f261a0b6-c02e-4405-e2cc-08da1e6fc978 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YsTbxg0vIFS81zidFVfuwVnXt4JJ8BkdoQtbKHVKWoLTZ4oURd8K9U/QAuaClQaIF721jwjyCu0srByh2vANGq36wvVf3g1lL6pBxfTfO6PWcvmo5u06oTxqJuUTrkM4JNqTA58+/3zsm0lQqvAtz0xC+Fp2ktXa6JFU/JvSTGj7cwGOo63xx+OUMHzZ5QV1e47obMxqSolLZE6jdFG0CgXpBY7mB8DhkC2RTFDs0GBcl6zmP5SD3WbVDrg0KpkUldij7aLGxGR7BTCGahnfYS8xELviWUGTmn2UPX9Wlc7mpSKKKh6dP2zaFnZbYYK3ZUTiBZ+95HLSg0ZPWcraXUU0lycNvdqIw31lECnHm9HvAol65b9zaNMXHGIA7NG6glXRIkKzfLSTpNEXg8D0HUUljYslQRbIJhnOb+m55lwBB6Nh4vrztHYeiHa0ecAK9LtMsyfAqXgIa2QdMXYCUQ39zjWFMe1rt4YYogyQbZ5aRVEHjOGjjNR+hoqQbej79y5W04hg93jKsZpnPyAP/dZpx3siKG2Hh75LZfMpY+I5mlu9cvOORDKxaRhy85ZprHTVDBw8lE4zONR0rRPoqLK0rehN8s6HEAAmAyXjZUGGlojGCkVAZt1eBg9E3814VXuvUHHrK51tx2u9xus9CMwONHfR2Zzopq7sREMyE92i9WWBt/SpklAMIpz1gkLo0mg/u7LtVVwNWUtle4wGAQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(6666004)(4326008)(8676002)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pjisHWjqfQN5ozyVtbACnrCU3DTRqbh3CluJyhJ8pRDb3K8tZ7dbgIv7InAKMU6SZN54Qj8SjFVmQGrO8PiaISzOgrlKjwAcXp4Rn69O65iz8mE2fp82e4papcsPEyQ2IFbDTedsRtJVMPBYOKSE4fvG3fdTxWpgo8/7Ksvh8fxH/Rh7gBvpYOMEkODDP+ktGqlAaEoOCfWaVRgEbvf1sP/6OyOfJTmaQJyUoVCY9511R/jJP8jD1UyQ1nxWRPwrH/X09ClXCqlbUSHnNAP/GrYedlBByJQaoNAcf27mH/NXm0JPWktNczOGd7WD1ZshPMgJU4g3ABP8rVfEvcOqqvAbJiUdIykTLWYglv94Wnd5+ubSEAlrOUoWiS4De6p2bEV/6kgnAbAJtfVxv+N4Q85H+I2OE8hu3HoiUzLhjS5yiaiVZWn8+NSHAeacV9Plnk8QIE46a3gxyodx1cLhtz8HXhecPNie45Hgd1kJQx5rr7cuD/DsThrIBx74McWlQF2Y5vL1tzn6nbhCK0GPT4LEcQ+xYXkJd6fTilFgJuiYhSM3ba8tcy5IfSN2i1X/0uCdpZY2VKyXEkCKeiVu96oWmOmYZpE9/pDc4Vy2E/piMgzEM/K3V8TtLfWyr8Es5K/GTEVclZqt9h/W+fBP7fLFzBd3+P0mWjhMM2ZqDz14CeKmJRRKfF7/cIGZ+AlFDPTxgBZqUg1/IWdo2vQcqbEPd+Il90Qkm9PUiCnKAwIhUhxbTVbSWjFiMCaaVtuewaJWen8DJJUmZLHGqiaaMRAKelcT/bbIYmnwTGNPCUX+RzGNVVuH96P82nFNOAtXM8gx9oUTFvtfdTNQcxMv+L7s6NzELvisp4W+zBimLPOQlTbEuzp2xeMPTXfGjAHmUgK5HD2vnTV2i8UJWQvavq9FGq+e8zf2ivD2bMg6rN0X9jHFxJhGn221trJC6WY9ljxc3NjuAwA5iclW2A4TLfsFtXIlV416KqdyQsq7FuIZ5snJElnBNVZduEeOE7QNXybbS6s2skdYGaEQpVXm+R+G1kqQk6YyumHWL9JJ3yedpuyIPNMZjRegp4yVSh32LsebYclelChldv991v4meJFVLReYOeQ4CrdtiFI5x3aL4yyfs2tyips7erwOOpiWVfjG9yGhwD+uDV0RkieKpbpYk8zulM4f1CK75GJTiBHnJvOyuKK0DmDt+6kgvWSw0bxeq+rcw4EAeo1gsCeyUlzGreajhitcx2ual0yFDz/eJXujuq7BT5pEtrl4yoA7dXnFXEcjdyycQSSGkD44dUqHivoYFZtLcV9QfBpnK2BF0S6N4e57jQyXZ9KpkwnOOmV2s7Gj/UaNWAO5VjBSKVl/UGgrW/EEAO8yur9wsy7LqKc8U1PmchpcoN+5Y3gQ5yq78ZKWjlKMTuIZ2pL+xhSeSnzRovk+aMVcAPxbKVTWjS2QYgDlsEt5J+tR3oqYlAkPG9DWYmpvH0BN6b+VsBuQimGQ0yufTYxt5MKwM58y6KFe/PqQSqd/tKBpIxBq/V4zS0v6Ziy7wCJgUaSWfnig41ioakBLmtt/zazsbLqOJNGVxoxdVBUOUEh0Kq6WNLewUMVkmYvBK8ZwoNvJcDdP2WIYmoWqaYoKwt5QPIo4IwqxWYBSrX4RrI7dNh+YvBXa0+ehSqgemREW0wsgh7036nk+5U0LAeNFnGKqymR+8TjwqtkzQ/VJyRITH2PjSycEZ8gDOJPIkZj6U7MxxA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f261a0b6-c02e-4405-e2cc-08da1e6fc978 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:37:49.8267 (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-CrossTenant-UserPrincipalName: lEywrqc9yZDQqXVMsr/4DVDJE3s5fx5+Xd0HcjM/KtuIIrlQoafmpRLfJG4nn2/NRCgp3xIfI7CbEtQVWfhRPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Serge Semin The dma_slave_config.direction field usage in the DW eDMA driver has been introduced in the commit bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Mainly the change introduced there was correct (indeed DEV_TO_MEM means using RD-channel and MEM_TO_DEV - WR-channel for the case of having eDMA accessed locally from CPU/Application side), but providing an additional MEM_TO_MEM/DEV_TO_DEV-based semantics was quite redundant if not to say potentially harmful (when it comes to removing the denoted field). First of all since the dma_slave_config.direction field has been marked as obsolete (see [1] and the structure dc [2]) and will be discarded in future, using it especially in a non-standard way is discouraged. Secondly in accordance with the commit denoted above the default dw_edma_device_transfer() semantics has been changed despite what it's message said. So claiming that the method was left backward compatible was wrong. Anyway let's fix the problems denoted above and simplify the dw_edma_device_transfer() method by dropping the parsing of the DMA-channel direction field. Instead of having that implicit dma_slave_config.direction field semantic we can use the recently added DW_EDMA_CHIP_LOCAL flag to distinguish between the local and remote DW eDMA setups thus preserving both cases support. In addition to that an ASCII-figure has been added to clarify the complication out. [1] Documentation/driver-api/dmaengine/provider.rst [2] include/linux/dmaengine.h: dma_slave_config.direction Co-developed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li --- drivers/dma/dw-edma/dw-edma-core.c | 49 +++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 8c440cd7ca0e2..f413fd9416956 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -340,21 +340,40 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) if (!chan->configured) return NULL; - switch (chan->config.direction) { - case DMA_DEV_TO_MEM: /* local DMA */ - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_READ) - break; - return NULL; - case DMA_MEM_TO_DEV: /* local DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_WRITE) - break; - return NULL; - default: /* remote DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_READ) - break; - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_WRITE) - break; - return NULL; + /* + * Local Root Port/End-point Remote End-point + * +-----------------------+ PCIe bus +----------------------+ + * | | +-+ | | + * | DEV_TO_MEM Rx Ch <----+ +---+ Tx Ch DEV_TO_MEM | + * | | | | | | + * | MEM_TO_DEV Tx Ch +----+ +---> Rx Ch MEM_TO_DEV | + * | | +-+ | | + * +-----------------------+ +----------------------+ + * + * 1. Normal logic: + * If eDMA is embedded into the DW PCIe RP/EP and controlled from the + * CPU/Application side, the Rx channel (EDMA_DIR_READ) will be used + * for the device read operations (DEV_TO_MEM) and the Tx channel + * (EDMA_DIR_WRITE) - for the write operations (MEM_TO_DEV). + * + * 2. Inverted logic: + * If eDMA is embedded into a Remote PCIe EP and is controlled by the + * MWr/MRd TLPs sent from the CPU's PCIe host controller, the Tx + * channel (EDMA_DIR_WRITE) will be used for the device read operations + * (DEV_TO_MEM) and the Rx channel (EDMA_DIR_READ) - for the write + * operations (MEM_TO_DEV). + * + * It is the client driver responsibility to choose a proper channel + * for the DMA transfers. + */ + if (chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) { + if ((chan->dir == EDMA_DIR_READ && dir != DMA_DEV_TO_MEM) || + (chan->dir == EDMA_DIR_WRITE && dir != DMA_MEM_TO_DEV)) + return NULL; + } else { + if ((chan->dir == EDMA_DIR_WRITE && dir != DMA_DEV_TO_MEM) || + (chan->dir == EDMA_DIR_READ && dir != DMA_MEM_TO_DEV)) + return NULL; } if (xfer->type == EDMA_XFER_CYCLIC) { From patchwork Thu Apr 14 23:37:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88B8BC433FE for ; Thu, 14 Apr 2022 23:38:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347729AbiDNXkY (ORCPT ); Thu, 14 Apr 2022 19:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239685AbiDNXkW (ORCPT ); Thu, 14 Apr 2022 19:40:22 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140057.outbound.protection.outlook.com [40.107.14.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C989BB928; Thu, 14 Apr 2022 16:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wm/bUNWjI4VamxXtCXIFQcX1hPb20oOUgvLLtLmydPz5zjb3BLUdARjLjlds+CkB6ful1QS9NQnoJEugbhQg98nGBS2tSqF0RF/nc3XxJPfVpk4iiu3jCy4ONa47P6tFkfh539UqqIKEWWz5Hh2v/ZI+Uh74jmPNQDWl2TZAmB575cv+HCg8p7qB9bnRhSCU84cx6TGL8pMb55B3jmyXm5V2wnVFcZqjphdS8oiL5mXgLEr5iO/Z+7SiNSq3atjKxQfYA6EwR7pHZ+uHpmbzdtLLl6joXlKxsn2HIapZghuo9pnigMyPUVdvfOylargEybIA05JiQieXGbbIlUysRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=21gz+xTRvA8WA6ehie5vdFb8Uc0AAso7NHLPnnYsvsg=; b=QyOQ7E9Unh3V2Icz4yNHbVAT43bqTS6uB4zhK2f1JJ3R6rimvIm6b1dO4Q+lJ0ICKDIO8O6BmYa88IanA7MiwgD9pTMXk9x0472oaa5ukSA+HhEg89lvIQrrvn5IK8CbhRZHiq7QMB0DPojFgzlJ5Apn9Pk9DiG3zqU/etFKbX0HzL5rZO0DRKQMDNRGxLFElWjEsIM/hvyKTYy8Z1QoD5Ho4pKRnOqOZWtvvyCKatYezvRxwNsE3VHZ0HsC7NFmRwhBzKTG9mPMYtc5yJnLKQ1To4Pui/BB8deFjEQvAT3SQnnprTbiR4FJoDKu8lrAGs1DGdoBqTXFXP10M3yaAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=21gz+xTRvA8WA6ehie5vdFb8Uc0AAso7NHLPnnYsvsg=; b=Oi9B9lL39vPuXb7e9z9bi95uDbfME+4nKfLldwNvQLpOtdR3P+nIzHpChj/WSSxzK6/hD+2M+KEojwNEaoltJWgzLr/aCvTRQLOxD6sbyyo6qeJSwfGKvgSydQz0qZIfiHjueyvF7s+jYjc+rXK9XE4tz4q9Ft3knBSI2F5ua3Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:37:53 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:37:53 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 6/9] dmaengine: dw-edma: Fix eDMA Rd/Wr-channels and DMA-direction semantics Date: Thu, 14 Apr 2022 18:37:06 -0500 Message-Id: <20220414233709.412275-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9d5088ba-f21f-4066-45a1-08da1e6fcbc8 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3FGxemsQ+s9YeJw4ZvrkdvEQ91rUBdAZ83KQHAo3ABE9wiU8H2Tv+czv76wHgm+PhAJ2v/quuZb+cMxctCmWMRXxP6pAR2VOyArHBPhQ2TUK/rankb87xKIj2iytZiVuhhjJaQCa4nRRpz4xnWMPhbS+6gXYR42Cmq9zVmPcx6HDuXJoxgfP8n0qU3LEFXDVzTr/O2afEv96oQUo6vFViNZuGMjEEwD3iORubeqBx6zygC2Cme9s+WHhzr0SG7bYgKitdnT5c1qArNolXa+LAMDqawq16ngtlqouxMEObqWIAWDRLDeB/5ZALFFvkOzCWOUngY50LhkQ+ntXkvJIs5Xy/K9r45VLgT6qXZSbE1iiq3R4C3pqB46FTcDaBt1fWIKEJd9Nd0KnYLzOPxaq+S5DsED8YqF3b6+rp17caFsJPIBH93k+5f8Jc2RKtIWYzRqLT1M6jRC67DpUpk1nOYqvKidUeB4dD8EAxgYnJFtPTq9a8/PJYZCoA0kNp4swwDPFlTljNVp/Zl1o76FD0bXt6zgl/NDpXenYj5F50hbLno+MpkBnPKglZ7dWuS6HvOV48+mguFt+q4EiM8IU+kZBeGLP3OKtGO3W0bYdA76PQU4olckDAv7KgrUqK0a6jEBXscwJSoQJBE7i1v16pHxC3njBUBIqVBlufupdAvTG/febS8eTQQTwbKADy+QLhyJCGgyttBkETxYMfrA8dQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(6666004)(4326008)(8676002)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2jM74C5CBa1gjdlI8nY8ZeJ0nPMXsHpOLnLAJ/flpTIlqA5EXuM79CziTVqObhZUvG3W4aVikecyAqC5h3AqQOHRdqyqXPItlJNWLSxnzYfWCEh+d1Ej0jNmVsMwHRjBTX5XxD+62dtaS3vVuYNThrF9mBTIXUKAaao2xCIWM5gTKC5rPwY1GbLPhuS1gYfkTlBaClS26ILO7voo+dAI8Q8CabHDxKkYZXWszV2zC5XVP6Txr/Py0HI3/k5qZdmRjcaVbNbYuxTFsvwNdQ91ehMgjbcq2d7ZzdyA/U6DeLK3sn4trN1BCY7wiB+LBgZaa06FQDEKhhHUHf+76ZAP42n3brqgQU3++LUTVPCpC1Wi7U6wp19zRxlN58kEEC5D+nt1NrQzNSeZZQX7jUFqJO2V5cCaeN3ofIeMUlwbN2PQtFQ9mbLjP5g78hpAimIwge9F8G4aMEbnMO66jMUg7QWeO4RJDhT0hrsC/dezk3jiPFx73AzufFp9UcLetzb5FNj4cT2XtqWmICCZOWKylo/86w6i02+aNUQnTfGrK7znC1Ez+JuFoaXq8ad5mViyraMBCo83ItPLEZNDmhUUqOyF6zs72m5aIeY/r9GjR70pgWt8kkNL1LWjUe+EOFTTEYC85g/6oOspw2Cfw8CRtyJmrGmIrZ2ra5YV7IhPhQJr+ZlBCF1xBz7gKqw/q707WJGd2wGL88u4/m2yfbYNFodJ0UDwL5qd/A3TFGfrMpaGSxm6HmJOw5mHUXYNAuzjp9wVvo7MmFIoUPkwX1jgByA+X8g4fl/JJ1bPookaflEeoKHNH+Z+NpjSvnSFPwRj07JafXF8YoUfJ8Jq5Ge0Q2JDGYtryBVWyd1Wk9C6Ph9uoOyd3zsoIsM72iHhrZH8dpnZuz26xsy/eo6jwKCCLRKGgrcPyUGVifVip4VjZ78F/lv1dofxv7ipT+VQokSJVFSsyhjsIVQ7azrvysQZxbefaTNTAmNCNH9Z6C52CDgrnprCFRd4XKKqSm7/yiO/QPX87jqWwj77CLTVW2DGg6c3tv3F8NSNUIcAdwtO2vzvS4SeQmQ5zYRjDGnRp9HWpLaHHth1esKvCQEv5pYn4/0hKv8hAOYwi3Mhh1GUHLx8bantWrzPinvNPcIoloJmATpTAObxq4zpXAOR8KhuG/HVTv2UsYHwP0nuW7yuICBcogO88yq4gA9vvGQRJua/oAJ7Ig2tbVVrnRTmu9lXpw9FVcYdyBltM/R2d3JtEBHNZEg7INaAWoFMfheRRu2mori/K8/PQO5OhzCwQpyHIyodg36lpSxShvNnRsG5j73bsY1uX39ZO3C6Gj2R/W5nbJxopaWjXTTjUZ9mz6OXrsRUYiqwMCQrhjwmuieo3BOqX7+J36Gi1Xq3TOOqAoXj2xoJeKOyJYc2HtmhM9b4YdvYL53gHtD3lzFZy5R5cpymvfp3CPeUq85wC03Y2VQBl1I4PpNxThRFBhd1snB9iQQ90uChBXZ+scGSnAB938VwMTdg+x+3B2S2va8Yh8U0yNk+gvPKLWq0xPs/lfXOhXfaP8PvkavytGl9BCnA2Y9F41ZhIPFoFszA15BCfpVayS93L3WlU0SlM86e33vl0BxWN/21l2kHvSjXppf70/28gi7gQvfcdUNb4hdhDl06EP926vRUKjpIUpPPKMBh+4B5b7AOai4AD8bgEMDsxpNAzcy5bBqxK6dEHU02wRcooN+RL4hXatTKyugmDvKrrQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d5088ba-f21f-4066-45a1-08da1e6fcbc8 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:37:53.7167 (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-CrossTenant-UserPrincipalName: pojn4agwyggyOvR1PjeGk5awwUimhKfylU3d0JH3srvhrZYgaC4468RIdQuj8H52xs60VYsZpskagMgea13bbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Serge Semin In accordance with [1, 2] the DW eDMA controller has been created to be part of the DW PCIe Root Port and DW PCIe End-point controllers and to offload the transferring of large blocks of data between application and remote PCIe domains leaving the system CPU free for other tasks. In the first case (eDMA being part of DW PCIe Root Port) the eDMA controller is always accessible via the CPU DBI interface and never over the PCIe wire. The later case is more complex. Depending on the DW PCIe End-Point IP-core synthesize parameters it's possible to have the eDMA registers accessible not only from the application CPU side, but also via mapping the eDMA CSRs over a dedicated end-point BAR. So based on the specifics denoted above the eDMA driver is supposed to support two types of the DMA controller setups: 1) eDMA embedded into the DW PCIe Root Port/End-point and accessible over the local CPU from the application side. 2) eDMA embedded into the DW PCIe End-point and accessible via the PCIe wire with MWr/MRd TLPs generated by the CPU PCIe host controller. Since the CPU memory resides different sides in these cases the semantics of the MEM_TO_DEV and DEV_TO_MEM operations is flipped with respect to the Tx and Rx DMA channels. So MEM_TO_DEV/DEV_TO_MEM corresponds to the Tx/Rx channels in setup 1) and to the Rx/Tx channels in case of setup 2). The DW eDMA driver has supported the case 2) since the initial commit e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") in the framework of the drivers/dma/dw-edma/dw-edma-pcie.c driver. The case 1) support was added a bit later in commit bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Afterwards the driver was supposed to cover the both possible eDMA setups, but the later commit turned to be not fully correct. The problem was that the commit together with the new functionality support also changed the channel direction semantics in a way so the eDMA Read-channel (corresponding to the DMA_DEV_TO_MEM direction for the case 1.) now uses the sgl/cyclic base addresses as the Source addresses of the DMA-transfers and dma_slave_config.dst_addr as the Destination address of the DMA-transfers. Similarly the eDMA Write-channel (corresponding to the DMA_MEM_TO_DEV direction for case 1.) now utilizes dma_slave_config.src_addr as a source address of the DMA-transfers and sgl/cyclic base address as the Destination address of the DMA-transfers. This contradicts to the logic of the DMA-interface, which implies that DEV side is supposed to belong to the PCIe device memory and MEM - to the CPU/Application memory. Indeed it seems irrational to have the SG-list defined in the PCIe bus space, while expecting a contiguous buffer allocated in the CPU memory. Moreover the passed SG-list and cyclic DMA buffers are supposed to be mapped in a way so to be seen by the DW eDMA Application (CPU) interface. So in order to have the correct DW eDMA interface we need to invert the eDMA Rd/Wr-channels and DMA-slave directions semantics by selecting the src/dst addresses based on the DMA transfer direction instead of using the channel direction capability. [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v.5.40a, March 2019, p.1092 [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, v.5.40a, March 2019, p.1189 Fixes: bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics") Co-developed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li --- drivers/dma/dw-edma/dw-edma-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index f413fd9416956..2765fa1230dc0 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -443,7 +443,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) chunk->ll_region.sz += burst->sz; desc->alloc_sz += burst->sz; - if (chan->dir == EDMA_DIR_WRITE) { + if (dir == DMA_DEV_TO_MEM) { burst->sar = src_addr; if (xfer->type == EDMA_XFER_CYCLIC) { burst->dar = xfer->xfer.cyclic.paddr; From patchwork Thu Apr 14 23:37:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA47C433F5 for ; Thu, 14 Apr 2022 23:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347727AbiDNXk1 (ORCPT ); Thu, 14 Apr 2022 19:40:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239685AbiDNXk0 (ORCPT ); Thu, 14 Apr 2022 19:40:26 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140080.outbound.protection.outlook.com [40.107.14.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42AE3BB931; Thu, 14 Apr 2022 16:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a491lctX8SrOzG/napC8n/zPRc7dGoShAC/c0ywzm2774mc4O2Bi082L5CEGiSsrVY5JK7B15BYAhpi1djgK7ghIxTL/JxWEsCH5QJ5joD5ZIR+SlxWqrB3Q5DgLztQb/NmqKU/JpmKvtJ8YaVQdK9YO5Fjgig8/U0v9eY15fIIYh5FDWrmIJo6F3H8dfDZZ44m4u20rXD9tkX3YjUm7Chck29eAxpTtfdpQ9UAbJDq8jW7rbUwwLBN/M9EeDrbPni1pkWLtsyIzntSr7QunwW4y9THOIA13uVMktDg519qQB30fxVQ5rgWuwBE/dKAxVuGjFZocyXVmc9w3MKE1og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GYzyqiMS3WsIAkX+/4RiuVDLaIkkH6lTzekhetucJl0=; b=mjgRPq/7Vq2/if41ikrLhq+5qcTn3ckbNR23YQSxnwOUvToEQRMuTnwlvekCPzsgeovxkUWsc4OREor8rlowl8SnV2eFdEcun9fAv47P4QgNgl9REA4THJ1ey0VSFPpI2oBS/dXzDpatD0zSvyu3v67vMnRf7wsEh/zH7VE32vQxOvnPWDBHImH/t522wPIXfI6QYlyR9xY8zu8h1fzvm86ldu7M8bOXdDKdvNTxdCMa3xhireFNHeqCB41azCs8Xqc7aNXl4jVc0mm1bgppwVeZbHkqIM6iIlIg6I8+b0w21yT6nz5uP7/EvlZ9ezaWnisrt0UNc9/QKXG6QrUTUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GYzyqiMS3WsIAkX+/4RiuVDLaIkkH6lTzekhetucJl0=; b=QFykjqOJkZw3pZzw36s6P6JsN72aLtNAJhvJO+saX4tXU09VRXvOlUJnvEhVhDp94Hu+kfGe7dAAXGSigwrKibTBosIPt9LrnfCp4zkWwKRf4gff3TBxuvBEnbG6hT8nzTXPYo1fnbzB9TCtAoRXUSunhpBpzTeJBQoSLcxGgoI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:37:57 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:37:57 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 7/9] dmaengine: dw-edma: Add support for chip specific flags Date: Thu, 14 Apr 2022 18:37:07 -0500 Message-Id: <20220414233709.412275-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0789dc2-eb62-498a-ae20-08da1e6fce17 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6pztZI49HC9Bt6NjfHpSgIy2mz+etyPmIoc5yM5/ppPF6E2fk4wU6w/oAAWy264GjaB/rgGIThqiGLHY32rp57Z4+DAIAnvub8ebl6ZX57SB6579P9msK62kh4lDqlFGJaZFGkJL7QU2oTC1ylhBOb2MlHoFKURfr5BMONJOROG0x4gXjKwKS6k1unGPEfmgUIlc5FlowjD5CpmfLGgn/YkF/YfyMXkn8HVK8eSWffFVCqj5u2mdoS90MWvpr5Jj+t2n1TDyi5pXOwIO7Xo9au4W7fPIIsn2w9aE/Ty7EVZ3+fvYFTdMQtKwtNo49w665OJtTcZvOHXLPwZTtAfGtjwPtB7O4KPd4QCQJ89o87DVB8AiCgCDk8CHRDR4hE660rAojY6bs0V9mKkWtCOMeTnXPopjUwQkyEptgWIUTVtVb1uxQQzp4Hr3FNHiJFzUmADZ4s99VMObUa/PiiBagB2PHFZx6i446MFgoPWxGcwpRnoy7KzEDrC2eY5ADhcTS6yiDap+71117IliP1oMLn54qA3ib+u+scKSe2auJmy0polGjWas9oFzJgHqj9CPIq4vgUJ2u2j/qcVAqqrN6e5iX4bd9XBUQICnVmikrYAQDQhmE10zrAnOQg+DyKgwuxFiLeMQxP6WkYhL9lF6RNJtFO2jb010LKaWQRo+oKQzXXtwCm9asH/s7uZM5CjYlCXcM36fFPMRqEh1TesLKw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(6666004)(4326008)(8676002)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RNf7P0Yhpt6gC2JgKvFPmHjKf3gDyTJfcqTMH6lCPKsNQe385Ty9zQ2EeS1MukEmm3/NiWagSX8Vw5IP3vsoOcpo1mq17d/w+Gx0qGKDii1lRYzT8pQWCha8IVE1Nv0eUMwpxqkyV+pvcUnL52c5IPAyRUMwc2sa5auZIEfmMrujm7g19dS8Xl+MD/xycV6qo0q5Ja2Pf+jbA7LtdDGE14ib5OdNQ62rmXnyzxQIYyji7sNdnwM1AwocuVF/lJoRQl5MAGU5ocgvlzoylJzLkSLWKn1EWyUAMhX5EdUNF/k1sSaT/nS80nK433XSbLtnl5xOS0LaaslPrwu3dcgud8EZ8U1TBxvOW9o6Z+6F4kszbriFxmgmO1yTce7s/E1K6MwwWGKzk9PmsVGJjniOmev7wr7XnTiROXIjX/G8+7rz/bduTBDdJ0aXYij5G4D5DWxvVJUnjoCaEYTgTrQHY2lSSKQGNrv2TgDxbQI10g6ZGEVaVghyZgkVFs+6MIKqDfMGB1YPACBpbu9RWUHhIl86i7ZeBA5ST8wJVBqdBB6WYDxE95GjZaHYrU8sNrsO2qO/OZuaPMbGXLqQ2OYTD3wTcxsAPczPGWErsN3j/nUDAEJQbmBfxGEW0DQpouRp2jS+l8KSMxRdXFbsuZeAdz/vPRPT20WMIjeNqageSQlCw/BN3s991rVVOYI5rlW/Lhipny6aXvkSj97xUASoF8fJ5iKN8uP/sQvI74gatMPgtc+i5Bs5vCkKcl+IMa8WhKG5IoK+aHBWkvhvlifJvdlPhNprYvLonM3USRXmBhUWTFooT1eFrDdEu49Xbs3k3dXG4p6OvW/aYrIeNRCjUeprW7tRqCqPGcixcu5zA/dbW3i84fHDqzvvElWxezv2/yc2gLEXVltScZUNiCK/bPCH3UzzaFiJ2r30C8DeyB1/yayP/ANlEaJSONnVOKTHb1nIntZJsinnawxy+TCjBhZT7pKWLZkr9y/UvQt9M1cIEb7p2BnXO8dfOEDqymodlBwxVKTGvBDzvJQ3AH/giltdu5Br7IrRWgzdX1CCsUAZy7IKtgQfR7Bnz12nST1M6eyYMh4oGJhIm6rvyRWyeV5TbiTduFNi3rnnDeG8KSGD5ZdfcmLA+OSzeLlPyqrV7g7kYEYKPAj4ZifLVpzfXdfaTX4OyKQeQRbj0nqQE05UenOx4vhnBE1FAXC6CV0MZdvExjl45FK40sw5F+89tAr7dS/4/B2b+wmSMll78rI66SFExZb2J/3v0ll9EzTkdL+xQClXyyvaJ17yp+vD1ZBrVePcLcFut0Iv3Fp7HXKFw3E0FIm8ZJo+MW9DttM9cZhQTfsUvWOYhrUaDBPfFejVpb7VF/8thTxD3BiEPBIXAMmXugKwMYLdywVmH5NODMfXekFc389qd7MJiWjtgAjff2Huv5fzWSR6xu96zvDn0mUXDfdu/Qj/2R1XI96PqPwJmiIVcZyIj70xzn7kSKpZ/jt8svOyIaxgYxtnygBembXOieN4OSaiSp6EL/iBo2ocSqaFYoBxffWacbp0ixpJ4cxAz1iVQ1lRRHpW8UHIbvf5n9rHY3hMOPnJnDy925mcuutAd7RnmnWGprlpvP8oUzshPPOa/fvtvklNbrCxmIpqWCxdv6knWFTNWXdT1GuMzwLNxI7LByRlKQFWu7TwLarQK17lNUhZE8vIWw2P1gjEx6KXu0M09DeIfpL4LiGenH0YF1xv6gcXgzTgXg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0789dc2-eb62-498a-ae20-08da1e6fce17 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:37:57.7801 (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-CrossTenant-UserPrincipalName: 7f2Xbl/NXKgS31IBc43LQxD2+WinP7wzJFC0X82knYf7NkwIzmUwiEz0uQZUgQu6QlHL5R1xFij/khKZeCpnEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add a "flags" field to the "struct dw_edma_chip" so that the controller drivers can pass flags that are relevant to the platform. DW_EDMA_CHIP_LOCAL - Used by the controller drivers accessing eDMA locally. Local eDMA access doesn't require generating MSIs to the remote. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v7 - dw_edma_chip_flags to u32 Change from v5 to v6 - use enum instead of define Change from v4 to v5 - split two two patch - rework commit message Change from v3 to v4 none Change from v2 to v3 - rework commit message - Change to DW_EDMA_CHIP_32BIT_DBI - using DW_EDMA_CHIP_LOCAL control msi - Apply Bjorn's comments, if (!j) { control |= DW_EDMA_V0_LIE; if (!(chan->chip->flags & DW_EDMA_CHIP_LOCAL)) control |= DW_EDMA_V0_RIE; } if ((chan->chip->flags & DW_EDMA_CHIP_REG32BIT) || !IS_ENABLED(CONFIG_64BIT)) { SET_CH_32(...); SET_CH_32(...); } else { SET_CH_64(...); } Change from v1 to v2 - none drivers/dma/dw-edma/dw-edma-v0-core.c | 9 ++++++--- include/linux/dma/edma.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 8ddc537d11fd6..30f8bfe6e5712 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -301,6 +301,7 @@ u32 dw_edma_v0_core_status_abort_int(struct dw_edma *dw, enum dw_edma_dir dir) static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) { struct dw_edma_burst *child; + struct dw_edma_chan *chan = chunk->chan; struct dw_edma_v0_lli __iomem *lli; struct dw_edma_v0_llp __iomem *llp; u32 control = 0, i = 0; @@ -314,9 +315,11 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) j = chunk->bursts_alloc; list_for_each_entry(child, &chunk->burst->list, list) { j--; - if (!j) - control |= (DW_EDMA_V0_LIE | DW_EDMA_V0_RIE); - + if (!j) { + control |= DW_EDMA_V0_LIE; + if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + control |= DW_EDMA_V0_RIE; + } /* Channel control */ SET_LL_32(&lli[i].control, control); /* Transfer size */ diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index c2039246fc08c..5232d3d198f88 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -33,12 +33,21 @@ enum dw_edma_map_format { EDMA_MF_HDMA_COMPAT = 0x5 }; +/** + * enum dw_edma_chip_flags - Flags specific to an eDMA chip + * @DW_EDMA_CHIP_LOCAL: eDMA is used locally by an endpoint + */ +enum dw_edma_chip_flags { + DW_EDMA_CHIP_LOCAL = BIT(0), +}; + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * #flags dw_edma_chip_flags * @reg_base DMA register base address * @ll_wr_cnt DMA write link list number * @ll_rd_cnt DMA read link list number @@ -53,6 +62,7 @@ struct dw_edma_chip { int id; int nr_irqs; const struct dw_edma_core_ops *ops; + u32 flags; void __iomem *reg_base; From patchwork Thu Apr 14 23:37:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70B46C433FE for ; Thu, 14 Apr 2022 23:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347731AbiDNXka (ORCPT ); Thu, 14 Apr 2022 19:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347738AbiDNXk3 (ORCPT ); Thu, 14 Apr 2022 19:40:29 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60067.outbound.protection.outlook.com [40.107.6.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6388BB939; Thu, 14 Apr 2022 16:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S05tx4M7mrGZOs9n3F5CZiodFwlenjlohMjJK0rp/IyI9MW3D5CeWrvUNoP7K1oGELuYN0jfjT4DV3PUG1IgfqEQsKHTF3kyXZBFcrSzailTTMg7IlXujt0cgOS9NpuGHOcKdq1u79EXzZV4rdLl3lP5rJ839sTIMkZrBsrY+dwQ1ZOChqtIxtrdQemelWDELJJjKZX1PCRGkoxaP2oR5MPw/kVJHTqpPYF6EjXHl09TuRk0XDGREGmwtgGHzCYNkejt3Ug8brSq1HA/RvVecrUGjPKBkj7VfB0L4lEKAiF+UaMWlytFMDGD4mUY8p309LBqQ6AtM7pvE5KHpuSLxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=X7r7U0c5ltodlcnRhKLHNkFCGg6VcYEysbUeGBFxFAg=; b=NnQSBbAnnblQgyuvmaPru+lr61ZrBctxMhSYT9W8EYHhfrt1ro7LC+6iOln2LYrO7DJcYwK/5rEdUewkyR8MyHVsm/7T/wtAwyDEMA4lIHDDakLqb/vv8sCi8CbtCkXr1VD5mSHyDLXsU4tdZYYFDY88hnqu6JtLc0tqId66U4ouPe5izOj2FEM6T/jY4ZnyucfCHzHScu6vp5YwIoFuui9FCzDEejwOXk0Q7+gujOANAPBnj5hHMXluF7qK9yVBJIS/xmCvYTHzp21oa5LMXmgRtccD1xw31MnANjtJVTTEL15AMpkZ8vXZ71KKU+381Po6nEtfq/avuZK9Ljy1uA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X7r7U0c5ltodlcnRhKLHNkFCGg6VcYEysbUeGBFxFAg=; b=fQifmModtwMJJ2Yq/PAS5Fcq3iZCSVkLMwCX6f38etjJix2Oy1Bnwmn1HWwDpFf10mqf4LZHSY43hiJtrUFnhnT+O3fyKdfKGqNuy+NiVO01n+piMuSKMRZGU+GW4emUsRQb6Zh6LIhUWZZmJspU9vIS3bQfh4I6j6/IM0pWbkI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by DBBPR04MB6043.eurprd04.prod.outlook.com (2603:10a6:10:c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:38:01 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:38:01 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 8/9] dmaengine: dw-edma: Add DW_EDMA_CHIP_32BIT_DBI for chip specific flags Date: Thu, 14 Apr 2022 18:37:08 -0500 Message-Id: <20220414233709.412275-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f8b2419-f22b-4d4a-1163-08da1e6fd084 X-MS-TrafficTypeDiagnostic: DBBPR04MB6043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6csiAWmTZUAfAvaJGe3sM5QRB7KkLAohsFsyyg/t8QTl/HFeXbdJdiv4zYL8sQfzMx2THO6U6xGEY1wyiHBh7JhaC9McO3YBDQMUFJGaRKf3h55c+xxIXU2zJ/aKPXqUxdG+w+JM97V41LPkyI918hDFfC1ySrE0TNfT0GuS97czfbOWM1Eg0RQDmHiC9kMu2RB7X/scd6+XcNnHTqzfY5bPDO70ju10IT5/Sljv6WeVQDdGceLYiRupJaLhzJfl3xP5MWVFCCSC1zm1puostXUhuhIsTwi0H4WIeT3oc8Wb4taTrW5tJ7imXu8sTIDiPx/J5zphpHCYpjdRlrK3tlWEA4hs5/X9sIiFlbsr5XBJ2vbolQDhQ6SJosKmQ/dwdiPB4uPnOdHNtJjPSMZa39KegaXNY/MTp4UfCmJ6+BDramVvdcd+H2+88hWBulgjeV1UcBz1if6lo+euSC4Kv0vorCKVk7dccwHYr+sADDBpt4tERYtO6i3MFJaFfZdNvHI6Ct/sFM8m9+H32VTSMqLMlmtDkJoXmMA6QawHZgWl5FgrJexZmMtBp2HMV3RoX1UOwZ6akH5zkbFAldXrocuF4elnnOnIdIeYhDOMCITDVQ8Y8aLK1HORi//oFTCe8MWanHiPgz4gWOHEiTbYAvDsIrgydZQ/EgKPCEDX9B/19z3balvR8gjq9JlRbs4BPeCwa4Wbs8+WdmqPXnZAYQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(5660300002)(6506007)(8936002)(38350700002)(83380400001)(36756003)(38100700002)(508600001)(6486002)(2906002)(6512007)(4326008)(8676002)(186003)(316002)(86362001)(7416002)(1076003)(52116002)(66556008)(26005)(66476007)(66946007)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AKxtjITfiKj9bUjOK9HgKq7ie1D8R1KPOgPpp12FhDgtkN+B1eOZ6RZwH+81U9UhpFhZpBRLqjjMyFbC/FfTNUrUCAwfA/ZYzxF+2ZDE0cf/Wmt+SK3x5LJIOpsQrS/V+8fRZEM8GYd7jxR+FPB6dytD/TPuq7ZT3Ha4Dqz8k2hTvKfxJmyKeJWWb25D/hZl4AU6VYqjnzR6sSpUrQEKGvUHuGVK+hfGT2nfH4V6BxgHw2dMzkMaR2Cw9WK3yD7jF6Bu5BQvZuM5eJAr21JC52fDWZKyVGw0YuOeWd2AiSiUtMWTuvcRp/yuP3koKaWxhmwwVqhs/BwEU76McNIqHZGwBAmqbZDwgT+PIPWj1ml7mKL/RCps9ni4Nznj+MhCUkmHyaW6NaEFRb2zCNJwk0PiqhG8Bc0xrW5UJWRNqSOmLpbKetbiITM0wrDl5iRPV7+sf7hC/s80x5Rrg3NzSmVxiYH/RI25hOm2yFAp2x6bcBaH1qBg7mSUORZnzwIJxLx0Pa4vmDTAC8FyUshJ6/GO4v1e9jiDUqbYJOPZ8Oh9m2mhxrnwQGm8xoxXW3EtEkg6DDwcd27P8E982gSMTTMXGvDFw4B0rknxuj489a91+tBPQrWBehOr9L4Q4EWRTfqdezXKrXivG+bpwXAqE0HvbkDJevmTW56XsyZ+L3bwAkLL7mir5p38yi2Y+T0uiH0Wv4nmH+PsnHM/Mi0yM8nERj5gYOdV3wiqUo9V0QtrsUCHhmkNYaHvGbR+3aeA0Wm4MKds42ELB2b5MI8VwwFue/dBMrUUMG7v63ZuMamIPWtF4LJXvX6QcJwxX+quo24b5SDvE+jOhadBL0uUUfQ3LQlALMonTyATjRVNRUaMDZ9nGoHlrEi/JAm50MWsqRg+rzlDqSr+mRviQu6OtM/EqjyYRNonFiBmaQLzxr02vonQmEzve2arLOzlQZbCIPi+3Z+04seeiLH0omDiCM+mU8umvkf8gyUEa2t6ym6X/U9QNZrlhi7ssrBCWV2tunHj7jIil3G/qKOrPkUmNxTpZtfu/m8H4IAXgKUEXt0cSo/YikLWiVakqTqkKwdFbrenXc6RCPk8tJ0YvFFDWG3OG7ALJ2w4+uFRKwz9ltpK0uiTznnvfe8neeTKLnRGkJBq0GLJwhWTHHNBa4TC2xQtdJPQKEf2xoVYGSd4KBEN8tPLBNCey1v27+Lfuo1zQr6XOuoP/E1TXjsiMLu3LElwRS2Xj/hjuwVmIHWBuyootMv9hdHdzrVXh/XF+ZprFEemzE+q0R4P847mo/6ml2thHSO5XfZGF+npwOwPHA2Uim/RJSjznKmTu5Nid6fhCMwA2de5sa1Sif6alhNTDkrZOk2o63Sa4761zAZEgy2LcS6lORMkB+dL4iOcCQSNdaPwXHJckGX+ZZLSfZ9abuAntUjE/KkOsr5BDOg6Q7tPEDXB+LK4YMUOB+vWi4PoSvXJ9kCZL0B/HqPS05hRrcHBlq3f0yoYpAUIwAFDz/SZR08azExjcwNh63LWB54jj65kFOouVubtC87mUBxye1YYnUfwewij1DzgEXxkaEdxNCeZBA7c1XllzUknYZd3rL0dc7rmNhoj1p4WgpozI5HYI0xKl6dnZkOsiVfkF3ca0tZu8DDMC/88Ynvq6oubW78hFcC9CSZjpz18W5bB26Z/WXul/QTBotbqRRaap3ULVD32T6Lb2AngfomDFiScC0fxb7MSOKE3eaxcNCU/Mw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f8b2419-f22b-4d4a-1163-08da1e6fd084 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:38:01.6428 (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-CrossTenant-UserPrincipalName: ow07T7AAAxvZuuVOlbdqbBEn0Hz258LNLxHzPFkJvS/ZaEJ5JOrKPvtWSdrXG5o5XCC1gc5s0mqETpvuXKmVsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6043 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org DW_EDMA_CHIP_32BIT_DBI was used by the controller drivers like i.MX8 that allows only 32bit access to the DBI region. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v7 - none Change from v5 to v6 - use enum instead of define New patch at v5 - fix kernel test robot build error drivers/dma/dw-edma/dw-edma-v0-core.c | 13 ++++++++----- include/linux/dma/edma.h | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 30f8bfe6e5712..b2b2cbe75fe4f 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -417,15 +417,18 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) SET_CH_32(dw, chan->dir, chan->id, ch_control1, (DW_EDMA_V0_CCS | DW_EDMA_V0_LLE)); /* Linked list */ - #ifdef CONFIG_64BIT - SET_CH_64(dw, chan->dir, chan->id, llp.reg, - chunk->ll_region.paddr); - #else /* CONFIG_64BIT */ + if ((chan->dw->chip->flags & DW_EDMA_CHIP_32BIT_DBI) || + !IS_ENABLED(CONFIG_64BIT)) { SET_CH_32(dw, chan->dir, chan->id, llp.lsb, lower_32_bits(chunk->ll_region.paddr)); SET_CH_32(dw, chan->dir, chan->id, llp.msb, upper_32_bits(chunk->ll_region.paddr)); - #endif /* CONFIG_64BIT */ + } else { + #ifdef CONFIG_64BIT + SET_CH_64(dw, chan->dir, chan->id, llp.reg, + chunk->ll_region.paddr); + #endif + } } /* Doorbell */ SET_RW_32(dw, chan->dir, doorbell, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 5232d3d198f88..85df746659c0d 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -36,9 +36,11 @@ enum dw_edma_map_format { /** * enum dw_edma_chip_flags - Flags specific to an eDMA chip * @DW_EDMA_CHIP_LOCAL: eDMA is used locally by an endpoint + * @DW_EDMA_CHIP_32BIT_DBI Only support 32bit DBI register access */ enum dw_edma_chip_flags { DW_EDMA_CHIP_LOCAL = BIT(0), + DW_EDMA_CHIP_32BIT_DBI = BIT(1), }; /** From patchwork Thu Apr 14 23:37:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12814149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EA72C433FE for ; Thu, 14 Apr 2022 23:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347738AbiDNXkh (ORCPT ); Thu, 14 Apr 2022 19:40:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239685AbiDNXkg (ORCPT ); Thu, 14 Apr 2022 19:40:36 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2074.outbound.protection.outlook.com [40.107.21.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE911BB93E; Thu, 14 Apr 2022 16:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sy/Sb1Vu29a5o5UYw0y0h3SgUcw5he90dOHUF6ChsqQnluOnDdP6XsMtQvLsm83qONdIum6a3TyK7ATyCPbgyvusnvGRnCUUfHfMTHZwsBkUphN7rIMgAl7qksSykFlUX2guNVGZgQkXgIuJyGeJa6ypago9kSznMqBWL3LU+Yx/bXGbUohRZs4fMNecyXiNYemTMLnfR5N79s0+MQ+kw/8OgJ2R4GniaxMqo2Vpsw/vzGg55nIKP6Yj+iwR/YQGJm5DH/aRKcnNygDN6xQpfogmWFAOTQk66ilrXAPFbqtBy5znU4G2dEqCl74Tbqx2LRf6HqE4oM+gENtSKiIC1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pn1d7cVWoyxCwrJyzGvhKmS7ivgnjxhrbTi3k68JI/k=; b=YS1mP6lO75eruiiqJXiBQPdMHvezNqRMpzVvVB3M89YOleRLOyyalPXoBSqwvwFcM1CrkjBryA+D9uVeGqWMcUN5DjczAfMs+66BiYsaTy7D/bED+HTUBL/O2FIT92WJnyezmrSiHLnIFn76lktp/iQ4CZKAG72mtE6Yj30Sj1MgtgnGdk4uBcCxdv9gRGGRrMlX9MjbRkvbqpLvA6j2cxQn1r5+T3FsiAJxV2s3OHkZlvsk6kr4Kom3rdqiqNgustkEZd13NwNHu1PwbzrAOf2DrS+GR2TSXrOa5S4wSZyy0SZFiGUbFGLqXbCGUVU8wtclgkMhs+mkg8jFjk/13g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pn1d7cVWoyxCwrJyzGvhKmS7ivgnjxhrbTi3k68JI/k=; b=f8nNkBOpBoWGoqdzeaU/3FgLGTBVfRxP/iuCU+pvxP2Q0/2YTjZUY2Ehk+9lvXgRHKp7BuVNErNfC1VQ3cgAM9DvN7BBx/8rp1tGKROirAhqIzTrvdrzj/FoIOtyQ0kgPOfQZY4KJZ/TDzJMD+XTTcYune+hE0SPICblzIze5wk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) by VI1PR04MB6046.eurprd04.prod.outlook.com (2603:10a6:803:f4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Thu, 14 Apr 2022 23:38:05 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e13c:6fb1:ca92:d11b%9]) with mapi id 15.20.5164.020; Thu, 14 Apr 2022 23:38:05 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v7 9/9] PCI: endpoint: Add embedded DMA controller test Date: Thu, 14 Apr 2022 18:37:09 -0500 Message-Id: <20220414233709.412275-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220414233709.412275-1-Frank.Li@nxp.com> References: <20220414233709.412275-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR06CA0045.namprd06.prod.outlook.com (2603:10b6:a03:14b::22) To PAXPR04MB9186.eurprd04.prod.outlook.com (2603:10a6:102:232::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cffc9318-8aa5-4ca4-f4f2-08da1e6fd2d0 X-MS-TrafficTypeDiagnostic: VI1PR04MB6046:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9RjiWoXG+Yqpn2Q7wwGZ9t4021v228tOfAxBmUmOD0Mf5M7OTiRvh9SYO1NuYGOjCU2NTPvbLCWD0RXiFy6Q51AtKRnzvk8d2N2wLPqbepNa4QCUYZEi4l3cShgnYZ5vUmrknjWdpQPKBIldg5PDT+KLJz6pNyg37qIEHzTmeQ0s18QNXgzhPJupf/tXPw9s0c1MHcBk2W1jmVkAcVxSW9Zr35VkWMoGscRcshOUR1jnafh5guHLJHCj9dKJGaord6sVYWze/+f4WHKPq9wqJPFKRiwHpSg1LreWfm6cYRMC4PfTE8kB9rgyOv38HfqOgusU4Siy6Yy7zlFNT3XjXp6c+nJ0n8fdS+MDqAXbgLnvT6Q/mXef0HGUPLjSZRABv3gY9Fb01n6uLWZERuMkErv5BvKfEfl0bYdRu6QV27mPIb1cpsycngU/Y6JiVmiVKwhT+iWAuNUmtxL0jlcz/gmWGP8kPjd/3h132LUvp/qC/YPMSMmHlLryLxxsGov4BXDGkuuoh/MHYZFZlmc0f3otTgV5kyvswDtg9bZPDDIdjoTLkyct2YzU9mbfxbbCpzSv2/tASE/xU2pVLeshla+W6TC3XlpN1eslvDEkldTqGkflnOsYD57Qfb4i9jWf346pthA4vqwnKWYeXxfYQZH97vfecWhh830yK5fhT8S7bGUJXgyQ2aCRxP3rgnPYGoKp4YL/elNGo5wXZ4akGA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66556008)(83380400001)(316002)(66946007)(8676002)(2906002)(86362001)(36756003)(38100700002)(1076003)(6506007)(4326008)(7416002)(38350700002)(8936002)(6486002)(508600001)(52116002)(6512007)(2616005)(186003)(26005)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 42B85Pvm8FNqWM7y910d5X9Dy1Zsh4KaP50GdYH1JKu4oOuhuDDJUoUOHN8R7teqkww78cizTEh1DzlXg3DQGUlcRikjlZgxOjmvdb23+k4nMSf0pmZdcT0MNirv5d8TYgevdrH1XkkjMFfKT/vSxQ9nb+qyDwQRuYrq2lVh7ssrSUTxqr/QanQh4JIvtXJheAzknB/1dO9HyesAoq+pTYxUD4u7O+EjD6yUaiuZnZ7laq2RbM4eykEJzyiybg8IRBP/L9GJUktD+c8zfcrgfaLF7Kke0ofg4jFTqMzYDLEqQmzRCBIXoH8ShiGen+CVaum/u9V1eZ+hky0Ls8VaOY55kXDnvv/RpeXC+zsjnbNUBs1yHvm9rA136wXYXNEKnRSVmci+gCYBEm3qmLpniu2OGA5u2R8YrZf03yc6hUqphEJhCUsGTzHS5E93Ded07gGYkjuExCTh2E8lD310CbWYVBm4aOwkAhg0M4JgJoS3iRotYF5BHJWTAJw/0r1uIaQBEqkjB5XKip6xyOlKUJyiw313nOGl0avQDN5jgii8M2m00Djgq5QYe9lBeDYxCu7ZC4bhgup01Z834lc0NQK/Iggjw1JvKABBPMdp86S84FbTabCDr9au82hvHf3/r2926eVhjV4tvbEQ1Zx6hvGz4EvANlrP9PlnDtB74mWhRIgfKdaaptqT0uO/AR6/b6Hbtpbqfoor6SAcGc1VN65OKMv/+LUn55bwLRWw1ZhzQsWz5vCUCwqvdDuPg2eCQlpe4GS1uy31ecH+6oOfncwG1vKl7IjkQ3HtVZmohCgG5Q+AlJa8H/G99mxP/WXj4wiW2e6nti9LR+2/xq8gtIxcsbtf+36A0aHyM+4vG/i3P6s0azf7yfXK6UO52iK0rqVhh3pwbaHJ2cVppp6hgAGjbNNwvH/APE+2RyNuVDjhozkuuZ97/GvUooEhpOuNHTDj8v/QLeiZVGOIzsgijSwQL3zK7halnY8pwgPxnda+JzddEk34nVxIVeCwD81XGTXkoVIvZB1YybI+vT14A6oR6/QjYEPKn1Li8u6w0/f9tI4THlzyQS9FaVPaU54TxZo20RNIsBRvrIvbKI/HWFMfhhHM7Lgt1nObwOf4piVxepWqXymLmxsiGYwAXCZmH5vFw78NvkcFIuNLhApzyQnyWNHiiXvcWr2KHkvb9fnHHMCFubM4rmvtj9bTaNEl7Emq36dSfolIC+GezI1nVgOaYwFoLZu3WiYHZkZ0zxFTXq8j+Al6JxNCtnBhoNh5aFtf+4LAJnvXbgYXVf4niEWhxfPCzi+kYcdy+x6GtCjbN9SlNYpnDLwIfgXd6dzzTJ+46DKCewv/M4TPTuISyAGsxN0CCrWFn50nRMOt5EsA/gUYhEF6YqQlu2qY5ShvozQDDO1XYWTeurvPBs+zuZTFW0xnRH+jD6T7RMevErTH+STl3Iu4armlOyODFQ75+3vAw1aLmm44wLBmQAiEynGLDdCIQPJ40zBQbhb82H6/05ruFJ/fjKoL5biYNE6uwjBvOHM07lgoGq8g7IBLYLxTdpQac/6ty0FWEM4JryHNDChxNrIHPazmBSOC+4UI20NTOAgMCq1vG7mQ+gfobgyULBgKQi42uYF0VtmB+7WLEuQGOcbE++OsjKdRs9o9XKTXca/TzOMIv8E/URJraXdc2Ri/lKsxE9QiCu8rpnuMART2MqU/dLHdM3JszKEMjLIF15ZrVcNzZ6c+FMSY7A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cffc9318-8aa5-4ca4-f4f2-08da1e6fd2d0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2022 23:38:05.5021 (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-CrossTenant-UserPrincipalName: +XMdcm15CaBETbXObSPbEjbFUbKK3Rn7NBCfc6Z5wx4Rk9c3jHWrkuCyM5Rf99vKytMSqOdg0c9YM2Ir4kzypQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6046 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Designware provided eDMA support in controller. This enabled use this eDMA controller to transfer data. The whole flow align with standard DMA usage module 1. Using dma_request_channel() and filter function to find correct RX and TX Channel. 2. dmaengine_slave_config() config remote side physcial address. 3. using dmaengine_prep_slave_single() create transfer descriptor 4. tx_submit(); 5. dma_async_issue_pending(); Tested at i.MX8DXL platform. root@imx8qmmek:~# /usr/bin/pcitest -d -w WRITE ( 102400 bytes): OKAY root@imx8qmmek:~# /usr/bin/pcitest -d -r READ ( 102400 bytes): OKAY WRITE => Size: 102400 bytes DMA: YES Time: 0.000180145 seconds Rate: 555108 KB/s READ => Size: 102400 bytes DMA: YES Time: 0.000194397 seconds Rate: 514411 KB/s READ => Size: 102400 bytes DMA: NO Time: 0.013532597 seconds Rate: 7389 KB/s WRITE => Size: 102400 bytes DMA: NO Time: 0.000857090 seconds Rate: 116673 KB/s Signed-off-by: Frank Li --- Change from v6 to v7: - none Change from v5 to v6: - change subject Change from v4 to v5: - none Change from v3 to v4: - reverse Xmas tree order - local -> dma_local - change error message - IS_ERR -> IS_ERR_OR_NULL - check return value of dmaengine_slave_config() Change from v1 to v2: - none drivers/pci/endpoint/functions/pci-epf-test.c | 108 ++++++++++++++++-- 1 file changed, 98 insertions(+), 10 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 90d84d3bc868f..f26afd02f3a86 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -52,9 +52,11 @@ struct pci_epf_test { enum pci_barno test_reg_bar; size_t msix_table_offset; struct delayed_work cmd_handler; - struct dma_chan *dma_chan; + struct dma_chan *dma_chan_tx; + struct dma_chan *dma_chan_rx; struct completion transfer_complete; bool dma_supported; + bool dma_private; const struct pci_epc_features *epc_features; }; @@ -105,12 +107,15 @@ static void pci_epf_test_dma_callback(void *param) */ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, dma_addr_t dma_dst, dma_addr_t dma_src, - size_t len) + size_t len, dma_addr_t dma_remote, + enum dma_transfer_direction dir) { + struct dma_chan *chan = (dir == DMA_DEV_TO_MEM) ? epf_test->dma_chan_tx : epf_test->dma_chan_rx; + dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ? dma_src : dma_dst; enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; - struct dma_chan *chan = epf_test->dma_chan; struct pci_epf *epf = epf_test->epf; struct dma_async_tx_descriptor *tx; + struct dma_slave_config sconf = {}; struct device *dev = &epf->dev; dma_cookie_t cookie; int ret; @@ -120,7 +125,22 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, return -EINVAL; } - tx = dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, flags); + if (epf_test->dma_private) { + sconf.direction = dir; + if (dir == DMA_MEM_TO_DEV) + sconf.dst_addr = dma_remote; + else + sconf.src_addr = dma_remote; + + if (dmaengine_slave_config(chan, &sconf)) { + dev_err(dev, "DMA slave config fail\n"); + return -EIO; + } + tx = dmaengine_prep_slave_single(chan, dma_local, len, dir, flags); + } else { + tx = dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, flags); + } + if (!tx) { dev_err(dev, "Failed to prepare DMA memcpy\n"); return -EIO; @@ -148,6 +168,23 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, return 0; } +struct epf_dma_filter { + struct device *dev; + u32 dma_mask; +}; + +static bool epf_dma_filter_fn(struct dma_chan *chan, void *node) +{ + struct epf_dma_filter *filter = node; + struct dma_slave_caps caps; + + memset(&caps, 0, sizeof(caps)); + dma_get_slave_caps(chan, &caps); + + return chan->device->dev == filter->dev + && (filter->dma_mask & caps.directions); +} + /** * pci_epf_test_init_dma_chan() - Function to initialize EPF test DMA channel * @epf_test: the EPF test device that performs data transfer operation @@ -158,10 +195,44 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) { struct pci_epf *epf = epf_test->epf; struct device *dev = &epf->dev; + struct epf_dma_filter filter; struct dma_chan *dma_chan; dma_cap_mask_t mask; int ret; + filter.dev = epf->epc->dev.parent; + filter.dma_mask = BIT(DMA_DEV_TO_MEM); + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter); + if (IS_ERR_OR_NULL(dma_chan)) { + dev_info(dev, "Failed to get private DMA channel. Falling back to generic one\n"); + goto fail_back_tx; + } + + epf_test->dma_chan_rx = dma_chan; + + filter.dma_mask = BIT(DMA_MEM_TO_DEV); + dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter); + + if (IS_ERR(dma_chan)) { + dev_info(dev, "Failed to get private DMA channel. Falling back to generic one\n"); + goto fail_back_rx; + } + + epf_test->dma_chan_tx = dma_chan; + epf_test->dma_private = true; + + init_completion(&epf_test->transfer_complete); + + return 0; + +fail_back_rx: + dma_release_channel(epf_test->dma_chan_rx); + epf_test->dma_chan_tx = NULL; + +fail_back_tx: dma_cap_zero(mask); dma_cap_set(DMA_MEMCPY, mask); @@ -174,7 +245,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) } init_completion(&epf_test->transfer_complete); - epf_test->dma_chan = dma_chan; + epf_test->dma_chan_tx = epf_test->dma_chan_rx = dma_chan; return 0; } @@ -190,8 +261,17 @@ static void pci_epf_test_clean_dma_chan(struct pci_epf_test *epf_test) if (!epf_test->dma_supported) return; - dma_release_channel(epf_test->dma_chan); - epf_test->dma_chan = NULL; + dma_release_channel(epf_test->dma_chan_tx); + if (epf_test->dma_chan_tx == epf_test->dma_chan_rx) { + epf_test->dma_chan_tx = NULL; + epf_test->dma_chan_rx = NULL; + return; + } + + dma_release_channel(epf_test->dma_chan_rx); + epf_test->dma_chan_rx = NULL; + + return; } static void pci_epf_test_print_rate(const char *ops, u64 size, @@ -280,8 +360,14 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test) goto err_map_addr; } + if (epf_test->dma_private) { + dev_err(dev, "Cannot transfer data using DMA\n"); + ret = -EINVAL; + goto err_map_addr; + } + ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr, - src_phys_addr, reg->size); + src_phys_addr, reg->size, 0, DMA_MEM_TO_MEM); if (ret) dev_err(dev, "Data transfer failed\n"); } else { @@ -363,7 +449,8 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test) ktime_get_ts64(&start); ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr, - phys_addr, reg->size); + phys_addr, reg->size, + reg->src_addr, DMA_DEV_TO_MEM); if (ret) dev_err(dev, "Data transfer failed\n"); ktime_get_ts64(&end); @@ -453,8 +540,9 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) } ktime_get_ts64(&start); + ret = pci_epf_test_data_transfer(epf_test, phys_addr, - src_phys_addr, reg->size); + src_phys_addr, reg->size, reg->dst_addr, DMA_MEM_TO_DEV); if (ret) dev_err(dev, "Data transfer failed\n"); ktime_get_ts64(&end);