aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/bfin_5xx.c
diff options
context:
space:
mode:
authorGraf Yang <graf.yang@analog.com>2008-02-28 22:31:08 -0500
committerBryan Wu <cooloney@kernel.org>2008-02-28 22:31:08 -0500
commit7d01b475ab17018756c8df27c2ee3c220fab05f8 (patch)
treef24b3804a69a899e51175c817ec3bef827dde951 /drivers/serial/bfin_5xx.c
parent0c11700dbfaf0aa5336bd667373ee09db245f3ea (diff)
Blackfin Serial Driver: Enable IR function when user application (irattach /dev/ttyBFx -s) call TIOCSETD ioctl with line discipline N_IRDA
Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'drivers/serial/bfin_5xx.c')
-rw-r--r--drivers/serial/bfin_5xx.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 46bb47f37b9a..4e0b8cd4d4e0 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -900,6 +900,31 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
900 return 0; 900 return 0;
901} 901}
902 902
903/*
904 * Enable the IrDA function if tty->ldisc.num is N_IRDA.
905 * In other cases, disable IrDA function.
906 */
907static void bfin_set_ldisc(struct tty_struct *tty)
908{
909 int line = tty->index;
910 unsigned short val;
911
912 if (line >= tty->driver->num)
913 return;
914
915 switch (tty->ldisc.num) {
916 case N_IRDA:
917 val = UART_GET_GCTL(&bfin_serial_ports[line]);
918 val |= (IREN | RPOLC);
919 UART_PUT_GCTL(&bfin_serial_ports[line], val);
920 break;
921 default:
922 val = UART_GET_GCTL(&bfin_serial_ports[line]);
923 val &= ~(IREN | RPOLC);
924 UART_PUT_GCTL(&bfin_serial_ports[line], val);
925 }
926}
927
903static struct uart_ops bfin_serial_pops = { 928static struct uart_ops bfin_serial_pops = {
904 .tx_empty = bfin_serial_tx_empty, 929 .tx_empty = bfin_serial_tx_empty,
905 .set_mctrl = bfin_serial_set_mctrl, 930 .set_mctrl = bfin_serial_set_mctrl,
@@ -1261,6 +1286,7 @@ static int __init bfin_serial_init(void)
1261 1286
1262 ret = uart_register_driver(&bfin_serial_reg); 1287 ret = uart_register_driver(&bfin_serial_reg);
1263 if (ret == 0) { 1288 if (ret == 0) {
1289 bfin_serial_reg.tty_driver->set_ldisc = bfin_set_ldisc;
1264 ret = platform_driver_register(&bfin_serial_driver); 1290 ret = platform_driver_register(&bfin_serial_driver);
1265 if (ret) { 1291 if (ret) {
1266 pr_debug("uart register failed\n"); 1292 pr_debug("uart register failed\n");