Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 16 | struct module; |
| 17 | |
| 18 | struct clk { |
| 19 | struct list_head node; |
| 20 | struct module *owner; |
| 21 | const char *name; |
Tony Lindgren | b824efa | 2006-04-02 17:46:20 +0100 | [diff] [blame] | 22 | int id; |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 23 | struct clk *parent; |
| 24 | unsigned long rate; |
| 25 | __u32 flags; |
| 26 | void __iomem *enable_reg; |
| 27 | __u8 enable_bit; |
| 28 | __u8 rate_offset; |
| 29 | __u8 src_offset; |
| 30 | __s8 usecount; |
| 31 | void (*recalc)(struct clk *); |
| 32 | int (*set_rate)(struct clk *, unsigned long); |
| 33 | long (*round_rate)(struct clk *, unsigned long); |
| 34 | void (*init)(struct clk *); |
| 35 | int (*enable)(struct clk *); |
| 36 | void (*disable)(struct clk *); |
| 37 | }; |
| 38 | |
| 39 | struct clk_functions { |
| 40 | int (*clk_enable)(struct clk *clk); |
| 41 | void (*clk_disable)(struct clk *clk); |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 42 | long (*clk_round_rate)(struct clk *clk, unsigned long rate); |
| 43 | int (*clk_set_rate)(struct clk *clk, unsigned long rate); |
| 44 | int (*clk_set_parent)(struct clk *clk, struct clk *parent); |
| 45 | struct clk * (*clk_get_parent)(struct clk *clk); |
| 46 | void (*clk_allow_idle)(struct clk *clk); |
| 47 | void (*clk_deny_idle)(struct clk *clk); |
| 48 | }; |
| 49 | |
| 50 | extern unsigned int mpurate; |
| 51 | extern struct list_head clocks; |
| 52 | extern spinlock_t clockfw_lock; |
| 53 | |
| 54 | extern int clk_init(struct clk_functions * custom_clocks); |
| 55 | extern int clk_register(struct clk *clk); |
| 56 | extern void clk_unregister(struct clk *clk); |
| 57 | extern void propagate_rate(struct clk *clk); |
| 58 | extern void followparent_recalc(struct clk * clk); |
| 59 | extern void clk_allow_idle(struct clk *clk); |
| 60 | extern void clk_deny_idle(struct clk *clk); |
Tony Lindgren | b824efa | 2006-04-02 17:46:20 +0100 | [diff] [blame] | 61 | extern int clk_get_usecount(struct clk *clk); |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 62 | |
| 63 | /* Clock flags */ |
| 64 | #define RATE_CKCTL (1 << 0) /* Main fixed ratio clocks */ |
| 65 | #define RATE_FIXED (1 << 1) /* Fixed clock rate */ |
| 66 | #define RATE_PROPAGATES (1 << 2) /* Program children too */ |
| 67 | #define VIRTUAL_CLOCK (1 << 3) /* Composite clock from table */ |
| 68 | #define ALWAYS_ENABLED (1 << 4) /* Clock cannot be disabled */ |
| 69 | #define ENABLE_REG_32BIT (1 << 5) /* Use 32-bit access */ |
| 70 | #define VIRTUAL_IO_ADDRESS (1 << 6) /* Clock in virtual address */ |
| 71 | #define CLOCK_IDLE_CONTROL (1 << 7) |
| 72 | #define CLOCK_NO_IDLE_PARENT (1 << 8) |
| 73 | #define DELAYED_APP (1 << 9) /* Delay application of clock */ |
| 74 | #define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */ |
| 75 | #define CM_MPU_SEL1 (1 << 11) /* Domain divider/source */ |
| 76 | #define CM_DSP_SEL1 (1 << 12) |
| 77 | #define CM_GFX_SEL1 (1 << 13) |
| 78 | #define CM_MODEM_SEL1 (1 << 14) |
| 79 | #define CM_CORE_SEL1 (1 << 15) /* Sets divider for many */ |
| 80 | #define CM_CORE_SEL2 (1 << 16) /* sets parent for GPT */ |
| 81 | #define CM_WKUP_SEL1 (1 << 17) |
| 82 | #define CM_PLL_SEL1 (1 << 18) |
| 83 | #define CM_PLL_SEL2 (1 << 19) |
| 84 | #define CM_SYSCLKOUT_SEL1 (1 << 20) |
Tony Lindgren | b824efa | 2006-04-02 17:46:20 +0100 | [diff] [blame] | 85 | #define CLOCK_IN_OMAP310 (1 << 21) |
| 86 | #define CLOCK_IN_OMAP730 (1 << 22) |
| 87 | #define CLOCK_IN_OMAP1510 (1 << 23) |
| 88 | #define CLOCK_IN_OMAP16XX (1 << 24) |
| 89 | #define CLOCK_IN_OMAP242X (1 << 25) |
| 90 | #define CLOCK_IN_OMAP243X (1 << 26) |
Tony Lindgren | 9ad5897 | 2005-11-10 14:26:53 +0000 | [diff] [blame] | 91 | |
| 92 | #endif |