clk-mt8195-imp_iic_wrap.c 2.2 KB

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