diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /arch/arm/plat-omap | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'arch/arm/plat-omap')
84 files changed, 13823 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c new file mode 100644 index 00000000000..3ba4d11ca73 --- /dev/null +++ b/arch/arm/plat-omap/clock.c | |||
| @@ -0,0 +1,594 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/plat-omap/clock.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2004 - 2008 Nokia corporation | ||
| 5 | * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> | ||
| 6 | * | ||
| 7 | * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License version 2 as | ||
| 11 | * published by the Free Software Foundation. | ||
| 12 | */ | ||
| 13 | #include <linux/kernel.h> | ||
| 14 | #include <linux/init.h> | ||
| 15 | #include <linux/list.h> | ||
| 16 | #include <linux/errno.h> | ||
| 17 | #include <linux/err.h> | ||
| 18 | #include <linux/string.h> | ||
| 19 | #include <linux/clk.h> | ||
| 20 | #include <linux/mutex.h> | ||
| 21 | #include <linux/cpufreq.h> | ||
| 22 | #include <linux/debugfs.h> | ||
| 23 | #include <linux/io.h> | ||
| 24 | |||
| 25 | #include <plat/clock.h> | ||
| 26 | |||
| 27 | static LIST_HEAD(clocks); | ||
| 28 | static DEFINE_MUTEX(clocks_mutex); | ||
| 29 | static DEFINE_SPINLOCK(clockfw_lock); | ||
| 30 | |||
| 31 | static struct clk_functions *arch_clock; | ||
| 32 | |||
| 33 | /* | ||
| 34 | * Standard clock functions defined in include/linux/clk.h | ||
| 35 | */ | ||
| 36 | |||
| 37 | int clk_enable(struct clk *clk) | ||
| 38 | { | ||
| 39 | unsigned long flags; | ||
| 40 | int ret; | ||
| 41 | |||
| 42 | if (clk == NULL || IS_ERR(clk)) | ||
| 43 | return -EINVAL; | ||
| 44 | |||
| 45 | if (!arch_clock || !arch_clock->clk_enable) | ||
| 46 | return -EINVAL; | ||
| 47 | |||
| 48 | spin_lock_irqsave(&clockfw_lock, flags); | ||
| 49 | ret = arch_clock->clk_enable(clk); | ||
| 50 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
| 51 | |||
| 52 | return ret; | ||
| 53 | } | ||
| 54 | EXPORT_SYMBOL(clk_enable); | ||
| 55 | |||
| 56 | void clk_disable(struct clk *clk) | ||
| 57 | { | ||
| 58 | unsigned long flags; | ||
| 59 | |||
| 60 | if (clk == NULL || IS_ERR(clk)) | ||
| 61 | return; | ||
| 62 | |||
| 63 | if (!arch_clock || !arch_clock->clk_disable) | ||
| 64 | return; | ||
| 65 | |||
| 66 | spin_lock_irqsave(&clockfw_lock, flags); | ||
| 67 | if (clk->usecount == 0) { | ||
| 68 | pr_err("Trying disable clock %s with 0 usecount\n", | ||
| 69 | clk->name); | ||
| 70 | WARN_ON(1); | ||
| 71 | goto out; | ||
| 72 | } | ||
| 73 | |||
| 74 | arch_clock->clk_disable(clk); | ||
| 75 | |||
| 76 | out: | ||
| 77 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
| 78 | } | ||
| 79 | EXPORT_SYMBOL(clk_disable); | ||
| 80 | |||
| 81 | unsigned long clk_get_rate(struct clk *clk) | ||
| 82 | { | ||
| 83 | unsigned long flags; | ||
| 84 | unsigned long ret; | ||
| 85 | |||
| 86 | if (clk == NULL || IS_ERR(clk)) | ||
| 87 | return 0; | ||
| 88 | |||
| 89 | spin_lock_irqsave(&clockfw_lock, flags); | ||
