11802d0beSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2e2f744a8Sweiyi.lu@mediatek.com /*
3e2f744a8Sweiyi.lu@mediatek.com  * Copyright (c) 2017 MediaTek Inc.
4e2f744a8Sweiyi.lu@mediatek.com  * Author: Weiyi Lu <weiyi.lu@mediatek.com>
5e2f744a8Sweiyi.lu@mediatek.com  */
6e2f744a8Sweiyi.lu@mediatek.com 
7e2f744a8Sweiyi.lu@mediatek.com #include <linux/clk-provider.h>
8e2f744a8Sweiyi.lu@mediatek.com #include <linux/platform_device.h>
9e2f744a8Sweiyi.lu@mediatek.com 
10e2f744a8Sweiyi.lu@mediatek.com #include "clk-mtk.h"
11e2f744a8Sweiyi.lu@mediatek.com #include "clk-gate.h"
12e2f744a8Sweiyi.lu@mediatek.com 
13e2f744a8Sweiyi.lu@mediatek.com #include <dt-bindings/clock/mt2712-clk.h>
14e2f744a8Sweiyi.lu@mediatek.com 
15e2f744a8Sweiyi.lu@mediatek.com static const struct mtk_gate_regs mfg_cg_regs = {
16e2f744a8Sweiyi.lu@mediatek.com 	.set_ofs = 0x4,
17e2f744a8Sweiyi.lu@mediatek.com 	.clr_ofs = 0x8,
18e2f744a8Sweiyi.lu@mediatek.com 	.sta_ofs = 0x0,
19e2f744a8Sweiyi.lu@mediatek.com };
20e2f744a8Sweiyi.lu@mediatek.com 
214c85e20bSAngeloGioacchino Del Regno #define GATE_MFG(_id, _name, _parent, _shift)			\
224c85e20bSAngeloGioacchino Del Regno 	GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
23e2f744a8Sweiyi.lu@mediatek.com 
24e2f744a8Sweiyi.lu@mediatek.com static const struct mtk_gate mfg_clks[] = {
25e2f744a8Sweiyi.lu@mediatek.com 	GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0),
26e2f744a8Sweiyi.lu@mediatek.com };
27e2f744a8Sweiyi.lu@mediatek.com 
28f3e4e735SMiles Chen static const struct mtk_clk_desc mfg_desc = {
29f3e4e735SMiles Chen 	.clks = mfg_clks,
30f3e4e735SMiles Chen 	.num_clks = ARRAY_SIZE(mfg_clks),
31f3e4e735SMiles Chen };
32e2f744a8Sweiyi.lu@mediatek.com 
33e2f744a8Sweiyi.lu@mediatek.com static const struct of_device_id of_match_clk_mt2712_mfg[] = {
34f3e4e735SMiles Chen 	{
35f3e4e735SMiles Chen 		.compatible = "mediatek,mt2712-mfgcfg",
36f3e4e735SMiles Chen 		.data = &mfg_desc,
37f3e4e735SMiles Chen 	}, {
38f3e4e735SMiles Chen 		/* sentinel */
39f3e4e735SMiles Chen 	}
40e2f744a8Sweiyi.lu@mediatek.com };
4165c9ad77SAngeloGioacchino Del Regno MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_mfg);
42e2f744a8Sweiyi.lu@mediatek.com 
43e2f744a8Sweiyi.lu@mediatek.com static struct platform_driver clk_mt2712_mfg_drv = {
44f3e4e735SMiles Chen 	.probe = mtk_clk_simple_probe,
45*61ca6ee7SUwe Kleine-König 	.remove_new = mtk_clk_simple_remove,
46e2f744a8Sweiyi.lu@mediatek.com 	.driver = {
47e2f744a8Sweiyi.lu@mediatek.com 		.name = "clk-mt2712-mfg",
48e2f744a8Sweiyi.lu@mediatek.com 		.of_match_table = of_match_clk_mt2712_mfg,
49e2f744a8Sweiyi.lu@mediatek.com 	},
50e2f744a8Sweiyi.lu@mediatek.com };
51164d240dSAngeloGioacchino Del Regno module_platform_driver(clk_mt2712_mfg_drv);
52a451da86SAngeloGioacchino Del Regno MODULE_LICENSE("GPL");
53