@@ -176,6 +176,7 @@ struct gpio_bank {
int stride;
bool looses_context;
u32 ctx_lost_cnt_before;
+ bool off_mode_wkup_wa_enabled;
};
/*
@@ -1636,6 +1637,7 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank)
static int gpio;
bank->mod_usage = 0;
+ bank->off_mode_wkup_wa_enabled = false;
/*
* REVISIT eventually switch from OMAP-specific gpio structs
* over to the generic ones
@@ -1858,11 +1860,9 @@ static struct sys_device omap_gpio_device = {
static void omap_gpio_save_context(struct gpio_bank *bank);
static void omap_gpio_restore_context(struct gpio_bank *bank);
-static int workaround_enabled;
-
void omap2_gpio_prepare_for_idle(int off_mode)
{
- int i, c = 0;
+ int i;
for (i = 0; i < gpio_bank_count; i++) {
struct gpio_bank *bank = &gpio_bank[i];
@@ -1922,7 +1922,7 @@ void omap2_gpio_prepare_for_idle(int off_mode)
__raw_writel(l2, bank->base + OMAP4_GPIO_RISINGDETECT);
}
- c++;
+ bank->off_mode_wkup_wa_enabled = true;
save_gpio_ctx:
pdev = to_platform_device(bank->dev);
@@ -1930,11 +1930,6 @@ save_gpio_ctx:
omap_device_get_context_loss_count(pdev);
omap_gpio_save_context(bank);
}
- if (!c) {
- workaround_enabled = 0;
- return;
- }
- workaround_enabled = 1;
}
void omap2_gpio_resume_after_idle(void)
@@ -1964,7 +1959,7 @@ void omap2_gpio_resume_after_idle(void)
if (ctx_lost_cnt_after == bank->ctx_lost_cnt_before)
continue;
- if (!workaround_enabled)
+ if (!bank->off_mode_wkup_wa_enabled)
goto restore_gpio_ctx;
if (!(bank->enabled_non_wakeup_gpios))
@@ -2042,6 +2037,7 @@ void omap2_gpio_resume_after_idle(void)
}
restore_gpio_ctx:
+ bank->off_mode_wkup_wa_enabled = false;
omap_gpio_restore_context(bank);
}