-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: shmobile: add struct clk_ratio and fixed ratio clock macro
Renesas chip has many clocks inside, and some of them are using fixed ratio via parent clock. Current shmobile clock code is using own divX_recalc function and divX_clk_ops. This patch can reduce these code Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
- Loading branch information
Kuninori Morimoto
authored and
Simon Horman
committed
Apr 2, 2013
1 parent
b3186c6
commit f5942c7
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#ifndef CLOCK_H | ||
#define CLOCK_H | ||
|
||
unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk); | ||
extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops; | ||
|
||
/* clock ratio */ | ||
struct clk_ratio { | ||
int mul; | ||
int div; | ||
}; | ||
|
||
#define SH_CLK_RATIO(name, m, d) \ | ||
static struct clk_ratio name ##_ratio = { \ | ||
.mul = m, \ | ||
.div = d, \ | ||
} | ||
|
||
#define SH_FIXED_RATIO_CLKg(name, p, r) \ | ||
struct clk name = { \ | ||
.parent = &p, \ | ||
.ops = &shmobile_fixed_ratio_clk_ops,\ | ||
.priv = &r ## _ratio, \ | ||
} | ||
|
||
#define SH_FIXED_RATIO_CLK(name, p, r) \ | ||
static SH_FIXED_RATIO_CLKg(name, p, r); | ||
|
||
#define SH_FIXED_RATIO_CLK_SET(name, p, m, d) \ | ||
SH_CLK_RATIO(name, m, d); \ | ||
SH_FIXED_RATIO_CLK(name, p, name); | ||
|
||
#define SH_CLK_SET_RATIO(p, m, d) \ | ||
{ \ | ||
(p)->mul = m; \ | ||
(p)->div = d; \ | ||
} | ||
|
||
#endif |