FILE
ccu_common.h
File preview with syntax highlighting.
linux-6.19.14/drivers/clk/spacemit/ccu_common.h
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (c) 2024 SpacemiT Technology Co. Ltd 4 * Copyright (c) 2024-2025 Haylen Chu <heylenay@4d2.org> 5 */ 6 7#ifndef _CCU_COMMON_H_ 8#define _CCU_COMMON_H_ 9 10#include <linux/regmap.h> 11 12struct ccu_common { 13 struct regmap *regmap; 14 struct regmap *lock_regmap; 15 16 union { 17 /* For DDN and MIX */ 18 struct { 19 u32 reg_ctrl; 20 u32 reg_fc; 21 u32 mask_fc; 22 }; 23 24 /* For PLL */ 25 struct { 26 u32 reg_swcr1; 27 u32 reg_swcr3; 28 }; 29 }; 30 31 struct clk_hw hw; 32}; 33 34static inline struct ccu_common *hw_to_ccu_common(struct clk_hw *hw) 35{ 36 return container_of(hw, struct ccu_common, hw); 37} 38 39#define ccu_read(c, reg) \ 40 ({ \ 41 u32 tmp; \ 42 regmap_read((c)->regmap, (c)->reg_##reg, &tmp); \ 43 tmp; \ 44 }) 45#define ccu_update(c, reg, mask, val) \ 46 regmap_update_bits((c)->regmap, (c)->reg_##reg, mask, val) 47 48#endif /* _CCU_COMMON_H_ */
~/
Read-only file preview.