clk-lib.h 1021 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2018 Synopsys, Inc. All rights reserved.
  4. * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
  5. */
  6. #ifndef __BOARD_CLK_LIB_H
  7. #define __BOARD_CLK_LIB_H
  8. #include <common.h>
  9. enum clk_ctl_ops {
  10. CLK_SET = BIT(0), /* set frequency */
  11. CLK_GET = BIT(1), /* get frequency */
  12. CLK_ON = BIT(2), /* enable clock */
  13. CLK_OFF = BIT(3), /* disable clock */
  14. CLK_PRINT = BIT(4), /* print frequency */
  15. CLK_MHZ = BIT(5) /* all values in MHZ instead of HZ */
  16. };
  17. /*
  18. * Depending on the clk_ctl_ops enable / disable /
  19. * set clock rate from 'rate' argument / read clock to 'rate' argument /
  20. * print clock rate. If CLK_MHZ flag set in clk_ctl_ops 'rate' is in MHz,
  21. * otherwise - in Hz.
  22. *
  23. * This function expects "clk-fmeas" node in device tree:
  24. * / {
  25. * clk-fmeas {
  26. * clocks = <&cpu_pll>, <&sys_pll>;
  27. * clock-names = "cpu-pll", "sys-pll";
  28. * };
  29. * };
  30. */
  31. int soc_clk_ctl(const char *name, ulong *rate, enum clk_ctl_ops ctl);
  32. #endif /* __BOARD_CLK_LIB_H */