1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (c) 2018 MediaTek Inc. 4 * Author: Sean Wang <sean.wang@mediatek.com> 5 * 6 */ 7 8 #include <linux/clk-provider.h> 9 #include <linux/of.h> 10 #include <linux/of_address.h> 11 #include <linux/of_device.h> 12 #include <linux/platform_device.h> 13 14 #include "clk-mtk.h" 15 #include "clk-gate.h" 16 17 #include <dt-bindings/clock/mt2701-clk.h> 18 19 #define GATE_G3D(_id, _name, _parent, _shift) \ 20 GATE_MTK(_id, _name, _parent, &g3d_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 21 22 static const struct mtk_gate_regs g3d_cg_regs = { 23 .sta_ofs = 0x0, 24 .set_ofs = 0x4, 25 .clr_ofs = 0x8, 26 }; 27 28 static const struct mtk_gate g3d_clks[] = { 29 GATE_DUMMY(CLK_DUMMY, "g3d_dummy"), 30 GATE_G3D(CLK_G3DSYS_CORE, "g3d_core", "mfg_sel", 0), 31 }; 32 33 static u16 rst_ofs[] = { 0xc, }; 34 35 static const struct mtk_clk_rst_desc clk_rst_desc = { 36 .version = MTK_RST_SIMPLE, 37 .rst_bank_ofs = rst_ofs, 38 .rst_bank_nr = ARRAY_SIZE(rst_ofs), 39 }; 40 41 static const struct mtk_clk_desc g3d_desc = { 42 .clks = g3d_clks, 43 .num_clks = ARRAY_SIZE(g3d_clks), 44 .rst_desc = &clk_rst_desc, 45 }; 46 47 static const struct of_device_id of_match_clk_mt2701_g3d[] = { 48 { .compatible = "mediatek,mt2701-g3dsys", .data = &g3d_desc }, 49 { /* sentinel */ } 50 }; 51 MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_g3d); 52 53 static struct platform_driver clk_mt2701_g3d_drv = { 54 .probe = mtk_clk_simple_probe, 55 .remove_new = mtk_clk_simple_remove, 56 .driver = { 57 .name = "clk-mt2701-g3d", 58 .of_match_table = of_match_clk_mt2701_g3d, 59 }, 60 }; 61 module_platform_driver(clk_mt2701_g3d_drv); 62 MODULE_LICENSE("GPL"); 63