clk-mt8192-mfg.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. //
  3. // Copyright (c) 2021 MediaTek Inc.
  4. // Author: Chun-Jie Chen <[email protected]>
  5. #include <linux/clk-provider.h>
  6. #include <linux/of_device.h>
  7. #include <linux/platform_device.h>
  8. #include "clk-mtk.h"
  9. #include "clk-gate.h"
  10. #include <dt-bindings/clock/mt8192-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, \
  18. _shift, &mtk_clk_gate_ops_setclr, \
  19. CLK_SET_RATE_PARENT)
  20. static const struct mtk_gate mfg_clks[] = {
  21. GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_pll_sel", 0),
  22. };
  23. static const struct mtk_clk_desc mfg_desc = {
  24. .clks = mfg_clks,
  25. .num_clks = ARRAY_SIZE(mfg_clks),
  26. };
  27. static const struct of_device_id of_match_clk_mt8192_mfg[] = {
  28. {
  29. .compatible = "mediatek,mt8192-mfgcfg",
  30. .data = &mfg_desc,
  31. }, {
  32. /* sentinel */
  33. }
  34. };
  35. static struct platform_driver clk_mt8192_mfg_drv = {
  36. .probe = mtk_clk_simple_probe,
  37. .remove = mtk_clk_simple_remove,
  38. .driver = {
  39. .name = "clk-mt8192-mfg",
  40. .of_match_table = of_match_clk_mt8192_mfg,
  41. },
  42. };
  43. builtin_platform_driver(clk_mt8192_mfg_drv);