blob: d756ef8b78eb6c02d9fee43dd6670cda36df53bb [file] [log] [blame]
Geert Uytterhoeven5b1defd2016-05-04 14:32:56 +02001/*
2 * R-Car Gen3 Clock Pulse Generator
3 *
4 * Copyright (C) 2015-2016 Glider bvba
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 */
10
11#ifndef __CLK_RENESAS_RCAR_GEN3_CPG_H__
12#define __CLK_RENESAS_RCAR_GEN3_CPG_H__
13
14enum rcar_gen3_clk_types {
15 CLK_TYPE_GEN3_MAIN = CLK_TYPE_CUSTOM,
16 CLK_TYPE_GEN3_PLL0,
17 CLK_TYPE_GEN3_PLL1,
18 CLK_TYPE_GEN3_PLL2,
19 CLK_TYPE_GEN3_PLL3,
20 CLK_TYPE_GEN3_PLL4,
21 CLK_TYPE_GEN3_SD,
22 CLK_TYPE_GEN3_R,
Geert Uytterhoeven696997e2017-07-19 17:39:54 +020023 CLK_TYPE_GEN3_PE,
Geert Uytterhoeven5b1defd2016-05-04 14:32:56 +020024};
25
26#define DEF_GEN3_SD(_name, _id, _parent, _offset) \
27 DEF_BASE(_name, _id, CLK_TYPE_GEN3_SD, _parent, .offset = _offset)
28
Geert Uytterhoeven696997e2017-07-19 17:39:54 +020029#define DEF_GEN3_PE(_name, _id, _parent_sscg, _div_sscg, _parent_clean, \
30 _div_clean) \
31 DEF_BASE(_name, _id, CLK_TYPE_GEN3_PE, \
32 (_parent_sscg) << 16 | (_parent_clean), \
33 .div = (_div_sscg) << 16 | (_div_clean))
34
Geert Uytterhoeven5b1defd2016-05-04 14:32:56 +020035struct rcar_gen3_cpg_pll_config {
Geert Uytterhoeven09a7dea2017-07-19 16:30:45 +020036 u8 extal_div;
37 u8 pll1_mult;
38 u8 pll1_div;
39 u8 pll3_mult;
40 u8 pll3_div;
Geert Uytterhoeven5b1defd2016-05-04 14:32:56 +020041};
42
43#define CPG_RCKCR 0x240
44
Geert Uytterhoeven5b1defd2016-05-04 14:32:56 +020045struct clk *rcar_gen3_cpg_clk_register(struct device *dev,
46 const struct cpg_core_clk *core, const struct cpg_mssr_info *info,
47 struct clk **clks, void __iomem *base);
48int rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config,
Geert Uytterhoeven5f3a4322017-03-10 11:36:33 +010049 unsigned int clk_extalr, u32 mode);
Geert Uytterhoeven5b1defd2016-05-04 14:32:56 +020050
51#endif