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>
This commit is contained in:
parent
d4775356bb
commit
eda2030a5b
2 changed files with 8 additions and 2 deletions
|
@ -355,7 +355,7 @@ static int clk_establish_mapping(struct clk *clk)
|
||||||
*/
|
*/
|
||||||
if (!clk->parent) {
|
if (!clk->parent) {
|
||||||
clk->mapping = &dummy_mapping;
|
clk->mapping = &dummy_mapping;
|
||||||
return 0;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -384,6 +384,9 @@ static int clk_establish_mapping(struct clk *clk)
|
||||||
}
|
}
|
||||||
|
|
||||||
clk->mapping = mapping;
|
clk->mapping = mapping;
|
||||||
|
out:
|
||||||
|
clk->mapped_reg = clk->mapping->base;
|
||||||
|
clk->mapped_reg += (phys_addr_t)clk->enable_reg - clk->mapping->phys;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,10 +405,12 @@ static void clk_teardown_mapping(struct clk *clk)
|
||||||
|
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
if (mapping == &dummy_mapping)
|
if (mapping == &dummy_mapping)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
kref_put(&mapping->ref, clk_destroy_mapping);
|
kref_put(&mapping->ref, clk_destroy_mapping);
|
||||||
clk->mapping = NULL;
|
clk->mapping = NULL;
|
||||||
|
out:
|
||||||
|
clk->mapped_reg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clk_register(struct clk *clk)
|
int clk_register(struct clk *clk)
|
||||||
|
|
|
@ -49,6 +49,7 @@ struct clk {
|
||||||
|
|
||||||
void __iomem *enable_reg;
|
void __iomem *enable_reg;
|
||||||
unsigned int enable_bit;
|
unsigned int enable_bit;
|
||||||
|
void __iomem *mapped_reg;
|
||||||
|
|
||||||
unsigned long arch_flags;
|
unsigned long arch_flags;
|
||||||
void *priv;
|
void *priv;
|
||||||
|
|
Loading…
Add table
Reference in a new issue