From patchwork Thu Jun 12 11:45:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 31812 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A7D122100A for ; Thu, 12 Jun 2014 11:47:47 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id up15sf3871267pbc.8 for ; Thu, 12 Jun 2014 04:47:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=9GcVp66XWaliFXgLYZ5mYoN0BtmPLx3VoM4p/qCZQM0=; b=Rq5EaP2yhciekDn0XzjDPWMgpx3Xq3Jh3zkNHDtARUYnKQbSmXx7ct+/ytAjio/Srm T9BdLoQi4NG6F8p2X6kqAENiWbRqywiQmgx0sHKJwmMXDWufsgUjkUW8lGR3Ltl80iST Avi3lIyxx1HsQYl2vw1HsfripFY1KovY7+lVfwJWqofnGZp+M0GveOjyVMK2dD29dcFz 82P4KXz9sM4Ry4ZvfT27WkRAGBEzISWZ1Tkid0FsdD98KgGe6/rX6oPTnH345/IKM14d kf4lKHVt5NS+aEtmg0cdJzYpdXxBhTlKSdcYXopBbKdoah8jUP5Gp9I+LPpK+FG1nmok ZKTw== X-Gm-Message-State: ALoCoQkzfkQn7HqlXg+ojou1DjfKzThAEgRrbubUaZlLo8yWJwTh2kf3K/qmG0rxcdTq2Ol2yHeM X-Received: by 10.67.30.200 with SMTP id kg8mr8403427pad.25.1402573666880; Thu, 12 Jun 2014 04:47:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.44.36 with SMTP id f33ls2894905qga.19.gmail; Thu, 12 Jun 2014 04:47:46 -0700 (PDT) X-Received: by 10.58.195.130 with SMTP id ie2mr45311261vec.3.1402573666720; Thu, 12 Jun 2014 04:47:46 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id bb6si237318vcb.17.2014.06.12.04.47.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Jun 2014 04:47:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz11so1653726veb.31 for ; Thu, 12 Jun 2014 04:47:46 -0700 (PDT) X-Received: by 10.52.110.105 with SMTP id hz9mr8116468vdb.9.1402573666579; Thu, 12 Jun 2014 04:47:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp396556vcb; Thu, 12 Jun 2014 04:47:46 -0700 (PDT) X-Received: by 10.66.146.105 with SMTP id tb9mr20569394pab.157.1402573665757; Thu, 12 Jun 2014 04:47:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si840083pas.122.2014.06.12.04.47.45; Thu, 12 Jun 2014 04:47:45 -0700 (PDT) Received-SPF: none (google.com: linux-omap-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755463AbaFLLro (ORCPT + 6 others); Thu, 12 Jun 2014 07:47:44 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:60180 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752728AbaFLLrn (ORCPT ); Thu, 12 Jun 2014 07:47:43 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5CBlF4V011483; Thu, 12 Jun 2014 06:47:15 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5CBlFkI023813; Thu, 12 Jun 2014 06:47:15 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Thu, 12 Jun 2014 06:47:15 -0500 Received: from uda0393807.india.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 s5CBl4mv027390; Thu, 12 Jun 2014 06:47:12 -0500 From: Sricharan R To: , CC: , , , , , Subject: [PATCH V2 1/2] ARM: OMAP2+: DMA: remove requirement of irq for platform-dma driver Date: Thu, 12 Jun 2014 17:15:22 +0530 Message-ID: <1402573523-13814-2-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1402573523-13814-1-git-send-email-r.sricharan@ti.com> References: <1402573523-13814-1-git-send-email-r.sricharan@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: r.sricharan@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Nishanth Menon we have currently 2 DMA drivers that try to co-exist. drivers/dma/omap-dma.c which registers it's own IRQ and is device tree aware and uses arch/arm/plat-omap/dma.c instance created by arch/arm/mach-omap2/dma.c to maintain channel usage (omap_request_dma). Currently both try to register interrupts and mach-omap2/plat-omap dma.c attempts to use the IRQ number registered by hwmod to register it's own interrupt handler. Now, there is no reasonable way of static allocating DMA irq in GIC SPI when we use crossbar. However, since the dma_chan structure is freed as a result of IRQ not being present due to devm allocation, maintaining information of channel by platform code fails at a later point in time when that region of memory is reused. So, if hwmod does not indicate an IRQ number, then, assume that dma-engine will take care of the interrupt handling. Signed-off-by: Nishanth Menon --- arch/arm/mach-omap2/dma.c | 3 +++ arch/arm/plat-omap/dma.c | 5 +++-- include/linux/omap-dma.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c index a6d2cf1..e1a56d8 100644 --- a/arch/arm/mach-omap2/dma.c +++ b/arch/arm/mach-omap2/dma.c @@ -259,6 +259,9 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP)) d->dev_caps |= HS_CHANNELS_RESERVED; + if (platform_get_irq_byname(pdev, "0") < 0) + d->dev_caps |= DMA_ENGINE_HANDLE_IRQ; + /* Check the capabilities register for descriptor loading feature */ if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS) dma_common_ch_end = CCDN; diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index b5608b1..7aae0e5 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -2100,7 +2100,7 @@ static int omap_system_dma_probe(struct platform_device *pdev) omap_dma_set_global_params(DMA_DEFAULT_ARB_RATE, DMA_DEFAULT_FIFO_DEPTH, 0); - if (dma_omap2plus()) { + if (dma_omap2plus() && !(d->dev_caps & DMA_ENGINE_HANDLE_IRQ)) { strcpy(irq_name, "0"); dma_irq = platform_get_irq_byname(pdev, irq_name); if (dma_irq < 0) { @@ -2145,7 +2145,8 @@ static int omap_system_dma_remove(struct platform_device *pdev) char irq_name[4]; strcpy(irq_name, "0"); dma_irq = platform_get_irq_byname(pdev, irq_name); - remove_irq(dma_irq, &omap24xx_dma_irq); + if (dma_irq >= 0) + remove_irq(dma_irq, &omap24xx_dma_irq); } else { int irq_rel = 0; for ( ; irq_rel < dma_chan_count; irq_rel++) { diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h index 88e6ea4..6f06f8b 100644 --- a/include/linux/omap-dma.h +++ b/include/linux/omap-dma.h @@ -130,6 +130,7 @@ #define IS_WORD_16 BIT(0xd) #define ENABLE_16XX_MODE BIT(0xe) #define HS_CHANNELS_RESERVED BIT(0xf) +#define DMA_ENGINE_HANDLE_IRQ BIT(0x10) /* Defines for DMA Capabilities */ #define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18)