1*87d06fa9SGarmin.Chang // SPDX-License-Identifier: GPL-2.0-only 2*87d06fa9SGarmin.Chang /* 3*87d06fa9SGarmin.Chang * Copyright (c) 2022 MediaTek Inc. 4*87d06fa9SGarmin.Chang * Author: Garmin Chang <garmin.chang@mediatek.com> 5*87d06fa9SGarmin.Chang */ 6*87d06fa9SGarmin.Chang 7*87d06fa9SGarmin.Chang #include <dt-bindings/clock/mediatek,mt8188-clk.h> 8*87d06fa9SGarmin.Chang #include <linux/clk-provider.h> 9*87d06fa9SGarmin.Chang #include <linux/platform_device.h> 10*87d06fa9SGarmin.Chang 11*87d06fa9SGarmin.Chang #include "clk-gate.h" 12*87d06fa9SGarmin.Chang #include "clk-mtk.h" 13*87d06fa9SGarmin.Chang 14*87d06fa9SGarmin.Chang static const struct mtk_gate_regs ccu_cg_regs = { 15*87d06fa9SGarmin.Chang .set_ofs = 0x4, 16*87d06fa9SGarmin.Chang .clr_ofs = 0x8, 17*87d06fa9SGarmin.Chang .sta_ofs = 0x0, 18*87d06fa9SGarmin.Chang }; 19*87d06fa9SGarmin.Chang 20*87d06fa9SGarmin.Chang #define GATE_CCU(_id, _name, _parent, _shift) \ 21*87d06fa9SGarmin.Chang GATE_MTK(_id, _name, _parent, &ccu_cg_regs, _shift, &mtk_clk_gate_ops_setclr) 22*87d06fa9SGarmin.Chang 23*87d06fa9SGarmin.Chang static const struct mtk_gate ccu_clks[] = { 24*87d06fa9SGarmin.Chang GATE_CCU(CLK_CCU_LARB27, "ccu_larb27", "top_ccu", 0), 25*87d06fa9SGarmin.Chang GATE_CCU(CLK_CCU_AHB, "ccu_ahb", "top_ccu", 1), 26*87d06fa9SGarmin.Chang GATE_CCU(CLK_CCU_CCU0, "ccu_ccu0", "top_ccu", 2), 27*87d06fa9SGarmin.Chang }; 28*87d06fa9SGarmin.Chang 29*87d06fa9SGarmin.Chang static const struct mtk_clk_desc ccu_desc = { 30*87d06fa9SGarmin.Chang .clks = ccu_clks, 31*87d06fa9SGarmin.Chang .num_clks = ARRAY_SIZE(ccu_clks), 32*87d06fa9SGarmin.Chang }; 33*87d06fa9SGarmin.Chang 34*87d06fa9SGarmin.Chang static const struct of_device_id of_match_clk_mt8188_ccu[] = { 35*87d06fa9SGarmin.Chang { .compatible = "mediatek,mt8188-ccusys", .data = &ccu_desc }, 36*87d06fa9SGarmin.Chang { /* sentinel */ } 37*87d06fa9SGarmin.Chang }; 38*87d06fa9SGarmin.Chang MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_ccu); 39*87d06fa9SGarmin.Chang 40*87d06fa9SGarmin.Chang static struct platform_driver clk_mt8188_ccu_drv = { 41*87d06fa9SGarmin.Chang .probe = mtk_clk_simple_probe, 42*87d06fa9SGarmin.Chang .remove_new = mtk_clk_simple_remove, 43*87d06fa9SGarmin.Chang .driver = { 44*87d06fa9SGarmin.Chang .name = "clk-mt8188-ccu", 45*87d06fa9SGarmin.Chang .of_match_table = of_match_clk_mt8188_ccu, 46*87d06fa9SGarmin.Chang }, 47*87d06fa9SGarmin.Chang }; 48*87d06fa9SGarmin.Chang 49*87d06fa9SGarmin.Chang module_platform_driver(clk_mt8188_ccu_drv); 50*87d06fa9SGarmin.Chang MODULE_LICENSE("GPL"); 51