Skip to content

Commit 1c2f049

Browse files
Vikram PanditaLive-CD User
authored andcommitted
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 <[email protected]> Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1e066d8 commit 1c2f049

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

drivers/serial/8250.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
16771677
INIT_LIST_HEAD(&up->list);
16781678
i->head = &up->list;
16791679
spin_unlock_irq(&i->lock);
1680-
1680+
irq_flags |= up->port.irqflags;
16811681
ret = request_irq(up->port.irq, serial8250_interrupt,
16821682
irq_flags, "serial", i);
16831683
if (ret < 0)
@@ -2026,7 +2026,7 @@ static int serial8250_startup(struct uart_port *port)
20262026
* allow register changes to become visible.
20272027
*/
20282028
spin_lock_irqsave(&up->port.lock, flags);
2029-
if (up->port.flags & UPF_SHARE_IRQ)
2029+
if (up->port.irqflags & IRQF_SHARED)
20302030
disable_irq_nosync(up->port.irq);
20312031

20322032
wait_for_xmitr(up, UART_LSR_THRE);
@@ -2039,7 +2039,7 @@ static int serial8250_startup(struct uart_port *port)
20392039
iir = serial_in(up, UART_IIR);
20402040
serial_out(up, UART_IER, 0);
20412041

2042-
if (up->port.flags & UPF_SHARE_IRQ)
2042+
if (up->port.irqflags & IRQF_SHARED)
20432043
enable_irq(up->port.irq);
20442044
spin_unlock_irqrestore(&up->port.lock, flags);
20452045

@@ -2671,6 +2671,7 @@ static void __init serial8250_isa_init_ports(void)
26712671
i++, up++) {
26722672
up->port.iobase = old_serial_port[i].port;
26732673
up->port.irq = irq_canonicalize(old_serial_port[i].irq);
2674+
up->port.irqflags = old_serial_port[i].irqflags;
26742675
up->port.uartclk = old_serial_port[i].baud_base * 16;
26752676
up->port.flags = old_serial_port[i].flags;
26762677
up->port.hub6 = old_serial_port[i].hub6;
@@ -2679,7 +2680,7 @@ static void __init serial8250_isa_init_ports(void)
26792680
up->port.regshift = old_serial_port[i].iomem_reg_shift;
26802681
set_io_from_upio(&up->port);
26812682
if (share_irqs)
2682-
up->port.flags |= UPF_SHARE_IRQ;
2683+
up->port.irqflags |= IRQF_SHARED;
26832684
}
26842685
}
26852686

@@ -2869,6 +2870,7 @@ int __init early_serial_setup(struct uart_port *port)
28692870
p->iobase = port->iobase;
28702871
p->membase = port->membase;
28712872
p->irq = port->irq;
2873+
p->irqflags = port->irqflags;
28722874
p->uartclk = port->uartclk;
28732875
p->fifosize = port->fifosize;
28742876
p->regshift = port->regshift;
@@ -2942,6 +2944,7 @@ static int __devinit serial8250_probe(struct platform_device *dev)
29422944
port.iobase = p->iobase;
29432945
port.membase = p->membase;
29442946
port.irq = p->irq;
2947+
port.irqflags = p->irqflags;
29452948
port.uartclk = p->uartclk;
29462949
port.regshift = p->regshift;
29472950
port.iotype = p->iotype;
@@ -2954,7 +2957,7 @@ static int __devinit serial8250_probe(struct platform_device *dev)
29542957
port.serial_out = p->serial_out;
29552958
port.dev = &dev->dev;
29562959
if (share_irqs)
2957-
port.flags |= UPF_SHARE_IRQ;
2960+
port.irqflags |= IRQF_SHARED;
29582961
ret = serial8250_register_port(&port);
29592962
if (ret < 0) {
29602963
dev_err(&dev->dev, "unable to register port at index %d "
@@ -3096,6 +3099,7 @@ int serial8250_register_port(struct uart_port *port)
30963099
uart->port.iobase = port->iobase;
30973100
uart->port.membase = port->membase;
30983101
uart->port.irq = port->irq;
3102+
uart->port.irqflags = port->irqflags;
30993103
uart->port.uartclk = port->uartclk;
31003104
uart->port.fifosize = port->fifosize;
31013105
uart->port.regshift = port->regshift;

drivers/serial/8250.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct old_serial_port {
2525
unsigned char io_type;
2626
unsigned char *iomem_base;
2727
unsigned short iomem_reg_shift;
28+
unsigned long irqflags;
2829
};
2930

3031
/*

include/linux/serial_8250.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct plat_serial8250_port {
2222
void __iomem *membase; /* ioremap cookie or NULL */
2323
resource_size_t mapbase; /* resource base */
2424
unsigned int irq; /* interrupt number */
25+
unsigned long irqflags; /* request_irq flags */
2526
unsigned int uartclk; /* UART clock rate */
2627
void *private_data;
2728
unsigned char regshift; /* register shift */

include/linux/serial_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ struct uart_port {
265265
unsigned int (*serial_in)(struct uart_port *, int);
266266
void (*serial_out)(struct uart_port *, int, int);
267267
unsigned int irq; /* irq number */
268+
unsigned long irqflags; /* irq flags */
268269
unsigned int uartclk; /* base uart clock */
269270
unsigned int fifosize; /* tx fifo size */
270271
unsigned char x_char; /* xon/xoff char */

0 commit comments

Comments
 (0)