1 From 41fd87c34e2f54d24081d1963a05ca26ffda3620 Mon Sep 17 00:00:00 2001
2 From: Russ Dill <Russ.Dill@ti.com>
3 Date: Wed, 5 Aug 2015 15:30:44 +0530
4 Subject: [PATCH 005/366] ARM: OMAP2: Drop the concept of certain power domains
5 not being able to lose context.
7 It isn't much of a win, and with hibernation, everything loses context.
9 Signed-off-by: Russ Dill <Russ.Dill@ti.com>
10 [j-keerthy@ti.com] ported to 4.1
11 Signed-off-by: Keerthy <j-keerthy@ti.com>
13 arch/arm/mach-omap2/gpio.c | 1 -
14 arch/arm/mach-omap2/powerdomain.c | 40 ---------------------------------
15 arch/arm/mach-omap2/powerdomain.h | 1 -
16 drivers/gpio/gpio-omap.c | 36 ++++++++++++-----------------
17 include/linux/platform_data/gpio-omap.h | 1 -
18 5 files changed, 14 insertions(+), 65 deletions(-)
20 diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
21 index 7a57714..689a1af 100644
22 --- a/arch/arm/mach-omap2/gpio.c
23 +++ b/arch/arm/mach-omap2/gpio.c
24 @@ -130,7 +130,6 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
27 pwrdm = omap_hwmod_get_pwrdm(oh);
28 - pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
30 pdev = omap_device_build(name, id - 1, oh, pdata, sizeof(*pdata));
32 diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
33 index 78af6d8..ef4227f 100644
34 --- a/arch/arm/mach-omap2/powerdomain.c
35 +++ b/arch/arm/mach-omap2/powerdomain.c
36 @@ -1166,43 +1166,3 @@ int pwrdm_get_context_loss_count(struct powerdomain *pwrdm)
41 - * pwrdm_can_ever_lose_context - can this powerdomain ever lose context?
42 - * @pwrdm: struct powerdomain *
44 - * Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain
45 - * can lose either memory or logic context or if @pwrdm is invalid, or
46 - * returns 0 otherwise. This function is not concerned with how the
47 - * powerdomain registers are programmed (i.e., to go off or not); it's
48 - * concerned with whether it's ever possible for this powerdomain to
49 - * go off while some other part of the chip is active. This function
50 - * assumes that every powerdomain can go to either ON or INACTIVE.
52 -bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm)
57 - pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
62 - if (pwrdm->pwrsts & PWRSTS_OFF)
65 - if (pwrdm->pwrsts & PWRSTS_RET) {
66 - if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
69 - for (i = 0; i < pwrdm->banks; i++)
70 - if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
74 - for (i = 0; i < pwrdm->banks; i++)
75 - if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
80 diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
81 index 28a796c..5e0c033 100644
82 --- a/arch/arm/mach-omap2/powerdomain.h
83 +++ b/arch/arm/mach-omap2/powerdomain.h
84 @@ -244,7 +244,6 @@ int pwrdm_state_switch(struct powerdomain *pwrdm);
85 int pwrdm_pre_transition(struct powerdomain *pwrdm);
86 int pwrdm_post_transition(struct powerdomain *pwrdm);
87 int pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
88 -bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
90 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 state);
92 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
93 index e183351..4423b6d 100644
94 --- a/drivers/gpio/gpio-omap.c
95 +++ b/drivers/gpio/gpio-omap.c
96 @@ -69,7 +69,7 @@ struct gpio_bank {
100 - bool loses_context;
105 @@ -1208,15 +1208,9 @@ static int omap_gpio_probe(struct platform_device *pdev)
106 #ifdef CONFIG_OF_GPIO
107 bank->chip.of_node = of_node_get(node);
110 - if (!of_property_read_bool(node, "ti,gpio-always-on"))
111 - bank->loses_context = true;
113 - bank->loses_context = pdata->loses_context;
115 - if (bank->loses_context)
116 - bank->get_context_loss_count =
117 - pdata->get_context_loss_count;
119 + bank->get_context_loss_count =
120 + pdata->get_context_loss_count;
123 if (bank->regs->set_dataout && bank->regs->clr_dataout)
124 @@ -1373,7 +1367,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
125 * been initialised and so initialise it now. Also initialise
126 * the context loss count.
128 - if (bank->loses_context && !bank->context_valid) {
129 + if (!bank->context_valid) {
130 omap_gpio_init_context(bank);
132 if (bank->get_context_loss_count)
133 @@ -1394,17 +1388,15 @@ static int omap_gpio_runtime_resume(struct device *dev)
134 writel_relaxed(bank->context.risingdetect,
135 bank->base + bank->regs->risingdetect);
137 - if (bank->loses_context) {
138 - if (!bank->get_context_loss_count) {
139 + if (!bank->get_context_loss_count) {
140 + omap_gpio_restore_context(bank);
142 + c = bank->get_context_loss_count(bank->dev);
143 + if (c != bank->context_loss_count) {
144 omap_gpio_restore_context(bank);
146 - c = bank->get_context_loss_count(bank->dev);
147 - if (c != bank->context_loss_count) {
148 - omap_gpio_restore_context(bank);
150 - raw_spin_unlock_irqrestore(&bank->lock, flags);
153 + spin_unlock_irqrestore(&bank->lock, flags);
158 @@ -1476,7 +1468,7 @@ void omap2_gpio_prepare_for_idle(int pwr_mode)
159 struct gpio_bank *bank;
161 list_for_each_entry(bank, &omap_gpio_list, node) {
162 - if (!BANK_USED(bank) || !bank->loses_context)
163 + if (!BANK_USED(bank))
166 bank->power_mode = pwr_mode;
167 @@ -1490,7 +1482,7 @@ void omap2_gpio_resume_after_idle(void)
168 struct gpio_bank *bank;
170 list_for_each_entry(bank, &omap_gpio_list, node) {
171 - if (!BANK_USED(bank) || !bank->loses_context)
172 + if (!BANK_USED(bank))
175 pm_runtime_get_sync(bank->dev);
176 diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
177 index cb26181..ff43e01 100644
178 --- a/include/linux/platform_data/gpio-omap.h
179 +++ b/include/linux/platform_data/gpio-omap.h
180 @@ -198,7 +198,6 @@ struct omap_gpio_platform_data {
181 int bank_width; /* GPIO bank width */
182 int bank_stride; /* Only needed for omap1 MPUIO */
183 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
184 - bool loses_context; /* whether the bank would ever lose context */
185 bool is_mpuio; /* whether the bank is of type MPUIO */
186 u32 non_wakeup_gpios;