18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */
28c2ecf20Sopenharmony_ci//
38c2ecf20Sopenharmony_ci// OWL common clock driver
48c2ecf20Sopenharmony_ci//
58c2ecf20Sopenharmony_ci// Copyright (c) 2014 Actions Semi Inc.
68c2ecf20Sopenharmony_ci// Author: David Liu <liuwei@actions-semi.com>
78c2ecf20Sopenharmony_ci//
88c2ecf20Sopenharmony_ci// Copyright (c) 2018 Linaro Ltd.
98c2ecf20Sopenharmony_ci// Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _OWL_COMMON_H_
128c2ecf20Sopenharmony_ci#define _OWL_COMMON_H_
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
158c2ecf20Sopenharmony_ci#include <linux/of_platform.h>
168c2ecf20Sopenharmony_ci#include <linux/regmap.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_cistruct device_node;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct owl_clk_common {
218c2ecf20Sopenharmony_ci	struct regmap			*regmap;
228c2ecf20Sopenharmony_ci	struct clk_hw			hw;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct owl_clk_desc {
268c2ecf20Sopenharmony_ci	struct owl_clk_common		**clks;
278c2ecf20Sopenharmony_ci	unsigned long			num_clks;
288c2ecf20Sopenharmony_ci	struct clk_hw_onecell_data	*hw_clks;
298c2ecf20Sopenharmony_ci	const struct owl_reset_map	*resets;
308c2ecf20Sopenharmony_ci	unsigned long			num_resets;
318c2ecf20Sopenharmony_ci	struct regmap			*regmap;
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic inline struct owl_clk_common *
358c2ecf20Sopenharmony_ci	hw_to_owl_clk_common(const struct clk_hw *hw)
368c2ecf20Sopenharmony_ci{
378c2ecf20Sopenharmony_ci	return container_of(hw, struct owl_clk_common, hw);
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciint owl_clk_regmap_init(struct platform_device *pdev,
418c2ecf20Sopenharmony_ci			struct owl_clk_desc *desc);
428c2ecf20Sopenharmony_ciint owl_clk_probe(struct device *dev, struct clk_hw_onecell_data *hw_clks);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#endif /* _OWL_COMMON_H_ */
45