Commit | Line | Data |
---|---|---|
e874a669 EL |
1 | #ifndef __MACH_SUNXI_CLK_FACTORS_H |
2 | #define __MACH_SUNXI_CLK_FACTORS_H | |
3 | ||
4 | #include <linux/clk-provider.h> | |
601da9d0 | 5 | #include <linux/spinlock.h> |
e874a669 EL |
6 | |
7 | #define SUNXI_FACTORS_NOT_APPLICABLE (0) | |
8 | ||
9 | struct clk_factors_config { | |
10 | u8 nshift; | |
11 | u8 nwidth; | |
12 | u8 kshift; | |
13 | u8 kwidth; | |
14 | u8 mshift; | |
15 | u8 mwidth; | |
16 | u8 pshift; | |
17 | u8 pwidth; | |
9a5e6c7e | 18 | u8 n_start; |
e874a669 EL |
19 | }; |
20 | ||
cfa63688 CYT |
21 | struct factors_request { |
22 | unsigned long rate; | |
23 | unsigned long parent_rate; | |
435b7be1 | 24 | u8 parent_index; |
cfa63688 CYT |
25 | u8 n; |
26 | u8 k; | |
27 | u8 m; | |
28 | u8 p; | |
29 | }; | |
30 | ||
601da9d0 MR |
31 | struct factors_data { |
32 | int enable; | |
33 | int mux; | |
e94f8cb3 | 34 | int muxmask; |
b3e919e0 | 35 | const struct clk_factors_config *table; |
cfa63688 | 36 | void (*getter)(struct factors_request *req); |
435b7be1 | 37 | void (*recalc)(struct factors_request *req); |
601da9d0 MR |
38 | const char *name; |
39 | }; | |
40 | ||
40a5dcba EL |
41 | struct clk_factors { |
42 | struct clk_hw hw; | |
43 | void __iomem *reg; | |
b3e919e0 | 44 | const struct clk_factors_config *config; |
cfa63688 | 45 | void (*get_factors)(struct factors_request *req); |
435b7be1 | 46 | void (*recalc)(struct factors_request *req); |
40a5dcba | 47 | spinlock_t *lock; |
4cbeaebb CYT |
48 | /* for cleanup */ |
49 | struct clk_mux *mux; | |
50 | struct clk_gate *gate; | |
40a5dcba EL |
51 | }; |
52 | ||
7c74c220 HG |
53 | struct clk *sunxi_factors_register(struct device_node *node, |
54 | const struct factors_data *data, | |
55 | spinlock_t *lock, | |
56 | void __iomem *reg); | |
601da9d0 | 57 | |
4cbeaebb CYT |
58 | void sunxi_factors_unregister(struct device_node *node, struct clk *clk); |
59 | ||
e874a669 | 60 | #endif |