xref: /freebsd/sys/dev/clk/allwinner/aw_clk_prediv_mux.h (revision e37e8677fe55ddd0685c764e17ac58707787758a)
1*e37e8677SEmmanuel Vadot /*-
2*e37e8677SEmmanuel Vadot  * Copyright (c) 2017 Emmanuel Vadot <manu@freebsd.org>
3*e37e8677SEmmanuel Vadot  *
4*e37e8677SEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
5*e37e8677SEmmanuel Vadot  * modification, are permitted provided that the following conditions
6*e37e8677SEmmanuel Vadot  * are met:
7*e37e8677SEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
8*e37e8677SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer.
9*e37e8677SEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
10*e37e8677SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in the
11*e37e8677SEmmanuel Vadot  *    documentation and/or other materials provided with the distribution.
12*e37e8677SEmmanuel Vadot  *
13*e37e8677SEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14*e37e8677SEmmanuel Vadot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15*e37e8677SEmmanuel Vadot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16*e37e8677SEmmanuel Vadot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17*e37e8677SEmmanuel Vadot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
18*e37e8677SEmmanuel Vadot  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19*e37e8677SEmmanuel Vadot  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
20*e37e8677SEmmanuel Vadot  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21*e37e8677SEmmanuel Vadot  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*e37e8677SEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*e37e8677SEmmanuel Vadot  * SUCH DAMAGE.
24*e37e8677SEmmanuel Vadot  */
25*e37e8677SEmmanuel Vadot 
26*e37e8677SEmmanuel Vadot #ifndef	__AW_CLK_PREDIV_MUX_H__
27*e37e8677SEmmanuel Vadot #define __AW_CLK_PREDIV_MUX_H__
28*e37e8677SEmmanuel Vadot 
29*e37e8677SEmmanuel Vadot #include <dev/clk/allwinner/aw_clk.h>
30*e37e8677SEmmanuel Vadot 
31*e37e8677SEmmanuel Vadot struct aw_clk_prediv_mux_def {
32*e37e8677SEmmanuel Vadot 	struct clknode_init_def clkdef;
33*e37e8677SEmmanuel Vadot 	uint32_t		offset;
34*e37e8677SEmmanuel Vadot 
35*e37e8677SEmmanuel Vadot 	uint32_t		mux_shift;
36*e37e8677SEmmanuel Vadot 	uint32_t		mux_width;
37*e37e8677SEmmanuel Vadot 
38*e37e8677SEmmanuel Vadot 	struct aw_clk_factor	div;
39*e37e8677SEmmanuel Vadot 	struct aw_clk_factor	prediv;
40*e37e8677SEmmanuel Vadot 
41*e37e8677SEmmanuel Vadot 	uint32_t		flags;
42*e37e8677SEmmanuel Vadot };
43*e37e8677SEmmanuel Vadot 
44*e37e8677SEmmanuel Vadot int	aw_clk_prediv_mux_register(struct clkdom *clkdom, struct aw_clk_prediv_mux_def *clkdef);
45*e37e8677SEmmanuel Vadot 
46*e37e8677SEmmanuel Vadot #endif /* __AW_CLK_PREDIV_MUX_H__ */
47