From patchwork Fri Jan 13 07:26:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9514729 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 9806E60762 for ; Fri, 13 Jan 2017 07:27:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 918CD2866E for ; Fri, 13 Jan 2017 07:27:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 866EF286C3; Fri, 13 Jan 2017 07:27:05 +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 2B9B82866E for ; Fri, 13 Jan 2017 07:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751168AbdAMH1E (ORCPT ); Fri, 13 Jan 2017 02:27:04 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:55920 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbdAMH05 (ORCPT ); Fri, 13 Jan 2017 02:26:57 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJP0080JJCUIC30@mailout3.w1.samsung.com>; Fri, 13 Jan 2017 07:26:54 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170113072653eucas1p2eba2cf600964476d9ec5296f87f4cccf~ZRBYFNyMG0035400354eucas1p2V; Fri, 13 Jan 2017 07:26:53 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id BB.B5.28517.D3188785; Fri, 13 Jan 2017 07:26:53 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170113072652eucas1p21a2e7300622470d018bfa0f327d16132~ZRBXQzCY-3083730837eucas1p2i; Fri, 13 Jan 2017 07:26:52 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-c2-5878813d0c53 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 03.90.06687.27188785; Fri, 13 Jan 2017 07:27:46 +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 <0OJP00H0WJCM0400@eusync3.samsung.com>; Fri, 13 Jan 2017 07:26:52 +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 v4 3/4] dmaengine: pl330: Store pointer to slave device Date: Fri, 13 Jan 2017 08:26:39 +0100 Message-id: <1484292400-29730-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1484292400-29730-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWRa0hTYRjHe3fOzo7TI4cp+TBNcOiHkkxF4lAWRYXHbxaGlpCtdryUm7Y5 0yBy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vHRbpdAQ N10LJYW8xNxUW6UIXd+QICWFssScUiDPyAANODgHuAcr6dsluGV0HOliKjjMVdHZ1c3cwHiT o4uRk0NCwETiwY4L7BC2mMSFe+vZuhi5OIQEljBKLOo9ywLhNDFJLD41hxGkik3AUKLrbRcb iC0i0MQocfCXB0gRs8ByJokt0yFGCQu4S9w99ZMVxGYRUJWYdOQHUJyDg1fAQ6JzER/ENjmJ k8cmg5VwCnhKzD7zFswWAirp+PaLdQIj7wJGhlWMIqmlxbnpucWGesWJucWleel6yfm5mxiB UbDt2M/NOxgvbQw+xCjAwajEwzvhdnmEEGtiWXFl7iFGCQ5mJRHeH7UVEUK8KYmVValF+fFF pTmpxYcYTYFumsgsJZqcD4zQvJJ4QxNDc0tDI2MLC3MjIyVx3pIPV8KFBNITS1KzU1MLUotg +pg4OKUaGIu6vI/6mHy4uvNFvXFoeFqZQ9+U9L8CMrINfQwl/bnGe7j6w1/MuhesxMTZK7q+ es/61kWGRkqiv5n1JtjPrk9Ldil6FLaceY8TR6pT5iwR9h8NFy4YfI/+arKiVcEhXqhexnxN Q99rwfbmtKU6M/Pfbnsfx/vyl9/ibp7jcdsDTk/eHZykxFKckWioxVxUnAgAJ+nFepgCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170113072652eucas1p21a2e7300622470d018bfa0f327d16132 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: 20170113072652eucas1p21a2e7300622470d018bfa0f327d16132 X-RootMTR: 20170113072652eucas1p21a2e7300622470d018bfa0f327d16132 References: <1484292400-29730-1-git-send-email-m.szyprowski@samsung.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@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 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); }