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