xref: /freebsd/sys/dev/clk/rockchip/rk_clk_mux.h (revision be82b3a0bf72ed3b5f01ac9fcd8dcd3802e3c742)
177f22241SEmmanuel Vadot /*-
277f22241SEmmanuel Vadot  * SPDX-License-Identifier: BSD-2-Clause
377f22241SEmmanuel Vadot  *
477f22241SEmmanuel Vadot  * Copyright 2016 Michal Meloun <mmel@FreeBSD.org>
577f22241SEmmanuel Vadot  * All rights reserved.
677f22241SEmmanuel Vadot  *
777f22241SEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
877f22241SEmmanuel Vadot  * modification, are permitted provided that the following conditions
977f22241SEmmanuel Vadot  * are met:
1077f22241SEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
1177f22241SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer.
1277f22241SEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
1377f22241SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in the
1477f22241SEmmanuel Vadot  *    documentation and/or other materials provided with the distribution.
1577f22241SEmmanuel Vadot  *
1677f22241SEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1777f22241SEmmanuel Vadot  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1877f22241SEmmanuel Vadot  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1977f22241SEmmanuel Vadot  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2077f22241SEmmanuel Vadot  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2177f22241SEmmanuel Vadot  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2277f22241SEmmanuel Vadot  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2377f22241SEmmanuel Vadot  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2477f22241SEmmanuel Vadot  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2577f22241SEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2677f22241SEmmanuel Vadot  * SUCH DAMAGE.
2777f22241SEmmanuel Vadot  */
2877f22241SEmmanuel Vadot #ifndef _RK_CLK_MUX_H_
2977f22241SEmmanuel Vadot #define _RK_CLK_MUX_H_
3077f22241SEmmanuel Vadot 
31*be82b3a0SEmmanuel Vadot #include <dev/clk/clk.h>
3277f22241SEmmanuel Vadot 
3377f22241SEmmanuel Vadot struct rk_clk_mux_def {
3477f22241SEmmanuel Vadot 	struct clknode_init_def clkdef;
3577f22241SEmmanuel Vadot 	uint32_t		offset;
3677f22241SEmmanuel Vadot 	uint32_t		shift;
3777f22241SEmmanuel Vadot 	uint32_t		width;
3877f22241SEmmanuel Vadot 	int			mux_flags;
3977f22241SEmmanuel Vadot };
4077f22241SEmmanuel Vadot 
4177f22241SEmmanuel Vadot #define	RK_CLK_MUX_MASK		0xFFFF0000
4277f22241SEmmanuel Vadot #define	RK_CLK_MUX_REPARENT	(1 << 0)
4377f22241SEmmanuel Vadot #define	RK_CLK_MUX_GRF		(1 << 1)
4477f22241SEmmanuel Vadot 
4577f22241SEmmanuel Vadot int rk_clk_mux_register(struct clkdom *clkdom, struct rk_clk_mux_def *clkdef);
4677f22241SEmmanuel Vadot 
4777f22241SEmmanuel Vadot #endif /* _RK_CLK_MUX_H_ */
48