From patchwork Tue Jan 10 07:12:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9506583 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 AEE3F60762 for ; Tue, 10 Jan 2017 07:14:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A225F2844A for ; Tue, 10 Jan 2017 07:14:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 936562851D; Tue, 10 Jan 2017 07:14:00 +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 327C928537 for ; Tue, 10 Jan 2017 07:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756370AbdAJHN6 (ORCPT ); Tue, 10 Jan 2017 02:13:58 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:45242 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754580AbdAJHNt (ORCPT ); Tue, 10 Jan 2017 02:13:49 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJJ00KIRYQXG040@mailout1.w1.samsung.com>; Tue, 10 Jan 2017 07:13:45 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170110071344eucas1p20bd0fbf9ac7926c1261222b6686f4e60~YV6CiEx251013110131eucas1p2t; Tue, 10 Jan 2017 07:13:44 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id FE.BD.30614.8A984785; Tue, 10 Jan 2017 07:13:44 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170110071343eucas1p1b3f8c5122f2d2259e95353a98fdd9484~YV6B1ktxH2439124391eucas1p1T; Tue, 10 Jan 2017 07:13:43 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-4c-587489a86c5f Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 45.92.06687.AD984785; Tue, 10 Jan 2017 07:14:34 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OJJ00L15YQQ2V50@eusync3.samsung.com>; Tue, 10 Jan 2017 07:13:43 +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 v3 3/4] dmaengine: pl330: Store pointer to slave device Date: Tue, 10 Jan 2017 08:12:38 +0100 Message-id: <1484032359-8311-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1484032359-8311-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsWy7djPc7orOksiDNYfEbfYOGM9q8XqqX9Z LSbdn8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WSgp5ibmptkoRur4hQUoKZYk5pUCekQEacHAOcA9W0rdLcMvYuHs/a8FhrorbEw4wNjDe 5Ohi5OSQEDCR2NZ+jh3CFpO4cG89WxcjF4eQwBJGicdTVzJBOE1MEjM3b2cBqWITMJToetvF BmKLCDQxShz85QFSxCywnEliy/QLYKOEBdwl9j+cwQhiswioSmxq+wrWwAsUb3+2nRFinZzE yWOTWUFsTgEPiXffjoDVCAHVzPr1m20CI+8CRoZVjCKppcW56bnFhnrFibnFpXnpesn5uZsY gXGw7djPzTsYL20MPsQowMGoxMO7YVJxhBBrYllxZe4hRgkOZiURXoHWkggh3pTEyqrUovz4 otKc1OJDjKZAR01klhJNzgfGaF5JvKGJobmloZGxhYW5kZGSOG/JhyvhQgLpiSWp2ampBalF MH1MHJxSDYwuP8ViYnk2SH3L7Dqrv62j13apctPNxTfLyl//PHQyxX3Lgpfm6gxNRTkKDQlG t+ZXV/rwrWtjrzA+eeTN1F0iHxJL1Gc8e3pDVWL/+p6/3K9MJNe++Lf9uM2Uzxn9EtOXPf4d 3B96aUZwyB7z2istBSKRwfIS81/cu6z87YzRHA8r5Tc75x1RYinOSDTUYi4qTgQAa8hvw5kC AAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170110071343eucas1p1b3f8c5122f2d2259e95353a98fdd9484 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 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: 20170110071343eucas1p1b3f8c5122f2d2259e95353a98fdd9484 X-RootMTR: 20170110071343eucas1p1b3f8c5122f2d2259e95353a98fdd9484 References: <1484032359-8311-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 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 d7670e7220e4..4489d4d13012 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 { @@ -2101,6 +2102,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); }