blob: 0aca504fae31c87aa8603f336bea7bfc4d5cab01 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Steven Kingbea8bcb2012-06-06 14:28:31 -07002/*
3 * mcfclk.h -- coldfire specific clock structure
4 */
5
6
7#ifndef mcfclk_h
8#define mcfclk_h
9
10struct clk;
11
Steven Kingbea8bcb2012-06-06 14:28:31 -070012struct clk_ops {
13 void (*enable)(struct clk *);
14 void (*disable)(struct clk *);
15};
16
17struct clk {
18 const char *name;
19 struct clk_ops *clk_ops;
20 unsigned long rate;
21 unsigned long enabled;
22 u8 slot;
23};
24
25extern struct clk *mcf_clks[];
Greg Ungerer610ac932012-07-13 14:48:23 +100026
27#ifdef MCFPM_PPMCR0
Steven Kingbea8bcb2012-06-06 14:28:31 -070028extern struct clk_ops clk_ops0;
29#ifdef MCFPM_PPMCR1
30extern struct clk_ops clk_ops1;
31#endif /* MCFPM_PPMCR1 */
32
33#define DEFINE_CLK(clk_bank, clk_name, clk_slot, clk_rate) \
34static struct clk __clk_##clk_bank##_##clk_slot = { \
35 .name = clk_name, \
36 .clk_ops = &clk_ops##clk_bank, \
37 .rate = clk_rate, \
38 .slot = clk_slot, \
39}
40
41void __clk_init_enabled(struct clk *);
42void __clk_init_disabled(struct clk *);
Greg Ungerer610ac932012-07-13 14:48:23 +100043#else
44#define DEFINE_CLK(clk_ref, clk_name, clk_rate) \
45 static struct clk clk_##clk_ref = { \
46 .name = clk_name, \
47 .rate = clk_rate, \
48 }
Steven Kingbea8bcb2012-06-06 14:28:31 -070049#endif /* MCFPM_PPMCR0 */
50
51#endif /* mcfclk_h */