aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-5.15/855-pending-i2c-mt65xx-add-additional-clocks.patch
blob: 1ed8d1a96a336307c737e639493047a14a6fdb10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 94bf61df9201195d6d8ce82e299fb231b31fbaae Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Fri, 26 May 2023 10:29:45 +0100
Subject: [PATCH] i2c: mt65xx: add additional clocks

On MT7981 additional clocks are required when accessing I2C registers.
Add MCK and PCK optional clocks to i2c-mt65xx driver so we don't have
to always have them enabled, but really only if I2C is used.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/i2c/busses/i2c-mt65xx.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -93,6 +93,8 @@
  * @I2C_MT65XX_CLK_DMA:  DMA clock for i2c via DMA
  * @I2C_MT65XX_CLK_PMIC: PMIC clock for i2c from PMIC
  * @I2C_MT65XX_CLK_ARB:  Arbitrator clock for i2c
+ * @I2C_MT65XX_CLK_MCK:  MCK clock for i2c
+ * @I2C_MT65XX_CLK_PCK:  PCK clock for i2c
  * @I2C_MT65XX_CLK_MAX:  Number of supported clocks
  */
 enum i2c_mt65xx_clks {
@@ -100,11 +102,13 @@ enum i2c_mt65xx_clks {
 	I2C_MT65XX_CLK_DMA,
 	I2C_MT65XX_CLK_PMIC,
 	I2C_MT65XX_CLK_ARB,
+	I2C_MT65XX_CLK_MCK,
+	I2C_MT65XX_CLK_PCK,
 	I2C_MT65XX_CLK_MAX
 };
 
 static const char * const i2c_mt65xx_clk_ids[I2C_MT65XX_CLK_MAX] = {
-	"main", "dma", "pmic", "arb"
+	"main", "dma", "pmic", "arb", "mck", "pck"
 };
 
 enum DMA_REGS_OFFSET {
@@ -1444,6 +1448,14 @@ static int mtk_i2c_probe(struct platform
 	if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk))
 		return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk);
 
+	i2c->clocks[I2C_MT65XX_CLK_MCK].clk = devm_clk_get_optional(&pdev->dev, "mck");
+	if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk))
+		return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk);
+
+	i2c->clocks[I2C_MT65XX_CLK_PCK].clk = devm_clk_get_optional(&pdev->dev, "pck");
+	if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk))
+		return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk);
+
 	if (i2c->have_pmic) {
 		i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get(&pdev->dev, "pmic");
 		if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) {