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