From patchwork Wed Feb 27 23:16:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunter, Jon" X-Patchwork-Id: 2194921 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id C895CDF2F2 for ; Wed, 27 Feb 2013 23:20:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAqET-0006Ra-KX; Wed, 27 Feb 2013 23:16:17 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UAqEQ-0006Qe-35 for linux-arm-kernel@lists.infradead.org; Wed, 27 Feb 2013 23:16:15 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r1RNGALt002819; Wed, 27 Feb 2013 17:16:10 -0600 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r1RNGAJq008077; Wed, 27 Feb 2013 17:16:10 -0600 Received: from [172.24.114.87] (172.24.114.87) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Wed, 27 Feb 2013 17:16:10 -0600 Message-ID: <512E93B9.8020806@ti.com> Date: Wed, 27 Feb 2013 17:16:09 -0600 From: Jon Hunter User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: Javier Martinez Canillas Subject: Re: [PATCH 3/5] gpio/omap: Add DT support to GPIO driver References: <1329321854-24490-1-git-send-email-b-cousson@ti.com> <1329321854-24490-4-git-send-email-b-cousson@ti.com> <4F44FA56.7020000@gmail.com> <4F44FC37.2000701@ti.com> <4F452484.5080503@gmail.com> <74CDBE0F657A3D45AFBB94109FB122FF17BD8BC6C1@HQMAIL01.nvidia.com> <4F47AD08.4030504@ti.com> <512D39DA.7020306@ti.com> <512D3AB1.1080202@wwwdotorg.org> <512D3EC2.6050408@ti.com> <512D3FE6.1010300@wwwdotorg.org> <512D490B.70900@ti.com> <512D4FC4.2060505@wwwdotorg.org> <512D5C58.4090500@ti.com> In-Reply-To: X-Originating-IP: [172.24.114.87] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130227_181614_249120_24DC9EA3 X-CRM114-Status: GOOD ( 21.00 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Stephen Warren , Stephen Warren , Kevin Hilman , "devicetree-discuss@lists.ozlabs.org" , Grant Likely , "linux-omap@vger.kernel.org" , Linus Walleij , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 02/26/2013 09:57 PM, Javier Martinez Canillas wrote: [snip] > Something like that would definitely solve the GPIO request issue but > we still have the issue that the current OMAP GPIO controller binding > does not support #interrupt-cells = <2>. > > So, we can't pass the trigger type and level flags for an IRQ-GPIO > when using an GPIO controller as the interrupt-parent for a device > node. > > Do you have any comments on that issue? Can you elaborate a bit more on why you say this is not supported? I have been playing with this today on an omap board and if I set the #interrupt-cells = <2>, then I do see that irq_domain_xlate_onetwocell() is called and the irq number and flags read as expected. Following which I then see it will call the omap_irq_type() to set type. So AFAICT it works. Please note I do see that when the SMC driver calls request_irq() in smc_drv_probe() it is also settings the trigger type to IRQ_TYPE_EDGE_RISING (default). So if you are setting to low-level sensitive in DT, then this is being overwritten. We could fix this by setting SMC_IRQ_FLAGS to -1 for OMAP. In general we do need to fix the gpio binding for omap to default to #interrupt-cell = <2>, as this should work. However, before we can do that we need to fix the issue of ensuring the gpio module is enabled if being used as an interrupt source without having to call gpio_request() first. We should probably add the following patch as well to avoid any hangs if the bank is not enabled, when omap_irq_type is called. commit 5e298de564e09f5ca4148a9bc0ed5d16b4742f14 Author: Jon Hunter Date: Wed Feb 27 17:14:11 2013 -0600 gpio/omap: warn if gpio bank is not enabled on setting irq type gpio = OMAP_MPUIO(d->irq - IH_MPUIO_BASE); Cheers Jon diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index f1fbedb2..cbdc796 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -421,6 +421,9 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) int retval; unsigned long flags; + if (WARN_ON(!bank->mod_usage)) + return -EINVAL; + #ifdef CONFIG_ARCH_OMAP1 if (d->irq > IH_MPUIO_BASE)