clk-branch.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2013, The Linux Foundation. All rights reserved. */
  3. #ifndef __QCOM_CLK_BRANCH_H__
  4. #define __QCOM_CLK_BRANCH_H__
  5. #include <linux/clk-provider.h>
  6. #include "clk-regmap.h"
  7. /**
  8. * struct clk_branch - gating clock with status bit and dynamic hardware gating
  9. *
  10. * @hwcg_reg: dynamic hardware clock gating register
  11. * @hwcg_bit: ORed with @hwcg_reg to enable dynamic hardware clock gating
  12. * @halt_reg: halt register
  13. * @halt_bit: ANDed with @halt_reg to test for clock halted
  14. * @halt_check: type of halt checking to perform
  15. * @clkr: handle between common and hardware-specific interfaces
  16. *
  17. * Clock which can gate its output.
  18. */
  19. struct clk_branch {
  20. u32 hwcg_reg;
  21. u32 halt_reg;
  22. u8 hwcg_bit;
  23. u8 halt_bit;
  24. u8 halt_check;
  25. #define BRANCH_VOTED BIT(7) /* Delay on disable */
  26. #define BRANCH_HALT 0 /* pol: 1 = halt */
  27. #define BRANCH_HALT_VOTED (BRANCH_HALT | BRANCH_VOTED)
  28. #define BRANCH_HALT_ENABLE 1 /* pol: 0 = halt */
  29. #define BRANCH_HALT_ENABLE_VOTED (BRANCH_HALT_ENABLE | BRANCH_VOTED)
  30. #define BRANCH_HALT_DELAY 2 /* No bit to check; just delay */
  31. #define BRANCH_HALT_SKIP 3 /* Don't check halt bit */
  32. struct clk_regmap clkr;
  33. };
  34. extern const struct clk_ops clk_branch_ops;
  35. extern const struct clk_ops clk_branch2_ops;
  36. extern const struct clk_ops clk_branch_simple_ops;
  37. #define to_clk_branch(_hw) \
  38. container_of(to_clk_regmap(_hw), struct clk_branch, clkr)
  39. #endif