From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F09DC433E3 for ; Thu, 30 Jul 2020 13:55:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24B2820656 for ; Thu, 30 Jul 2020 13:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729152AbgG3Nzw (ORCPT ); Thu, 30 Jul 2020 09:55:52 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:56392 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728440AbgG3Nzw (ORCPT ); Thu, 30 Jul 2020 09:55:52 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id B97C8803202F; Thu, 30 Jul 2020 13:55:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bdRglwaZNYp3; Thu, 30 Jul 2020 16:55:41 +0300 (MSK) From: Serge Semin To: Hoan Tran , Linus Walleij , Bartosz Golaszewski CC: Serge Semin , Serge Semin , Andy Shevchenko , Andy Shevchenko , Alexey Malahov , Pavel Parkhomenko , Rob Herring , , , Subject: [PATCH v2 00/10] gpio: dwapb: Refactor GPIO resources initialization Date: Thu, 30 Jul 2020 16:55:26 +0300 Message-ID: <20200730135536.19747-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This series is about the DW APB GPIO device initialization procedure cleaning up. First of all it has been discovered that having a vendor-specific "snps,nr-gpios" property isn't only redundant but also might be dangerous (see the commit log for details). Instead we suggest to use the generic "ngpios" property to define a number of GPIOs each DW APB GPIO controller port supports. Secondly seeing a tendency of the other GPIO drivers getting converted to using the GPIO-lib-based IRQ-chip interface this series provides a patch, which replaces the DW APB GPIO driver Generic IRQ-chip implementation with the GPIO-lib IRQ-chip one. Finally the DW APB GPIO device probe procedure is simplified by converting the code to be using the device managed resources for the reference clocks initialization, reset control assertion/de-assertion and GPIO-chip registration. Some additional cleanups like replacing a number of GPIOs literal with a corresponding macro and grouping the IRQ handlers up in a single place of the driver are also introduced in this patchset. Link: https://lore.kernel.org/linux-gpio/20200723013858.10766-1-Sergey.Semin@baikalelectronics.ru/ Changelog v2: - Replace gc->to_irq() with irq_find_mapping() method. - Refactor dwapb_irq_set_type() method to directly set IRQ flow handler instead of using a temporary variable. - Initialize GPIOlib IRQ-chip settings before calling request_irq() method. - Add a notice regarding regression of commit 6a2f4b7dadd5 ("gpio: dwapb: use a second irq chip"). - Move the acpi_gpiochip_{request,free}_interrupts() methods invocation removal to a dedicated patch. - Move GPIO-chip to_irq callback removal to a dedicated patch. - Add a patch which replaces a max number of GPIO literals with a macro. - Introduce dwapb_convert_irqs() method to convert the sparse parental IRQs array into an array of linearly distributed IRQs correctly perceived by GPIO-lib. Signed-off-by: Serge Semin Cc: Andy Shevchenko Cc: Andy Shevchenko Cc: Alexey Malahov Cc: Pavel Parkhomenko Cc: Rob Herring Cc: linux-gpio@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Serge Semin (10): dt-bindings: gpio: dwapb: Add ngpios property support gpio: dwapb: Add ngpios DT-property support gpio: dwapb: Move MFD-specific IRQ handler gpio: dwapb: Add max GPIOs macro gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip gpio: dwapb: Discard GPIO-to-IRQ mapping function gpio: dwapb: Discard ACPI GPIO-chip IRQs request gpio: dwapb: Get reset control by means of resource managed interface gpio: dwapb: Get clocks by means of resource managed interface gpio: dwapb: Use resource managed GPIO-chip add data method .../bindings/gpio/snps,dw-apb-gpio.yaml | 6 + drivers/gpio/Kconfig | 2 +- drivers/gpio/gpio-dwapb.c | 340 +++++++++--------- include/linux/platform_data/gpio-dwapb.h | 4 +- 4 files changed, 178 insertions(+), 174 deletions(-) -- 2.27.0