From patchwork Tue May 24 15:21:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860284 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 C83BDC433FE for ; Tue, 24 May 2022 15:23:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238913AbiEXPXC (ORCPT ); Tue, 24 May 2022 11:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238401AbiEXPW6 (ORCPT ); Tue, 24 May 2022 11:22:58 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB43F5AA43; Tue, 24 May 2022 08:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/HAkCgQ5XXqsHlrkVW2aFeZjr/iOKJda+3a/dzLIpzSE6vgidKBq0DxP2zXGCFcoRhjM8FYRX+eUaEyeEui+tl2PrDojFRta/JNHYf00XNxWCPnhgupMNmhWEDnOCtOTs8vIQSQQwipITbS6oNiQR9xKbRCEsGE1Kdrm53aY7lGUqqzL1bv49MUjH6xGTPZlthiqJ+pFm5Ap4D+llqRGxhFjoSd3V1o5qcGoKW3ubl+gG9jtdzT51O1ZiXEDR8FjodLYcquaeESo8Od4e314t/60XIAVFs7xT8jqTf6y/y2Uxa8/J2UUWOpvL3LDSvVCEUoHGOjzJjVqBgJtyY6ng== 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=AwXmdq2w0NVc5W3YT9hEL/ylCcNXeWjpsutKo270JGM=; b=UyntTlDSUawt2LVLNMyOuiwC5MJicaONzfBdej4Ba+M5GtT39/u4AC2MwnmJjEajIv8Ck6/NynOlaDpzAd3v7WY7Xh3UyQ5hcl3FWThMz1Zpd9qThNeKM8AMjpojWjpGrdB+owu00mmYj0cWjTX1YCZUwey7NZESkNDqEB2TxkqiNF0qgZM8vHLjpXZm5U3KYhoDiYcVFVzqDEdLKQivzQmFm5zLhQiK/h8e5zNrPjWMUlnubrkhRHV+gfDfWLja9rtBkduVXeNRhkM7HQ4VjCK4M2EgOYrTlt9j7WBCfrOg9lnW+UMWkXqwPoImmLTSbhAXGe1OpHJfgOESPQwpmQ== 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=AwXmdq2w0NVc5W3YT9hEL/ylCcNXeWjpsutKo270JGM=; b=UHZXBdAszu/8O3G7sKt8RsBEZL8HCoLqNYWOVlcOX2r7pBSj+TmLAWIX3dWu4YIhx8mlRR8T2WuA36E6FQEUNmDFDpszK2in3Vu56mj8z8AzfdwPStf8GVqJAFWZerPuKbyvVSrGy7uuBa2CSuPEyoaNT4x9k5fXB7koKodPbN0= 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 AM6PR04MB5672.eurprd04.prod.outlook.com (2603:10a6:20b:ae::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:22 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22: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, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 1/8] dmaengine: dw-edma: Remove unused field irq in struct dw_edma_chip Date: Tue, 24 May 2022 10:21:52 -0500 Message-Id: <20220524152159.2370739-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: 4b16238f-a462-4bcf-1db5-08da3d9932ec X-MS-TrafficTypeDiagnostic: AM6PR04MB5672: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: +Pm1QH4XRWXbDP8MalMgx69i7NX9kO6e77mtgrF2agh/Epc0kGSEQZpPfghprC67pgIrpMLWGuW3U3X8vuuO7/Yl7kZfLfN21c3rz49s2KDMoS97eEvJudWAhedJ+Do3mIUoLQTZGsLAXrMFVBUc08fPIk9DCB/lznkAisM7tghyA7keAWmAZ19Ri8PHvwJS1Qj3N3erVNmfuQrt4aOE1c0ywao0dvo5dzysWYdppGtxx5FTjwyWkf9Nfy189IslTrkmcC1pLMQRFQGTGY0XHaRJpM9N8k/oaVl4rcfMB+Cs2FSkpy2uxkb0rBzpWOdOPV1YLyfsEs3jehkPx6XJ7vYHedUuBgev+Z6QLSncdO8RTg70nbQnPdAinowjF2+m9AbVAh61jkEoQY1nYWvaGH5zhxRMdDG7demXHlmZLdFmTstjojrDZVipJkXpm79IunCKwuRv6ou/MOS6kCdpcZElBeCOya1ayMeckyNuAud1KWIDZajhtnIQ8wGRcT04lP3jk11ghbKqojYJ+wQbsu0K5zB6a8eAwH8+XAjMB4dHKfEZYp63vECo20k07nJTiQOVeLpFPzdZ+5AyOcnxz2I1nPxQ2dcr8hbaQ8BVg6oaBZTuvLtL3nYjyhSNBZq93SzbD7k/GiCFUm0i0bNvDZUyNlbVwXYSis0uU54qL9wM0rDaWbHp5ul2akFrzEze5CWzU9A40RgN+LCDNFhVS4/wiTgOHrWOX+X8Z13SuHA= 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)(86362001)(66476007)(8676002)(7416002)(316002)(38100700002)(38350700002)(6506007)(6486002)(66556008)(26005)(66946007)(508600001)(8936002)(2906002)(5660300002)(186003)(4326008)(6512007)(921005)(1076003)(83380400001)(52116002)(2616005)(6666004)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: liaDHevGCxZRMhSEoxn9YFzn/E7SuTg6gz53Uwf+E2X44J/eFU025r3obKLnbSBkRQS9rbs6OTZNdyPppIfw7g3AUfe/QpUJE2cTnjy8eMHhwiKegGEh2k5TsxWhbDDIzRWtPquyBiEIvnjTkVtNy6d1oNvXawGmB0YpVCWwhJwSn7ihw0Pv2vRJeG8B/je2wC5w7MfaECjEwcY0vAWK114yE/ommzokt/Gs94WU/kHB3AwpVwfyJZa5wjD2kJdfPQ2T4LsDc4ijbJiHZtEjBSk+cM9z0hH7c9RUaNe/8WT1NL/KoDi1OVdo6WRH+N31vNY96WI1kmhQursoC8nfvJmnsf6XaS4jKVz4tKVR+ts+YSV2s3dCVjinE2WoLlmn77pvPjGpvC29n93B6EqrOssuEowGPQqzL2wY8p6JRIxItV8ctQPh/FW1BIv13k8fVfAHBt4ByJDloAf3LmNPrtkTSQaWBs9gmAEMl96kRj68sLR4Vt5rJ5gqbDJlsYNXqclhlYs08H6FeLZiU0qghC2R2P0wf38oIs43H+WunWBC6vXB+anomklNicW6LqS1ypgV442Rk9K2qIbiamXoJdJo9BwTFj0lAZJ8NLVovYUbaz+pCcMZO7G2BaCAXUhSEiGIQ+nG0UqLoudCRCxs1mi9dNNa6N1EQqI0DYoG4an/zEUK0ogmlbDuLAU1QwnoYeTTnGfSbDNnrtd+8btFvfADMMsws0dNXGm80CrodDTo4t2ql7Yn62eTwdcea9Na6Cf3JFM6OJPClKpOwtIK/DxbktbvjB0rzm6VxrBQYZstKvy8zrJqTWKidATmdnfMdFOj9NpUTyRAQP95Yg3hxMiR19IR/xqs8nA2uj/DYlDgtWNaayleNTNOiHCTNETiiPS91C/J3uzX8CdxSk1buUezVrgKTDtQ8kBv5Pqm0m0WdMoUXOWX1m6nAzrBq7UMLd/o8tMHmmAEPtmQvCD68hsMKb+LSgYn5CNiYOjrWzheP9DoOClbg1FN7ni3aJsxNv1ZS+9eakfxgoeIQm03CUqd9/RLAxvgRjtQACqBSJphi1bP6em77S8YCB2ENZXy6dHDFcMnJNHKhsksEMPB+CJhVeRvGrLl/VRNUboX5OxeOLYVHLi+jtm4GIlvt1EypVhSdcs3dndEm7qtuOCuOlkY4Nb8f9UhUxacF2iX2UskGdeBE6RL3qxVKt0fdkpSLXLJbjKgWMdDJotRRu2Mstppg1GkW68fCY5UUMM7PR1swQHKQsOiDooVLb2qDkAgc4C+0c63n9gDa7wvGEqNODClrGromt63NuqIB64Q6A/FTqwRL04qKKURQZafwr2cJd3KqJ17odgqO4SGin46e1HKEXWAInQHwGvekA2Nm74MtM62Kn3fzdSYrqB7gFzCxxYoaarTCPpiUvgCct96b36lItFV7exaCKJHTegYdmzzczoaIksXEANf/20zepkm1vcQ2ejhH4kLm3f1HO+T1jF9UfWhZZXLDE/FoFIe5CxEyZbrodXIRKbd0/dAt2YBlWF6oi9SMgJ4VIM1priYu8TfrQDlLtlSAbOo997N1TIzn4rdT1yjg3o8NaYdJkEbB99NT7c1tOuvjMfy7n/0uzexxX5HPKrXzmGNoxlDQz/L2vVE/RJyBGXqUuKphmK801D+VzFCc4XZQbVZSkz4FIEEI80ZOW/a/kKy6gsZd97Q4bx/L0kU9g2zK8O16tvkYxLOlk283neVWbNdb5QgxA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b16238f-a462-4bcf-1db5-08da3d9932ec X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:22.2002 (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: 303Wuo+l5tbiUDSlaY0k4m+LNDgsainjoplHkcxkZBgRFpEMT/XXAlK1/GGkhqNnfJZVqucOWgCrWNM/UIsFsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5672 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org irq of struct dw_edma_chip was never used. It can be removed safely. Signed-off-by: Frank Li Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v7 to v12 - None Change from v6 to v7 - move to 1st patch Change from v5 to v6 - s/remove/Remove/ at subject Change from v4 to v5 - none new patch at v4 drivers/dma/dw-edma/dw-edma-pcie.c | 1 - include/linux/dma/edma.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 44f6e09bdb531..b8f52ca10fa91 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -231,7 +231,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->dw = dw; chip->dev = dev; chip->id = pdev->devfn; - chip->irq = pdev->irq; dw->mf = vsec_data.mf; dw->nr_irqs = nr_irqs; diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index cab6e18773dad..d4333e721588d 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -18,13 +18,11 @@ struct dw_edma; * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID - * @irq: irq line * @dw: struct dw_edma that is filed by dw_edma_probe() */ struct dw_edma_chip { struct device *dev; int id; - int irq; struct dw_edma *dw; }; From patchwork Tue May 24 15:21:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860285 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 64801C433FE for ; Tue, 24 May 2022 15:23:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238902AbiEXPXE (ORCPT ); Tue, 24 May 2022 11:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238889AbiEXPXA (ORCPT ); Tue, 24 May 2022 11:23:00 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B354B58399; Tue, 24 May 2022 08:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZUqCG/pwVrLgfJ9B0ySxs5vyRRPk/sZDS+nAmT2rSSPAQRMag4SGxVcRF9l52izV/H+NTPb/ixsMqOv8PLesm4L7Vcsc5+FqVsG37db/kI5ds0PxYv2NDfROOEE1R8PfidOUl3U3ss4i5KK+lFIekvYRr1L9oaFeDBCoiq00ykZlQOwlwt5WbVqE/67R7+IIXTcZYT/qVQtHi6BpHNI6VL2bFQlOQsxe0Mdagc0Qz8G6kGOUM8+H5tZUYLePEaHmKrE+a0UNM3EeVe79MVpiAAsR3lDsz2xPdjgiVko1aKpZk7GBXGL1hU8X1TP2IA51LbgVD+JFghaUNHUxvhQ7mg== 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=ytkXxJWV1ODUT2blKmDbdNP468Bi3s9NAGt21gU0cPo=; b=Qh322mk46xfN8lGQeJmaxIDO3d1zXmAAkU7T6hhAjeGaqMLOSAzeewXeNBojwACEtKKqWbBryyl5pKbNRsJp8706j4cMdikeMYTo1tsdiZUz+bJpukgsK/QWOGh4CNzMPvXYDvHD2ymIMQBurIdZSNDfCqxkt4fSAuLK6gzkLVCs38JGtzqxj5E7RYqnVgmJSP8dHMCBi6qPzAvBP/sB+MGG3ejwQBh9Ogy9qLY0MMCizsrey730nKCamZCnjUPLc+Y8mLsnVksr1xyv1fB1pCDpKREp3DCeDMCCQ6UTtyJVTA8mSEij14bMh0YDDfZrk4fpMRV+QwTuR4jfEtfVww== 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=ytkXxJWV1ODUT2blKmDbdNP468Bi3s9NAGt21gU0cPo=; b=GytNepoCuCqdKnLqJftZ1ZPKJItKfLqHJaYX6/6u0i/OryX/8yLGT8jVmXD6pyLQJPB4fV6XyjErkWiN09NH4fVzyHaXK3TacLiZkIJ5bG+n9U2a+7wAfOT6PXF21kqMxZKj9CGefIaULMUKp6iBW5HmXzskP2KPIUJ7y13BoLs= 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 AM6PR04MB5672.eurprd04.prod.outlook.com (2603:10a6:20b:ae::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:26 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22: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, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 2/8] dmaengine: dw-edma: Detach the private data and chip info structures Date: Tue, 24 May 2022 10:21:53 -0500 Message-Id: <20220524152159.2370739-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: c7cde571-e225-406e-f5b0-08da3d993561 X-MS-TrafficTypeDiagnostic: AM6PR04MB5672: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: VtiiOHU69G7odxYMr7aUgdwkOi+wbJ8O/3L/Vk5QzfNyi5X+Q9QVKPacyvAxpP3CgPSNaJo1dE0gzF6YZwLL0FbE+9mpJ7qK1YL6Pbw2Omy5Gzp4zKGbo5ra4i5o4GKqgomhNGHwBIAxfPjOEuszQg647LBPXyZuQ0VmXADuLKNB49FInMNjE65woeQ/zTAA9Uxv567AVCFs98U1obWsGz1QnfgTeMJcUtRUsV2LU1qued6WvfdAaXx++oHpTdWTHBtKChdBkHuwZ19COWwoM1VJSSYMAVJcxYFN8QOIic2/89sahYzEIrnEN0SsKGTtmIZh3gjCvhWhNZ+7znlVAiQdudfSb7O7qToFAExyLRgPVf9mt1Zkvk1Kw/UDqVUhnhiHZsd4WZhhQ63K/jCjd2EEfvaTgXLVlIoSLPPKfutkD2wXT876MZC2aHY/o0w9MvH7bc0iUbBfyrWVuo62z/qBg0zRCXacd8CtN1EZQXFDSYIxKpjB+MYLwiYXKaKf2pbXwOxLh4n/vZY4A0ljZTrFbqQZDiu9vGdExLhNGR+JVrbTTeehCaYem6I42yMMpxF9gNJNiY1MAYShKl4VnCso+pum4K2boZJatDQ2tGRvLjaGxLB93c/27s2Kal4glPEINnJf074KdC0y/hOyaIIfFqep2bDsGFQzie93vvSR3cDlpYEnFFBxmpERD4REJdUcpAkX6lo0VVqlOZoL/IGNTwJnwveibYNF9Dh2kjQ= 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)(86362001)(66476007)(8676002)(7416002)(316002)(38100700002)(38350700002)(6506007)(6486002)(66556008)(26005)(66946007)(508600001)(8936002)(2906002)(5660300002)(186003)(4326008)(6512007)(921005)(30864003)(1076003)(83380400001)(52116002)(2616005)(6666004)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2V/Dr89Fr7PKZaXm11jz4dyTwNoRhsuQiv9nxIpIN65H6iEW/LGdi7fVI9bQ1SvMsyFmVRrEzLU3i8GN7rnL9gh91ma9FtYyWtoUTsveXV5qls5P6QYbQ0Z6mWA2mOfwZP1xjI47EC4fj2U1Ypzoh7rcKaw/q27nY6FrsBxYxkV7xbyVh0T9Xo6eLQNh/rfNKfrNdPgt/2h7LB+o2ewskw1W+G8wasEPGMDCHWODYYdMsqH+/oCAOWQ314zvCXvIvXjboWepEEoMOS8VQPRaK94f7zbuN+8Ra0VgBmtiUsXdp4fz+pYqZL+4pJ+l9rPx9fwYfH8pMkghdMWjm6Y0FfFdfl84U0/+R9I03FIU/BwM8DAr1edVj/akZV51LERtIUKfVDi7wFKGxhFO+DVP3VUM6vwHdopsnnr/ys1oLbTVeOmBh2MmmawJg/gdu1uo/8aUxj+GvD+jDo5f1IB0aBNkiHyzZquooO8xK64OemektCAnT7Zs4jwitdyINkO3fqCvYlhX6vuwPuTj6WvuichbIR4mCpNSOhKBvdJldZ+78SjlDvCc88N8VwwNIlBgkA4bI9h0L87/DPejm2R3JTjrI96GqXWGre3BJslVLSXgDU3j9MqAUmxKHg3pBIGgjmpQ9lJ4mrNsMXOk3ufKHl68v3joEi1vRTEZcyQJ6siwJJ1HngXpwQlFdY/TL5Pg7AMh/cJwgNDjhp048uPgnVmPZMsCTMscGpnsmsPN+alVlzIA7ry5pO6BKLhSDG8yi7xK6VwmcJ3BIZCTDitwOu7fvB8o9mjNWnqCYWC7C/T01BCPOm+80SfgsJpmziw+UkX5etr0BmckpB0A5CmhOwb2IjiMdMXcxb7E2XRb2YmPJEqbGkVAh3FxydCgvR/X5OlZc/OmIctUgDbGsT5jw+IukxLktkx/MU9QHD+TOWH6xaDgFNomlHZBMhEt+ar45dPYMrGOysy5GGl143iucIytAwD0x9JZaAJIvcBgafU7EOc78rVgGioIlaGy//X6kVL+fVCvS/LhmpxtuA4KwZE3zVZz8RxHT/p1fdQACD55HEPSXc3tr+Tbr6BF20RusNVxlMPrCUatekIQ6PvIoz+UmDoPf36hsm0MGwfXceEkos9ioI5NbRHaME9OOvhvK5F5Lpii9T9SQ+exJyy7LILzSRv47Bs0x5tm6XdpHNWmERQ4le0W2Mm/fcKJxm/oGvfeISoXxWQmn0Ep2/M/xKBZ28haNjgbEVfkWOaFvCXY97QwIVCLwN4yHF3n0dK4ZGY1qAqeGy3VuUAtbJ3hwQm2cuVFK5aaIsrr7AaqXZJbToUfpgW6ntGMD/qEfchaxOFdXhVkW78IR9vnXHVtDjyaTaR4ei6+sn5wn/uYJTJhtrhc3f69eLcGjzBhYYgXlv5xHghZKr1h9m42GP2kEHKipfcGzR+UHc0j5fU9+gsPbnbPIhFGRvLg/PZwBQ9njA01NjWqtVsxknAknoOTUYKsRuxK+hfepTfCk0fI3YY2dFYqNZDqECy3hTEBHQW4MwesOwFIaQqYGzlamyOTnI403PLsQOzjJwK/FXcYIpvF0xBAympZAv0UBStSK45oFGFk2oQpPtuoz3WkucD3NUzA0Au6nH6ixHZIuujSox7mswW54Mzdqkj4bCcNn7q+523MHNUxyM1+rXIKB3/J655GUoGqOCMWGBTuatX4UPgynt4cyAPhKBXYuw7h1f53Vx7F8ycQ7lVY4rdOdFsHpA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7cde571-e225-406e-f5b0-08da3d993561 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:26.4855 (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: 36TA3ECV9AgSCEb7w4ymmt2u+H+8ETdq2cDs6AffNruqo5snCXNzVAX87To55D3Mzh7dBqP0wI4IZp0oq9lnPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5672 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org "struct dw_edma_chip" contains an internal structure "struct dw_edma" that is used by the eDMA core internally. This structure should not be touched by the eDMA controller drivers themselves. But currently, the eDMA controller drivers like "dw-edma-pci" allocates and populates this internal structure then passes it on to eDMA core. The eDMA core further populates the structure and uses it. This is wrong! Hence, move all the "struct dw_edma" specifics from controller drivers to the eDMA core. Signed-off-by: Frank Li Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v10 to v12 none Change from v9 to v10 - add doc for dt_region_wr/dt_region_rd Change from v8 to v9 - remove chip->ops check at dw_edma_irq_request() Change from v7 to v8 - Check chip->ops at probe() - use struct edma_dw at dw_edma_v0_debugfs_on/off() Change from v6 to v7 - Move nr_irqs and chip->ops check into dw_edma_irq_request() - Move dw->irq devm_kcalloc() into dw_edma_irq_request() - Change dw->nr_irqs after request success - Fix wrong use chip->nr_irqs when remove Change from v5 to v6 - Don't touch chip->nr_irqs - Don't set chip->dw utill everything is okay - dw_edma_channel_setup() and dw_edma_v0_core_debugfs_on/off() methods take dw_edma structure pointer as a parameter Change from v4 to v5 - Move chip->nr_irqs before allocate dw_edma Change from v3 to v4 - Accept most suggestions of Serge Semin Change from v2 to v3 - none Change from v1 to v2 - rework commit message - remove duplicate field in struct dw_edma drivers/dma/dw-edma/dw-edma-core.c | 90 +++++++++++++----------- drivers/dma/dw-edma/dw-edma-core.h | 31 +------- drivers/dma/dw-edma/dw-edma-pcie.c | 82 +++++++++------------ drivers/dma/dw-edma/dw-edma-v0-core.c | 32 ++++----- drivers/dma/dw-edma/dw-edma-v0-core.h | 4 +- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 18 ++--- drivers/dma/dw-edma/dw-edma-v0-debugfs.h | 8 +-- include/linux/dma/edma.h | 46 ++++++++++++ 8 files changed, 163 insertions(+), 148 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 53289927dd0d6..58e91fe384282 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -64,8 +64,8 @@ static struct dw_edma_burst *dw_edma_alloc_burst(struct dw_edma_chunk *chunk) static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) { + struct dw_edma_chip *chip = desc->chan->dw->chip; struct dw_edma_chan *chan = desc->chan; - struct dw_edma *dw = chan->chip->dw; struct dw_edma_chunk *chunk; chunk = kzalloc(sizeof(*chunk), GFP_NOWAIT); @@ -82,11 +82,11 @@ static struct dw_edma_chunk *dw_edma_alloc_chunk(struct dw_edma_desc *desc) */ chunk->cb = !(desc->chunks_alloc % 2); if (chan->dir == EDMA_DIR_WRITE) { - chunk->ll_region.paddr = dw->ll_region_wr[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_wr[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_wr[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_wr[chan->id].vaddr; } else { - chunk->ll_region.paddr = dw->ll_region_rd[chan->id].paddr; - chunk->ll_region.vaddr = dw->ll_region_rd[chan->id].vaddr; + chunk->ll_region.paddr = chip->ll_region_rd[chan->id].paddr; + chunk->ll_region.vaddr = chip->ll_region_rd[chan->id].vaddr; } if (desc->chunk) { @@ -664,7 +664,7 @@ static int dw_edma_alloc_chan_resources(struct dma_chan *dchan) if (chan->status != EDMA_ST_IDLE) return -EBUSY; - pm_runtime_get(chan->chip->dev); + pm_runtime_get(chan->dw->chip->dev); return 0; } @@ -686,15 +686,15 @@ static void dw_edma_free_chan_resources(struct dma_chan *dchan) cpu_relax(); } - pm_runtime_put(chan->chip->dev); + pm_runtime_put(chan->dw->chip->dev); } -static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, +static int dw_edma_channel_setup(struct dw_edma *dw, bool write, u32 wr_alloc, u32 rd_alloc) { + struct dw_edma_chip *chip = dw->chip; struct dw_edma_region *dt_region; struct device *dev = chip->dev; - struct dw_edma *dw = chip->dw; struct dw_edma_chan *chan; struct dw_edma_irq *irq; struct dma_device *dma; @@ -727,7 +727,7 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->vc.chan.private = dt_region; - chan->chip = chip; + chan->dw = dw; chan->id = j; chan->dir = write ? EDMA_DIR_WRITE : EDMA_DIR_READ; chan->configured = false; @@ -735,9 +735,9 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, chan->status = EDMA_ST_IDLE; if (write) - chan->ll_max = (dw->ll_region_wr[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_wr[j].sz / EDMA_LL_SZ); else - chan->ll_max = (dw->ll_region_rd[j].sz / EDMA_LL_SZ); + chan->ll_max = (chip->ll_region_rd[j].sz / EDMA_LL_SZ); chan->ll_max -= 1; dev_vdbg(dev, "L. List:\tChannel %s[%u] max_cnt=%u\n", @@ -767,13 +767,13 @@ static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, vchan_init(&chan->vc, dma); if (write) { - dt_region->paddr = dw->dt_region_wr[j].paddr; - dt_region->vaddr = dw->dt_region_wr[j].vaddr; - dt_region->sz = dw->dt_region_wr[j].sz; + dt_region->paddr = chip->dt_region_wr[j].paddr; + dt_region->vaddr = chip->dt_region_wr[j].vaddr; + dt_region->sz = chip->dt_region_wr[j].sz; } else { - dt_region->paddr = dw->dt_region_rd[j].paddr; - dt_region->vaddr = dw->dt_region_rd[j].vaddr; - dt_region->sz = dw->dt_region_rd[j].sz; + dt_region->paddr = chip->dt_region_rd[j].paddr; + dt_region->vaddr = chip->dt_region_rd[j].vaddr; + dt_region->sz = chip->dt_region_rd[j].sz; } dw_edma_v0_core_device_config(chan); @@ -827,11 +827,11 @@ static inline void dw_edma_add_irq_mask(u32 *mask, u32 alloc, u16 cnt) (*mask)++; } -static int dw_edma_irq_request(struct dw_edma_chip *chip, +static int dw_edma_irq_request(struct dw_edma *dw, u32 *wr_alloc, u32 *rd_alloc) { - struct device *dev = chip->dev; - struct dw_edma *dw = chip->dw; + struct dw_edma_chip *chip = dw->chip; + struct device *dev = dw->chip->dev; u32 wr_mask = 1; u32 rd_mask = 1; int i, err = 0; @@ -840,12 +840,16 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, ch_cnt = dw->wr_ch_cnt + dw->rd_ch_cnt; - if (dw->nr_irqs < 1) + if (chip->nr_irqs < 1 || !chip->ops->irq_vector) return -EINVAL; - if (dw->nr_irqs == 1) { + dw->irq = devm_kcalloc(dev, chip->nr_irqs, sizeof(*dw->irq), GFP_KERNEL); + if (!dw->irq) + return -ENOMEM; + + if (chip->nr_irqs == 1) { /* Common IRQ shared among all channels */ - irq = dw->ops->irq_vector(dev, 0); + irq = chip->ops->irq_vector(dev, 0); err = request_irq(irq, dw_edma_interrupt_common, IRQF_SHARED, dw->name, &dw->irq[0]); if (err) { @@ -855,9 +859,11 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, if (irq_get_msi_desc(irq)) get_cached_msi_msg(irq, &dw->irq[0].msi); + + dw->nr_irqs = 1; } else { /* Distribute IRQs equally among all channels */ - int tmp = dw->nr_irqs; + int tmp = chip->nr_irqs; while (tmp && (*wr_alloc + *rd_alloc) < ch_cnt) { dw_edma_dec_irq_alloc(&tmp, wr_alloc, dw->wr_ch_cnt); @@ -868,7 +874,7 @@ static int dw_edma_irq_request(struct dw_edma_chip *chip, dw_edma_add_irq_mask(&rd_mask, *rd_alloc, dw->rd_ch_cnt); for (i = 0; i < (*wr_alloc + *rd_alloc); i++) { - irq = dw->ops->irq_vector(dev, i); + irq = chip->ops->irq_vector(dev, i); err = request_irq(irq, i < *wr_alloc ? dw_edma_interrupt_write : @@ -902,20 +908,22 @@ int dw_edma_probe(struct dw_edma_chip *chip) return -EINVAL; dev = chip->dev; - if (!dev) + if (!dev || !chip->ops) return -EINVAL; - dw = chip->dw; - if (!dw || !dw->irq || !dw->ops || !dw->ops->irq_vector) - return -EINVAL; + dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); + if (!dw) + return -ENOMEM; + + dw->chip = chip; raw_spin_lock_init(&dw->lock); - dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, + dw->wr_ch_cnt = min_t(u16, chip->wr_ch_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_WRITE)); dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); - dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, + dw->rd_ch_cnt = min_t(u16, chip->rd_ch_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_READ)); dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); @@ -937,17 +945,17 @@ int dw_edma_probe(struct dw_edma_chip *chip) dw_edma_v0_core_off(dw); /* Request IRQs */ - err = dw_edma_irq_request(chip, &wr_alloc, &rd_alloc); + err = dw_edma_irq_request(dw, &wr_alloc, &rd_alloc); if (err) return err; /* Setup write channels */ - err = dw_edma_channel_setup(chip, true, wr_alloc, rd_alloc); + err = dw_edma_channel_setup(dw, true, wr_alloc, rd_alloc); if (err) goto err_irq_free; /* Setup read channels */ - err = dw_edma_channel_setup(chip, false, wr_alloc, rd_alloc); + err = dw_edma_channel_setup(dw, false, wr_alloc, rd_alloc); if (err) goto err_irq_free; @@ -955,15 +963,15 @@ int dw_edma_probe(struct dw_edma_chip *chip) pm_runtime_enable(dev); /* Turn debugfs on */ - dw_edma_v0_core_debugfs_on(chip); + dw_edma_v0_core_debugfs_on(dw); + + chip->dw = dw; return 0; err_irq_free: for (i = (dw->nr_irqs - 1); i >= 0; i--) - free_irq(dw->ops->irq_vector(dev, i), &dw->irq[i]); - - dw->nr_irqs = 0; + free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); return err; } @@ -981,7 +989,7 @@ int dw_edma_remove(struct dw_edma_chip *chip) /* Free irqs */ for (i = (dw->nr_irqs - 1); i >= 0; i--) - free_irq(dw->ops->irq_vector(dev, i), &dw->irq[i]); + free_irq(chip->ops->irq_vector(dev, i), &dw->irq[i]); /* Power management */ pm_runtime_disable(dev); @@ -1002,7 +1010,7 @@ int dw_edma_remove(struct dw_edma_chip *chip) } /* Turn debugfs off */ - dw_edma_v0_core_debugfs_off(chip); + dw_edma_v0_core_debugfs_off(dw); return 0; } diff --git a/drivers/dma/dw-edma/dw-edma-core.h b/drivers/dma/dw-edma/dw-edma-core.h index 60316d408c3e0..85df2d511907b 100644 --- a/drivers/dma/dw-edma/dw-edma-core.h +++ b/drivers/dma/dw-edma/dw-edma-core.h @@ -15,20 +15,12 @@ #include "../virt-dma.h" #define EDMA_LL_SZ 24 -#define EDMA_MAX_WR_CH 8 -#define EDMA_MAX_RD_CH 8 enum dw_edma_dir { EDMA_DIR_WRITE = 0, EDMA_DIR_READ }; -enum dw_edma_map_format { - EDMA_MF_EDMA_LEGACY = 0x0, - EDMA_MF_EDMA_UNROLL = 0x1, - EDMA_MF_HDMA_COMPAT = 0x5 -}; - enum dw_edma_request { EDMA_REQ_NONE = 0, EDMA_REQ_STOP, @@ -57,12 +49,6 @@ struct dw_edma_burst { u32 sz; }; -struct dw_edma_region { - phys_addr_t paddr; - void __iomem *vaddr; - size_t sz; -}; - struct dw_edma_chunk { struct list_head list; struct dw_edma_chan *chan; @@ -87,7 +73,7 @@ struct dw_edma_desc { struct dw_edma_chan { struct virt_dma_chan vc; - struct dw_edma_chip *chip; + struct dw_edma *dw; int id; enum dw_edma_dir dir; @@ -109,10 +95,6 @@ struct dw_edma_irq { struct dw_edma *dw; }; -struct dw_edma_core_ops { - int (*irq_vector)(struct device *dev, unsigned int nr); -}; - struct dw_edma { char name[20]; @@ -122,21 +104,14 @@ struct dw_edma { struct dma_device rd_edma; u16 rd_ch_cnt; - struct dw_edma_region rg_region; /* Registers */ - struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; - struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; - struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH]; - struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH]; - struct dw_edma_irq *irq; int nr_irqs; - enum dw_edma_map_format mf; - struct dw_edma_chan *chan; - const struct dw_edma_core_ops *ops; raw_spinlock_t lock; /* Only for legacy */ + + struct dw_edma_chip *chip; #ifdef CONFIG_DEBUG_FS struct dentry *debugfs; #endif /* CONFIG_DEBUG_FS */ diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index b8f52ca10fa91..2c1c5fa4e9f28 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -148,7 +148,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, struct dw_edma_pcie_data vsec_data; struct device *dev = &pdev->dev; struct dw_edma_chip *chip; - struct dw_edma *dw; int err, nr_irqs; int i, mask; @@ -214,10 +213,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, if (!chip) return -ENOMEM; - dw = devm_kzalloc(dev, sizeof(*dw), GFP_KERNEL); - if (!dw) - return -ENOMEM; - /* IRQs allocation */ nr_irqs = pci_alloc_irq_vectors(pdev, 1, vsec_data.irqs, PCI_IRQ_MSI | PCI_IRQ_MSIX); @@ -228,28 +223,23 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } /* Data structure initialization */ - chip->dw = dw; chip->dev = dev; chip->id = pdev->devfn; - dw->mf = vsec_data.mf; - dw->nr_irqs = nr_irqs; - dw->ops = &dw_edma_pcie_core_ops; - dw->wr_ch_cnt = vsec_data.wr_ch_cnt; - dw->rd_ch_cnt = vsec_data.rd_ch_cnt; + chip->mf = vsec_data.mf; + chip->nr_irqs = nr_irqs; + chip->ops = &dw_edma_pcie_core_ops; - dw->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; - if (!dw->rg_region.vaddr) - return -ENOMEM; + chip->wr_ch_cnt = vsec_data.wr_ch_cnt; + chip->rd_ch_cnt = vsec_data.rd_ch_cnt; - dw->rg_region.vaddr += vsec_data.rg.off; - dw->rg_region.paddr = pdev->resource[vsec_data.rg.bar].start; - dw->rg_region.paddr += vsec_data.rg.off; - dw->rg_region.sz = vsec_data.rg.sz; + chip->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; + if (!chip->rg_region.vaddr) + return -ENOMEM; - for (i = 0; i < dw->wr_ch_cnt; i++) { - struct dw_edma_region *ll_region = &dw->ll_region_wr[i]; - struct dw_edma_region *dt_region = &dw->dt_region_wr[i]; + for (i = 0; i < chip->wr_ch_cnt; i++) { + struct dw_edma_region *ll_region = &chip->ll_region_wr[i]; + struct dw_edma_region *dt_region = &chip->dt_region_wr[i]; struct dw_edma_block *ll_block = &vsec_data.ll_wr[i]; struct dw_edma_block *dt_block = &vsec_data.dt_wr[i]; @@ -272,9 +262,9 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dt_region->sz = dt_block->sz; } - for (i = 0; i < dw->rd_ch_cnt; i++) { - struct dw_edma_region *ll_region = &dw->ll_region_rd[i]; - struct dw_edma_region *dt_region = &dw->dt_region_rd[i]; + for (i = 0; i < chip->rd_ch_cnt; i++) { + struct dw_edma_region *ll_region = &chip->ll_region_rd[i]; + struct dw_edma_region *dt_region = &chip->dt_region_rd[i]; struct dw_edma_block *ll_block = &vsec_data.ll_rd[i]; struct dw_edma_block *dt_block = &vsec_data.dt_rd[i]; @@ -298,45 +288,45 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } /* Debug info */ - if (dw->mf == EDMA_MF_EDMA_LEGACY) - pci_dbg(pdev, "Version:\teDMA Port Logic (0x%x)\n", dw->mf); - else if (dw->mf == EDMA_MF_EDMA_UNROLL) - pci_dbg(pdev, "Version:\teDMA Unroll (0x%x)\n", dw->mf); - else if (dw->mf == EDMA_MF_HDMA_COMPAT) - pci_dbg(pdev, "Version:\tHDMA Compatible (0x%x)\n", dw->mf); + if (chip->mf == EDMA_MF_EDMA_LEGACY) + pci_dbg(pdev, "Version:\teDMA Port Logic (0x%x)\n", chip->mf); + else if (chip->mf == EDMA_MF_EDMA_UNROLL) + pci_dbg(pdev, "Version:\teDMA Unroll (0x%x)\n", chip->mf); + else if (chip->mf == EDMA_MF_HDMA_COMPAT) + pci_dbg(pdev, "Version:\tHDMA Compatible (0x%x)\n", chip->mf); else - pci_dbg(pdev, "Version:\tUnknown (0x%x)\n", dw->mf); + pci_dbg(pdev, "Version:\tUnknown (0x%x)\n", chip->mf); - pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", + pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p)\n", vsec_data.rg.bar, vsec_data.rg.off, vsec_data.rg.sz, - dw->rg_region.vaddr, &dw->rg_region.paddr); + chip->rg_region.vaddr); - for (i = 0; i < dw->wr_ch_cnt; i++) { + for (i = 0; i < chip->wr_ch_cnt; i++) { pci_dbg(pdev, "L. List:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_wr[i].bar, - vsec_data.ll_wr[i].off, dw->ll_region_wr[i].sz, - dw->ll_region_wr[i].vaddr, &dw->ll_region_wr[i].paddr); + vsec_data.ll_wr[i].off, chip->ll_region_wr[i].sz, + chip->ll_region_wr[i].vaddr, &chip->ll_region_wr[i].paddr); pci_dbg(pdev, "Data:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.dt_wr[i].bar, - vsec_data.dt_wr[i].off, dw->dt_region_wr[i].sz, - dw->dt_region_wr[i].vaddr, &dw->dt_region_wr[i].paddr); + vsec_data.dt_wr[i].off, chip->dt_region_wr[i].sz, + chip->dt_region_wr[i].vaddr, &chip->dt_region_wr[i].paddr); } - for (i = 0; i < dw->rd_ch_cnt; i++) { + for (i = 0; i < chip->rd_ch_cnt; i++) { pci_dbg(pdev, "L. List:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_rd[i].bar, - vsec_data.ll_rd[i].off, dw->ll_region_rd[i].sz, - dw->ll_region_rd[i].vaddr, &dw->ll_region_rd[i].paddr); + vsec_data.ll_rd[i].off, chip->ll_region_rd[i].sz, + chip->ll_region_rd[i].vaddr, &chip->ll_region_rd[i].paddr); pci_dbg(pdev, "Data:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.dt_rd[i].bar, - vsec_data.dt_rd[i].off, dw->dt_region_rd[i].sz, - dw->dt_region_rd[i].vaddr, &dw->dt_region_rd[i].paddr); + vsec_data.dt_rd[i].off, chip->dt_region_rd[i].sz, + chip->dt_region_rd[i].vaddr, &chip->dt_region_rd[i].paddr); } - pci_dbg(pdev, "Nr. IRQs:\t%u\n", dw->nr_irqs); + pci_dbg(pdev, "Nr. IRQs:\t%u\n", chip->nr_irqs); /* Validating if PCI interrupts were enabled */ if (!pci_dev_msi_enabled(pdev)) { @@ -344,10 +334,6 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, return -EPERM; } - dw->irq = devm_kcalloc(dev, nr_irqs, sizeof(*dw->irq), GFP_KERNEL); - if (!dw->irq) - return -ENOMEM; - /* Starting eDMA driver */ err = dw_edma_probe(chip); if (err) { diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 33bc1e6c4cf2e..999e038961866 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -25,7 +25,7 @@ enum dw_edma_control { static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) { - return dw->rg_region.vaddr; + return dw->chip->rg_region.vaddr; } #define SET_32(dw, name, value) \ @@ -96,7 +96,7 @@ static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) static inline struct dw_edma_v0_ch_regs __iomem * __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) return &(__dw_regs(dw)->type.legacy.ch); if (dir == EDMA_DIR_WRITE) @@ -108,7 +108,7 @@ __dw_ch_regs(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch) static inline void writel_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u32 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -133,7 +133,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -169,7 +169,7 @@ static inline u32 readl_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, static inline void writeq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, u64 value, void __iomem *addr) { - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -194,7 +194,7 @@ static inline u64 readq_ch(struct dw_edma *dw, enum dw_edma_dir dir, u16 ch, { u32 value; - if (dw->mf == EDMA_MF_EDMA_LEGACY) { + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY) { u32 viewport_sel; unsigned long flags; @@ -256,7 +256,7 @@ u16 dw_edma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; tmp = FIELD_GET(EDMA_V0_CH_STATUS_MASK, @@ -272,7 +272,7 @@ enum dma_status dw_edma_v0_core_ch_status(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_DONE_INT_MASK, BIT(chan->id))); @@ -280,7 +280,7 @@ void dw_edma_v0_core_clear_done_int(struct dw_edma_chan *chan) void dw_edma_v0_core_clear_abort_int(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; SET_RW_32(dw, chan->dir, int_clear, FIELD_PREP(EDMA_V0_ABORT_INT_MASK, BIT(chan->id))); @@ -357,7 +357,7 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) { struct dw_edma_chan *chan = chunk->chan; - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp; dw_edma_v0_core_write_chunk(chunk); @@ -365,7 +365,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) if (first) { /* Enable engine */ SET_RW_32(dw, chan->dir, engine_en, BIT(0)); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { switch (chan->id) { case 0: SET_RW_COMPAT(dw, chan->dir, ch0_pwr_en, @@ -435,7 +435,7 @@ void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) { - struct dw_edma *dw = chan->chip->dw; + struct dw_edma *dw = chan->dw; u32 tmp = 0; /* MSI done addr - low, high */ @@ -505,12 +505,12 @@ int dw_edma_v0_core_device_config(struct dw_edma_chan *chan) } /* eDMA debugfs callbacks */ -void dw_edma_v0_core_debugfs_on(struct dw_edma_chip *chip) +void dw_edma_v0_core_debugfs_on(struct dw_edma *dw) { - dw_edma_v0_debugfs_on(chip); + dw_edma_v0_debugfs_on(dw); } -void dw_edma_v0_core_debugfs_off(struct dw_edma_chip *chip) +void dw_edma_v0_core_debugfs_off(struct dw_edma *dw) { - dw_edma_v0_debugfs_off(chip); + dw_edma_v0_debugfs_off(dw); } diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.h b/drivers/dma/dw-edma/dw-edma-v0-core.h index 2afa626b8300c..75aec6d31b210 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.h +++ b/drivers/dma/dw-edma/dw-edma-v0-core.h @@ -22,7 +22,7 @@ u32 dw_edma_v0_core_status_abort_int(struct dw_edma *chan, enum dw_edma_dir dir) void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first); int dw_edma_v0_core_device_config(struct dw_edma_chan *chan); /* eDMA debug fs callbacks */ -void dw_edma_v0_core_debugfs_on(struct dw_edma_chip *chip); -void dw_edma_v0_core_debugfs_off(struct dw_edma_chip *chip); +void dw_edma_v0_core_debugfs_on(struct dw_edma *dw); +void dw_edma_v0_core_debugfs_off(struct dw_edma *dw); #endif /* _DW_EDMA_V0_CORE_H */ diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index 4b3bcffd15ef1..b765adb969998 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -54,7 +54,7 @@ struct debugfs_entries { static int dw_edma_debugfs_u32_get(void *data, u64 *val) { void __iomem *reg = (void __force __iomem *)data; - if (dw->mf == EDMA_MF_EDMA_LEGACY && + if (dw->chip->mf == EDMA_MF_EDMA_LEGACY && reg >= (void __iomem *)®s->type.legacy.ch) { void __iomem *ptr = ®s->type.legacy.ch; u32 viewport_sel = 0; @@ -173,7 +173,7 @@ static void dw_edma_debugfs_regs_wr(struct dentry *dir) nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { nr_entries = ARRAY_SIZE(debugfs_unroll_regs); dw_edma_debugfs_create_x32(debugfs_unroll_regs, nr_entries, regs_dir); @@ -242,7 +242,7 @@ static void dw_edma_debugfs_regs_rd(struct dentry *dir) nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); - if (dw->mf == EDMA_MF_HDMA_COMPAT) { + if (dw->chip->mf == EDMA_MF_HDMA_COMPAT) { nr_entries = ARRAY_SIZE(debugfs_unroll_regs); dw_edma_debugfs_create_x32(debugfs_unroll_regs, nr_entries, regs_dir); @@ -282,13 +282,13 @@ static void dw_edma_debugfs_regs(void) dw_edma_debugfs_regs_rd(regs_dir); } -void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) +void dw_edma_v0_debugfs_on(struct dw_edma *_dw) { - dw = chip->dw; + dw = _dw; if (!dw) return; - regs = dw->rg_region.vaddr; + regs = dw->chip->rg_region.vaddr; if (!regs) return; @@ -296,16 +296,16 @@ void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) if (!dw->debugfs) return; - debugfs_create_u32("mf", 0444, dw->debugfs, &dw->mf); + debugfs_create_u32("mf", 0444, dw->debugfs, &dw->chip->mf); debugfs_create_u16("wr_ch_cnt", 0444, dw->debugfs, &dw->wr_ch_cnt); debugfs_create_u16("rd_ch_cnt", 0444, dw->debugfs, &dw->rd_ch_cnt); dw_edma_debugfs_regs(); } -void dw_edma_v0_debugfs_off(struct dw_edma_chip *chip) +void dw_edma_v0_debugfs_off(struct dw_edma *_dw) { - dw = chip->dw; + dw = _dw; if (!dw) return; diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.h b/drivers/dma/dw-edma/dw-edma-v0-debugfs.h index d0ff25a9ea5c9..3391b86edf5ab 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.h +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.h @@ -12,14 +12,14 @@ #include #ifdef CONFIG_DEBUG_FS -void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip); -void dw_edma_v0_debugfs_off(struct dw_edma_chip *chip); +void dw_edma_v0_debugfs_on(struct dw_edma *dw); +void dw_edma_v0_debugfs_off(struct dw_edma *dw); #else -static inline void dw_edma_v0_debugfs_on(struct dw_edma_chip *chip) +static inline void dw_edma_v0_debugfs_on(struct dw_edma *dw) { } -static inline void dw_edma_v0_debugfs_off(struct dw_edma_chip *chip) +static inline void dw_edma_v0_debugfs_off(struct dw_edma *dw) { } #endif /* CONFIG_DEBUG_FS */ diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index d4333e721588d..86697d33e0610 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -12,17 +12,63 @@ #include #include +#define EDMA_MAX_WR_CH 8 +#define EDMA_MAX_RD_CH 8 + struct dw_edma; +struct dw_edma_region { + phys_addr_t paddr; + void __iomem *vaddr; + size_t sz; +}; + +struct dw_edma_core_ops { + int (*irq_vector)(struct device *dev, unsigned int nr); +}; + +enum dw_edma_map_format { + EDMA_MF_EDMA_LEGACY = 0x0, + EDMA_MF_EDMA_UNROLL = 0x1, + EDMA_MF_HDMA_COMPAT = 0x5 +}; + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID + * @nr_irqs: total dma irq number + * @ops DMA channel to IRQ number mapping + * @wr_ch_cnt DMA write channel number + * @rd_ch_cnt DMA read channel number + * @rg_region DMA register region + * @ll_region_wr DMA descriptor link list memory for write channel + * @ll_region_rd DMA descriptor link list memory for read channel + * @dt_region_wr DMA data memory for write channel + * @dt_region_rd DMA data memory for read channel + * @mf DMA register map format * @dw: struct dw_edma that is filed by dw_edma_probe() */ struct dw_edma_chip { struct device *dev; int id; + int nr_irqs; + const struct dw_edma_core_ops *ops; + + struct dw_edma_region rg_region; + + u16 wr_ch_cnt; + u16 rd_ch_cnt; + /* link list address */ + struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; + + /* data region */ + struct dw_edma_region dt_region_wr[EDMA_MAX_WR_CH]; + struct dw_edma_region dt_region_rd[EDMA_MAX_RD_CH]; + + enum dw_edma_map_format mf; + struct dw_edma *dw; }; From patchwork Tue May 24 15:21:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860286 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 255C8C433EF for ; Tue, 24 May 2022 15:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238915AbiEXPXG (ORCPT ); Tue, 24 May 2022 11:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238924AbiEXPXC (ORCPT ); Tue, 24 May 2022 11:23:02 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 867149D06A; Tue, 24 May 2022 08:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEeMpl71zRuehT8h6XD85RGj0ZX0QzFEA7YYkJj0xPHwXmhird3c/RPHQkmkdvBRYSeaySiseJVYOuoGGpRebBQu+f9y3I9TXZx7qTMHZh1O0hGOK2DUzCs689zynfRnr6/IHWRwOYLxB+up8vbgv36swlw3zO7fVh9twl5+rikdo3qYfGiGJMVJTcCCOpB+71zmUlD155Mp7dIblHpkrAX+0j5jAlpPsLN1xI5SxiL3/6oMF/whIh+aAJB3ub8LrkLzQikgg7LzqA/m73q6AGhpszX3GfUJg4aliAhkYDSWMjzOlA6vssW8ea+5CUYmu340DXPPlDiIS4m50hwJOA== 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=3qVnCoI7AHidEFTKprgXQD03f/PEuEsiRhs0/Lb2mZ0=; b=TZnTJ64KDA2tJL3XO+FLluOfR2/3l8K8ly9jlT8C0eO6PNIrQ4tX12iJadW3lXyzwWCn+e+/3LTeSPz6NjzEegEbKNmuyxHVRRF65DQ14L5wiJ8O+l31kiIk5QsyRAlfQSfUtlqON9iRqbhKaLQxGjJWEl77UFns2VuYAhYaq8ppi6GszD1FE8ow3WwSTOg2AriAQWavj5HEJ9/ailSUDTFFec6jODZqTFLlljDUvmbITvwia5tQs1GELMErSVrOVAn9atLOXNfQ2hjYPzajvHq6y/cqxu48DhzETO9qkPnOPgygPX7pZpEdBBOKYQmI2QcfD0HTOabzwi78MFDwTQ== 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=3qVnCoI7AHidEFTKprgXQD03f/PEuEsiRhs0/Lb2mZ0=; b=bAn3zCUwrquCp22Ayy07NQIlqGpPGoL2lL43SOVTFKXFH2LqGQaKAqIr3evhJ5ojuSDqsrLdPCDX3BwXtAz/ptTYEokgYZ/w+e/BTR7Oa69xl+uWrMjCqS5xrvWn8pS3tZYnk8UMNH/WdtoXcpZLe1gTL3MVJR/58iF7GEYxnPo= 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 AM6PR04MB5672.eurprd04.prod.outlook.com (2603:10a6:20b:ae::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:31 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22: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, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 3/8] dmaengine: dw-edma: Change rg_region to reg_base in struct dw_edma_chip Date: Tue, 24 May 2022 10:21:54 -0500 Message-Id: <20220524152159.2370739-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: e0976a3c-74c0-4a9e-0f56-08da3d993854 X-MS-TrafficTypeDiagnostic: AM6PR04MB5672: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: r0x1LkMYjHEpRqLV9x5QmHzN7cdNddgs5fzOQ1TLtOyuExRbolPMGAxIXucRChuLIXIFaJ7iF5LT3OZ3S1EMzOdRwByB1zI7CTgxRHSrbEpNxegq8weCr4Ns2jOScUz5RRjeId5I9J1b/LYg3qXS3PFKYAlNvUkiVYELODXpCaN48idsudkeHtd39FN6929sN7ozeoef8+3mEhoJ38KQSr1I1RxTKVKjfKgjTHCaGyTCbF0sBtEuiMQg93yzUIh+VEoNDVdQW6TGCRb1MNLoHiTEUoMZIJeQ50DKbf+zIS6hgq83o30hdh6Ek+EivN/BJMf7n9L0hlHkO5DSneV9BRStdsqkwUWi6ur06hXhvU3v5fQDOszQ187pfugs+UmSYRJP1ypI/nAjLsSg133X90v52taVPzjjlWq2RkETORJR0LCKhn+w0rTz/E4TdIzzjWquYw2iog2yolBnwuaLK0io1KtwUL+f9vRD4yH3ZITQkHSftpjOs0QDn/9giJNIGYw+7Fe+4WGg+24NdTUjRqsH7nhaCfS9zOYjZZJkLmwo2Uag0cwtoTXU9nrx7gSHjRNsvkx1WznKvCjVp+RyUDEQZhhySAkhlcTymd+RG7N+kqNncRIQa/o6pIrZBq8Xw6wMETJ3RdkZT+xuUN7gNzbQyqX3lB6SMdOHogFg2WdxHm83UDEc82fCZ+UaOkqUPagLlSOwWCkAkVNPtp4sYQZy4aINbI3gMy9APIPdiAg= 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)(86362001)(66476007)(8676002)(7416002)(316002)(38100700002)(38350700002)(6506007)(6486002)(66556008)(26005)(66946007)(508600001)(8936002)(2906002)(5660300002)(186003)(4326008)(6512007)(921005)(1076003)(83380400001)(52116002)(2616005)(6666004)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cgR1oha1nqkCV/CsIbiThc9u3x3r0RjM4tb5xvGT5nNUyUGobTDxLSL4sPET0VLRmMuEavQvPUgRzYQVjieTfpj3tpOdHy/UsmF8Bg9J1MfjdAUu8QiATo6JNysuI5wHoWIP+G7VlchTHY2gGb84PxBVwmDseunVrsbyd5tga67JGFbnRnktYgt8cYVs8f0QaiTU3OzdOl+GE9IjXrMWDZdkb6Cl5Q58khF1iB+EkMnGwkTDF9BUkicOtdI6IvtiOtek4TltmWD0WQH1HgRv0vFjy3aAhXjKl5Wv/QB6F0SfetNxWbBE8wsXhSs9hbynN3RLd1qfJegT8O30GoAHY/XMVEBnlxRHnHtGc87QBdoqgo22wHLV742pVOYlt4vnQ10rOsCLdvvIMJwlM8J8H3D2T0GQQQZW8RkkaKGOCJ+9PP8ktMOWkscKapSmKRWs9lfBlgWxoqiSTJDcU69tkKX8+o1wSL9FIKAvnOtcQXlqIBwmGWvFtiGvAbDnvF/uMVQkMWwpkjbVLQ9YsTHJsyinK5cHy2+Hj1YSOSA4GuHKjMrloQsAAIwSYAlJNesqzdtOH2AU6r6cUQ3Iij/DpS9j2FbzsqVqlHT97qQ1BRqVE3O4heCL2GEbeEZHvY9kF9iPGekSsNLVAmKCtIlFijCYTKTde5gZ1zksBaQeNqQhpMosYIPwTzVy/lFfYFIT0F257DL4Gh3Iacbr4yjId8cgENQaVDQ5bO3xVSx1PqhRYp0nepQBeqzfQP+Ex56yR4/b9Uz1YULUuAlUqQEOoJBnIIuyo7fNztrr4xnsCRfhAoHj1DAJN1bJ6C4FarmIovhmUYfzALI3b4EdG5JhTHCQ9cA9sJlASibr3clCKMPE72er8U6dWi/edwwfyx1jLN/NJOh+YFMdj86GN7uBtCGYDGNTENhUfwZMElRzIoP4rrPYzAq9jV5bUceDuNslhqiRLWKB17gV456A8uEb8eD1YxPPX52L0z/6InQcRJ34lJXHTFkXp790u/TNv0JqOv+c8/F9KAuYka+0ugCnLFXHDvldELvW85tyKu3Q6oL6++BqdqmRzCWF6aU2FGCaKiv/EM6fBk9Wok76ht2i1tdD6CzrnuA7O2gE0IH8VnAzwXVHjqLVwVl4zm7JdevidGf8TN2iYf7Y0zILnrtbv7zfUPkQ8Lf7eHqsE7uQ43xmSZ6VFx7SPYr8gQbW8gooP3HRkjbNDz2wIRLaJmZltKmd5BI7otzI+eoWlpgtUHF2RkTcHL8r5Qo5J/GeHTLVol12kZcz0JcupdZxQYpftKKDROuAyAaNf7PpDD4ZXkV5BSTMvxipsnNLK4xuNm5v6XQ65+FeT2wynaD7RBOFdAicCJovxYIbL30Sg4sm7Kr3RXyB1WCygoW6ifG0+QWrq3zc77EbvEkxi7LsQrOjZOTQ+sJghqB2EUOB7qVa3icLP7y96Gm/PSJMQVyG9+oSba4q8KKnkGZW6lmaqhPikAS2FgbdAS2Mbu74i+lv9cD18A1aqIoSJSzyX0J2oBXeTGiSouQ0XGg1sSAno8gqjscpItRx0NTaCCpeNkKRvEAszSU9oC1RgAGQcgF9CsAOZDFsvj741bFGhg5TPUCZ1FFQs68vC4VoJtXwzh0W35vEN9FmhWKEXAa1QfqFoUJ37Pyc0E7fCh1KrklO43uppO7wHN7FZ1KzG+xiDhRLCY9INbuOXdXUqGsaEUoj/TAExRaCrSTQYGG4NPaz6T6PMQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0976a3c-74c0-4a9e-0f56-08da3d993854 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:31.3794 (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: ZNQIyA+usAsVCNbIRKjmVN4smg8N3Jn2FtSdALvoQ3yuJyhbLFSE12TV278MUJr+h4EtxQ/rIHPCNltV4yPPhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5672 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org struct dw_edma_region rg_region included virtual address, physical address and size information. But only virtual address is used by EDMA driver. Change it to void __iomem *reg_base to clean up code. Signed-off-by: Frank Li Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v6 to v12: - none Change from v5 to v6: -s/change/Change at subject New patch at v4 drivers/dma/dw-edma/dw-edma-pcie.c | 6 +++--- drivers/dma/dw-edma/dw-edma-v0-core.c | 2 +- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 2 +- include/linux/dma/edma.h | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index 2c1c5fa4e9f28..ae42bad24dd5a 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -233,8 +233,8 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->wr_ch_cnt = vsec_data.wr_ch_cnt; chip->rd_ch_cnt = vsec_data.rd_ch_cnt; - chip->rg_region.vaddr = pcim_iomap_table(pdev)[vsec_data.rg.bar]; - if (!chip->rg_region.vaddr) + chip->reg_base = pcim_iomap_table(pdev)[vsec_data.rg.bar]; + if (!chip->reg_base) return -ENOMEM; for (i = 0; i < chip->wr_ch_cnt; i++) { @@ -299,7 +299,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, pci_dbg(pdev, "Registers:\tBAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p)\n", vsec_data.rg.bar, vsec_data.rg.off, vsec_data.rg.sz, - chip->rg_region.vaddr); + chip->reg_base); for (i = 0; i < chip->wr_ch_cnt; i++) { diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 999e038961866..403ade40c1b1b 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -25,7 +25,7 @@ enum dw_edma_control { static inline struct dw_edma_v0_regs __iomem *__dw_regs(struct dw_edma *dw) { - return dw->chip->rg_region.vaddr; + return dw->chip->reg_base; } #define SET_32(dw, name, value) \ diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index b765adb969998..5226c9014703c 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -288,7 +288,7 @@ void dw_edma_v0_debugfs_on(struct dw_edma *_dw) if (!dw) return; - regs = dw->chip->rg_region.vaddr; + regs = dw->chip->reg_base; if (!regs) return; diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 86697d33e0610..195ee1e47f21d 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -39,6 +39,7 @@ enum dw_edma_map_format { * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * @reg_base DMA register base address * @wr_ch_cnt DMA write channel number * @rd_ch_cnt DMA read channel number * @rg_region DMA register region @@ -55,7 +56,7 @@ struct dw_edma_chip { int nr_irqs; const struct dw_edma_core_ops *ops; - struct dw_edma_region rg_region; + void __iomem *reg_base; u16 wr_ch_cnt; u16 rd_ch_cnt; From patchwork Tue May 24 15:21:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860290 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 78A25C433EF for ; Tue, 24 May 2022 15:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234133AbiEXPXW (ORCPT ); Tue, 24 May 2022 11:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238870AbiEXPXD (ORCPT ); Tue, 24 May 2022 11:23:03 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B69C9E9DA; Tue, 24 May 2022 08:22:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QC261s8OOhqVe9G9bH+3KtJFENmNh8/XTcLn8hoUTzS615ydvzHUz9X4WQnVB+9T6yWGKTbbCe1rUd8tADU0ZaRdFLB4sm7pvsF8WGTbBBQ6qFp+pJMQ6ZQrghoAVQ0qjuZk5Q60rXto3bTlnp6FatfdZjyrat/dl3xwJqbM/V9VTXEiBJ+eE90WTTZi8IGfSJ3fyYlZmStqmdkpqwulDs+Vavi+uQM3lCgngOsgUAFUNguQmJ2l5mosyGvGKTkpY+3S5KUV0JmoxUvuTIH54UNyXKyj3j6FAe4/uoodDnfH0fKgyAcK2lAJwdrUBMyajhG8wL52RoCM0O+55jg4ag== 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=8fHfKStKCIND70Y7qYZIBayS2AiLFEuv7NF99z+l/vE=; b=U6bhzO3uVRpMxZHzho8yF/Y4PnU+92BJcIkYN4pfaNuTKiXTapJ1kDkJsWHXKr/RtXWGtoTxMkxj3rFuB+9IK5w5sOz2sZ+p5cXLLgiFWP6XAaTGshTbq2qXMrO5jCwD0ATQz14QyFOwlh4TwgI/jnrhixxpmnkqBZYKYIKDBmewbEsrYH2sl8P1PtmpDDfXstzbTamarpvoD7dqFNu34Xu8VHCR9I3o8j2vzBudH0yvv+jmE2QY5j1TIFAZ7UN/GJmSzUpkt6n7muDuJqE2LynHOg57yn9xe0De1sds3ljnDWIKT0iANTDiy4rluSoqEKbFaWjljpdEwMSnkLU9WA== 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=8fHfKStKCIND70Y7qYZIBayS2AiLFEuv7NF99z+l/vE=; b=gqzXxUsEVnILf4Xk2MGHtwCGew8iv59IvBCSkslHfgLObnqFAdq5yFz2Kl3egUqZh1DBa/2AyF+UZhQRFL/KrgXSTPCmoRtUhWGj57SnvlWDybh5G1o9rgE7RsaLtx8TesapDmeCYxZRnLR3zXzTirEUmE+9DykGIBecxBLlP0E= 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 AM6PR04MB5672.eurprd04.prod.outlook.com (2603:10a6:20b:ae::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:35 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22: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, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 4/8] dmaengine: dw-edma: Rename wr(rd)_ch_cnt to ll_wr(rd)_cnt in struct dw_edma_chip Date: Tue, 24 May 2022 10:21:55 -0500 Message-Id: <20220524152159.2370739-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: 3a98c565-a24d-4659-bf66-08da3d993adc X-MS-TrafficTypeDiagnostic: AM6PR04MB5672: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: qEfqEb9ExqC6UV4o5P/+o+A/TECSQ78J9ZkbC9ROrFualzh5mfPwC2PhRUukSrbhkZcLiHb9syb1a6XsoB5STyBO2J2mowodn4OSTJLLX3W/I1mQKK4465l+Hc4UuReRLLMnovuyxf1sLrQic50emfHQVlMMydkE/e+pDKPV7Hj4v4TuGgWGEFqYG054Ii/5Uq2XAKMycHz/nt0K0olIhfjn/sC16lLEYmMIx/LOEdSgpauK5GjZf7MMNeduKbHIvP/ycVeHBTCSMqce3oePggkd5Og4XtAbqFyMybHUoIQ0ZOwJW5q4ljqXNPlygE2czdXAT6MuH02i7LAZqSsY7GNAnxrK0fNDu+rMR3UHrfq+c+4Neh+Qo8mO7Zm23tJZ5qNgeZVBumF/QjB7/Yc1ZYLXPNCvrdiNXg6Hp/hIr5g1E/8XHZUk63i8gUbttxrEktzuGUF+SQo3BQEKeJIJA/eW1GkjriBn3ys8YEoahwX/gnIJ499M128SqjIjOylQklJE6v7RJnU3pISB1gzkOBzBKr1zllVU94kqQ1SjbgZvL850+98DXxm+O0fGRYm1jgZx/T32L5SDc2MVF1vmu26d8ydpK8RTX0iAW2+96QWrxgEsSoG+FbsZb9UtEbTOF0MY+Ops23dFEUEYIc423YIEm6m3uP3Mg1+KzspHLIVyoA8Yc2JYj8KCrFU3S1zmh8xmnGZ9gPJ3sOD3TN2zpZk7SLXR2otsbNpsFs6QtHg= 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)(86362001)(66476007)(8676002)(7416002)(316002)(38100700002)(38350700002)(6506007)(6486002)(66556008)(26005)(66946007)(508600001)(8936002)(2906002)(5660300002)(186003)(4326008)(6512007)(921005)(1076003)(83380400001)(52116002)(2616005)(6666004)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Kjr0oRM5a3U3BMtyPCtQHFDcJloaQu3vv4l47M35zreTm3fe7TElzcjwYfYU8TRnE7m4q3HUicvekgbDawP4cQ9LRLigkmG030oFtuYN0myS0DnebuRAn3AwovxCc0JpHNrICFKbb1MB5/a7tOQxjiELy8wvOuswA7wy1eMWz4yPwPXhxfgByIxFyFHUXEa3ecq2WsubUkrhdB4x2QwwbXfRF9M+e0bhaHeV+nIQAkiJdyBvFjMiXji8sqaNmPXSb76Pj/v8KMflH8Yy1gtZr3QwvZrhElU4z/FFkSI+iM63jH1Va76hha7ip6JYg14mHRQMixFQVLh5nU2PBDoMgK/MA+/3LC56HwPUTV1eIrn34pAQl7iMISxgpvNgot+z36Eizw2PkINpLm/AGJ0qx0GlAJC7W7XUbGThmjMGYbMS9xkUwetoGNXvLW4y2VO22brKKD/YWmRWfgXwh5puOP6w3mdjWh7cVS5nRGtUIOgWwW/WHmmGlPnbAieUtGLISIhYBmGlcGnN89/6+PHuo38RwWuUly5AvKFBMCr6ywnYPeBrx1j4ZCxJPgCPjTdSQLlE7BBOIZn9zXHTpqo4WnzBrVaQ6e2LtVwDvlFlFK/RWoPohSW3M5bSyMpjrKaC1OvyHsk0MiyuiBwW9npTVIC3eGv5e5VwrGf1jESE2pL2gb27ohLATTsd3yy9DxQVFm0QITLeE0vLKDITpXvXM2iinFB0EFlUeohRvQsJ9WCJA/tewMUCqc7SgySv39RLT7UlSJqxUrL7nPGbAfL9kByJQOBe+AnS8PLsoP2zt/8/R+QfeEwKiFj8Cr0c7+L4EMkpaM3VLtClXWpf2LnQ4QD8T896w4p8KWJ2KOc4pkcgSbEQ+eUxehctCFRwHlQiJL2YntqqnUomKOo7PZHHIXVqXd05JLKeSlGlIDUt6+kZ0nr1Hs1nrPzt5jXvM7jc3Z2PJbXbMNRozS3uY7Ccoc87jFZKm82CR9OWxQgIPTYIkizU5eiqoGpkB5A9UAv7Iq/rWLpgE9kTOQDNXoIaSG5EUW7/Sq3kbiLHxrG40+F67X+zB4Q+J0oxMVGo4PE9umoX8MmFQ2uBYSOB+/gvN4a66J6S8cvsehhMsQoX9W0XgRccv0Wz7778G1iB4eo3aBsiHZEkf7j6VvId0toTkcy172zluE4w+j3aWLpScOX1dBTA/VUT5/HOFbSobJyYUd5GvAsVNai70/91X1/ccs/hGXrmu3+iQYyMIOwu6eJ5+mChJFrD+E5D2PqDVYzHYXCcpw+BQGrUxKO54VgDTh2QYcD80ejQD+5BBnUnKNJNb18EYsF4ZtGDiuQTLpC9KZEA3jQPSFtNfWAcR54R89+arO7+gMWwKFBuAYudIFEIT2TVUZC7j/YAZFaZJ8irV3neKsmG6E+P8/Wg9L3Em7BsZaja6LgK5ak7NZL/zUfP1WZJus5mZmurPslXAJrEOLzGyu+EWtZu7mvXblEzhyHm/Fyd9/xiWWln75DetjYNLSADHSXHxMpX0fXtyQWH3TttSD50MlHtybGsMqwgq52Tr3UL/YMU+jeyi64SqO5dQRSkU9QT7odseK2FAHvfpeWo1toK+/6KqKUTW7O2TpTRGz9/6pW6ceGVvL/yn1PR/DmUdUoA0ZMsmrARSnHtho1IW8BoxadDJlGX2r+tHLmJcox6gdRP32vIau2DxmI8tewqlm/8z7scmub2QJZ+hpTngIfFWP5phdP+Xpxg8w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a98c565-a24d-4659-bf66-08da3d993adc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:35.5213 (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: krA4a3gFEHz4EnmoRtj2Dg2nfsotUBZB0+4iICTiU/Qvw4mLeF03pANshLGPCYyj0dPOWwNspIcLDcgM5gCS3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5672 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org There are same name wr(rd)_ch_cnt in struct dw_edma. EDMA driver get write(read) channel number from register, then save these into dw_edma. Old wr(rd)_ch_cnt in dw_edma_chip actuall means how many link list memory are available in ll_region_wr(rd)[EDMA_MAX_WR_CH]. So rename it to ll_wr(rd)_cnt to indicate actual usage. Signed-off-by: Frank Li Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v10 to v12 - none Change from v9 to v10 - Change comment for ll_wr(rd)_cnt Change from v6 to v9 - none Change from v5 to v6 - s/rename/Rename/ at subject new patch at v4 drivers/dma/dw-edma/dw-edma-core.c | 4 ++-- drivers/dma/dw-edma/dw-edma-pcie.c | 12 ++++++------ include/linux/dma/edma.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 58e91fe384282..1ef326f7151a3 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -919,11 +919,11 @@ int dw_edma_probe(struct dw_edma_chip *chip) raw_spin_lock_init(&dw->lock); - dw->wr_ch_cnt = min_t(u16, chip->wr_ch_cnt, + dw->wr_ch_cnt = min_t(u16, chip->ll_wr_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_WRITE)); dw->wr_ch_cnt = min_t(u16, dw->wr_ch_cnt, EDMA_MAX_WR_CH); - dw->rd_ch_cnt = min_t(u16, chip->rd_ch_cnt, + dw->rd_ch_cnt = min_t(u16, chip->ll_rd_cnt, dw_edma_v0_core_ch_count(dw, EDMA_DIR_READ)); dw->rd_ch_cnt = min_t(u16, dw->rd_ch_cnt, EDMA_MAX_RD_CH); diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-edma-pcie.c index ae42bad24dd5a..7732537f96086 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -230,14 +230,14 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->nr_irqs = nr_irqs; chip->ops = &dw_edma_pcie_core_ops; - chip->wr_ch_cnt = vsec_data.wr_ch_cnt; - chip->rd_ch_cnt = vsec_data.rd_ch_cnt; + chip->ll_wr_cnt = vsec_data.wr_ch_cnt; + chip->ll_rd_cnt = vsec_data.rd_ch_cnt; chip->reg_base = pcim_iomap_table(pdev)[vsec_data.rg.bar]; if (!chip->reg_base) return -ENOMEM; - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_wr[i]; struct dw_edma_region *dt_region = &chip->dt_region_wr[i]; struct dw_edma_block *ll_block = &vsec_data.ll_wr[i]; @@ -262,7 +262,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, dt_region->sz = dt_block->sz; } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { struct dw_edma_region *ll_region = &chip->ll_region_rd[i]; struct dw_edma_region *dt_region = &chip->dt_region_rd[i]; struct dw_edma_block *ll_block = &vsec_data.ll_rd[i]; @@ -302,7 +302,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->reg_base); - for (i = 0; i < chip->wr_ch_cnt; i++) { + for (i = 0; i < chip->ll_wr_cnt; i++) { pci_dbg(pdev, "L. List:\tWRITE CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_wr[i].bar, vsec_data.ll_wr[i].off, chip->ll_region_wr[i].sz, @@ -314,7 +314,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->dt_region_wr[i].vaddr, &chip->dt_region_wr[i].paddr); } - for (i = 0; i < chip->rd_ch_cnt; i++) { + for (i = 0; i < chip->ll_rd_cnt; i++) { pci_dbg(pdev, "L. List:\tREAD CH%.2u, BAR=%u, off=0x%.8lx, sz=0x%zx bytes, addr(v=%p, p=%pa)\n", i, vsec_data.ll_rd[i].bar, vsec_data.ll_rd[i].off, chip->ll_region_rd[i].sz, diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 195ee1e47f21d..c8b479f1d4da7 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -40,8 +40,8 @@ enum dw_edma_map_format { * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping * @reg_base DMA register base address - * @wr_ch_cnt DMA write channel number - * @rd_ch_cnt DMA read channel number + * @ll_wr_cnt DMA write link list count + * @ll_rd_cnt DMA read link list count * @rg_region DMA register region * @ll_region_wr DMA descriptor link list memory for write channel * @ll_region_rd DMA descriptor link list memory for read channel @@ -58,8 +58,8 @@ struct dw_edma_chip { void __iomem *reg_base; - u16 wr_ch_cnt; - u16 rd_ch_cnt; + u16 ll_wr_cnt; + u16 ll_rd_cnt; /* link list address */ struct dw_edma_region ll_region_wr[EDMA_MAX_WR_CH]; struct dw_edma_region ll_region_rd[EDMA_MAX_RD_CH]; From patchwork Tue May 24 15:21:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860291 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 F1573C43217 for ; Tue, 24 May 2022 15:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238693AbiEXPXX (ORCPT ); Tue, 24 May 2022 11:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238942AbiEXPXD (ORCPT ); Tue, 24 May 2022 11:23:03 -0400 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10048.outbound.protection.outlook.com [40.107.1.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31E419D4FD; Tue, 24 May 2022 08:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VVVhRuG9OnVr1mKyDFNi1Vs9zqlffmlTenjTNb8lQtNr0HMt+4h3tScOQVzeeTiW/TOSoqmcZ+2nIkTXz86tAZ64+/MxTEuRkNK99JvjvwqcVIHrjw7s/QO0v+UjpQS+MRuoyHtyjIOpASqIvF61CmZBlt3YprG8QOhnnBngzqbM6ZCNxoEk/kLGBF7KBaH8+66cr5hWt5hyDxrq436b0pFdYkBRzfxWjyqYVTzujjR3KtjvTEo480TaSuv0SQ/6Dp2kkFe6E8nFIopA0vBC1aQ45anmpDITarjYcMBzgmqOFqM1/YA1T986tIR/u/u54t2f48dDuTQid6WOysaAew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m6PYFWLjdxdEGOKFifXzCyQb8b2XDlH4k/Z9xT9L3lA=; b=LQiFZq5UJ1KGNzS/EYI5TPnRv5qoCDdW3c3PZweCZlAmC5iSWN8E0y0EVb+gUrFzbgg62V+OG/qqTgFGgMxiSOXPrM61o0GyKdUr8pdSsi5OfSiodDi37gMxTS3BMXupBEnxElrSd9VgboztBppp/vNlmlgZh5b2j3aszY/nDxssNykXoqJIdjOxFBBiLrV4h0BJEb6vQ4X3QAXIWrW5k4Hyx+0oVyKb7JFAqSD4/sdCom/4CtrR91Zev4YaZHghSnY19yoINTcm0e/qk52ufWaBTzRWB6p3791P425+iGjswZxTIoqPrQhvZUlbnxdCeE5qpQJ1VlbndQuKLEAOlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m6PYFWLjdxdEGOKFifXzCyQb8b2XDlH4k/Z9xT9L3lA=; b=PsjHM14ijMA05NmTPOA00lu5OY67kosGA7fMEbZyzGwXBrt7uNbU9sT2WjhY02JJfTuwJFojBFdgHlj0t17DESn23AebRVptWyvZb3zwcWcVx9QOweBt2DFZ34RelYVF5bIIDHhVg0RJtGfjfWi+lmgY9Di8KeDJYpYDi4uf40A= 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 PA4PR04MB7536.eurprd04.prod.outlook.com (2603:10a6:102:e1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:39 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22: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, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 5/8] dmaengine: dw-edma: Drop dma_slave_config.direction field usage Date: Tue, 24 May 2022 10:21:56 -0500 Message-Id: <20220524152159.2370739-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: c3a9ef8c-6535-43e0-4ad3-08da3d993d52 X-MS-TrafficTypeDiagnostic: PA4PR04MB7536: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: +ZB8RJEDdy0dveltJxAQ5QkKhNQCwjBWyzOAaNXs6nLXNRV7Qr+jeVzuxrXyaBBj7vaRLx82OHXw1cvKOvNY3touJ5KLfPjavADEpN/EJu3LKzVIykGiFgrVEgOH0d5XXF5by9lmSTNeOWnZNkx/IDnvmBMifpu01Oj5it9v37OalHJ/SEhvlCEajXlMT8RKpr7RsjFMH2lpCN8jVJeFa4x2Fh2VDTxbBp7ctd9ZuXXFmQo3XJuThaR8KuPSGQjWMSrEwOzImMkKJeCUW7BLTWbTmv9F5C8mhtA0VTCJoOjpk+rJ76Z4zIZRtdvl9z+/lJB25LIqysU9mCHQ2SkaMQP/OnrjIsThHybFPDM7qamKXriOO5pWkD/G6x5NNr/7oTqO0xg4e0MPdpfubwxbIaDt48iV6TfUsFTg0hhARyMrWQiYkbcRAlrjAkhMJ2heaQz9mt/XHXCy5NhuDjDK/B2Bwoqnz1H4/NtKvjLMnZupk4aHdT1zIgZIJvxgmMtbmh9FsiXqf1FcPf1oAHBBu8IAcHfPa21bXkrdHO/u/H7I/LmqlX83vl8UZEMY5GiJ+a0acPXeVeT55zly1PqzWVOhjKvUf/UIZm5opFsm7gytHGFK4WzAc2fRVcDX9Vm3HFNaBsAcSZJZPHg5+MRzlx0aV4Hz40+Pq3zTJ94X3TTUWKiU9By/toJ0Zs7oRlo0puM6tPX5iKDVIg8GZt3zwrHf8QpUe2HS2xd4XyEgx4U= 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)(66556008)(2906002)(26005)(6512007)(1076003)(921005)(66476007)(508600001)(316002)(2616005)(186003)(66946007)(6506007)(7416002)(36756003)(8936002)(5660300002)(52116002)(6486002)(86362001)(38100700002)(4326008)(38350700002)(8676002)(6666004)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2CUIGeuLVH5LamAM7cOloG804XF6m11EHORNEZZxq//ejaL+Xln1y6U1k/JLiGTr970s0R5lXXAhoqlWz+Y7OkfOJtEv3oqIbPDtcQGW2zRVMQd81HP3X5JIdGiVJBdiRUnVUpHya5HSrx1X/EKihBLy1PknFHw5sj2h4Ju2OXEx0uI2mH2LeIyXwd+zlFfWFcB7YUtWhKOSqGatHhYODTwKuMiz570FfpwsDB1TooE953b2wifTy2huyh/oILm/QedidRGpcHix0Lq6lVVcLhuVS2UwuFDg7DYflD+U27J/Z5VvIh8CFBqL8AWs0h1gcg2DiLbMuuPDDk9h8UVdpEz23J6LYurZo/LN5E5HVP03gB766gCxdbDjg9zVymR0W1/p3ySDpreE83EEGBz6jxxkCnQV3LPeekiHxvhbls05ZN3SeHbVcqreLdWvJ56WngpgxtDJSZWY81IH9CFiWWX2vQUHBXLE8f20+oxbooECDKJUetlk1A4f/hXg4mKtSakkfyX1HmZwhSibKEQplnCZ2fQ6MNSnq/MRKpNbrruKcA8zQMheqZak28M2sgKtHDn9e4PU6pTNzbdD7VG8HDNEL9xfoxU5hlL+uD60DgOCx4rzWpm17wAWzGJ6Cx2c9s/JPHSAaBZaZRsKZ3tQUgSt/ri7zxsRrKSVju6WDo+8O+DksKj5GO3BbumpBrs91WObYlYfLDUOPxoMNS0GZQOWyYJNNDFG9i8Uf3vMV4qKHlGf6vjaCqvsJOZCS/Dc/8GG1UbxhuNw3gJ9crWXBi+7K+WOO/4UFCHsWTdLrXc7JhzoEQvPxFDhiVg2a15XYHW1vt24WmybsODX9rlaRWKkGSueyImfakcxvv+qRASl43EFC/c4jFbdInHaMmgro16/+EjyppIJRpGrrF/v+1mSuvTg7bTapyA8uHyQiJEaDMYRORpP+4jHeJXPVMIk8E6jXMOz8zeIMkTdVg/aFkR4LcoMVUg37nMEd82JwLm59hrTPwjz8VQ+Z/DjUDXozW/HHv+Q8BVOcjl1/BvgxWJ7igzKsFz9+DSLCMh/tdwGvQ/45mo6kvYHep4169AVTw8JDkArw8cLCJDiKv/6g3kUr6T5uCwN8AL9s7WTY6sbzBBmuE67UlxgGyRtk6MbFU026UMubGB8RZ1w0kI+tFOtZM1Y1XPSNYyWdDomkK7uD9e3vF8n2hQbhYA5DWHbpp9cVh0aBj4XzKEWrEXwivryJ3pQ1/GBg75586ceYzhte6TkYteBNLJQVa6bX4hu4yPIWeaWdOqJjuRQGTrvC6sGdK0Rj5Pxuo3utyZTWAsJWKa52wjKdVlaFTz+bQgHoOZNXoUXX6TbYLlVW2/GxkSv/XVCKHrrJE7tCB9eIfCeFmQepcl8xAS71alZ5gVRvZ9VuMr+YG/pqAEcfNKXbrFlUs8xgjdiaVXqhTBNpdcPnpic2pVbmqcAyIS6niCDbIXJ31WMoNTNxaacF/PMW8uj0bsRxKeq2emrrNsXdcGQW3hCa3jsYPkwTzpK3K8zn0zJSts2lcbVyKzi++ASEm9ab9/w5fWJ8xbC3MAK5nO3cAqGu7cMC7yfk5pnbAkFkADKM8kdzql3lcY1/xj5691QKfDFh8wvUnpgpo6IfdREZ74yN0jTpXZnYbFosuTfS9Jc6Q7cOkI9mzPMuYrIW+3Punoxx5OLASO2LSKN+VHeywINN5BHgM8f6kQW7JildlwMhWPvFSnEyA190ggNJQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3a9ef8c-6535-43e0-4ad3-08da3d993d52 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:39.6471 (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: UU33vdyve/b/iB3OMHe1NHnHg0iEYgc+0rIjOEFadM6Io3rlUEHvW2WI85zrvG8pzG+lEaMlbpsULyED1vc4rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7536 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Serge Semin The dma_slave_config.direction field usage in the DW eDMA driver has been introduced in the commit bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Mainly the change introduced there was correct (indeed DEV_TO_MEM means using RD-channel and MEM_TO_DEV - WR-channel for the case of having eDMA accessed locally from CPU/Application side), but providing an additional MEM_TO_MEM/DEV_TO_DEV-based semantics was quite redundant if not to say potentially harmful (when it comes to removing the denoted field). First of all since the dma_slave_config.direction field has been marked as obsolete (see [1] and the structure dc [2]) and will be discarded in future, using it especially in a non-standard way is discouraged. Secondly in accordance with the commit denoted above the default dw_edma_device_transfer() semantics has been changed despite what it's message said. So claiming that the method was left backward compatible was wrong. Anyway let's fix the problems denoted above and simplify the dw_edma_device_transfer() method by dropping the parsing of the DMA-channel direction field. Instead of having that implicit dma_slave_config.direction field semantic we can use the recently added DW_EDMA_CHIP_LOCAL flag to distinguish between the local and remote DW eDMA setups thus preserving both cases support. In addition to that an ASCII-figure has been added to clarify the complication out. [1] Documentation/driver-api/dmaengine/provider.rst [2] include/linux/dmaengine.h: dma_slave_config.direction Co-developed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li Tested-by: Manivannan Sadhasivam --- drivers/dma/dw-edma/dw-edma-core.c | 49 +++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 1ef326f7151a3..3ce0d7600da64 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -340,21 +340,40 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) if (!chan->configured) return NULL; - switch (chan->config.direction) { - case DMA_DEV_TO_MEM: /* local DMA */ - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_READ) - break; - return NULL; - case DMA_MEM_TO_DEV: /* local DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_WRITE) - break; - return NULL; - default: /* remote DMA */ - if (dir == DMA_MEM_TO_DEV && chan->dir == EDMA_DIR_READ) - break; - if (dir == DMA_DEV_TO_MEM && chan->dir == EDMA_DIR_WRITE) - break; - return NULL; + /* + * Local Root Port/End-point Remote End-point + * +-----------------------+ PCIe bus +----------------------+ + * | | +-+ | | + * | DEV_TO_MEM Rx Ch <----+ +---+ Tx Ch DEV_TO_MEM | + * | | | | | | + * | MEM_TO_DEV Tx Ch +----+ +---> Rx Ch MEM_TO_DEV | + * | | +-+ | | + * +-----------------------+ +----------------------+ + * + * 1. Normal logic: + * If eDMA is embedded into the DW PCIe RP/EP and controlled from the + * CPU/Application side, the Rx channel (EDMA_DIR_READ) will be used + * for the device read operations (DEV_TO_MEM) and the Tx channel + * (EDMA_DIR_WRITE) - for the write operations (MEM_TO_DEV). + * + * 2. Inverted logic: + * If eDMA is embedded into a Remote PCIe EP and is controlled by the + * MWr/MRd TLPs sent from the CPU's PCIe host controller, the Tx + * channel (EDMA_DIR_WRITE) will be used for the device read operations + * (DEV_TO_MEM) and the Rx channel (EDMA_DIR_READ) - for the write + * operations (MEM_TO_DEV). + * + * It is the client driver responsibility to choose a proper channel + * for the DMA transfers. + */ + if (chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL) { + if ((chan->dir == EDMA_DIR_READ && dir != DMA_DEV_TO_MEM) || + (chan->dir == EDMA_DIR_WRITE && dir != DMA_MEM_TO_DEV)) + return NULL; + } else { + if ((chan->dir == EDMA_DIR_WRITE && dir != DMA_DEV_TO_MEM) || + (chan->dir == EDMA_DIR_READ && dir != DMA_MEM_TO_DEV)) + return NULL; } if (xfer->type == EDMA_XFER_CYCLIC) { From patchwork Tue May 24 15:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860287 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 AA5A9C433EF for ; Tue, 24 May 2022 15:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238728AbiEXPXK (ORCPT ); Tue, 24 May 2022 11:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238963AbiEXPXE (ORCPT ); Tue, 24 May 2022 11:23:04 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D4BDA005A; Tue, 24 May 2022 08:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U+38HDTNO/JsqLmV5etydCIwnlhkqRu2gUcIb5jipPIC52lg4o3IGIxPf4sMb0Q1RHPl0/ZNHxpOerdc9ukAkCJsqFCKjBUaxmDcmYMdusguF+Mc2elR5ZkfPFJTgQLSmbidKd21kRcefHw11qeIKSa0ah96haV7sLslWDqbWSFSYUPFmHf2VE6UHm0J5t4QHli1SbElgTNUFk31s5LkfPHwpEMRxgEdksQidVVq4KjtRLl1PuT8yEuOdhIFX8vqLM9xOX+0ZQr//EJgOMDjE0kAoP6CZ0qkldRtKH9ks6DeFj9p07s0Ng0kPZeW0SLeA/5R9Y4SRgefRCPXrjLZ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8xiesIl3VQKcbMSIZFTlAHHkBLiMP3OMyWwMoX4eAW4=; b=PV0TXvkbssWYAzlyDsDFM+J2fz/OIL1//duiqPiPzZf029vF5LYeb0JFs4+VhGz6H7snOeIDOMSWibHtS3lIxojuD1tZhb1NoesyagS2Qf8TXSQw+LuW68GPK+jBFQS1GRN7FdYDQgJ7T5vtiC/RBH1vcwwWFu3/Ef6qy1gH3QHXprJIxa/mnMqQpkEt1rmf6gK7WcuBpPVr4q33jsze1hS+IxQzPI7c6aNkmZt7ro/fdqy8ZWnbhhpqDFYSCQp7YslDDaqLh4yFAoTwjpV8pucV2IhGRvxytbkyV+M0ainwFHZ022xHVfvgMFdm+sFy9vJ3cgP6uDw8d9N+xUh4MA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8xiesIl3VQKcbMSIZFTlAHHkBLiMP3OMyWwMoX4eAW4=; b=gMhVg2FMqTUSOYC+WkGodJQ0ug06CEZPsNqWwIysnYpzTYE7oBdNywd0RwOUxWnXytk8fv7eJ5a1LQqEbpx1dLlx8+qkfFogpD0tmOBylPuYZh8wFdAuqt5C652s33QvbSvlhiwRPrsGhLRQ0P14kcIu4zhcvIQVdcGZhVXWt2s= 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 AM6PR04MB5672.eurprd04.prod.outlook.com (2603:10a6:20b:ae::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:44 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22:43 +0000 From: Frank Li To: gustavo.pimentel@synopsys.com, hongxing.zhu@nxp.com, l.stach@pengutronix.de, linux-imx@nxp.com, linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, fancer.lancer@gmail.com, lznuaa@gmail.com, helgaas@kernel.org, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 6/8] dmaengine: dw-edma: Fix eDMA Rd/Wr-channels and DMA-direction semantics Date: Tue, 24 May 2022 10:21:57 -0500 Message-Id: <20220524152159.2370739-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: aecfde96-b0c2-470a-9e19-08da3d993fcc X-MS-TrafficTypeDiagnostic: AM6PR04MB5672: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: L7rgJSeTZ0c1g4Y7DHkzxrAQqkEg9ldNR5x9P2b6iqiZ/ovH7+Opy/31c/1hizxsekKp35zgY0/3dcnjom91O0SQfzNb4ABz2gK0ZpzExiTL94S3hZX63x/dQSivZoWUfIHoFh4z/zullqrMFVB9V16N3XdWG1u59Cu5F/aCNTPqrCufDiB4p53xizSMO2L9+Nt7z85caUzPFs25xGz0pX2rHS84Eb27l7eYgygrPYp0TzqOOw6MAhVWW63IpXvUPe2oFOX8inxPALB6QjD/XCu/EoWYI00/2Vdq9Lsqw1I1/BDWEKLAu9cxOhgLzS02BUE+cmTiJ+5hNbpR+OmlWu2Nd5LB0YHjvieTokosBOSAbAypWpkYnVwQi7/KNNEK+fLGTQyKifFfhFw0J6+wv53S8WAK3RRSE8SnDcYXyLXTS+dr2M+npSQyhQbez8u9WrYhdQ98070QNKRgSNITbQT/hj6oje+R6+MSuKKbv4FYwmsezI794+rG6YP5FeGCi0zrUebwOdr3LtonuL7KOy7FTyil+qHpUzihlnCGwq3FtUQ4wIG5MuSzOhsrXLLhjattmoS30iDjZ2++jY248yUlQUQSY6OORroaIaU1rFHylZT0ES7OO4xnjuQRyE18otfnFtVspvXmvc1H+eBOlf3tqhzUyTHnB5xiujjAFbf9jd5t0bI3UayUx9x8uh32w2Mx3iwDbUijUyMrO3sFtjZWdxHMeADnX6OnV5Gf8sQ= 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)(6512007)(1076003)(921005)(6666004)(36756003)(83380400001)(2616005)(52116002)(26005)(66946007)(66556008)(6486002)(7416002)(86362001)(66476007)(8676002)(38350700002)(6506007)(316002)(38100700002)(4326008)(5660300002)(186003)(508600001)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0EeCXT2ZjiWLgPe+GZYr31cGoT4Zpw7gTaZb9fBmcVDphsw86otVbPOWJtzoEcISrx3J0eUJRMqIV2g7VlIE5QNU7XL2839wMbRRuXnNYwy0HMznEJhNcfmMJxClXj5N8N14E79Hm+YWPcb+43rJZmR2RNR3R9rZECZQpLNk21nvh8EgQBqZ8AMkLClotBDxVOrsOJAXjgJYWYjGyUdDDkNfrXPVJ+E+U5sa3Ppz/esuXVJGdaY8SAbcltfoCK5PLuRB4bFuS577q4xM3xj0aK9dAm8rylUWxpu/q32clzGCbgm/Vjv7Tj78NMU8tgovyqDCqNF7FHkAUtdNLcZWDe9p6TK3M/VqiYf9NJpwMVyE30HVunA6Nf1OiJkt90YIIa6F6eDsRKEwDHPeZy0y6szyuf6jJIrcpVgiG0eAY1duFnGLLHhWCKmifohrHx2A+tNDq4oS5v0NaT0l2r4w5v70gmwfBcpn6DOgKBGdUhp2jjAkK50j8TzMXyvymbCvA4XRNvXvCnbtK4iKpNoi5jXfXn4lQL0Y/iCoJKF8fopuQ656YvWPGOC4muRca74qDJg1AWQ3TeTg9I7TOGhLDomlkrXWOtyJuxnpE9cFo53/ArUZBGcKwIVtEmHCHFo46nhLGkZgPg3+Z8gprUNxmBgpTTnIJ9+qziR/IuYXXeSvMFZr4ctqjJ3XmbSm/glq66du6/QKn0b73Zw6z++f/bobx7oZwIWB1RYtlAYTM9h5bNf71Do0o7GMbumuzL8Zr5E9z1Lg0mt+7zungn+02bd2241GJI2NpOVrgJ74QEsNr1M4Q+mCy09LAkLyQaPcAPrUOqcOtgurdI8+auBHoSXT7PMlCbI1da5Pw6gg3Cdd8tko+MCPeCDeckP/vZC9xLEQzFzONofSaYde+tCDrrdqg6XmDaGpR5L/aGpvlizWsrVOtz/1cGpBtOwCGWYzwMmZ5IMZ/3AOv3jGVlmxAU6TSWP/1x1ljC4yEfTtGcYXFfvJ7Aw7nwiv3uZw4Kac4vOW3ywxWJ+oIggEC2L9asuLarsmc5Gt/DMbUtlRPNlOK0lqxN4QD/vxFqLw9KVoKaY3Mc9pjAz5Q/1bAdmFLfR2L1OjYvZzu8q1+cEC28Er1Zxkz2dUTDXFZkLvcEH4MKp32BJ2Q3O0jPL9cJFNytQZkJZSZr0woEGM2rMn0CwrV3rp5WTBzbtN4t4OaLDzX8HVV026BnE8s9PGsKfuKYdwG8PVRqJ5axUfvFJgisu/qTaq3C9fJLEyz5XpQqRVZPI063oiL7tWeU9b/eWkTuQiJkQt08K0RNCUSXX90EgYwH5AM2YCPD9G1SA+IqlSyZCfbDe6sMNvBZ0sdV6qvwdIJZO7lHVVZ/3nc6FVn7D3c7rG/YpFXhKXUf4zeGc22WqtjFwxEmTCwSQSvuL9WYs3meKsRRw+rsAaW9rSv2Pzk8wjXWNU5sw5ndAMA85TDnT50gjo0m5cCfRQH+jYpQ+eHYsol2SJnsDlXdkm5OLKSi305/1zne+lTPIAryMGkjB/hxjdvo3fEAlyZ1UnAaZTxhDo2roTCvpyBfmQZxkicz1VOpugG/4X/+z1h9xoIDuU1iUn9o8QvVkRcNfim+fGCUINpwybkKtcvhgDykucKIvGa2cEwzTaiHzyKXMh1QB+lgTNEtxQuh+mmtT6MQK/8ieLZkMg3ozJYaMWoNMMFxPj9LgMVwIwD5bwZA8H1/4vXhhmWPs1XSlrI5hUhg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aecfde96-b0c2-470a-9e19-08da3d993fcc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:43.8667 (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: OVnMkoaMWhRstyndJ0H53sOE8hawKmigwlgDbqwFzAInqGTR4EEf9d5W2QE+DopWqPnVQs2wXPzqeSNoYPcUlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5672 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Serge Semin In accordance with [1, 2] the DW eDMA controller has been created to be part of the DW PCIe Root Port and DW PCIe End-point controllers and to offload the transferring of large blocks of data between application and remote PCIe domains leaving the system CPU free for other tasks. In the first case (eDMA being part of DW PCIe Root Port) the eDMA controller is always accessible via the CPU DBI interface and never over the PCIe wire. The later case is more complex. Depending on the DW PCIe End-Point IP-core synthesize parameters it's possible to have the eDMA registers accessible not only from the application CPU side, but also via mapping the eDMA CSRs over a dedicated end-point BAR. So based on the specifics denoted above the eDMA driver is supposed to support two types of the DMA controller setups: 1) eDMA embedded into the DW PCIe Root Port/End-point and accessible over the local CPU from the application side. 2) eDMA embedded into the DW PCIe End-point and accessible via the PCIe wire with MWr/MRd TLPs generated by the CPU PCIe host controller. Since the CPU memory resides different sides in these cases the semantics of the MEM_TO_DEV and DEV_TO_MEM operations is flipped with respect to the Tx and Rx DMA channels. So MEM_TO_DEV/DEV_TO_MEM corresponds to the Tx/Rx channels in setup 1) and to the Rx/Tx channels in case of setup 2). The DW eDMA driver has supported the case 2) since the initial commit e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") in the framework of the drivers/dma/dw-edma/dw-edma-pcie.c driver. The case 1) support was added a bit later in commit bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Afterwards the driver was supposed to cover the both possible eDMA setups, but the later commit turned to be not fully correct. The problem was that the commit together with the new functionality support also changed the channel direction semantics in a way so the eDMA Read-channel (corresponding to the DMA_DEV_TO_MEM direction for the case 1.) now uses the sgl/cyclic base addresses as the Source addresses of the DMA-transfers and dma_slave_config.dst_addr as the Destination address of the DMA-transfers. Similarly the eDMA Write-channel (corresponding to the DMA_MEM_TO_DEV direction for case 1.) now utilizes dma_slave_config.src_addr as a source address of the DMA-transfers and sgl/cyclic base address as the Destination address of the DMA-transfers. This contradicts to the logic of the DMA-interface, which implies that DEV side is supposed to belong to the PCIe device memory and MEM - to the CPU/Application memory. Indeed it seems irrational to have the SG-list defined in the PCIe bus space, while expecting a contiguous buffer allocated in the CPU memory. Moreover the passed SG-list and cyclic DMA buffers are supposed to be mapped in a way so to be seen by the DW eDMA Application (CPU) interface. So in order to have the correct DW eDMA interface we need to invert the eDMA Rd/Wr-channels and DMA-slave directions semantics by selecting the src/dst addresses based on the DMA transfer direction instead of using the channel direction capability. [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v.5.40a, March 2019, p.1092 [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, v.5.40a, March 2019, p.1189 Fixes: bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics") Co-developed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li Tested-by: Manivannan Sadhasivam --- drivers/dma/dw-edma/dw-edma-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 3ce0d7600da64..fa95d1d17db21 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -443,7 +443,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) chunk->ll_region.sz += burst->sz; desc->alloc_sz += burst->sz; - if (chan->dir == EDMA_DIR_WRITE) { + if (dir == DMA_DEV_TO_MEM) { burst->sar = src_addr; if (xfer->type == EDMA_XFER_CYCLIC) { burst->dar = xfer->xfer.cyclic.paddr; From patchwork Tue May 24 15:21:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860288 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 55CB0C433FE for ; Tue, 24 May 2022 15:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238778AbiEXPXM (ORCPT ); Tue, 24 May 2022 11:23:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238900AbiEXPXF (ORCPT ); Tue, 24 May 2022 11:23:05 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19BC6A0D3B; Tue, 24 May 2022 08:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oDkzMbym0we38pCa9qjvtKvy291ief4x9rAj+i5PB2evtLpsICp80jwalYpyvRkOBKVicovJhL9LH7XfaQSXiEShArbLyXyXRQLq1fIbpVvk6D6mfDZxy2hBw1wnRFaBm05tRAMvBdJys41WGe88oDxQr+YRhFagl5ZuBrhDVTUwGg4FWS7HQA+/EBbEzTU4C9Bjfb/r5p0n0x8y3/Tb+3ZdHPrF/ar3mMgq4vWE7M0BzO0hnq9X6EL/fFFqpplsBjoeasaTfyc6urK773NSnsdGnvy5Q7RzMeBMFSsVpGD0FuKF+EJeTDbmFN0/5Yik1hD4YhyOatiYmejtH32k7Q== 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=/aHFPqXCBqiH4vAnDWzIjxzms//3bONxbDu8UVGy21k=; b=QddPw2aaPbmDI00VMwwqUOZJ3iIQUUfMHbg79AqAzUtURFr3Zq5zOlJSuT1N+QR1NIhxWv7tbPjIvna5DuKiX6SsB03l3jfaKrSdvzCykjMDZJteyf1l7SOCffbck0umPPVJQD7tsHNbFtLW4LNp/duPEhskRe8lhEOop8HQ7w6NBAaPNjdfN3npUZxRfLynQvYouLb4rG2gRY6Lr9F7ZcTY5YiHBSWOg+DzCVynOYTKNHA0szQ+Vfk8P8CbX9hX4iwZaF6ndEYQ99Bym2lL3ehkd0VVR6H8agn05xWWvSEmDvnWJZgVDvIzTvnyxTrd+kr2OltlkgvuvG5Fh9O6Bg== 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=/aHFPqXCBqiH4vAnDWzIjxzms//3bONxbDu8UVGy21k=; b=CruvoJNLU1dapaq4OvmZ2Ne57sYdMnQJeTW+mwSu1lHNeK2BQah6zQUd79s5Okvqy0KUOFPxtclJ1C/q6Oew2acOWwr5vxF+EOngZOCRXRzHWa6xs1vpyRIB60PfRamkoBKp3qgDfU970ZK8B9bUHt8d2O+JS9PcJV01kmrhE8o= 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 AM6PR04MB5672.eurprd04.prod.outlook.com (2603:10a6:20b:ae::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:48 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22: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, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 7/8] dmaengine: dw-edma: Add support for chip specific flags Date: Tue, 24 May 2022 10:21:58 -0500 Message-Id: <20220524152159.2370739-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: fe35b2f9-7263-40d2-5f3e-08da3d99424e X-MS-TrafficTypeDiagnostic: AM6PR04MB5672: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: tDWDnE+SX3Lh8vUtOPOw/mzwDbMqTTMUU+ZKJ3ozCCywPPo6SIq5OWF85M5rDnNpnDyyebhg+81i7khC4zpW/4pskcZd6T6Bo/QhPZYGdWTBhqfT4bkovteYIXxPjUQZZgtxPZi0n4zeV/SRXkr5c9gJ9wOG0ml6B3LQYUkBM3+wqMO5pIqKp2dhxeLThnHEV9KzrIHwClPURXn2whi5Zwz38ajIC/k6ydmrM7jQ8EFPpJXpy1da4QKJMGtqBzsn9J3NOu98vt/0FTEZqI3i4GpBwirawzlzrqldXgvLGDDXDnxy/FKb6m/7lRhlR995QUn1eCb/2FvOKjmQkGEsE7WXsozpVdF3OyK6JXkREuBaxbdh3ZW/7Zc+DSh94wmfD6CPSOxu18urKHJKSKrkt+64On7E/WxA2wOYq0fjKHLtVpeq4Ni4LrOel5jYif+A7WUdc3EkxOYwLsegqGqQ75QTWXP3q2fL16Chuxr70y48SVrSGq7R3HMnqqB4L5i9Vg3FFch6iNgYRmbf6eKeqih0av/J8YkDssrUL/2mWtbXqHzZ7cwdMZUiAzTHwZo4Gt1uBInUeuuLyt6VTySuY4Bvi23Xb9yJJ26M0L2dZHkaMicssxx0/2R2rqnfu9XzRDLVSUfzTLxXC+xr/LpeHzcDVBIz+XNK4cWFJXMmVbCob1NZFkKEe6zHn60UxsU/8zAQ0bcd8MwWkQPBtv+V7wzOIK4IlwEvugB+RMjjQWM= 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)(6512007)(1076003)(921005)(6666004)(36756003)(83380400001)(2616005)(52116002)(26005)(66946007)(66556008)(6486002)(7416002)(86362001)(66476007)(8676002)(38350700002)(6506007)(316002)(38100700002)(4326008)(5660300002)(186003)(508600001)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tdkg6KPWoXVNYZwbHuH/IOmLT22KorsJr/0VU2rQAkEd0oxVvgWQoeSnOeENAiB6xoQlw/htWn7k7PwL5ECjTYeeEphlMqDvt75685K+jvK2eIrgeMjgVF3l3z5c/lyusKfy7sm8qTMDo9USzRUXivXBpw+YsTgCXJXXPHbxgIDjUAqmlI6b4ufHgeg66QP058n66nHLNA4caKmkJ66wtj00cdzM/9o1zXDSxNa/dx0aNY916vE8qckRt0QoxH6oseLAEe+IemPSlWD0BMq+BKtF27PeXIB/RPpIE8kNW5a2Y1WQMwy/Xw4gfEqx+PE68E/mKVBZyukT68m7C02P1PYuAXIGoRe9oSyBX0rYZVvBEoOcWTeaXvbZXsERj5Z31hcOZf+4zDvdj4Avm1du22L6y+Q4b+nugrx6oQQWX+bLfl1w3HYZroBXeBaerF5cBvS/3CUbzVMPMx3wyEh1wrm9Fn5XpnwIqZXLO5Q88ueEeq5aL/ye/MdKSf9nYcmI7KBmy52PZL+Mo6rDqgnl+W7Qnd1JD4JopEYf5zqJLV/qGcghEeoeHepD/iufVPCWuT5nl6fiikuzCBrdjOJVcMjdVWlvC4YHP1sdT9Wq5tZpbiEqUCadVL1iGBpmu6s+v1kc83LP3C4Rrk+p+ogawp9dTe903GlUZsASz+4eFy58PDwiiYF1CM7e3GBQRw6M48nPDBOHBcLAFBqv1zGGlEmO4mZMYSAApsG7mptxs3fBsyFwklFe1lD1bLplsHoW7F7rnfGl1+yVylFRTMW5jJUFZdyM7SgK6hkW172MYZmckK5piaacxM9dLl6k6LDGtox1QOQOJikRujrTTIXQ/v9t+q6akY8S7a05RaSUBu9iNA5ftKsKsYS6kFPyQVLSCDe430M+WKt73l8SWNWYJ/h9KSk9Dz8b0+BygzFc+EXZandFxGX/uUeIjZMGkdXPgUT5YBT9opMOIJI7P3yxjnAqbwT8PdFMhwYhleL9P/98xWX4B/92mKu3JcnfvdiGYib7mQaydVrEZztQ+i27vQMgN2eD1C7hvgDF2ti8DdVZz3iw7TbaYzr4OkRglw7z3Oib+MWLInJEOz4b7ocUk3C7G2eB9L+g+co24Pu6Yxcq8Hl0VuloxjjOmb+/pE/4kBOBYjtFU5eAN1A+Uj+AjC9ZqJqQIo09bYdXGpYom2KMlRb6ywASMLhsPK+8qvmbxupvypC2ETNmROygtjLsjRa123b660MBbIE2KzBBqDDLSLlUwa0uF8dh1Av8sFxsE8FRI2KOF39ID0I6aZe2Yk8y+8QNPl78vD3QM1DdbAKtIt5iuUcvPOqOf+WxQxVSOLKyZxhYaMwcVoLZH6IwBFHOWhYraUN+YYHj2lJjs/O/GIJgligIoRoCfl32MBrJKEU8m00OFOeJjl/WXqqtRvvP2phgNV3uiJ64ul6syU31HnY5ocV1k9OElw/nVFkSnIwmlgfbPpkYXADXDY0+sd+yDEBJBHEwp8EKTv2Rl36Mt8tVaNQSi0RSWDvyawxoE3v7THBY0hXzYJfk/48Y5fQ8+96v5SxmMvrkuE6S6fL8l9uchO5o+jiK+esWJyBwNymnRauhKu6eVCbHNnIJ6v7dbUH1sQniX+C2QhFaRBtsa+zEeoAWp4Mque+zaDIUq3Q/ui5OCsJdab76LdteQ0r2LvE24i2HkbM9LOV5lEQca3RHoYwWxmHXisnYV/uLCsxb3rUcL3xuRufL27P7tQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe35b2f9-7263-40d2-5f3e-08da3d99424e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:48.0569 (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: 1QlM7j1/SOzxXSBrjuXZBr4tanFobpnNDQrjEbMqyBOWibmlTH0RlNxDhOofBTpRkceQGKa9izvO/znX0qcG+g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5672 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add a "flags" field to the "struct dw_edma_chip" so that the controller drivers can pass flags that are relevant to the platform. DW_EDMA_CHIP_LOCAL - Used by the controller drivers accessing eDMA locally. Local eDMA access doesn't require generating MSIs to the remote. Signed-off-by: Frank Li Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Serge Semin Tested-by: Manivannan Sadhasivam --- Change from v7 to v12 -none Change from v6 to v7 - dw_edma_chip_flags to u32 Change from v5 to v6 - use enum instead of define Change from v4 to v5 - split two two patch - rework commit message Change from v3 to v4 none Change from v2 to v3 - rework commit message - Change to DW_EDMA_CHIP_32BIT_DBI - using DW_EDMA_CHIP_LOCAL control msi - Apply Bjorn's comments, if (!j) { control |= DW_EDMA_V0_LIE; if (!(chan->chip->flags & DW_EDMA_CHIP_LOCAL)) control |= DW_EDMA_V0_RIE; } if ((chan->chip->flags & DW_EDMA_CHIP_REG32BIT) || !IS_ENABLED(CONFIG_64BIT)) { SET_CH_32(...); SET_CH_32(...); } else { SET_CH_64(...); } Change from v1 to v2 - none drivers/dma/dw-edma/dw-edma-v0-core.c | 9 ++++++--- include/linux/dma/edma.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 403ade40c1b1b..607647dacc291 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -301,6 +301,7 @@ u32 dw_edma_v0_core_status_abort_int(struct dw_edma *dw, enum dw_edma_dir dir) static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) { struct dw_edma_burst *child; + struct dw_edma_chan *chan = chunk->chan; struct dw_edma_v0_lli __iomem *lli; struct dw_edma_v0_llp __iomem *llp; u32 control = 0, i = 0; @@ -314,9 +315,11 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) j = chunk->bursts_alloc; list_for_each_entry(child, &chunk->burst->list, list) { j--; - if (!j) - control |= (DW_EDMA_V0_LIE | DW_EDMA_V0_RIE); - + if (!j) { + control |= DW_EDMA_V0_LIE; + if (!(chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + control |= DW_EDMA_V0_RIE; + } /* Channel control */ SET_LL_32(&lli[i].control, control); /* Transfer size */ diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index c8b479f1d4da7..7baf16fd4f233 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -33,12 +33,21 @@ enum dw_edma_map_format { EDMA_MF_HDMA_COMPAT = 0x5 }; +/** + * enum dw_edma_chip_flags - Flags specific to an eDMA chip + * @DW_EDMA_CHIP_LOCAL: eDMA is used locally by an endpoint + */ +enum dw_edma_chip_flags { + DW_EDMA_CHIP_LOCAL = BIT(0), +}; + /** * struct dw_edma_chip - representation of DesignWare eDMA controller hardware * @dev: struct device of the eDMA controller * @id: instance ID * @nr_irqs: total dma irq number * @ops DMA channel to IRQ number mapping + * @flags dw_edma_chip_flags * @reg_base DMA register base address * @ll_wr_cnt DMA write link list count * @ll_rd_cnt DMA read link list count @@ -55,6 +64,7 @@ struct dw_edma_chip { int id; int nr_irqs; const struct dw_edma_core_ops *ops; + u32 flags; void __iomem *reg_base; From patchwork Tue May 24 15:21:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 12860289 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 6E05AC433FE for ; Tue, 24 May 2022 15:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238887AbiEXPXO (ORCPT ); Tue, 24 May 2022 11:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238786AbiEXPXG (ORCPT ); Tue, 24 May 2022 11:23:06 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2084.outbound.protection.outlook.com [40.107.22.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2D35715F; Tue, 24 May 2022 08:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RKfep7JPscO0r/TfazBzLOajZ0X8bAd9Q6IEV5wWqN6jIwijsGYVNgY61SUk+ATrknhLbeamBXZfdYl1Lx6r5AAhfTb0xaYy7sGc7+FAVBsyNGUeTpLyTdu1dXfwnJtqiHXp3HEj6/qRtjBl7Hg99hs8HM6co7PAjxpa93f03jdBe46O3p7yke8jPhOZAXxqX9U4xMMvGe7fj9NLK8tclxkYUTY35PuJ/JoSVBi0hGCJq+RUgkWNjYhyB2d1n0t46TV1t8MlTfLl1zZDKXIoq0uQQPzcM8xLp2IC6wYXxyJD/p5Llp1zspR+2IIvadct/lAuvk5R/4afVZMF5nnD5w== 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=yUl4xK3MiOMAFiJxrMmhTFnUxSXfq0wb8AMP9oRxT+Q=; b=bP0zvuDSvcvO6X/IWda8xPmzn7XQt8UNdZz3HIedRzLygZSjgm3bHiMUzOPiSDzmAA9EbIwnHO4Kuj/oWar0Dk0vraiBe8ErkbJk6gupi3WgDpTQdVZl/NiVsIhLiCxX/Bp7pb/CAxr3gtVv/gRGZyZm7Tx5OkqIyPxm8jpalUHtK5qeHoJX6+HcT94euMlvX+luoCCCzRfMN5W5tBSgisqbVk1z1pphiQmuiC+e4fGp1YT4C3h/xKRbP4ZrEDp9nXCe82xZ6k6jAaQf+LQlwS9eMAj+femnxU/DL+kQfmpTzKz4oTrw6er6e/02ayP8GphxNN4OLbcjiesH52tn9A== 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=yUl4xK3MiOMAFiJxrMmhTFnUxSXfq0wb8AMP9oRxT+Q=; b=poN/luJb5ZsEBoiWY0IzRJqSBqECYSC0bw8zAO4Ayaz3QO/pi1KS2MIWEi9pxyBxz9IJY+PEsdOSLgYIyNlQ29VkkGx3TJyPT7c1v0J84QkcKyRZ3BJ2bpfuAOfdQHIpIP3CsaSVzQqWinCNoXmkmHf3iDrfykJZkZrFwSiWHEY= 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 AM6PR04MB5672.eurprd04.prod.outlook.com (2603:10a6:20b:ae::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.22; Tue, 24 May 2022 15:22:52 +0000 Received: from PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea]) by PAXPR04MB9186.eurprd04.prod.outlook.com ([fe80::e0bf:616e:3fa0:e4ea%5]) with mapi id 15.20.5273.022; Tue, 24 May 2022 15:22: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, kishon@ti.com Cc: vkoul@kernel.org, lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com, bhelgaas@google.com, manivannan.sadhasivam@linaro.org, Sergey.Semin@baikalelectronics.ru Subject: [PATCH v12 8/8] PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities Date: Tue, 24 May 2022 10:21:59 -0500 Message-Id: <20220524152159.2370739-9-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220524152159.2370739-1-Frank.Li@nxp.com> References: <20220524152159.2370739-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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: 3243030c-d5e5-4dcd-690a-08da3d9944d2 X-MS-TrafficTypeDiagnostic: AM6PR04MB5672: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: nBYQejlq2yWqbYN/qzOmn10JNGE+kjZfOpOMy5HwBhsBzI5Llr5mkCIVSP4j5+xbKxVPsHCOWzDj1MrX2ihuqz7UjH5vMzoQPDMbG8DeX4WcOZRVSGux7/9c0DI363+pCocz8DphcIjtwk6cK6yjHyrtL0N8adHi8EuMdqfzdzJa4a1u4TSqlOML8hgArwYy8SLqdPOV4gZXqlK23LYeFFeNW2c1uUaaDyTkfjJARH6xOryAUVcTrECpO/jd1Q9dMZaEQwTdZEyn4B0UepwzpSr9+8KZ+RnZdq4La+N/ruWZDTwM1w1J6pTAdLjH2WWofXY91uCAneVHmM6f12sq0OdKr72MynNWax6ZuDHRVFSEhn8orf6Z7tprZUd3WZLQDsehh0qgZEJPW2jf1jXg3tdfWmVMzWTZ8EpquxdjhuAwvJgZ0Aaq9Puax3tzQ9vqSA9Id/DD9dbZphsJSIg/wvAc7EdZIIyaziNIF1Kpxz1/7NTwXxBkFaYBePMpB/Ap4xViDuuCJ1KI//qCr9CULEGNBlWI+fV07SDyDUVNgn6Mp5XkoatM1oBPaY+fQddtBk4a3H+Gm23k+DY09kYrXbRhD9QS3C9F6s72ROM8Usinxp1w5OcWZ9cSINfMA58amYnWQT8tHLJ3Lcmz6GAhZBSOjqzJws/PiMY81wjuyxVLr533BUHK5HnkzoVdj7fP/8KHXkR8yoJVAjuiESovIDYJ8Ix8lGb9XExIIU1aNKA= 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)(6512007)(1076003)(921005)(36756003)(83380400001)(2616005)(52116002)(26005)(66946007)(66556008)(6486002)(7416002)(86362001)(66476007)(8676002)(38350700002)(6506007)(316002)(38100700002)(4326008)(5660300002)(186003)(508600001)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UInq8I1/cJgk6659hDDms6UONwi7FIs5Jjd1eKYAJKHXREoZ9LOD0kjXiQMgkOk2NUKuPa5uKTbQ5OuEy8hq4poDkv3Bnl395x6ODi3Rn4ah3k4Dy1BPaSmUUPX8c8xGlYYWCsuuP97ojM1uI2nW3MEXExxgfKYmeITIMXJuADcYjoTFXTJ9zVmbDX56vMX4vqmivItCN16kxKSxO31OTCv4i0VX+1FOn8+ZrQTtw9zyYg31ftd7dBDuQWC4xPn1iigwD2vmBo4zGxuU6mnnkFklbnxbaW+ZnxhW0rH6xEtPWeHiWa6IO2y/nANl/thEWnKO/dbA7w/z0iE8lQQcQya6fiuNjyOOWlgjuc26GtOfvLQ8G6ibUnEzglPGz/zH4GB+G5GDVnq6nJqrNW6FQNDB+JoG4FCbvMI2g6jHViGyHiO+4e128A9I4gXJ57RDqIe3CZ5eWL20tHSnp/Dmd5oge6lRNwc2rLQBjH9JhVGLvux+LjlmiCfqX5+txtDfHuSj5cMOtFZNgaZbGaTOyb6SLjBONVxnEIJmcJpFPHE/jhHVyH1tK/blxbEZBTUpUnfc2zWU4e4aRCpjdU9LwVwdh7L/FdDVk8PtuQQWc8hK1MtaDCXFeeG5z9lRZbtqCk7rCBvxUwzV8mzrxBdJ8X4I/dGwLhIDGit91D/XaQtu71d7DkB+dyJBLv/xCToo6CiOgKlQ2Vo1PGVZOddsP02bIuWsUFHNnd88dO9l0RgUSDIcrvr9XMnRWO4OGaccl09WBTxoYYMhYYGgP/RW4i7AcdmGRXp5Z0F9L30ujm0aiTqgi8X1a21uLkO2HbEPK6sl7fEfHkLGFD1rzrnIrHOl8/yxYvFINkUz64NSjvdhud2c+t/IX/FW/wM0xyrn2A7IVWlLD67lPxws6/tyAeRkRwTCGMpbUF+21Go0urElag13/1GjnEhX8J2cdt5WlPPLxU+PLZzOPbM95aF/jyZXDzDSrTlSjnHofVV5UuCW3jw787HsVXclDK2/R8vs+98KlK+MMuF6zpIY/SO93C6+QWcvsk6tkn+MXOvzT53v9+uSkd5LCALaN3bGlppogIGtt1fJoNsQ0p2c/zeyy4noUQ/UffJ3ce8xvjxuNFXQMUkVhEUsBHNJdtFnsu7nvoNLHd2VNaSDaKyK7AoRMWlH3c7uFv+uaLD67Qk1ZxQZg5Etrw+sbm3qpxbseFKDMATGnps0ZgIi1zkjeMVzI1eNiUbP74+vP5L8fkPz+uqE44iY77pfW/oseNtbrtgWN6Z9XNPcmYQT9kSJA1Ce7VuN4H3jrgz7FpxBUyLoKdCtlmHB/7zgiWjwUVH9CnshRXh7cNazKoSnWphPw29j1xhPizAmRQ+Qq7UkG47oIvDefPBgV70Xnh27rL3bmi2+23X1oh8IHGQYyNsBbH0EFl7IogB4516o3/m38rxnh4LoL13zmZRtsAT5bQfPDd+XaZ3MF14PiuEtjEyuJB/RWpYdiVQ/BRQgZHBhaWl8UKclucfspeR1aj3n2dHyuQw2WOic/TNm8BNJf47gzRGHLRquKtPJQF8VN4NlLIaDIvxI6yAv/pb6skDVL4cPPsN2ZAmrfNpwNMjxgJbSQL0/qij8RBuUk+vzpz5MABSE1pdaXmpqH85RcUCByFDfM/DQu+gjWD92U0Bwyep63O1vvyYsGiskE8udABBoRVBs4lo78WJXiNpKhdPfo9jfvrbhDfL07Q+KlNU3o2GSGflyvg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3243030c-d5e5-4dcd-690a-08da3d9944d2 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9186.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 15:22:52.7302 (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: zvWFaaT5P5HPAMUdFqRrollIDFL9OAJK2aCL2rNJfbhQOgTtV9TuXIUeDlnpR6kZ7bBggg7GeLsfluybrCNFeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5672 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Some PCI Endpoint controllers integrate an eDMA (embedded DMA). eDMA can bypass the outbound memory address translation unit to access all RC memory space. Add eDMA support for pci-epf-test. Depending on HW availability, the EPF test can use either eDMA or general system DMA controllers to perform DMA. The test tries to use eDMA first and falls back to general system DMA controllers if there's no eDMA Separate dma_chan to dma_chan_tx and dma_chan_rx. Search for an eDMA channel first, then search for a memory-to-memory DMA channel. If general memory to memory channels are used, dma_chan_rx = dma_chan_tx. Add dma_addr_t dma_remote in pci_epf_test_data_transfer() because eDMA uses remote RC physical address directly. Add enum dma_transfer_direction dir in pci_epf_test_data_transfer() because eDMA chooses the correct RX/TX channel by dir. The overall steps are 1. Execute dma_request_channel() and filter function to find correct eDMA RX and TX Channel. If a channel does not exist, fallback to try to allocate general memory to memory DMA channel. 2. Execute dmaengine_slave_config() to configure remote side physical address. 3. Execute dmaengine_prep_slave_single() to create transfer descriptor. 4. Execute tx_submit(). 5. Execute dma_async_issue_pending() Signed-off-by: Frank Li Acked-by: Manivannan Sadhasivam Acked-by: Kishon Vijay Abraham I --- Change from v11 to v12: - remrite commit message - wrap code to 80 line - difference error message when apply tx/rx channel Change from v10 to v11: - rewrite commit message Change from v9 to v10: - rewrite commit message Change from v4 to v9: - none Change from v3 to v4: - reverse Xmas tree order - local -> dma_local - change error message - IS_ERR -> IS_ERR_OR_NULL - check return value of dmaengine_slave_config() Change from v1 to v2: - none drivers/pci/endpoint/functions/pci-epf-test.c | 113 ++++++++++++++++-- 1 file changed, 103 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..f232dd8eb19f0 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; }; @@ -96,6 +98,8 @@ static void pci_epf_test_dma_callback(void *param) * @dma_src: The source address of the data transfer. It can be a physical * address given by pci_epc_mem_alloc_addr or DMA mapping APIs. * @len: The size of the data transfer + * @dma_remote: remote RC physical address + * @dir: DMA transfer direction * * Function that uses dmaengine API to transfer data between PCIe EP and remote * PCIe RC. The source and destination address can be a physical address given @@ -105,12 +109,16 @@ 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 +128,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 +171,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 +198,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 rx 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 tx 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 +248,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 +264,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 +363,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 +452,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 +543,11 @@ 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);