From patchwork Tue Mar 3 08:47:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 445582 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C03EA14009B for ; Tue, 3 Mar 2015 19:47:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137AbbCCIrt (ORCPT ); Tue, 3 Mar 2015 03:47:49 -0500 Received: from smtprelay2.synopsys.com ([198.182.60.111]:55932 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263AbbCCIrt (ORCPT ); Tue, 3 Mar 2015 03:47:49 -0500 Received: from dc8secmta2.synopsys.com (dc8secmta2.synopsys.com [10.13.218.202]) by smtprelay.synopsys.com (Postfix) with ESMTP id C0A1810C10D0; Tue, 3 Mar 2015 00:47:48 -0800 (PST) Received: from dc8secmta2.internal.synopsys.com (dc8secmta2.internal.synopsys.com [127.0.0.1]) by dc8secmta2.internal.synopsys.com (Service) with ESMTP id B4775A4115; Tue, 3 Mar 2015 00:47:48 -0800 (PST) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by dc8secmta2.internal.synopsys.com (Service) with ESMTP id 89D9AA4114; Tue, 3 Mar 2015 00:47:48 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 77BC1447; Tue, 3 Mar 2015 00:47:48 -0800 (PST) Received: from abrodkin-e7440l.internal.synopsys.com (unknown [10.225.15.34]) by mailhost.synopsys.com (Postfix) with ESMTP id 5750E42B; Tue, 3 Mar 2015 00:47:46 -0800 (PST) From: Alexey Brodkin To: linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Alexey Brodkin , Vineet Gupta , Linus Walleij , Alexandre Courbot Subject: [PATCH] gpio-dwapb: reset mask register on probe Date: Tue, 3 Mar 2015 11:47:41 +0300 Message-Id: <1425372461-17859-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org It's possible that boot-loader that worked on CPU before Linux kernel made some changes in GPIO controller registers. For example interrupts could be all masked. Current implementation of DW GPIO driver relies on default values in mask register. This is especially problematic in this DW GPIO driver because it sets 2 pairs of methods: .irq_eable/.irq_disable and .irq_mask/.irq_unmask. In this case generic "irq_enable" function will use only .irq_enable call-back and mask register will be never modified so required interrupts will be finally unmasked. To troubleshoot described problem on driver probe we just need to make sure mask register is zeroed. Signed-off-by: Alexey Brodkin Cc: Vineet Gupta Cc: Linus Walleij Cc: Alexandre Courbot --- drivers/gpio/gpio-dwapb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 58faf04..be75860 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -370,6 +370,9 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio, irq_create_mapping(gpio->domain, hwirq); port->bgc.gc.to_irq = dwapb_gpio_to_irq; + + /* Reset mask register */ + dwapb_write(gpio, GPIO_INTMASK, 0); } static void dwapb_irq_teardown(struct dwapb_gpio *gpio)