Skip to contentSkip to conversation

au1x00 serial real interrupt

PATCH In review Rodolfo Giometti 4 participants 7 messages May 22, 2006 – Sep 18, 2006 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 au1x00 serial real interrupt

Hello.

Here my patch to enable real interrupts management for the au1x00 CPUs.

Ciao,

Rodolfo

Signature · 4 lines
GNU/Linux Solutions                  e-mail:    [email protected]
Linux Device Driver                             [email protected]
Embedded Systems                     		[email protected]
UNIX programming                     phone:     +39 349 2432127
include/asm-mips/serial.h +8 -0
index 7b23664..0197062 100644
@@ -11,6 +11,14 @@
 
 #include <linux/config.h>
 
+#ifdef CONFIG_SOC_AU1X00
+/*
+ * We have to redefine "is_real_interrupt()" for Au1x00 CPUs...
+ */
+#undef is_real_interrupt
+#define is_real_interrupt(irq)	((irq) != ~0)
+#endif
+
 /*
  * This assumes you have a 1.8432 MHz clock for your UART.
  *
#1 lore raw

Hello.

Quoted 14 lines · Rodolfo Giometti

Here my patch to enable real interrupts management for the au1x00 CPUs.

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

include/asm-mips/serial.h +1 -0
index 7b23664..0197062 100644
@@ -11,6 +11,14 @@
 
 #include <linux/config.h>
 
+#ifdef CONFIG_SOC_AU1X00

include/asm-mips/serial.h line 24

Quoted 10 lines
include/asm-mips/serial.h +7 -0
+/*
+ * We have to redefine "is_real_interrupt()" for Au1x00 CPUs...
+ */
+#undef is_real_interrupt
+#define is_real_interrupt(irq)	((irq) != ~0)
+#endif
+
 /*
  * This assumes you have a 1.8432 MHz clock for your UART.
  *

Ralf, how about this patch? Can it be applied, at least 3 months after
posting? Alchemy UART0 uses IRQ0 and 0 is treated as "no IRQ" by drivers/serial/8250.c which says the macro should be redefined in <asm/serial.h> if needed.

WBR, Sergei

#2 lore raw

Hello.

Quoted 10 lines · Sergei Shtylyov
Quoted 10 lines

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

include/asm-mips/serial.h +0 -0
index 7b23664..0197062 100644
@@ -11,6 +11,14 @@
 
 #include <linux/config.h>
 
Quoted 14 lines

include/asm-mips/serial.h line 24

Quoted 11 lines
include/asm-mips/serial.h +8 -0
+#ifdef CONFIG_SOC_AU1X00
+/*
+ * We have to redefine "is_real_interrupt()" for Au1x00 CPUs...
+ */
+#undef is_real_interrupt
+#define is_real_interrupt(irq)    ((irq) != ~0)
+#endif
+
 /*
  * This assumes you have a 1.8432 MHz clock for your UART.
  *

Ralf, how about this patch? Can it be applied, at least 3 months
after posting? Alchemy UART0 uses IRQ0 and 0 is treated as "no IRQ" by drivers/serial/8250.c which says the macro should be redefined in <asm/serial.h> if needed.

If the values other than 0 need to be filtered out, to be precise...

Well, after looking at drivers/serial/8250.c a bit more, I think this may
be even more simlified since that driver seems to treat the negative values as completely invalid anyway. IOW, we can just:

#define is_real_interrupt(irq) 1

Russel, what do you think?

WBR, Sergei

#3 lore raw
Quoted 7 lines · Sergei Shtylyov

Well, after looking at drivers/serial/8250.c a bit more, I think this may be even more simlified since that driver seems to treat the negative
values as completely invalid anyway. IOW, we can just:

#define is_real_interrupt(irq) 1

Russel, what do you think?

That's Russell 8)

Well, if you need IRQ0 to be real then redefining is_real_interrupt() is the correct way forward.

However, Linus' policy is that IRQ0 shall be invalid at least on PCI systems, and architectures _should_ remap their real IRQ0 to some other number. Personally I don't like this. Hence why I prefer to give people the option.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#4 lore raw

Hello.

Quoted 9 lines · Russell King
Quoted 7 lines

Well, after looking at drivers/serial/8250.c a bit more, I think this may be even more simlified since that driver seems to treat the negative
values as completely invalid anyway. IOW, we can just:

#define is_real_interrupt(irq) 1

Russel, what do you think?

That's Russell 8)

I'm sorry. :-)

Quoted 6 lines

Well, if you need IRQ0 to be real then redefining is_real_interrupt() is the correct way forward.

However, Linus' policy is that IRQ0 shall be invalid at least on PCI systems, and architectures _should_ remap their real IRQ0 to some other number.

Hm, given that NO_IRQ is #defined as -1 (when it's defined at all)...

Quoted 1 line

Personally I don't like this.

Hm, me neither but I can undestand the reasoning. 0 is the usual default
value of the PCI interrupt line register, meaning interrupt is unassigned.

Quoted 1 line

Hence why I prefer to give people the option.

Thanks for the explanation.
Would be better probably to have that #define in 8250.c going after
#include <asm/serial.h> but as this seems the first and only case of the override needed, it's good enough this way. :-)
As for the PCI UARTs possibly plugged into Alchemy board, I really don't
know... This macro has no provision to check for the UART type. So, skipping its invocation in 8250.c for UPIO_AU case might be a better (though not cleaner) solution...

WBR, Sergei

#5 lore raw
In reply to Russell King
Quoted 7 lines · Russell King

Well, if you need IRQ0 to be real then redefining is_real_interrupt() is the correct way forward.

However, Linus' policy is that IRQ0 shall be invalid at least on PCI systems, and architectures _should_ remap their real IRQ0 to some other number. Personally I don't like this. Hence why I prefer to give people the option.

I have no strong opinion either. In some cases not having interrupt 0 available sucks because Linux will have to use a different interrupt numbering than system documentation ...

Ralf

#6 lore raw
In reply to Sergei Shtylyov

Hello.

Quoted 23 lines · Sergei Shtylyov
Quoted 8 lines
Quoted 8 lines
include/asm-mips/serial.h +0 -0
index 7b23664..0197062 100644
@@ -11,6 +11,14 @@
 
 #include <linux/config.h>
 
Quoted 11 lines

include/asm-mips/serial.h line 24

Quoted 11 lines
include/asm-mips/serial.h +8 -0
+#ifdef CONFIG_SOC_AU1X00
+/*
+ * We have to redefine "is_real_interrupt()" for Au1x00 CPUs...
+ */
+#undef is_real_interrupt
+#define is_real_interrupt(irq)    ((irq) != ~0)
+#endif
+
 /*
  * This assumes you have a 1.8432 MHz clock for your UART.
  *

Well, after looking at drivers/serial/8250.c a bit more, I think this
may be even more simlified since that driver seems to treat the negative values as completely invalid anyway. IOW, we can just:

Quoted 1 line

#define is_real_interrupt(irq) 1

Rodolfo, can you do this (possibly adding more elaborate comment about
UART0 using IRQ0)?

WBR, Sergei