Skip to contentSkip to conversation

pxa/hx4700: Fix basic suspend/resume

PATCH Superseded Paul Parsons 2 participants 2 messages Mar 10, 2012

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 pxa/hx4700: Fix basic suspend/resume

Basic suspend/resume is fixed by ensuring that the PGSR registers are set correctly before sleep mode is entered. In particular four of the active low resets need to be driven high while in sleep mode, otherwise the unit resets itself instead of suspending. Another problem was that the PCFR_GPROD bit is set by the HTC bootloader; this caused GPIO reset (i.e. the reset button) to fail immediately after returning from sleep mode.

---

V3:
Changed GPIO72, GPIO96 back to KEEP_OUTPUT.

arch/arm/mach-pxa/hx4700.c +15 -1
diff -uprN clean-3.3-rc6/arch/arm/mach-pxa/hx4700.c linux-3.3-rc6/arch/arm/mach-pxa/hx4700.c
@@ -121,7 +121,11 @@ static unsigned long hx4700_pin_config[]
 	GPIO19_SSP2_SCLK,
 	GPIO86_SSP2_RXD,
 	GPIO87_SSP2_TXD,
-	GPIO88_GPIO,
+	GPIO88_GPIO | MFP_LPM_DRIVE_HIGH,	/* TSC2046_CS */
+
+	/* BQ24022 Regulator */
+	GPIO72_GPIO | MFP_LPM_KEEP_OUTPUT,	/* BQ24022_nCHARGE_EN */
+	GPIO96_GPIO | MFP_LPM_KEEP_OUTPUT,	/* BQ24022_ISET2 */
 
 	/* HX4700 specific input GPIOs */
 	GPIO12_GPIO,	/* ASIC3_IRQ */
@@ -134,6 +138,11 @@ static unsigned long hx4700_pin_config[]
 	GPIO108_GPIO,	/* GSM_READY */
 	GPIO58_GPIO,	/* TSC2046_nPENIRQ */
 	GPIO66_GPIO,	/* nSDIO_IRQ */
+
+	GPIO61_GPIO | MFP_LPM_DRIVE_HIGH,	/* W3220_nRESET */
+	GPIO71_GPIO | MFP_LPM_DRIVE_HIGH,	/* ASIC3_nRESET */
+	GPIO81_GPIO | MFP_LPM_DRIVE_HIGH,	/* CPU_GP_nRESET */
+	GPIO116_GPIO | MFP_LPM_DRIVE_HIGH,	/* CPU_HW_nRESET */
 };
 
 /*
@@ -828,15 +837,20 @@ static struct gpio global_gpios[] = {
 	{ GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
 	{ GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
 	{ GPIO32_HX4700_RS232_ON,         GPIOF_OUT_INIT_HIGH, "RS232_ON" },
+	{ GPIO61_HX4700_W3220_nRESET,     GPIOF_OUT_INIT_HIGH, "W3220_nRESET" },
 	{ GPIO71_HX4700_ASIC3_nRESET,     GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
+	{ GPIO81_HX4700_CPU_GP_nRESET,    GPIOF_OUT_INIT_HIGH, "CPU_GP_nRESET" },
 	{ GPIO82_HX4700_EUART_RESET,      GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
 	{ GPIO105_HX4700_nIR_ON,          GPIOF_OUT_INIT_HIGH, "nIR_EN" },
+	{ GPIO116_HX4700_CPU_HW_nRESET,   GPIOF_OUT_INIT_HIGH, "CPU_HW_nRESET" },
 };
 
 static void __init hx4700_init(void)
 {
 	int ret;
 
+	PCFR = PCFR_GPR_EN | PCFR_OPDE;
+
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
 	ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
 	if (ret)
#1 lore raw

PATCH v3 1/1 pxa/hx4700: Fix basic suspend/resume

Quoted 7 lines · Paul Parsons

Basic suspend/resume is fixed by ensuring that the PGSR registers are set correctly before sleep mode is entered. In particular four of the active low resets need to be driven high while in sleep mode, otherwise the unit resets itself instead of suspending. Another problem was that the PCFR_GPROD bit is set by the HTC bootloader; this caused GPIO reset (i.e. the reset button) to fail immediately after returning from sleep mode.

Quoted 5 lines

---

V3:
Changed GPIO72, GPIO96 back to KEEP_OUTPUT.

Thanks!

Quoted 50 lines

diff -uprN clean-3.3-rc6/arch/arm/mach-pxa/hx4700.c linux-3.3-rc6/arch/arm/mach-pxa/hx4700.c

arch/arm/mach-pxa/hx4700.c ? ?2012-03-10 14:42:41.328255002 +0000 renamed from arch/arm/mach-pxa/hx4700.c ? ?2012-03-04 01:08:09.000000000 +0000 +5 -1
@@ -121,7 +121,11 @@ static unsigned long hx4700_pin_config[]
 ? ? ? ?GPIO19_SSP2_SCLK,
 ? ? ? ?GPIO86_SSP2_RXD,
 ? ? ? ?GPIO87_SSP2_TXD,
- ? ? ? GPIO88_GPIO,
+ ? ? ? GPIO88_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* TSC2046_CS */
+
+ ? ? ? /* BQ24022 Regulator */
+ ? ? ? GPIO72_GPIO | MFP_LPM_KEEP_OUTPUT, ? ? ?/* BQ24022_nCHARGE_EN */
+ ? ? ? GPIO96_GPIO | MFP_LPM_KEEP_OUTPUT, ? ? ?/* BQ24022_ISET2 */
 

? ? ? ?/* HX4700 specific input GPIOs */
? ? ? ?GPIO12_GPIO, ? ?/* ASIC3_IRQ */

arch/arm/mach-pxa/hx4700.c ? ?2012-03-10 14:42:41.328255002 +0000 renamed from arch/arm/mach-pxa/hx4700.c ? ?2012-03-04 01:08:09.000000000 +0000 +0 -0
@@ -134,6 +138,11 @@ static unsigned long hx4700_pin_config[]

? ? ? ?GPIO108_GPIO, ? /* GSM_READY */
? ? ? ?GPIO58_GPIO, ? ?/* TSC2046_nPENIRQ */
? ? ? ?GPIO66_GPIO, ? ?/* nSDIO_IRQ */
+

+ ? ? ? GPIO61_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* W3220_nRESET */
+ ? ? ? GPIO71_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* ASIC3_nRESET */
+ ? ? ? GPIO81_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* CPU_GP_nRESET */

+ ? ? ? GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ?/* CPU_HW_nRESET */ ?};

?/*

arch/arm/mach-pxa/hx4700.c ? ?2012-03-10 14:42:41.328255002 +0000 renamed from arch/arm/mach-pxa/hx4700.c ? ?2012-03-04 01:08:09.000000000 +0000 +5 -0
@@ -828,15 +837,20 @@ static struct gpio global_gpios[] = {
 ? ? ? ?{ GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
 ? ? ? ?{ GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
 ? ? ? ?{ GPIO32_HX4700_RS232_ON, ? ? ? ? GPIOF_OUT_INIT_HIGH, "RS232_ON" },
+ ? ? ? { GPIO61_HX4700_W3220_nRESET, ? ? GPIOF_OUT_INIT_HIGH, "W3220_nRESET" },
 ? ? ? ?{ GPIO71_HX4700_ASIC3_nRESET, ? ? GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
+ ? ? ? { GPIO81_HX4700_CPU_GP_nRESET, ? ?GPIOF_OUT_INIT_HIGH, "CPU_GP_nRESET" },
 ? ? ? ?{ GPIO82_HX4700_EUART_RESET, ? ? ?GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
 ? ? ? ?{ GPIO105_HX4700_nIR_ON, ? ? ? ? ?GPIOF_OUT_INIT_HIGH, "nIR_EN" },
+ ? ? ? { GPIO116_HX4700_CPU_HW_nRESET, ? GPIOF_OUT_INIT_HIGH, "CPU_HW_nRESET" },
 ?};
 
 ?static void __init hx4700_init(void)
 ?{
 ? ? ? ?int ret;
 
+ ? ? ? PCFR = PCFR_GPR_EN | PCFR_OPDE;
+
 ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
 ? ? ? ?ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
 ? ? ? ?if (ret)