Patch "soc: aspeed: snoop: Add clock control logic" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    soc: aspeed: snoop: Add clock control logic

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     soc-aspeed-snoop-add-clock-control-logic.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 68650a321e0daf06fb997da2a9757c5667565499
Author: Jae Hyun Yoo <jae.hyun.yoo@xxxxxxxxx>
Date:   Tue Dec 8 17:17:47 2020 +0800

    soc: aspeed: snoop: Add clock control logic
    
    [ 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 <jae.hyun.yoo@xxxxxxxxx>
    Signed-off-by: Vernon Mauery <vernon.mauery@xxxxxxxxxxxxxxx>
    Signed-off-by: John Wang <wangzhiqiang.bj@xxxxxxxxxxxxx>
    Reviewed-by: Joel Stanley <joel@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20201208091748.1920-1-wangzhiqiang.bj@xxxxxxxxxxxxx
    Signed-off-by: Joel Stanley <joel@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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 <linux/bitops.h>
+#include <linux/clk.h>
 #include <linux/interrupt.h>
 #include <linux/fs.h>
 #include <linux/kfifo.h>
@@ -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;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux