ccu_phase.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2016 Maxime Ripard. All rights reserved.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _CCU_PHASE_H_
  14. #define _CCU_PHASE_H_
  15. #include <linux/clk-provider.h>
  16. #include "ccu_common.h"
  17. struct ccu_phase {
  18. u8 shift;
  19. u8 width;
  20. struct ccu_common common;
  21. };
  22. #define SUNXI_CCU_PHASE(_struct, _name, _parent, _reg, _shift, _width, _flags) \
  23. struct ccu_phase _struct = { \
  24. .shift = _shift, \
  25. .width = _width, \
  26. .common = { \
  27. .reg = _reg, \
  28. .hw.init = CLK_HW_INIT(_name, \
  29. _parent, \
  30. &ccu_phase_ops, \
  31. _flags), \
  32. } \
  33. }
  34. static inline struct ccu_phase *hw_to_ccu_phase(struct clk_hw *hw)
  35. {
  36. struct ccu_common *common = hw_to_ccu_common(hw);
  37. return container_of(common, struct ccu_phase, common);
  38. }
  39. extern const struct clk_ops ccu_phase_ops;
  40. #endif /* _CCU_PHASE_H_ */