From patchwork Fri Feb 13 02:16:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 44639 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6F6DE21527 for ; Fri, 13 Feb 2015 02:16:26 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf8926779lbi.0 for ; Thu, 12 Feb 2015 18:16:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=Zi0fQQX+bOeLMPZpsE8AbPRTmwQlwOoKIjsbYlOfxK4=; b=JgDkhhzhrmUb7QaHwjJMWFrPZXRpeDbOC2/01RJMH6aPjPMaP/zfa8/nCSqSNf0q3+ EaSrnnoTgd+yFhPMX1tXO06qxtgi2m4eukLkRDEWAPlNtYZK3ooDpaBEJIipNp/pt8El WFyynL2LyU+1Q5kZ8QUQ7O/mJIqigSfJd6jB/iEESrc8gHd2viahuckL9LQblPevnvzW Pu2LXMIVjnCgs/e+wxhw1lcJHkmmjQ8PF2ZayOl60nSESXi4hLasj5Ni9jCNQJd3E5r5 J5o36SGWXgG4jdzsBk+rzyes32fZibdsDTEcTFZ6EPgQZFyUxnclomoLqGXCVoN0764T KbEA== X-Gm-Message-State: ALoCoQmqaMyq3TU+BN6VZ99r+h8Zb/wvX6JL6vF4nWkL78M11D2DnAxzsVhuVxDdsGmuOg2JH/p2 X-Received: by 10.152.88.40 with SMTP id bd8mr1006906lab.0.1423793784997; Thu, 12 Feb 2015 18:16:24 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.75 with SMTP id da11ls243984lad.95.gmail; Thu, 12 Feb 2015 18:16:24 -0800 (PST) X-Received: by 10.152.7.38 with SMTP id g6mr5817970laa.65.1423793784785; Thu, 12 Feb 2015 18:16:24 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id 1si521048lai.139.2015.02.12.18.16.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 18:16:24 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labgq15 with SMTP id gq15so13786342lab.6 for ; Thu, 12 Feb 2015 18:16:24 -0800 (PST) X-Received: by 10.152.179.172 with SMTP id dh12mr3301207lac.76.1423793784519; Thu, 12 Feb 2015 18:16:24 -0800 (PST) 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.112.35.133 with SMTP id h5csp792317lbj; Thu, 12 Feb 2015 18:16:23 -0800 (PST) X-Received: by 10.68.211.228 with SMTP id nf4mr11572989pbc.66.1423793782693; Thu, 12 Feb 2015 18:16:22 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf6si947453pad.240.2015.02.12.18.16.20; Thu, 12 Feb 2015 18:16:22 -0800 (PST) Received-SPF: none (google.com: linux-kernel-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 S1751678AbbBMCQM (ORCPT + 28 others); Thu, 12 Feb 2015 21:16:12 -0500 Received: from mail-ob0-f173.google.com ([209.85.214.173]:53116 "EHLO mail-ob0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271AbbBMCQK (ORCPT ); Thu, 12 Feb 2015 21:16:10 -0500 Received: by mail-ob0-f173.google.com with SMTP id uy5so15275620obc.4 for ; Thu, 12 Feb 2015 18:16:10 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.182.116.130 with SMTP id jw2mr4994687obb.48.1423793770064; Thu, 12 Feb 2015 18:16:10 -0800 (PST) Received: by 10.182.132.79 with HTTP; Thu, 12 Feb 2015 18:16:09 -0800 (PST) In-Reply-To: <1423760350-20149-1-git-send-email-robert.jarzmik@free.fr> References: <1423760350-20149-1-git-send-email-robert.jarzmik@free.fr> Date: Fri, 13 Feb 2015 10:16:09 +0800 Message-ID: Subject: Re: [PATCH] Revert "smc91x: retrieve IRQ and trigger flags in a modern way" From: Linus Walleij To: Robert Jarzmik Cc: Nicolas Pitre , "David S. Miller" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 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: , On Fri, Feb 13, 2015 at 12:59 AM, Robert Jarzmik wrote: > The commit breaks the legacy platforms, ie. these not using device-tree, > and setting up the interrupt resources with a flag to activate edge > detection. The issue was found on the zylonite platform. > > The reason is that zylonite uses platform resources to pass the interrupt number > and the irq flags (here IORESOURCE_IRQ_HIGHEDGE). It expects the driver to > request the irq with these flags, which in turn setups the irq as high edge > triggered. > > After the patch, this was supposed to be taken care of with : > irq_resflags = irqd_get_trigger_type(irq_get_irq_data(ndev->irq)); > > But irq_resflags is 0 for legacy platforms, while for example in > arch/arm/mach-pxa/zylonite.c, in struct resource smc91x_resources[] the > irq flag is specified. This breaks zylonite because the interrupt is not > setup as triggered, and hardware doesn't provide interrupts. > > Signed-off-by: Robert Jarzmik But isn't the real problem that in the device tree case, irq_get_irq_data(ndev->irq) will work becaus parsing an interrupt from the device tree populates it correctly in platform_get_irq() whereas for the legacy lookup it just fetches the number. So to me it seems like a weakness in the platform_get_irq() helper altogether. Does the following work? (I can send as a separate patch for testing if you like). Yours, Linus Walleij --- 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/ diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 9421fed40905..301f4b9ae908 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -101,6 +101,15 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) } r = platform_get_resource(dev, IORESOURCE_IRQ, num); + /* + * The resources may pass trigger flags to the irqs that need + * to be set up. It so happens that the trigger flags for + * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER* + * settings. + */ + if (r->flags & IORESOURCE_BITS) + irqd_set_trigger_type(irq_get_irq_data(r->start), + r->flags & IORESOURCE_BITS);