Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3966984pxb; Tue, 2 Mar 2021 03:20:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxytIHijd2/cEuu07Wf7wMAOYbUEZjBvyACFvMv4z8DfaZtVod4//wdalLtMjx5ATUDY7Ef X-Received: by 2002:a17:906:66cf:: with SMTP id k15mr19981898ejp.296.1614684038065; Tue, 02 Mar 2021 03:20:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614684038; cv=none; d=google.com; s=arc-20160816; b=UBB+G9C6KP+BvJnbiyc5C5QsXtHfzCosxN2meO88S+PzfMLhfo+YPtX46PrY0k1LPw WDOpSaMTQiCSB9n04FdDZ/BlBgO6sMTc/og3gI89ebgRyQzP6uT5lyZHquO9N0BVrMJK GcwuXIRu9zcy943+l+atB1M4q6VOCoUnJHR+xsOstW+BHKYcH8dsnYowbsukGsaNbEhR pBCBysiNqse6ib0U4aUTHduBiKiKHy42TomQpFt+GN+mxZfIUnIVHJBIq3WGGUr9PhmZ st6uP//TFFjWWjOoW2ym5ZwRhhqdD1qst+jVHM14IvyQC7M/HD6MzcPtS5VF7MTldkb6 WJsw== 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=qFmWEgeh0QCp85mJV8x2rO6WT94SbvmuC+Kq3otjrdA=; b=nANEJ6ns1zEaFUYl31f83uwy2zrDeVgmLL3mCCXGe47euiV10+8W+aminXsM327gxG GZov1USsjHM0XGYeZ+heQqhQjifqKaUPXZ41gOjsY1q+yPFWsbY20x2lghzGKSApuEjm Rvkezj12qVI5QnL7odJ/JE0fja1DbX64F76esjlSgXoUJRAAK4IPzkfHjdC1QWkZrmuc UfOF/bEb8FTNmlVK4aIrvNDrDeUr25yrl3r1/naeDP6zjIfedx38NuCZZmeE6WOG7Ds8 /5qhROLHtsSq0tJIGOv2Rkr7oJ9d0AlC2/cGr9TNSbC6khbmT4xhETs91+lMaipLQYlM 4bYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zhtouzI4; 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 ce13si13408449ejc.750.2021.03.02.03.20.14; Tue, 02 Mar 2021 03:20:38 -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=zhtouzI4; 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 S1380616AbhCBByJ (ORCPT + 99 others); Mon, 1 Mar 2021 20:54:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:49570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241934AbhCAT3y (ORCPT ); Mon, 1 Mar 2021 14:29:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 140196516C; Mon, 1 Mar 2021 17:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618436; bh=/FEFoX2zk8pVhdAlCodPRc2hw1FXSooj9O12L3FMXms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zhtouzI4wgQUVTRAkey6d//Ib92cBdCcD2eCVTTSOfpDgHJ/X9IGnAEVsfbfU5GSd hwxd82krid69qlU+0NN+mz85oH0A8HVG6dZudcH26hg4Q6xZo+n42muDqm4IRlAq3a ruL4AqMCRzAtAARwwBFuaY+wu1SiDUfDGCbGrt1s= 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 5.10 086/663] soc: aspeed: snoop: Add clock control logic Date: Mon, 1 Mar 2021 17:05:34 +0100 Message-Id: <20210301161145.987082889@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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/soc/aspeed/aspeed-lpc-snoop.c | 30 ++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c index f3d8d53ab84de..dbe5325a324d5 100644 --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include @@ -67,6 +68,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]; }; @@ -282,22 +284,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; } @@ -309,6 +331,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