Commit 80ff8a805113850a3ffafcc8e6eaa1fdd51b02f3
Committed by
Linus Torvalds
1 parent
1c45607ad3
Exists in
master
and in
7 other branches
Char: mxser, add support for CP-114UL
Add new card (0x1393:0x1143) support added in 1.11 original driver, also allow rate change in set_serial_info ioctl (as per 1.11 too). Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Reviewed-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 19 additions and 10 deletions Side-by-side Diff
drivers/char/mxser.c
1 | 1 | /* |
2 | 2 | * mxser.c -- MOXA Smartio/Industio family multiport serial driver. |
3 | 3 | * |
4 | - * Copyright (C) 1999-2006 Moxa Technologies (support@moxa.com.tw). | |
5 | - * Copyright (C) 2006-2007 Jiri Slaby <jirislaby@gmail.com> | |
4 | + * Copyright (C) 1999-2006 Moxa Technologies (support@moxa.com). | |
5 | + * Copyright (C) 2006-2008 Jiri Slaby <jirislaby@gmail.com> | |
6 | 6 | * |
7 | 7 | * This code is loosely based on the 1.8 moxa driver which is based on |
8 | 8 | * Linux serial driver, written by Linus Torvalds, Theodore T'so and |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | |
48 | 48 | #include "mxser.h" |
49 | 49 | |
50 | -#define MXSER_VERSION "2.0.2" /* 1.10 */ | |
50 | +#define MXSER_VERSION "2.0.3" /* 1.11 */ | |
51 | 51 | #define MXSERMAJOR 174 |
52 | 52 | #define MXSERCUMAJOR 175 |
53 | 53 | |
... | ... | @@ -73,6 +73,7 @@ |
73 | 73 | |
74 | 74 | #define PCI_DEVICE_ID_CB108 0x1080 |
75 | 75 | #define PCI_DEVICE_ID_CB114 0x1142 |
76 | +#define PCI_DEVICE_ID_CP114UL 0x1143 | |
76 | 77 | #define PCI_DEVICE_ID_CB134I 0x1341 |
77 | 78 | #define PCI_DEVICE_ID_CP138U 0x1380 |
78 | 79 | #define PCI_DEVICE_ID_POS104UL 0x1044 |
... | ... | @@ -140,7 +141,8 @@ |
140 | 141 | /*25*/ { "CB-114 series", 4, }, |
141 | 142 | { "CB-134I series", 4, }, |
142 | 143 | { "CP-138U series", 8, }, |
143 | - { "POS-104UL series", 4, } | |
144 | + { "POS-104UL series", 4, }, | |
145 | + { "CP-114UL series", 4, } | |
144 | 146 | }; |
145 | 147 | |
146 | 148 | /* driver_data correspond to the lines in the structure above |
... | ... | @@ -169,6 +171,7 @@ |
169 | 171 | { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB134I), .driver_data = 26 }, |
170 | 172 | { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U), .driver_data = 27 }, |
171 | 173 | { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 28 }, |
174 | + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL), .driver_data = 29 }, | |
172 | 175 | { } |
173 | 176 | }; |
174 | 177 | MODULE_DEVICE_TABLE(pci, mxser_pcibrds); |
175 | 178 | |
176 | 179 | |
... | ... | @@ -1188,20 +1191,19 @@ |
1188 | 1191 | struct serial_struct __user *new_info) |
1189 | 1192 | { |
1190 | 1193 | struct serial_struct new_serial; |
1194 | + speed_t baud; | |
1191 | 1195 | unsigned long sl_flags; |
1192 | 1196 | unsigned int flags; |
1193 | 1197 | int retval = 0; |
1194 | 1198 | |
1195 | 1199 | if (!new_info || !info->ioaddr) |
1196 | - return -EFAULT; | |
1200 | + return -ENODEV; | |
1197 | 1201 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) |
1198 | 1202 | return -EFAULT; |
1199 | 1203 | |
1200 | - if ((new_serial.irq != info->board->irq) || | |
1201 | - (new_serial.port != info->ioaddr) || | |
1202 | - (new_serial.custom_divisor != info->custom_divisor) || | |
1203 | - (new_serial.baud_base != info->baud_base)) | |
1204 | - return -EPERM; | |
1204 | + if (new_serial.irq != info->board->irq || | |
1205 | + new_serial.port != info->ioaddr) | |
1206 | + return -EINVAL; | |
1205 | 1207 | |
1206 | 1208 | flags = info->flags & ASYNC_SPD_MASK; |
1207 | 1209 | |
... | ... | @@ -1224,6 +1226,13 @@ |
1224 | 1226 | info->tty->low_latency = |
1225 | 1227 | (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
1226 | 1228 | info->tty->low_latency = 0; |
1229 | + if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && | |
1230 | + (new_serial.baud_base != info->baud_base || | |
1231 | + new_serial.custom_divisor != | |
1232 | + info->custom_divisor)) { | |
1233 | + baud = new_serial.baud_base / new_serial.custom_divisor; | |
1234 | + tty_encode_baud_rate(info->tty, baud, baud); | |
1235 | + } | |
1227 | 1236 | } |
1228 | 1237 | |
1229 | 1238 | info->type = new_serial.type; |