Skip to content

Commit 222e0fb

Browse files
Chun-Jie Chenbebarino
authored andcommitted
clk: mediatek: Add MT8195 imp i2c wrapper clock support
Add MT8195 imp i2c wrapper clock controllers which provide clock gate control in I2C IP blocks. Signed-off-by: Chun-Jie Chen <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 993e9a7 commit 222e0fb

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

drivers/clk/mediatek/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ obj-$(CONFIG_COMMON_CLK_MT8195) += clk-mt8195-apmixedsys.o clk-mt8195-topckgen.o
8686
clk-mt8195-ipe.o clk-mt8195-mfg.o clk-mt8195-scp_adsp.o \
8787
clk-mt8195-vdec.o clk-mt8195-vdo0.o clk-mt8195-vdo1.o \
8888
clk-mt8195-venc.o clk-mt8195-vpp0.o clk-mt8195-vpp1.o \
89-
clk-mt8195-wpe.o
89+
clk-mt8195-wpe.o clk-mt8195-imp_iic_wrap.o
9090
obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o
9191
obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
//
3+
// Copyright (c) 2021 MediaTek Inc.
4+
// Author: Chun-Jie Chen <[email protected]>
5+
6+
#include "clk-gate.h"
7+
#include "clk-mtk.h"
8+
9+
#include <dt-bindings/clock/mt8195-clk.h>
10+
#include <linux/clk-provider.h>
11+
#include <linux/platform_device.h>
12+
13+
#include <dt-bindings/clock/mt8195-clk.h>
14+
15+
static const struct mtk_gate_regs imp_iic_wrap_cg_regs = {
16+
.set_ofs = 0xe08,
17+
.clr_ofs = 0xe04,
18+
.sta_ofs = 0xe00,
19+
};
20+
21+
#define GATE_IMP_IIC_WRAP(_id, _name, _parent, _shift) \
22+
GATE_MTK_FLAGS(_id, _name, _parent, &imp_iic_wrap_cg_regs, _shift, \
23+
&mtk_clk_gate_ops_setclr, CLK_OPS_PARENT_ENABLE)
24+
25+
static const struct mtk_gate imp_iic_wrap_s_clks[] = {
26+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C5, "imp_iic_wrap_s_i2c5", "top_i2c", 0),
27+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C6, "imp_iic_wrap_s_i2c6", "top_i2c", 1),
28+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C7, "imp_iic_wrap_s_i2c7", "top_i2c", 2),
29+
};
30+
31+
static const struct mtk_gate imp_iic_wrap_w_clks[] = {
32+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C0, "imp_iic_wrap_w_i2c0", "top_i2c", 0),
33+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C1, "imp_iic_wrap_w_i2c1", "top_i2c", 1),
34+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C2, "imp_iic_wrap_w_i2c2", "top_i2c", 2),
35+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C3, "imp_iic_wrap_w_i2c3", "top_i2c", 3),
36+
GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C4, "imp_iic_wrap_w_i2c4", "top_i2c", 4),
37+
};
38+
39+
static const struct mtk_clk_desc imp_iic_wrap_s_desc = {
40+
.clks = imp_iic_wrap_s_clks,
41+
.num_clks = ARRAY_SIZE(imp_iic_wrap_s_clks),
42+
};
43+
44+
static const struct mtk_clk_desc imp_iic_wrap_w_desc = {
45+
.clks = imp_iic_wrap_w_clks,
46+
.num_clks = ARRAY_SIZE(imp_iic_wrap_w_clks),
47+
};
48+
49+
static const struct of_device_id of_match_clk_mt8195_imp_iic_wrap[] = {
50+
{
51+
.compatible = "mediatek,mt8195-imp_iic_wrap_s",
52+
.data = &imp_iic_wrap_s_desc,
53+
}, {
54+
.compatible = "mediatek,mt8195-imp_iic_wrap_w",
55+
.data = &imp_iic_wrap_w_desc,
56+
}, {
57+
/* sentinel */
58+
}
59+
};
60+
61+
static struct platform_driver clk_mt8195_imp_iic_wrap_drv = {
62+
.probe = mtk_clk_simple_probe,
63+
.driver = {
64+
.name = "clk-mt8195-imp_iic_wrap",
65+
.of_match_table = of_match_clk_mt8195_imp_iic_wrap,
66+
},
67+
};
68+
builtin_platform_driver(clk_mt8195_imp_iic_wrap_drv);

0 commit comments

Comments
 (0)