Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 86 lines 2.1 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (c) 2016 Maxime Ripard. All rights reserved. 4 */ 5 6#ifndef _COMMON_H_ 7#define _COMMON_H_ 8 9#include <linux/compiler.h> 10#include <linux/clk-provider.h> 11 12#define CCU_FEATURE_FRACTIONAL BIT(0) 13#define CCU_FEATURE_VARIABLE_PREDIV BIT(1) 14#define CCU_FEATURE_FIXED_PREDIV BIT(2) 15#define CCU_FEATURE_FIXED_POSTDIV BIT(3) 16#define CCU_FEATURE_ALL_PREDIV BIT(4) 17#define CCU_FEATURE_LOCK_REG BIT(5) 18#define CCU_FEATURE_MMC_TIMING_SWITCH BIT(6) 19#define CCU_FEATURE_SIGMA_DELTA_MOD BIT(7) 20#define CCU_FEATURE_KEY_FIELD BIT(8) 21#define CCU_FEATURE_CLOSEST_RATE BIT(9) 22#define CCU_FEATURE_DUAL_DIV BIT(10) 23#define CCU_FEATURE_UPDATE_BIT BIT(11) 24 25/* MMC timing mode switch bit */ 26#define CCU_MMC_NEW_TIMING_MODE BIT(30) 27 28/* Some clocks need this bit to actually apply register changes */ 29#define CCU_SUNXI_UPDATE_BIT BIT(27) 30 31struct device_node; 32 33struct ccu_common { 34 void __iomem *base; 35 u16 reg; 36 u16 lock_reg; 37 u32 prediv; 38 39 unsigned long min_rate; 40 unsigned long max_rate; 41 42 unsigned long features; 43 spinlock_t *lock; 44 struct clk_hw hw; 45}; 46 47static inline struct ccu_common *hw_to_ccu_common(struct clk_hw *hw) 48{ 49 return container_of(hw, struct ccu_common, hw); 50} 51 52struct sunxi_ccu_desc { 53 struct ccu_common **ccu_clks; 54 unsigned long num_ccu_clks; 55 56 struct clk_hw_onecell_data *hw_clks; 57 58 const struct ccu_reset_map *resets; 59 unsigned long num_resets; 60}; 61 62void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock); 63 64bool ccu_is_better_rate(struct ccu_common *common, 65 unsigned long target_rate, 66 unsigned long current_rate, 67 unsigned long best_rate); 68 69struct ccu_pll_nb { 70 struct notifier_block clk_nb; 71 struct ccu_common *common; 72 73 u32 enable; 74 u32 lock; 75}; 76 77#define to_ccu_pll_nb(_nb) container_of(_nb, struct ccu_pll_nb, clk_nb) 78 79int ccu_pll_notifier_register(struct ccu_pll_nb *pll_nb); 80 81int devm_sunxi_ccu_probe(struct device *dev, void __iomem *reg, 82 const struct sunxi_ccu_desc *desc); 83void of_sunxi_ccu_probe(struct device_node *node, void __iomem *reg, 84 const struct sunxi_ccu_desc *desc); 85 86#endif /* _COMMON_H_ */