clk-mt8188-ipe.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2022 MediaTek Inc.
  4. * Author: Garmin Chang <garmin.chang@mediatek.com>
  5. */
  6. #include <dt-bindings/clock/mediatek,mt8188-clk.h>
  7. #include <linux/clk-provider.h>
  8. #include <linux/platform_device.h>
  9. #include "clk-gate.h"
  10. #include "clk-mtk.h"
  11. static const struct mtk_gate_regs ipe_cg_regs = {
  12. .set_ofs = 0x4,
  13. .clr_ofs = 0x8,
  14. .sta_ofs = 0x0,
  15. };
  16. #define GATE_IPE(_id, _name, _parent, _shift) \
  17. GATE_MTK(_id, _name, _parent, &ipe_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
  18. #define IPE_SYS_SMI_LARB_RST_OFF (0xC)
  19. static const struct mtk_gate ipe_clks[] = {
  20. GATE_IPE(CLK_IPE_DPE, "ipe_dpe", "top_ipe", 0),
  21. GATE_IPE(CLK_IPE_FDVT, "ipe_fdvt", "top_ipe", 1),
  22. GATE_IPE(CLK_IPE_ME, "ipe_me", "top_ipe", 2),
  23. GATE_IPE(CLK_IPESYS_TOP, "ipesys_top", "top_ipe", 3),
  24. GATE_IPE(CLK_IPE_SMI_LARB12, "ipe_smi_larb12", "top_ipe", 4),
  25. };
  26. /* Reset for SMI larb 12 */
  27. static u16 ipe_sys_rst_ofs[] = {
  28. IPE_SYS_SMI_LARB_RST_OFF,
  29. };
  30. static const struct mtk_clk_rst_desc ipe_sys_rst_desc = {
  31. .version = MTK_RST_SIMPLE,
  32. .rst_bank_ofs = ipe_sys_rst_ofs,
  33. .rst_bank_nr = ARRAY_SIZE(ipe_sys_rst_ofs),
  34. };
  35. static const struct mtk_clk_desc ipe_desc = {
  36. .clks = ipe_clks,
  37. .num_clks = ARRAY_SIZE(ipe_clks),
  38. .rst_desc = &ipe_sys_rst_desc,
  39. };
  40. static const struct of_device_id of_match_clk_mt8188_ipe[] = {
  41. { .compatible = "mediatek,mt8188-ipesys", .data = &ipe_desc },
  42. { /* sentinel */ }
  43. };
  44. MODULE_DEVICE_TABLE(of, of_match_clk_mt8188_ipe);
  45. static struct platform_driver clk_mt8188_ipe_drv = {
  46. .probe = mtk_clk_simple_probe,
  47. .remove = mtk_clk_simple_remove,
  48. .driver = {
  49. .name = "clk-mt8188-ipe",
  50. .of_match_table = of_match_clk_mt8188_ipe,
  51. },
  52. };
  53. module_platform_driver(clk_mt8188_ipe_drv);
  54. MODULE_DESCRIPTION("MediaTek MT8188 Image Processing Engine clocks driver");
  55. MODULE_LICENSE("GPL");