From patchwork Thu Oct 18 13:26:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1610801 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id ACAE23FC1A for ; Thu, 18 Oct 2012 13:29:54 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q9IDRssE009870; Thu, 18 Oct 2012 08:27:54 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q9IDRsA3029674; Thu, 18 Oct 2012 08:27:54 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Thu, 18 Oct 2012 08:27:53 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q9IDRreK000638; Thu, 18 Oct 2012 08:27:53 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id BC8D880626; Thu, 18 Oct 2012 08:27:53 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 5A5A580628 for ; Thu, 18 Oct 2012 08:25:53 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id q9IDPrVE017594 for ; Thu, 18 Oct 2012 08:25:53 -0500 (CDT) Received: from psmtp.com (na3sys009amx234.postini.com [74.125.149.118]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id q9IDPqEI016875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 18 Oct 2012 08:25:52 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]) (using TLSv1) by na3sys009amx234.postini.com ([74.125.148.10]) with SMTP; Thu, 18 Oct 2012 06:25:52 PDT Received: by mail-ie0-f173.google.com with SMTP id 17so13404569iea.4 for ; Thu, 18 Oct 2012 06:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=fEeTx5m2at8pX3C/TtjgD+p8gQjniMdPcXwStFuM3oU=; b=r7Jl5TQZZPHRh+AqsnA4AOG4lJR/NuVWRVaEJ4TS3puZlmefBPdI3VN9QX3LFJ2ufy /ZFEHXUnNlmrkwALPRZ6Djvo/KPrgP99frPleeYGZCZNhyak/k86NrzhW7XkDkZ2qtCc 8Jko0IYGvUCL16UulpWid4nN0Ba7Rx6IF/O5nhukFXvP/2GgIzc4naNSpgTqJ6wS7lvw HIj9+E0xfib0x2LBDAAIvn7kiGqKDd86dNCdHLaKBdwj1nODvezPAGWybFYRM0lxaWd/ UzAlMx1qyAi0gC8EeXI4Ngj/Iy4StLOwN0aq3/vAU8SttTCkLLqyGwjpVVA+qpPNq4pl rpSg== Received: by 10.43.92.71 with SMTP id bp7mr17032735icc.29.1350566751897; Thu, 18 Oct 2012 06:25:51 -0700 (PDT) Received: from beef.ohporter.com (cpe-24-166-64-7.neo.res.rr.com. [24.166.64.7]) by mx.google.com with ESMTPS id x7sm14244186igk.8.2012.10.18.06.25.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 06:25:51 -0700 (PDT) From: Matt Porter To: Tony Lindgren , Sekhar Nori , Grant Likely , Mark Brown , Benoit Cousson , Russell King , Vinod Koul , Rob Landley , Chris Ball Subject: [RFC PATCH v3 05/16] ARM: edma: add AM33XX crossbar event support Date: Thu, 18 Oct 2012 09:26:44 -0400 Message-ID: <1350566815-409-6-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350566815-409-1-git-send-email-mporter@ti.com> References: <1350566815-409-1-git-send-email-mporter@ti.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 1 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.0050) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] CC: Linux DaVinci Kernel List , Arnd Bergmann , Linux Documentation List , Devicetree Discuss , Linux MMC List , Linux Kernel Mailing List , Rob Herring , Dan Williams , Linux SPI Devel List , Linux OMAP List , Linux ARM Kernel List X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com Adds support for the per-EDMA channel event mux. This is required for any peripherals using DMA crossbar mapped events. Signed-off-by: Matt Porter --- arch/arm/common/edma.c | 63 +++++++++++++++++++++++++++++++++++- include/linux/platform_data/edma.h | 1 + 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 6d2a590..b761b7a 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -1425,6 +1425,53 @@ static int edma_of_read_u32_to_s16_array(const struct device_node *np, return 0; } +static int edma_xbar_event_map(struct device *dev, + struct device_node *node, + struct edma_soc_info *pdata, int len) +{ + int ret = 0; + int i; + struct resource res; + void *xbar; + s16 (*xbar_chans)[2]; + u32 shift, offset, mux; + + xbar_chans = devm_kzalloc(dev, + len/sizeof(s16) + 2*sizeof(s16), + GFP_KERNEL); + if (!xbar_chans) + return -ENOMEM; + + ret = of_address_to_resource(node, 1, &res); + if (IS_ERR_VALUE(ret)) + return -EIO; + + xbar = devm_ioremap(dev, res.start, resource_size(&res)); + if (!xbar) + return -EIO; + + ret = edma_of_read_u32_to_s16_array(node, + "ti,edma-xbar-event-map", + (s16 *)xbar_chans, + len/sizeof(u32)); + if (IS_ERR_VALUE(ret)) + return -EIO; + + for (i = 0; xbar_chans[i][0] != -1; i++) { + shift = (xbar_chans[i][1] % 4) * 8; + offset = xbar_chans[i][1] >> 2; + offset <<= 2; + mux = __raw_readl((void *)((u32)xbar + offset)); + mux &= (~(0xff << shift)); + mux |= (xbar_chans[i][0] << shift); + __raw_writel(mux, (void *)((u32)xbar + offset)); + } + + pdata->xbar_chans = xbar_chans; + + return 0; +} + static int edma_of_parse_dt(struct device *dev, struct device_node *node, struct edma_soc_info *pdata) @@ -1453,7 +1500,6 @@ static int edma_of_parse_dt(struct device *dev, pdata->n_slot = value; pdata->n_cc = 1; - /* This is unused */ pdata->n_tc = 3; rsv_info = @@ -1538,6 +1584,10 @@ static int edma_of_parse_dt(struct device *dev, return ret; pdata->default_queue = value; + prop = of_find_property(node, "ti,edma-xbar-event-map", &sz); + if (prop) + ret = edma_xbar_event_map(dev, node, pdata, sz); + return ret; } @@ -1554,6 +1604,7 @@ static int __init edma_probe(struct platform_device *pdev) int status = -1; s16 (*rsv_chans)[2]; s16 (*rsv_slots)[2]; + s16 (*xbar_chans)[2]; int irq[EDMA_MAX_CC] = {0, 0}; int err_irq[EDMA_MAX_CC] = {0, 0}; struct resource *r[EDMA_MAX_CC] = {NULL, NULL}; @@ -1678,6 +1729,16 @@ static int __init edma_probe(struct platform_device *pdev) } } + /* Clear the xbar mapped channels in unused list */ + xbar_chans = info[j]->xbar_chans; + if (xbar_chans) { + for (i = 0; xbar_chans[i][1] != -1; i++) { + off = xbar_chans[i][1]; + clear_bits(off, 1, + edma_cc[j]->edma_unused); + } + } + if (node) irq[j] = irq_of_parse_and_map(node, 0); else { diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h index b20b586..888a3c6 100644 --- a/include/linux/platform_data/edma.h +++ b/include/linux/platform_data/edma.h @@ -191,6 +191,7 @@ struct edma_soc_info { /* Resource reservation for other cores */ struct edma_rsv_info *rsv; + s16 (*xbar_chans)[2]; s8 (*queue_tc_mapping)[2]; s8 (*queue_priority_mapping)[2]; };