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: 9534617 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 C68446046A for ; Tue, 24 Jan 2017 09:28:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA41920373 for ; Tue, 24 Jan 2017 09:28:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEF1E26907; Tue, 24 Jan 2017 09:28: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 5749F20373 for ; Tue, 24 Jan 2017 09:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750779AbdAXJ2B (ORCPT ); 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 FpPuT2CxO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I m66FkkJeYm6qrVKErm9IkJJCWWJOKZBnZIAGHJwD3IOV9O0S3DI6224xFbzhqjj0XaCB8S9H FyMnh4SAicTuyX8YIWwxiQv31rN1MXJxCAksYZR4ufcxE4TTxCQxr7eRDaSKTcBQouttF5gt 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?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: 20170124092751eucas1p2807f068bdbcd695d0bec355e6b509d6c X-RootMTR: 20170124092751eucas1p2807f068bdbcd695d0bec355e6b509d6c References: <1485250055-22137-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 Acked-by: Arnd Bergmann Reviewed-by: Ulf Hansson --- 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); }