From patchwork Tue Jan 17 12:48:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9520803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83A5F60447 for ; Tue, 17 Jan 2017 12:50:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 775BE28547 for ; Tue, 17 Jan 2017 12:50:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C3FB2854A; Tue, 17 Jan 2017 12:50:02 +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=-6.9 required=2.0 tests=BAYES_00,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 0D92128549 for ; Tue, 17 Jan 2017 12:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750952AbdAQMuB (ORCPT ); Tue, 17 Jan 2017 07:50:01 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:10332 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbdAQMtx (ORCPT ); Tue, 17 Jan 2017 07:49:53 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJX0052WCYC0E70@mailout1.w1.samsung.com>; Tue, 17 Jan 2017 12:49:24 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170117124923eucas1p2f4b8583e21751eee4d99635c747c028f~akAGLkc1K3130731307eucas1p2O; Tue, 17 Jan 2017 12:49:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id FD.A7.16908.5D21E785; Tue, 17 Jan 2017 12:49:25 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170117124922eucas1p1d4037d80229e55007169cf85c19e5eec~akAFhktQb1364913649eucas1p1s; Tue, 17 Jan 2017 12:49:22 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-00-587e12d5f7e0 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4F.75.10233.DC21E785; Tue, 17 Jan 2017 12:49:17 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OJX00BVZCY56440@eusync2.samsung.com>; Tue, 17 Jan 2017 12:49:22 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: Marek Szyprowski , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Vinod Koul , Ulf Hansson , "Rafael J. Wysocki" , Inki Dae Subject: [PATCH v5 3/4] dmaengine: pl330: Store pointer to slave device Date: Tue, 17 Jan 2017 13:48:57 +0100 Message-id: <1484657338-26338-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1484657338-26338-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsWy7djPc7pXheoiDF5NNbDYOGM9q8XqqX9Z LSbdn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TMvHRbpdAQ N10LJYW8xNxUW6UIXd+QICWFssScUiDPyAANODgHuAcr6dsluGWsmXGFtWAHV0XzgZ2MDYzn OLoYOTkkBEwkNl2dxQZhi0lcuLceyObiEBJYwihxcd9RVginiUni0O3/LCBVbAKGEl1vu8A6 RASaGCUO/vIAKWIWWM4ksWX6BXaQhLCAu8T322fBbBYBVYkrj3+wgti8Ah4Sh44vZ4VYJydx 8thkMJtTwFOi9+Y2RhBbCKhm4cbV7BMYeRcwMqxiFEktLc5Nzy020itOzC0uzUvXS87P3cQI jINtx35u2cHY9S74EKMAB6MSD6/T7ZoIIdbEsuLK3EOMEhzMSiK8cwXqIoR4UxIrq1KL8uOL SnNSiw8xmgIdNZFZSjQ5HxijeSXxhiaG5paGRsYWFuZGRkrivFM/XAkXEkhPLEnNTk0tSC2C 6WPi4JRqYJSKOnrtS/7proe7PV8/fXe3zjBv1/KbIRdXcUtfizn++EWzoYeziOuCP5uKtlhz TU2IXsC3yVo5vlwq3kJykYS+v7Jnsz777GeXlzs/eHMnXXTyh9zoKE/O+gSP00z9ZzTuZ+zN n8hrPeVjsCKz9yOlexfK2/bOWC7a1J9bw/3a+sJK36rs80osxRmJhlrMRcWJAF/atESZAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170117124922eucas1p1d4037d80229e55007169cf85c19e5eec X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170117124922eucas1p1d4037d80229e55007169cf85c19e5eec X-RootMTR: 20170117124922eucas1p1d4037d80229e55007169cf85c19e5eec References: <1484657338-26338-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Store the pointer to slave device, which requested our channel. It will be later used to implement runtime PM of PL330 DMA controller. Although DMA channels might be requested many times, each DMA peripheral channel is physically dedicated only for specific hardware, so there should be only one slave device for each channel. Signed-off-by: Marek Szyprowski Acked-by: Arnd Bergmann Reviewed-by: Krzysztof Kozlowski --- drivers/dma/pl330.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index b6b2cc912380..c77a3494659c 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -450,6 +450,7 @@ struct dma_pl330_chan { /* for runtime pm tracking */ bool active; + struct device *slave; }; struct pl330_dmac { @@ -2093,6 +2094,14 @@ static struct dma_chan *of_dma_pl330_xlate(struct of_phandle_args *dma_spec, if (chan_id >= pl330->num_peripherals) return NULL; + if (!pl330->peripherals[chan_id].slave) { + pl330->peripherals[chan_id].slave = slave; + } else if (pl330->peripherals[chan_id].slave != slave) { + dev_err(pl330->ddma.dev, + "Can't use same channel with multiple slave devices!\n"); + return NULL; + } + return dma_get_slave_channel(&pl330->peripherals[chan_id].chan); }