diff options
author | Magnus Damm <damm@opensource.se> | 2011-12-08 08:58:54 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-12-09 04:01:05 -0500 |
commit | eda2030a5b60bb818f062adacbcfb6fd2d366fb9 (patch) | |
tree | 1806b5e9f0d86e3e397973020418ad3144921b65 /drivers/sh | |
parent | d4775356bb39eaa305844cc6cc4c267236535956 (diff) |
sh: extend clock struct with mapped_reg member
Add a "mapped_reg" member to struct clk and use that
to keep the ioremapped register based on enable_reg.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/sh')
-rw-r--r-- | drivers/sh/clk/core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index db257a35e71a..7715de2629c1 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c | |||
@@ -355,7 +355,7 @@ static int clk_establish_mapping(struct clk *clk) | |||
355 | */ | 355 | */ |
356 | if (!clk->parent) { | 356 | if (!clk->parent) { |
357 | clk->mapping = &dummy_mapping; | 357 | clk->mapping = &dummy_mapping; |
358 | return 0; | 358 | goto out; |
359 | } | 359 | } |
360 | 360 | ||
361 | /* | 361 | /* |
@@ -384,6 +384,9 @@ static int clk_establish_mapping(struct clk *clk) | |||
384 | } | 384 | } |
385 | 385 | ||
386 | clk->mapping = mapping; | 386 | clk->mapping = mapping; |
387 | out: | ||
388 | clk->mapped_reg = clk->mapping->base; | ||
389 | clk->mapped_reg += (phys_addr_t)clk->enable_reg - clk->mapping->phys; | ||
387 | return 0; | 390 | return 0; |
388 | } | 391 | } |
389 | 392 | ||
@@ -402,10 +405,12 @@ static void clk_teardown_mapping(struct clk *clk) | |||
402 | 405 | ||
403 | /* Nothing to do */ | 406 | /* Nothing to do */ |
404 | if (mapping == &dummy_mapping) | 407 | if (mapping == &dummy_mapping) |
405 | return; | 408 | goto out; |
406 | 409 | ||
407 | kref_put(&mapping->ref, clk_destroy_mapping); | 410 | kref_put(&mapping->ref, clk_destroy_mapping); |
408 | clk->mapping = NULL; | 411 | clk->mapping = NULL; |
412 | out: | ||
413 | clk->mapped_reg = NULL; | ||
409 | } | 414 | } |
410 | 415 | ||
411 | int clk_register(struct clk *clk) | 416 | int clk_register(struct clk *clk) |