From patchwork Fri May 10 10:14:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Gong X-Patchwork-Id: 10938503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 62BE092A for ; Fri, 10 May 2019 10:14:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 500FC28C28 for ; Fri, 10 May 2019 10:14:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41CBA28C35; Fri, 10 May 2019 10:14:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C253228C28 for ; Fri, 10 May 2019 10:14:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727359AbfEJKOM (ORCPT ); Fri, 10 May 2019 06:14:12 -0400 Received: from mail-eopbgr20088.outbound.protection.outlook.com ([40.107.2.88]:5890 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727241AbfEJKOM (ORCPT ); Fri, 10 May 2019 06:14:12 -0400 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=3GUngS2hc2MDcjwsXSY7apOViN88QRoNo13FDkhjFwc=; b=dbiRoDRo4nsbNnUMwPUfzA05CCQIEDM1FVTs37n0sYveaVSZjjLNiR/8I8QynW4tiXtADnaW8fQdjId/VHDPJ0JO8rv1ENJSfGaTiXlQiL92obkcP6RI0qT54z71Zs6SFpH6VChJCWInNaXi8t2s8RpyszLb6kCYMQvp+/emxgQ= Received: from VI1PR04MB4543.eurprd04.prod.outlook.com (20.177.55.90) by VI1PR04MB3007.eurprd04.prod.outlook.com (10.170.228.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.12; Fri, 10 May 2019 10:14:08 +0000 Received: from VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::d85b:d2:194c:2b94]) by VI1PR04MB4543.eurprd04.prod.outlook.com ([fe80::d85b:d2:194c:2b94%4]) with mapi id 15.20.1878.022; Fri, 10 May 2019 10:14:08 +0000 From: Robin Gong To: "robh@kernel.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , "mark.rutland@arm.com" , "vkoul@kernel.org" , "dan.j.williams@intel.com" CC: dl-linux-imx , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "dmaengine@vger.kernel.org" , "devicetree@vger.kernel.org" , "kernel@pengutronix.de" Subject: [PATCH v1 1/6] dmaengine: fsl-edma: add dmamux_nr for next version Thread-Topic: [PATCH v1 1/6] dmaengine: fsl-edma: add dmamux_nr for next version Thread-Index: AQHVBxka2g2zuT0EHUW4nsjDLiNmZw== Date: Fri, 10 May 2019 10:14:08 +0000 Message-ID: <1557512248-8440-2-git-send-email-yibin.gong@nxp.com> References: <1557512248-8440-1-git-send-email-yibin.gong@nxp.com> In-Reply-To: <1557512248-8440-1-git-send-email-yibin.gong@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR01CA0062.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::26) To VI1PR04MB4543.eurprd04.prod.outlook.com (2603:10a6:803:6d::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yibin.gong@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 88802fee-e01f-40ef-39f8-08d6d5303d2f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR04MB3007; x-ms-traffictypediagnostic: VI1PR04MB3007: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2201; x-forefront-prvs: 0033AAD26D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(136003)(39860400002)(396003)(346002)(366004)(199004)(189003)(14454004)(2201001)(110136005)(54906003)(478600001)(2501003)(8936002)(8676002)(81166006)(81156014)(50226002)(316002)(86362001)(66066001)(25786009)(7416002)(53936002)(4326008)(36756003)(7736002)(71200400001)(2616005)(71190400001)(446003)(11346002)(66946007)(256004)(486006)(2906002)(186003)(26005)(102836004)(476003)(5660300002)(3846002)(6486002)(6116002)(76176011)(52116002)(6506007)(386003)(68736007)(305945005)(66476007)(66556008)(64756008)(66446008)(73956011)(99286004)(6436002)(6512007);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB3007;H:VI1PR04MB4543.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: cEYtqknFcTg6iv/EyGTuNRIn3i3/tYkJ5JEjO974ySgChUqPmeItcx+Qk5efdEXKWh84Hfg88lnSnJK1dyHuyUFNQhO7T8fMpMrrPMnPEIpupOCF+7ctUkHpfbV73Y2scuuI4YGk3XZbH2geQx3qHUDhgYreiovTkUbcWAevD56tC8EH5HP/+MqBNoutv+goJ+f3+OxNKoKafA7ClcFJR5YVjCgm4rCt4sYpkzf2mlhAKeuHAzVRat85cmFgpOaVMrALYcePaQJCaP49kXuw07BrsvidWnRBpkMQMlUUrCsqbNz4HIZdkAcCWnCHEuhQPkF4jXdB8yS61QcLbT5ifH/xhk7vCoDtDnBRXAUCNZQMEOGZ9zNf9g6Ztv4TlKxkQhWs8VAvkCr1BDB6kowRftQsHQbHg9yYt8oCwp+IqFk= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88802fee-e01f-40ef-39f8-08d6d5303d2f X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2019 10:14:08.3367 (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-Transport-CrossTenantHeadersStamped: VI1PR04MB3007 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Next version of edma such as edmav2 on i.mx7ulp has only one dmamux. Add dmamux_nr instead of static macro define 'DMAMUX_NR'. No any function change here. Signed-off-by: Robin Gong --- drivers/dma/fsl-edma-common.h | 1 + drivers/dma/fsl-edma.c | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/dma/fsl-edma-common.h b/drivers/dma/fsl-edma-common.h index c53f76e..21a9cfd 100644 --- a/drivers/dma/fsl-edma-common.h +++ b/drivers/dma/fsl-edma-common.h @@ -145,6 +145,7 @@ struct fsl_edma_engine { void __iomem *membase; void __iomem *muxbase[DMAMUX_NR]; struct clk *muxclk[DMAMUX_NR]; + u32 dmamux_nr; struct mutex fsl_edma_mutex; u32 n_chans; int txirq; diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c index d641ef8..7b65ef4 100644 --- a/drivers/dma/fsl-edma.c +++ b/drivers/dma/fsl-edma.c @@ -96,7 +96,7 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec, struct fsl_edma_engine *fsl_edma = ofdma->of_dma_data; struct dma_chan *chan, *_chan; struct fsl_edma_chan *fsl_chan; - unsigned long chans_per_mux = fsl_edma->n_chans / DMAMUX_NR; + unsigned long chans_per_mux = fsl_edma->n_chans / fsl_edma->dmamux_nr; if (dma_spec->args_count != 2) return NULL; @@ -206,6 +206,7 @@ static int fsl_edma_probe(struct platform_device *pdev) return -ENOMEM; fsl_edma->version = v1; + fsl_edma->dmamux_nr = DMAMUX_NR; fsl_edma->n_chans = chans; mutex_init(&fsl_edma->fsl_edma_mutex); @@ -217,7 +218,7 @@ static int fsl_edma_probe(struct platform_device *pdev) fsl_edma_setup_regs(fsl_edma); regs = &fsl_edma->regs; - for (i = 0; i < DMAMUX_NR; i++) { + for (i = 0; i < fsl_edma->dmamux_nr; i++) { char clkname[32]; res = platform_get_resource(pdev, IORESOURCE_MEM, 1 + i); @@ -295,7 +296,7 @@ static int fsl_edma_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Can't register Freescale eDMA engine. (%d)\n", ret); - fsl_disable_clocks(fsl_edma, DMAMUX_NR); + fsl_disable_clocks(fsl_edma, fsl_edma->dmamux_nr); return ret; } @@ -304,7 +305,7 @@ static int fsl_edma_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Can't register Freescale eDMA of_dma. (%d)\n", ret); dma_async_device_unregister(&fsl_edma->dma_dev); - fsl_disable_clocks(fsl_edma, DMAMUX_NR); + fsl_disable_clocks(fsl_edma, fsl_edma->dmamux_nr); return ret; } @@ -323,7 +324,7 @@ static int fsl_edma_remove(struct platform_device *pdev) fsl_edma_cleanup_vchan(&fsl_edma->dma_dev); of_dma_controller_free(np); dma_async_device_unregister(&fsl_edma->dma_dev); - fsl_disable_clocks(fsl_edma, DMAMUX_NR); + fsl_disable_clocks(fsl_edma, fsl_edma->dmamux_nr); return 0; }