linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts
@ 2009-12-10 11:14 Mark Ware
  2009-12-10 14:52 ` Kumar Gala
  2009-12-10 19:48 ` Kumar Gala
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Ware @ 2009-12-10 11:14 UTC (permalink / raw)
  To: Linuxppc-dev Development; +Cc: Scott Wood, avorontsov

Port C interrupts can be either falling edge, or either edge.
Other external interrupts are either falling edge or active low.
Tested on a custom 8280 based board.

Signed-off-by: Mark Ware <mware@elphinstone.net>
---
Changed in v3:
- Cosmetic improvements as suggested by Anton and Scott
- Added tested note to changelog

 arch/powerpc/sysdev/cpm2_pic.c |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index 78f1f7c..b1e9206 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -141,13 +141,23 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
 	struct irq_desc *desc = get_irq_desc(virq);
 	unsigned int vold, vnew, edibit;
 
-	if (flow_type == IRQ_TYPE_NONE)
-		flow_type = IRQ_TYPE_LEVEL_LOW;
-
-	if (flow_type & IRQ_TYPE_EDGE_RISING) {
-		printk(KERN_ERR "CPM2 PIC: sense type 0x%x not supported\n",
-			flow_type);
-		return -EINVAL;
+	/* Port C interrupts are either IRQ_TYPE_EDGE_FALLING or
+	 * IRQ_TYPE_EDGE_BOTH (default).  All others are IRQ_TYPE_EDGE_FALLING
+	 * or IRQ_TYPE_LEVEL_LOW (default)
+	 */
+	if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0) {
+		if (flow_type == IRQ_TYPE_NONE)
+			flow_type = IRQ_TYPE_EDGE_BOTH;
+
+		if (flow_type != IRQ_TYPE_EDGE_BOTH &&
+		    flow_type != IRQ_TYPE_EDGE_FALLING)
+			goto err_sense;
+	} else {
+		if (flow_type == IRQ_TYPE_NONE)
+			flow_type = IRQ_TYPE_LEVEL_LOW;
+
+		if (flow_type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_LEVEL_HIGH))
+			goto err_sense;
 	}
 
 	desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
@@ -179,6 +189,10 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
 	if (vold != vnew)
 		out_be32(&cpm2_intctl->ic_siexr, vnew);
 	return 0;
+
+err_sense:
+	pr_err("CPM2 PIC: sense type 0x%x not supported\n", flow_type);
+	return -EINVAL;
 }
 
 static struct irq_chip cpm2_pic = {
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts
  2009-12-10 11:14 [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts Mark Ware
@ 2009-12-10 14:52 ` Kumar Gala
  2009-12-10 14:58   ` Anton Vorontsov
  2009-12-10 19:48 ` Kumar Gala
  1 sibling, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2009-12-10 14:52 UTC (permalink / raw)
  To: Scott Wood, Mark Ware; +Cc: Linuxppc-dev Development, Anton Vorontsov


On Dec 10, 2009, at 5:14 AM, Mark Ware wrote:

> Port C interrupts can be either falling edge, or either edge.
> Other external interrupts are either falling edge or active low.
> Tested on a custom 8280 based board.
> 
> Signed-off-by: Mark Ware <mware@elphinstone.net>
> ---
> Changed in v3:
> - Cosmetic improvements as suggested by Anton and Scott
> - Added tested note to changelog
> 
> arch/powerpc/sysdev/cpm2_pic.c |   28 +++++++++++++++++++++-------
> 1 files changed, 21 insertions(+), 7 deletions(-)

Scott, Anton do you want to add an Ack to this version?

- k

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts
  2009-12-10 14:52 ` Kumar Gala
@ 2009-12-10 14:58   ` Anton Vorontsov
  2009-12-10 17:41     ` Scott Wood
  0 siblings, 1 reply; 5+ messages in thread
From: Anton Vorontsov @ 2009-12-10 14:58 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Scott Wood, Linuxppc-dev Development, Mark Ware

On Thu, Dec 10, 2009 at 08:52:01AM -0600, Kumar Gala wrote:
> 
> On Dec 10, 2009, at 5:14 AM, Mark Ware wrote:
> 
> > Port C interrupts can be either falling edge, or either edge.
> > Other external interrupts are either falling edge or active low.
> > Tested on a custom 8280 based board.
> > 
> > Signed-off-by: Mark Ware <mware@elphinstone.net>
> > ---
> > Changed in v3:
> > - Cosmetic improvements as suggested by Anton and Scott
> > - Added tested note to changelog
> > 
> > arch/powerpc/sysdev/cpm2_pic.c |   28 +++++++++++++++++++++-------
> > 1 files changed, 21 insertions(+), 7 deletions(-)
> 
> Scott, Anton do you want to add an Ack to this version?

Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>

Thanks!

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts
  2009-12-10 14:58   ` Anton Vorontsov
@ 2009-12-10 17:41     ` Scott Wood
  0 siblings, 0 replies; 5+ messages in thread
From: Scott Wood @ 2009-12-10 17:41 UTC (permalink / raw)
  To: avorontsov; +Cc: Linuxppc-dev Development, Mark Ware

Anton Vorontsov wrote:
> On Thu, Dec 10, 2009 at 08:52:01AM -0600, Kumar Gala wrote:
>> On Dec 10, 2009, at 5:14 AM, Mark Ware wrote:
>>
>>> Port C interrupts can be either falling edge, or either edge.
>>> Other external interrupts are either falling edge or active low.
>>> Tested on a custom 8280 based board.
>>>
>>> Signed-off-by: Mark Ware <mware@elphinstone.net>
>>> ---
>>> Changed in v3:
>>> - Cosmetic improvements as suggested by Anton and Scott
>>> - Added tested note to changelog
>>>
>>> arch/powerpc/sysdev/cpm2_pic.c |   28 +++++++++++++++++++++-------
>>> 1 files changed, 21 insertions(+), 7 deletions(-)
>> Scott, Anton do you want to add an Ack to this version?
> 
> Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>

Acked-by: Scott Wood <scottwood@freescale.com>

-Scott

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts
  2009-12-10 11:14 [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts Mark Ware
  2009-12-10 14:52 ` Kumar Gala
@ 2009-12-10 19:48 ` Kumar Gala
  1 sibling, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2009-12-10 19:48 UTC (permalink / raw)
  To: Mark Ware; +Cc: Scott Wood, Linuxppc-dev Development, avorontsov


On Dec 10, 2009, at 5:14 AM, Mark Ware wrote:

> Port C interrupts can be either falling edge, or either edge.
> Other external interrupts are either falling edge or active low.
> Tested on a custom 8280 based board.
> 
> Signed-off-by: Mark Ware <mware@elphinstone.net>
> ---
> Changed in v3:
> - Cosmetic improvements as suggested by Anton and Scott
> - Added tested note to changelog
> 
> arch/powerpc/sysdev/cpm2_pic.c |   28 +++++++++++++++++++++-------
> 1 files changed, 21 insertions(+), 7 deletions(-)

Applied to next

- k

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-10 19:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 11:14 [PATCH v3] cpm2_pic: Allow correct flow_types for port C interrupts Mark Ware
2009-12-10 14:52 ` Kumar Gala
2009-12-10 14:58   ` Anton Vorontsov
2009-12-10 17:41     ` Scott Wood
2009-12-10 19:48 ` Kumar Gala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).