diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/serial/jsm | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/serial/jsm')
-rw-r--r-- | drivers/serial/jsm/jsm.h | 8 | ||||
-rw-r--r-- | drivers/serial/jsm/jsm_driver.c | 50 | ||||
-rw-r--r-- | drivers/serial/jsm/jsm_neo.c | 8 | ||||
-rw-r--r-- | drivers/serial/jsm/jsm_tty.c | 16 |
4 files changed, 58 insertions, 24 deletions
diff --git a/drivers/serial/jsm/jsm.h b/drivers/serial/jsm/jsm.h index 4e5f3bde0461..38a509c684cd 100644 --- a/drivers/serial/jsm/jsm.h +++ b/drivers/serial/jsm/jsm.h | |||
@@ -138,7 +138,6 @@ struct jsm_board | |||
138 | u32 nasync; /* Number of ports on card */ | 138 | u32 nasync; /* Number of ports on card */ |
139 | 139 | ||
140 | u32 irq; /* Interrupt request number */ | 140 | u32 irq; /* Interrupt request number */ |
141 | u64 intr_count; /* Count of interrupts */ | ||
142 | 141 | ||
143 | u64 membase; /* Start of base memory of the card */ | 142 | u64 membase; /* Start of base memory of the card */ |
144 | u64 membase_end; /* End of base memory of the card */ | 143 | u64 membase_end; /* End of base memory of the card */ |
@@ -206,8 +205,6 @@ struct jsm_channel { | |||
206 | 205 | ||
207 | u64 ch_close_delay; /* How long we should drop RTS/DTR for */ | 206 | u64 ch_close_delay; /* How long we should drop RTS/DTR for */ |
208 | 207 | ||
209 | u64 ch_cpstime; /* Time for CPS calculations */ | ||
210 | |||
211 | tcflag_t ch_c_iflag; /* channel iflags */ | 208 | tcflag_t ch_c_iflag; /* channel iflags */ |
212 | tcflag_t ch_c_cflag; /* channel cflags */ | 209 | tcflag_t ch_c_cflag; /* channel cflags */ |
213 | tcflag_t ch_c_oflag; /* channel oflags */ | 210 | tcflag_t ch_c_oflag; /* channel oflags */ |
@@ -215,11 +212,6 @@ struct jsm_channel { | |||
215 | u8 ch_stopc; /* Stop character */ | 212 | u8 ch_stopc; /* Stop character */ |
216 | u8 ch_startc; /* Start character */ | 213 | u8 ch_startc; /* Start character */ |
217 | 214 | ||
218 | u32 ch_old_baud; /* Cache of the current baud */ | ||
219 | u32 ch_custom_speed;/* Custom baud, if set */ | ||
220 | |||
221 | u32 ch_wopen; /* Waiting for open process cnt */ | ||
222 | |||
223 | u8 ch_mostat; /* FEP output modem status */ | 215 | u8 ch_mostat; /* FEP output modem status */ |
224 | u8 ch_mistat; /* FEP input modem status */ | 216 | u8 ch_mistat; /* FEP input modem status */ |
225 | 217 | ||
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index b3604aa322a4..eaf545014119 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c | |||
@@ -26,6 +26,7 @@ | |||
26 | ***********************************************************************/ | 26 | ***********************************************************************/ |
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/slab.h> | ||
29 | 30 | ||
30 | #include "jsm.h" | 31 | #include "jsm.h" |
31 | 32 | ||
@@ -48,6 +49,17 @@ struct uart_driver jsm_uart_driver = { | |||
48 | .nr = NR_PORTS, | 49 | .nr = NR_PORTS, |
49 | }; | 50 | }; |
50 | 51 | ||
52 | static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev, | ||
53 | pci_channel_state_t state); | ||
54 | static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev); | ||
55 | static void jsm_io_resume(struct pci_dev *pdev); | ||
56 | |||
57 | static struct pci_error_handlers jsm_err_handler = { | ||
58 | .error_detected = jsm_io_error_detected, | ||
59 | .slot_reset = jsm_io_slot_reset, | ||
60 | .resume = jsm_io_resume, | ||
61 | }; | ||
62 | |||
51 | int jsm_debug; | 63 | int jsm_debug; |
52 | module_param(jsm_debug, int, 0); | 64 | module_param(jsm_debug, int, 0); |
53 | MODULE_PARM_DESC(jsm_debug, "Driver debugging level"); | 65 | MODULE_PARM_DESC(jsm_debug, "Driver debugging level"); |
@@ -123,7 +135,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device | |||
123 | } | 135 | } |
124 | 136 | ||
125 | rc = request_irq(brd->irq, brd->bd_ops->intr, | 137 | rc = request_irq(brd->irq, brd->bd_ops->intr, |
126 | IRQF_DISABLED|IRQF_SHARED, "JSM", brd); | 138 | IRQF_SHARED, "JSM", brd); |
127 | if (rc) { | 139 | if (rc) { |
128 | printk(KERN_WARNING "Failed to hook IRQ %d\n",brd->irq); | 140 | printk(KERN_WARNING "Failed to hook IRQ %d\n",brd->irq); |
129 | goto out_iounmap; | 141 | goto out_iounmap; |
@@ -164,9 +176,11 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device | |||
164 | } | 176 | } |
165 | 177 | ||
166 | pci_set_drvdata(pdev, brd); | 178 | pci_set_drvdata(pdev, brd); |
179 | pci_save_state(pdev); | ||
167 | 180 | ||
168 | return 0; | 181 | return 0; |
169 | out_free_irq: | 182 | out_free_irq: |
183 | jsm_remove_uart_port(brd); | ||
170 | free_irq(brd->irq, brd); | 184 | free_irq(brd->irq, brd); |
171 | out_iounmap: | 185 | out_iounmap: |
172 | iounmap(brd->re_map_membase); | 186 | iounmap(brd->re_map_membase); |
@@ -222,8 +236,42 @@ static struct pci_driver jsm_driver = { | |||
222 | .id_table = jsm_pci_tbl, | 236 | .id_table = jsm_pci_tbl, |
223 | .probe = jsm_probe_one, | 237 | .probe = jsm_probe_one, |
224 | .remove = __devexit_p(jsm_remove_one), | 238 | .remove = __devexit_p(jsm_remove_one), |
239 | .err_handler = &jsm_err_handler, | ||
225 | }; | 240 | }; |
226 | 241 | ||
242 | static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev, | ||
243 | pci_channel_state_t state) | ||
244 | { | ||
245 | struct jsm_board *brd = pci_get_drvdata(pdev); | ||
246 | |||
247 | jsm_remove_uart_port(brd); | ||
248 | |||
249 | return PCI_ERS_RESULT_NEED_RESET; | ||
250 | } | ||
251 | |||
252 | static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev) | ||
253 | { | ||
254 | int rc; | ||
255 | |||
256 | rc = pci_enable_device(pdev); | ||
257 | |||
258 | if (rc) | ||
259 | return PCI_ERS_RESULT_DISCONNECT; | ||
260 | |||
261 | pci_set_master(pdev); | ||
262 | |||
263 | return PCI_ERS_RESULT_RECOVERED; | ||
264 | } | ||
265 | |||
266 | static void jsm_io_resume(struct pci_dev *pdev) | ||
267 | { | ||
268 | struct jsm_board *brd = pci_get_drvdata(pdev); | ||
269 | |||
270 | pci_restore_state(pdev); | ||
271 | |||
272 | jsm_uart_port_init(brd); | ||
273 | } | ||
274 | |||
227 | static int __init jsm_init_module(void) | 275 | static int __init jsm_init_module(void) |
228 | { | 276 | { |
229 | int rc; | 277 | int rc; |
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c index b4b124e4828f..7960d9633c15 100644 --- a/drivers/serial/jsm/jsm_neo.c +++ b/drivers/serial/jsm/jsm_neo.c | |||
@@ -954,13 +954,8 @@ static void neo_param(struct jsm_channel *ch) | |||
954 | ch->ch_flags |= (CH_BAUD0); | 954 | ch->ch_flags |= (CH_BAUD0); |
955 | ch->ch_mostat &= ~(UART_MCR_RTS | UART_MCR_DTR); | 955 | ch->ch_mostat &= ~(UART_MCR_RTS | UART_MCR_DTR); |
956 | neo_assert_modem_signals(ch); | 956 | neo_assert_modem_signals(ch); |
957 | ch->ch_old_baud = 0; | ||
958 | return; | 957 | return; |
959 | 958 | ||
960 | } else if (ch->ch_custom_speed) { | ||
961 | baud = ch->ch_custom_speed; | ||
962 | if (ch->ch_flags & CH_BAUD0) | ||
963 | ch->ch_flags &= ~(CH_BAUD0); | ||
964 | } else { | 959 | } else { |
965 | int i; | 960 | int i; |
966 | unsigned int cflag; | 961 | unsigned int cflag; |
@@ -1045,7 +1040,6 @@ static void neo_param(struct jsm_channel *ch) | |||
1045 | quot = ch->ch_bd->bd_dividend / baud; | 1040 | quot = ch->ch_bd->bd_dividend / baud; |
1046 | 1041 | ||
1047 | if (quot != 0) { | 1042 | if (quot != 0) { |
1048 | ch->ch_old_baud = baud; | ||
1049 | writeb(UART_LCR_DLAB, &ch->ch_neo_uart->lcr); | 1043 | writeb(UART_LCR_DLAB, &ch->ch_neo_uart->lcr); |
1050 | writeb((quot & 0xff), &ch->ch_neo_uart->txrx); | 1044 | writeb((quot & 0xff), &ch->ch_neo_uart->txrx); |
1051 | writeb((quot >> 8), &ch->ch_neo_uart->ier); | 1045 | writeb((quot >> 8), &ch->ch_neo_uart->ier); |
@@ -1123,8 +1117,6 @@ static irqreturn_t neo_intr(int irq, void *voidbrd) | |||
1123 | unsigned long lock_flags2; | 1117 | unsigned long lock_flags2; |
1124 | int outofloop_count = 0; | 1118 | int outofloop_count = 0; |
1125 | 1119 | ||
1126 | brd->intr_count++; | ||
1127 | |||
1128 | /* Lock out the slow poller from running on this board. */ | 1120 | /* Lock out the slow poller from running on this board. */ |
1129 | spin_lock_irqsave(&brd->bd_intr_lock, lock_flags); | 1121 | spin_lock_irqsave(&brd->bd_intr_lock, lock_flags); |
1130 | 1122 | ||
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c index 7439c0373620..7a4a914ecff0 100644 --- a/drivers/serial/jsm/jsm_tty.c +++ b/drivers/serial/jsm/jsm_tty.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/serial_reg.h> | 30 | #include <linux/serial_reg.h> |
31 | #include <linux/delay.h> /* For udelay */ | 31 | #include <linux/delay.h> /* For udelay */ |
32 | #include <linux/pci.h> | 32 | #include <linux/pci.h> |
33 | #include <linux/slab.h> | ||
33 | 34 | ||
34 | #include "jsm.h" | 35 | #include "jsm.h" |
35 | 36 | ||
@@ -296,8 +297,6 @@ static void jsm_tty_close(struct uart_port *port) | |||
296 | bd->bd_ops->assert_modem_signals(channel); | 297 | bd->bd_ops->assert_modem_signals(channel); |
297 | } | 298 | } |
298 | 299 | ||
299 | channel->ch_old_baud = 0; | ||
300 | |||
301 | /* Turn off UART interrupts for this port */ | 300 | /* Turn off UART interrupts for this port */ |
302 | channel->ch_bd->bd_ops->uart_off(channel); | 301 | channel->ch_bd->bd_ops->uart_off(channel); |
303 | 302 | ||
@@ -432,9 +431,9 @@ int __devinit jsm_tty_init(struct jsm_board *brd) | |||
432 | return 0; | 431 | return 0; |
433 | } | 432 | } |
434 | 433 | ||
435 | int __devinit jsm_uart_port_init(struct jsm_board *brd) | 434 | int jsm_uart_port_init(struct jsm_board *brd) |
436 | { | 435 | { |
437 | int i; | 436 | int i, rc; |
438 | unsigned int line; | 437 | unsigned int line; |
439 | struct jsm_channel *ch; | 438 | struct jsm_channel *ch; |
440 | 439 | ||
@@ -469,10 +468,13 @@ int __devinit jsm_uart_port_init(struct jsm_board *brd) | |||
469 | } else | 468 | } else |
470 | set_bit(line, linemap); | 469 | set_bit(line, linemap); |
471 | brd->channels[i]->uart_port.line = line; | 470 | brd->channels[i]->uart_port.line = line; |
472 | if (uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port)) | 471 | rc = uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port); |
473 | printk(KERN_INFO "jsm: add device failed\n"); | 472 | if (rc){ |
473 | printk(KERN_INFO "jsm: Port %d failed. Aborting...\n", i); | ||
474 | return rc; | ||
475 | } | ||
474 | else | 476 | else |
475 | printk(KERN_INFO "Added device \n"); | 477 | printk(KERN_INFO "jsm: Port %d added\n", i); |
476 | } | 478 | } |
477 | 479 | ||
478 | jsm_printk(INIT, INFO, &brd->pci_dev, "finish\n"); | 480 | jsm_printk(INIT, INFO, &brd->pci_dev, "finish\n"); |