blob: 46a0402696de913ec357e79548a34ac37ee3446d [file] [log] [blame]
Tony Lindgren9ad58972005-11-10 14:26:53 +00001/*
2 * linux/include/asm-arm/arch-omap/clock.h
3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ARCH_ARM_OMAP_CLOCK_H
14#define __ARCH_ARM_OMAP_CLOCK_H
15
16struct module;
17
18struct clk {
19 struct list_head node;
20 struct module *owner;
21 const char *name;
22 struct clk *parent;
23 unsigned long rate;
24 __u32 flags;
25 void __iomem *enable_reg;
26 __u8 enable_bit;
27 __u8 rate_offset;
28 __u8 src_offset;
29 __s8 usecount;
30 void (*recalc)(struct clk *);
31 int (*set_rate)(struct clk *, unsigned long);
32 long (*round_rate)(struct clk *, unsigned long);
33 void (*init)(struct clk *);
34 int (*enable)(struct clk *);
35 void (*disable)(struct clk *);
36};
37
38struct clk_functions {
39 int (*clk_enable)(struct clk *clk);
40 void (*clk_disable)(struct clk *clk);
Tony Lindgren9ad58972005-11-10 14:26:53 +000041 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
42 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
43 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
44 struct clk * (*clk_get_parent)(struct clk *clk);
45 void (*clk_allow_idle)(struct clk *clk);
46 void (*clk_deny_idle)(struct clk *clk);
47};
48
49extern unsigned int mpurate;
50extern struct list_head clocks;
51extern spinlock_t clockfw_lock;
52
53extern int clk_init(struct clk_functions * custom_clocks);
54extern int clk_register(struct clk *clk);
55extern void clk_unregister(struct clk *clk);
56extern void propagate_rate(struct clk *clk);
57extern void followparent_recalc(struct clk * clk);
58extern void clk_allow_idle(struct clk *clk);
59extern void clk_deny_idle(struct clk *clk);
60
61/* Clock flags */
62#define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */
63#define RATE_FIXED (1 << 1) /* Fixed clock rate */
64#define RATE_PROPAGATES (1 << 2) /* Program children too */
65#define VIRTUAL_CLOCK (1 << 3) /* Composite clock from table */
66#define ALWAYS_ENABLED (1 << 4) /* Clock cannot be disabled */
67#define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */
68#define VIRTUAL_IO_ADDRESS (1 << 6) /* Clock in virtual address */
69#define CLOCK_IDLE_CONTROL (1 << 7)
70#define CLOCK_NO_IDLE_PARENT (1 << 8)
71#define DELAYED_APP (1 << 9) /* Delay application of clock */
72#define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */
73#define CM_MPU_SEL1 (1 << 11) /* Domain divider/source */
74#define CM_DSP_SEL1 (1 << 12)
75#define CM_GFX_SEL1 (1 << 13)
76#define CM_MODEM_SEL1 (1 << 14)
77#define CM_CORE_SEL1 (1 << 15) /* Sets divider for many */
78#define CM_CORE_SEL2 (1 << 16) /* sets parent for GPT */
79#define CM_WKUP_SEL1 (1 << 17)
80#define CM_PLL_SEL1 (1 << 18)
81#define CM_PLL_SEL2 (1 << 19)
82#define CM_SYSCLKOUT_SEL1 (1 << 20)
83#define CLOCK_IN_OMAP730 (1 << 21)
84#define CLOCK_IN_OMAP1510 (1 << 22)
85#define CLOCK_IN_OMAP16XX (1 << 23)
86#define CLOCK_IN_OMAP242X (1 << 24)
87#define CLOCK_IN_OMAP243X (1 << 25)
88
89#endif