From patchwork Mon Nov 30 13:45:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 7725151 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B8689F3CD for ; Mon, 30 Nov 2015 13:50:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47D8420495 for ; Mon, 30 Nov 2015 13:50:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 215BC20552 for ; Mon, 30 Nov 2015 13:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754039AbbK3Nqf (ORCPT ); Mon, 30 Nov 2015 08:46:35 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:37587 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754040AbbK3Nqd (ORCPT ); Mon, 30 Nov 2015 08:46:33 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id tAUDk5ph026384; Mon, 30 Nov 2015 07:46:05 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id tAUDk5Tm025625; Mon, 30 Nov 2015 07:46:05 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Mon, 30 Nov 2015 07:46:05 -0600 Received: from dlep33.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id tAUDjmOG024941; Mon, 30 Nov 2015 07:46:02 -0600 From: Peter Ujfalusi To: , , CC: , , , , , , Subject: [RFC v02 04/15] dmaengine: edma: Add support for DMA filter mapping to slave devices Date: Mon, 30 Nov 2015 15:45:34 +0200 Message-ID: <1448891145-10766-5-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448891145-10766-1-git-send-email-peter.ujfalusi@ti.com> References: <1448891145-10766-1-git-send-email-peter.ujfalusi@ti.com> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for providing device to filter_fn mapping so client drivers can switch to use the dma_request_chan() API. Signed-off-by: Peter Ujfalusi --- drivers/dma/edma.c | 24 ++++++++++++++++++++++++ include/linux/platform_data/edma.h | 5 +++++ 2 files changed, 29 insertions(+) diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 0675e268d577..386f8c9bd606 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -2098,6 +2098,8 @@ static struct dma_chan *of_edma_xlate(struct of_phandle_args *dma_spec, } #endif +static bool edma_filter_for_map(struct dma_chan *chan, void *param); + static int edma_probe(struct platform_device *pdev) { struct edma_soc_info *info = pdev->dev.platform_data; @@ -2297,6 +2299,12 @@ static int edma_probe(struct platform_device *pdev) edma_set_chmap(&ecc->slave_chans[i], ecc->dummy_slot); } + if (info->filter_map) { + ecc->dma_slave.filter_map.map = info->filter_map; + ecc->dma_slave.filter_map.mapcnt = info->filtercnt; + ecc->dma_slave.filter_map.filter_fn = edma_filter_for_map; + } + ret = dma_async_device_register(&ecc->dma_slave); if (ret) { dev_err(dev, "slave ddev registration failed (%d)\n", ret); @@ -2428,6 +2436,22 @@ bool edma_filter_fn(struct dma_chan *chan, void *param) } EXPORT_SYMBOL(edma_filter_fn); +static bool edma_filter_for_map(struct dma_chan *chan, void *param) +{ + bool match = false; + + if (chan->device->dev->driver == &edma_driver.driver) { + struct edma_chan *echan = to_edma_chan(chan); + unsigned ch_req = (unsigned)param; + if (ch_req == echan->ch_num) { + /* The channel is going to be used as HW synchronized */ + echan->hw_triggered = true; + match = true; + } + } + return match; +} + static int edma_init(void) { int ret; diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h index e2878baeb90e..117a36d63840 100644 --- a/include/linux/platform_data/edma.h +++ b/include/linux/platform_data/edma.h @@ -59,6 +59,8 @@ struct edma_rsv_info { const s16 (*rsv_slots)[2]; }; +struct dma_filter_map; + /* platform_data for EDMA driver */ struct edma_soc_info { /* @@ -76,6 +78,9 @@ struct edma_soc_info { s8 (*queue_priority_mapping)[2]; const s16 (*xbar_chans)[2]; + + struct dma_filter_map *filter_map; + int filtercnt; }; #endif