diff options
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/imx.c | 27 | ||||
-rw-r--r-- | drivers/serial/pxa.c | 5 | ||||
-rw-r--r-- | drivers/serial/serial_ks8695.c | 61 |
3 files changed, 79 insertions, 14 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 6a29f9330a73..3f90f1bbbbcd 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -127,8 +127,13 @@ | |||
127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ | 127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ |
128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ | 128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ |
129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ | 129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ |
130 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz */ | 130 | #ifdef CONFIG_ARCH_IMX |
131 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz */ | 131 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */ |
132 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */ | ||
133 | #endif | ||
134 | #if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3 | ||
135 | #define UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */ | ||
136 | #endif | ||
132 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ | 137 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ |
133 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ | 138 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ |
134 | #define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ | 139 | #define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ |
@@ -445,7 +450,7 @@ static irqreturn_t imx_int(int irq, void *dev_id) | |||
445 | readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN) | 450 | readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN) |
446 | imx_txint(irq, dev_id); | 451 | imx_txint(irq, dev_id); |
447 | 452 | ||
448 | if (sts & USR1_RTSS) | 453 | if (sts & USR1_RTSD) |
449 | imx_rtsint(irq, dev_id); | 454 | imx_rtsint(irq, dev_id); |
450 | 455 | ||
451 | return IRQ_HANDLED; | 456 | return IRQ_HANDLED; |
@@ -598,6 +603,12 @@ static int imx_startup(struct uart_port *port) | |||
598 | temp |= (UCR2_RXEN | UCR2_TXEN); | 603 | temp |= (UCR2_RXEN | UCR2_TXEN); |
599 | writel(temp, sport->port.membase + UCR2); | 604 | writel(temp, sport->port.membase + UCR2); |
600 | 605 | ||
606 | #if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3 | ||
607 | temp = readl(sport->port.membase + UCR3); | ||
608 | temp |= UCR3_RXDMUXSEL; | ||
609 | writel(temp, sport->port.membase + UCR3); | ||
610 | #endif | ||
611 | |||
601 | /* | 612 | /* |
602 | * Enable modem status interrupts | 613 | * Enable modem status interrupts |
603 | */ | 614 | */ |
@@ -1133,13 +1144,19 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
1133 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) | 1144 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) |
1134 | sport->have_rtscts = 1; | 1145 | sport->have_rtscts = 1; |
1135 | 1146 | ||
1136 | if (pdata->init) | 1147 | if (pdata->init) { |
1137 | pdata->init(pdev); | 1148 | ret = pdata->init(pdev); |
1149 | if (ret) | ||
1150 | goto clkput; | ||
1151 | } | ||
1138 | 1152 | ||
1139 | uart_add_one_port(&imx_reg, &sport->port); | 1153 | uart_add_one_port(&imx_reg, &sport->port); |
1140 | platform_set_drvdata(pdev, &sport->port); | 1154 | platform_set_drvdata(pdev, &sport->port); |
1141 | 1155 | ||
1142 | return 0; | 1156 | return 0; |
1157 | clkput: | ||
1158 | clk_put(sport->clk); | ||
1159 | clk_disable(sport->clk); | ||
1143 | unmap: | 1160 | unmap: |
1144 | iounmap(sport->port.membase); | 1161 | iounmap(sport->port.membase); |
1145 | free: | 1162 | free: |
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 |