summaryrefslogtreecommitdiffstats
path: root/drivers/clk/mvebu/common.h
blob: a3b27247f79ee8bb73539431934d92954104a86c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * Marvell EBU SoC common clock handling
 *
 * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
 *
 * Based on Linux Marvell MVEBU clock providers
 *   Copyright (C) 2012 Marvell
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#ifndef __CLK_MVEBU_COMMON_H_
#define __CLK_MVEBU_COMMON_H_

struct coreclk_ratio {
	int id;
	const char *name;
};

struct coreclk_soc_desc {
	u32 (*get_tclk_freq)(void __iomem *sar);
	u32 (*get_cpu_freq)(void __iomem *sar);
	void (*get_clk_ratio)(void __iomem *sar, int id, int *mult, int *div);
	const struct coreclk_ratio *ratios;
	int num_ratios;
};

struct clk_gating_soc_desc {
	const char *name;
	const char *parent;
	int bit_idx;
};

#ifdef CONFIG_ARCH_ARMADA_370
extern const struct coreclk_soc_desc armada_370_coreclks;
extern const struct clk_gating_soc_desc armada_370_gating_desc[];
#else
static const u32 armada_370_coreclks;
static const u32 armada_370_gating_desc;
#endif

#ifdef CONFIG_ARCH_ARMADA_XP
extern const struct coreclk_soc_desc armada_xp_coreclks;
extern const struct clk_gating_soc_desc armada_xp_gating_desc[];
#else
static const u32 armada_xp_coreclks;
static const u32 armada_xp_gating_desc;
#endif

#ifdef CONFIG_ARCH_ARMADA_38X
extern const struct coreclk_soc_desc armada_38x_coreclks;
extern const struct clk_gating_soc_desc armada_38x_gating_desc[];
#else
static const u32 armada_38x_coreclks;
static const u32 armada_38x_gating_desc;
#endif

#ifdef CONFIG_ARCH_DOVE
extern const struct coreclk_soc_desc dove_coreclks;
extern const struct clk_gating_soc_desc dove_gating_desc[];
#else
static const u32 dove_coreclks;
static const u32 dove_gating_desc;
#endif

#ifdef CONFIG_ARCH_KIRKWOOD
extern const struct coreclk_soc_desc kirkwood_coreclks;
extern const struct coreclk_soc_desc mv88f6180_coreclks;
extern const struct clk_gating_soc_desc kirkwood_gating_desc[];
#else
static const u32 kirkwood_coreclks;
static const u32 mv88f6180_coreclks;
static const u32 kirkwood_gating_desc;
#endif

#endif