From patchwork Mon Nov 7 15:41:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 9415411 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 068AB60585 for ; Mon, 7 Nov 2016 15:42:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED3B6287AB for ; Mon, 7 Nov 2016 15:42:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1BFF289F3; Mon, 7 Nov 2016 15:42:25 +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=unavailable 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 A3C11287AB for ; Mon, 7 Nov 2016 15:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932526AbcKGPmJ (ORCPT ); Mon, 7 Nov 2016 10:42:09 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:31310 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932213AbcKGPmF (ORCPT ); Mon, 7 Nov 2016 10:42:05 -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 <0OGA00B2N3M10Z80@mailout1.w1.samsung.com>; Mon, 07 Nov 2016 15:42:01 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161107154200eucas1p2c264425cfd6261515dd23e5fcd0b6ba2~EzjjG9RJ71208112081eucas1p2k; Mon, 7 Nov 2016 15:42:00 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id B1.34.02283.8C0A0285; Mon, 7 Nov 2016 15:42:00 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161107154200eucas1p27113774c72e7eb84483d5f39917de820~EzjidxyYg1208112081eucas1p2h; Mon, 7 Nov 2016 15:42:00 +0000 (GMT) X-AuditID: cbfec7f1-f79f46d0000008eb-89-5820a0c83cc2 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 27.B5.07726.6C0A0285; Mon, 7 Nov 2016 15:41:58 +0000 (GMT) Received: from [106.116.147.40] by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGA000VY3LZWD80@eusync4.samsung.com>; Mon, 07 Nov 2016 15:42:00 +0000 (GMT) Subject: Re: [PATCH RFC 1/7] dma: pl08x: Add support for the DMA slave map To: Arnd Bergmann , dmaengine@vger.kernel.org, vinod.koul@intel.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, sbkim73@samsung.com, andi.shyti@samsung.com, javier@osg.samsung.com, broonie@kernel.org, kgene@kernel.org, ckeepax@opensource.wolfsonmicro.com, ym0914@gmail.com From: Sylwester Nawrocki Message-id: <3d10d013-b18c-e10e-b596-d4d0f8b6e973@samsung.com> Date: Mon, 07 Nov 2016 16:41:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-version: 1.0 In-reply-to: <201611050026.49560.arnd@arndb.de> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHKsWRmVeSWpSXmKPExsWy7djPc7onFihEGBx7rmGx/cgzVou/k46x W0x9+ITN4t+UG+wWq6f+ZbV483YNk0X/49fMFpseX2O1mHF+H5PFxRVfmCxe9u1nsejZ8J/V gcfj969JjB47Z91l91i85yWTx6ZVnWwem5fUe7yc+JvNY0s/ULxvyypGj8+b5AI4o7hsUlJz MstSi/TtErgytm1+wlZwXbNiztJDbA2M0xS6GDk5JARMJO4uW8QEYYtJXLi3nq2LkYtDSGAp o8SEDYfYIZzPjBInrrQxwnRc6lvICpFYxijxev4tqJbnjBKP3r1iBakSFvCS6HlyHKxDRCBE 4k3PHrAiZpBRu/e1soAk2AQMJXqP9oEV8QrYSWxubwU6hIODRUBVYu1xQ5CwqECExMGNq6FK BCV+TL7HAlLCKaAvMaPJACTMLGAgMWPKYSYIW15i85q3zCCrJATusUvsX/YKrF5CQFZi0wFm iAdcJB6tO8wGYQtLvDq+hR3ClpHo7DjIBNHbD/TxmmZGCGcGo8Sd9gnQQLKWOHz8IivENj6J SdumM0Ms4JXoaBOCKPGQ+NP1ngXCdpTYeaaJBRJAfxglOg8cYpnAKD8LyT+zkDwxC8kTCxiZ VzGKpJYW56anFhvpFSfmFpfmpesl5+duYgSmqtP/jn/cwfj+hNUhRgEORiUe3hf9ChFCrIll xZW5hxglOJiVRHhT5wOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8+5ZcCVcSCA9sSQ1OzW1ILUI JsvEwSnVwFj/5EjGucBH374b9qiyrdDhm/aySLqd5evKrWfOFPxtZ9W+0n5h3hJerSSxQ48v WfcllTnfctKePVMlqznsuIhf/fyQwDftf73i47VSC9g5ilT/pJ7gfyf5su+csaPnIe7z6xhi ezU31sXJzRdn5w7eqmf6d+KydxO9/xW/7zof5qD57NIkQSWW4oxEQy3mouJEAJIF5t1RAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsVy+t/xa7rHFihEGMybqWWx/cgzVou/k46x W0x9+ITN4t+UG+wWq6f+ZbV483YNk0X/49fMFpseX2O1mHF+H5PFxRVfmCxe9u1nsejZ8J/V gcfj969JjB47Z91l91i85yWTx6ZVnWwem5fUe7yc+JvNY0s/ULxvyypGj8+b5AI4o9xsMlIT U1KLFFLzkvNTMvPSbZVCQ9x0LZQU8hJzU22VInR9Q4KUFMoSc0qBPCMDNODgHOAerKRvl+CW sW3zE7aC65oVc5YeYmtgnKbQxcjJISFgInGpbyErhC0mceHeerYuRi4OIYEljBKX+7uhnOeM Eje3tbCBVAkLeEn0PDnOCGKLCIRINPV/hyr6wyixbsVssCJmgc+MEusXCYHYbAKGEr1H+8Aa eAXsJDa3tzJ1MXJwsAioSqw9bggSFhWIkNj0dQ4LRImgxI/J91hASjgF9CVmNBmAmMwCehL3 L2pBDJeX2LzmLfMERoFZSBpmIVTNQlK1gJF5FaNIamlxbnpusaFecWJucWleul5yfu4mRmC8 bjv2c/MOxksbgw8xCnAwKvHwvuhXiBBiTSwrrsw9xCjBwawkwrtsPlCINyWxsiq1KD++qDQn tfgQoynQAxOZpUST84GpJK8k3tDE0NzS0MjYwsLcyEhJnLfkw5VwIYH0xJLU7NTUgtQimD4m Dk6pBkbu44G7apW921rXWFpvq4pQeVxx4kpsgYXA1dNuu2akKPqEFHdvVDDoOr+r++CP2gC5 amObO5e5U8zqnmwWmHFHwOWcXXmhkP48p6AE0femj0Ic/1l7RWtfeKfivSHHYfnpe03Cl0/a RWhHZXkknVxtoXPj+cJtbvn20n2+yX4aJstNE/5fVGIpzkg01GIuKk4EALU1A5XtAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161107154200eucas1p27113774c72e7eb84483d5f39917de820 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G+yCvOyEseyghOyekBtTZW5pb3IgU29mdHdhcmUgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?U3lsd2VzdGVyIE5hd3JvY2tpG1NSUE9MLUtlcm5lbCAoVFAp?= =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIFNvZnR3YXJlIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161104232724epcas3p38fcd78acf5b35aead87273edf8682693 X-RootMTR: 20161104232724epcas3p38fcd78acf5b35aead87273edf8682693 References: <1478276094-19135-1-git-send-email-s.nawrocki@samsung.com> <1478276094-19135-3-git-send-email-s.nawrocki@samsung.com> <201611050026.49560.arnd@arndb.de> 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 On 11/05/2016 12:26 AM, Arnd Bergmann wrote: > On Friday 04 November 2016, Sylwester Nawrocki wrote: >> + } else { >> + pl08x->slave.filter.map = pl08x->pd->slave_map; >> + pl08x->slave.filter.mapcnt = pl08x->pd->slave_map_len; >> } > > I think you miss the setup of the filter function here. Oops, indeed, there was little chance it could work without that part. > Filtering by string in this driver is a bit awkward, so I wonder if we > might want to go one step further here and pass the actual data (i.e. > struct pl08x_channel_data) rather than the string here. Yeah, it didn't look to me terribly elegant too. Then a change as below? --------------8<------------------- /* By default, AHB1 only. If dualmaster, from platform */ -------------->8------------------- diff --git a/arch/arm/mach-s3c64xx/pl080.c b/arch/arm/mach-s3c64xx/pl080.c index 8c88680..556ce74 100644 --- a/arch/arm/mach-s3c64xx/pl080.c +++ b/arch/arm/mach-s3c64xx/pl080.c @@ -118,22 +118,22 @@ static void pl08x_put_xfer_signal(const struct pl08x_channel_data *cd, int ch) }; static const struct dma_slave_map s3c64xx_dma0_slave_map[] = { - { "s3c6400-uart.0", "tx", (void *)"uart0_tx" }, - { "s3c6400-uart.0", "rx", (void *)"uart0_rx" }, - { "s3c6400-uart.1", "tx", (void *)"uart1_tx" }, - { "s3c6400-uart.1", "rx", (void *)"uart1_rx" }, - { "s3c6400-uart.2", "tx", (void *)"uart2_tx" }, - { "s3c6400-uart.2", "rx", (void *)"uart2_rx" }, - { "s3c6400-uart.3", "tx", (void *)"uart3_tx" }, - { "s3c6400-uart.3", "rx", (void *)"uart3_rx" }, - { "samsung-pcm.0", "tx", (void *)"pcm0_tx" }, - { "samsung-pcm.0", "rx", (void *)"pcm0_rx" }, - { "samsung-i2s.0", "tx", (void *)"i2s0_tx" }, - { "samsung-i2s.0", "rx", (void *)"i2s0_rx" }, - { "s3c6410-spi.0", "tx", (void *)"spi0_tx" }, - { "s3c6410-spi.0", "rx", (void *)"spi0_rx" }, - { "samsung-i2s.2", "tx", (void *)"i2s2_tx" }, - { "samsung-i2s.2", "rx", (void *)"i2s2_rx" }, + { "s3c6400-uart.0", "tx", (void *)&s3c64xx_dma0_info[0] }, + { "s3c6400-uart.0", "rx", (void *)&s3c64xx_dma0_info[1] }, + { "s3c6400-uart.1", "tx", (void *)&s3c64xx_dma0_info[2] }, + { "s3c6400-uart.1", "rx", (void *)&s3c64xx_dma0_info[3] }, + { "s3c6400-uart.2", "tx", (void *)&s3c64xx_dma0_info[4] }, + { "s3c6400-uart.2", "rx", (void *)&s3c64xx_dma0_info[5] }, + { "s3c6400-uart.3", "tx", (void *)&s3c64xx_dma0_info[6] }, + { "s3c6400-uart.3", "rx", (void *)&s3c64xx_dma0_info[7] }, + { "samsung-pcm.0", "tx", (void *)&s3c64xx_dma0_info[8] }, + { "samsung-pcm.0", "rx", (void *)&s3c64xx_dma0_info[9] }, + { "samsung-i2s.0", "tx", (void *)&s3c64xx_dma0_info[10] }, + { "samsung-i2s.0", "rx", (void *)&s3c64xx_dma0_info[11] }, + { "s3c6410-spi.0", "tx", (void *)&s3c64xx_dma0_info[12] }, + { "s3c6410-spi.0", "rx", (void *)&s3c64xx_dma0_info[13] }, + { "samsung-i2s.2", "tx", (void *)&s3c64xx_dma0_info[14] }, + { "samsung-i2s.2", "rx", (void *)&s3c64xx_dma0_info[15] }, }; @@ -229,12 +229,12 @@ static AMBA_AHB_DEVICE(s3c64xx_dma0, "dma-pl080s.0", 0, }; static const struct dma_slave_map s3c64xx_dma1_slave_map[] = { - { "samsung-pcm.1", "tx", (void *)"pcm1_tx" }, - { "samsung-pcm.1", "rx", (void *)"pcm1_rx" }, - { "samsung-i2s.1", "tx", (void *)"i2s1_tx" }, - { "samsung-i2s.1", "rx", (void *)"i2s1_rx" }, - { "s3c6410-spi.1", "tx", (void *)"spi1_tx" }, - { "s3c6410-spi.1", "rx", (void *)"spi1_rx" }, + { "samsung-pcm.1", "tx", (void *)&s3c64xx_dma1_info[0] }, + { "samsung-pcm.1", "rx", (void *)&s3c64xx_dma1_info[1] }, + { "samsung-i2s.1", "tx", (void *)&s3c64xx_dma1_info[2] }, + { "samsung-i2s.1", "rx", (void *)&s3c64xx_dma1_info[3] }, + { "s3c6410-spi.1", "tx", (void *)&s3c64xx_dma1_info[4] }, + { "s3c6410-spi.1", "rx", (void *)&s3c64xx_dma1_info[5] }, }; diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index d5c75c8..0d1eb2e 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -1793,6 +1793,23 @@ bool pl08x_filter_id(struct dma_chan *chan, void *chan_id) } EXPORT_SYMBOL_GPL(pl08x_filter_id); +static bool pl08x_filter_fn(struct dma_chan *chan, void *chan_id) +{ + struct pl08x_dma_chan *plchan; + + /* Reject channels for devices not bound to this driver */ + if (chan->device->dev->driver != &pl08x_amba_driver.drv) + return false; + + plchan = to_pl08x_chan(chan); + + /* Check that the channel is not taken! */ + if (plchan->cd == chan_id) + return true; + + return false; +} + /* * Just check that the device is there and active * TODO: turn this bit on/off depending on the number of physical channels @@ -2310,6 +2327,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) } else { pl08x->slave.filter.map = pl08x->pd->slave_map; pl08x->slave.filter.mapcnt = pl08x->pd->slave_map_len; + pl08x->slave.filter.fn = pl08x_filter_fn; }