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