From patchwork Tue Nov 20 15:19:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 10690493 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B565215A7 for ; Tue, 20 Nov 2018 15:19:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A59992AA32 for ; Tue, 20 Nov 2018 15:19:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 993442AA34; Tue, 20 Nov 2018 15:19:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BF6E2AA32 for ; Tue, 20 Nov 2018 15:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728051AbeKUBtI (ORCPT ); Tue, 20 Nov 2018 20:49:08 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:28671 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725977AbeKUBtI (ORCPT ); Tue, 20 Nov 2018 20:49:08 -0500 Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 21 Nov 2018 00:19:29 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.190]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id BB78940121DB; Wed, 21 Nov 2018 00:19:27 +0900 (JST) From: Fabrizio Castro To: Linus Walleij , Geert Uytterhoeven , Bartosz Golaszewski Cc: Fabrizio Castro , linux-gpio@vger.kernel.org, Simon Horman , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [RFC v3 2/2] gpio: rcar: Set pin as a GPIO when configuring an interrupt Date: Tue, 20 Nov 2018 15:19:16 +0000 Message-Id: <1542727156-31432-3-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542727156-31432-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1542727156-31432-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As it turns out, the bootloader or a POR may get in the way of the current implementation of gpio_rcar_irq_set_type, as the pinmuxing may not be GPIO. This patch makes sure the pin is configured as a GPIO when requesting it an interrupt, as that's necessary for the interrupt to work properly. Failing to do so may damage the board as this can cause shorts. Signed-off-by: Fabrizio Castro --- drivers/gpio/gpio-rcar.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 1322f7e..615404c 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -168,6 +168,9 @@ static int gpio_rcar_irq_set_type(struct irq_data *d, unsigned int type) default: return -EINVAL; } + + pinctrl_mux_gpio_request_enable(gc->base + hwirq); + return 0; }