From 11d324c8a9a68cbb10dbc87f757303dca074c1dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?=
 <nfraprado@collabora.com>
Date: Tue, 8 Feb 2022 10:43:16 -0500
Subject: [PATCH] STOPSHIP: clk: mediatek: mt8192-msdc: Set CLK_IGNORE_UNUSED
 on CLK_MSDC_AXI_WRAP
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

During clk_disable_unused(), the status of CLK_MSDC_AXI_WRAP is read in
order to determine whether it should be disabled. However, the simple
act of reading this clock, causes i2c0 to fail subsequent operations.

Set the CLK_IGNORE_UNUSED on this clock so it is not even read, fixing
the side-effect issue in the i2c0 bus.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
 drivers/clk/mediatek/clk-mt8192-msdc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/clk/mediatek/clk-mt8192-msdc.c b/drivers/clk/mediatek/clk-mt8192-msdc.c
index 87c3b79b79cfb..ec3e0b086ba24 100644
--- a/drivers/clk/mediatek/clk-mt8192-msdc.c
+++ b/drivers/clk/mediatek/clk-mt8192-msdc.c
@@ -24,14 +24,11 @@ static const struct mtk_gate_regs msdc_top_cg_regs = {
 	.sta_ofs = 0x0,
 };
 
-#define GATE_MSDC(_id, _name, _parent, _shift)	\
-	GATE_MTK(_id, _name, _parent, &msdc_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
-
 #define GATE_MSDC_TOP(_id, _name, _parent, _shift)	\
 	GATE_MTK(_id, _name, _parent, &msdc_top_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
 
 static const struct mtk_gate msdc_clks[] = {
-	GATE_MSDC(CLK_MSDC_AXI_WRAP, "msdc_axi_wrap", "axi_sel", 22),
+	GATE_MTK_FLAGS(CLK_MSDC_AXI_WRAP, "msdc_axi_wrap", "axi_sel", &msdc_cg_regs, 22, &mtk_clk_gate_ops_no_setclr_inv, CLK_IGNORE_UNUSED),
 };
 
 static const struct mtk_gate msdc_top_clks[] = {
-- 
GitLab