Paul Walmsley | 81b34fb | 2010-02-22 22:09:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * clock2430.c - OMAP2430-specific clock integration code |
| 3 | * |
| 4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2004-2010 Nokia Corporation |
| 6 | * |
| 7 | * Contacts: |
| 8 | * Richard Woodruff <r-woodruff2@ti.com> |
| 9 | * Paul Walmsley |
| 10 | * |
| 11 | * Based on earlier work by Tuukka Tikkanen, Tony Lindgren, |
| 12 | * Gordon McNutt and RidgeRun, Inc. |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License version 2 as |
| 16 | * published by the Free Software Foundation. |
| 17 | */ |
| 18 | #undef DEBUG |
| 19 | |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/clk.h> |
| 22 | #include <linux/io.h> |
| 23 | |
Tony Lindgren | dbc0416 | 2012-08-31 10:59:07 -0700 | [diff] [blame] | 24 | #include "soc.h" |
Tony Lindgren | ee0839c | 2012-02-24 10:34:35 -0800 | [diff] [blame] | 25 | #include "iomap.h" |
Paul Walmsley | 81b34fb | 2010-02-22 22:09:22 -0700 | [diff] [blame] | 26 | #include "clock.h" |
| 27 | #include "clock2xxx.h" |
Paul Walmsley | ff4ae5d | 2012-10-21 01:01:11 -0600 | [diff] [blame] | 28 | #include "cm2xxx.h" |
Paul Walmsley | 81b34fb | 2010-02-22 22:09:22 -0700 | [diff] [blame] | 29 | #include "cm-regbits-24xx.h" |
| 30 | |
| 31 | /** |
| 32 | * omap2430_clk_i2chs_find_idlest - return CM_IDLEST info for 2430 I2CHS |
| 33 | * @clk: struct clk * being enabled |
| 34 | * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into |
| 35 | * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into |
| 36 | * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator |
| 37 | * |
| 38 | * OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the |
| 39 | * CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function |
| 40 | * passes back the correct CM_IDLEST register address for I2CHS |
| 41 | * modules. No return value. |
| 42 | */ |
Rajendra Nayak | ed1ebc4 | 2012-04-27 15:59:32 +0530 | [diff] [blame^] | 43 | #ifdef CONFIG_COMMON_CLK |
| 44 | static void omap2430_clk_i2chs_find_idlest(struct clk_hw_omap *clk, |
| 45 | #else |
Paul Walmsley | 81b34fb | 2010-02-22 22:09:22 -0700 | [diff] [blame] | 46 | static void omap2430_clk_i2chs_find_idlest(struct clk *clk, |
Rajendra Nayak | ed1ebc4 | 2012-04-27 15:59:32 +0530 | [diff] [blame^] | 47 | #endif |
Paul Walmsley | 81b34fb | 2010-02-22 22:09:22 -0700 | [diff] [blame] | 48 | void __iomem **idlest_reg, |
| 49 | u8 *idlest_bit, |
| 50 | u8 *idlest_val) |
| 51 | { |
| 52 | *idlest_reg = OMAP2430_CM_REGADDR(CORE_MOD, CM_IDLEST); |
| 53 | *idlest_bit = clk->enable_bit; |
| 54 | *idlest_val = OMAP24XX_CM_IDLEST_VAL; |
| 55 | } |
| 56 | |
| 57 | /* 2430 I2CHS has non-standard IDLEST register */ |
Rajendra Nayak | ed1ebc4 | 2012-04-27 15:59:32 +0530 | [diff] [blame^] | 58 | #ifdef CONFIG_COMMON_CLK |
| 59 | const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait = { |
| 60 | .find_idlest = omap2430_clk_i2chs_find_idlest, |
| 61 | .find_companion = omap2_clk_dflt_find_companion, |
| 62 | }; |
| 63 | #else |
Paul Walmsley | 81b34fb | 2010-02-22 22:09:22 -0700 | [diff] [blame] | 64 | const struct clkops clkops_omap2430_i2chs_wait = { |
| 65 | .enable = omap2_dflt_clk_enable, |
| 66 | .disable = omap2_dflt_clk_disable, |
| 67 | .find_idlest = omap2430_clk_i2chs_find_idlest, |
| 68 | .find_companion = omap2_clk_dflt_find_companion, |
| 69 | }; |
Rajendra Nayak | ed1ebc4 | 2012-04-27 15:59:32 +0530 | [diff] [blame^] | 70 | #endif |