Skip to content
This repository
Browse code

apply patches from jakeday to fix wakelocks

  • Loading branch information...
commit 65c17fa021bea284b1b15bc43c049b062b35e4a3 1 parent aec5fa7
sonicxml authored February 08, 2012 jdkoreclipse committed March 06, 2012
45  arch/arm/mach-omap2/pm44xx.c
@@ -107,6 +107,9 @@ static struct clockdomain *emif_clkdm, *mpuss_clkdm;
107 107
  */
108 108
 #define OMAP4_PM_ERRATUM_MPU_EMIF_NO_DYNDEP_IDLE_iXXX	BIT(4)
109 109
 
  110
+#define OMAP4_PM_ERRATUM_LPDDR_CLK_IO_iXXX				BIT(5)
  111
+#define LPDDR_WD_PULL_DOWN								0x02
  112
+
110 113
 u8 pm44xx_errata;
111 114
 #define is_pm44xx_erratum(erratum) (pm44xx_errata & OMAP4_PM_ERRATUM_##erratum)
112 115
 
@@ -123,6 +126,28 @@ void check_cawake_wakeup_event(void)
123 126
 	}
124 127
 }
125 128
 
  129
+void syscontrol_lpddr_clk_io_errata(bool enable)
  130
+{
  131
+	u32 v = 0;
  132
+
  133
+	if (!is_pm44xx_erratum(LPDDR_CLK_IO_iXXX))
  134
+		return;
  135
+
  136
+	v = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_2);
  137
+	if (enable)
  138
+		v &= ~OMAP4_LPDDR2IO1_GR10_WD_MASK;
  139
+	else
  140
+		v |= LPDDR_WD_PULL_DOWN << OMAP4_LPDDR2IO1_GR10_WD_SHIFT;
  141
+	omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_2);
  142
+
  143
+	v = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_2);
  144
+	if (enable)
  145
+		v &= ~OMAP4_LPDDR2IO2_GR10_WD_MASK;
  146
+	else
  147
+		v |= LPDDR_WD_PULL_DOWN << OMAP4_LPDDR2IO1_GR10_WD_SHIFT;
  148
+	omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_2);
  149
+}
  150
+
126 151
 #define MAX_IOPAD_LATCH_TIME 1000
127 152
 void omap4_trigger_ioctrl(void)
128 153
 {
@@ -273,8 +298,14 @@ void omap4_enter_sleep(unsigned int cpu, unsigned int power_state, bool suspend)
273 298
 			OMAP4430_PRM_DEVICE_INST, OMAP4_PRM_IO_PMCTRL_OFFSET);
274 299
 	}
275 300
 
  301
+	if (suspend)
  302
+		syscontrol_lpddr_clk_io_errata(false);
  303
+
276 304
 	omap4_enter_lowpower(cpu, power_state);
277 305
 
  306
+	if (suspend)
  307
+		syscontrol_lpddr_clk_io_errata(true);
  308
+
278 309
 	if (omap4_device_prev_state_off()) {
279 310
 		/* Reconfigure the trim settings as well */
280 311
 		omap4_ldo_trim_configure();
@@ -906,16 +937,7 @@ static void __init syscontrol_setup_regs(void)
906 937
 	v |= OMAP4_LPDDR21_VREF_AUTO_EN_CA_MASK | OMAP4_LPDDR21_VREF_AUTO_EN_DQ_MASK;
907 938
         omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_3);
908 939
 
909  
-	/*
910  
-	 * Workaround for CK differential IO PADn, PADp values due to bug in
911  
-	 * EMIF CMD phy.
912  
-	 */
913  
-	v = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_2);
914  
-	v &= ~OMAP4_LPDDR2IO1_GR10_WD_MASK;
915  
-	omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO1_2);
916  
-	v = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_2);
917  
-	v &= ~OMAP4_LPDDR2IO2_GR10_WD_MASK;
918  
-	omap4_ctrl_pad_writel(v, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_LPDDR2IO2_2);
  940
+	syscontrol_lpddr_clk_io_errata(true);
919 941
 }
920 942
 
921 943
 static void __init prcm_setup_regs(void)
@@ -1236,7 +1258,8 @@ static void __init omap4_pm_setup_errata(void)
1236 1258
 	 */
1237 1259
 	if (cpu_is_omap44xx())
1238 1260
 		pm44xx_errata |= OMAP4_PM_ERRATUM_IVA_AUTO_RET_iXXX |
1239  
-				 OMAP4_PM_ERRATUM_HSI_SWAKEUP_iXXX;
  1261
+				OMAP4_PM_ERRATUM_HSI_SWAKEUP_iXXX |
  1262
+				OMAP4_PM_ERRATUM_LPDDR_CLK_IO_iXXX;
1240 1263
 	/* Dynamic Dependency errata for all silicon !=443x */
1241 1264
 	if (cpu_is_omap443x())
1242 1265
 		pm44xx_errata |= OMAP4_PM_ERRATUM_MPU_EMIF_NO_DYNDEP_i688;
9  drivers/gpio/gpio-omap.c
@@ -1312,14 +1312,17 @@ static int omap_gpio_resume(struct device *dev)
1312 1312
 static void omap_gpio_save_context(struct gpio_bank *bank);
1313 1313
 static void omap_gpio_restore_context(struct gpio_bank *bank);
1314 1314
 
1315  
-static void omap2_gpio_set_wakeupenables(struct gpio_bank *bank)
  1315
+static void omap2_gpio_set_wakeupenables(struct gpio_bank *bank, bool suspend)
1316 1316
 {
1317 1317
 	unsigned long pad_wakeup;
1318 1318
 	int i;
1319 1319
 
1320 1320
 	bank->context.pad_set_wakeupenable = 0;
1321 1321
 
1322  
-	pad_wakeup = __raw_readl(bank->base + bank->regs->irqenable);
  1322
+	if (suspend)
  1323
+		pad_wakeup = bank->suspend_wakeup;
  1324
+	else
  1325
+		pad_wakeup = __raw_readl(bank->base + bank->regs->irqenable);
1323 1326
 
1324 1327
 	/*
1325 1328
 	 * HACK: Ignore gpios that have multiple sources.
@@ -1578,7 +1581,7 @@ int omap2_gpio_prepare_for_idle(int off_mode, bool suspend)
1578 1581
 		if (!bank->mod_usage)
1579 1582
 			continue;
1580 1583
 
1581  
-		omap2_gpio_set_wakeupenables(bank);
  1584
+		omap2_gpio_set_wakeupenables(bank, suspend);
1582 1585
 
1583 1586
 		if (omap2_gpio_set_edge_wakeup(bank, suspend))
1584 1587
 			ret = -EBUSY;

0 notes on commit 65c17fa

Please sign in to comment.
Something went wrong with that request. Please try again.