diff options
author | Tony Lindgren <tony@atomide.com> | 2012-11-26 15:32:50 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-11-26 15:32:50 -0500 |
commit | 8b9c1ac2e11a9fb3a5a8860fb7570ff7633aa7f7 (patch) | |
tree | 282feb4b7a0f4b430b363048616f50e27f656594 /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 558a0780b0a04862a678f7823215424b4e5501f9 (diff) | |
parent | c567b0584c352e7f97ced003be46bed8581ddd5b (diff) |
Merge tag 'omap-devel-a-for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending into omap-for-v3.8/devel-pcrm
Some miscellaneous OMAP hwmod changes for 3.8, along with a PRM
change needed for one of the hwmod patches to function.
Basic test logs for this branch on top of Tony's
omap-for-v3.8/clock branch at commit
558a0780b0a04862a678f7823215424b4e5501f9 are here:
http://www.pwsan.com/omap/testlogs/hwmod_devel_a_3.8/20121121161522/
However, omap-for-v3.8/clock at 558a0780 does not include some fixes
that are needed for a successful test. With several reverts,
fixes, and workarounds applied, the following test logs were
obtained:
http://www.pwsan.com/omap/testlogs/TEST_hwmod_devel_a_3.8/20121121162719/
which indicate that the series tests cleanly.
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 82 |
1 files changed, 67 insertions, 15 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 68616b2b5b96..a8090907fe35 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -187,6 +187,8 @@ struct omap_hwmod_soc_ops { | |||
187 | int (*is_hardreset_asserted)(struct omap_hwmod *oh, | 187 | int (*is_hardreset_asserted)(struct omap_hwmod *oh, |
188 | struct omap_hwmod_rst_info *ohri); | 188 | struct omap_hwmod_rst_info *ohri); |
189 | int (*init_clkdm)(struct omap_hwmod *oh); | 189 | int (*init_clkdm)(struct omap_hwmod *oh); |
190 | void (*update_context_lost)(struct omap_hwmod *oh); | ||
191 | int (*get_context_lost)(struct omap_hwmod *oh); | ||
190 | }; | 192 | }; |
191 | 193 | ||
192 | /* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */ | 194 | /* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */ |
@@ -1983,6 +1985,42 @@ static void _reconfigure_io_chain(void) | |||
1983 | } | 1985 | } |
1984 | 1986 | ||
1985 | /** | 1987 | /** |
1988 | * _omap4_update_context_lost - increment hwmod context loss counter if | ||
1989 | * hwmod context was lost, and clear hardware context loss reg | ||
1990 | * @oh: hwmod to check for context loss | ||
1991 | * | ||
1992 | * If the PRCM indicates that the hwmod @oh lost context, increment | ||
1993 | * our in-memory context loss counter, and clear the RM_*_CONTEXT | ||
1994 | * bits. No return value. | ||
1995 | */ | ||
1996 | static void _omap4_update_context_lost(struct omap_hwmod *oh) | ||
1997 | { | ||
1998 | if (oh->prcm.omap4.flags & HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT) | ||
1999 | return; | ||
2000 | |||
2001 | if (!prm_was_any_context_lost_old(oh->clkdm->pwrdm.ptr->prcm_partition, | ||
2002 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
2003 | oh->prcm.omap4.context_offs)) | ||
2004 | return; | ||
2005 | |||
2006 | oh->prcm.omap4.context_lost_counter++; | ||
2007 | prm_clear_context_loss_flags_old(oh->clkdm->pwrdm.ptr->prcm_partition, | ||
2008 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
2009 | oh->prcm.omap4.context_offs); | ||
2010 | } | ||
2011 | |||
2012 | /** | ||
2013 | * _omap4_get_context_lost - get context loss counter for a hwmod | ||
2014 | * @oh: hwmod to get context loss counter for | ||
2015 | * | ||
2016 | * Returns the in-memory context loss counter for a hwmod. | ||
2017 | */ | ||
2018 | static int _omap4_get_context_lost(struct omap_hwmod *oh) | ||
2019 | { | ||
2020 | return oh->prcm.omap4.context_lost_counter; | ||
2021 | } | ||
2022 | |||
2023 | /** | ||
1986 | * _enable - enable an omap_hwmod | 2024 | * _enable - enable an omap_hwmod |
1987 | * @oh: struct omap_hwmod * | 2025 | * @oh: struct omap_hwmod * |
1988 | * | 2026 | * |
@@ -2065,6 +2103,9 @@ static int _enable(struct omap_hwmod *oh) | |||
2065 | if (soc_ops.enable_module) | 2103 | if (soc_ops.enable_module) |
2066 | soc_ops.enable_module(oh); | 2104 | soc_ops.enable_module(oh); |
2067 | 2105 | ||
2106 | if (soc_ops.update_context_lost) | ||
2107 | soc_ops.update_context_lost(oh); | ||
2108 | |||
2068 | r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) : | 2109 | r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) : |
2069 | -EINVAL; | 2110 | -EINVAL; |
2070 | if (!r) { | 2111 | if (!r) { |
@@ -3386,7 +3427,7 @@ int omap_hwmod_reset(struct omap_hwmod *oh) | |||
3386 | /** | 3427 | /** |
3387 | * omap_hwmod_count_resources - count number of struct resources needed by hwmod | 3428 | * omap_hwmod_count_resources - count number of struct resources needed by hwmod |
3388 | * @oh: struct omap_hwmod * | 3429 | * @oh: struct omap_hwmod * |
3389 | * @res: pointer to the first element of an array of struct resource to fill | 3430 | * @flags: Type of resources to include when counting (IRQ/DMA/MEM) |
3390 | * | 3431 | * |
3391 | * Count the number of struct resource array elements necessary to | 3432 | * Count the number of struct resource array elements necessary to |
3392 | * contain omap_hwmod @oh resources. Intended to be called by code | 3433 | * contain omap_hwmod @oh resources. Intended to be called by code |
@@ -3399,20 +3440,25 @@ int omap_hwmod_reset(struct omap_hwmod *oh) | |||
3399 | * resource IDs. | 3440 | * resource IDs. |
3400 | * | 3441 | * |
3401 | */ | 3442 | */ |
3402 | int omap_hwmod_count_resources(struct omap_hwmod *oh) | 3443 | int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags) |
3403 | { | 3444 | { |
3404 | struct omap_hwmod_ocp_if *os; | 3445 | int ret = 0; |
3405 | struct list_head *p; | ||
3406 | int ret; | ||
3407 | int i = 0; | ||
3408 | 3446 | ||
3409 | ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); | 3447 | if (flags & IORESOURCE_IRQ) |
3448 | ret += _count_mpu_irqs(oh); | ||
3410 | 3449 | ||
3411 | p = oh->slave_ports.next; | 3450 | if (flags & IORESOURCE_DMA) |
3451 | ret += _count_sdma_reqs(oh); | ||
3412 | 3452 | ||
3413 | while (i < oh->slaves_cnt) { | 3453 | if (flags & IORESOURCE_MEM) { |
3414 | os = _fetch_next_ocp_if(&p, &i); | 3454 | int i = 0; |
3415 | ret += _count_ocp_if_addr_spaces(os); | 3455 | struct omap_hwmod_ocp_if *os; |
3456 | struct list_head *p = oh->slave_ports.next; | ||
3457 | |||
3458 | while (i < oh->slaves_cnt) { | ||
3459 | os = _fetch_next_ocp_if(&p, &i); | ||
3460 | ret += _count_ocp_if_addr_spaces(os); | ||
3461 | } | ||
3416 | } | 3462 | } |
3417 | 3463 | ||
3418 | return ret; | 3464 | return ret; |
@@ -3907,17 +3953,21 @@ ohsps_unlock: | |||
3907 | * omap_hwmod_get_context_loss_count - get lost context count | 3953 | * omap_hwmod_get_context_loss_count - get lost context count |
3908 | * @oh: struct omap_hwmod * | 3954 | * @oh: struct omap_hwmod * |
3909 | * | 3955 | * |
3910 | * Query the powerdomain of of @oh to get the context loss | 3956 | * Returns the context loss count of associated @oh |
3911 | * count for this device. | 3957 | * upon success, or zero if no context loss data is available. |
3912 | * | 3958 | * |
3913 | * Returns the context loss count of the powerdomain assocated with @oh | 3959 | * On OMAP4, this queries the per-hwmod context loss register, |
3914 | * upon success, or zero if no powerdomain exists for @oh. | 3960 | * assuming one exists. If not, or on OMAP2/3, this queries the |
3961 | * enclosing powerdomain context loss count. | ||
3915 | */ | 3962 | */ |
3916 | int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) | 3963 | int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) |
3917 | { | 3964 | { |
3918 | struct powerdomain *pwrdm; | 3965 | struct powerdomain *pwrdm; |
3919 | int ret = 0; | 3966 | int ret = 0; |
3920 | 3967 | ||
3968 | if (soc_ops.get_context_lost) | ||
3969 | return soc_ops.get_context_lost(oh); | ||
3970 | |||
3921 | pwrdm = omap_hwmod_get_pwrdm(oh); | 3971 | pwrdm = omap_hwmod_get_pwrdm(oh); |
3922 | if (pwrdm) | 3972 | if (pwrdm) |
3923 | ret = pwrdm_get_context_loss_count(pwrdm); | 3973 | ret = pwrdm_get_context_loss_count(pwrdm); |
@@ -4032,6 +4082,8 @@ void __init omap_hwmod_init(void) | |||
4032 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; | 4082 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; |
4033 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; | 4083 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; |
4034 | soc_ops.init_clkdm = _init_clkdm; | 4084 | soc_ops.init_clkdm = _init_clkdm; |
4085 | soc_ops.update_context_lost = _omap4_update_context_lost; | ||
4086 | soc_ops.get_context_lost = _omap4_get_context_lost; | ||
4035 | } else if (soc_is_am33xx()) { | 4087 | } else if (soc_is_am33xx()) { |
4036 | soc_ops.enable_module = _am33xx_enable_module; | 4088 | soc_ops.enable_module = _am33xx_enable_module; |
4037 | soc_ops.disable_module = _am33xx_disable_module; | 4089 | soc_ops.disable_module = _am33xx_disable_module; |