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_ARMCLK_H_ 2977f22241SEmmanuel Vadot #define _RK_CLK_ARMCLK_H_ 3077f22241SEmmanuel Vadot 31*be82b3a0SEmmanuel Vadot #include <dev/clk/clk.h> 3277f22241SEmmanuel Vadot 3377f22241SEmmanuel Vadot struct rk_clk_armclk_rates { 3477f22241SEmmanuel Vadot uint64_t freq; 3577f22241SEmmanuel Vadot uint32_t div; 3677f22241SEmmanuel Vadot }; 3777f22241SEmmanuel Vadot 3877f22241SEmmanuel Vadot struct rk_clk_armclk_def { 3977f22241SEmmanuel Vadot struct clknode_init_def clkdef; 4077f22241SEmmanuel Vadot 4177f22241SEmmanuel Vadot uint32_t muxdiv_offset; 4277f22241SEmmanuel Vadot 4377f22241SEmmanuel Vadot uint32_t mux_shift; 4477f22241SEmmanuel Vadot uint32_t mux_width; 4577f22241SEmmanuel Vadot 4677f22241SEmmanuel Vadot uint32_t div_shift; 4777f22241SEmmanuel Vadot uint32_t div_width; 4877f22241SEmmanuel Vadot 4977f22241SEmmanuel Vadot uint32_t flags; 5077f22241SEmmanuel Vadot 5177f22241SEmmanuel Vadot uint32_t main_parent; 5277f22241SEmmanuel Vadot uint32_t alt_parent; 5377f22241SEmmanuel Vadot 5477f22241SEmmanuel Vadot struct rk_clk_armclk_rates *rates; 5577f22241SEmmanuel Vadot int nrates; 5677f22241SEmmanuel Vadot }; 5777f22241SEmmanuel Vadot 5877f22241SEmmanuel Vadot int rk_clk_armclk_register(struct clkdom *clkdom, 5977f22241SEmmanuel Vadot struct rk_clk_armclk_def *clkdef); 6077f22241SEmmanuel Vadot 6177f22241SEmmanuel Vadot #endif /* _RK_CLK_ARMCLK_H_ */ 62