clk-mt8183-mfgcfg.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright (c) 2018 MediaTek Inc.
  4. // Author: Weiyi Lu <[email protected]>
  5. #include <linux/clk-provider.h>
  6. #include <linux/platform_device.h>
  7. #include <linux/pm_runtime.h>
  8. #include "clk-mtk.h"
  9. #include "clk-gate.h"
  10. #include <dt-bindings/clock/mt8183-clk.h>
  11. static const struct mtk_gate_regs mfg_cg_regs = {
  12. .set_ofs = 0x4,
  13. .clr_ofs = 0x8,
  14. .sta_ofs = 0x0,
  15. };
  16. #define GATE_MFG(_id, _name, _parent, _shift) \
  17. GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \
  18. &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT)
  19. static const struct mtk_gate mfg_clks[] = {
  20. GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0)
  21. };
  22. static const struct mtk_clk_desc mfg_desc = {
  23. .clks = mfg_clks,
  24. .num_clks = ARRAY_SIZE(mfg_clks),
  25. };
  26. static const struct of_device_id of_match_clk_mt8183_mfg[] = {
  27. {
  28. .compatible = "mediatek,mt8183-mfgcfg",
  29. .data = &mfg_desc,
  30. }, {
  31. /* sentinel */
  32. }
  33. };
  34. static struct platform_driver clk_mt8183_mfg_drv = {
  35. .probe = mtk_clk_simple_probe,
  36. .remove = mtk_clk_simple_remove,
  37. .driver = {
  38. .name = "clk-mt8183-mfg",
  39. .of_match_table = of_match_clk_mt8183_mfg,
  40. },
  41. };
  42. builtin_platform_driver(clk_mt8183_mfg_drv);