From patchwork Mon Jan 9 14:03:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9504851 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 32F3260762 for ; Mon, 9 Jan 2017 14:05:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25675284E4 for ; Mon, 9 Jan 2017 14:05:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A211284EA; Mon, 9 Jan 2017 14:05:06 +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 1798B284E6 for ; Mon, 9 Jan 2017 14:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033337AbdAIOEu (ORCPT ); Mon, 9 Jan 2017 09:04:50 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:44615 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S942377AbdAIODb (ORCPT ); Mon, 9 Jan 2017 09:03:31 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJI002JUN1RG170@mailout4.w1.samsung.com>; Mon, 09 Jan 2017 14:03:27 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170109140327eucas1p16216bbd37cd1bb3f189d878fc47de90a~YH2el9tog2901929019eucas1p1c; Mon, 9 Jan 2017 14:03:27 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 10.06.09557.E2893785; Mon, 9 Jan 2017 14:03:26 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170109140326eucas1p29d3e54da58845589e2adf70db854d996~YH2d8qMKJ1318513185eucas1p2X; Mon, 9 Jan 2017 14:03:26 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-6e-5873982e7527 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4F.2D.06687.06893785; Mon, 9 Jan 2017 14:04:16 +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 <0OJI005JBN1K8V20@eusync3.samsung.com>; Mon, 09 Jan 2017 14:03:26 +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 v2 3/4] dmaengine: pl330: Store pointer to slave device Date: Mon, 09 Jan 2017 15:03:17 +0100 Message-id: <1483970598-6191-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1483970598-6191-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsWy7djP87p6M4ojDL5OtbHYOGM9q8XqqX9Z LSbdn8Bicf78Bn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KF1Lzk/JTMvHRbpdAQ N10LJYW8xNxUW6UIXd+QICWFssScUiDPyAANODgHuAcr6dsluGW0nDrGWNDNVbH6yhSWBsYV HF2MnBwSAiYS+35PZYSwxSQu3FvP1sXIxSEksIRRovP5RVYIp4lJ4nLrMSaQKjYBQ4mut11s ILaIQBOjxMFfHiBFzALLmSS2TL/A3sXIwSEs4C6x51EoSA2LgKpE3+UXzCA2L1D4+tk37BDb 5CROHpvMCmJzCnhIfF4xkwXEFgKq6Xj7nH0CI+8CRoZVjCKppcW56bnFhnrFibnFpXnpesn5 uZsYgVGw7djPzTsYL20MPsQowMGoxMO7YVJxhBBrYllxZe4hRgkOZiUR3htTgEK8KYmVValF +fFFpTmpxYcYTYGOmsgsJZqcD4zQvJJ4QxNDc0tDI2MLC3MjIyVx3pIPV8KFBNITS1KzU1ML Uotg+pg4OKUaGGUu7kiKbefaMP3lu/z1Br8WHT/W9uv04mmLJS1XpeyJ9o3c9rG5vcPl8xTj pzME5mxjnsqS6XT9aERo+7nOfSuLk+YcCNHUtvPXaeE6u+eeUNvPljXPV60NEjs0N5Qxffni Jdo7nUW0dJh4IzlZj+xs/r77T1fOLNMoHs5/f5a80GjTTan8s1CJpTgj0VCLuag4EQAti/30 mAIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170109140326eucas1p29d3e54da58845589e2adf70db854d996 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: 20170109140326eucas1p29d3e54da58845589e2adf70db854d996 X-RootMTR: 20170109140326eucas1p29d3e54da58845589e2adf70db854d996 References: <1483970598-6191-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 3c80e71271a2..9c72f535739c 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 { @@ -2113,6 +2114,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); }