1 #ifndef __MACH_SUNXI_CLK_FACTORS_H 2 #define __MACH_SUNXI_CLK_FACTORS_H 3 4 #include <linux/clk-provider.h> 5 #include <linux/clkdev.h> 6 #include <linux/spinlock.h> 7 8 #define SUNXI_FACTORS_NOT_APPLICABLE (0) 9 10 #define SUNXI_FACTORS_MUX_MASK 0x3 11 12 struct clk_factors_config { 13 u8 nshift; 14 u8 nwidth; 15 u8 kshift; 16 u8 kwidth; 17 u8 mshift; 18 u8 mwidth; 19 u8 pshift; 20 u8 pwidth; 21 u8 n_start; 22 }; 23 24 struct factors_data { 25 int enable; 26 int mux; 27 struct clk_factors_config *table; 28 void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p); 29 const char *name; 30 }; 31 32 struct clk_factors { 33 struct clk_hw hw; 34 void __iomem *reg; 35 struct clk_factors_config *config; 36 void (*get_factors) (u32 *rate, u32 parent, u8 *n, u8 *k, u8 *m, u8 *p); 37 spinlock_t *lock; 38 }; 39 40 struct clk * __init sunxi_factors_register(struct device_node *node, 41 const struct factors_data *data, 42 spinlock_t *lock); 43 44 #endif 45