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