Skip to contentSkip to conversation

i.MX27: add suspend to RAM support

PATCH Superseded Eric Bénard 5 participants 14 messages May 21, 2010 – May 24, 2010

Subsystems (6)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 i.MX27: add suspend to RAM support

---
 arch/arm/mach-mx2/Makefile   |    2 +-
 arch/arm/mach-mx2/pm-imx27.c |   46 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-mx2/pm-imx27.c
arch/arm/mach-mx2/Makefile +1 -1
index e3254fa..27d496c 100644
@@ -8,7 +8,7 @@ obj-y	:=  devices.o serial.o
 
 obj-$(CONFIG_MACH_MX21) += clock_imx21.o mm-imx21.o
 
-obj-$(CONFIG_MACH_MX27) += cpu_imx27.o
+obj-$(CONFIG_MACH_MX27) += cpu_imx27.o pm-imx27.o
 obj-$(CONFIG_MACH_MX27) += clock_imx27.o mm-imx27.o
 
 obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
arch/arm/mach-mx2/pm-imx27.c new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 2/5 mxc_nand: fix PM

---
 drivers/mtd/nand/mxc_nand.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)
drivers/mtd/nand/mxc_nand.c +10 -17
index fb03aff..5e51d4d 100644
@@ -895,16 +895,13 @@ static int __devexit mxcnd_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
 {
-	struct mtd_info *mtd = platform_get_drvdata(pdev);
-	struct nand_chip *nand_chip = mtd->priv;
-	struct mxc_nand_host *host = nand_chip->priv;
+	struct mxc_nand_host *host = platform_get_drvdata(pdev);
 	int ret = 0;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
-	if (mtd) {
-		ret = mtd->suspend(mtd);
-		/* Disable the NFC clock */
+	if (host->clk_act) {
 		clk_disable(host->clk);
+		host->clk_act = 0;
 	}
 
 	return ret;
@@ -912,31 +909,27 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
 
 static int mxcnd_resume(struct platform_device *pdev)
 {
-	struct mtd_info *mtd = platform_get_drvdata(pdev);
-	struct nand_chip *nand_chip = mtd->priv;
-	struct mxc_nand_host *host = nand_chip->priv;
+	struct mxc_nand_host *host = platform_get_drvdata(pdev);
 	int ret = 0;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
-
-	if (mtd) {
-		/* Enable the NFC clock */
+	if (!host->clk_act) {
 		clk_enable(host->clk);
-		mtd->resume(mtd);
+		host->clk_act = 1;
 	}
 
 	return ret;
 }
 
 #else
-# define mxcnd_suspend   NULL
-# define mxcnd_resume    NULL
-#endif				/* CONFIG_PM */
+#define mxcnd_suspend	NULL
+#define mxcnd_resume	NULL
+#endif
 
 static struct platform_driver mxcnd_driver = {
 	.driver = {
 		   .name = DRIVER_NAME,
-		   },
+	},
 	.remove = __devexit_p(mxcnd_remove),
 	.suspend = mxcnd_suspend,
 	.resume = mxcnd_resume,
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 3/5 imx_keypad: add PM support

* add suspend/resume support
* use keypad_data to enable wakeup from platform data

---
 drivers/input/keyboard/imx_keypad.c |   57 +++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 2 deletions(-)
drivers/input/keyboard/imx_keypad.c +55 -2
index d92c15c..0d44bce 100644
@@ -364,6 +364,56 @@ static void imx_keypad_inhibit(struct imx_keypad *keypad)
 	writew(0xff00, keypad->mmio_base + KPCR);
 }
 
+static int mxc_kpp_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct imx_keypad *keypad = platform_get_drvdata(pdev);
+	unsigned short reg_val;
+
+	clk_disable(keypad->clk);
+
+	if (device_may_wakeup(&pdev->dev)) {
+		reg_val = readw(keypad->mmio_base + KPSR);
+		if ((reg_val & KBD_STAT_KDIE) == 0) {
+			/* If no depress interrupt enable the release interrupt */
+			reg_val |= KBD_STAT_KRIE;
+			writew(reg_val, keypad->mmio_base + KPSR);
+		}
+		enable_irq_wake(keypad->irq);
+	} else {
+		disable_irq(keypad->irq);
+		keypad->enabled = false;
+		imx_keypad_inhibit(keypad);
+	}
+
+	return 0;
+}
+
+/*!
+ * This function brings the Keypad controller back from low-power state.
+ * If Keypad is enabled as a wake source(i.e. it can resume the system
+ * from suspend mode), the Keypad controller doesn't enter low-power state.
+ *
+ * @param   pdev  the device structure used to give information on Keypad
+ *                to resume
+ *
+ * @return  The function always returns 0.
+ */
+static int mxc_kpp_resume(struct platform_device *pdev)
+{
+	struct imx_keypad *keypad = platform_get_drvdata(pdev);
+
+	clk_enable(keypad->clk);
+	if (device_may_wakeup(&pdev->dev)) {
+		/* The irq routine already cleared KRIE if it was set */
+	} else {
+		enable_irq(keypad->irq);
+		keypad->enabled = true;
+		imx_keypad_config(keypad);
+	}
+
+	return 0;
+}
+
 static void imx_keypad_close(struct input_dev *dev)
 {
 	struct imx_keypad *keypad = input_get_drvdata(dev);
@@ -410,7 +460,8 @@ open_err:
 
 static int __devinit imx_keypad_probe(struct platform_device *pdev)
 {
-	const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
+	const struct matrix_keypad_platform_data *keypad_data = pdev->dev.platform_data;
+	const struct matrix_keymap_data *keymap_data = keypad_data->keymap_data;
 	struct imx_keypad *keypad;
 	struct input_dev *input_dev;
 	struct resource *res;
@@ -525,7 +576,7 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, keypad);
-	device_init_wakeup(&pdev->dev, 1);
+	device_init_wakeup(&pdev->dev, keypad_data->wakeup);
 
 	return 0;
 
@@ -574,6 +625,8 @@ static struct platform_driver imx_keypad_driver = {
 	},
 	.probe		= imx_keypad_probe,
 	.remove		= __devexit_p(imx_keypad_remove),
+	.suspend = mxc_kpp_suspend,
+	.resume = mxc_kpp_resume,
 };
 
 static int __init imx_keypad_init(void)
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 4/5 eukrea_mbimx27: update keyboard platform data

* use matrix_keypad_platform_data
* enable wakeup

---
 arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c +6 -1
index 34bdc26..9038e1f 100644
@@ -107,6 +107,11 @@ static struct matrix_keymap_data eukrea_mbimx27_keymap_data = {
 	.keymap_size    = ARRAY_SIZE(eukrea_mbimx27_keymap),
 };
 
+static struct matrix_keypad_platform_data eukrea_mbimx27_keypad_data = {
+	.keymap_data	= &eukrea_mbimx27_keymap_data,
+	.wakeup		= 1,
+};
+
 static struct gpio_led gpio_leds[] = {
 	{
 		.name			= "led1",
@@ -350,7 +355,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
 	gpio_request(GPIO_PORTA | 25, "lcd_enable");
 	platform_device_register(&eukrea_mbimx27_lcd_powerdev);
 
-	mxc_register_device(&imx_kpp_device, &eukrea_mbimx27_keymap_data);
+	mxc_register_device(&imx_kpp_device, &eukrea_mbimx27_keypad_data);
 
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 }
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH 5/5 serial/imx.c: fix suspend/resume

* there is a stange behaviour in suspend & resume functions :
if console is enabled on serial the baudrate is not properly restored at resume. The "fix" is tho use platform_get_drvdata directly on dev in suspend/resume instead of using to_platform_device. Someone more used to this driver than me may find a better fix !

---
 drivers/serial/imx.c |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)
drivers/serial/imx.c +26 -7
index eacb588..606566e 100644
@@ -1020,6 +1020,17 @@ imx_verify_port(struct uart_port *port, struct serial_struct *ser)
 	return ret;
 }
 
+static void
+imx_suspend(struct uart_port *port, unsigned int state, unsigned int oldstate)
+{
+	struct imx_port *sport = (struct imx_port *)port;
+
+	if (!state)
+		clk_enable(sport->clk);
+	else
+		clk_disable(sport->clk);
+}
+
 static struct uart_ops imx_pops = {
 	.tx_empty	= imx_tx_empty,
 	.set_mctrl	= imx_set_mctrl,
@@ -1037,6 +1048,7 @@ static struct uart_ops imx_pops = {
 	.request_port	= imx_request_port,
 	.config_port	= imx_config_port,
 	.verify_port	= imx_verify_port,
+	.pm		= imx_suspend,
 };
 
 static struct imx_port *imx_ports[UART_NR];
@@ -1207,9 +1219,11 @@ static struct uart_driver imx_reg = {
 	.cons           = IMX_CONSOLE,
 };
 
-static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
+#ifdef CONFIG_PM
+static int serial_imx_suspend(struct device *dev)
 {
-	struct imx_port *sport = platform_get_drvdata(dev);
+/* FIXME	struct platform_device *pdev = to_platform_device(dev); */
+	struct imx_port *sport = platform_get_drvdata((struct platform_device *)dev);
 
 	if (sport)
 		uart_suspend_port(&imx_reg, &sport->port);
@@ -1217,9 +1231,10 @@ static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
 	return 0;
 }
 
-static int serial_imx_resume(struct platform_device *dev)
+static int serial_imx_resume(struct device *dev)
 {
-	struct imx_port *sport = platform_get_drvdata(dev);
+/* FIXME	struct platform_device *pdev = to_platform_device(dev); */
+	struct imx_port *sport = platform_get_drvdata((struct platform_device *)dev);
 
 	if (sport)
 		uart_resume_port(&imx_reg, &sport->port);
@@ -1227,6 +1242,10 @@ static int serial_imx_resume(struct platform_device *dev)
 	return 0;
 }
 
+static const SIMPLE_DEV_PM_OPS(serial_imx_pm_ops,
+				serial_imx_suspend, serial_imx_resume);
+#endif
+
 static int serial_imx_probe(struct platform_device *pdev)
 {
 	struct imx_port *sport;
@@ -1342,12 +1361,12 @@ static int serial_imx_remove(struct platform_device *pdev)
 static struct platform_driver serial_imx_driver = {
 	.probe		= serial_imx_probe,
 	.remove		= serial_imx_remove,
-
-	.suspend	= serial_imx_suspend,
-	.resume		= serial_imx_resume,
 	.driver		= {
 		.name	= "imx-uart",
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm	= &serial_imx_pm_ops,
+#endif
 	},
 };
 
Signature · 1 line
1.6.3.3
#5 lore raw

PATCH 3/5 imx_keypad: add PM support

In reply to Eric Bénard

drivers/input/keyboard/imx_keypad.c static void imx_keypad_inhibit(struct imx_keypad *keypad) · line 409

Quoted 9 lines · Eric B?nard
drivers/input/keyboard/imx_keypad.c +9 -0
+static int mxc_kpp_resume(struct platform_device *pdev)
+{
+	struct imx_keypad *keypad = platform_get_drvdata(pdev);
+
+	clk_enable(keypad->clk);
+	if (device_may_wakeup(&pdev->dev)) {
+		/* The irq routine already cleared KRIE if it was set */
+	} else {
+		enable_irq(keypad->irq);

What happens if an IRQ happens here?

Quoted 1 line
drivers/input/keyboard/imx_keypad.c +1 -0
+		keypad->enabled = true;
#6 lore raw

PATCH 2/5 mxc_nand: fix PM

In reply to Eric Bénard

Hi,

Quoted 24 lines
 drivers/mtd/nand/mxc_nand.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)
drivers/mtd/nand/mxc_nand.c +3 -6
index fb03aff..5e51d4d 100644
@@ -895,16 +895,13 @@ static int __devexit mxcnd_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
 {
-	struct mtd_info *mtd = platform_get_drvdata(pdev);
-	struct nand_chip *nand_chip = mtd->priv;
-	struct mxc_nand_host *host = nand_chip->priv;
+	struct mxc_nand_host *host = platform_get_drvdata(pdev);
 	int ret = 0;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
-	if (mtd) {
-		ret = mtd->suspend(mtd);
-		/* Disable the NFC clock */
+	if (host->clk_act) {
 		clk_disable(host->clk);
+		host->clk_act = 0;

[...]

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c +1 -3
@@ -912,31 +909,27 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
 
 static int mxcnd_resume(struct platform_device *pdev)
 {
-	struct mtd_info *mtd = platform_get_drvdata(pdev);
-	struct nand_chip *nand_chip = mtd->priv;
-	struct mxc_nand_host *host = nand_chip->priv;
+	struct mxc_nand_host *host = platform_get_drvdata(pdev);
 	int ret = 0;
 

drivers/mtd/nand/mxc_nand.c static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) · line 920

Quoted 10 lines
drivers/mtd/nand/mxc_nand.c +2 -4
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
-
-	if (mtd) {
-		/* Enable the NFC clock */
+	if (!host->clk_act) {
 		clk_enable(host->clk);
-		mtd->resume(mtd);
+		host->clk_act = 1;
 	}
 

Since you are clearing host->clk_act during suspend, this will unconditionally enable the clock no matter what state it had before suspend (in case that's intended, the check for !host->clk_act is useless, since it will always yield true).
I think it's more sensible to leave host->clk_act alone, and reenable the clock only if host->clk_act is set, so that the clock is left in the same state after resume in which it was before suspend.

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#7 lore raw

PATCH 2/5 mxc_nand: fix PM

Hi Lothar,

Le 21/05/2010 13:41, Lothar Wa?mann a ?crit :

Quoted 4 lines
Quoted 4 lines
drivers/mtd/nand/mxc_nand.c +1 -2
-	if (mtd) {
-		/* Enable the NFC clock */
+	if (!host->clk_act) {
  		clk_enable(host->clk);
Quoted 8 lines

drivers/mtd/nand/mxc_nand.c static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) · line 919

Quoted 4 lines
drivers/mtd/nand/mxc_nand.c +1 -1
-		mtd->resume(mtd);
+		host->clk_act = 1;
  	}

Since you are clearing host->clk_act during suspend, this will unconditionally enable the clock no matter what state it had before suspend (in case that's intended, the check for !host->clk_act is useless, since it will always yield true).

Yes, you're right.
In fact, the clock is turned on & off by mxc_nand_select_chip so when clk_enable & clk_disable are called in suspend & resume without checking it the clock is already active, I had log complaining for the clock already being off as mxc_nand_select_chip hard already turned it off, so I put the checks in both functions.

Quoted 4 lines

I think it's more sensible to leave host->clk_act alone, and reenable the clock only if host->clk_act is set, so that the clock is left in the same state after resume in which it was before suspend.

OK I'll try this. In fact, I think the clock is always off when we reach suspend & resume as nand_base has already deselected the chip and thus the NFC's clock is turned off.

While we're at this : is there a good reason to select/deselect the chip at every access and turn on/off the clock at the same time ?

Eric

#8 lore raw

PATCH 2/5 mxc_nand: fix PM

In reply to Eric Bénard

On Fri, May 21, 2010 at 01:12:40PM +0200, Eric B?nard wrote:

A short description what was fixed and how it was fixed would be great.

Quoted 76 lines
---
 drivers/mtd/nand/mxc_nand.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)
drivers/mtd/nand/mxc_nand.c +10 -17
index fb03aff..5e51d4d 100644
@@ -895,16 +895,13 @@ static int __devexit mxcnd_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
 {
-	struct mtd_info *mtd = platform_get_drvdata(pdev);
-	struct nand_chip *nand_chip = mtd->priv;
-	struct mxc_nand_host *host = nand_chip->priv;
+	struct mxc_nand_host *host = platform_get_drvdata(pdev);
 	int ret = 0;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
-	if (mtd) {
-		ret = mtd->suspend(mtd);
-		/* Disable the NFC clock */
+	if (host->clk_act) {
 		clk_disable(host->clk);
+		host->clk_act = 0;
 	}
 
 	return ret;
@@ -912,31 +909,27 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state)
 
 static int mxcnd_resume(struct platform_device *pdev)
 {
-	struct mtd_info *mtd = platform_get_drvdata(pdev);
-	struct nand_chip *nand_chip = mtd->priv;
-	struct mxc_nand_host *host = nand_chip->priv;
+	struct mxc_nand_host *host = platform_get_drvdata(pdev);
 	int ret = 0;
 
 	DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n");
-
-	if (mtd) {
-		/* Enable the NFC clock */
+	if (!host->clk_act) {
 		clk_enable(host->clk);
-		mtd->resume(mtd);
+		host->clk_act = 1;
 	}
 
 	return ret;
 }
 
 #else
-# define mxcnd_suspend   NULL
-# define mxcnd_resume    NULL
-#endif				/* CONFIG_PM */
+#define mxcnd_suspend	NULL
+#define mxcnd_resume	NULL
+#endif
 
 static struct platform_driver mxcnd_driver = {
 	.driver = {
 		   .name = DRIVER_NAME,
-		   },
+	},
 	.remove = __devexit_p(mxcnd_remove),
 	.suspend = mxcnd_suspend,
 	.resume = mxcnd_resume,
Signature · 7 lines
1.6.3.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100521/49433094/attachment.sig>
#9 lore raw

PATCH 2/5 mxc_nand: fix PM

Le 21/05/2010 15:10, Wolfram Sang a ?crit :

Quoted 4 lines · Eric B?nard

A short description what was fixed and how it was fixed would be great.

sure :
*** 1st part of the log before the fix :

WARNING: at arch/arm/plat-mxc/clock.c:59 __clk_disable+0x68/0x74()
Modules linked in:
[<c002d200>] (unwind_backtrace+0x0/0xf8) from [<c0046008>] 
(warn_slowpath_common+0x48/0x78)
[<c0046008>] (warn_slowpath_common+0x48/0x78) from [<c0031e28>] 
(__clk_disable+0x68/0x74)
[<c0031e28>] (__clk_disable+0x68/0x74) from [<c0031ddc>] 
(__clk_disable+0x1c/0x74)
[<c0031ddc>] (__clk_disable+0x1c/0x74) from [<c0031e58>] 
(clk_disable+0x24/0x34)
[<c0031e58>] (clk_disable+0x24/0x34) from [<c01e57b4>] 
(mxcnd_suspend+0x34/0x3c)
[<c01e57b4>] (mxcnd_suspend+0x34/0x3c) from [<c01bee10>] 
(platform_pm_suspend+0x50/0x54)

* why :
because the clock is already turned off by mxc_nand_select_chip

* fix :
check if the clock is actually really on before turning it off

*** 2nd part of the log before the fix :
nand_resume called for a chip which is not in suspended state

* why :
because mtd->suspend and mtd->resume are already called from the mtd layer, thus they were called a second time in mxc_nand so mtd complains when trying to resume for the second time

* fix :
don't call mtd->suspend / mtd->resume in mxc_nand.

Eric

#12 lore raw

PATCH 1/5 i.MX27: add suspend to RAM support

In reply to Eric Bénard

Hi,

Quoted 47 lines · Eric B?nard
---
 arch/arm/mach-mx2/Makefile   |    2 +-
 arch/arm/mach-mx2/pm-imx27.c |   46 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-mx2/pm-imx27.c
arch/arm/mach-mx2/Makefile +1 -1
index e3254fa..27d496c 100644
@@ -8,7 +8,7 @@ obj-y	:=  devices.o serial.o
 
 obj-$(CONFIG_MACH_MX21) += clock_imx21.o mm-imx21.o
 
-obj-$(CONFIG_MACH_MX27) += cpu_imx27.o
+obj-$(CONFIG_MACH_MX27) += cpu_imx27.o pm-imx27.o
 obj-$(CONFIG_MACH_MX27) += clock_imx27.o mm-imx27.o
 
 obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
arch/arm/mach-mx2/pm-imx27.c new file +20 -0
new file mode 100644
index 0000000..a82fb6d
@@ -0,0 +1,46 @@
+/*
+ * i.MX27 Power Management Routines
+ *
+ * Based on Freescale's BSP
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/suspend.h>
+#include <asm/io.h>
+#include <mach/system.h>
+#include <mach/mx27.h>
+
+static int mx27_suspend_enter(suspend_state_t state)
+{
+	u32 cscr;
+	switch (state) {
+	case PM_SUSPEND_MEM:

arch/arm/mach-mx2/pm-imx27.c line 30

Quoted 10 lines
arch/arm/mach-mx2/pm-imx27.c new file +10 -0
+		/* Clear MPEN and SPEN to disable MPLL/SPLL */
+		cscr = __raw_readl(MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
+		cscr &= 0xFFFFFFFC;
+		__raw_writel(cscr, MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
+		/* Executes WFI */
+		arch_idle();
+		break;
+
+	default:
+		return -1;

an errno value would be more appropriate here.

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#13 lore raw

PATCH 1/5 i.MX27: add suspend to RAM support

In reply to Eric Bénard

arch/arm/mach-mx2/pm-imx27.c line 12

Quoted 3 lines · Eric B?nard
arch/arm/mach-mx2/pm-imx27.c new file +3 -0
+#include <linux/kernel.h>
+#include <linux/suspend.h>
+#include <asm/io.h>

linux/io.h

Quoted 8 lines
arch/arm/mach-mx2/pm-imx27.c new file +8 -0
+#include <mach/system.h>
+#include <mach/mx27.h>
+
+static int mx27_suspend_enter(suspend_state_t state)
+{
+	u32 cscr;
+	switch (state) {
+	case PM_SUSPEND_MEM:

arch/arm/mach-mx2/pm-imx27.c line 30

Quoted 10 lines
arch/arm/mach-mx2/pm-imx27.c new file +10 -0
+		/* Clear MPEN and SPEN to disable MPLL/SPLL */
+		cscr = __raw_readl(MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
+		cscr &= 0xFFFFFFFC;
+		__raw_writel(cscr, MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
+		/* Executes WFI */
+		arch_idle();
+		break;
+
+	default:
+		return -1;

-Exxx ?