Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1572723pxb; Tue, 8 Feb 2022 22:43:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIP+XoWi7GQAm44B1wft1KK0wVRBhaRVTrZaAKqH52FlwPuXsb+omR609GL4kFqnrncJwf X-Received: by 2002:a63:8ac8:: with SMTP id y191mr759748pgd.29.1644389017302; Tue, 08 Feb 2022 22:43:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644389017; cv=none; d=google.com; s=arc-20160816; b=ehWyLMW5pHzqdyGnWKZ4/+WoqT0B5YoXBqMUOO0KcYR0S7jbxHkbcw+xKaCUjjJJVq 52ZfF/EbUIVryW2FDgukLm1+D/7lw0GmsBvu6kPigpPSthIFrNFMS/9awRilQcT8tFaE YF2jOgXbIh/wzTxDZtFVFaqCPnADeY6MeWCFgtkSvSy7OmmlHHBM9b6U4KP9vEk8l5LK jV565xXf7spu/0G2JrC4dIJBv05hLXW94yRvea32F3gJMNmtGISJ+ejtxVWD4m7vf7Jn xPl1Cc1EnqIjy6xNXhOdENtVnEvakpXCrY42eD78uijLi3WucbTVdfHRIG6+a2/yWbep 9HkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cbRcKBYbQPb+eGygJvHhaUPt+3jYgFXnzS6wNVyGxw0=; b=pn37N4ubO4tkmh0odvl+dzTPiXVGrCfMnr977Kn7q4aXXWBhAn6qEOQ6LZt0ChMk4t PomYd++Fk4/Eg1Hlv9WZDRw2HhMuY+Qs3xX0JRUWU6Oy5HX22bePBVxoua77W3u0vDWU xdo6n0mIuu3WfJRBeYJVwFSs9fxQkcQsEt2FW+zvjsy1OntrifhxRAWmXBSvDnfkeTbR WCHpVEaZoC7a+Q3l/h4ID4Q6oDWi+IIpBiZaEyOKOm1SI6qxmcEvzO3YxBIbt981nBqF NtMcbYqQDfEO+ZOiJcEK1+g8xeQL3pVnTj4TL2h/l+up1FoAgMHVn4sm4DptR1NrnLUw T3YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="I9/9ywJ1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si17046173pfg.249.2022.02.08.22.43.23; Tue, 08 Feb 2022 22:43:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="I9/9ywJ1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386237AbiBGLeD (ORCPT + 99 others); Mon, 7 Feb 2022 06:34:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383673AbiBGLXY (ORCPT ); Mon, 7 Feb 2022 06:23:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16639C0401D4; Mon, 7 Feb 2022 03:23:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F191B811B2; Mon, 7 Feb 2022 11:23:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31E90C004E1; Mon, 7 Feb 2022 11:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644232996; bh=P/8x4z9awNIPRoU7bcgMNv3+1kOQLXdXrq64xhcsXlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9/9ywJ1kds7R86qarGs2WHyi+E7C1fW2kIYSDf2q1hS1SS0yGASLPSydJ2DZHil5 Ex36Do/UzxOQh3ezoh0Mbop+gctFenYXiSUjHlPcMNho17+G9RreNNJyQL+C32Uu8B BGXgFffHvH7R0KVrhsD76o/84iBJKocei/LqpuJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=C5=81ukasz=20Bartosik?= , Andy Shevchenko Subject: [PATCH 5.10 50/74] pinctrl: intel: fix unexpected interrupt Date: Mon, 7 Feb 2022 12:06:48 +0100 Message-Id: <20220207103758.859492624@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103757.232676988@linuxfoundation.org> References: <20220207103757.232676988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Łukasz Bartosik commit e986f0e602f19ecb7880b04dd1db415ed9bca3f6 upstream. ASUS Chromebook C223 with Celeron N3350 crashes sometimes during cold booot. Inspection of the kernel log showed that it gets into an inifite loop logging the following message: ->handle_irq(): 000000009cdb51e8, handle_bad_irq+0x0/0x251 ->irq_data.chip(): 000000005ec212a7, 0xffffa043009d8e7 ->action(): 00000 IRQ_NOPROBE set unexpected IRQ trap at vector 7c The issue happens during cold boot but only if cold boot happens at most several dozen seconds after Chromebook is powered off. For longer intervals between power off and power on (cold boot) the issue does not reproduce. The unexpected interrupt is sourced from INT3452 GPIO pin which is used for SD card detect. Investigation relevealed that when the interval between power off and power on (cold boot) is less than several dozen seconds then values of INT3452 GPIO interrupt enable and interrupt pending registers survive power off and power on sequence and interrupt for SD card detect pin is enabled and pending during probe of SD controller which causes the unexpected IRQ message. "Intel Pentium and Celeron Processor N- and J- Series" volume 3 doc mentions that GPIO interrupt enable and status registers default value is 0x0. The fix clears INT3452 GPIO interrupt enabled and interrupt pending registers in its probe function. Fixes: 7981c0015af2 ("pinctrl: intel: Add Intel Sunrisepoint pin controller and GPIO support") Signed-off-by: Łukasz Bartosik Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/intel/pinctrl-intel.c | 54 +++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 20 deletions(-) --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -1201,6 +1201,39 @@ static irqreturn_t intel_gpio_irq(int ir return IRQ_RETVAL(ret); } +static void intel_gpio_irq_init(struct intel_pinctrl *pctrl) +{ + int i; + + for (i = 0; i < pctrl->ncommunities; i++) { + const struct intel_community *community; + void __iomem *base; + unsigned int gpp; + + community = &pctrl->communities[i]; + base = community->regs; + + for (gpp = 0; gpp < community->ngpps; gpp++) { + /* Mask and clear all interrupts */ + writel(0, base + community->ie_offset + gpp * 4); + writel(0xffff, base + community->is_offset + gpp * 4); + } + } +} + +static int intel_gpio_irq_init_hw(struct gpio_chip *gc) +{ + struct intel_pinctrl *pctrl = gpiochip_get_data(gc); + + /* + * Make sure the interrupt lines are in a proper state before + * further configuration. + */ + intel_gpio_irq_init(pctrl); + + return 0; +} + static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl, const struct intel_community *community) { @@ -1305,6 +1338,7 @@ static int intel_gpio_probe(struct intel girq->num_parents = 0; girq->default_type = IRQ_TYPE_NONE; girq->handler = handle_bad_irq; + girq->init_hw = intel_gpio_irq_init_hw; ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl); if (ret) { @@ -1634,26 +1668,6 @@ int intel_pinctrl_suspend_noirq(struct d } EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq); -static void intel_gpio_irq_init(struct intel_pinctrl *pctrl) -{ - size_t i; - - for (i = 0; i < pctrl->ncommunities; i++) { - const struct intel_community *community; - void __iomem *base; - unsigned int gpp; - - community = &pctrl->communities[i]; - base = community->regs; - - for (gpp = 0; gpp < community->ngpps; gpp++) { - /* Mask and clear all interrupts */ - writel(0, base + community->ie_offset + gpp * 4); - writel(0xffff, base + community->is_offset + gpp * 4); - } - } -} - static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value) { u32 curr, updated;