diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-01-23 17:57:12 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-08 12:50:20 -0500 |
commit | 5fe23380405d3a65ce6f46d270c4d3a31027430b (patch) | |
tree | e7c9753c209c2c90b91fd5c507396e51187dbf25 /drivers/i2c | |
parent | 0e9ae109e4eece027ede4f3f0edc8e659f8298c9 (diff) |
[ARM] omap: i2c: remove conditional ick clocks
By providing a dummy ick for OMAP1510 and OMAP310, we avoid having
SoC conditional clock information in i2c-omap.c. Also, fix the
error handling by making sure we propagate the error returned via
clk_get().
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 96814fb67155..ece0125a1ee5 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -193,22 +193,24 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg) | |||
193 | 193 | ||
194 | static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev) | 194 | static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev) |
195 | { | 195 | { |
196 | if (cpu_is_omap16xx() || cpu_class_is_omap2()) { | 196 | int ret; |
197 | dev->iclk = clk_get(dev->dev, "ick"); | 197 | |
198 | if (IS_ERR(dev->iclk)) { | 198 | dev->iclk = clk_get(dev->dev, "ick"); |
199 | dev->iclk = NULL; | 199 | if (IS_ERR(dev->iclk)) { |
200 | return -ENODEV; | 200 | ret = PTR_ERR(dev->iclk); |
201 | } | 201 | dev->iclk = NULL; |
202 | return ret; | ||
202 | } | 203 | } |
203 | 204 | ||
204 | dev->fclk = clk_get(dev->dev, "fck"); | 205 | dev->fclk = clk_get(dev->dev, "fck"); |
205 | if (IS_ERR(dev->fclk)) { | 206 | if (IS_ERR(dev->fclk)) { |
207 | ret = PTR_ERR(dev->fclk); | ||
206 | if (dev->iclk != NULL) { | 208 | if (dev->iclk != NULL) { |
207 | clk_put(dev->iclk); | 209 | clk_put(dev->iclk); |
208 | dev->iclk = NULL; | 210 | dev->iclk = NULL; |
209 | } | 211 | } |
210 | dev->fclk = NULL; | 212 | dev->fclk = NULL; |
211 | return -ENODEV; | 213 | return ret; |
212 | } | 214 | } |
213 | 215 | ||
214 | return 0; | 216 | return 0; |
@@ -218,18 +220,15 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev) | |||
218 | { | 220 | { |
219 | clk_put(dev->fclk); | 221 | clk_put(dev->fclk); |
220 | dev->fclk = NULL; | 222 | dev->fclk = NULL; |
221 | if (dev->iclk != NULL) { | 223 | clk_put(dev->iclk); |
222 | clk_put(dev->iclk); | 224 | dev->iclk = NULL; |
223 | dev->iclk = NULL; | ||
224 | } | ||
225 | } | 225 | } |
226 | 226 | ||
227 | static void omap_i2c_unidle(struct omap_i2c_dev *dev) | 227 | static void omap_i2c_unidle(struct omap_i2c_dev *dev) |
228 | { | 228 | { |
229 | WARN_ON(!dev->idle); | 229 | WARN_ON(!dev->idle); |
230 | 230 | ||
231 | if (dev->iclk != NULL) | 231 | clk_enable(dev->iclk); |
232 | clk_enable(dev->iclk); | ||
233 | clk_enable(dev->fclk); | 232 | clk_enable(dev->fclk); |
234 | dev->idle = 0; | 233 | dev->idle = 0; |
235 | if (dev->iestate) | 234 | if (dev->iestate) |
@@ -254,8 +253,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev) | |||
254 | } | 253 | } |
255 | dev->idle = 1; | 254 | dev->idle = 1; |
256 | clk_disable(dev->fclk); | 255 | clk_disable(dev->fclk); |
257 | if (dev->iclk != NULL) | 256 | clk_disable(dev->iclk); |
258 | clk_disable(dev->iclk); | ||
259 | } | 257 | } |
260 | 258 | ||
261 | static int omap_i2c_init(struct omap_i2c_dev *dev) | 259 | static int omap_i2c_init(struct omap_i2c_dev *dev) |