From patchwork Thu Apr 21 14:43:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821776 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 BB03FC433F5 for ; Thu, 21 Apr 2022 14:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389583AbiDUOrO (ORCPT ); Thu, 21 Apr 2022 10:47:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389589AbiDUOrL (ORCPT ); Thu, 21 Apr 2022 10:47:11 -0400 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10072.outbound.protection.outlook.com [40.107.1.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C4C4427D0; Thu, 21 Apr 2022 07:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yc0avBsYpQ5YuQf9uKc2BPgE8R9sdj370HrvmGZgXjkLC0aN0ewGzHfy16ArCVTLJ3LCEg8m6RZO9cPxYjCToIY4TDQiqgBb9SUGgyqbMGxjS7yyb9SQCurbebX6y5DBLyJEdoWbuNympY3ZwyjCw44SwAN48gAa4f3KN1Wiq7hhcGDefqlgui2RWugtxuPHi3BIHHcSra9zbyyk0NqMIhShdU7wqH2+FIpvk9/EEz68iWTtp+ae6etxMdFYzv9tw031q2LLWdZ2/YCxEysf3iKP7brmKyWlDdcfeyYOgIITvQlogw5Ts/GnqJ5Txkl83FuNE7/TQjEZ3FQRV2HYQg== 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=4eMM2Hy+cZrDM6rnZL6Kby5v3Syrrjqnc88feJODeVE=; b=mfPN4OM1v0YUW0gzHxKOtkjF31QXw14VLdLtJvMOt3cgb3wkOr8jqcPfuqDzK3tr7t5C95fARzeXQCBRiujD2DWS6c4XHYWR9Si0rfdK06NFt4t75fS7NvHRzQ4ELFwIvecg2kYiDM1TpWifuGRSyZw+nhpfHzdOC+wwTBX0jojWfEr9M7ulkbcN9AyZKSA+i+10eBa6dw7bicA0HEYyGa8NNKMiE0mliWrrenuUJTlnilS4EybUlMh7Symbq/xvflSTjGeCtB8LX0qqiyXuTEgCVbTf7KIbbU8KMaatiI7Ajd37+8EvdmiZCvBihVFEr+CRt1IF3sEkaKZrG1CvfQ== 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=4eMM2Hy+cZrDM6rnZL6Kby5v3Syrrjqnc88feJODeVE=; b=OOpOrwRI6DRM7waYAFPCyXYzU9T9ZW2QmAk8LWKLYN383Z7Woiy9j3uarZfliOB30yzVFQbmxpPUI+xFA1Tu/o5G2Y7czdmDa9cQaYCtlTJsc6WkZZmMga1sKd1F79xwy2w1ywStgMn9rGQ7PxkgtmOGwA2FX8Sfjo2+QGZ8r+4= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:18 +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.014; Thu, 21 Apr 2022 14:44:18 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 1/9] dmaengine: dw-edma: Remove unused field irq in struct dw_edma_chip Date: Thu, 21 Apr 2022 09:43:41 -0500 Message-Id: <20220421144349.690115-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: 96c57228-dcaa-408e-1171-08da23a569ca X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: tBaL35mzSZyhclLLZJD9Vi7pMbyE22mJgBBvkcdSE56Ksbhsgesu9uT0eBy6n1WCL7yger9rX49SBbSsaxhjAwYTTxVwB6dukEdTfq1uEFXVc0GRna9cYjfNTQpok7B4mhSxl1pq9DCx+cjIkdqpFcNZIjB4tYKq8KswTW0ZPaQV7fgfQ2Gs9YJgnTMBH1+EClKK1nyUBtHJvWDqhSbev1SeCGeFTzeJlmbPiw075qcWbGylltfYugA5KluyGRPfYugR565i2pzwU+mBqyQIw+q77V84zB/9JScDzfOXezvrwUEVlXlaUkd/NLDkcjizct33TWCRFBAJ8/DAKU8Ol20h7c8NKwa4eh7o22lXa87kdzcqUemSIV/tObAU7LerNrzaA+CuQ0aMMNZ54R7JBpAfNxaIQWSXqfixLDoPWRElSItt9ub+Aie5hUxMcTY7Gqko93WySSE7gOneTeWX2GF4EecUymWmANZGAwjZVkgqQH0D4wxO/NlJgXPg+mxejcJYVfGkbJIhlY4s9gHlFYQEz+XzofbfHbUm3qDLhEE+48ZABp4awwYBI7eQ81kMnQYDPkekolkhJbd2OwE9sFfxaIue/WTJEEWjoMq77cHC2vU0jCPL65bfEja/YX6HIXYt9HGNZ7/exOSjCrEPqLBTgf+lTosLTUnzajKvs0ctRb5WpqJqyHFkLuOcVA0xBQWKalj4g70mff9hJIXlzA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66946007)(6512007)(508600001)(4326008)(316002)(26005)(66556008)(8676002)(52116002)(6666004)(6506007)(6486002)(83380400001)(86362001)(38350700002)(38100700002)(186003)(8936002)(2906002)(2616005)(7416002)(36756003)(5660300002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gImyEB4kGP/tuh0OL9UmjkuJ5//jsdm4jJkmN0wt6TwFei3iGuc+m+UmzyayPzGVnYer0KKJ+yORWIZmfLVh8svpVnXg5ClvRWZt48Mfj4hS1oOfXL0QwF/1Li0RfZPihnxau+YbFQDMoLcQS0UedF+LiTxdPl8ebGcijLJI33Xk89r/hrnCHvXHuRlWN9xkH1xRyRliGBvoo0yn3CEe4QNrkhxmWivr9GzqxVi3Xq3dGYi5DEZJ+D2DwkN9Kq7wGYkcRC9FSxF7+X/mRuo2GubhjUqxqs/DJng8KGCXuE04p7qpO1ZB8dhazK7UAZyjZb93jXolWwVfEiwwVF1z3iCjeei18fS2OrSqqQa8XLPIC5g54E+kig/tU/zpeeweFsBvNbl350Qy1+QPU+s6ShmQR2iQtdfDnwr3UexRtL3dRWPLu/hGdzNSwQSVOfTJh/UwnHpI+jcKqbFguaBOFyhzvP7w5wHKuhroTocp2fdiEvsbYDG7cyoc0UDln5qy4sX7XyHAW/Sz8wAYH+GFUGFt+BTUcQlE3Qmz5lNLWYS24t0JEq524VEFGdQ4n8VcQcA5Pub74hcBA+vwTNSaMN+TstZLBHs+KnfwoICpelZHTyRaJ+uCAVjB1vlujZidtMjOtxufdkzJxgkg0nR96yR7x92HXn9l8HA9hch1pb8ZLQ7oVtNUP7BesjUr5WOjUvktU1may4RRO5cZfc7PHLWw/TDNgeQg7zbtWh239/rsKkNInCICHBoShPDFf5+BVLbRKtbuyeFh8u32LhFQ6mnX2bRbUWgIEPn2KfoD2GJbrRsoRpM4M1w7Nzli2/n6Dvfo7Ed1gGO3BxYAJWtvMEmqNNItPZpuvGL1bGW3Ucjx8PtXm/ynFzLtl5DlprxMLga5B8nSWJaJzCVZQCAxnsriHN5lth30cHZFojLlBo0svXspop4mNX5bBKKVOOCFJM4Dw4Dim2jjj7ismmHqIZZ3TH0XFT9ApcC4dltnRYxZobFXf39jwXJtxjCpcswRuQnEed8jfYzRPyd5ax6yk/nZQ9qXy0XrS7ABagobydUDcABu+hjTO9co0z/DQ+EYHyWjNc+VeEcWLOztvw7GKQlcNCAb/N4t/wKVXSBpkXfQVBRuJY65H5scbjFV8i8xsZB7YThZEEsMwlgZ0WHTMldB+lDWtQoP6jfzvhh3Ap8b2CBfK8Tsft1Zocpq4X4khk9uchFpFnAI0UnaBhsxdcpJLesrqbIJtRGpu5PlsvXIzEJTf72JEO7x4mJJl7O82uETIomFEdg+PJYNHj8CWWOyFBO8gQytn66ciVPkLAQD34iCM45coAp4i570+UORsHM+1pMtdZCYPG/9HObUDprXrpxV+s4JW9Sn39jyG2FAa7srfWn705JVifp3sA4WqQWqe3WPkHztro2VH2h3IdC4Ok4nCwLQ4tuJxwMAFn6uiLS/VUmOfNWvXLhWESL9d3F4/2v0XPZo3JmvNGBAo/XcWcFtubLmH/FY38upspJcGDCUBYWS1JdXuxBnfxSqKwNP9ERVxT5TmH55AJ/nJVuM2znwjIiACgAl6+0JIAZN1iwkDMixJguknrqySI+wI2JVz1+irjJc9FPSry8zaKpTTAZugb/Cxq9lQejZGXbA+tGvR0fhjl7TSI3ZqmCR+WLdo+PmF3QSUoSpMHB9lxnMjrXmPOHIzR/3+nOLFMZyCsj8Tj3XHelS48T77x9ZfHdhawJloq+XZjgiqRvp1Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96c57228-dcaa-408e-1171-08da23a569ca X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:18.0272 (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: wsuE44k/JIDzAudCykfASQSwregCYtcmz4c4ash3o7QFg3mEX5TZsULT7GE7x8lYe/HTTKuvbkVPzz+aJbuTqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org irq of struct dw_edma_chip was never used. It can be removed safely. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v7 to v8 - 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 Thu Apr 21 14:43:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821784 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 70CAAC433EF for ; Thu, 21 Apr 2022 14:45:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389603AbiDUOrZ (ORCPT ); Thu, 21 Apr 2022 10:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389599AbiDUOrR (ORCPT ); Thu, 21 Apr 2022 10:47:17 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2044.outbound.protection.outlook.com [40.107.20.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6215341F87; Thu, 21 Apr 2022 07:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjSFHrKUz/m5lwRBcx5+uxqX2vfGNGUIATlQ0GRyGmGkqCdSH+OAjTh+iM7/e/9JA4E3umlB+Jc9mIj9sc7RX9gBXxWz1KxZlWeyeY4j+VoQQRh+k8vIPxsWWO/YXKL4IOdrf/JWkvlZSAp+oiIgH9LkF7lTKHmzwVMn95xSy1mRU4RiM0IFog/EYCj6M4doW5gN7xYJnVpJoOG8PJsDDtmLJIPDXoQAzX7Ms3v/XG2ka6yJxZ5Imk4YvI9XsHQ6VdpB+DvVVMCDC+da9eZlUpVDgC6aSN6Y0L8yXgD5zc8TN/m0BoptuIYYl8MwGJS5RfKj+XQ8oaUyIPnhfCBnog== 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=17U6Qt6FdE0+BwbMclw3zfwSYXWHcahLGZF5bZ8LxNo=; b=hhs4HD4FNgjQuK9eX8jf9p8NHpVNICZixyhT/41747jXAeCNKYSfMneZS8fhiQ9nluloAQ+Tq/7TffWiZqEK8eaa6oKvx7Utl06McX14M+7nvNpmS5qPQOskqL3LyMP7McNCWDu5M/hSBYjL40t/iNb7d3Ex1NyrSA32OamInWBv/b1eBePniYVPf8EUSWWDt946NboRVr6Dmi6ZwWtaWQe7BfCKuD86jBDfro0HIMBv8jJn5Kfqc5iTjdTNYL4X6yC8LgJ3VXvThdPOloSZsrmCWJdvBqDPYIdOQwgvEqRRhs+mtHhvIFiHZg3F4UW5blGWKrK5ll+WAmRFsvkQ2w== 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=17U6Qt6FdE0+BwbMclw3zfwSYXWHcahLGZF5bZ8LxNo=; b=rArTIuk6w7cPCuw/VNniSRadYOP1l2x6VjgBkslp3U31y0HsrecLf3SwE7ZUYLXv0aYy5n8nEqip4H78UmpCSvaKqgV/xedQTk5bWuz+YQGAzRqkU0sCgSfd5xcty+X/5KOmMOVxgt/xFothOAJuXHwZrF6G2QSlEzjdREwL2eo= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:22 +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.014; Thu, 21 Apr 2022 14:44:22 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 2/9] dmaengine: dw-edma: Detach the private data and chip info structures Date: Thu, 21 Apr 2022 09:43:42 -0500 Message-Id: <20220421144349.690115-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: 1e5ebfac-6c08-496c-200e-08da23a56c74 X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: 6ido6JFUevAPc4heRJZVtBRqS+f7bugJkX3vUx35UOh9kSR2ovrA4EMSB10xEcdKl08JtvGRokq6agNVJs1ndZNaAe5hlBnoWD0beHqLZ2DPSpyxoXIyFGWfQy6VAPMd/MiMhULrOBdIGZ5Z/aylkA+HNfJD9DqnEHi2F+9viIZt+9uzcG9mUlYVm0DHBRVufNF2+mtnHKnOZc4MPdXI4Nnpa9q7qaFGL+di0SsudDQyws8RECYunQODkbkT0u1NmpmBCN7GYWX1kB/bj0HpaUyA+TureZTWUjRM+gteBn+CbcdlHrMLfUSpo88xsxVm5I2etipU63YoDXFRq6CV0APioF2YXk1/yeQPhJihg5obt+/u+kWoIjYPZYs4QFEJ9cdSHMlTZJ0z7awBDM7O/VX6xW6nP2xxWYEPQXF569yfpXlGlamJbZKmZjyLgYYVHKcgZiL1x4IeVvyTnItyacE12mvNC5OnMtPkRNambF/M0A7X2wqJiHaE65h4Qon7YSfrhlJwwqf7UTlFRMgCMagpgBtPODlmvc4Jyyc9YU+jjbEfgNdyhAVkRUJvSs28pDdGUJsrh4cT1q32a6ajZGX/RoFtlN0ahXbmgFcc0zkJllld+cVAC2Uq4DEbpJJZJu3Tf3pWVpunwoJlD5b6ZDDaLer1YoyzpDeeTGej8gEF6cozvB7xI5ch/KJE1jnHe+trvAdwKEAtde+LSfaQTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66946007)(6512007)(508600001)(4326008)(316002)(26005)(66556008)(8676002)(52116002)(6666004)(6506007)(6486002)(83380400001)(86362001)(38350700002)(38100700002)(186003)(8936002)(2906002)(2616005)(7416002)(36756003)(5660300002)(1076003)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f8fkoNq7Ea6LLAYfDaoBvyxnCbWRVySNnay5N2Q92UXp/6PEfwk/g7ggvud84RNLKDexbqEYSwBf23PkMGhNcv8OvlnpLtwuDHkq7k255Cla6PFHKGo1wdkdHDpEpap9XTh+hCxrekdUvItqBbIF2k3M/UYg6FpHl30X0ND58IhfcbNt5qYceiAuriOiaO8cljdrp7Kfcr+oAKxAkK6g0ZKmVa0CQtSt/BvsIiAU5q1YgXJN/QongTmZ3y6G/BF1Yxn+d+QCrXa++i888IR1IPT//z86gkRDCF2zW8wI2Zyr4Lu6O3s2rRMR0Afp8UzzmkQu1HmM05DN06oEey5SxUs7hHuF4CRXRKaMdlIs1W8eK9TWCy1QzlcWAwOiwjzRysywfzjkoHLRsVEVFVGUXc1sJO1m6llhInHcBrp7ZWCBTXYYSH37BKSuLIHKtscAyaxgidwbP5azE+/Sd75ZctAkHT6pVm20CGq1HGsjKwC1QFgx3fGFpzppPvJgmihgOafoTIi2J1lsP3wes0bOXxkgS8H9vI4h9baVr4aKeVcmH7WXWdvf8KZyysDK2Hh9sJ5GaZqd6lfAtSlFA2QlB2DRQt0lMirbQ2ES5MQ+JwWHQ6YEeYLlyqaMszsj5Ec5JIdvWBdXMlimP6OTMM22rbgIxmaNLFFqHnqKNV1dUMul4F9Ti3zWAbM3Y73d6bM8b5j/F2/5HX32WltVOwvwohA73GneC0jd6NiRTUVlxBtL5bgCB9ytLQsn7Fae+AoyHwd7KfTTUvtCG2xhUjTP2I2SxwmllWGzJDJmDJ7nwwRj3DN3MeDqwPpU58GecOAPFTWhQo53YCsPPzaDAObNYicaMD8Nxhzlb6R0WH+E+NR5TNfRwxK8R3RzTX6J8QB9kBuRoI43anelTNIxfYQ+5tAyKFvMtFJt7sOjCXOa6J1XTDWQUUmjYbGtdeRBRHfGkY52raLMUP5d4gaiozmNthU0k3xQnUi+DPlBLtGybL3D23i4nrMwcX529TtUbtuX2zDJU9Y5rDLhd4gv9kKe4zZOfT3BRU0YtwR8KQ6Yy+mV3NuWvpwSqbTuw7aH19HsDuKqCGWbQuutz7kAXsD9xrBMv27zOslRfJtjbzbbz4lhHIQ0GKMsqPvJvdvRGggkyQVXrks08wPf+RL1ERNR6NDru2Mo1iAcUCrhpCAjn0TW3EZmg2eOfitpuLqlWuAQ/Fhu4dW6UQXvKgwMYPk/Vm15RRwdB3tjqmusM9FomUlOgg7+nCEqoWFGYsjeszNltLgSIMxuJ0A586T3ULJqtJrP07I9eOPMLsseWGsqCtT6sarxt7Aa/VuT6TssOJXSIJLfA9U2HjGgqqa4o3wmrqoyl4LPHbXqU1zneqKnCDTBvCTWzw35lyHFAKxJxjGxLNKRveHxCWFxh8npIOlNAUvEcewc0/S2PPtvkup1SQ5uP+inEsNudmH83DqDqZbrhPsa1z4tbEIBNE+eMiV5rCSFed3mtvznCgSFLqgkw/F9+TqIgSZldA1ZdqX6MBvHAhlCFNZidO2bqid+2+BqTFGL8OT2PkGQkBRuuT8YBl93iB4uBv63R1w9NvV53jI3IVJ77QPcW+eEZPl3d1gII9nLjd8RWvi0z4AIB2+pIWr5I1UdROjyLPaAdvDB7nWWXJPPki7VgPjEwKpbtaofm1/Gi9CKpgHDU8BoDxev3cF6knZeiMnO5fHT+tgddQBond9yAXnvbPoOkDX3guYHUg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e5ebfac-6c08-496c-200e-08da23a56c74 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:22.5752 (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: qBLNnqpBJB3ge6XibSZUJwsgnWXkrHcFMgPScCokuTnVfa1YccZ4IxzX9q1R69r2ek5Z24JQUrh5CsUVzkuncQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org "struct dw_edma_chip" contains an internal structure "struct dw_edma" that is used by the eDMA core internally. This structure should not be touched by the eDMA controller drivers themselves. But currently, the eDMA controller drivers like "dw-edma-pci" allocates and populates this internal structure then passes it on to eDMA core. The eDMA core further populates the structure and uses it. This is wrong! Hence, move all the "struct dw_edma" specifics from controller drivers to the eDMA core. Signed-off-by: Frank Li --- Change from 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 | 44 ++++++++++++ 8 files changed, 161 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..435e4f2ab6575 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -64,8 +64,8 @@ static struct dw_edma_burst *dw_edma_alloc_burst(struct dw_edma_chunk *chunk) static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) { + struct dw_edma_chip *chip = desc->chan->dw->chip; struct dw_edma_chan *chan = desc->chan; - struct dw_edma *dw = chan->chip->dw; struct dw_edma_chunk *chunk; chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT); @@ -82,11 +82,11 @@ static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) */ chunk->cb = !(desc->chunks_alloc % 2); if (chan->dir == EDMA_DIR_WRITE) { - chunk->ll_region.paddr = dw->ll_region_wr[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_wr[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_wr[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_wr[chan->id].vaddr; } else { - chunk->ll_region.paddr = dw->ll_region_rd[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_rd[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_rd[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_rd[chan->id].vaddr; } if (desc->chunk) { @@ -664,7 +664,7 @@ static int dw_edma_alloc_chan_resources(struct dma_chan *dchan) if (chan->status != EDMA_ST_IDLE) return -EBUSY; - pm_runtime_get(chan->chip->dev); + pm_runtime_get(chan->dw->chip->dev); return 0; } @@ -686,15 +686,15 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan) cpu_relax(); } - pm_runtime_put(chan->chip->dev); + pm_runtime_put(chan->dw->chip->dev); } -static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, +static int dw_edma_channel_setup(struct dw_edma *dw, bool write, u32 wr_alloc, u32 rd_alloc) { + struct dw_edma_chip *chip = dw->chip; struct dw_edma_region *dt_region; struct device *dev = chip->dev; - struct dw_edma *dw = chip->dw; struct dw_edma_chan *chan; struct dw_edma_irq *irq; struct dma_device *dma; @@ -727,7 +727,7 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->vc.chan.private = dt_region; - chan->chip = chip; + chan->dw = dw; chan->id = j; chan->dir = write ? EDMA_DIR_WRITE : EDMA_DIR_READ; chan->configured = false; @@ -735,9 +735,9 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->status = EDMA_ST_IDLE; if (write) - chan->ll_max = (dw->ll_region_wr[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_wr[j].sz / EDMA_LL_SZ); else - chan->ll_max = (dw->ll_region_rd[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_rd[j].sz / EDMA_LL_SZ); chan->ll_max -= 1; dev_vdbg(dev, "L. List:\tChannel %s[%u] max_cnt=%u\n", @@ -767,13 +767,13 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, vchan_init(&chan->vc, dma); if (write) { - dt_region->paddr = dw->dt_region_wr[j].paddr; - dt_region->vaddr = dw->dt_region_wr[j].vaddr; - dt_region->sz = dw->dt_region_wr[j].sz; + dt_region->paddr = chip->dt_region_wr[j].paddr; + dt_region->vaddr = chip->dt_region_wr[j].vaddr; + dt_region->sz = chip->dt_region_wr[j].sz; } else { - dt_region->paddr = dw->dt_region_rd[j].paddr; - dt_region->vaddr = dw->dt_region_rd[j].vaddr; - dt_region->sz = dw->dt_region_rd[j].sz; + dt_region->paddr = chip->dt_region_rd[j].paddr; + dt_region->vaddr = chip->dt_region_rd[j].vaddr; + dt_region->sz = chip->dt_region_rd[j].sz; } dw_edma_v0_core_device_config(chan); @@ -827,11 +827,11 @@ static inline void dw_edma_add_irq_mask(u32 *mask, u32 alloc, u16 cnt) (*mask)++; } -static int dw_edma_irq_request(struct dw_edma_chip *chip, +static int dw_edma_irq_request(struct dw_edma *dw, u32 *wr_alloc, u32 *rd_alloc) { - struct device *dev = chip->dev; - struct dw_edma *dw = chip->dw; + struct dw_edma_chip *chip = dw->chip; + struct device *dev = dw->chip->dev; u32 wr_mask = 1; u32 rd_mask = 1; int i, err = 0; @@ -840,12 +840,16 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, ch_cnt = dw->wr_ch_cnt + dw->rd_ch_cnt; - if (dw->nr_irqs < 1) + if (chip->nr_irqs < 1 || !chip->ops || !chip->ops->irq_vector) return -EINVAL; - if (dw->nr_irqs == 1) { + dw->irq = devm_kcalloc(dev, chip->nr_irqs, sizeof(*dw->irq), GFP_KERNEL); + if (!dw->irq) + return -ENOMEM; + + if (chip->nr_irqs == 1) { /* Common IRQ shared among all channels */ - irq = dw->ops->irq_vector(dev, 0); + irq = chip->ops->irq_vector(dev, 0); err = request_irq(irq, dw_edma_interrupt_common, IRQF_SHARED, dw->name, &dw->irq[0]); if (err) { @@ -855,9 +859,11 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, if (irq_get_msi_desc(irq)) get_cached_msi_msg(irq, &dw->irq[0].msi); + + dw->nr_irqs = 1; } else { /* Distribute IRQs equally among all channels */ - int tmp = dw->nr_irqs; + int tmp = chip->nr_irqs; while (tmp && (*wr_alloc + *rd_alloc) < ch_cnt) { dw_edma_dec_irq_alloc(&tmp, wr_alloc, dw->wr_ch_cnt); @@ -868,7 +874,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, dw_edma_add_irq_mask(&rd_mask, *rd_alloc, dw->rd_ch_cnt); for (i = 0; i < (*wr_alloc + *rd_alloc); i++) { - irq = dw->ops->irq_vector(dev, i); + irq = chip->ops->irq_vector(dev, i); err = request_irq(irq, i < *wr_alloc ? dw_edma_interrupt_write : @@ -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 329fc2e57b703..6cf6c28ce0cc9 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -25,7 +25,7 @@ enum dw_edma_control { static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) { - return dw->rg_region.vaddr; + return dw->chip->rg_region.vaddr; } #define SET_32(dw, name, value) \ @@ -96,7 +96,7 @@ static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) static inline struct dw_edma_v0_ch_regs __iomem * __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) return &(__dw_regs(dw)->type.legacy.ch); if (dir == EDMA_DIR_WRITE) @@ -108,7 +108,7 @@ __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) static inline void writel_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u32 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -133,7 +133,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -169,7 +169,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, static inline void writeq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u64 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -194,7 +194,7 @@ static inline u64 readq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -256,7 +256,7 @@ u16 dw_edma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; tmp = FIELD_GET(EDMA_V0_CH_STATUS_MASK, @@ -272,7 +272,7 @@ enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_DONE_INT_MASK, BIT(chan->id))); @@ -280,7 +280,7 @@ void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_abort_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_ABORT_INT_MASK, BIT(chan->id))); @@ -357,7 +357,7 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) { struct dw_edma_chan *chan = chunk->chan; - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; dw_edma_v0_core_write_chunk(chunk); @@ -365,7 +365,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) if (first) { /* Enable engine */ SET_RW_32(dw, chan->dir, engine_en, BIT(0)); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { switch (chan->id) { case 0: SET_RW_COMPAT(dw, chan->dir, ch0_pwr_en, @@ -431,7 +431,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp = 0; /* MSI done addr - low, high */ @@ -501,12 +501,12 @@ int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) } /* eDMA debugfs callbacks */ -void dw_edma_v0_core_debugfs_on(struct dw_edma_chip *chip) +void dw_edma_v0_core_debugfs_on(struct dw_edma *dw) { - dw_edma_v0_debugfs_on(chip); + dw_edma_v0_debugfs_on(dw); } -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..6fd374cc72c8e 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -12,17 +12,61 @@ #include #include +#define EDMA_MAX_WR_CH 8 +#define EDMA_MAX_RD_CH 8 + struct dw_edma; +struct dw_edma_region { + phys_addr_t paddr; + void __iomem *vaddr; + size_t sz; +}; + +struct dw_edma_core_ops { + int (*irq_vector)(struct device *dev, unsigned int nr); +}; + +enum dw_edma_map_format { + EDMA_MF_EDMA_LEGACY = 0x0, + EDMA_MF_EDMA_UNROLL = 0x1, + EDMA_MF_HDMA_COMPAT = 0x5 +}; + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID + * @nr_irqs: total dma irq number + * @ops DMA channel to IRQ number mapping + * @wr_ch_cnt DMA write channel number + * @rd_ch_cnt DMA read channel number + * @rg_region DMA register region + * @ll_region_wr DMA descriptor link list memory for write channel + * @ll_region_rd DMA descriptor link list memory for read channel + * @mf DMA register map format * @dw: struct dw_edma that is filed by dw_edma_probe() */ struct dw_edma_chip { struct device *dev; int id; + int nr_irqs; + const struct dw_edma_core_ops *ops; + + struct dw_edma_region rg_region; + + u16 wr_ch_cnt; + u16 rd_ch_cnt; + /* link list address */ + struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; + + /* data region */ + struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH]; + + enum dw_edma_map_format mf; + struct dw_edma *dw; }; From patchwork Thu Apr 21 14:43:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821777 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 2A278C433EF for ; Thu, 21 Apr 2022 14:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244373AbiDUOrs (ORCPT ); Thu, 21 Apr 2022 10:47:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389614AbiDUOrZ (ORCPT ); Thu, 21 Apr 2022 10:47:25 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2044.outbound.protection.outlook.com [40.107.20.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D5A4427F5; Thu, 21 Apr 2022 07:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CXFkdcWmi1F6PeeWhKqe1clP9CxSc4PANLOL2VwACBOd70gSCvlAXIqiwiFdKtQPeloW6YmJ7PTi+0OLnHySOm+6Fc+JRWESs4REwUFz6MCHjT8Y/7o8+DLSpXMZkI8ZikWofgfOo+AGSIPANPQ1Q02qhs2KElbY0f6EZyLmUrHbpR0bYAD1Sp7MYCFlSnyshyHpS6FANHw8zunWFTBCDMrNEqaehpQDPUlUDk1ivPoxoeIPuoDOAKZEY/KRb5vGhhACuaYjouo2BFrKrUcAy40qugrK2dcxGoQCkBmrDDyjxnLSRDNd6shbmKJ6KiXjxU933F6qwAVz6q32hyvqfA== 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=p0JgMx0wytWoHxVoQUBFYj0wEe5jDMgWqsPp46aLqFU=; b=i4t9jnTnFdOx1dwXLA2pudNBdBF52jYTrq4eY1+Wt8tWvac7yCf+zPrUXV+JUKBcryibtIEnmfP0IkYC24GPFb1FGD1z8vB0QQ1Sf5McOHHbzg00Hu8CwOKfopsd0bEKE+jJ8f2ohUTsU9GPEnuxqRWcSm8IKXetmWZ1tM3EwzENhVZYCpNzqSPjCmobg5XswIk1iHmYRyH6czt53n+moGsyxYkc5NWkelxcbNOc52Vtjtx9ZdV34FvYD9dnQyswav/XZ+m3nlzoHbRnp5DJDfAGIMfUTEezrGxNZUBEbhdGRmLZAo4jIOJzCmnvy05h5y4jQJq59dRWG3yD9zeAbw== 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=p0JgMx0wytWoHxVoQUBFYj0wEe5jDMgWqsPp46aLqFU=; b=h5CPQvFFvQZ/cc775WrZ0fgJAAMdxTGrZtirrvWgiTNoiU8keRs1Shlf9xgS5jNBVCRjlidGp/rZz4o2PCiwqljIBYpWgFNqcuC+LFsEhAox+/Q2DsgozrsZ0afwDk5ZyF6c1GkEKL1dmE6BFAqCEZFzmamuVojuuJOK729DUEk= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:27 +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.014; Thu, 21 Apr 2022 14:44:26 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 3/9] dmaengine: dw-edma: Change rg_region to reg_base in struct dw_edma_chip Date: Thu, 21 Apr 2022 09:43:43 -0500 Message-Id: <20220421144349.690115-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: f9b72c4b-5c5f-4b90-d85f-08da23a56f19 X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: 7flz0SHw9Ftju7GHox5gl2TkgBIZIkMqu30pK+iJKq8uCa5djO185KTt29up/TdiWJWbbVnhdugm5LKN51Vkka0ccSGCBjIg+YXQRt23Rz81+wzOpcnS3/j2RTMkvu8LJIeSmqyXuC5ryXJvzk5XF+KenyuB8l/Vsf5ARHpBN+hBA7INwIFZe3N9C0BKCzXptXpQ7xIDzAZG3JS4ZKEeqzc37naGE2U6/zCOqygEkZp3WuJieA7q00q85zEeF65vEExec3iMfof+Aqw0Ere/+8sNvqnNPvm8KI105ktMcynmPTU4K07QXDBErh2f37b9DQlt61CuuTHUDm9uccINm5eohVPcxucohKKPyk/T04YxEAepLLkQa8LKsJQOOM0CYpGU1jQNUyDrK/IZett53tMMUTWDRzghS1w/wA3oUvKKLLPBzZ00s4p9AfVvTe4IvQ3j11yrGUilofiK8GBH9RL5ncjpNSgGMl9z+tZRt2f3qgJcq4ciemDRlGC7hCUDyIcGjRMIISRO+FVzGeGvHrTiHHXTvlfffFlT+V0QWr7VLjorAgvJuwtdsLwxX3ooV042O7uFYGpnFhkC07/ftjfu6MoUPB3IuVVhYwpeEFsLjpioreiOn7bJOInHDbdNxCpXez5j2uEn4Z5y931vBogBSMh06kqQzwoo+GUWkpOHk0sw7mm6Rhv/g6tJ/N6UhkayM/4fj6m1nHdNqXQzwQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66946007)(6512007)(508600001)(4326008)(316002)(26005)(66556008)(8676002)(52116002)(6666004)(6506007)(6486002)(83380400001)(86362001)(38350700002)(38100700002)(186003)(8936002)(2906002)(2616005)(7416002)(36756003)(5660300002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cGu4zZfnKgjnv78k6/hJJzDTfzRr3M8YaPxPWLD8yW1TiwBEYUDRHFwVrVk6nPbBv4k7Y2izVsKzsHiaY7BqA2+LispSXt20etDeMMfadU3sVvsPzJ+UgVxMKCuiXKa+X6fnzRG00wTK8GoOXZc7oViPYLD5bXMGzru0YmGG7s4wN1wdALTOAxpoSs25716OToAAPj3kPQpb7EDu6r3/OOSsYVehlYsY1iTqd/xzkYbSq6y067eA5Bq4z6f1W9/tpSvFfTn2VBqW7k7D9CXJPYRMR2KUPR1NjW6buKWUuGKTD99HMXozfs+dnRS6cnDQW2P6RniM3xtGMc3ybXSf+pas2OsosVQErXDnoZwIkrVZgOD+9NcfpJiSwe2I2FppbxKwhMoBG7PhfSzoWDY0oev0lwc1Rp1ld5wtACkGSQNWkpm0MyKLz7TAY2Y5MhiXVYKvPiIJJvgat2A0Pnn+dgE2vJAsVehF/Ug0OjuUcp2+t0JjEIpMzoeterYdaBgDdvKwbsDULREUYV/HCMP+AvTTJBAss2VpfEX5iu05uVL84Je9rZk3yd384/BcyXaCwpjBpkDDFJ3EsesIUp0rQHiVIeqPEyN/hVmqu0juXyJQYj+h4MvmwmkA+0MEp3r1qcU34lLmW1tt2VyBTlbzPMEP4PCsT+f3v67ldrzzL4lN0aALG92sbVfXS2sOPh5uYXkiFbvrQ1Q22hYdn+H9/isXvOzB4aUVAxKh/L11qB+HBPwqOacFP46BQ1kIGITFAMD8XNm6mq1/KhNxBfxtB4OYT8DusBiSwZjJ7WeQVV94aMxtATYAiVDqDkqna0KaNd3KdtJqrIchuIFuBceWtBP5RvfutN5wrtjlYJUFVeWQe/z3zFBSBCxUQV/ZUuSOFAWmNmDN1whsWpjrGN1M2FQz1in/mH1zTWPwkbO5BB3p7vxJWh8W1rzT5+rbSbeuI3VMYOaHJVppLsEV7teUm9TP6AqbgtbZnEITKtVzrEE0iSGwum4arWP+11IzJAq9OWOQuEnf9FQANY2T2gSO5yYfCeZFap2u7Vfrq2ZvfgVS7HJZ5d8DW92iF+1NrMIiG15pmKiYnvrkgr9F1S8QKziXuE6l0EoCw8Wu7iqnGA9/NxC+8r3/KlRc2P+pOOeHJWihQ1A5i275klmIOEnQDSZlB+2/LOUDi+1EU18CnKzIT1ACBiaeeqDj3g3jLOoItq3HO3tjPkbC7oAzlWCBcv4ASEktm4qE/PQjCq9Jz/WTGfiPk3TPkppPG2NZA9Ayu7gJp2Ri+/pPmKos8/0Dh5VpayOwZaKI4e9qJ7Dmnlc+7HsE5dmvx0ObwD5YNyMfenau7jvgDNJky2kFVbgoqn/qz5VWqYvcpi5J+++iEwQsOkZcR9nfUTJwEAsabpQu9WdZSMIEktxVVMFGFaNymaUaVzq/KryUsC7kL96CvAUSeAzdogD3gjpoLX3kFRGBFvlwYtdR4ayB0AfPFX6HNafWEPe5tNxXT9aCszEnz6d1W5oFrfvVmY48yyRerSRu/7NVKaUd8o5TlEkHHOKlQhbZX++i9zCc4IOOXlyt5/l30XMGWDDdHBijkkvuQGeAoNrwrYznvmNknbTrOt/0+J/MNRJ0LRfmjsTdFYmgJDV/H/pyCiCPs+8oxNciU6TsU4BKRhIdDDSMgGx1ju9+87Cti9KzTYo3cUqrgkhknUcA/ykxAh3zaPhfgc3KVjunoEEjO6pNFJ2vMGoe+W/Zwg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9b72c4b-5c5f-4b90-d85f-08da23a56f19 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:26.8761 (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: AZWP1UUSuZcLbHIqKMqI11wlmjOF2Eh0cpFC4k98AHHmoroWV8mf8ph8NfttzfB+NGLesmxvScncMUTzc1PBmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org struct dw_edma_region rg_region included virtual address, physical address and size informaiton. But only virtual address is used by EDMA driver. Change it to void __iomem *reg_base to clean up code. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v8: - 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 6cf6c28ce0cc9..c59e23b9f9fdb 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 da88958399a95..f59e7c37feac3 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -287,7 +287,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 6fd374cc72c8e..e9ce652b88233 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -39,6 +39,7 @@ enum dw_edma_map_format { * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * @reg_base DMA register base address * @wr_ch_cnt DMA write channel number * @rd_ch_cnt DMA read channel number * @rg_region DMA register region @@ -53,7 +54,7 @@ struct dw_edma_chip { int nr_irqs; const struct dw_edma_core_ops *ops; - struct dw_edma_region rg_region; + void __iomem *reg_base; u16 wr_ch_cnt; u16 rd_ch_cnt; From patchwork Thu Apr 21 14:43:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821778 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 5726EC4332F for ; Thu, 21 Apr 2022 14:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387935AbiDUOrt (ORCPT ); Thu, 21 Apr 2022 10:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389618AbiDUOrZ (ORCPT ); Thu, 21 Apr 2022 10:47:25 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2055.outbound.protection.outlook.com [40.107.20.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8136C42EEE; Thu, 21 Apr 2022 07:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cOWBmvLL461QbXsFL34f5aSqMtukooK7kzgCiFBxptHcRlgRALn8AnXuHJimLDTlWJ2vVNmlI18e+Gi/htaj40yQEf8WX2aCxDuRM+C0AuKQFAOkOi+pTyMeboQkeotdY91gnP+YB7FX6G+rNdC6cRYYJDPmtv6g45ZjVlIA0FsOcCNxhkBqOBr1wH68IZ0Qfju7r2VMDiZiaTErFL/yQb274TMiZYY5X1c68brzyleBrP94HLvCriNfYiiiF37XgYNmpCWMpqXMX0X2D7APCXBeujQf9I5QdzWRxYOcLLgmq03hnAuHQ4F6kaxdecepOhcpASFLqVAUOXEqzThgKQ== 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=FDU+S5+FcN6oB8ZOhlLsu5F1lAkxRxFM2CpVESA8iRg=; b=bzxEsQI1UJWsPXmjxyYkQMe4dSzGUmUHcH01lIwUsrqRim7oF+Laf4txkFWpEfPoSXLNQ/bLOcCcvHvgM0gd780wgNSDwkUQEX+lj0SRCZyLHAZwXdD7XxZyX6Mh+HILXiTMMsprOfbwqtfNo8JZaHNXV03j6X6cadAFGuW1VM2wwy3dkiIeUJduvn/kl8c+UyiVwRyurvOy3IeMpagEgqcZ+D1k6XV9XlthqLmmlqSbn2wUHWjwBTP83oi2Fgciyki461ljsWIwogcjKkuWmot/knA73CKj8EyBMA0MxOy4zM2/YOJLK4yRYAmOOpSP1hoZ6SJ/Y2MGXuMUd36l0w== 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=FDU+S5+FcN6oB8ZOhlLsu5F1lAkxRxFM2CpVESA8iRg=; b=l/IrX8orfLyml2WEVERBcum94cqIiXp45j0pxVfJDTx5YV706tH8reXB9i6nLpdQ9G+ZLQ+rHaoYplk0Ub/Ku3lB7iT63030597t06CaQgUb0qsOpntUAYxRmKYYjEBiT+CTo/3v8QctOvHHghBVjyDddsnrI2tRfKN2l4Wmsys= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:31 +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.014; Thu, 21 Apr 2022 14:44:31 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 4/9] dmaengine: dw-edma: Rename wr(rd)_ch_cnt to ll_wr(rd)_cnt in struct dw_edma_chip Date: Thu, 21 Apr 2022 09:43:44 -0500 Message-Id: <20220421144349.690115-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: 554dc92f-eb21-4adf-22e2-08da23a571b1 X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: Phpy6clHu0UxVmtccl5TJK36Qa3s43nPzUd0GiucvoiKtH9Ep1wkjfNEu7CizoNaL4ZfxV+mJ/eUpjd1NrYLdkOV73xLR5QZQsIvrOp05d5kY2qNaqsU5shTzKu0hPBnuEh+wUOQ1FARHV82/mXvWOZo+MXg6+fs3rRQAQo/SZoZCxIvs50G8C+i/lGrGr19FqjF6qLZIbhlgQkM4/A+w67RCtTm+3wOBLeoONOl4HA9xmDMJTwQL1Mx+XNjdxEWtJ3nid3oUdzBER/PEm06U1M1b8mtHkWvlTvhkXUpmvj00Qd2AlzswDSafbLiQKlYgdaOScKbWE4bVk4Sb9RbTl+oWVjabWwFEo6nGQmYtS+vk3Rl3jFUJQmZKQPC2yo8gXdps+yHoIvSTxQOqoiK2wRnaaVdz0XGdMsOYDVRjntAM/vo25BbmAMbqUBG/j2yuYPI+lTzaw7c8qzS70ZIFSOM/RCuks4+EQabBaP3xptd2hSgwB78yEDKdS8MlPbbpFvhD0PVrXWkFxRwkT2xrYbvKhncUiywwQbJuSNVgJbfL30DixoGbOdjYye77wELlQnYT/4gO7whd0+X6Oidz4zyHR3tw+nucHo/0d3vBdCQUdj85MkBqT3PEubWKVOVT8OkQhTF/DK/ISL2J+3sDmoh/Tex01/H4JWDmddLl2xPLMb/JU2yvJDIyH3X8OImB50FeKLV5cUlKaIRXusmDg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66946007)(6512007)(508600001)(4326008)(316002)(26005)(66556008)(8676002)(52116002)(6666004)(6506007)(6486002)(83380400001)(86362001)(38350700002)(38100700002)(186003)(8936002)(2906002)(2616005)(7416002)(36756003)(5660300002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HPOgdVkFZluYycgixhE0be/MFPxsoQlFaZ20/X7z9LcNbuo+FmGYtaDIVhQh0a9piTsDlh40t3wwJRt3qgIbgi29jEf28KVEmBMBWdAbJ40XQqZjWTla8oKMubAssffZDB1hOVdk2rmcBFgbGJdNZnzUJL3HzS0CLhQ/fKd8VnSvMu3CGPzEpxllaiFd2FD7JCzpfq5kSPZ8z6dv/LoiyNC98DEn1HqjNUPYc1ep7O3p4/hS6aOWW7/1oX+/ErBEga7W/HyWEABoO4VtVur4qE6L/j3eLpLZI3+bkS4UqXU7HIpXj6N99Rh5LXC+WgEypXBeIhyFjo1h/w2zCq2X7Cj2zQA/K2yCGT/qL/FxxA9qa0A612aWMI+FHnzqcFnTmiOSUYkM3KkFKSZGo3asH6pppCxd8Q+51S2cOlS+4MJW8k4LH8UNEUzMS462VP1jtQ94SssQrGyHiiw1Uz8BrllhaO2Wol7cnQhSZHGN9O5ZhHWL+5XLLnIFARE1nZqufj9MSCHlsomwlyjtbj0teV3zBKc3txGkz3KPMUkoZKwyhAHuyOCKmbI3xRq/JkZBF5PiLTWJg37qdrzbB1++MDItioGM9pk2t6oLW8Y0Miq7+xmCR3x6eDnMuGEZ2szmzdsXdvT4TX4Twp1uBGNrTlvfpt88K7wuC/vOMtD3HFDn9qe/ooIfZgs+NV8zUTxznQ0DFp1TMzgP1TTObqUjBR5idFOG6p4tPB5n3Up1wLS6XH0OOP90N+WUzkMDVItId1UARQvwTQeTFKAFt4zROm9uP0BniTzoi4SfamqWm8VZbgrniRirdcDrMxnPddAjXbnpXuBl543W1Xw++cs0hz2+hih1PIb0Yw9sESMb5wFTV9ZdjJ4bLOAGCOydH9zCQWj+aKshRyr3bJURQjDMJevJ0RFHDqFrdnO9rM7swIlwAbUb0d08iOwAKnRQNEfQiHbtGH5o6WoG4NppJinRNKlnqkvlgTtjmxBG8fK3yg6P+5lUl1g2Y9U0IsqindPiITrdMObZrbwG424v7BtWOyxfAFcZgSUQDKM33Z4mqwk/OYlDA3VKYKN5EzR+Ag8uzaMn0PUca5s+xy5v719HWcBLAd0N+hDOcp5i0kzNPHho8ITe/ERwFPQLjEeb3vqm+XEP3wD109knUDs0WTWunPCd04LuKipod2VH8OB5cOdJmBVw5fwY3egGXOacUFz2TawHdN/5/26VdKtbWBZitvnBe1v4J/TiFQajuy8U8ST7vaINVUhClUuaYX/RvPdz/gS677qZSw2vZTnttG/cxzpoKEq7mJLwrVP4wG4sH0ZTf3TZo4i9v7oaKRg7QvXVQoP+3lYU+aRGFNOlWMMP6nbJH2PISQMwQaumsr7qaTH9SHh4IaxvM7V/U3KZLcd2MOl6xPFdUJGiBBUu+QyoYIfZ/pEOjh88yrQK9yJwU9Tls666qihR1fWEh5I1wB9wXWG/sIKA7qwdtWDo94NwP6wewY70vlF6N2EJ84RgAHX+VB777r5oSGa72j4HJlGES+A+mi7pAMEhTMS312+/5QefvaSQc1ZJJZNpDH5aH8gDkt4ZfszuuMydkRj+pJ2KWR1oBf7QdIi1fccvyrc+Skwair6vSdyTbHgJxEk0zE8UqkaU4Jk9IttmekNo8sqZu+0B7HtRpN1BiX0YofLQhE6n2Eb+F60OoBLb5XhKpWynz+NtC1rnsc2RSeSMS+C3OQ+X9O4L+SpQZEpUOsTjVA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 554dc92f-eb21-4adf-22e2-08da23a571b1 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:31.2064 (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: mP4pSaCX7mIVM7jGWv4ieft21tp+Gox7PHOqYs7EF5jACzBVMrK/8VKTW+mkoxT2RatQPF22yQR39LAcOm02fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org There are same name wr(rd)_ch_cnt in struct dw_edma. EDMA driver get write(read) channel number from register, then save these into dw_edma. Old wr(rd)_ch_cnt in dw_edma_chip actuall means how many link list memory are available in ll_region_wr(rd)[EDMA_MAX_WR_CH]. So rename it to ll_wr(rd)_cnt to indicate actual usage. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v8 - 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 435e4f2ab6575..1a0a98f6c5515 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -919,11 +919,11 @@ int dw_edma_probe(struct dw_edma_chip *chip) raw_spin_lock_init(&dw->lock); - dw->wr_ch_cnt = min_t(u16, chip->wr_ch_cnt, + dw->wr_ch_cnt = min_t(u16, chip->ll_wr_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_WRITE)); dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); - dw->rd_ch_cnt = min_t(u16, chip->rd_ch_cnt, + dw->rd_ch_cnt = min_t(u16, chip->ll_rd_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_READ)); dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index ae42bad24dd5a..7732537f96086 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -230,14 +230,14 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->nr_irqs = nr_irqs; chip->ops = &dw_edma_pcie_core_ops; - chip->wr_ch_cnt = vsec_data.wr_ch_cnt; - chip->rd_ch_cnt = vsec_data.rd_ch_cnt; + chip->ll_wr_cnt = vsec_data.wr_ch_cnt; + chip->ll_rd_cnt = vsec_data.rd_ch_cnt; chip->reg_base = pcim_iomap_table(pdev)[vsec_data.rg.bar]; if (!chip->reg_base) return -ENOMEM; - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_wr[i]; struct dw_edma_region *dt_region = &chip->dt_region_wr[i]; struct dw_edma_block *ll_block = &vsec_data.ll_wr[i]; @@ -262,7 +262,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dt_region->sz = dt_block->sz; } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_rd[i]; struct dw_edma_region *dt_region = &chip->dt_region_rd[i]; struct dw_edma_block *ll_block = &vsec_data.ll_rd[i]; @@ -302,7 +302,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->reg_base); - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { pci_dbg(pdev, "L. List:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_wr[i].bar, vsec_data.ll_wr[i].off, chip->ll_region_wr[i].sz, @@ -314,7 +314,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->dt_region_wr[i].vaddr, &chip->dt_region_wr[i].paddr); } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { pci_dbg(pdev, "L. List:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_rd[i].bar, vsec_data.ll_rd[i].off, chip->ll_region_rd[i].sz, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index e9ce652b88233..c2039246fc08c 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -40,8 +40,8 @@ enum dw_edma_map_format { * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping * @reg_base DMA register base address - * @wr_ch_cnt DMA write channel number - * @rd_ch_cnt DMA read channel number + * @ll_wr_cnt DMA write link list number + * @ll_rd_cnt DMA read link list number * @rg_region DMA register region * @ll_region_wr DMA descriptor link list memory for write channel * @ll_region_rd DMA descriptor link list memory for read channel @@ -56,8 +56,8 @@ struct dw_edma_chip { void __iomem *reg_base; - u16 wr_ch_cnt; - u16 rd_ch_cnt; + u16 ll_wr_cnt; + u16 ll_rd_cnt; /* link list address */ struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; From patchwork Thu Apr 21 14:43:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821779 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 3F931C433F5 for ; Thu, 21 Apr 2022 14:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389606AbiDUOru (ORCPT ); Thu, 21 Apr 2022 10:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389648AbiDUOr3 (ORCPT ); Thu, 21 Apr 2022 10:47:29 -0400 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10051.outbound.protection.outlook.com [40.107.1.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52A6341F87; Thu, 21 Apr 2022 07:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lorMEgsQjt4YNIHTZzw3ntlaSrmS7+0H1LhymSbEb4DcP8QkiFCSgLakZfsTr6T/J4vAmAaFiqwb2zE5E4yhgOGE7yN4UwVLb0KFkjAzdHsh4UVAKmYmAgawRRXaNwbT3TTZu2b3k2DMocytWGKKnGULaZEN7vLHsqtemsv3npz0ECyRWDYJYvqnUknSd8Yk2Lwc79QgiEW4fU4EqTBbNLutB6nhPuN136FiX7LRqr1T6C1QzmdWw8pKBhiXCRBwzRFJq/PYoXWl0Uhog7sDjiaqzPS+z0ewvTxq+4bjVIAUTc3EqaOc9KnBa0zUUBzXlRxOxRTYGII4trxwl/MYOw== 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=eYUJkQ8Dp0mqy9iZs/YK4Hyn1gTP4MKjWnN2+JyWvGg=; b=FCOa45iGen1cPsUVBXdwVXYlPpkMIGR7XWVp2rhikfLElKR3IzP6IFbv9gogqoITMvXIABZJPtFFlgfXp5Sm3WCcXCXoH+O/7pwzH0eJzTJnoM3ycj26lANKB/5YoeqAKA82Kd3SWXbeh02ufVQ2mitDl8tYT1BIXv/yr2nl79DYqp52IJCHZBz/fiO+bt9/hfEiw/k++K928R01b+O+tRlrR2usVbWU8DMtneqiNAPt1N7MqSRN/HLVQ2Wjf9uxfF5TZHnhA3VvdR74MsCz/59+Oaj9lv3I551Y/xMf1tJZxJf8hKVf98/igGmKdB3xKy4+1ba3xulDPS5lojmDLQ== 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=eYUJkQ8Dp0mqy9iZs/YK4Hyn1gTP4MKjWnN2+JyWvGg=; b=KzQd9XMm1q+YY2yylZvmrKfbwPh+PL1fzV6MMtmvVVgYhZ8zkQnktwwB4AwDnRVsX7eJhwrdOtCIwZHJFdsFHIr7x3etiKTee5WAtJhc82k9oiEn2bZUrApdEHihT5HeGDbXwKExB+rUQsLm0lsivdKovHhHW0N19zC929jmwQY= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:35 +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.014; Thu, 21 Apr 2022 14:44:35 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 5/9] dmaengine: dw-edma: Drop dma_slave_config.direction field usage Date: Thu, 21 Apr 2022 09:43:45 -0500 Message-Id: <20220421144349.690115-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: 1f529a6c-08b0-4588-77c0-08da23a57456 X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: 5BHEGXOsWu7NMLUZacYO6KEW17r0QPmhCauNWCwqUgZ31dNpvpMerdyIwjYrtXLqBy6XmXpC/JVJ+T+5xB1rCJdjjxFnDaMHphBUAnx93wbsE7IRzH7pbP9QA6RKtuwG6VqsURlj/Ye3XMa6REiGdLhqyWNeoPg7E63jxEDv+jxtYl0rLxWCsz3hW8SuHlO3vk3SpK1+BJrRZfAtdJdVCHrlyLGlypf4BBVd5vejgpprS2BGvj5VqAOG1SgHcCiHWqYZFe7Ql9e7qNouWhLlA98DDZ+yrErSVYXuHFVkZtAoEt4Ieatqzjrt6UK0P+/AgLTwppkwxJx4g5PZFuT0fNr9A/1VXRqxWIYTGHoMN3RXtNmC2MJn5Y7lhpFv/qILL7ozb/sy1DfkfQNUlLqPY8mWVfriJhRlC8M188gw905WmaRZV6BieJK5Ahuh7yDO0uIHVeluCpIGk+rOmEJeUYdnDiaFWC4ewfk224eGbiE1OKqZETO0J64Y9tc6DP0H1Dw2sIOjJQm5QauduFmYsHp0xhIixdqTdUuQshAuizuC/hZbqhbWRGkElp/FfZO5XTUHV8e8LSFNbr+NTQsWA84N4RJiUUzHm/xJ1314JTu01SKvyXIJIbJ/Y1rbTB4HECiRup10nx62DG+XdGZAYJbbh1ey8phGug8fmFwea5evEOGKVrQEOi2EQ07Y/7repM4crz7DvYTLMruB1Vqi5w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66946007)(6512007)(508600001)(4326008)(316002)(26005)(66556008)(8676002)(52116002)(6666004)(6506007)(6486002)(83380400001)(86362001)(38350700002)(38100700002)(186003)(8936002)(2906002)(2616005)(7416002)(36756003)(5660300002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n/dhOj6U8vsmOJKbscKyD9yoLKibgfYyvsL6daS5257oQYJ28D3ZGDwwTMczajgLwA+OzoGye9MAJdDLMWaqTD1t39tDRk0gLtSL3ezfcipwqLUO8yMmY3HGqK/VfgBuKS1lamVEtq3homs93OA1CC7ZLmJwtQapEOW7QmmDXjdrFGJgJNZPEt9vgHv4pJ9qduWElnfR9v+Nmsk03kGvevkJeZntBWup+RVvqVbuDtIw4CCeu6Z1MeiFNCIqgVY0YkK9u/Ds5b+rka/TBb8uiiz6tJ2L0rXjKmSwwPlGou5sO8fYpcuTY5GiKtglqpdGU4vJ/Nl0XcARwhCSmd+VadmMHe2mXzz36um8DhF5l4thuBFe8yC10wtE31NYKaDuSqq9ZCQfoL6kI661GKH7gRSJy9wZjXk/O5RCRVzj/CPDEwnsx8ApYCzjoIONnjqIY46mi5g12dQl5t9GrCGqnau1VCSx8e8X799hfd2NA3Q0BfGu/NacWBMuFkcmYyUsscIPlF77xD512RnGUoxNdveHyfFGII2eqcqP+wYtUHrjRos1Z7ssASLUseGftkhnKW/fnBmWxkBDNNhPavozLrfucbSAn6F65mbTtD1xF+Xna6Ha4Pd4MzF9xWPASHBj5PlOx0GZk9mC5qW6ikvmCG0GgXdpZAxeebiAT+Sq+1TyqSI8w9LtfuFGjCKmOfZlDx+kLDpHApYlUJeTIiTUBNceHno7xRwfTjg59esTS0FV8/EGyKRRk+AX4uRh4OkDnldCJp6oxc3f4Pyy+JhSdqBPo5q2P3QL1TrYiX3OLIwAiyI0moQKKkEk07chLhfvv3ZESoSEAgu/K4RNMmlySUxrztfRJfxGrLJtZIoz+MbzIsvJoOkcO9p65nt2eKcIBB0eUmhtR+SXggr4mKXFyBiq2CAwqF2dzo7vDollJlGgDEyQeMFWKPi1faUyjxTr3SuRh7AyNzxBGGo2ImMITNBFnt40LOEgyVbJ8+OvbD3KPU70sORkIpVj/Ejmeaq1IeEv5wu3vpxtfoWN9LQsy1DsSCqN5EOWi80vtGNIUv7/a1Orvhfz4NIiC5pOGhjua8LJTZ0W8Bcg3ccrVWKWLGgngj+CJ59wuZeWxZ2gD4cYoDYai5pc0qQ8Njf/gVY/YuHWtR3UT2BE+gR3CQLAZnSlVEJgXa9STFwHal/v3OiwiGLvPJYUjpgk//TVyDQ+Tazb2+5C4bKgtQuuaY5Ywk/hjLMgwRlKD8Md5V1mYV5Nuw37mlxjnh1fncGEowvH5+R+7OBIiO8y+dbicv1csOGQP4JtQ4stkuxfKWBUFB8mWJqaTEhQAsr2d+cdN/T5WPuVdvdnOEhD1eZKdKU2pNY1ukjc5zx8OqBSMnY6xcycmYPlUkmnY0M9BV3/kXI3lZ0NhUyyh5xY2DRPvltrru2KUXxoIgVdTN7R83Pn4HKwJHDacS/CCHsmr923ASaW6ALLibgZCvtHvxGAyRMr4Xmd9EykzUFRTHlJd9/smlUnXvF5EjOPWj1YZarEqJp1KYBhr2SWbR6XCVaPGqkhbERBiUqQkDECEeRrZgoGJbDs5cC5b7lAh0dWxf0Zy2jF5HPGTVSOgfBHCkcB0M4NgHbAApmCsrA0M46+TciQrY30iNqo7mhRETKOraqQ/cZP+jl5735zLPU3hDoQGrH7ld520eKdTnM6nTfmtfqU9eqU7hC3w/e4Wzpd/C+/6B0l4kQuAtuWW4DRdFJ6MoyPcA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f529a6c-08b0-4588-77c0-08da23a57456 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:35.6620 (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: PcNE/9LzaXosSBvjLa3IuBkxAa5oY8LaPrZ4fCKxj43vRVLbta7nbhoomEdxXWUP+SCSrDkVOAAW0xFkfDXSkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Serge Semin The dma_slave_config.direction field usage in the DW eDMA driver has been introduced in the commit bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Mainly the change introduced there was correct (indeed DEV_TO_MEM means using RD-channel and MEM_TO_DEV - WR-channel for the case of having eDMA accessed locally from CPU/Application side), but providing an additional MEM_TO_MEM/DEV_TO_DEV-based semantics was quite redundant if not to say potentially harmful (when it comes to removing the denoted field). First of all since the dma_slave_config.direction field has been marked as obsolete (see [1] and the structure dc [2]) and will be discarded in future, using it especially in a non-standard way is discouraged. Secondly in accordance with the commit denoted above the default dw_edma_device_transfer() semantics has been changed despite what it's message said. So claiming that the method was left backward compatible was wrong. Anyway let's fix the problems denoted above and simplify the dw_edma_device_transfer() method by dropping the parsing of the DMA-channel direction field. Instead of having that implicit dma_slave_config.direction field semantic we can use the recently added DW_EDMA_CHIP_LOCAL flag to distinguish between the local and remote DW eDMA setups thus preserving both cases support. In addition to that an ASCII-figure has been added to clarify the complication out. [1] Documentation/driver-api/dmaengine/provider.rst [2] include/linux/dmaengine.h: dma_slave_config.direction Co-developed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li --- drivers/dma/dw-edma/dw-edma-core.c | 49 +++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 1a0a98f6c5515..184622be500b7 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -340,21 +340,40 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) if (!chan->configured) return NULL; - switch (chan->config.direction) { - case DMA_DEV_TO_MEM: /* local DMA */ - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_READ) - break; - return NULL; - case DMA_MEM_TO_DEV: /* local DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_WRITE) - break; - return NULL; - default: /* remote DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_READ) - break; - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_WRITE) - break; - return NULL; + /* + * Local Root Port/End-point Remote End-point + * +-----------------------+ PCIe bus +----------------------+ + * | | +-+ | | + * | DEV_TO_MEM Rx Ch <----+ +---+ Tx Ch DEV_TO_MEM | + * | | | | | | + * | MEM_TO_DEV Tx Ch +----+ +---> Rx Ch MEM_TO_DEV | + * | | +-+ | | + * +-----------------------+ +----------------------+ + * + * 1. Normal logic: + * If eDMA is embedded into the DW PCIe RP/EP and controlled from the + * CPU/Application side, the Rx channel (EDMA_DIR_READ) will be used + * for the device read operations (DEV_TO_MEM) and the Tx channel + * (EDMA_DIR_WRITE) - for the write operations (MEM_TO_DEV). + * + * 2. Inverted logic: + * If eDMA is embedded into a Remote PCIe EP and is controlled by the + * MWr/MRd TLPs sent from the CPU's PCIe host controller, the Tx + * channel (EDMA_DIR_WRITE) will be used for the device read operations + * (DEV_TO_MEM) and the Rx channel (EDMA_DIR_READ) - for the write + * operations (MEM_TO_DEV). + * + * It is the client driver responsibility to choose a proper channel + * for the DMA transfers. + */ + if (chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) { + if ((chan->dir == EDMA_DIR_READ && dir != DMA_DEV_TO_MEM) || + (chan->dir == EDMA_DIR_WRITE && dir != DMA_MEM_TO_DEV)) + return NULL; + } else { + if ((chan->dir == EDMA_DIR_WRITE && dir != DMA_DEV_TO_MEM) || + (chan->dir == EDMA_DIR_READ && dir != DMA_MEM_TO_DEV)) + return NULL; } if (xfer->type == EDMA_XFER_CYCLIC) { From patchwork Thu Apr 21 14:43:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821780 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 559AFC433EF for ; Thu, 21 Apr 2022 14:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389609AbiDUOrv (ORCPT ); Thu, 21 Apr 2022 10:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389655AbiDUOrc (ORCPT ); Thu, 21 Apr 2022 10:47:32 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2077.outbound.protection.outlook.com [40.107.20.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B39B40E70; Thu, 21 Apr 2022 07:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nHGx+4oSS6YRb3v7zrVOHqD0A+DsWaW0tY2HJE26hHs3RbVOHuoMHYY9oahXE0muKbDQJzfjsl1HQtDokpLJRXFt43a3KBcXmKHUdP559jj6h0qYuQNpcuawauD0kMkMzwXjaGbUIYIOXTwSRLwuaCgH8J93Rs/95nOLkrNZ3UyLqK4lSl9NL4KqByGACo3IQIcBkDXuRybCNxfM2FCVvBZ1mB4ZxOkbqP8kBi2RxNhtB0V5cHq8Rh0p2iBaRoowxZOJcnXJKi3S7TXGWz0FRttXerwjit/vmHeR7KnTfnT8F2gvf0IlWSA+N0Eeobef813kL4tZsp+068uyzS9pwg== 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=iDLR4RrzcSMDkGIvXMGWpsgkncN1pWQgo5kbq3jU6wU=; b=luqJ0r3+y/MVpdx1VH4+TyK+QL9a4HMe+UohRsEWGTBI4YrR669eSdPYTj/gUdCoLYfdI7g9nbv2SXIZZr+J4TWS3avgraxLIxVUiGsNdJ94rEuGORGfVjYcsRe7Am7nfXBN276SXGI30PdwnSGrDI/r4OIJG8q/2krij2eOBXZKoxGfh5OtC6ixo/8KpcpavSr+P/YZgEfwpQqoHexZaiNtOiWE6BDMA477j4YiCuDUlQL6lKJVo6gSbhDwzQn+nYKpRjfWhMk7ZRJDeq/cOdCFMVy6GB4jSgPiNCTybRNy2eakGrAmjvNYzWFcJhcAdRt4NP5kw+QrqFRiq6EYFg== 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=iDLR4RrzcSMDkGIvXMGWpsgkncN1pWQgo5kbq3jU6wU=; b=V68d7IIEk50O1PD3URZ/DQCxvmI/Bjnb82vtoBg/40QVpwaEv8ug0v8i20ZACU0InkFJ7quEjUlMbu6NOTiR5tTf/LcMl4bwhzY6beeJbqCelrYsHqe+aDQASP3LK4GtD+jB/vZ93ubuYqWMq5fZbMP0H+YcDiNpLYrxOXzTqyI= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:39 +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.014; Thu, 21 Apr 2022 14:44:39 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 6/9] dmaengine: dw-edma: Fix eDMA Rd/Wr-channels and DMA-direction semantics Date: Thu, 21 Apr 2022 09:43:46 -0500 Message-Id: <20220421144349.690115-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: 3de95cb5-d20b-40a2-ed27-08da23a576dc X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: jX7y6wrPgbt1WqQCH292woNcKxNrebxt/T2re11miu9xHDRIs+Pq41bdjO+bcsLEh3zhOA5Fkf6RGVTiP40nW19+IuHekin2EmVAOZZl8dgDkISzcFFJ1SxdGZl12y6I/NHJZXHm0YgaXZAxBg5+dE4RPOjMTjqltIL+XI3RTj/lqBPZouHjIb3PlrA0PwCoM5orKnx8AkeYdOgM7DpZrztekh1pnpjKW6OvMzf09smYGjuUWi79v/UxiWsmgHWGqfRZlIoQAHIINH2Qer48KKGjwepp7DfzS2JMR0IW+b5FbD4bOGMwye3zOo24vAkJGmiJlnPmY/Gke4PBXtEkVnJeAiRwVZ6+GMxFKnlxPRvxSxuRb6sCOYJ1dc6/3n/Zdkly0Uz8Pg8QK9/+gTrwkn57M8WbaAFzjnF8jve56NEoZUviULpnaONJvlW5sF5S2Pl7Bm1354ys/jVLsQJ1CIkn2kgSltEPmbFJeM9y9r3vmpO0xcR6VR2ujqTsEXJWlFP5xwLcb6gq7TkxmM++4ESlxKLBGe1tyk/InEx0HGIGM9b+oIoUcigV+SIjcLsc/A9pIgMvRXuLFjQtIHoBGBAJSRGX5+jUxfpRD7KGwIUKbs5yX9byrwwHng7iBm2E4N0W/P02bbrzaf0Qw43jy2nESn+zaJvzqJux6rmF+ww2Rua4MORAZTVKzi4fEeyi8vX0ngkxnQhoBxWFn/5G4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66946007)(6512007)(508600001)(4326008)(316002)(26005)(66556008)(8676002)(52116002)(6666004)(6506007)(6486002)(83380400001)(86362001)(38350700002)(38100700002)(186003)(8936002)(2906002)(2616005)(7416002)(36756003)(5660300002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FEg18Fk/KJbcTniFj16Ruba4Og8pN64v3w3VTjB+DFEEG3UodFz3eRZupMkTlJAQsnbmz00YqhmCHMs+lxcznWXGBjMTiFq1DTF4rL7ch9owYU/MmwDUR6+RVUU7MEa5nIqJ12zn8yy86TktRPfU4L1u0OioJyt59piuWMiNHaExrYUbZs/510Ry3G7PfjirTcbt1/qrOUoFKWwhUfhAdCRFwm5X0JeD8h8FHL4Txm0euLgcxnhdebk7Ls00oAzfjLMoCtySa+1bDicCMXIJCNc/TX5zucKTGU7RJZhAKIOTLJ6tp6OA4/hgJW6tAyNkqXLBzUOBMftG7HPmraW9uMFq0jH4AXtfxI6PjkUOJqZPX3LaY44y76SkPTUnZ21kuEnqBijrIOdfw8Xizl9zHyiwmOMqdFmb5Ojj76F/hibKYz02ewiqnXc3YSEVrwN4l0jPIWBjRZPVmMiJp0Qu9R++x3zlWewMEa8BepFm9NPH75PkTfEii8x5c2EZuCFsjVQh5UdegHKi4q9tCPtmietZlNEJx/PinRyPAr3mw72uBFoaR2ih03je9LtJs+nU9KI3suM6+G8z2+B5lXSYerqje0v5gC2Lbvc+KRW9NnKGj3hABmXevvul6MfSD5vK8RZjPLNJAViPpknP8PESSomM1IKkIXyY0YfQPTKJkhekO1ATe6V6mgayqlWLyp/kvp5WymOsh9jWS0cimpo1+XPz/weGyVF6Re0HAr/PJYwA9G7tJGFTKX7e5Mz1NYii/roDo2O1TzS0uUBaFufJ69knXGuvFm+liOtF5FGrB0nw+PP/llRoP2PKvwKOLCOuRkHDVb7vJhY4Hn510GeogrZJLBKqdMijIhDnXUlU55nEf4AfPalD8al3nDgdoeoL5SjzXjJDy/Hp7jPgsIPETAeKcMFrJQqmB107wEzpFAmex3b4I1F8IHoomyk2ZM+5d+gDQoFvIBk9na9zyMZNns4JTrPbclB3qU3OaCU91TlxzEf7Bc+/EeJmhoEyC3ASuYmGp/KAWpiFMtBc8whsHEDA6VnN5n8bBDpNZohTQW14hZETGE2yw7neSHyG+RFchVpRe/RyI2CM3J+RzuLnTMaklwZK0sysPt64G+XMQV9GFkNaHD3aDMMyNz0pV2dkzB9fqa21FUxEDtFtzc1hfYl0J0idWn2cmyREvF87jzeaUvpNcmRifuGddU/J+PsLWnulO/6QtNKuH4dItM7nANDJPnSiyF+RYQ34UFpKHUYVte9ExFVA+TdWj2UNdpzScG3PVgPHKG54Hn9a2Wn27fc3Ey5WnV32Bln3Y65JidVKv8voB4/Y6fymdU9oqBaIBYiJobPBLDFGX2hJnYRzbL2hS8MPzzJcjEa3oRGt1+zAmJj1s9mtc4K26I5fni+61LFgZWOgk4Wr2KZcZOev0dyGfo+eN6fMlwyuyUgsifa5WTTSkpE+YBoZJ6lXcfvZ0Yd/xQ4mgO9MrWzMLq8pQrwx0Tn+M4rESLQfdcWDCcNIdCEpXu4wXvRJfUQ/FABgzOyIHXpwZtQ7Kf0I7l+fcL0VVp/jhYB4jf3nD1UMKMgpsWtz6IzuFvjuppjkLhsQ3k7RAKIsNeWr4zKYWVu4COguvY/+jkZTe6PBV4p3wDmpdpvkYVl17QuqUFfiM8lTugSa423Flep90BjdYsfM00LgAy1Iev6tedezNYibf8Sd7Y7ErNAThHbzQldCHNB/8sEZLHcMBa6G3edfQKE5+Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3de95cb5-d20b-40a2-ed27-08da23a576dc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:39.8674 (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: PGBg2Ph5C1W5TRcC+NvwFXAIpkx7+SZSNMd5KSe4Zqwg75vCN0zMTxYgf21fxStQVAzFTUWIZ5lK0urtb4vQLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Serge Semin In accordance with [1, 2] the DW eDMA controller has been created to be part of the DW PCIe Root Port and DW PCIe End-point controllers and to offload the transferring of large blocks of data between application and remote PCIe domains leaving the system CPU free for other tasks. In the first case (eDMA being part of DW PCIe Root Port) the eDMA controller is always accessible via the CPU DBI interface and never over the PCIe wire. The later case is more complex. Depending on the DW PCIe End-Point IP-core synthesize parameters it's possible to have the eDMA registers accessible not only from the application CPU side, but also via mapping the eDMA CSRs over a dedicated end-point BAR. So based on the specifics denoted above the eDMA driver is supposed to support two types of the DMA controller setups: 1) eDMA embedded into the DW PCIe Root Port/End-point and accessible over the local CPU from the application side. 2) eDMA embedded into the DW PCIe End-point and accessible via the PCIe wire with MWr/MRd TLPs generated by the CPU PCIe host controller. Since the CPU memory resides different sides in these cases the semantics of the MEM_TO_DEV and DEV_TO_MEM operations is flipped with respect to the Tx and Rx DMA channels. So MEM_TO_DEV/DEV_TO_MEM corresponds to the Tx/Rx channels in setup 1) and to the Rx/Tx channels in case of setup 2). The DW eDMA driver has supported the case 2) since the initial commit e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") in the framework of the drivers/dma/dw-edma/dw-edma-pcie.c driver. The case 1) support was added a bit later in commit bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Afterwards the driver was supposed to cover the both possible eDMA setups, but the later commit turned to be not fully correct. The problem was that the commit together with the new functionality support also changed the channel direction semantics in a way so the eDMA Read-channel (corresponding to the DMA_DEV_TO_MEM direction for the case 1.) now uses the sgl/cyclic base addresses as the Source addresses of the DMA-transfers and dma_slave_config.dst_addr as the Destination address of the DMA-transfers. Similarly the eDMA Write-channel (corresponding to the DMA_MEM_TO_DEV direction for case 1.) now utilizes dma_slave_config.src_addr as a source address of the DMA-transfers and sgl/cyclic base address as the Destination address of the DMA-transfers. This contradicts to the logic of the DMA-interface, which implies that DEV side is supposed to belong to the PCIe device memory and MEM - to the CPU/Application memory. Indeed it seems irrational to have the SG-list defined in the PCIe bus space, while expecting a contiguous buffer allocated in the CPU memory. Moreover the passed SG-list and cyclic DMA buffers are supposed to be mapped in a way so to be seen by the DW eDMA Application (CPU) interface. So in order to have the correct DW eDMA interface we need to invert the eDMA Rd/Wr-channels and DMA-slave directions semantics by selecting the src/dst addresses based on the DMA transfer direction instead of using the channel direction capability. [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v.5.40a, March 2019, p.1092 [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, v.5.40a, March 2019, p.1189 Fixes: bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics") Co-developed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li --- drivers/dma/dw-edma/dw-edma-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 184622be500b7..9ac2723ed31fb 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -443,7 +443,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) chunk->ll_region.sz += burst->sz; desc->alloc_sz += burst->sz; - if (chan->dir == EDMA_DIR_WRITE) { + if (dir == DMA_DEV_TO_MEM) { burst->sar = src_addr; if (xfer->type == EDMA_XFER_CYCLIC) { burst->dar = xfer->xfer.cyclic.paddr; From patchwork Thu Apr 21 14:43:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821781 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 2EA58C43219 for ; Thu, 21 Apr 2022 14:45:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389610AbiDUOrw (ORCPT ); Thu, 21 Apr 2022 10:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389668AbiDUOrg (ORCPT ); Thu, 21 Apr 2022 10:47:36 -0400 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10062.outbound.protection.outlook.com [40.107.1.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99F294161B; Thu, 21 Apr 2022 07:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SAtqtQQX24QuM47Irp9p48UJ9GyubJjnGbUtuPrIbV2tTB160YPjru1JKBoWtiS8lYMnuFLr2cmUR+tCHxsPHtk3W840hqUwx/PMmyTybWzXOJwWemeobs9tNiMClJJZFzfT31OZ1WgEbzXFyR9O46nOeEYYaqX5gq8N98KNh34tmMhiIDVhwxCmgmUd4/orUQ0ZmrDCY0LaSOcRd3rAMnr9h2bQMFEMT/iMYV7AjM0Aw+AHf3AC8INQgqk3Leeeb7006j6wwVh2XvD2TaTsh6syo2QnhHTnhSt30jcGKO7I87JuKEjSGq7NDpA+MHHWCqK0fWmQNTScYD+9AAhW5Q== 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=dHsr6FArWpaVgQuSGe2hQzVTSCxZQaRJ7H8H6EDEQ40=; b=lGPneIJEIKrcHwM5gl0dW8zUs3Gn3Cb9QGqeithj72QmKXOqyiq32yk1SbuVjBISd8qvRB2DqM+xw034LJBc2KNOpoVMAWRoixMwrdwQdU2IdviZTAFmWVe4TzkUDa1FdoLZ6a/8zP8Uez4MqyK6QPv3y6bbU53a/zDYVVYLJZdQ3D7SmA0IN8mwsFjNtK+0hzYj2DfGV34diwv9D9IOxvPtpK/VdcgZd8K554qbrwsMS0ARb1TZhO2VrWtfwfQM80oQ/k1LCjpxyZeMZriprdHEwQrZXi1C05SbprnsdGFM4S7ujV+GgnJkBdfapdJQf7EYykq5ihs/b4WrJSadkQ== 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=dHsr6FArWpaVgQuSGe2hQzVTSCxZQaRJ7H8H6EDEQ40=; b=rbcshDHsXKze2kqyjIcOkoTx4DS6fZ5YvjKkOXWeNo6FzNO2OLp7vTbSxKmTsSZWsq1YxQxXAOHlkKVxohut/lSWaz0A5CG54RyuawOKjOYJVLRHq5Che3iaJVIjqODfdBLPY8auprCOg176dJYDSAP3jiGHNOOinHdDPhYDV30= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:44 +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.014; Thu, 21 Apr 2022 14:44:44 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 7/9] dmaengine: dw-edma: Add support for chip specific flags Date: Thu, 21 Apr 2022 09:43:47 -0500 Message-Id: <20220421144349.690115-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: 4eac2576-f9a8-4709-a57b-08da23a57960 X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: ekKEPKY1FqpBFEX3uA3fs3T4WM/j1xCcIT3EsijRORNyWSWfMstABoK6uuszhNnc8mHEJuwN/YuHZ3WZK/QClSljQsoou50FVZvGB0kqS7yPcG+Uj3eeIE1k8k7+57lqD2mlz6n4oYIxoI1N2z7AgGQCMbafmY783al1BOo6OueNP+l7yvMxfdQw+cnGpRG+WZlhjKNViSxhy9NpuCCkywrurlHAgACp4/MSLjY0XVqCRLC/HvIYcGanBUHFnQ8PxGcvJFY1ii1HBLac4iVap3k9axfupdrkl1I75zVVaw1PqQ6PMlQo9xl3MtwPMpqDoWBnAHBjZTPBhL0mCDapyZ2Qtjr/wYx4FrgCYte4MJedUBHqLH6Un1NdLtRcrAEoIIdFfvIPDuyTUtfUYwm1o5EKzTkQm0iDow+DJbLuG7fd6vK7db2WHY41R/iupB19UwEiBL8z3UqD0dOQWX08dhRP5Dx7qemNIaQHXWQ0TEVAEW6gWq8MwJbYCrIQheTV0ySGHYvbGKdS7BgqJhKVNbsxbQLY0BxSVtcbTdZVM/f0vqNi8bQC599YoKFnvEnxX0sJ00MIaShWdj9s/vEbT3QhcbeI3+tgy0kA5BXaq3q0H5e/h5PCn6k1neWBJ2LECWSvinQN2Wenv8PKhiE142LMeRR/077U504xRCdY1T5l8KwmtC2AEfArSj2WmTVgCHPDffIkPMF/XLbzFP+yrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9186.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66476007)(66946007)(6512007)(508600001)(4326008)(316002)(26005)(66556008)(8676002)(52116002)(6506007)(6486002)(83380400001)(86362001)(38350700002)(38100700002)(186003)(8936002)(2906002)(2616005)(7416002)(36756003)(5660300002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n2lPGZfNeskdLW87uktkv+8Y1T/fScUUAGjoUMVa9NC7v2fHmeoXf4Kl88hI0IadS5n0SBGmusM3GrSMe75RugVaK8z4Ory2D9jlfgW8gfErqRNm9ONmdMjZuvVHWj4ACIaNCvCIoktOSzq52znUA41YGHUVPCtSNC7cXEtzE0m7oPoLDOwSxXxSWrN1mQmRBfrn2B6mzJA2sA7YJrXLX7OdEllUqgqVMUpbVnYikvfhEgBJm5ZmfWKsuxF1Ga2j4dEC69AgI3btiLIXD5ww9FjDTIjE2A4jVMLdjYUWLWXpnWrYO57XkCbwwvTIquLN1lqhdKNbZ0qW65FniHJAdXVLYyS0E0YYKTWLNw+VF0gmZ3TmOyszILtQI10yfffF0izrV8erjD79DKCcBhCUawvNUwM0MYD95KAzmlMFUZBQ8wr2Mm3Yn+FoftYb0zDF71sGj3kiBrTIbFBB4zq15qY4elyXeWVkXQMuVeWtNRBLag7SNUMNaDIvaUWWB9+Smo8/mqQwv9rlv+i5cKmVipEou6V7iFn7Nb+YSF76fM2TKzmbVCT+uqGaIdXWclFKHgXJcZMfzEIXQLFSb8hOBSKjZYgaW95W6BwrUSPSN2t0NOcNRVtS+yOnyown8Jus/RInFddomMeCZL3XfzfwE6a8p8Yz27G3kLqrNV4OTc7/ts90I3lEFjLq90t3LnImCgrWm9tQ9uBnMzQemrj/DjYMYPJV9yFncxhSbtK72UHAVs67HceoFIMVZgw51kjyiYbqyoj1WUmAgAm7EIcqhWQJT3YpIzNHcANOcSl9hBVYNTkOikM37VrRZVWhlv1/JHW6uWpoSAvMrQlzi7Eh5lZkeD4bOpHCcqp/eRojYUVBuY829AatS5Nu5fS3sHUEz8xY940kex3EegkNbp9ZvSdhn4M9gP7ZFg6pREVDNJb22Aqo09WzFX/8dUC2QFJoZhIyiYusMs43VaCy7cnMERt4mH5mdXsiP82/DUZ6UoRQBv7+CSDeROISZZ6ML19rJFvI+MRO+or7GsUsCuJ6RKx170pSpHsUWLMNWTfTlggN+XS/AtSVqmGwSiq8OG8i373tHW73evKTk+ih5e3ye9wGRdFbWXQwidpdS1hk29Nxk0Y3PEx1whrih0QRm2Q3YwZdvzPrm9W8pWfWr49YuIXYQIkFCex1y5hs9ohwIlG++cOkzfJ3NfLHoTKSxEo0IeDHJHs6XWxm3/JR9q3KOvrKba/w2ck0q6qzI4oaJNkRemA8r0UtkRsNxk5HNqPIwhFdxNRuBuxaI8JLTTvVr8apQZ7swfPlEkgeRhbqg0PQP36oykjZSqlM2lmesFuWBwSqZO7ZVryRDFN5q+P3VU/euKG0V8JBcpId3d6Nq8mwSuocGVHsO0Z/LH4PQgkbz8NvlQjkBgv4mjqSUgUoRftkJjSR4cRv+VSc0innKKUuWbf6akIEhGofTcrFxPpaahbgqQjDMLHocE9RQt+m7GU7/VZyBTrG2Ve6xu2eFassE8g4lleAUaYTcl3R4cBP1kLihC+raRzUWMSUy5egKFmTdwGPAFzCBb9akpcSA4Fz4ahspP8PwlSRtrMmf4EFxAtDDon2Dm5/cih0RbUYCYyBssKfStF/MpyRcNDXB6/oQQFTx/LQ2q/N0fBW37o7R+EXI1WKws9vvVewmW56wzrw3YSweR1sHasZhkIYYA7RO2pbci/DmwWPE/s3Z/8xpAsM9EQ9hDmLSGeaHt72wA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4eac2576-f9a8-4709-a57b-08da23a57960 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:44.0861 (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: 7I8CNuJUnyqxpIbfH5EEfprvziRzj7bKiscAzq1txqrl6VUA+x1Bk+XUf+Yeu4TeFJfYuSRJyUvbt+6G1tZFtw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add a "flags" field to the "struct dw_edma_chip" so that the controller drivers can pass flags that are relevant to the platform. DW_EDMA_CHIP_LOCAL - Used by the controller drivers accessing eDMA locally. Local eDMA access doesn't require generating MSIs to the remote. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v7 to v8 -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 c59e23b9f9fdb..2ab1059a3de1e 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -301,6 +301,7 @@ u32 dw_edma_v0_core_status_abort_int(struct dw_edma *dw, enum dw_edma_dir dir) static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) { struct dw_edma_burst *child; + struct dw_edma_chan *chan = chunk->chan; struct dw_edma_v0_lli __iomem *lli; struct dw_edma_v0_llp __iomem *llp; u32 control = 0, i = 0; @@ -314,9 +315,11 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) j = chunk->bursts_alloc; list_for_each_entry(child, &chunk->burst->list, list) { j--; - if (!j) - control |= (DW_EDMA_V0_LIE | DW_EDMA_V0_RIE); - + if (!j) { + control |= DW_EDMA_V0_LIE; + if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + control |= DW_EDMA_V0_RIE; + } /* Channel control */ SET_LL_32(&lli[i].control, control); /* Transfer size */ diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index c2039246fc08c..fbd05a7284934 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -33,12 +33,21 @@ enum dw_edma_map_format { EDMA_MF_HDMA_COMPAT = 0x5 }; +/** + * enum dw_edma_chip_flags - Flags specific to an eDMA chip + * @DW_EDMA_CHIP_LOCAL: eDMA is used locally by an endpoint + */ +enum dw_edma_chip_flags { + DW_EDMA_CHIP_LOCAL = BIT(0), +}; + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * @flags dw_edma_chip_flags * @reg_base DMA register base address * @ll_wr_cnt DMA write link list number * @ll_rd_cnt DMA read link list number @@ -53,6 +62,7 @@ struct dw_edma_chip { int id; int nr_irqs; const struct dw_edma_core_ops *ops; + u32 flags; void __iomem *reg_base; From patchwork Thu Apr 21 14:43:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821782 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 40C19C433FE for ; Thu, 21 Apr 2022 14:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389616AbiDUOrx (ORCPT ); Thu, 21 Apr 2022 10:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389686AbiDUOrk (ORCPT ); Thu, 21 Apr 2022 10:47:40 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2073.outbound.protection.outlook.com [40.107.20.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A08514092D; Thu, 21 Apr 2022 07:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c8nRugIy9xnEVvuE94tRvC64ner+iqhjkTXo6IH5U5eSFO1Ec71N0EMGBeEL1j1nnaXxMpGyfv5yzmw0Abs2sV0C+13TQmgZ8fvmGVoBIY4WP8mLwFqmAkxk31u0aYFGbUdiDrzbsYPuGn83RJMzGV47DCnupXlXCLAHq+oiokhOV3rkaUxiVJ9VvNvlFVErD7Q25+wFhwm3HVlgQQrtZVNnSfBgBulwealC9yYMLuBdah8KzQVs9DV87Jr3GB5F2Yp/OJoBjJYM7wRoH4pXoC7JQgOztAo9OSj+5tq8R72AGWJS7BpDhpohDRmPCi12j4HWsfbS9qaRAnynmeY+Iw== 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=PkjgbQ4rONBBxaqeu7k7MNzsLVbp6fcJxxASe5/sQNc=; b=ci2pikD9CpiOmROGOG5oNYIpXxjRDrGmxmIC/JhMgw1o+vGPgfRiyIbh+wSyjvdsifrX+vQ/B5d9D8eKFiwKNN5NU11fzDH8xyk5tqjcIJDIsxyR7ZJiXqN7AfxRpv88Xf2Uvy2p4LK1wPShYg8hC7IDLqTACiuYwdkLrpcY4Mpl40nZUyY6HOQ8TwpQPV6mncoTFlNwzTTqErvvTQHmmpEGdxJlhOyxqnKFQb/p9V9WpARpIlQMX/Vc3jiKVsfpyvYU18mlkQP3gLbuc3mrXlHYDKZlBv0rgHmXkb9ZeU8zH5D9vWjnFmBDk+2mfULV7aa2cbjLcTuXj5cg0fbEoA== 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=PkjgbQ4rONBBxaqeu7k7MNzsLVbp6fcJxxASe5/sQNc=; b=elaa/8zWxCytwoeUsxtw2ZiUMkTzumF0p4X/QytZeGBVIJXqe0eS7PQ40C+4EoZKIIZbbsNqlYCMGF1ch05sNe4f0bSFq1v7IdfVSlqnHtjavD2JL74mYZttgcESSKIYZPurZqS4dv5Ti2+2COAz/xiRoI9yBkt0dSh0vnMpx0w= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:48 +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.014; Thu, 21 Apr 2022 14:44:48 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 8/9] dmaengine: dw-edma: Add DW_EDMA_CHIP_32BIT_DBI for chip specific flags Date: Thu, 21 Apr 2022 09:43:48 -0500 Message-Id: <20220421144349.690115-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: 10ccebba-1d57-4dd5-ce8e-08da23a57bf7 X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: siaRafxn4CeE0nfo8J+w/W74DnL4+7tfAFl6ph6GY6nVadAJ+C2MsB/iY4F/bwxqpK+axEd+q+8cx/u7txUWdY0jFwFdLtIf3xeArDyGQdSAjJ8j0PkJKYHsxu3+qMi4pSbGZmVgDiII6X/TMgTKmtIorwbVoYJvfoJFyD8WuJR38vT3+/EOEQmR4I1Q/Po4YBg7tgfq8hmN5iW3VQnYw9PI0YGfmrnVffjy40nd41kZI5M7TtEPcbQtBttNETu7BE7sidYeeM1vmZpTkhL1qUUYdOEIPsgysUlE8dJmEc8EiubDyxy+AJTHn+5Kud7lgW7iTsVFAQEZLtF6tKnVx669SLotNnuT8Cat5Cdg90aplof72DWyZj5SmhethBN0fD3iXrJp4zWIEQJuSfKS86Bzjr9JZQAlEqOOpntIedVTuAbqbmDSNDNVj+o116lQ1W0DqkPWgnQmJnq+jCt/qQgvC2Q2zqooELlQ/hwZBnoFOjoz9yBMo0OvVL5zC6ob7RUFQagjB/i9ewaNQcyeeBnPrBGAIGZGbJoWEAEweHcsYQSD2clOtdK3N6Z3OQlBeaRtwRjahwB3qpzonGhOtr93mLnbbep/5tCLCVb8Ch/0iX3XJA7KkNP3luxfp6bqmhgigM+fZ+gEXcB1nYPqDQ7NHjxL9bGTXNTFw6Vw791DHvGHE8SKekaRfO33KbdfYWaQht86vTNmvQf5GZ3BJw== 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)(38100700002)(38350700002)(186003)(86362001)(7416002)(2616005)(36756003)(5660300002)(1076003)(8936002)(2906002)(8676002)(26005)(66556008)(52116002)(6512007)(508600001)(66946007)(66476007)(316002)(4326008)(83380400001)(6506007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6GbNA8wpUe3dSCMtRwlgwL0yCGcxEf9xZykCR1/EaUnNJgzjGF7GIWFv6T/Bpu5wFRmH9h4Nl8CeVoTnj3rXwi9x1x47MPPSHDSHyANZFuyic7c2b5puDKNqimaOhV+uVRshrck2sfTDwa4vpt5JewLIBip+IDWGCneLWJ66mwpksc6PCyhWSWyZiYrlUI3kaz/LfYsytVjj+zclJz2bcBb8u3AA8Hl5dAg1O4rp8wRvCwHZHTOmAkBuFuaF2fhyeNU26J1dnVR6AfczKIw54E+PVxBw1Iny4zCpGBS+dDkgkQ5CSYyMs57w29TtNceHPxY2vwxaToCQX32XTQkqZZw7Icd4ZgUJo6+y/1+YnC+hHLT+yXWe1t7ZGsi0uUOEcLAF1f2XelnEAxmZCBDYcb/z//00VCfFFlKdEEBcyiTG215+NMeBXf++U23/3iHCC7GZ+d9NpPVB353TN1USBCNS/M1apr4fHinl9TIb3SwhTNkIMN4fmL7f7Qublc+icwJ7zZf7XWHTtn9Ks/GIBGqfemfAZtSRnqkEoLXSHaboTIIvL/RmQvAj27iIU46vIatLhBc8fzKnlcOkHQGwg0/LmMhTxC4SmmiX2Z7cYSwryByUYSY7oQSOOtweWSrQwfyh7uFNL+ZuTkp+sYbOG8Lf03mt6JYVmD6fR9X2L6TU0z7AnjoM4R3APNANNAuqt6leTSb/qFSaLeWZbCcJs+GxaItKFhfLBcnkJMJNb9AEd5bkwSk5Hu7BFV9S1/1pzh58gziqRYz1G1vegUHeDxq7dGtEh+C4//ezn6xzmPwcRBCR2y6THULtSA943/iZoEM27aqnxogGXJwKGWC0Zvg6vmeWAtouLdImmRX7cpRuxgbokiGN/C9Fr7NgLop4Rvetbmmswi2DvEvG7giUKizKpzb6Ofagv2GwuVuqi7RZ7lHiWLGEcD9kVCskoS+ncvms9gVOC5I7f+etR1IdyCa9nBU0iu33pXe5RYCmc+1k3OFOGhlrWF1zxsbsAxaRUsQ2opNicWeRoFzfXAgpy5RSyVYG/6q38FKSdwz7NbaF68mASxDSH9grTQxQealrW9/u4ENc/k61QbYoyEH2FaFKxQnMa1WlLaL+wSftpQja61gDGZcoy7tM+dSXl2PL10OFJSjbO0EX0NXCAGcqWdh5XhuejtMTYBqwfoGTnbJ1R1xebV9XlCnFqAYo6WNvwip5uMj8hsioLEUnnHiEvCzk4UAW6Gn8tWe0zX5lLH5LJ69eE2BnxkuWtsp8XuoZsZQhQQmDTxSE3DbVFHWC+vmxEZ8xBxIoWkuvYz84Djme2BXIDhjo0QSLO8BAEgdzMUzXOPFnpPWiXV4w4uU0sTS2YHgfeXeCkCUKA39H2WLhxpbA21tOvC0m7M+UCMMBb6hfhGlcNFdFOwP67MnVrATCdQDA22XIZON0AN/rrOMTKDSkcoUPRUT/Jmcy34CpCw8A4lziABpUvPB5J99qfqiEjr8y1V9HEMBP7RF2pFN5CjAerxEPgMU+fSiO32HYz6PKTIUEMP89jKNM+eDaTcqaIUjMkXL9UB5bPMjwat4NVC/4C59x3Zds3mDyVILxyoIa049ibfgeDfNxx6ObZPvOx7IAR4WoozjY3Wu4C/u9onoGyVya0SsLfI/GoBrHTlnK2a2E4KbZt5LFEd0X3Ijb35FsY2q+9lyu3so4RGGVAkXS/6YRndlA2uFMwe0KdjaP1SwJ7ak45vGR+BZU0w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10ccebba-1d57-4dd5-ce8e-08da23a57bf7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:48.4634 (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: a4/pI8s9AKzNP+q/wMzrGBX+8Spvhxp2/znzgNYUOm2TXaL3rSpy7BStE9VGBMybqYTQNTMLJ310BFsWQyle7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org DW_EDMA_CHIP_32BIT_DBI was used by the controller drivers like i.MX8 that allows only 32bit access to the DBI region. Signed-off-by: Frank Li Reviewed-by: Serge Semin --- Change from v6 to v8 - none Change from v5 to v6 - use enum instead of define New patch at v5 - fix kernel test robot build error drivers/dma/dw-edma/dw-edma-v0-core.c | 13 ++++++++----- include/linux/dma/edma.h | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 2ab1059a3de1e..2d3f74ccc340a 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -417,15 +417,18 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) SET_CH_32(dw, chan->dir, chan->id, ch_control1, (DW_EDMA_V0_CCS | DW_EDMA_V0_LLE)); /* Linked list */ - #ifdef CONFIG_64BIT - SET_CH_64(dw, chan->dir, chan->id, llp.reg, - chunk->ll_region.paddr); - #else /* CONFIG_64BIT */ + if ((chan->dw->chip->flags & DW_EDMA_CHIP_32BIT_DBI) || + !IS_ENABLED(CONFIG_64BIT)) { SET_CH_32(dw, chan->dir, chan->id, llp.lsb, lower_32_bits(chunk->ll_region.paddr)); SET_CH_32(dw, chan->dir, chan->id, llp.msb, upper_32_bits(chunk->ll_region.paddr)); - #endif /* CONFIG_64BIT */ + } else { + #ifdef CONFIG_64BIT + SET_CH_64(dw, chan->dir, chan->id, llp.reg, + chunk->ll_region.paddr); + #endif + } } /* Doorbell */ SET_RW_32(dw, chan->dir, doorbell, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index fbd05a7284934..8b134896c9edb 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -36,9 +36,11 @@ enum dw_edma_map_format { /** * enum dw_edma_chip_flags - Flags specific to an eDMA chip * @DW_EDMA_CHIP_LOCAL: eDMA is used locally by an endpoint + * @DW_EDMA_CHIP_32BIT_DBI Only support 32bit DBI register access */ enum dw_edma_chip_flags { DW_EDMA_CHIP_LOCAL = BIT(0), + DW_EDMA_CHIP_32BIT_DBI = BIT(1), }; /** From patchwork Thu Apr 21 14:43:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12821783 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 D2FC2C433F5 for ; Thu, 21 Apr 2022 14:45:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389614AbiDUOry (ORCPT ); Thu, 21 Apr 2022 10:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389719AbiDUOrp (ORCPT ); Thu, 21 Apr 2022 10:47:45 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2044.outbound.protection.outlook.com [40.107.20.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC5EF2D; Thu, 21 Apr 2022 07:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PqN9sXNceL8hhRGKOiG4PmllIGAlFTnkh102hIa83rmIa1qv/BFRc6YO2klcQVAiFLpP0Exi0h0qQN0MM5izDXQmmAAbY+v+TzhtbC0uKdwSiAKBW2LWo5ZB2DjdRhBo6R1Ae5OaS13wxZubUx6G/qK5zImc9R+91KPUclIiHVXxDjE/hmQXObPPGigQJMV/H5z2yEi9m0PjQUcI5U8BbggN0ostxYzaWtEIRjtJx314nH2uUcvA0PUaIjcp2zZNz+x+RDwiO3qkRlUPJ5qf+tVm2A8MIHALmRg4yef0C3LL177LqDEccXHOqt7N6odIImXILTdv5Vb+MpCgV8Z/ug== 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=Pj/pveH5kPziUMCOxK05/YsFnLQbVdu/IqeDPLzlQX4=; b=OnD3C+WGWcTah+cDAFAn6W+d2h2XFTtMtby9mVfFoCZ3FFXq1Of3th8JAVeGwu6S2iz1gxpEXi1PnJtPP4fuSQ6yfMBfWfUIR9CAqz2UWefcbKbBEgfqPDlBR/NvrgEs33HBNb2XW50XllKDEeBORcwUBJr1T0g6DXsXwDO0ITh4at4l6cJ7EWZdaNcXAbTr44omdHAp885Tvt4m3d/j7te8+qtBnJi+7Kin0pzcBV7U8tbeZnI7Dv+VERv1cms235afsZMMrc5A6WoVAye1vB0FHMKn3Oke2kJjamCOIci/zcFqD550VA1oit8i70BMh9B7ZH+fuZ0CjAzqY0yPUA== 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=Pj/pveH5kPziUMCOxK05/YsFnLQbVdu/IqeDPLzlQX4=; b=e3EAQgK7pjEihbniQhb8tBbWap4rFzDyfJ+Jwkd8GZOz3LQ5SffdFgC2BWN2LQpkdc2tAC3Spb0Sv46wN30D09UG2QdOwdS+qnMT60TkGKxeehatXaLFJccHeoGnSvZrzaP1CJRyezwXioXOx/KCxqVUIP5P2nLMz6kZ0BBe/Yw= 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 AS8PR04MB8689.eurprd04.prod.outlook.com (2603:10a6:20b:428::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Thu, 21 Apr 2022 14:44:52 +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.014; Thu, 21 Apr 2022 14:44:52 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v8 9/9] PCI: endpoint: Add embedded DMA controller test Date: Thu, 21 Apr 2022 09:43:49 -0500 Message-Id: <20220421144349.690115-10-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421144349.690115-1-Frank.Li@nxp.com> References: <20220421144349.690115-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) 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: ddd5d5ec-74fd-4d72-8b3f-08da23a57e93 X-MS-TrafficTypeDiagnostic: AS8PR04MB8689: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: pfTkx+/B4HPP/TgJRQ2343wZUk8aqFZF6ySe+ojX5wTpp52q+jUN80h6BbRWaEdnUpVlW1mjo69cCjf5O9fhtTw8rNEjfXc1znorrArLYlTznoiydtFHCrH1vDu/Y6qbr5QM3gp58HEOm3/avIAajuZ7POJM5Hr4x2Ek5tRu2sfIu/HJ74sVxt+Sh/+6BvdvKjQvNmk+l1nztyyqyLrGQzrVuB/PtSA8sKpyFWseA5HLvQ2WoL3L0wTAeh6k/5WOlwAjdzSAopaLSM0DW18rzOi2yPiqGQE3LoZfKfWFc94/QTbWkKIXnpJpObCsE/KPL7kg/h7gbBzzCEuBsEc3t9Yn+Bz/YByuUxRf1FelEQ461+5Q3nJhcGS2bHrcR15eoWNZwPVkfFrPsqfwT2W/ll0YZNVWIYjG4RR+RtU0mX949ZixAFv2HOXhX3oiEHpM2PqkUg/KWjfsqQWoojR8cdbWVsvmcaNuEg94iVdi6EJAKNHVDvJNyvaSfH9cLxg/5F6Dz4f0YLWyuvwfUzMfL/qZngExkAF4uhPR3vdXZIxwWhq4atNA1tg7Y9gtnDRPHIbKauEc9eivkFQhNQromvJb3r6NIf6gLMMK0Zm5wJfFDSP2M73TW1pl2AIXqqqof4RhIB0MBRN+iLCV6gWXBQ8CwHhiqPF/ToHbQxRxf6FIbuMDjcKzRgrx0+fyqIObOEUsJjsLdjF8cLLLZTdgaw== 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)(38100700002)(38350700002)(186003)(86362001)(7416002)(2616005)(36756003)(5660300002)(1076003)(8936002)(2906002)(8676002)(26005)(66556008)(52116002)(6666004)(6512007)(508600001)(66946007)(66476007)(316002)(4326008)(83380400001)(6506007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xo1Bld3A70QopxTQdiHZ1fifwgdcQDRDIhlUxEqr/OC0UkXG492wyg4qs+ZwohEEDgPyTrbt7QkGgS0BiohmfFggQ6oXjxAwzxztx4mam4X3ITQFdYACL0FxFJLELLjyNGmeEo20oI+4sTir+/p964LDgNlLCYWYBhx9Vws2CzQR5JzzeaNgyKetXD8vTB/AHLiEHUL+DumAviReqFHctKJk9Gr+m4XIimZuT+WS7sf3MtpwsLlqtapAJ1EyV4DYhKYcRZniBOJcmSI3tj1saOAzHiG/2iCoN5ol5M24CdQpf3IFERR4Ulm3tVQWTGvgMeFBlvdCgpJY7COGb/q3QfWYzSsI3t0q9FySrdObwHmvu8Y8ezmitYzM541qWXSR9/KrGKQA4J3RghYL1+oEOg5Lz62rNPsFrYmbMyFQ9YaHvaJ9hoPtmhNW2i/FAMFTrPGDtmbK5NLe5gN2/1napdhhrlk2EGvPWHpYhzG2iOUqhbcRAEcjI8hchdGFTHKL7G4Mup6TLeKDQZri3iPw2qsevIXvp92WdqhZv7BBnS1/TETcuy0LDpMgXSKdzL+P0svyuPnLNXTDIJjkXbxfWmQ2eqeiPsC83CgcfPBvVnTPcd6LHPZUwba2D+JDMMyGuOS4BCUYAKqOE5QVybX9AdbEiA66klh57cZSd9sMf9L1zvW0u0MDVHEhiBsv5TVSqEsB4wXa+/mmpcHSyBs9F0m+1FHrdJIFy0Yp1Kaa4/MbeLE69LAuvcGsdXgKnrw+/rIbP5JhuGe1uFN0J6RQ2sQw/7lG0Cf4fiI8n3nNiorNE8yriKqN+ZlcGlBvSiziWQJTF0vwN4o+hxdc48/7Cyr3FdUQtvgX67GMEj1fBQYy4Q2Cn4V4MRVpMmbnFRrkuemhspkrGfnuZb3HntvD5vlp5vQY8dmyVENW4FWV0bPVhuoXCaUSGSw2sRHMQmSSExs5zKL1EaJuXPk4FSbuGomJhjzW7yv3c8GxzsscIArJMRAQ6gFcwA7o4fDOk3KrYgmIlOV34VOgcFIqDEW/QOnkqWpb2XDpjaAK9l+LuYNk7lvNjJmTUF4rkda4k4EG77vxS/Yc7LN+syfMxAlTqKfEvMcQfp5C66MtDDPP20Nh7W/xYTMfbuZe+hQCIKHCxvBTT2yW8UKSxpJ89aGzO8Mrocd6QPxYsAJy3SpLeWTZFDGhyfCoqu/cx8DVvJVguoYGY/vtQkzbaYNAuJbntoG3FnB18fOzs1h+PHEBgfXiMTm+b/DBXTdBV9BlZ8NrY6bHEO3gtdhHc8jZ94AwD9pvKm8xplMhr31YfOQY8pYiFROqICFIytYmBUj/Gitw4yMeVxkAJhPfdpuu/Pt719KnqIwtOYSVkdlIALAG8Bqtou6tpsKALJvoVYyZBdzqa+OifCcDS7k4SpMcHQjN0ieVrwHCO+MVoz1TtbdAspI/lNoZkWrVxAjWhatFPsj8B/Df1pYE1plyoPwrHTr7tL58jYiToyPGoa3rkm2ChmHz1PX73gjBOqWuokbhT1n/IE3gbApTF4NYABZw5qxdI6LUnXt3XaGPg5CBRgdAP6LTWTEPIkIKgeigYxl2XfF2GFG4p6Cd/h2RIqDdFmxtrcwG8sgi2PVB2N5yOF4RTfL2pN1/MX2ZWkJxuzsa3SyNzz84zmMzUGNzuF7iY9x5mmokwsGoJ8PEJYm3+O/moMM45f/976Wox0skqkVJphqz3+VZCMJ55Jc0mqnpxZuh7w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddd5d5ec-74fd-4d72-8b3f-08da23a57e93 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2022 14:44:52.8239 (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: OuvsnRRYldCey1jE/38Bzb6teMGWnSoJDuVZtyJ9/d07hRUP1rO9LQ254NyEGzKZDqdqp+RBu8bxUE5qYa2jjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8689 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Designware provided eDMA support in controller. This enabled use this eDMA controller to transfer data. The whole flow align with standard DMA usage module 1. Using dma_request_channel() and filter function to find correct RX and TX Channel. 2. dmaengine_slave_config() config remote side physcial address. 3. using dmaengine_prep_slave_single() create transfer descriptor 4. tx_submit(); 5. dma_async_issue_pending(); Tested at i.MX8DXL platform. root@imx8qmmek:~# /usr/bin/pcitest -d -w WRITE ( 102400 bytes): OKAY root@imx8qmmek:~# /usr/bin/pcitest -d -r READ ( 102400 bytes): OKAY WRITE => Size: 102400 bytes DMA: YES Time: 0.000180145 seconds Rate: 555108 KB/s READ => Size: 102400 bytes DMA: YES Time: 0.000194397 seconds Rate: 514411 KB/s READ => Size: 102400 bytes DMA: NO Time: 0.013532597 seconds Rate: 7389 KB/s WRITE => Size: 102400 bytes DMA: NO Time: 0.000857090 seconds Rate: 116673 KB/s Signed-off-by: Frank Li --- Change from v6 to v8: - none Change from v5 to v6: - change subject Change from v4 to v5: - none Change from v3 to v4: - reverse Xmas tree order - local -> dma_local - change error message - IS_ERR -> IS_ERR_OR_NULL - check return value of dmaengine_slave_config() Change from v1 to v2: - none drivers/pci/endpoint/functions/pci-epf-test.c | 108 ++++++++++++++++-- 1 file changed, 98 insertions(+), 10 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 90d84d3bc868f..f26afd02f3a86 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -52,9 +52,11 @@ struct pci_epf_test { enum pci_barno test_reg_bar; size_t msix_table_offset; struct delayed_work cmd_handler; - struct dma_chan *dma_chan; + struct dma_chan *dma_chan_tx; + struct dma_chan *dma_chan_rx; struct completion transfer_complete; bool dma_supported; + bool dma_private; const struct pci_epc_features *epc_features; }; @@ -105,12 +107,15 @@ static void pci_epf_test_dma_callback(void *param) */ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, dma_addr_t dma_dst, dma_addr_t dma_src, - size_t len) + size_t len, dma_addr_t dma_remote, + enum dma_transfer_direction dir) { + struct dma_chan *chan = (dir == DMA_DEV_TO_MEM) ? epf_test->dma_chan_tx : epf_test->dma_chan_rx; + dma_addr_t dma_local = (dir == DMA_MEM_TO_DEV) ? dma_src : dma_dst; enum dma_ctrl_flags flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; - struct dma_chan *chan = epf_test->dma_chan; struct pci_epf *epf = epf_test->epf; struct dma_async_tx_descriptor *tx; + struct dma_slave_config sconf = {}; struct device *dev = &epf->dev; dma_cookie_t cookie; int ret; @@ -120,7 +125,22 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, return -EINVAL; } - tx = dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, flags); + if (epf_test->dma_private) { + sconf.direction = dir; + if (dir == DMA_MEM_TO_DEV) + sconf.dst_addr = dma_remote; + else + sconf.src_addr = dma_remote; + + if (dmaengine_slave_config(chan, &sconf)) { + dev_err(dev, "DMA slave config fail\n"); + return -EIO; + } + tx = dmaengine_prep_slave_single(chan, dma_local, len, dir, flags); + } else { + tx = dmaengine_prep_dma_memcpy(chan, dma_dst, dma_src, len, flags); + } + if (!tx) { dev_err(dev, "Failed to prepare DMA memcpy\n"); return -EIO; @@ -148,6 +168,23 @@ static int pci_epf_test_data_transfer(struct pci_epf_test *epf_test, return 0; } +struct epf_dma_filter { + struct device *dev; + u32 dma_mask; +}; + +static bool epf_dma_filter_fn(struct dma_chan *chan, void *node) +{ + struct epf_dma_filter *filter = node; + struct dma_slave_caps caps; + + memset(&caps, 0, sizeof(caps)); + dma_get_slave_caps(chan, &caps); + + return chan->device->dev == filter->dev + && (filter->dma_mask & caps.directions); +} + /** * pci_epf_test_init_dma_chan() - Function to initialize EPF test DMA channel * @epf_test: the EPF test device that performs data transfer operation @@ -158,10 +195,44 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) { struct pci_epf *epf = epf_test->epf; struct device *dev = &epf->dev; + struct epf_dma_filter filter; struct dma_chan *dma_chan; dma_cap_mask_t mask; int ret; + filter.dev = epf->epc->dev.parent; + filter.dma_mask = BIT(DMA_DEV_TO_MEM); + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter); + if (IS_ERR_OR_NULL(dma_chan)) { + dev_info(dev, "Failed to get private DMA channel. Falling back to generic one\n"); + goto fail_back_tx; + } + + epf_test->dma_chan_rx = dma_chan; + + filter.dma_mask = BIT(DMA_MEM_TO_DEV); + dma_chan = dma_request_channel(mask, epf_dma_filter_fn, &filter); + + if (IS_ERR(dma_chan)) { + dev_info(dev, "Failed to get private DMA channel. Falling back to generic one\n"); + goto fail_back_rx; + } + + epf_test->dma_chan_tx = dma_chan; + epf_test->dma_private = true; + + init_completion(&epf_test->transfer_complete); + + return 0; + +fail_back_rx: + dma_release_channel(epf_test->dma_chan_rx); + epf_test->dma_chan_tx = NULL; + +fail_back_tx: dma_cap_zero(mask); dma_cap_set(DMA_MEMCPY, mask); @@ -174,7 +245,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) } init_completion(&epf_test->transfer_complete); - epf_test->dma_chan = dma_chan; + epf_test->dma_chan_tx = epf_test->dma_chan_rx = dma_chan; return 0; } @@ -190,8 +261,17 @@ static void pci_epf_test_clean_dma_chan(struct pci_epf_test *epf_test) if (!epf_test->dma_supported) return; - dma_release_channel(epf_test->dma_chan); - epf_test->dma_chan = NULL; + dma_release_channel(epf_test->dma_chan_tx); + if (epf_test->dma_chan_tx == epf_test->dma_chan_rx) { + epf_test->dma_chan_tx = NULL; + epf_test->dma_chan_rx = NULL; + return; + } + + dma_release_channel(epf_test->dma_chan_rx); + epf_test->dma_chan_rx = NULL; + + return; } static void pci_epf_test_print_rate(const char *ops, u64 size, @@ -280,8 +360,14 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test) goto err_map_addr; } + if (epf_test->dma_private) { + dev_err(dev, "Cannot transfer data using DMA\n"); + ret = -EINVAL; + goto err_map_addr; + } + ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr, - src_phys_addr, reg->size); + src_phys_addr, reg->size, 0, DMA_MEM_TO_MEM); if (ret) dev_err(dev, "Data transfer failed\n"); } else { @@ -363,7 +449,8 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test) ktime_get_ts64(&start); ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr, - phys_addr, reg->size); + phys_addr, reg->size, + reg->src_addr, DMA_DEV_TO_MEM); if (ret) dev_err(dev, "Data transfer failed\n"); ktime_get_ts64(&end); @@ -453,8 +540,9 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) } ktime_get_ts64(&start); + ret = pci_epf_test_data_transfer(epf_test, phys_addr, - src_phys_addr, reg->size); + src_phys_addr, reg->size, reg->dst_addr, DMA_MEM_TO_DEV); if (ret) dev_err(dev, "Data transfer failed\n"); ktime_get_ts64(&end);