ccu_gate.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_GATE_H_
  14. #define _CCU_GATE_H_
  15. #include <linux/clk-provider.h>
  16. #include "ccu_common.h"
  17. struct ccu_gate {
  18. u32 enable;
  19. struct ccu_common common;
  20. };
  21. #define SUNXI_CCU_GATE(_struct, _name, _parent, _reg, _gate, _flags) \
  22. struct ccu_gate _struct = { \
  23. .enable = _gate, \
  24. .common = { \
  25. .reg = _reg, \
  26. .hw.init = CLK_HW_INIT(_name, \
  27. _parent, \
  28. &ccu_gate_ops, \
  29. _flags), \
  30. } \
  31. }
  32. static inline struct ccu_gate *hw_to_ccu_gate(struct clk_hw *hw)
  33. {
  34. struct ccu_common *common = hw_to_ccu_common(hw);
  35. return container_of(common, struct ccu_gate, common);
  36. }
  37. void ccu_gate_helper_disable(struct ccu_common *common, u32 gate);
  38. int ccu_gate_helper_enable(struct ccu_common *common, u32 gate);
  39. int ccu_gate_helper_is_enabled(struct ccu_common *common, u32 gate);
  40. extern const struct clk_ops ccu_gate_ops;
  41. #endif /* _CCU_GATE_H_ */