Skip to contentSkip to conversation

OMAP PM fixes for .31-rc series

PATCH In review Kevin Hilman 3 participants 19 messages Jul 21, 2009 – Aug 5, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover OMAP PM fixes for .31-rc series

Also available here as a v2.6.31-rc3 based branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git pm-upstream/fixes

Eero Nurkkala (1):
OMAP: PM: CPUfreq: obey min/max settings of policy

Jouni Hogander (1):
OMAP3: PM: Fix wrong sequence in suspend.

Kevin Hilman (11):
OMAP2/3: PM: make PM __init calls static
OMAP3: PM: CM_REGADDR macros using wrong name
OMAP3: PM: Ensure PRCM interrupts are cleared at boot
OMAP3: PM: Clear pending PRCM reset flags on init
OMAP3: PM: prevent module wakeups from waking IVA2
OMAP3: PM: Do not build suspend code if SUSPEND is not enabled
OMAP4: UART: cleanup special case IRQ handling OMAP2/3/4: UART: Allow per-UART disabling wakeup for serial ports OMAP2/3/4: UART: allow in-order port traversal
OMAP: GPIO: clear/restore level/edge detect settings on mask/unmask
OMAP3: Overo: add missing pen-down GPIO definition

Tero Kristo (1):
OMAP3: Fixed crash bug with serial + suspend

 arch/arm/mach-omap2/board-overo.c        |    1 +
 arch/arm/mach-omap2/cm.h                 |    6 +-
 arch/arm/mach-omap2/pm.h                 |    3 -
 arch/arm/mach-omap2/pm24xx.c             |    2 +-
 arch/arm/mach-omap2/pm34xx.c             |   51 +++++++-
 arch/arm/mach-omap2/serial.c             |  197 ++++++++++++++++++++----------
 arch/arm/plat-omap/cpu-omap.c            |    8 +-
 arch/arm/plat-omap/gpio.c                |    6 +
 arch/arm/plat-omap/include/mach/serial.h |    1 +
 9 files changed, 197 insertions(+), 78 deletions(-)
#1 lore raw

PATCH 1/14 OMAP2/3: PM: make PM __init calls static

---
 arch/arm/mach-omap2/pm.h     |    3 ---
 arch/arm/mach-omap2/pm24xx.c |    2 +-
 arch/arm/mach-omap2/pm34xx.c |    2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/pm.h +0 -3
index f7b3baf..21201cd 100644
@@ -11,9 +11,6 @@
 #ifndef __ARCH_ARM_MACH_OMAP2_PM_H
 #define __ARCH_ARM_MACH_OMAP2_PM_H
 
-extern int omap2_pm_init(void);
-extern int omap3_pm_init(void);
-
 #ifdef CONFIG_PM_DEBUG
 extern void omap2_pm_dump(int mode, int resume, unsigned int us);
 extern int omap2_pm_debug;
arch/arm/mach-omap2/pm24xx.c +1 -1
index db10255..528dbdc 100644
@@ -470,7 +470,7 @@ static void __init prcm_setup_regs(void)
 			  WKUP_MOD, PM_WKEN);
 }
 
-int __init omap2_pm_init(void)
+static int __init omap2_pm_init(void)
 {
 	u32 l;
 
arch/arm/mach-omap2/pm34xx.c +1 -1
index 841d4c5..765cdc0 100644
@@ -652,7 +652,7 @@ static int __init clkdms_setup(struct clockdomain *clkdm)
 	return 0;
 }
 
-int __init omap3_pm_init(void)
+static int __init omap3_pm_init(void)
 {
 	struct power_state *pwrst, *tmp;
 	int ret;
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH 2/14 OMAP3: PM: CM_REGADDR macros using wrong name

---
 arch/arm/mach-omap2/cm.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/cm.h +3 -3
index 1d3c93b..f3c91a1 100644
@@ -29,9 +29,9 @@
  * These registers appear once per CM module.
  */
 
-#define OMAP3430_CM_REVISION		OMAP_CM_REGADDR(OCP_MOD, 0x0000)
-#define OMAP3430_CM_SYSCONFIG		OMAP_CM_REGADDR(OCP_MOD, 0x0010)
-#define OMAP3430_CM_POLCTRL		OMAP_CM_REGADDR(OCP_MOD, 0x009c)
+#define OMAP3430_CM_REVISION		OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
+#define OMAP3430_CM_SYSCONFIG		OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
+#define OMAP3430_CM_POLCTRL		OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
 
 #define OMAP3_CM_CLKOUT_CTRL_OFFSET	0x0070
 #define OMAP3430_CM_CLKOUT_CTRL		OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 3/14 OMAP3: PM: Ensure PRCM interrupts are cleared at boot

Any pending PRCM interrupts can prevent retention. Ensure they are cleared during boot.

---
 arch/arm/mach-omap2/pm34xx.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm34xx.c +3 -0
index 765cdc0..cc83dfc 100644
@@ -613,6 +613,9 @@ static void __init prcm_setup_regs(void)
 	/* Clear any pending PRCM interrupts */
 	prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
 
+	/* Clear any pending PRCM interrupts */
+	prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
+
 	omap3_iva_idle();
 	omap3_d2d_idle();
 }
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH 4/14 OMAP3: PM: Clear pending PRCM reset flags on init

Any pending reset flags can prevent retention. Ensure they are all cleared during boot.

---
 arch/arm/mach-omap2/pm34xx.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm34xx.c +9 -0
index cc83dfc..1422e93 100644
@@ -613,6 +613,15 @@ static void __init prcm_setup_regs(void)
 	/* Clear any pending PRCM interrupts */
 	prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
 
+	/* Clear any pending 'reset' flags */
+	prm_write_mod_reg(0xffffffff, MPU_MOD, RM_RSTST);
+	prm_write_mod_reg(0xffffffff, CORE_MOD, RM_RSTST);
+	prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD, RM_RSTST);
+	prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD, RM_RSTST);
+	prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD, RM_RSTST);
+	prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD, RM_RSTST);
+	prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD, RM_RSTST);
+
 	/* Clear any pending PRCM interrupts */
 	prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
 
Signature · 1 line
1.6.3.3
#5 lore raw

PATCH 5/14 OMAP3: PM: prevent module wakeups from waking IVA2

By default, prevent functional wakeups from inside a module from waking up the IVA2. Let DSP Bridge code handle this when loaded.

---
 arch/arm/mach-omap2/pm34xx.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm34xx.c +6 -0
index 1422e93..c813a08 100644
@@ -613,6 +613,12 @@ static void __init prcm_setup_regs(void)
 	/* Clear any pending PRCM interrupts */
 	prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
 
+	/* Don't attach IVA interrupts */
+	prm_write_mod_reg(0, WKUP_MOD, OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(0, CORE_MOD, OMAP3430_PM_IVAGRPSEL1);
+	prm_write_mod_reg(0, CORE_MOD, OMAP3430ES2_PM_IVAGRPSEL3);
+	prm_write_mod_reg(0, OMAP3430_PER_MOD, OMAP3430_PM_IVAGRPSEL);
+
 	/* Clear any pending 'reset' flags */
 	prm_write_mod_reg(0xffffffff, MPU_MOD, RM_RSTST);
 	prm_write_mod_reg(0xffffffff, CORE_MOD, RM_RSTST);
Signature · 1 line
1.6.3.3
#6 lore raw

PATCH 6/14 OMAP3: PM: Do not build suspend code if SUSPEND is not enabled

---
 arch/arm/mach-omap2/pm34xx.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm34xx.c +6 -0
index c813a08..528f725 100644
@@ -39,7 +39,9 @@
 struct power_state {
 	struct powerdomain *pwrdm;
 	u32 next_state;
+#ifdef CONFIG_SUSPEND
 	u32 saved_state;
+#endif
 	struct list_head node;
 };
 
@@ -293,6 +295,7 @@ out:
 	local_irq_enable();
 }
 
+#ifdef CONFIG_SUSPEND
 static int omap3_pm_prepare(void)
 {
 	disable_hlt();
@@ -366,6 +369,7 @@ static struct platform_suspend_ops omap_pm_ops = {
 	.finish		= omap3_pm_finish,
 	.valid		= suspend_valid_only_mem,
 };
+#endif /* CONFIG_SUSPEND */
 
 
 /**
@@ -710,7 +714,9 @@ static int __init omap3_pm_init(void)
 	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
 					 omap34xx_cpu_suspend_sz);
 
+#ifdef CONFIG_SUSPEND
 	suspend_set_ops(&omap_pm_ops);
+#endif /* CONFIG_SUSPEND */
 
 	pm_idle = omap3_pm_idle;
 
Signature · 1 line
1.6.3.3
#7 lore raw

PATCH 7/14 OMAP4: UART: cleanup special case IRQ handling

Streamline the OMAP4 special IRQ assignments by putting inside normal init loop instead of having a separate loop.

---
 arch/arm/mach-omap2/serial.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/serial.c +3 -4
index b094c15..c82ec95 100644
@@ -496,10 +496,6 @@ void __init omap_serial_init(void)
 
 	if (info == NULL)
 		return;
-	if (cpu_is_omap44xx()) {
-		for (i = 0; i < OMAP_MAX_NR_PORTS; i++)
-			serial_platform_data[i].irq += 32;
-	}
 
 	for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
 		struct plat_serial8250_port *p = serial_platform_data + i;
@@ -533,6 +529,9 @@ void __init omap_serial_init(void)
 		uart->p = p;
 		list_add(&uart->node, &uart_list);
 
+		if (cpu_is_omap44xx())
+			p->irq += 32;
+
 		omap_uart_enable_clocks(uart);
 		omap_uart_reset(uart);
 		omap_uart_idle_init(uart);
Signature · 1 line
1.6.3.3
#8 lore raw

PATCH 8/14 OMAP3: Fixed crash bug with serial + suspend

From: Tero Kristo <[email protected]>

It was possible for an unhandled interrupt to occur if there was incoming serial traffic during wakeup from suspend. This was caused by the code in arch-arm/mach-omap2/serial.c keeping interrupt enabled all the time, but not acking its interrupts. Applies on top of PM branch.

Use the PM begin/end hooks to ensure that the "serial idle" interrupts are disabled during the suspend path. Also, since begin/end hooks are now used, use the suspend_state that is passed in the begin hook instead of the enter hook as per the platform_suspend_ops docs.

---
 arch/arm/mach-omap2/pm34xx.c             |   23 +++++++++++++++++++++--
 arch/arm/mach-omap2/serial.c             |   14 ++++++++++++++
 arch/arm/plat-omap/include/mach/serial.h |    1 +
 3 files changed, 36 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/pm34xx.c +21 -2
index 528f725..b07efb2 100644
@@ -296,6 +296,8 @@ out:
 }
 
 #ifdef CONFIG_SUSPEND
+static suspend_state_t suspend_state;
+
 static int omap3_pm_prepare(void)
 {
 	disable_hlt();
@@ -342,11 +344,11 @@ restore:
 	return ret;
 }
 
-static int omap3_pm_enter(suspend_state_t state)
+static int omap3_pm_enter(suspend_state_t unused)
 {
 	int ret = 0;
 
-	switch (state) {
+	switch (suspend_state) {
 	case PM_SUSPEND_STANDBY:
 	case PM_SUSPEND_MEM:
 		ret = omap3_pm_suspend();
@@ -363,7 +365,24 @@ static void omap3_pm_finish(void)
 	enable_hlt();
 }
 
+/* Hooks to enable / disable UART interrupts during suspend */
+static int omap3_pm_begin(suspend_state_t state)
+{
+	suspend_state = state;
+	omap_uart_enable_irqs(0);
+	return 0;
+}
+
+static void omap3_pm_end(void)
+{
+	suspend_state = PM_SUSPEND_ON;
+	omap_uart_enable_irqs(1);
+	return;
+}
+
 static struct platform_suspend_ops omap_pm_ops = {
+	.begin		= omap3_pm_begin,
+	.end		= omap3_pm_end,
 	.prepare	= omap3_pm_prepare,
 	.enter		= omap3_pm_enter,
 	.finish		= omap3_pm_finish,
arch/arm/mach-omap2/serial.c +14 -0
index c82ec95..5352d05 100644
@@ -435,6 +435,20 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
 	WARN_ON(ret);
 }
 
+void omap_uart_enable_irqs(int enable)
+{
+	int ret;
+	struct omap_uart_state *uart;
+
+	list_for_each_entry(uart, &uart_list, node) {
+		if (enable)
+			ret = request_irq(uart->p->irq, omap_uart_interrupt,
+				IRQF_SHARED, "serial idle", (void *)uart);
+		else
+			free_irq(uart->p->irq, (void *)uart);
+	}
+}
+
 static ssize_t sleep_timeout_show(struct kobject *kobj,
 				  struct kobj_attribute *attr,
 				  char *buf)
arch/arm/plat-omap/include/mach/serial.h +1 -0
index 13abd02..def0529 100644
@@ -59,6 +59,7 @@ extern void omap_uart_check_wakeup(void);
 extern void omap_uart_prepare_suspend(void);
 extern void omap_uart_prepare_idle(int num);
 extern void omap_uart_resume_idle(int num);
+extern void omap_uart_enable_irqs(int enable);
 #endif
 
 #endif
Signature · 1 line
1.6.3.3
#9 lore raw

PATCH 9/14 OMAP2/3/4: UART: Allow per-UART disabling wakeup for serial ports

This patch causes the OMAP uarts to honor the sysfs power/wakeup file for IOPAD wakeups. Before the OMAP was always woken up from off mode on a rs232 signal change. This patch also creates a different platform device for each serial port so that the wakeup properties can be control per port.

By default, IOPAD wakeups are enabled for each UART. To disable,

  # echo disabled > /sys/devices/platform/serial8250.0/power/wakeup

Where serial8250.0 can be replaced by .1, or .2 to control the other ports.

Original idea and original patch from Russ Dill <[email protected]>

---
 arch/arm/mach-omap2/serial.c |  174 ++++++++++++++++++++++++++++--------------
 1 files changed, 116 insertions(+), 58 deletions(-)
arch/arm/mach-omap2/serial.c +116 -58
index 5352d05..6f35a7e 100644
@@ -54,6 +54,7 @@ struct omap_uart_state {
 
 	struct plat_serial8250_port *p;
 	struct list_head node;
+	struct platform_device pdev;
 
 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
 	int context_valid;
@@ -68,10 +69,9 @@ struct omap_uart_state {
 #endif
 };
 
-static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS];
 static LIST_HEAD(uart_list);
 
-static struct plat_serial8250_port serial_platform_data[] = {
+static struct plat_serial8250_port serial_platform_data0[] = {
 	{
 		.membase	= IO_ADDRESS(OMAP_UART1_BASE),
 		.mapbase	= OMAP_UART1_BASE,
@@ -81,6 +81,12 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.regshift	= 2,
 		.uartclk	= OMAP24XX_BASE_BAUD * 16,
 	}, {
+		.flags		= 0
+	}
+};
+
+static struct plat_serial8250_port serial_platform_data1[] = {
+	{
 		.membase	= IO_ADDRESS(OMAP_UART2_BASE),
 		.mapbase	= OMAP_UART2_BASE,
 		.irq		= 73,
@@ -89,6 +95,12 @@ static struct plat_serial8250_port serial_platform_data[] = {
 		.regshift	= 2,
 		.uartclk	= OMAP24XX_BASE_BAUD * 16,
 	}, {
+		.flags		= 0
+	}
+};
+
+static struct plat_serial8250_port serial_platform_data2[] = {
+	{
 		.membase	= IO_ADDRESS(OMAP_UART3_BASE),
 		.mapbase	= OMAP_UART3_BASE,
 		.irq		= 74,
@@ -217,6 +229,40 @@ static inline void omap_uart_disable_clocks(struct omap_uart_state *uart)
 	clk_disable(uart->fck);
 }
 
+static void omap_uart_enable_wakeup(struct omap_uart_state *uart)
+{
+	/* Set wake-enable bit */
+	if (uart->wk_en && uart->wk_mask) {
+		u32 v = __raw_readl(uart->wk_en);
+		v |= uart->wk_mask;
+		__raw_writel(v, uart->wk_en);
+	}
+
+	/* Ensure IOPAD wake-enables are set */
+	if (cpu_is_omap34xx() && uart->padconf) {
+		u16 v = omap_ctrl_readw(uart->padconf);
+		v |= OMAP3_PADCONF_WAKEUPENABLE0;
+		omap_ctrl_writew(v, uart->padconf);
+	}
+}
+
+static void omap_uart_disable_wakeup(struct omap_uart_state *uart)
+{
+	/* Clear wake-enable bit */
+	if (uart->wk_en && uart->wk_mask) {
+		u32 v = __raw_readl(uart->wk_en);
+		v &= ~uart->wk_mask;
+		__raw_writel(v, uart->wk_en);
+	}
+
+	/* Ensure IOPAD wake-enables are cleared */
+	if (cpu_is_omap34xx() && uart->padconf) {
+		u16 v = omap_ctrl_readw(uart->padconf);
+		v &= ~OMAP3_PADCONF_WAKEUPENABLE0;
+		omap_ctrl_writew(v, uart->padconf);
+	}
+}
+
 static void omap_uart_smart_idle_enable(struct omap_uart_state *uart,
 					  int enable)
 {
@@ -246,6 +292,11 @@ static void omap_uart_block_sleep(struct omap_uart_state *uart)
 
 static void omap_uart_allow_sleep(struct omap_uart_state *uart)
 {
+	if (device_may_wakeup(&uart->pdev.dev))
+		omap_uart_enable_wakeup(uart);
+	else
+		omap_uart_disable_wakeup(uart);
+
 	if (!uart->clocked)
 		return;
 
@@ -292,7 +343,6 @@ void omap_uart_resume_idle(int num)
 			/* Check for normal UART wakeup */
 			if (__raw_readl(uart->wk_st) & uart->wk_mask)
 				omap_uart_block_sleep(uart);
-
 			return;
 		}
 	}
@@ -346,16 +396,13 @@ static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
 	return IRQ_NONE;
 }
 
-static u32 sleep_timeout = DEFAULT_TIMEOUT;
-
 static void omap_uart_idle_init(struct omap_uart_state *uart)
 {
-	u32 v;
 	struct plat_serial8250_port *p = uart->p;
 	int ret;
 
 	uart->can_sleep = 0;
-	uart->timeout = sleep_timeout;
+	uart->timeout = DEFAULT_TIMEOUT;
 	setup_timer(&uart->timer, omap_uart_idle_timer,
 		    (unsigned long) uart);
 	mod_timer(&uart->timer, jiffies + uart->timeout);
@@ -413,22 +460,6 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
 		uart->padconf = 0;
 	}
 
-	/* Set wake-enable bit */
-	if (uart->wk_en && uart->wk_mask) {
-		v = __raw_readl(uart->wk_en);
-		v |= uart->wk_mask;
-		__raw_writel(v, uart->wk_en);
-	}
-
-	/* Ensure IOPAD wake-enables are set */
-	if (cpu_is_omap34xx() && uart->padconf) {
-		u16 v;
-
-		v = omap_ctrl_readw(uart->padconf);
-		v |= OMAP3_PADCONF_WAKEUPENABLE0;
-		omap_ctrl_writew(v, uart->padconf);
-	}
-
 	p->flags |= UPF_SHARE_IRQ;
 	ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED,
 			  "serial idle", (void *)uart);
@@ -449,54 +480,81 @@ void omap_uart_enable_irqs(int enable)
 	}
 }
 
-static ssize_t sleep_timeout_show(struct kobject *kobj,
-				  struct kobj_attribute *attr,
+static ssize_t sleep_timeout_show(struct device *dev,
+				  struct device_attribute *attr,
 				  char *buf)
 {
-	return sprintf(buf, "%u\n", sleep_timeout / HZ);
+	struct platform_device *pdev = container_of(dev,
+					struct platform_device, dev);
+	struct omap_uart_state *uart = container_of(pdev,
+					struct omap_uart_state, pdev);
+
+	return sprintf(buf, "%u\n", uart->timeout / HZ);
 }
 
-static ssize_t sleep_timeout_store(struct kobject *kobj,
-				   struct kobj_attribute *attr,
+static ssize_t sleep_timeout_store(struct device *dev,
+				   struct device_attribute *attr,
 				   const char *buf, size_t n)
 {
-	struct omap_uart_state *uart;
+	struct platform_device *pdev = container_of(dev,
+					struct platform_device, dev);
+	struct omap_uart_state *uart = container_of(pdev,
+					struct omap_uart_state, pdev);
 	unsigned int value;
 
 	if (sscanf(buf, "%u", &value) != 1) {
 		printk(KERN_ERR "sleep_timeout_store: Invalid value\n");
 		return -EINVAL;
 	}
-	sleep_timeout = value * HZ;
-	list_for_each_entry(uart, &uart_list, node) {
-		uart->timeout = sleep_timeout;
-		if (uart->timeout)
-			mod_timer(&uart->timer, jiffies + uart->timeout);
-		else
-			/* A zero value means disable timeout feature */
-			omap_uart_block_sleep(uart);
-	}
+
+	uart->timeout = value * HZ;
+	if (uart->timeout)
+		mod_timer(&uart->timer, jiffies + uart->timeout);
+	else
+		/* A zero value means disable timeout feature */
+		omap_uart_block_sleep(uart);
+
 	return n;
 }
 
-static struct kobj_attribute sleep_timeout_attr =
-	__ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store);
-
+DEVICE_ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store);
+#define DEV_CREATE_FILE(dev, attr) WARN_ON(device_create_file(dev, attr))
 #else
 static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}
+#define DEV_CREATE_FILE(dev, attr)
 #endif /* CONFIG_PM */
 
-static struct platform_device serial_device = {
-	.name			= "serial8250",
-	.id			= PLAT8250_DEV_PLATFORM,
-	.dev			= {
-		.platform_data	= serial_platform_data,
+static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = {
+	{
+		.pdev = {
+			.name			= "serial8250",
+			.id			= PLAT8250_DEV_PLATFORM,
+			.dev			= {
+				.platform_data	= serial_platform_data0,
+			},
+		},
+	}, {
+		.pdev = {
+			.name			= "serial8250",
+			.id			= PLAT8250_DEV_PLATFORM1,
+			.dev			= {
+				.platform_data	= serial_platform_data1,
+			},
+		},
+	}, {
+		.pdev = {
+			.name			= "serial8250",
+			.id			= PLAT8250_DEV_PLATFORM2,
+			.dev			= {
+				.platform_data	= serial_platform_data2,
+			},
+		},
 	},
 };
 
 void __init omap_serial_init(void)
 {
-	int i, err;
+	int i;
 	const struct omap_uart_config *info;
 	char name[16];
 
@@ -512,8 +570,10 @@ void __init omap_serial_init(void)
 		return;
 
 	for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
-		struct plat_serial8250_port *p = serial_platform_data + i;
 		struct omap_uart_state *uart = &omap_uart[i];
+		struct platform_device *pdev = &uart->pdev;
+		struct device *dev = &pdev->dev;
+		struct plat_serial8250_port *p = dev->platform_data;
 
 		if (!(info->enabled_uarts & (1 << i))) {
 			p->membase = NULL;
@@ -549,15 +609,13 @@ void __init omap_serial_init(void)
 		omap_uart_enable_clocks(uart);
 		omap_uart_reset(uart);
 		omap_uart_idle_init(uart);
-	}
-
-	err = platform_device_register(&serial_device);
-
-#ifdef CONFIG_PM
-	if (!err)
-		err = sysfs_create_file(&serial_device.dev.kobj,
-					&sleep_timeout_attr.attr);
-#endif
 
+		if (WARN_ON(platform_device_register(pdev)))
+			continue;
+		if ((cpu_is_omap34xx() && uart->padconf) ||
+		    (uart->wk_en && uart->wk_mask)) {
+			device_init_wakeup(dev, true);
+			DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout);
+		}
+	}
 }
-
Signature · 1 line
1.6.3.3
#10 lore raw

PATCH 10/14 OMAP2/3/4: UART: allow in-order port traversal

Use list_add_tail() when adding discovered UART ports. This is so traversal using list_for_each_entry() will traverse the list in the order they were found.

---
 arch/arm/mach-omap2/serial.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/serial.c +1 -1
index 6f35a7e..a7421a5 100644
@@ -601,7 +601,7 @@ void __init omap_serial_init(void)
 		uart->num = i;
 		p->private_data = uart;
 		uart->p = p;
-		list_add(&uart->node, &uart_list);
+		list_add_tail(&uart->node, &uart_list);
 
 		if (cpu_is_omap44xx())
 			p->irq += 32;
Signature · 1 line
1.6.3.3
#11 lore raw

PATCH 11/14 OMAP: PM: CPUfreq: obey min/max settings of policy

From: Eero Nurkkala <[email protected]>

Use the min/max settings from CPUfreq policy rather than processor defined min/max settings.

Without this patch, it's possible to scale frequency outside the current policy range.

---
 arch/arm/plat-omap/cpu-omap.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/plat-omap/cpu-omap.c +4 -4
index 843e8af..1868c0d 100644
@@ -78,10 +78,10 @@ static int omap_target(struct cpufreq_policy *policy,
 
 	/* Ensure desired rate is within allowed range.  Some govenors
 	 * (ondemand) will just pass target_freq=0 to get the minimum. */
-	if (target_freq < policy->cpuinfo.min_freq)
-		target_freq = policy->cpuinfo.min_freq;
-	if (target_freq > policy->cpuinfo.max_freq)
-		target_freq = policy->cpuinfo.max_freq;
+	if (target_freq < policy->min)
+		target_freq = policy->min;
+	if (target_freq > policy->max)
+		target_freq = policy->max;
 
 	freqs.old = omap_getspeed(0);
 	freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
Signature · 1 line
1.6.3.3
#12 lore raw

PATCH 12/14 OMAP3: PM: Fix wrong sequence in suspend.

From: Jouni Hogander <[email protected]>

Powerdomain previous state is checked after restoring new states in suspend. This patch fixes this problem.

---
 arch/arm/mach-omap2/pm34xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/pm34xx.c +1 -1
index b07efb2..488d595 100644
@@ -326,7 +326,6 @@ static int omap3_pm_suspend(void)
 restore:
 	/* Restore next_pwrsts */
 	list_for_each_entry(pwrst, &pwrst_list, node) {
-		set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
 		state = pwrdm_read_prev_pwrst(pwrst->pwrdm);
 		if (state > pwrst->next_state) {
 			printk(KERN_INFO "Powerdomain (%s) didn't enter "
@@ -334,6 +333,7 @@ restore:
 			       pwrst->pwrdm->name, pwrst->next_state);
 			ret = -1;
 		}
+		set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
 	}
 	if (ret)
 		printk(KERN_ERR "Could not enter target state in pm_suspend\n");
Signature · 1 line
1.6.3.3
#13 lore raw

PATCH 13/14 OMAP: GPIO: clear/restore level/edge detect settings on mask/unmask

If IRQ triggering is enabled, it can trigger a pending interrupt even for masked interrupts. Any pending GPIO interrupts can prevent the powerdomain from hitting retention.

Problem found, reported and additional review and testing by Chunquiu Wang.

---
 arch/arm/plat-omap/gpio.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/plat-omap/gpio.c +6 -0
index 26b387c..77bad14 100644
@@ -1189,6 +1189,7 @@ static void gpio_mask_irq(unsigned int irq)
 	struct gpio_bank *bank = get_irq_chip_data(irq);
 
 	_set_gpio_irqenable(bank, gpio, 0);
+	_set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE);
 }
 
 static void gpio_unmask_irq(unsigned int irq)
@@ -1196,6 +1197,11 @@ static void gpio_unmask_irq(unsigned int irq)
 	unsigned int gpio = irq - IH_GPIO_BASE;
 	struct gpio_bank *bank = get_irq_chip_data(irq);
 	unsigned int irq_mask = 1 << get_gpio_index(gpio);
+	struct irq_desc *desc = irq_to_desc(irq);
+	u32 trigger = desc->status & IRQ_TYPE_SENSE_MASK;
+
+	if (trigger)
+		_set_gpio_triggering(bank, get_gpio_index(gpio), trigger);
 
 	/* For level-triggered GPIOs, the clearing must be done after
 	 * the HW source is cleared, thus after the handler has run */
Signature · 1 line
1.6.3.3
#14 lore raw

PATCH 14/14 OMAP3: Overo: add missing pen-down GPIO definition

---
 arch/arm/mach-omap2/board-overo.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-overo.c +1 -0
index dff5528..e26af83 100644
@@ -51,6 +51,7 @@
 
 #define OVERO_GPIO_BT_XGATE	15
 #define OVERO_GPIO_W2W_NRESET	16
+#define OVERO_GPIO_PENDOWN	114
 #define OVERO_GPIO_BT_NRESET	164
 #define OVERO_GPIO_USBH_CPEN	168
 #define OVERO_GPIO_USBH_NRESET	183
Signature · 1 line
1.6.3.3
maintainer
#16 lore raw
Quoted 4 lines · Russell King - ARM Linux
Quoted 1 line · Kevin Hilman

Also available here as a v2.6.31-rc3 based branch from:

Looks fine.

Ack from me too. I assume that Kevin will post a pull request for Russell so we'll get these merged.

FYI, I'm back from vacation now and reading mails. Looks like there are some fixes floating around, so I'll collect those into one more omap-fixes series once I'm done reading.

Regards,

Tony

#17 lore raw
Quoted 8 lines · Tony Lindgren
Quoted 4 lines · Russell King - ARM Linux
Quoted 1 line · Kevin Hilman

Also available here as a v2.6.31-rc3 based branch from:

Looks fine.

Ack from me too. I assume that Kevin will post a pull request for Russell so we'll get these merged.

Yes, I'll rebase and send pull request.

Kevin

#18 lore raw

pull request (Re: [PATCH 00/14] OMAP PM fixes for .31-rc series)

In reply to Tony Lindgren

Russell,

This series was rebased against v2.6.31-rc5, and here's the pull request.

The following changes since commit ed680c4ad478d0fee9740f7d029087f181346564:
Linus Torvalds (1):

        Linux 2.6.31-rc5

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git pm-upstream/fixes

Eero Nurkkala (1):
OMAP: PM: CPUfreq: obey min/max settings of policy

Jouni Hogander (1):
OMAP3: PM: Fix wrong sequence in suspend.

Kevin Hilman (11):
OMAP2/3: PM: make PM __init calls static
OMAP3: PM: CM_REGADDR macros using wrong name
OMAP3: PM: Ensure PRCM interrupts are cleared at boot
OMAP3: PM: Clear pending PRCM reset flags on init
OMAP3: PM: prevent module wakeups from waking IVA2
OMAP3: PM: Do not build suspend code if SUSPEND is not enabled
OMAP4: UART: cleanup special case IRQ handling OMAP2/3/4: UART: Allow per-UART disabling wakeup for serial ports OMAP2/3/4: UART: allow in-order port traversal
OMAP: GPIO: clear/restore level/edge detect settings on mask/unmask
OMAP3: Overo: add missing pen-down GPIO definition

Tero Kristo (1):
OMAP3: Fixed crash bug with serial + suspend

 arch/arm/mach-omap2/board-overo.c        |    1 +
 arch/arm/mach-omap2/cm.h                 |    6 +-
 arch/arm/mach-omap2/pm.h                 |    3 -
 arch/arm/mach-omap2/pm24xx.c             |    2 +-
 arch/arm/mach-omap2/pm34xx.c             |   51 +++++++-
 arch/arm/mach-omap2/serial.c             |  197 ++++++++++++++++++++----------
 arch/arm/plat-omap/cpu-omap.c            |    8 +-
 arch/arm/plat-omap/gpio.c                |    6 +
 arch/arm/plat-omap/include/mach/serial.h |    1 +
 9 files changed, 197 insertions(+), 78 deletions(-)

-------------------------------------------------------------------

List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php