clk-branch.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2013, The Linux Foundation. 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 __QCOM_CLK_BRANCH_H__
  14. #define __QCOM_CLK_BRANCH_H__
  15. #include <linux/clk-provider.h>
  16. #include "clk-regmap.h"
  17. /**
  18. * struct clk_branch - gating clock with status bit and dynamic hardware gating
  19. *
  20. * @hwcg_reg: dynamic hardware clock gating register
  21. * @hwcg_bit: ORed with @hwcg_reg to enable dynamic hardware clock gating
  22. * @halt_reg: halt register
  23. * @halt_bit: ANDed with @halt_reg to test for clock halted
  24. * @halt_check: type of halt checking to perform
  25. * @clkr: handle between common and hardware-specific interfaces
  26. *
  27. * Clock which can gate its output.
  28. */
  29. struct clk_branch {
  30. u32 hwcg_reg;
  31. u32 halt_reg;
  32. u8 hwcg_bit;
  33. u8 halt_bit;
  34. u8 halt_check;
  35. #define BRANCH_VOTED BIT(7) /* Delay on disable */
  36. #define BRANCH_HALT 0 /* pol: 1 = halt */
  37. #define BRANCH_HALT_VOTED (BRANCH_HALT | BRANCH_VOTED)
  38. #define BRANCH_HALT_ENABLE 1 /* pol: 0 = halt */
  39. #define BRANCH_HALT_ENABLE_VOTED (BRANCH_HALT_ENABLE | BRANCH_VOTED)
  40. #define BRANCH_HALT_DELAY 2 /* No bit to check; just delay */
  41. struct clk_regmap clkr;
  42. };
  43. extern const struct clk_ops clk_branch_ops;
  44. extern const struct clk_ops clk_branch2_ops;
  45. extern const struct clk_ops clk_branch_simple_ops;
  46. #define to_clk_branch(_hw) \
  47. container_of(to_clk_regmap(_hw), struct clk_branch, clkr)
  48. #endif