diff options
author | David S. Miller <davem@davemloft.net> | 2008-10-11 15:39:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-11 15:39:35 -0400 |
commit | 56c5d900dbb8e042bfad035d18433476931d8f93 (patch) | |
tree | 00b793965beeef10db03e0ff021d2d965c410759 /drivers/serial | |
parent | 4dd95b63ae25c5cad6986829b5e8788e9faa0330 (diff) | |
parent | ead9d23d803ea3a73766c3cb27bf7563ac8d7266 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
sound/core/memalloc.c
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/atmel_serial.c | 32 | ||||
-rw-r--r-- | drivers/serial/pxa.c | 5 | ||||
-rw-r--r-- | drivers/serial/serial_ks8695.c | 61 |
3 files changed, 76 insertions, 22 deletions
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 3a6da80b081c..61fb8b6d19af 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -131,7 +131,8 @@ struct atmel_uart_char { | |||
131 | struct atmel_uart_port { | 131 | struct atmel_uart_port { |
132 | struct uart_port uart; /* uart */ | 132 | struct uart_port uart; /* uart */ |
133 | struct clk *clk; /* uart clock */ | 133 | struct clk *clk; /* uart clock */ |
134 | unsigned short suspended; /* is port suspended? */ | 134 | int may_wakeup; /* cached value of device_may_wakeup for times we need to disable it */ |
135 | u32 backup_imr; /* IMR saved during suspend */ | ||
135 | int break_active; /* break being received */ | 136 | int break_active; /* break being received */ |
136 | 137 | ||
137 | short use_dma_rx; /* enable PDC receiver */ | 138 | short use_dma_rx; /* enable PDC receiver */ |
@@ -984,8 +985,15 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state, | |||
984 | * This is called on uart_open() or a resume event. | 985 | * This is called on uart_open() or a resume event. |
985 | */ | 986 | */ |
986 | clk_enable(atmel_port->clk); | 987 | clk_enable(atmel_port->clk); |
988 | |||
989 | /* re-enable interrupts if we disabled some on suspend */ | ||
990 | UART_PUT_IER(port, atmel_port->backup_imr); | ||
987 | break; | 991 | break; |
988 | case 3: | 992 | case 3: |
993 | /* Back up the interrupt mask and disable all interrupts */ | ||
994 | atmel_port->backup_imr = UART_GET_IMR(port); | ||
995 | UART_PUT_IDR(port, -1); | ||
996 | |||
989 | /* | 997 | /* |
990 | * Disable the peripheral clock for this serial port. | 998 | * Disable the peripheral clock for this serial port. |
991 | * This is called on uart_close() or a suspend event. | 999 | * This is called on uart_close() or a suspend event. |
@@ -1475,13 +1483,12 @@ static int atmel_serial_suspend(struct platform_device *pdev, | |||
1475 | cpu_relax(); | 1483 | cpu_relax(); |
1476 | } | 1484 | } |
1477 | 1485 | ||
1478 | if (device_may_wakeup(&pdev->dev) | 1486 | /* we can not wake up if we're running on slow clock */ |
1479 | && !atmel_serial_clk_will_stop()) | 1487 | atmel_port->may_wakeup = device_may_wakeup(&pdev->dev); |
1480 | enable_irq_wake(port->irq); | 1488 | if (atmel_serial_clk_will_stop()) |
1481 | else { | 1489 | device_set_wakeup_enable(&pdev->dev, 0); |
1482 | uart_suspend_port(&atmel_uart, port); | 1490 | |
1483 | atmel_port->suspended = 1; | 1491 | uart_suspend_port(&atmel_uart, port); |
1484 | } | ||
1485 | 1492 | ||
1486 | return 0; | 1493 | return 0; |
1487 | } | 1494 | } |
@@ -1491,11 +1498,8 @@ static int atmel_serial_resume(struct platform_device *pdev) | |||
1491 | struct uart_port *port = platform_get_drvdata(pdev); | 1498 | struct uart_port *port = platform_get_drvdata(pdev); |
1492 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 1499 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
1493 | 1500 | ||
1494 | if (atmel_port->suspended) { | 1501 | uart_resume_port(&atmel_uart, port); |
1495 | uart_resume_port(&atmel_uart, port); | 1502 | device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup); |
1496 | atmel_port->suspended = 0; | ||
1497 | } else | ||
1498 | disable_irq_wake(port->irq); | ||
1499 | 1503 | ||
1500 | return 0; | 1504 | return 0; |
1501 | } | 1505 | } |
@@ -1513,6 +1517,8 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev) | |||
1513 | BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); | 1517 | BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); |
1514 | 1518 | ||
1515 | port = &atmel_ports[pdev->id]; | 1519 | port = &atmel_ports[pdev->id]; |
1520 | port->backup_imr = 0; | ||
1521 | |||
1516 | atmel_init_port(port, pdev); | 1522 | atmel_init_port(port, pdev); |
1517 | 1523 | ||
1518 | if (!atmel_use_dma_rx(&port->uart)) { | 1524 | if (!atmel_use_dma_rx(&port->uart)) { |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index f7a0d37c4221..abc00be55433 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -534,6 +534,11 @@ serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios, | |||
534 | 534 | ||
535 | serial_out(up, UART_IER, up->ier); | 535 | serial_out(up, UART_IER, up->ier); |
536 | 536 | ||
537 | if (termios->c_cflag & CRTSCTS) | ||
538 | up->mcr |= UART_MCR_AFE; | ||
539 | else | ||
540 | up->mcr &= ~UART_MCR_AFE; | ||
541 | |||
537 | serial_out(up, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */ | 542 | serial_out(up, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */ |
538 | serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */ | 543 | serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */ |
539 | serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */ | 544 | serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */ |
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c index b9cbfc87f616..998e89dc5aaf 100644 --- a/drivers/serial/serial_ks8695.c +++ b/drivers/serial/serial_ks8695.c | |||
@@ -63,8 +63,44 @@ | |||
63 | #define UART_DUMMY_LSR_RX 0x100 | 63 | #define UART_DUMMY_LSR_RX 0x100 |
64 | #define UART_PORT_SIZE (KS8695_USR - KS8695_URRB + 4) | 64 | #define UART_PORT_SIZE (KS8695_USR - KS8695_URRB + 4) |
65 | 65 | ||
66 | #define tx_enabled(port) ((port)->unused[0]) | 66 | static inline int tx_enabled(struct uart_port *port) |
67 | #define rx_enabled(port) ((port)->unused[1]) | 67 | { |
68 | return port->unused[0] & 1; | ||
69 | } | ||
70 | |||
71 | static inline int rx_enabled(struct uart_port *port) | ||
72 | { | ||
73 | return port->unused[0] & 2; | ||
74 | } | ||
75 | |||
76 | static inline int ms_enabled(struct uart_port *port) | ||
77 | { | ||
78 | return port->unused[0] & 4; | ||
79 | } | ||
80 | |||
81 | static inline void ms_enable(struct uart_port *port, int enabled) | ||
82 | { | ||
83 | if(enabled) | ||
84 | port->unused[0] |= 4; | ||
85 | else | ||
86 | port->unused[0] &= ~4; | ||
87 | } | ||
88 | |||
89 | static inline void rx_enable(struct uart_port *port, int enabled) | ||
90 | { | ||
91 | if(enabled) | ||
92 | port->unused[0] |= 2; | ||
93 | else | ||
94 | port->unused[0] &= ~2; | ||
95 | } | ||
96 | |||
97 | static inline void tx_enable(struct uart_port *port, int enabled) | ||
98 | { | ||
99 | if(enabled) | ||
100 | port->unused[0] |= 1; | ||
101 | else | ||
102 | port->unused[0] &= ~1; | ||
103 | } | ||
68 | 104 | ||
69 | 105 | ||
70 | #ifdef SUPPORT_SYSRQ | 106 | #ifdef SUPPORT_SYSRQ |
@@ -75,7 +111,7 @@ static void ks8695uart_stop_tx(struct uart_port *port) | |||
75 | { | 111 | { |
76 | if (tx_enabled(port)) { | 112 | if (tx_enabled(port)) { |
77 | disable_irq(KS8695_IRQ_UART_TX); | 113 | disable_irq(KS8695_IRQ_UART_TX); |
78 | tx_enabled(port) = 0; | 114 | tx_enable(port, 0); |
79 | } | 115 | } |
80 | } | 116 | } |
81 | 117 | ||
@@ -83,7 +119,7 @@ static void ks8695uart_start_tx(struct uart_port *port) | |||
83 | { | 119 | { |
84 | if (!tx_enabled(port)) { | 120 | if (!tx_enabled(port)) { |
85 | enable_irq(KS8695_IRQ_UART_TX); | 121 | enable_irq(KS8695_IRQ_UART_TX); |
86 | tx_enabled(port) = 1; | 122 | tx_enable(port, 1); |
87 | } | 123 | } |
88 | } | 124 | } |
89 | 125 | ||
@@ -91,18 +127,24 @@ static void ks8695uart_stop_rx(struct uart_port *port) | |||
91 | { | 127 | { |
92 | if (rx_enabled(port)) { | 128 | if (rx_enabled(port)) { |
93 | disable_irq(KS8695_IRQ_UART_RX); | 129 | disable_irq(KS8695_IRQ_UART_RX); |
94 | rx_enabled(port) = 0; | 130 | rx_enable(port, 0); |
95 | } | 131 | } |
96 | } | 132 | } |
97 | 133 | ||
98 | static void ks8695uart_enable_ms(struct uart_port *port) | 134 | static void ks8695uart_enable_ms(struct uart_port *port) |
99 | { | 135 | { |
100 | enable_irq(KS8695_IRQ_UART_MODEM_STATUS); | 136 | if (!ms_enabled(port)) { |
137 | enable_irq(KS8695_IRQ_UART_MODEM_STATUS); | ||
138 | ms_enable(port,1); | ||
139 | } | ||
101 | } | 140 | } |
102 | 141 | ||
103 | static void ks8695uart_disable_ms(struct uart_port *port) | 142 | static void ks8695uart_disable_ms(struct uart_port *port) |
104 | { | 143 | { |
105 | disable_irq(KS8695_IRQ_UART_MODEM_STATUS); | 144 | if (ms_enabled(port)) { |
145 | disable_irq(KS8695_IRQ_UART_MODEM_STATUS); | ||
146 | ms_enable(port,0); | ||
147 | } | ||
106 | } | 148 | } |
107 | 149 | ||
108 | static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) | 150 | static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) |
@@ -285,8 +327,9 @@ static int ks8695uart_startup(struct uart_port *port) | |||
285 | int retval; | 327 | int retval; |
286 | 328 | ||
287 | set_irq_flags(KS8695_IRQ_UART_TX, IRQF_VALID | IRQF_NOAUTOEN); | 329 | set_irq_flags(KS8695_IRQ_UART_TX, IRQF_VALID | IRQF_NOAUTOEN); |
288 | tx_enabled(port) = 0; | 330 | tx_enable(port, 0); |
289 | rx_enabled(port) = 1; | 331 | rx_enable(port, 1); |
332 | ms_enable(port, 1); | ||
290 | 333 | ||
291 | /* | 334 | /* |
292 | * Allocate the IRQ | 335 | * Allocate the IRQ |