From patchwork Wed Sep 27 02:40:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 818902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="v0dr3Dqr"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y22FB0Fcfz9t3x for ; Wed, 27 Sep 2017 12:43:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968803AbdI0CnB (ORCPT ); Tue, 26 Sep 2017 22:43:01 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:60358 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967799AbdI0Cm7 (ORCPT ); Tue, 26 Sep 2017 22:42:59 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id v8R2eoYQ029272; Wed, 27 Sep 2017 11:40:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v8R2eoYQ029272 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1506480051; bh=lrmfbzVXJ3yV3iP4p79dHBvZGUhM2zh1Xn7WJ+C4W/Y=; h=From:To:Cc:Subject:Date:From; b=v0dr3Dqrn2jnBLw9iR5uqzliku7iiPwZY+OtyR6o2AEOKjjmd1hCnpR3QpGAXc8cX KVrDkdZUANbPCtA383aDfUpMpSMzMQ+7hswQJ2hCAHLOf79NMyb47R9FxRTOe7jL5r 63qhpSkkv10n6hUPOuJqOj1ZwqLFDEwGsaX5pZ+wTf+IQ0gs+/dYJN9T1HgGq6YE52 7NPa49jjxmN48wLgam+KiA0IvlGQcTgUcm6sq2xsI4uhzR7m1Pm8o7pz9PyoqU8vyF NLbpSbHwBO4Iljc49bMi50vKkB5o74OtSXn/jnv6ro0bvTLnSikt9xvMDRY1DQJquh BWxa8jmemLHeg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-gpio@vger.kernel.org Cc: devicetree@vger.kernel.org, Rob Herring , Masami Hiramatsu , Jassi Brar , Masahiro Yamada , Mauro Carvalho Chehab , Randy Dunlap , Linus Walleij , linux-kernel@vger.kernel.org, "David S. Miller" , Rob Herring , Greg Kroah-Hartman , Mark Rutland , linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 0/2] gpio: uniphier: UniPhier GPIO driver Date: Wed, 27 Sep 2017 11:40:20 +0900 Message-Id: <1506480022-8995-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This series adds UniPhier GPIO driver. The interrupt controller part is implemented by using hierarchy irqdomain. IMHO, the problem of the hierarchy irqdomain is that drivers must hard-code the fwspec of the interrupt parent. We will never know the DT binding of the parent unless we parse #interrupt-cell, etc. I asked about this: https://lkml.org/lkml/2017/7/6/758 Apparently, the current kernel does not provide a systematic way to describe it. In v1-v3, I hard-coded the parent hwirq numbers in the driver because irqchip drivers are forced to hard-code more or less about the parent. This was not accepted by Linus Walleij. In v4, I tried to use the new API irq_domain_push_irq(). I needed to change the irqdomain framework to make it work for DT, but seemed controversial in the irqdomain subsystem review. In v5, I tried another solution. At first I thought it worked, but I found a dead-lock if an irq is disposed from the .alloc hook. After I considered more, I thought "interrupts" property does not make much sense here because the last cell (which usually specifies the trigger type) is useless for the hierarchy irqdomain. I decided to use a vendor-specific property. This is what some drivers actually do. Changes in v6: - Add "socionext,interrupt-ranges" Changes in v5: - Split into a separate patch for DT binding - Add a new patch to export of_phandle_args_to_fwspec - Split DT binding into a separate file - v4 depends on some patches that change irq_domain_push_irq(), but they got negative feedback in the irqdomain subsystem review. Yet another approach here. Parse "interrupts" property in .alloc() hook. If the parent IRQ is already mapped, dispose it and re-alloc in irqdomain manner. Changes in v4: - Add COMPILE_TEST and select IRQ_DOMAIN_HIERARCHY - Reimplement irqchip part by using irq_domain_push_irq() Changes in v3: - Add .irq_set_affinity() hook - Use irq_domain_create_hierarchy() instead of legacy irq_domain_add_hierarchy() Changes in v2: - Remove +32 offset for parent interrupts to follow the GIC binding convention - Let uniphier_gpio_irq_alloc() fail if nr_irqs != 1 - Allocate gpio_chip statically because just one instance is supported - Fix suspend and resume hooks Masahiro Yamada (2): dt-bindings: gpio: uniphier: add UniPhier GPIO binding gpio: uniphier: add UniPhier GPIO controller driver .../devicetree/bindings/gpio/gpio-uniphier.txt | 40 ++ MAINTAINERS | 1 + drivers/gpio/Kconfig | 8 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-uniphier.c | 507 +++++++++++++++++++++ include/dt-bindings/gpio/uniphier-gpio.h | 18 + 6 files changed, 575 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-uniphier.txt create mode 100644 drivers/gpio/gpio-uniphier.c create mode 100644 include/dt-bindings/gpio/uniphier-gpio.h