ccu_phase.h 881 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016 Maxime Ripard. All rights reserved.
  4. */
  5. #ifndef _CCU_PHASE_H_
  6. #define _CCU_PHASE_H_
  7. #include <linux/clk-provider.h>
  8. #include "ccu_common.h"
  9. struct ccu_phase {
  10. u8 shift;
  11. u8 width;
  12. struct ccu_common common;
  13. };
  14. #define SUNXI_CCU_PHASE(_struct, _name, _parent, _reg, _shift, _width, _flags) \
  15. struct ccu_phase _struct = { \
  16. .shift = _shift, \
  17. .width = _width, \
  18. .common = { \
  19. .reg = _reg, \
  20. .hw.init = CLK_HW_INIT(_name, \
  21. _parent, \
  22. &ccu_phase_ops, \
  23. _flags), \
  24. } \
  25. }
  26. static inline struct ccu_phase *hw_to_ccu_phase(struct clk_hw *hw)
  27. {
  28. struct ccu_common *common = hw_to_ccu_common(hw);
  29. return container_of(common, struct ccu_phase, common);
  30. }
  31. extern const struct clk_ops ccu_phase_ops;
  32. #endif /* _CCU_PHASE_H_ */