diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /drivers/serial | |
parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'drivers/serial')
66 files changed, 1549 insertions, 3550 deletions
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c index 0276471cb25e..f31c6698419c 100644 --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c | |||
@@ -4,8 +4,6 @@ | |||
4 | * Driver for the serial port on the 21285 StrongArm-110 core logic chip. | 4 | * Driver for the serial port on the 21285 StrongArm-110 core logic chip. |
5 | * | 5 | * |
6 | * Based on drivers/char/serial.c | 6 | * Based on drivers/char/serial.c |
7 | * | ||
8 | * $Id: 21285.c,v 1.37 2002/07/28 10:03:27 rmk Exp $ | ||
9 | */ | 7 | */ |
10 | #include <linux/module.h> | 8 | #include <linux/module.h> |
11 | #include <linux/tty.h> | 9 | #include <linux/tty.h> |
@@ -21,7 +19,7 @@ | |||
21 | #include <asm/irq.h> | 19 | #include <asm/irq.h> |
22 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
23 | #include <asm/hardware/dec21285.h> | 21 | #include <asm/hardware/dec21285.h> |
24 | #include <asm/hardware.h> | 22 | #include <mach/hardware.h> |
25 | 23 | ||
26 | #define BAUD_BASE (mem_fclk_21285/64) | 24 | #define BAUD_BASE (mem_fclk_21285/64) |
27 | 25 | ||
@@ -88,7 +86,7 @@ static void serial21285_enable_ms(struct uart_port *port) | |||
88 | static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) | 86 | static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) |
89 | { | 87 | { |
90 | struct uart_port *port = dev_id; | 88 | struct uart_port *port = dev_id; |
91 | struct tty_struct *tty = port->info->tty; | 89 | struct tty_struct *tty = port->info->port.tty; |
92 | unsigned int status, ch, flag, rxs, max_count = 256; | 90 | unsigned int status, ch, flag, rxs, max_count = 256; |
93 | 91 | ||
94 | status = *CSR_UARTFLG; | 92 | status = *CSR_UARTFLG; |
@@ -237,8 +235,8 @@ serial21285_set_termios(struct uart_port *port, struct ktermios *termios, | |||
237 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); | 235 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); |
238 | quot = uart_get_divisor(port, baud); | 236 | quot = uart_get_divisor(port, baud); |
239 | 237 | ||
240 | if (port->info && port->info->tty) { | 238 | if (port->info && port->info->port.tty) { |
241 | struct tty_struct *tty = port->info->tty; | 239 | struct tty_struct *tty = port->info->port.tty; |
242 | unsigned int b = port->uartclk / (16 * quot); | 240 | unsigned int b = port->uartclk / (16 * quot); |
243 | tty_encode_baud_rate(tty, b, b); | 241 | tty_encode_baud_rate(tty, b, b); |
244 | } | 242 | } |
@@ -494,7 +492,7 @@ static int __init serial21285_init(void) | |||
494 | { | 492 | { |
495 | int ret; | 493 | int ret; |
496 | 494 | ||
497 | printk(KERN_INFO "Serial: 21285 driver $Revision: 1.37 $\n"); | 495 | printk(KERN_INFO "Serial: 21285 driver\n"); |
498 | 496 | ||
499 | serial21285_setup_ports(); | 497 | serial21285_setup_ports(); |
500 | 498 | ||
@@ -515,5 +513,5 @@ module_init(serial21285_init); | |||
515 | module_exit(serial21285_exit); | 513 | module_exit(serial21285_exit); |
516 | 514 | ||
517 | MODULE_LICENSE("GPL"); | 515 | MODULE_LICENSE("GPL"); |
518 | MODULE_DESCRIPTION("Intel Footbridge (21285) serial driver $Revision: 1.37 $"); | 516 | MODULE_DESCRIPTION("Intel Footbridge (21285) serial driver"); |
519 | MODULE_ALIAS_CHARDEV(SERIAL_21285_MAJOR, SERIAL_21285_MINOR); | 517 | MODULE_ALIAS_CHARDEV(SERIAL_21285_MAJOR, SERIAL_21285_MINOR); |
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c index bbf5bc5892c7..d935b2d04f93 100644 --- a/drivers/serial/68328serial.c +++ b/drivers/serial/68328serial.c | |||
@@ -66,7 +66,6 @@ | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | static struct m68k_serial m68k_soft[NR_PORTS]; | 68 | static struct m68k_serial m68k_soft[NR_PORTS]; |
69 | struct m68k_serial *IRQ_ports[NR_IRQS]; | ||
70 | 69 | ||
71 | static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS; | 70 | static unsigned int uart_irqs[NR_PORTS] = UART_IRQ_DEFNS; |
72 | 71 | ||
@@ -249,7 +248,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status) | |||
249 | { | 248 | { |
250 | #if 0 | 249 | #if 0 |
251 | if(status & DCD) { | 250 | if(status & DCD) { |
252 | if((info->tty->termios->c_cflag & CRTSCTS) && | 251 | if((info->port.tty->termios->c_cflag & CRTSCTS) && |
253 | ((info->curregs[3] & AUTO_ENAB)==0)) { | 252 | ((info->curregs[3] & AUTO_ENAB)==0)) { |
254 | info->curregs[3] |= AUTO_ENAB; | 253 | info->curregs[3] |= AUTO_ENAB; |
255 | info->pendregs[3] |= AUTO_ENAB; | 254 | info->pendregs[3] |= AUTO_ENAB; |
@@ -274,7 +273,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status) | |||
274 | 273 | ||
275 | static void receive_chars(struct m68k_serial *info, unsigned short rx) | 274 | static void receive_chars(struct m68k_serial *info, unsigned short rx) |
276 | { | 275 | { |
277 | struct tty_struct *tty = info->tty; | 276 | struct tty_struct *tty = info->port.tty; |
278 | m68328_uart *uart = &uart_addr[info->line]; | 277 | m68328_uart *uart = &uart_addr[info->line]; |
279 | unsigned char ch, flag; | 278 | unsigned char ch, flag; |
280 | 279 | ||
@@ -345,7 +344,7 @@ static void transmit_chars(struct m68k_serial *info) | |||
345 | goto clear_and_return; | 344 | goto clear_and_return; |
346 | } | 345 | } |
347 | 346 | ||
348 | if((info->xmit_cnt <= 0) || info->tty->stopped) { | 347 | if((info->xmit_cnt <= 0) || info->port.tty->stopped) { |
349 | /* That's peculiar... TX ints off */ | 348 | /* That's peculiar... TX ints off */ |
350 | uart->ustcnt &= ~USTCNT_TX_INTR_MASK; | 349 | uart->ustcnt &= ~USTCNT_TX_INTR_MASK; |
351 | goto clear_and_return; | 350 | goto clear_and_return; |
@@ -375,15 +374,11 @@ clear_and_return: | |||
375 | */ | 374 | */ |
376 | irqreturn_t rs_interrupt(int irq, void *dev_id) | 375 | irqreturn_t rs_interrupt(int irq, void *dev_id) |
377 | { | 376 | { |
378 | struct m68k_serial * info; | 377 | struct m68k_serial *info = dev_id; |
379 | m68328_uart *uart; | 378 | m68328_uart *uart; |
380 | unsigned short rx; | 379 | unsigned short rx; |
381 | unsigned short tx; | 380 | unsigned short tx; |
382 | 381 | ||
383 | info = IRQ_ports[irq]; | ||
384 | if(!info) | ||
385 | return IRQ_NONE; | ||
386 | |||
387 | uart = &uart_addr[info->line]; | 382 | uart = &uart_addr[info->line]; |
388 | rx = uart->urx.w; | 383 | rx = uart->urx.w; |
389 | 384 | ||
@@ -403,7 +398,7 @@ static void do_softint(struct work_struct *work) | |||
403 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue); | 398 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue); |
404 | struct tty_struct *tty; | 399 | struct tty_struct *tty; |
405 | 400 | ||
406 | tty = info->tty; | 401 | tty = info->port.tty; |
407 | if (!tty) | 402 | if (!tty) |
408 | return; | 403 | return; |
409 | #if 0 | 404 | #if 0 |
@@ -427,7 +422,7 @@ static void do_serial_hangup(struct work_struct *work) | |||
427 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup); | 422 | struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup); |
428 | struct tty_struct *tty; | 423 | struct tty_struct *tty; |
429 | 424 | ||
430 | tty = info->tty; | 425 | tty = info->port.tty; |
431 | if (!tty) | 426 | if (!tty) |
432 | return; | 427 | return; |
433 | 428 | ||
@@ -471,8 +466,8 @@ static int startup(struct m68k_serial * info) | |||
471 | uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK; | 466 | uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK; |
472 | #endif | 467 | #endif |
473 | 468 | ||
474 | if (info->tty) | 469 | if (info->port.tty) |
475 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 470 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
476 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 471 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
477 | 472 | ||
478 | /* | 473 | /* |
@@ -506,8 +501,8 @@ static void shutdown(struct m68k_serial * info) | |||
506 | info->xmit_buf = 0; | 501 | info->xmit_buf = 0; |
507 | } | 502 | } |
508 | 503 | ||
509 | if (info->tty) | 504 | if (info->port.tty) |
510 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 505 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
511 | 506 | ||
512 | info->flags &= ~S_INITIALIZED; | 507 | info->flags &= ~S_INITIALIZED; |
513 | local_irq_restore(flags); | 508 | local_irq_restore(flags); |
@@ -573,9 +568,9 @@ static void change_speed(struct m68k_serial *info) | |||
573 | unsigned cflag; | 568 | unsigned cflag; |
574 | int i; | 569 | int i; |
575 | 570 | ||
576 | if (!info->tty || !info->tty->termios) | 571 | if (!info->port.tty || !info->port.tty->termios) |
577 | return; | 572 | return; |
578 | cflag = info->tty->termios->c_cflag; | 573 | cflag = info->port.tty->termios->c_cflag; |
579 | if (!(port = info->port)) | 574 | if (!(port = info->port)) |
580 | return; | 575 | return; |
581 | 576 | ||
@@ -1131,7 +1126,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1131 | tty_ldisc_flush(tty); | 1126 | tty_ldisc_flush(tty); |
1132 | tty->closing = 0; | 1127 | tty->closing = 0; |
1133 | info->event = 0; | 1128 | info->event = 0; |
1134 | info->tty = 0; | 1129 | info->port.tty = NULL; |
1135 | #warning "This is not and has never been valid so fix it" | 1130 | #warning "This is not and has never been valid so fix it" |
1136 | #if 0 | 1131 | #if 0 |
1137 | if (tty->ldisc.num != ldiscs[N_TTY].num) { | 1132 | if (tty->ldisc.num != ldiscs[N_TTY].num) { |
@@ -1169,7 +1164,7 @@ void rs_hangup(struct tty_struct *tty) | |||
1169 | info->event = 0; | 1164 | info->event = 0; |
1170 | info->count = 0; | 1165 | info->count = 0; |
1171 | info->flags &= ~S_NORMAL_ACTIVE; | 1166 | info->flags &= ~S_NORMAL_ACTIVE; |
1172 | info->tty = 0; | 1167 | info->port.tty = NULL; |
1173 | wake_up_interruptible(&info->open_wait); | 1168 | wake_up_interruptible(&info->open_wait); |
1174 | } | 1169 | } |
1175 | 1170 | ||
@@ -1286,7 +1281,7 @@ int rs_open(struct tty_struct *tty, struct file * filp) | |||
1286 | 1281 | ||
1287 | info->count++; | 1282 | info->count++; |
1288 | tty->driver_data = info; | 1283 | tty->driver_data = info; |
1289 | info->tty = tty; | 1284 | info->port.tty = tty; |
1290 | 1285 | ||
1291 | /* | 1286 | /* |
1292 | * Start up serial port | 1287 | * Start up serial port |
@@ -1363,7 +1358,7 @@ rs68328_init(void) | |||
1363 | info = &m68k_soft[i]; | 1358 | info = &m68k_soft[i]; |
1364 | info->magic = SERIAL_MAGIC; | 1359 | info->magic = SERIAL_MAGIC; |
1365 | info->port = (int) &uart_addr[i]; | 1360 | info->port = (int) &uart_addr[i]; |
1366 | info->tty = 0; | 1361 | info->port.tty = NULL; |
1367 | info->irq = uart_irqs[i]; | 1362 | info->irq = uart_irqs[i]; |
1368 | info->custom_divisor = 16; | 1363 | info->custom_divisor = 16; |
1369 | info->close_delay = 50; | 1364 | info->close_delay = 50; |
@@ -1383,8 +1378,6 @@ rs68328_init(void) | |||
1383 | info->port, info->irq); | 1378 | info->port, info->irq); |
1384 | printk(" is a builtin MC68328 UART\n"); | 1379 | printk(" is a builtin MC68328 UART\n"); |
1385 | 1380 | ||
1386 | IRQ_ports[info->irq] = info; /* waste of space */ | ||
1387 | |||
1388 | #ifdef CONFIG_M68VZ328 | 1381 | #ifdef CONFIG_M68VZ328 |
1389 | if (i > 0 ) | 1382 | if (i > 0 ) |
1390 | PJSEL &= 0xCF; /* PSW enable second port output */ | 1383 | PJSEL &= 0xCF; /* PSW enable second port output */ |
@@ -1393,7 +1386,7 @@ rs68328_init(void) | |||
1393 | if (request_irq(uart_irqs[i], | 1386 | if (request_irq(uart_irqs[i], |
1394 | rs_interrupt, | 1387 | rs_interrupt, |
1395 | IRQF_DISABLED, | 1388 | IRQF_DISABLED, |
1396 | "M68328_UART", NULL)) | 1389 | "M68328_UART", info)) |
1397 | panic("Unable to attach 68328 serial interrupt\n"); | 1390 | panic("Unable to attach 68328 serial interrupt\n"); |
1398 | } | 1391 | } |
1399 | local_irq_restore(flags); | 1392 | local_irq_restore(flags); |
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index d9d4e9552a4d..24661cd5e4fb 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c | |||
@@ -393,7 +393,7 @@ static void rs_360_start(struct tty_struct *tty) | |||
393 | 393 | ||
394 | static _INLINE_ void receive_chars(ser_info_t *info) | 394 | static _INLINE_ void receive_chars(ser_info_t *info) |
395 | { | 395 | { |
396 | struct tty_struct *tty = info->tty; | 396 | struct tty_struct *tty = info->port.tty; |
397 | unsigned char ch, flag, *cp; | 397 | unsigned char ch, flag, *cp; |
398 | /*int ignored = 0;*/ | 398 | /*int ignored = 0;*/ |
399 | int i; | 399 | int i; |
@@ -514,7 +514,7 @@ static _INLINE_ void receive_chars(ser_info_t *info) | |||
514 | 514 | ||
515 | static _INLINE_ void receive_break(ser_info_t *info) | 515 | static _INLINE_ void receive_break(ser_info_t *info) |
516 | { | 516 | { |
517 | struct tty_struct *tty = info->tty; | 517 | struct tty_struct *tty = info->port.tty; |
518 | 518 | ||
519 | info->state->icount.brk++; | 519 | info->state->icount.brk++; |
520 | /* Check to see if there is room in the tty buffer for | 520 | /* Check to see if there is room in the tty buffer for |
@@ -528,7 +528,7 @@ static _INLINE_ void transmit_chars(ser_info_t *info) | |||
528 | { | 528 | { |
529 | 529 | ||
530 | if ((info->flags & TX_WAKEUP) || | 530 | if ((info->flags & TX_WAKEUP) || |
531 | (info->tty->flags & (1 << TTY_DO_WRITE_WAKEUP))) { | 531 | (info->port.tty->flags & (1 << TTY_DO_WRITE_WAKEUP))) { |
532 | schedule_work(&info->tqueue); | 532 | schedule_work(&info->tqueue); |
533 | } | 533 | } |
534 | 534 | ||
@@ -584,12 +584,12 @@ static _INLINE_ void check_modem_status(struct async_struct *info) | |||
584 | } | 584 | } |
585 | } | 585 | } |
586 | if (info->flags & ASYNC_CTS_FLOW) { | 586 | if (info->flags & ASYNC_CTS_FLOW) { |
587 | if (info->tty->hw_stopped) { | 587 | if (info->port.tty->hw_stopped) { |
588 | if (status & UART_MSR_CTS) { | 588 | if (status & UART_MSR_CTS) { |
589 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) | 589 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) |
590 | printk("CTS tx start..."); | 590 | printk("CTS tx start..."); |
591 | #endif | 591 | #endif |
592 | info->tty->hw_stopped = 0; | 592 | info->port.tty->hw_stopped = 0; |
593 | info->IER |= UART_IER_THRI; | 593 | info->IER |= UART_IER_THRI; |
594 | serial_out(info, UART_IER, info->IER); | 594 | serial_out(info, UART_IER, info->IER); |
595 | rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); | 595 | rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); |
@@ -600,7 +600,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info) | |||
600 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) | 600 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) |
601 | printk("CTS tx stop..."); | 601 | printk("CTS tx stop..."); |
602 | #endif | 602 | #endif |
603 | info->tty->hw_stopped = 1; | 603 | info->port.tty->hw_stopped = 1; |
604 | info->IER &= ~UART_IER_THRI; | 604 | info->IER &= ~UART_IER_THRI; |
605 | serial_out(info, UART_IER, info->IER); | 605 | serial_out(info, UART_IER, info->IER); |
606 | } | 606 | } |
@@ -670,7 +670,7 @@ static void do_softint(void *private_) | |||
670 | ser_info_t *info = (ser_info_t *) private_; | 670 | ser_info_t *info = (ser_info_t *) private_; |
671 | struct tty_struct *tty; | 671 | struct tty_struct *tty; |
672 | 672 | ||
673 | tty = info->tty; | 673 | tty = info->port.tty; |
674 | if (!tty) | 674 | if (!tty) |
675 | return; | 675 | return; |
676 | 676 | ||
@@ -693,7 +693,7 @@ static void do_serial_hangup(void *private_) | |||
693 | struct async_struct *info = (struct async_struct *) private_; | 693 | struct async_struct *info = (struct async_struct *) private_; |
694 | struct tty_struct *tty; | 694 | struct tty_struct *tty; |
695 | 695 | ||
696 | tty = info->tty; | 696 | tty = info->port.tty; |
697 | if (!tty) | 697 | if (!tty) |
698 | return; | 698 | return; |
699 | 699 | ||
@@ -721,8 +721,8 @@ static int startup(ser_info_t *info) | |||
721 | 721 | ||
722 | #ifdef maybe | 722 | #ifdef maybe |
723 | if (!state->port || !state->type) { | 723 | if (!state->port || !state->type) { |
724 | if (info->tty) | 724 | if (info->port.tty) |
725 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 725 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
726 | goto errout; | 726 | goto errout; |
727 | } | 727 | } |
728 | #endif | 728 | #endif |
@@ -734,12 +734,12 @@ static int startup(ser_info_t *info) | |||
734 | 734 | ||
735 | #ifdef modem_control | 735 | #ifdef modem_control |
736 | info->MCR = 0; | 736 | info->MCR = 0; |
737 | if (info->tty->termios->c_cflag & CBAUD) | 737 | if (info->port.tty->termios->c_cflag & CBAUD) |
738 | info->MCR = UART_MCR_DTR | UART_MCR_RTS; | 738 | info->MCR = UART_MCR_DTR | UART_MCR_RTS; |
739 | #endif | 739 | #endif |
740 | 740 | ||
741 | if (info->tty) | 741 | if (info->port.tty) |
742 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 742 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
743 | 743 | ||
744 | /* | 744 | /* |
745 | * and set the speed of the serial port | 745 | * and set the speed of the serial port |
@@ -842,8 +842,8 @@ static void shutdown(ser_info_t *info) | |||
842 | smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); | 842 | smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); |
843 | } | 843 | } |
844 | 844 | ||
845 | if (info->tty) | 845 | if (info->port.tty) |
846 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 846 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
847 | 847 | ||
848 | info->flags &= ~ASYNC_INITIALIZED; | 848 | info->flags &= ~ASYNC_INITIALIZED; |
849 | local_irq_restore(flags); | 849 | local_irq_restore(flags); |
@@ -863,9 +863,9 @@ static void change_speed(ser_info_t *info) | |||
863 | volatile struct smc_regs *smcp; | 863 | volatile struct smc_regs *smcp; |
864 | volatile struct scc_regs *sccp; | 864 | volatile struct scc_regs *sccp; |
865 | 865 | ||
866 | if (!info->tty || !info->tty->termios) | 866 | if (!info->port.tty || !info->port.tty->termios) |
867 | return; | 867 | return; |
868 | cflag = info->tty->termios->c_cflag; | 868 | cflag = info->port.tty->termios->c_cflag; |
869 | 869 | ||
870 | state = info->state; | 870 | state = info->state; |
871 | 871 | ||
@@ -936,24 +936,24 @@ static void change_speed(ser_info_t *info) | |||
936 | * Set up parity check flag | 936 | * Set up parity check flag |
937 | */ | 937 | */ |
938 | info->read_status_mask = (BD_SC_EMPTY | BD_SC_OV); | 938 | info->read_status_mask = (BD_SC_EMPTY | BD_SC_OV); |
939 | if (I_INPCK(info->tty)) | 939 | if (I_INPCK(info->port.tty)) |
940 | info->read_status_mask |= BD_SC_FR | BD_SC_PR; | 940 | info->read_status_mask |= BD_SC_FR | BD_SC_PR; |
941 | if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) | 941 | if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) |
942 | info->read_status_mask |= BD_SC_BR; | 942 | info->read_status_mask |= BD_SC_BR; |
943 | 943 | ||
944 | /* | 944 | /* |
945 | * Characters to ignore | 945 | * Characters to ignore |
946 | */ | 946 | */ |
947 | info->ignore_status_mask = 0; | 947 | info->ignore_status_mask = 0; |
948 | if (I_IGNPAR(info->tty)) | 948 | if (I_IGNPAR(info->port.tty)) |
949 | info->ignore_status_mask |= BD_SC_PR | BD_SC_FR; | 949 | info->ignore_status_mask |= BD_SC_PR | BD_SC_FR; |
950 | if (I_IGNBRK(info->tty)) { | 950 | if (I_IGNBRK(info->port.tty)) { |
951 | info->ignore_status_mask |= BD_SC_BR; | 951 | info->ignore_status_mask |= BD_SC_BR; |
952 | /* | 952 | /* |
953 | * If we're ignore parity and break indicators, ignore | 953 | * If we're ignore parity and break indicators, ignore |
954 | * overruns too. (For real raw support). | 954 | * overruns too. (For real raw support). |
955 | */ | 955 | */ |
956 | if (I_IGNPAR(info->tty)) | 956 | if (I_IGNPAR(info->port.tty)) |
957 | info->ignore_status_mask |= BD_SC_OV; | 957 | info->ignore_status_mask |= BD_SC_OV; |
958 | } | 958 | } |
959 | /* | 959 | /* |
@@ -1658,7 +1658,7 @@ static void rs_360_close(struct tty_struct *tty, struct file * filp) | |||
1658 | tty_ldisc_flush(tty); | 1658 | tty_ldisc_flush(tty); |
1659 | tty->closing = 0; | 1659 | tty->closing = 0; |
1660 | info->event = 0; | 1660 | info->event = 0; |
1661 | info->tty = 0; | 1661 | info->port.tty = NULL; |
1662 | if (info->blocked_open) { | 1662 | if (info->blocked_open) { |
1663 | if (info->close_delay) { | 1663 | if (info->close_delay) { |
1664 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 1664 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); |
@@ -1758,7 +1758,7 @@ static void rs_360_hangup(struct tty_struct *tty) | |||
1758 | info->event = 0; | 1758 | info->event = 0; |
1759 | state->count = 0; | 1759 | state->count = 0; |
1760 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 1760 | info->flags &= ~ASYNC_NORMAL_ACTIVE; |
1761 | info->tty = 0; | 1761 | info->port.tty = NULL; |
1762 | wake_up_interruptible(&info->open_wait); | 1762 | wake_up_interruptible(&info->open_wait); |
1763 | } | 1763 | } |
1764 | 1764 | ||
@@ -1919,7 +1919,7 @@ static int rs_360_open(struct tty_struct *tty, struct file * filp) | |||
1919 | printk("rs_open %s, count = %d\n", tty->name, info->state->count); | 1919 | printk("rs_open %s, count = %d\n", tty->name, info->state->count); |
1920 | #endif | 1920 | #endif |
1921 | tty->driver_data = info; | 1921 | tty->driver_data = info; |
1922 | info->tty = tty; | 1922 | info->port.tty = tty; |
1923 | 1923 | ||
1924 | /* | 1924 | /* |
1925 | * Start up serial port | 1925 | * Start up serial port |
@@ -1976,7 +1976,7 @@ static inline int line_info(char *buf, struct serial_state *state) | |||
1976 | info->port = state->port; | 1976 | info->port = state->port; |
1977 | info->flags = state->flags; | 1977 | info->flags = state->flags; |
1978 | info->quot = 0; | 1978 | info->quot = 0; |
1979 | info->tty = 0; | 1979 | info->port.tty = NULL; |
1980 | } | 1980 | } |
1981 | local_irq_disable(); | 1981 | local_irq_disable(); |
1982 | status = serial_in(info, UART_MSR); | 1982 | status = serial_in(info, UART_MSR); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index be95e55b228b..303272af386e 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -12,8 +12,6 @@ | |||
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | * (at your option) any later version. | 13 | * (at your option) any later version. |
14 | * | 14 | * |
15 | * $Id: 8250.c,v 1.90 2002/07/28 10:03:27 rmk Exp $ | ||
16 | * | ||
17 | * A note about mapbase / membase | 15 | * A note about mapbase / membase |
18 | * | 16 | * |
19 | * mapbase is the physical address of the IO port. | 17 | * mapbase is the physical address of the IO port. |
@@ -46,6 +44,10 @@ | |||
46 | 44 | ||
47 | #include "8250.h" | 45 | #include "8250.h" |
48 | 46 | ||
47 | #ifdef CONFIG_SPARC | ||
48 | #include "suncore.h" | ||
49 | #endif | ||
50 | |||
49 | /* | 51 | /* |
50 | * Configuration: | 52 | * Configuration: |
51 | * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option | 53 | * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option |
@@ -55,6 +57,13 @@ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS; | |||
55 | 57 | ||
56 | static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; | 58 | static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; |
57 | 59 | ||
60 | static struct uart_driver serial8250_reg; | ||
61 | |||
62 | static int serial_index(struct uart_port *port) | ||
63 | { | ||
64 | return (serial8250_reg.minor - 64) + port->line; | ||
65 | } | ||
66 | |||
58 | /* | 67 | /* |
59 | * Debugging. | 68 | * Debugging. |
60 | */ | 69 | */ |
@@ -147,11 +156,15 @@ struct uart_8250_port { | |||
147 | }; | 156 | }; |
148 | 157 | ||
149 | struct irq_info { | 158 | struct irq_info { |
150 | spinlock_t lock; | 159 | struct hlist_node node; |
160 | int irq; | ||
161 | spinlock_t lock; /* Protects list not the hash */ | ||
151 | struct list_head *head; | 162 | struct list_head *head; |
152 | }; | 163 | }; |
153 | 164 | ||
154 | static struct irq_info irq_lists[NR_IRQS]; | 165 | #define NR_IRQ_HASH 32 /* Can be adjusted later */ |
166 | static struct hlist_head irq_lists[NR_IRQ_HASH]; | ||
167 | static DEFINE_MUTEX(hash_mutex); /* Used to walk the hash */ | ||
155 | 168 | ||
156 | /* | 169 | /* |
157 | * Here we define the default xmit fifo size used for each type of UART. | 170 | * Here we define the default xmit fifo size used for each type of UART. |
@@ -538,7 +551,7 @@ static unsigned int serial_icr_read(struct uart_8250_port *up, int offset) | |||
538 | /* | 551 | /* |
539 | * FIFO support. | 552 | * FIFO support. |
540 | */ | 553 | */ |
541 | static inline void serial8250_clear_fifos(struct uart_8250_port *p) | 554 | static void serial8250_clear_fifos(struct uart_8250_port *p) |
542 | { | 555 | { |
543 | if (p->capabilities & UART_CAP_FIFO) { | 556 | if (p->capabilities & UART_CAP_FIFO) { |
544 | serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO); | 557 | serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO); |
@@ -553,7 +566,7 @@ static inline void serial8250_clear_fifos(struct uart_8250_port *p) | |||
553 | * capability" bit enabled. Note that on XR16C850s, we need to | 566 | * capability" bit enabled. Note that on XR16C850s, we need to |
554 | * reset LCR to write to IER. | 567 | * reset LCR to write to IER. |
555 | */ | 568 | */ |
556 | static inline void serial8250_set_sleep(struct uart_8250_port *p, int sleep) | 569 | static void serial8250_set_sleep(struct uart_8250_port *p, int sleep) |
557 | { | 570 | { |
558 | if (p->capabilities & UART_CAP_SLEEP) { | 571 | if (p->capabilities & UART_CAP_SLEEP) { |
559 | if (p->capabilities & UART_CAP_EFR) { | 572 | if (p->capabilities & UART_CAP_EFR) { |
@@ -995,7 +1008,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) | |||
995 | return; | 1008 | return; |
996 | 1009 | ||
997 | DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ", | 1010 | DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%p): ", |
998 | up->port.line, up->port.iobase, up->port.membase); | 1011 | serial_index(&up->port), up->port.iobase, up->port.membase); |
999 | 1012 | ||
1000 | /* | 1013 | /* |
1001 | * We really do need global IRQs disabled here - we're going to | 1014 | * We really do need global IRQs disabled here - we're going to |
@@ -1130,8 +1143,8 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags) | |||
1130 | if (up->capabilities != uart_config[up->port.type].flags) { | 1143 | if (up->capabilities != uart_config[up->port.type].flags) { |
1131 | printk(KERN_WARNING | 1144 | printk(KERN_WARNING |
1132 | "ttyS%d: detected caps %08x should be %08x\n", | 1145 | "ttyS%d: detected caps %08x should be %08x\n", |
1133 | up->port.line, up->capabilities, | 1146 | serial_index(&up->port), up->capabilities, |
1134 | uart_config[up->port.type].flags); | 1147 | uart_config[up->port.type].flags); |
1135 | } | 1148 | } |
1136 | 1149 | ||
1137 | up->port.fifosize = uart_config[up->port.type].fifo_size; | 1150 | up->port.fifosize = uart_config[up->port.type].fifo_size; |
@@ -1289,13 +1302,24 @@ static void serial8250_enable_ms(struct uart_port *port) | |||
1289 | static void | 1302 | static void |
1290 | receive_chars(struct uart_8250_port *up, unsigned int *status) | 1303 | receive_chars(struct uart_8250_port *up, unsigned int *status) |
1291 | { | 1304 | { |
1292 | struct tty_struct *tty = up->port.info->tty; | 1305 | struct tty_struct *tty = up->port.info->port.tty; |
1293 | unsigned char ch, lsr = *status; | 1306 | unsigned char ch, lsr = *status; |
1294 | int max_count = 256; | 1307 | int max_count = 256; |
1295 | char flag; | 1308 | char flag; |
1296 | 1309 | ||
1297 | do { | 1310 | do { |
1298 | ch = serial_inp(up, UART_RX); | 1311 | if (likely(lsr & UART_LSR_DR)) |
1312 | ch = serial_inp(up, UART_RX); | ||
1313 | else | ||
1314 | /* | ||
1315 | * Intel 82571 has a Serial Over Lan device that will | ||
1316 | * set UART_LSR_BI without setting UART_LSR_DR when | ||
1317 | * it receives a break. To avoid reading from the | ||
1318 | * receive buffer without UART_LSR_DR bit set, we | ||
1319 | * just force the read character to be 0 | ||
1320 | */ | ||
1321 | ch = 0; | ||
1322 | |||
1299 | flag = TTY_NORMAL; | 1323 | flag = TTY_NORMAL; |
1300 | up->port.icount.rx++; | 1324 | up->port.icount.rx++; |
1301 | 1325 | ||
@@ -1344,7 +1368,7 @@ receive_chars(struct uart_8250_port *up, unsigned int *status) | |||
1344 | 1368 | ||
1345 | ignore_char: | 1369 | ignore_char: |
1346 | lsr = serial_inp(up, UART_LSR); | 1370 | lsr = serial_inp(up, UART_LSR); |
1347 | } while ((lsr & UART_LSR_DR) && (max_count-- > 0)); | 1371 | } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0)); |
1348 | spin_unlock(&up->port.lock); | 1372 | spin_unlock(&up->port.lock); |
1349 | tty_flip_buffer_push(tty); | 1373 | tty_flip_buffer_push(tty); |
1350 | spin_lock(&up->port.lock); | 1374 | spin_lock(&up->port.lock); |
@@ -1415,8 +1439,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up) | |||
1415 | /* | 1439 | /* |
1416 | * This handles the interrupt from one port. | 1440 | * This handles the interrupt from one port. |
1417 | */ | 1441 | */ |
1418 | static inline void | 1442 | static void serial8250_handle_port(struct uart_8250_port *up) |
1419 | serial8250_handle_port(struct uart_8250_port *up) | ||
1420 | { | 1443 | { |
1421 | unsigned int status; | 1444 | unsigned int status; |
1422 | unsigned long flags; | 1445 | unsigned long flags; |
@@ -1427,7 +1450,7 @@ serial8250_handle_port(struct uart_8250_port *up) | |||
1427 | 1450 | ||
1428 | DEBUG_INTR("status = %x...", status); | 1451 | DEBUG_INTR("status = %x...", status); |
1429 | 1452 | ||
1430 | if (status & UART_LSR_DR) | 1453 | if (status & (UART_LSR_DR | UART_LSR_BI)) |
1431 | receive_chars(up, &status); | 1454 | receive_chars(up, &status); |
1432 | check_modem_status(up); | 1455 | check_modem_status(up); |
1433 | if (status & UART_LSR_THRE) | 1456 | if (status & UART_LSR_THRE) |
@@ -1526,15 +1549,43 @@ static void serial_do_unlink(struct irq_info *i, struct uart_8250_port *up) | |||
1526 | BUG_ON(i->head != &up->list); | 1549 | BUG_ON(i->head != &up->list); |
1527 | i->head = NULL; | 1550 | i->head = NULL; |
1528 | } | 1551 | } |
1529 | |||
1530 | spin_unlock_irq(&i->lock); | 1552 | spin_unlock_irq(&i->lock); |
1553 | /* List empty so throw away the hash node */ | ||
1554 | if (i->head == NULL) { | ||
1555 | hlist_del(&i->node); | ||
1556 | kfree(i); | ||
1557 | } | ||
1531 | } | 1558 | } |
1532 | 1559 | ||
1533 | static int serial_link_irq_chain(struct uart_8250_port *up) | 1560 | static int serial_link_irq_chain(struct uart_8250_port *up) |
1534 | { | 1561 | { |
1535 | struct irq_info *i = irq_lists + up->port.irq; | 1562 | struct hlist_head *h; |
1563 | struct hlist_node *n; | ||
1564 | struct irq_info *i; | ||
1536 | int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0; | 1565 | int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0; |
1537 | 1566 | ||
1567 | mutex_lock(&hash_mutex); | ||
1568 | |||
1569 | h = &irq_lists[up->port.irq % NR_IRQ_HASH]; | ||
1570 | |||
1571 | hlist_for_each(n, h) { | ||
1572 | i = hlist_entry(n, struct irq_info, node); | ||
1573 | if (i->irq == up->port.irq) | ||
1574 | break; | ||
1575 | } | ||
1576 | |||
1577 | if (n == NULL) { | ||
1578 | i = kzalloc(sizeof(struct irq_info), GFP_KERNEL); | ||
1579 | if (i == NULL) { | ||
1580 | mutex_unlock(&hash_mutex); | ||
1581 | return -ENOMEM; | ||
1582 | } | ||
1583 | spin_lock_init(&i->lock); | ||
1584 | i->irq = up->port.irq; | ||
1585 | hlist_add_head(&i->node, h); | ||
1586 | } | ||
1587 | mutex_unlock(&hash_mutex); | ||
1588 | |||
1538 | spin_lock_irq(&i->lock); | 1589 | spin_lock_irq(&i->lock); |
1539 | 1590 | ||
1540 | if (i->head) { | 1591 | if (i->head) { |
@@ -1558,14 +1609,28 @@ static int serial_link_irq_chain(struct uart_8250_port *up) | |||
1558 | 1609 | ||
1559 | static void serial_unlink_irq_chain(struct uart_8250_port *up) | 1610 | static void serial_unlink_irq_chain(struct uart_8250_port *up) |
1560 | { | 1611 | { |
1561 | struct irq_info *i = irq_lists + up->port.irq; | 1612 | struct irq_info *i; |
1613 | struct hlist_node *n; | ||
1614 | struct hlist_head *h; | ||
1562 | 1615 | ||
1616 | mutex_lock(&hash_mutex); | ||
1617 | |||
1618 | h = &irq_lists[up->port.irq % NR_IRQ_HASH]; | ||
1619 | |||
1620 | hlist_for_each(n, h) { | ||
1621 | i = hlist_entry(n, struct irq_info, node); | ||
1622 | if (i->irq == up->port.irq) | ||
1623 | break; | ||
1624 | } | ||
1625 | |||
1626 | BUG_ON(n == NULL); | ||
1563 | BUG_ON(i->head == NULL); | 1627 | BUG_ON(i->head == NULL); |
1564 | 1628 | ||
1565 | if (list_empty(i->head)) | 1629 | if (list_empty(i->head)) |
1566 | free_irq(up->port.irq, i); | 1630 | free_irq(up->port.irq, i); |
1567 | 1631 | ||
1568 | serial_do_unlink(i, up); | 1632 | serial_do_unlink(i, up); |
1633 | mutex_unlock(&hash_mutex); | ||
1569 | } | 1634 | } |
1570 | 1635 | ||
1571 | /* Base timer interval for polling */ | 1636 | /* Base timer interval for polling */ |
@@ -1710,7 +1775,7 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state) | |||
1710 | /* | 1775 | /* |
1711 | * Wait for transmitter & holding register to empty | 1776 | * Wait for transmitter & holding register to empty |
1712 | */ | 1777 | */ |
1713 | static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) | 1778 | static void wait_for_xmitr(struct uart_8250_port *up, int bits) |
1714 | { | 1779 | { |
1715 | unsigned int status, tmout = 10000; | 1780 | unsigned int status, tmout = 10000; |
1716 | 1781 | ||
@@ -1845,7 +1910,8 @@ static int serial8250_startup(struct uart_port *port) | |||
1845 | */ | 1910 | */ |
1846 | if (!(up->port.flags & UPF_BUGGY_UART) && | 1911 | if (!(up->port.flags & UPF_BUGGY_UART) && |
1847 | (serial_inp(up, UART_LSR) == 0xff)) { | 1912 | (serial_inp(up, UART_LSR) == 0xff)) { |
1848 | printk("ttyS%d: LSR safety check engaged!\n", up->port.line); | 1913 | printk(KERN_INFO "ttyS%d: LSR safety check engaged!\n", |
1914 | serial_index(&up->port)); | ||
1849 | return -ENODEV; | 1915 | return -ENODEV; |
1850 | } | 1916 | } |
1851 | 1917 | ||
@@ -1877,6 +1943,8 @@ static int serial8250_startup(struct uart_port *port) | |||
1877 | * allow register changes to become visible. | 1943 | * allow register changes to become visible. |
1878 | */ | 1944 | */ |
1879 | spin_lock_irqsave(&up->port.lock, flags); | 1945 | spin_lock_irqsave(&up->port.lock, flags); |
1946 | if (up->port.flags & UPF_SHARE_IRQ) | ||
1947 | disable_irq_nosync(up->port.irq); | ||
1880 | 1948 | ||
1881 | wait_for_xmitr(up, UART_LSR_THRE); | 1949 | wait_for_xmitr(up, UART_LSR_THRE); |
1882 | serial_out_sync(up, UART_IER, UART_IER_THRI); | 1950 | serial_out_sync(up, UART_IER, UART_IER_THRI); |
@@ -1888,6 +1956,8 @@ static int serial8250_startup(struct uart_port *port) | |||
1888 | iir = serial_in(up, UART_IIR); | 1956 | iir = serial_in(up, UART_IIR); |
1889 | serial_out(up, UART_IER, 0); | 1957 | serial_out(up, UART_IER, 0); |
1890 | 1958 | ||
1959 | if (up->port.flags & UPF_SHARE_IRQ) | ||
1960 | enable_irq(up->port.irq); | ||
1891 | spin_unlock_irqrestore(&up->port.lock, flags); | 1961 | spin_unlock_irqrestore(&up->port.lock, flags); |
1892 | 1962 | ||
1893 | /* | 1963 | /* |
@@ -1895,15 +1965,24 @@ static int serial8250_startup(struct uart_port *port) | |||
1895 | * kick the UART on a regular basis. | 1965 | * kick the UART on a regular basis. |
1896 | */ | 1966 | */ |
1897 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { | 1967 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { |
1898 | pr_debug("ttyS%d - using backup timer\n", port->line); | 1968 | up->bugs |= UART_BUG_THRE; |
1899 | up->timer.function = serial8250_backup_timeout; | 1969 | pr_debug("ttyS%d - using backup timer\n", |
1900 | up->timer.data = (unsigned long)up; | 1970 | serial_index(port)); |
1901 | mod_timer(&up->timer, jiffies + | ||
1902 | poll_timeout(up->port.timeout) + HZ / 5); | ||
1903 | } | 1971 | } |
1904 | } | 1972 | } |
1905 | 1973 | ||
1906 | /* | 1974 | /* |
1975 | * The above check will only give an accurate result the first time | ||
1976 | * the port is opened so this value needs to be preserved. | ||
1977 | */ | ||
1978 | if (up->bugs & UART_BUG_THRE) { | ||
1979 | up->timer.function = serial8250_backup_timeout; | ||
1980 | up->timer.data = (unsigned long)up; | ||
1981 | mod_timer(&up->timer, jiffies + | ||
1982 | poll_timeout(up->port.timeout) + HZ / 5); | ||
1983 | } | ||
1984 | |||
1985 | /* | ||
1907 | * If the "interrupt" for this port doesn't correspond with any | 1986 | * If the "interrupt" for this port doesn't correspond with any |
1908 | * hardware interrupt, we use a timer-based system. The original | 1987 | * hardware interrupt, we use a timer-based system. The original |
1909 | * driver used to do this with IRQ0. | 1988 | * driver used to do this with IRQ0. |
@@ -1948,7 +2027,7 @@ static int serial8250_startup(struct uart_port *port) | |||
1948 | if (!(up->bugs & UART_BUG_TXEN)) { | 2027 | if (!(up->bugs & UART_BUG_TXEN)) { |
1949 | up->bugs |= UART_BUG_TXEN; | 2028 | up->bugs |= UART_BUG_TXEN; |
1950 | pr_debug("ttyS%d - enabling bad tx status workarounds\n", | 2029 | pr_debug("ttyS%d - enabling bad tx status workarounds\n", |
1951 | port->line); | 2030 | serial_index(port)); |
1952 | } | 2031 | } |
1953 | } else { | 2032 | } else { |
1954 | up->bugs &= ~UART_BUG_TXEN; | 2033 | up->bugs &= ~UART_BUG_TXEN; |
@@ -2190,9 +2269,9 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2190 | serial_outp(up, UART_EFR, efr); | 2269 | serial_outp(up, UART_EFR, efr); |
2191 | } | 2270 | } |
2192 | 2271 | ||
2193 | #ifdef CONFIG_ARCH_OMAP15XX | 2272 | #ifdef CONFIG_ARCH_OMAP |
2194 | /* Workaround to enable 115200 baud on OMAP1510 internal ports */ | 2273 | /* Workaround to enable 115200 baud on OMAP1510 internal ports */ |
2195 | if (cpu_is_omap1510() && is_omap_port((unsigned int)up->port.membase)) { | 2274 | if (cpu_is_omap1510() && is_omap_port(up)) { |
2196 | if (baud == 115200) { | 2275 | if (baud == 115200) { |
2197 | quot = 1; | 2276 | quot = 1; |
2198 | serial_out(up, UART_OMAP_OSC_12M_SEL, 1); | 2277 | serial_out(up, UART_OMAP_OSC_12M_SEL, 1); |
@@ -2245,18 +2324,27 @@ serial8250_pm(struct uart_port *port, unsigned int state, | |||
2245 | p->pm(port, state, oldstate); | 2324 | p->pm(port, state, oldstate); |
2246 | } | 2325 | } |
2247 | 2326 | ||
2327 | static unsigned int serial8250_port_size(struct uart_8250_port *pt) | ||
2328 | { | ||
2329 | if (pt->port.iotype == UPIO_AU) | ||
2330 | return 0x100000; | ||
2331 | #ifdef CONFIG_ARCH_OMAP | ||
2332 | if (is_omap_port(pt)) | ||
2333 | return 0x16 << pt->port.regshift; | ||
2334 | #endif | ||
2335 | return 8 << pt->port.regshift; | ||
2336 | } | ||
2337 | |||
2248 | /* | 2338 | /* |
2249 | * Resource handling. | 2339 | * Resource handling. |
2250 | */ | 2340 | */ |
2251 | static int serial8250_request_std_resource(struct uart_8250_port *up) | 2341 | static int serial8250_request_std_resource(struct uart_8250_port *up) |
2252 | { | 2342 | { |
2253 | unsigned int size = 8 << up->port.regshift; | 2343 | unsigned int size = serial8250_port_size(up); |
2254 | int ret = 0; | 2344 | int ret = 0; |
2255 | 2345 | ||
2256 | switch (up->port.iotype) { | 2346 | switch (up->port.iotype) { |
2257 | case UPIO_AU: | 2347 | case UPIO_AU: |
2258 | size = 0x100000; | ||
2259 | /* fall thru */ | ||
2260 | case UPIO_TSI: | 2348 | case UPIO_TSI: |
2261 | case UPIO_MEM32: | 2349 | case UPIO_MEM32: |
2262 | case UPIO_MEM: | 2350 | case UPIO_MEM: |
@@ -2290,12 +2378,10 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) | |||
2290 | 2378 | ||
2291 | static void serial8250_release_std_resource(struct uart_8250_port *up) | 2379 | static void serial8250_release_std_resource(struct uart_8250_port *up) |
2292 | { | 2380 | { |
2293 | unsigned int size = 8 << up->port.regshift; | 2381 | unsigned int size = serial8250_port_size(up); |
2294 | 2382 | ||
2295 | switch (up->port.iotype) { | 2383 | switch (up->port.iotype) { |
2296 | case UPIO_AU: | 2384 | case UPIO_AU: |
2297 | size = 0x100000; | ||
2298 | /* fall thru */ | ||
2299 | case UPIO_TSI: | 2385 | case UPIO_TSI: |
2300 | case UPIO_MEM32: | 2386 | case UPIO_MEM32: |
2301 | case UPIO_MEM: | 2387 | case UPIO_MEM: |
@@ -2407,7 +2493,7 @@ static void serial8250_config_port(struct uart_port *port, int flags) | |||
2407 | static int | 2493 | static int |
2408 | serial8250_verify_port(struct uart_port *port, struct serial_struct *ser) | 2494 | serial8250_verify_port(struct uart_port *port, struct serial_struct *ser) |
2409 | { | 2495 | { |
2410 | if (ser->irq >= NR_IRQS || ser->irq < 0 || | 2496 | if (ser->irq >= nr_irqs || ser->irq < 0 || |
2411 | ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || | 2497 | ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || |
2412 | ser->type >= ARRAY_SIZE(uart_config) || ser->type == PORT_CIRRUS || | 2498 | ser->type >= ARRAY_SIZE(uart_config) || ser->type == PORT_CIRRUS || |
2413 | ser->type == PORT_STARTECH) | 2499 | ser->type == PORT_STARTECH) |
@@ -2609,7 +2695,6 @@ static int serial8250_console_early_setup(void) | |||
2609 | return serial8250_find_port_for_earlycon(); | 2695 | return serial8250_find_port_for_earlycon(); |
2610 | } | 2696 | } |
2611 | 2697 | ||
2612 | static struct uart_driver serial8250_reg; | ||
2613 | static struct console serial8250_console = { | 2698 | static struct console serial8250_console = { |
2614 | .name = "ttyS", | 2699 | .name = "ttyS", |
2615 | .write = serial8250_console_write, | 2700 | .write = serial8250_console_write, |
@@ -2656,7 +2741,6 @@ static struct uart_driver serial8250_reg = { | |||
2656 | .dev_name = "ttyS", | 2741 | .dev_name = "ttyS", |
2657 | .major = TTY_MAJOR, | 2742 | .major = TTY_MAJOR, |
2658 | .minor = 64, | 2743 | .minor = 64, |
2659 | .nr = UART_NR, | ||
2660 | .cons = SERIAL8250_CONSOLE, | 2744 | .cons = SERIAL8250_CONSOLE, |
2661 | }; | 2745 | }; |
2662 | 2746 | ||
@@ -2929,19 +3013,21 @@ EXPORT_SYMBOL(serial8250_unregister_port); | |||
2929 | 3013 | ||
2930 | static int __init serial8250_init(void) | 3014 | static int __init serial8250_init(void) |
2931 | { | 3015 | { |
2932 | int ret, i; | 3016 | int ret; |
2933 | 3017 | ||
2934 | if (nr_uarts > UART_NR) | 3018 | if (nr_uarts > UART_NR) |
2935 | nr_uarts = UART_NR; | 3019 | nr_uarts = UART_NR; |
2936 | 3020 | ||
2937 | printk(KERN_INFO "Serial: 8250/16550 driver $Revision: 1.90 $ " | 3021 | printk(KERN_INFO "Serial: 8250/16550 driver" |
2938 | "%d ports, IRQ sharing %sabled\n", nr_uarts, | 3022 | "%d ports, IRQ sharing %sabled\n", nr_uarts, |
2939 | share_irqs ? "en" : "dis"); | 3023 | share_irqs ? "en" : "dis"); |
2940 | 3024 | ||
2941 | for (i = 0; i < NR_IRQS; i++) | 3025 | #ifdef CONFIG_SPARC |
2942 | spin_lock_init(&irq_lists[i].lock); | 3026 | ret = sunserial_register_minors(&serial8250_reg, UART_NR); |
2943 | 3027 | #else | |
3028 | serial8250_reg.nr = UART_NR; | ||
2944 | ret = uart_register_driver(&serial8250_reg); | 3029 | ret = uart_register_driver(&serial8250_reg); |
3030 | #endif | ||
2945 | if (ret) | 3031 | if (ret) |
2946 | goto out; | 3032 | goto out; |
2947 | 3033 | ||
@@ -2963,11 +3049,15 @@ static int __init serial8250_init(void) | |||
2963 | goto out; | 3049 | goto out; |
2964 | 3050 | ||
2965 | platform_device_del(serial8250_isa_devs); | 3051 | platform_device_del(serial8250_isa_devs); |
2966 | put_dev: | 3052 | put_dev: |
2967 | platform_device_put(serial8250_isa_devs); | 3053 | platform_device_put(serial8250_isa_devs); |
2968 | unreg_uart_drv: | 3054 | unreg_uart_drv: |
3055 | #ifdef CONFIG_SPARC | ||
3056 | sunserial_unregister_minors(&serial8250_reg, UART_NR); | ||
3057 | #else | ||
2969 | uart_unregister_driver(&serial8250_reg); | 3058 | uart_unregister_driver(&serial8250_reg); |
2970 | out: | 3059 | #endif |
3060 | out: | ||
2971 | return ret; | 3061 | return ret; |
2972 | } | 3062 | } |
2973 | 3063 | ||
@@ -2985,7 +3075,11 @@ static void __exit serial8250_exit(void) | |||
2985 | platform_driver_unregister(&serial8250_isa_driver); | 3075 | platform_driver_unregister(&serial8250_isa_driver); |
2986 | platform_device_unregister(isa_dev); | 3076 | platform_device_unregister(isa_dev); |
2987 | 3077 | ||
3078 | #ifdef CONFIG_SPARC | ||
3079 | sunserial_unregister_minors(&serial8250_reg, UART_NR); | ||
3080 | #else | ||
2988 | uart_unregister_driver(&serial8250_reg); | 3081 | uart_unregister_driver(&serial8250_reg); |
3082 | #endif | ||
2989 | } | 3083 | } |
2990 | 3084 | ||
2991 | module_init(serial8250_init); | 3085 | module_init(serial8250_init); |
@@ -2995,7 +3089,7 @@ EXPORT_SYMBOL(serial8250_suspend_port); | |||
2995 | EXPORT_SYMBOL(serial8250_resume_port); | 3089 | EXPORT_SYMBOL(serial8250_resume_port); |
2996 | 3090 | ||
2997 | MODULE_LICENSE("GPL"); | 3091 | MODULE_LICENSE("GPL"); |
2998 | MODULE_DESCRIPTION("Generic 8250/16x50 serial driver $Revision: 1.90 $"); | 3092 | MODULE_DESCRIPTION("Generic 8250/16x50 serial driver"); |
2999 | 3093 | ||
3000 | module_param(share_irqs, uint, 0644); | 3094 | module_param(share_irqs, uint, 0644); |
3001 | MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices" | 3095 | MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices" |
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h index 91bd28f2bb47..520260326f3d 100644 --- a/drivers/serial/8250.h +++ b/drivers/serial/8250.h | |||
@@ -11,8 +11,6 @@ | |||
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | * (at your option) any later version. | 13 | * (at your option) any later version. |
14 | * | ||
15 | * $Id: 8250.h,v 1.8 2002/07/21 21:32:30 rmk Exp $ | ||
16 | */ | 14 | */ |
17 | 15 | ||
18 | #include <linux/serial_8250.h> | 16 | #include <linux/serial_8250.h> |
@@ -49,6 +47,7 @@ struct serial8250_config { | |||
49 | #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ | 47 | #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ |
50 | #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ | 48 | #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ |
51 | #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ | 49 | #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ |
50 | #define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */ | ||
52 | 51 | ||
53 | #define PROBE_RSA (1 << 0) | 52 | #define PROBE_RSA (1 << 0) |
54 | #define PROBE_ANY (~0) | 53 | #define PROBE_ANY (~0) |
diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c index 4eb7437a404a..418b4fe9a0a1 100644 --- a/drivers/serial/8250_gsc.c +++ b/drivers/serial/8250_gsc.c | |||
@@ -111,7 +111,7 @@ static struct parisc_driver serial_driver = { | |||
111 | .probe = serial_init_chip, | 111 | .probe = serial_init_chip, |
112 | }; | 112 | }; |
113 | 113 | ||
114 | int __init probe_serial_gsc(void) | 114 | static int __init probe_serial_gsc(void) |
115 | { | 115 | { |
116 | register_parisc_driver(&lasi_driver); | 116 | register_parisc_driver(&lasi_driver); |
117 | register_parisc_driver(&serial_driver); | 117 | register_parisc_driver(&serial_driver); |
@@ -119,3 +119,5 @@ int __init probe_serial_gsc(void) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | module_init(probe_serial_gsc); | 121 | module_init(probe_serial_gsc); |
122 | |||
123 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 788c3559522d..5450a0e5ecdb 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -10,8 +10,6 @@ | |||
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2 of the License. | 12 | * the Free Software Foundation; either version 2 of the License. |
13 | * | ||
14 | * $Id: 8250_pci.c,v 1.28 2002/11/02 11:14:18 rmk Exp $ | ||
15 | */ | 13 | */ |
16 | #include <linux/module.h> | 14 | #include <linux/module.h> |
17 | #include <linux/init.h> | 15 | #include <linux/init.h> |
@@ -769,6 +767,9 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board, | |||
769 | #define PCI_SUBDEVICE_ID_POCTAL232 0x0308 | 767 | #define PCI_SUBDEVICE_ID_POCTAL232 0x0308 |
770 | #define PCI_SUBDEVICE_ID_POCTAL422 0x0408 | 768 | #define PCI_SUBDEVICE_ID_POCTAL422 0x0408 |
771 | 769 | ||
770 | /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ | ||
771 | #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 | ||
772 | |||
772 | /* | 773 | /* |
773 | * Master list of serial port init/setup/exit quirks. | 774 | * Master list of serial port init/setup/exit quirks. |
774 | * This does not describe the general nature of the port. | 775 | * This does not describe the general nature of the port. |
@@ -884,6 +885,15 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
884 | }, | 885 | }, |
885 | { | 886 | { |
886 | .vendor = PCI_VENDOR_ID_PLX, | 887 | .vendor = PCI_VENDOR_ID_PLX, |
888 | .device = PCI_DEVICE_ID_PLX_9050, | ||
889 | .subvendor = PCI_VENDOR_ID_PLX, | ||
890 | .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584, | ||
891 | .init = pci_plx9050_init, | ||
892 | .setup = pci_default_setup, | ||
893 | .exit = __devexit_p(pci_plx9050_exit), | ||
894 | }, | ||
895 | { | ||
896 | .vendor = PCI_VENDOR_ID_PLX, | ||
887 | .device = PCI_DEVICE_ID_PLX_ROMULUS, | 897 | .device = PCI_DEVICE_ID_PLX_ROMULUS, |
888 | .subvendor = PCI_VENDOR_ID_PLX, | 898 | .subvendor = PCI_VENDOR_ID_PLX, |
889 | .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, | 899 | .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, |
@@ -1090,6 +1100,8 @@ enum pci_board_num_t { | |||
1090 | pbn_b0_4_1843200_200, | 1100 | pbn_b0_4_1843200_200, |
1091 | pbn_b0_8_1843200_200, | 1101 | pbn_b0_8_1843200_200, |
1092 | 1102 | ||
1103 | pbn_b0_1_4000000, | ||
1104 | |||
1093 | pbn_b0_bt_1_115200, | 1105 | pbn_b0_bt_1_115200, |
1094 | pbn_b0_bt_2_115200, | 1106 | pbn_b0_bt_2_115200, |
1095 | pbn_b0_bt_8_115200, | 1107 | pbn_b0_bt_8_115200, |
@@ -1157,6 +1169,10 @@ enum pci_board_num_t { | |||
1157 | pbn_exsys_4055, | 1169 | pbn_exsys_4055, |
1158 | pbn_plx_romulus, | 1170 | pbn_plx_romulus, |
1159 | pbn_oxsemi, | 1171 | pbn_oxsemi, |
1172 | pbn_oxsemi_1_4000000, | ||
1173 | pbn_oxsemi_2_4000000, | ||
1174 | pbn_oxsemi_4_4000000, | ||
1175 | pbn_oxsemi_8_4000000, | ||
1160 | pbn_intel_i960, | 1176 | pbn_intel_i960, |
1161 | pbn_sgi_ioc3, | 1177 | pbn_sgi_ioc3, |
1162 | pbn_computone_4, | 1178 | pbn_computone_4, |
@@ -1280,6 +1296,12 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
1280 | .base_baud = 1843200, | 1296 | .base_baud = 1843200, |
1281 | .uart_offset = 0x200, | 1297 | .uart_offset = 0x200, |
1282 | }, | 1298 | }, |
1299 | [pbn_b0_1_4000000] = { | ||
1300 | .flags = FL_BASE0, | ||
1301 | .num_ports = 1, | ||
1302 | .base_baud = 4000000, | ||
1303 | .uart_offset = 8, | ||
1304 | }, | ||
1283 | 1305 | ||
1284 | [pbn_b0_bt_1_115200] = { | 1306 | [pbn_b0_bt_1_115200] = { |
1285 | .flags = FL_BASE0|FL_BASE_BARS, | 1307 | .flags = FL_BASE0|FL_BASE_BARS, |
@@ -1615,6 +1637,35 @@ static struct pciserial_board pci_boards[] __devinitdata = { | |||
1615 | .base_baud = 115200, | 1637 | .base_baud = 115200, |
1616 | .uart_offset = 8, | 1638 | .uart_offset = 8, |
1617 | }, | 1639 | }, |
1640 | [pbn_oxsemi_1_4000000] = { | ||
1641 | .flags = FL_BASE0, | ||
1642 | .num_ports = 1, | ||
1643 | .base_baud = 4000000, | ||
1644 | .uart_offset = 0x200, | ||
1645 | .first_offset = 0x1000, | ||
1646 | }, | ||
1647 | [pbn_oxsemi_2_4000000] = { | ||
1648 | .flags = FL_BASE0, | ||
1649 | .num_ports = 2, | ||
1650 | .base_baud = 4000000, | ||
1651 | .uart_offset = 0x200, | ||
1652 | .first_offset = 0x1000, | ||
1653 | }, | ||
1654 | [pbn_oxsemi_4_4000000] = { | ||
1655 | .flags = FL_BASE0, | ||
1656 | .num_ports = 4, | ||
1657 | .base_baud = 4000000, | ||
1658 | .uart_offset = 0x200, | ||
1659 | .first_offset = 0x1000, | ||
1660 | }, | ||
1661 | [pbn_oxsemi_8_4000000] = { | ||
1662 | .flags = FL_BASE0, | ||
1663 | .num_ports = 8, | ||
1664 | .base_baud = 4000000, | ||
1665 | .uart_offset = 0x200, | ||
1666 | .first_offset = 0x1000, | ||
1667 | }, | ||
1668 | |||
1618 | 1669 | ||
1619 | /* | 1670 | /* |
1620 | * EKF addition for i960 Boards form EKF with serial port. | 1671 | * EKF addition for i960 Boards form EKF with serial port. |
@@ -1803,6 +1854,39 @@ serial_pci_matches(struct pciserial_board *board, | |||
1803 | board->first_offset == guessed->first_offset; | 1854 | board->first_offset == guessed->first_offset; |
1804 | } | 1855 | } |
1805 | 1856 | ||
1857 | /* | ||
1858 | * Oxford Semiconductor Inc. | ||
1859 | * Check that device is part of the Tornado range of devices, then determine | ||
1860 | * the number of ports available on the device. | ||
1861 | */ | ||
1862 | static int pci_oxsemi_tornado_init(struct pci_dev *dev, struct pciserial_board *board) | ||
1863 | { | ||
1864 | u8 __iomem *p; | ||
1865 | unsigned long deviceID; | ||
1866 | unsigned int number_uarts; | ||
1867 | |||
1868 | /* OxSemi Tornado devices are all 0xCxxx */ | ||
1869 | if (dev->vendor == PCI_VENDOR_ID_OXSEMI && | ||
1870 | (dev->device & 0xF000) != 0xC000) | ||
1871 | return 0; | ||
1872 | |||
1873 | p = pci_iomap(dev, 0, 5); | ||
1874 | if (p == NULL) | ||
1875 | return -ENOMEM; | ||
1876 | |||
1877 | deviceID = ioread32(p); | ||
1878 | /* Tornado device */ | ||
1879 | if (deviceID == 0x07000200) { | ||
1880 | number_uarts = ioread8(p + 4); | ||
1881 | board->num_ports = number_uarts; | ||
1882 | printk(KERN_DEBUG | ||
1883 | "%d ports detected on Oxford PCI Express device\n", | ||
1884 | number_uarts); | ||
1885 | } | ||
1886 | pci_iounmap(dev, p); | ||
1887 | return 0; | ||
1888 | } | ||
1889 | |||
1806 | struct serial_private * | 1890 | struct serial_private * |
1807 | pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) | 1891 | pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) |
1808 | { | 1892 | { |
@@ -1811,6 +1895,13 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board) | |||
1811 | struct pci_serial_quirk *quirk; | 1895 | struct pci_serial_quirk *quirk; |
1812 | int rc, nr_ports, i; | 1896 | int rc, nr_ports, i; |
1813 | 1897 | ||
1898 | /* | ||
1899 | * Find number of ports on board | ||
1900 | */ | ||
1901 | if (dev->vendor == PCI_VENDOR_ID_OXSEMI || | ||
1902 | dev->vendor == PCI_VENDOR_ID_MAINPINE) | ||
1903 | pci_oxsemi_tornado_init(dev, board); | ||
1904 | |||
1814 | nr_ports = board->num_ports; | 1905 | nr_ports = board->num_ports; |
1815 | 1906 | ||
1816 | /* | 1907 | /* |
@@ -2031,9 +2122,9 @@ static int pciserial_resume_one(struct pci_dev *dev) | |||
2031 | * The device may have been disabled. Re-enable it. | 2122 | * The device may have been disabled. Re-enable it. |
2032 | */ | 2123 | */ |
2033 | err = pci_enable_device(dev); | 2124 | err = pci_enable_device(dev); |
2125 | /* FIXME: We cannot simply error out here */ | ||
2034 | if (err) | 2126 | if (err) |
2035 | return err; | 2127 | printk(KERN_ERR "pciserial: Unable to re-enable ports, trying to continue.\n"); |
2036 | |||
2037 | pciserial_resume_ports(priv); | 2128 | pciserial_resume_ports(priv); |
2038 | } | 2129 | } |
2039 | return 0; | 2130 | return 0; |
@@ -2199,6 +2290,11 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
2199 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077, | 2290 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_1077, |
2200 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 2291 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
2201 | pbn_b2_4_921600 }, | 2292 | pbn_b2_4_921600 }, |
2293 | /* Unknown card - subdevice 0x1584 */ | ||
2294 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | ||
2295 | PCI_VENDOR_ID_PLX, | ||
2296 | PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0, | ||
2297 | pbn_b0_4_115200 }, | ||
2202 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | 2298 | { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, |
2203 | PCI_SUBVENDOR_ID_KEYSPAN, | 2299 | PCI_SUBVENDOR_ID_KEYSPAN, |
2204 | PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, | 2300 | PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, |
@@ -2286,6 +2382,156 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
2286 | pbn_b0_bt_2_921600 }, | 2382 | pbn_b0_bt_2_921600 }, |
2287 | 2383 | ||
2288 | /* | 2384 | /* |
2385 | * Oxford Semiconductor Inc. Tornado PCI express device range. | ||
2386 | */ | ||
2387 | { PCI_VENDOR_ID_OXSEMI, 0xc101, /* OXPCIe952 1 Legacy UART */ | ||
2388 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2389 | pbn_b0_1_4000000 }, | ||
2390 | { PCI_VENDOR_ID_OXSEMI, 0xc105, /* OXPCIe952 1 Legacy UART */ | ||
2391 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2392 | pbn_b0_1_4000000 }, | ||
2393 | { PCI_VENDOR_ID_OXSEMI, 0xc11b, /* OXPCIe952 1 Native UART */ | ||
2394 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2395 | pbn_oxsemi_1_4000000 }, | ||
2396 | { PCI_VENDOR_ID_OXSEMI, 0xc11f, /* OXPCIe952 1 Native UART */ | ||
2397 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2398 | pbn_oxsemi_1_4000000 }, | ||
2399 | { PCI_VENDOR_ID_OXSEMI, 0xc120, /* OXPCIe952 1 Legacy UART */ | ||
2400 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2401 | pbn_b0_1_4000000 }, | ||
2402 | { PCI_VENDOR_ID_OXSEMI, 0xc124, /* OXPCIe952 1 Legacy UART */ | ||
2403 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2404 | pbn_b0_1_4000000 }, | ||
2405 | { PCI_VENDOR_ID_OXSEMI, 0xc138, /* OXPCIe952 1 Native UART */ | ||
2406 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2407 | pbn_oxsemi_1_4000000 }, | ||
2408 | { PCI_VENDOR_ID_OXSEMI, 0xc13d, /* OXPCIe952 1 Native UART */ | ||
2409 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2410 | pbn_oxsemi_1_4000000 }, | ||
2411 | { PCI_VENDOR_ID_OXSEMI, 0xc140, /* OXPCIe952 1 Legacy UART */ | ||
2412 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2413 | pbn_b0_1_4000000 }, | ||
2414 | { PCI_VENDOR_ID_OXSEMI, 0xc141, /* OXPCIe952 1 Legacy UART */ | ||
2415 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2416 | pbn_b0_1_4000000 }, | ||
2417 | { PCI_VENDOR_ID_OXSEMI, 0xc144, /* OXPCIe952 1 Legacy UART */ | ||
2418 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2419 | pbn_b0_1_4000000 }, | ||
2420 | { PCI_VENDOR_ID_OXSEMI, 0xc145, /* OXPCIe952 1 Legacy UART */ | ||
2421 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2422 | pbn_b0_1_4000000 }, | ||
2423 | { PCI_VENDOR_ID_OXSEMI, 0xc158, /* OXPCIe952 2 Native UART */ | ||
2424 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2425 | pbn_oxsemi_2_4000000 }, | ||
2426 | { PCI_VENDOR_ID_OXSEMI, 0xc15d, /* OXPCIe952 2 Native UART */ | ||
2427 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2428 | pbn_oxsemi_2_4000000 }, | ||
2429 | { PCI_VENDOR_ID_OXSEMI, 0xc208, /* OXPCIe954 4 Native UART */ | ||
2430 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2431 | pbn_oxsemi_4_4000000 }, | ||
2432 | { PCI_VENDOR_ID_OXSEMI, 0xc20d, /* OXPCIe954 4 Native UART */ | ||
2433 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2434 | pbn_oxsemi_4_4000000 }, | ||
2435 | { PCI_VENDOR_ID_OXSEMI, 0xc308, /* OXPCIe958 8 Native UART */ | ||
2436 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2437 | pbn_oxsemi_8_4000000 }, | ||
2438 | { PCI_VENDOR_ID_OXSEMI, 0xc30d, /* OXPCIe958 8 Native UART */ | ||
2439 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2440 | pbn_oxsemi_8_4000000 }, | ||
2441 | { PCI_VENDOR_ID_OXSEMI, 0xc40b, /* OXPCIe200 1 Native UART */ | ||
2442 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2443 | pbn_oxsemi_1_4000000 }, | ||
2444 | { PCI_VENDOR_ID_OXSEMI, 0xc40f, /* OXPCIe200 1 Native UART */ | ||
2445 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2446 | pbn_oxsemi_1_4000000 }, | ||
2447 | { PCI_VENDOR_ID_OXSEMI, 0xc41b, /* OXPCIe200 1 Native UART */ | ||
2448 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2449 | pbn_oxsemi_1_4000000 }, | ||
2450 | { PCI_VENDOR_ID_OXSEMI, 0xc41f, /* OXPCIe200 1 Native UART */ | ||
2451 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2452 | pbn_oxsemi_1_4000000 }, | ||
2453 | { PCI_VENDOR_ID_OXSEMI, 0xc42b, /* OXPCIe200 1 Native UART */ | ||
2454 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2455 | pbn_oxsemi_1_4000000 }, | ||
2456 | { PCI_VENDOR_ID_OXSEMI, 0xc42f, /* OXPCIe200 1 Native UART */ | ||
2457 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2458 | pbn_oxsemi_1_4000000 }, | ||
2459 | { PCI_VENDOR_ID_OXSEMI, 0xc43b, /* OXPCIe200 1 Native UART */ | ||
2460 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2461 | pbn_oxsemi_1_4000000 }, | ||
2462 | { PCI_VENDOR_ID_OXSEMI, 0xc43f, /* OXPCIe200 1 Native UART */ | ||
2463 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2464 | pbn_oxsemi_1_4000000 }, | ||
2465 | { PCI_VENDOR_ID_OXSEMI, 0xc44b, /* OXPCIe200 1 Native UART */ | ||
2466 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2467 | pbn_oxsemi_1_4000000 }, | ||
2468 | { PCI_VENDOR_ID_OXSEMI, 0xc44f, /* OXPCIe200 1 Native UART */ | ||
2469 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2470 | pbn_oxsemi_1_4000000 }, | ||
2471 | { PCI_VENDOR_ID_OXSEMI, 0xc45b, /* OXPCIe200 1 Native UART */ | ||
2472 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2473 | pbn_oxsemi_1_4000000 }, | ||
2474 | { PCI_VENDOR_ID_OXSEMI, 0xc45f, /* OXPCIe200 1 Native UART */ | ||
2475 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2476 | pbn_oxsemi_1_4000000 }, | ||
2477 | { PCI_VENDOR_ID_OXSEMI, 0xc46b, /* OXPCIe200 1 Native UART */ | ||
2478 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2479 | pbn_oxsemi_1_4000000 }, | ||
2480 | { PCI_VENDOR_ID_OXSEMI, 0xc46f, /* OXPCIe200 1 Native UART */ | ||
2481 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2482 | pbn_oxsemi_1_4000000 }, | ||
2483 | { PCI_VENDOR_ID_OXSEMI, 0xc47b, /* OXPCIe200 1 Native UART */ | ||
2484 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2485 | pbn_oxsemi_1_4000000 }, | ||
2486 | { PCI_VENDOR_ID_OXSEMI, 0xc47f, /* OXPCIe200 1 Native UART */ | ||
2487 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2488 | pbn_oxsemi_1_4000000 }, | ||
2489 | { PCI_VENDOR_ID_OXSEMI, 0xc48b, /* OXPCIe200 1 Native UART */ | ||
2490 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2491 | pbn_oxsemi_1_4000000 }, | ||
2492 | { PCI_VENDOR_ID_OXSEMI, 0xc48f, /* OXPCIe200 1 Native UART */ | ||
2493 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2494 | pbn_oxsemi_1_4000000 }, | ||
2495 | { PCI_VENDOR_ID_OXSEMI, 0xc49b, /* OXPCIe200 1 Native UART */ | ||
2496 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2497 | pbn_oxsemi_1_4000000 }, | ||
2498 | { PCI_VENDOR_ID_OXSEMI, 0xc49f, /* OXPCIe200 1 Native UART */ | ||
2499 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2500 | pbn_oxsemi_1_4000000 }, | ||
2501 | { PCI_VENDOR_ID_OXSEMI, 0xc4ab, /* OXPCIe200 1 Native UART */ | ||
2502 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2503 | pbn_oxsemi_1_4000000 }, | ||
2504 | { PCI_VENDOR_ID_OXSEMI, 0xc4af, /* OXPCIe200 1 Native UART */ | ||
2505 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2506 | pbn_oxsemi_1_4000000 }, | ||
2507 | { PCI_VENDOR_ID_OXSEMI, 0xc4bb, /* OXPCIe200 1 Native UART */ | ||
2508 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2509 | pbn_oxsemi_1_4000000 }, | ||
2510 | { PCI_VENDOR_ID_OXSEMI, 0xc4bf, /* OXPCIe200 1 Native UART */ | ||
2511 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2512 | pbn_oxsemi_1_4000000 }, | ||
2513 | { PCI_VENDOR_ID_OXSEMI, 0xc4cb, /* OXPCIe200 1 Native UART */ | ||
2514 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2515 | pbn_oxsemi_1_4000000 }, | ||
2516 | { PCI_VENDOR_ID_OXSEMI, 0xc4cf, /* OXPCIe200 1 Native UART */ | ||
2517 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
2518 | pbn_oxsemi_1_4000000 }, | ||
2519 | /* | ||
2520 | * Mainpine Inc. IQ Express "Rev3" utilizing OxSemi Tornado | ||
2521 | */ | ||
2522 | { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 1 Port V.34 Super-G3 Fax */ | ||
2523 | PCI_VENDOR_ID_MAINPINE, 0x4001, 0, 0, | ||
2524 | pbn_oxsemi_1_4000000 }, | ||
2525 | { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 2 Port V.34 Super-G3 Fax */ | ||
2526 | PCI_VENDOR_ID_MAINPINE, 0x4002, 0, 0, | ||
2527 | pbn_oxsemi_2_4000000 }, | ||
2528 | { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 4 Port V.34 Super-G3 Fax */ | ||
2529 | PCI_VENDOR_ID_MAINPINE, 0x4004, 0, 0, | ||
2530 | pbn_oxsemi_4_4000000 }, | ||
2531 | { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 8 Port V.34 Super-G3 Fax */ | ||
2532 | PCI_VENDOR_ID_MAINPINE, 0x4008, 0, 0, | ||
2533 | pbn_oxsemi_8_4000000 }, | ||
2534 | /* | ||
2289 | * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards, | 2535 | * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards, |
2290 | * from skokodyn@yahoo.com | 2536 | * from skokodyn@yahoo.com |
2291 | */ | 2537 | */ |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index 638b68649e79..fde7f9ccf57e 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -12,8 +12,6 @@ | |||
12 | * This program is free software; you can redistribute it and/or modify | 12 | * 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 | 13 | * it under the terms of the GNU General Public License as published by |
14 | * the Free Software Foundation; either version 2 of the License. | 14 | * the Free Software Foundation; either version 2 of the License. |
15 | * | ||
16 | * $Id: 8250_pnp.c,v 1.10 2002/07/21 21:32:30 rmk Exp $ | ||
17 | */ | 15 | */ |
18 | #include <linux/module.h> | 16 | #include <linux/module.h> |
19 | #include <linux/init.h> | 17 | #include <linux/init.h> |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 18ca9075e131..c94d3c4b7521 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -1,8 +1,6 @@ | |||
1 | # | 1 | # |
2 | # Serial device configuration | 2 | # Serial device configuration |
3 | # | 3 | # |
4 | # $Id: Kconfig,v 1.11 2004/03/11 18:08:04 lethal Exp $ | ||
5 | # | ||
6 | 4 | ||
7 | menu "Serial drivers" | 5 | menu "Serial drivers" |
8 | depends on HAS_IOMEM | 6 | depends on HAS_IOMEM |
@@ -11,7 +9,6 @@ menu "Serial drivers" | |||
11 | # The new 8250/16550 serial drivers | 9 | # The new 8250/16550 serial drivers |
12 | config SERIAL_8250 | 10 | config SERIAL_8250 |
13 | tristate "8250/16550 and compatible serial support" | 11 | tristate "8250/16550 and compatible serial support" |
14 | depends on (BROKEN || !SPARC) | ||
15 | select SERIAL_CORE | 12 | select SERIAL_CORE |
16 | ---help--- | 13 | ---help--- |
17 | This selects whether you want to include the driver for the standard | 14 | This selects whether you want to include the driver for the standard |
@@ -451,6 +448,7 @@ config SERIAL_CLPS711X_CONSOLE | |||
451 | config SERIAL_SAMSUNG | 448 | config SERIAL_SAMSUNG |
452 | tristate "Samsung SoC serial support" | 449 | tristate "Samsung SoC serial support" |
453 | depends on ARM && PLAT_S3C24XX | 450 | depends on ARM && PLAT_S3C24XX |
451 | select SERIAL_CORE | ||
454 | help | 452 | help |
455 | Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, | 453 | Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, |
456 | providing /dev/ttySAC0, 1 and 2 (note, some machines may not | 454 | providing /dev/ttySAC0, 1 and 2 (note, some machines may not |
@@ -459,7 +457,7 @@ config SERIAL_SAMSUNG | |||
459 | 457 | ||
460 | config SERIAL_SAMSUNG_DEBUG | 458 | config SERIAL_SAMSUNG_DEBUG |
461 | bool "Samsung SoC serial debug" | 459 | bool "Samsung SoC serial debug" |
462 | depends on SERIAL_SAMSUNG | 460 | depends on SERIAL_SAMSUNG && DEBUG_LL |
463 | help | 461 | help |
464 | Add support for debugging the serial driver. Since this is | 462 | Add support for debugging the serial driver. Since this is |
465 | generally being used as a console, we use our own output | 463 | generally being used as a console, we use our own output |
@@ -944,22 +942,6 @@ config SERIAL_IP22_ZILOG_CONSOLE | |||
944 | depends on SERIAL_IP22_ZILOG=y | 942 | depends on SERIAL_IP22_ZILOG=y |
945 | select SERIAL_CORE_CONSOLE | 943 | select SERIAL_CORE_CONSOLE |
946 | 944 | ||
947 | config V850E_UART | ||
948 | bool "NEC V850E on-chip UART support" | ||
949 | depends on V850E_MA1 || V850E_ME2 || V850E_TEG || V850E2_ANNA || V850E_AS85EP1 | ||
950 | select SERIAL_CORE | ||
951 | default y | ||
952 | |||
953 | config V850E_UARTB | ||
954 | bool | ||
955 | depends on V850E_UART && V850E_ME2 | ||
956 | default y | ||
957 | |||
958 | config V850E_UART_CONSOLE | ||
959 | bool "Use NEC V850E on-chip UART for console" | ||
960 | depends on V850E_UART | ||
961 | select SERIAL_CORE_CONSOLE | ||
962 | |||
963 | config SERIAL_SH_SCI | 945 | config SERIAL_SH_SCI |
964 | tristate "SuperH SCI(F) serial port support" | 946 | tristate "SuperH SCI(F) serial port support" |
965 | depends on SUPERH || H8300 | 947 | depends on SUPERH || H8300 |
@@ -1011,24 +993,12 @@ config SERIAL_68328_RTS_CTS | |||
1011 | bool "Support RTS/CTS on 68328 serial port" | 993 | bool "Support RTS/CTS on 68328 serial port" |
1012 | depends on SERIAL_68328 | 994 | depends on SERIAL_68328 |
1013 | 995 | ||
1014 | config SERIAL_COLDFIRE | ||
1015 | bool "ColdFire serial support (DEPRECATED)" | ||
1016 | depends on COLDFIRE | ||
1017 | help | ||
1018 | This driver supports the built-in serial ports of the Motorola ColdFire | ||
1019 | family of CPUs. | ||
1020 | This driver is deprecated because it supports only the old interface | ||
1021 | for serial drivers and features like magic keys are not working. | ||
1022 | Please switch to the new style driver because this driver will be | ||
1023 | removed soon. | ||
1024 | |||
1025 | config SERIAL_MCF | 996 | config SERIAL_MCF |
1026 | bool "Coldfire serial support (new style driver)" | 997 | bool "Coldfire serial support" |
1027 | depends on COLDFIRE | 998 | depends on COLDFIRE |
1028 | select SERIAL_CORE | 999 | select SERIAL_CORE |
1029 | help | 1000 | help |
1030 | This new serial driver supports the Freescale Coldfire serial ports | 1001 | This serial driver supports the Freescale Coldfire serial ports. |
1031 | using the new serial driver subsystem. | ||
1032 | 1002 | ||
1033 | config SERIAL_MCF_BAUDRATE | 1003 | config SERIAL_MCF_BAUDRATE |
1034 | int "Default baudrate for Coldfire serial ports" | 1004 | int "Default baudrate for Coldfire serial ports" |
@@ -1153,42 +1123,6 @@ config SERIAL_CPM_CONSOLE | |||
1153 | your boot loader (lilo or loadlin) about how to pass options to the | 1123 | your boot loader (lilo or loadlin) about how to pass options to the |
1154 | kernel at boot time.) | 1124 | kernel at boot time.) |
1155 | 1125 | ||
1156 | config SERIAL_CPM_SCC1 | ||
1157 | bool "Support for SCC1 serial port" | ||
1158 | depends on SERIAL_CPM=y | ||
1159 | help | ||
1160 | Select this option to use SCC1 as a serial port | ||
1161 | |||
1162 | config SERIAL_CPM_SCC2 | ||
1163 | bool "Support for SCC2 serial port" | ||
1164 | depends on SERIAL_CPM=y | ||
1165 | help | ||
1166 | Select this option to use SCC2 as a serial port | ||
1167 | |||
1168 | config SERIAL_CPM_SCC3 | ||
1169 | bool "Support for SCC3 serial port" | ||
1170 | depends on SERIAL_CPM=y | ||
1171 | help | ||
1172 | Select this option to use SCC3 as a serial port | ||
1173 | |||
1174 | config SERIAL_CPM_SCC4 | ||
1175 | bool "Support for SCC4 serial port" | ||
1176 | depends on SERIAL_CPM=y | ||
1177 | help | ||
1178 | Select this option to use SCC4 as a serial port | ||
1179 | |||
1180 | config SERIAL_CPM_SMC1 | ||
1181 | bool "Support for SMC1 serial port" | ||
1182 | depends on SERIAL_CPM=y | ||
1183 | help | ||
1184 | Select this option to use SMC1 as a serial port | ||
1185 | |||
1186 | config SERIAL_CPM_SMC2 | ||
1187 | bool "Support for SMC2 serial port" | ||
1188 | depends on SERIAL_CPM=y | ||
1189 | help | ||
1190 | Select this option to use SMC2 as a serial port | ||
1191 | |||
1192 | config SERIAL_SGI_L1_CONSOLE | 1126 | config SERIAL_SGI_L1_CONSOLE |
1193 | bool "SGI Altix L1 serial console support" | 1127 | bool "SGI Altix L1 serial console support" |
1194 | depends on IA64_GENERIC || IA64_SGI_SN2 | 1128 | depends on IA64_GENERIC || IA64_SGI_SN2 |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 7d85c1fbe7e0..0c17c8ddb19d 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -1,11 +1,19 @@ | |||
1 | # | 1 | # |
2 | # Makefile for the kernel serial device drivers. | 2 | # Makefile for the kernel serial device drivers. |
3 | # | 3 | # |
4 | # $Id: Makefile,v 1.8 2002/07/21 21:32:30 rmk Exp $ | ||
5 | # | ||
6 | 4 | ||
7 | obj-$(CONFIG_SERIAL_CORE) += serial_core.o | 5 | obj-$(CONFIG_SERIAL_CORE) += serial_core.o |
8 | obj-$(CONFIG_SERIAL_21285) += 21285.o | 6 | obj-$(CONFIG_SERIAL_21285) += 21285.o |
7 | |||
8 | # These Sparc drivers have to appear before others such as 8250 | ||
9 | # which share ttySx minor node space. Otherwise console device | ||
10 | # names change and other unplesantries. | ||
11 | obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o | ||
12 | obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o | ||
13 | obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o | ||
14 | obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o | ||
15 | obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o | ||
16 | |||
9 | obj-$(CONFIG_SERIAL_8250) += 8250.o | 17 | obj-$(CONFIG_SERIAL_8250) += 8250.o |
10 | obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o | 18 | obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.o |
11 | obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o | 19 | obj-$(CONFIG_SERIAL_8250_GSC) += 8250_gsc.o |
@@ -33,18 +41,11 @@ obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o | |||
33 | obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o | 41 | obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o |
34 | obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o | 42 | obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o |
35 | obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o | 43 | obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o |
36 | obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o | ||
37 | obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o | ||
38 | obj-$(CONFIG_SERIAL_SUNZILOG) += sunzilog.o | ||
39 | obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o | 44 | obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o |
40 | obj-$(CONFIG_SERIAL_SUNSU) += sunsu.o | ||
41 | obj-$(CONFIG_SERIAL_SUNSAB) += sunsab.o | ||
42 | obj-$(CONFIG_SERIAL_MUX) += mux.o | 45 | obj-$(CONFIG_SERIAL_MUX) += mux.o |
43 | obj-$(CONFIG_SERIAL_68328) += 68328serial.o | 46 | obj-$(CONFIG_SERIAL_68328) += 68328serial.o |
44 | obj-$(CONFIG_SERIAL_68360) += 68360serial.o | 47 | obj-$(CONFIG_SERIAL_68360) += 68360serial.o |
45 | obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o | ||
46 | obj-$(CONFIG_SERIAL_MCF) += mcf.o | 48 | obj-$(CONFIG_SERIAL_MCF) += mcf.o |
47 | obj-$(CONFIG_V850E_UART) += v850e_uart.o | ||
48 | obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o | 49 | obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o |
49 | obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o | 50 | obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o |
50 | obj-$(CONFIG_SERIAL_DZ) += dz.o | 51 | obj-$(CONFIG_SERIAL_DZ) += dz.o |
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index e88da72f8304..71562689116f 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * along with this program; if not, write to the Free Software | 22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | * | 24 | * |
25 | * $Id: amba.c,v 1.41 2002/07/28 10:03:27 rmk Exp $ | ||
26 | * | ||
27 | * This is a generic driver for ARM AMBA-type serial ports. They | 25 | * This is a generic driver for ARM AMBA-type serial ports. They |
28 | * have a lot of 16550-like features, but are not register compatible. | 26 | * have a lot of 16550-like features, but are not register compatible. |
29 | * Note that although they do have CTS, DCD and DSR inputs, they do | 27 | * Note that although they do have CTS, DCD and DSR inputs, they do |
@@ -119,7 +117,7 @@ static void pl010_enable_ms(struct uart_port *port) | |||
119 | 117 | ||
120 | static void pl010_rx_chars(struct uart_amba_port *uap) | 118 | static void pl010_rx_chars(struct uart_amba_port *uap) |
121 | { | 119 | { |
122 | struct tty_struct *tty = uap->port.info->tty; | 120 | struct tty_struct *tty = uap->port.info->port.tty; |
123 | unsigned int status, ch, flag, rsr, max_count = 256; | 121 | unsigned int status, ch, flag, rsr, max_count = 256; |
124 | 122 | ||
125 | status = readb(uap->port.membase + UART01x_FR); | 123 | status = readb(uap->port.membase + UART01x_FR); |
@@ -514,7 +512,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
514 | int ret = 0; | 512 | int ret = 0; |
515 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA) | 513 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA) |
516 | ret = -EINVAL; | 514 | ret = -EINVAL; |
517 | if (ser->irq < 0 || ser->irq >= NR_IRQS) | 515 | if (ser->irq < 0 || ser->irq >= nr_irqs) |
518 | ret = -EINVAL; | 516 | ret = -EINVAL; |
519 | if (ser->baud_base < 9600) | 517 | if (ser->baud_base < 9600) |
520 | ret = -EINVAL; | 518 | ret = -EINVAL; |
@@ -791,7 +789,7 @@ static int __init pl010_init(void) | |||
791 | { | 789 | { |
792 | int ret; | 790 | int ret; |
793 | 791 | ||
794 | printk(KERN_INFO "Serial: AMBA driver $Revision: 1.41 $\n"); | 792 | printk(KERN_INFO "Serial: AMBA driver\n"); |
795 | 793 | ||
796 | ret = uart_register_driver(&amba_reg); | 794 | ret = uart_register_driver(&amba_reg); |
797 | if (ret == 0) { | 795 | if (ret == 0) { |
@@ -812,5 +810,5 @@ module_init(pl010_init); | |||
812 | module_exit(pl010_exit); | 810 | module_exit(pl010_exit); |
813 | 811 | ||
814 | MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd"); | 812 | MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd"); |
815 | MODULE_DESCRIPTION("ARM AMBA serial port driver $Revision: 1.41 $"); | 813 | MODULE_DESCRIPTION("ARM AMBA serial port driver"); |
816 | MODULE_LICENSE("GPL"); | 814 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 08adc1de4a79..b7180046f8db 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * along with this program; if not, write to the Free Software | 22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | * | 24 | * |
25 | * $Id: amba.c,v 1.41 2002/07/28 10:03:27 rmk Exp $ | ||
26 | * | ||
27 | * This is a generic driver for ARM AMBA-type serial ports. They | 25 | * This is a generic driver for ARM AMBA-type serial ports. They |
28 | * have a lot of 16550-like features, but are not register compatible. | 26 | * have a lot of 16550-like features, but are not register compatible. |
29 | * Note that although they do have CTS, DCD and DSR inputs, they do | 27 | * Note that although they do have CTS, DCD and DSR inputs, they do |
@@ -109,7 +107,7 @@ static void pl011_enable_ms(struct uart_port *port) | |||
109 | 107 | ||
110 | static void pl011_rx_chars(struct uart_amba_port *uap) | 108 | static void pl011_rx_chars(struct uart_amba_port *uap) |
111 | { | 109 | { |
112 | struct tty_struct *tty = uap->port.info->tty; | 110 | struct tty_struct *tty = uap->port.info->port.tty; |
113 | unsigned int status, ch, flag, max_count = 256; | 111 | unsigned int status, ch, flag, max_count = 256; |
114 | 112 | ||
115 | status = readw(uap->port.membase + UART01x_FR); | 113 | status = readw(uap->port.membase + UART01x_FR); |
@@ -574,7 +572,7 @@ static int pl010_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
574 | int ret = 0; | 572 | int ret = 0; |
575 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA) | 573 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA) |
576 | ret = -EINVAL; | 574 | ret = -EINVAL; |
577 | if (ser->irq < 0 || ser->irq >= NR_IRQS) | 575 | if (ser->irq < 0 || ser->irq >= nr_irqs) |
578 | ret = -EINVAL; | 576 | ret = -EINVAL; |
579 | if (ser->baud_base < 9600) | 577 | if (ser->baud_base < 9600) |
580 | ret = -EINVAL; | 578 | ret = -EINVAL; |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 6aeef22bd203..61fb8b6d19af 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -42,11 +42,11 @@ | |||
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
43 | 43 | ||
44 | #include <asm/mach/serial_at91.h> | 44 | #include <asm/mach/serial_at91.h> |
45 | #include <asm/arch/board.h> | 45 | #include <mach/board.h> |
46 | 46 | ||
47 | #ifdef CONFIG_ARM | 47 | #ifdef CONFIG_ARM |
48 | #include <asm/arch/cpu.h> | 48 | #include <mach/cpu.h> |
49 | #include <asm/arch/gpio.h> | 49 | #include <mach/gpio.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #define PDC_BUFFER_SIZE 512 | 52 | #define PDC_BUFFER_SIZE 512 |
@@ -131,7 +131,8 @@ struct atmel_uart_char { | |||
131 | struct atmel_uart_port { | 131 | struct atmel_uart_port { |
132 | struct uart_port uart; /* uart */ | 132 | struct uart_port uart; /* uart */ |
133 | struct clk *clk; /* uart clock */ | 133 | struct clk *clk; /* uart clock */ |
134 | unsigned short suspended; /* is port suspended? */ | 134 | int may_wakeup; /* cached value of device_may_wakeup for times we need to disable it */ |
135 | u32 backup_imr; /* IMR saved during suspend */ | ||
135 | int break_active; /* break being received */ | 136 | int break_active; /* break being received */ |
136 | 137 | ||
137 | short use_dma_rx; /* enable PDC receiver */ | 138 | short use_dma_rx; /* enable PDC receiver */ |
@@ -662,14 +663,14 @@ static void atmel_rx_from_ring(struct uart_port *port) | |||
662 | * uart_start(), which takes the lock. | 663 | * uart_start(), which takes the lock. |
663 | */ | 664 | */ |
664 | spin_unlock(&port->lock); | 665 | spin_unlock(&port->lock); |
665 | tty_flip_buffer_push(port->info->tty); | 666 | tty_flip_buffer_push(port->info->port.tty); |
666 | spin_lock(&port->lock); | 667 | spin_lock(&port->lock); |
667 | } | 668 | } |
668 | 669 | ||
669 | static void atmel_rx_from_dma(struct uart_port *port) | 670 | static void atmel_rx_from_dma(struct uart_port *port) |
670 | { | 671 | { |
671 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 672 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
672 | struct tty_struct *tty = port->info->tty; | 673 | struct tty_struct *tty = port->info->port.tty; |
673 | struct atmel_dma_buffer *pdc; | 674 | struct atmel_dma_buffer *pdc; |
674 | int rx_idx = atmel_port->pdc_rx_idx; | 675 | int rx_idx = atmel_port->pdc_rx_idx; |
675 | unsigned int head; | 676 | unsigned int head; |
@@ -794,7 +795,7 @@ static void atmel_tasklet_func(unsigned long data) | |||
794 | static int atmel_startup(struct uart_port *port) | 795 | static int atmel_startup(struct uart_port *port) |
795 | { | 796 | { |
796 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 797 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
797 | struct tty_struct *tty = port->info->tty; | 798 | struct tty_struct *tty = port->info->port.tty; |
798 | int retval; | 799 | int retval; |
799 | 800 | ||
800 | /* | 801 | /* |
@@ -956,6 +957,20 @@ static void atmel_shutdown(struct uart_port *port) | |||
956 | } | 957 | } |
957 | 958 | ||
958 | /* | 959 | /* |
960 | * Flush any TX data submitted for DMA. Called when the TX circular | ||
961 | * buffer is reset. | ||
962 | */ | ||
963 | static void atmel_flush_buffer(struct uart_port *port) | ||
964 | { | ||
965 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | ||
966 | |||
967 | if (atmel_use_dma_tx(port)) { | ||
968 | UART_PUT_TCR(port, 0); | ||
969 | atmel_port->pdc_tx.ofs = 0; | ||
970 | } | ||
971 | } | ||
972 | |||
973 | /* | ||
959 | * Power / Clock management. | 974 | * Power / Clock management. |
960 | */ | 975 | */ |
961 | static void atmel_serial_pm(struct uart_port *port, unsigned int state, | 976 | static void atmel_serial_pm(struct uart_port *port, unsigned int state, |
@@ -970,8 +985,15 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state, | |||
970 | * This is called on uart_open() or a resume event. | 985 | * This is called on uart_open() or a resume event. |
971 | */ | 986 | */ |
972 | clk_enable(atmel_port->clk); | 987 | clk_enable(atmel_port->clk); |
988 | |||
989 | /* re-enable interrupts if we disabled some on suspend */ | ||
990 | UART_PUT_IER(port, atmel_port->backup_imr); | ||
973 | break; | 991 | break; |
974 | case 3: | 992 | case 3: |
993 | /* Back up the interrupt mask and disable all interrupts */ | ||
994 | atmel_port->backup_imr = UART_GET_IMR(port); | ||
995 | UART_PUT_IDR(port, -1); | ||
996 | |||
975 | /* | 997 | /* |
976 | * Disable the peripheral clock for this serial port. | 998 | * Disable the peripheral clock for this serial port. |
977 | * This is called on uart_close() or a suspend event. | 999 | * This is called on uart_close() or a suspend event. |
@@ -1189,6 +1211,7 @@ static struct uart_ops atmel_pops = { | |||
1189 | .break_ctl = atmel_break_ctl, | 1211 | .break_ctl = atmel_break_ctl, |
1190 | .startup = atmel_startup, | 1212 | .startup = atmel_startup, |
1191 | .shutdown = atmel_shutdown, | 1213 | .shutdown = atmel_shutdown, |
1214 | .flush_buffer = atmel_flush_buffer, | ||
1192 | .set_termios = atmel_set_termios, | 1215 | .set_termios = atmel_set_termios, |
1193 | .type = atmel_type, | 1216 | .type = atmel_type, |
1194 | .release_port = atmel_release_port, | 1217 | .release_port = atmel_release_port, |
@@ -1460,13 +1483,12 @@ static int atmel_serial_suspend(struct platform_device *pdev, | |||
1460 | cpu_relax(); | 1483 | cpu_relax(); |
1461 | } | 1484 | } |
1462 | 1485 | ||
1463 | if (device_may_wakeup(&pdev->dev) | 1486 | /* we can not wake up if we're running on slow clock */ |
1464 | && !atmel_serial_clk_will_stop()) | 1487 | atmel_port->may_wakeup = device_may_wakeup(&pdev->dev); |
1465 | enable_irq_wake(port->irq); | 1488 | if (atmel_serial_clk_will_stop()) |
1466 | else { | 1489 | device_set_wakeup_enable(&pdev->dev, 0); |
1467 | uart_suspend_port(&atmel_uart, port); | 1490 | |
1468 | atmel_port->suspended = 1; | 1491 | uart_suspend_port(&atmel_uart, port); |
1469 | } | ||
1470 | 1492 | ||
1471 | return 0; | 1493 | return 0; |
1472 | } | 1494 | } |
@@ -1476,11 +1498,8 @@ static int atmel_serial_resume(struct platform_device *pdev) | |||
1476 | struct uart_port *port = platform_get_drvdata(pdev); | 1498 | struct uart_port *port = platform_get_drvdata(pdev); |
1477 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | 1499 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); |
1478 | 1500 | ||
1479 | if (atmel_port->suspended) { | 1501 | uart_resume_port(&atmel_uart, port); |
1480 | uart_resume_port(&atmel_uart, port); | 1502 | device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup); |
1481 | atmel_port->suspended = 0; | ||
1482 | } else | ||
1483 | disable_irq_wake(port->irq); | ||
1484 | 1503 | ||
1485 | return 0; | 1504 | return 0; |
1486 | } | 1505 | } |
@@ -1498,6 +1517,8 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev) | |||
1498 | BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); | 1517 | BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); |
1499 | 1518 | ||
1500 | port = &atmel_ports[pdev->id]; | 1519 | port = &atmel_ports[pdev->id]; |
1520 | port->backup_imr = 0; | ||
1521 | |||
1501 | atmel_init_port(port, pdev); | 1522 | atmel_init_port(port, pdev); |
1502 | 1523 | ||
1503 | if (!atmel_use_dma_rx(&port->uart)) { | 1524 | if (!atmel_use_dma_rx(&port->uart)) { |
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index fd9bb777df28..569f0e2476c6 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Blackfin On-Chip Serial Driver | 2 | * Blackfin On-Chip Serial Driver |
3 | * | 3 | * |
4 | * Copyright 2006-2007 Analog Devices Inc. | 4 | * Copyright 2006-2008 Analog Devices Inc. |
5 | * | 5 | * |
6 | * Enter bugs at http://blackfin.uclinux.org/ | 6 | * Enter bugs at http://blackfin.uclinux.org/ |
7 | * | 7 | * |
@@ -28,7 +28,7 @@ | |||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #include <asm/gpio.h> | 30 | #include <asm/gpio.h> |
31 | #include <asm/mach/bfin_serial_5xx.h> | 31 | #include <mach/bfin_serial_5xx.h> |
32 | 32 | ||
33 | #ifdef CONFIG_SERIAL_BFIN_DMA | 33 | #ifdef CONFIG_SERIAL_BFIN_DMA |
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
@@ -42,6 +42,9 @@ | |||
42 | #define BFIN_SERIAL_MAJOR 204 | 42 | #define BFIN_SERIAL_MAJOR 204 |
43 | #define BFIN_SERIAL_MINOR 64 | 43 | #define BFIN_SERIAL_MINOR 64 |
44 | 44 | ||
45 | static struct bfin_serial_port bfin_serial_ports[BFIN_UART_NR_PORTS]; | ||
46 | static int nr_active_ports = ARRAY_SIZE(bfin_serial_resource); | ||
47 | |||
45 | /* | 48 | /* |
46 | * Setup for console. Argument comes from the menuconfig | 49 | * Setup for console. Argument comes from the menuconfig |
47 | */ | 50 | */ |
@@ -126,13 +129,13 @@ static int kgdb_entry_state; | |||
126 | void kgdb_put_debug_char(int chr) | 129 | void kgdb_put_debug_char(int chr) |
127 | { | 130 | { |
128 | struct bfin_serial_port *uart; | 131 | struct bfin_serial_port *uart; |
129 | 132 | ||
130 | if (CONFIG_KGDB_UART_PORT < 0 | 133 | if (CONFIG_KGDB_UART_PORT < 0 |
131 | || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS) | 134 | || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS) |
132 | uart = &bfin_serial_ports[0]; | 135 | uart = &bfin_serial_ports[0]; |
133 | else | 136 | else |
134 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; | 137 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; |
135 | 138 | ||
136 | while (!(UART_GET_LSR(uart) & THRE)) { | 139 | while (!(UART_GET_LSR(uart) & THRE)) { |
137 | SSYNC(); | 140 | SSYNC(); |
138 | } | 141 | } |
@@ -152,7 +155,7 @@ int kgdb_get_debug_char(void) | |||
152 | uart = &bfin_serial_ports[0]; | 155 | uart = &bfin_serial_ports[0]; |
153 | else | 156 | else |
154 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; | 157 | uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT]; |
155 | 158 | ||
156 | while(!(UART_GET_LSR(uart) & DR)) { | 159 | while(!(UART_GET_LSR(uart) & DR)) { |
157 | SSYNC(); | 160 | SSYNC(); |
158 | } | 161 | } |
@@ -175,7 +178,7 @@ int kgdb_get_debug_char(void) | |||
175 | #ifdef CONFIG_SERIAL_BFIN_PIO | 178 | #ifdef CONFIG_SERIAL_BFIN_PIO |
176 | static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | 179 | static void bfin_serial_rx_chars(struct bfin_serial_port *uart) |
177 | { | 180 | { |
178 | struct tty_struct *tty = uart->port.info->tty; | 181 | struct tty_struct *tty = uart->port.info->port.tty; |
179 | unsigned int status, ch, flg; | 182 | unsigned int status, ch, flg; |
180 | static struct timeval anomaly_start = { .tv_sec = 0 }; | 183 | static struct timeval anomaly_start = { .tv_sec = 0 }; |
181 | 184 | ||
@@ -298,7 +301,11 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart) | |||
298 | bfin_serial_mctrl_check(uart); | 301 | bfin_serial_mctrl_check(uart); |
299 | 302 | ||
300 | if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) { | 303 | if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) { |
301 | bfin_serial_stop_tx(&uart->port); | 304 | #ifdef CONFIG_BF54x |
305 | /* Clear TFI bit */ | ||
306 | UART_PUT_LSR(uart, TFI); | ||
307 | #endif | ||
308 | UART_CLEAR_IER(uart, ETBEI); | ||
302 | return; | 309 | return; |
303 | } | 310 | } |
304 | 311 | ||
@@ -317,9 +324,6 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart) | |||
317 | 324 | ||
318 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 325 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
319 | uart_write_wakeup(&uart->port); | 326 | uart_write_wakeup(&uart->port); |
320 | |||
321 | if (uart_circ_empty(xmit)) | ||
322 | bfin_serial_stop_tx(&uart->port); | ||
323 | } | 327 | } |
324 | 328 | ||
325 | static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id) | 329 | static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id) |
@@ -393,7 +397,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) | |||
393 | 397 | ||
394 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) | 398 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) |
395 | { | 399 | { |
396 | struct tty_struct *tty = uart->port.info->tty; | 400 | struct tty_struct *tty = uart->port.info->port.tty; |
397 | int i, flg, status; | 401 | int i, flg, status; |
398 | 402 | ||
399 | status = UART_GET_LSR(uart); | 403 | status = UART_GET_LSR(uart); |
@@ -552,7 +556,7 @@ static void bfin_serial_mctrl_check(struct bfin_serial_port *uart) | |||
552 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS | 556 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS |
553 | unsigned int status; | 557 | unsigned int status; |
554 | struct uart_info *info = uart->port.info; | 558 | struct uart_info *info = uart->port.info; |
555 | struct tty_struct *tty = info->tty; | 559 | struct tty_struct *tty = info->port.tty; |
556 | 560 | ||
557 | status = bfin_serial_get_mctrl(&uart->port); | 561 | status = bfin_serial_get_mctrl(&uart->port); |
558 | uart_handle_cts_change(&uart->port, status & TIOCM_CTS); | 562 | uart_handle_cts_change(&uart->port, status & TIOCM_CTS); |
@@ -645,6 +649,42 @@ static int bfin_serial_startup(struct uart_port *port) | |||
645 | free_irq(uart->port.irq, uart); | 649 | free_irq(uart->port.irq, uart); |
646 | return -EBUSY; | 650 | return -EBUSY; |
647 | } | 651 | } |
652 | |||
653 | # ifdef CONFIG_BF54x | ||
654 | { | ||
655 | unsigned uart_dma_ch_rx, uart_dma_ch_tx; | ||
656 | |||
657 | switch (uart->port.irq) { | ||
658 | case IRQ_UART3_RX: | ||
659 | uart_dma_ch_rx = CH_UART3_RX; | ||
660 | uart_dma_ch_tx = CH_UART3_TX; | ||
661 | break; | ||
662 | case IRQ_UART2_RX: | ||
663 | uart_dma_ch_rx = CH_UART2_RX; | ||
664 | uart_dma_ch_tx = CH_UART2_TX; | ||
665 | break; | ||
666 | default: | ||
667 | uart_dma_ch_rx = uart_dma_ch_tx = 0; | ||
668 | break; | ||
669 | }; | ||
670 | |||
671 | if (uart_dma_ch_rx && | ||
672 | request_dma(uart_dma_ch_rx, "BFIN_UART_RX") < 0) { | ||
673 | printk(KERN_NOTICE"Fail to attach UART interrupt\n"); | ||
674 | free_irq(uart->port.irq, uart); | ||
675 | free_irq(uart->port.irq + 1, uart); | ||
676 | return -EBUSY; | ||
677 | } | ||
678 | if (uart_dma_ch_tx && | ||
679 | request_dma(uart_dma_ch_tx, "BFIN_UART_TX") < 0) { | ||
680 | printk(KERN_NOTICE "Fail to attach UART interrupt\n"); | ||
681 | free_dma(uart_dma_ch_rx); | ||
682 | free_irq(uart->port.irq, uart); | ||
683 | free_irq(uart->port.irq + 1, uart); | ||
684 | return -EBUSY; | ||
685 | } | ||
686 | } | ||
687 | # endif | ||
648 | #endif | 688 | #endif |
649 | UART_SET_IER(uart, ERBFI); | 689 | UART_SET_IER(uart, ERBFI); |
650 | return 0; | 690 | return 0; |
@@ -662,6 +702,20 @@ static void bfin_serial_shutdown(struct uart_port *port) | |||
662 | del_timer(&(uart->rx_dma_timer)); | 702 | del_timer(&(uart->rx_dma_timer)); |
663 | dma_free_coherent(NULL, PAGE_SIZE, uart->rx_dma_buf.buf, 0); | 703 | dma_free_coherent(NULL, PAGE_SIZE, uart->rx_dma_buf.buf, 0); |
664 | #else | 704 | #else |
705 | #ifdef CONFIG_BF54x | ||
706 | switch (uart->port.irq) { | ||
707 | case IRQ_UART3_RX: | ||
708 | free_dma(CH_UART3_RX); | ||
709 | free_dma(CH_UART3_TX); | ||
710 | break; | ||
711 | case IRQ_UART2_RX: | ||
712 | free_dma(CH_UART2_RX); | ||
713 | free_dma(CH_UART2_TX); | ||
714 | break; | ||
715 | default: | ||
716 | break; | ||
717 | }; | ||
718 | #endif | ||
665 | #ifdef CONFIG_KGDB_UART | 719 | #ifdef CONFIG_KGDB_UART |
666 | if (uart->port.line != CONFIG_KGDB_UART_PORT) | 720 | if (uart->port.line != CONFIG_KGDB_UART_PORT) |
667 | #endif | 721 | #endif |
@@ -757,6 +811,9 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
757 | val |= UCEN; | 811 | val |= UCEN; |
758 | UART_PUT_GCTL(uart, val); | 812 | UART_PUT_GCTL(uart, val); |
759 | 813 | ||
814 | /* Port speed changed, update the per-port timeout. */ | ||
815 | uart_update_timeout(port, termios->c_cflag, baud); | ||
816 | |||
760 | spin_unlock_irqrestore(&uart->port.lock, flags); | 817 | spin_unlock_irqrestore(&uart->port.lock, flags); |
761 | } | 818 | } |
762 | 819 | ||
@@ -814,10 +871,10 @@ static void bfin_serial_set_ldisc(struct uart_port *port) | |||
814 | int line = port->line; | 871 | int line = port->line; |
815 | unsigned short val; | 872 | unsigned short val; |
816 | 873 | ||
817 | if (line >= port->info->tty->driver->num) | 874 | if (line >= port->info->port.tty->driver->num) |
818 | return; | 875 | return; |
819 | 876 | ||
820 | switch (port->info->tty->ldisc.num) { | 877 | switch (port->info->port.tty->termios->c_line) { |
821 | case N_IRDA: | 878 | case N_IRDA: |
822 | val = UART_GET_GCTL(&bfin_serial_ports[line]); | 879 | val = UART_GET_GCTL(&bfin_serial_ports[line]); |
823 | val |= (IREN | RPOLC); | 880 | val |= (IREN | RPOLC); |
@@ -859,8 +916,9 @@ static void __init bfin_serial_init_ports(void) | |||
859 | return; | 916 | return; |
860 | first = 0; | 917 | first = 0; |
861 | 918 | ||
862 | for (i = 0; i < nr_ports; i++) { | 919 | for (i = 0; i < nr_active_ports; i++) { |
863 | bfin_serial_ports[i].port.uartclk = get_sclk(); | 920 | bfin_serial_ports[i].port.uartclk = get_sclk(); |
921 | bfin_serial_ports[i].port.fifosize = BFIN_UART_TX_FIFO_SIZE; | ||
864 | bfin_serial_ports[i].port.ops = &bfin_serial_pops; | 922 | bfin_serial_ports[i].port.ops = &bfin_serial_pops; |
865 | bfin_serial_ports[i].port.line = i; | 923 | bfin_serial_ports[i].port.line = i; |
866 | bfin_serial_ports[i].port.iotype = UPIO_MEM; | 924 | bfin_serial_ports[i].port.iotype = UPIO_MEM; |
@@ -961,7 +1019,7 @@ bfin_serial_console_setup(struct console *co, char *options) | |||
961 | * if so, search for the first available port that does have | 1019 | * if so, search for the first available port that does have |
962 | * console support. | 1020 | * console support. |
963 | */ | 1021 | */ |
964 | if (co->index == -1 || co->index >= nr_ports) | 1022 | if (co->index == -1 || co->index >= nr_active_ports) |
965 | co->index = 0; | 1023 | co->index = 0; |
966 | uart = &bfin_serial_ports[co->index]; | 1024 | uart = &bfin_serial_ports[co->index]; |
967 | 1025 | ||
@@ -1056,7 +1114,7 @@ static __init void early_serial_write(struct console *con, const char *s, | |||
1056 | } | 1114 | } |
1057 | } | 1115 | } |
1058 | 1116 | ||
1059 | static struct __init console bfin_early_serial_console = { | 1117 | static struct __initdata console bfin_early_serial_console = { |
1060 | .name = "early_BFuart", | 1118 | .name = "early_BFuart", |
1061 | .write = early_serial_write, | 1119 | .write = early_serial_write, |
1062 | .device = uart_console_device, | 1120 | .device = uart_console_device, |
@@ -1072,7 +1130,7 @@ struct console __init *bfin_earlyserial_init(unsigned int port, | |||
1072 | struct bfin_serial_port *uart; | 1130 | struct bfin_serial_port *uart; |
1073 | struct ktermios t; | 1131 | struct ktermios t; |
1074 | 1132 | ||
1075 | if (port == -1 || port >= nr_ports) | 1133 | if (port == -1 || port >= nr_active_ports) |
1076 | port = 0; | 1134 | port = 0; |
1077 | bfin_serial_init_ports(); | 1135 | bfin_serial_init_ports(); |
1078 | bfin_early_serial_console.index = port; | 1136 | bfin_early_serial_console.index = port; |
@@ -1100,20 +1158,26 @@ static struct uart_driver bfin_serial_reg = { | |||
1100 | 1158 | ||
1101 | static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state) | 1159 | static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state) |
1102 | { | 1160 | { |
1103 | struct bfin_serial_port *uart = platform_get_drvdata(dev); | 1161 | int i; |
1104 | 1162 | ||
1105 | if (uart) | 1163 | for (i = 0; i < nr_active_ports; i++) { |
1106 | uart_suspend_port(&bfin_serial_reg, &uart->port); | 1164 | if (bfin_serial_ports[i].port.dev != &dev->dev) |
1165 | continue; | ||
1166 | uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | ||
1167 | } | ||
1107 | 1168 | ||
1108 | return 0; | 1169 | return 0; |
1109 | } | 1170 | } |
1110 | 1171 | ||
1111 | static int bfin_serial_resume(struct platform_device *dev) | 1172 | static int bfin_serial_resume(struct platform_device *dev) |
1112 | { | 1173 | { |
1113 | struct bfin_serial_port *uart = platform_get_drvdata(dev); | 1174 | int i; |
1114 | 1175 | ||
1115 | if (uart) | 1176 | for (i = 0; i < nr_active_ports; i++) { |
1116 | uart_resume_port(&bfin_serial_reg, &uart->port); | 1177 | if (bfin_serial_ports[i].port.dev != &dev->dev) |
1178 | continue; | ||
1179 | uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | ||
1180 | } | ||
1117 | 1181 | ||
1118 | return 0; | 1182 | return 0; |
1119 | } | 1183 | } |
@@ -1128,32 +1192,31 @@ static int bfin_serial_probe(struct platform_device *dev) | |||
1128 | break; | 1192 | break; |
1129 | 1193 | ||
1130 | if (i < dev->num_resources) { | 1194 | if (i < dev->num_resources) { |
1131 | for (i = 0; i < nr_ports; i++, res++) { | 1195 | for (i = 0; i < nr_active_ports; i++, res++) { |
1132 | if (bfin_serial_ports[i].port.mapbase != res->start) | 1196 | if (bfin_serial_ports[i].port.mapbase != res->start) |
1133 | continue; | 1197 | continue; |
1134 | bfin_serial_ports[i].port.dev = &dev->dev; | 1198 | bfin_serial_ports[i].port.dev = &dev->dev; |
1135 | uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | 1199 | uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); |
1136 | platform_set_drvdata(dev, &bfin_serial_ports[i]); | ||
1137 | } | 1200 | } |
1138 | } | 1201 | } |
1139 | 1202 | ||
1140 | return 0; | 1203 | return 0; |
1141 | } | 1204 | } |
1142 | 1205 | ||
1143 | static int bfin_serial_remove(struct platform_device *pdev) | 1206 | static int bfin_serial_remove(struct platform_device *dev) |
1144 | { | 1207 | { |
1145 | struct bfin_serial_port *uart = platform_get_drvdata(pdev); | 1208 | int i; |
1146 | |||
1147 | 1209 | ||
1210 | for (i = 0; i < nr_active_ports; i++) { | ||
1211 | if (bfin_serial_ports[i].port.dev != &dev->dev) | ||
1212 | continue; | ||
1213 | uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port); | ||
1214 | bfin_serial_ports[i].port.dev = NULL; | ||
1148 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS | 1215 | #ifdef CONFIG_SERIAL_BFIN_CTSRTS |
1149 | gpio_free(uart->cts_pin); | 1216 | gpio_free(bfin_serial_ports[i].cts_pin); |
1150 | gpio_free(uart->rts_pin); | 1217 | gpio_free(bfin_serial_ports[i].rts_pin); |
1151 | #endif | 1218 | #endif |
1152 | 1219 | } | |
1153 | platform_set_drvdata(pdev, NULL); | ||
1154 | |||
1155 | if (uart) | ||
1156 | uart_remove_one_port(&bfin_serial_reg, &uart->port); | ||
1157 | 1220 | ||
1158 | return 0; | 1221 | return 0; |
1159 | } | 1222 | } |
diff --git a/drivers/serial/bfin_sport_uart.c b/drivers/serial/bfin_sport_uart.c index aca1240ad808..dd8564d25051 100644 --- a/drivers/serial/bfin_sport_uart.c +++ b/drivers/serial/bfin_sport_uart.c | |||
@@ -174,7 +174,7 @@ static int sport_uart_setup(struct sport_uart_port *up, int sclk, int baud_rate) | |||
174 | static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) | 174 | static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) |
175 | { | 175 | { |
176 | struct sport_uart_port *up = dev_id; | 176 | struct sport_uart_port *up = dev_id; |
177 | struct tty_struct *tty = up->port.info->tty; | 177 | struct tty_struct *tty = up->port.info->port.tty; |
178 | unsigned int ch; | 178 | unsigned int ch; |
179 | 179 | ||
180 | do { | 180 | do { |
@@ -201,7 +201,7 @@ static irqreturn_t sport_uart_tx_irq(int irq, void *dev_id) | |||
201 | static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) | 201 | static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) |
202 | { | 202 | { |
203 | struct sport_uart_port *up = dev_id; | 203 | struct sport_uart_port *up = dev_id; |
204 | struct tty_struct *tty = up->port.info->tty; | 204 | struct tty_struct *tty = up->port.info->port.tty; |
205 | unsigned int stat = SPORT_GET_STAT(up); | 205 | unsigned int stat = SPORT_GET_STAT(up); |
206 | 206 | ||
207 | /* Overflow in RX FIFO */ | 207 | /* Overflow in RX FIFO */ |
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c index 23827189ec0e..459f3420a429 100644 --- a/drivers/serial/clps711x.c +++ b/drivers/serial/clps711x.c | |||
@@ -21,9 +21,6 @@ | |||
21 | * You should have received a copy of the GNU General Public License | 21 | * You should have received a copy of the GNU General Public License |
22 | * along with this program; if not, write to the Free Software | 22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | * | ||
25 | * $Id: clps711x.c,v 1.42 2002/07/28 10:03:28 rmk Exp $ | ||
26 | * | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 26 | #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
@@ -42,7 +39,7 @@ | |||
42 | #include <linux/serial_core.h> | 39 | #include <linux/serial_core.h> |
43 | #include <linux/serial.h> | 40 | #include <linux/serial.h> |
44 | 41 | ||
45 | #include <asm/hardware.h> | 42 | #include <mach/hardware.h> |
46 | #include <asm/io.h> | 43 | #include <asm/io.h> |
47 | #include <asm/irq.h> | 44 | #include <asm/irq.h> |
48 | #include <asm/hardware/clps7111.h> | 45 | #include <asm/hardware/clps7111.h> |
@@ -96,7 +93,7 @@ static void clps711xuart_enable_ms(struct uart_port *port) | |||
96 | static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id) | 93 | static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id) |
97 | { | 94 | { |
98 | struct uart_port *port = dev_id; | 95 | struct uart_port *port = dev_id; |
99 | struct tty_struct *tty = port->info->tty; | 96 | struct tty_struct *tty = port->info->port.tty; |
100 | unsigned int status, ch, flg; | 97 | unsigned int status, ch, flg; |
101 | 98 | ||
102 | status = clps_readl(SYSFLG(port)); | 99 | status = clps_readl(SYSFLG(port)); |
@@ -551,7 +548,7 @@ static int __init clps711xuart_init(void) | |||
551 | { | 548 | { |
552 | int ret, i; | 549 | int ret, i; |
553 | 550 | ||
554 | printk(KERN_INFO "Serial: CLPS711x driver $Revision: 1.42 $\n"); | 551 | printk(KERN_INFO "Serial: CLPS711x driver\n"); |
555 | 552 | ||
556 | ret = uart_register_driver(&clps711x_reg); | 553 | ret = uart_register_driver(&clps711x_reg); |
557 | if (ret) | 554 | if (ret) |
@@ -577,6 +574,6 @@ module_init(clps711xuart_init); | |||
577 | module_exit(clps711xuart_exit); | 574 | module_exit(clps711xuart_exit); |
578 | 575 | ||
579 | MODULE_AUTHOR("Deep Blue Solutions Ltd"); | 576 | MODULE_AUTHOR("Deep Blue Solutions Ltd"); |
580 | MODULE_DESCRIPTION("CLPS-711x generic serial driver $Revision: 1.42 $"); | 577 | MODULE_DESCRIPTION("CLPS-711x generic serial driver"); |
581 | MODULE_LICENSE("GPL"); | 578 | MODULE_LICENSE("GPL"); |
582 | MODULE_ALIAS_CHARDEV(SERIAL_CLPS711X_MAJOR, SERIAL_CLPS711X_MINOR); | 579 | MODULE_ALIAS_CHARDEV(SERIAL_CLPS711X_MAJOR, SERIAL_CLPS711X_MINOR); |
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h index 5c76e0ae0582..7274b527a3c1 100644 --- a/drivers/serial/cpm_uart/cpm_uart.h +++ b/drivers/serial/cpm_uart/cpm_uart.h | |||
@@ -50,6 +50,15 @@ | |||
50 | 50 | ||
51 | #define SCC_WAIT_CLOSING 100 | 51 | #define SCC_WAIT_CLOSING 100 |
52 | 52 | ||
53 | #define GPIO_CTS 0 | ||
54 | #define GPIO_RTS 1 | ||
55 | #define GPIO_DCD 2 | ||
56 | #define GPIO_DSR 3 | ||
57 | #define GPIO_DTR 4 | ||
58 | #define GPIO_RI 5 | ||
59 | |||
60 | #define NUM_GPIOS (GPIO_RI+1) | ||
61 | |||
53 | struct uart_cpm_port { | 62 | struct uart_cpm_port { |
54 | struct uart_port port; | 63 | struct uart_port port; |
55 | u16 rx_nrfifos; | 64 | u16 rx_nrfifos; |
@@ -68,6 +77,7 @@ struct uart_cpm_port { | |||
68 | unsigned char *rx_buf; | 77 | unsigned char *rx_buf; |
69 | u32 flags; | 78 | u32 flags; |
70 | void (*set_lineif)(struct uart_cpm_port *); | 79 | void (*set_lineif)(struct uart_cpm_port *); |
80 | struct clk *clk; | ||
71 | u8 brg; | 81 | u8 brg; |
72 | uint dp_addr; | 82 | uint dp_addr; |
73 | void *mem_addr; | 83 | void *mem_addr; |
@@ -82,6 +92,7 @@ struct uart_cpm_port { | |||
82 | int wait_closing; | 92 | int wait_closing; |
83 | /* value to combine with opcode to form cpm command */ | 93 | /* value to combine with opcode to form cpm command */ |
84 | u32 command; | 94 | u32 command; |
95 | int gpios[NUM_GPIOS]; | ||
85 | }; | 96 | }; |
86 | 97 | ||
87 | extern int cpm_uart_nr; | 98 | extern int cpm_uart_nr; |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index abe129cc927a..bde4b4b0b80f 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -43,6 +43,9 @@ | |||
43 | #include <linux/dma-mapping.h> | 43 | #include <linux/dma-mapping.h> |
44 | #include <linux/fs_uart_pd.h> | 44 | #include <linux/fs_uart_pd.h> |
45 | #include <linux/of_platform.h> | 45 | #include <linux/of_platform.h> |
46 | #include <linux/gpio.h> | ||
47 | #include <linux/of_gpio.h> | ||
48 | #include <linux/clk.h> | ||
46 | 49 | ||
47 | #include <asm/io.h> | 50 | #include <asm/io.h> |
48 | #include <asm/irq.h> | 51 | #include <asm/irq.h> |
@@ -96,13 +99,41 @@ static unsigned int cpm_uart_tx_empty(struct uart_port *port) | |||
96 | 99 | ||
97 | static void cpm_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) | 100 | static void cpm_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) |
98 | { | 101 | { |
99 | /* Whee. Do nothing. */ | 102 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; |
103 | |||
104 | if (pinfo->gpios[GPIO_RTS] >= 0) | ||
105 | gpio_set_value(pinfo->gpios[GPIO_RTS], !(mctrl & TIOCM_RTS)); | ||
106 | |||
107 | if (pinfo->gpios[GPIO_DTR] >= 0) | ||
108 | gpio_set_value(pinfo->gpios[GPIO_DTR], !(mctrl & TIOCM_DTR)); | ||
100 | } | 109 | } |
101 | 110 | ||
102 | static unsigned int cpm_uart_get_mctrl(struct uart_port *port) | 111 | static unsigned int cpm_uart_get_mctrl(struct uart_port *port) |
103 | { | 112 | { |
104 | /* Whee. Do nothing. */ | 113 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; |
105 | return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; | 114 | unsigned int mctrl = TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; |
115 | |||
116 | if (pinfo->gpios[GPIO_CTS] >= 0) { | ||
117 | if (gpio_get_value(pinfo->gpios[GPIO_CTS])) | ||
118 | mctrl &= ~TIOCM_CTS; | ||
119 | } | ||
120 | |||
121 | if (pinfo->gpios[GPIO_DSR] >= 0) { | ||
122 | if (gpio_get_value(pinfo->gpios[GPIO_DSR])) | ||
123 | mctrl &= ~TIOCM_DSR; | ||
124 | } | ||
125 | |||
126 | if (pinfo->gpios[GPIO_DCD] >= 0) { | ||
127 | if (gpio_get_value(pinfo->gpios[GPIO_DCD])) | ||
128 | mctrl &= ~TIOCM_CAR; | ||
129 | } | ||
130 | |||
131 | if (pinfo->gpios[GPIO_RI] >= 0) { | ||
132 | if (!gpio_get_value(pinfo->gpios[GPIO_RI])) | ||
133 | mctrl |= TIOCM_RNG; | ||
134 | } | ||
135 | |||
136 | return mctrl; | ||
106 | } | 137 | } |
107 | 138 | ||
108 | /* | 139 | /* |
@@ -201,6 +232,10 @@ static void cpm_uart_int_tx(struct uart_port *port) | |||
201 | cpm_uart_tx_pump(port); | 232 | cpm_uart_tx_pump(port); |
202 | } | 233 | } |
203 | 234 | ||
235 | #ifdef CONFIG_CONSOLE_POLL | ||
236 | static int serial_polled; | ||
237 | #endif | ||
238 | |||
204 | /* | 239 | /* |
205 | * Receive characters | 240 | * Receive characters |
206 | */ | 241 | */ |
@@ -209,7 +244,7 @@ static void cpm_uart_int_rx(struct uart_port *port) | |||
209 | int i; | 244 | int i; |
210 | unsigned char ch; | 245 | unsigned char ch; |
211 | u8 *cp; | 246 | u8 *cp; |
212 | struct tty_struct *tty = port->info->tty; | 247 | struct tty_struct *tty = port->info->port.tty; |
213 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; | 248 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; |
214 | cbd_t __iomem *bdp; | 249 | cbd_t __iomem *bdp; |
215 | u16 status; | 250 | u16 status; |
@@ -222,6 +257,12 @@ static void cpm_uart_int_rx(struct uart_port *port) | |||
222 | */ | 257 | */ |
223 | bdp = pinfo->rx_cur; | 258 | bdp = pinfo->rx_cur; |
224 | for (;;) { | 259 | for (;;) { |
260 | #ifdef CONFIG_CONSOLE_POLL | ||
261 | if (unlikely(serial_polled)) { | ||
262 | serial_polled = 0; | ||
263 | return; | ||
264 | } | ||
265 | #endif | ||
225 | /* get status */ | 266 | /* get status */ |
226 | status = in_be16(&bdp->cbd_sc); | 267 | status = in_be16(&bdp->cbd_sc); |
227 | /* If this one is empty, return happy */ | 268 | /* If this one is empty, return happy */ |
@@ -253,7 +294,12 @@ static void cpm_uart_int_rx(struct uart_port *port) | |||
253 | goto handle_error; | 294 | goto handle_error; |
254 | if (uart_handle_sysrq_char(port, ch)) | 295 | if (uart_handle_sysrq_char(port, ch)) |
255 | continue; | 296 | continue; |
256 | 297 | #ifdef CONFIG_CONSOLE_POLL | |
298 | if (unlikely(serial_polled)) { | ||
299 | serial_polled = 0; | ||
300 | return; | ||
301 | } | ||
302 | #endif | ||
257 | error_return: | 303 | error_return: |
258 | tty_insert_flip_char(tty, ch, flg); | 304 | tty_insert_flip_char(tty, ch, flg); |
259 | 305 | ||
@@ -420,10 +466,13 @@ static void cpm_uart_shutdown(struct uart_port *port) | |||
420 | } | 466 | } |
421 | 467 | ||
422 | /* Shut them really down and reinit buffer descriptors */ | 468 | /* Shut them really down and reinit buffer descriptors */ |
423 | if (IS_SMC(pinfo)) | 469 | if (IS_SMC(pinfo)) { |
470 | out_be16(&pinfo->smcup->smc_brkcr, 0); | ||
424 | cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX); | 471 | cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX); |
425 | else | 472 | } else { |
473 | out_be16(&pinfo->sccup->scc_brkcr, 0); | ||
426 | cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX); | 474 | cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX); |
475 | } | ||
427 | 476 | ||
428 | cpm_uart_initbd(pinfo); | 477 | cpm_uart_initbd(pinfo); |
429 | } | 478 | } |
@@ -539,14 +588,19 @@ static void cpm_uart_set_termios(struct uart_port *port, | |||
539 | * enables, because we want to put them back if they were | 588 | * enables, because we want to put them back if they were |
540 | * present. | 589 | * present. |
541 | */ | 590 | */ |
542 | prev_mode = in_be16(&smcp->smc_smcmr); | 591 | prev_mode = in_be16(&smcp->smc_smcmr) & (SMCMR_REN | SMCMR_TEN); |
543 | out_be16(&smcp->smc_smcmr, smcr_mk_clen(bits) | cval | SMCMR_SM_UART); | 592 | /* Output in *one* operation, so we don't interrupt RX/TX if they |
544 | setbits16(&smcp->smc_smcmr, (prev_mode & (SMCMR_REN | SMCMR_TEN))); | 593 | * were already enabled. */ |
594 | out_be16(&smcp->smc_smcmr, smcr_mk_clen(bits) | cval | | ||
595 | SMCMR_SM_UART | prev_mode); | ||
545 | } else { | 596 | } else { |
546 | out_be16(&sccp->scc_psmr, (sbits << 12) | scval); | 597 | out_be16(&sccp->scc_psmr, (sbits << 12) | scval); |
547 | } | 598 | } |
548 | 599 | ||
549 | cpm_set_brg(pinfo->brg - 1, baud); | 600 | if (pinfo->clk) |
601 | clk_set_rate(pinfo->clk, baud); | ||
602 | else | ||
603 | cpm_set_brg(pinfo->brg - 1, baud); | ||
550 | spin_unlock_irqrestore(&port->lock, flags); | 604 | spin_unlock_irqrestore(&port->lock, flags); |
551 | } | 605 | } |
552 | 606 | ||
@@ -569,7 +623,7 @@ static int cpm_uart_verify_port(struct uart_port *port, | |||
569 | 623 | ||
570 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM) | 624 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM) |
571 | ret = -EINVAL; | 625 | ret = -EINVAL; |
572 | if (ser->irq < 0 || ser->irq >= NR_IRQS) | 626 | if (ser->irq < 0 || ser->irq >= nr_irqs) |
573 | ret = -EINVAL; | 627 | ret = -EINVAL; |
574 | if (ser->baud_base < 9600) | 628 | if (ser->baud_base < 9600) |
575 | ret = -EINVAL; | 629 | ret = -EINVAL; |
@@ -865,6 +919,80 @@ static void cpm_uart_config_port(struct uart_port *port, int flags) | |||
865 | cpm_uart_request_port(port); | 919 | cpm_uart_request_port(port); |
866 | } | 920 | } |
867 | } | 921 | } |
922 | |||
923 | #ifdef CONFIG_CONSOLE_POLL | ||
924 | /* Serial polling routines for writing and reading from the uart while | ||
925 | * in an interrupt or debug context. | ||
926 | */ | ||
927 | |||
928 | #define GDB_BUF_SIZE 512 /* power of 2, please */ | ||
929 | |||
930 | static char poll_buf[GDB_BUF_SIZE]; | ||
931 | static char *pollp; | ||
932 | static int poll_chars; | ||
933 | |||
934 | static int poll_wait_key(char *obuf, struct uart_cpm_port *pinfo) | ||
935 | { | ||
936 | u_char c, *cp; | ||
937 | volatile cbd_t *bdp; | ||
938 | int i; | ||
939 | |||
940 | /* Get the address of the host memory buffer. | ||
941 | */ | ||
942 | bdp = pinfo->rx_cur; | ||
943 | while (bdp->cbd_sc & BD_SC_EMPTY) | ||
944 | ; | ||
945 | |||
946 | /* If the buffer address is in the CPM DPRAM, don't | ||
947 | * convert it. | ||
948 | */ | ||
949 | cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); | ||
950 | |||
951 | if (obuf) { | ||
952 | i = c = bdp->cbd_datlen; | ||
953 | while (i-- > 0) | ||
954 | *obuf++ = *cp++; | ||
955 | } else | ||
956 | c = *cp; | ||
957 | bdp->cbd_sc &= ~(BD_SC_BR | BD_SC_FR | BD_SC_PR | BD_SC_OV | BD_SC_ID); | ||
958 | bdp->cbd_sc |= BD_SC_EMPTY; | ||
959 | |||
960 | if (bdp->cbd_sc & BD_SC_WRAP) | ||
961 | bdp = pinfo->rx_bd_base; | ||
962 | else | ||
963 | bdp++; | ||
964 | pinfo->rx_cur = (cbd_t *)bdp; | ||
965 | |||
966 | return (int)c; | ||
967 | } | ||
968 | |||
969 | static int cpm_get_poll_char(struct uart_port *port) | ||
970 | { | ||
971 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; | ||
972 | |||
973 | if (!serial_polled) { | ||
974 | serial_polled = 1; | ||
975 | poll_chars = 0; | ||
976 | } | ||
977 | if (poll_chars <= 0) { | ||
978 | poll_chars = poll_wait_key(poll_buf, pinfo); | ||
979 | pollp = poll_buf; | ||
980 | } | ||
981 | poll_chars--; | ||
982 | return *pollp++; | ||
983 | } | ||
984 | |||
985 | static void cpm_put_poll_char(struct uart_port *port, | ||
986 | unsigned char c) | ||
987 | { | ||
988 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; | ||
989 | static char ch[2]; | ||
990 | |||
991 | ch[0] = (char)c; | ||
992 | cpm_uart_early_write(pinfo->port.line, ch, 1); | ||
993 | } | ||
994 | #endif /* CONFIG_CONSOLE_POLL */ | ||
995 | |||
868 | static struct uart_ops cpm_uart_pops = { | 996 | static struct uart_ops cpm_uart_pops = { |
869 | .tx_empty = cpm_uart_tx_empty, | 997 | .tx_empty = cpm_uart_tx_empty, |
870 | .set_mctrl = cpm_uart_set_mctrl, | 998 | .set_mctrl = cpm_uart_set_mctrl, |
@@ -882,6 +1010,10 @@ static struct uart_ops cpm_uart_pops = { | |||
882 | .request_port = cpm_uart_request_port, | 1010 | .request_port = cpm_uart_request_port, |
883 | .config_port = cpm_uart_config_port, | 1011 | .config_port = cpm_uart_config_port, |
884 | .verify_port = cpm_uart_verify_port, | 1012 | .verify_port = cpm_uart_verify_port, |
1013 | #ifdef CONFIG_CONSOLE_POLL | ||
1014 | .poll_get_char = cpm_get_poll_char, | ||
1015 | .poll_put_char = cpm_put_poll_char, | ||
1016 | #endif | ||
885 | }; | 1017 | }; |
886 | 1018 | ||
887 | struct uart_cpm_port cpm_uart_ports[UART_NR]; | 1019 | struct uart_cpm_port cpm_uart_ports[UART_NR]; |
@@ -893,14 +1025,23 @@ static int cpm_uart_init_port(struct device_node *np, | |||
893 | void __iomem *mem, *pram; | 1025 | void __iomem *mem, *pram; |
894 | int len; | 1026 | int len; |
895 | int ret; | 1027 | int ret; |
1028 | int i; | ||
896 | 1029 | ||
897 | data = of_get_property(np, "fsl,cpm-brg", &len); | 1030 | data = of_get_property(np, "clock", NULL); |
898 | if (!data || len != 4) { | 1031 | if (data) { |
899 | printk(KERN_ERR "CPM UART %s has no/invalid " | 1032 | struct clk *clk = clk_get(NULL, (const char*)data); |
900 | "fsl,cpm-brg property.\n", np->name); | 1033 | if (!IS_ERR(clk)) |
901 | return -EINVAL; | 1034 | pinfo->clk = clk; |
1035 | } | ||
1036 | if (!pinfo->clk) { | ||
1037 | data = of_get_property(np, "fsl,cpm-brg", &len); | ||
1038 | if (!data || len != 4) { | ||
1039 | printk(KERN_ERR "CPM UART %s has no/invalid " | ||
1040 | "fsl,cpm-brg property.\n", np->name); | ||
1041 | return -EINVAL; | ||
1042 | } | ||
1043 | pinfo->brg = *data; | ||
902 | } | 1044 | } |
903 | pinfo->brg = *data; | ||
904 | 1045 | ||
905 | data = of_get_property(np, "fsl,cpm-command", &len); | 1046 | data = of_get_property(np, "fsl,cpm-command", &len); |
906 | if (!data || len != 4) { | 1047 | if (!data || len != 4) { |
@@ -952,6 +1093,9 @@ static int cpm_uart_init_port(struct device_node *np, | |||
952 | goto out_pram; | 1093 | goto out_pram; |
953 | } | 1094 | } |
954 | 1095 | ||
1096 | for (i = 0; i < NUM_GPIOS; i++) | ||
1097 | pinfo->gpios[i] = of_get_gpio(np, i); | ||
1098 | |||
955 | return cpm_uart_request_port(&pinfo->port); | 1099 | return cpm_uart_request_port(&pinfo->port); |
956 | 1100 | ||
957 | out_pram: | 1101 | out_pram: |
@@ -1105,12 +1249,14 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
1105 | udbg_putc = NULL; | 1249 | udbg_putc = NULL; |
1106 | #endif | 1250 | #endif |
1107 | 1251 | ||
1108 | cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX); | ||
1109 | |||
1110 | if (IS_SMC(pinfo)) { | 1252 | if (IS_SMC(pinfo)) { |
1253 | out_be16(&pinfo->smcup->smc_brkcr, 0); | ||
1254 | cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX); | ||
1111 | clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX | SMCM_TX); | 1255 | clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX | SMCM_TX); |
1112 | clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN); | 1256 | clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN | SMCMR_TEN); |
1113 | } else { | 1257 | } else { |
1258 | out_be16(&pinfo->sccup->scc_brkcr, 0); | ||
1259 | cpm_line_cr_cmd(pinfo, CPM_CR_GRA_STOP_TX); | ||
1114 | clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_TX | UART_SCCM_RX); | 1260 | clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_TX | UART_SCCM_RX); |
1115 | clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); | 1261 | clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
1116 | } | 1262 | } |
@@ -1187,6 +1333,9 @@ static int __devinit cpm_uart_probe(struct of_device *ofdev, | |||
1187 | if (ret) | 1333 | if (ret) |
1188 | return ret; | 1334 | return ret; |
1189 | 1335 | ||
1336 | /* initialize the device pointer for the port */ | ||
1337 | pinfo->port.dev = &ofdev->dev; | ||
1338 | |||
1190 | return uart_add_one_port(&cpm_reg, &pinfo->port); | 1339 | return uart_add_one_port(&cpm_reg, &pinfo->port); |
1191 | } | 1340 | } |
1192 | 1341 | ||
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index 0f0aff06c596..1b94c56ec239 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c | |||
@@ -100,7 +100,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
100 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); | 100 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); |
101 | dma_addr = (u32)cpm_dpram_phys(mem_addr); | 101 | dma_addr = (u32)cpm_dpram_phys(mem_addr); |
102 | } else | 102 | } else |
103 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 103 | mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, |
104 | GFP_KERNEL); | 104 | GFP_KERNEL); |
105 | 105 | ||
106 | if (mem_addr == NULL) { | 106 | if (mem_addr == NULL) { |
@@ -127,8 +127,8 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
127 | 127 | ||
128 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) | 128 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) |
129 | { | 129 | { |
130 | dma_free_coherent(NULL, L1_CACHE_ALIGN(pinfo->rx_nrfifos * | 130 | dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos * |
131 | pinfo->rx_fifosize) + | 131 | pinfo->rx_fifosize) + |
132 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * | 132 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * |
133 | pinfo->tx_fifosize), pinfo->mem_addr, | 133 | pinfo->tx_fifosize), pinfo->mem_addr, |
134 | pinfo->dma_addr); | 134 | pinfo->dma_addr); |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index b8db4d3eed36..141c0a3333ad 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c | |||
@@ -136,7 +136,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
136 | dma_addr = virt_to_bus(mem_addr); | 136 | dma_addr = virt_to_bus(mem_addr); |
137 | } | 137 | } |
138 | else | 138 | else |
139 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 139 | mem_addr = dma_alloc_coherent(pinfo->port.dev, memsz, &dma_addr, |
140 | GFP_KERNEL); | 140 | GFP_KERNEL); |
141 | 141 | ||
142 | if (mem_addr == NULL) { | 142 | if (mem_addr == NULL) { |
@@ -163,8 +163,8 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
163 | 163 | ||
164 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) | 164 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo) |
165 | { | 165 | { |
166 | dma_free_coherent(NULL, L1_CACHE_ALIGN(pinfo->rx_nrfifos * | 166 | dma_free_coherent(pinfo->port.dev, L1_CACHE_ALIGN(pinfo->rx_nrfifos * |
167 | pinfo->rx_fifosize) + | 167 | pinfo->rx_fifosize) + |
168 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * | 168 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * |
169 | pinfo->tx_fifosize), (void __force *)pinfo->mem_addr, | 169 | pinfo->tx_fifosize), (void __force *)pinfo->mem_addr, |
170 | pinfo->dma_addr); | 170 | pinfo->dma_addr); |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 3e0366eab412..211c21797ce0 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -234,7 +234,7 @@ unsigned long r_alt_ser_baudrate_shadow = 0; | |||
234 | 234 | ||
235 | static struct e100_serial rs_table[] = { | 235 | static struct e100_serial rs_table[] = { |
236 | { .baud = DEF_BAUD, | 236 | { .baud = DEF_BAUD, |
237 | .port = (unsigned char *)R_SERIAL0_CTRL, | 237 | .ioport = (unsigned char *)R_SERIAL0_CTRL, |
238 | .irq = 1U << 12, /* uses DMA 6 and 7 */ | 238 | .irq = 1U << 12, /* uses DMA 6 and 7 */ |
239 | .oclrintradr = R_DMA_CH6_CLR_INTR, | 239 | .oclrintradr = R_DMA_CH6_CLR_INTR, |
240 | .ofirstadr = R_DMA_CH6_FIRST, | 240 | .ofirstadr = R_DMA_CH6_FIRST, |
@@ -288,7 +288,7 @@ static struct e100_serial rs_table[] = { | |||
288 | }, /* ttyS0 */ | 288 | }, /* ttyS0 */ |
289 | #ifndef CONFIG_SVINTO_SIM | 289 | #ifndef CONFIG_SVINTO_SIM |
290 | { .baud = DEF_BAUD, | 290 | { .baud = DEF_BAUD, |
291 | .port = (unsigned char *)R_SERIAL1_CTRL, | 291 | .ioport = (unsigned char *)R_SERIAL1_CTRL, |
292 | .irq = 1U << 16, /* uses DMA 8 and 9 */ | 292 | .irq = 1U << 16, /* uses DMA 8 and 9 */ |
293 | .oclrintradr = R_DMA_CH8_CLR_INTR, | 293 | .oclrintradr = R_DMA_CH8_CLR_INTR, |
294 | .ofirstadr = R_DMA_CH8_FIRST, | 294 | .ofirstadr = R_DMA_CH8_FIRST, |
@@ -344,7 +344,7 @@ static struct e100_serial rs_table[] = { | |||
344 | }, /* ttyS1 */ | 344 | }, /* ttyS1 */ |
345 | 345 | ||
346 | { .baud = DEF_BAUD, | 346 | { .baud = DEF_BAUD, |
347 | .port = (unsigned char *)R_SERIAL2_CTRL, | 347 | .ioport = (unsigned char *)R_SERIAL2_CTRL, |
348 | .irq = 1U << 4, /* uses DMA 2 and 3 */ | 348 | .irq = 1U << 4, /* uses DMA 2 and 3 */ |
349 | .oclrintradr = R_DMA_CH2_CLR_INTR, | 349 | .oclrintradr = R_DMA_CH2_CLR_INTR, |
350 | .ofirstadr = R_DMA_CH2_FIRST, | 350 | .ofirstadr = R_DMA_CH2_FIRST, |
@@ -398,7 +398,7 @@ static struct e100_serial rs_table[] = { | |||
398 | }, /* ttyS2 */ | 398 | }, /* ttyS2 */ |
399 | 399 | ||
400 | { .baud = DEF_BAUD, | 400 | { .baud = DEF_BAUD, |
401 | .port = (unsigned char *)R_SERIAL3_CTRL, | 401 | .ioport = (unsigned char *)R_SERIAL3_CTRL, |
402 | .irq = 1U << 8, /* uses DMA 4 and 5 */ | 402 | .irq = 1U << 8, /* uses DMA 4 and 5 */ |
403 | .oclrintradr = R_DMA_CH4_CLR_INTR, | 403 | .oclrintradr = R_DMA_CH4_CLR_INTR, |
404 | .ofirstadr = R_DMA_CH4_FIRST, | 404 | .ofirstadr = R_DMA_CH4_FIRST, |
@@ -457,7 +457,6 @@ static struct e100_serial rs_table[] = { | |||
457 | #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) | 457 | #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) |
458 | 458 | ||
459 | static struct ktermios *serial_termios[NR_PORTS]; | 459 | static struct ktermios *serial_termios[NR_PORTS]; |
460 | static struct ktermios *serial_termios_locked[NR_PORTS]; | ||
461 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER | 460 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER |
462 | static struct fast_timer fast_timers[NR_PORTS]; | 461 | static struct fast_timer fast_timers[NR_PORTS]; |
463 | #endif | 462 | #endif |
@@ -939,7 +938,7 @@ static const struct control_pins e100_modem_pins[NR_PORTS] = | |||
939 | /* Output */ | 938 | /* Output */ |
940 | #define E100_RTS_GET(info) ((info)->rx_ctrl & E100_RTS_MASK) | 939 | #define E100_RTS_GET(info) ((info)->rx_ctrl & E100_RTS_MASK) |
941 | /* Input */ | 940 | /* Input */ |
942 | #define E100_CTS_GET(info) ((info)->port[REG_STATUS] & E100_CTS_MASK) | 941 | #define E100_CTS_GET(info) ((info)->ioport[REG_STATUS] & E100_CTS_MASK) |
943 | 942 | ||
944 | /* These are typically PA or PB and 0 means 0V, 1 means 3.3V */ | 943 | /* These are typically PA or PB and 0 means 0V, 1 means 3.3V */ |
945 | /* Is an output */ | 944 | /* Is an output */ |
@@ -968,7 +967,7 @@ static DEFINE_MUTEX(tmp_buf_mutex); | |||
968 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ | 967 | /* Calculate the chartime depending on baudrate, numbor of bits etc. */ |
969 | static void update_char_time(struct e100_serial * info) | 968 | static void update_char_time(struct e100_serial * info) |
970 | { | 969 | { |
971 | tcflag_t cflags = info->tty->termios->c_cflag; | 970 | tcflag_t cflags = info->port.tty->termios->c_cflag; |
972 | int bits; | 971 | int bits; |
973 | 972 | ||
974 | /* calc. number of bits / data byte */ | 973 | /* calc. number of bits / data byte */ |
@@ -1092,7 +1091,7 @@ e100_rts(struct e100_serial *info, int set) | |||
1092 | local_irq_save(flags); | 1091 | local_irq_save(flags); |
1093 | info->rx_ctrl &= ~E100_RTS_MASK; | 1092 | info->rx_ctrl &= ~E100_RTS_MASK; |
1094 | info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ | 1093 | info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ |
1095 | info->port[REG_REC_CTRL] = info->rx_ctrl; | 1094 | info->ioport[REG_REC_CTRL] = info->rx_ctrl; |
1096 | local_irq_restore(flags); | 1095 | local_irq_restore(flags); |
1097 | #ifdef SERIAL_DEBUG_IO | 1096 | #ifdef SERIAL_DEBUG_IO |
1098 | printk("ser%i rts %i\n", info->line, set); | 1097 | printk("ser%i rts %i\n", info->line, set); |
@@ -1142,7 +1141,7 @@ e100_disable_rx(struct e100_serial *info) | |||
1142 | { | 1141 | { |
1143 | #ifndef CONFIG_SVINTO_SIM | 1142 | #ifndef CONFIG_SVINTO_SIM |
1144 | /* disable the receiver */ | 1143 | /* disable the receiver */ |
1145 | info->port[REG_REC_CTRL] = | 1144 | info->ioport[REG_REC_CTRL] = |
1146 | (info->rx_ctrl &= ~IO_MASK(R_SERIAL0_REC_CTRL, rec_enable)); | 1145 | (info->rx_ctrl &= ~IO_MASK(R_SERIAL0_REC_CTRL, rec_enable)); |
1147 | #endif | 1146 | #endif |
1148 | } | 1147 | } |
@@ -1152,7 +1151,7 @@ e100_enable_rx(struct e100_serial *info) | |||
1152 | { | 1151 | { |
1153 | #ifndef CONFIG_SVINTO_SIM | 1152 | #ifndef CONFIG_SVINTO_SIM |
1154 | /* enable the receiver */ | 1153 | /* enable the receiver */ |
1155 | info->port[REG_REC_CTRL] = | 1154 | info->ioport[REG_REC_CTRL] = |
1156 | (info->rx_ctrl |= IO_MASK(R_SERIAL0_REC_CTRL, rec_enable)); | 1155 | (info->rx_ctrl |= IO_MASK(R_SERIAL0_REC_CTRL, rec_enable)); |
1157 | #endif | 1156 | #endif |
1158 | } | 1157 | } |
@@ -1483,13 +1482,14 @@ rs_stop(struct tty_struct *tty) | |||
1483 | CIRC_CNT(info->xmit.head, | 1482 | CIRC_CNT(info->xmit.head, |
1484 | info->xmit.tail,SERIAL_XMIT_SIZE))); | 1483 | info->xmit.tail,SERIAL_XMIT_SIZE))); |
1485 | 1484 | ||
1486 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); | 1485 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, |
1486 | STOP_CHAR(info->port.tty)); | ||
1487 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); | 1487 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); |
1488 | if (tty->termios->c_iflag & IXON ) { | 1488 | if (tty->termios->c_iflag & IXON ) { |
1489 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); | 1489 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; | 1492 | *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; |
1493 | local_irq_restore(flags); | 1493 | local_irq_restore(flags); |
1494 | } | 1494 | } |
1495 | } | 1495 | } |
@@ -1512,7 +1512,7 @@ rs_start(struct tty_struct *tty) | |||
1512 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); | 1512 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; | 1515 | *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; |
1516 | if (!info->uses_dma_out && | 1516 | if (!info->uses_dma_out && |
1517 | info->xmit.head != info->xmit.tail && info->xmit.buf) | 1517 | info->xmit.head != info->xmit.tail && info->xmit.buf) |
1518 | e100_enable_serial_tx_ready_irq(info); | 1518 | e100_enable_serial_tx_ready_irq(info); |
@@ -1772,7 +1772,7 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char fl | |||
1772 | 1772 | ||
1773 | info->icount.rx++; | 1773 | info->icount.rx++; |
1774 | } else { | 1774 | } else { |
1775 | struct tty_struct *tty = info->tty; | 1775 | struct tty_struct *tty = info->port.tty; |
1776 | tty_insert_flip_char(tty, data, flag); | 1776 | tty_insert_flip_char(tty, data, flag); |
1777 | info->icount.rx++; | 1777 | info->icount.rx++; |
1778 | } | 1778 | } |
@@ -1838,7 +1838,7 @@ static unsigned int handle_all_descr_data(struct e100_serial *info) | |||
1838 | descr->status = 0; | 1838 | descr->status = 0; |
1839 | 1839 | ||
1840 | DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl); | 1840 | DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl); |
1841 | if (info->tty->stopped) { | 1841 | if (info->port.tty->stopped) { |
1842 | unsigned char *buf = phys_to_virt(descr->buf); | 1842 | unsigned char *buf = phys_to_virt(descr->buf); |
1843 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]); | 1843 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]); |
1844 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]); | 1844 | DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]); |
@@ -1872,7 +1872,7 @@ static void receive_chars_dma(struct e100_serial *info) | |||
1872 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | | 1872 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | |
1873 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); | 1873 | IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); |
1874 | 1874 | ||
1875 | tty = info->tty; | 1875 | tty = info->port.tty; |
1876 | if (!tty) /* Something wrong... */ | 1876 | if (!tty) /* Something wrong... */ |
1877 | return; | 1877 | return; |
1878 | 1878 | ||
@@ -1887,7 +1887,7 @@ static void receive_chars_dma(struct e100_serial *info) | |||
1887 | handle_all_descr_data(info); | 1887 | handle_all_descr_data(info); |
1888 | 1888 | ||
1889 | /* Read the status register to detect errors */ | 1889 | /* Read the status register to detect errors */ |
1890 | rstat = info->port[REG_STATUS]; | 1890 | rstat = info->ioport[REG_STATUS]; |
1891 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) { | 1891 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) { |
1892 | DFLOW(DEBUG_LOG(info->line, "XOFF detect stat %x\n", rstat)); | 1892 | DFLOW(DEBUG_LOG(info->line, "XOFF detect stat %x\n", rstat)); |
1893 | } | 1893 | } |
@@ -1896,7 +1896,7 @@ static void receive_chars_dma(struct e100_serial *info) | |||
1896 | /* If we got an error, we must reset it by reading the | 1896 | /* If we got an error, we must reset it by reading the |
1897 | * data_in field | 1897 | * data_in field |
1898 | */ | 1898 | */ |
1899 | unsigned char data = info->port[REG_DATA]; | 1899 | unsigned char data = info->ioport[REG_DATA]; |
1900 | 1900 | ||
1901 | PROCSTAT(ser_stat[info->line].errors_cnt++); | 1901 | PROCSTAT(ser_stat[info->line].errors_cnt++); |
1902 | DEBUG_LOG(info->line, "#dERR: s d 0x%04X\n", | 1902 | DEBUG_LOG(info->line, "#dERR: s d 0x%04X\n", |
@@ -2076,7 +2076,7 @@ static int force_eop_if_needed(struct e100_serial *info) | |||
2076 | /* We check data_avail bit to determine if data has | 2076 | /* We check data_avail bit to determine if data has |
2077 | * arrived since last time | 2077 | * arrived since last time |
2078 | */ | 2078 | */ |
2079 | unsigned char rstat = info->port[REG_STATUS]; | 2079 | unsigned char rstat = info->ioport[REG_STATUS]; |
2080 | 2080 | ||
2081 | /* error or datavail? */ | 2081 | /* error or datavail? */ |
2082 | if (rstat & SER_ERROR_MASK) { | 2082 | if (rstat & SER_ERROR_MASK) { |
@@ -2095,7 +2095,7 @@ static int force_eop_if_needed(struct e100_serial *info) | |||
2095 | TIMERD(DEBUG_LOG(info->line, "timeout: rstat 0x%03X\n", | 2095 | TIMERD(DEBUG_LOG(info->line, "timeout: rstat 0x%03X\n", |
2096 | rstat | (info->line << 8))); | 2096 | rstat | (info->line << 8))); |
2097 | /* Read data to clear status flags */ | 2097 | /* Read data to clear status flags */ |
2098 | (void)info->port[REG_DATA]; | 2098 | (void)info->ioport[REG_DATA]; |
2099 | 2099 | ||
2100 | info->forced_eop = 0; | 2100 | info->forced_eop = 0; |
2101 | START_FLUSH_FAST_TIMER(info, "magic"); | 2101 | START_FLUSH_FAST_TIMER(info, "magic"); |
@@ -2122,7 +2122,7 @@ static void flush_to_flip_buffer(struct e100_serial *info) | |||
2122 | unsigned long flags; | 2122 | unsigned long flags; |
2123 | 2123 | ||
2124 | local_irq_save(flags); | 2124 | local_irq_save(flags); |
2125 | tty = info->tty; | 2125 | tty = info->port.tty; |
2126 | 2126 | ||
2127 | if (!tty) { | 2127 | if (!tty) { |
2128 | local_irq_restore(flags); | 2128 | local_irq_restore(flags); |
@@ -2287,7 +2287,7 @@ static | |||
2287 | struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) | 2287 | struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) |
2288 | { | 2288 | { |
2289 | unsigned long data_read; | 2289 | unsigned long data_read; |
2290 | struct tty_struct *tty = info->tty; | 2290 | struct tty_struct *tty = info->port.tty; |
2291 | 2291 | ||
2292 | if (!tty) { | 2292 | if (!tty) { |
2293 | printk("!NO TTY!\n"); | 2293 | printk("!NO TTY!\n"); |
@@ -2295,7 +2295,7 @@ struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) | |||
2295 | } | 2295 | } |
2296 | 2296 | ||
2297 | /* Read data and status at the same time */ | 2297 | /* Read data and status at the same time */ |
2298 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); | 2298 | data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]); |
2299 | more_data: | 2299 | more_data: |
2300 | if (data_read & IO_MASK(R_SERIAL0_READ, xoff_detect) ) { | 2300 | if (data_read & IO_MASK(R_SERIAL0_READ, xoff_detect) ) { |
2301 | DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); | 2301 | DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); |
@@ -2350,7 +2350,7 @@ more_data: | |||
2350 | data_in, data_read); | 2350 | data_in, data_read); |
2351 | char flag = TTY_NORMAL; | 2351 | char flag = TTY_NORMAL; |
2352 | if (info->errorcode == ERRCODE_INSERT_BREAK) { | 2352 | if (info->errorcode == ERRCODE_INSERT_BREAK) { |
2353 | struct tty_struct *tty = info->tty; | 2353 | struct tty_struct *tty = info->port.tty; |
2354 | tty_insert_flip_char(tty, 0, flag); | 2354 | tty_insert_flip_char(tty, 0, flag); |
2355 | info->icount.rx++; | 2355 | info->icount.rx++; |
2356 | } | 2356 | } |
@@ -2390,13 +2390,13 @@ more_data: | |||
2390 | 2390 | ||
2391 | 2391 | ||
2392 | info->icount.rx++; | 2392 | info->icount.rx++; |
2393 | data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]); | 2393 | data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]); |
2394 | if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { | 2394 | if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) { |
2395 | DEBUG_LOG(info->line, "ser_rx %c in loop\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read)); | 2395 | DEBUG_LOG(info->line, "ser_rx %c in loop\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read)); |
2396 | goto more_data; | 2396 | goto more_data; |
2397 | } | 2397 | } |
2398 | 2398 | ||
2399 | tty_flip_buffer_push(info->tty); | 2399 | tty_flip_buffer_push(info->port.tty); |
2400 | return info; | 2400 | return info; |
2401 | } | 2401 | } |
2402 | 2402 | ||
@@ -2412,7 +2412,7 @@ static struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info) | |||
2412 | return handle_ser_rx_interrupt_no_dma(info); | 2412 | return handle_ser_rx_interrupt_no_dma(info); |
2413 | } | 2413 | } |
2414 | /* DMA is used */ | 2414 | /* DMA is used */ |
2415 | rstat = info->port[REG_STATUS]; | 2415 | rstat = info->ioport[REG_STATUS]; |
2416 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) { | 2416 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) { |
2417 | DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); | 2417 | DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); |
2418 | } | 2418 | } |
@@ -2425,7 +2425,7 @@ static struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info) | |||
2425 | /* If we got an error, we must reset it by reading the | 2425 | /* If we got an error, we must reset it by reading the |
2426 | * data_in field | 2426 | * data_in field |
2427 | */ | 2427 | */ |
2428 | data = info->port[REG_DATA]; | 2428 | data = info->ioport[REG_DATA]; |
2429 | DINTR1(DEBUG_LOG(info->line, "ser_rx! %c\n", data)); | 2429 | DINTR1(DEBUG_LOG(info->line, "ser_rx! %c\n", data)); |
2430 | DINTR1(DEBUG_LOG(info->line, "ser_rx err stat %02X\n", rstat)); | 2430 | DINTR1(DEBUG_LOG(info->line, "ser_rx err stat %02X\n", rstat)); |
2431 | if (!data && (rstat & SER_FRAMING_ERR_MASK)) { | 2431 | if (!data && (rstat & SER_FRAMING_ERR_MASK)) { |
@@ -2527,10 +2527,10 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2527 | unsigned char rstat; | 2527 | unsigned char rstat; |
2528 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); | 2528 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); |
2529 | local_irq_save(flags); | 2529 | local_irq_save(flags); |
2530 | rstat = info->port[REG_STATUS]; | 2530 | rstat = info->ioport[REG_STATUS]; |
2531 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); | 2531 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); |
2532 | 2532 | ||
2533 | info->port[REG_TR_DATA] = info->x_char; | 2533 | info->ioport[REG_TR_DATA] = info->x_char; |
2534 | info->icount.tx++; | 2534 | info->icount.tx++; |
2535 | info->x_char = 0; | 2535 | info->x_char = 0; |
2536 | /* We must enable since it is disabled in ser_interrupt */ | 2536 | /* We must enable since it is disabled in ser_interrupt */ |
@@ -2544,11 +2544,11 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2544 | /* We only use normal tx interrupt when sending x_char */ | 2544 | /* We only use normal tx interrupt when sending x_char */ |
2545 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); | 2545 | DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); |
2546 | local_irq_save(flags); | 2546 | local_irq_save(flags); |
2547 | rstat = info->port[REG_STATUS]; | 2547 | rstat = info->ioport[REG_STATUS]; |
2548 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); | 2548 | DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); |
2549 | e100_disable_serial_tx_ready_irq(info); | 2549 | e100_disable_serial_tx_ready_irq(info); |
2550 | if (info->tty->stopped) | 2550 | if (info->port.tty->stopped) |
2551 | rs_stop(info->tty); | 2551 | rs_stop(info->port.tty); |
2552 | /* Enable the DMA channel and tell it to continue */ | 2552 | /* Enable the DMA channel and tell it to continue */ |
2553 | e100_enable_txdma_channel(info); | 2553 | e100_enable_txdma_channel(info); |
2554 | /* Wait 12 cycles before doing the DMA command */ | 2554 | /* Wait 12 cycles before doing the DMA command */ |
@@ -2561,9 +2561,10 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2561 | } | 2561 | } |
2562 | /* Normal char-by-char interrupt */ | 2562 | /* Normal char-by-char interrupt */ |
2563 | if (info->xmit.head == info->xmit.tail | 2563 | if (info->xmit.head == info->xmit.tail |
2564 | || info->tty->stopped | 2564 | || info->port.tty->stopped |
2565 | || info->tty->hw_stopped) { | 2565 | || info->port.tty->hw_stopped) { |
2566 | DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", info->tty->stopped)); | 2566 | DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", |
2567 | info->port.tty->stopped)); | ||
2567 | e100_disable_serial_tx_ready_irq(info); | 2568 | e100_disable_serial_tx_ready_irq(info); |
2568 | info->tr_running = 0; | 2569 | info->tr_running = 0; |
2569 | return; | 2570 | return; |
@@ -2571,7 +2572,7 @@ static void handle_ser_tx_interrupt(struct e100_serial *info) | |||
2571 | DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); | 2572 | DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); |
2572 | /* Send a byte, rs485 timing is critical so turn of ints */ | 2573 | /* Send a byte, rs485 timing is critical so turn of ints */ |
2573 | local_irq_save(flags); | 2574 | local_irq_save(flags); |
2574 | info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; | 2575 | info->ioport[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; |
2575 | info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); | 2576 | info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); |
2576 | info->icount.tx++; | 2577 | info->icount.tx++; |
2577 | if (info->xmit.head == info->xmit.tail) { | 2578 | if (info->xmit.head == info->xmit.tail) { |
@@ -2725,7 +2726,7 @@ do_softint(struct work_struct *work) | |||
2725 | 2726 | ||
2726 | info = container_of(work, struct e100_serial, work); | 2727 | info = container_of(work, struct e100_serial, work); |
2727 | 2728 | ||
2728 | tty = info->tty; | 2729 | tty = info->port.tty; |
2729 | if (!tty) | 2730 | if (!tty) |
2730 | return; | 2731 | return; |
2731 | 2732 | ||
@@ -2767,8 +2768,8 @@ startup(struct e100_serial * info) | |||
2767 | /* Bits and pieces collected from below. Better to have them | 2768 | /* Bits and pieces collected from below. Better to have them |
2768 | in one ifdef:ed clause than to mix in a lot of ifdefs, | 2769 | in one ifdef:ed clause than to mix in a lot of ifdefs, |
2769 | right? */ | 2770 | right? */ |
2770 | if (info->tty) | 2771 | if (info->port.tty) |
2771 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 2772 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2772 | 2773 | ||
2773 | info->xmit.head = info->xmit.tail = 0; | 2774 | info->xmit.head = info->xmit.tail = 0; |
2774 | info->first_recv_buffer = info->last_recv_buffer = NULL; | 2775 | info->first_recv_buffer = info->last_recv_buffer = NULL; |
@@ -2825,8 +2826,8 @@ startup(struct e100_serial * info) | |||
2825 | e100_disable_txdma_channel(info); | 2826 | e100_disable_txdma_channel(info); |
2826 | } | 2827 | } |
2827 | 2828 | ||
2828 | if (info->tty) | 2829 | if (info->port.tty) |
2829 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 2830 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2830 | 2831 | ||
2831 | info->xmit.head = info->xmit.tail = 0; | 2832 | info->xmit.head = info->xmit.tail = 0; |
2832 | info->first_recv_buffer = info->last_recv_buffer = NULL; | 2833 | info->first_recv_buffer = info->last_recv_buffer = NULL; |
@@ -2846,7 +2847,7 @@ startup(struct e100_serial * info) | |||
2846 | 2847 | ||
2847 | /* dummy read to reset any serial errors */ | 2848 | /* dummy read to reset any serial errors */ |
2848 | 2849 | ||
2849 | (void)info->port[REG_DATA]; | 2850 | (void)info->ioport[REG_DATA]; |
2850 | 2851 | ||
2851 | /* enable the interrupts */ | 2852 | /* enable the interrupts */ |
2852 | if (info->uses_dma_out) | 2853 | if (info->uses_dma_out) |
@@ -2895,7 +2896,7 @@ shutdown(struct e100_serial * info) | |||
2895 | /* shut down the transmitter and receiver */ | 2896 | /* shut down the transmitter and receiver */ |
2896 | DFLOW(DEBUG_LOG(info->line, "shutdown %i\n", info->line)); | 2897 | DFLOW(DEBUG_LOG(info->line, "shutdown %i\n", info->line)); |
2897 | e100_disable_rx(info); | 2898 | e100_disable_rx(info); |
2898 | info->port[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40); | 2899 | info->ioport[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40); |
2899 | 2900 | ||
2900 | /* disable interrupts, reset dma channels */ | 2901 | /* disable interrupts, reset dma channels */ |
2901 | if (info->uses_dma_in) { | 2902 | if (info->uses_dma_in) { |
@@ -2940,14 +2941,14 @@ shutdown(struct e100_serial * info) | |||
2940 | descr[i].buf = 0; | 2941 | descr[i].buf = 0; |
2941 | } | 2942 | } |
2942 | 2943 | ||
2943 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { | 2944 | if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) { |
2944 | /* hang up DTR and RTS if HUPCL is enabled */ | 2945 | /* hang up DTR and RTS if HUPCL is enabled */ |
2945 | e100_dtr(info, 0); | 2946 | e100_dtr(info, 0); |
2946 | e100_rts(info, 0); /* could check CRTSCTS before doing this */ | 2947 | e100_rts(info, 0); /* could check CRTSCTS before doing this */ |
2947 | } | 2948 | } |
2948 | 2949 | ||
2949 | if (info->tty) | 2950 | if (info->port.tty) |
2950 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2951 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2951 | 2952 | ||
2952 | info->flags &= ~ASYNC_INITIALIZED; | 2953 | info->flags &= ~ASYNC_INITIALIZED; |
2953 | local_irq_restore(flags); | 2954 | local_irq_restore(flags); |
@@ -2964,12 +2965,12 @@ change_speed(struct e100_serial *info) | |||
2964 | unsigned long flags; | 2965 | unsigned long flags; |
2965 | /* first some safety checks */ | 2966 | /* first some safety checks */ |
2966 | 2967 | ||
2967 | if (!info->tty || !info->tty->termios) | 2968 | if (!info->port.tty || !info->port.tty->termios) |
2968 | return; | 2969 | return; |
2969 | if (!info->port) | 2970 | if (!info->ioport) |
2970 | return; | 2971 | return; |
2971 | 2972 | ||
2972 | cflag = info->tty->termios->c_cflag; | 2973 | cflag = info->port.tty->termios->c_cflag; |
2973 | 2974 | ||
2974 | /* possibly, the tx/rx should be disabled first to do this safely */ | 2975 | /* possibly, the tx/rx should be disabled first to do this safely */ |
2975 | 2976 | ||
@@ -3035,7 +3036,7 @@ change_speed(struct e100_serial *info) | |||
3035 | 3036 | ||
3036 | info->baud = cflag_to_baud(cflag); | 3037 | info->baud = cflag_to_baud(cflag); |
3037 | #ifndef CONFIG_SVINTO_SIM | 3038 | #ifndef CONFIG_SVINTO_SIM |
3038 | info->port[REG_BAUD] = cflag_to_etrax_baud(cflag); | 3039 | info->ioport[REG_BAUD] = cflag_to_etrax_baud(cflag); |
3039 | #endif /* CONFIG_SVINTO_SIM */ | 3040 | #endif /* CONFIG_SVINTO_SIM */ |
3040 | } | 3041 | } |
3041 | 3042 | ||
@@ -3095,16 +3096,17 @@ change_speed(struct e100_serial *info) | |||
3095 | 3096 | ||
3096 | /* actually write the control regs to the hardware */ | 3097 | /* actually write the control regs to the hardware */ |
3097 | 3098 | ||
3098 | info->port[REG_TR_CTRL] = info->tx_ctrl; | 3099 | info->ioport[REG_TR_CTRL] = info->tx_ctrl; |
3099 | info->port[REG_REC_CTRL] = info->rx_ctrl; | 3100 | info->ioport[REG_REC_CTRL] = info->rx_ctrl; |
3100 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); | 3101 | xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty)); |
3101 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); | 3102 | xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); |
3102 | if (info->tty->termios->c_iflag & IXON ) { | 3103 | if (info->port.tty->termios->c_iflag & IXON ) { |
3103 | DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", STOP_CHAR(info->tty))); | 3104 | DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", |
3105 | STOP_CHAR(info->port.tty))); | ||
3104 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); | 3106 | xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); |
3105 | } | 3107 | } |
3106 | 3108 | ||
3107 | *((unsigned long *)&info->port[REG_XOFF]) = xoff; | 3109 | *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; |
3108 | local_irq_restore(flags); | 3110 | local_irq_restore(flags); |
3109 | #endif /* !CONFIG_SVINTO_SIM */ | 3111 | #endif /* !CONFIG_SVINTO_SIM */ |
3110 | 3112 | ||
@@ -3153,7 +3155,7 @@ static int rs_raw_write(struct tty_struct *tty, | |||
3153 | #ifdef SERIAL_DEBUG_DATA | 3155 | #ifdef SERIAL_DEBUG_DATA |
3154 | if (info->line == SERIAL_DEBUG_LINE) | 3156 | if (info->line == SERIAL_DEBUG_LINE) |
3155 | printk("rs_raw_write (%d), status %d\n", | 3157 | printk("rs_raw_write (%d), status %d\n", |
3156 | count, info->port[REG_STATUS]); | 3158 | count, info->ioport[REG_STATUS]); |
3157 | #endif | 3159 | #endif |
3158 | 3160 | ||
3159 | #ifdef CONFIG_SVINTO_SIM | 3161 | #ifdef CONFIG_SVINTO_SIM |
@@ -3424,7 +3426,7 @@ get_serial_info(struct e100_serial * info, | |||
3424 | memset(&tmp, 0, sizeof(tmp)); | 3426 | memset(&tmp, 0, sizeof(tmp)); |
3425 | tmp.type = info->type; | 3427 | tmp.type = info->type; |
3426 | tmp.line = info->line; | 3428 | tmp.line = info->line; |
3427 | tmp.port = (int)info->port; | 3429 | tmp.port = (int)info->ioport; |
3428 | tmp.irq = info->irq; | 3430 | tmp.irq = info->irq; |
3429 | tmp.flags = info->flags; | 3431 | tmp.flags = info->flags; |
3430 | tmp.baud_base = info->baud_base; | 3432 | tmp.baud_base = info->baud_base; |
@@ -3475,7 +3477,7 @@ set_serial_info(struct e100_serial *info, | |||
3475 | info->type = new_serial.type; | 3477 | info->type = new_serial.type; |
3476 | info->close_delay = new_serial.close_delay; | 3478 | info->close_delay = new_serial.close_delay; |
3477 | info->closing_wait = new_serial.closing_wait; | 3479 | info->closing_wait = new_serial.closing_wait; |
3478 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 3480 | info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
3479 | 3481 | ||
3480 | check_and_exit: | 3482 | check_and_exit: |
3481 | if (info->flags & ASYNC_INITIALIZED) { | 3483 | if (info->flags & ASYNC_INITIALIZED) { |
@@ -3554,14 +3556,14 @@ char *get_control_state_str(int MLines, char *s) | |||
3554 | } | 3556 | } |
3555 | #endif | 3557 | #endif |
3556 | 3558 | ||
3557 | static void | 3559 | static int |
3558 | rs_break(struct tty_struct *tty, int break_state) | 3560 | rs_break(struct tty_struct *tty, int break_state) |
3559 | { | 3561 | { |
3560 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; | 3562 | struct e100_serial *info = (struct e100_serial *)tty->driver_data; |
3561 | unsigned long flags; | 3563 | unsigned long flags; |
3562 | 3564 | ||
3563 | if (!info->port) | 3565 | if (!info->ioport) |
3564 | return; | 3566 | return -EIO; |
3565 | 3567 | ||
3566 | local_irq_save(flags); | 3568 | local_irq_save(flags); |
3567 | if (break_state == -1) { | 3569 | if (break_state == -1) { |
@@ -3572,8 +3574,9 @@ rs_break(struct tty_struct *tty, int break_state) | |||
3572 | /* Set bit 7 (txd) and 6 (tr_enable) */ | 3574 | /* Set bit 7 (txd) and 6 (tr_enable) */ |
3573 | info->tx_ctrl |= (0x80 | 0x40); | 3575 | info->tx_ctrl |= (0x80 | 0x40); |
3574 | } | 3576 | } |
3575 | info->port[REG_TR_CTRL] = info->tx_ctrl; | 3577 | info->ioport[REG_TR_CTRL] = info->tx_ctrl; |
3576 | local_irq_restore(flags); | 3578 | local_irq_restore(flags); |
3579 | return 0; | ||
3577 | } | 3580 | } |
3578 | 3581 | ||
3579 | static int | 3582 | static int |
@@ -3811,7 +3814,7 @@ rs_close(struct tty_struct *tty, struct file * filp) | |||
3811 | tty_ldisc_flush(tty); | 3814 | tty_ldisc_flush(tty); |
3812 | tty->closing = 0; | 3815 | tty->closing = 0; |
3813 | info->event = 0; | 3816 | info->event = 0; |
3814 | info->tty = 0; | 3817 | info->port.tty = NULL; |
3815 | if (info->blocked_open) { | 3818 | if (info->blocked_open) { |
3816 | if (info->close_delay) | 3819 | if (info->close_delay) |
3817 | schedule_timeout_interruptible(info->close_delay); | 3820 | schedule_timeout_interruptible(info->close_delay); |
@@ -3915,7 +3918,7 @@ rs_hangup(struct tty_struct *tty) | |||
3915 | info->event = 0; | 3918 | info->event = 0; |
3916 | info->count = 0; | 3919 | info->count = 0; |
3917 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 3920 | info->flags &= ~ASYNC_NORMAL_ACTIVE; |
3918 | info->tty = 0; | 3921 | info->port.tty = NULL; |
3919 | wake_up_interruptible(&info->open_wait); | 3922 | wake_up_interruptible(&info->open_wait); |
3920 | } | 3923 | } |
3921 | 3924 | ||
@@ -4077,9 +4080,9 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4077 | 4080 | ||
4078 | info->count++; | 4081 | info->count++; |
4079 | tty->driver_data = info; | 4082 | tty->driver_data = info; |
4080 | info->tty = tty; | 4083 | info->port.tty = tty; |
4081 | 4084 | ||
4082 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 4085 | info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
4083 | 4086 | ||
4084 | if (!tmp_buf) { | 4087 | if (!tmp_buf) { |
4085 | page = get_zeroed_page(GFP_KERNEL); | 4088 | page = get_zeroed_page(GFP_KERNEL); |
@@ -4228,9 +4231,9 @@ static int line_info(char *buf, struct e100_serial *info) | |||
4228 | unsigned long tmp; | 4231 | unsigned long tmp; |
4229 | 4232 | ||
4230 | ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d", | 4233 | ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d", |
4231 | info->line, (unsigned long)info->port, info->irq); | 4234 | info->line, (unsigned long)info->ioport, info->irq); |
4232 | 4235 | ||
4233 | if (!info->port || (info->type == PORT_UNKNOWN)) { | 4236 | if (!info->ioport || (info->type == PORT_UNKNOWN)) { |
4234 | ret += sprintf(buf+ret, "\n"); | 4237 | ret += sprintf(buf+ret, "\n"); |
4235 | return ret; | 4238 | return ret; |
4236 | } | 4239 | } |
@@ -4267,18 +4270,18 @@ static int line_info(char *buf, struct e100_serial *info) | |||
4267 | (unsigned long)info->max_recv_cnt); | 4270 | (unsigned long)info->max_recv_cnt); |
4268 | 4271 | ||
4269 | #if 1 | 4272 | #if 1 |
4270 | if (info->tty) { | 4273 | if (info->port.tty) { |
4271 | 4274 | ||
4272 | if (info->tty->stopped) | 4275 | if (info->port.tty->stopped) |
4273 | ret += sprintf(buf+ret, " stopped:%i", | 4276 | ret += sprintf(buf+ret, " stopped:%i", |
4274 | (int)info->tty->stopped); | 4277 | (int)info->port.tty->stopped); |
4275 | if (info->tty->hw_stopped) | 4278 | if (info->port.tty->hw_stopped) |
4276 | ret += sprintf(buf+ret, " hw_stopped:%i", | 4279 | ret += sprintf(buf+ret, " hw_stopped:%i", |
4277 | (int)info->tty->hw_stopped); | 4280 | (int)info->port.tty->hw_stopped); |
4278 | } | 4281 | } |
4279 | 4282 | ||
4280 | { | 4283 | { |
4281 | unsigned char rstat = info->port[REG_STATUS]; | 4284 | unsigned char rstat = info->ioport[REG_STATUS]; |
4282 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) | 4285 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) |
4283 | ret += sprintf(buf+ret, " xoff_detect:1"); | 4286 | ret += sprintf(buf+ret, " xoff_detect:1"); |
4284 | } | 4287 | } |
@@ -4415,6 +4418,7 @@ rs_init(void) | |||
4415 | rs485_pa_bit)) { | 4418 | rs485_pa_bit)) { |
4416 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | 4419 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " |
4417 | "RS485 pin\n"); | 4420 | "RS485 pin\n"); |
4421 | put_tty_driver(driver); | ||
4418 | return -EBUSY; | 4422 | return -EBUSY; |
4419 | } | 4423 | } |
4420 | #endif | 4424 | #endif |
@@ -4423,6 +4427,7 @@ rs_init(void) | |||
4423 | rs485_port_g_bit)) { | 4427 | rs485_port_g_bit)) { |
4424 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " | 4428 | printk(KERN_CRIT "ETRAX100LX serial: Could not allocate " |
4425 | "RS485 pin\n"); | 4429 | "RS485 pin\n"); |
4430 | put_tty_driver(driver); | ||
4426 | return -EBUSY; | 4431 | return -EBUSY; |
4427 | } | 4432 | } |
4428 | #endif | 4433 | #endif |
@@ -4442,8 +4447,6 @@ rs_init(void) | |||
4442 | driver->init_termios.c_ispeed = 115200; | 4447 | driver->init_termios.c_ispeed = 115200; |
4443 | driver->init_termios.c_ospeed = 115200; | 4448 | driver->init_termios.c_ospeed = 115200; |
4444 | driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; | 4449 | driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
4445 | driver->termios = serial_termios; | ||
4446 | driver->termios_locked = serial_termios_locked; | ||
4447 | 4450 | ||
4448 | tty_set_operations(driver, &rs_ops); | 4451 | tty_set_operations(driver, &rs_ops); |
4449 | serial_driver = driver; | 4452 | serial_driver = driver; |
@@ -4465,7 +4468,7 @@ rs_init(void) | |||
4465 | info->uses_dma_in = 0; | 4468 | info->uses_dma_in = 0; |
4466 | info->uses_dma_out = 0; | 4469 | info->uses_dma_out = 0; |
4467 | info->line = i; | 4470 | info->line = i; |
4468 | info->tty = 0; | 4471 | info->port.tty = NULL; |
4469 | info->type = PORT_ETRAX; | 4472 | info->type = PORT_ETRAX; |
4470 | info->tr_running = 0; | 4473 | info->tr_running = 0; |
4471 | info->forced_eop = 0; | 4474 | info->forced_eop = 0; |
@@ -4499,7 +4502,7 @@ rs_init(void) | |||
4499 | 4502 | ||
4500 | if (info->enabled) { | 4503 | if (info->enabled) { |
4501 | printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n", | 4504 | printk(KERN_INFO "%s%d at 0x%x is a builtin UART with DMA\n", |
4502 | serial_driver->name, info->line, (unsigned int)info->port); | 4505 | serial_driver->name, info->line, (unsigned int)info->ioport); |
4503 | } | 4506 | } |
4504 | } | 4507 | } |
4505 | #ifdef CONFIG_ETRAX_FAST_TIMER | 4508 | #ifdef CONFIG_ETRAX_FAST_TIMER |
diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h index ccd0f32b7372..e3c5c8c3c09b 100644 --- a/drivers/serial/crisv10.h +++ b/drivers/serial/crisv10.h | |||
@@ -36,8 +36,9 @@ struct etrax_recv_buffer { | |||
36 | }; | 36 | }; |
37 | 37 | ||
38 | struct e100_serial { | 38 | struct e100_serial { |
39 | struct tty_port port; | ||
39 | int baud; | 40 | int baud; |
40 | volatile u8 *port; /* R_SERIALx_CTRL */ | 41 | volatile u8 *ioport; /* R_SERIALx_CTRL */ |
41 | u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */ | 42 | u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */ |
42 | 43 | ||
43 | /* Output registers */ | 44 | /* Output registers */ |
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index 0dddd68b20d2..6042b87797a1 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
@@ -197,7 +197,7 @@ static inline void dz_receive_chars(struct dz_mux *mux) | |||
197 | while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) { | 197 | while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) { |
198 | dport = &mux->dport[LINE(status)]; | 198 | dport = &mux->dport[LINE(status)]; |
199 | uport = &dport->port; | 199 | uport = &dport->port; |
200 | tty = uport->info->tty; /* point to the proper dev */ | 200 | tty = uport->info->port.tty; /* point to the proper dev */ |
201 | 201 | ||
202 | ch = UCHAR(status); /* grab the char */ | 202 | ch = UCHAR(status); /* grab the char */ |
203 | flag = TTY_NORMAL; | 203 | flag = TTY_NORMAL; |
@@ -249,7 +249,7 @@ static inline void dz_receive_chars(struct dz_mux *mux) | |||
249 | } | 249 | } |
250 | for (i = 0; i < DZ_NB_PORT; i++) | 250 | for (i = 0; i < DZ_NB_PORT; i++) |
251 | if (lines_rx[i]) | 251 | if (lines_rx[i]) |
252 | tty_flip_buffer_push(mux->dport[i].port.info->tty); | 252 | tty_flip_buffer_push(mux->dport[i].port.info->port.tty); |
253 | } | 253 | } |
254 | 254 | ||
255 | /* | 255 | /* |
@@ -642,6 +642,26 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
642 | spin_unlock_irqrestore(&dport->port.lock, flags); | 642 | spin_unlock_irqrestore(&dport->port.lock, flags); |
643 | } | 643 | } |
644 | 644 | ||
645 | /* | ||
646 | * Hack alert! | ||
647 | * Required solely so that the initial PROM-based console | ||
648 | * works undisturbed in parallel with this one. | ||
649 | */ | ||
650 | static void dz_pm(struct uart_port *uport, unsigned int state, | ||
651 | unsigned int oldstate) | ||
652 | { | ||
653 | struct dz_port *dport = to_dport(uport); | ||
654 | unsigned long flags; | ||
655 | |||
656 | spin_lock_irqsave(&dport->port.lock, flags); | ||
657 | if (state < 3) | ||
658 | dz_start_tx(&dport->port); | ||
659 | else | ||
660 | dz_stop_tx(&dport->port); | ||
661 | spin_unlock_irqrestore(&dport->port.lock, flags); | ||
662 | } | ||
663 | |||
664 | |||
645 | static const char *dz_type(struct uart_port *uport) | 665 | static const char *dz_type(struct uart_port *uport) |
646 | { | 666 | { |
647 | return "DZ"; | 667 | return "DZ"; |
@@ -738,6 +758,7 @@ static struct uart_ops dz_ops = { | |||
738 | .startup = dz_startup, | 758 | .startup = dz_startup, |
739 | .shutdown = dz_shutdown, | 759 | .shutdown = dz_shutdown, |
740 | .set_termios = dz_set_termios, | 760 | .set_termios = dz_set_termios, |
761 | .pm = dz_pm, | ||
741 | .type = dz_type, | 762 | .type = dz_type, |
742 | .release_port = dz_release_port, | 763 | .release_port = dz_release_port, |
743 | .request_port = dz_request_port, | 764 | .request_port = dz_request_port, |
@@ -861,7 +882,10 @@ static int __init dz_console_setup(struct console *co, char *options) | |||
861 | if (ret) | 882 | if (ret) |
862 | return ret; | 883 | return ret; |
863 | 884 | ||
885 | spin_lock_init(&dport->port.lock); /* For dz_pm(). */ | ||
886 | |||
864 | dz_reset(dport); | 887 | dz_reset(dport); |
888 | dz_pm(uport, 0, -1); | ||
865 | 889 | ||
866 | if (options) | 890 | if (options) |
867 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 891 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c index 9c2df5c857cf..2b7531d9f6ab 100644 --- a/drivers/serial/icom.c +++ b/drivers/serial/icom.c | |||
@@ -730,7 +730,7 @@ static void xmit_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
730 | static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | 730 | static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) |
731 | { | 731 | { |
732 | short int count, rcv_buff; | 732 | short int count, rcv_buff; |
733 | struct tty_struct *tty = icom_port->uart_port.info->tty; | 733 | struct tty_struct *tty = icom_port->uart_port.info->port.tty; |
734 | unsigned short int status; | 734 | unsigned short int status; |
735 | struct uart_icount *icount; | 735 | struct uart_icount *icount; |
736 | unsigned long offset; | 736 | unsigned long offset; |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 64acb39a51ba..3f90f1bbbbcd 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -44,8 +44,8 @@ | |||
44 | 44 | ||
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include <asm/irq.h> | 46 | #include <asm/irq.h> |
47 | #include <asm/hardware.h> | 47 | #include <mach/hardware.h> |
48 | #include <asm/arch/imx-uart.h> | 48 | #include <mach/imx-uart.h> |
49 | 49 | ||
50 | /* Register definitions */ | 50 | /* Register definitions */ |
51 | #define URXD0 0x0 /* Receiver Register */ | 51 | #define URXD0 0x0 /* Receiver Register */ |
@@ -127,8 +127,13 @@ | |||
127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ | 127 | #define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ |
128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ | 128 | #define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ |
129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ | 129 | #define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ |
130 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz */ | 130 | #ifdef CONFIG_ARCH_IMX |
131 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz */ | 131 | #define UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */ |
132 | #define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */ | ||
133 | #endif | ||
134 | #if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3 | ||
135 | #define UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */ | ||
136 | #endif | ||
132 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ | 137 | #define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ |
133 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ | 138 | #define UCR3_BPEN (1<<0) /* Preset registers enable */ |
134 | #define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ | 139 | #define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ |
@@ -372,7 +377,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) | |||
372 | { | 377 | { |
373 | struct imx_port *sport = dev_id; | 378 | struct imx_port *sport = dev_id; |
374 | unsigned int rx,flg,ignored = 0; | 379 | unsigned int rx,flg,ignored = 0; |
375 | struct tty_struct *tty = sport->port.info->tty; | 380 | struct tty_struct *tty = sport->port.info->port.tty; |
376 | unsigned long flags, temp; | 381 | unsigned long flags, temp; |
377 | 382 | ||
378 | spin_lock_irqsave(&sport->port.lock,flags); | 383 | spin_lock_irqsave(&sport->port.lock,flags); |
@@ -445,7 +450,7 @@ static irqreturn_t imx_int(int irq, void *dev_id) | |||
445 | readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN) | 450 | readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN) |
446 | imx_txint(irq, dev_id); | 451 | imx_txint(irq, dev_id); |
447 | 452 | ||
448 | if (sts & USR1_RTSS) | 453 | if (sts & USR1_RTSD) |
449 | imx_rtsint(irq, dev_id); | 454 | imx_rtsint(irq, dev_id); |
450 | 455 | ||
451 | return IRQ_HANDLED; | 456 | return IRQ_HANDLED; |
@@ -598,6 +603,12 @@ static int imx_startup(struct uart_port *port) | |||
598 | temp |= (UCR2_RXEN | UCR2_TXEN); | 603 | temp |= (UCR2_RXEN | UCR2_TXEN); |
599 | writel(temp, sport->port.membase + UCR2); | 604 | writel(temp, sport->port.membase + UCR2); |
600 | 605 | ||
606 | #if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3 | ||
607 | temp = readl(sport->port.membase + UCR3); | ||
608 | temp |= UCR3_RXDMUXSEL; | ||
609 | writel(temp, sport->port.membase + UCR3); | ||
610 | #endif | ||
611 | |||
601 | /* | 612 | /* |
602 | * Enable modem status interrupts | 613 | * Enable modem status interrupts |
603 | */ | 614 | */ |
@@ -1133,13 +1144,19 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
1133 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) | 1144 | if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) |
1134 | sport->have_rtscts = 1; | 1145 | sport->have_rtscts = 1; |
1135 | 1146 | ||
1136 | if (pdata->init) | 1147 | if (pdata->init) { |
1137 | pdata->init(pdev); | 1148 | ret = pdata->init(pdev); |
1149 | if (ret) | ||
1150 | goto clkput; | ||
1151 | } | ||
1138 | 1152 | ||
1139 | uart_add_one_port(&imx_reg, &sport->port); | 1153 | uart_add_one_port(&imx_reg, &sport->port); |
1140 | platform_set_drvdata(pdev, &sport->port); | 1154 | platform_set_drvdata(pdev, &sport->port); |
1141 | 1155 | ||
1142 | return 0; | 1156 | return 0; |
1157 | clkput: | ||
1158 | clk_put(sport->clk); | ||
1159 | clk_disable(sport->clk); | ||
1143 | unmap: | 1160 | unmap: |
1144 | iounmap(sport->port.membase); | 1161 | iounmap(sport->port.membase); |
1145 | free: | 1162 | free: |
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c index 4f1af71e9a1b..6dd98f9fb89c 100644 --- a/drivers/serial/ioc3_serial.c +++ b/drivers/serial/ioc3_serial.c | |||
@@ -905,7 +905,7 @@ static void transmit_chars(struct uart_port *the_port) | |||
905 | return; | 905 | return; |
906 | 906 | ||
907 | info = the_port->info; | 907 | info = the_port->info; |
908 | tty = info->tty; | 908 | tty = info->port.tty; |
909 | 909 | ||
910 | if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { | 910 | if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { |
911 | /* Nothing to do or hw stopped */ | 911 | /* Nothing to do or hw stopped */ |
@@ -997,14 +997,14 @@ ioc3_change_speed(struct uart_port *the_port, | |||
997 | 997 | ||
998 | the_port->ignore_status_mask = N_ALL_INPUT; | 998 | the_port->ignore_status_mask = N_ALL_INPUT; |
999 | 999 | ||
1000 | info->tty->low_latency = 1; | 1000 | info->port.tty->low_latency = 1; |
1001 | 1001 | ||
1002 | if (I_IGNPAR(info->tty)) | 1002 | if (I_IGNPAR(info->port.tty)) |
1003 | the_port->ignore_status_mask &= ~(N_PARITY_ERROR | 1003 | the_port->ignore_status_mask &= ~(N_PARITY_ERROR |
1004 | | N_FRAMING_ERROR); | 1004 | | N_FRAMING_ERROR); |
1005 | if (I_IGNBRK(info->tty)) { | 1005 | if (I_IGNBRK(info->port.tty)) { |
1006 | the_port->ignore_status_mask &= ~N_BREAK; | 1006 | the_port->ignore_status_mask &= ~N_BREAK; |
1007 | if (I_IGNPAR(info->tty)) | 1007 | if (I_IGNPAR(info->port.tty)) |
1008 | the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; | 1008 | the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; |
1009 | } | 1009 | } |
1010 | if (!(cflag & CREAD)) { | 1010 | if (!(cflag & CREAD)) { |
@@ -1399,14 +1399,14 @@ static int receive_chars(struct uart_port *the_port) | |||
1399 | /* Make sure all the pointers are "good" ones */ | 1399 | /* Make sure all the pointers are "good" ones */ |
1400 | if (!info) | 1400 | if (!info) |
1401 | return 0; | 1401 | return 0; |
1402 | if (!info->tty) | 1402 | if (!info->port.tty) |
1403 | return 0; | 1403 | return 0; |
1404 | 1404 | ||
1405 | if (!(port->ip_flags & INPUT_ENABLE)) | 1405 | if (!(port->ip_flags & INPUT_ENABLE)) |
1406 | return 0; | 1406 | return 0; |
1407 | 1407 | ||
1408 | spin_lock_irqsave(&the_port->lock, pflags); | 1408 | spin_lock_irqsave(&the_port->lock, pflags); |
1409 | tty = info->tty; | 1409 | tty = info->port.tty; |
1410 | 1410 | ||
1411 | read_count = do_read(the_port, ch, MAX_CHARS); | 1411 | read_count = do_read(the_port, ch, MAX_CHARS); |
1412 | if (read_count > 0) { | 1412 | if (read_count > 0) { |
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index 49b8a82b7b9f..6bab63cd5b29 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c | |||
@@ -1635,7 +1635,7 @@ static void transmit_chars(struct uart_port *the_port) | |||
1635 | return; | 1635 | return; |
1636 | 1636 | ||
1637 | info = the_port->info; | 1637 | info = the_port->info; |
1638 | tty = info->tty; | 1638 | tty = info->port.tty; |
1639 | 1639 | ||
1640 | if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { | 1640 | if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { |
1641 | /* Nothing to do or hw stopped */ | 1641 | /* Nothing to do or hw stopped */ |
@@ -1738,14 +1738,14 @@ ioc4_change_speed(struct uart_port *the_port, | |||
1738 | 1738 | ||
1739 | the_port->ignore_status_mask = N_ALL_INPUT; | 1739 | the_port->ignore_status_mask = N_ALL_INPUT; |
1740 | 1740 | ||
1741 | info->tty->low_latency = 1; | 1741 | info->port.tty->low_latency = 1; |
1742 | 1742 | ||
1743 | if (I_IGNPAR(info->tty)) | 1743 | if (I_IGNPAR(info->port.tty)) |
1744 | the_port->ignore_status_mask &= ~(N_PARITY_ERROR | 1744 | the_port->ignore_status_mask &= ~(N_PARITY_ERROR |
1745 | | N_FRAMING_ERROR); | 1745 | | N_FRAMING_ERROR); |
1746 | if (I_IGNBRK(info->tty)) { | 1746 | if (I_IGNBRK(info->port.tty)) { |
1747 | the_port->ignore_status_mask &= ~N_BREAK; | 1747 | the_port->ignore_status_mask &= ~N_BREAK; |
1748 | if (I_IGNPAR(info->tty)) | 1748 | if (I_IGNPAR(info->port.tty)) |
1749 | the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; | 1749 | the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; |
1750 | } | 1750 | } |
1751 | if (!(cflag & CREAD)) { | 1751 | if (!(cflag & CREAD)) { |
@@ -1801,7 +1801,8 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1801 | ioc4_set_proto(port, the_port->mapbase); | 1801 | ioc4_set_proto(port, the_port->mapbase); |
1802 | 1802 | ||
1803 | /* set the speed of the serial port */ | 1803 | /* set the speed of the serial port */ |
1804 | ioc4_change_speed(the_port, info->tty->termios, (struct ktermios *)0); | 1804 | ioc4_change_speed(the_port, info->port.tty->termios, |
1805 | (struct ktermios *)0); | ||
1805 | 1806 | ||
1806 | return 0; | 1807 | return 0; |
1807 | } | 1808 | } |
@@ -2346,11 +2347,11 @@ static void receive_chars(struct uart_port *the_port) | |||
2346 | /* Make sure all the pointers are "good" ones */ | 2347 | /* Make sure all the pointers are "good" ones */ |
2347 | if (!info) | 2348 | if (!info) |
2348 | return; | 2349 | return; |
2349 | if (!info->tty) | 2350 | if (!info->port.tty) |
2350 | return; | 2351 | return; |
2351 | 2352 | ||
2352 | spin_lock_irqsave(&the_port->lock, pflags); | 2353 | spin_lock_irqsave(&the_port->lock, pflags); |
2353 | tty = info->tty; | 2354 | tty = info->port.tty; |
2354 | 2355 | ||
2355 | request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS); | 2356 | request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS); |
2356 | 2357 | ||
@@ -2440,8 +2441,8 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2440 | 2441 | ||
2441 | wake_up_interruptible(&info->delta_msr_wait); | 2442 | wake_up_interruptible(&info->delta_msr_wait); |
2442 | 2443 | ||
2443 | if (info->tty) | 2444 | if (info->port.tty) |
2444 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2445 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
2445 | 2446 | ||
2446 | spin_lock_irqsave(&the_port->lock, port_flags); | 2447 | spin_lock_irqsave(&the_port->lock, port_flags); |
2447 | set_notification(port, N_ALL, 0); | 2448 | set_notification(port, N_ALL, 0); |
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index 9c95bc0398ad..0d9acbd0bb70 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
@@ -257,8 +257,8 @@ static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up | |||
257 | 257 | ||
258 | tty = NULL; | 258 | tty = NULL; |
259 | if (up->port.info != NULL && | 259 | if (up->port.info != NULL && |
260 | up->port.info->tty != NULL) | 260 | up->port.info->port.tty != NULL) |
261 | tty = up->port.info->tty; | 261 | tty = up->port.info->port.tty; |
262 | 262 | ||
263 | for (;;) { | 263 | for (;;) { |
264 | ch = readb(&channel->control); | 264 | ch = readb(&channel->control); |
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c index b2d6f5b1a7c2..b7584ca55ade 100644 --- a/drivers/serial/jsm/jsm_neo.c +++ b/drivers/serial/jsm/jsm_neo.c | |||
@@ -998,7 +998,7 @@ static void neo_param(struct jsm_channel *ch) | |||
998 | { 50, B50 }, | 998 | { 50, B50 }, |
999 | }; | 999 | }; |
1000 | 1000 | ||
1001 | cflag = C_BAUD(ch->uart_port.info->tty); | 1001 | cflag = C_BAUD(ch->uart_port.info->port.tty); |
1002 | baud = 9600; | 1002 | baud = 9600; |
1003 | for (i = 0; i < ARRAY_SIZE(baud_rates); i++) { | 1003 | for (i = 0; i < ARRAY_SIZE(baud_rates); i++) { |
1004 | if (baud_rates[i].cflag == cflag) { | 1004 | if (baud_rates[i].cflag == cflag) { |
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c index 94ec66372508..a697914ae3d0 100644 --- a/drivers/serial/jsm/jsm_tty.c +++ b/drivers/serial/jsm/jsm_tty.c | |||
@@ -145,7 +145,7 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch) | |||
145 | struct ktermios *termios; | 145 | struct ktermios *termios; |
146 | 146 | ||
147 | spin_lock_irqsave(&port->lock, lock_flags); | 147 | spin_lock_irqsave(&port->lock, lock_flags); |
148 | termios = port->info->tty->termios; | 148 | termios = port->info->port.tty->termios; |
149 | if (ch == termios->c_cc[VSTART]) | 149 | if (ch == termios->c_cc[VSTART]) |
150 | channel->ch_bd->bd_ops->send_start_character(channel); | 150 | channel->ch_bd->bd_ops->send_start_character(channel); |
151 | 151 | ||
@@ -239,7 +239,7 @@ static int jsm_tty_open(struct uart_port *port) | |||
239 | channel->ch_cached_lsr = 0; | 239 | channel->ch_cached_lsr = 0; |
240 | channel->ch_stops_sent = 0; | 240 | channel->ch_stops_sent = 0; |
241 | 241 | ||
242 | termios = port->info->tty->termios; | 242 | termios = port->info->port.tty->termios; |
243 | channel->ch_c_cflag = termios->c_cflag; | 243 | channel->ch_c_cflag = termios->c_cflag; |
244 | channel->ch_c_iflag = termios->c_iflag; | 244 | channel->ch_c_iflag = termios->c_iflag; |
245 | channel->ch_c_oflag = termios->c_oflag; | 245 | channel->ch_c_oflag = termios->c_oflag; |
@@ -272,7 +272,7 @@ static void jsm_tty_close(struct uart_port *port) | |||
272 | jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n"); | 272 | jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n"); |
273 | 273 | ||
274 | bd = channel->ch_bd; | 274 | bd = channel->ch_bd; |
275 | ts = channel->uart_port.info->tty->termios; | 275 | ts = channel->uart_port.info->port.tty->termios; |
276 | 276 | ||
277 | channel->ch_flags &= ~(CH_STOPI); | 277 | channel->ch_flags &= ~(CH_STOPI); |
278 | 278 | ||
@@ -515,7 +515,7 @@ void jsm_input(struct jsm_channel *ch) | |||
515 | if (!ch) | 515 | if (!ch) |
516 | return; | 516 | return; |
517 | 517 | ||
518 | tp = ch->uart_port.info->tty; | 518 | tp = ch->uart_port.info->port.tty; |
519 | 519 | ||
520 | bd = ch->ch_bd; | 520 | bd = ch->ch_bd; |
521 | if(!bd) | 521 | if(!bd) |
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c index c2bb11c02bde..611c97a15654 100644 --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c | |||
@@ -325,7 +325,7 @@ static void m32r_sio_enable_ms(struct uart_port *port) | |||
325 | 325 | ||
326 | static void receive_chars(struct uart_sio_port *up, int *status) | 326 | static void receive_chars(struct uart_sio_port *up, int *status) |
327 | { | 327 | { |
328 | struct tty_struct *tty = up->port.info->tty; | 328 | struct tty_struct *tty = up->port.info->port.tty; |
329 | unsigned char ch; | 329 | unsigned char ch; |
330 | unsigned char flag; | 330 | unsigned char flag; |
331 | int max_count = 256; | 331 | int max_count = 256; |
@@ -922,7 +922,7 @@ static void m32r_sio_config_port(struct uart_port *port, int flags) | |||
922 | static int | 922 | static int |
923 | m32r_sio_verify_port(struct uart_port *port, struct serial_struct *ser) | 923 | m32r_sio_verify_port(struct uart_port *port, struct serial_struct *ser) |
924 | { | 924 | { |
925 | if (ser->irq >= NR_IRQS || ser->irq < 0 || | 925 | if (ser->irq >= nr_irqs || ser->irq < 0 || |
926 | ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || | 926 | ser->baud_base < 9600 || ser->type < PORT_UNKNOWN || |
927 | ser->type >= ARRAY_SIZE(uart_config)) | 927 | ser->type >= ARRAY_SIZE(uart_config)) |
928 | return -EINVAL; | 928 | return -EINVAL; |
@@ -1160,9 +1160,9 @@ static int __init m32r_sio_init(void) | |||
1160 | { | 1160 | { |
1161 | int ret, i; | 1161 | int ret, i; |
1162 | 1162 | ||
1163 | printk(KERN_INFO "Serial: M32R SIO driver $Revision: 1.11 $ "); | 1163 | printk(KERN_INFO "Serial: M32R SIO driver\n"); |
1164 | 1164 | ||
1165 | for (i = 0; i < NR_IRQS; i++) | 1165 | for (i = 0; i < nr_irqs; i++) |
1166 | spin_lock_init(&irq_lists[i].lock); | 1166 | spin_lock_init(&irq_lists[i].lock); |
1167 | 1167 | ||
1168 | ret = uart_register_driver(&m32r_sio_reg); | 1168 | ret = uart_register_driver(&m32r_sio_reg); |
@@ -1189,4 +1189,4 @@ EXPORT_SYMBOL(m32r_sio_suspend_port); | |||
1189 | EXPORT_SYMBOL(m32r_sio_resume_port); | 1189 | EXPORT_SYMBOL(m32r_sio_resume_port); |
1190 | 1190 | ||
1191 | MODULE_LICENSE("GPL"); | 1191 | MODULE_LICENSE("GPL"); |
1192 | MODULE_DESCRIPTION("Generic M32R SIO serial driver $Revision: 1.11 $"); | 1192 | MODULE_DESCRIPTION("Generic M32R SIO serial driver"); |
diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c index 7e164e0cd211..b2001c5b145c 100644 --- a/drivers/serial/mcf.c +++ b/drivers/serial/mcf.c | |||
@@ -312,7 +312,7 @@ static void mcf_rx_chars(struct mcf_uart *pp) | |||
312 | uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); | 312 | uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); |
313 | } | 313 | } |
314 | 314 | ||
315 | tty_flip_buffer_push(port->info->tty); | 315 | tty_flip_buffer_push(port->info->port.tty); |
316 | } | 316 | } |
317 | 317 | ||
318 | /****************************************************************************/ | 318 | /****************************************************************************/ |
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c deleted file mode 100644 index 56007cc8a9b3..000000000000 --- a/drivers/serial/mcfserial.c +++ /dev/null | |||
@@ -1,1965 +0,0 @@ | |||
1 | #warning This driver is deprecated. Check Kconfig for details. | ||
2 | /* | ||
3 | * mcfserial.c -- serial driver for ColdFire internal UARTS. | ||
4 | * | ||
5 | * Copyright (C) 1999-2003 Greg Ungerer <gerg@snapgear.com> | ||
6 | * Copyright (c) 2000-2001 Lineo, Inc. <www.lineo.com> | ||
7 | * Copyright (C) 2001-2002 SnapGear Inc. <www.snapgear.com> | ||
8 | * | ||
9 | * Based on code from 68332serial.c which was: | ||
10 | * | ||
11 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
12 | * Copyright (C) 1998 TSHG | ||
13 | * Copyright (c) 1999 Rt-Control Inc. <jeff@uclinux.org> | ||
14 | * | ||
15 | * Changes: | ||
16 | * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it> | ||
17 | * some cleanups in mcfrs_write. | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/signal.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/timer.h> | ||
26 | #include <linux/wait.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/tty.h> | ||
29 | #include <linux/tty_flip.h> | ||
30 | #include <linux/string.h> | ||
31 | #include <linux/fcntl.h> | ||
32 | #include <linux/mm.h> | ||
33 | #include <linux/kernel.h> | ||
34 | #include <linux/serial.h> | ||
35 | #include <linux/serialP.h> | ||
36 | #include <linux/console.h> | ||
37 | #include <linux/init.h> | ||
38 | #include <linux/bitops.h> | ||
39 | #include <linux/delay.h> | ||
40 | |||
41 | #include <asm/io.h> | ||
42 | #include <asm/irq.h> | ||
43 | #include <asm/system.h> | ||
44 | #include <asm/delay.h> | ||
45 | #include <asm/coldfire.h> | ||
46 | #include <asm/mcfsim.h> | ||
47 | #include <asm/mcfuart.h> | ||
48 | #include <asm/nettel.h> | ||
49 | #include <asm/uaccess.h> | ||
50 | #include "mcfserial.h" | ||
51 | |||
52 | struct timer_list mcfrs_timer_struct; | ||
53 | |||
54 | /* | ||
55 | * Default console baud rate, we use this as the default | ||
56 | * for all ports so init can just open /dev/console and | ||
57 | * keep going. Perhaps one day the cflag settings for the | ||
58 | * console can be used instead. | ||
59 | */ | ||
60 | #if defined(CONFIG_HW_FEITH) | ||
61 | #define CONSOLE_BAUD_RATE 38400 | ||
62 | #define DEFAULT_CBAUD B38400 | ||
63 | #elif defined(CONFIG_MOD5272) || defined(CONFIG_M5208EVB) || \ | ||
64 | defined(CONFIG_M5329EVB) || defined(CONFIG_GILBARCO) | ||
65 | #define CONSOLE_BAUD_RATE 115200 | ||
66 | #define DEFAULT_CBAUD B115200 | ||
67 | #elif defined(CONFIG_ARNEWSH) || defined(CONFIG_FREESCALE) || \ | ||
68 | defined(CONFIG_senTec) || defined(CONFIG_SNEHA) || defined(CONFIG_AVNET) | ||
69 | #define CONSOLE_BAUD_RATE 19200 | ||
70 | #define DEFAULT_CBAUD B19200 | ||
71 | #endif | ||
72 | |||
73 | #ifndef CONSOLE_BAUD_RATE | ||
74 | #define CONSOLE_BAUD_RATE 9600 | ||
75 | #define DEFAULT_CBAUD B9600 | ||
76 | #endif | ||
77 | |||
78 | int mcfrs_console_inited = 0; | ||
79 | int mcfrs_console_port = -1; | ||
80 | int mcfrs_console_baud = CONSOLE_BAUD_RATE; | ||
81 | int mcfrs_console_cbaud = DEFAULT_CBAUD; | ||
82 | |||
83 | /* | ||
84 | * Driver data structures. | ||
85 | */ | ||
86 | static struct tty_driver *mcfrs_serial_driver; | ||
87 | |||
88 | /* number of characters left in xmit buffer before we ask for more */ | ||
89 | #define WAKEUP_CHARS 256 | ||
90 | |||
91 | /* Debugging... | ||
92 | */ | ||
93 | #undef SERIAL_DEBUG_OPEN | ||
94 | #undef SERIAL_DEBUG_FLOW | ||
95 | |||
96 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ | ||
97 | defined(CONFIG_M520x) || defined(CONFIG_M532x) | ||
98 | #define IRQBASE (MCFINT_VECBASE+MCFINT_UART0) | ||
99 | #else | ||
100 | #define IRQBASE 73 | ||
101 | #endif | ||
102 | |||
103 | /* | ||
104 | * Configuration table, UARTs to look for at startup. | ||
105 | */ | ||
106 | static struct mcf_serial mcfrs_table[] = { | ||
107 | { /* ttyS0 */ | ||
108 | .magic = 0, | ||
109 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE1), | ||
110 | .irq = IRQBASE, | ||
111 | .flags = ASYNC_BOOT_AUTOCONF, | ||
112 | }, | ||
113 | #ifdef MCFUART_BASE2 | ||
114 | { /* ttyS1 */ | ||
115 | .magic = 0, | ||
116 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE2), | ||
117 | .irq = IRQBASE+1, | ||
118 | .flags = ASYNC_BOOT_AUTOCONF, | ||
119 | }, | ||
120 | #endif | ||
121 | #ifdef MCFUART_BASE3 | ||
122 | { /* ttyS2 */ | ||
123 | .magic = 0, | ||
124 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE3), | ||
125 | .irq = IRQBASE+2, | ||
126 | .flags = ASYNC_BOOT_AUTOCONF, | ||
127 | }, | ||
128 | #endif | ||
129 | #ifdef MCFUART_BASE4 | ||
130 | { /* ttyS3 */ | ||
131 | .magic = 0, | ||
132 | .addr = (volatile unsigned char *) (MCF_MBAR+MCFUART_BASE4), | ||
133 | .irq = IRQBASE+3, | ||
134 | .flags = ASYNC_BOOT_AUTOCONF, | ||
135 | }, | ||
136 | #endif | ||
137 | }; | ||
138 | |||
139 | |||
140 | #define NR_PORTS (sizeof(mcfrs_table) / sizeof(struct mcf_serial)) | ||
141 | |||
142 | /* | ||
143 | * This is used to figure out the divisor speeds and the timeouts. | ||
144 | */ | ||
145 | static int mcfrs_baud_table[] = { | ||
146 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, | ||
147 | 9600, 19200, 38400, 57600, 115200, 230400, 460800, 0 | ||
148 | }; | ||
149 | #define MCFRS_BAUD_TABLE_SIZE \ | ||
150 | (sizeof(mcfrs_baud_table)/sizeof(mcfrs_baud_table[0])) | ||
151 | |||
152 | |||
153 | #ifdef CONFIG_MAGIC_SYSRQ | ||
154 | /* | ||
155 | * Magic system request keys. Used for debugging... | ||
156 | */ | ||
157 | extern int magic_sysrq_key(int ch); | ||
158 | #endif | ||
159 | |||
160 | |||
161 | /* | ||
162 | * Forware declarations... | ||
163 | */ | ||
164 | static void mcfrs_change_speed(struct mcf_serial *info); | ||
165 | static void mcfrs_wait_until_sent(struct tty_struct *tty, int timeout); | ||
166 | |||
167 | |||
168 | static inline int serial_paranoia_check(struct mcf_serial *info, | ||
169 | char *name, const char *routine) | ||
170 | { | ||
171 | #ifdef SERIAL_PARANOIA_CHECK | ||
172 | static const char badmagic[] = | ||
173 | "MCFRS(warning): bad magic number for serial struct %s in %s\n"; | ||
174 | static const char badinfo[] = | ||
175 | "MCFRS(warning): null mcf_serial for %s in %s\n"; | ||
176 | |||
177 | if (!info) { | ||
178 | printk(badinfo, name, routine); | ||
179 | return 1; | ||
180 | } | ||
181 | if (info->magic != SERIAL_MAGIC) { | ||
182 | printk(badmagic, name, routine); | ||
183 | return 1; | ||
184 | } | ||
185 | #endif | ||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * Sets or clears DTR and RTS on the requested line. | ||
191 | */ | ||
192 | static void mcfrs_setsignals(struct mcf_serial *info, int dtr, int rts) | ||
193 | { | ||
194 | volatile unsigned char *uartp; | ||
195 | unsigned long flags; | ||
196 | |||
197 | #if 0 | ||
198 | printk("%s(%d): mcfrs_setsignals(info=%x,dtr=%d,rts=%d)\n", | ||
199 | __FILE__, __LINE__, info, dtr, rts); | ||
200 | #endif | ||
201 | |||
202 | local_irq_save(flags); | ||
203 | if (dtr >= 0) { | ||
204 | #ifdef MCFPP_DTR0 | ||
205 | if (info->line) | ||
206 | mcf_setppdata(MCFPP_DTR1, (dtr ? 0 : MCFPP_DTR1)); | ||
207 | else | ||
208 | mcf_setppdata(MCFPP_DTR0, (dtr ? 0 : MCFPP_DTR0)); | ||
209 | #endif | ||
210 | } | ||
211 | if (rts >= 0) { | ||
212 | uartp = info->addr; | ||
213 | if (rts) { | ||
214 | info->sigs |= TIOCM_RTS; | ||
215 | uartp[MCFUART_UOP1] = MCFUART_UOP_RTS; | ||
216 | } else { | ||
217 | info->sigs &= ~TIOCM_RTS; | ||
218 | uartp[MCFUART_UOP0] = MCFUART_UOP_RTS; | ||
219 | } | ||
220 | } | ||
221 | local_irq_restore(flags); | ||
222 | return; | ||
223 | } | ||
224 | |||
225 | /* | ||
226 | * Gets values of serial signals. | ||
227 | */ | ||
228 | static int mcfrs_getsignals(struct mcf_serial *info) | ||
229 | { | ||
230 | volatile unsigned char *uartp; | ||
231 | unsigned long flags; | ||
232 | int sigs; | ||
233 | #if defined(CONFIG_NETtel) && defined(CONFIG_M5307) | ||
234 | unsigned short ppdata; | ||
235 | #endif | ||
236 | |||
237 | #if 0 | ||
238 | printk("%s(%d): mcfrs_getsignals(info=%x)\n", __FILE__, __LINE__); | ||
239 | #endif | ||
240 | |||
241 | local_irq_save(flags); | ||
242 | uartp = info->addr; | ||
243 | sigs = (uartp[MCFUART_UIPR] & MCFUART_UIPR_CTS) ? 0 : TIOCM_CTS; | ||
244 | sigs |= (info->sigs & TIOCM_RTS); | ||
245 | |||
246 | #ifdef MCFPP_DCD0 | ||
247 | { | ||
248 | unsigned int ppdata; | ||
249 | ppdata = mcf_getppdata(); | ||
250 | if (info->line == 0) { | ||
251 | sigs |= (ppdata & MCFPP_DCD0) ? 0 : TIOCM_CD; | ||
252 | sigs |= (ppdata & MCFPP_DTR0) ? 0 : TIOCM_DTR; | ||
253 | } else if (info->line == 1) { | ||
254 | sigs |= (ppdata & MCFPP_DCD1) ? 0 : TIOCM_CD; | ||
255 | sigs |= (ppdata & MCFPP_DTR1) ? 0 : TIOCM_DTR; | ||
256 | } | ||
257 | } | ||
258 | #endif | ||
259 | |||
260 | local_irq_restore(flags); | ||
261 | return(sigs); | ||
262 | } | ||
263 | |||
264 | /* | ||
265 | * ------------------------------------------------------------ | ||
266 | * mcfrs_stop() and mcfrs_start() | ||
267 | * | ||
268 | * This routines are called before setting or resetting tty->stopped. | ||
269 | * They enable or disable transmitter interrupts, as necessary. | ||
270 | * ------------------------------------------------------------ | ||
271 | */ | ||
272 | static void mcfrs_stop(struct tty_struct *tty) | ||
273 | { | ||
274 | volatile unsigned char *uartp; | ||
275 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
276 | unsigned long flags; | ||
277 | |||
278 | if (serial_paranoia_check(info, tty->name, "mcfrs_stop")) | ||
279 | return; | ||
280 | |||
281 | local_irq_save(flags); | ||
282 | uartp = info->addr; | ||
283 | info->imr &= ~MCFUART_UIR_TXREADY; | ||
284 | uartp[MCFUART_UIMR] = info->imr; | ||
285 | local_irq_restore(flags); | ||
286 | } | ||
287 | |||
288 | static void mcfrs_start(struct tty_struct *tty) | ||
289 | { | ||
290 | volatile unsigned char *uartp; | ||
291 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
292 | unsigned long flags; | ||
293 | |||
294 | if (serial_paranoia_check(info, tty->name, "mcfrs_start")) | ||
295 | return; | ||
296 | |||
297 | local_irq_save(flags); | ||
298 | if (info->xmit_cnt && info->xmit_buf) { | ||
299 | uartp = info->addr; | ||
300 | info->imr |= MCFUART_UIR_TXREADY; | ||
301 | uartp[MCFUART_UIMR] = info->imr; | ||
302 | } | ||
303 | local_irq_restore(flags); | ||
304 | } | ||
305 | |||
306 | /* | ||
307 | * ---------------------------------------------------------------------- | ||
308 | * | ||
309 | * Here starts the interrupt handling routines. All of the following | ||
310 | * subroutines are declared as inline and are folded into | ||
311 | * mcfrs_interrupt(). They were separated out for readability's sake. | ||
312 | * | ||
313 | * Note: mcfrs_interrupt() is a "fast" interrupt, which means that it | ||
314 | * runs with interrupts turned off. People who may want to modify | ||
315 | * mcfrs_interrupt() should try to keep the interrupt handler as fast as | ||
316 | * possible. After you are done making modifications, it is not a bad | ||
317 | * idea to do: | ||
318 | * | ||
319 | * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer serial.c | ||
320 | * | ||
321 | * and look at the resulting assemble code in serial.s. | ||
322 | * | ||
323 | * - Ted Ts'o (tytso@mit.edu), 7-Mar-93 | ||
324 | * ----------------------------------------------------------------------- | ||
325 | */ | ||
326 | |||
327 | static inline void receive_chars(struct mcf_serial *info) | ||
328 | { | ||
329 | volatile unsigned char *uartp; | ||
330 | struct tty_struct *tty = info->tty; | ||
331 | unsigned char status, ch, flag; | ||
332 | |||
333 | if (!tty) | ||
334 | return; | ||
335 | |||
336 | uartp = info->addr; | ||
337 | |||
338 | while ((status = uartp[MCFUART_USR]) & MCFUART_USR_RXREADY) { | ||
339 | ch = uartp[MCFUART_URB]; | ||
340 | info->stats.rx++; | ||
341 | |||
342 | #ifdef CONFIG_MAGIC_SYSRQ | ||
343 | if (mcfrs_console_inited && (info->line == mcfrs_console_port)) { | ||
344 | if (magic_sysrq_key(ch)) | ||
345 | continue; | ||
346 | } | ||
347 | #endif | ||
348 | |||
349 | flag = TTY_NORMAL; | ||
350 | if (status & MCFUART_USR_RXERR) { | ||
351 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR; | ||
352 | if (status & MCFUART_USR_RXBREAK) { | ||
353 | info->stats.rxbreak++; | ||
354 | flag = TTY_BREAK; | ||
355 | } else if (status & MCFUART_USR_RXPARITY) { | ||
356 | info->stats.rxparity++; | ||
357 | flag = TTY_PARITY; | ||
358 | } else if (status & MCFUART_USR_RXOVERRUN) { | ||
359 | info->stats.rxoverrun++; | ||
360 | flag = TTY_OVERRUN; | ||
361 | } else if (status & MCFUART_USR_RXFRAMING) { | ||
362 | info->stats.rxframing++; | ||
363 | flag = TTY_FRAME; | ||
364 | } | ||
365 | } | ||
366 | tty_insert_flip_char(tty, ch, flag); | ||
367 | } | ||
368 | tty_schedule_flip(tty); | ||
369 | return; | ||
370 | } | ||
371 | |||
372 | static inline void transmit_chars(struct mcf_serial *info) | ||
373 | { | ||
374 | volatile unsigned char *uartp; | ||
375 | |||
376 | uartp = info->addr; | ||
377 | |||
378 | if (info->x_char) { | ||
379 | /* Send special char - probably flow control */ | ||
380 | uartp[MCFUART_UTB] = info->x_char; | ||
381 | info->x_char = 0; | ||
382 | info->stats.tx++; | ||
383 | } | ||
384 | |||
385 | if ((info->xmit_cnt <= 0) || info->tty->stopped) { | ||
386 | info->imr &= ~MCFUART_UIR_TXREADY; | ||
387 | uartp[MCFUART_UIMR] = info->imr; | ||
388 | return; | ||
389 | } | ||
390 | |||
391 | while (uartp[MCFUART_USR] & MCFUART_USR_TXREADY) { | ||
392 | uartp[MCFUART_UTB] = info->xmit_buf[info->xmit_tail++]; | ||
393 | info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); | ||
394 | info->stats.tx++; | ||
395 | if (--info->xmit_cnt <= 0) | ||
396 | break; | ||
397 | } | ||
398 | |||
399 | if (info->xmit_cnt < WAKEUP_CHARS) | ||
400 | schedule_work(&info->tqueue); | ||
401 | return; | ||
402 | } | ||
403 | |||
404 | /* | ||
405 | * This is the serial driver's generic interrupt routine | ||
406 | */ | ||
407 | irqreturn_t mcfrs_interrupt(int irq, void *dev_id) | ||
408 | { | ||
409 | struct mcf_serial *info; | ||
410 | unsigned char isr; | ||
411 | |||
412 | info = &mcfrs_table[(irq - IRQBASE)]; | ||
413 | isr = info->addr[MCFUART_UISR] & info->imr; | ||
414 | |||
415 | if (isr & MCFUART_UIR_RXREADY) | ||
416 | receive_chars(info); | ||
417 | if (isr & MCFUART_UIR_TXREADY) | ||
418 | transmit_chars(info); | ||
419 | return IRQ_HANDLED; | ||
420 | } | ||
421 | |||
422 | /* | ||
423 | * ------------------------------------------------------------------- | ||
424 | * Here ends the serial interrupt routines. | ||
425 | * ------------------------------------------------------------------- | ||
426 | */ | ||
427 | |||
428 | static void mcfrs_offintr(struct work_struct *work) | ||
429 | { | ||
430 | struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue); | ||
431 | struct tty_struct *tty = info->tty; | ||
432 | |||
433 | if (tty) | ||
434 | tty_wakeup(tty); | ||
435 | } | ||
436 | |||
437 | |||
438 | /* | ||
439 | * Change of state on a DCD line. | ||
440 | */ | ||
441 | void mcfrs_modem_change(struct mcf_serial *info, int dcd) | ||
442 | { | ||
443 | if (info->count == 0) | ||
444 | return; | ||
445 | |||
446 | if (info->flags & ASYNC_CHECK_CD) { | ||
447 | if (dcd) | ||
448 | wake_up_interruptible(&info->open_wait); | ||
449 | else | ||
450 | schedule_work(&info->tqueue_hangup); | ||
451 | } | ||
452 | } | ||
453 | |||
454 | |||
455 | #ifdef MCFPP_DCD0 | ||
456 | |||
457 | unsigned short mcfrs_ppstatus; | ||
458 | |||
459 | /* | ||
460 | * This subroutine is called when the RS_TIMER goes off. It is used | ||
461 | * to monitor the state of the DCD lines - since they have no edge | ||
462 | * sensors and interrupt generators. | ||
463 | */ | ||
464 | static void mcfrs_timer(void) | ||
465 | { | ||
466 | unsigned int ppstatus, dcdval, i; | ||
467 | |||
468 | ppstatus = mcf_getppdata() & (MCFPP_DCD0 | MCFPP_DCD1); | ||
469 | |||
470 | if (ppstatus != mcfrs_ppstatus) { | ||
471 | for (i = 0; (i < 2); i++) { | ||
472 | dcdval = (i ? MCFPP_DCD1 : MCFPP_DCD0); | ||
473 | if ((ppstatus & dcdval) != (mcfrs_ppstatus & dcdval)) { | ||
474 | mcfrs_modem_change(&mcfrs_table[i], | ||
475 | ((ppstatus & dcdval) ? 0 : 1)); | ||
476 | } | ||
477 | } | ||
478 | } | ||
479 | mcfrs_ppstatus = ppstatus; | ||
480 | |||
481 | /* Re-arm timer */ | ||
482 | mcfrs_timer_struct.expires = jiffies + HZ/25; | ||
483 | add_timer(&mcfrs_timer_struct); | ||
484 | } | ||
485 | |||
486 | #endif /* MCFPP_DCD0 */ | ||
487 | |||
488 | |||
489 | /* | ||
490 | * This routine is called from the scheduler tqueue when the interrupt | ||
491 | * routine has signalled that a hangup has occurred. The path of | ||
492 | * hangup processing is: | ||
493 | * | ||
494 | * serial interrupt routine -> (scheduler tqueue) -> | ||
495 | * do_serial_hangup() -> tty->hangup() -> mcfrs_hangup() | ||
496 | * | ||
497 | */ | ||
498 | static void do_serial_hangup(struct work_struct *work) | ||
499 | { | ||
500 | struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue_hangup); | ||
501 | struct tty_struct *tty = info->tty; | ||
502 | |||
503 | if (tty) | ||
504 | tty_hangup(tty); | ||
505 | } | ||
506 | |||
507 | static int startup(struct mcf_serial * info) | ||
508 | { | ||
509 | volatile unsigned char *uartp; | ||
510 | unsigned long flags; | ||
511 | |||
512 | if (info->flags & ASYNC_INITIALIZED) | ||
513 | return 0; | ||
514 | |||
515 | if (!info->xmit_buf) { | ||
516 | info->xmit_buf = (unsigned char *) __get_free_page(GFP_KERNEL); | ||
517 | if (!info->xmit_buf) | ||
518 | return -ENOMEM; | ||
519 | } | ||
520 | |||
521 | local_irq_save(flags); | ||
522 | |||
523 | #ifdef SERIAL_DEBUG_OPEN | ||
524 | printk("starting up ttyS%d (irq %d)...\n", info->line, info->irq); | ||
525 | #endif | ||
526 | |||
527 | /* | ||
528 | * Reset UART, get it into known state... | ||
529 | */ | ||
530 | uartp = info->addr; | ||
531 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX; /* reset RX */ | ||
532 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */ | ||
533 | mcfrs_setsignals(info, 1, 1); | ||
534 | |||
535 | if (info->tty) | ||
536 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | ||
537 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | ||
538 | |||
539 | /* | ||
540 | * and set the speed of the serial port | ||
541 | */ | ||
542 | mcfrs_change_speed(info); | ||
543 | |||
544 | /* | ||
545 | * Lastly enable the UART transmitter and receiver, and | ||
546 | * interrupt enables. | ||
547 | */ | ||
548 | info->imr = MCFUART_UIR_RXREADY; | ||
549 | uartp[MCFUART_UCR] = MCFUART_UCR_RXENABLE | MCFUART_UCR_TXENABLE; | ||
550 | uartp[MCFUART_UIMR] = info->imr; | ||
551 | |||
552 | info->flags |= ASYNC_INITIALIZED; | ||
553 | local_irq_restore(flags); | ||
554 | return 0; | ||
555 | } | ||
556 | |||
557 | /* | ||
558 | * This routine will shutdown a serial port; interrupts are disabled, and | ||
559 | * DTR is dropped if the hangup on close termio flag is on. | ||
560 | */ | ||
561 | static void shutdown(struct mcf_serial * info) | ||
562 | { | ||
563 | volatile unsigned char *uartp; | ||
564 | unsigned long flags; | ||
565 | |||
566 | if (!(info->flags & ASYNC_INITIALIZED)) | ||
567 | return; | ||
568 | |||
569 | #ifdef SERIAL_DEBUG_OPEN | ||
570 | printk("Shutting down serial port %d (irq %d)....\n", info->line, | ||
571 | info->irq); | ||
572 | #endif | ||
573 | |||
574 | local_irq_save(flags); | ||
575 | |||
576 | uartp = info->addr; | ||
577 | uartp[MCFUART_UIMR] = 0; /* mask all interrupts */ | ||
578 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX; /* reset RX */ | ||
579 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */ | ||
580 | |||
581 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) | ||
582 | mcfrs_setsignals(info, 0, 0); | ||
583 | |||
584 | if (info->xmit_buf) { | ||
585 | free_page((unsigned long) info->xmit_buf); | ||
586 | info->xmit_buf = 0; | ||
587 | } | ||
588 | |||
589 | if (info->tty) | ||
590 | set_bit(TTY_IO_ERROR, &info->tty->flags); | ||
591 | |||
592 | info->flags &= ~ASYNC_INITIALIZED; | ||
593 | local_irq_restore(flags); | ||
594 | } | ||
595 | |||
596 | |||
597 | /* | ||
598 | * This routine is called to set the UART divisor registers to match | ||
599 | * the specified baud rate for a serial port. | ||
600 | */ | ||
601 | static void mcfrs_change_speed(struct mcf_serial *info) | ||
602 | { | ||
603 | volatile unsigned char *uartp; | ||
604 | unsigned int baudclk, cflag; | ||
605 | unsigned long flags; | ||
606 | unsigned char mr1, mr2; | ||
607 | int i; | ||
608 | #ifdef CONFIG_M5272 | ||
609 | unsigned int fraction; | ||
610 | #endif | ||
611 | |||
612 | if (!info->tty || !info->tty->termios) | ||
613 | return; | ||
614 | cflag = info->tty->termios->c_cflag; | ||
615 | if (info->addr == 0) | ||
616 | return; | ||
617 | |||
618 | #if 0 | ||
619 | printk("%s(%d): mcfrs_change_speed()\n", __FILE__, __LINE__); | ||
620 | #endif | ||
621 | |||
622 | i = cflag & CBAUD; | ||
623 | if (i & CBAUDEX) { | ||
624 | i &= ~CBAUDEX; | ||
625 | if (i < 1 || i > 4) | ||
626 | info->tty->termios->c_cflag &= ~CBAUDEX; | ||
627 | else | ||
628 | i += 15; | ||
629 | } | ||
630 | if (i == 0) { | ||
631 | mcfrs_setsignals(info, 0, -1); | ||
632 | return; | ||
633 | } | ||
634 | |||
635 | /* compute the baudrate clock */ | ||
636 | #ifdef CONFIG_M5272 | ||
637 | /* | ||
638 | * For the MCF5272, also compute the baudrate fraction. | ||
639 | */ | ||
640 | baudclk = (MCF_BUSCLK / mcfrs_baud_table[i]) / 32; | ||
641 | fraction = MCF_BUSCLK - (baudclk * 32 * mcfrs_baud_table[i]); | ||
642 | fraction *= 16; | ||
643 | fraction /= (32 * mcfrs_baud_table[i]); | ||
644 | #else | ||
645 | baudclk = ((MCF_BUSCLK / mcfrs_baud_table[i]) + 16) / 32; | ||
646 | #endif | ||
647 | |||
648 | info->baud = mcfrs_baud_table[i]; | ||
649 | |||
650 | mr1 = MCFUART_MR1_RXIRQRDY | MCFUART_MR1_RXERRCHAR; | ||
651 | mr2 = 0; | ||
652 | |||
653 | switch (cflag & CSIZE) { | ||
654 | case CS5: mr1 |= MCFUART_MR1_CS5; break; | ||
655 | case CS6: mr1 |= MCFUART_MR1_CS6; break; | ||
656 | case CS7: mr1 |= MCFUART_MR1_CS7; break; | ||
657 | case CS8: | ||
658 | default: mr1 |= MCFUART_MR1_CS8; break; | ||
659 | } | ||
660 | |||
661 | if (cflag & PARENB) { | ||
662 | if (cflag & CMSPAR) { | ||
663 | if (cflag & PARODD) | ||
664 | mr1 |= MCFUART_MR1_PARITYMARK; | ||
665 | else | ||
666 | mr1 |= MCFUART_MR1_PARITYSPACE; | ||
667 | } else { | ||
668 | if (cflag & PARODD) | ||
669 | mr1 |= MCFUART_MR1_PARITYODD; | ||
670 | else | ||
671 | mr1 |= MCFUART_MR1_PARITYEVEN; | ||
672 | } | ||
673 | } else { | ||
674 | mr1 |= MCFUART_MR1_PARITYNONE; | ||
675 | } | ||
676 | |||
677 | if (cflag & CSTOPB) | ||
678 | mr2 |= MCFUART_MR2_STOP2; | ||
679 | else | ||
680 | mr2 |= MCFUART_MR2_STOP1; | ||
681 | |||
682 | if (cflag & CRTSCTS) { | ||
683 | mr1 |= MCFUART_MR1_RXRTS; | ||
684 | mr2 |= MCFUART_MR2_TXCTS; | ||
685 | } | ||
686 | |||
687 | if (cflag & CLOCAL) | ||
688 | info->flags &= ~ASYNC_CHECK_CD; | ||
689 | else | ||
690 | info->flags |= ASYNC_CHECK_CD; | ||
691 | |||
692 | uartp = info->addr; | ||
693 | |||
694 | local_irq_save(flags); | ||
695 | #if 0 | ||
696 | printk("%s(%d): mr1=%x mr2=%x baudclk=%x\n", __FILE__, __LINE__, | ||
697 | mr1, mr2, baudclk); | ||
698 | #endif | ||
699 | /* | ||
700 | Note: pg 12-16 of MCF5206e User's Manual states that a | ||
701 | software reset should be performed prior to changing | ||
702 | UMR1,2, UCSR, UACR, bit 7 | ||
703 | */ | ||
704 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX; /* reset RX */ | ||
705 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */ | ||
706 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETMRPTR; /* reset MR pointer */ | ||
707 | uartp[MCFUART_UMR] = mr1; | ||
708 | uartp[MCFUART_UMR] = mr2; | ||
709 | uartp[MCFUART_UBG1] = (baudclk & 0xff00) >> 8; /* set msb byte */ | ||
710 | uartp[MCFUART_UBG2] = (baudclk & 0xff); /* set lsb byte */ | ||
711 | #ifdef CONFIG_M5272 | ||
712 | uartp[MCFUART_UFPD] = (fraction & 0xf); /* set fraction */ | ||
713 | #endif | ||
714 | uartp[MCFUART_UCSR] = MCFUART_UCSR_RXCLKTIMER | MCFUART_UCSR_TXCLKTIMER; | ||
715 | uartp[MCFUART_UCR] = MCFUART_UCR_RXENABLE | MCFUART_UCR_TXENABLE; | ||
716 | mcfrs_setsignals(info, 1, -1); | ||
717 | local_irq_restore(flags); | ||
718 | return; | ||
719 | } | ||
720 | |||
721 | static void mcfrs_flush_chars(struct tty_struct *tty) | ||
722 | { | ||
723 | volatile unsigned char *uartp; | ||
724 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
725 | unsigned long flags; | ||
726 | |||
727 | if (serial_paranoia_check(info, tty->name, "mcfrs_flush_chars")) | ||
728 | return; | ||
729 | |||
730 | uartp = (volatile unsigned char *) info->addr; | ||
731 | |||
732 | /* | ||
733 | * re-enable receiver interrupt | ||
734 | */ | ||
735 | local_irq_save(flags); | ||
736 | if ((!(info->imr & MCFUART_UIR_RXREADY)) && | ||
737 | (info->flags & ASYNC_INITIALIZED) ) { | ||
738 | info->imr |= MCFUART_UIR_RXREADY; | ||
739 | uartp[MCFUART_UIMR] = info->imr; | ||
740 | } | ||
741 | local_irq_restore(flags); | ||
742 | |||
743 | if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || | ||
744 | !info->xmit_buf) | ||
745 | return; | ||
746 | |||
747 | /* Enable transmitter */ | ||
748 | local_irq_save(flags); | ||
749 | info->imr |= MCFUART_UIR_TXREADY; | ||
750 | uartp[MCFUART_UIMR] = info->imr; | ||
751 | local_irq_restore(flags); | ||
752 | } | ||
753 | |||
754 | static int mcfrs_write(struct tty_struct * tty, | ||
755 | const unsigned char *buf, int count) | ||
756 | { | ||
757 | volatile unsigned char *uartp; | ||
758 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
759 | unsigned long flags; | ||
760 | int c, total = 0; | ||
761 | |||
762 | #if 0 | ||
763 | printk("%s(%d): mcfrs_write(tty=%x,buf=%x,count=%d)\n", | ||
764 | __FILE__, __LINE__, (int)tty, (int)buf, count); | ||
765 | #endif | ||
766 | |||
767 | if (serial_paranoia_check(info, tty->name, "mcfrs_write")) | ||
768 | return 0; | ||
769 | |||
770 | if (!tty || !info->xmit_buf) | ||
771 | return 0; | ||
772 | |||
773 | local_save_flags(flags); | ||
774 | while (1) { | ||
775 | local_irq_disable(); | ||
776 | c = min(count, (int) min(((int)SERIAL_XMIT_SIZE) - info->xmit_cnt - 1, | ||
777 | ((int)SERIAL_XMIT_SIZE) - info->xmit_head)); | ||
778 | local_irq_restore(flags); | ||
779 | |||
780 | if (c <= 0) | ||
781 | break; | ||
782 | |||
783 | memcpy(info->xmit_buf + info->xmit_head, buf, c); | ||
784 | |||
785 | local_irq_disable(); | ||
786 | info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); | ||
787 | info->xmit_cnt += c; | ||
788 | local_irq_restore(flags); | ||
789 | |||
790 | buf += c; | ||
791 | count -= c; | ||
792 | total += c; | ||
793 | } | ||
794 | |||
795 | local_irq_disable(); | ||
796 | uartp = info->addr; | ||
797 | info->imr |= MCFUART_UIR_TXREADY; | ||
798 | uartp[MCFUART_UIMR] = info->imr; | ||
799 | local_irq_restore(flags); | ||
800 | |||
801 | return total; | ||
802 | } | ||
803 | |||
804 | static int mcfrs_write_room(struct tty_struct *tty) | ||
805 | { | ||
806 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
807 | int ret; | ||
808 | |||
809 | if (serial_paranoia_check(info, tty->name, "mcfrs_write_room")) | ||
810 | return 0; | ||
811 | ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; | ||
812 | if (ret < 0) | ||
813 | ret = 0; | ||
814 | return ret; | ||
815 | } | ||
816 | |||
817 | static int mcfrs_chars_in_buffer(struct tty_struct *tty) | ||
818 | { | ||
819 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
820 | |||
821 | if (serial_paranoia_check(info, tty->name, "mcfrs_chars_in_buffer")) | ||
822 | return 0; | ||
823 | return info->xmit_cnt; | ||
824 | } | ||
825 | |||
826 | static void mcfrs_flush_buffer(struct tty_struct *tty) | ||
827 | { | ||
828 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
829 | unsigned long flags; | ||
830 | |||
831 | if (serial_paranoia_check(info, tty->name, "mcfrs_flush_buffer")) | ||
832 | return; | ||
833 | |||
834 | local_irq_save(flags); | ||
835 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | ||
836 | local_irq_restore(flags); | ||
837 | |||
838 | tty_wakeup(tty); | ||
839 | } | ||
840 | |||
841 | /* | ||
842 | * ------------------------------------------------------------ | ||
843 | * mcfrs_throttle() | ||
844 | * | ||
845 | * This routine is called by the upper-layer tty layer to signal that | ||
846 | * incoming characters should be throttled. | ||
847 | * ------------------------------------------------------------ | ||
848 | */ | ||
849 | static void mcfrs_throttle(struct tty_struct * tty) | ||
850 | { | ||
851 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
852 | #ifdef SERIAL_DEBUG_THROTTLE | ||
853 | char buf[64]; | ||
854 | |||
855 | printk("throttle %s: %d....\n", tty_name(tty, buf), | ||
856 | tty->ldisc.chars_in_buffer(tty)); | ||
857 | #endif | ||
858 | |||
859 | if (serial_paranoia_check(info, tty->name, "mcfrs_throttle")) | ||
860 | return; | ||
861 | |||
862 | if (I_IXOFF(tty)) | ||
863 | info->x_char = STOP_CHAR(tty); | ||
864 | |||
865 | /* Turn off RTS line (do this atomic) */ | ||
866 | } | ||
867 | |||
868 | static void mcfrs_unthrottle(struct tty_struct * tty) | ||
869 | { | ||
870 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
871 | #ifdef SERIAL_DEBUG_THROTTLE | ||
872 | char buf[64]; | ||
873 | |||
874 | printk("unthrottle %s: %d....\n", tty_name(tty, buf), | ||
875 | tty->ldisc.chars_in_buffer(tty)); | ||
876 | #endif | ||
877 | |||
878 | if (serial_paranoia_check(info, tty->name, "mcfrs_unthrottle")) | ||
879 | return; | ||
880 | |||
881 | if (I_IXOFF(tty)) { | ||
882 | if (info->x_char) | ||
883 | info->x_char = 0; | ||
884 | else | ||
885 | info->x_char = START_CHAR(tty); | ||
886 | } | ||
887 | |||
888 | /* Assert RTS line (do this atomic) */ | ||
889 | } | ||
890 | |||
891 | /* | ||
892 | * ------------------------------------------------------------ | ||
893 | * mcfrs_ioctl() and friends | ||
894 | * ------------------------------------------------------------ | ||
895 | */ | ||
896 | |||
897 | static int get_serial_info(struct mcf_serial * info, | ||
898 | struct serial_struct * retinfo) | ||
899 | { | ||
900 | struct serial_struct tmp; | ||
901 | |||
902 | if (!retinfo) | ||
903 | return -EFAULT; | ||
904 | memset(&tmp, 0, sizeof(tmp)); | ||
905 | tmp.type = info->type; | ||
906 | tmp.line = info->line; | ||
907 | tmp.port = (unsigned int) info->addr; | ||
908 | tmp.irq = info->irq; | ||
909 | tmp.flags = info->flags; | ||
910 | tmp.baud_base = info->baud_base; | ||
911 | tmp.close_delay = info->close_delay; | ||
912 | tmp.closing_wait = info->closing_wait; | ||
913 | tmp.custom_divisor = info->custom_divisor; | ||
914 | return copy_to_user(retinfo,&tmp,sizeof(*retinfo)) ? -EFAULT : 0; | ||
915 | } | ||
916 | |||
917 | static int set_serial_info(struct mcf_serial * info, | ||
918 | struct serial_struct * new_info) | ||
919 | { | ||
920 | struct serial_struct new_serial; | ||
921 | struct mcf_serial old_info; | ||
922 | int retval = 0; | ||
923 | |||
924 | if (!new_info) | ||
925 | return -EFAULT; | ||
926 | if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) | ||
927 | return -EFAULT; | ||
928 | old_info = *info; | ||
929 | |||
930 | if (!capable(CAP_SYS_ADMIN)) { | ||
931 | if ((new_serial.baud_base != info->baud_base) || | ||
932 | (new_serial.type != info->type) || | ||
933 | (new_serial.close_delay != info->close_delay) || | ||
934 | ((new_serial.flags & ~ASYNC_USR_MASK) != | ||
935 | (info->flags & ~ASYNC_USR_MASK))) | ||
936 | return -EPERM; | ||
937 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | | ||
938 | (new_serial.flags & ASYNC_USR_MASK)); | ||
939 | info->custom_divisor = new_serial.custom_divisor; | ||
940 | goto check_and_exit; | ||
941 | } | ||
942 | |||
943 | if (info->count > 1) | ||
944 | return -EBUSY; | ||
945 | |||
946 | /* | ||
947 | * OK, past this point, all the error checking has been done. | ||
948 | * At this point, we start making changes..... | ||
949 | */ | ||
950 | |||
951 | info->baud_base = new_serial.baud_base; | ||
952 | info->flags = ((info->flags & ~ASYNC_FLAGS) | | ||
953 | (new_serial.flags & ASYNC_FLAGS)); | ||
954 | info->type = new_serial.type; | ||
955 | info->close_delay = new_serial.close_delay; | ||
956 | info->closing_wait = new_serial.closing_wait; | ||
957 | |||
958 | check_and_exit: | ||
959 | retval = startup(info); | ||
960 | return retval; | ||
961 | } | ||
962 | |||
963 | /* | ||
964 | * get_lsr_info - get line status register info | ||
965 | * | ||
966 | * Purpose: Let user call ioctl() to get info when the UART physically | ||
967 | * is emptied. On bus types like RS485, the transmitter must | ||
968 | * release the bus after transmitting. This must be done when | ||
969 | * the transmit shift register is empty, not be done when the | ||
970 | * transmit holding register is empty. This functionality | ||
971 | * allows an RS485 driver to be written in user space. | ||
972 | */ | ||
973 | static int get_lsr_info(struct mcf_serial * info, unsigned int *value) | ||
974 | { | ||
975 | volatile unsigned char *uartp; | ||
976 | unsigned long flags; | ||
977 | unsigned char status; | ||
978 | |||
979 | local_irq_save(flags); | ||
980 | uartp = info->addr; | ||
981 | status = (uartp[MCFUART_USR] & MCFUART_USR_TXEMPTY) ? TIOCSER_TEMT : 0; | ||
982 | local_irq_restore(flags); | ||
983 | |||
984 | return put_user(status,value); | ||
985 | } | ||
986 | |||
987 | /* | ||
988 | * This routine sends a break character out the serial port. | ||
989 | */ | ||
990 | static void send_break( struct mcf_serial * info, int duration) | ||
991 | { | ||
992 | volatile unsigned char *uartp; | ||
993 | unsigned long flags; | ||
994 | |||
995 | if (!info->addr) | ||
996 | return; | ||
997 | set_current_state(TASK_INTERRUPTIBLE); | ||
998 | uartp = info->addr; | ||
999 | |||
1000 | local_irq_save(flags); | ||
1001 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDBREAKSTART; | ||
1002 | schedule_timeout(duration); | ||
1003 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDBREAKSTOP; | ||
1004 | local_irq_restore(flags); | ||
1005 | } | ||
1006 | |||
1007 | static int mcfrs_tiocmget(struct tty_struct *tty, struct file *file) | ||
1008 | { | ||
1009 | struct mcf_serial * info = (struct mcf_serial *)tty->driver_data; | ||
1010 | |||
1011 | if (serial_paranoia_check(info, tty->name, "mcfrs_ioctl")) | ||
1012 | return -ENODEV; | ||
1013 | if (tty->flags & (1 << TTY_IO_ERROR)) | ||
1014 | return -EIO; | ||
1015 | |||
1016 | return mcfrs_getsignals(info); | ||
1017 | } | ||
1018 | |||
1019 | static int mcfrs_tiocmset(struct tty_struct *tty, struct file *file, | ||
1020 | unsigned int set, unsigned int clear) | ||
1021 | { | ||
1022 | struct mcf_serial * info = (struct mcf_serial *)tty->driver_data; | ||
1023 | int rts = -1, dtr = -1; | ||
1024 | |||
1025 | if (serial_paranoia_check(info, tty->name, "mcfrs_ioctl")) | ||
1026 | return -ENODEV; | ||
1027 | if (tty->flags & (1 << TTY_IO_ERROR)) | ||
1028 | return -EIO; | ||
1029 | |||
1030 | if (set & TIOCM_RTS) | ||
1031 | rts = 1; | ||
1032 | if (set & TIOCM_DTR) | ||
1033 | dtr = 1; | ||
1034 | if (clear & TIOCM_RTS) | ||
1035 | rts = 0; | ||
1036 | if (clear & TIOCM_DTR) | ||
1037 | dtr = 0; | ||
1038 | |||
1039 | mcfrs_setsignals(info, dtr, rts); | ||
1040 | |||
1041 | return 0; | ||
1042 | } | ||
1043 | |||
1044 | static int mcfrs_ioctl(struct tty_struct *tty, struct file * file, | ||
1045 | unsigned int cmd, unsigned long arg) | ||
1046 | { | ||
1047 | struct mcf_serial * info = (struct mcf_serial *)tty->driver_data; | ||
1048 | int retval, error; | ||
1049 | |||
1050 | if (serial_paranoia_check(info, tty->name, "mcfrs_ioctl")) | ||
1051 | return -ENODEV; | ||
1052 | |||
1053 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && | ||
1054 | (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD) && | ||
1055 | (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT)) { | ||
1056 | if (tty->flags & (1 << TTY_IO_ERROR)) | ||
1057 | return -EIO; | ||
1058 | } | ||
1059 | |||
1060 | switch (cmd) { | ||
1061 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | ||
1062 | retval = tty_check_change(tty); | ||
1063 | if (retval) | ||
1064 | return retval; | ||
1065 | tty_wait_until_sent(tty, 0); | ||
1066 | if (!arg) | ||
1067 | send_break(info, HZ/4); /* 1/4 second */ | ||
1068 | return 0; | ||
1069 | case TCSBRKP: /* support for POSIX tcsendbreak() */ | ||
1070 | retval = tty_check_change(tty); | ||
1071 | if (retval) | ||
1072 | return retval; | ||
1073 | tty_wait_until_sent(tty, 0); | ||
1074 | send_break(info, arg ? arg*(HZ/10) : HZ/4); | ||
1075 | return 0; | ||
1076 | case TIOCGSERIAL: | ||
1077 | if (access_ok(VERIFY_WRITE, (void *) arg, | ||
1078 | sizeof(struct serial_struct))) | ||
1079 | return get_serial_info(info, | ||
1080 | (struct serial_struct *) arg); | ||
1081 | return -EFAULT; | ||
1082 | case TIOCSSERIAL: | ||
1083 | return set_serial_info(info, | ||
1084 | (struct serial_struct *) arg); | ||
1085 | case TIOCSERGETLSR: /* Get line status register */ | ||
1086 | if (access_ok(VERIFY_WRITE, (void *) arg, | ||
1087 | sizeof(unsigned int))) | ||
1088 | return get_lsr_info(info, (unsigned int *) arg); | ||
1089 | return -EFAULT; | ||
1090 | case TIOCSERGSTRUCT: | ||
1091 | error = copy_to_user((struct mcf_serial *) arg, | ||
1092 | info, sizeof(struct mcf_serial)); | ||
1093 | if (error) | ||
1094 | return -EFAULT; | ||
1095 | return 0; | ||
1096 | |||
1097 | #ifdef TIOCSET422 | ||
1098 | case TIOCSET422: { | ||
1099 | unsigned int val; | ||
1100 | get_user(val, (unsigned int *) arg); | ||
1101 | mcf_setpa(MCFPP_PA11, (val ? 0 : MCFPP_PA11)); | ||
1102 | break; | ||
1103 | } | ||
1104 | case TIOCGET422: { | ||
1105 | unsigned int val; | ||
1106 | val = (mcf_getpa() & MCFPP_PA11) ? 0 : 1; | ||
1107 | put_user(val, (unsigned int *) arg); | ||
1108 | break; | ||
1109 | } | ||
1110 | #endif | ||
1111 | |||
1112 | default: | ||
1113 | return -ENOIOCTLCMD; | ||
1114 | } | ||
1115 | return 0; | ||
1116 | } | ||
1117 | |||
1118 | static void mcfrs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | ||
1119 | { | ||
1120 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
1121 | |||
1122 | if (tty->termios->c_cflag == old_termios->c_cflag) | ||
1123 | return; | ||
1124 | |||
1125 | mcfrs_change_speed(info); | ||
1126 | |||
1127 | if ((old_termios->c_cflag & CRTSCTS) && | ||
1128 | !(tty->termios->c_cflag & CRTSCTS)) { | ||
1129 | tty->hw_stopped = 0; | ||
1130 | mcfrs_setsignals(info, -1, 1); | ||
1131 | #if 0 | ||
1132 | mcfrs_start(tty); | ||
1133 | #endif | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | /* | ||
1138 | * ------------------------------------------------------------ | ||
1139 | * mcfrs_close() | ||
1140 | * | ||
1141 | * This routine is called when the serial port gets closed. First, we | ||
1142 | * wait for the last remaining data to be sent. Then, we unlink its | ||
1143 | * S structure from the interrupt chain if necessary, and we free | ||
1144 | * that IRQ if nothing is left in the chain. | ||
1145 | * ------------------------------------------------------------ | ||
1146 | */ | ||
1147 | static void mcfrs_close(struct tty_struct *tty, struct file * filp) | ||
1148 | { | ||
1149 | volatile unsigned char *uartp; | ||
1150 | struct mcf_serial *info = (struct mcf_serial *)tty->driver_data; | ||
1151 | unsigned long flags; | ||
1152 | |||
1153 | if (!info || serial_paranoia_check(info, tty->name, "mcfrs_close")) | ||
1154 | return; | ||
1155 | |||
1156 | local_irq_save(flags); | ||
1157 | |||
1158 | if (tty_hung_up_p(filp)) { | ||
1159 | local_irq_restore(flags); | ||
1160 | return; | ||
1161 | } | ||
1162 | |||
1163 | #ifdef SERIAL_DEBUG_OPEN | ||
1164 | printk("mcfrs_close ttyS%d, count = %d\n", info->line, info->count); | ||
1165 | #endif | ||
1166 | if ((tty->count == 1) && (info->count != 1)) { | ||
1167 | /* | ||
1168 | * Uh, oh. tty->count is 1, which means that the tty | ||
1169 | * structure will be freed. Info->count should always | ||
1170 | * be one in these conditions. If it's greater than | ||
1171 | * one, we've got real problems, since it means the | ||
1172 | * serial port won't be shutdown. | ||
1173 | */ | ||
1174 | printk("MCFRS: bad serial port count; tty->count is 1, " | ||
1175 | "info->count is %d\n", info->count); | ||
1176 | info->count = 1; | ||
1177 | } | ||
1178 | if (--info->count < 0) { | ||
1179 | printk("MCFRS: bad serial port count for ttyS%d: %d\n", | ||
1180 | info->line, info->count); | ||
1181 | info->count = 0; | ||
1182 | } | ||
1183 | if (info->count) { | ||
1184 | local_irq_restore(flags); | ||
1185 | return; | ||
1186 | } | ||
1187 | info->flags |= ASYNC_CLOSING; | ||
1188 | |||
1189 | /* | ||
1190 | * Now we wait for the transmit buffer to clear; and we notify | ||
1191 | * the line discipline to only process XON/XOFF characters. | ||
1192 | */ | ||
1193 | tty->closing = 1; | ||
1194 | if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) | ||
1195 | tty_wait_until_sent(tty, info->closing_wait); | ||
1196 | |||
1197 | /* | ||
1198 | * At this point we stop accepting input. To do this, we | ||
1199 | * disable the receive line status interrupts, and tell the | ||
1200 | * interrupt driver to stop checking the data ready bit in the | ||
1201 | * line status register. | ||
1202 | */ | ||
1203 | info->imr &= ~MCFUART_UIR_RXREADY; | ||
1204 | uartp = info->addr; | ||
1205 | uartp[MCFUART_UIMR] = info->imr; | ||
1206 | |||
1207 | #if 0 | ||
1208 | /* FIXME: do we need to keep this enabled for console?? */ | ||
1209 | if (mcfrs_console_inited && (mcfrs_console_port == info->line)) { | ||
1210 | /* Do not disable the UART */ ; | ||
1211 | } else | ||
1212 | #endif | ||
1213 | shutdown(info); | ||
1214 | mcfrs_flush_buffer(tty); | ||
1215 | tty_ldisc_flush(tty); | ||
1216 | |||
1217 | tty->closing = 0; | ||
1218 | info->event = 0; | ||
1219 | info->tty = 0; | ||
1220 | #if 0 | ||
1221 | if (tty->ldisc.num != ldiscs[N_TTY].num) { | ||
1222 | if (tty->ldisc.close) | ||
1223 | (tty->ldisc.close)(tty); | ||
1224 | tty->ldisc = ldiscs[N_TTY]; | ||
1225 | tty->termios->c_line = N_TTY; | ||
1226 | if (tty->ldisc.open) | ||
1227 | (tty->ldisc.open)(tty); | ||
1228 | } | ||
1229 | #endif | ||
1230 | if (info->blocked_open) { | ||
1231 | if (info->close_delay) { | ||
1232 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | ||
1233 | } | ||
1234 | wake_up_interruptible(&info->open_wait); | ||
1235 | } | ||
1236 | info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | ||
1237 | wake_up_interruptible(&info->close_wait); | ||
1238 | local_irq_restore(flags); | ||
1239 | } | ||
1240 | |||
1241 | /* | ||
1242 | * mcfrs_wait_until_sent() --- wait until the transmitter is empty | ||
1243 | */ | ||
1244 | static void | ||
1245 | mcfrs_wait_until_sent(struct tty_struct *tty, int timeout) | ||
1246 | { | ||
1247 | #ifdef CONFIG_M5272 | ||
1248 | #define MCF5272_FIFO_SIZE 25 /* fifo size + shift reg */ | ||
1249 | |||
1250 | struct mcf_serial * info = (struct mcf_serial *)tty->driver_data; | ||
1251 | volatile unsigned char *uartp; | ||
1252 | unsigned long orig_jiffies, fifo_time, char_time, fifo_cnt; | ||
1253 | |||
1254 | if (serial_paranoia_check(info, tty->name, "mcfrs_wait_until_sent")) | ||
1255 | return; | ||
1256 | |||
1257 | orig_jiffies = jiffies; | ||
1258 | |||
1259 | /* | ||
1260 | * Set the check interval to be 1/5 of the approximate time | ||
1261 | * to send the entire fifo, and make it at least 1. The check | ||
1262 | * interval should also be less than the timeout. | ||
1263 | * | ||
1264 | * Note: we have to use pretty tight timings here to satisfy | ||
1265 | * the NIST-PCTS. | ||
1266 | */ | ||
1267 | lock_kernel(); | ||
1268 | |||
1269 | fifo_time = (MCF5272_FIFO_SIZE * HZ * 10) / info->baud; | ||
1270 | char_time = fifo_time / 5; | ||
1271 | if (char_time == 0) | ||
1272 | char_time = 1; | ||
1273 | if (timeout && timeout < char_time) | ||
1274 | char_time = timeout; | ||
1275 | |||
1276 | /* | ||
1277 | * Clamp the timeout period at 2 * the time to empty the | ||
1278 | * fifo. Just to be safe, set the minimum at .5 seconds. | ||
1279 | */ | ||
1280 | fifo_time *= 2; | ||
1281 | if (fifo_time < (HZ/2)) | ||
1282 | fifo_time = HZ/2; | ||
1283 | if (!timeout || timeout > fifo_time) | ||
1284 | timeout = fifo_time; | ||
1285 | |||
1286 | /* | ||
1287 | * Account for the number of bytes in the UART | ||
1288 | * transmitter FIFO plus any byte being shifted out. | ||
1289 | */ | ||
1290 | uartp = (volatile unsigned char *) info->addr; | ||
1291 | for (;;) { | ||
1292 | fifo_cnt = (uartp[MCFUART_UTF] & MCFUART_UTF_TXB); | ||
1293 | if ((uartp[MCFUART_USR] & (MCFUART_USR_TXREADY| | ||
1294 | MCFUART_USR_TXEMPTY)) == | ||
1295 | MCFUART_USR_TXREADY) | ||
1296 | fifo_cnt++; | ||
1297 | if (fifo_cnt == 0) | ||
1298 | break; | ||
1299 | msleep_interruptible(jiffies_to_msecs(char_time)); | ||
1300 | if (signal_pending(current)) | ||
1301 | break; | ||
1302 | if (timeout && time_after(jiffies, orig_jiffies + timeout)) | ||
1303 | break; | ||
1304 | } | ||
1305 | unlock_kernel(); | ||
1306 | #else | ||
1307 | /* | ||
1308 | * For the other coldfire models, assume all data has been sent | ||
1309 | */ | ||
1310 | #endif | ||
1311 | } | ||
1312 | |||
1313 | /* | ||
1314 | * mcfrs_hangup() --- called by tty_hangup() when a hangup is signaled. | ||
1315 | */ | ||
1316 | void mcfrs_hangup(struct tty_struct *tty) | ||
1317 | { | ||
1318 | struct mcf_serial * info = (struct mcf_serial *)tty->driver_data; | ||
1319 | |||
1320 | if (serial_paranoia_check(info, tty->name, "mcfrs_hangup")) | ||
1321 | return; | ||
1322 | |||
1323 | mcfrs_flush_buffer(tty); | ||
1324 | shutdown(info); | ||
1325 | info->event = 0; | ||
1326 | info->count = 0; | ||
1327 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | ||
1328 | info->tty = 0; | ||
1329 | wake_up_interruptible(&info->open_wait); | ||
1330 | } | ||
1331 | |||
1332 | /* | ||
1333 | * ------------------------------------------------------------ | ||
1334 | * mcfrs_open() and friends | ||
1335 | * ------------------------------------------------------------ | ||
1336 | */ | ||
1337 | static int block_til_ready(struct tty_struct *tty, struct file * filp, | ||
1338 | struct mcf_serial *info) | ||
1339 | { | ||
1340 | DECLARE_WAITQUEUE(wait, current); | ||
1341 | int retval; | ||
1342 | int do_clocal = 0; | ||
1343 | |||
1344 | /* | ||
1345 | * If the device is in the middle of being closed, then block | ||
1346 | * until it's done, and then try again. | ||
1347 | */ | ||
1348 | if (info->flags & ASYNC_CLOSING) { | ||
1349 | interruptible_sleep_on(&info->close_wait); | ||
1350 | #ifdef SERIAL_DO_RESTART | ||
1351 | if (info->flags & ASYNC_HUP_NOTIFY) | ||
1352 | return -EAGAIN; | ||
1353 | else | ||
1354 | return -ERESTARTSYS; | ||
1355 | #else | ||
1356 | return -EAGAIN; | ||
1357 | #endif | ||
1358 | } | ||
1359 | |||
1360 | /* | ||
1361 | * If non-blocking mode is set, or the port is not enabled, | ||
1362 | * then make the check up front and then exit. | ||
1363 | */ | ||
1364 | if ((filp->f_flags & O_NONBLOCK) || | ||
1365 | (tty->flags & (1 << TTY_IO_ERROR))) { | ||
1366 | info->flags |= ASYNC_NORMAL_ACTIVE; | ||
1367 | return 0; | ||
1368 | } | ||
1369 | |||
1370 | if (tty->termios->c_cflag & CLOCAL) | ||
1371 | do_clocal = 1; | ||
1372 | |||
1373 | /* | ||
1374 | * Block waiting for the carrier detect and the line to become | ||
1375 | * free (i.e., not in use by the callout). While we are in | ||
1376 | * this loop, info->count is dropped by one, so that | ||
1377 | * mcfrs_close() knows when to free things. We restore it upon | ||
1378 | * exit, either normal or abnormal. | ||
1379 | */ | ||
1380 | retval = 0; | ||
1381 | add_wait_queue(&info->open_wait, &wait); | ||
1382 | #ifdef SERIAL_DEBUG_OPEN | ||
1383 | printk("block_til_ready before block: ttyS%d, count = %d\n", | ||
1384 | info->line, info->count); | ||
1385 | #endif | ||
1386 | info->count--; | ||
1387 | info->blocked_open++; | ||
1388 | while (1) { | ||
1389 | local_irq_disable(); | ||
1390 | mcfrs_setsignals(info, 1, 1); | ||
1391 | local_irq_enable(); | ||
1392 | current->state = TASK_INTERRUPTIBLE; | ||
1393 | if (tty_hung_up_p(filp) || | ||
1394 | !(info->flags & ASYNC_INITIALIZED)) { | ||
1395 | #ifdef SERIAL_DO_RESTART | ||
1396 | if (info->flags & ASYNC_HUP_NOTIFY) | ||
1397 | retval = -EAGAIN; | ||
1398 | else | ||
1399 | retval = -ERESTARTSYS; | ||
1400 | #else | ||
1401 | retval = -EAGAIN; | ||
1402 | #endif | ||
1403 | break; | ||
1404 | } | ||
1405 | if (!(info->flags & ASYNC_CLOSING) && | ||
1406 | (do_clocal || (mcfrs_getsignals(info) & TIOCM_CD))) | ||
1407 | break; | ||
1408 | if (signal_pending(current)) { | ||
1409 | retval = -ERESTARTSYS; | ||
1410 | break; | ||
1411 | } | ||
1412 | #ifdef SERIAL_DEBUG_OPEN | ||
1413 | printk("block_til_ready blocking: ttyS%d, count = %d\n", | ||
1414 | info->line, info->count); | ||
1415 | #endif | ||
1416 | schedule(); | ||
1417 | } | ||
1418 | current->state = TASK_RUNNING; | ||
1419 | remove_wait_queue(&info->open_wait, &wait); | ||
1420 | if (!tty_hung_up_p(filp)) | ||
1421 | info->count++; | ||
1422 | info->blocked_open--; | ||
1423 | #ifdef SERIAL_DEBUG_OPEN | ||
1424 | printk("block_til_ready after blocking: ttyS%d, count = %d\n", | ||
1425 | info->line, info->count); | ||
1426 | #endif | ||
1427 | if (retval) | ||
1428 | return retval; | ||
1429 | info->flags |= ASYNC_NORMAL_ACTIVE; | ||
1430 | return 0; | ||
1431 | } | ||
1432 | |||
1433 | /* | ||
1434 | * This routine is called whenever a serial port is opened. It | ||
1435 | * enables interrupts for a serial port, linking in its structure into | ||
1436 | * the IRQ chain. It also performs the serial-specific | ||
1437 | * initialization for the tty structure. | ||
1438 | */ | ||
1439 | int mcfrs_open(struct tty_struct *tty, struct file * filp) | ||
1440 | { | ||
1441 | struct mcf_serial *info; | ||
1442 | int retval, line; | ||
1443 | |||
1444 | line = tty->index; | ||
1445 | if ((line < 0) || (line >= NR_PORTS)) | ||
1446 | return -ENODEV; | ||
1447 | info = mcfrs_table + line; | ||
1448 | if (serial_paranoia_check(info, tty->name, "mcfrs_open")) | ||
1449 | return -ENODEV; | ||
1450 | #ifdef SERIAL_DEBUG_OPEN | ||
1451 | printk("mcfrs_open %s, count = %d\n", tty->name, info->count); | ||
1452 | #endif | ||
1453 | info->count++; | ||
1454 | tty->driver_data = info; | ||
1455 | info->tty = tty; | ||
1456 | |||
1457 | /* | ||
1458 | * Start up serial port | ||
1459 | */ | ||
1460 | retval = startup(info); | ||
1461 | if (retval) | ||
1462 | return retval; | ||
1463 | |||
1464 | retval = block_til_ready(tty, filp, info); | ||
1465 | if (retval) { | ||
1466 | #ifdef SERIAL_DEBUG_OPEN | ||
1467 | printk("mcfrs_open returning after block_til_ready with %d\n", | ||
1468 | retval); | ||
1469 | #endif | ||
1470 | return retval; | ||
1471 | } | ||
1472 | |||
1473 | #ifdef SERIAL_DEBUG_OPEN | ||
1474 | printk("mcfrs_open %s successful...\n", tty->name); | ||
1475 | #endif | ||
1476 | return 0; | ||
1477 | } | ||
1478 | |||
1479 | /* | ||
1480 | * Based on the line number set up the internal interrupt stuff. | ||
1481 | */ | ||
1482 | static void mcfrs_irqinit(struct mcf_serial *info) | ||
1483 | { | ||
1484 | #if defined(CONFIG_M5272) | ||
1485 | volatile unsigned long *icrp; | ||
1486 | volatile unsigned long *portp; | ||
1487 | volatile unsigned char *uartp; | ||
1488 | |||
1489 | uartp = info->addr; | ||
1490 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR2); | ||
1491 | |||
1492 | switch (info->line) { | ||
1493 | case 0: | ||
1494 | *icrp = 0xe0000000; | ||
1495 | break; | ||
1496 | case 1: | ||
1497 | *icrp = 0x0e000000; | ||
1498 | break; | ||
1499 | default: | ||
1500 | printk("MCFRS: don't know how to handle UART %d interrupt?\n", | ||
1501 | info->line); | ||
1502 | return; | ||
1503 | } | ||
1504 | |||
1505 | /* Enable the output lines for the serial ports */ | ||
1506 | portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PBCNT); | ||
1507 | *portp = (*portp & ~0x000000ff) | 0x00000055; | ||
1508 | portp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_PDCNT); | ||
1509 | *portp = (*portp & ~0x000003fc) | 0x000002a8; | ||
1510 | #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) | ||
1511 | volatile unsigned char *icrp, *uartp; | ||
1512 | volatile unsigned long *imrp; | ||
1513 | |||
1514 | uartp = info->addr; | ||
1515 | |||
1516 | icrp = (volatile unsigned char *) (MCF_MBAR + MCFICM_INTC0 + | ||
1517 | MCFINTC_ICR0 + MCFINT_UART0 + info->line); | ||
1518 | *icrp = 0x30 + info->line; /* level 6, line based priority */ | ||
1519 | |||
1520 | imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 + | ||
1521 | MCFINTC_IMRL); | ||
1522 | *imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1); | ||
1523 | #if defined(CONFIG_M527x) | ||
1524 | { | ||
1525 | /* | ||
1526 | * External Pin Mask Setting & Enable External Pin for Interface | ||
1527 | * mrcbis@aliceposta.it | ||
1528 | */ | ||
1529 | u16 *serpin_enable_mask; | ||
1530 | serpin_enable_mask = (u16 *) (MCF_IPSBAR + MCF_GPIO_PAR_UART); | ||
1531 | if (info->line == 0) | ||
1532 | *serpin_enable_mask |= UART0_ENABLE_MASK; | ||
1533 | else if (info->line == 1) | ||
1534 | *serpin_enable_mask |= UART1_ENABLE_MASK; | ||
1535 | else if (info->line == 2) | ||
1536 | *serpin_enable_mask |= UART2_ENABLE_MASK; | ||
1537 | } | ||
1538 | #endif | ||
1539 | #if defined(CONFIG_M528x) | ||
1540 | /* make sure PUAPAR is set for UART0 and UART1 */ | ||
1541 | if (info->line < 2) { | ||
1542 | volatile unsigned char *portp = (volatile unsigned char *) (MCF_MBAR + MCF5282_GPIO_PUAPAR); | ||
1543 | *portp |= (0x03 << (info->line * 2)); | ||
1544 | } | ||
1545 | #endif | ||
1546 | #elif defined(CONFIG_M520x) | ||
1547 | volatile unsigned char *icrp, *uartp; | ||
1548 | volatile unsigned long *imrp; | ||
1549 | |||
1550 | uartp = info->addr; | ||
1551 | |||
1552 | icrp = (volatile unsigned char *) (MCF_MBAR + MCFICM_INTC0 + | ||
1553 | MCFINTC_ICR0 + MCFINT_UART0 + info->line); | ||
1554 | *icrp = 0x03; | ||
1555 | |||
1556 | imrp = (volatile unsigned long *) (MCF_MBAR + MCFICM_INTC0 + | ||
1557 | MCFINTC_IMRL); | ||
1558 | *imrp &= ~((1 << (info->irq - MCFINT_VECBASE)) | 1); | ||
1559 | if (info->line < 2) { | ||
1560 | unsigned short *uart_par; | ||
1561 | uart_par = (unsigned short *)(MCF_IPSBAR + MCF_GPIO_PAR_UART); | ||
1562 | if (info->line == 0) | ||
1563 | *uart_par |= MCF_GPIO_PAR_UART_PAR_UTXD0 | ||
1564 | | MCF_GPIO_PAR_UART_PAR_URXD0; | ||
1565 | else if (info->line == 1) | ||
1566 | *uart_par |= MCF_GPIO_PAR_UART_PAR_UTXD1 | ||
1567 | | MCF_GPIO_PAR_UART_PAR_URXD1; | ||
1568 | } else if (info->line == 2) { | ||
1569 | unsigned char *feci2c_par; | ||
1570 | feci2c_par = (unsigned char *)(MCF_IPSBAR + MCF_GPIO_PAR_FECI2C); | ||
1571 | *feci2c_par &= ~0x0F; | ||
1572 | *feci2c_par |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 | ||
1573 | | MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2; | ||
1574 | } | ||
1575 | #elif defined(CONFIG_M532x) | ||
1576 | volatile unsigned char *uartp; | ||
1577 | uartp = info->addr; | ||
1578 | switch (info->line) { | ||
1579 | case 0: | ||
1580 | MCF_INTC0_ICR26 = 0x3; | ||
1581 | MCF_INTC0_CIMR = 26; | ||
1582 | /* GPIO initialization */ | ||
1583 | MCF_GPIO_PAR_UART |= 0x000F; | ||
1584 | break; | ||
1585 | case 1: | ||
1586 | MCF_INTC0_ICR27 = 0x3; | ||
1587 | MCF_INTC0_CIMR = 27; | ||
1588 | /* GPIO initialization */ | ||
1589 | MCF_GPIO_PAR_UART |= 0x0FF0; | ||
1590 | break; | ||
1591 | case 2: | ||
1592 | MCF_INTC0_ICR28 = 0x3; | ||
1593 | MCF_INTC0_CIMR = 28; | ||
1594 | /* GPIOs also must be initalized, depends on board */ | ||
1595 | break; | ||
1596 | } | ||
1597 | #else | ||
1598 | volatile unsigned char *icrp, *uartp; | ||
1599 | |||
1600 | switch (info->line) { | ||
1601 | case 0: | ||
1602 | icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_UART1ICR); | ||
1603 | *icrp = /*MCFSIM_ICR_AUTOVEC |*/ MCFSIM_ICR_LEVEL6 | | ||
1604 | MCFSIM_ICR_PRI1; | ||
1605 | mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1); | ||
1606 | break; | ||
1607 | case 1: | ||
1608 | icrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_UART2ICR); | ||
1609 | *icrp = /*MCFSIM_ICR_AUTOVEC |*/ MCFSIM_ICR_LEVEL6 | | ||
1610 | MCFSIM_ICR_PRI2; | ||
1611 | mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2); | ||
1612 | break; | ||
1613 | default: | ||
1614 | printk("MCFRS: don't know how to handle UART %d interrupt?\n", | ||
1615 | info->line); | ||
1616 | return; | ||
1617 | } | ||
1618 | |||
1619 | uartp = info->addr; | ||
1620 | uartp[MCFUART_UIVR] = info->irq; | ||
1621 | #endif | ||
1622 | |||
1623 | /* Clear mask, so no surprise interrupts. */ | ||
1624 | uartp[MCFUART_UIMR] = 0; | ||
1625 | |||
1626 | if (request_irq(info->irq, mcfrs_interrupt, IRQF_DISABLED, | ||
1627 | "ColdFire UART", NULL)) { | ||
1628 | printk("MCFRS: Unable to attach ColdFire UART %d interrupt " | ||
1629 | "vector=%d\n", info->line, info->irq); | ||
1630 | } | ||
1631 | |||
1632 | return; | ||
1633 | } | ||
1634 | |||
1635 | |||
1636 | char *mcfrs_drivername = "ColdFire internal UART serial driver version 1.00\n"; | ||
1637 | |||
1638 | |||
1639 | /* | ||
1640 | * Serial stats reporting... | ||
1641 | */ | ||
1642 | int mcfrs_readproc(char *page, char **start, off_t off, int count, | ||
1643 | int *eof, void *data) | ||
1644 | { | ||
1645 | struct mcf_serial *info; | ||
1646 | char str[20]; | ||
1647 | int len, sigs, i; | ||
1648 | |||
1649 | len = sprintf(page, mcfrs_drivername); | ||
1650 | for (i = 0; (i < NR_PORTS); i++) { | ||
1651 | info = &mcfrs_table[i]; | ||
1652 | len += sprintf((page + len), "%d: port:%x irq=%d baud:%d ", | ||
1653 | i, (unsigned int) info->addr, info->irq, info->baud); | ||
1654 | if (info->stats.rx || info->stats.tx) | ||
1655 | len += sprintf((page + len), "tx:%d rx:%d ", | ||
1656 | info->stats.tx, info->stats.rx); | ||
1657 | if (info->stats.rxframing) | ||
1658 | len += sprintf((page + len), "fe:%d ", | ||
1659 | info->stats.rxframing); | ||
1660 | if (info->stats.rxparity) | ||
1661 | len += sprintf((page + len), "pe:%d ", | ||
1662 | info->stats.rxparity); | ||
1663 | if (info->stats.rxbreak) | ||
1664 | len += sprintf((page + len), "brk:%d ", | ||
1665 | info->stats.rxbreak); | ||
1666 | if (info->stats.rxoverrun) | ||
1667 | len += sprintf((page + len), "oe:%d ", | ||
1668 | info->stats.rxoverrun); | ||
1669 | |||
1670 | str[0] = str[1] = 0; | ||
1671 | if ((sigs = mcfrs_getsignals(info))) { | ||
1672 | if (sigs & TIOCM_RTS) | ||
1673 | strcat(str, "|RTS"); | ||
1674 | if (sigs & TIOCM_CTS) | ||
1675 | strcat(str, "|CTS"); | ||
1676 | if (sigs & TIOCM_DTR) | ||
1677 | strcat(str, "|DTR"); | ||
1678 | if (sigs & TIOCM_CD) | ||
1679 | strcat(str, "|CD"); | ||
1680 | } | ||
1681 | |||
1682 | len += sprintf((page + len), "%s\n", &str[1]); | ||
1683 | } | ||
1684 | |||
1685 | return(len); | ||
1686 | } | ||
1687 | |||
1688 | |||
1689 | /* Finally, routines used to initialize the serial driver. */ | ||
1690 | |||
1691 | static void show_serial_version(void) | ||
1692 | { | ||
1693 | printk(mcfrs_drivername); | ||
1694 | } | ||
1695 | |||
1696 | static const struct tty_operations mcfrs_ops = { | ||
1697 | .open = mcfrs_open, | ||
1698 | .close = mcfrs_close, | ||
1699 | .write = mcfrs_write, | ||
1700 | .flush_chars = mcfrs_flush_chars, | ||
1701 | .write_room = mcfrs_write_room, | ||
1702 | .chars_in_buffer = mcfrs_chars_in_buffer, | ||
1703 | .flush_buffer = mcfrs_flush_buffer, | ||
1704 | .ioctl = mcfrs_ioctl, | ||
1705 | .throttle = mcfrs_throttle, | ||
1706 | .unthrottle = mcfrs_unthrottle, | ||
1707 | .set_termios = mcfrs_set_termios, | ||
1708 | .stop = mcfrs_stop, | ||
1709 | .start = mcfrs_start, | ||
1710 | .hangup = mcfrs_hangup, | ||
1711 | .read_proc = mcfrs_readproc, | ||
1712 | .wait_until_sent = mcfrs_wait_until_sent, | ||
1713 | .tiocmget = mcfrs_tiocmget, | ||
1714 | .tiocmset = mcfrs_tiocmset, | ||
1715 | }; | ||
1716 | |||
1717 | /* mcfrs_init inits the driver */ | ||
1718 | static int __init | ||
1719 | mcfrs_init(void) | ||
1720 | { | ||
1721 | struct mcf_serial *info; | ||
1722 | unsigned long flags; | ||
1723 | int i; | ||
1724 | |||
1725 | /* Setup base handler, and timer table. */ | ||
1726 | #ifdef MCFPP_DCD0 | ||
1727 | init_timer(&mcfrs_timer_struct); | ||
1728 | mcfrs_timer_struct.function = mcfrs_timer; | ||
1729 | mcfrs_timer_struct.data = 0; | ||
1730 | mcfrs_timer_struct.expires = jiffies + HZ/25; | ||
1731 | add_timer(&mcfrs_timer_struct); | ||
1732 | mcfrs_ppstatus = mcf_getppdata() & (MCFPP_DCD0 | MCFPP_DCD1); | ||
1733 | #endif | ||
1734 | mcfrs_serial_driver = alloc_tty_driver(NR_PORTS); | ||
1735 | if (!mcfrs_serial_driver) | ||
1736 | return -ENOMEM; | ||
1737 | |||
1738 | show_serial_version(); | ||
1739 | |||
1740 | /* Initialize the tty_driver structure */ | ||
1741 | mcfrs_serial_driver->owner = THIS_MODULE; | ||
1742 | mcfrs_serial_driver->name = "ttyS"; | ||
1743 | mcfrs_serial_driver->driver_name = "mcfserial"; | ||
1744 | mcfrs_serial_driver->major = TTY_MAJOR; | ||
1745 | mcfrs_serial_driver->minor_start = 64; | ||
1746 | mcfrs_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; | ||
1747 | mcfrs_serial_driver->subtype = SERIAL_TYPE_NORMAL; | ||
1748 | mcfrs_serial_driver->init_termios = tty_std_termios; | ||
1749 | |||
1750 | mcfrs_serial_driver->init_termios.c_cflag = | ||
1751 | mcfrs_console_cbaud | CS8 | CREAD | HUPCL | CLOCAL; | ||
1752 | mcfrs_serial_driver->flags = TTY_DRIVER_REAL_RAW; | ||
1753 | |||
1754 | tty_set_operations(mcfrs_serial_driver, &mcfrs_ops); | ||
1755 | |||
1756 | if (tty_register_driver(mcfrs_serial_driver)) { | ||
1757 | printk("MCFRS: Couldn't register serial driver\n"); | ||
1758 | put_tty_driver(mcfrs_serial_driver); | ||
1759 | return(-EBUSY); | ||
1760 | } | ||
1761 | |||
1762 | local_irq_save(flags); | ||
1763 | |||
1764 | /* | ||
1765 | * Configure all the attached serial ports. | ||
1766 | */ | ||
1767 | for (i = 0, info = mcfrs_table; (i < NR_PORTS); i++, info++) { | ||
1768 | info->magic = SERIAL_MAGIC; | ||
1769 | info->line = i; | ||
1770 | info->tty = 0; | ||
1771 | info->custom_divisor = 16; | ||
1772 | info->close_delay = 50; | ||
1773 | info->closing_wait = 3000; | ||
1774 | info->x_char = 0; | ||
1775 | info->event = 0; | ||
1776 | info->count = 0; | ||
1777 | info->blocked_open = 0; | ||
1778 | INIT_WORK(&info->tqueue, mcfrs_offintr); | ||
1779 | INIT_WORK(&info->tqueue_hangup, do_serial_hangup); | ||
1780 | init_waitqueue_head(&info->open_wait); | ||
1781 | init_waitqueue_head(&info->close_wait); | ||
1782 | |||
1783 | info->imr = 0; | ||
1784 | mcfrs_setsignals(info, 0, 0); | ||
1785 | mcfrs_irqinit(info); | ||
1786 | |||
1787 | printk("ttyS%d at 0x%04x (irq = %d)", info->line, | ||
1788 | (unsigned int) info->addr, info->irq); | ||
1789 | printk(" is a builtin ColdFire UART\n"); | ||
1790 | } | ||
1791 | |||
1792 | local_irq_restore(flags); | ||
1793 | return 0; | ||
1794 | } | ||
1795 | |||
1796 | module_init(mcfrs_init); | ||
1797 | |||
1798 | /****************************************************************************/ | ||
1799 | /* Serial Console */ | ||
1800 | /****************************************************************************/ | ||
1801 | |||
1802 | /* | ||
1803 | * Quick and dirty UART initialization, for console output. | ||
1804 | */ | ||
1805 | |||
1806 | void mcfrs_init_console(void) | ||
1807 | { | ||
1808 | volatile unsigned char *uartp; | ||
1809 | unsigned int clk; | ||
1810 | |||
1811 | /* | ||
1812 | * Reset UART, get it into known state... | ||
1813 | */ | ||
1814 | uartp = (volatile unsigned char *) (MCF_MBAR + | ||
1815 | (mcfrs_console_port ? MCFUART_BASE2 : MCFUART_BASE1)); | ||
1816 | |||
1817 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX; /* reset RX */ | ||
1818 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */ | ||
1819 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETMRPTR; /* reset MR pointer */ | ||
1820 | |||
1821 | /* | ||
1822 | * Set port for defined baud , 8 data bits, 1 stop bit, no parity. | ||
1823 | */ | ||
1824 | uartp[MCFUART_UMR] = MCFUART_MR1_PARITYNONE | MCFUART_MR1_CS8; | ||
1825 | uartp[MCFUART_UMR] = MCFUART_MR2_STOP1; | ||
1826 | |||
1827 | #ifdef CONFIG_M5272 | ||
1828 | { | ||
1829 | /* | ||
1830 | * For the MCF5272, also compute the baudrate fraction. | ||
1831 | */ | ||
1832 | int fraction = MCF_BUSCLK - (clk * 32 * mcfrs_console_baud); | ||
1833 | fraction *= 16; | ||
1834 | fraction /= (32 * mcfrs_console_baud); | ||
1835 | uartp[MCFUART_UFPD] = (fraction & 0xf); /* set fraction */ | ||
1836 | clk = (MCF_BUSCLK / mcfrs_console_baud) / 32; | ||
1837 | } | ||
1838 | #else | ||
1839 | clk = ((MCF_BUSCLK / mcfrs_console_baud) + 16) / 32; /* set baud */ | ||
1840 | #endif | ||
1841 | |||
1842 | uartp[MCFUART_UBG1] = (clk & 0xff00) >> 8; /* set msb baud */ | ||
1843 | uartp[MCFUART_UBG2] = (clk & 0xff); /* set lsb baud */ | ||
1844 | uartp[MCFUART_UCSR] = MCFUART_UCSR_RXCLKTIMER | MCFUART_UCSR_TXCLKTIMER; | ||
1845 | uartp[MCFUART_UCR] = MCFUART_UCR_RXENABLE | MCFUART_UCR_TXENABLE; | ||
1846 | |||
1847 | mcfrs_console_inited++; | ||
1848 | return; | ||
1849 | } | ||
1850 | |||
1851 | |||
1852 | /* | ||
1853 | * Setup for console. Argument comes from the boot command line. | ||
1854 | */ | ||
1855 | |||
1856 | int mcfrs_console_setup(struct console *cp, char *arg) | ||
1857 | { | ||
1858 | int i, n = CONSOLE_BAUD_RATE; | ||
1859 | |||
1860 | if (!cp) | ||
1861 | return(-1); | ||
1862 | |||
1863 | if (!strncmp(cp->name, "ttyS", 4)) | ||
1864 | mcfrs_console_port = cp->index; | ||
1865 | else if (!strncmp(cp->name, "cua", 3)) | ||
1866 | mcfrs_console_port = cp->index; | ||
1867 | else | ||
1868 | return(-1); | ||
1869 | |||
1870 | if (arg) | ||
1871 | n = simple_strtoul(arg,NULL,0); | ||
1872 | for (i = 0; i < MCFRS_BAUD_TABLE_SIZE; i++) | ||
1873 | if (mcfrs_baud_table[i] == n) | ||
1874 | break; | ||
1875 | if (i < MCFRS_BAUD_TABLE_SIZE) { | ||
1876 | mcfrs_console_baud = n; | ||
1877 | mcfrs_console_cbaud = 0; | ||
1878 | if (i > 15) { | ||
1879 | mcfrs_console_cbaud |= CBAUDEX; | ||
1880 | i -= 15; | ||
1881 | } | ||
1882 | mcfrs_console_cbaud |= i; | ||
1883 | } | ||
1884 | mcfrs_init_console(); /* make sure baud rate changes */ | ||
1885 | return(0); | ||
1886 | } | ||
1887 | |||
1888 | |||
1889 | static struct tty_driver *mcfrs_console_device(struct console *c, int *index) | ||
1890 | { | ||
1891 | *index = c->index; | ||
1892 | return mcfrs_serial_driver; | ||
1893 | } | ||
1894 | |||
1895 | |||
1896 | /* | ||
1897 | * Output a single character, using UART polled mode. | ||
1898 | * This is used for console output. | ||
1899 | */ | ||
1900 | |||
1901 | int mcfrs_put_char(char ch) | ||
1902 | { | ||
1903 | volatile unsigned char *uartp; | ||
1904 | unsigned long flags; | ||
1905 | int i; | ||
1906 | |||
1907 | uartp = (volatile unsigned char *) (MCF_MBAR + | ||
1908 | (mcfrs_console_port ? MCFUART_BASE2 : MCFUART_BASE1)); | ||
1909 | |||
1910 | local_irq_save(flags); | ||
1911 | for (i = 0; (i < 0x10000); i++) { | ||
1912 | if (uartp[MCFUART_USR] & MCFUART_USR_TXREADY) | ||
1913 | break; | ||
1914 | } | ||
1915 | if (i < 0x10000) { | ||
1916 | uartp[MCFUART_UTB] = ch; | ||
1917 | for (i = 0; (i < 0x10000); i++) | ||
1918 | if (uartp[MCFUART_USR] & MCFUART_USR_TXEMPTY) | ||
1919 | break; | ||
1920 | } | ||
1921 | if (i >= 0x10000) | ||
1922 | mcfrs_init_console(); /* try and get it back */ | ||
1923 | local_irq_restore(flags); | ||
1924 | |||
1925 | return 1; | ||
1926 | } | ||
1927 | |||
1928 | |||
1929 | /* | ||
1930 | * rs_console_write is registered for printk output. | ||
1931 | */ | ||
1932 | |||
1933 | void mcfrs_console_write(struct console *cp, const char *p, unsigned len) | ||
1934 | { | ||
1935 | if (!mcfrs_console_inited) | ||
1936 | mcfrs_init_console(); | ||
1937 | while (len-- > 0) { | ||
1938 | if (*p == '\n') | ||
1939 | mcfrs_put_char('\r'); | ||
1940 | mcfrs_put_char(*p++); | ||
1941 | } | ||
1942 | } | ||
1943 | |||
1944 | /* | ||
1945 | * declare our consoles | ||
1946 | */ | ||
1947 | |||
1948 | struct console mcfrs_console = { | ||
1949 | .name = "ttyS", | ||
1950 | .write = mcfrs_console_write, | ||
1951 | .device = mcfrs_console_device, | ||
1952 | .setup = mcfrs_console_setup, | ||
1953 | .flags = CON_PRINTBUFFER, | ||
1954 | .index = -1, | ||
1955 | }; | ||
1956 | |||
1957 | static int __init mcfrs_console_init(void) | ||
1958 | { | ||
1959 | register_console(&mcfrs_console); | ||
1960 | return 0; | ||
1961 | } | ||
1962 | |||
1963 | console_initcall(mcfrs_console_init); | ||
1964 | |||
1965 | /****************************************************************************/ | ||
diff --git a/drivers/serial/mcfserial.h b/drivers/serial/mcfserial.h deleted file mode 100644 index 56420e2cb110..000000000000 --- a/drivers/serial/mcfserial.h +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | /* | ||
2 | * mcfserial.c -- serial driver for ColdFire internal UARTS. | ||
3 | * | ||
4 | * Copyright (c) 1999 Greg Ungerer <gerg@snapgear.com> | ||
5 | * Copyright (c) 2000-2001 Lineo, Inc. <www.lineo.com> | ||
6 | * Copyright (c) 2002 SnapGear Inc., <www.snapgear.com> | ||
7 | * | ||
8 | * Based on code from 68332serial.c which was: | ||
9 | * | ||
10 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
11 | * Copyright (C) 1998 TSHG | ||
12 | * Copyright (c) 1999 Rt-Control Inc. <jeff@uclinux.org> | ||
13 | */ | ||
14 | #ifndef _MCF_SERIAL_H | ||
15 | #define _MCF_SERIAL_H | ||
16 | |||
17 | #include <linux/serial.h> | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | |||
21 | /* | ||
22 | * Define a local serial stats structure. | ||
23 | */ | ||
24 | |||
25 | struct mcf_stats { | ||
26 | unsigned int rx; | ||
27 | unsigned int tx; | ||
28 | unsigned int rxbreak; | ||
29 | unsigned int rxframing; | ||
30 | unsigned int rxparity; | ||
31 | unsigned int rxoverrun; | ||
32 | }; | ||
33 | |||
34 | |||
35 | /* | ||
36 | * This is our internal structure for each serial port's state. | ||
37 | * Each serial port has one of these structures associated with it. | ||
38 | */ | ||
39 | |||
40 | struct mcf_serial { | ||
41 | int magic; | ||
42 | volatile unsigned char *addr; /* UART memory address */ | ||
43 | int irq; | ||
44 | int flags; /* defined in tty.h */ | ||
45 | int type; /* UART type */ | ||
46 | struct tty_struct *tty; | ||
47 | unsigned char imr; /* Software imr register */ | ||
48 | unsigned int baud; | ||
49 | int sigs; | ||
50 | int custom_divisor; | ||
51 | int x_char; /* xon/xoff character */ | ||
52 | int baud_base; | ||
53 | int close_delay; | ||
54 | unsigned short closing_wait; | ||
55 | unsigned short closing_wait2; | ||
56 | unsigned long event; | ||
57 | int line; | ||
58 | int count; /* # of fd on device */ | ||
59 | int blocked_open; /* # of blocked opens */ | ||
60 | unsigned char *xmit_buf; | ||
61 | int xmit_head; | ||
62 | int xmit_tail; | ||
63 | int xmit_cnt; | ||
64 | struct mcf_stats stats; | ||
65 | struct work_struct tqueue; | ||
66 | struct work_struct tqueue_hangup; | ||
67 | wait_queue_head_t open_wait; | ||
68 | wait_queue_head_t close_wait; | ||
69 | |||
70 | }; | ||
71 | |||
72 | #endif /* __KERNEL__ */ | ||
73 | |||
74 | #endif /* _MCF_SERIAL_H */ | ||
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index efc971d9647b..6117d3db0b66 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -72,13 +72,8 @@ | |||
72 | #include <linux/console.h> | 72 | #include <linux/console.h> |
73 | #include <linux/delay.h> | 73 | #include <linux/delay.h> |
74 | #include <linux/io.h> | 74 | #include <linux/io.h> |
75 | |||
76 | #if defined(CONFIG_PPC_MERGE) | ||
77 | #include <linux/of.h> | 75 | #include <linux/of.h> |
78 | #include <linux/of_platform.h> | 76 | #include <linux/of_platform.h> |
79 | #else | ||
80 | #include <linux/platform_device.h> | ||
81 | #endif | ||
82 | 77 | ||
83 | #include <asm/mpc52xx.h> | 78 | #include <asm/mpc52xx.h> |
84 | #include <asm/mpc512x.h> | 79 | #include <asm/mpc512x.h> |
@@ -107,12 +102,11 @@ static struct uart_port mpc52xx_uart_ports[MPC52xx_PSC_MAXNUM]; | |||
107 | * it's cleared, then a memset(...,0,...) should be added to | 102 | * it's cleared, then a memset(...,0,...) should be added to |
108 | * the console_init | 103 | * the console_init |
109 | */ | 104 | */ |
110 | #if defined(CONFIG_PPC_MERGE) | 105 | |
111 | /* lookup table for matching device nodes to index numbers */ | 106 | /* lookup table for matching device nodes to index numbers */ |
112 | static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM]; | 107 | static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM]; |
113 | 108 | ||
114 | static void mpc52xx_uart_of_enumerate(void); | 109 | static void mpc52xx_uart_of_enumerate(void); |
115 | #endif | ||
116 | 110 | ||
117 | 111 | ||
118 | #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase)) | 112 | #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase)) |
@@ -255,17 +249,12 @@ static void mpc52xx_psc_cw_restore_ints(struct uart_port *port) | |||
255 | /* Search for bus-frequency property in this node or a parent */ | 249 | /* Search for bus-frequency property in this node or a parent */ |
256 | static unsigned long mpc52xx_getuartclk(void *p) | 250 | static unsigned long mpc52xx_getuartclk(void *p) |
257 | { | 251 | { |
258 | #if defined(CONFIG_PPC_MERGE) | ||
259 | /* | 252 | /* |
260 | * 5200 UARTs have a / 32 prescaler | 253 | * 5200 UARTs have a / 32 prescaler |
261 | * but the generic serial code assumes 16 | 254 | * but the generic serial code assumes 16 |
262 | * so return ipb freq / 2 | 255 | * so return ipb freq / 2 |
263 | */ | 256 | */ |
264 | return mpc52xx_find_ipb_freq(p) / 2; | 257 | return mpc52xx_find_ipb_freq(p) / 2; |
265 | #else | ||
266 | pr_debug("unexpected call to mpc52xx_getuartclk with arch/ppc\n"); | ||
267 | return NULL; | ||
268 | #endif | ||
269 | } | 258 | } |
270 | 259 | ||
271 | static struct psc_ops mpc52xx_psc_ops = { | 260 | static struct psc_ops mpc52xx_psc_ops = { |
@@ -732,7 +721,7 @@ static struct uart_ops mpc52xx_uart_ops = { | |||
732 | static inline int | 721 | static inline int |
733 | mpc52xx_uart_int_rx_chars(struct uart_port *port) | 722 | mpc52xx_uart_int_rx_chars(struct uart_port *port) |
734 | { | 723 | { |
735 | struct tty_struct *tty = port->info->tty; | 724 | struct tty_struct *tty = port->info->port.tty; |
736 | unsigned char ch, flag; | 725 | unsigned char ch, flag; |
737 | unsigned short status; | 726 | unsigned short status; |
738 | 727 | ||
@@ -886,10 +875,6 @@ mpc52xx_console_get_options(struct uart_port *port, | |||
886 | 875 | ||
887 | /* CT{U,L}R are write-only ! */ | 876 | /* CT{U,L}R are write-only ! */ |
888 | *baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; | 877 | *baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; |
889 | #if !defined(CONFIG_PPC_MERGE) | ||
890 | if (__res.bi_baudrate) | ||
891 | *baud = __res.bi_baudrate; | ||
892 | #endif | ||
893 | 878 | ||
894 | /* Parse them */ | 879 | /* Parse them */ |
895 | switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) { | 880 | switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) { |
@@ -946,42 +931,6 @@ mpc52xx_console_write(struct console *co, const char *s, unsigned int count) | |||
946 | psc_ops->cw_restore_ints(port); | 931 | psc_ops->cw_restore_ints(port); |
947 | } | 932 | } |
948 | 933 | ||
949 | #if !defined(CONFIG_PPC_MERGE) | ||
950 | static int __init | ||
951 | mpc52xx_console_setup(struct console *co, char *options) | ||
952 | { | ||
953 | struct uart_port *port = &mpc52xx_uart_ports[co->index]; | ||
954 | |||
955 | int baud = CONFIG_SERIAL_MPC52xx_CONSOLE_BAUD; | ||
956 | int bits = 8; | ||
957 | int parity = 'n'; | ||
958 | int flow = 'n'; | ||
959 | |||
960 | if (co->index < 0 || co->index >= MPC52xx_PSC_MAXNUM) | ||
961 | return -EINVAL; | ||
962 | |||
963 | /* Basic port init. Needed since we use some uart_??? func before | ||
964 | * real init for early access */ | ||
965 | spin_lock_init(&port->lock); | ||
966 | port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ | ||
967 | port->ops = &mpc52xx_uart_ops; | ||
968 | port->mapbase = MPC52xx_PA(MPC52xx_PSCx_OFFSET(co->index+1)); | ||
969 | |||
970 | /* We ioremap ourself */ | ||
971 | port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE); | ||
972 | if (port->membase == NULL) | ||
973 | return -EINVAL; | ||
974 | |||
975 | /* Setup the port parameters accoding to options */ | ||
976 | if (options) | ||
977 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
978 | else | ||
979 | mpc52xx_console_get_options(port, &baud, &parity, &bits, &flow); | ||
980 | |||
981 | return uart_set_options(port, co, baud, parity, bits, flow); | ||
982 | } | ||
983 | |||
984 | #else | ||
985 | 934 | ||
986 | static int __init | 935 | static int __init |
987 | mpc52xx_console_setup(struct console *co, char *options) | 936 | mpc52xx_console_setup(struct console *co, char *options) |
@@ -1053,7 +1002,6 @@ mpc52xx_console_setup(struct console *co, char *options) | |||
1053 | 1002 | ||
1054 | return uart_set_options(port, co, baud, parity, bits, flow); | 1003 | return uart_set_options(port, co, baud, parity, bits, flow); |
1055 | } | 1004 | } |
1056 | #endif /* defined(CONFIG_PPC_MERGE) */ | ||
1057 | 1005 | ||
1058 | 1006 | ||
1059 | static struct uart_driver mpc52xx_uart_driver; | 1007 | static struct uart_driver mpc52xx_uart_driver; |
@@ -1072,9 +1020,7 @@ static struct console mpc52xx_console = { | |||
1072 | static int __init | 1020 | static int __init |
1073 | mpc52xx_console_init(void) | 1021 | mpc52xx_console_init(void) |
1074 | { | 1022 | { |
1075 | #if defined(CONFIG_PPC_MERGE) | ||
1076 | mpc52xx_uart_of_enumerate(); | 1023 | mpc52xx_uart_of_enumerate(); |
1077 | #endif | ||
1078 | register_console(&mpc52xx_console); | 1024 | register_console(&mpc52xx_console); |
1079 | return 0; | 1025 | return 0; |
1080 | } | 1026 | } |
@@ -1100,115 +1046,6 @@ static struct uart_driver mpc52xx_uart_driver = { | |||
1100 | .cons = MPC52xx_PSC_CONSOLE, | 1046 | .cons = MPC52xx_PSC_CONSOLE, |
1101 | }; | 1047 | }; |
1102 | 1048 | ||
1103 | |||
1104 | #if !defined(CONFIG_PPC_MERGE) | ||
1105 | /* ======================================================================== */ | ||
1106 | /* Platform Driver */ | ||
1107 | /* ======================================================================== */ | ||
1108 | |||
1109 | static int __devinit | ||
1110 | mpc52xx_uart_probe(struct platform_device *dev) | ||
1111 | { | ||
1112 | struct resource *res = dev->resource; | ||
1113 | |||
1114 | struct uart_port *port = NULL; | ||
1115 | int i, idx, ret; | ||
1116 | |||
1117 | /* Check validity & presence */ | ||
1118 | idx = dev->id; | ||
1119 | if (idx < 0 || idx >= MPC52xx_PSC_MAXNUM) | ||
1120 | return -EINVAL; | ||
1121 | |||
1122 | if (!mpc52xx_match_psc_function(idx, "uart")) | ||
1123 | return -ENODEV; | ||
1124 | |||
1125 | /* Init the port structure */ | ||
1126 | port = &mpc52xx_uart_ports[idx]; | ||
1127 | |||
1128 | spin_lock_init(&port->lock); | ||
1129 | port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ | ||
1130 | port->fifosize = 512; | ||
1131 | port->iotype = UPIO_MEM; | ||
1132 | port->flags = UPF_BOOT_AUTOCONF | | ||
1133 | (uart_console(port) ? 0 : UPF_IOREMAP); | ||
1134 | port->line = idx; | ||
1135 | port->ops = &mpc52xx_uart_ops; | ||
1136 | port->dev = &dev->dev; | ||
1137 | |||
1138 | /* Search for IRQ and mapbase */ | ||
1139 | for (i = 0 ; i < dev->num_resources ; i++, res++) { | ||
1140 | if (res->flags & IORESOURCE_MEM) | ||
1141 | port->mapbase = res->start; | ||
1142 | else if (res->flags & IORESOURCE_IRQ) | ||
1143 | port->irq = res->start; | ||
1144 | } | ||
1145 | if (!port->irq || !port->mapbase) | ||
1146 | return -EINVAL; | ||
1147 | |||
1148 | /* Add the port to the uart sub-system */ | ||
1149 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); | ||
1150 | if (!ret) | ||
1151 | platform_set_drvdata(dev, (void *)port); | ||
1152 | |||
1153 | return ret; | ||
1154 | } | ||
1155 | |||
1156 | static int | ||
1157 | mpc52xx_uart_remove(struct platform_device *dev) | ||
1158 | { | ||
1159 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); | ||
1160 | |||
1161 | platform_set_drvdata(dev, NULL); | ||
1162 | |||
1163 | if (port) | ||
1164 | uart_remove_one_port(&mpc52xx_uart_driver, port); | ||
1165 | |||
1166 | return 0; | ||
1167 | } | ||
1168 | |||
1169 | #ifdef CONFIG_PM | ||
1170 | static int | ||
1171 | mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) | ||
1172 | { | ||
1173 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); | ||
1174 | |||
1175 | if (port) | ||
1176 | uart_suspend_port(&mpc52xx_uart_driver, port); | ||
1177 | |||
1178 | return 0; | ||
1179 | } | ||
1180 | |||
1181 | static int | ||
1182 | mpc52xx_uart_resume(struct platform_device *dev) | ||
1183 | { | ||
1184 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); | ||
1185 | |||
1186 | if (port) | ||
1187 | uart_resume_port(&mpc52xx_uart_driver, port); | ||
1188 | |||
1189 | return 0; | ||
1190 | } | ||
1191 | #endif | ||
1192 | |||
1193 | /* work with hotplug and coldplug */ | ||
1194 | MODULE_ALIAS("platform:mpc52xx-psc"); | ||
1195 | |||
1196 | static struct platform_driver mpc52xx_uart_platform_driver = { | ||
1197 | .probe = mpc52xx_uart_probe, | ||
1198 | .remove = mpc52xx_uart_remove, | ||
1199 | #ifdef CONFIG_PM | ||
1200 | .suspend = mpc52xx_uart_suspend, | ||
1201 | .resume = mpc52xx_uart_resume, | ||
1202 | #endif | ||
1203 | .driver = { | ||
1204 | .owner = THIS_MODULE, | ||
1205 | .name = "mpc52xx-psc", | ||
1206 | }, | ||
1207 | }; | ||
1208 | #endif /* !defined(CONFIG_PPC_MERGE) */ | ||
1209 | |||
1210 | |||
1211 | #if defined(CONFIG_PPC_MERGE) | ||
1212 | /* ======================================================================== */ | 1049 | /* ======================================================================== */ |
1213 | /* OF Platform Driver */ | 1050 | /* OF Platform Driver */ |
1214 | /* ======================================================================== */ | 1051 | /* ======================================================================== */ |
@@ -1402,7 +1239,6 @@ static struct of_platform_driver mpc52xx_uart_of_driver = { | |||
1402 | .name = "mpc52xx-psc-uart", | 1239 | .name = "mpc52xx-psc-uart", |
1403 | }, | 1240 | }, |
1404 | }; | 1241 | }; |
1405 | #endif /* defined(CONFIG_PPC_MERGE) */ | ||
1406 | 1242 | ||
1407 | 1243 | ||
1408 | /* ======================================================================== */ | 1244 | /* ======================================================================== */ |
@@ -1423,7 +1259,6 @@ mpc52xx_uart_init(void) | |||
1423 | return ret; | 1259 | return ret; |
1424 | } | 1260 | } |
1425 | 1261 | ||
1426 | #if defined(CONFIG_PPC_MERGE) | ||
1427 | mpc52xx_uart_of_enumerate(); | 1262 | mpc52xx_uart_of_enumerate(); |
1428 | 1263 | ||
1429 | ret = of_register_platform_driver(&mpc52xx_uart_of_driver); | 1264 | ret = of_register_platform_driver(&mpc52xx_uart_of_driver); |
@@ -1433,16 +1268,6 @@ mpc52xx_uart_init(void) | |||
1433 | uart_unregister_driver(&mpc52xx_uart_driver); | 1268 | uart_unregister_driver(&mpc52xx_uart_driver); |
1434 | return ret; | 1269 | return ret; |
1435 | } | 1270 | } |
1436 | #else | ||
1437 | psc_ops = &mpc52xx_psc_ops; | ||
1438 | ret = platform_driver_register(&mpc52xx_uart_platform_driver); | ||
1439 | if (ret) { | ||
1440 | printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", | ||
1441 | __FILE__, ret); | ||
1442 | uart_unregister_driver(&mpc52xx_uart_driver); | ||
1443 | return ret; | ||
1444 | } | ||
1445 | #endif | ||
1446 | 1271 | ||
1447 | return 0; | 1272 | return 0; |
1448 | } | 1273 | } |
@@ -1450,11 +1275,7 @@ mpc52xx_uart_init(void) | |||
1450 | static void __exit | 1275 | static void __exit |
1451 | mpc52xx_uart_exit(void) | 1276 | mpc52xx_uart_exit(void) |
1452 | { | 1277 | { |
1453 | #if defined(CONFIG_PPC_MERGE) | ||
1454 | of_unregister_platform_driver(&mpc52xx_uart_of_driver); | 1278 | of_unregister_platform_driver(&mpc52xx_uart_of_driver); |
1455 | #else | ||
1456 | platform_driver_unregister(&mpc52xx_uart_platform_driver); | ||
1457 | #endif | ||
1458 | uart_unregister_driver(&mpc52xx_uart_driver); | 1279 | uart_unregister_driver(&mpc52xx_uart_driver); |
1459 | } | 1280 | } |
1460 | 1281 | ||
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index e8819c43f57d..61d3ade5286c 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -921,6 +921,10 @@ static int mpsc_make_ready(struct mpsc_port_info *pi) | |||
921 | return 0; | 921 | return 0; |
922 | } | 922 | } |
923 | 923 | ||
924 | #ifdef CONFIG_CONSOLE_POLL | ||
925 | static int serial_polled; | ||
926 | #endif | ||
927 | |||
924 | /* | 928 | /* |
925 | ****************************************************************************** | 929 | ****************************************************************************** |
926 | * | 930 | * |
@@ -932,7 +936,7 @@ static int mpsc_make_ready(struct mpsc_port_info *pi) | |||
932 | static int mpsc_rx_intr(struct mpsc_port_info *pi) | 936 | static int mpsc_rx_intr(struct mpsc_port_info *pi) |
933 | { | 937 | { |
934 | struct mpsc_rx_desc *rxre; | 938 | struct mpsc_rx_desc *rxre; |
935 | struct tty_struct *tty = pi->port.info->tty; | 939 | struct tty_struct *tty = pi->port.info->port.tty; |
936 | u32 cmdstat, bytes_in, i; | 940 | u32 cmdstat, bytes_in, i; |
937 | int rc = 0; | 941 | int rc = 0; |
938 | u8 *bp; | 942 | u8 *bp; |
@@ -956,7 +960,12 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi) | |||
956 | while (!((cmdstat = be32_to_cpu(rxre->cmdstat)) | 960 | while (!((cmdstat = be32_to_cpu(rxre->cmdstat)) |
957 | & SDMA_DESC_CMDSTAT_O)) { | 961 | & SDMA_DESC_CMDSTAT_O)) { |
958 | bytes_in = be16_to_cpu(rxre->bytecnt); | 962 | bytes_in = be16_to_cpu(rxre->bytecnt); |
959 | 963 | #ifdef CONFIG_CONSOLE_POLL | |
964 | if (unlikely(serial_polled)) { | ||
965 | serial_polled = 0; | ||
966 | return 0; | ||
967 | } | ||
968 | #endif | ||
960 | /* Following use of tty struct directly is deprecated */ | 969 | /* Following use of tty struct directly is deprecated */ |
961 | if (unlikely(tty_buffer_request_room(tty, bytes_in) | 970 | if (unlikely(tty_buffer_request_room(tty, bytes_in) |
962 | < bytes_in)) { | 971 | < bytes_in)) { |
@@ -1017,6 +1026,12 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi) | |||
1017 | if (uart_handle_sysrq_char(&pi->port, *bp)) { | 1026 | if (uart_handle_sysrq_char(&pi->port, *bp)) { |
1018 | bp++; | 1027 | bp++; |
1019 | bytes_in--; | 1028 | bytes_in--; |
1029 | #ifdef CONFIG_CONSOLE_POLL | ||
1030 | if (unlikely(serial_polled)) { | ||
1031 | serial_polled = 0; | ||
1032 | return 0; | ||
1033 | } | ||
1034 | #endif | ||
1020 | goto next_frame; | 1035 | goto next_frame; |
1021 | } | 1036 | } |
1022 | 1037 | ||
@@ -1519,6 +1534,133 @@ static int mpsc_verify_port(struct uart_port *port, struct serial_struct *ser) | |||
1519 | 1534 | ||
1520 | return rc; | 1535 | return rc; |
1521 | } | 1536 | } |
1537 | #ifdef CONFIG_CONSOLE_POLL | ||
1538 | /* Serial polling routines for writing and reading from the uart while | ||
1539 | * in an interrupt or debug context. | ||
1540 | */ | ||
1541 | |||
1542 | static char poll_buf[2048]; | ||
1543 | static int poll_ptr; | ||
1544 | static int poll_cnt; | ||
1545 | static void mpsc_put_poll_char(struct uart_port *port, | ||
1546 | unsigned char c); | ||
1547 | |||
1548 | static int mpsc_get_poll_char(struct uart_port *port) | ||
1549 | { | ||
1550 | struct mpsc_port_info *pi = (struct mpsc_port_info *)port; | ||
1551 | struct mpsc_rx_desc *rxre; | ||
1552 | u32 cmdstat, bytes_in, i; | ||
1553 | u8 *bp; | ||
1554 | |||
1555 | if (!serial_polled) | ||
1556 | serial_polled = 1; | ||
1557 | |||
1558 | pr_debug("mpsc_rx_intr[%d]: Handling Rx intr\n", pi->port.line); | ||
1559 | |||
1560 | if (poll_cnt) { | ||
1561 | poll_cnt--; | ||
1562 | return poll_buf[poll_ptr++]; | ||
1563 | } | ||
1564 | poll_ptr = 0; | ||
1565 | poll_cnt = 0; | ||
1566 | |||
1567 | while (poll_cnt == 0) { | ||
1568 | rxre = (struct mpsc_rx_desc *)(pi->rxr + | ||
1569 | (pi->rxr_posn*MPSC_RXRE_SIZE)); | ||
1570 | dma_cache_sync(pi->port.dev, (void *)rxre, | ||
1571 | MPSC_RXRE_SIZE, DMA_FROM_DEVICE); | ||
1572 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | ||
1573 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | ||
1574 | invalidate_dcache_range((ulong)rxre, | ||
1575 | (ulong)rxre + MPSC_RXRE_SIZE); | ||
1576 | #endif | ||
1577 | /* | ||
1578 | * Loop through Rx descriptors handling ones that have | ||
1579 | * been completed. | ||
1580 | */ | ||
1581 | while (poll_cnt == 0 && | ||
1582 | !((cmdstat = be32_to_cpu(rxre->cmdstat)) & | ||
1583 | SDMA_DESC_CMDSTAT_O)){ | ||
1584 | bytes_in = be16_to_cpu(rxre->bytecnt); | ||
1585 | bp = pi->rxb + (pi->rxr_posn * MPSC_RXBE_SIZE); | ||
1586 | dma_cache_sync(pi->port.dev, (void *) bp, | ||
1587 | MPSC_RXBE_SIZE, DMA_FROM_DEVICE); | ||
1588 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | ||
1589 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | ||
1590 | invalidate_dcache_range((ulong)bp, | ||
1591 | (ulong)bp + MPSC_RXBE_SIZE); | ||
1592 | #endif | ||
1593 | if ((unlikely(cmdstat & (SDMA_DESC_CMDSTAT_BR | | ||
1594 | SDMA_DESC_CMDSTAT_FR | SDMA_DESC_CMDSTAT_OR))) && | ||
1595 | !(cmdstat & pi->port.ignore_status_mask)) { | ||
1596 | poll_buf[poll_cnt] = *bp; | ||
1597 | poll_cnt++; | ||
1598 | } else { | ||
1599 | for (i = 0; i < bytes_in; i++) { | ||
1600 | poll_buf[poll_cnt] = *bp++; | ||
1601 | poll_cnt++; | ||
1602 | } | ||
1603 | pi->port.icount.rx += bytes_in; | ||
1604 | } | ||
1605 | rxre->bytecnt = cpu_to_be16(0); | ||
1606 | wmb(); | ||
1607 | rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O | | ||
1608 | SDMA_DESC_CMDSTAT_EI | | ||
1609 | SDMA_DESC_CMDSTAT_F | | ||
1610 | SDMA_DESC_CMDSTAT_L); | ||
1611 | wmb(); | ||
1612 | dma_cache_sync(pi->port.dev, (void *)rxre, | ||
1613 | MPSC_RXRE_SIZE, DMA_BIDIRECTIONAL); | ||
1614 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | ||
1615 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | ||
1616 | flush_dcache_range((ulong)rxre, | ||
1617 | (ulong)rxre + MPSC_RXRE_SIZE); | ||
1618 | #endif | ||
1619 | |||
1620 | /* Advance to next descriptor */ | ||
1621 | pi->rxr_posn = (pi->rxr_posn + 1) & | ||
1622 | (MPSC_RXR_ENTRIES - 1); | ||
1623 | rxre = (struct mpsc_rx_desc *)(pi->rxr + | ||
1624 | (pi->rxr_posn * MPSC_RXRE_SIZE)); | ||
1625 | dma_cache_sync(pi->port.dev, (void *)rxre, | ||
1626 | MPSC_RXRE_SIZE, DMA_FROM_DEVICE); | ||
1627 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | ||
1628 | if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */ | ||
1629 | invalidate_dcache_range((ulong)rxre, | ||
1630 | (ulong)rxre + MPSC_RXRE_SIZE); | ||
1631 | #endif | ||
1632 | } | ||
1633 | |||
1634 | /* Restart rx engine, if its stopped */ | ||
1635 | if ((readl(pi->sdma_base + SDMA_SDCM) & SDMA_SDCM_ERD) == 0) | ||
1636 | mpsc_start_rx(pi); | ||
1637 | } | ||
1638 | if (poll_cnt) { | ||
1639 | poll_cnt--; | ||
1640 | return poll_buf[poll_ptr++]; | ||
1641 | } | ||
1642 | |||
1643 | return 0; | ||
1644 | } | ||
1645 | |||
1646 | |||
1647 | static void mpsc_put_poll_char(struct uart_port *port, | ||
1648 | unsigned char c) | ||
1649 | { | ||
1650 | struct mpsc_port_info *pi = (struct mpsc_port_info *)port; | ||
1651 | u32 data; | ||
1652 | |||
1653 | data = readl(pi->mpsc_base + MPSC_MPCR); | ||
1654 | writeb(c, pi->mpsc_base + MPSC_CHR_1); | ||
1655 | mb(); | ||
1656 | data = readl(pi->mpsc_base + MPSC_CHR_2); | ||
1657 | data |= MPSC_CHR_2_TTCS; | ||
1658 | writel(data, pi->mpsc_base + MPSC_CHR_2); | ||
1659 | mb(); | ||
1660 | |||
1661 | while (readl(pi->mpsc_base + MPSC_CHR_2) & MPSC_CHR_2_TTCS); | ||
1662 | } | ||
1663 | #endif | ||
1522 | 1664 | ||
1523 | static struct uart_ops mpsc_pops = { | 1665 | static struct uart_ops mpsc_pops = { |
1524 | .tx_empty = mpsc_tx_empty, | 1666 | .tx_empty = mpsc_tx_empty, |
@@ -1537,6 +1679,10 @@ static struct uart_ops mpsc_pops = { | |||
1537 | .request_port = mpsc_request_port, | 1679 | .request_port = mpsc_request_port, |
1538 | .config_port = mpsc_config_port, | 1680 | .config_port = mpsc_config_port, |
1539 | .verify_port = mpsc_verify_port, | 1681 | .verify_port = mpsc_verify_port, |
1682 | #ifdef CONFIG_CONSOLE_POLL | ||
1683 | .poll_get_char = mpsc_get_poll_char, | ||
1684 | .poll_put_char = mpsc_put_poll_char, | ||
1685 | #endif | ||
1540 | }; | 1686 | }; |
1541 | 1687 | ||
1542 | /* | 1688 | /* |
@@ -1972,7 +2118,7 @@ static int __init mpsc_drv_init(void) | |||
1972 | { | 2118 | { |
1973 | int rc; | 2119 | int rc; |
1974 | 2120 | ||
1975 | printk(KERN_INFO "Serial: MPSC driver $Revision: 1.00 $\n"); | 2121 | printk(KERN_INFO "Serial: MPSC driver\n"); |
1976 | 2122 | ||
1977 | memset(mpsc_ports, 0, sizeof(mpsc_ports)); | 2123 | memset(mpsc_ports, 0, sizeof(mpsc_ports)); |
1978 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); | 2124 | memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); |
@@ -2004,7 +2150,7 @@ module_init(mpsc_drv_init); | |||
2004 | module_exit(mpsc_drv_exit); | 2150 | module_exit(mpsc_drv_exit); |
2005 | 2151 | ||
2006 | MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>"); | 2152 | MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>"); |
2007 | MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver $Revision: 1.00 $"); | 2153 | MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver"); |
2008 | MODULE_VERSION(MPSC_VERSION); | 2154 | MODULE_VERSION(MPSC_VERSION); |
2009 | MODULE_LICENSE("GPL"); | 2155 | MODULE_LICENSE("GPL"); |
2010 | MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR); | 2156 | MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR); |
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index e94031731a47..953a5ffa9b44 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c | |||
@@ -243,7 +243,7 @@ static void mux_write(struct uart_port *port) | |||
243 | static void mux_read(struct uart_port *port) | 243 | static void mux_read(struct uart_port *port) |
244 | { | 244 | { |
245 | int data; | 245 | int data; |
246 | struct tty_struct *tty = port->info->tty; | 246 | struct tty_struct *tty = port->info->port.tty; |
247 | __u32 start_count = port->icount.rx; | 247 | __u32 start_count = port->icount.rx; |
248 | 248 | ||
249 | while(1) { | 249 | while(1) { |
diff --git a/drivers/serial/netx-serial.c b/drivers/serial/netx-serial.c index 81ac9bb4f39b..3f489329e8d3 100644 --- a/drivers/serial/netx-serial.c +++ b/drivers/serial/netx-serial.c | |||
@@ -35,8 +35,8 @@ | |||
35 | 35 | ||
36 | #include <asm/io.h> | 36 | #include <asm/io.h> |
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/hardware.h> | 38 | #include <mach/hardware.h> |
39 | #include <asm/arch/netx-regs.h> | 39 | #include <mach/netx-regs.h> |
40 | 40 | ||
41 | /* We've been assigned a range on the "Low-density serial ports" major */ | 41 | /* We've been assigned a range on the "Low-density serial ports" major */ |
42 | #define SERIAL_NX_MAJOR 204 | 42 | #define SERIAL_NX_MAJOR 204 |
@@ -203,7 +203,7 @@ static void netx_txint(struct uart_port *port) | |||
203 | static void netx_rxint(struct uart_port *port) | 203 | static void netx_rxint(struct uart_port *port) |
204 | { | 204 | { |
205 | unsigned char rx, flg, status; | 205 | unsigned char rx, flg, status; |
206 | struct tty_struct *tty = port->info->tty; | 206 | struct tty_struct *tty = port->info->port.tty; |
207 | 207 | ||
208 | while (!(readl(port->membase + UART_FR) & FR_RXFE)) { | 208 | while (!(readl(port->membase + UART_FR) & FR_RXFE)) { |
209 | rx = readl(port->membase + UART_DR); | 209 | rx = readl(port->membase + UART_DR); |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index 794bd0f50d73..317b061f7641 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -242,12 +242,12 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) | |||
242 | } | 242 | } |
243 | 243 | ||
244 | /* Sanity check, make sure the old bug is no longer happening */ | 244 | /* Sanity check, make sure the old bug is no longer happening */ |
245 | if (uap->port.info == NULL || uap->port.info->tty == NULL) { | 245 | if (uap->port.info == NULL || uap->port.info->port.tty == NULL) { |
246 | WARN_ON(1); | 246 | WARN_ON(1); |
247 | (void)read_zsdata(uap); | 247 | (void)read_zsdata(uap); |
248 | return NULL; | 248 | return NULL; |
249 | } | 249 | } |
250 | tty = uap->port.info->tty; | 250 | tty = uap->port.info->port.tty; |
251 | 251 | ||
252 | while (1) { | 252 | while (1) { |
253 | error = 0; | 253 | error = 0; |
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c index d0e5a79ea635..22e30d21225e 100644 --- a/drivers/serial/pnx8xxx_uart.c +++ b/drivers/serial/pnx8xxx_uart.c | |||
@@ -181,7 +181,7 @@ static void pnx8xxx_enable_ms(struct uart_port *port) | |||
181 | 181 | ||
182 | static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) | 182 | static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) |
183 | { | 183 | { |
184 | struct tty_struct *tty = sport->port.info->tty; | 184 | struct tty_struct *tty = sport->port.info->port.tty; |
185 | unsigned int status, ch, flg; | 185 | unsigned int status, ch, flg; |
186 | 186 | ||
187 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | | 187 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | |
@@ -824,7 +824,7 @@ static int __init pnx8xxx_serial_init(void) | |||
824 | { | 824 | { |
825 | int ret; | 825 | int ret; |
826 | 826 | ||
827 | printk(KERN_INFO "Serial: PNX8XXX driver $Revision: 1.2 $\n"); | 827 | printk(KERN_INFO "Serial: PNX8XXX driver\n"); |
828 | 828 | ||
829 | pnx8xxx_init_ports(); | 829 | pnx8xxx_init_ports(); |
830 | 830 | ||
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index b4f7ffb7688d..abc00be55433 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -45,9 +45,9 @@ | |||
45 | #include <linux/clk.h> | 45 | #include <linux/clk.h> |
46 | 46 | ||
47 | #include <asm/io.h> | 47 | #include <asm/io.h> |
48 | #include <asm/hardware.h> | 48 | #include <mach/hardware.h> |
49 | #include <asm/irq.h> | 49 | #include <asm/irq.h> |
50 | #include <asm/arch/pxa-regs.h> | 50 | #include <mach/pxa-regs.h> |
51 | 51 | ||
52 | 52 | ||
53 | struct uart_pxa_port { | 53 | struct uart_pxa_port { |
@@ -101,7 +101,7 @@ static void serial_pxa_stop_rx(struct uart_port *port) | |||
101 | 101 | ||
102 | static inline void receive_chars(struct uart_pxa_port *up, int *status) | 102 | static inline void receive_chars(struct uart_pxa_port *up, int *status) |
103 | { | 103 | { |
104 | struct tty_struct *tty = up->port.info->tty; | 104 | struct tty_struct *tty = up->port.info->port.tty; |
105 | unsigned int ch, flag; | 105 | unsigned int ch, flag; |
106 | int max_count = 256; | 106 | int max_count = 256; |
107 | 107 | ||
@@ -534,6 +534,11 @@ serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios, | |||
534 | 534 | ||
535 | serial_out(up, UART_IER, up->ier); | 535 | serial_out(up, UART_IER, up->ier); |
536 | 536 | ||
537 | if (termios->c_cflag & CRTSCTS) | ||
538 | up->mcr |= UART_MCR_AFE; | ||
539 | else | ||
540 | up->mcr &= ~UART_MCR_AFE; | ||
541 | |||
537 | serial_out(up, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */ | 542 | serial_out(up, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */ |
538 | serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */ | 543 | serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */ |
539 | serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */ | 544 | serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */ |
diff --git a/drivers/serial/s3c2400.c b/drivers/serial/s3c2400.c index a1102053e553..4873f2978bd2 100644 --- a/drivers/serial/s3c2400.c +++ b/drivers/serial/s3c2400.c | |||
@@ -17,10 +17,10 @@ | |||
17 | 17 | ||
18 | #include <asm/irq.h> | 18 | #include <asm/irq.h> |
19 | 19 | ||
20 | #include <asm/hardware.h> | 20 | #include <mach/hardware.h> |
21 | 21 | ||
22 | #include <asm/plat-s3c/regs-serial.h> | 22 | #include <plat/regs-serial.h> |
23 | #include <asm/arch/regs-gpio.h> | 23 | #include <mach/regs-gpio.h> |
24 | 24 | ||
25 | #include "samsung.h" | 25 | #include "samsung.h" |
26 | 26 | ||
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index c5f03f41686f..87c182ef71b8 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/serial.h> | 19 | #include <linux/serial.h> |
20 | 20 | ||
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | #include <asm/hardware.h> | 22 | #include <mach/hardware.h> |
23 | 23 | ||
24 | #include <asm/plat-s3c/regs-serial.h> | 24 | #include <plat/regs-serial.h> |
25 | #include <asm/arch/regs-gpio.h> | 25 | #include <mach/regs-gpio.h> |
26 | 26 | ||
27 | #include "samsung.h" | 27 | #include "samsung.h" |
28 | 28 | ||
diff --git a/drivers/serial/s3c2412.c b/drivers/serial/s3c2412.c index ce0c220e3e92..fd017b375568 100644 --- a/drivers/serial/s3c2412.c +++ b/drivers/serial/s3c2412.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/serial.h> | 19 | #include <linux/serial.h> |
20 | 20 | ||
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | #include <asm/hardware.h> | 22 | #include <mach/hardware.h> |
23 | 23 | ||
24 | #include <asm/plat-s3c/regs-serial.h> | 24 | #include <plat/regs-serial.h> |
25 | #include <asm/arch/regs-gpio.h> | 25 | #include <mach/regs-gpio.h> |
26 | 26 | ||
27 | #include "samsung.h" | 27 | #include "samsung.h" |
28 | 28 | ||
diff --git a/drivers/serial/s3c2440.c b/drivers/serial/s3c2440.c index 38f954bd39c6..317d239ab740 100644 --- a/drivers/serial/s3c2440.c +++ b/drivers/serial/s3c2440.c | |||
@@ -19,10 +19,10 @@ | |||
19 | #include <linux/serial.h> | 19 | #include <linux/serial.h> |
20 | 20 | ||
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | #include <asm/hardware.h> | 22 | #include <mach/hardware.h> |
23 | 23 | ||
24 | #include <asm/plat-s3c/regs-serial.h> | 24 | #include <plat/regs-serial.h> |
25 | #include <asm/arch/regs-gpio.h> | 25 | #include <mach/regs-gpio.h> |
26 | 26 | ||
27 | #include "samsung.h" | 27 | #include "samsung.h" |
28 | 28 | ||
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 62b38582f5e9..b24a25ea6bc5 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -20,9 +20,6 @@ | |||
20 | * You should have received a copy of the GNU General Public License | 20 | * You should have received a copy of the GNU General Public License |
21 | * along with this program; if not, write to the Free Software | 21 | * along with this program; if not, write to the Free Software |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 | * | ||
24 | * $Id: sa1100.c,v 1.50 2002/07/29 14:41:04 rmk Exp $ | ||
25 | * | ||
26 | */ | 23 | */ |
27 | 24 | ||
28 | #if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 25 | #if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
@@ -42,7 +39,7 @@ | |||
42 | 39 | ||
43 | #include <asm/io.h> | 40 | #include <asm/io.h> |
44 | #include <asm/irq.h> | 41 | #include <asm/irq.h> |
45 | #include <asm/hardware.h> | 42 | #include <mach/hardware.h> |
46 | #include <asm/mach/serial_sa1100.h> | 43 | #include <asm/mach/serial_sa1100.h> |
47 | 44 | ||
48 | /* We've been assigned a range on the "Low-density serial ports" major */ | 45 | /* We've been assigned a range on the "Low-density serial ports" major */ |
@@ -192,7 +189,7 @@ static void sa1100_enable_ms(struct uart_port *port) | |||
192 | static void | 189 | static void |
193 | sa1100_rx_chars(struct sa1100_port *sport) | 190 | sa1100_rx_chars(struct sa1100_port *sport) |
194 | { | 191 | { |
195 | struct tty_struct *tty = sport->port.info->tty; | 192 | struct tty_struct *tty = sport->port.info->port.tty; |
196 | unsigned int status, ch, flg; | 193 | unsigned int status, ch, flg; |
197 | 194 | ||
198 | status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | | 195 | status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | |
@@ -892,7 +889,7 @@ static int __init sa1100_serial_init(void) | |||
892 | { | 889 | { |
893 | int ret; | 890 | int ret; |
894 | 891 | ||
895 | printk(KERN_INFO "Serial: SA11x0 driver $Revision: 1.50 $\n"); | 892 | printk(KERN_INFO "Serial: SA11x0 driver\n"); |
896 | 893 | ||
897 | sa1100_init_ports(); | 894 | sa1100_init_ports(); |
898 | 895 | ||
@@ -915,7 +912,7 @@ module_init(sa1100_serial_init); | |||
915 | module_exit(sa1100_serial_exit); | 912 | module_exit(sa1100_serial_exit); |
916 | 913 | ||
917 | MODULE_AUTHOR("Deep Blue Solutions Ltd"); | 914 | MODULE_AUTHOR("Deep Blue Solutions Ltd"); |
918 | MODULE_DESCRIPTION("SA1100 generic serial port driver $Revision: 1.50 $"); | 915 | MODULE_DESCRIPTION("SA1100 generic serial port driver"); |
919 | MODULE_LICENSE("GPL"); | 916 | MODULE_LICENSE("GPL"); |
920 | MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_SA1100_MAJOR); | 917 | MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_SA1100_MAJOR); |
921 | MODULE_ALIAS("platform:sa11x0-uart"); | 918 | MODULE_ALIAS("platform:sa11x0-uart"); |
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c index 4a3ecaa629e6..1e219d3d0352 100644 --- a/drivers/serial/samsung.c +++ b/drivers/serial/samsung.c | |||
@@ -45,10 +45,10 @@ | |||
45 | 45 | ||
46 | #include <asm/irq.h> | 46 | #include <asm/irq.h> |
47 | 47 | ||
48 | #include <asm/hardware.h> | 48 | #include <mach/hardware.h> |
49 | 49 | ||
50 | #include <asm/plat-s3c/regs-serial.h> | 50 | #include <plat/regs-serial.h> |
51 | #include <asm/arch/regs-gpio.h> | 51 | #include <mach/regs-gpio.h> |
52 | 52 | ||
53 | #include "samsung.h" | 53 | #include "samsung.h" |
54 | 54 | ||
@@ -202,7 +202,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id) | |||
202 | { | 202 | { |
203 | struct s3c24xx_uart_port *ourport = dev_id; | 203 | struct s3c24xx_uart_port *ourport = dev_id; |
204 | struct uart_port *port = &ourport->port; | 204 | struct uart_port *port = &ourport->port; |
205 | struct tty_struct *tty = port->info->tty; | 205 | struct tty_struct *tty = port->info->port.tty; |
206 | unsigned int ufcon, ch, flag, ufstat, uerstat; | 206 | unsigned int ufcon, ch, flag, ufstat, uerstat; |
207 | int max_count = 64; | 207 | int max_count = 64; |
208 | 208 | ||
diff --git a/drivers/serial/sb1250-duart.c b/drivers/serial/sb1250-duart.c index f8e1447a022a..a4fb343a08da 100644 --- a/drivers/serial/sb1250-duart.c +++ b/drivers/serial/sb1250-duart.c | |||
@@ -384,7 +384,7 @@ static void sbd_receive_chars(struct sbd_port *sport) | |||
384 | uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag); | 384 | uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag); |
385 | } | 385 | } |
386 | 386 | ||
387 | tty_flip_buffer_push(uport->info->tty); | 387 | tty_flip_buffer_push(uport->info->port.tty); |
388 | } | 388 | } |
389 | 389 | ||
390 | static void sbd_transmit_chars(struct sbd_port *sport) | 390 | static void sbd_transmit_chars(struct sbd_port *sport) |
diff --git a/drivers/serial/sc26xx.c b/drivers/serial/sc26xx.c index ae2a9e2df777..e0be11ceaa25 100644 --- a/drivers/serial/sc26xx.c +++ b/drivers/serial/sc26xx.c | |||
@@ -141,7 +141,7 @@ static struct tty_struct *receive_chars(struct uart_port *port) | |||
141 | u8 status; | 141 | u8 status; |
142 | 142 | ||
143 | if (port->info != NULL) /* Unopened serial console */ | 143 | if (port->info != NULL) /* Unopened serial console */ |
144 | tty = port->info->tty; | 144 | tty = port->info->port.tty; |
145 | 145 | ||
146 | while (limit-- > 0) { | 146 | while (limit-- > 0) { |
147 | status = READ_SC_PORT(port, SR); | 147 | status = READ_SC_PORT(port, SR); |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 42d2e108b679..874786a11fe9 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -50,7 +50,7 @@ static struct lock_class_key port_lock_key; | |||
50 | 50 | ||
51 | #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) | 51 | #define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) |
52 | 52 | ||
53 | #define uart_users(state) ((state)->count + ((state)->info ? (state)->info->blocked_open : 0)) | 53 | #define uart_users(state) ((state)->count + ((state)->info ? (state)->info->port.blocked_open : 0)) |
54 | 54 | ||
55 | #ifdef CONFIG_SERIAL_CORE_CONSOLE | 55 | #ifdef CONFIG_SERIAL_CORE_CONSOLE |
56 | #define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line) | 56 | #define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line) |
@@ -113,7 +113,7 @@ static void uart_start(struct tty_struct *tty) | |||
113 | static void uart_tasklet_action(unsigned long data) | 113 | static void uart_tasklet_action(unsigned long data) |
114 | { | 114 | { |
115 | struct uart_state *state = (struct uart_state *)data; | 115 | struct uart_state *state = (struct uart_state *)data; |
116 | tty_wakeup(state->info->tty); | 116 | tty_wakeup(state->info->port.tty); |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline void | 119 | static inline void |
@@ -135,7 +135,7 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear) | |||
135 | 135 | ||
136 | /* | 136 | /* |
137 | * Startup the port. This will be called once per open. All calls | 137 | * Startup the port. This will be called once per open. All calls |
138 | * will be serialised by the per-port semaphore. | 138 | * will be serialised by the per-port mutex. |
139 | */ | 139 | */ |
140 | static int uart_startup(struct uart_state *state, int init_hw) | 140 | static int uart_startup(struct uart_state *state, int init_hw) |
141 | { | 141 | { |
@@ -152,7 +152,7 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
152 | * once we have successfully opened the port. Also set | 152 | * once we have successfully opened the port. Also set |
153 | * up the tty->alt_speed kludge | 153 | * up the tty->alt_speed kludge |
154 | */ | 154 | */ |
155 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 155 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
156 | 156 | ||
157 | if (port->type == PORT_UNKNOWN) | 157 | if (port->type == PORT_UNKNOWN) |
158 | return 0; | 158 | return 0; |
@@ -162,6 +162,7 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
162 | * buffer. | 162 | * buffer. |
163 | */ | 163 | */ |
164 | if (!info->xmit.buf) { | 164 | if (!info->xmit.buf) { |
165 | /* This is protected by the per port mutex */ | ||
165 | page = get_zeroed_page(GFP_KERNEL); | 166 | page = get_zeroed_page(GFP_KERNEL); |
166 | if (!page) | 167 | if (!page) |
167 | return -ENOMEM; | 168 | return -ENOMEM; |
@@ -182,20 +183,20 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
182 | * Setup the RTS and DTR signals once the | 183 | * Setup the RTS and DTR signals once the |
183 | * port is open and ready to respond. | 184 | * port is open and ready to respond. |
184 | */ | 185 | */ |
185 | if (info->tty->termios->c_cflag & CBAUD) | 186 | if (info->port.tty->termios->c_cflag & CBAUD) |
186 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); | 187 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); |
187 | } | 188 | } |
188 | 189 | ||
189 | if (info->flags & UIF_CTS_FLOW) { | 190 | if (info->flags & UIF_CTS_FLOW) { |
190 | spin_lock_irq(&port->lock); | 191 | spin_lock_irq(&port->lock); |
191 | if (!(port->ops->get_mctrl(port) & TIOCM_CTS)) | 192 | if (!(port->ops->get_mctrl(port) & TIOCM_CTS)) |
192 | info->tty->hw_stopped = 1; | 193 | info->port.tty->hw_stopped = 1; |
193 | spin_unlock_irq(&port->lock); | 194 | spin_unlock_irq(&port->lock); |
194 | } | 195 | } |
195 | 196 | ||
196 | info->flags |= UIF_INITIALIZED; | 197 | info->flags |= UIF_INITIALIZED; |
197 | 198 | ||
198 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 199 | clear_bit(TTY_IO_ERROR, &info->port.tty->flags); |
199 | } | 200 | } |
200 | 201 | ||
201 | if (retval && capable(CAP_SYS_ADMIN)) | 202 | if (retval && capable(CAP_SYS_ADMIN)) |
@@ -217,8 +218,8 @@ static void uart_shutdown(struct uart_state *state) | |||
217 | /* | 218 | /* |
218 | * Set the TTY IO error marker | 219 | * Set the TTY IO error marker |
219 | */ | 220 | */ |
220 | if (info->tty) | 221 | if (info->port.tty) |
221 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 222 | set_bit(TTY_IO_ERROR, &info->port.tty->flags); |
222 | 223 | ||
223 | if (info->flags & UIF_INITIALIZED) { | 224 | if (info->flags & UIF_INITIALIZED) { |
224 | info->flags &= ~UIF_INITIALIZED; | 225 | info->flags &= ~UIF_INITIALIZED; |
@@ -226,7 +227,7 @@ static void uart_shutdown(struct uart_state *state) | |||
226 | /* | 227 | /* |
227 | * Turn off DTR and RTS early. | 228 | * Turn off DTR and RTS early. |
228 | */ | 229 | */ |
229 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) | 230 | if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) |
230 | uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | 231 | uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
231 | 232 | ||
232 | /* | 233 | /* |
@@ -426,7 +427,7 @@ EXPORT_SYMBOL(uart_get_divisor); | |||
426 | static void | 427 | static void |
427 | uart_change_speed(struct uart_state *state, struct ktermios *old_termios) | 428 | uart_change_speed(struct uart_state *state, struct ktermios *old_termios) |
428 | { | 429 | { |
429 | struct tty_struct *tty = state->info->tty; | 430 | struct tty_struct *tty = state->info->port.tty; |
430 | struct uart_port *port = state->port; | 431 | struct uart_port *port = state->port; |
431 | struct ktermios *termios; | 432 | struct ktermios *termios; |
432 | 433 | ||
@@ -573,6 +574,8 @@ static void uart_flush_buffer(struct tty_struct *tty) | |||
573 | 574 | ||
574 | spin_lock_irqsave(&port->lock, flags); | 575 | spin_lock_irqsave(&port->lock, flags); |
575 | uart_circ_clear(&state->info->xmit); | 576 | uart_circ_clear(&state->info->xmit); |
577 | if (port->ops->flush_buffer) | ||
578 | port->ops->flush_buffer(port); | ||
576 | spin_unlock_irqrestore(&port->lock, flags); | 579 | spin_unlock_irqrestore(&port->lock, flags); |
577 | tty_wakeup(tty); | 580 | tty_wakeup(tty); |
578 | } | 581 | } |
@@ -738,7 +741,7 @@ static int uart_set_info(struct uart_state *state, | |||
738 | if (port->ops->verify_port) | 741 | if (port->ops->verify_port) |
739 | retval = port->ops->verify_port(port, &new_serial); | 742 | retval = port->ops->verify_port(port, &new_serial); |
740 | 743 | ||
741 | if ((new_serial.irq >= NR_IRQS) || (new_serial.irq < 0) || | 744 | if ((new_serial.irq >= nr_irqs) || (new_serial.irq < 0) || |
742 | (new_serial.baud_base < 9600)) | 745 | (new_serial.baud_base < 9600)) |
743 | retval = -EINVAL; | 746 | retval = -EINVAL; |
744 | 747 | ||
@@ -834,8 +837,8 @@ static int uart_set_info(struct uart_state *state, | |||
834 | state->closing_wait = closing_wait; | 837 | state->closing_wait = closing_wait; |
835 | if (new_serial.xmit_fifo_size) | 838 | if (new_serial.xmit_fifo_size) |
836 | port->fifosize = new_serial.xmit_fifo_size; | 839 | port->fifosize = new_serial.xmit_fifo_size; |
837 | if (state->info->tty) | 840 | if (state->info->port.tty) |
838 | state->info->tty->low_latency = | 841 | state->info->port.tty->low_latency = |
839 | (port->flags & UPF_LOW_LATENCY) ? 1 : 0; | 842 | (port->flags & UPF_LOW_LATENCY) ? 1 : 0; |
840 | 843 | ||
841 | check_and_exit: | 844 | check_and_exit: |
@@ -855,7 +858,7 @@ static int uart_set_info(struct uart_state *state, | |||
855 | printk(KERN_NOTICE | 858 | printk(KERN_NOTICE |
856 | "%s sets custom speed on %s. This " | 859 | "%s sets custom speed on %s. This " |
857 | "is deprecated.\n", current->comm, | 860 | "is deprecated.\n", current->comm, |
858 | tty_name(state->info->tty, buf)); | 861 | tty_name(state->info->port.tty, buf)); |
859 | } | 862 | } |
860 | uart_change_speed(state, NULL); | 863 | uart_change_speed(state, NULL); |
861 | } | 864 | } |
@@ -887,7 +890,7 @@ static int uart_get_lsr_info(struct uart_state *state, | |||
887 | */ | 890 | */ |
888 | if (port->x_char || | 891 | if (port->x_char || |
889 | ((uart_circ_chars_pending(&state->info->xmit) > 0) && | 892 | ((uart_circ_chars_pending(&state->info->xmit) > 0) && |
890 | !state->info->tty->stopped && !state->info->tty->hw_stopped)) | 893 | !state->info->port.tty->stopped && !state->info->port.tty->hw_stopped)) |
891 | result &= ~TIOCSER_TEMT; | 894 | result &= ~TIOCSER_TEMT; |
892 | 895 | ||
893 | return put_user(result, value); | 896 | return put_user(result, value); |
@@ -931,7 +934,7 @@ uart_tiocmset(struct tty_struct *tty, struct file *file, | |||
931 | return ret; | 934 | return ret; |
932 | } | 935 | } |
933 | 936 | ||
934 | static void uart_break_ctl(struct tty_struct *tty, int break_state) | 937 | static int uart_break_ctl(struct tty_struct *tty, int break_state) |
935 | { | 938 | { |
936 | struct uart_state *state = tty->driver_data; | 939 | struct uart_state *state = tty->driver_data; |
937 | struct uart_port *port = state->port; | 940 | struct uart_port *port = state->port; |
@@ -942,6 +945,7 @@ static void uart_break_ctl(struct tty_struct *tty, int break_state) | |||
942 | port->ops->break_ctl(port, break_state); | 945 | port->ops->break_ctl(port, break_state); |
943 | 946 | ||
944 | mutex_unlock(&state->mutex); | 947 | mutex_unlock(&state->mutex); |
948 | return 0; | ||
945 | } | 949 | } |
946 | 950 | ||
947 | static int uart_do_autoconfig(struct uart_state *state) | 951 | static int uart_do_autoconfig(struct uart_state *state) |
@@ -1237,7 +1241,7 @@ static void uart_set_termios(struct tty_struct *tty, | |||
1237 | */ | 1241 | */ |
1238 | if (!(old_termios->c_cflag & CLOCAL) && | 1242 | if (!(old_termios->c_cflag & CLOCAL) && |
1239 | (tty->termios->c_cflag & CLOCAL)) | 1243 | (tty->termios->c_cflag & CLOCAL)) |
1240 | wake_up_interruptible(&state->info->open_wait); | 1244 | wake_up_interruptible(&state->info->port.open_wait); |
1241 | #endif | 1245 | #endif |
1242 | } | 1246 | } |
1243 | 1247 | ||
@@ -1318,9 +1322,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1318 | tty_ldisc_flush(tty); | 1322 | tty_ldisc_flush(tty); |
1319 | 1323 | ||
1320 | tty->closing = 0; | 1324 | tty->closing = 0; |
1321 | state->info->tty = NULL; | 1325 | state->info->port.tty = NULL; |
1322 | 1326 | ||
1323 | if (state->info->blocked_open) { | 1327 | if (state->info->port.blocked_open) { |
1324 | if (state->close_delay) | 1328 | if (state->close_delay) |
1325 | msleep_interruptible(state->close_delay); | 1329 | msleep_interruptible(state->close_delay); |
1326 | } else if (!uart_console(port)) { | 1330 | } else if (!uart_console(port)) { |
@@ -1331,7 +1335,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1331 | * Wake up anyone trying to open this port. | 1335 | * Wake up anyone trying to open this port. |
1332 | */ | 1336 | */ |
1333 | state->info->flags &= ~UIF_NORMAL_ACTIVE; | 1337 | state->info->flags &= ~UIF_NORMAL_ACTIVE; |
1334 | wake_up_interruptible(&state->info->open_wait); | 1338 | wake_up_interruptible(&state->info->port.open_wait); |
1335 | 1339 | ||
1336 | done: | 1340 | done: |
1337 | mutex_unlock(&state->mutex); | 1341 | mutex_unlock(&state->mutex); |
@@ -1415,8 +1419,8 @@ static void uart_hangup(struct tty_struct *tty) | |||
1415 | uart_shutdown(state); | 1419 | uart_shutdown(state); |
1416 | state->count = 0; | 1420 | state->count = 0; |
1417 | state->info->flags &= ~UIF_NORMAL_ACTIVE; | 1421 | state->info->flags &= ~UIF_NORMAL_ACTIVE; |
1418 | state->info->tty = NULL; | 1422 | state->info->port.tty = NULL; |
1419 | wake_up_interruptible(&state->info->open_wait); | 1423 | wake_up_interruptible(&state->info->port.open_wait); |
1420 | wake_up_interruptible(&state->info->delta_msr_wait); | 1424 | wake_up_interruptible(&state->info->delta_msr_wait); |
1421 | } | 1425 | } |
1422 | mutex_unlock(&state->mutex); | 1426 | mutex_unlock(&state->mutex); |
@@ -1430,7 +1434,7 @@ static void uart_hangup(struct tty_struct *tty) | |||
1430 | */ | 1434 | */ |
1431 | static void uart_update_termios(struct uart_state *state) | 1435 | static void uart_update_termios(struct uart_state *state) |
1432 | { | 1436 | { |
1433 | struct tty_struct *tty = state->info->tty; | 1437 | struct tty_struct *tty = state->info->port.tty; |
1434 | struct uart_port *port = state->port; | 1438 | struct uart_port *port = state->port; |
1435 | 1439 | ||
1436 | if (uart_console(port) && port->cons->cflag) { | 1440 | if (uart_console(port) && port->cons->cflag) { |
@@ -1469,17 +1473,17 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1469 | struct uart_port *port = state->port; | 1473 | struct uart_port *port = state->port; |
1470 | unsigned int mctrl; | 1474 | unsigned int mctrl; |
1471 | 1475 | ||
1472 | info->blocked_open++; | 1476 | info->port.blocked_open++; |
1473 | state->count--; | 1477 | state->count--; |
1474 | 1478 | ||
1475 | add_wait_queue(&info->open_wait, &wait); | 1479 | add_wait_queue(&info->port.open_wait, &wait); |
1476 | while (1) { | 1480 | while (1) { |
1477 | set_current_state(TASK_INTERRUPTIBLE); | 1481 | set_current_state(TASK_INTERRUPTIBLE); |
1478 | 1482 | ||
1479 | /* | 1483 | /* |
1480 | * If we have been hung up, tell userspace/restart open. | 1484 | * If we have been hung up, tell userspace/restart open. |
1481 | */ | 1485 | */ |
1482 | if (tty_hung_up_p(filp) || info->tty == NULL) | 1486 | if (tty_hung_up_p(filp) || info->port.tty == NULL) |
1483 | break; | 1487 | break; |
1484 | 1488 | ||
1485 | /* | 1489 | /* |
@@ -1498,8 +1502,8 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1498 | * have set TTY_IO_ERROR for a non-existant port. | 1502 | * have set TTY_IO_ERROR for a non-existant port. |
1499 | */ | 1503 | */ |
1500 | if ((filp->f_flags & O_NONBLOCK) || | 1504 | if ((filp->f_flags & O_NONBLOCK) || |
1501 | (info->tty->termios->c_cflag & CLOCAL) || | 1505 | (info->port.tty->termios->c_cflag & CLOCAL) || |
1502 | (info->tty->flags & (1 << TTY_IO_ERROR))) | 1506 | (info->port.tty->flags & (1 << TTY_IO_ERROR))) |
1503 | break; | 1507 | break; |
1504 | 1508 | ||
1505 | /* | 1509 | /* |
@@ -1507,7 +1511,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1507 | * not set RTS here - we want to make sure we catch | 1511 | * not set RTS here - we want to make sure we catch |
1508 | * the data from the modem. | 1512 | * the data from the modem. |
1509 | */ | 1513 | */ |
1510 | if (info->tty->termios->c_cflag & CBAUD) | 1514 | if (info->port.tty->termios->c_cflag & CBAUD) |
1511 | uart_set_mctrl(port, TIOCM_DTR); | 1515 | uart_set_mctrl(port, TIOCM_DTR); |
1512 | 1516 | ||
1513 | /* | 1517 | /* |
@@ -1529,15 +1533,15 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1529 | break; | 1533 | break; |
1530 | } | 1534 | } |
1531 | set_current_state(TASK_RUNNING); | 1535 | set_current_state(TASK_RUNNING); |
1532 | remove_wait_queue(&info->open_wait, &wait); | 1536 | remove_wait_queue(&info->port.open_wait, &wait); |
1533 | 1537 | ||
1534 | state->count++; | 1538 | state->count++; |
1535 | info->blocked_open--; | 1539 | info->port.blocked_open--; |
1536 | 1540 | ||
1537 | if (signal_pending(current)) | 1541 | if (signal_pending(current)) |
1538 | return -ERESTARTSYS; | 1542 | return -ERESTARTSYS; |
1539 | 1543 | ||
1540 | if (!info->tty || tty_hung_up_p(filp)) | 1544 | if (!info->port.tty || tty_hung_up_p(filp)) |
1541 | return -EAGAIN; | 1545 | return -EAGAIN; |
1542 | 1546 | ||
1543 | return 0; | 1547 | return 0; |
@@ -1560,10 +1564,13 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line) | |||
1560 | goto err_unlock; | 1564 | goto err_unlock; |
1561 | } | 1565 | } |
1562 | 1566 | ||
1567 | /* BKL: RACE HERE - LEAK */ | ||
1568 | /* We should move this into the uart_state structure and kill off | ||
1569 | this whole complexity */ | ||
1563 | if (!state->info) { | 1570 | if (!state->info) { |
1564 | state->info = kzalloc(sizeof(struct uart_info), GFP_KERNEL); | 1571 | state->info = kzalloc(sizeof(struct uart_info), GFP_KERNEL); |
1565 | if (state->info) { | 1572 | if (state->info) { |
1566 | init_waitqueue_head(&state->info->open_wait); | 1573 | init_waitqueue_head(&state->info->port.open_wait); |
1567 | init_waitqueue_head(&state->info->delta_msr_wait); | 1574 | init_waitqueue_head(&state->info->delta_msr_wait); |
1568 | 1575 | ||
1569 | /* | 1576 | /* |
@@ -1620,7 +1627,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1620 | * be re-entered while allocating the info structure, or while we | 1627 | * be re-entered while allocating the info structure, or while we |
1621 | * request any IRQs that the driver may need. This also has the nice | 1628 | * request any IRQs that the driver may need. This also has the nice |
1622 | * side-effect that it delays the action of uart_hangup, so we can | 1629 | * side-effect that it delays the action of uart_hangup, so we can |
1623 | * guarantee that info->tty will always contain something reasonable. | 1630 | * guarantee that info->port.tty will always contain something reasonable. |
1624 | */ | 1631 | */ |
1625 | state = uart_get(drv, line); | 1632 | state = uart_get(drv, line); |
1626 | if (IS_ERR(state)) { | 1633 | if (IS_ERR(state)) { |
@@ -1636,7 +1643,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1636 | tty->driver_data = state; | 1643 | tty->driver_data = state; |
1637 | tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0; | 1644 | tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0; |
1638 | tty->alt_speed = 0; | 1645 | tty->alt_speed = 0; |
1639 | state->info->tty = tty; | 1646 | state->info->port.tty = tty; |
1640 | 1647 | ||
1641 | /* | 1648 | /* |
1642 | * If the port is in the middle of closing, bail out now. | 1649 | * If the port is in the middle of closing, bail out now. |
@@ -2044,7 +2051,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
2044 | "transmitter\n", | 2051 | "transmitter\n", |
2045 | port->dev ? port->dev->bus_id : "", | 2052 | port->dev ? port->dev->bus_id : "", |
2046 | port->dev ? ": " : "", | 2053 | port->dev ? ": " : "", |
2047 | drv->dev_name, port->line); | 2054 | drv->dev_name, |
2055 | drv->tty_driver->name_base + port->line); | ||
2048 | 2056 | ||
2049 | ops->shutdown(port); | 2057 | ops->shutdown(port); |
2050 | } | 2058 | } |
@@ -2099,8 +2107,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
2099 | /* | 2107 | /* |
2100 | * If that's unset, use the tty termios setting. | 2108 | * If that's unset, use the tty termios setting. |
2101 | */ | 2109 | */ |
2102 | if (state->info && state->info->tty && termios.c_cflag == 0) | 2110 | if (state->info && state->info->port.tty && termios.c_cflag == 0) |
2103 | termios = *state->info->tty->termios; | 2111 | termios = *state->info->port.tty->termios; |
2104 | 2112 | ||
2105 | uart_change_pm(state, 0); | 2113 | uart_change_pm(state, 0); |
2106 | port->ops->set_termios(port, &termios, NULL); | 2114 | port->ops->set_termios(port, &termios, NULL); |
@@ -2147,12 +2155,11 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) | |||
2147 | 2155 | ||
2148 | switch (port->iotype) { | 2156 | switch (port->iotype) { |
2149 | case UPIO_PORT: | 2157 | case UPIO_PORT: |
2150 | snprintf(address, sizeof(address), | 2158 | snprintf(address, sizeof(address), "I/O 0x%lx", port->iobase); |
2151 | "I/O 0x%x", port->iobase); | ||
2152 | break; | 2159 | break; |
2153 | case UPIO_HUB6: | 2160 | case UPIO_HUB6: |
2154 | snprintf(address, sizeof(address), | 2161 | snprintf(address, sizeof(address), |
2155 | "I/O 0x%x offset 0x%x", port->iobase, port->hub6); | 2162 | "I/O 0x%lx offset 0x%x", port->iobase, port->hub6); |
2156 | break; | 2163 | break; |
2157 | case UPIO_MEM: | 2164 | case UPIO_MEM: |
2158 | case UPIO_MEM32: | 2165 | case UPIO_MEM32: |
@@ -2170,7 +2177,9 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) | |||
2170 | printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n", | 2177 | printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n", |
2171 | port->dev ? port->dev->bus_id : "", | 2178 | port->dev ? port->dev->bus_id : "", |
2172 | port->dev ? ": " : "", | 2179 | port->dev ? ": " : "", |
2173 | drv->dev_name, port->line, address, port->irq, uart_type(port)); | 2180 | drv->dev_name, |
2181 | drv->tty_driver->name_base + port->line, | ||
2182 | address, port->irq, uart_type(port)); | ||
2174 | } | 2183 | } |
2175 | 2184 | ||
2176 | static void | 2185 | static void |
@@ -2519,8 +2528,8 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2519 | tty_unregister_device(drv->tty_driver, port->line); | 2528 | tty_unregister_device(drv->tty_driver, port->line); |
2520 | 2529 | ||
2521 | info = state->info; | 2530 | info = state->info; |
2522 | if (info && info->tty) | 2531 | if (info && info->port.tty) |
2523 | tty_vhangup(info->tty); | 2532 | tty_vhangup(info->port.tty); |
2524 | 2533 | ||
2525 | /* | 2534 | /* |
2526 | * All users of this port should now be disconnected from | 2535 | * All users of this port should now be disconnected from |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 164d2a42eb59..7546aa887fa7 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -431,131 +431,103 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) | |||
431 | { | 431 | { |
432 | int i; | 432 | int i; |
433 | i = pcmcia_get_first_tuple(handle, tuple); | 433 | i = pcmcia_get_first_tuple(handle, tuple); |
434 | if (i != CS_SUCCESS) | 434 | if (i != 0) |
435 | return CS_NO_MORE_ITEMS; | ||
436 | i = pcmcia_get_tuple_data(handle, tuple); | ||
437 | if (i != CS_SUCCESS) | ||
438 | return i; | 435 | return i; |
439 | return pcmcia_parse_tuple(handle, tuple, parse); | ||
440 | } | ||
441 | |||
442 | static int | ||
443 | next_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) | ||
444 | { | ||
445 | int i; | ||
446 | i = pcmcia_get_next_tuple(handle, tuple); | ||
447 | if (i != CS_SUCCESS) | ||
448 | return CS_NO_MORE_ITEMS; | ||
449 | i = pcmcia_get_tuple_data(handle, tuple); | 436 | i = pcmcia_get_tuple_data(handle, tuple); |
450 | if (i != CS_SUCCESS) | 437 | if (i != 0) |
451 | return i; | 438 | return i; |
452 | return pcmcia_parse_tuple(handle, tuple, parse); | 439 | return pcmcia_parse_tuple(tuple, parse); |
453 | } | 440 | } |
454 | 441 | ||
455 | /*====================================================================*/ | 442 | /*====================================================================*/ |
456 | 443 | ||
457 | static int simple_config(struct pcmcia_device *link) | 444 | static int simple_config_check(struct pcmcia_device *p_dev, |
445 | cistpl_cftable_entry_t *cf, | ||
446 | cistpl_cftable_entry_t *dflt, | ||
447 | unsigned int vcc, | ||
448 | void *priv_data) | ||
458 | { | 449 | { |
459 | static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | ||
460 | static const int size_table[2] = { 8, 16 }; | 450 | static const int size_table[2] = { 8, 16 }; |
461 | struct serial_info *info = link->priv; | 451 | int *try = priv_data; |
462 | struct serial_cfg_mem *cfg_mem; | 452 | |
463 | tuple_t *tuple; | 453 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) |
464 | u_char *buf; | 454 | p_dev->conf.Vpp = |
465 | cisparse_t *parse; | 455 | cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
466 | cistpl_cftable_entry_t *cf; | 456 | |
467 | config_info_t config; | 457 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) |
468 | int i, j, try; | 458 | && (cf->io.win[0].base != 0)) { |
469 | int s; | 459 | p_dev->io.BasePort1 = cf->io.win[0].base; |
460 | p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ? | ||
461 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
462 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
463 | return 0; | ||
464 | } | ||
465 | return -EINVAL; | ||
466 | } | ||
470 | 467 | ||
471 | cfg_mem = kmalloc(sizeof(struct serial_cfg_mem), GFP_KERNEL); | 468 | static int simple_config_check_notpicky(struct pcmcia_device *p_dev, |
472 | if (!cfg_mem) | 469 | cistpl_cftable_entry_t *cf, |
473 | return -1; | 470 | cistpl_cftable_entry_t *dflt, |
471 | unsigned int vcc, | ||
472 | void *priv_data) | ||
473 | { | ||
474 | static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | ||
475 | int j; | ||
476 | |||
477 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | ||
478 | for (j = 0; j < 5; j++) { | ||
479 | p_dev->io.BasePort1 = base[j]; | ||
480 | p_dev->io.IOAddrLines = base[j] ? 16 : 3; | ||
481 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
482 | return 0; | ||
483 | } | ||
484 | } | ||
485 | return -ENODEV; | ||
486 | } | ||
474 | 487 | ||
475 | tuple = &cfg_mem->tuple; | 488 | static int simple_config(struct pcmcia_device *link) |
476 | parse = &cfg_mem->parse; | 489 | { |
477 | cf = &parse->cftable_entry; | 490 | struct serial_info *info = link->priv; |
478 | buf = cfg_mem->buf; | 491 | int i = -ENODEV, try; |
479 | 492 | ||
480 | /* If the card is already configured, look up the port and irq */ | 493 | /* If the card is already configured, look up the port and irq */ |
481 | i = pcmcia_get_configuration_info(link, &config); | 494 | if (link->function_config) { |
482 | if ((i == CS_SUCCESS) && (config.Attributes & CONF_VALID_CLIENT)) { | ||
483 | unsigned int port = 0; | 495 | unsigned int port = 0; |
484 | if ((config.BasePort2 != 0) && (config.NumPorts2 == 8)) { | 496 | if ((link->io.BasePort2 != 0) && |
485 | port = config.BasePort2; | 497 | (link->io.NumPorts2 == 8)) { |
498 | port = link->io.BasePort2; | ||
486 | info->slave = 1; | 499 | info->slave = 1; |
487 | } else if ((info->manfid == MANFID_OSITECH) && | 500 | } else if ((info->manfid == MANFID_OSITECH) && |
488 | (config.NumPorts1 == 0x40)) { | 501 | (link->io.NumPorts1 == 0x40)) { |
489 | port = config.BasePort1 + 0x28; | 502 | port = link->io.BasePort1 + 0x28; |
490 | info->slave = 1; | 503 | info->slave = 1; |
491 | } | 504 | } |
492 | if (info->slave) { | 505 | if (info->slave) { |
493 | kfree(cfg_mem); | 506 | return setup_serial(link, info, port, |
494 | return setup_serial(link, info, port, config.AssignedIRQ); | 507 | link->irq.AssignedIRQ); |
495 | } | 508 | } |
496 | } | 509 | } |
497 | 510 | ||
498 | /* First pass: look for a config entry that looks normal. */ | 511 | /* First pass: look for a config entry that looks normal. |
499 | tuple->TupleData = (cisdata_t *) buf; | 512 | * Two tries: without IO aliases, then with aliases */ |
500 | tuple->TupleOffset = 0; | 513 | for (try = 0; try < 4; try++) |
501 | tuple->TupleDataMax = 255; | 514 | if (!pcmcia_loop_config(link, simple_config_check, &try)) |
502 | tuple->Attributes = 0; | 515 | goto found_port; |
503 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | 516 | |
504 | /* Two tries: without IO aliases, then with aliases */ | ||
505 | for (s = 0; s < 2; s++) { | ||
506 | for (try = 0; try < 2; try++) { | ||
507 | i = first_tuple(link, tuple, parse); | ||
508 | while (i != CS_NO_MORE_ITEMS) { | ||
509 | if (i != CS_SUCCESS) | ||
510 | goto next_entry; | ||
511 | if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
512 | link->conf.Vpp = | ||
513 | cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
514 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[s]) && | ||
515 | (cf->io.win[0].base != 0)) { | ||
516 | link->conf.ConfigIndex = cf->index; | ||
517 | link->io.BasePort1 = cf->io.win[0].base; | ||
518 | link->io.IOAddrLines = (try == 0) ? | ||
519 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
520 | i = pcmcia_request_io(link, &link->io); | ||
521 | if (i == CS_SUCCESS) | ||
522 | goto found_port; | ||
523 | } | ||
524 | next_entry: | ||
525 | i = next_tuple(link, tuple, parse); | ||
526 | } | ||
527 | } | ||
528 | } | ||
529 | /* Second pass: try to find an entry that isn't picky about | 517 | /* Second pass: try to find an entry that isn't picky about |
530 | its base address, then try to grab any standard serial port | 518 | its base address, then try to grab any standard serial port |
531 | address, and finally try to get any free port. */ | 519 | address, and finally try to get any free port. */ |
532 | i = first_tuple(link, tuple, parse); | 520 | if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL)) |
533 | while (i != CS_NO_MORE_ITEMS) { | 521 | goto found_port; |
534 | if ((i == CS_SUCCESS) && (cf->io.nwin > 0) && | ||
535 | ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | ||
536 | link->conf.ConfigIndex = cf->index; | ||
537 | for (j = 0; j < 5; j++) { | ||
538 | link->io.BasePort1 = base[j]; | ||
539 | link->io.IOAddrLines = base[j] ? 16 : 3; | ||
540 | i = pcmcia_request_io(link, &link->io); | ||
541 | if (i == CS_SUCCESS) | ||
542 | goto found_port; | ||
543 | } | ||
544 | } | ||
545 | i = next_tuple(link, tuple, parse); | ||
546 | } | ||
547 | 522 | ||
548 | found_port: | 523 | printk(KERN_NOTICE |
549 | if (i != CS_SUCCESS) { | 524 | "serial_cs: no usable port range found, giving up\n"); |
550 | printk(KERN_NOTICE | 525 | cs_error(link, RequestIO, i); |
551 | "serial_cs: no usable port range found, giving up\n"); | 526 | return -1; |
552 | cs_error(link, RequestIO, i); | ||
553 | kfree(cfg_mem); | ||
554 | return -1; | ||
555 | } | ||
556 | 527 | ||
528 | found_port: | ||
557 | i = pcmcia_request_irq(link, &link->irq); | 529 | i = pcmcia_request_irq(link, &link->irq); |
558 | if (i != CS_SUCCESS) { | 530 | if (i != 0) { |
559 | cs_error(link, RequestIRQ, i); | 531 | cs_error(link, RequestIRQ, i); |
560 | link->irq.AssignedIRQ = 0; | 532 | link->irq.AssignedIRQ = 0; |
561 | } | 533 | } |
@@ -569,88 +541,76 @@ next_entry: | |||
569 | info->quirk->config(link); | 541 | info->quirk->config(link); |
570 | 542 | ||
571 | i = pcmcia_request_configuration(link, &link->conf); | 543 | i = pcmcia_request_configuration(link, &link->conf); |
572 | if (i != CS_SUCCESS) { | 544 | if (i != 0) { |
573 | cs_error(link, RequestConfiguration, i); | 545 | cs_error(link, RequestConfiguration, i); |
574 | kfree(cfg_mem); | ||
575 | return -1; | 546 | return -1; |
576 | } | 547 | } |
577 | kfree(cfg_mem); | ||
578 | return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); | 548 | return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
579 | } | 549 | } |
580 | 550 | ||
581 | static int multi_config(struct pcmcia_device * link) | 551 | static int multi_config_check(struct pcmcia_device *p_dev, |
552 | cistpl_cftable_entry_t *cf, | ||
553 | cistpl_cftable_entry_t *dflt, | ||
554 | unsigned int vcc, | ||
555 | void *priv_data) | ||
582 | { | 556 | { |
583 | struct serial_info *info = link->priv; | 557 | int *base2 = priv_data; |
584 | struct serial_cfg_mem *cfg_mem; | 558 | |
585 | tuple_t *tuple; | 559 | /* The quad port cards have bad CIS's, so just look for a |
586 | u_char *buf; | 560 | window larger than 8 ports and assume it will be right */ |
587 | cisparse_t *parse; | 561 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { |
588 | cistpl_cftable_entry_t *cf; | 562 | p_dev->io.BasePort1 = cf->io.win[0].base; |
589 | int i, rc, base2 = 0; | 563 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; |
564 | if (!pcmcia_request_io(p_dev, &p_dev->io)) { | ||
565 | *base2 = p_dev->io.BasePort1 + 8; | ||
566 | return 0; | ||
567 | } | ||
568 | } | ||
569 | return -ENODEV; | ||
570 | } | ||
590 | 571 | ||
591 | cfg_mem = kmalloc(sizeof(struct serial_cfg_mem), GFP_KERNEL); | 572 | static int multi_config_check_notpicky(struct pcmcia_device *p_dev, |
592 | if (!cfg_mem) | 573 | cistpl_cftable_entry_t *cf, |
593 | return -1; | 574 | cistpl_cftable_entry_t *dflt, |
594 | tuple = &cfg_mem->tuple; | 575 | unsigned int vcc, |
595 | parse = &cfg_mem->parse; | 576 | void *priv_data) |
596 | cf = &parse->cftable_entry; | 577 | { |
597 | buf = cfg_mem->buf; | 578 | int *base2 = priv_data; |
579 | |||
580 | if (cf->io.nwin == 2) { | ||
581 | p_dev->io.BasePort1 = cf->io.win[0].base; | ||
582 | p_dev->io.BasePort2 = cf->io.win[1].base; | ||
583 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | ||
584 | if (!pcmcia_request_io(p_dev, &p_dev->io)) { | ||
585 | *base2 = p_dev->io.BasePort2; | ||
586 | return 0; | ||
587 | } | ||
588 | } | ||
589 | return -ENODEV; | ||
590 | } | ||
598 | 591 | ||
599 | tuple->TupleData = (cisdata_t *) buf; | 592 | static int multi_config(struct pcmcia_device *link) |
600 | tuple->TupleOffset = 0; | 593 | { |
601 | tuple->TupleDataMax = 255; | 594 | struct serial_info *info = link->priv; |
602 | tuple->Attributes = 0; | 595 | int i, base2 = 0; |
603 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
604 | 596 | ||
605 | /* First, look for a generic full-sized window */ | 597 | /* First, look for a generic full-sized window */ |
606 | link->io.NumPorts1 = info->multi * 8; | 598 | link->io.NumPorts1 = info->multi * 8; |
607 | i = first_tuple(link, tuple, parse); | 599 | if (pcmcia_loop_config(link, multi_config_check, &base2)) { |
608 | while (i != CS_NO_MORE_ITEMS) { | 600 | /* If that didn't work, look for two windows */ |
609 | /* The quad port cards have bad CIS's, so just look for a | ||
610 | window larger than 8 ports and assume it will be right */ | ||
611 | if ((i == CS_SUCCESS) && (cf->io.nwin == 1) && | ||
612 | (cf->io.win[0].len > 8)) { | ||
613 | link->conf.ConfigIndex = cf->index; | ||
614 | link->io.BasePort1 = cf->io.win[0].base; | ||
615 | link->io.IOAddrLines = | ||
616 | cf->io.flags & CISTPL_IO_LINES_MASK; | ||
617 | i = pcmcia_request_io(link, &link->io); | ||
618 | base2 = link->io.BasePort1 + 8; | ||
619 | if (i == CS_SUCCESS) | ||
620 | break; | ||
621 | } | ||
622 | i = next_tuple(link, tuple, parse); | ||
623 | } | ||
624 | |||
625 | /* If that didn't work, look for two windows */ | ||
626 | if (i != CS_SUCCESS) { | ||
627 | link->io.NumPorts1 = link->io.NumPorts2 = 8; | 601 | link->io.NumPorts1 = link->io.NumPorts2 = 8; |
628 | info->multi = 2; | 602 | info->multi = 2; |
629 | i = first_tuple(link, tuple, parse); | 603 | if (pcmcia_loop_config(link, multi_config_check_notpicky, |
630 | while (i != CS_NO_MORE_ITEMS) { | 604 | &base2)) { |
631 | if ((i == CS_SUCCESS) && (cf->io.nwin == 2)) { | 605 | printk(KERN_NOTICE "serial_cs: no usable port range" |
632 | link->conf.ConfigIndex = cf->index; | 606 | "found, giving up\n"); |
633 | link->io.BasePort1 = cf->io.win[0].base; | 607 | return -ENODEV; |
634 | link->io.BasePort2 = cf->io.win[1].base; | ||
635 | link->io.IOAddrLines = | ||
636 | cf->io.flags & CISTPL_IO_LINES_MASK; | ||
637 | i = pcmcia_request_io(link, &link->io); | ||
638 | base2 = link->io.BasePort2; | ||
639 | if (i == CS_SUCCESS) | ||
640 | break; | ||
641 | } | ||
642 | i = next_tuple(link, tuple, parse); | ||
643 | } | 608 | } |
644 | } | 609 | } |
645 | 610 | ||
646 | if (i != CS_SUCCESS) { | ||
647 | cs_error(link, RequestIO, i); | ||
648 | rc = -1; | ||
649 | goto free_cfg_mem; | ||
650 | } | ||
651 | |||
652 | i = pcmcia_request_irq(link, &link->irq); | 611 | i = pcmcia_request_irq(link, &link->irq); |
653 | if (i != CS_SUCCESS) { | 612 | if (i != 0) { |
613 | /* FIXME: comment does not fit, error handling does not fit */ | ||
654 | printk(KERN_NOTICE | 614 | printk(KERN_NOTICE |
655 | "serial_cs: no usable port range found, giving up\n"); | 615 | "serial_cs: no usable port range found, giving up\n"); |
656 | cs_error(link, RequestIRQ, i); | 616 | cs_error(link, RequestIRQ, i); |
@@ -664,10 +624,9 @@ static int multi_config(struct pcmcia_device * link) | |||
664 | info->quirk->config(link); | 624 | info->quirk->config(link); |
665 | 625 | ||
666 | i = pcmcia_request_configuration(link, &link->conf); | 626 | i = pcmcia_request_configuration(link, &link->conf); |
667 | if (i != CS_SUCCESS) { | 627 | if (i != 0) { |
668 | cs_error(link, RequestConfiguration, i); | 628 | cs_error(link, RequestConfiguration, i); |
669 | rc = -1; | 629 | return -ENODEV; |
670 | goto free_cfg_mem; | ||
671 | } | 630 | } |
672 | 631 | ||
673 | /* The Oxford Semiconductor OXCF950 cards are in fact single-port: | 632 | /* The Oxford Semiconductor OXCF950 cards are in fact single-port: |
@@ -678,7 +637,8 @@ static int multi_config(struct pcmcia_device * link) | |||
678 | info->prodid == PRODID_POSSIO_GCC)) { | 637 | info->prodid == PRODID_POSSIO_GCC)) { |
679 | int err; | 638 | int err; |
680 | 639 | ||
681 | if (cf->index == 1 || cf->index == 3) { | 640 | if (link->conf.ConfigIndex == 1 || |
641 | link->conf.ConfigIndex == 3) { | ||
682 | err = setup_serial(link, info, base2, | 642 | err = setup_serial(link, info, base2, |
683 | link->irq.AssignedIRQ); | 643 | link->irq.AssignedIRQ); |
684 | base2 = link->io.BasePort1; | 644 | base2 = link->io.BasePort1; |
@@ -695,18 +655,14 @@ static int multi_config(struct pcmcia_device * link) | |||
695 | if (info->quirk && info->quirk->wakeup) | 655 | if (info->quirk && info->quirk->wakeup) |
696 | info->quirk->wakeup(link); | 656 | info->quirk->wakeup(link); |
697 | 657 | ||
698 | rc = 0; | 658 | return 0; |
699 | goto free_cfg_mem; | ||
700 | } | 659 | } |
701 | 660 | ||
702 | setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); | 661 | setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); |
703 | for (i = 0; i < info->multi - 1; i++) | 662 | for (i = 0; i < info->multi - 1; i++) |
704 | setup_serial(link, info, base2 + (8 * i), | 663 | setup_serial(link, info, base2 + (8 * i), |
705 | link->irq.AssignedIRQ); | 664 | link->irq.AssignedIRQ); |
706 | rc = 0; | 665 | return 0; |
707 | free_cfg_mem: | ||
708 | kfree(cfg_mem); | ||
709 | return rc; | ||
710 | } | 666 | } |
711 | 667 | ||
712 | /*====================================================================== | 668 | /*====================================================================== |
@@ -746,7 +702,7 @@ static int serial_config(struct pcmcia_device * link) | |||
746 | /* Is this a compliant multifunction card? */ | 702 | /* Is this a compliant multifunction card? */ |
747 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 703 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
748 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | 704 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; |
749 | info->multi = (first_tuple(link, tuple, parse) == CS_SUCCESS); | 705 | info->multi = (first_tuple(link, tuple, parse) == 0); |
750 | 706 | ||
751 | /* Is this a multiport card? */ | 707 | /* Is this a multiport card? */ |
752 | tuple->DesiredTuple = CISTPL_MANFID; | 708 | tuple->DesiredTuple = CISTPL_MANFID; |
@@ -770,7 +726,7 @@ static int serial_config(struct pcmcia_device * link) | |||
770 | ((link->func_id == CISTPL_FUNCID_MULTI) || | 726 | ((link->func_id == CISTPL_FUNCID_MULTI) || |
771 | (link->func_id == CISTPL_FUNCID_SERIAL))) { | 727 | (link->func_id == CISTPL_FUNCID_SERIAL))) { |
772 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; | 728 | tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; |
773 | if (first_tuple(link, tuple, parse) == CS_SUCCESS) { | 729 | if (first_tuple(link, tuple, parse) == 0) { |
774 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) | 730 | if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) |
775 | info->multi = cf->io.win[0].len >> 3; | 731 | info->multi = cf->io.win[0].len >> 3; |
776 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && | 732 | if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && |
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c index 8721afe1ae4f..998e89dc5aaf 100644 --- a/drivers/serial/serial_ks8695.c +++ b/drivers/serial/serial_ks8695.c | |||
@@ -26,8 +26,8 @@ | |||
26 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | #include <asm/mach/irq.h> | 27 | #include <asm/mach/irq.h> |
28 | 28 | ||
29 | #include <asm/arch/regs-uart.h> | 29 | #include <mach/regs-uart.h> |
30 | #include <asm/arch/regs-irq.h> | 30 | #include <mach/regs-irq.h> |
31 | 31 | ||
32 | #if defined(CONFIG_SERIAL_KS8695_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 32 | #if defined(CONFIG_SERIAL_KS8695_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
33 | #define SUPPORT_SYSRQ | 33 | #define SUPPORT_SYSRQ |
@@ -63,8 +63,44 @@ | |||
63 | #define UART_DUMMY_LSR_RX 0x100 | 63 | #define UART_DUMMY_LSR_RX 0x100 |
64 | #define UART_PORT_SIZE (KS8695_USR - KS8695_URRB + 4) | 64 | #define UART_PORT_SIZE (KS8695_USR - KS8695_URRB + 4) |
65 | 65 | ||
66 | #define tx_enabled(port) ((port)->unused[0]) | 66 | static inline int tx_enabled(struct uart_port *port) |
67 | #define rx_enabled(port) ((port)->unused[1]) | 67 | { |
68 | return port->unused[0] & 1; | ||
69 | } | ||
70 | |||
71 | static inline int rx_enabled(struct uart_port *port) | ||
72 | { | ||
73 | return port->unused[0] & 2; | ||
74 | } | ||
75 | |||
76 | static inline int ms_enabled(struct uart_port *port) | ||
77 | { | ||
78 | return port->unused[0] & 4; | ||
79 | } | ||
80 | |||
81 | static inline void ms_enable(struct uart_port *port, int enabled) | ||
82 | { | ||
83 | if(enabled) | ||
84 | port->unused[0] |= 4; | ||
85 | else | ||
86 | port->unused[0] &= ~4; | ||
87 | } | ||
88 | |||
89 | static inline void rx_enable(struct uart_port *port, int enabled) | ||
90 | { | ||
91 | if(enabled) | ||
92 | port->unused[0] |= 2; | ||
93 | else | ||
94 | port->unused[0] &= ~2; | ||
95 | } | ||
96 | |||
97 | static inline void tx_enable(struct uart_port *port, int enabled) | ||
98 | { | ||
99 | if(enabled) | ||
100 | port->unused[0] |= 1; | ||
101 | else | ||
102 | port->unused[0] &= ~1; | ||
103 | } | ||
68 | 104 | ||
69 | 105 | ||
70 | #ifdef SUPPORT_SYSRQ | 106 | #ifdef SUPPORT_SYSRQ |
@@ -75,7 +111,7 @@ static void ks8695uart_stop_tx(struct uart_port *port) | |||
75 | { | 111 | { |
76 | if (tx_enabled(port)) { | 112 | if (tx_enabled(port)) { |
77 | disable_irq(KS8695_IRQ_UART_TX); | 113 | disable_irq(KS8695_IRQ_UART_TX); |
78 | tx_enabled(port) = 0; | 114 | tx_enable(port, 0); |
79 | } | 115 | } |
80 | } | 116 | } |
81 | 117 | ||
@@ -83,7 +119,7 @@ static void ks8695uart_start_tx(struct uart_port *port) | |||
83 | { | 119 | { |
84 | if (!tx_enabled(port)) { | 120 | if (!tx_enabled(port)) { |
85 | enable_irq(KS8695_IRQ_UART_TX); | 121 | enable_irq(KS8695_IRQ_UART_TX); |
86 | tx_enabled(port) = 1; | 122 | tx_enable(port, 1); |
87 | } | 123 | } |
88 | } | 124 | } |
89 | 125 | ||
@@ -91,24 +127,30 @@ static void ks8695uart_stop_rx(struct uart_port *port) | |||
91 | { | 127 | { |
92 | if (rx_enabled(port)) { | 128 | if (rx_enabled(port)) { |
93 | disable_irq(KS8695_IRQ_UART_RX); | 129 | disable_irq(KS8695_IRQ_UART_RX); |
94 | rx_enabled(port) = 0; | 130 | rx_enable(port, 0); |
95 | } | 131 | } |
96 | } | 132 | } |
97 | 133 | ||
98 | static void ks8695uart_enable_ms(struct uart_port *port) | 134 | static void ks8695uart_enable_ms(struct uart_port *port) |
99 | { | 135 | { |
100 | enable_irq(KS8695_IRQ_UART_MODEM_STATUS); | 136 | if (!ms_enabled(port)) { |
137 | enable_irq(KS8695_IRQ_UART_MODEM_STATUS); | ||
138 | ms_enable(port,1); | ||
139 | } | ||
101 | } | 140 | } |
102 | 141 | ||
103 | static void ks8695uart_disable_ms(struct uart_port *port) | 142 | static void ks8695uart_disable_ms(struct uart_port *port) |
104 | { | 143 | { |
105 | disable_irq(KS8695_IRQ_UART_MODEM_STATUS); | 144 | if (ms_enabled(port)) { |
145 | disable_irq(KS8695_IRQ_UART_MODEM_STATUS); | ||
146 | ms_enable(port,0); | ||
147 | } | ||
106 | } | 148 | } |
107 | 149 | ||
108 | static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) | 150 | static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) |
109 | { | 151 | { |
110 | struct uart_port *port = dev_id; | 152 | struct uart_port *port = dev_id; |
111 | struct tty_struct *tty = port->info->tty; | 153 | struct tty_struct *tty = port->info->port.tty; |
112 | unsigned int status, ch, lsr, flg, max_count = 256; | 154 | unsigned int status, ch, lsr, flg, max_count = 256; |
113 | 155 | ||
114 | status = UART_GET_LSR(port); /* clears pending LSR interrupts */ | 156 | status = UART_GET_LSR(port); /* clears pending LSR interrupts */ |
@@ -285,8 +327,9 @@ static int ks8695uart_startup(struct uart_port *port) | |||
285 | int retval; | 327 | int retval; |
286 | 328 | ||
287 | set_irq_flags(KS8695_IRQ_UART_TX, IRQF_VALID | IRQF_NOAUTOEN); | 329 | set_irq_flags(KS8695_IRQ_UART_TX, IRQF_VALID | IRQF_NOAUTOEN); |
288 | tx_enabled(port) = 0; | 330 | tx_enable(port, 0); |
289 | rx_enabled(port) = 1; | 331 | rx_enable(port, 1); |
332 | ms_enable(port, 1); | ||
290 | 333 | ||
291 | /* | 334 | /* |
292 | * Allocate the IRQ | 335 | * Allocate the IRQ |
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c index eb18d429752d..61dc8b3daa26 100644 --- a/drivers/serial/serial_lh7a40x.c +++ b/drivers/serial/serial_lh7a40x.c | |||
@@ -137,7 +137,7 @@ static void lh7a40xuart_enable_ms (struct uart_port* port) | |||
137 | 137 | ||
138 | static void lh7a40xuart_rx_chars (struct uart_port* port) | 138 | static void lh7a40xuart_rx_chars (struct uart_port* port) |
139 | { | 139 | { |
140 | struct tty_struct* tty = port->info->tty; | 140 | struct tty_struct* tty = port->info->port.tty; |
141 | int cbRxMax = 256; /* (Gross) limit on receive */ | 141 | int cbRxMax = 256; /* (Gross) limit on receive */ |
142 | unsigned int data; /* Received data and status */ | 142 | unsigned int data; /* Received data and status */ |
143 | unsigned int flag; | 143 | unsigned int flag; |
@@ -460,7 +460,7 @@ static int lh7a40xuart_verify_port (struct uart_port* port, | |||
460 | 460 | ||
461 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_LH7A40X) | 461 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_LH7A40X) |
462 | ret = -EINVAL; | 462 | ret = -EINVAL; |
463 | if (ser->irq < 0 || ser->irq >= NR_IRQS) | 463 | if (ser->irq < 0 || ser->irq >= nr_irqs) |
464 | ret = -EINVAL; | 464 | ret = -EINVAL; |
465 | if (ser->baud_base < 9600) /* *** FIXME: is this true? */ | 465 | if (ser->baud_base < 9600) /* *** FIXME: is this true? */ |
466 | ret = -EINVAL; | 466 | ret = -EINVAL; |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 7ad21925869a..7313c2edcb83 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
@@ -272,7 +272,7 @@ static void serial_txx9_initialize(struct uart_port *port) | |||
272 | static inline void | 272 | static inline void |
273 | receive_chars(struct uart_txx9_port *up, unsigned int *status) | 273 | receive_chars(struct uart_txx9_port *up, unsigned int *status) |
274 | { | 274 | { |
275 | struct tty_struct *tty = up->port.info->tty; | 275 | struct tty_struct *tty = up->port.info->port.tty; |
276 | unsigned char ch; | 276 | unsigned char ch; |
277 | unsigned int disr = *status; | 277 | unsigned int disr = *status; |
278 | int max_count = 256; | 278 | int max_count = 256; |
@@ -1039,7 +1039,7 @@ static int __devinit serial_txx9_probe(struct platform_device *dev) | |||
1039 | ret = serial_txx9_register_port(&port); | 1039 | ret = serial_txx9_register_port(&port); |
1040 | if (ret < 0) { | 1040 | if (ret < 0) { |
1041 | dev_err(&dev->dev, "unable to register port at index %d " | 1041 | dev_err(&dev->dev, "unable to register port at index %d " |
1042 | "(IO%x MEM%llx IRQ%d): %d\n", i, | 1042 | "(IO%lx MEM%llx IRQ%d): %d\n", i, |
1043 | p->iobase, (unsigned long long)p->mapbase, | 1043 | p->iobase, (unsigned long long)p->mapbase, |
1044 | p->irq, ret); | 1044 | p->irq, ret); |
1045 | } | 1045 | } |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index ce6ee92b3a1b..f0658d2c45b2 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) | 4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) |
5 | * | 5 | * |
6 | * Copyright (C) 2002 - 2006 Paul Mundt | 6 | * Copyright (C) 2002 - 2008 Paul Mundt |
7 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). | 7 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). |
8 | * | 8 | * |
9 | * based off of the old drivers/char/sh-sci.c by: | 9 | * based off of the old drivers/char/sh-sci.c by: |
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/cpufreq.h> | 46 | #include <linux/cpufreq.h> |
47 | #include <linux/clk.h> | 47 | #include <linux/clk.h> |
48 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
49 | #include <linux/err.h> | ||
49 | 50 | ||
50 | #ifdef CONFIG_SUPERH | 51 | #ifdef CONFIG_SUPERH |
51 | #include <asm/clock.h> | 52 | #include <asm/clock.h> |
@@ -78,7 +79,7 @@ struct sci_port { | |||
78 | struct timer_list break_timer; | 79 | struct timer_list break_timer; |
79 | int break_flag; | 80 | int break_flag; |
80 | 81 | ||
81 | #ifdef CONFIG_SUPERH | 82 | #ifdef CONFIG_HAVE_CLK |
82 | /* Port clock */ | 83 | /* Port clock */ |
83 | struct clk *clk; | 84 | struct clk *clk; |
84 | #endif | 85 | #endif |
@@ -410,7 +411,6 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | |||
410 | #endif | 411 | #endif |
411 | 412 | ||
412 | #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ | 413 | #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ |
413 | defined(CONFIG_CPU_SUBTYPE_SH7763) || \ | ||
414 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | 414 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ |
415 | defined(CONFIG_CPU_SUBTYPE_SH7785) | 415 | defined(CONFIG_CPU_SUBTYPE_SH7785) |
416 | static inline int scif_txroom(struct uart_port *port) | 416 | static inline int scif_txroom(struct uart_port *port) |
@@ -422,6 +422,22 @@ static inline int scif_rxroom(struct uart_port *port) | |||
422 | { | 422 | { |
423 | return sci_in(port, SCRFDR) & 0xff; | 423 | return sci_in(port, SCRFDR) & 0xff; |
424 | } | 424 | } |
425 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | ||
426 | static inline int scif_txroom(struct uart_port *port) | ||
427 | { | ||
428 | if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/ | ||
429 | return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff); | ||
430 | else /* SCIF2 */ | ||
431 | return SCIF2_TXROOM_MAX - (sci_in(port, SCFDR) >> 8); | ||
432 | } | ||
433 | |||
434 | static inline int scif_rxroom(struct uart_port *port) | ||
435 | { | ||
436 | if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/ | ||
437 | return sci_in(port, SCRFDR) & 0xff; | ||
438 | else /* SCIF2 */ | ||
439 | return sci_in(port, SCFDR) & SCIF2_RFDC_MASK; | ||
440 | } | ||
425 | #else | 441 | #else |
426 | static inline int scif_txroom(struct uart_port *port) | 442 | static inline int scif_txroom(struct uart_port *port) |
427 | { | 443 | { |
@@ -521,7 +537,7 @@ static void sci_transmit_chars(struct uart_port *port) | |||
521 | static inline void sci_receive_chars(struct uart_port *port) | 537 | static inline void sci_receive_chars(struct uart_port *port) |
522 | { | 538 | { |
523 | struct sci_port *sci_port = (struct sci_port *)port; | 539 | struct sci_port *sci_port = (struct sci_port *)port; |
524 | struct tty_struct *tty = port->info->tty; | 540 | struct tty_struct *tty = port->info->port.tty; |
525 | int i, count, copied = 0; | 541 | int i, count, copied = 0; |
526 | unsigned short status; | 542 | unsigned short status; |
527 | unsigned char flag; | 543 | unsigned char flag; |
@@ -642,7 +658,7 @@ static inline int sci_handle_errors(struct uart_port *port) | |||
642 | { | 658 | { |
643 | int copied = 0; | 659 | int copied = 0; |
644 | unsigned short status = sci_in(port, SCxSR); | 660 | unsigned short status = sci_in(port, SCxSR); |
645 | struct tty_struct *tty = port->info->tty; | 661 | struct tty_struct *tty = port->info->port.tty; |
646 | 662 | ||
647 | if (status & SCxSR_ORER(port)) { | 663 | if (status & SCxSR_ORER(port)) { |
648 | /* overrun error */ | 664 | /* overrun error */ |
@@ -692,7 +708,7 @@ static inline int sci_handle_breaks(struct uart_port *port) | |||
692 | { | 708 | { |
693 | int copied = 0; | 709 | int copied = 0; |
694 | unsigned short status = sci_in(port, SCxSR); | 710 | unsigned short status = sci_in(port, SCxSR); |
695 | struct tty_struct *tty = port->info->tty; | 711 | struct tty_struct *tty = port->info->port.tty; |
696 | struct sci_port *s = &sci_ports[port->line]; | 712 | struct sci_port *s = &sci_ports[port->line]; |
697 | 713 | ||
698 | if (uart_handle_break(port)) | 714 | if (uart_handle_break(port)) |
@@ -762,7 +778,7 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr) | |||
762 | } else { | 778 | } else { |
763 | #if defined(SCIF_ORER) | 779 | #if defined(SCIF_ORER) |
764 | if((sci_in(port, SCLSR) & SCIF_ORER) != 0) { | 780 | if((sci_in(port, SCLSR) & SCIF_ORER) != 0) { |
765 | struct tty_struct *tty = port->info->tty; | 781 | struct tty_struct *tty = port->info->port.tty; |
766 | 782 | ||
767 | sci_out(port, SCLSR, 0); | 783 | sci_out(port, SCLSR, 0); |
768 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 784 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
@@ -816,7 +832,7 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | |||
816 | return IRQ_HANDLED; | 832 | return IRQ_HANDLED; |
817 | } | 833 | } |
818 | 834 | ||
819 | #ifdef CONFIG_CPU_FREQ | 835 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) |
820 | /* | 836 | /* |
821 | * Here we define a transistion notifier so that we can update all of our | 837 | * Here we define a transistion notifier so that we can update all of our |
822 | * ports' baud rate when the peripheral clock changes. | 838 | * ports' baud rate when the peripheral clock changes. |
@@ -845,7 +861,7 @@ static int sci_notifier(struct notifier_block *self, | |||
845 | * Clean this up later.. | 861 | * Clean this up later.. |
846 | */ | 862 | */ |
847 | clk = clk_get(NULL, "module_clk"); | 863 | clk = clk_get(NULL, "module_clk"); |
848 | port->uartclk = clk_get_rate(clk) * 16; | 864 | port->uartclk = clk_get_rate(clk); |
849 | clk_put(clk); | 865 | clk_put(clk); |
850 | } | 866 | } |
851 | 867 | ||
@@ -858,7 +874,7 @@ static int sci_notifier(struct notifier_block *self, | |||
858 | } | 874 | } |
859 | 875 | ||
860 | static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 }; | 876 | static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 }; |
861 | #endif /* CONFIG_CPU_FREQ */ | 877 | #endif /* CONFIG_CPU_FREQ && CONFIG_HAVE_CLK */ |
862 | 878 | ||
863 | static int sci_request_irq(struct sci_port *port) | 879 | static int sci_request_irq(struct sci_port *port) |
864 | { | 880 | { |
@@ -993,7 +1009,7 @@ static int sci_startup(struct uart_port *port) | |||
993 | if (s->enable) | 1009 | if (s->enable) |
994 | s->enable(port); | 1010 | s->enable(port); |
995 | 1011 | ||
996 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 1012 | #ifdef CONFIG_HAVE_CLK |
997 | s->clk = clk_get(NULL, "module_clk"); | 1013 | s->clk = clk_get(NULL, "module_clk"); |
998 | #endif | 1014 | #endif |
999 | 1015 | ||
@@ -1015,7 +1031,7 @@ static void sci_shutdown(struct uart_port *port) | |||
1015 | if (s->disable) | 1031 | if (s->disable) |
1016 | s->disable(port); | 1032 | s->disable(port); |
1017 | 1033 | ||
1018 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 1034 | #ifdef CONFIG_HAVE_CLK |
1019 | clk_put(s->clk); | 1035 | clk_put(s->clk); |
1020 | s->clk = NULL; | 1036 | s->clk = NULL; |
1021 | #endif | 1037 | #endif |
@@ -1026,24 +1042,11 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1026 | { | 1042 | { |
1027 | struct sci_port *s = &sci_ports[port->line]; | 1043 | struct sci_port *s = &sci_ports[port->line]; |
1028 | unsigned int status, baud, smr_val; | 1044 | unsigned int status, baud, smr_val; |
1029 | int t; | 1045 | int t = -1; |
1030 | 1046 | ||
1031 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); | 1047 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); |
1032 | 1048 | if (likely(baud)) | |
1033 | switch (baud) { | 1049 | t = SCBRR_VALUE(baud, port->uartclk); |
1034 | case 0: | ||
1035 | t = -1; | ||
1036 | break; | ||
1037 | default: | ||
1038 | { | ||
1039 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | ||
1040 | t = SCBRR_VALUE(baud, clk_get_rate(s->clk)); | ||
1041 | #else | ||
1042 | t = SCBRR_VALUE(baud); | ||
1043 | #endif | ||
1044 | break; | ||
1045 | } | ||
1046 | } | ||
1047 | 1050 | ||
1048 | do { | 1051 | do { |
1049 | status = sci_in(port, SCxSR); | 1052 | status = sci_in(port, SCxSR); |
@@ -1098,7 +1101,7 @@ static const char *sci_type(struct uart_port *port) | |||
1098 | case PORT_IRDA: return "irda"; | 1101 | case PORT_IRDA: return "irda"; |
1099 | } | 1102 | } |
1100 | 1103 | ||
1101 | return 0; | 1104 | return NULL; |
1102 | } | 1105 | } |
1103 | 1106 | ||
1104 | static void sci_release_port(struct uart_port *port) | 1107 | static void sci_release_port(struct uart_port *port) |
@@ -1130,19 +1133,23 @@ static void sci_config_port(struct uart_port *port, int flags) | |||
1130 | break; | 1133 | break; |
1131 | } | 1134 | } |
1132 | 1135 | ||
1133 | #if defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 1136 | if (port->flags & UPF_IOREMAP && !port->membase) { |
1134 | if (port->mapbase == 0) | 1137 | #if defined(CONFIG_SUPERH64) |
1135 | port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); | 1138 | port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); |
1136 | 1139 | port->membase = (void __iomem *)port->mapbase; | |
1137 | port->membase = (void __iomem *)port->mapbase; | 1140 | #else |
1141 | port->membase = ioremap_nocache(port->mapbase, 0x40); | ||
1138 | #endif | 1142 | #endif |
1143 | |||
1144 | printk(KERN_ERR "sci: can't remap port#%d\n", port->line); | ||
1145 | } | ||
1139 | } | 1146 | } |
1140 | 1147 | ||
1141 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) | 1148 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) |
1142 | { | 1149 | { |
1143 | struct sci_port *s = &sci_ports[port->line]; | 1150 | struct sci_port *s = &sci_ports[port->line]; |
1144 | 1151 | ||
1145 | if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq > NR_IRQS) | 1152 | if (ser->irq != s->irqs[SCIx_TXI_IRQ] || ser->irq > nr_irqs) |
1146 | return -EINVAL; | 1153 | return -EINVAL; |
1147 | if (ser->baud_base < 2400) | 1154 | if (ser->baud_base < 2400) |
1148 | /* No paper tape reader for Mitch.. */ | 1155 | /* No paper tape reader for Mitch.. */ |
@@ -1192,17 +1199,17 @@ static void __init sci_init_ports(void) | |||
1192 | sci_ports[i].disable = h8300_sci_disable; | 1199 | sci_ports[i].disable = h8300_sci_disable; |
1193 | #endif | 1200 | #endif |
1194 | sci_ports[i].port.uartclk = CONFIG_CPU_CLOCK; | 1201 | sci_ports[i].port.uartclk = CONFIG_CPU_CLOCK; |
1195 | #elif defined(CONFIG_SUPERH64) | 1202 | #elif defined(CONFIG_HAVE_CLK) |
1196 | sci_ports[i].port.uartclk = current_cpu_data.module_clock * 16; | ||
1197 | #else | ||
1198 | /* | 1203 | /* |
1199 | * XXX: We should use a proper SCI/SCIF clock | 1204 | * XXX: We should use a proper SCI/SCIF clock |
1200 | */ | 1205 | */ |
1201 | { | 1206 | { |
1202 | struct clk *clk = clk_get(NULL, "module_clk"); | 1207 | struct clk *clk = clk_get(NULL, "module_clk"); |
1203 | sci_ports[i].port.uartclk = clk_get_rate(clk) * 16; | 1208 | sci_ports[i].port.uartclk = clk_get_rate(clk); |
1204 | clk_put(clk); | 1209 | clk_put(clk); |
1205 | } | 1210 | } |
1211 | #else | ||
1212 | #error "Need a valid uartclk" | ||
1206 | #endif | 1213 | #endif |
1207 | 1214 | ||
1208 | sci_ports[i].break_timer.data = (unsigned long)&sci_ports[i]; | 1215 | sci_ports[i].break_timer.data = (unsigned long)&sci_ports[i]; |
@@ -1270,7 +1277,7 @@ static int __init serial_console_setup(struct console *co, char *options) | |||
1270 | 1277 | ||
1271 | port->type = serial_console_port->type; | 1278 | port->type = serial_console_port->type; |
1272 | 1279 | ||
1273 | #if defined(CONFIG_SUPERH) && !defined(CONFIG_SUPERH64) | 1280 | #ifdef CONFIG_HAVE_CLK |
1274 | if (!serial_console_port->clk) | 1281 | if (!serial_console_port->clk) |
1275 | serial_console_port->clk = clk_get(NULL, "module_clk"); | 1282 | serial_console_port->clk = clk_get(NULL, "module_clk"); |
1276 | #endif | 1283 | #endif |
@@ -1421,7 +1428,7 @@ static struct uart_driver sci_uart_driver = { | |||
1421 | static int __devinit sci_probe(struct platform_device *dev) | 1428 | static int __devinit sci_probe(struct platform_device *dev) |
1422 | { | 1429 | { |
1423 | struct plat_sci_port *p = dev->dev.platform_data; | 1430 | struct plat_sci_port *p = dev->dev.platform_data; |
1424 | int i; | 1431 | int i, ret = -EINVAL; |
1425 | 1432 | ||
1426 | for (i = 0; p && p->flags != 0; p++, i++) { | 1433 | for (i = 0; p && p->flags != 0; p++, i++) { |
1427 | struct sci_port *sciport = &sci_ports[i]; | 1434 | struct sci_port *sciport = &sci_ports[i]; |
@@ -1438,12 +1445,22 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
1438 | 1445 | ||
1439 | sciport->port.mapbase = p->mapbase; | 1446 | sciport->port.mapbase = p->mapbase; |
1440 | 1447 | ||
1441 | /* | 1448 | if (p->mapbase && !p->membase) { |
1442 | * For the simple (and majority of) cases where we don't need | 1449 | if (p->flags & UPF_IOREMAP) { |
1443 | * to do any remapping, just cast the cookie directly. | 1450 | p->membase = ioremap_nocache(p->mapbase, 0x40); |
1444 | */ | 1451 | if (IS_ERR(p->membase)) { |
1445 | if (p->mapbase && !p->membase && !(p->flags & UPF_IOREMAP)) | 1452 | ret = PTR_ERR(p->membase); |
1446 | p->membase = (void __iomem *)p->mapbase; | 1453 | goto err_unreg; |
1454 | } | ||
1455 | } else { | ||
1456 | /* | ||
1457 | * For the simple (and majority of) cases | ||
1458 | * where we don't need to do any remapping, | ||
1459 | * just cast the cookie directly. | ||
1460 | */ | ||
1461 | p->membase = (void __iomem *)p->mapbase; | ||
1462 | } | ||
1463 | } | ||
1447 | 1464 | ||
1448 | sciport->port.membase = p->membase; | 1465 | sciport->port.membase = p->membase; |
1449 | 1466 | ||
@@ -1464,7 +1481,7 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
1464 | kgdb_putchar = kgdb_sci_putchar; | 1481 | kgdb_putchar = kgdb_sci_putchar; |
1465 | #endif | 1482 | #endif |
1466 | 1483 | ||
1467 | #ifdef CONFIG_CPU_FREQ | 1484 | #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK) |
1468 | cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); | 1485 | cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER); |
1469 | dev_info(&dev->dev, "CPU frequency notifier registered\n"); | 1486 | dev_info(&dev->dev, "CPU frequency notifier registered\n"); |
1470 | #endif | 1487 | #endif |
@@ -1474,6 +1491,12 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
1474 | #endif | 1491 | #endif |
1475 | 1492 | ||
1476 | return 0; | 1493 | return 0; |
1494 | |||
1495 | err_unreg: | ||
1496 | for (i = i - 1; i >= 0; i--) | ||
1497 | uart_remove_one_port(&sci_uart_driver, &sci_ports[i].port); | ||
1498 | |||
1499 | return ret; | ||
1477 | } | 1500 | } |
1478 | 1501 | ||
1479 | static int __devexit sci_remove(struct platform_device *dev) | 1502 | static int __devexit sci_remove(struct platform_device *dev) |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index eb84833233fd..7cd28b226800 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -123,8 +123,9 @@ | |||
123 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 123 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) |
124 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ | 124 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ |
125 | # define SCSPTR1 0xffe08024 /* 16 bit SCIF */ | 125 | # define SCSPTR1 0xffe08024 /* 16 bit SCIF */ |
126 | # define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */ | ||
126 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 127 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
127 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 128 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
128 | # define SCIF_ONLY | 129 | # define SCIF_ONLY |
129 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) | 130 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) |
130 | # define SCSPTR0 0xff923020 /* 16 bit SCIF */ | 131 | # define SCSPTR0 0xff923020 /* 16 bit SCIF */ |
@@ -188,6 +189,7 @@ | |||
188 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ | 189 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ |
189 | defined(CONFIG_CPU_SUBTYPE_SH7751) || \ | 190 | defined(CONFIG_CPU_SUBTYPE_SH7751) || \ |
190 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ | 191 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ |
192 | defined(CONFIG_CPU_SUBTYPE_SH7763) || \ | ||
191 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | 193 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ |
192 | defined(CONFIG_CPU_SUBTYPE_SH7785) || \ | 194 | defined(CONFIG_CPU_SUBTYPE_SH7785) || \ |
193 | defined(CONFIG_CPU_SUBTYPE_SHX3) | 195 | defined(CONFIG_CPU_SUBTYPE_SHX3) |
@@ -225,14 +227,21 @@ | |||
225 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 227 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
226 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 228 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
227 | defined(CONFIG_CPU_SUBTYPE_SH7721) | 229 | defined(CONFIG_CPU_SUBTYPE_SH7721) |
228 | #define SCIF_ORER 0x0200 | 230 | # define SCIF_ORER 0x0200 |
229 | #define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) | 231 | # define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) |
230 | #define SCIF_RFDC_MASK 0x007f | 232 | # define SCIF_RFDC_MASK 0x007f |
231 | #define SCIF_TXROOM_MAX 64 | 233 | # define SCIF_TXROOM_MAX 64 |
234 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | ||
235 | # define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK ) | ||
236 | # define SCIF_RFDC_MASK 0x007f | ||
237 | # define SCIF_TXROOM_MAX 64 | ||
238 | /* SH7763 SCIF2 support */ | ||
239 | # define SCIF2_RFDC_MASK 0x001f | ||
240 | # define SCIF2_TXROOM_MAX 16 | ||
232 | #else | 241 | #else |
233 | #define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) | 242 | # define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) |
234 | #define SCIF_RFDC_MASK 0x001f | 243 | # define SCIF_RFDC_MASK 0x001f |
235 | #define SCIF_TXROOM_MAX 16 | 244 | # define SCIF_TXROOM_MAX 16 |
236 | #endif | 245 | #endif |
237 | 246 | ||
238 | #if defined(SCI_ONLY) | 247 | #if defined(SCI_ONLY) |
@@ -311,18 +320,16 @@ | |||
311 | #define SCI_EVENT_WRITE_WAKEUP 0 | 320 | #define SCI_EVENT_WRITE_WAKEUP 0 |
312 | 321 | ||
313 | #define SCI_IN(size, offset) \ | 322 | #define SCI_IN(size, offset) \ |
314 | unsigned int addr = port->mapbase + (offset); \ | ||
315 | if ((size) == 8) { \ | 323 | if ((size) == 8) { \ |
316 | return ctrl_inb(addr); \ | 324 | return ioread8(port->membase + (offset)); \ |
317 | } else { \ | 325 | } else { \ |
318 | return ctrl_inw(addr); \ | 326 | return ioread16(port->membase + (offset)); \ |
319 | } | 327 | } |
320 | #define SCI_OUT(size, offset, value) \ | 328 | #define SCI_OUT(size, offset, value) \ |
321 | unsigned int addr = port->mapbase + (offset); \ | ||
322 | if ((size) == 8) { \ | 329 | if ((size) == 8) { \ |
323 | ctrl_outb(value, addr); \ | 330 | iowrite8(value, port->membase + (offset)); \ |
324 | } else if ((size) == 16) { \ | 331 | } else if ((size) == 16) { \ |
325 | ctrl_outw(value, addr); \ | 332 | iowrite16(value, port->membase + (offset)); \ |
326 | } | 333 | } |
327 | 334 | ||
328 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ | 335 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ |
@@ -442,7 +449,6 @@ SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8) | |||
442 | SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8) | 449 | SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8) |
443 | SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16) | 450 | SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16) |
444 | #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ | 451 | #if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ |
445 | defined(CONFIG_CPU_SUBTYPE_SH7763) || \ | ||
446 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | 452 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ |
447 | defined(CONFIG_CPU_SUBTYPE_SH7785) | 453 | defined(CONFIG_CPU_SUBTYPE_SH7785) |
448 | SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) | 454 | SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) |
@@ -450,6 +456,14 @@ SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16) | |||
450 | SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) | 456 | SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) |
451 | SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) | 457 | SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) |
452 | SCIF_FNS(SCLSR, 0, 0, 0x28, 16) | 458 | SCIF_FNS(SCLSR, 0, 0, 0x28, 16) |
459 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | ||
460 | SCIF_FNS(SCFDR, 0, 0, 0x1C, 16) | ||
461 | SCIF_FNS(SCSPTR2, 0, 0, 0x20, 16) | ||
462 | SCIF_FNS(SCLSR2, 0, 0, 0x24, 16) | ||
463 | SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16) | ||
464 | SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) | ||
465 | SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) | ||
466 | SCIF_FNS(SCLSR, 0, 0, 0x28, 16) | ||
453 | #else | 467 | #else |
454 | SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) | 468 | SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) |
455 | #if defined(CONFIG_CPU_SUBTYPE_SH7722) | 469 | #if defined(CONFIG_CPU_SUBTYPE_SH7722) |
@@ -652,6 +666,9 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
652 | return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ | 666 | return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ |
653 | if (port->mapbase == 0xffe08000) | 667 | if (port->mapbase == 0xffe08000) |
654 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ | 668 | return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ |
669 | if (port->mapbase == 0xffe10000) | ||
670 | return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF/IRDA */ | ||
671 | |||
655 | return 1; | 672 | return 1; |
656 | } | 673 | } |
657 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) | 674 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) |
@@ -764,8 +781,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
764 | * -- Mitch Davis - 15 Jul 2000 | 781 | * -- Mitch Davis - 15 Jul 2000 |
765 | */ | 782 | */ |
766 | 783 | ||
767 | #if defined(CONFIG_CPU_SUBTYPE_SH7763) || \ | 784 | #if defined(CONFIG_CPU_SUBTYPE_SH7780) || \ |
768 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | ||
769 | defined(CONFIG_CPU_SUBTYPE_SH7785) | 785 | defined(CONFIG_CPU_SUBTYPE_SH7785) |
770 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) | 786 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) |
771 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | 787 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ |
@@ -773,11 +789,16 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
773 | defined(CONFIG_CPU_SUBTYPE_SH7721) | 789 | defined(CONFIG_CPU_SUBTYPE_SH7721) |
774 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) | 790 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) |
775 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | 791 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) |
776 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(16*bps)-1) | 792 | static inline int scbrr_calc(struct uart_port *port, int bps, int clk) |
793 | { | ||
794 | if (port->type == PORT_SCIF) | ||
795 | return (clk+16*bps)/(32*bps)-1; | ||
796 | else | ||
797 | return ((clk*2)+16*bps)/(16*bps)-1; | ||
798 | } | ||
799 | #define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk) | ||
777 | #elif defined(__H8300H__) || defined(__H8300S__) | 800 | #elif defined(__H8300H__) || defined(__H8300S__) |
778 | #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) | 801 | #define SCBRR_VALUE(bps, clk) (((clk*1000/32)/bps)-1) |
779 | #elif defined(CONFIG_SUPERH64) | ||
780 | #define SCBRR_VALUE(bps) ((current_cpu_data.module_clock+16*bps)/(32*bps)-1) | ||
781 | #else /* Generic SH */ | 802 | #else /* Generic SH */ |
782 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1) | 803 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1) |
783 | #endif | 804 | #endif |
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c index 019da2e05f0b..d5276c012f78 100644 --- a/drivers/serial/sn_console.c +++ b/drivers/serial/sn_console.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #define SN_SAL_BUFFER_SIZE (64 * (1 << 10)) | 61 | #define SN_SAL_BUFFER_SIZE (64 * (1 << 10)) |
62 | 62 | ||
63 | #define SN_SAL_UART_FIFO_DEPTH 16 | 63 | #define SN_SAL_UART_FIFO_DEPTH 16 |
64 | #define SN_SAL_UART_FIFO_SPEED_CPS 9600/10 | 64 | #define SN_SAL_UART_FIFO_SPEED_CPS (9600/10) |
65 | 65 | ||
66 | /* sn_transmit_chars() calling args */ | 66 | /* sn_transmit_chars() calling args */ |
67 | #define TRANSMIT_BUFFERED 0 | 67 | #define TRANSMIT_BUFFERED 0 |
@@ -471,7 +471,7 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags) | |||
471 | 471 | ||
472 | if (port->sc_port.info) { | 472 | if (port->sc_port.info) { |
473 | /* The serial_core stuffs are initilized, use them */ | 473 | /* The serial_core stuffs are initilized, use them */ |
474 | tty = port->sc_port.info->tty; | 474 | tty = port->sc_port.info->port.tty; |
475 | } | 475 | } |
476 | else { | 476 | else { |
477 | /* Not registered yet - can't pass to tty layer. */ | 477 | /* Not registered yet - can't pass to tty layer. */ |
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index 2847336742d7..a94a2ab4b571 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c | |||
@@ -17,11 +17,11 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/of_device.h> | ||
20 | 21 | ||
21 | #include <asm/hypervisor.h> | 22 | #include <asm/hypervisor.h> |
22 | #include <asm/spitfire.h> | 23 | #include <asm/spitfire.h> |
23 | #include <asm/prom.h> | 24 | #include <asm/prom.h> |
24 | #include <asm/of_device.h> | ||
25 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
26 | 26 | ||
27 | #if defined(CONFIG_MAGIC_SYSRQ) | 27 | #if defined(CONFIG_MAGIC_SYSRQ) |
@@ -185,7 +185,7 @@ static struct tty_struct *receive_chars(struct uart_port *port) | |||
185 | struct tty_struct *tty = NULL; | 185 | struct tty_struct *tty = NULL; |
186 | 186 | ||
187 | if (port->info != NULL) /* Unopened serial console */ | 187 | if (port->info != NULL) /* Unopened serial console */ |
188 | tty = port->info->tty; | 188 | tty = port->info->port.tty; |
189 | 189 | ||
190 | if (sunhv_ops->receive_chars(port, tty)) | 190 | if (sunhv_ops->receive_chars(port, tty)) |
191 | sun_do_break(); | 191 | sun_do_break(); |
@@ -616,7 +616,7 @@ static int __devexit hv_remove(struct of_device *dev) | |||
616 | return 0; | 616 | return 0; |
617 | } | 617 | } |
618 | 618 | ||
619 | static struct of_device_id hv_match[] = { | 619 | static const struct of_device_id hv_match[] = { |
620 | { | 620 | { |
621 | .name = "console", | 621 | .name = "console", |
622 | .compatible = "qcn", | 622 | .compatible = "qcn", |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 9ff5b38f3bee..0355efe115d9 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -32,11 +32,11 @@ | |||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/of_device.h> | ||
35 | 36 | ||
36 | #include <asm/io.h> | 37 | #include <asm/io.h> |
37 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
38 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
39 | #include <asm/of_device.h> | ||
40 | 40 | ||
41 | #if defined(CONFIG_SERIAL_SUNSAB_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 41 | #if defined(CONFIG_SERIAL_SUNSAB_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
42 | #define SUPPORT_SYSRQ | 42 | #define SUPPORT_SYSRQ |
@@ -118,7 +118,7 @@ receive_chars(struct uart_sunsab_port *up, | |||
118 | int i; | 118 | int i; |
119 | 119 | ||
120 | if (up->port.info != NULL) /* Unopened serial console */ | 120 | if (up->port.info != NULL) /* Unopened serial console */ |
121 | tty = up->port.info->tty; | 121 | tty = up->port.info->port.tty; |
122 | 122 | ||
123 | /* Read number of BYTES (Character + Status) available. */ | 123 | /* Read number of BYTES (Character + Status) available. */ |
124 | if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { | 124 | if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { |
@@ -1078,7 +1078,7 @@ static int __devexit sab_remove(struct of_device *op) | |||
1078 | return 0; | 1078 | return 0; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | static struct of_device_id sab_match[] = { | 1081 | static const struct of_device_id sab_match[] = { |
1082 | { | 1082 | { |
1083 | .name = "se", | 1083 | .name = "se", |
1084 | }, | 1084 | }, |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 03806a935209..a4dc79b1d7ab 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: su.c,v 1.55 2002/01/08 16:00:16 davem Exp $ | 1 | /* |
2 | * su.c: Small serial driver for keyboard/mouse interface on sparc32/PCI | 2 | * su.c: Small serial driver for keyboard/mouse interface on sparc32/PCI |
3 | * | 3 | * |
4 | * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) | 4 | * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) |
@@ -35,11 +35,11 @@ | |||
35 | #include <linux/serial_reg.h> | 35 | #include <linux/serial_reg.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/of_device.h> | ||
38 | 39 | ||
39 | #include <asm/io.h> | 40 | #include <asm/io.h> |
40 | #include <asm/irq.h> | 41 | #include <asm/irq.h> |
41 | #include <asm/prom.h> | 42 | #include <asm/prom.h> |
42 | #include <asm/of_device.h> | ||
43 | 43 | ||
44 | #if defined(CONFIG_SERIAL_SUNSU_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 44 | #if defined(CONFIG_SERIAL_SUNSU_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
45 | #define SUPPORT_SYSRQ | 45 | #define SUPPORT_SYSRQ |
@@ -311,7 +311,7 @@ static void sunsu_enable_ms(struct uart_port *port) | |||
311 | static struct tty_struct * | 311 | static struct tty_struct * |
312 | receive_chars(struct uart_sunsu_port *up, unsigned char *status) | 312 | receive_chars(struct uart_sunsu_port *up, unsigned char *status) |
313 | { | 313 | { |
314 | struct tty_struct *tty = up->port.info->tty; | 314 | struct tty_struct *tty = up->port.info->port.tty; |
315 | unsigned char ch, flag; | 315 | unsigned char ch, flag; |
316 | int max_count = 256; | 316 | int max_count = 256; |
317 | int saw_console_brk = 0; | 317 | int saw_console_brk = 0; |
@@ -1506,7 +1506,7 @@ static int __devexit su_remove(struct of_device *op) | |||
1506 | return 0; | 1506 | return 0; |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | static struct of_device_id su_match[] = { | 1509 | static const struct of_device_id su_match[] = { |
1510 | { | 1510 | { |
1511 | .name = "su", | 1511 | .name = "su", |
1512 | }, | 1512 | }, |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 7e9fa5ef0eb7..45a299f35617 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -32,11 +32,11 @@ | |||
32 | #include <linux/serio.h> | 32 | #include <linux/serio.h> |
33 | #endif | 33 | #endif |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/of_device.h> | ||
35 | 36 | ||
36 | #include <asm/io.h> | 37 | #include <asm/io.h> |
37 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
38 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
39 | #include <asm/of_device.h> | ||
40 | 40 | ||
41 | #if defined(CONFIG_SERIAL_SUNZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | 41 | #if defined(CONFIG_SERIAL_SUNZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) |
42 | #define SUPPORT_SYSRQ | 42 | #define SUPPORT_SYSRQ |
@@ -329,8 +329,8 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
329 | 329 | ||
330 | tty = NULL; | 330 | tty = NULL; |
331 | if (up->port.info != NULL && /* Unopened serial console */ | 331 | if (up->port.info != NULL && /* Unopened serial console */ |
332 | up->port.info->tty != NULL) /* Keyboard || mouse */ | 332 | up->port.info->port.tty != NULL) /* Keyboard || mouse */ |
333 | tty = up->port.info->tty; | 333 | tty = up->port.info->port.tty; |
334 | 334 | ||
335 | for (;;) { | 335 | for (;;) { |
336 | 336 | ||
@@ -1480,7 +1480,7 @@ static int __devexit zs_remove(struct of_device *op) | |||
1480 | return 0; | 1480 | return 0; |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | static struct of_device_id zs_match[] = { | 1483 | static const struct of_device_id zs_match[] = { |
1484 | { | 1484 | { |
1485 | .name = "zs", | 1485 | .name = "zs", |
1486 | }, | 1486 | }, |
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c index b51c24245be4..6a3f8fb0c9dd 100644 --- a/drivers/serial/uartlite.c +++ b/drivers/serial/uartlite.c | |||
@@ -75,7 +75,7 @@ static struct uart_port ulite_ports[ULITE_NR_UARTS]; | |||
75 | 75 | ||
76 | static int ulite_receive(struct uart_port *port, int stat) | 76 | static int ulite_receive(struct uart_port *port, int stat) |
77 | { | 77 | { |
78 | struct tty_struct *tty = port->info->tty; | 78 | struct tty_struct *tty = port->info->port.tty; |
79 | unsigned char ch = 0; | 79 | unsigned char ch = 0; |
80 | char flag = TTY_NORMAL; | 80 | char flag = TTY_NORMAL; |
81 | 81 | ||
@@ -162,7 +162,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id) | |||
162 | busy |= ulite_transmit(port, stat); | 162 | busy |= ulite_transmit(port, stat); |
163 | } while (busy); | 163 | } while (busy); |
164 | 164 | ||
165 | tty_flip_buffer_push(port->info->tty); | 165 | tty_flip_buffer_push(port->info->port.tty); |
166 | 166 | ||
167 | return IRQ_HANDLED; | 167 | return IRQ_HANDLED; |
168 | } | 168 | } |
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c index 566a8b42e05a..315a9333ca3c 100644 --- a/drivers/serial/ucc_uart.c +++ b/drivers/serial/ucc_uart.c | |||
@@ -466,7 +466,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port) | |||
466 | int i; | 466 | int i; |
467 | unsigned char ch, *cp; | 467 | unsigned char ch, *cp; |
468 | struct uart_port *port = &qe_port->port; | 468 | struct uart_port *port = &qe_port->port; |
469 | struct tty_struct *tty = port->info->tty; | 469 | struct tty_struct *tty = port->info->port.tty; |
470 | struct qe_bd *bdp; | 470 | struct qe_bd *bdp; |
471 | u16 status; | 471 | u16 status; |
472 | unsigned int flg; | 472 | unsigned int flg; |
@@ -1009,7 +1009,7 @@ static int qe_uart_request_port(struct uart_port *port) | |||
1009 | rx_size = L1_CACHE_ALIGN(qe_port->rx_nrfifos * qe_port->rx_fifosize); | 1009 | rx_size = L1_CACHE_ALIGN(qe_port->rx_nrfifos * qe_port->rx_fifosize); |
1010 | tx_size = L1_CACHE_ALIGN(qe_port->tx_nrfifos * qe_port->tx_fifosize); | 1010 | tx_size = L1_CACHE_ALIGN(qe_port->tx_nrfifos * qe_port->tx_fifosize); |
1011 | 1011 | ||
1012 | bd_virt = dma_alloc_coherent(NULL, rx_size + tx_size, &bd_dma_addr, | 1012 | bd_virt = dma_alloc_coherent(port->dev, rx_size + tx_size, &bd_dma_addr, |
1013 | GFP_KERNEL); | 1013 | GFP_KERNEL); |
1014 | if (!bd_virt) { | 1014 | if (!bd_virt) { |
1015 | dev_err(port->dev, "could not allocate buffer descriptors\n"); | 1015 | dev_err(port->dev, "could not allocate buffer descriptors\n"); |
@@ -1051,7 +1051,7 @@ static void qe_uart_release_port(struct uart_port *port) | |||
1051 | container_of(port, struct uart_qe_port, port); | 1051 | container_of(port, struct uart_qe_port, port); |
1052 | struct ucc_slow_private *uccs = qe_port->us_private; | 1052 | struct ucc_slow_private *uccs = qe_port->us_private; |
1053 | 1053 | ||
1054 | dma_free_coherent(NULL, qe_port->bd_size, qe_port->bd_virt, | 1054 | dma_free_coherent(port->dev, qe_port->bd_size, qe_port->bd_virt, |
1055 | qe_port->bd_dma_addr); | 1055 | qe_port->bd_dma_addr); |
1056 | 1056 | ||
1057 | ucc_slow_free(uccs); | 1057 | ucc_slow_free(uccs); |
@@ -1066,7 +1066,7 @@ static int qe_uart_verify_port(struct uart_port *port, | |||
1066 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM) | 1066 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_CPM) |
1067 | return -EINVAL; | 1067 | return -EINVAL; |
1068 | 1068 | ||
1069 | if (ser->irq < 0 || ser->irq >= NR_IRQS) | 1069 | if (ser->irq < 0 || ser->irq >= nr_irqs) |
1070 | return -EINVAL; | 1070 | return -EINVAL; |
1071 | 1071 | ||
1072 | if (ser->baud_base < 9600) | 1072 | if (ser->baud_base < 9600) |
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c deleted file mode 100644 index dd98aca6ed08..000000000000 --- a/drivers/serial/v850e_uart.c +++ /dev/null | |||
@@ -1,548 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/serial/v850e_uart.c -- Serial I/O using V850E on-chip UART or UARTB | ||
3 | * | ||
4 | * Copyright (C) 2001,02,03 NEC Electronics Corporation | ||
5 | * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General | ||
8 | * Public License. See the file COPYING in the main directory of this | ||
9 | * archive for more details. | ||
10 | * | ||
11 | * Written by Miles Bader <miles@gnu.org> | ||
12 | */ | ||
13 | |||
14 | /* This driver supports both the original V850E UART interface (called | ||
15 | merely `UART' in the docs) and the newer `UARTB' interface, which is | ||
16 | roughly a superset of the first one. The selection is made at | ||
17 | configure time -- if CONFIG_V850E_UARTB is defined, then UARTB is | ||
18 | presumed, otherwise the old UART -- as these are on-CPU UARTS, a system | ||
19 | can never have both. | ||
20 | |||
21 | The UARTB interface also has a 16-entry FIFO mode, which is not | ||
22 | yet supported by this driver. */ | ||
23 | |||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/module.h> | ||
27 | #include <linux/console.h> | ||
28 | #include <linux/tty.h> | ||
29 | #include <linux/tty_flip.h> | ||
30 | #include <linux/serial.h> | ||
31 | #include <linux/serial_core.h> | ||
32 | |||
33 | #include <asm/v850e_uart.h> | ||
34 | |||
35 | /* Initial UART state. This may be overridden by machine-dependent headers. */ | ||
36 | #ifndef V850E_UART_INIT_BAUD | ||
37 | #define V850E_UART_INIT_BAUD 115200 | ||
38 | #endif | ||
39 | #ifndef V850E_UART_INIT_CFLAGS | ||
40 | #define V850E_UART_INIT_CFLAGS (B115200 | CS8 | CREAD) | ||
41 | #endif | ||
42 | |||
43 | /* A string used for prefixing printed descriptions; since the same UART | ||
44 | macro is actually used on other chips than the V850E. This must be a | ||
45 | constant string. */ | ||
46 | #ifndef V850E_UART_CHIP_NAME | ||
47 | #define V850E_UART_CHIP_NAME "V850E" | ||
48 | #endif | ||
49 | |||
50 | #define V850E_UART_MINOR_BASE 64 /* First tty minor number */ | ||
51 | |||
52 | |||
53 | /* Low-level UART functions. */ | ||
54 | |||
55 | /* Configure and turn on uart channel CHAN, using the termios `control | ||
56 | modes' bits in CFLAGS, and a baud-rate of BAUD. */ | ||
57 | void v850e_uart_configure (unsigned chan, unsigned cflags, unsigned baud) | ||
58 | { | ||
59 | int flags; | ||
60 | v850e_uart_speed_t old_speed; | ||
61 | v850e_uart_config_t old_config; | ||
62 | v850e_uart_speed_t new_speed = v850e_uart_calc_speed (baud); | ||
63 | v850e_uart_config_t new_config = v850e_uart_calc_config (cflags); | ||
64 | |||
65 | /* Disable interrupts while we're twiddling the hardware. */ | ||
66 | local_irq_save (flags); | ||
67 | |||
68 | #ifdef V850E_UART_PRE_CONFIGURE | ||
69 | V850E_UART_PRE_CONFIGURE (chan, cflags, baud); | ||
70 | #endif | ||
71 | |||
72 | old_config = V850E_UART_CONFIG (chan); | ||
73 | old_speed = v850e_uart_speed (chan); | ||
74 | |||
75 | if (! v850e_uart_speed_eq (old_speed, new_speed)) { | ||
76 | /* The baud rate has changed. First, disable the UART. */ | ||
77 | V850E_UART_CONFIG (chan) = V850E_UART_CONFIG_FINI; | ||
78 | old_config = 0; /* Force the uart to be re-initialized. */ | ||
79 | |||
80 | /* Reprogram the baud-rate generator. */ | ||
81 | v850e_uart_set_speed (chan, new_speed); | ||
82 | } | ||
83 | |||
84 | if (! (old_config & V850E_UART_CONFIG_ENABLED)) { | ||
85 | /* If we are using the uart for the first time, start by | ||
86 | enabling it, which must be done before turning on any | ||
87 | other bits. */ | ||
88 | V850E_UART_CONFIG (chan) = V850E_UART_CONFIG_INIT; | ||
89 | /* See the initial state. */ | ||
90 | old_config = V850E_UART_CONFIG (chan); | ||
91 | } | ||
92 | |||
93 | if (new_config != old_config) { | ||
94 | /* Which of the TXE/RXE bits we'll temporarily turn off | ||
95 | before changing other control bits. */ | ||
96 | unsigned temp_disable = 0; | ||
97 | /* Which of the TXE/RXE bits will be enabled. */ | ||
98 | unsigned enable = 0; | ||
99 | unsigned changed_bits = new_config ^ old_config; | ||
100 | |||
101 | /* Which of RX/TX will be enabled in the new configuration. */ | ||
102 | if (new_config & V850E_UART_CONFIG_RX_BITS) | ||
103 | enable |= (new_config & V850E_UART_CONFIG_RX_ENABLE); | ||
104 | if (new_config & V850E_UART_CONFIG_TX_BITS) | ||
105 | enable |= (new_config & V850E_UART_CONFIG_TX_ENABLE); | ||
106 | |||
107 | /* Figure out which of RX/TX needs to be disabled; note | ||
108 | that this will only happen if they're not already | ||
109 | disabled. */ | ||
110 | if (changed_bits & V850E_UART_CONFIG_RX_BITS) | ||
111 | temp_disable | ||
112 | |= (old_config & V850E_UART_CONFIG_RX_ENABLE); | ||
113 | if (changed_bits & V850E_UART_CONFIG_TX_BITS) | ||
114 | temp_disable | ||
115 | |= (old_config & V850E_UART_CONFIG_TX_ENABLE); | ||
116 | |||
117 | /* We have to turn off RX and/or TX mode before changing | ||
118 | any associated control bits. */ | ||
119 | if (temp_disable) | ||
120 | V850E_UART_CONFIG (chan) = old_config & ~temp_disable; | ||
121 | |||
122 | /* Write the new control bits, while RX/TX are disabled. */ | ||
123 | if (changed_bits & ~enable) | ||
124 | V850E_UART_CONFIG (chan) = new_config & ~enable; | ||
125 | |||
126 | v850e_uart_config_delay (new_config, new_speed); | ||
127 | |||
128 | /* Write the final version, with enable bits turned on. */ | ||
129 | V850E_UART_CONFIG (chan) = new_config; | ||
130 | } | ||
131 | |||
132 | local_irq_restore (flags); | ||
133 | } | ||
134 | |||
135 | |||
136 | /* Low-level console. */ | ||
137 | |||
138 | #ifdef CONFIG_V850E_UART_CONSOLE | ||
139 | |||
140 | static void v850e_uart_cons_write (struct console *co, | ||
141 | const char *s, unsigned count) | ||
142 | { | ||
143 | if (count > 0) { | ||
144 | unsigned chan = co->index; | ||
145 | unsigned irq = V850E_UART_TX_IRQ (chan); | ||
146 | int irq_was_enabled, irq_was_pending, flags; | ||
147 | |||
148 | /* We don't want to get `transmission completed' | ||
149 | interrupts, since we're busy-waiting, so we disable them | ||
150 | while sending (we don't disable interrupts entirely | ||
151 | because sending over a serial line is really slow). We | ||
152 | save the status of the tx interrupt and restore it when | ||
153 | we're done so that using printk doesn't interfere with | ||
154 | normal serial transmission (other than interleaving the | ||
155 | output, of course!). This should work correctly even if | ||
156 | this function is interrupted and the interrupt printks | ||
157 | something. */ | ||
158 | |||
159 | /* Disable interrupts while fiddling with tx interrupt. */ | ||
160 | local_irq_save (flags); | ||
161 | /* Get current tx interrupt status. */ | ||
162 | irq_was_enabled = v850e_intc_irq_enabled (irq); | ||
163 | irq_was_pending = v850e_intc_irq_pending (irq); | ||
164 | /* Disable tx interrupt if necessary. */ | ||
165 | if (irq_was_enabled) | ||
166 | v850e_intc_disable_irq (irq); | ||
167 | /* Turn interrupts back on. */ | ||
168 | local_irq_restore (flags); | ||
169 | |||
170 | /* Send characters. */ | ||
171 | while (count > 0) { | ||
172 | int ch = *s++; | ||
173 | |||
174 | if (ch == '\n') { | ||
175 | /* We don't have the benefit of a tty | ||
176 | driver, so translate NL into CR LF. */ | ||
177 | v850e_uart_wait_for_xmit_ok (chan); | ||
178 | v850e_uart_putc (chan, '\r'); | ||
179 | } | ||
180 | |||
181 | v850e_uart_wait_for_xmit_ok (chan); | ||
182 | v850e_uart_putc (chan, ch); | ||
183 | |||
184 | count--; | ||
185 | } | ||
186 | |||
187 | /* Restore saved tx interrupt status. */ | ||
188 | if (irq_was_enabled) { | ||
189 | /* Wait for the last character we sent to be | ||
190 | completely transmitted (as we'll get an | ||
191 | interrupt interrupt at that point). */ | ||
192 | v850e_uart_wait_for_xmit_done (chan); | ||
193 | /* Clear pending interrupts received due | ||
194 | to our transmission, unless there was already | ||
195 | one pending, in which case we want the | ||
196 | handler to be called. */ | ||
197 | if (! irq_was_pending) | ||
198 | v850e_intc_clear_pending_irq (irq); | ||
199 | /* ... and then turn back on handling. */ | ||
200 | v850e_intc_enable_irq (irq); | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | |||
205 | extern struct uart_driver v850e_uart_driver; | ||
206 | static struct console v850e_uart_cons = | ||
207 | { | ||
208 | .name = "ttyS", | ||
209 | .write = v850e_uart_cons_write, | ||
210 | .device = uart_console_device, | ||
211 | .flags = CON_PRINTBUFFER, | ||
212 | .cflag = V850E_UART_INIT_CFLAGS, | ||
213 | .index = -1, | ||
214 | .data = &v850e_uart_driver, | ||
215 | }; | ||
216 | |||
217 | void v850e_uart_cons_init (unsigned chan) | ||
218 | { | ||
219 | v850e_uart_configure (chan, V850E_UART_INIT_CFLAGS, | ||
220 | V850E_UART_INIT_BAUD); | ||
221 | v850e_uart_cons.index = chan; | ||
222 | register_console (&v850e_uart_cons); | ||
223 | printk ("Console: %s on-chip UART channel %d\n", | ||
224 | V850E_UART_CHIP_NAME, chan); | ||
225 | } | ||
226 | |||
227 | /* This is what the init code actually calls. */ | ||
228 | static int v850e_uart_console_init (void) | ||
229 | { | ||
230 | v850e_uart_cons_init (V850E_UART_CONSOLE_CHANNEL); | ||
231 | return 0; | ||
232 | } | ||
233 | console_initcall(v850e_uart_console_init); | ||
234 | |||
235 | #define V850E_UART_CONSOLE &v850e_uart_cons | ||
236 | |||
237 | #else /* !CONFIG_V850E_UART_CONSOLE */ | ||
238 | #define V850E_UART_CONSOLE 0 | ||
239 | #endif /* CONFIG_V850E_UART_CONSOLE */ | ||
240 | |||
241 | /* TX/RX interrupt handlers. */ | ||
242 | |||
243 | static void v850e_uart_stop_tx (struct uart_port *port); | ||
244 | |||
245 | void v850e_uart_tx (struct uart_port *port) | ||
246 | { | ||
247 | struct circ_buf *xmit = &port->info->xmit; | ||
248 | int stopped = uart_tx_stopped (port); | ||
249 | |||
250 | if (v850e_uart_xmit_ok (port->line)) { | ||
251 | int tx_ch; | ||
252 | |||
253 | if (port->x_char) { | ||
254 | tx_ch = port->x_char; | ||
255 | port->x_char = 0; | ||
256 | } else if (!uart_circ_empty (xmit) && !stopped) { | ||
257 | tx_ch = xmit->buf[xmit->tail]; | ||
258 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | ||
259 | } else | ||
260 | goto no_xmit; | ||
261 | |||
262 | v850e_uart_putc (port->line, tx_ch); | ||
263 | port->icount.tx++; | ||
264 | |||
265 | if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS) | ||
266 | uart_write_wakeup (port); | ||
267 | } | ||
268 | |||
269 | no_xmit: | ||
270 | if (uart_circ_empty (xmit) || stopped) | ||
271 | v850e_uart_stop_tx (port, stopped); | ||
272 | } | ||
273 | |||
274 | static irqreturn_t v850e_uart_tx_irq(int irq, void *data) | ||
275 | { | ||
276 | struct uart_port *port = data; | ||
277 | v850e_uart_tx (port); | ||
278 | return IRQ_HANDLED; | ||
279 | } | ||
280 | |||
281 | static irqreturn_t v850e_uart_rx_irq(int irq, void *data) | ||
282 | { | ||
283 | struct uart_port *port = data; | ||
284 | unsigned ch_stat = TTY_NORMAL; | ||
285 | unsigned ch = v850e_uart_getc (port->line); | ||
286 | unsigned err = v850e_uart_err (port->line); | ||
287 | |||
288 | if (err) { | ||
289 | if (err & V850E_UART_ERR_OVERRUN) { | ||
290 | ch_stat = TTY_OVERRUN; | ||
291 | port->icount.overrun++; | ||
292 | } else if (err & V850E_UART_ERR_FRAME) { | ||
293 | ch_stat = TTY_FRAME; | ||
294 | port->icount.frame++; | ||
295 | } else if (err & V850E_UART_ERR_PARITY) { | ||
296 | ch_stat = TTY_PARITY; | ||
297 | port->icount.parity++; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | port->icount.rx++; | ||
302 | |||
303 | tty_insert_flip_char (port->info->tty, ch, ch_stat); | ||
304 | tty_schedule_flip (port->info->tty); | ||
305 | |||
306 | return IRQ_HANDLED; | ||
307 | } | ||
308 | |||
309 | |||
310 | /* Control functions for the serial framework. */ | ||
311 | |||
312 | static void v850e_uart_nop (struct uart_port *port) { } | ||
313 | static int v850e_uart_success (struct uart_port *port) { return 0; } | ||
314 | |||
315 | static unsigned v850e_uart_tx_empty (struct uart_port *port) | ||
316 | { | ||
317 | return TIOCSER_TEMT; /* Can't detect. */ | ||
318 | } | ||
319 | |||
320 | static void v850e_uart_set_mctrl (struct uart_port *port, unsigned mctrl) | ||
321 | { | ||
322 | #ifdef V850E_UART_SET_RTS | ||
323 | V850E_UART_SET_RTS (port->line, (mctrl & TIOCM_RTS)); | ||
324 | #endif | ||
325 | } | ||
326 | |||
327 | static unsigned v850e_uart_get_mctrl (struct uart_port *port) | ||
328 | { | ||
329 | /* We don't support DCD or DSR, so consider them permanently active. */ | ||
330 | int mctrl = TIOCM_CAR | TIOCM_DSR; | ||
331 | |||
332 | /* We may support CTS. */ | ||
333 | #ifdef V850E_UART_CTS | ||
334 | mctrl |= V850E_UART_CTS(port->line) ? TIOCM_CTS : 0; | ||
335 | #else | ||
336 | mctrl |= TIOCM_CTS; | ||
337 | #endif | ||
338 | |||
339 | return mctrl; | ||
340 | } | ||
341 | |||
342 | static void v850e_uart_start_tx (struct uart_port *port) | ||
343 | { | ||
344 | v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line)); | ||
345 | v850e_uart_tx (port); | ||
346 | v850e_intc_enable_irq (V850E_UART_TX_IRQ (port->line)); | ||
347 | } | ||
348 | |||
349 | static void v850e_uart_stop_tx (struct uart_port *port) | ||
350 | { | ||
351 | v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line)); | ||
352 | } | ||
353 | |||
354 | static void v850e_uart_start_rx (struct uart_port *port) | ||
355 | { | ||
356 | v850e_intc_enable_irq (V850E_UART_RX_IRQ (port->line)); | ||
357 | } | ||
358 | |||
359 | static void v850e_uart_stop_rx (struct uart_port *port) | ||
360 | { | ||
361 | v850e_intc_disable_irq (V850E_UART_RX_IRQ (port->line)); | ||
362 | } | ||
363 | |||
364 | static void v850e_uart_break_ctl (struct uart_port *port, int break_ctl) | ||
365 | { | ||
366 | /* Umm, do this later. */ | ||
367 | } | ||
368 | |||
369 | static int v850e_uart_startup (struct uart_port *port) | ||
370 | { | ||
371 | int err; | ||
372 | |||
373 | /* Alloc RX irq. */ | ||
374 | err = request_irq (V850E_UART_RX_IRQ (port->line), v850e_uart_rx_irq, | ||
375 | IRQF_DISABLED, "v850e_uart", port); | ||
376 | if (err) | ||
377 | return err; | ||
378 | |||
379 | /* Alloc TX irq. */ | ||
380 | err = request_irq (V850E_UART_TX_IRQ (port->line), v850e_uart_tx_irq, | ||
381 | IRQF_DISABLED, "v850e_uart", port); | ||
382 | if (err) { | ||
383 | free_irq (V850E_UART_RX_IRQ (port->line), port); | ||
384 | return err; | ||
385 | } | ||
386 | |||
387 | v850e_uart_start_rx (port); | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static void v850e_uart_shutdown (struct uart_port *port) | ||
393 | { | ||
394 | /* Disable port interrupts. */ | ||
395 | free_irq (V850E_UART_TX_IRQ (port->line), port); | ||
396 | free_irq (V850E_UART_RX_IRQ (port->line), port); | ||
397 | |||
398 | /* Turn off xmit/recv enable bits. */ | ||
399 | V850E_UART_CONFIG (port->line) | ||
400 | &= ~(V850E_UART_CONFIG_TX_ENABLE | ||
401 | | V850E_UART_CONFIG_RX_ENABLE); | ||
402 | /* Then reset the channel. */ | ||
403 | V850E_UART_CONFIG (port->line) = 0; | ||
404 | } | ||
405 | |||
406 | static void | ||
407 | v850e_uart_set_termios (struct uart_port *port, struct ktermios *termios, | ||
408 | struct ktermios *old) | ||
409 | { | ||
410 | unsigned cflags = termios->c_cflag; | ||
411 | |||
412 | /* Restrict flags to legal values. */ | ||
413 | if ((cflags & CSIZE) != CS7 && (cflags & CSIZE) != CS8) | ||
414 | /* The new value of CSIZE is invalid, use the old value. */ | ||
415 | cflags = (cflags & ~CSIZE) | ||
416 | | (old ? (old->c_cflag & CSIZE) : CS8); | ||
417 | |||
418 | termios->c_cflag = cflags; | ||
419 | |||
420 | v850e_uart_configure (port->line, cflags, | ||
421 | uart_get_baud_rate (port, termios, old, | ||
422 | v850e_uart_min_baud(), | ||
423 | v850e_uart_max_baud())); | ||
424 | } | ||
425 | |||
426 | static const char *v850e_uart_type (struct uart_port *port) | ||
427 | { | ||
428 | return port->type == PORT_V850E_UART ? "v850e_uart" : 0; | ||
429 | } | ||
430 | |||
431 | static void v850e_uart_config_port (struct uart_port *port, int flags) | ||
432 | { | ||
433 | if (flags & UART_CONFIG_TYPE) | ||
434 | port->type = PORT_V850E_UART; | ||
435 | } | ||
436 | |||
437 | static int | ||
438 | v850e_uart_verify_port (struct uart_port *port, struct serial_struct *ser) | ||
439 | { | ||
440 | if (ser->type != PORT_UNKNOWN && ser->type != PORT_V850E_UART) | ||
441 | return -EINVAL; | ||
442 | if (ser->irq != V850E_UART_TX_IRQ (port->line)) | ||
443 | return -EINVAL; | ||
444 | return 0; | ||
445 | } | ||
446 | |||
447 | static struct uart_ops v850e_uart_ops = { | ||
448 | .tx_empty = v850e_uart_tx_empty, | ||
449 | .get_mctrl = v850e_uart_get_mctrl, | ||
450 | .set_mctrl = v850e_uart_set_mctrl, | ||
451 | .start_tx = v850e_uart_start_tx, | ||
452 | .stop_tx = v850e_uart_stop_tx, | ||
453 | .stop_rx = v850e_uart_stop_rx, | ||
454 | .enable_ms = v850e_uart_nop, | ||
455 | .break_ctl = v850e_uart_break_ctl, | ||
456 | .startup = v850e_uart_startup, | ||
457 | .shutdown = v850e_uart_shutdown, | ||
458 | .set_termios = v850e_uart_set_termios, | ||
459 | .type = v850e_uart_type, | ||
460 | .release_port = v850e_uart_nop, | ||
461 | .request_port = v850e_uart_success, | ||
462 | .config_port = v850e_uart_config_port, | ||
463 | .verify_port = v850e_uart_verify_port, | ||
464 | }; | ||
465 | |||
466 | /* Initialization and cleanup. */ | ||
467 | |||
468 | static struct uart_driver v850e_uart_driver = { | ||
469 | .owner = THIS_MODULE, | ||
470 | .driver_name = "v850e_uart", | ||
471 | .dev_name = "ttyS", | ||
472 | .major = TTY_MAJOR, | ||
473 | .minor = V850E_UART_MINOR_BASE, | ||
474 | .nr = V850E_UART_NUM_CHANNELS, | ||
475 | .cons = V850E_UART_CONSOLE, | ||
476 | }; | ||
477 | |||
478 | |||
479 | static struct uart_port v850e_uart_ports[V850E_UART_NUM_CHANNELS]; | ||
480 | |||
481 | static int __init v850e_uart_init (void) | ||
482 | { | ||
483 | int rval; | ||
484 | |||
485 | printk (KERN_INFO "%s on-chip UART\n", V850E_UART_CHIP_NAME); | ||
486 | |||
487 | rval = uart_register_driver (&v850e_uart_driver); | ||
488 | if (rval == 0) { | ||
489 | unsigned chan; | ||
490 | |||
491 | for (chan = 0; chan < V850E_UART_NUM_CHANNELS; chan++) { | ||
492 | struct uart_port *port = &v850e_uart_ports[chan]; | ||
493 | |||
494 | memset (port, 0, sizeof *port); | ||
495 | |||
496 | port->ops = &v850e_uart_ops; | ||
497 | port->line = chan; | ||
498 | port->iotype = UPIO_MEM; | ||
499 | port->flags = UPF_BOOT_AUTOCONF; | ||
500 | |||
501 | /* We actually use multiple IRQs, but the serial | ||
502 | framework seems to mainly use this for | ||
503 | informational purposes anyway. Here we use the TX | ||
504 | irq. */ | ||
505 | port->irq = V850E_UART_TX_IRQ (chan); | ||
506 | |||
507 | /* The serial framework doesn't really use these | ||
508 | membase/mapbase fields for anything useful, but | ||
509 | it requires that they be something non-zero to | ||
510 | consider the port `valid', and also uses them | ||
511 | for informational purposes. */ | ||
512 | port->membase = (void *)V850E_UART_BASE_ADDR (chan); | ||
513 | port->mapbase = V850E_UART_BASE_ADDR (chan); | ||
514 | |||
515 | /* The framework insists on knowing the uart's master | ||
516 | clock freq, though it doesn't seem to do anything | ||
517 | useful for us with it. We must make it at least | ||
518 | higher than (the maximum baud rate * 16), otherwise | ||
519 | the framework will puke during its internal | ||
520 | calculations, and force the baud rate to be 9600. | ||
521 | To be accurate though, just repeat the calculation | ||
522 | we use when actually setting the speed. */ | ||
523 | port->uartclk = v850e_uart_max_clock() * 16; | ||
524 | |||
525 | uart_add_one_port (&v850e_uart_driver, port); | ||
526 | } | ||
527 | } | ||
528 | |||
529 | return rval; | ||
530 | } | ||
531 | |||
532 | static void __exit v850e_uart_exit (void) | ||
533 | { | ||
534 | unsigned chan; | ||
535 | |||
536 | for (chan = 0; chan < V850E_UART_NUM_CHANNELS; chan++) | ||
537 | uart_remove_one_port (&v850e_uart_driver, | ||
538 | &v850e_uart_ports[chan]); | ||
539 | |||
540 | uart_unregister_driver (&v850e_uart_driver); | ||
541 | } | ||
542 | |||
543 | module_init (v850e_uart_init); | ||
544 | module_exit (v850e_uart_exit); | ||
545 | |||
546 | MODULE_AUTHOR ("Miles Bader"); | ||
547 | MODULE_DESCRIPTION ("NEC " V850E_UART_CHIP_NAME " on-chip UART"); | ||
548 | MODULE_LICENSE ("GPL"); | ||
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index bb6ce6bba32f..0573f3b5175e 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -318,7 +318,7 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status) | |||
318 | char flag; | 318 | char flag; |
319 | int max_count = RX_MAX_COUNT; | 319 | int max_count = RX_MAX_COUNT; |
320 | 320 | ||
321 | tty = port->info->tty; | 321 | tty = port->info->port.tty; |
322 | lsr = *status; | 322 | lsr = *status; |
323 | 323 | ||
324 | do { | 324 | do { |
diff --git a/drivers/serial/zs.c b/drivers/serial/zs.c index 65f1294fd27b..9e6a873f8203 100644 --- a/drivers/serial/zs.c +++ b/drivers/serial/zs.c | |||
@@ -602,7 +602,7 @@ static void zs_receive_chars(struct zs_port *zport) | |||
602 | uart_insert_char(uport, status, Rx_OVR, ch, flag); | 602 | uart_insert_char(uport, status, Rx_OVR, ch, flag); |
603 | } | 603 | } |
604 | 604 | ||
605 | tty_flip_buffer_push(uport->info->tty); | 605 | tty_flip_buffer_push(uport->info->port.tty); |
606 | } | 606 | } |
607 | 607 | ||
608 | static void zs_raw_transmit_chars(struct zs_port *zport) | 608 | static void zs_raw_transmit_chars(struct zs_port *zport) |
@@ -787,7 +787,6 @@ static int zs_startup(struct uart_port *uport) | |||
787 | zport->regs[1] &= ~RxINT_MASK; | 787 | zport->regs[1] &= ~RxINT_MASK; |
788 | zport->regs[1] |= RxINT_ALL | TxINT_ENAB | EXT_INT_ENAB; | 788 | zport->regs[1] |= RxINT_ALL | TxINT_ENAB | EXT_INT_ENAB; |
789 | zport->regs[3] |= RxENABLE; | 789 | zport->regs[3] |= RxENABLE; |
790 | zport->regs[5] |= TxENAB; | ||
791 | zport->regs[15] |= BRKIE; | 790 | zport->regs[15] |= BRKIE; |
792 | write_zsreg(zport, R1, zport->regs[1]); | 791 | write_zsreg(zport, R1, zport->regs[1]); |
793 | write_zsreg(zport, R3, zport->regs[3]); | 792 | write_zsreg(zport, R3, zport->regs[3]); |
@@ -814,7 +813,6 @@ static void zs_shutdown(struct uart_port *uport) | |||
814 | 813 | ||
815 | spin_lock_irqsave(&scc->zlock, flags); | 814 | spin_lock_irqsave(&scc->zlock, flags); |
816 | 815 | ||
817 | zport->regs[5] &= ~TxENAB; | ||
818 | zport->regs[3] &= ~RxENABLE; | 816 | zport->regs[3] &= ~RxENABLE; |
819 | write_zsreg(zport, R5, zport->regs[5]); | 817 | write_zsreg(zport, R5, zport->regs[5]); |
820 | write_zsreg(zport, R3, zport->regs[3]); | 818 | write_zsreg(zport, R3, zport->regs[3]); |
@@ -959,6 +957,23 @@ static void zs_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
959 | spin_unlock_irqrestore(&scc->zlock, flags); | 957 | spin_unlock_irqrestore(&scc->zlock, flags); |
960 | } | 958 | } |
961 | 959 | ||
960 | /* | ||
961 | * Hack alert! | ||
962 | * Required solely so that the initial PROM-based console | ||
963 | * works undisturbed in parallel with this one. | ||
964 | */ | ||
965 | static void zs_pm(struct uart_port *uport, unsigned int state, | ||
966 | unsigned int oldstate) | ||
967 | { | ||
968 | struct zs_port *zport = to_zport(uport); | ||
969 | |||
970 | if (state < 3) | ||
971 | zport->regs[5] |= TxENAB; | ||
972 | else | ||
973 | zport->regs[5] &= ~TxENAB; | ||
974 | write_zsreg(zport, R5, zport->regs[5]); | ||
975 | } | ||
976 | |||
962 | 977 | ||
963 | static const char *zs_type(struct uart_port *uport) | 978 | static const char *zs_type(struct uart_port *uport) |
964 | { | 979 | { |
@@ -1041,6 +1056,7 @@ static struct uart_ops zs_ops = { | |||
1041 | .startup = zs_startup, | 1056 | .startup = zs_startup, |
1042 | .shutdown = zs_shutdown, | 1057 | .shutdown = zs_shutdown, |
1043 | .set_termios = zs_set_termios, | 1058 | .set_termios = zs_set_termios, |
1059 | .pm = zs_pm, | ||
1044 | .type = zs_type, | 1060 | .type = zs_type, |
1045 | .release_port = zs_release_port, | 1061 | .release_port = zs_release_port, |
1046 | .request_port = zs_request_port, | 1062 | .request_port = zs_request_port, |
@@ -1190,6 +1206,7 @@ static int __init zs_console_setup(struct console *co, char *options) | |||
1190 | return ret; | 1206 | return ret; |
1191 | 1207 | ||
1192 | zs_reset(zport); | 1208 | zs_reset(zport); |
1209 | zs_pm(uport, 0, -1); | ||
1193 | 1210 | ||
1194 | if (options) | 1211 | if (options) |
1195 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 1212 | uart_parse_options(options, &baud, &parity, &bits, &flow); |