diff options
| author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-02-24 05:17:10 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-06 21:26:32 -0500 |
| commit | afe9cbb1a6adf6da5fa6d4747d102b95b4bb52c1 (patch) | |
| tree | 177763c8bda5727569545cab7d6ad143dd0d9066 | |
| parent | f95661b2f2ae75c9b07b9b4e0a9a55c40e085e6f (diff) | |
serial: imx: drop support for IRDA
Support for IRDA was added in 2009 in commit v2.6.31-rc1~399^2~2. There
are no in-tree users.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/tty/serial/imx.c | 157 | ||||
| -rw-r--r-- | include/linux/platform_data/serial-imx.h | 5 |
2 files changed, 9 insertions, 153 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index cbbb47385877..6dc1d2781b86 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
| @@ -6,9 +6,6 @@ | |||
| 6 | * Author: Sascha Hauer <sascha@saschahauer.de> | 6 | * Author: Sascha Hauer <sascha@saschahauer.de> |
| 7 | * Copyright (C) 2004 Pengutronix | 7 | * Copyright (C) 2004 Pengutronix |
| 8 | * | 8 | * |
| 9 | * Author: Fabian Godehardt (added IrDA support for iMX) | ||
| 10 | * Copyright (C) 2009 emlix GmbH | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
| @@ -201,7 +198,6 @@ struct imx_port { | |||
| 201 | unsigned int old_status; | 198 | unsigned int old_status; |
| 202 | unsigned int have_rtscts:1; | 199 | unsigned int have_rtscts:1; |
| 203 | unsigned int dte_mode:1; | 200 | unsigned int dte_mode:1; |
| 204 | unsigned int use_irda:1; | ||
| 205 | unsigned int irda_inv_rx:1; | 201 | unsigned int irda_inv_rx:1; |
| 206 | unsigned int irda_inv_tx:1; | 202 | unsigned int irda_inv_tx:1; |
| 207 | unsigned short trcv_delay; /* transceiver delay */ | 203 | unsigned short trcv_delay; /* transceiver delay */ |
| @@ -228,12 +224,6 @@ struct imx_port_ucrs { | |||
| 228 | unsigned int ucr3; | 224 | unsigned int ucr3; |
| 229 | }; | 225 | }; |
| 230 | 226 | ||
| 231 | #ifdef CONFIG_IRDA | ||
| 232 | #define USE_IRDA(sport) ((sport)->use_irda) | ||
| 233 | #else | ||
| 234 | #define USE_IRDA(sport) (0) | ||
| 235 | #endif | ||
| 236 | |||
| 237 | static struct imx_uart_data imx_uart_devdata[] = { | 227 | static struct imx_uart_data imx_uart_devdata[] = { |
| 238 | [IMX1_UART] = { | 228 | [IMX1_UART] = { |
| 239 | .uts_reg = IMX1_UTS, | 229 | .uts_reg = IMX1_UTS, |
| @@ -368,48 +358,6 @@ static void imx_stop_tx(struct uart_port *port) | |||
| 368 | struct imx_port *sport = (struct imx_port *)port; | 358 | struct imx_port *sport = (struct imx_port *)port; |
| 369 | unsigned long temp; | 359 | unsigned long temp; |
| 370 | 360 | ||
| 371 | if (USE_IRDA(sport)) { | ||
| 372 | /* half duplex - wait for end of transmission */ | ||
| 373 | int n = 256; | ||
| 374 | while ((--n > 0) && | ||
| 375 | !(readl(sport->port.membase + USR2) & USR2_TXDC)) { | ||
| 376 | udelay(5); | ||
| 377 | barrier(); | ||
| 378 | } | ||
| 379 | /* | ||
| 380 | * irda transceiver - wait a bit more to avoid | ||
| 381 | * cutoff, hardware dependent | ||
| 382 | */ | ||
| 383 | udelay(sport->trcv_delay); | ||
| 384 | |||
| 385 | /* | ||
| 386 | * half duplex - reactivate receive mode, | ||
| 387 | * flush receive pipe echo crap | ||
| 388 | */ | ||
| 389 | if (readl(sport->port.membase + USR2) & USR2_TXDC) { | ||
| 390 | temp = readl(sport->port.membase + UCR1); | ||
| 391 | temp &= ~(UCR1_TXMPTYEN | UCR1_TRDYEN); | ||
| 392 | writel(temp, sport->port.membase + UCR1); | ||
| 393 | |||
| 394 | temp = readl(sport->port.membase + UCR4); | ||
| 395 | temp &= ~(UCR4_TCEN); | ||
| 396 | writel(temp, sport->port.membase + UCR4); | ||
| 397 | |||
| 398 | while (readl(sport->port.membase + URXD0) & | ||
| 399 | URXD_CHARRDY) | ||
| 400 | barrier(); | ||
| 401 | |||
| 402 | temp = readl(sport->port.membase + UCR1); | ||
| 403 | temp |= UCR1_RRDYEN; | ||
| 404 | writel(temp, sport->port.membase + UCR1); | ||
| 405 | |||
| 406 | temp = readl(sport->port.membase + UCR4); | ||
| 407 | temp |= UCR4_DREN; | ||
| 408 | writel(temp, sport->port.membase + UCR4); | ||
| 409 | } | ||
| 410 | return; | ||
| 411 | } | ||
| 412 | |||
| 413 | /* | 361 | /* |
| 414 | * We are maybe in the SMP context, so if the DMA TX thread is running | 362 | * We are maybe in the SMP context, so if the DMA TX thread is running |
| 415 | * on other cpu, we have to wait for it to finish. | 363 | * on other cpu, we have to wait for it to finish. |
| @@ -612,32 +560,11 @@ static void imx_start_tx(struct uart_port *port) | |||
| 612 | struct imx_port *sport = (struct imx_port *)port; | 560 | struct imx_port *sport = (struct imx_port *)port; |
| 613 | unsigned long temp; | 561 | unsigned long temp; |
| 614 | 562 | ||
| 615 | if (USE_IRDA(sport)) { | ||
| 616 | /* half duplex in IrDA mode; have to disable receive mode */ | ||
| 617 | temp = readl(sport->port.membase + UCR4); | ||
| 618 | temp &= ~(UCR4_DREN); | ||
| 619 | writel(temp, sport->port.membase + UCR4); | ||
| 620 | |||
| 621 | temp = readl(sport->port.membase + UCR1); | ||
| 622 | temp &= ~(UCR1_RRDYEN); | ||
| 623 | writel(temp, sport->port.membase + UCR1); | ||
| 624 | } | ||
| 625 | |||
| 626 | if (!sport->dma_is_enabled) { | 563 | if (!sport->dma_is_enabled) { |
| 627 | temp = readl(sport->port.membase + UCR1); | 564 | temp = readl(sport->port.membase + UCR1); |
| 628 | writel(temp | UCR1_TXMPTYEN, sport->port.membase + UCR1); | 565 | writel(temp | UCR1_TXMPTYEN, sport->port.membase + UCR1); |
| 629 | } | 566 | } |
| 630 | 567 | ||
| 631 | if (USE_IRDA(sport)) { | ||
| 632 | temp = readl(sport->port.membase + UCR1); | ||
| 633 | temp |= UCR1_TRDYEN; | ||
| 634 | writel(temp, sport->port.membase + UCR1); | ||
| 635 | |||
| 636 | temp = readl(sport->port.membase + UCR4); | ||
| 637 | temp |= UCR4_TCEN; | ||
| 638 | writel(temp, sport->port.membase + UCR4); | ||
| 639 | } | ||
| 640 | |||
| 641 | if (sport->dma_is_enabled) { | 568 | if (sport->dma_is_enabled) { |
| 642 | if (sport->port.x_char) { | 569 | if (sport->port.x_char) { |
| 643 | /* We have X-char to send, so enable TX IRQ and | 570 | /* We have X-char to send, so enable TX IRQ and |
| @@ -1148,9 +1075,6 @@ static int imx_startup(struct uart_port *port) | |||
| 1148 | */ | 1075 | */ |
| 1149 | temp = readl(sport->port.membase + UCR4); | 1076 | temp = readl(sport->port.membase + UCR4); |
| 1150 | 1077 | ||
| 1151 | if (USE_IRDA(sport)) | ||
| 1152 | temp |= UCR4_IRSC; | ||
| 1153 | |||
| 1154 | /* set the trigger level for CTS */ | 1078 | /* set the trigger level for CTS */ |
| 1155 | temp &= ~(UCR4_CTSTL_MASK << UCR4_CTSTL_SHF); | 1079 | temp &= ~(UCR4_CTSTL_MASK << UCR4_CTSTL_SHF); |
| 1156 | temp |= CTSTL << UCR4_CTSTL_SHF; | 1080 | temp |= CTSTL << UCR4_CTSTL_SHF; |
| @@ -1186,11 +1110,6 @@ static int imx_startup(struct uart_port *port) | |||
| 1186 | temp = readl(sport->port.membase + UCR1); | 1110 | temp = readl(sport->port.membase + UCR1); |
| 1187 | temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN; | 1111 | temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN; |
| 1188 | 1112 | ||
| 1189 | if (USE_IRDA(sport)) { | ||
| 1190 | temp |= UCR1_IREN; | ||
| 1191 | temp &= ~(UCR1_RTSDEN); | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | writel(temp, sport->port.membase + UCR1); | 1113 | writel(temp, sport->port.membase + UCR1); |
| 1195 | 1114 | ||
| 1196 | temp = readl(sport->port.membase + UCR4); | 1115 | temp = readl(sport->port.membase + UCR4); |
| @@ -1209,38 +1128,12 @@ static int imx_startup(struct uart_port *port) | |||
| 1209 | writel(temp, sport->port.membase + UCR3); | 1128 | writel(temp, sport->port.membase + UCR3); |
| 1210 | } | 1129 | } |
| 1211 | 1130 | ||
| 1212 | if (USE_IRDA(sport)) { | ||
| 1213 | temp = readl(sport->port.membase + UCR4); | ||
| 1214 | if (sport->irda_inv_rx) | ||
| 1215 | temp |= UCR4_INVR; | ||
| 1216 | else | ||
| 1217 | temp &= ~(UCR4_INVR); | ||
| 1218 | writel(temp | UCR4_DREN, sport->port.membase + UCR4); | ||
| 1219 | |||
| 1220 | temp = readl(sport->port.membase + UCR3); | ||
| 1221 | if (sport->irda_inv_tx) | ||
| 1222 | temp |= UCR3_INVT; | ||
| 1223 | else | ||
| 1224 | temp &= ~(UCR3_INVT); | ||
| 1225 | writel(temp, sport->port.membase + UCR3); | ||
| 1226 | } | ||
| 1227 | |||
| 1228 | /* | 1131 | /* |
| 1229 | * Enable modem status interrupts | 1132 | * Enable modem status interrupts |
| 1230 | */ | 1133 | */ |
| 1231 | imx_enable_ms(&sport->port); | 1134 | imx_enable_ms(&sport->port); |
| 1232 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1135 | spin_unlock_irqrestore(&sport->port.lock, flags); |
| 1233 | 1136 | ||
| 1234 | if (USE_IRDA(sport)) { | ||
| 1235 | struct imxuart_platform_data *pdata; | ||
| 1236 | pdata = dev_get_platdata(sport->port.dev); | ||
| 1237 | sport->irda_inv_rx = pdata->irda_inv_rx; | ||
| 1238 | sport->irda_inv_tx = pdata->irda_inv_tx; | ||
| 1239 | sport->trcv_delay = pdata->transceiver_delay; | ||
| 1240 | if (pdata->irda_enable) | ||
| 1241 | pdata->irda_enable(1); | ||
| 1242 | } | ||
| 1243 | |||
| 1244 | return 0; | 1137 | return 0; |
| 1245 | } | 1138 | } |
| 1246 | 1139 | ||
| @@ -1276,13 +1169,6 @@ static void imx_shutdown(struct uart_port *port) | |||
| 1276 | writel(temp, sport->port.membase + UCR2); | 1169 | writel(temp, sport->port.membase + UCR2); |
| 1277 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1170 | spin_unlock_irqrestore(&sport->port.lock, flags); |
| 1278 | 1171 | ||
| 1279 | if (USE_IRDA(sport)) { | ||
| 1280 | struct imxuart_platform_data *pdata; | ||
| 1281 | pdata = dev_get_platdata(sport->port.dev); | ||
| 1282 | if (pdata->irda_enable) | ||
| 1283 | pdata->irda_enable(0); | ||
| 1284 | } | ||
| 1285 | |||
| 1286 | /* | 1172 | /* |
| 1287 | * Stop our timer. | 1173 | * Stop our timer. |
| 1288 | */ | 1174 | */ |
| @@ -1295,8 +1181,6 @@ static void imx_shutdown(struct uart_port *port) | |||
| 1295 | spin_lock_irqsave(&sport->port.lock, flags); | 1181 | spin_lock_irqsave(&sport->port.lock, flags); |
| 1296 | temp = readl(sport->port.membase + UCR1); | 1182 | temp = readl(sport->port.membase + UCR1); |
| 1297 | temp &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); | 1183 | temp &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); |
| 1298 | if (USE_IRDA(sport)) | ||
| 1299 | temp &= ~(UCR1_IREN); | ||
| 1300 | 1184 | ||
| 1301 | writel(temp, sport->port.membase + UCR1); | 1185 | writel(temp, sport->port.membase + UCR1); |
| 1302 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1186 | spin_unlock_irqrestore(&sport->port.lock, flags); |
| @@ -1450,24 +1334,16 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
| 1450 | sport->port.membase + UCR2); | 1334 | sport->port.membase + UCR2); |
| 1451 | old_txrxen &= (UCR2_TXEN | UCR2_RXEN); | 1335 | old_txrxen &= (UCR2_TXEN | UCR2_RXEN); |
| 1452 | 1336 | ||
| 1453 | if (USE_IRDA(sport)) { | 1337 | /* custom-baudrate handling */ |
| 1454 | /* | 1338 | div = sport->port.uartclk / (baud * 16); |
| 1455 | * use maximum available submodule frequency to | 1339 | if (baud == 38400 && quot != div) |
| 1456 | * avoid missing short pulses due to low sampling rate | 1340 | baud = sport->port.uartclk / (quot * 16); |
| 1457 | */ | 1341 | |
| 1342 | div = sport->port.uartclk / (baud * 16); | ||
| 1343 | if (div > 7) | ||
| 1344 | div = 7; | ||
| 1345 | if (!div) | ||
| 1458 | div = 1; | 1346 | div = 1; |
| 1459 | } else { | ||
| 1460 | /* custom-baudrate handling */ | ||
| 1461 | div = sport->port.uartclk / (baud * 16); | ||
| 1462 | if (baud == 38400 && quot != div) | ||
| 1463 | baud = sport->port.uartclk / (quot * 16); | ||
| 1464 | |||
| 1465 | div = sport->port.uartclk / (baud * 16); | ||
| 1466 | if (div > 7) | ||
| 1467 | div = 7; | ||
| 1468 | if (!div) | ||
| 1469 | div = 1; | ||
| 1470 | } | ||
| 1471 | 1347 | ||
| 1472 | rational_best_approximation(16 * div * baud, sport->port.uartclk, | 1348 | rational_best_approximation(16 * div * baud, sport->port.uartclk, |
| 1473 | 1 << 16, 1 << 16, &num, &denom); | 1349 | 1 << 16, 1 << 16, &num, &denom); |
| @@ -1906,9 +1782,6 @@ static int serial_imx_probe_dt(struct imx_port *sport, | |||
| 1906 | if (of_get_property(np, "fsl,uart-has-rtscts", NULL)) | 1782 | if (of_get_property(np, "fsl,uart-has-rtscts", NULL)) |
| 1907 | sport->have_rtscts = 1; | 1783 | sport->have_rtscts = 1; |
| 1908 | 1784 | ||
| 1909 | if (of_get_property(np, "fsl,irda-mode", NULL)) | ||
| 1910 | sport->use_irda = 1; | ||
| 1911 | |||
| 1912 | if (of_get_property(np, "fsl,dte-mode", NULL)) | 1785 | if (of_get_property(np, "fsl,dte-mode", NULL)) |
| 1913 | sport->dte_mode = 1; | 1786 | sport->dte_mode = 1; |
| 1914 | 1787 | ||
| @@ -1937,9 +1810,6 @@ static void serial_imx_probe_pdata(struct imx_port *sport, | |||
| 1937 | 1810 | ||
| 1938 | if (pdata->flags & IMXUART_HAVE_RTSCTS) | 1811 | if (pdata->flags & IMXUART_HAVE_RTSCTS) |
| 1939 | sport->have_rtscts = 1; | 1812 | sport->have_rtscts = 1; |
| 1940 | |||
| 1941 | if (pdata->flags & IMXUART_IRDA) | ||
| 1942 | sport->use_irda = 1; | ||
| 1943 | } | 1813 | } |
| 1944 | 1814 | ||
| 1945 | static int serial_imx_probe(struct platform_device *pdev) | 1815 | static int serial_imx_probe(struct platform_device *pdev) |
| @@ -2012,15 +1882,6 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
| 2012 | dev_name(&pdev->dev), sport); | 1882 | dev_name(&pdev->dev), sport); |
| 2013 | if (ret) | 1883 | if (ret) |
| 2014 | return ret; | 1884 | return ret; |
| 2015 | |||
| 2016 | /* do not use RTS IRQ on IrDA */ | ||
| 2017 | if (!USE_IRDA(sport)) { | ||
| 2018 | ret = devm_request_irq(&pdev->dev, rtsirq, | ||
| 2019 | imx_rtsint, 0, | ||
| 2020 | dev_name(&pdev->dev), sport); | ||
| 2021 | if (ret) | ||
| 2022 | return ret; | ||
| 2023 | } | ||
| 2024 | } else { | 1885 | } else { |
| 2025 | ret = devm_request_irq(&pdev->dev, rxirq, imx_int, 0, | 1886 | ret = devm_request_irq(&pdev->dev, rxirq, imx_int, 0, |
| 2026 | dev_name(&pdev->dev), sport); | 1887 | dev_name(&pdev->dev), sport); |
diff --git a/include/linux/platform_data/serial-imx.h b/include/linux/platform_data/serial-imx.h index 3cc2e3c40914..a938eba2f18e 100644 --- a/include/linux/platform_data/serial-imx.h +++ b/include/linux/platform_data/serial-imx.h | |||
| @@ -20,14 +20,9 @@ | |||
| 20 | #define ASMARM_ARCH_UART_H | 20 | #define ASMARM_ARCH_UART_H |
| 21 | 21 | ||
| 22 | #define IMXUART_HAVE_RTSCTS (1<<0) | 22 | #define IMXUART_HAVE_RTSCTS (1<<0) |
| 23 | #define IMXUART_IRDA (1<<1) | ||
| 24 | 23 | ||
| 25 | struct imxuart_platform_data { | 24 | struct imxuart_platform_data { |
| 26 | unsigned int flags; | 25 | unsigned int flags; |
| 27 | void (*irda_enable)(int enable); | ||
| 28 | unsigned int irda_inv_rx:1; | ||
| 29 | unsigned int irda_inv_tx:1; | ||
| 30 | unsigned short transceiver_delay; | ||
| 31 | }; | 26 | }; |
| 32 | 27 | ||
| 33 | #endif | 28 | #endif |
