1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2019 MediaTek Inc.
4 * Author: Wendell Lin <wendell.lin@mediatek.com>
7 #include <linux/clk-provider.h>
8 #include <linux/platform_device.h>
9 #include <dt-bindings/clock/mt6779-clk.h>
14 static const struct mtk_gate_regs ipe_cg_regs
= {
20 #define GATE_IPE(_id, _name, _parent, _shift) \
21 GATE_MTK(_id, _name, _parent, &ipe_cg_regs, _shift, \
22 &mtk_clk_gate_ops_setclr)
24 static const struct mtk_gate ipe_clks
[] = {
25 GATE_IPE(CLK_IPE_LARB7
, "ipe_larb7", "ipe_sel", 0),
26 GATE_IPE(CLK_IPE_LARB8
, "ipe_larb8", "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),
34 static const struct of_device_id of_match_clk_mt6779_ipe
[] = {
35 { .compatible
= "mediatek,mt6779-ipesys", },
39 static int clk_mt6779_ipe_probe(struct platform_device
*pdev
)
41 struct clk_onecell_data
*clk_data
;
42 struct device_node
*node
= pdev
->dev
.of_node
;
44 clk_data
= mtk_alloc_clk_data(CLK_IPE_NR_CLK
);
46 mtk_clk_register_gates(node
, ipe_clks
, ARRAY_SIZE(ipe_clks
),
49 return of_clk_add_provider(node
, of_clk_src_onecell_get
, clk_data
);
52 static struct platform_driver clk_mt6779_ipe_drv
= {
53 .probe
= clk_mt6779_ipe_probe
,
55 .name
= "clk-mt6779-ipe",
56 .of_match_table
= of_match_clk_mt6779_ipe
,
60 builtin_platform_driver(clk_mt6779_ipe_drv
);