|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
| 2 | +// |
| 3 | +// Copyright (c) 2021 MediaTek Inc. |
| 4 | +// Author: Chun-Jie Chen <[email protected]> |
| 5 | + |
| 6 | +#include "clk-gate.h" |
| 7 | +#include "clk-mtk.h" |
| 8 | + |
| 9 | +#include <dt-bindings/clock/mt8195-clk.h> |
| 10 | +#include <linux/clk-provider.h> |
| 11 | +#include <linux/platform_device.h> |
| 12 | + |
| 13 | +#include <dt-bindings/clock/mt8195-clk.h> |
| 14 | + |
| 15 | +static const struct mtk_gate_regs imp_iic_wrap_cg_regs = { |
| 16 | + .set_ofs = 0xe08, |
| 17 | + .clr_ofs = 0xe04, |
| 18 | + .sta_ofs = 0xe00, |
| 19 | +}; |
| 20 | + |
| 21 | +#define GATE_IMP_IIC_WRAP(_id, _name, _parent, _shift) \ |
| 22 | + GATE_MTK_FLAGS(_id, _name, _parent, &imp_iic_wrap_cg_regs, _shift, \ |
| 23 | + &mtk_clk_gate_ops_setclr, CLK_OPS_PARENT_ENABLE) |
| 24 | + |
| 25 | +static const struct mtk_gate imp_iic_wrap_s_clks[] = { |
| 26 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C5, "imp_iic_wrap_s_i2c5", "top_i2c", 0), |
| 27 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C6, "imp_iic_wrap_s_i2c6", "top_i2c", 1), |
| 28 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_S_I2C7, "imp_iic_wrap_s_i2c7", "top_i2c", 2), |
| 29 | +}; |
| 30 | + |
| 31 | +static const struct mtk_gate imp_iic_wrap_w_clks[] = { |
| 32 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C0, "imp_iic_wrap_w_i2c0", "top_i2c", 0), |
| 33 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C1, "imp_iic_wrap_w_i2c1", "top_i2c", 1), |
| 34 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C2, "imp_iic_wrap_w_i2c2", "top_i2c", 2), |
| 35 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C3, "imp_iic_wrap_w_i2c3", "top_i2c", 3), |
| 36 | + GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_W_I2C4, "imp_iic_wrap_w_i2c4", "top_i2c", 4), |
| 37 | +}; |
| 38 | + |
| 39 | +static const struct mtk_clk_desc imp_iic_wrap_s_desc = { |
| 40 | + .clks = imp_iic_wrap_s_clks, |
| 41 | + .num_clks = ARRAY_SIZE(imp_iic_wrap_s_clks), |
| 42 | +}; |
| 43 | + |
| 44 | +static const struct mtk_clk_desc imp_iic_wrap_w_desc = { |
| 45 | + .clks = imp_iic_wrap_w_clks, |
| 46 | + .num_clks = ARRAY_SIZE(imp_iic_wrap_w_clks), |
| 47 | +}; |
| 48 | + |
| 49 | +static const struct of_device_id of_match_clk_mt8195_imp_iic_wrap[] = { |
| 50 | + { |
| 51 | + .compatible = "mediatek,mt8195-imp_iic_wrap_s", |
| 52 | + .data = &imp_iic_wrap_s_desc, |
| 53 | + }, { |
| 54 | + .compatible = "mediatek,mt8195-imp_iic_wrap_w", |
| 55 | + .data = &imp_iic_wrap_w_desc, |
| 56 | + }, { |
| 57 | + /* sentinel */ |
| 58 | + } |
| 59 | +}; |
| 60 | + |
| 61 | +static struct platform_driver clk_mt8195_imp_iic_wrap_drv = { |
| 62 | + .probe = mtk_clk_simple_probe, |
| 63 | + .driver = { |
| 64 | + .name = "clk-mt8195-imp_iic_wrap", |
| 65 | + .of_match_table = of_match_clk_mt8195_imp_iic_wrap, |
| 66 | + }, |
| 67 | +}; |
| 68 | +builtin_platform_driver(clk_mt8195_imp_iic_wrap_drv); |
0 commit comments