Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 //
0003 // Copyright (c) 2021 MediaTek Inc.
0004 // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com>
0005 
0006 #include "clk-gate.h"
0007 #include "clk-mtk.h"
0008 
0009 #include <dt-bindings/clock/mt8195-clk.h>
0010 #include <linux/clk-provider.h>
0011 #include <linux/platform_device.h>
0012 
0013 static const struct mtk_gate_regs imp_iic_wrap_cg_regs = {
0014     .set_ofs = 0xe08,
0015     .clr_ofs = 0xe04,
0016     .sta_ofs = 0xe00,
0017 };
0018 
0019 #define GATE_IMP_IIC_WRAP(_id, _name, _parent, _shift)              \
0020     GATE_MTK_FLAGS(_id, _name, _parent, &imp_iic_wrap_cg_regs, _shift,  \
0021         &mtk_clk_gate_ops_setclr, CLK_OPS_PARENT_ENABLE)
0022 
0023 static const struct mtk_gate imp_iic_wrap_s_clks[] = {
0024     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C5, "imp_iic_wrap_s_i2c5", "top_i2c", 0),
0025     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C6, "imp_iic_wrap_s_i2c6", "top_i2c", 1),
0026     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C7, "imp_iic_wrap_s_i2c7", "top_i2c", 2),
0027 };
0028 
0029 static const struct mtk_gate imp_iic_wrap_w_clks[] = {
0030     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C0, "imp_iic_wrap_w_i2c0", "top_i2c", 0),
0031     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C1, "imp_iic_wrap_w_i2c1", "top_i2c", 1),
0032     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C2, "imp_iic_wrap_w_i2c2", "top_i2c", 2),
0033     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C3, "imp_iic_wrap_w_i2c3", "top_i2c", 3),
0034     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C4, "imp_iic_wrap_w_i2c4", "top_i2c", 4),
0035 };
0036 
0037 static const struct mtk_clk_desc imp_iic_wrap_s_desc = {
0038     .clks = imp_iic_wrap_s_clks,
0039     .num_clks = ARRAY_SIZE(imp_iic_wrap_s_clks),
0040 };
0041 
0042 static const struct mtk_clk_desc imp_iic_wrap_w_desc = {
0043     .clks = imp_iic_wrap_w_clks,
0044     .num_clks = ARRAY_SIZE(imp_iic_wrap_w_clks),
0045 };
0046 
0047 static const struct of_device_id of_match_clk_mt8195_imp_iic_wrap[] = {
0048     {
0049         .compatible = "mediatek,mt8195-imp_iic_wrap_s",
0050         .data = &imp_iic_wrap_s_desc,
0051     }, {
0052         .compatible = "mediatek,mt8195-imp_iic_wrap_w",
0053         .data = &imp_iic_wrap_w_desc,
0054     }, {
0055         /* sentinel */
0056     }
0057 };
0058 
0059 static struct platform_driver clk_mt8195_imp_iic_wrap_drv = {
0060     .probe = mtk_clk_simple_probe,
0061     .remove = mtk_clk_simple_remove,
0062     .driver = {
0063         .name = "clk-mt8195-imp_iic_wrap",
0064         .of_match_table = of_match_clk_mt8195_imp_iic_wrap,
0065     },
0066 };
0067 builtin_platform_driver(clk_mt8195_imp_iic_wrap_drv);