1d9943b6dSChun-Jie Chen // SPDX-License-Identifier: GPL-2.0-only
2d9943b6dSChun-Jie Chen //
3d9943b6dSChun-Jie Chen // Copyright (c) 2021 MediaTek Inc.
4d9943b6dSChun-Jie Chen // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com>
5d9943b6dSChun-Jie Chen 
6d9943b6dSChun-Jie Chen #include "clk-gate.h"
7d9943b6dSChun-Jie Chen #include "clk-mtk.h"
8d9943b6dSChun-Jie Chen 
9d9943b6dSChun-Jie Chen #include <dt-bindings/clock/mt8195-clk.h>
10d9943b6dSChun-Jie Chen #include <linux/clk-provider.h>
11d9943b6dSChun-Jie Chen #include <linux/platform_device.h>
12d9943b6dSChun-Jie Chen 
13d9943b6dSChun-Jie Chen static const struct mtk_gate_regs ipe_cg_regs = {
14d9943b6dSChun-Jie Chen 	.set_ofs = 0x0,
15d9943b6dSChun-Jie Chen 	.clr_ofs = 0x0,
16d9943b6dSChun-Jie Chen 	.sta_ofs = 0x0,
17d9943b6dSChun-Jie Chen };
18d9943b6dSChun-Jie Chen 
19d9943b6dSChun-Jie Chen #define GATE_IPE(_id, _name, _parent, _shift)			\
20d9943b6dSChun-Jie Chen 	GATE_MTK(_id, _name, _parent, &ipe_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
21d9943b6dSChun-Jie Chen 
22d9943b6dSChun-Jie Chen static const struct mtk_gate ipe_clks[] = {
23d9943b6dSChun-Jie Chen 	GATE_IPE(CLK_IPE_DPE, "ipe_dpe", "top_ipe", 0),
24d9943b6dSChun-Jie Chen 	GATE_IPE(CLK_IPE_FDVT, "ipe_fdvt", "top_ipe", 1),
25d9943b6dSChun-Jie Chen 	GATE_IPE(CLK_IPE_ME, "ipe_me", "top_ipe", 2),
26d9943b6dSChun-Jie Chen 	GATE_IPE(CLK_IPE_TOP, "ipe_top", "top_ipe", 3),
27d9943b6dSChun-Jie Chen 	GATE_IPE(CLK_IPE_SMI_LARB12, "ipe_smi_larb12", "top_ipe", 4),
28d9943b6dSChun-Jie Chen };
29d9943b6dSChun-Jie Chen 
30d9943b6dSChun-Jie Chen static const struct mtk_clk_desc ipe_desc = {
31d9943b6dSChun-Jie Chen 	.clks = ipe_clks,
32d9943b6dSChun-Jie Chen 	.num_clks = ARRAY_SIZE(ipe_clks),
33d9943b6dSChun-Jie Chen };
34d9943b6dSChun-Jie Chen 
35d9943b6dSChun-Jie Chen static const struct of_device_id of_match_clk_mt8195_ipe[] = {
36d9943b6dSChun-Jie Chen 	{
37d9943b6dSChun-Jie Chen 		.compatible = "mediatek,mt8195-ipesys",
38d9943b6dSChun-Jie Chen 		.data = &ipe_desc,
39d9943b6dSChun-Jie Chen 	}, {
40d9943b6dSChun-Jie Chen 		/* sentinel */
41d9943b6dSChun-Jie Chen 	}
42d9943b6dSChun-Jie Chen };
43d9943b6dSChun-Jie Chen 
44d9943b6dSChun-Jie Chen static struct platform_driver clk_mt8195_ipe_drv = {
45d9943b6dSChun-Jie Chen 	.probe = mtk_clk_simple_probe,
46cd3a77a0SChen-Yu Tsai 	.remove = mtk_clk_simple_remove,
47d9943b6dSChun-Jie Chen 	.driver = {
48d9943b6dSChun-Jie Chen 		.name = "clk-mt8195-ipe",
49d9943b6dSChun-Jie Chen 		.of_match_table = of_match_clk_mt8195_ipe,
50d9943b6dSChun-Jie Chen 	},
51d9943b6dSChun-Jie Chen };
52164d240dSAngeloGioacchino Del Regno module_platform_driver(clk_mt8195_ipe_drv);
53*a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL");
54