diff options
author | Olof Johansson <olof@lixom.net> | 2012-12-12 19:10:45 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-12-12 19:10:45 -0500 |
commit | 9c7466b217af784280d9fc841bbd559ef3bf33e9 (patch) | |
tree | c21ee243e48912201b4041fbf3f9bd9165603bd8 /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 4a76411ea3f1da9032e031f8fff8894b97d141b2 (diff) | |
parent | 48d224d1efec98b0b78e511150b4f5752beceb7c (diff) |
ARM: arm-soc: Merge branch 'next/pm2' into next/pm
Another smaller branch merged into next/pm before pull request.
Signed-off-by: Olof Johansson <olof@lixom.net>
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 3f3bf323e201..4653efb87a27 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 */ |
@@ -2015,6 +2017,42 @@ static void _reconfigure_io_chain(void) | |||
2015 | } | 2017 | } |
2016 | 2018 | ||
2017 | /** | 2019 | /** |
2020 | * _omap4_update_context_lost - increment hwmod context loss counter if | ||
2021 | * hwmod context was lost, and clear hardware context loss reg | ||
2022 | * @oh: hwmod to check for context loss | ||
2023 | * | ||
2024 | * If the PRCM indicates that the hwmod @oh lost context, increment | ||
2025 | * our in-memory context loss counter, and clear the RM_*_CONTEXT | ||
2026 | * bits. No return value. | ||
2027 | */ | ||
2028 | static void _omap4_update_context_lost(struct omap_hwmod *oh) | ||
2029 | { | ||
2030 | if (oh->prcm.omap4.flags & HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT) | ||
2031 | return; | ||
2032 | |||
2033 | if (!prm_was_any_context_lost_old(oh->clkdm->pwrdm.ptr->prcm_partition, | ||
2034 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
2035 | oh->prcm.omap4.context_offs)) | ||
2036 | return; | ||
2037 | |||
2038 | oh->prcm.omap4.context_lost_counter++; | ||
2039 | prm_clear_context_loss_flags_old(oh->clkdm->pwrdm.ptr->prcm_partition, | ||
2040 | oh->clkdm->pwrdm.ptr->prcm_offs, | ||
2041 | oh->prcm.omap4.context_offs); | ||
2042 | } | ||
2043 | |||
2044 | /** | ||
2045 | * _omap4_get_context_lost - get context loss counter for a hwmod | ||
2046 | * @oh: hwmod to get context loss counter for | ||
2047 | * | ||
2048 | * Returns the in-memory context loss counter for a hwmod. | ||
2049 | */ | ||
2050 | static int _omap4_get_context_lost(struct omap_hwmod *oh) | ||
2051 | { | ||
2052 | return oh->prcm.omap4.context_lost_counter; | ||
2053 | } | ||
2054 | |||
2055 | /** | ||
2018 | * _enable - enable an omap_hwmod | 2056 | * _enable - enable an omap_hwmod |
2019 | * @oh: struct omap_hwmod * | 2057 | * @oh: struct omap_hwmod * |
2020 | * | 2058 | * |
@@ -2097,6 +2135,9 @@ static int _enable(struct omap_hwmod *oh) | |||
2097 | if (soc_ops.enable_module) | 2135 | if (soc_ops.enable_module) |
2098 | soc_ops.enable_module(oh); | 2136 | soc_ops.enable_module(oh); |
2099 | 2137 | ||
2138 | if (soc_ops.update_context_lost) | ||
2139 | soc_ops.update_context_lost(oh); | ||
2140 | |||
2100 | r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) : | 2141 | r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) : |
2101 | -EINVAL; | 2142 | -EINVAL; |
2102 | if (!r) { | 2143 | if (!r) { |
@@ -3421,7 +3462,7 @@ int omap_hwmod_reset(struct omap_hwmod *oh) | |||
3421 | /** | 3462 | /** |
3422 | * omap_hwmod_count_resources - count number of struct resources needed by hwmod | 3463 | * omap_hwmod_count_resources - count number of struct resources needed by hwmod |
3423 | * @oh: struct omap_hwmod * | 3464 | * @oh: struct omap_hwmod * |
3424 | * @res: pointer to the first element of an array of struct resource to fill | 3465 | * @flags: Type of resources to include when counting (IRQ/DMA/MEM) |
3425 | * | 3466 | * |
3426 | * Count the number of struct resource array elements necessary to | 3467 | * Count the number of struct resource array elements necessary to |
3427 | * contain omap_hwmod @oh resources. Intended to be called by code | 3468 | * contain omap_hwmod @oh resources. Intended to be called by code |
@@ -3434,20 +3475,25 @@ int omap_hwmod_reset(struct omap_hwmod *oh) | |||
3434 | * resource IDs. | 3475 | * resource IDs. |
3435 | * | 3476 | * |
3436 | */ | 3477 | */ |
3437 | int omap_hwmod_count_resources(struct omap_hwmod *oh) | 3478 | int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags) |
3438 | { | 3479 | { |
3439 | struct omap_hwmod_ocp_if *os; | 3480 | int ret = 0; |
3440 | struct list_head *p; | ||
3441 | int ret; | ||
3442 | int i = 0; | ||
3443 | 3481 | ||
3444 | ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); | 3482 | if (flags & IORESOURCE_IRQ) |
3483 | ret += _count_mpu_irqs(oh); | ||
3445 | 3484 | ||
3446 | p = oh->slave_ports.next; | 3485 | if (flags & IORESOURCE_DMA) |
3486 | ret += _count_sdma_reqs(oh); | ||
3447 | 3487 | ||
3448 | while (i < oh->slaves_cnt) { | 3488 | if (flags & IORESOURCE_MEM) { |
3449 | os = _fetch_next_ocp_if(&p, &i); | 3489 | int i = 0; |
3450 | ret += _count_ocp_if_addr_spaces(os); | 3490 | struct omap_hwmod_ocp_if *os; |
3491 | struct list_head *p = oh->slave_ports.next; | ||
3492 | |||
3493 | while (i < oh->slaves_cnt) { | ||
3494 | os = _fetch_next_ocp_if(&p, &i); | ||
3495 | ret += _count_ocp_if_addr_spaces(os); | ||
3496 | } | ||
3451 | } | 3497 | } |
3452 | 3498 | ||
3453 | return ret; | 3499 | return ret; |
@@ -3942,17 +3988,21 @@ ohsps_unlock: | |||
3942 | * omap_hwmod_get_context_loss_count - get lost context count | 3988 | * omap_hwmod_get_context_loss_count - get lost context count |
3943 | * @oh: struct omap_hwmod * | 3989 | * @oh: struct omap_hwmod * |
3944 | * | 3990 | * |
3945 | * Query the powerdomain of of @oh to get the context loss | 3991 | * Returns the context loss count of associated @oh |
3946 | * count for this device. | 3992 | * upon success, or zero if no context loss data is available. |
3947 | * | 3993 | * |
3948 | * Returns the context loss count of the powerdomain assocated with @oh | 3994 | * On OMAP4, this queries the per-hwmod context loss register, |
3949 | * upon success, or zero if no powerdomain exists for @oh. | 3995 | * assuming one exists. If not, or on OMAP2/3, this queries the |
3996 | * enclosing powerdomain context loss count. | ||
3950 | */ | 3997 | */ |
3951 | int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) | 3998 | int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) |
3952 | { | 3999 | { |
3953 | struct powerdomain *pwrdm; | 4000 | struct powerdomain *pwrdm; |
3954 | int ret = 0; | 4001 | int ret = 0; |
3955 | 4002 | ||
4003 | if (soc_ops.get_context_lost) | ||
4004 | return soc_ops.get_context_lost(oh); | ||
4005 | |||
3956 | pwrdm = omap_hwmod_get_pwrdm(oh); | 4006 | pwrdm = omap_hwmod_get_pwrdm(oh); |
3957 | if (pwrdm) | 4007 | if (pwrdm) |
3958 | ret = pwrdm_get_context_loss_count(pwrdm); | 4008 | ret = pwrdm_get_context_loss_count(pwrdm); |
@@ -4067,6 +4117,8 @@ void __init omap_hwmod_init(void) | |||
4067 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; | 4117 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; |
4068 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; | 4118 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; |
4069 | soc_ops.init_clkdm = _init_clkdm; | 4119 | soc_ops.init_clkdm = _init_clkdm; |
4120 | soc_ops.update_context_lost = _omap4_update_context_lost; | ||
4121 | soc_ops.get_context_lost = _omap4_get_context_lost; | ||
4070 | } else if (soc_is_am33xx()) { | 4122 | } else if (soc_is_am33xx()) { |
4071 | soc_ops.enable_module = _am33xx_enable_module; | 4123 | soc_ops.enable_module = _am33xx_enable_module; |
4072 | soc_ops.disable_module = _am33xx_disable_module; | 4124 | soc_ops.disable_module = _am33xx_disable_module; |