Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp385156pxb; Wed, 3 Mar 2021 05:54:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwvYvNuZzFYLObQ3VLy4x9qJloMa9wQrqLuku01GOWTVKk8/rw5SMrjS79cMeM6C/2LVZzZ X-Received: by 2002:a17:906:753:: with SMTP id z19mr24428573ejb.447.1614779689319; Wed, 03 Mar 2021 05:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614779689; cv=none; d=google.com; s=arc-20160816; b=b5fl5Ic9uSk6zMwcnmo4WiPbw5WnZQNRHnw9BqzziKEmp7+k2X0PZPLvLKH0odcM3p IZeo6HbI0uHDjuyQgD5WFcX9h1zKgUJzp4QF+KZuD6Cpp7l3n0hKs+ZA+vJMBANKDQIF qrlFfgt4iDtdhaTmUD3qr6ru9JII7AKtMyGMcmh9BTQmwIS2TqpaPViiBvlBvDh2c4p3 i+6irEQKgQw0ky9514VFhEqGEy9LseQ+SzEXGSZj2DcgPb1H02pOlRGN8C9tg0zWBM7G EFDVK2FaGZ3lQ80H22zZspv94wlTALXmXClT5exG3dUcnsnav7KZX/zS0ZyxsWqutdsc xPcw== 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=A3g2Kgjt5kFRO2uAzEFYSKuxLN+5in3WafQgCr/felI=; b=Ncq+akhhkX3eCpBGtiECXiay4XKqovjKZMxAWOxltJ+xD3T1QjxOTlZqyXdZoPCEWp NCY2XodyEt4pxcUKVQqawMl4iTUx0PdcBca3unginbhK3fs1CIl3ozelvtEgoJlHGkXK YhRXc5pqMhLFYRW5egaW5E+ogj1y3lsgurLtQ9dVLl+4bCzAgUDpUeihmAzGzxugnXYw xDwrLW+jA7fq9+Y6RzHEOIAh7E+eNI8cP3elOBBjgWj+41x8vMwgCf4E/Xiu3B66K2wp pangvi5HEsEfVV2m8MMAJdmyDFXM8qHRKl2U1LT8+0Jnkc7vBeBWPxdYzzj0GiY4xPPo VqCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lw5JmbXg; 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 cd22si3677953ejb.384.2021.03.03.05.54.10; Wed, 03 Mar 2021 05:54:49 -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=Lw5JmbXg; 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 S242354AbhCAUKa (ORCPT + 99 others); Mon, 1 Mar 2021 15:10:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:33066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235915AbhCARCx (ORCPT ); Mon, 1 Mar 2021 12:02:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 44CB064F74; Mon, 1 Mar 2021 16:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616674; bh=qNyvTpgP2qBw/FEkZPhQTJ62tjrNOIOFhITedfrZER8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lw5JmbXgFpVerU6YLWiX6zzI4ViOhc42pAFsH8E/ew66tqIP0HNQ4oIgeAa9r/GAy 9yOWD55yx7Jxz41CaxzMHEb//8VFqvNGU1x5VOJ1G+c2KC3r7x2zR76qw2BLmhYuzW AcWu75fYye+QfBpxIPGA7VWxDWNRzREUACxnQ5K0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jae Hyun Yoo , Vernon Mauery , John Wang , Joel Stanley , Sasha Levin Subject: [PATCH 4.19 055/247] soc: aspeed: snoop: Add clock control logic Date: Mon, 1 Mar 2021 17:11:15 +0100 Message-Id: <20210301161034.369309830@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jae Hyun Yoo [ Upstream commit 3f94cf15583be554df7aaa651b8ff8e1b68fbe51 ] If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC SNOOP block will be enabled without heart beating of LCLK until lpc-ctrl enables the LCLK. This issue causes improper handling on host interrupts when the host sends interrupt in that time frame. Then kernel eventually forcibly disables the interrupt with dumping stack and printing a 'nobody cared this irq' message out. To prevent this issue, all LPC sub-nodes should enable LCLK individually so this patch adds clock control logic into the LPC SNOOP driver. Fixes: 3772e5da4454 ("drivers/misc: Aspeed LPC snoop output using misc chardev") Signed-off-by: Jae Hyun Yoo Signed-off-by: Vernon Mauery Signed-off-by: John Wang Reviewed-by: Joel Stanley Link: https://lore.kernel.org/r/20201208091748.1920-1-wangzhiqiang.bj@bytedance.com Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/misc/aspeed-lpc-snoop.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/misc/aspeed-lpc-snoop.c b/drivers/misc/aspeed-lpc-snoop.c index c10be21a1663d..b4a776bf44bc5 100644 --- a/drivers/misc/aspeed-lpc-snoop.c +++ b/drivers/misc/aspeed-lpc-snoop.c @@ -15,6 +15,7 @@ */ #include +#include #include #include #include @@ -71,6 +72,7 @@ struct aspeed_lpc_snoop_channel { struct aspeed_lpc_snoop { struct regmap *regmap; int irq; + struct clk *clk; struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS]; }; @@ -286,22 +288,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev) return -ENODEV; } + lpc_snoop->clk = devm_clk_get(dev, NULL); + if (IS_ERR(lpc_snoop->clk)) { + rc = PTR_ERR(lpc_snoop->clk); + if (rc != -EPROBE_DEFER) + dev_err(dev, "couldn't get clock\n"); + return rc; + } + rc = clk_prepare_enable(lpc_snoop->clk); + if (rc) { + dev_err(dev, "couldn't enable clock\n"); + return rc; + } + rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); if (rc) - return rc; + goto err; rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); if (rc) - return rc; + goto err; /* Configuration of 2nd snoop channel port is optional */ if (of_property_read_u32_index(dev->of_node, "snoop-ports", 1, &port) == 0) { rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); - if (rc) + if (rc) { aspeed_lpc_disable_snoop(lpc_snoop, 0); + goto err; + } } + return 0; + +err: + clk_disable_unprepare(lpc_snoop->clk); + return rc; } @@ -313,6 +335,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev) aspeed_lpc_disable_snoop(lpc_snoop, 0); aspeed_lpc_disable_snoop(lpc_snoop, 1); + clk_disable_unprepare(lpc_snoop->clk); + return 0; } -- 2.27.0