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