From patchwork Tue Jan 24 09:27:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 92305 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1624095qgi; Tue, 24 Jan 2017 01:28:02 -0800 (PST) X-Received: by 10.99.170.70 with SMTP id x6mr37702585pgo.14.1485250082743; Tue, 24 Jan 2017 01:28:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si18461620plj.322.2017.01.24.01.28.02; Tue, 24 Jan 2017 01:28:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750772AbdAXJ2B (ORCPT + 4 others); Tue, 24 Jan 2017 04:28:01 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:18605 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751AbdAXJ15 (ORCPT ); Tue, 24 Jan 2017 04:27:57 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OKA005212AHRJ80@mailout4.w1.samsung.com>; Tue, 24 Jan 2017 09:27:53 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170124092752eucas1p2b50295fc4df3125f1dbabd5e62c56cf5~cqxJize1E2546525465eucas1p2C; Tue, 24 Jan 2017 09:27:52 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 01.F4.16908.A1E17885; Tue, 24 Jan 2017 09:27:54 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170124092751eucas1p2807f068bdbcd695d0bec355e6b509d6c~cqxI6aorI2527025270eucas1p2W; Tue, 24 Jan 2017 09:27:51 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-9f-58871e1a67e0 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F6.D4.10233.41E17885; Tue, 24 Jan 2017 09:27:48 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OKA00L222A11G70@eusync1.samsung.com>; Tue, 24 Jan 2017 09:27:51 +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 v6 3/4] dmaengine: pl330: Store pointer to slave device Date: Tue, 24 Jan 2017 10:27:34 +0100 Message-id: <1485250055-22137-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1485250055-22137-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsWy7djP87pScu0RBk9PW1tsnLGe1WL11L+s FpPuT2CxOH9+A7vFpsfXWC0+9x5htJhxfh+Txdojd9ktzpy+xGpxfG24xcu+/SwO3B6L97xk 8ti0qpPN4861PWwem5fUe2y52s7i0bdlFaPH501yAexRXD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CAksYZR4ufcxE4TTxCQxr7eRDaSKTcBQouttF5gt ItDEKHHwlwdIEbPAciaJLdMvsHcxcnAIC7hLrNyoDVLDIqAqsWpNIzuIzSvgITFx02pmiG1y EiePTWYFsTkFPCW2Pm8Cu0IIqGbNkoNsExh5FzAyrGIUSS0tzk3PLTbSK07MLS7NS9dLzs/d xAiMgW3Hfm7Zwdj1LvgQowAHoxIPb4FUW4QQa2JZcWXuIUYJDmYlEd4v4u0RQrwpiZVVqUX5 8UWlOanFhxhNgY6ayCwlmpwPjM+8knhDE0NzS0MjYwsLcyMjJXHeqR+uhAsJpCeWpGanphak FsH0MXFwSjUwbl/lKNGcpKiTvXDKf6k9s+U/2H7U7W1yneLz8muDt/nc5ZJBZcccM8r8+msv 6m9UTpimvbbgHI95ZXrP4QCXyaf2qF5Pa/m9OMDE0S+9aXvcmncCs2rkuzZePrLobsqCvzLc 7oGpny5vcEhofsHzs24Lc2FbQ2lCTPs8qVeLgvKffZy9leuUEktxRqKhFnNRcSIAzKOOzpcC AAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170124092751eucas1p2807f068bdbcd695d0bec355e6b509d6c X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170124092751eucas1p2807f068bdbcd695d0bec355e6b509d6c X-RootMTR: 20170124092751eucas1p2807f068bdbcd695d0bec355e6b509d6c References: <1485250055-22137-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 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 Acked-by: Arnd Bergmann --- drivers/dma/pl330.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }