1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright (c) 2022 MediaTek Inc. 4 * Author: Garmin Chang <garmin.chang@mediatek.com> 5 */ 6 7 #include <dt-bindings/clock/mediatek,mt8188-clk.h> 8 #include <linux/clk-provider.h> 9 #include <linux/platform_device.h> 10 11 #include "clk-gate.h" 12 #include "clk-mtk.h" 13 14 static const struct mtk_gate_regs mfgcfg_cg_regs = { 15 .set_ofs = 0x4, 16 .clr_ofs = 0x8, 17 .sta_ofs = 0x0, 18 }; 19 20 #define GATE_MFG(_id, _name, _parent, _shift) \ 21 GATE_MTK_FLAGS(_id, _name, _parent, &mfgcfg_cg_regs, _shift, \ 22 &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT) 23 24 static const struct mtk_gate mfgcfg_clks[] = { 25 GATE_MFG(CLK_MFGCFG_BG3D, "mfgcfg_bg3d", "mfg_ck_fast_ref", 0), 26 }; 27 28 static const struct mtk_clk_desc mfgcfg_desc = { 29 .clks = mfgcfg_clks, 30 .num_clks = ARRAY_SIZE(mfgcfg_clks), 31 }; 32 33 static const struct of_device_id of_match_clk_mt8188_mfgcfg[] = { 34 { .compatible = "mediatek,mt8188-mfgcfg", .data = &mfgcfg_desc }, 35 { /* sentinel */ } 36 }; 37 MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_mfgcfg); 38 39 static struct platform_driver clk_mt8188_mfgcfg_drv = { 40 .probe = mtk_clk_simple_probe, 41 .remove = mtk_clk_simple_remove, 42 .driver = { 43 .name = "clk-mt8188-mfgcfg", 44 .of_match_table = of_match_clk_mt8188_mfgcfg, 45 }, 46 }; 47 48 module_platform_driver(clk_mt8188_mfgcfg_drv); 49 50 MODULE_DESCRIPTION("MediaTek MT8186 GPU mfg clocks driver"); 51 MODULE_LICENSE("GPL"); 52