Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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