/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2017,2018 Emmanuel Vadot <[email protected]>4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR15* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES16* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.17* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,18* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,19* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;20* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED21* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,22* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*/2627#ifndef __CCU_NG_H__28#define __CCU_NG_H__2930#include <dev/clk/allwinner/aw_clk.h>31#include <dev/clk/allwinner/aw_clk_m.h>32#include <dev/clk/allwinner/aw_clk_mipi.h>33#include <dev/clk/allwinner/aw_clk_nkmp.h>34#include <dev/clk/allwinner/aw_clk_nm.h>35#include <dev/clk/allwinner/aw_clk_nmm.h>36#include <dev/clk/allwinner/aw_clk_np.h>37#include <dev/clk/allwinner/aw_clk_prediv_mux.h>38#include <dev/clk/allwinner/aw_clk_frac.h>39#include <dev/clk/clk_mux.h>40#include <dev/clk/clk_div.h>41#include <dev/clk/clk_fixed.h>4243enum aw_ccung_clk_type {44AW_CLK_UNDEFINED = 0,45AW_CLK_MUX,46AW_CLK_DIV,47AW_CLK_FIXED,48AW_CLK_NKMP,49AW_CLK_NM,50AW_CLK_PREDIV_MUX,51AW_CLK_FRAC,52AW_CLK_M,53AW_CLK_MIPI,54AW_CLK_NP,55AW_CLK_NMM,56};5758struct aw_ccung_clk {59enum aw_ccung_clk_type type;60union {61struct clk_mux_def *mux;62struct clk_div_def *div;63struct clk_fixed_def *fixed;64struct aw_clk_nkmp_def *nkmp;65struct aw_clk_nm_def *nm;66struct aw_clk_prediv_mux_def *prediv_mux;67struct aw_clk_frac_def *frac;68struct aw_clk_m_def *m;69struct aw_clk_mipi_def *mipi;70struct aw_clk_np_def *np;71struct aw_clk_nmm_def *nmm;72} clk;73};7475struct aw_ccung_softc {76device_t dev;77struct resource *res;78struct clkdom *clkdom;79struct mtx mtx;80struct aw_ccung_reset *resets;81int nresets;82struct aw_ccung_gate *gates;83int ngates;84struct aw_ccung_clk *clks;85int nclks;86struct aw_clk_init *clk_init;87int n_clk_init;88};8990struct aw_ccung_reset {91uint32_t offset;92uint32_t shift;93};9495struct aw_ccung_gate {96const char *name;97const char *parent_name;98uint32_t id;99uint32_t offset;100uint32_t shift;101};102103DECLARE_CLASS(aw_ccung_driver);104105int aw_ccung_attach(device_t dev);106107#endif /* __CCU_NG_H__ */108109110