diff options
Diffstat (limited to 'drivers/serial/imx.c')
-rw-r--r-- | drivers/serial/imx.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 18130f11238e..eacb588a9345 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/clk.h> | 46 | #include <linux/clk.h> |
47 | #include <linux/delay.h> | 47 | #include <linux/delay.h> |
48 | #include <linux/rational.h> | 48 | #include <linux/rational.h> |
49 | #include <linux/slab.h> | ||
49 | 50 | ||
50 | #include <asm/io.h> | 51 | #include <asm/io.h> |
51 | #include <asm/irq.h> | 52 | #include <asm/irq.h> |
@@ -119,7 +120,8 @@ | |||
119 | #define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */ | 120 | #define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */ |
120 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ | 121 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ |
121 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ | 122 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ |
122 | #define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ | 123 | #define UCR4_CTSTL_SHF 10 /* CTS trigger level shift */ |
124 | #define UCR4_CTSTL_MASK 0x3F /* CTS trigger is 6 bits wide */ | ||
123 | #define UCR4_INVR (1<<9) /* Inverted infrared reception */ | 125 | #define UCR4_INVR (1<<9) /* Inverted infrared reception */ |
124 | #define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */ | 126 | #define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */ |
125 | #define UCR4_WKEN (1<<7) /* Wake interrupt enable */ | 127 | #define UCR4_WKEN (1<<7) /* Wake interrupt enable */ |
@@ -440,7 +442,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) | |||
440 | 442 | ||
441 | temp = readl(sport->port.membase + USR2); | 443 | temp = readl(sport->port.membase + USR2); |
442 | if (temp & USR2_BRCD) { | 444 | if (temp & USR2_BRCD) { |
443 | writel(temp | USR2_BRCD, sport->port.membase + USR2); | 445 | writel(USR2_BRCD, sport->port.membase + USR2); |
444 | if (uart_handle_break(&sport->port)) | 446 | if (uart_handle_break(&sport->port)) |
445 | continue; | 447 | continue; |
446 | } | 448 | } |
@@ -590,6 +592,9 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode) | |||
590 | return 0; | 592 | return 0; |
591 | } | 593 | } |
592 | 594 | ||
595 | /* half the RX buffer size */ | ||
596 | #define CTSTL 16 | ||
597 | |||
593 | static int imx_startup(struct uart_port *port) | 598 | static int imx_startup(struct uart_port *port) |
594 | { | 599 | { |
595 | struct imx_port *sport = (struct imx_port *)port; | 600 | struct imx_port *sport = (struct imx_port *)port; |
@@ -606,6 +611,10 @@ static int imx_startup(struct uart_port *port) | |||
606 | if (USE_IRDA(sport)) | 611 | if (USE_IRDA(sport)) |
607 | temp |= UCR4_IRSC; | 612 | temp |= UCR4_IRSC; |
608 | 613 | ||
614 | /* set the trigger level for CTS */ | ||
615 | temp &= ~(UCR4_CTSTL_MASK<< UCR4_CTSTL_SHF); | ||
616 | temp |= CTSTL<< UCR4_CTSTL_SHF; | ||
617 | |||
609 | writel(temp & ~UCR4_DREN, sport->port.membase + UCR4); | 618 | writel(temp & ~UCR4_DREN, sport->port.membase + UCR4); |
610 | 619 | ||
611 | if (USE_IRDA(sport)) { | 620 | if (USE_IRDA(sport)) { |
@@ -1088,7 +1097,7 @@ imx_console_get_options(struct imx_port *sport, int *baud, | |||
1088 | int *parity, int *bits) | 1097 | int *parity, int *bits) |
1089 | { | 1098 | { |
1090 | 1099 | ||
1091 | if ( readl(sport->port.membase + UCR1) | UCR1_UARTEN ) { | 1100 | if (readl(sport->port.membase + UCR1) & UCR1_UARTEN) { |
1092 | /* ok, the port was enabled */ | 1101 | /* ok, the port was enabled */ |
1093 | unsigned int ucr2, ubir,ubmr, uartclk; | 1102 | unsigned int ucr2, ubir,ubmr, uartclk; |
1094 | unsigned int baud_raw; | 1103 | unsigned int baud_raw; |
@@ -1279,7 +1288,7 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
1279 | sport->use_irda = 1; | 1288 | sport->use_irda = 1; |
1280 | #endif | 1289 | #endif |
1281 | 1290 | ||
1282 | if (pdata->init) { | 1291 | if (pdata && pdata->init) { |
1283 | ret = pdata->init(pdev); | 1292 | ret = pdata->init(pdev); |
1284 | if (ret) | 1293 | if (ret) |
1285 | goto clkput; | 1294 | goto clkput; |
@@ -1292,7 +1301,7 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
1292 | 1301 | ||
1293 | return 0; | 1302 | return 0; |
1294 | deinit: | 1303 | deinit: |
1295 | if (pdata->exit) | 1304 | if (pdata && pdata->exit) |
1296 | pdata->exit(pdev); | 1305 | pdata->exit(pdev); |
1297 | clkput: | 1306 | clkput: |
1298 | clk_put(sport->clk); | 1307 | clk_put(sport->clk); |
@@ -1321,7 +1330,7 @@ static int serial_imx_remove(struct platform_device *pdev) | |||
1321 | 1330 | ||
1322 | clk_disable(sport->clk); | 1331 | clk_disable(sport->clk); |
1323 | 1332 | ||
1324 | if (pdata->exit) | 1333 | if (pdata && pdata->exit) |
1325 | pdata->exit(pdev); | 1334 | pdata->exit(pdev); |
1326 | 1335 | ||
1327 | iounmap(sport->port.membase); | 1336 | iounmap(sport->port.membase); |