1acddfc2cSWeiyi Lu // SPDX-License-Identifier: GPL-2.0 2acddfc2cSWeiyi Lu // 3acddfc2cSWeiyi Lu // Copyright (c) 2018 MediaTek Inc. 4acddfc2cSWeiyi Lu // Author: Weiyi Lu <weiyi.lu@mediatek.com> 5acddfc2cSWeiyi Lu 6acddfc2cSWeiyi Lu #include <linux/clk-provider.h> 7acddfc2cSWeiyi Lu #include <linux/platform_device.h> 8327aa741SWeiyi Lu #include <linux/pm_runtime.h> 9acddfc2cSWeiyi Lu 10acddfc2cSWeiyi Lu #include "clk-mtk.h" 11acddfc2cSWeiyi Lu #include "clk-gate.h" 12acddfc2cSWeiyi Lu 13acddfc2cSWeiyi Lu #include <dt-bindings/clock/mt8183-clk.h> 14acddfc2cSWeiyi Lu 15acddfc2cSWeiyi Lu static const struct mtk_gate_regs mfg_cg_regs = { 16acddfc2cSWeiyi Lu .set_ofs = 0x4, 17acddfc2cSWeiyi Lu .clr_ofs = 0x8, 18acddfc2cSWeiyi Lu .sta_ofs = 0x0, 19acddfc2cSWeiyi Lu }; 20acddfc2cSWeiyi Lu 21acddfc2cSWeiyi Lu #define GATE_MFG(_id, _name, _parent, _shift) \ 229f94f545SChen-Yu Tsai GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \ 239f94f545SChen-Yu Tsai &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT) 24acddfc2cSWeiyi Lu 25acddfc2cSWeiyi Lu static const struct mtk_gate mfg_clks[] = { 26acddfc2cSWeiyi Lu GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0) 27acddfc2cSWeiyi Lu }; 28acddfc2cSWeiyi Lu 29d36d697aSMiles Chen static const struct mtk_clk_desc mfg_desc = { 30d36d697aSMiles Chen .clks = mfg_clks, 31d36d697aSMiles Chen .num_clks = ARRAY_SIZE(mfg_clks), 32d36d697aSMiles Chen }; 33acddfc2cSWeiyi Lu 34acddfc2cSWeiyi Lu static const struct of_device_id of_match_clk_mt8183_mfg[] = { 35d36d697aSMiles Chen { 36d36d697aSMiles Chen .compatible = "mediatek,mt8183-mfgcfg", 37d36d697aSMiles Chen .data = &mfg_desc, 38d36d697aSMiles Chen }, { 39d36d697aSMiles Chen /* sentinel */ 40d36d697aSMiles Chen } 41acddfc2cSWeiyi Lu }; 4265c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt8183_mfg); 43acddfc2cSWeiyi Lu 44acddfc2cSWeiyi Lu static struct platform_driver clk_mt8183_mfg_drv = { 45d36d697aSMiles Chen .probe = mtk_clk_simple_probe, 46*61ca6ee7SUwe Kleine-König .remove_new = mtk_clk_simple_remove, 47acddfc2cSWeiyi Lu .driver = { 48acddfc2cSWeiyi Lu .name = "clk-mt8183-mfg", 49acddfc2cSWeiyi Lu .of_match_table = of_match_clk_mt8183_mfg, 50acddfc2cSWeiyi Lu }, 51acddfc2cSWeiyi Lu }; 52164d240dSAngeloGioacchino Del Regno module_platform_driver(clk_mt8183_mfg_drv); 53a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL"); 54