Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752016Ab2J1LMh (ORCPT ); Sun, 28 Oct 2012 07:12:37 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:56732 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751644Ab2J1LMf (ORCPT ); Sun, 28 Oct 2012 07:12:35 -0400 Message-ID: <508D12DC.8010400@ti.com> Date: Sun, 28 Oct 2012 16:41:24 +0530 From: Sekhar Nori User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Matt Porter CC: Tony Lindgren , Grant Likely , Mark Brown , Benoit Cousson , Russell King , Vinod Koul , Rob Landley , Chris Ball , Devicetree Discuss , Linux OMAP List , Linux ARM Kernel List , Linux DaVinci Kernel List , Linux Kernel Mailing List , Linux Documentation List , Linux MMC List , Linux SPI Devel List , Arnd Bergmann , Dan Williams , Rob Herring Subject: Re: [RFC PATCH v3 05/16] ARM: edma: add AM33XX crossbar event support References: <1350566815-409-1-git-send-email-mporter@ti.com> <1350566815-409-6-git-send-email-mporter@ti.com> In-Reply-To: <1350566815-409-6-git-send-email-mporter@ti.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2638 Lines: 93 On 10/18/2012 6:56 PM, Matt Porter wrote: > 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; -ENOMEM is more appropiate for ioremap failures. > + > + 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)); Dont use __raw* variants of io accessors. There will be ordering issues on ARMv7. > + mux &= (~(0xff << shift)); > + mux |= (xbar_chans[i][0] << shift); Unnecessary parens above. > + __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 */ The comment should have not been part of 4/16? Thanks, Sekhar -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/