diff options
author | Rajendra Nayak <rnayak@ti.com> | 2012-11-10 18:58:41 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-11-12 15:55:50 -0500 |
commit | f5dd3bb53ca45f3b47c6889e5920c562f5a37359 (patch) | |
tree | 5a10d225c445ac16943a64692a44f532e9c27d91 /arch/arm/mach-omap2 | |
parent | b5a2366c1833100aae0d00eaec4c15d15d290c85 (diff) |
ARM: OMAP: hwmod: Fix up hwmod based clkdm accesses
hwmod uses deferencing the clk pointer to acccess the clkdm.
With COMMON clk hwoever this will need to be deferenced through
the clk_hw_omap pointer, so do the necessary changes.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mike Turquette <mturquette@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 139adca3bda1..f38e4cefa2a5 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -130,7 +130,11 @@ | |||
130 | #include <linux/kernel.h> | 130 | #include <linux/kernel.h> |
131 | #include <linux/errno.h> | 131 | #include <linux/errno.h> |
132 | #include <linux/io.h> | 132 | #include <linux/io.h> |
133 | #ifdef CONFIG_COMMON_CLK | ||
134 | #include <linux/clk-provider.h> | ||
135 | #else | ||
133 | #include <linux/clk.h> | 136 | #include <linux/clk.h> |
137 | #endif | ||
134 | #include <linux/delay.h> | 138 | #include <linux/delay.h> |
135 | #include <linux/err.h> | 139 | #include <linux/err.h> |
136 | #include <linux/list.h> | 140 | #include <linux/list.h> |
@@ -614,6 +618,23 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) | |||
614 | return 0; | 618 | return 0; |
615 | } | 619 | } |
616 | 620 | ||
621 | static struct clockdomain *_get_clkdm(struct omap_hwmod *oh) | ||
622 | { | ||
623 | if (oh->clkdm) { | ||
624 | return oh->clkdm; | ||
625 | } else if (oh->_clk) { | ||
626 | #ifdef CONFIG_COMMON_CLK | ||
627 | struct clk_hw_omap *clk; | ||
628 | |||
629 | clk = to_clk_hw_omap(__clk_get_hw(oh->_clk)); | ||
630 | return clk->clkdm; | ||
631 | #else | ||
632 | return oh->_clk->clkdm; | ||
633 | #endif | ||
634 | } | ||
635 | return NULL; | ||
636 | } | ||
637 | |||
617 | /** | 638 | /** |
618 | * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active | 639 | * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active |
619 | * @oh: struct omap_hwmod * | 640 | * @oh: struct omap_hwmod * |
@@ -629,13 +650,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) | |||
629 | */ | 650 | */ |
630 | static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) | 651 | static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) |
631 | { | 652 | { |
632 | if (!oh->_clk) | 653 | struct clockdomain *clkdm, *init_clkdm; |
654 | |||
655 | clkdm = _get_clkdm(oh); | ||
656 | init_clkdm = _get_clkdm(init_oh); | ||
657 | |||
658 | if (!clkdm || !init_clkdm) | ||
633 | return -EINVAL; | 659 | return -EINVAL; |
634 | 660 | ||
635 | if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) | 661 | if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) |
636 | return 0; | 662 | return 0; |
637 | 663 | ||
638 | return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); | 664 | return clkdm_add_sleepdep(clkdm, init_clkdm); |
639 | } | 665 | } |
640 | 666 | ||
641 | /** | 667 | /** |
@@ -653,13 +679,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) | |||
653 | */ | 679 | */ |
654 | static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) | 680 | static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) |
655 | { | 681 | { |
656 | if (!oh->_clk) | 682 | struct clockdomain *clkdm, *init_clkdm; |
683 | |||
684 | clkdm = _get_clkdm(oh); | ||
685 | init_clkdm = _get_clkdm(init_oh); | ||
686 | |||
687 | if (!clkdm || !init_clkdm) | ||
657 | return -EINVAL; | 688 | return -EINVAL; |
658 | 689 | ||
659 | if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) | 690 | if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) |
660 | return 0; | 691 | return 0; |
661 | 692 | ||
662 | return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); | 693 | return clkdm_del_sleepdep(clkdm, init_clkdm); |
663 | } | 694 | } |
664 | 695 | ||
665 | /** | 696 | /** |
@@ -693,7 +724,7 @@ static int _init_main_clk(struct omap_hwmod *oh) | |||
693 | */ | 724 | */ |
694 | clk_prepare(oh->_clk); | 725 | clk_prepare(oh->_clk); |
695 | 726 | ||
696 | if (!oh->_clk->clkdm) | 727 | if (!_get_clkdm(oh)) |
697 | pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", | 728 | pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", |
698 | oh->name, oh->main_clk); | 729 | oh->name, oh->main_clk); |
699 | 730 | ||
@@ -1276,6 +1307,7 @@ static void _enable_sysc(struct omap_hwmod *oh) | |||
1276 | u8 idlemode, sf; | 1307 | u8 idlemode, sf; |
1277 | u32 v; | 1308 | u32 v; |
1278 | bool clkdm_act; | 1309 | bool clkdm_act; |
1310 | struct clockdomain *clkdm; | ||
1279 | 1311 | ||
1280 | if (!oh->class->sysc) | 1312 | if (!oh->class->sysc) |
1281 | return; | 1313 | return; |
@@ -1283,11 +1315,9 @@ static void _enable_sysc(struct omap_hwmod *oh) | |||
1283 | v = oh->_sysc_cache; | 1315 | v = oh->_sysc_cache; |
1284 | sf = oh->class->sysc->sysc_flags; | 1316 | sf = oh->class->sysc->sysc_flags; |
1285 | 1317 | ||
1318 | clkdm = _get_clkdm(oh); | ||
1286 | if (sf & SYSC_HAS_SIDLEMODE) { | 1319 | if (sf & SYSC_HAS_SIDLEMODE) { |
1287 | clkdm_act = ((oh->clkdm && | 1320 | clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU); |
1288 | oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) || | ||
1289 | (oh->_clk && oh->_clk->clkdm && | ||
1290 | oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU)); | ||
1291 | if (clkdm_act && !(oh->class->sysc->idlemodes & | 1321 | if (clkdm_act && !(oh->class->sysc->idlemodes & |
1292 | (SIDLE_SMART | SIDLE_SMART_WKUP))) | 1322 | (SIDLE_SMART | SIDLE_SMART_WKUP))) |
1293 | idlemode = HWMOD_IDLEMODE_FORCE; | 1323 | idlemode = HWMOD_IDLEMODE_FORCE; |
@@ -3556,10 +3586,17 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) | |||
3556 | { | 3586 | { |
3557 | struct clk *c; | 3587 | struct clk *c; |
3558 | struct omap_hwmod_ocp_if *oi; | 3588 | struct omap_hwmod_ocp_if *oi; |
3589 | struct clockdomain *clkdm; | ||
3590 | #ifdef CONFIG_COMMON_CLK | ||
3591 | struct clk_hw_omap *clk; | ||
3592 | #endif | ||
3559 | 3593 | ||
3560 | if (!oh) | 3594 | if (!oh) |
3561 | return NULL; | 3595 | return NULL; |
3562 | 3596 | ||
3597 | if (oh->clkdm) | ||
3598 | return oh->clkdm->pwrdm.ptr; | ||
3599 | |||
3563 | if (oh->_clk) { | 3600 | if (oh->_clk) { |
3564 | c = oh->_clk; | 3601 | c = oh->_clk; |
3565 | } else { | 3602 | } else { |
@@ -3569,11 +3606,16 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) | |||
3569 | c = oi->_clk; | 3606 | c = oi->_clk; |
3570 | } | 3607 | } |
3571 | 3608 | ||
3572 | if (!c->clkdm) | 3609 | #ifdef CONFIG_COMMON_CLK |
3610 | clk = to_clk_hw_omap(__clk_get_hw(c)); | ||
3611 | clkdm = clk->clkdm; | ||
3612 | #else | ||
3613 | clkdm = c->clkdm; | ||
3614 | #endif | ||
3615 | if (!clkdm) | ||
3573 | return NULL; | 3616 | return NULL; |
3574 | 3617 | ||
3575 | return c->clkdm->pwrdm.ptr; | 3618 | return clkdm->pwrdm.ptr; |
3576 | |||
3577 | } | 3619 | } |
3578 | 3620 | ||
3579 | /** | 3621 | /** |