ccu_mult.h 1.1 KB

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