clk.h 870 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com>
  4. */
  5. #ifndef K210_CLK_H
  6. #define K210_CLK_H
  7. #define LOG_CATEGORY UCLASS_CLK
  8. #include <linux/types.h>
  9. #include <linux/clk-provider.h>
  10. static inline struct clk *k210_clk_gate(const char *name,
  11. const char *parent_name,
  12. void __iomem *reg, u8 bit_idx)
  13. {
  14. return clk_register_gate(NULL, name, parent_name, 0, reg, bit_idx, 0,
  15. NULL);
  16. }
  17. static inline struct clk *k210_clk_half(const char *name,
  18. const char *parent_name)
  19. {
  20. return clk_register_fixed_factor(NULL, name, parent_name, 0, 1, 2);
  21. }
  22. static inline struct clk *k210_clk_div(const char *name,
  23. const char *parent_name,
  24. void __iomem *reg, u8 shift, u8 width)
  25. {
  26. return clk_register_divider(NULL, name, parent_name, 0, reg, shift,
  27. width, 0);
  28. }
  29. #endif /* K210_CLK_H */