Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
afe9cbb1 f95661b2

+9 -153
+9 -148
drivers/tty/serial/imx.c
··· 6 6 * Author: Sascha Hauer <sascha@saschahauer.de> 7 7 * Copyright (C) 2004 Pengutronix 8 8 * 9 - * Author: Fabian Godehardt (added IrDA support for iMX) 10 - * Copyright (C) 2009 emlix GmbH 11 - * 12 9 * This program is free software; you can redistribute it and/or modify 13 10 * it under the terms of the GNU General Public License as published by 14 11 * the Free Software Foundation; either version 2 of the License, or ··· 198 201 unsigned int old_status; 199 202 unsigned int have_rtscts:1; 200 203 unsigned int dte_mode:1; 201 - unsigned int use_irda:1; 202 204 unsigned int irda_inv_rx:1; 203 205 unsigned int irda_inv_tx:1; 204 206 unsigned short trcv_delay; /* transceiver delay */ ··· 223 227 unsigned int ucr2; 224 228 unsigned int ucr3; 225 229 }; 226 - 227 - #ifdef CONFIG_IRDA 228 - #define USE_IRDA(sport) ((sport)->use_irda) 229 - #else 230 - #define USE_IRDA(sport) (0) 231 - #endif 232 230 233 231 static struct imx_uart_data imx_uart_devdata[] = { 234 232 [IMX1_UART] = { ··· 357 367 { 358 368 struct imx_port *sport = (struct imx_port *)port; 359 369 unsigned long temp; 360 - 361 - if (USE_IRDA(sport)) { 362 - /* half duplex - wait for end of transmission */ 363 - int n = 256; 364 - while ((--n > 0) && 365 - !(readl(sport->port.membase + USR2) & USR2_TXDC)) { 366 - udelay(5); 367 - barrier(); 368 - } 369 - /* 370 - * irda transceiver - wait a bit more to avoid 371 - * cutoff, hardware dependent 372 - */ 373 - udelay(sport->trcv_delay); 374 - 375 - /* 376 - * half duplex - reactivate receive mode, 377 - * flush receive pipe echo crap 378 - */ 379 - if (readl(sport->port.membase + USR2) & USR2_TXDC) { 380 - temp = readl(sport->port.membase + UCR1); 381 - temp &= ~(UCR1_TXMPTYEN | UCR1_TRDYEN); 382 - writel(temp, sport->port.membase + UCR1); 383 - 384 - temp = readl(sport->port.membase + UCR4); 385 - temp &= ~(UCR4_TCEN); 386 - writel(temp, sport->port.membase + UCR4); 387 - 388 - while (readl(sport->port.membase + URXD0) & 389 - URXD_CHARRDY) 390 - barrier(); 391 - 392 - temp = readl(sport->port.membase + UCR1); 393 - temp |= UCR1_RRDYEN; 394 - writel(temp, sport->port.membase + UCR1); 395 - 396 - temp = readl(sport->port.membase + UCR4); 397 - temp |= UCR4_DREN; 398 - writel(temp, sport->port.membase + UCR4); 399 - } 400 - return; 401 - } 402 370 403 371 /* 404 372 * We are maybe in the SMP context, so if the DMA TX thread is running ··· 560 612 struct imx_port *sport = (struct imx_port *)port; 561 613 unsigned long temp; 562 614 563 - if (USE_IRDA(sport)) { 564 - /* half duplex in IrDA mode; have to disable receive mode */ 565 - temp = readl(sport->port.membase + UCR4); 566 - temp &= ~(UCR4_DREN); 567 - writel(temp, sport->port.membase + UCR4); 568 - 569 - temp = readl(sport->port.membase + UCR1); 570 - temp &= ~(UCR1_RRDYEN); 571 - writel(temp, sport->port.membase + UCR1); 572 - } 573 - 574 615 if (!sport->dma_is_enabled) { 575 616 temp = readl(sport->port.membase + UCR1); 576 617 writel(temp | UCR1_TXMPTYEN, sport->port.membase + UCR1); 577 - } 578 - 579 - if (USE_IRDA(sport)) { 580 - temp = readl(sport->port.membase + UCR1); 581 - temp |= UCR1_TRDYEN; 582 - writel(temp, sport->port.membase + UCR1); 583 - 584 - temp = readl(sport->port.membase + UCR4); 585 - temp |= UCR4_TCEN; 586 - writel(temp, sport->port.membase + UCR4); 587 618 } 588 619 589 620 if (sport->dma_is_enabled) { ··· 1075 1148 */ 1076 1149 temp = readl(sport->port.membase + UCR4); 1077 1150 1078 - if (USE_IRDA(sport)) 1079 - temp |= UCR4_IRSC; 1080 - 1081 1151 /* set the trigger level for CTS */ 1082 1152 temp &= ~(UCR4_CTSTL_MASK << UCR4_CTSTL_SHF); 1083 1153 temp |= CTSTL << UCR4_CTSTL_SHF; ··· 1110 1186 temp = readl(sport->port.membase + UCR1); 1111 1187 temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN; 1112 1188 1113 - if (USE_IRDA(sport)) { 1114 - temp |= UCR1_IREN; 1115 - temp &= ~(UCR1_RTSDEN); 1116 - } 1117 - 1118 1189 writel(temp, sport->port.membase + UCR1); 1119 1190 1120 1191 temp = readl(sport->port.membase + UCR4); ··· 1128 1209 writel(temp, sport->port.membase + UCR3); 1129 1210 } 1130 1211 1131 - if (USE_IRDA(sport)) { 1132 - temp = readl(sport->port.membase + UCR4); 1133 - if (sport->irda_inv_rx) 1134 - temp |= UCR4_INVR; 1135 - else 1136 - temp &= ~(UCR4_INVR); 1137 - writel(temp | UCR4_DREN, sport->port.membase + UCR4); 1138 - 1139 - temp = readl(sport->port.membase + UCR3); 1140 - if (sport->irda_inv_tx) 1141 - temp |= UCR3_INVT; 1142 - else 1143 - temp &= ~(UCR3_INVT); 1144 - writel(temp, sport->port.membase + UCR3); 1145 - } 1146 - 1147 1212 /* 1148 1213 * Enable modem status interrupts 1149 1214 */ 1150 1215 imx_enable_ms(&sport->port); 1151 1216 spin_unlock_irqrestore(&sport->port.lock, flags); 1152 - 1153 - if (USE_IRDA(sport)) { 1154 - struct imxuart_platform_data *pdata; 1155 - pdata = dev_get_platdata(sport->port.dev); 1156 - sport->irda_inv_rx = pdata->irda_inv_rx; 1157 - sport->irda_inv_tx = pdata->irda_inv_tx; 1158 - sport->trcv_delay = pdata->transceiver_delay; 1159 - if (pdata->irda_enable) 1160 - pdata->irda_enable(1); 1161 - } 1162 1217 1163 1218 return 0; 1164 1219 } ··· 1169 1276 writel(temp, sport->port.membase + UCR2); 1170 1277 spin_unlock_irqrestore(&sport->port.lock, flags); 1171 1278 1172 - if (USE_IRDA(sport)) { 1173 - struct imxuart_platform_data *pdata; 1174 - pdata = dev_get_platdata(sport->port.dev); 1175 - if (pdata->irda_enable) 1176 - pdata->irda_enable(0); 1177 - } 1178 - 1179 1279 /* 1180 1280 * Stop our timer. 1181 1281 */ ··· 1181 1295 spin_lock_irqsave(&sport->port.lock, flags); 1182 1296 temp = readl(sport->port.membase + UCR1); 1183 1297 temp &= ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN); 1184 - if (USE_IRDA(sport)) 1185 - temp &= ~(UCR1_IREN); 1186 1298 1187 1299 writel(temp, sport->port.membase + UCR1); 1188 1300 spin_unlock_irqrestore(&sport->port.lock, flags); ··· 1334 1450 sport->port.membase + UCR2); 1335 1451 old_txrxen &= (UCR2_TXEN | UCR2_RXEN); 1336 1452 1337 - if (USE_IRDA(sport)) { 1338 - /* 1339 - * use maximum available submodule frequency to 1340 - * avoid missing short pulses due to low sampling rate 1341 - */ 1342 - div = 1; 1343 - } else { 1344 - /* custom-baudrate handling */ 1345 - div = sport->port.uartclk / (baud * 16); 1346 - if (baud == 38400 && quot != div) 1347 - baud = sport->port.uartclk / (quot * 16); 1453 + /* custom-baudrate handling */ 1454 + div = sport->port.uartclk / (baud * 16); 1455 + if (baud == 38400 && quot != div) 1456 + baud = sport->port.uartclk / (quot * 16); 1348 1457 1349 - div = sport->port.uartclk / (baud * 16); 1350 - if (div > 7) 1351 - div = 7; 1352 - if (!div) 1353 - div = 1; 1354 - } 1458 + div = sport->port.uartclk / (baud * 16); 1459 + if (div > 7) 1460 + div = 7; 1461 + if (!div) 1462 + div = 1; 1355 1463 1356 1464 rational_best_approximation(16 * div * baud, sport->port.uartclk, 1357 1465 1 << 16, 1 << 16, &num, &denom); ··· 1782 1906 if (of_get_property(np, "fsl,uart-has-rtscts", NULL)) 1783 1907 sport->have_rtscts = 1; 1784 1908 1785 - if (of_get_property(np, "fsl,irda-mode", NULL)) 1786 - sport->use_irda = 1; 1787 - 1788 1909 if (of_get_property(np, "fsl,dte-mode", NULL)) 1789 1910 sport->dte_mode = 1; 1790 1911 ··· 1810 1937 1811 1938 if (pdata->flags & IMXUART_HAVE_RTSCTS) 1812 1939 sport->have_rtscts = 1; 1813 - 1814 - if (pdata->flags & IMXUART_IRDA) 1815 - sport->use_irda = 1; 1816 1940 } 1817 1941 1818 1942 static int serial_imx_probe(struct platform_device *pdev) ··· 1882 2012 dev_name(&pdev->dev), sport); 1883 2013 if (ret) 1884 2014 return ret; 1885 - 1886 - /* do not use RTS IRQ on IrDA */ 1887 - if (!USE_IRDA(sport)) { 1888 - ret = devm_request_irq(&pdev->dev, rtsirq, 1889 - imx_rtsint, 0, 1890 - dev_name(&pdev->dev), sport); 1891 - if (ret) 1892 - return ret; 1893 - } 1894 2015 } else { 1895 2016 ret = devm_request_irq(&pdev->dev, rxirq, imx_int, 0, 1896 2017 dev_name(&pdev->dev), sport);
-5
include/linux/platform_data/serial-imx.h
··· 20 20 #define ASMARM_ARCH_UART_H 21 21 22 22 #define IMXUART_HAVE_RTSCTS (1<<0) 23 - #define IMXUART_IRDA (1<<1) 24 23 25 24 struct imxuart_platform_data { 26 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 28 #endif