Title: [4170] trunk: Task [#3261] hook up set_irq_wake() in Blackfins irq code: Add BF54x support for GPIO IRQ wakeups
Revision
4170
Author
hennerich
Date
2008-01-30 03:57:52 -0600 (Wed, 30 Jan 2008)

Log Message

Task [#3261] hook up set_irq_wake() in Blackfins irq code: Add BF54x support for GPIO IRQ wakeups

Diffstat

 arch/blackfin/kernel/bfin_gpio.c          |    6 +-
 arch/blackfin/mach-common/ints-priority.c |   77 ++++++++++++++++++++++++++++--
 arch/blackfin/mach-common/pm.c            |    8 +--
 include/asm-blackfin/gpio.h               |    7 +-
 4 files changed, 86 insertions(+), 12 deletions(-)

Modified Paths

Diff

Modified: trunk/arch/blackfin/kernel/bfin_gpio.c (4169 => 4170)


--- trunk/arch/blackfin/kernel/bfin_gpio.c	2008-01-30 06:27:48 UTC (rev 4169)
+++ trunk/arch/blackfin/kernel/bfin_gpio.c	2008-01-30 09:57:52 UTC (rev 4170)
@@ -186,7 +186,7 @@
 	char name[RESOURCE_LABEL_SIZE];
 } str_ident[MAX_RESOURCES];
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) && !defined(CONFIG_BF54x)
 static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
 static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
 static struct gpio_port_s gpio_bank_saved[gpio_bank(MAX_BLACKFIN_GPIOS)];
@@ -696,7 +696,7 @@
 	return 0;
 }
 
-u32 gpio_pm_setup(void)
+u32 bfin_pm_setup(void)
 {
 	u16 bank, mask, i, gpio;
 
@@ -744,7 +744,7 @@
 	return 0;
 }
 
-void gpio_pm_restore(void)
+void bfin_pm_restore(void)
 {
 	u16 bank, mask, i;
 

Modified: trunk/arch/blackfin/mach-common/ints-priority.c (4169 => 4170)


--- trunk/arch/blackfin/mach-common/ints-priority.c	2008-01-30 06:27:48 UTC (rev 4169)
+++ trunk/arch/blackfin/mach-common/ints-priority.c	2008-01-30 09:57:52 UTC (rev 4170)
@@ -1,5 +1,5 @@
 /*
- * File:         arch/blackfin/mach-common/ints-priority-sc.c
+ * File:         arch/blackfin/mach-common/ints-priority.c
  * Based on:
  * Author:
  *
@@ -13,7 +13,7 @@
  *               2002 Arcturus Networks Inc. MaTed <[EMAIL PROTECTED]>
  *               2003 Metrowerks/Motorola
  *               2003 Bas Vermeulen <[EMAIL PROTECTED]>
- *               Copyright 2004-2007 Analog Devices Inc.
+ *               Copyright 2004-2008 Analog Devices Inc.
  *
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  *
@@ -808,6 +808,74 @@
 	return 0;
 }
 
+#ifdef CONFIG_PM
+u32 pint_saved_masks[NR_PINT_SYS_IRQS];
+u32 pint_wakeup_masks[NR_PINT_SYS_IRQS];
+
+int bfin_gpio_set_wake(unsigned int irq, unsigned int state)
+{
+	u32 pint_irq;
+	u8 pint_val = irq2pint_lut[irq - SYS_IRQS];
+	u32 bank = PINT_2_BANK(pint_val);
+	u32 pintbit = PINT_BIT(pint_val);
+
+	switch (bank) {
+	case 0:
+		pint_irq = IRQ_PINT0;
+		break;
+	case 2:
+		pint_irq = IRQ_PINT2;
+		break;
+	case 3:
+		pint_irq = IRQ_PINT3;
+		break;
+	case 1:
+		pint_irq = IRQ_PINT1;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	bfin_internal_set_wake(pint_irq, state);
+
+	if (state)
+		pint_wakeup_masks[bank] |= pintbit;
+	else
+		pint_wakeup_masks[bank] &= ~pintbit;
+
+	return 0;
+}
+
+u32 bfin_pm_setup(void)
+{
+	u32 val, i;
+
+	for (i = 0; i < NR_PINT_SYS_IRQS; i++) {
+		val = pint[i]->mask_clear;
+		pint_saved_masks[i] = val;
+		if (val ^ pint_wakeup_masks[i]) {
+			pint[i]->mask_clear = val;
+			pint[i]->mask_set = pint_wakeup_masks[i];
+		}
+	}
+
+	return 0;
+}
+
+void bfin_pm_restore(void)
+{
+	u32 i, val;
+
+	for (i = 0; i < NR_PINT_SYS_IRQS; i++) {
+		val = pint_saved_masks[i];
+		if (val ^ pint_wakeup_masks[i]) {
+			pint[i]->mask_clear = pint[i]->mask_clear;
+			pint[i]->mask_set = val;
+		}
+	}
+}
+#endif
+
 static struct irq_chip bfin_gpio_irqchip = {
 	.ack = bfin_gpio_ack_irq,
 	.mask = bfin_gpio_mask_irq,
@@ -815,7 +883,10 @@
 	.unmask = bfin_gpio_unmask_irq,
 	.set_type = bfin_gpio_irq_type,
 	.startup = bfin_gpio_irq_startup,
-	.shutdown = bfin_gpio_irq_shutdown
+	.shutdown = bfin_gpio_irq_shutdown,
+#ifdef CONFIG_PM
+	.set_wake = bfin_gpio_set_wake,
+#endif
 };
 
 static void bfin_demux_gpio_irq(unsigned int inta_irq,

Modified: trunk/arch/blackfin/mach-common/pm.c (4169 => 4170)


--- trunk/arch/blackfin/mach-common/pm.c	2008-01-30 06:27:48 UTC (rev 4169)
+++ trunk/arch/blackfin/mach-common/pm.c	2008-01-30 09:57:52 UTC (rev 4170)
@@ -4,7 +4,7 @@
  * Author:       Cliff Brake <[EMAIL PROTECTED]> Copyright (c) 2001
  *
  * Created:      2001
- * Description:  Power management for the bfin
+ * Description:  Blackfin power management
  *
  * Modified:     Nicolas Pitre - PXA250 support
  *                Copyright (c) 2002 Monta Vista Software, Inc.
@@ -12,7 +12,7 @@
  *                Copyright (c) 2002 Monta Vista Software, Inc.
  *               Dirk Behme <[EMAIL PROTECTED]> - OMAP1510/1610
  *                Copyright 2004
- *               Copyright 2004-2006 Analog Devices Inc.
+ *               Copyright 2004-2008 Analog Devices Inc.
  *
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  *
@@ -70,7 +70,7 @@
 	u32 flags;
 
 	local_irq_save(flags);
-	gpio_pm_setup();
+	bfin_pm_setup();
 
 #ifdef CONFIG_PM_BFIN_SLEEP_DEEPER
 	sleep_deeper(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]);
@@ -78,7 +78,7 @@
 	sleep_mode(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]);
 #endif
 
-	gpio_pm_restore();
+	bfin_pm_restore();
 
 #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)  || defined(CONFIG_BF561)
 	bfin_write_SIC_IWR0(IWR_ENABLE_ALL);

Modified: trunk/include/asm-blackfin/gpio.h (4169 => 4170)


--- trunk/include/asm-blackfin/gpio.h	2008-01-30 06:27:48 UTC (rev 4169)
+++ trunk/include/asm-blackfin/gpio.h	2008-01-30 09:57:52 UTC (rev 4170)
@@ -376,6 +376,10 @@
 #endif
 
 #ifdef CONFIG_PM
+unsigned int bfin_pm_setup(void);
+void bfin_pm_restore(void);
+
+#ifndef CONFIG_BF54x
 #define PM_WAKE_RISING	0x1
 #define PM_WAKE_FALLING	0x2
 #define PM_WAKE_HIGH	0x4
@@ -385,8 +389,6 @@
 
 int gpio_pm_wakeup_request(unsigned gpio, unsigned char type);
 void gpio_pm_wakeup_free(unsigned gpio);
-unsigned int gpio_pm_setup(void);
-void gpio_pm_restore(void);
 
 struct gpio_port_s {
 	unsigned short data;
@@ -410,6 +412,7 @@
 	unsigned short fer;
 	unsigned short reserved;
 };
+#endif /*CONFIG_BF54x*/
 #endif /*CONFIG_PM*/
 
 /***********************************************************
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to