clk-mt8186-imp_iic_wrap.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. //
  3. // Copyright (c) 2022 MediaTek Inc.
  4. // Author: Chun-Jie Chen <[email protected]>
  5. #include <linux/clk-provider.h>
  6. #include <linux/platform_device.h>
  7. #include <dt-bindings/clock/mt8186-clk.h>
  8. #include "clk-gate.h"
  9. #include "clk-mtk.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(_id, _name, _parent, &imp_iic_wrap_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
  17. static const struct mtk_gate imp_iic_wrap_clks[] = {
  18. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C0,
  19. "imp_iic_wrap_ap_clock_i2c0", "infra_ao_i2c_ap", 0),
  20. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C1,
  21. "imp_iic_wrap_ap_clock_i2c1", "infra_ao_i2c_ap", 1),
  22. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C2,
  23. "imp_iic_wrap_ap_clock_i2c2", "infra_ao_i2c_ap", 2),
  24. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C3,
  25. "imp_iic_wrap_ap_clock_i2c3", "infra_ao_i2c_ap", 3),
  26. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C4,
  27. "imp_iic_wrap_ap_clock_i2c4", "infra_ao_i2c_ap", 4),
  28. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C5,
  29. "imp_iic_wrap_ap_clock_i2c5", "infra_ao_i2c_ap", 5),
  30. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C6,
  31. "imp_iic_wrap_ap_clock_i2c6", "infra_ao_i2c_ap", 6),
  32. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C7,
  33. "imp_iic_wrap_ap_clock_i2c7", "infra_ao_i2c_ap", 7),
  34. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C8,
  35. "imp_iic_wrap_ap_clock_i2c8", "infra_ao_i2c_ap", 8),
  36. GATE_IMP_IIC_WRAP(CLK_IMP_IIC_WRAP_AP_CLOCK_I2C9,
  37. "imp_iic_wrap_ap_clock_i2c9", "infra_ao_i2c_ap", 9),
  38. };
  39. static const struct mtk_clk_desc imp_iic_wrap_desc = {
  40. .clks = imp_iic_wrap_clks,
  41. .num_clks = ARRAY_SIZE(imp_iic_wrap_clks),
  42. };
  43. static const struct of_device_id of_match_clk_mt8186_imp_iic_wrap[] = {
  44. {
  45. .compatible = "mediatek,mt8186-imp_iic_wrap",
  46. .data = &imp_iic_wrap_desc,
  47. }, {
  48. /* sentinel */
  49. }
  50. };
  51. static struct platform_driver clk_mt8186_imp_iic_wrap_drv = {
  52. .probe = mtk_clk_simple_probe,
  53. .remove = mtk_clk_simple_remove,
  54. .driver = {
  55. .name = "clk-mt8186-imp_iic_wrap",
  56. .of_match_table = of_match_clk_mt8186_imp_iic_wrap,
  57. },
  58. };
  59. builtin_platform_driver(clk_mt8186_imp_iic_wrap_drv);