Skip to content

Commit

Permalink
sh: extend clock struct with mapped_reg member
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Dec 9, 2011
1 parent d477535 commit eda2030
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/sh/clk/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ static int clk_establish_mapping(struct clk *clk)
*/
if (!clk->parent) {
clk->mapping = &dummy_mapping;
return 0;
goto out;
}

/*
Expand Down Expand Up @@ -384,6 +384,9 @@ static int clk_establish_mapping(struct clk *clk)
}

clk->mapping = mapping;
out:
clk->mapped_reg = clk->mapping->base;
clk->mapped_reg += (phys_addr_t)clk->enable_reg - clk->mapping->phys;
return 0;
}

Expand All @@ -402,10 +405,12 @@ static void clk_teardown_mapping(struct clk *clk)

/* Nothing to do */
if (mapping == &dummy_mapping)
return;
goto out;

kref_put(&mapping->ref, clk_destroy_mapping);
clk->mapping = NULL;
out:
clk->mapped_reg = NULL;
}

int clk_register(struct clk *clk)
Expand Down
1 change: 1 addition & 0 deletions include/linux/sh_clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct clk {

void __iomem *enable_reg;
unsigned int enable_bit;
void __iomem *mapped_reg;

unsigned long arch_flags;
void *priv;
Expand Down

0 comments on commit eda2030

Please sign in to comment.