Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 //
0003 // Copyright (c) 2022 MediaTek Inc.
0004 // Author: Chun-Jie Chen <chun-jie.chen@mediatek.com>
0005 
0006 #include <linux/clk-provider.h>
0007 #include <linux/platform_device.h>
0008 #include <dt-bindings/clock/mt8186-clk.h>
0009 
0010 #include "clk-gate.h"
0011 #include "clk-mtk.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(_id, _name, _parent, &imp_iic_wrap_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
0021 
0022 static const struct mtk_gate imp_iic_wrap_clks[] = {
0023     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C0,
0024         "imp_iic_wrap_ap_clock_i2c0", "infra_ao_i2c_ap", 0),
0025     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C1,
0026         "imp_iic_wrap_ap_clock_i2c1", "infra_ao_i2c_ap", 1),
0027     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C2,
0028         "imp_iic_wrap_ap_clock_i2c2", "infra_ao_i2c_ap", 2),
0029     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C3,
0030         "imp_iic_wrap_ap_clock_i2c3", "infra_ao_i2c_ap", 3),
0031     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C4,
0032         "imp_iic_wrap_ap_clock_i2c4", "infra_ao_i2c_ap", 4),
0033     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C5,
0034         "imp_iic_wrap_ap_clock_i2c5", "infra_ao_i2c_ap", 5),
0035     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C6,
0036         "imp_iic_wrap_ap_clock_i2c6", "infra_ao_i2c_ap", 6),
0037     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C7,
0038         "imp_iic_wrap_ap_clock_i2c7", "infra_ao_i2c_ap", 7),
0039     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C8,
0040         "imp_iic_wrap_ap_clock_i2c8", "infra_ao_i2c_ap", 8),
0041     GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C9,
0042         "imp_iic_wrap_ap_clock_i2c9", "infra_ao_i2c_ap", 9),
0043 };
0044 
0045 static const struct mtk_clk_desc imp_iic_wrap_desc = {
0046     .clks = imp_iic_wrap_clks,
0047     .num_clks = ARRAY_SIZE(imp_iic_wrap_clks),
0048 };
0049 
0050 static const struct of_device_id of_match_clk_mt8186_imp_iic_wrap[] = {
0051     {
0052         .compatible = "mediatek,mt8186-imp_iic_wrap",
0053         .data = &imp_iic_wrap_desc,
0054     }, {
0055         /* sentinel */
0056     }
0057 };
0058 
0059 static struct platform_driver clk_mt8186_imp_iic_wrap_drv = {
0060     .probe = mtk_clk_simple_probe,
0061     .remove = mtk_clk_simple_remove,
0062     .driver = {
0063         .name = "clk-mt8186-imp_iic_wrap",
0064         .of_match_table = of_match_clk_mt8186_imp_iic_wrap,
0065     },
0066 };
0067 builtin_platform_driver(clk_mt8186_imp_iic_wrap_drv);