xref: /linux/drivers/clk/socfpga/stratix10-clk.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
107afb8dbSDinh Nguyen /* SPDX-License-Identifier:    GPL-2.0 */
207afb8dbSDinh Nguyen /*
307afb8dbSDinh Nguyen  * Copyright (C) 2017, Intel Corporation
407afb8dbSDinh Nguyen  */
507afb8dbSDinh Nguyen 
607afb8dbSDinh Nguyen #ifndef	__STRATIX10_CLK_H
707afb8dbSDinh Nguyen #define	__STRATIX10_CLK_H
807afb8dbSDinh Nguyen 
907afb8dbSDinh Nguyen struct stratix10_clock_data {
1007afb8dbSDinh Nguyen 	void __iomem		*base;
11*d761bb01SGustavo A. R. Silva 
12*d761bb01SGustavo A. R. Silva 	/* Must be last */
13*d761bb01SGustavo A. R. Silva 	struct clk_hw_onecell_data	clk_data;
1407afb8dbSDinh Nguyen };
1507afb8dbSDinh Nguyen 
1607afb8dbSDinh Nguyen struct stratix10_pll_clock {
1707afb8dbSDinh Nguyen 	unsigned int		id;
1807afb8dbSDinh Nguyen 	const char		*name;
19762d961aSDinh Nguyen 	const struct clk_parent_data	*parent_data;
2007afb8dbSDinh Nguyen 	u8			num_parents;
2107afb8dbSDinh Nguyen 	unsigned long		flags;
2207afb8dbSDinh Nguyen 	unsigned long		offset;
2307afb8dbSDinh Nguyen };
2407afb8dbSDinh Nguyen 
2507afb8dbSDinh Nguyen struct stratix10_perip_c_clock {
2607afb8dbSDinh Nguyen 	unsigned int		id;
2707afb8dbSDinh Nguyen 	const char		*name;
2807afb8dbSDinh Nguyen 	const char		*parent_name;
29762d961aSDinh Nguyen 	const struct clk_parent_data	*parent_data;
3007afb8dbSDinh Nguyen 	u8			num_parents;
3107afb8dbSDinh Nguyen 	unsigned long		flags;
3207afb8dbSDinh Nguyen 	unsigned long		offset;
3307afb8dbSDinh Nguyen };
3407afb8dbSDinh Nguyen 
35a0f9819cSDinh Nguyen struct n5x_perip_c_clock {
36a0f9819cSDinh Nguyen 	unsigned int		id;
37a0f9819cSDinh Nguyen 	const char		*name;
38a0f9819cSDinh Nguyen 	const char		*parent_name;
39a0f9819cSDinh Nguyen 	const char		*const *parent_names;
40a0f9819cSDinh Nguyen 	u8			num_parents;
41a0f9819cSDinh Nguyen 	unsigned long		flags;
42a0f9819cSDinh Nguyen 	unsigned long		offset;
43a0f9819cSDinh Nguyen 	unsigned long		shift;
44a0f9819cSDinh Nguyen };
45a0f9819cSDinh Nguyen 
4607afb8dbSDinh Nguyen struct stratix10_perip_cnt_clock {
4707afb8dbSDinh Nguyen 	unsigned int		id;
4807afb8dbSDinh Nguyen 	const char		*name;
4907afb8dbSDinh Nguyen 	const char		*parent_name;
50762d961aSDinh Nguyen 	const struct clk_parent_data	*parent_data;
5107afb8dbSDinh Nguyen 	u8			num_parents;
5207afb8dbSDinh Nguyen 	unsigned long		flags;
5307afb8dbSDinh Nguyen 	unsigned long		offset;
5407afb8dbSDinh Nguyen 	u8			fixed_divider;
5507afb8dbSDinh Nguyen 	unsigned long		bypass_reg;
5607afb8dbSDinh Nguyen 	unsigned long		bypass_shift;
5707afb8dbSDinh Nguyen };
5807afb8dbSDinh Nguyen 
5907afb8dbSDinh Nguyen struct stratix10_gate_clock {
6007afb8dbSDinh Nguyen 	unsigned int		id;
6107afb8dbSDinh Nguyen 	const char		*name;
6207afb8dbSDinh Nguyen 	const char		*parent_name;
63762d961aSDinh Nguyen 	const struct clk_parent_data	*parent_data;
6407afb8dbSDinh Nguyen 	u8			num_parents;
6507afb8dbSDinh Nguyen 	unsigned long		flags;
6607afb8dbSDinh Nguyen 	unsigned long		gate_reg;
6707afb8dbSDinh Nguyen 	u8			gate_idx;
6807afb8dbSDinh Nguyen 	unsigned long		div_reg;
6907afb8dbSDinh Nguyen 	u8			div_offset;
7007afb8dbSDinh Nguyen 	u8			div_width;
7107afb8dbSDinh Nguyen 	unsigned long		bypass_reg;
7207afb8dbSDinh Nguyen 	u8			bypass_shift;
7307afb8dbSDinh Nguyen 	u8			fixed_div;
7407afb8dbSDinh Nguyen };
7507afb8dbSDinh Nguyen 
76ba7e2584SDinh Nguyen struct clk_hw *s10_register_pll(const struct stratix10_pll_clock *clks,
77a0f9819cSDinh Nguyen 			     void __iomem *reg);
78ba7e2584SDinh Nguyen struct clk_hw *agilex_register_pll(const struct stratix10_pll_clock *clks,
79a0f9819cSDinh Nguyen 				void __iomem *reg);
80ba7e2584SDinh Nguyen struct clk_hw *n5x_register_pll(const struct stratix10_pll_clock *clks,
81a0f9819cSDinh Nguyen 			     void __iomem *reg);
82ba7e2584SDinh Nguyen struct clk_hw *s10_register_periph(const struct stratix10_perip_c_clock *clks,
83ba7e2584SDinh Nguyen 				void __iomem *reg);
84ba7e2584SDinh Nguyen struct clk_hw *n5x_register_periph(const struct n5x_perip_c_clock *clks,
85ba7e2584SDinh Nguyen 				void __iomem *reg);
86ba7e2584SDinh Nguyen struct clk_hw *s10_register_cnt_periph(const struct stratix10_perip_cnt_clock *clks,
87ba7e2584SDinh Nguyen 				    void __iomem *reg);
88ba7e2584SDinh Nguyen struct clk_hw *s10_register_gate(const struct stratix10_gate_clock *clks,
89ba7e2584SDinh Nguyen 			      void __iomem *reg);
90c2c9c566SDinh Nguyen struct clk_hw *agilex_register_gate(const struct stratix10_gate_clock *clks,
91c2c9c566SDinh Nguyen 			      void __iomem *reg);
9207afb8dbSDinh Nguyen #endif	/* __STRATIX10_CLK_H */
93