From patchwork Mon Nov 8 19:01:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jae.hyun.yoo@intel.com X-Patchwork-Id: 12608953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 592D3C433F5 for ; Mon, 8 Nov 2021 18:43:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B42461506 for ; Mon, 8 Nov 2021 18:43:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2B42461506 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xvQgpywbci23Ixqr0kzw4fGBVySZbf6p8VOjzKJNzkk=; b=aKt3UXUc/5DQLG C31G5UFEOgWYfuaj5leRDua15wQTqKvFqSOP/Pv1KRTJAxAKyU84njEhq8ev/LQv9xKjj57VkgVK+ R9C56D1ZdHlRC19ut1EoP24jXJlrzFryafGE4IzIT/tXxs3VZUhEYxgIs2kIWFoR3wGwKPeALJ/Fe wFP68qMub5sXZq81MxD9N6LDJu7pUe9ETSubGAG5AvUyafGEiOqQbLXCBwI+kLsg0AMqq4pe5lT7h GREPdtk/UtS/LxteHXynRexe3nJtOKpxNNm41l47pQ0Ku5vqY4+sbecLxHV2FP9RxqpJuYJ6Zqpii S3XShCOwZzhCCImTwdxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bN-00HBUA-0n; Mon, 08 Nov 2021 18:42:41 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9b8-00HBQ9-Sm for linux-arm-kernel@lists.infradead.org; Mon, 08 Nov 2021 18:42:28 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="212332004" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="212332004" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 10:42:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="503150686" Received: from maru.jf.intel.com ([10.54.51.77]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2021 10:42:19 -0800 From: jae.hyun.yoo@intel.com To: Rob Herring , Corey Minyard , Joel Stanley , Andrew Jeffery , Cedric Le Goater , Haiyue Wang , ChiaWei Wang , Jae Hyun Yoo Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net Subject: [PATCH v3 1/6] ARM: dts: aspeed: add LCLK setting into LPC IBT node Date: Mon, 8 Nov 2021 11:01:55 -0800 Message-Id: <20211108190200.290957-2-jae.hyun.yoo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108190200.290957-1-jae.hyun.yoo@intel.com> References: <20211108190200.290957-1-jae.hyun.yoo@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_104226_973108_4EC3B5FC X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jae Hyun Yoo If LPC BT driver is registered ahead of lpc-ctrl module, LPC BT hardware 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 interrupts 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 drivers should enable LCLK individually so this patch adds 'clocks' property setting into LPC IBT node as one of required properties to enable the LCLK by the LPC IBT driver. Note: dtbs should be re-compiled after applying this change since it's adding a new required property otherwise the driver will not be probed correctly. Signed-off-by: Jae Hyun Yoo Reviewed-by: Joel Stanley Reviewed-by: Andrew Jeffery --- v2 -> v3: * Made commit message more descriptive. v1 -> v2: * No change. arch/arm/boot/dts/aspeed-g4.dtsi | 1 + arch/arm/boot/dts/aspeed-g5.dtsi | 1 + arch/arm/boot/dts/aspeed-g6.dtsi | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi index b313a1cf5f73..f14dace34c5a 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi @@ -381,6 +381,7 @@ ibt: ibt@140 { compatible = "aspeed,ast2400-ibt-bmc"; reg = <0x140 0x18>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi index c7049454c7cb..d0cc4be2de59 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -507,6 +507,7 @@ ibt: ibt@140 { compatible = "aspeed,ast2500-ibt-bmc"; reg = <0x140 0x18>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; }; diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi index 5106a424f1ce..465c3549fdc3 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -581,6 +581,7 @@ ibt: ibt@140 { compatible = "aspeed,ast2600-ibt-bmc"; reg = <0x140 0x18>; interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; }; From patchwork Mon Nov 8 19:01:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jae.hyun.yoo@intel.com X-Patchwork-Id: 12608963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3657C433EF for ; Mon, 8 Nov 2021 18:45:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 931C4613B3 for ; Mon, 8 Nov 2021 18:45:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 931C4613B3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HhNW1dM6iTi3NlMzwijNgHxQiBRA9Y7k7caQ5G5O4L8=; b=WmnjIF4SKt98B3 HEo33JtPIG4f/uTy8WYWZFC1Wj6guddXcj9coPGClTpzKaSbuBdD1Pn9CzUuE7Zzel41JErmy7DIQ J/4tgfufFJbsvHVng7nWL25MnEBb/Aj8DeMReYBkwOZk3gsY0MBoPJ32pr8Wh30o/CBhNoYJBQxiy wHk6iNM6qS/F3PFX40HjSkFgLwbYJf9m75IQbYzqIg6np4vWHrjz5dLFyIZvEN3MElFa9iDz0bDQy 0sp1KsVWr6C3jj73vC78w7FKNGprrET9IS+2tjn3TTTQ/LNZERN2uRtKr7l5Ke8QC2C83FFWnvKyZ WxYxEIQJwfMFQbVeSWbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9cW-00HBwT-93; Mon, 08 Nov 2021 18:43:52 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bB-00HBQ9-Tl for linux-arm-kernel@lists.infradead.org; Mon, 08 Nov 2021 18:42:31 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="212332006" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="212332006" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 10:42:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="503150687" Received: from maru.jf.intel.com ([10.54.51.77]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2021 10:42:19 -0800 From: jae.hyun.yoo@intel.com To: Rob Herring , Corey Minyard , Joel Stanley , Andrew Jeffery , Cedric Le Goater , Haiyue Wang , ChiaWei Wang , Jae Hyun Yoo Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net Subject: [PATCH v3 2/6] dt-bindings: ipmi: bt-bmc: add 'clocks' as a required property Date: Mon, 8 Nov 2021 11:01:56 -0800 Message-Id: <20211108190200.290957-3-jae.hyun.yoo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108190200.290957-1-jae.hyun.yoo@intel.com> References: <20211108190200.290957-1-jae.hyun.yoo@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_104230_009398_E19F3C72 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jae Hyun Yoo If LPC BT driver is registered ahead of lpc-ctrl module, LPC BT hardware 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 interrupts 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 drivers should enable LCLK individually so this patch adds 'clocks' property as one of required properties to enable the LCLK by the LPC IBT driver. Note: dtsi change in this patch series should be applied along with, and dtbs should be re-compiled after applying this series since it's adding a new required property otherwise the driver will not be probed correctly. Signed-off-by: Jae Hyun Yoo Reviewed-by: Rob Herring --- v2 -> v3: * Made commit message more descriptive. v1 -> v2: * Added 'clocks' property into ibt bindings using 'aspeed,ast2400-ibt-bmc.txt' because it's not merged into 'aspeed-lpc.yaml' yet. The bindings merging could be done using a separate patch later. .../devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt b/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt index c9902fd4b38b..25f86da804b7 100644 --- a/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt +++ b/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt @@ -11,6 +11,7 @@ Required properties: "aspeed,ast2500-ibt-bmc" "aspeed,ast2600-ibt-bmc" - reg: physical address and size of the registers +- clocks: clock for the device Optional properties: @@ -23,4 +24,5 @@ Example: compatible = "aspeed,ast2400-ibt-bmc"; reg = <0x1e789140 0x18>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; }; From patchwork Mon Nov 8 19:01:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: jae.hyun.yoo@intel.com X-Patchwork-Id: 12608955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FD9CC433F5 for ; Mon, 8 Nov 2021 18:44:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5ECB61506 for ; Mon, 8 Nov 2021 18:44:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C5ECB61506 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cfW5dCc9NFAJFsr4TlWwWg6uiAdtnz8plnNYfPaKBcE=; b=MAENQOdH9nEom2 AvL9KsapHXDS/GmE3f67wMmYjCyNXqZCClj84EKkCElfteEliZnEsNZGAt6brB9uhGM5sPganIaqV Alb6qRIUb264bgEHYDFTIAveJptKMU1SV8XTPtbOWPTgp5U1AQUmhXVIAUMa6N9qiZUIyovCDVezH fnXLn0sNbKTyR5lxKiLyFBRjg/vdTDJtSpTfMt3xvJJ6kBDz0sIYZ/GUu5l5KG4TfAsKzKWwzF9ZN 8NBS35g/Dw6pJK41UsK8j9oVg578fvb0UGsVIeT9KWVgjlTkeCxQ6Z9CoxZjV3QYdxuOpzJVA6WI2 qiYTCBBrX9W1bct6Tt9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bX-00HBVo-Az; Mon, 08 Nov 2021 18:42:51 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9b8-00HBQs-Vp for linux-arm-kernel@lists.infradead.org; Mon, 08 Nov 2021 18:42:28 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="212332008" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="212332008" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 10:42:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="503150689" Received: from maru.jf.intel.com ([10.54.51.77]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2021 10:42:20 -0800 From: jae.hyun.yoo@intel.com To: Rob Herring , Corey Minyard , Joel Stanley , Andrew Jeffery , Cedric Le Goater , Haiyue Wang , ChiaWei Wang , Jae Hyun Yoo Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net Subject: [PATCH v3 3/6] ipmi: bt: add clock control logic Date: Mon, 8 Nov 2021 11:01:57 -0800 Message-Id: <20211108190200.290957-4-jae.hyun.yoo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108190200.290957-1-jae.hyun.yoo@intel.com> References: <20211108190200.290957-1-jae.hyun.yoo@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_104227_108744_09511F14 X-CRM114-Status: GOOD ( 17.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jae Hyun Yoo If LPC BT driver is registered ahead of lpc-ctrl module, LPC BT hardware 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 interrupts 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 drivers should enable LCLK individually so this patch adds clock control logic into the LPC BT driver. Note: dtsi change in this patch series should be applied along with, and dtbs should be re-compiled after applying this series since it's adding a new required property otherwise this driver will not be probed correctly. Fixes: 54f9c4d0778b ("ipmi: add an Aspeed BT IPMI BMC driver") Signed-off-by: Jae Hyun Yoo Reviewed-by: Joel Stanley Reviewed-by: Cédric Le Goater Reviewed-by: Andrew Jeffery --- v2 -> v3: * Simplified the -EPROBE_DEFER handling using dev_err_probe(). v1 -> v2: * No change. drivers/char/ipmi/bt-bmc.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/char/ipmi/bt-bmc.c b/drivers/char/ipmi/bt-bmc.c index 7450904e330a..f6547ddd7284 100644 --- a/drivers/char/ipmi/bt-bmc.c +++ b/drivers/char/ipmi/bt-bmc.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,7 @@ struct bt_bmc { wait_queue_head_t queue; struct timer_list poll_timer; struct mutex mutex; + struct clk *clk; }; static atomic_t open_count = ATOMIC_INIT(0); @@ -423,6 +425,16 @@ static int bt_bmc_probe(struct platform_device *pdev) if (IS_ERR(bt_bmc->base)) return PTR_ERR(bt_bmc->base); + bt_bmc->clk = devm_clk_get(dev, NULL); + if (IS_ERR(bt_bmc->clk)) + return dev_err_probe(dev, PTR_ERR(bt_bmc->clk), + "Unable to get clock\n"); + rc = clk_prepare_enable(bt_bmc->clk); + if (rc) { + dev_err(dev, "Unable to enable clock\n"); + return rc; + } + mutex_init(&bt_bmc->mutex); init_waitqueue_head(&bt_bmc->queue); @@ -433,7 +445,7 @@ static int bt_bmc_probe(struct platform_device *pdev) rc = misc_register(&bt_bmc->miscdev); if (rc) { dev_err(dev, "Unable to register misc device\n"); - return rc; + goto err; } bt_bmc_config_irq(bt_bmc, pdev); @@ -457,6 +469,11 @@ static int bt_bmc_probe(struct platform_device *pdev) clr_b_busy(bt_bmc); return 0; + +err: + clk_disable_unprepare(bt_bmc->clk); + + return rc; } static int bt_bmc_remove(struct platform_device *pdev) @@ -466,6 +483,8 @@ static int bt_bmc_remove(struct platform_device *pdev) misc_deregister(&bt_bmc->miscdev); if (bt_bmc->irq < 0) del_timer_sync(&bt_bmc->poll_timer); + clk_disable_unprepare(bt_bmc->clk); + return 0; } From patchwork Mon Nov 8 19:01:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jae.hyun.yoo@intel.com X-Patchwork-Id: 12608961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59863C433EF for ; Mon, 8 Nov 2021 18:44:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2374161506 for ; Mon, 8 Nov 2021 18:44:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2374161506 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hLKt0WkcFdC/B9+ePw8vso0bhqWwVMFkWuKDpt+VUlM=; b=ecmph2wuyNdRGW w7sDLfqjEgZvBsmJzyfT2pF5KU+2iW1stBrpP+mfIYPQaxvXEf7R9bvNqA/mAooEPeAg1EBXWX5nl QLCenUK9pPwps7mzmYYZaHa/sX6qwgt6jSDCVDT5esm0Ig1yxM7P+kbrDyjMMBVgb7vzjHQsIE5/8 VY/prm6METMYz1D4BJ31I+EOweba70djk9f4biTPC2BqAV2yN4XBHsTtgNclzr57F34dErvWpkCBa O70pencGhNrCTSNQsX1hBzPoeVhUbJhEo+DkO0qORFnAvspXa4CBdPPGF2fvbNxohvlRBJn1G1hU0 ZYMhQ6FyqmOFcG1Lr+mA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9cD-00HBlR-2D; Mon, 08 Nov 2021 18:43:33 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bA-00HBQs-Ha for linux-arm-kernel@lists.infradead.org; Mon, 08 Nov 2021 18:42:31 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="212332010" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="212332010" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 10:42:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="503150692" Received: from maru.jf.intel.com ([10.54.51.77]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2021 10:42:20 -0800 From: jae.hyun.yoo@intel.com To: Rob Herring , Corey Minyard , Joel Stanley , Andrew Jeffery , Cedric Le Goater , Haiyue Wang , ChiaWei Wang , Jae Hyun Yoo Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net Subject: [PATCH v3 4/6] ARM: dts: aspeed: add LCLK setting into LPC KCS nodes Date: Mon, 8 Nov 2021 11:01:58 -0800 Message-Id: <20211108190200.290957-5-jae.hyun.yoo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108190200.290957-1-jae.hyun.yoo@intel.com> References: <20211108190200.290957-1-jae.hyun.yoo@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_104228_660098_CDB70BD1 X-CRM114-Status: GOOD ( 10.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jae Hyun Yoo If LPC KCS driver is registered ahead of lpc-ctrl module, LPC KCS hardware 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 interrupts 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 drivers should enable LCLK individually so this patch adds 'clocks' property setting into LPC KCS node as one of required properties to enable the LCLK by the LPC KCS driver. Note: dtbs should be re-compiled after applying this change since it's adding a new required property otherwise the driver will not be probed correctly. Signed-off-by: Jae Hyun Yoo Reviewed-by: Joel Stanley Reviewed-by: Andrew Jeffery --- v2 -> v3: * Made commit message more descriptive. v1 -> v2: * No change. arch/arm/boot/dts/aspeed-g5.dtsi | 4 ++++ arch/arm/boot/dts/aspeed-g6.dtsi | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi index d0cc4be2de59..7495f93c5069 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -446,6 +446,7 @@ kcs1: kcs@24 { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x24 0x1>, <0x30 0x1>, <0x3c 0x1>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; @@ -453,6 +454,7 @@ kcs2: kcs@28 { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x28 0x1>, <0x34 0x1>, <0x40 0x1>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; @@ -460,6 +462,7 @@ kcs3: kcs@2c { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x2c 0x1>, <0x38 0x1>, <0x44 0x1>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; @@ -467,6 +470,7 @@ kcs4: kcs@114 { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x114 0x1>, <0x118 0x1>, <0x11c 0x1>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi index 465c3549fdc3..891b862363a7 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -520,6 +520,7 @@ kcs1: kcs@24 { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x24 0x1>, <0x30 0x1>, <0x3c 0x1>; interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; kcs_chan = <1>; status = "disabled"; }; @@ -528,6 +529,7 @@ kcs2: kcs@28 { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x28 0x1>, <0x34 0x1>, <0x40 0x1>; interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; @@ -535,6 +537,7 @@ kcs3: kcs@2c { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x2c 0x1>, <0x38 0x1>, <0x44 0x1>; interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; @@ -542,6 +545,7 @@ kcs4: kcs@114 { compatible = "aspeed,ast2500-kcs-bmc-v2"; reg = <0x114 0x1>, <0x118 0x1>, <0x11c 0x1>; interrupts = ; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; From patchwork Mon Nov 8 19:01:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jae.hyun.yoo@intel.com X-Patchwork-Id: 12608957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22C75C433EF for ; Mon, 8 Nov 2021 18:44:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7633613B3 for ; Mon, 8 Nov 2021 18:44:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E7633613B3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rthQyJPbw5iJNnoQ2mp4CSj2DUe4UsEej35sZxzD0ig=; b=hn3Gl5+W9X5VFL Y9Raual9eXk5BuvQ4F9W17juNtVyeh2ny0dDPjbCBLqMj2HQFYJMgUXz42IQjP6iAurDXy+iKgO8P ncccnFUvCCDoa1phB1jCMkowN25qW0gwTiJckBzku1btpRReVJtlDWwuDKlly+/Y8vhbvd66boLyO jsVY1Dgz+QtK55mEu9VkqjAu1LbR4aprjicoFzDaXKAprnrLLwCm65LvPfZfOwrPbuX7+YUGxbfcL rTrapQDwRxSJOcRNAfnTpy9+I9+1OzTWnrJWKTzM3/7feOWh3g6zVPQs2KB6IbcFW/1fBN8M/GkAS xAnzuuqaEQkdr9ttwKTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bk-00HBZB-8I; Mon, 08 Nov 2021 18:43:04 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bA-00HBQ9-9c for linux-arm-kernel@lists.infradead.org; Mon, 08 Nov 2021 18:42:29 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="212332012" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="212332012" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 10:42:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="503150693" Received: from maru.jf.intel.com ([10.54.51.77]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2021 10:42:20 -0800 From: jae.hyun.yoo@intel.com To: Rob Herring , Corey Minyard , Joel Stanley , Andrew Jeffery , Cedric Le Goater , Haiyue Wang , ChiaWei Wang , Jae Hyun Yoo Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net Subject: [PATCH v3 5/6] dt-bindings: ipmi: aspeed, kcs-bmc: add 'clocks' as a required property Date: Mon, 8 Nov 2021 11:01:59 -0800 Message-Id: <20211108190200.290957-6-jae.hyun.yoo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108190200.290957-1-jae.hyun.yoo@intel.com> References: <20211108190200.290957-1-jae.hyun.yoo@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_104228_416706_AFEDC0B6 X-CRM114-Status: GOOD ( 12.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jae Hyun Yoo If LPC KCS driver is registered ahead of lpc-ctrl module, LPC KCS hardware 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 interrupts 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 drivers should enable LCLK individually so this patch adds 'clocks' property as one of required properties to enable the LCLK by the LPC KCS driver. Note: dtsi change in this patch series should be applied along with, and dtbs should be re-compiled after applying this series since it's adding a new required property otherwise the driver will not be probed correctly. Signed-off-by: Jae Hyun Yoo Reviewed-by: Rob Herring --- v2 -> v3: * Made commit message more descriptive. v1 -> v2: Changes sinve v1: * Added 'clocks' property into kcs-bmc bindings using 'aspeed,ast2400-kcs-bmc.yaml' because it's not merged into 'aspeed-lpc.yaml' yet. The bindings merging could be done using a separate patch later. .../devicetree/bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml b/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml index 4ff6fabfcb30..92ec0da047f4 100644 --- a/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml +++ b/Documentation/devicetree/bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml @@ -71,9 +71,14 @@ properties: $ref: '/schemas/types.yaml#/definitions/uint32' description: The host CPU IO map address + clocks: + maxItems: 1 + description: Reference clock for the LPC controller + required: - compatible - interrupts + - clocks additionalProperties: false @@ -96,6 +101,7 @@ allOf: examples: - | + #include #include kcs3: kcs@24 { compatible = "aspeed,ast2600-kcs-bmc"; @@ -103,4 +109,5 @@ examples: aspeed,lpc-io-reg = <0xca2>; aspeed,lpc-interrupts = <11 IRQ_TYPE_LEVEL_LOW>; interrupts = <8>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; }; From patchwork Mon Nov 8 19:02:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jae.hyun.yoo@intel.com X-Patchwork-Id: 12608959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 440E0C433F5 for ; Mon, 8 Nov 2021 18:44:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 153D561506 for ; Mon, 8 Nov 2021 18:44:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 153D561506 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AyTTnPysEqGQV9q3v9J8agGP2ukPDC73MbEbTYMg3ZY=; b=oQKj+NxZz5Y5F1 HFqbGZghMNmaihNzMRxuDDDjNpMH3hS55Hu/LuXV2QXt6uSScgQ8Qj+1x7T6xDcVIidHd1zw4M2so l9LAX4F/cM2YntV54VnoIl7oOcVLBlpsTHbF0r8EsYTNLTKugOAD86Z2eJOXj8k9EiLCGkEGaRjJy 3iDg+IIIFuM04Ro/H1/j09IuTqgdgAALEZfY3M72penB/o91EkAEQGdzFXPsoT5RSRZOPbg75r9AD F42ZMeODufHdLqTfi7nP2aUJLuOaOGULfETB1uDKEpJqqc/tm7I8W7dh2xBgskwX2uGw7rdnHkOW8 VSgP5kJzIl+ou4IkOo5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bw-00HBdu-K2; Mon, 08 Nov 2021 18:43:16 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mk9bA-00HBRb-DF for linux-arm-kernel@lists.infradead.org; Mon, 08 Nov 2021 18:42:30 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="212332014" X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="212332014" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2021 10:42:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,218,1631602800"; d="scan'208";a="503150696" Received: from maru.jf.intel.com ([10.54.51.77]) by orsmga008.jf.intel.com with ESMTP; 08 Nov 2021 10:42:20 -0800 From: jae.hyun.yoo@intel.com To: Rob Herring , Corey Minyard , Joel Stanley , Andrew Jeffery , Cedric Le Goater , Haiyue Wang , ChiaWei Wang , Jae Hyun Yoo Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net Subject: [PATCH v3 6/6] ipmi: kcs_bmc_aspeed: add clock control logic Date: Mon, 8 Nov 2021 11:02:00 -0800 Message-Id: <20211108190200.290957-7-jae.hyun.yoo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108190200.290957-1-jae.hyun.yoo@intel.com> References: <20211108190200.290957-1-jae.hyun.yoo@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211108_104228_563419_2F659823 X-CRM114-Status: GOOD ( 16.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jae Hyun Yoo If LPC KCS driver is registered ahead of lpc-ctrl module, LPC KCS 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 interrupts 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 drivers should enable LCLK individually so this patch adds clock control logic into the LPC KCS driver. Note: dtsi change in this patch series should be applied along with, and dtbs should be re-compiled after applying this series since it's adding a new required property otherwise this driver will not be probed correctly. Fixes: be2ed207e374 ("ipmi: add an Aspeed KCS IPMI BMC driver") Signed-off-by: Jae Hyun Yoo Reviewed-by: Joel Stanley --- v2 -> v3: * Simplified the -EPROBE_DEFER handling using dev_err_probe(). v1 -> v2: * No change. drivers/char/ipmi/kcs_bmc_aspeed.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/char/ipmi/kcs_bmc_aspeed.c b/drivers/char/ipmi/kcs_bmc_aspeed.c index 92a37b33494c..66c9f51ae611 100644 --- a/drivers/char/ipmi/kcs_bmc_aspeed.c +++ b/drivers/char/ipmi/kcs_bmc_aspeed.c @@ -6,6 +6,7 @@ #define pr_fmt(fmt) "aspeed-kcs-bmc: " fmt #include +#include #include #include #include @@ -126,6 +127,8 @@ struct aspeed_kcs_bmc { bool remove; struct timer_list timer; } obe; + + struct clk *clk; }; struct aspeed_kcs_of_ops { @@ -620,24 +623,34 @@ static int aspeed_kcs_probe(struct platform_device *pdev) return -ENODEV; } + priv->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(priv->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk), + "Couldn't get clock\n"); + rc = clk_prepare_enable(priv->clk); + if (rc) { + dev_err(&pdev->dev, "Couldn't enable clock\n"); + return rc; + } + spin_lock_init(&priv->obe.lock); priv->obe.remove = false; timer_setup(&priv->obe.timer, aspeed_kcs_check_obe, 0); rc = aspeed_kcs_set_address(kcs_bmc, addrs, nr_addrs); if (rc) - return rc; + goto err; /* Host to BMC IRQ */ rc = aspeed_kcs_config_downstream_irq(kcs_bmc, pdev); if (rc) - return rc; + goto err; /* BMC to Host IRQ */ if (have_upstream_irq) { rc = aspeed_kcs_config_upstream_irq(priv, upstream_irq[0], upstream_irq[1]); if (rc < 0) - return rc; + goto err; } else { priv->upstream_irq.mode = aspeed_kcs_irq_none; } @@ -650,13 +663,19 @@ static int aspeed_kcs_probe(struct platform_device *pdev) rc = kcs_bmc_add_device(&priv->kcs_bmc); if (rc) { dev_warn(&pdev->dev, "Failed to register channel %d: %d\n", kcs_bmc->channel, rc); - return rc; + goto err; } dev_info(&pdev->dev, "Initialised channel %d at 0x%x\n", kcs_bmc->channel, addrs[0]); return 0; + +err: + aspeed_kcs_enable_channel(kcs_bmc, false); + clk_disable_unprepare(priv->clk); + + return rc; } static int aspeed_kcs_remove(struct platform_device *pdev) @@ -664,6 +683,7 @@ static int aspeed_kcs_remove(struct platform_device *pdev) struct aspeed_kcs_bmc *priv = platform_get_drvdata(pdev); struct kcs_bmc_device *kcs_bmc = &priv->kcs_bmc; + clk_disable_unprepare(priv->clk); kcs_bmc_remove_device(kcs_bmc); aspeed_kcs_enable_channel(kcs_bmc, false);