aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikram Pandita <vikram.pandita@ti.com>2009-09-19 16:13:19 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:19 -0400
commit1c2f04937b3e397a5695953c6b82aa4c77d21eb8 (patch)
tree8ccc7300fcc3fb4f3824575a7e7c47a4f3f366ba
parent1e066d803ab7e34e9efb3b0766d618c0cd2598e4 (diff)
serial: 8250: add IRQ trigger support
There is currently no provision for passing IRQ trigger flags for serial IRQs with triggering requirements (such as GPIO IRQs) This patch adds irqflags to plat_serial8250_port that can be passed from board file to reqest_irq() of 8250 driver Changes are backward compatible with boards passing UPF_SHARE_IRQ flag Tested on Zoom2 board that has IRQF_TRIGGER_RISING requirement for 8250 irq [Moved new flag to end to fix bugs in the original with the old_serial array -- Alan] Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/serial/8250.c14
-rw-r--r--drivers/serial/8250.h1
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h1
4 files changed, 12 insertions, 5 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index fb867a9f55e9..83168a6c3c05 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1677,7 +1677,7 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
1677 INIT_LIST_HEAD(&up->list); 1677 INIT_LIST_HEAD(&up->list);
1678 i->head = &up->list; 1678 i->head = &up->list;
1679 spin_unlock_irq(&i->lock); 1679 spin_unlock_irq(&i->lock);
1680 1680 irq_flags |= up->port.irqflags;
1681 ret = request_irq(up->port.irq, serial8250_interrupt, 1681 ret = request_irq(up->port.irq, serial8250_interrupt,
1682 irq_flags, "serial", i); 1682 irq_flags, "serial", i);
1683 if (ret < 0) 1683 if (ret < 0)
@@ -2026,7 +2026,7 @@ static int serial8250_startup(struct uart_port *port)
2026 * allow register changes to become visible. 2026 * allow register changes to become visible.
2027 */ 2027 */
2028 spin_lock_irqsave(&up->port.lock, flags); 2028 spin_lock_irqsave(&up->port.lock, flags);
2029 if (up->port.flags & UPF_SHARE_IRQ) 2029 if (up->port.irqflags & IRQF_SHARED)
2030 disable_irq_nosync(up->port.irq); 2030 disable_irq_nosync(up->port.irq);
2031 2031
2032 wait_for_xmitr(up, UART_LSR_THRE); 2032 wait_for_xmitr(up, UART_LSR_THRE);
@@ -2039,7 +2039,7 @@ static int serial8250_startup(struct uart_port *port)
2039 iir = serial_in(up, UART_IIR); 2039 iir = serial_in(up, UART_IIR);
2040 serial_out(up, UART_IER, 0); 2040 serial_out(up, UART_IER, 0);
2041 2041
2042 if (up->port.flags & UPF_SHARE_IRQ) 2042 if (up->port.irqflags & IRQF_SHARED)
2043 enable_irq(up->port.irq); 2043 enable_irq(up->port.irq);
2044 spin_unlock_irqrestore(&up->port.lock, flags); 2044 spin_unlock_irqrestore(&up->port.lock, flags);
2045 2045
@@ -2671,6 +2671,7 @@ static void __init serial8250_isa_init_ports(void)
2671 i++, up++) { 2671 i++, up++) {
2672 up->port.iobase = old_serial_port[i].port; 2672 up->port.iobase = old_serial_port[i].port;
2673 up->port.irq = irq_canonicalize(old_serial_port[i].irq); 2673 up->port.irq = irq_canonicalize(old_serial_port[i].irq);
2674 up->port.irqflags = old_serial_port[i].irqflags;
2674 up->port.uartclk = old_serial_port[i].baud_base * 16; 2675 up->port.uartclk = old_serial_port[i].baud_base * 16;
2675 up->port.flags = old_serial_port[i].flags; 2676 up->port.flags = old_serial_port[i].flags;
2676 up->port.hub6 = old_serial_port[i].hub6; 2677 up->port.hub6 = old_serial_port[i].hub6;
@@ -2679,7 +2680,7 @@ static void __init serial8250_isa_init_ports(void)
2679 up->port.regshift = old_serial_port[i].iomem_reg_shift; 2680 up->port.regshift = old_serial_port[i].iomem_reg_shift;
2680 set_io_from_upio(&up->port); 2681 set_io_from_upio(&up->port);
2681 if (share_irqs) 2682 if (share_irqs)
2682 up->port.flags |= UPF_SHARE_IRQ; 2683 up->port.irqflags |= IRQF_SHARED;
2683 } 2684 }
2684} 2685}
2685 2686
@@ -2869,6 +2870,7 @@ int __init early_serial_setup(struct uart_port *port)
2869 p->iobase = port->iobase; 2870 p->iobase = port->iobase;
2870 p->membase = port->membase; 2871 p->membase = port->membase;
2871 p->irq = port->irq; 2872 p->irq = port->irq;
2873 p->irqflags = port->irqflags;
2872 p->uartclk = port->uartclk; 2874 p->uartclk = port->uartclk;
2873 p->fifosize = port->fifosize; 2875 p->fifosize = port->fifosize;
2874 p->regshift = port->regshift; 2876 p->regshift = port->regshift;
@@ -2942,6 +2944,7 @@ static int __devinit serial8250_probe(struct platform_device *dev)
2942 port.iobase = p->iobase; 2944 port.iobase = p->iobase;
2943 port.membase = p->membase; 2945 port.membase = p->membase;
2944 port.irq = p->irq; 2946 port.irq = p->irq;
2947 port.irqflags = p->irqflags;
2945 port.uartclk = p->uartclk; 2948 port.uartclk = p->uartclk;
2946 port.regshift = p->regshift; 2949 port.regshift = p->regshift;
2947 port.iotype = p->iotype; 2950 port.iotype = p->iotype;
@@ -2954,7 +2957,7 @@ static int __devinit serial8250_probe(struct platform_device *dev)
2954 port.serial_out = p->serial_out; 2957 port.serial_out = p->serial_out;
2955 port.dev = &dev->dev; 2958 port.dev = &dev->dev;
2956 if (share_irqs) 2959 if (share_irqs)
2957 port.flags |= UPF_SHARE_IRQ; 2960 port.irqflags |= IRQF_SHARED;
2958 ret = serial8250_register_port(&port); 2961 ret = serial8250_register_port(&port);
2959 if (ret < 0) { 2962 if (ret < 0) {
2960 dev_err(&dev->dev, "unable to register port at index %d " 2963 dev_err(&dev->dev, "unable to register port at index %d "
@@ -3096,6 +3099,7 @@ int serial8250_register_port(struct uart_port *port)
3096 uart->port.iobase = port->iobase; 3099 uart->port.iobase = port->iobase;
3097 uart->port.membase = port->membase; 3100 uart->port.membase = port->membase;
3098 uart->port.irq = port->irq; 3101 uart->port.irq = port->irq;
3102 uart->port.irqflags = port->irqflags;
3099 uart->port.uartclk = port->uartclk; 3103 uart->port.uartclk = port->uartclk;
3100 uart->port.fifosize = port->fifosize; 3104 uart->port.fifosize = port->fifosize;
3101 uart->port.regshift = port->regshift; 3105 uart->port.regshift = port->regshift;
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h
index 520260326f3d..6e19ea3e48d5 100644
--- a/drivers/serial/8250.h
+++ b/drivers/serial/8250.h
@@ -25,6 +25,7 @@ struct old_serial_port {
25 unsigned char io_type; 25 unsigned char io_type;
26 unsigned char *iomem_base; 26 unsigned char *iomem_base;
27 unsigned short iomem_reg_shift; 27 unsigned short iomem_reg_shift;
28 unsigned long irqflags;
28}; 29};
29 30
30/* 31/*
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index d4d2a78ad43e..fb46aba11fb5 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -22,6 +22,7 @@ struct plat_serial8250_port {
22 void __iomem *membase; /* ioremap cookie or NULL */ 22 void __iomem *membase; /* ioremap cookie or NULL */
23 resource_size_t mapbase; /* resource base */ 23 resource_size_t mapbase; /* resource base */
24 unsigned int irq; /* interrupt number */ 24 unsigned int irq; /* interrupt number */
25 unsigned long irqflags; /* request_irq flags */
25 unsigned int uartclk; /* UART clock rate */ 26 unsigned int uartclk; /* UART clock rate */
26 void *private_data; 27 void *private_data;
27 unsigned char regshift; /* register shift */ 28 unsigned char regshift; /* register shift */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 23d2fb051f97..3cd255f0b211 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -265,6 +265,7 @@ struct uart_port {
265 unsigned int (*serial_in)(struct uart_port *, int); 265 unsigned int (*serial_in)(struct uart_port *, int);
266 void (*serial_out)(struct uart_port *, int, int); 266 void (*serial_out)(struct uart_port *, int, int);
267 unsigned int irq; /* irq number */ 267 unsigned int irq; /* irq number */
268 unsigned long irqflags; /* irq flags */
268 unsigned int uartclk; /* base uart clock */ 269 unsigned int uartclk; /* base uart clock */
269 unsigned int fifosize; /* tx fifo size */ 270 unsigned int fifosize; /* tx fifo size */
270 unsigned char x_char; /* xon/xoff char */ 271 unsigned char x_char; /* xon/xoff char */