diff options
author | Benoit Cousson <b-cousson@ti.com> | 2011-07-10 07:56:30 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-07-10 07:56:30 -0400 |
commit | 6ae769973adf1325115d0dfe3fec17e26cbacd81 (patch) | |
tree | 767e411f4fed8ab13fd7da0d419a18b767b4e57b /arch/arm | |
parent | a5322c6f3a3b0a81347c57de2f3a86b851b49bcf (diff) |
OMAP2+: hwmod: Init clkdm field at boot time
At boot time, lookup the clkdm_name to get the clkdm
structure pointer for further usage.
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 34 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 |
2 files changed, 34 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 02b6016393a8..1f6f47f1d82a 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -990,9 +990,40 @@ static struct omap_hwmod *_lookup(const char *name) | |||
990 | 990 | ||
991 | return oh; | 991 | return oh; |
992 | } | 992 | } |
993 | /** | ||
994 | * _init_clkdm - look up a clockdomain name, store pointer in omap_hwmod | ||
995 | * @oh: struct omap_hwmod * | ||
996 | * | ||
997 | * Convert a clockdomain name stored in a struct omap_hwmod into a | ||
998 | * clockdomain pointer, and save it into the struct omap_hwmod. | ||
999 | * return -EINVAL if clkdm_name does not exist or if the lookup failed. | ||
1000 | */ | ||
1001 | static int _init_clkdm(struct omap_hwmod *oh) | ||
1002 | { | ||
1003 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) | ||
1004 | return 0; | ||
1005 | |||
1006 | if (!oh->clkdm_name) { | ||
1007 | pr_warning("omap_hwmod: %s: no clkdm_name\n", oh->name); | ||
1008 | return -EINVAL; | ||
1009 | } | ||
1010 | |||
1011 | oh->clkdm = clkdm_lookup(oh->clkdm_name); | ||
1012 | if (!oh->clkdm) { | ||
1013 | pr_warning("omap_hwmod: %s: could not associate to clkdm %s\n", | ||
1014 | oh->name, oh->clkdm_name); | ||
1015 | return -EINVAL; | ||
1016 | } | ||
1017 | |||
1018 | pr_debug("omap_hwmod: %s: associated to clkdm %s\n", | ||
1019 | oh->name, oh->clkdm_name); | ||
1020 | |||
1021 | return 0; | ||
1022 | } | ||
993 | 1023 | ||
994 | /** | 1024 | /** |
995 | * _init_clocks - clk_get() all clocks associated with this hwmod | 1025 | * _init_clocks - clk_get() all clocks associated with this hwmod. Retrieve as |
1026 | * well the clockdomain. | ||
996 | * @oh: struct omap_hwmod * | 1027 | * @oh: struct omap_hwmod * |
997 | * @data: not used; pass NULL | 1028 | * @data: not used; pass NULL |
998 | * | 1029 | * |
@@ -1012,6 +1043,7 @@ static int _init_clocks(struct omap_hwmod *oh, void *data) | |||
1012 | ret |= _init_main_clk(oh); | 1043 | ret |= _init_main_clk(oh); |
1013 | ret |= _init_interface_clks(oh); | 1044 | ret |= _init_interface_clks(oh); |
1014 | ret |= _init_opt_clks(oh); | 1045 | ret |= _init_opt_clks(oh); |
1046 | ret |= _init_clkdm(oh); | ||
1015 | 1047 | ||
1016 | if (!ret) | 1048 | if (!ret) |
1017 | oh->_state = _HWMOD_STATE_CLKS_INITED; | 1049 | oh->_state = _HWMOD_STATE_CLKS_INITED; |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 21d392233ed0..3306bdfb79a1 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -516,6 +516,7 @@ struct omap_hwmod { | |||
516 | struct clk *_clk; | 516 | struct clk *_clk; |
517 | struct omap_hwmod_opt_clk *opt_clks; | 517 | struct omap_hwmod_opt_clk *opt_clks; |
518 | char *clkdm_name; | 518 | char *clkdm_name; |
519 | struct clockdomain *clkdm; | ||
519 | char *vdd_name; | 520 | char *vdd_name; |
520 | struct voltagedomain *voltdm; | 521 | struct voltagedomain *voltdm; |
521 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ | 522 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ |