Skip to content

Commit 7f621d2

Browse files
Chun-Jie Chenbebarino
authored andcommitted
clk: mediatek: Add MT8192 ipesys clock support
Add MT8192 ipesys clock provider Signed-off-by: Weiyi Lu <[email protected]> Signed-off-by: Chun-Jie Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ikjoon Jang <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 71193c4 commit 7f621d2

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

drivers/clk/mediatek/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,12 @@ config COMMON_CLK_MT8192_IMP_IIC_WRAP
532532
help
533533
This driver supports MediaTek MT8192 imp_iic_wrap clocks.
534534

535+
config COMMON_CLK_MT8192_IPESYS
536+
bool "Clock driver for MediaTek MT8192 ipesys"
537+
depends on COMMON_CLK_MT8192
538+
help
539+
This driver supports MediaTek MT8192 ipesys clocks.
540+
535541
config COMMON_CLK_MT8516
536542
bool "Clock driver for MediaTek MT8516"
537543
depends on ARCH_MEDIATEK || COMPILE_TEST

drivers/clk/mediatek/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@ obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
7272
obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
7373
obj-$(CONFIG_COMMON_CLK_MT8192_IMGSYS) += clk-mt8192-img.o
7474
obj-$(CONFIG_COMMON_CLK_MT8192_IMP_IIC_WRAP) += clk-mt8192-imp_iic_wrap.o
75+
obj-$(CONFIG_COMMON_CLK_MT8192_IPESYS) += clk-mt8192-ipe.o
7576
obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o
7677
obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o

drivers/clk/mediatek/clk-mt8192-ipe.c

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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 <linux/clk-provider.h>
7+
#include <linux/of_device.h>
8+
#include <linux/platform_device.h>
9+
10+
#include "clk-mtk.h"
11+
#include "clk-gate.h"
12+
13+
#include <dt-bindings/clock/mt8192-clk.h>
14+
15+
static const struct mtk_gate_regs ipe_cg_regs = {
16+
.set_ofs = 0x4,
17+
.clr_ofs = 0x8,
18+
.sta_ofs = 0x0,
19+
};
20+
21+
#define GATE_IPE(_id, _name, _parent, _shift) \
22+
GATE_MTK(_id, _name, _parent, &ipe_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
23+
24+
static const struct mtk_gate ipe_clks[] = {
25+
GATE_IPE(CLK_IPE_LARB19, "ipe_larb19", "ipe_sel", 0),
26+
GATE_IPE(CLK_IPE_LARB20, "ipe_larb20", "ipe_sel", 1),
27+
GATE_IPE(CLK_IPE_SMI_SUBCOM, "ipe_smi_subcom", "ipe_sel", 2),
28+
GATE_IPE(CLK_IPE_FD, "ipe_fd", "ipe_sel", 3),
29+
GATE_IPE(CLK_IPE_FE, "ipe_fe", "ipe_sel", 4),
30+
GATE_IPE(CLK_IPE_RSC, "ipe_rsc", "ipe_sel", 5),
31+
GATE_IPE(CLK_IPE_DPE, "ipe_dpe", "ipe_sel", 6),
32+
GATE_IPE(CLK_IPE_GALS, "ipe_gals", "ipe_sel", 8),
33+
};
34+
35+
static const struct mtk_clk_desc ipe_desc = {
36+
.clks = ipe_clks,
37+
.num_clks = ARRAY_SIZE(ipe_clks),
38+
};
39+
40+
static const struct of_device_id of_match_clk_mt8192_ipe[] = {
41+
{
42+
.compatible = "mediatek,mt8192-ipesys",
43+
.data = &ipe_desc,
44+
}, {
45+
/* sentinel */
46+
}
47+
};
48+
49+
static struct platform_driver clk_mt8192_ipe_drv = {
50+
.probe = mtk_clk_simple_probe,
51+
.driver = {
52+
.name = "clk-mt8192-ipe",
53+
.of_match_table = of_match_clk_mt8192_ipe,
54+
},
55+
};
56+
57+
builtin_platform_driver(clk_mt8192_ipe_drv);

0 commit comments

Comments
 (0)