ccu_mult.h 1009 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _CCU_MULT_H_
  2. #define _CCU_MULT_H_
  3. #include "ccu_common.h"
  4. #include "ccu_mux.h"
  5. struct _ccu_mult {
  6. u8 shift;
  7. u8 width;
  8. };
  9. #define _SUNXI_CCU_MULT(_shift, _width) \
  10. { \
  11. .shift = _shift, \
  12. .width = _width, \
  13. }
  14. struct ccu_mult {
  15. u32 enable;
  16. struct _ccu_mult mult;
  17. struct ccu_mux_internal mux;
  18. struct ccu_common common;
  19. };
  20. #define SUNXI_CCU_N_WITH_GATE_LOCK(_struct, _name, _parent, _reg, \
  21. _mshift, _mwidth, _gate, _lock, \
  22. _flags) \
  23. struct ccu_mult _struct = { \
  24. .enable = _gate, \
  25. .mult = _SUNXI_CCU_MULT(_mshift, _mwidth), \
  26. .common = { \
  27. .reg = _reg, \
  28. .hw.init = CLK_HW_INIT(_name, \
  29. _parent, \
  30. &ccu_mult_ops, \
  31. _flags), \
  32. }, \
  33. }
  34. static inline struct ccu_mult *hw_to_ccu_mult(struct clk_hw *hw)
  35. {
  36. struct ccu_common *common = hw_to_ccu_common(hw);
  37. return container_of(common, struct ccu_mult, common);
  38. }
  39. extern const struct clk_ops ccu_mult_ops;
  40. #endif /* _CCU_MULT_H_ */