From patchwork Fri Jun 5 15:34: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: 6556151 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 53B9AC0433 for ; Fri, 5 Jun 2015 15:35:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68F0E2065B for ; Fri, 5 Jun 2015 15:35:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C2B220687 for ; Fri, 5 Jun 2015 15:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423528AbbFEPfI (ORCPT ); Fri, 5 Jun 2015 11:35:08 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:50417 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422774AbbFEPfC (ORCPT ); Fri, 5 Jun 2015 11:35:02 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t55FYmXC029928; Fri, 5 Jun 2015 10:34:48 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t55FYmT0023174; Fri, 5 Jun 2015 10:34:48 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Fri, 5 Jun 2015 10:34:48 -0500 Received: from dflp32.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t55FYZ3w026256; Fri, 5 Jun 2015 10:34:45 -0500 From: Peter Ujfalusi To: , Tony Lindgren , , , CC: , , , , Subject: [PATCH 3/3] dmaengine: ti-dma-crossbar: Add support for eDMA xbar Date: Fri, 5 Jun 2015 18:34:34 +0300 Message-ID: <1433518474-26628-4-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1433518474-26628-1-git-send-email-peter.ujfalusi@ti.com> References: <1433518474-26628-1-git-send-email-peter.ujfalusi@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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 From: Misael Lopez Cruz eDMA crossbar works exactly the same way as sDMA, but sDMA requires an offset of 1, while no offset is needed for eDMA. Signed-off-by: Misael Lopez Cruz Signed-off-by: Peter Ujfalusi --- .../devicetree/bindings/dma/ti-dma-crossbar.txt | 1 + drivers/dma/ti-dma-crossbar.c | 30 +++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt b/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt index 76a10d0724b7..da46dddc78ef 100644 --- a/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt +++ b/Documentation/devicetree/bindings/dma/ti-dma-crossbar.txt @@ -2,6 +2,7 @@ Texas Instruments DMA Crossbar (DMA request router) Required properties: - compatible: "ti,dra7-sdma-crossbar" for DRA7xx sDMA crossbar + "ti,dra7-edma-crossbar" for DRA7xx eDMA crossbar - reg: Memory map for accessing module - #dma-cells: Should be set to <1>. Clients should use the crossbar request number (input) diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c index 887cfe676b6d..c21690ed954f 100644 --- a/drivers/dma/ti-dma-crossbar.c +++ b/drivers/dma/ti-dma-crossbar.c @@ -20,6 +20,9 @@ #define TI_XBAR_OUTPUTS 127 #define TI_XBAR_INPUTS 256 +#define TI_XBAR_EDMA_OFFSET 0 +#define TI_XBAR_SDMA_OFFSET 1 + struct ti_dma_xbar_data { void __iomem *iomem; @@ -29,6 +32,7 @@ struct ti_dma_xbar_data { u16 safe_val; /* Value to rest the crossbar lines */ u32 xbar_requests; /* number of DMA requests connected to XBAR */ u32 dma_requests; /* number of DMA requests forwarded to DMA */ + u32 dma_offset; }; struct ti_dma_xbar_map { @@ -84,8 +88,7 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec, GFP_KERNEL); map->xbar_in = (u16)dma_spec->args[0]; - /* The DMA request is 1 based in sDMA */ - dma_spec->args[0] = map->xbar_out + 1; + dma_spec->args[0] = map->xbar_out + xbar->dma_offset; dev_dbg(&pdev->dev, "Mapping XBAR%u to DMA%d\n", map->xbar_in, map->xbar_out); @@ -95,9 +98,22 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec, return map; } +static const struct of_device_id ti_dma_xbar_match[] = { + { + .compatible = "ti,dra7-sdma-crossbar", + .data = (void *)TI_XBAR_SDMA_OFFSET, + }, + { + .compatible = "ti,dra7-edma-crossbar", + .data = (void *)TI_XBAR_EDMA_OFFSET, + }, + {}, +}; + static int ti_dma_xbar_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; + const struct of_device_id *match; struct device_node *dma_node; struct ti_dma_xbar_data *xbar; struct resource *res; @@ -108,6 +124,10 @@ static int ti_dma_xbar_probe(struct platform_device *pdev) if (!node) return -ENODEV; + match = of_match_device(ti_dma_xbar_match, &pdev->dev); + if (!match) + return -EINVAL; + xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL); if (!xbar) return -ENOMEM; @@ -151,6 +171,7 @@ static int ti_dma_xbar_probe(struct platform_device *pdev) xbar->dmarouter.dev = &pdev->dev; xbar->dmarouter.route_free = ti_dma_xbar_free; + xbar->dma_offset = (u32)match->data; platform_set_drvdata(pdev, xbar); @@ -169,11 +190,6 @@ static int ti_dma_xbar_probe(struct platform_device *pdev) return ret; } -static const struct of_device_id ti_dma_xbar_match[] = { - { .compatible = "ti,dra7-sdma-crossbar" }, - {}, -}; - static struct platform_driver ti_dma_xbar_driver = { .driver = { .name = "ti-dma-crossbar",