From patchwork Tue May 17 15:19: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: 12852611 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 A7FDBC433FE for ; Tue, 17 May 2022 15:19:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349833AbiEQPTq (ORCPT ); Tue, 17 May 2022 11:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349822AbiEQPTq (ORCPT ); Tue, 17 May 2022 11:19:46 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80042.outbound.protection.outlook.com [40.107.8.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CFF737A0E; Tue, 17 May 2022 08:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QTvi+5wbkUTW+Xf+ehgueBr3oP4JYQCDgrXUatGRgEZMeAxU9zSXJJiKZt7qJmvgimeZlusSKJuu+5AWeo+bTVCjmpJa7XS/nk5qDfu/W7qtrsfSVKEKazaosSweVSnZbANcjGOqIplYQH7fVOTtU1LtdNCk2duPcs+ZZiobnsiHewlFoBvcxbZFX/eM2yXxmho2CGiO0ErJH5yHsOfDR8SsTphVxmOCQaFPQ0HUL01w59ofKPL0EyCz9woVmYhCVIFz/Y10TNMKpKkkZIj7X6nldYckMXniJmOWU2EoqadDkcm46nJS85F2KtOtjVAnjcZ2qQedHetwmBbuIeYPRw== 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=+ncTV5KYenVsTqJuRXLJ7swaY6VyfYire7r2DNqTCHQ=; b=KgUBboFonMbhHwQzxroplsvOlxIIGwGmFY4OkGLiDi9Ptd8ruLWNiBRetpQZmrW/DRaUAeDF+pNJ365/JoAypFszyVuavlGHBGigQWJ3+kS/pk8ilWMpIKq5QmEpSFtGEeinqR3qmgusOxrB7k7MnpKjdjf85BxQQIxsVXUAJnRL6k5O64w0e2oFLRTg63GQlbAb6+xxwxsi5smaQj2wQkwV49f+JJCpjV5bnykceBPDZBjQ/29S0J7qikx8xz7SiG7ROjsy9RQId9cPIjl2ZgCXE8TTJWGc+v2uher7qZsVUpHb6gvfjb42FnAbTykiV4ilBGJD0fHHz2WuzO4ctg== 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=+ncTV5KYenVsTqJuRXLJ7swaY6VyfYire7r2DNqTCHQ=; b=TO4n4qslUnnZIJV8Z/KDOcD/PlFQfhmOaRKIzZsnY3ssMDNZCjGM8Q5Y0Jxq+l1RyQwVgauVpsOlociXIaygChJMwFG00rmA3I5FGi+/4iybsx2LeNrLta+83HF2uWJA36xV7p7x9Q6mvCSk+RkOoQVCnDBFI0f8lESoJKbrQLM= 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 VI1PR04MB4367.eurprd04.prod.outlook.com (2603:10a6:803:4e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:19:42 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:19: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, kishon@ti.com 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 v11 1/8] dmaengine: dw-edma: Remove unused field irq in struct dw_edma_chip Date: Tue, 17 May 2022 10:19:08 -0500 Message-Id: <20220517151915.2212838-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: 608adc9b-b109-4514-dac7-08da3818aad4 X-MS-TrafficTypeDiagnostic: VI1PR04MB4367: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: 9I//+aWrjH4jjr+POuQLJF2n5ibaTd5d72QahqFiT5NpshBCXV836S0Izbh40o/t8qJsC6IElY41+AIsyXjxOISbaNbcnn+KO7q/PKvz4CZhMjt7acTMFXAaQ1ZovRpvh2Tx3pqToAnUZzSnkNxcKi2D2wn5kk3rYANpNUu8MglwHKf16+mYDZpLBBH0QAoBGekiI+5jgPNGllA/ITA5DBhS0tD3yAYcBPpXSHybnNdFEeA8mY5DKZToYuTBxsA0SdAjeRNsR2vcmHr8hYVj2QNtygXlxCLjmhUK+EIskqJmGcBmyWETUWVIv6qrRi/cvG1op2Gyq2DWEFpVqkbt2ZX60Tx8JRRKpsk+U5BsEm5rayjcKE/AaEmhjUukH16k8i2bmKVQ9EdiORO7K7mi7XEgJUlf1IN4t2kMUQLDf2sbktOqi8sc+jK0w5RE7P8K6Ps/W1oY1Sxxtza0AciYkonDCyNEkAD3GUTbgi1WE38Ci1w29TKse7szww7NwRPlnJjAcAofVQEDCnJW5Mhw/t2eFE1f8QmSGe72jI2icsWHIyPisFyksmVhaXgPvL2wG79oHMAAn0zy2Syi+Zh4ORDFq03q5E5NZsr9GL3tlPIwlEUINV/tIWYK/U4V2EvvLrWIWrWRQBmW2FLVJ2b28Pey4JGCcJjK9DXvqsCnWYi8hS0FlTpXxkL74HRYLz++68Uc+JX30tsscx02JfZtDncIU6jmw86Vh5KRgKVbues= 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)(36756003)(6666004)(52116002)(86362001)(83380400001)(7416002)(921005)(6486002)(38350700002)(316002)(508600001)(6512007)(26005)(6506007)(2906002)(186003)(5660300002)(1076003)(2616005)(66556008)(66946007)(66476007)(4326008)(8676002)(8936002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0teCgbw9zU5sMg4P7QFt5MDJzr/4ncJZDQu/ljCDzSeUBhjWLdvCy1O4J0MDOtIFkgK+FymAdPc1KPl+nn13AsJzYSqQijh82bsm+1TKGDFvZ/QlHwBHcdIFBPe7w1hEqRVoHGJe7O4x2ZgG5p9oPpZhsxEvYkqmaz/Nia5JtY++KBKoUyHSOWaC3B/zxZ1+bmR7GaMhlfONEmtrTgWCNPrwUihXu6HRF+C+nFOzzt2PXGmHgksVX78T/rgLz7i+Q61aPFtIIS1ZW+J0JmGctNLUhoNq5P7HBKmfwkpP2an3wXW3KjTey46xVDNdGoja6fz6Yh2zy8vyAZ4SttNLu26+MdfM9PmGM2J1UtqP/lTzx+74m6jCH7dGK141PmrV6dmuw5jN3nNqazCv56eZMFxqFd6aggnCO7f+c3830xSdu3t7wivZj+CqlCMWwUN1YXBuyRJItiwtF+JYMAHMRVTcR4PIkqYLLUpSNl7fn1zcF+35kJczBMPmg8wQ8o0wWV19bWEDlMih4RewV7sQVvMuWVEh8J+B8cx4jZybFUsG/G7PYD/aaOgXPOL42AI5nLD/E3cqCWRyKbDaXCd2Q/lSasiEMv/BBI9sLN4mZ7yB7hbvZoRFIiZUBXE21Y74u9Mmh19Iqn1VcFdnXYP/K5Aba4EAuq9BVHcbyi+Cquvw1s0JHjdK2XeImzrCUVY9lU0DVv1wF36UXq5BeM0UBIngDUKE+jfGKCSIbKOoeD2NkzyJmDXvSNb3Ry51yRUjEb5oanuZTC6QxkrJVJiol7u93SvEnchbhTbyubax4E36vUTQQORFAnm6Xtdxujb+BxF9nW38boQfoVns9LHvNH1B42upqwEedPE4/XP4XgrHTfazLiJS5zz0Svro4HCAt/CFrYlKGJ9W7cOREaf7vsW74KT/yXtJkXILcP9L4ihyx5IJTXxkghzhiS2FQs/I45aPC/oge3BQJbhbm2zY2P1fyzOE0dg9yVAopigetPa5C8yCNtfAiXbq6nXgXCm43l1/1x7y48e9Oj+4ThDrR9PmYRlOx0cqtZMF+v1xSe7YA5yKHE9IrKkUp8hTy9RGzShhPi9v/J6y3zYtQv+4rAwKAid5ZT+QxdLpiRHVk10sKQiK7L1uUX8FqC0jJPu1uISy0IKJn12Yx97Cc0qusUpLSE/W6qp7yCHUiLlYDQaDbghPDdQ7otmsmH9gEfxPjKDfGEjBfWWFPDO2Bh35oEA9kubj30rs1qzqNLukwwEmxejmD4VOheAZwJFeLGbRmsEfAdqfaGt6qLvn4LCIC6340il8gzUz8KbLp0BYWCVItzw6xtMUn5Lc56Sumw+KYbyUlAyE2xpZjtxLbX5qIC0M4iLhUEMjF4plvL8nmdlUUnflixj49qnL9AVuYLw2hbZto6S9rvjArvavftYQs3fI+FjzqhjZxP/UkZJ5G4erYIsIDbQKmfz2Tjoe0sd/L89hmAfULNlfiSWRQad1Hc7choCLFJNWzm5Gv+B1ftC/JLIK0Sg6I0ZkvCxjwAXUXAhuFvYYTtYE1/sUu4I48R+wNyPQsJjaesuyupAmbM8OUhTsweKjDPYwspcUvKs13LaK+lG6BoV9r9NdQ8bP5GJpejylRyFjqCvbk59VkrRlnui/6QCyzcCcNAEXzMyR258XFaTehYcYnMt7K5PjbOVeEGDc35sss5iBQK5Fi01fLIQkRrBlEh/GemCYZUi37Ep4n43VhdFxAW/i3IfXgw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 608adc9b-b109-4514-dac7-08da3818aad4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:19:42.4355 (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: WfKuYBjY5P5t6EUvIRZiV4tunWP6YZVHm2VB1ndAHLnjhHAClzd7NKsfgOwEhtyX8jcrBRbrVg1NpWk/ORdDGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4367 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 Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v7 to v11 - None 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 Tue May 17 15:19: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: 12852612 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 C0116C433EF for ; Tue, 17 May 2022 15:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349805AbiEQPUD (ORCPT ); Tue, 17 May 2022 11:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349851AbiEQPUA (ORCPT ); Tue, 17 May 2022 11:20:00 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80053.outbound.protection.outlook.com [40.107.8.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77634B845; Tue, 17 May 2022 08:19:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Usa6vSGM16JpT4VLaLzVnYYh3UGT9HEM04k0crDGleRAk+Jbejnyp/pnl+ty/kn2W7j8UrIzi+PiPXEmpHVU4SvjCulbn7appZV9QIK7OVCqfk27fge8kKXc/U1ymi4rDfd+6hcc5KqIixGDrwNfn960A3Gs392XbKUpBDO9awkJkVjaieUZT1bd+4gphS0l2RyxK4hyzEYhOOw4nF2vSUt1kFpx80WZYCLLL7Zg2yFFcIE/WAdvLnoWGqZr6pZhM7NZ7CBvCOqJZ0IJ+ea6nBVHJqBrdKge1I/23s+ds947wl92MwuDzo1GhRYhr+pzfqJcpp6twt7t0UD5CQZxSg== 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=lNsnWN17H8FFuplmmqWcaEZIHs7Z0YoaXskvE17F5bE=; b=VbXhpZ9+JuFPYVekKSTnsZ1qfWwLbZI1o9p2wXfqAw7FYyLSN7FxOXxIEP6umtx2n3ePBK222ghGBUO4efJW0UIsup8KdqMwzIbXOUcJRNQEwkudS0zTRAmnQFU6zCQ1p9xv2XeCvsvolaFwm7zEbpc0A++oZXCk2/zJ7U30kHtUKPGue9v1dYwbuV4qRXt0FqEabs20rOKtjnKujr7tvI+9Uw0Df/ZS9NbJoM8ehWgHWldJTI/bzSd1ts+ZVn02n83rRZC5PO0qWws426Unxdn6xAedbzoSa5meLyDPMS3ZLV3TC/dTQAqKQ4fpRcysMAj424SZRcVaVQONMMJ+OQ== 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=lNsnWN17H8FFuplmmqWcaEZIHs7Z0YoaXskvE17F5bE=; b=nqEaUZnMRUTAZS48UMzxB3d0yu7vAhGgOJLuCrVlvL18f27AmzxhtusGow+cu78ZssVoHFh27radzc6C1T/dokV56X0UhxQHUS8VK+1DCzSXRMC4lcur+zvnFiMQWszmaQr99R12vXi8d7/ZU5NkzUFrILxRjvZBCS31kI61y5A= 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 VI1PR04MB4367.eurprd04.prod.outlook.com (2603:10a6:803:4e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:19:47 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:19:47 +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, kishon@ti.com 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 v11 2/8] dmaengine: dw-edma: Detach the private data and chip info structures Date: Tue, 17 May 2022 10:19:09 -0500 Message-Id: <20220517151915.2212838-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: 03005563-f345-484d-218e-08da3818ad67 X-MS-TrafficTypeDiagnostic: VI1PR04MB4367: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: gzRQllM72PfGoJV9w/NHvS3a7syQHVd9415y/RARjl//7+Sf7mgzZ2P/GkM4fK+FMGgtd8RYEhSVJ+Rb+S1Fh13lgIDXPboGDAW8Vbnxat7OF6htdH1jqxhNQpACX0DzCvXIODAXgvKFJOQfz4qiPuzPfr1G9FR/3H2urWmAYGP4H7VQYLYlYTIl9y4Kx4OIF+23Cs6CkC/c0LlFxVALp4UJ7iNBd2P4aM57uq7j2mLAAwZFbC6UPH4pnoB52FRrOnYsr1ClfOwZlOHr+/4cwD+To1/KJtlCXJ5LR2mD5rEhET8/ve0npc80sUZtc4qek3LzHynMCrp+WtIqqk0QAmwP1upMwo8HtnvqT7bRbdFwVXiAdhxoug/lwTAGy6f/Mjp7BCRhLLE0DUydVwFd/FkPsYRdq9E7emCpmDG5aT8YLYcTUiJgIc4ARdM5sXZVRZKg8qLDFZS+rbD59DDRmDitRUUEpv6xsxNt8yQSouWfnJq9V6aFkuMete6w84nvSRzv09AMgu9MbjILLkKTvScR9rKAoSlJ6Wnq/jlpuvgf1GJI3k9sV3LrHgW+gC5V2hb2q91PIH7Fc6i31cZwcNHe2Bt5/RQlHwiv2bZFvHUm6TE88aduN465kYMVkrIfFiQ7okO+yrwmbRkgNDBbZTgAFk7dAnijtoU6ljW+Zxoe1osEz7iqAIHd4/WWNYs2aGgRO070BhJTTnvjdodHiRnA8uRab96RiWG+MoJEp2Q= 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)(36756003)(6666004)(52116002)(86362001)(83380400001)(7416002)(921005)(6486002)(38350700002)(316002)(508600001)(6512007)(26005)(6506007)(2906002)(186003)(5660300002)(30864003)(1076003)(2616005)(66556008)(66946007)(66476007)(4326008)(8676002)(8936002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k5ARZPVOMazVriFJeuj+a7WsMH9yblIXsp5NrE8voPXtOSFtzYOKoPxU1ERBBL4/d86nWoVH4qCe7FXZbKJT6hcy/zkSZcWpqLzoMN4YEDSGVRuj4vMKgWpcVBvjU7ls6XQ8a3dYafh+SzZru4fDe9i0KD/TDWZqxn88tYsxf3i1NukSlnIRVWjJkCJsD/pgDT55G4nbfebzMS2pfHL8dTiirbvx9o204Fcs3/MQV2OtbVVr3Hp/ks1J9J27BSLXVQxMOWma8Cilnrjdd1l61oGITmNo7gZ0IkizTAScWZ9Kp66FFGyz2KI3kd+aq5+FAp77zCXtU5tcE/11uuwwU7ZtbCP2eLJvv8g0OlhLmMh5I8dlxiAFvJynnKUfKZhf7hejPOrYNvvodtgCts6ayiyf2JRXcMW37RmnZGV7oRRXfS6438Yk4aipUfsjKaZq7zGufMs7J0RGlb/8jlqWcGBJJgwmRnQouKuHrIES+hfAmonK357qFUScpnggcwFDY23OBv+xBDACY/ESRtYzZnr1IR9bfqiUsjy7eh/9jPXQZ5gMils8obS1s9h6qKlcE2s5qFrLPq3FPPLWjr15UbOExmhtWp24g2sByVo6ujc15tdz4xq/jJbzrb/9FunghNF78DGjzWzUgsasBPzFqLRqQ+tyMcemhPZ3pTsEqDbzGLQKt6BrNa/H1BtttzGfPPrgIF/7aqL93xkB5cWwjEF9xHI6SB/Rm9zq+MZrNV8tw1onaWk/tYVcKyuYGha+XLJqQgbT1C+dvoDMFX6buqhZ6B1h/CFAUbrEKiVJS2bY8K19yQyPFB7HCMgKC72LjirWHYCnJM0hoHcTE8x3wkkn8Gh7MYJK/ds9KeEH/SWpDxIR7Nc3oWDG6pZcUOti7oaD81GKRhr+/2aZTcNq69xCBII/uodUFMEo0hOD3W/L1thfsikmRr4JJGct/nTw8irzCetot3v8fnXA/mUT8N6KGD1bA/673kWIvuvxqBwXoVl6F6viJ+MMqhlglmbrs6oloCQeb4O+ELsS8+ESBZ2tTclrJcU4O0IeA5e76sbJ8nx/MuNwh1FLQSapif/oDMQpCHRjwYeAlVpbUOgL/taLTmGZISt9sERZWTrov/xNpaEs0JCHS6yDMw69jDgYOA2A4h0FOTNtruoxMxKMZYfI+OKMo7tZajItb2HDjBG2yeS+5p5stwPxzs0xF89z9HHP/imtfzb1FfrroKA2/Al7MMWYkouScj33bz8jMe7zEBy2GqsVTgbmyB50e4uk9xFl0L2qj4lAqKib/OscEZwLon6duE65IsKVeHnFtvrapNSVkerZgD1ewCPWzb8dR8qFQ3DK1IxeLW2etELHeGWW/oS+eKDSsafcD+idtbekSpCto9U1ysLqG4u3spc6Ia8RgCOa043TkJjCUqArHBAYa4IYLjhjSNWqxF0yVIE8xvYSFmGGG9YY38Hj2aF7C9XEignFWiJLS7fk62Eam3d6h7h5YbVIfysErliVsh1Lrxorgi3x5XQobtcJ8qqdy9BCQ/2+Ey+HSWF1GOglu/vUibq/mY3tCrwmXgJcFJVKW5ehMzrPbgUiozsCmy11EDt0fcInVDAadJtEZbL/3bMASKqUxnDmxk0QHHDAcnT/3M2Jv11pwWqKbzmhEXYVcIlFkEKcQFvtvo7tA9uvURRyUT8OQotpVeNIkUmikjAmikxbIaeMTWPldvZe+8ecFtLYowRzVqv/vw+pRT3AHQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03005563-f345-484d-218e-08da3818ad67 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:19:46.9371 (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: RlqN2GzO43aLwm2bJWTCjFafUTn9BLHHFfnwTTfku88YOTA2rSC/XsmP9tbVqC2n9as85gChaY0tOSBhYzr0fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4367 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 Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v10 to v11 none Change from v9 to v10 - add doc for dt_region_wr/dt_region_rd Change from v8 to v9 - remove chip->ops check at dw_edma_irq_request() Change from v7 to v8 - Check chip->ops at probe() - use struct edma_dw at dw_edma_v0_debugfs_on/off() 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 | 90 +++++++++++++----------- 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 | 18 ++--- drivers/dma/dw-edma/dw-edma-v0-debugfs.h | 8 +-- include/linux/dma/edma.h | 46 ++++++++++++ 8 files changed, 163 insertions(+), 148 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 53289927dd0d6..58e91fe384282 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->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 : @@ -902,20 +908,22 @@ int dw_edma_probe(struct dw_edma_chip *chip) return -EINVAL; dev = chip->dev; - if (!dev) + if (!dev || !chip->ops) 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 33bc1e6c4cf2e..999e038961866 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, @@ -435,7 +435,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 */ @@ -505,12 +505,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); } -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); } 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..b765adb969998 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); @@ -282,13 +282,13 @@ static void dw_edma_debugfs_regs(void) dw_edma_debugfs_regs_rd(regs_dir); } -void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) +void dw_edma_v0_debugfs_on(struct dw_edma *_dw) { - dw = chip->dw; + dw = _dw; if (!dw) return; - regs = dw->rg_region.vaddr; + regs = dw->chip->rg_region.vaddr; if (!regs) return; @@ -296,16 +296,16 @@ 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); dw_edma_debugfs_regs(); } -void dw_edma_v0_debugfs_off(struct dw_edma_chip *chip) +void dw_edma_v0_debugfs_off(struct dw_edma *_dw) { - dw = chip->dw; + dw = _dw; if (!dw) return; diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.h b/drivers/dma/dw-edma/dw-edma-v0-debugfs.h index d0ff25a9ea5c9..3391b86edf5ab 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.h +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.h @@ -12,14 +12,14 @@ #include #ifdef CONFIG_DEBUG_FS -void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip); -void dw_edma_v0_debugfs_off(struct dw_edma_chip *chip); +void dw_edma_v0_debugfs_on(struct dw_edma *dw); +void dw_edma_v0_debugfs_off(struct dw_edma *dw); #else -static inline void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) +static inline void dw_edma_v0_debugfs_on(struct dw_edma *dw) { } -static inline void dw_edma_v0_debugfs_off(struct dw_edma_chip *chip) +static inline void dw_edma_v0_debugfs_off(struct dw_edma *dw) { } #endif /* CONFIG_DEBUG_FS */ diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index d4333e721588d..86697d33e0610 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -12,17 +12,63 @@ #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 + * @dt_region_wr DMA data memory for write channel + * @dt_region_rd DMA data 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 Tue May 17 15:19:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12852613 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 4EDC1C433FE for ; Tue, 17 May 2022 15:20:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349838AbiEQPUD (ORCPT ); Tue, 17 May 2022 11:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349861AbiEQPUB (ORCPT ); Tue, 17 May 2022 11:20:01 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150043.outbound.protection.outlook.com [40.107.15.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42864B856; Tue, 17 May 2022 08:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O72gi4qEPVCcqh46NiyEkY5VFmPVTjaB9oJnBOAn0FtXd6IdFXbQfS8vXLwvXL/LOjkUP3jH1sSOaPC+DRXgzL4yFPRXjAvHKDb04egpUmXuFd7pbI1jNqtvBeQyFH6GFmFwWQIeeyzJqtGTTQZaLjgWbkFOFnb7kcLqABG9IDcXTffczDJlB5X9IcYKry/eUIgcfRNaSiERmBv4naft1fa1k4YBt6VP2g4IIdp8bTxPgdfotQR8uc+lmGPll8ucTmlwEzuBE/ANnamqbE+5zOM1r9Yzw/e9C9KR6QJLs60kSp69iXjRlDD5AAPI5KuZg18CeaHXPNbYQ1qvPY6+Jg== 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=nvCC0s6AMnUQAuAKBzF++06HQkwR1Y07FxRbcP9jh9Y=; b=N8t1/mkxn5jFPqWLl0r2bzcOdk7vQ6VYECbytCM4istG38CO2Grb8yoYQeWC+As0IX6YhuviIO+M12aezZy0yJCzisp19Nk/skfXJ840LOfaRE3eBA6Fd5po1NI0C3sDATJgamLx8zVVh56Mf2kzhprVDJs0eJZsf5Ub/E7V2CkaUoR112bT8mPdtJuPNxgasW5msbSOtLRQ6aZYJEBH7VA8Tw09DioMmcgN4giC6vk+ByohV2MxmVMDjiObLDz5CV4isAokEXNFmApILZRq5ScF34kNGOfRSk8x2ibwSHunDPdIBAEuXMc4+rlXriT0k8R27QRpLtJInLpO+DYqAg== 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=nvCC0s6AMnUQAuAKBzF++06HQkwR1Y07FxRbcP9jh9Y=; b=SUXE2DhVUqMkfw56WaI4tPi4DdFvgvUGvbjeVDtmFICux3frSAyASu7fXRGq2peYv8+nQ9tILWKBm2RzoZgLceVu484PAVhxdPgFvgL/sC2m/XFRE9Ii1n/nk41lxp23AJA1hivJZ6nFI0M3vUJOxIhWJVVvy25mb100thxznEc= 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 VI1PR0401MB2285.eurprd04.prod.outlook.com (2603:10a6:800:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:19:51 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:19:51 +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, kishon@ti.com 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 v11 3/8] dmaengine: dw-edma: Change rg_region to reg_base in struct dw_edma_chip Date: Tue, 17 May 2022 10:19:10 -0500 Message-Id: <20220517151915.2212838-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: b7599504-bd4a-4817-d624-08da3818aff4 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2285: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: 01AYUtx8wz11kR3StMzoXTNz/duS6F9S1Hai4NZ3DmMx9I/8LOU+SS8WIaOdd4EjUmhD3AwMuUd3IjY1XjMLeDSbAiZ12yleKlBVjqlXkFZ0LYDg3LZ9NlGFE+dr5g2JcvF3CKVl+uTBXa9Aj2gw5LygvfeV++JtQsE26l6x0IQVBV61ge5kz+e2mmzgsKuSmFX9DQ7GN9uZAz/L/ORwUh8tRC4lHoL7Bo7smDB9jvPsr02TXXhP/vStTuD5ksSOoV0g132jZ7m++qseYOOgT5qPqUM3bSr8H/x+qW8WpfR0Sa0BXL3RYY4n7uUfwKBDNIRf3anObO1YCEvHmznwrsQmfbAIc+AdLocPDr5k/69SdaZfQqQ/lFxXvDVmNGFFdkZQSZ/fDbatGgkKAPpeGgRanDFsnwLqFzj2lgLf13kBqF6JfA1RTjp9+QOoJeDAdTZcZBmuslyCfv5L7/oMs5xx0ho4OWL+sam7WauwVnUiksMHRuYm0GQPHFwtdV1+bnv6uAXM+jE5JB63iX+f6cmtD9Wxr4DevW//4l5eJzBc7GYYJJvy5I+gaZzF6aXAO/qWg0dbqWcPXZ+yD+oeL4ciSxXCieeWeQoihMBISdGDPIFYM+oEMKE0QkGw1VMq2ikgo412dy2ppsXBV1d57ZY+CRZPDpD2BHDB1Eue50+5lR7OXs1Zl+wzTCdpgcExPmOnCc+L/dlbEt6AmoYXh0DSGGK9Cb6+MIjEqwo5sG8= 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)(66946007)(6666004)(52116002)(8676002)(6506007)(66556008)(86362001)(36756003)(6486002)(316002)(508600001)(38350700002)(38100700002)(2616005)(1076003)(186003)(921005)(83380400001)(8936002)(2906002)(6512007)(66476007)(26005)(5660300002)(4326008)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZE/IaRiPQ2phhvqqt3LR3tDwnW4KGaZQgzyV/Phx61C3HpnjhorpnTM+6GfxNBV+oA938oM3blNNyqCEedsQTzNdyCUkwqARkC9pxbICvYi/pp5XqfocctukoZfORsJdkcb9lZ5aUKgoIz4yjhzg59+Id0I7Vxim4eVGlNWbQQIT7rXN5c8BrRIMkjGbn5UJxidagwe92Ns3oFfm7jG4mzpchCvPy1HmZisfS2vtDHMg0AX8511jbKXyNJ2sXqxXenCxla7BLy5ak+ZvRV3T5MJ+QHgpeQu738oUjb0JPCWb6T2gWhdxFselnnLJrQ1f1cAqAslKJ2qUQ/hgJm3CB121hl417P3sCFOQejeXgqRLBUYhB2brnXYV7C3/7N4hnDNkCR0+LMF8f/g8KIKqLHAAbekd+IBMyKiNtwgEpb1I4e8bZbc+KoIDZbyGxcUGVpO3BX/82dxbJO9LHuavc7efw9VkIXEyB2tzgMA41s98G7dZjFjlPsaVcNm8D7l1LgEKyHpVkNOL4f3d/3vkAGQae9PL3fFY+ri6FA2IV1doxLD3Id0FH3c6wSh5LTP2vogQbsM0k9AcPd32Tf2ZVshmb+kfLh3yqYDyw0YKBySwDF6ckHOdYbOKrhgP0ZxyTu5SD66SyD2fuj4/3ZdpKmpQXkbwLclERiR8AG8TfvcPkyFFFTaZsLBW7+sp96/+uuePWx8kmD1LN1NBstukpbjh+LWsHqBy4KIg5H+M+wsFHCJmnW1vGEj2i16rJj+7L3cBbzRcQzvBflU+9ZtntXjekHn/K4m7nzl7jRkoDhW3RiQbAwxWTl5DIq+qa61AyFeZpS8hMhcwadRgP+7tL37GM/CvcJIs5myCEaArtivz2YCEa33XjxJYjhuZf43OjvrFrjDoEEXMnW6ib4DutERGfGlHYmV40p8lA5WXdtvYLm2ilgsyFFnaDz2OVN239nowIFe81V1jOhl7lNsKz4tp1WzcP0WqJhvkcE3WlaXgsnzZk/gdFZzeLR3r/Sx6b9enTaBteHnJhDwjhSCjGGBYMfLfVvRtuuAr/CrkiS7RAdn6QlugEFvBAM6WrB+Uih/LEp9mllupf3ZSS/C8VGuMTle8AaCdzs8wrqIR4oj+CNvtkehdqz3OH7sq3sAt71bXoU2e8L8y4jxVY+4N8BuTW6itHqQGGJXmU4VA65baE5GmjFI8YOHIYljA0kgJawqfd6lV9U6lJ22k3V1wllQ3VndX9rX58nYJ57ghwwcx5V96lrDCtS2HYV9q7OJtXnGxMJvxQkekc64xlR7RvD2rphNEFEM21mUEt7QYbNwNnZd1w+F8ETqSKIqWCniinSSYPaH+nztubnFoXZRV5K7POlh8XCIkV12jJvQ7/WcXPmY+ixUrwFpQXfITenjExL/DmjzJ92pNsDO3pMIFLlqaBVai53PLbL3Svp5V5a/wf5uySLFzT90FQOzkM60h71yFqY0DK/Euo27cbA3YNAYrUvfHwkc0sNUoP+L3wCJG/Q7+n4YRwi5iRkgBT7APHSWh/aDo87iPfjLRBjmpovAJVZ0z2dZito/7LSGBqeZyjhqMB9S3/beO1tSIJA8zi5Lb5rWEFg5bncsrAe39pf8Bq85Dr1L8T/SGdwocGPXfRhVKYsqL8rWeAZX+Xf7Pa9sgCHfzPrXyR5dMrtTPTEPm9njHIyeHfBNOd8LSc1yY+5mtbo323Lvxsige9KG9o1XjQ97ADqb8bePTOp9FYg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7599504-bd4a-4817-d624-08da3818aff4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:19:51.1899 (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: SAj7EdinG43n2cke00ZvuzAa6nl2S5Kaew/+v6YMuBZDldYIVyWkEqvJGXPmgXcF2cbNVR2/BbodcH1tc9Tgkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2285 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 information. 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 Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v6 to v11: - 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 999e038961866..403ade40c1b1b 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 b765adb969998..5226c9014703c 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 *_dw) 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 86697d33e0610..195ee1e47f21d 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 @@ -55,7 +56,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 Tue May 17 15:19:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12852614 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 E418DC433F5 for ; Tue, 17 May 2022 15:20:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349834AbiEQPUG (ORCPT ); Tue, 17 May 2022 11:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349884AbiEQPUB (ORCPT ); Tue, 17 May 2022 11:20:01 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150072.outbound.protection.outlook.com [40.107.15.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 549C74BFFB; Tue, 17 May 2022 08:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iE+xoHnSqcBXOkJxs8GPcPZzxo56YIz2ZENNriQgczWLiOFg0MqgeWoC387Zk7z58cQefyIYmtDkOXglDqMv6MFLWANX4iemnEzfXTwdGE20inBg2HsTym5bq+JFHPOIYh5BV/sWg86craRHTWjb0n8FyjhGuXKnmpqRvYgWsE7N9M+F4uaDN62HAI7B7TI90GCPx2mM0jQNC/1XEG1bOd4kDFpxZEpM8hhEUmVuuYrULGax8gQlWYbKl3yMuMja3ABhM4QUAWN8+X2wEFUxPBSN+1xU6Of2XDtlqDBad5IaDEwKpM0Ea3bFX0FqxIhdWOXz+HjpF+rpq+4pIuMPQA== 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=5YxEu1DR2+kf49JzrRx+aDqnPOyVjwxZ9oBTDJzYZUU=; b=XaZAL5fn3GrJSsaKwt/AabBi3uJmLsioud/6FUFIlyT0DvTaKqvizs6zrLXWkGVtjrHkFtxJ/A1cwPVg7QLPaQP77U7pis3W6yu/PFO6h5wfsuMxVKF/c7xPVx7jRyjIW9lgtsWkThbMAqUezYQAAis0ICFCpoXaesXgpI4+TuNuQcy7xIeCAwhXnErCD0uUDNlzYoG6NJk8XGBcK/eG7XCxaWHjHMDZKlT9uRgNWAlJ17wbxJV+Y7zHw+0JdcszizIpOPDJYUpD3ekRgUDqlOnda1sYpXIvO/Vj/msKI/LGgaCn4/96uJRdQwbmFhX7FDJ7hThMtAx0BQ8CC4Qwrw== 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=5YxEu1DR2+kf49JzrRx+aDqnPOyVjwxZ9oBTDJzYZUU=; b=JgONn7TShE78up7eqIvln8xL9JgYyOymVo832XEapHWMEDPbx62hlJX1R97dl8OrJIVqgRw/mktBqD6cJK7QR3RnjY+rbl4OLasDOaKtQlXAXRTJhELsjmUq41QLGs/ViS2eEvX8BsuA5bJ6S/UlK1E31cNGesl1ZyIYlWRy5Ic= 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 VI1PR0401MB2285.eurprd04.prod.outlook.com (2603:10a6:800:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:19:55 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:19:55 +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, kishon@ti.com 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 v11 4/8] dmaengine: dw-edma: Rename wr(rd)_ch_cnt to ll_wr(rd)_cnt in struct dw_edma_chip Date: Tue, 17 May 2022 10:19:11 -0500 Message-Id: <20220517151915.2212838-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: 8eeafa70-4870-4608-534f-08da3818b295 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2285: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: 4trQOMZsw//g6VLgE3N7sUxVmvrinP68YC2UnY0vaI1ckI+D1EJsGrVwgkvR9LC1mbtuIJrSIEwSl8ni1TItsXBD6K8AvhZnPBpOtb+gGXevw2zqIowHai3jpAlVc9y/HjoQSqb2T4IEGF7z/ON75DpLS3PL1SSqQvegfOyp4FPAbGE2AucuQK3MHu+3f8JALA9UelYrDLcHiGsntiwPr7bD5exrhz6pf8sIegGd56XpjvgF9mMvKWQ+3zQkf48JkgjC3WO7vZRwiuzXYH7nr2uOkuRyZrjM2YVc2LEyG0LkTyx2ejQaLExc4eRcg/QG/qdSUgnoLc0gbO+PDGxyEYPCsUU4WOjjw0EeFnvAg6rH3+k60vjoYxNjTsjYlge67HAeFyhkMHRqG+NTukFTmUC17tAJMiqu2NMPTdLGrfzDktAgWgn8cjka36nghyQIt2dWLvgNuIpIAQ354j254NXj7ENUsKACHonkFD2HzzMMTleyNiWDBAEvgOu2uoaSq1MwERU2cHEXwXX5hsmi/ibGn079r//tnV7eGumIC/yz9coLFueDsfRkmWWvVQPd6tg+oc8NaUFMMrKTujshWtxQjY4n7q43byARyth1DyPl4p69vHltSPQHoQDLvEkmy9uZyduMW/TDblct2KP+KzbCGSQzLNdsdIRw5FuKwv1+gC7AOJ0iprkYNQZkqyJPMwCH6xfdwVBPtzju21gDr7iteMUIRFBCEW2i3exafS4= 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)(66946007)(6666004)(52116002)(8676002)(6506007)(66556008)(86362001)(36756003)(6486002)(316002)(508600001)(38350700002)(38100700002)(2616005)(1076003)(186003)(921005)(83380400001)(8936002)(2906002)(6512007)(66476007)(26005)(5660300002)(4326008)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mzGi9j3IPyFg9TihvDE4wy7RtUw92HiSvDJaQhQnJmdSpnJgUcPyur8H8oDrhhOTAc2isFCe/zDp4iM/Fuy9MlNWX6nJTttZ0t3dKP52BtAs3qmQ61FDsSAVFZbIoBAffFU0IYtzg3OOCC1QXkojpmMeePanx162zOgjJ3gZbwcjHuK7Z+a8xNlnzsz27t0iT7wNg7/humjOm8p3sW0uY0NXIY6UmzfhkXODJq3Ga+7IsvG+Tqg0I0T550heGdsuiwTqNU+6uWmeSkxx4sUX/sVOqEInbNyLXsAn+uCHxrvqfMnr5BZYxFvitP154k9x/IX3l0DQo35WIrh76x3PYxDBYCgqr7MBAxMBDvnJ7v926FVnl5Bopkdak68zBEtAskeyh5D5JRqK7UDdOQ62PCOSnEF2hMxnNPwdbSfMU1uSLSK7CR36AZCBAZCf1nUAqc0M6ay2SJlIT+b5MJaxRV82wz8JLZ6dvdKXk5cmEIBqnervFypotrwofZ0MI3wK+czEg/dhcWeJ1+LmbO1y9sLox8lp27bk91H7uVfqrIa6iCUr3n6kjv/Un9NGtW/XICGxjc/V3nzaIBIpN8gZzIVc8dfanCWbOWLcPpOUuyeTpcGBt2IBNj84B1uFfkLL22NTXiqNhNxkp+t6XWSUhkBWmfdnbnh1LgE59hVI8MDC5RpouLJ/1bVT/QiiGr//xvjA6gRpkVRwLbNFkPObbQVS4UeiLNiIm97gDylvYdmLSSKM4s/avDrgHMAlXFY0/ZvacyeqPF9t6WhP6f+NhoxikeaF8/R5L6U5gmGhyXq08telg58mJsz6AhAvYRkdgWAPSYA869fo/sBdNv9wFPGmE93y777DA8CIZOE6QvB+Oj41MwzVLAL+MVNVe2Trt/eeZVDQqpfLxWliv4DF2rjiAlGxxY4r9wLK6jGz7qBPAFhAh6zSAhCTFnooGvTYNi3G61TkGjy3gfIXjFTKA1MS8ctMmt91n4iZq6t+FVsLBLNtxkKXkeL/4eeOEosmNmF2YC8ZKQn3Pn/bR2otzC/ihqBh9Ka9Eto5GO0PcFS33t4n1z9TWT1V2kWoe9r9t0lV6Va3fEUg6fWVeMmTnnPHSVsevjKQkOB46fKRPOovW1i/GXcudV8Ma1AX5+LbNrfm4cHNpOKrHJvXrcPcr1e+UPdgyIAG1QBRXnkzwQ9+RxcET080UOhy4+Hq72+Jsfr0qAZnuw1RcC5k36uDTXOPWCh1JWqy5ob+Zdhcr0UkI4bgf+9zrVWyaJckjlVFisFbXsFHgada/lqNPxzMcYKRDzUqrZGGkENES9jqOu2s0PAGS6f4uoU/rfyiUIKVaASg/FrlZwkKCeyAhxAuW6DyvPfR3s7ZHnCzGNECHjNCdk7geJyD1L1bgA8EBeo7eh1M+ds9NBOgOuYm5yrX1XNAY7BptgdyUeelS5/UMDKZCLzi84d9j7UdotcqWyv/3LIxC7COIekf9Aq/qLqPonYrqchchOVGo2hgNIeaT2UxbnB2t3Q9fChqjbUQB+2XP4lNBNlHdJTDpdj5oMkuOTPOyVJ9eIy10tnvmq3xDtHVzfSje33wkOe9BLnVQ6S3zcsLem8l6aemPGhhqySXJwmqSkukmX4mBuWhL70Hnw6p3bfn8OEGIIIOiYkh79HgiA0ObL03//XA6m+bCjKnoC0ugEszFTpZ9kws93ifQEDqETaZUblP4AVVg8BMIr7LY9nMHnc8JmFkshk/b/VLAg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8eeafa70-4870-4608-534f-08da3818b295 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:19:55.6610 (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: 3NgHV8KuNF7hgKpa6Fzg6bvotsUnjK8mxUi6X6zA+FggUF/+Z1nBLhu9+9ZOJbCAVrWO13Ultz9akbt9VULDRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2285 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 Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v10 to v11 - none Change from v9 to v10 - Change comment for ll_wr(rd)_cnt Change from v6 to v9 - 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 58e91fe384282..1ef326f7151a3 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 195ee1e47f21d..c8b479f1d4da7 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 count + * @ll_rd_cnt DMA read link list count * @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 @@ -58,8 +58,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 Tue May 17 15:19:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12852615 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 67F5EC433FE for ; Tue, 17 May 2022 15:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349854AbiEQPUG (ORCPT ); Tue, 17 May 2022 11:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349851AbiEQPUF (ORCPT ); Tue, 17 May 2022 11:20:05 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150050.outbound.protection.outlook.com [40.107.15.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EE153B579; Tue, 17 May 2022 08:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=labGmK8gLRquQbygZBV2QjNC9SVVUBCew6P1tID6v0XBPfIx5LUv2SUSFo5T7VLV65SVEC16sqMLhIKxB9BTVxH13Uf93QoMmVUEzszeZpjxiyz1ItcKtcRD7QSNacpxUQBOAKKyHtBXcZdkMEHVs2+DDFtzJNg3n7ko4X1mW4PiKCYxk73datHFGmPvUs/nGIbPBciBcZp2CkESK2ZrPJHdJaF9GzbZorXZgemo7lBk3nfm2+qecvAqfCnomlWqG6YD3CxAJuPbuDWMYCLl42tmOufzbGSyZ0ME8HOiTckHj7jpfK6PECCM+bSjpNutdvNfixGcu6kd+iiO2hZggQ== 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=m6PYFWLjdxdEGOKFifXzCyQb8b2XDlH4k/Z9xT9L3lA=; b=e2jghIQpOgzvxAYbl5RI2DYboLisOTaa5zqnFOPUw+TcVFGU0JlZbywuNyFKt/vOq+cRVOSw4Gt8bI1J53MEbZwyrOgpMR7ks235VusfCdibzGPtcK3/ZV3e2WgI46zHEjy88XuBOa9gdpsZyl3OCBxXWhC2eF1DaklJuO+Sl9VibGOy+fsf7VpiYdYrgQy+qndK/eMCavkm7rijC4snFCwWNpZqDZg+enELQLozCzVe/zOhggH9BhkmUc1V3vATPrGx1U/6bB9dvpSJwnRPY1GrvNAQjohZ3lYZT814PphqTwEf+jpUKQiqnRRnsbzk94rZLUXha/52HsJU9v4seQ== 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=m6PYFWLjdxdEGOKFifXzCyQb8b2XDlH4k/Z9xT9L3lA=; b=PwQSNin7AsK8Hqo7TTGA/c9e0b2ixbvPetcq4tgX3ZQsskrGSxIAiZhhHnwPhBIjbdyCKXn66lQ3c0uC65aEwnxNU+mT1w+VhRoKa7M7CHJgNvJMexVRfC6rCenDsqpc5MJMLmsrbDPUmO00lekxZxegDnW4KBUO+ZkuBHKjc2I= 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 VI1PR0401MB2285.eurprd04.prod.outlook.com (2603:10a6:800:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:20:00 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:20:00 +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, kishon@ti.com 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 v11 5/8] dmaengine: dw-edma: Drop dma_slave_config.direction field usage Date: Tue, 17 May 2022 10:19:12 -0500 Message-Id: <20220517151915.2212838-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: 94193302-3159-4f6d-54c4-08da3818b579 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2285: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: kflU6oI0fgdaOAYQ10V6k8R5TO/t2OITxQLrk4PJXer+ciNbVwVbUBdktPTld9WOiwd1jtq/47iy7c0aj3GZZP5iMO5a/29g9Z2xncsJZrAOrFypa9Sc8jSSDhqHhoNk6nhHVo7Jc29R8P0KeLMVHLIwTfZvG4ZB74LtP+nZZeVEkUfzes4Q654jsNa7h5U6n5TtkHTbbnWVZTDu4vR5Mn9ETMrCHB1xgVX6Zf/uqF7gbQvLxF/yDgb9k/8m9sgjkNCl3nigMWgGxEMKQNEg4QPqI7GnY3CSk1TITBpbBJ0jcjTK+Rmxtt13R1wqIQhTykgwo9k7jQmpMWLIBl/mtTgeETVcjLLtTiAs+A9qZabq8KQSGvA7i0A/Fd06knBc6TPnTL9r4YPp4aEk9MYD7/QCZ3SKWm33+7/B4Phdd9/rCFXefrn6gnAu4Q1NM9nWfPAYh8d7Gs5XsEwG5uoRER/vLlD0jupqU+5UhTbidIQnfcLEc+dTgvPo+4kh6rl/ASghBNvVOjg5IjoT9a1FNGQ9SCJHQYhSiFW1RuTJj/Sa8HDWTg5NKQIYC+UA68ttdwDiviWCGZtMjqR65due4p6780wSYn6UPd+xoiaCfEJaSKqeXu19xaakyRYKVFSOJWLNgazQNPRmSz04pbUOioyXqmqgB5wGG3RN3nTnURj1/Vg2s7JTiZ1sJtF3uqDoIvaWQ18SUnoY13zP3QZtz5qwSzjOykyYawCi1cmxDK4= 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)(66946007)(6666004)(52116002)(8676002)(6506007)(66556008)(86362001)(36756003)(6486002)(316002)(508600001)(38350700002)(38100700002)(2616005)(1076003)(186003)(921005)(83380400001)(8936002)(2906002)(6512007)(66476007)(26005)(5660300002)(4326008)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xX4waKt38lxbYPOxnrQ9PRdRcsa0XyGiS+/Q22HjvGYq6tcSdYO9h+CEwLKfppMDaqTIzT1/S0PUDrSscjni8sc80d6pfXQAng7Wa5+d1ssg3tWkIznRlAocEnBKHY8F5c4yO2o9i5xQQ34HfEMfP1dcrwYlyYUGqZn8foWyqNUwUReYG4SPRCoAr5re3aLiilRW3q0bGlIBKq0YyjhwYT/PqW2Sbv/Yu4DHmcoStwEZOY/wkhOHiiwCGHSguhZXTcr16pr4UzQs/VBRGx3k1wIlWp19MZNxPj5AW7SvulV5iuDoFLiqfLYcDAraqd8seToLT12UbspSS1D/yUcAoWI6j96HwZEXBBRO7EiGIcC/qf+J+whM7xKf9ZPKpoWVXGTvmu1FZ/UzqSD8NUGYwQ5q3UaG4Jh1Y7EIlwhH6ihsvtb55KuppR/j4rHHc4rz1a/bY6of6SELVy8d5Q3ZgmTspCjOQOu0bOAIkwSQLf+4KaGgWLgSc4xXuSqTEENx9NrIzs5x5kFcRsz9yeOsFX0WZLC1h8cl7RzFFk3tNO+RbvFUKlqunXsCCRiVPxTAShw8Ol6Inmd2eOboAnNZCAj1epAVhp00vuVvfyBwA7zPeJvlizIL8mLlst4zrDfaQ0jWkpoYVH244n23rEv9COt83aTWFFNGkkyE2UuG1mP/rGSYaamFPAKJlRYkIjh731Ol5S7UGCbOnQO7Oubxl+hTuzW4QTgR/f2Gds8r269h/jOIehV4Ike7h7eJb4loSIN2WjWlQ5mnCKwMLUBhDK8eVs6emvxOWl0SLGU6ii3LOakNy9ihne+xcxSRBm2BnQUaCGmCOTl9pc/hQzxRU1IpeNeXc5cAqAuSG6mWRu8BelyndqMTOQ6fMWLNhgEt0CP99U1d6R6sPJrXGUTlxf1du3bt9NG1GzJ0FW2SUPwdtHEAZUARX2NS2HOEa8MLGqDfm5G5CbFQlQB3E+3dJFhMIS3c/6EojpN2emAigIICNDybRbO76G/p+buFq79M1ciZJjRpIMwd9f6eTZYFsS8yOsK0p+yiRlSkpEnrlchhWDjYceFBvK8/qKJzNXvyDrkkaz2cQe1tuDCu+bzkGQiaTOCUBwKY5LMvparsQks/ZoGYqKmM2t5mNeQ+hLD3kD/TDcf1Rwm2g9upVjeaWVxtRn4AmtHnPTxKvF6z0yn3bSWWTxmbQ15l68/wG7zJHI6TBHfS0BsoGdMqRVKnuKoe13kD3LG+mubOhKIgyrHzjIhvhYsaUbsrvccnJsA1X1v1ne05o9t65IqpZNXQvMhGPudcnoaBddegESqKtfh5F+ivccKZB24h9QRWJu5gs/7SFTQlbUXIuw+I62+yc1zL89souBQshEA+XI7sX63YrDPskmIbUVv0CQ7nQMEMoEPF0XC4tc3erN+MewW820A26mGkRIMgOcesWxumZlP0ctHr05GBcFPApUZEYwG6z28IWr8LyEJ1xVrYiaEBAFFzcdjt5iksWjXrVryAUp/hyDqKlrTjZJl46PkmN5pDob5Vzmcn8bvIJX7qFGWsgo6+aHE1bDG+jIMnYZforUmDW5OlfkBpxSZRrt8peDX3ZTmbYmW+BaDmAX+pugULlFlkRl4VFrjFCgfZ1FiRvPCB0soKJneg3ELRDOjfPZ3CLpyQnzx/gp/sHQyf4g9AftBzBXKwvBorgvdsVvovyZCi9yrF/q97Ocqp8E3A+C5Fp8lnQx9aXXG0qJGnvlHS1Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94193302-3159-4f6d-54c4-08da3818b579 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:20:00.4469 (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: 4eS9xVLIPqKjm0Bv1VRxDa0+w7bYbIy6px0IQ0+hrGx6kHjh7OgTg+kyKsNICGGjc5iN7sRE2v6UZDZuBj8+7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2285 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 Tested-by: Manivannan Sadhasivam --- 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 1ef326f7151a3..3ce0d7600da64 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 Tue May 17 15:19:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12852616 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 591FDC433EF for ; Tue, 17 May 2022 15:20:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349853AbiEQPUO (ORCPT ); Tue, 17 May 2022 11:20:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349863AbiEQPUI (ORCPT ); Tue, 17 May 2022 11:20:08 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150088.outbound.protection.outlook.com [40.107.15.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851774AE27; Tue, 17 May 2022 08:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=auU2IzC//vK/gR9VtFyVP6M+FK9+G67wq0BYXtd05+q/DmkxsW9C2bXeZf7gOkMoJHOIWRaqeGpW+9HEdCKYtRTH7Tt9Bncn1J+3O3gkvVlWp9CMmoALZ9Kv4+KbAYs8fLnRx1XigzxqzAkmK6LhVI812hYSz2qDvn3BgIvtvYTfSAJ+ymbH/3Yp0aS3Iez5DmQ7jMljjcagm9v/3lZUfBJ8pMvKx30omIINMEdfCxrk5On1a6rnAPUTiLPYts1uq1XDqTvCV24m5davwsg+wrLiqk3XLUVsyL+NBWyPFt68li26ATRTw6piNDml8vt2Qy9kVIgIGwwLstJuzDiUzQ== 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=8xiesIl3VQKcbMSIZFTlAHHkBLiMP3OMyWwMoX4eAW4=; b=hwJh/4o/HetDaMvbuB0qA/6cXOLLH4//czkRgQBrgif86/GHTQWMgxcSXJqcnMVAp2NvY6X5nLCKzWte9+u9hZdx4ptWnJBpMnt60rUOV/WMVpV3Kq7Ls9+QHYsfK4b1YwKofkqhKAIpvxBYA89emnY7iU2dAGDxpHdGBP6TgHbEMseEarY7o0dQJI7hzGqKTaogg/zDoeMjc9vVkn1t+g270Hd7SRJDEDNVr3V443x4Kt0/tCbDGgy7vzOH6O/pECqsKdof1xsPwMFnmmfB/JAeK1UjCchbrzeZnjIliRs3urGo4rQOsDCy+edu8pkkXKMxuc/4H6Bub6FZtMI1Sw== 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=8xiesIl3VQKcbMSIZFTlAHHkBLiMP3OMyWwMoX4eAW4=; b=Wx/HQfD1Nu6GC+qXIC+8nmH3tUUKVXib6rO+ayhCOjWjx5rdiLBHEJWKTQaCkOSj6mbsxH0gbg/OdwG7UfMMe3XZdYH2th2dxaoVUT2XsW59eD4bGjkXeJR6VjiociEt82wP7lcuC4a2wNxhO6b4NSDuhdAGC9wbpczYgYZ57t0= 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 VI1PR0401MB2285.eurprd04.prod.outlook.com (2603:10a6:800:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:20:04 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:20:04 +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, kishon@ti.com 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 v11 6/8] dmaengine: dw-edma: Fix eDMA Rd/Wr-channels and DMA-direction semantics Date: Tue, 17 May 2022 10:19:13 -0500 Message-Id: <20220517151915.2212838-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: 6354484c-2bc7-4e5f-6094-08da3818b80c X-MS-TrafficTypeDiagnostic: VI1PR0401MB2285: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: DsAcX2+N7BTqYowwEaY+a0GPQsXXcUPfzDQmX56loQCGDg1JJ4Z9qOAYteiwqrIjhszvBFgDq071snWwfhnj2F176IRMEX9OC9FeqkX6UjjWUMCqpIJHDteSA01uioEY2gZDyGEx0ZiY/StMS2PcKuNrKu8OrkKOyt56qUox/SWeM8sgCH8UP2OO2JOeE4a8In4fKuwTeHBz1DKlWkjCoTfqBvgLr1ZuyKcNGnNPl5nPZgXDTFGpAbsZPlEW3Tch9t0mdAJP6/zzjGe4eONXj/XJhqb/IyHEZOsZT9vqc9XcbtDVWYYu2A8CMV/FKFFt8N+OmtGV46v2rElM+1rRn9ZEJdp2T1S9bnVTOKSbK5r0UAV9c0vFJqqTnKOZTK358SepqagX8irjdJF8FyWXgF0oWOYOqDeS8z0EZmO4t4rUKDIdptvmBnQgxHZUsE7/juDeBoHHKKOpd4Iuu0wUDZvFWJ3AzThBUlb4VOa3yWxWY/LXnzQDUG1DfH6erG9viyKDr/IWkWgnfeDm+Oa84RMRR4vBplbYASui9Xq8l5ydfhl6swHVjqRTL8nZBiF7QnmwULDIHVyfq5IYIOmjL4dI/IrH1iBsUh83l9g6sdESMgbUn5s5qZHKrnZAiIXirAUHcWIR/0g89/b40J26EqzHuVUKbNBUbSMwRq1PZobSkLXtY/dxKBTXtuoCuxmR5uFh+nUrc4pKmxEgxn+cpdzVp1acFQiQvDLpfB1IRgE= 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)(66946007)(6666004)(52116002)(8676002)(6506007)(66556008)(86362001)(36756003)(6486002)(316002)(508600001)(38350700002)(38100700002)(2616005)(1076003)(186003)(921005)(83380400001)(8936002)(2906002)(6512007)(66476007)(26005)(5660300002)(4326008)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Tyj9mYbukf9BE4k4r+AoVoa5Bpek+HEp3NVSETL5EI/jc7PIVhbX1++k31Xdzq6EuWEBTT2Ze/jZZa9Ogn2oynzobD/XmTdH3wTx97GFNadTkEF8UZRCIy3gYt4I+buKnzbxvADDohophiGsLjyZxDFVYvsee8x1gRXzJI6CLTTPIoII8XypefrG9+1RiS7yXt1m1WprTToT0GyEnUP3mvbcf4qiex9Q0MUAx19+ikCzWzfcbVv1hdzSZD+WS2LO6Jtfu3mJjzXpTMjwu+taR4RytTk29BhYgdynu2QjFI3DRhNRmLlxYTce2IBLlVWdSUzvAtRMfQxNe0W/GzVb2AEYSYtdaULLHCTFuf8Mh25EcGaQtQMha5AiiksHL33EHZjfwRvFLQUiVT//dGxY+IPenPB7cRnPlFX/K4sysEmmtFV2BpTS2C4lUjFGfKcc5/E8zrRz/9Jo6QZYEsXSx+QUN2AjWGzBdH5NaZmL0tMYJ9Dk1uuwGc02Jb7C7ROJr+hR7bcnSRE903/fcSD1I1NE24XW9QjIC6sX2xCgSaXogk2OHFdJlo23f0kz+o7LtL5X+8o3w1Ux4w8iyFPFAPvELwhCsqTOmeimCJRg7ow1IqohfBmycRE65W0eVwp7ejHI8Lxu4tul3H9c8oYVr0YwzyR2G0QArndbq/XoFXnDavXMPfc4GJA+edUfEmvShYgBY8VtxLgsaOkHKX6ov3tC7SvEYw7MBo0achsZf+zBBfZD59wydPtLCjZDnhG7XDMSJG5WiNPEhJY1Dioar2afBIJ3/9AiRO9n82mjvrGEXj3x4apr6n/pdC+yW6UWVnKh4cr49llkn0x56wBPUftJ7qWoOj2uhb3AdjdPYCf0ATXAiQvrlcFFrROZwx2OrJA8IcCruwBYlCmPKPUX5WpvNzDoUuxiL1VH2svJDPAXQffCZ7fUC+QiLCsVpmYa+jSRKInAi4+yywjW/CGUQa3ZxCL+wf08jZk0EIHsOqLacJrr834wyWSFS11FpTRFr5Oh3djgbo55itRuXkiNEKNGwmkBcnU5GcJt2JMsI4St2v8zJ8W+gt42S6PBvf+AP3D/nKJKe9cDSeb2aXtXkhK6hd+8KmNYCzZjB3NYccPRnfPR2VcD6HAfq3AOROV3MdIwcpd91rYLlhKQqxrYdgSHXmRCyWOf+aSx4TaukXbLdiFVYALAECMFdAsYznQFd6X6cogAWpuM/7ozEliDl0/N9Bjpzp8VAW4mjFkpHNtqQxwZTxEBtZeLGQo8bdZux59lqriyzK1SbLw3UzyEsIGk90ihpqYWhqcg250AHJQzM3Z4DmxaSStoLJHk4ovhft72wKLSsfmWe1dRjgIheTIahh/1Nazy5ipPXzyPAxgYqwWSYAaUuX9sjQxPy8D5z9HUXgCbc9xytZc+BmR9N2X8xyhsgSY89Cb9w87gTPSFFKvX+edVX8hRqMNktzomhHrAw4Jq5uiFSRlmWqYw8IqrGOhIl5ymRPsDYlJYo4O3YdeYn1ri5TyMvlMkC1/f2LOUrts+44rL0aZrWP8zUHt2spm+Y3ojJnAXVgNfuzxhqd/GUscHQbdwmeFQAj3aU53KkdjMQ5v+ZzEIiuxPatEaEe3ABjveN7OdP6BJjJ+JvWJq8obJyVAN2RTyDT6LBd9+TU7f7ynSSEODKLqDJbV5BCyvbDNFepBYTfMwcEkCehKxWqs5v/l185LHOrz1+0LLO5SANivLaNclzHMsSg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6354484c-2bc7-4e5f-6094-08da3818b80c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:20:04.6410 (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: qqj/JdkI7EoWELo4qIy39ab53xfdaegKHd31M7CsG1/uBUJF3A7X5LOa3xnMm4XtYPDtdYPGSUn9Vetzn0F2aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2285 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 Tested-by: Manivannan Sadhasivam --- 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 3ce0d7600da64..fa95d1d17db21 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 Tue May 17 15:19:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12852617 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 CC4B6C433EF for ; Tue, 17 May 2022 15:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349898AbiEQPUW (ORCPT ); Tue, 17 May 2022 11:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349842AbiEQPUM (ORCPT ); Tue, 17 May 2022 11:20:12 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150053.outbound.protection.outlook.com [40.107.15.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62EE33BA5E; Tue, 17 May 2022 08:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Us8KpNZU7jDvJaSxPnc/Q2WBJs1hl7q9FWvOfIWqrOVga0+DI43LDQG11xzo2Kz4XPOIJ9owFDrNO8uLOtbxCHvfPJkqW+VDMI6A//I01ix37OCODx1m3IL6VTpgbkfoFGGHhOCIVdzfKNuXr1xkD6W0BYtwkyTChtHymJ5D5MgKQeMui9iiQI1oE6LYk1wxyIfli5fjnEW7fe4LXV3KMCzTFAYjPpflZQQLi1eZm9h0Fn2t6VuaIIW+ZRcd9wFiv5VIcP513TkaKBQYb0XWq8jkWmx3bRAW6UdAwVC/Io9j7uZamstBCv16hkqofRQjkE6QtH4KeAjWEcyCaOs/GA== 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=e+Pjllvd4Av2/LNvmId5YRdVr3zuYQIpd1M4RhkuB3w=; b=BaTJad6Jf1TS5esWPKGHDS5J2tXMq2tq4JDf+6lKnnPADvKFUDq5RYFg2ckyjZ06XRDZoruS+xq19m4EkdJjsxi2ZrowDTkZeG9y+ZPkDYtSMVGyH0v2twq/Ujw0yUlgHOD1nM1xf4tVtMEXTjIF1c1Q32E/XZcR63dwDBOrtiC49jBAXjcuwbEy+c9Tpta+Og9wazWhEWOidRehRZ3ilqvlpJ97wRRnBKfjMsMotXfG9bDe2+OdoTISSHC0UpMjxeUAbu6xwoVjomGXGCQ9jYtk74tEi6JAFluMFEUk40aBhYbm4TMI5LzCsC/kft0fY7WDiT3morb9NZDqzxBu3A== 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=e+Pjllvd4Av2/LNvmId5YRdVr3zuYQIpd1M4RhkuB3w=; b=ACJY3alG/X2/hpyD2SfqTOAgg/s9SQ+hjTv/uzuCVKWdOGbtnSh2oMNFsuB6CFP0GynTvFMAPGMpHCo5PWdTnL4ljsBUgIdm2/OMldPBX4GXA12Zb/T//lLmg02EYREGzaJBneK/eg7Ae34B8mEXYee/MOOuqsjyvfKcLbyGmKc= 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 VI1PR0401MB2285.eurprd04.prod.outlook.com (2603:10a6:800:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:20:08 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:20:08 +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, kishon@ti.com 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 v11 7/8] dmaengine: dw-edma: Add support for chip specific flags Date: Tue, 17 May 2022 10:19:14 -0500 Message-Id: <20220517151915.2212838-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: 6234ab41-f525-46c1-eb8f-08da3818ba8b X-MS-TrafficTypeDiagnostic: VI1PR0401MB2285: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: jhAkG9wlFHU5n00ObP2tSCzts70+wh44D2yM4dubN8/gS15/PydBQW2LJF76F8BpcQosP7OWa5uB7h/fZZqt6/VbLUbNUeQuHTLH3buQasM/Dx38ZrieygWOC5enVUAgCwLBKDRxNib9Ziorw4nkwY/d1Ozr8v6OYctmpd1xavb79ezjCwzVVqv7Wqh7Hf3uw3rxaakXP9pmgFEOppbYbrblTLlhkRKZkwkXobBW83MW9QQMcsV30ubODUgYPRmHaa8cghBs8BXV2U9+28CkAvqcn42nKAYl/WUbEGGljg7/AvGJIdBFZmi1lqWKwGbgrqKNhBuXO2aQ1ZWHKN9jf2e4TUp1lRCpvG6Y1/VYLQEGGgon4XCh2iBpfZWxu80W9BZK+pOG18AJyKaPKK4FzmKFbS4tAw9EeZw2gtIkzjI4lIrS72mcjQlm6Z2+DBces1Dt+kaFgCSxsAhDXFRA1Hf394qpaSHZtiVKAoSpjOWKNk+p/RGCvqEInyzO+f++6s2RSVe/dVbQT8TWuy2gPfkorZOtfcSKPXJZi0D1grUheJ4YqNXKtgSP/ON2/ld5CxJUvz1ZU8BvikjEiRIENGyWvZfM9Sr10YokstVeRZPAAVkmA9fgGGk7xqvz/mlDUqmGXX9N9gqmNSUNSt8v1s9rKdBIjlYkCKIvRzvv9wQ0GWOBQBanhk9VfUoeFdVzEwcKJelB07SgO8rpmFGFdHYXeZ5g4Nk2BtyEheeUwG0= 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)(66946007)(6666004)(52116002)(8676002)(6506007)(66556008)(86362001)(36756003)(6486002)(316002)(508600001)(38350700002)(38100700002)(2616005)(1076003)(186003)(921005)(83380400001)(8936002)(2906002)(6512007)(66476007)(26005)(5660300002)(4326008)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EiAeby1ep6mP6QcOEgHrFGY+9dn3S++xNp4ZKn5Qy0kYk1CfJCbA+fA4c9PCJgPurY0qEg55xitFOUZKL0R/B8apqBPRsGsufpGkIKUs7XL8o9++xAZCOHFejELSzTbLwyPWNQpOI/WWDVbVELLngItVg40Onjb8Fq+T+iMvWbPnGbc1e92XQyOhgaYl5B8/EWyZzn6bpom+8jRmpkxCnMkb6gQ5FUrP/BGX5poYBN5BGgvRDC8HRm2dgDAHAjPhJkVMEExqSWT8yJqfAJ9cyBbku9i8uYhxh8suCITWToOKWm+ect3r4taxLq4ymCDqqIibyoRqZ6HePLqPZIkzoDNQHsh4wIT/LpWSo1a4AZiR+a3TbRBx1VMW1eM5IxqPcK8fL6GxHYIZfCMeWHdD4eqEgTtHOv63zjnbvhCcu34v0Jfr5AzvAI+ij9nMYwcv+N/HiQHNuXOWTSL45+eZUmMRtpcmROjaklNac2yBbAj8mFT22ZaK+0odXwNY62n8smkZInbhf0lzssH0nbQ+s4tBbRUD/DSt0WakHrhtU6+MJTv/JzMFxd0S62LhWvR/72Y+vlSYjh4ZyGrsdw/9PZhkfg1r45mQsi+3/bLvWRkq8YORKWB2MYHCBcg7o72gh7oPRMhMLQ3eXSzA+0T400WObV+nNgy0Jq5LqeywcL1pQHXn7Ofl5opCMJCXt1+r4+nyfEio5WlG4XfzTQPpkZw8a5T4/maY04jlg6KxOHE0YVY3h5kXlycG0xGVv4miDOAMaVD5PE3MA1oth2BQmTL2CLnyPf5IrJrbh9sF9wUNHQ1n6gFl/1f7Ke5tRuZCtL93ph3cSEvoi/lNL5g81Ngi5LvsfJQA1cxtMxy5zhVwVITdZIGi/ykcyShUtc1F/2+A0YPqKAZ2QgiIj212/p/ymxNc12S5w61v4TfYUEBHiaUQkIbSXDcuOAguuzs4xMebMeqEzxhFylwu53EoUrjKdKnEnwNyJt+1XdrN6fvDjT9QrLEAzYEL6MVxHowXUhPY+BppjXYQ4YkMYvsS45TGlCT1VPWtR6cNm6VraP7oM/qxMf9rqGRlU3CegIAHFixt0DC7KLt+6YygH7qSQzkanHd1EMZzrNCr7CQZByMGOLtX7FS6hvxoaxBjMyTa2pnfXKddt2E7um1qoeb49DnYiSBIcUAmdHWu/PWDx0tSkljo+XTxepYFY5CelUWSZuqDIlfeJK/1NkJNmfS7DTWwuUKXcQQ7JhYt3Qsq67efBmws2m96falU5t8BpJAX60MbKSgMnmXhRM+u715/Zq4jfPrQ+Ttu0A+dYsBMuxqBb93zSlfk55a/40527XST/0nbpaPBu1cJW7zIC9OAR45GMFfEqgxurglXnQCFyEugCNGqz9tcMZt5a9wHQsYneFNGhiNlxmLoKQAMzmMzVxpCBG3JKwP5QXJ++ymhNA+8C9C93t5ZnA4NmpoSuhISJhb3ciIZevx64Ba2b8gL6/jcBAXqYxb1AEnivPdKTO34HXdNhRsZZFzJ7CE3d8umDV//fLZpbp5FtYVobx4129jCsTxfrmc+kj+SyK1JSCnumF4hOM0VkL9EWM689jg8cav2CONd8l0XjYq4S4M60ziPT0urKV6UPJe6MfizHIWcCoieOFpNkOuUVVhynzKSknpJSY2TapjDbex53wYtRPNXUHUsd1ZaieGnlTP6iIRBw8u3pbRl75yc83Amy7AI71mF/ODJkuJqNzIU2Cf6Bg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6234ab41-f525-46c1-eb8f-08da3818ba8b X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:20:08.7855 (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: Kt0usyzaEaksIuDRk4TSyuT50R+i26A1XFEEg7kctuGQH6viihn6nfAikczdqHC2fDdf3dkM6MIGvzMtKQqJ1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2285 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 Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v7 to v11 -none 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 403ade40c1b1b..607647dacc291 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 c8b479f1d4da7..7baf16fd4f233 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 count * @ll_rd_cnt DMA read link list count @@ -55,6 +64,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 Tue May 17 15:19:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12852618 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 78301C433F5 for ; Tue, 17 May 2022 15:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349862AbiEQPUZ (ORCPT ); Tue, 17 May 2022 11:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349880AbiEQPUV (ORCPT ); Tue, 17 May 2022 11:20:21 -0400 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150072.outbound.protection.outlook.com [40.107.15.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EC024B87E; Tue, 17 May 2022 08:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bFT1tn/kcgXPGJWcjpMCwNNN5d1H8/ZOzfUgX4xywk20XklSDD0iBoUKJTY2B98EPM+Sh/LKXtqRHtEGTOGi+EZlWvCeGAbKVfbL6omwkkIctow+F+oWVSDGXdg2vCTDQj8fmuuiQCPImzV/EPAt1Z1fOqEmTG8PvM+eIrLrnjkTEFUBQApNynQ1seNOFbVHdSASlan+wVNkIwrewmJIG3/bc1uYFi6Et+iKtWGmb0hEeHayvL9d3wHe3RD4gAxvUTqHqUatf2SgHBf+cZtpLEJPSbH5VuQqd/vDm0bhG2g9BLHG40j5cEhvE0wArfJRDg35Li4D6fiBTHG3G3v/SA== 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=gyfunC8Q8A3yMuDWqmS3ef7y7nn123i4uP2/OGKTaC8=; b=db4WKBfphC8VN7kBPvj2ruCJvRhu5S2kJMgHWp17/qH2Zt0J7mKhEbOoRcCtcN4lujFPrKL8yfKTWzZgNZwvNyKYxa7hV4oAldTLIBeBuEs6SjB/qxJXd1/lSKGOnLmwwbZ7fYCzlJP44dS+vnM3XDnYjf+nT3E5X8v02WFdQtZo3KH8ENRiYPM9T3gBKIRjpHD9Ya4TSHMU29iS+6uPN+CbkHyAcsjKKfAcPHOFb1go4K+w8Ow582so2N9nAHxkD/8WN54BCbRGq9PsvTwspQIcgic3u75IXnErW6h4kHTEmnbyDYwlfiQ1mdIKpBd/YndofI5O/wC2DAcSiNENng== 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=gyfunC8Q8A3yMuDWqmS3ef7y7nn123i4uP2/OGKTaC8=; b=WgLAKF8w9ZfA6u9+SsyufUhsGPV1iVNyuZ6AwpxThA8sDUV4d3EzxDkTxszluwecAZ8CZyTNEMROPNS+GbQ31tufK1+1evZhrFfAcPkrB6/U0IzK2r/fpdxIs44Qy6rZ1P1c6OjVOH7d66yX8Fqqh6428ABIwS7yuOYSFQUwWS4= 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 VI1PR0401MB2285.eurprd04.prod.outlook.com (2603:10a6:800:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Tue, 17 May 2022 15:20:13 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::adc5:45f8:fa40:1b8a%7]) with mapi id 15.20.5186.021; Tue, 17 May 2022 15:20:13 +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, kishon@ti.com 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 v11 8/8] PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities Date: Tue, 17 May 2022 10:19:15 -0500 Message-Id: <20220517151915.2212838-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517151915.2212838-1-Frank.Li@nxp.com> References: <20220517151915.2212838-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) 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: e35e8d6b-661e-4186-8dae-08da3818bcfa X-MS-TrafficTypeDiagnostic: VI1PR0401MB2285: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: yMRyUOHWby4ZAgl0rcuwStiSOFsbShOMw8a/5Ln9BFaimJNOzeqAgn0eMF2SyIfrlS9nr/EzXzFcaV8Llt6LH2ikEmE3bhdXTfu1PUhxrmCcI/Ri/i7w2NKjzIySpbqv6L42q5k+GHyuhvUXH8usn0+qlpAxCb+OH4K5Q0fHjdBmHks12mBvZtZbJGBbuhgNYTmNgGi/PEnsUDxQcmViQhUTsE9KQMla6tcy4Z8ioGdA/lsYVwW4L1dRklRiPv2D5kVAvq//n+gv2bH69z6w9lsDxcnAOxHc5v37anY38DSnd+c7CVcjy4dvd78Mbfw6Awkq/fNMIaQXzwUPe9gdV1M3HhiRzhQf7ZCsTZUTWtec5DVqY4Pkmz5n7IDjeo0q+xLNx+WWYL23kc5OvV2AwonlmQx8WuyCOmhE7Kfw5KFrjYtL8PKtmCt5wKkUS4wFabgQ4OqVacI0SrBriHY5266MwfdFgrZpp5L2F8HnFKkyoqtlpzanhHW+xKziAnAGX69/aQCPNdQGE8ZMW7i0pzl1wFhtyaZ8YuSZLrme4nkpR1IHsk4rqRp+fpw7QIGcEtfIGGTKIoJ6HOEGWHR0QkDY1Wh43QuI9B2UuAerEB2ZnxrgNh1GhTuInliQP/lMDrRKDlvuTr2p60PAyZyBHdSxHGm+vCM+VVB/yQA77m9zMrARoFg+tw4M+F0yt0kI4UXS3VTgiqw5QhKN7NKKnGOk8xi2PiXxX+Rv0mS2h9U= 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)(66946007)(52116002)(8676002)(6506007)(66556008)(86362001)(36756003)(6486002)(316002)(508600001)(38350700002)(38100700002)(2616005)(1076003)(186003)(921005)(83380400001)(8936002)(2906002)(6512007)(66476007)(26005)(5660300002)(4326008)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WyEgUrMoJWH5odxKS946vmWyPYRlxj8HWWkoPDlv7vtKxmXfHz7uXjwDodkGZ1g44B4zzdpcR/zBtYT5vuWHeW6ROW0qjr9K1SM0UcBvRdWUpzKz9a+df4Q2QZbfU6XWq/mp26gZRIN1dei1vOuCuXT5Bz62PG+qtiBg9HFONuMXPwUbKc+zp21/hkRy0OCnTq2eXEZxVbCxRZah2bc+eVB032bRmGui/r5kR1X3s5DvV/ETCGhnT9yj4nzmB7VSxrnGPS7bUS/6EJj7G7D4HeGiZELju9zSuo8v9ah846NyYtf4/Eq5tYo81Rl5UCqYt8tYUPArcSxKzentdogKAEtXXn1/sVY8ZLkKDjw4/Q/XDN/UbN31y7PjgmMxfJKDFb4SjDLGTUbB2HwQutUEPjx6OTDrVf3iJCfpUIxjD/69VOhhkMo84O8DSUejEZcf4pDXuKvfhP/lysgSGyhufv4OoTjnv6ILLA3ZTECPcypXzAyIzTjX5pFVxJCUBUHrfrz+hBW6npWw4gjQzceqvzaxSBlQL0ZHGqyhfO4T0WV0e3XUnNL4uZYgwjFN1xMsMOYCPcycdNffr1omKr/qFd/6kEnbrGbO/rFmQKu8tfl+NHuFx6Ls6tm6VW6KFcgIPHL/CICGjx0+eDwYY16HTPKpBxA3Q5vAoyhS+PbhOqyEwEqdEdBBIjcpblznWahn/rkPz71fOWkCsUZoaZX5ga9wzObnrsVyEKRNvJHY5EesAIUtkmyONp4DxWpO0Ay/0wB3uF+xZ+ClM5em7H1aG0jzl9J7g3UEs0fh7TgL7n3cnnDFRY7iv512gUkTYumb/HB99KwDQ+s4BePiq1SkmztKrBV5+fJp66B1alCDLzuz1ZY5UFLDvzyKRuSQkwRIFZdytN/AuX0rWGtq+ua8j2QVZXKxkRrlKkyV/ZrYweGop4XtbvfExavVtHS6FzZCOij1IU1I3WbDwc9DzDPRGKUHZLDRiUKztu+Pf0MhhaNyYRvk6DU0KtCvaYpUJq1QMANFWHlOl92YyiiUG6nBPVrDQ1dJCZLEevq/AX2t4GSYkG5cJ5Lunn6W4DdXsYmGfyC/m6qk3WACVnDnek0oA6hXdpNWXICOOp2fBaQwsdGgRvqNll8rIWJhKA8LmuUJPKuopLsqvoYpgb4wIjC5S6JwB//xvhmZYBwU2sc2CScRdCIETT4vaKASPMIFHJy8KSnV32VZBaqT7aAjcwT2cF9mFumxTSr+TIHxrrIJHVtWGgopWX1OzlCTWWaVJNDpIjvFrefge/35Nx83ze2+0yHiZB4oG7Nzh6Jaq2vbRMK1St7a5dt8/JrCHbmp2XtL6/V6r0R+568JoO4jzUTRxls1eCgdmrlFPcIwLkSf9zUxueP8PpybU0gfbQPa0O+P/c18VCUqwUm57n3w9DwNJcp1NQFU5WsJtVX4FuJYq7UuByAIk8fh5MZsEtnW8i8PJs56dti7TlXtEhapPm33Tx6NeANiEAIQ20f+0E6MEBqwIS9rB/0zvw1pTf5oFZzqoAhJrbrqSxUbJ+qP8F/7llfKSM0RuOZztedabTU9O16PDCjJpVlwWShfcegT/mBINn7necAZbY7T+FrMzEwgqmgrXlWD5Li5MT34X4v8p1K9NRuM+XgUzupfBsl3Vw1aInl4JfaVs+svUPxVNsDfRtV7mr0jh0Ydd+Fy9hKPM0RAKXMWLhsTJhAgc9/sTftO7nJM9PgrGq/HnFbRTYkhUg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e35e8d6b-661e-4186-8dae-08da3818bcfa X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 15:20:12.9284 (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: uBUcnnYNRYgjGT5ftoVfzGl4bdHDrXmpgXsJGbzE8Sn9ViWzC82CkIr6UewWdw0YeVuWn1qW+Yt07WCyt782qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2285 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Some PCI Endpoints controllers integrate an eDMA (embedded DMA). eDMA only sends once a bus read/write command to complete once data transfer. eDMA can bypass the outbound memory address translation unit to access all RC memory space. Add DMA support for pci-epf-test. EPF test can use, depending on HW availability, eDMA or general system DMA controllers to perform DMA. The test probes the EPF DMA channel capabilities. Separate dma_chan to dma_chan_tx and dma_chan_rx. eDMA channels have higher priority than general DMA channels. If general memory to memory DMA hannels are used, dma_chan_rx = dma_chan_tx. Add dma_addr_t dma_remote in function pci_epf_test_data_transfer() because eDMA using remote RC physical address directly Add enum dma_transfer_direction dir in function pci_epf_test_data_transfer() because eDMA chooses the correct RX/TX channel by dir. The overall steps are 1. Execute dma_request_channel() and filter function to find correct eDMA RX and TX Channel. If a channel does not exist, fallback to try to allocate general memory to memory DMA channel. 2. Execute dmaengine_slave_config() to configure remote side physical address. 3. Execute dmaengine_prep_slave_single() to create transfer descriptor. 4. Execute tx_submit(). 5. Execute dma_async_issue_pending() Signed-off-by: Frank Li Acked-by: Manivannan Sadhasivam Acked-by: Kishon Vijay Abraham I --- Change from v10 to v11: - rewrite commit message Change from v9 to v10: - rewrite commit message Change from v4 to v9: - 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);