clk-lib.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #include <linux/bitops.h>
  10. enum clk_ctl_ops {
  11. CLK_SET = BIT(0), /* set frequency */
  12. CLK_GET = BIT(1), /* get frequency */
  13. CLK_ON = BIT(2), /* enable clock */
  14. CLK_OFF = BIT(3), /* disable clock */
  15. CLK_PRINT = BIT(4), /* print frequency */
  16. CLK_MHZ = BIT(5) /* all values in MHZ instead of HZ */
  17. };
  18. /*
  19. * Depending on the clk_ctl_ops enable / disable /
  20. * set clock rate from 'rate' argument / read clock to 'rate' argument /
  21. * print clock rate. If CLK_MHZ flag set in clk_ctl_ops 'rate' is in MHz,
  22. * otherwise - in Hz.
  23. *
  24. * This function expects "clk-fmeas" node in device tree:
  25. * / {
  26. * clk-fmeas {
  27. * clocks = <&cpu_pll>, <&sys_pll>;
  28. * clock-names = "cpu-pll", "sys-pll";
  29. * };
  30. * };
  31. */
  32. int soc_clk_ctl(const char *name, ulong *rate, enum clk_ctl_ops ctl);
  33. #endif /* __BOARD_CLK_LIB_H */