Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * OMAP2/3 interface clock control |
| 3 | * |
| 4 | * Copyright (C) 2011 Nokia Corporation |
| 5 | * Paul Walmsley |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | #undef DEBUG |
| 12 | |
| 13 | #include <linux/kernel.h> |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 14 | #include <linux/clk-provider.h> |
Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 15 | #include <linux/io.h> |
| 16 | |
Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 17 | |
| 18 | #include "clock.h" |
| 19 | #include "clock2xxx.h" |
| 20 | #include "cm2xxx_3xxx.h" |
| 21 | #include "cm-regbits-24xx.h" |
| 22 | |
| 23 | /* Private functions */ |
| 24 | |
| 25 | /* XXX */ |
Rajendra Nayak | b4777a2 | 2012-04-27 15:53:48 +0530 | [diff] [blame] | 26 | void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk) |
Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 27 | { |
| 28 | u32 v, r; |
| 29 | |
| 30 | r = ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); |
| 31 | |
| 32 | v = __raw_readl((__force void __iomem *)r); |
| 33 | v |= (1 << clk->enable_bit); |
| 34 | __raw_writel(v, (__force void __iomem *)r); |
| 35 | } |
| 36 | |
| 37 | /* XXX */ |
Rajendra Nayak | b4777a2 | 2012-04-27 15:53:48 +0530 | [diff] [blame] | 38 | void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk) |
Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 39 | { |
| 40 | u32 v, r; |
| 41 | |
| 42 | r = ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); |
| 43 | |
| 44 | v = __raw_readl((__force void __iomem *)r); |
| 45 | v &= ~(1 << clk->enable_bit); |
| 46 | __raw_writel(v, (__force void __iomem *)r); |
| 47 | } |
| 48 | |
| 49 | /* Public data */ |
| 50 | |
Rajendra Nayak | b4777a2 | 2012-04-27 15:53:48 +0530 | [diff] [blame] | 51 | const struct clk_hw_omap_ops clkhwops_iclk = { |
| 52 | .allow_idle = omap2_clkt_iclk_allow_idle, |
| 53 | .deny_idle = omap2_clkt_iclk_deny_idle, |
| 54 | }; |
| 55 | |
Mike Turquette | 32cc002 | 2012-11-10 16:58:41 -0700 | [diff] [blame] | 56 | const struct clk_hw_omap_ops clkhwops_iclk_wait = { |
| 57 | .allow_idle = omap2_clkt_iclk_allow_idle, |
| 58 | .deny_idle = omap2_clkt_iclk_deny_idle, |
| 59 | .find_idlest = omap2_clk_dflt_find_idlest, |
| 60 | .find_companion = omap2_clk_dflt_find_companion, |
| 61 | }; |
Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 62 | |
Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 63 | |
Paul Walmsley | 530e544 | 2011-02-25 15:39:28 -0700 | [diff] [blame] | 64 | |