Commit 08556256 authored by Russell King's avatar Russell King

[ARM] Add support for IRQ-based wakeup for SA11x0 CPUs

This patch adds support for enable/disable_irq_wake for the SA11x0
CPUs, allowing drivers or other code to select which IRQs are able
to wake the CPU from sleep mode.
parent 21f762b4
...@@ -92,12 +92,22 @@ static void sa1100_low_gpio_unmask(unsigned int irq) ...@@ -92,12 +92,22 @@ static void sa1100_low_gpio_unmask(unsigned int irq)
ICMR |= 1 << irq; ICMR |= 1 << irq;
} }
static int sa1100_low_gpio_wake(unsigned int irq, unsigned int on)
{
if (on)
PWER |= 1 << irq;
else
PWER &= ~(1 << irq);
return 0;
}
static struct irqchip sa1100_low_gpio_chip = { static struct irqchip sa1100_low_gpio_chip = {
.ack = sa1100_low_gpio_ack, .ack = sa1100_low_gpio_ack,
.mask = sa1100_low_gpio_mask, .mask = sa1100_low_gpio_mask,
.unmask = sa1100_low_gpio_unmask, .unmask = sa1100_low_gpio_unmask,
.rerun = sa1100_manual_rerun, .rerun = sa1100_manual_rerun,
.type = sa1100_gpio_type, .type = sa1100_gpio_type,
.wake = sa1100_low_gpio_wake,
}; };
/* /*
...@@ -166,12 +176,22 @@ static void sa1100_high_gpio_unmask(unsigned int irq) ...@@ -166,12 +176,22 @@ static void sa1100_high_gpio_unmask(unsigned int irq)
GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask; GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask;
} }
static int sa1100_high_gpio_wake(unsigned int irq, unsigned int on)
{
if (on)
PWER |= GPIO11_27_MASK(irq);
else
PWER &= ~GPIO11_27_MASK(irq);
return 0;
}
static struct irqchip sa1100_high_gpio_chip = { static struct irqchip sa1100_high_gpio_chip = {
.ack = sa1100_high_gpio_ack, .ack = sa1100_high_gpio_ack,
.mask = sa1100_high_gpio_mask, .mask = sa1100_high_gpio_mask,
.unmask = sa1100_high_gpio_unmask, .unmask = sa1100_high_gpio_unmask,
.rerun = sa1100_manual_rerun, .rerun = sa1100_manual_rerun,
.type = sa1100_gpio_type, .type = sa1100_gpio_type,
.wake = sa1100_high_gpio_wake,
}; };
/* /*
...@@ -252,5 +272,5 @@ void __init sa1100_init_irq(void) ...@@ -252,5 +272,5 @@ void __init sa1100_init_irq(void)
* We generally don't want the LCD IRQ being * We generally don't want the LCD IRQ being
* enabled as soon as we request it. * enabled as soon as we request it.
*/ */
set_irq_flags(IRQ_LCD, IRQF_VALID | IRQF_NOAUTOEN); set_irq_flags(IRQ_LCD, IRQF_VALID/* | IRQF_NOAUTOEN*/);
} }
...@@ -249,6 +249,19 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags) ...@@ -249,6 +249,19 @@ static int sa1111_type_lowirq(unsigned int irq, unsigned int flags)
INTPOL0 &= ~mask; INTPOL0 &= ~mask;
else else
INTPOL0 |= mask; INTPOL0 |= mask;
WAKE_POL0 = INTPOL0;
return 0;
}
static int sa1111_wake_lowirq(unsigned int irq, unsigned int on)
{
unsigned int mask = SA1111_IRQMASK_LO(irq);
if (on)
WAKE_EN0 |= mask;
else
WAKE_EN0 &= ~mask;
return 0; return 0;
} }
...@@ -259,6 +272,7 @@ static struct irqchip sa1111_low_chip = { ...@@ -259,6 +272,7 @@ static struct irqchip sa1111_low_chip = {
.unmask = sa1111_unmask_lowirq, .unmask = sa1111_unmask_lowirq,
.rerun = sa1111_rerun_lowirq, .rerun = sa1111_rerun_lowirq,
.type = sa1111_type_lowirq, .type = sa1111_type_lowirq,
.wake = sa1111_wake_lowirq,
}; };
static void sa1111_mask_highirq(unsigned int irq) static void sa1111_mask_highirq(unsigned int irq)
...@@ -309,6 +323,19 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags) ...@@ -309,6 +323,19 @@ static int sa1111_type_highirq(unsigned int irq, unsigned int flags)
INTPOL1 &= ~mask; INTPOL1 &= ~mask;
else else
INTPOL1 |= mask; INTPOL1 |= mask;
WAKE_POL1 = INTPOL1;
return 0;
}
static int sa1111_wake_highirq(unsigned int irq, unsigned int on)
{
unsigned int mask = SA1111_IRQMASK_HI(irq);
if (on)
WAKE_EN1 |= mask;
else
WAKE_EN1 &= ~mask;
return 0; return 0;
} }
...@@ -319,6 +346,7 @@ static struct irqchip sa1111_high_chip = { ...@@ -319,6 +346,7 @@ static struct irqchip sa1111_high_chip = {
.unmask = sa1111_unmask_highirq, .unmask = sa1111_unmask_highirq,
.rerun = sa1111_rerun_highirq, .rerun = sa1111_rerun_highirq,
.type = sa1111_type_highirq, .type = sa1111_type_highirq,
.wake = sa1111_wake_highirq,
}; };
static void __init sa1111_init_irq(struct sa1111_dev *sadev) static void __init sa1111_init_irq(struct sa1111_dev *sadev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment