clk-mt6779-ipe.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2019 MediaTek Inc.
  4. * Author: Wendell Lin <[email protected]>
  5. */
  6. #include <linux/module.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/platform_device.h>
  9. #include <dt-bindings/clock/mt6779-clk.h>
  10. #include "clk-mtk.h"
  11. #include "clk-gate.h"
  12. static const struct mtk_gate_regs ipe_cg_regs = {
  13. .set_ofs = 0x0004,
  14. .clr_ofs = 0x0008,
  15. .sta_ofs = 0x0000,
  16. };
  17. #define GATE_IPE(_id, _name, _parent, _shift) \
  18. GATE_MTK(_id, _name, _parent, &ipe_cg_regs, _shift, \
  19. &mtk_clk_gate_ops_setclr)
  20. static const struct mtk_gate ipe_clks[] = {
  21. GATE_IPE(CLK_IPE_LARB7, "ipe_larb7", "ipe_sel", 0),
  22. GATE_IPE(CLK_IPE_LARB8, "ipe_larb8", "ipe_sel", 1),
  23. GATE_IPE(CLK_IPE_SMI_SUBCOM, "ipe_smi_subcom", "ipe_sel", 2),
  24. GATE_IPE(CLK_IPE_FD, "ipe_fd", "ipe_sel", 3),
  25. GATE_IPE(CLK_IPE_FE, "ipe_fe", "ipe_sel", 4),
  26. GATE_IPE(CLK_IPE_RSC, "ipe_rsc", "ipe_sel", 5),
  27. GATE_IPE(CLK_IPE_DPE, "ipe_dpe", "ipe_sel", 6),
  28. };
  29. static const struct mtk_clk_desc ipe_desc = {
  30. .clks = ipe_clks,
  31. .num_clks = ARRAY_SIZE(ipe_clks),
  32. };
  33. static const struct of_device_id of_match_clk_mt6779_ipe[] = {
  34. {
  35. .compatible = "mediatek,mt6779-ipesys",
  36. .data = &ipe_desc,
  37. }, {
  38. /* sentinel */
  39. }
  40. };
  41. static struct platform_driver clk_mt6779_ipe_drv = {
  42. .probe = mtk_clk_simple_probe,
  43. .remove = mtk_clk_simple_remove,
  44. .driver = {
  45. .name = "clk-mt6779-ipe",
  46. .of_match_table = of_match_clk_mt6779_ipe,
  47. },
  48. };
  49. module_platform_driver(clk_mt6779_ipe_drv);
  50. MODULE_LICENSE("GPL");