aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/ser_a2232.c52
-rw-r--r--drivers/char/vme_scc.c59
2 files changed, 56 insertions, 55 deletions
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c
index 4ba3aec9e1cd..7b0c35207d9b 100644
--- a/drivers/char/ser_a2232.c
+++ b/drivers/char/ser_a2232.c
@@ -192,7 +192,7 @@ static inline void a2232_receive_char(struct a2232_port *port, int ch, int err)
192 Maybe one could implement a more efficient version by not only 192 Maybe one could implement a more efficient version by not only
193 transferring one character at a time. 193 transferring one character at a time.
194*/ 194*/
195 struct tty_struct *tty = port->gs.tty; 195 struct tty_struct *tty = port->gs.port.tty;
196 196
197#if 0 197#if 0
198 switch(err) { 198 switch(err) {
@@ -226,7 +226,7 @@ static void a2232_disable_tx_interrupts(void *ptr)
226 226
227 /* Does this here really have to be? */ 227 /* Does this here really have to be? */
228 local_irq_save(flags); 228 local_irq_save(flags);
229 port->gs.flags &= ~GS_TX_INTEN; 229 port->gs.port.flags &= ~GS_TX_INTEN;
230 local_irq_restore(flags); 230 local_irq_restore(flags);
231} 231}
232 232
@@ -242,7 +242,7 @@ static void a2232_enable_tx_interrupts(void *ptr)
242 242
243 /* Does this here really have to be? */ 243 /* Does this here really have to be? */
244 local_irq_save(flags); 244 local_irq_save(flags);
245 port->gs.flags |= GS_TX_INTEN; 245 port->gs.port.flags |= GS_TX_INTEN;
246 local_irq_restore(flags); 246 local_irq_restore(flags);
247} 247}
248 248
@@ -276,9 +276,9 @@ static void a2232_shutdown_port(void *ptr)
276 276
277 local_irq_save(flags); 277 local_irq_save(flags);
278 278
279 port->gs.flags &= ~GS_ACTIVE; 279 port->gs.port.flags &= ~GS_ACTIVE;
280 280
281 if (port->gs.tty && port->gs.tty->termios->c_cflag & HUPCL) { 281 if (port->gs.port.tty && port->gs.port.tty->termios->c_cflag & HUPCL) {
282 /* Set DTR and RTS to Low, flush output. 282 /* Set DTR and RTS to Low, flush output.
283 The NetBSD driver "msc.c" does it this way. */ 283 The NetBSD driver "msc.c" does it this way. */
284 stat->Command = ( (stat->Command & ~A2232CMD_CMask) | 284 stat->Command = ( (stat->Command & ~A2232CMD_CMask) |
@@ -309,7 +309,7 @@ static int a2232_set_real_termios(void *ptr)
309 volatile struct a2232status *status; 309 volatile struct a2232status *status;
310 volatile struct a2232memory *mem; 310 volatile struct a2232memory *mem;
311 311
312 if (!port->gs.tty || !port->gs.tty->termios) return 0; 312 if (!port->gs.port.tty || !port->gs.port.tty->termios) return 0;
313 313
314 status = a2232stat(port->which_a2232, port->which_port_on_a2232); 314 status = a2232stat(port->which_a2232, port->which_port_on_a2232);
315 mem = a2232mem(port->which_a2232); 315 mem = a2232mem(port->which_a2232);
@@ -345,7 +345,7 @@ static int a2232_set_real_termios(void *ptr)
345 } 345 }
346 a2232_param |= rate; 346 a2232_param |= rate;
347 347
348 cflag = port->gs.tty->termios->c_cflag; 348 cflag = port->gs.port.tty->termios->c_cflag;
349 349
350 // get character size 350 // get character size
351 chsize = cflag & CSIZE; 351 chsize = cflag & CSIZE;
@@ -382,7 +382,7 @@ static int a2232_set_real_termios(void *ptr)
382 the conventional way of inserting START/STOP characters 382 the conventional way of inserting START/STOP characters
383 by hand in throttle()/unthrottle(). 383 by hand in throttle()/unthrottle().
384 */ 384 */
385 softflow = !!( port->gs.tty->termios->c_iflag & IXOFF ); 385 softflow = !!( port->gs.port.tty->termios->c_iflag & IXOFF );
386 386
387 // get Parity (Enabled/Disabled? If Enabled, Odd or Even?) 387 // get Parity (Enabled/Disabled? If Enabled, Odd or Even?)
388 parity = cflag & (PARENB | PARODD); 388 parity = cflag & (PARENB | PARODD);
@@ -400,9 +400,9 @@ static int a2232_set_real_termios(void *ptr)
400 /* Hmm. Maybe an own a2232_port structure 400 /* Hmm. Maybe an own a2232_port structure
401 member would be cleaner? */ 401 member would be cleaner? */
402 if (cflag & CLOCAL) 402 if (cflag & CLOCAL)
403 port->gs.flags &= ~ASYNC_CHECK_CD; 403 port->gs.port.flags &= ~ASYNC_CHECK_CD;
404 else 404 else
405 port->gs.flags |= ASYNC_CHECK_CD; 405 port->gs.port.flags |= ASYNC_CHECK_CD;
406 406
407 407
408 /* Now we have all parameters and can go to set them: */ 408 /* Now we have all parameters and can go to set them: */
@@ -482,18 +482,18 @@ static int a2232_open(struct tty_struct * tty, struct file * filp)
482 port = &a2232_ports[line]; 482 port = &a2232_ports[line];
483 483
484 tty->driver_data = port; 484 tty->driver_data = port;
485 port->gs.tty = tty; 485 port->gs.port.tty = tty;
486 port->gs.count++; 486 port->gs.port.count++;
487 retval = gs_init_port(&port->gs); 487 retval = gs_init_port(&port->gs);
488 if (retval) { 488 if (retval) {
489 port->gs.count--; 489 port->gs.port.count--;
490 return retval; 490 return retval;
491 } 491 }
492 port->gs.flags |= GS_ACTIVE; 492 port->gs.port.flags |= GS_ACTIVE;
493 retval = gs_block_til_ready(port, filp); 493 retval = gs_block_til_ready(port, filp);
494 494
495 if (retval) { 495 if (retval) {
496 port->gs.count--; 496 port->gs.port.count--;
497 return retval; 497 return retval;
498 } 498 }
499 499
@@ -522,7 +522,7 @@ int ch, err, n, p;
522 for (p = 0; p < NUMLINES; p++){ /* for every port on this board */ 522 for (p = 0; p < NUMLINES; p++){ /* for every port on this board */
523 err = 0; 523 err = 0;
524 port = &a2232_ports[n*NUMLINES+p]; 524 port = &a2232_ports[n*NUMLINES+p];
525 if ( port->gs.flags & GS_ACTIVE ){ /* if the port is used */ 525 if ( port->gs.port.flags & GS_ACTIVE ){ /* if the port is used */
526 526
527 status = a2232stat(n,p); 527 status = a2232stat(n,p);
528 528
@@ -577,8 +577,8 @@ int ch, err, n, p;
577 obuf = mem->OutBuf[p]; 577 obuf = mem->OutBuf[p];
578 bufpos = status->OutHead; 578 bufpos = status->OutHead;
579 while ( (port->gs.xmit_cnt > 0) && 579 while ( (port->gs.xmit_cnt > 0) &&
580 (!port->gs.tty->stopped) && 580 (!port->gs.port.tty->stopped) &&
581 (!port->gs.tty->hw_stopped) ){ /* While there are chars to transmit */ 581 (!port->gs.port.tty->hw_stopped) ){ /* While there are chars to transmit */
582 if (((bufpos+1) & A2232_IOBUFLENMASK) != status->OutTail) { /* If the A2232 buffer is not full */ 582 if (((bufpos+1) & A2232_IOBUFLENMASK) != status->OutTail) { /* If the A2232 buffer is not full */
583 ch = port->gs.xmit_buf[port->gs.xmit_tail]; /* get the next char to transmit */ 583 ch = port->gs.xmit_buf[port->gs.xmit_tail]; /* get the next char to transmit */
584 port->gs.xmit_tail = (port->gs.xmit_tail+1) & (SERIAL_XMIT_SIZE-1); /* modulo-addition for the gs.xmit_buf ring-buffer */ 584 port->gs.xmit_tail = (port->gs.xmit_tail+1) & (SERIAL_XMIT_SIZE-1); /* modulo-addition for the gs.xmit_buf ring-buffer */
@@ -592,8 +592,8 @@ int ch, err, n, p;
592 status->OutHead = bufpos; 592 status->OutHead = bufpos;
593 593
594 /* WakeUp if output buffer runs low */ 594 /* WakeUp if output buffer runs low */
595 if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { 595 if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.port.tty) {
596 tty_wakeup(port->gs.tty); 596 tty_wakeup(port->gs.port.tty);
597 } 597 }
598 } // if the port is used 598 } // if the port is used
599 } // for every port on the board 599 } // for every port on the board
@@ -613,16 +613,16 @@ int ch, err, n, p;
613 struct a2232_port *port = &a2232_ports[n*7+p]; 613 struct a2232_port *port = &a2232_ports[n*7+p];
614 port->cd_status = !(ncd & 1); /* ncd&1 <=> CD is now off */ 614 port->cd_status = !(ncd & 1); /* ncd&1 <=> CD is now off */
615 615
616 if (!(port->gs.flags & ASYNC_CHECK_CD)) 616 if (!(port->gs.port.flags & ASYNC_CHECK_CD))
617 ; /* Don't report DCD changes */ 617 ; /* Don't report DCD changes */
618 else if (port->cd_status) { // if DCD on: DCD went UP! 618 else if (port->cd_status) { // if DCD on: DCD went UP!
619 619
620 /* Are we blocking in open?*/ 620 /* Are we blocking in open?*/
621 wake_up_interruptible(&port->gs.open_wait); 621 wake_up_interruptible(&port->gs.port.open_wait);
622 } 622 }
623 else { // if DCD off: DCD went DOWN! 623 else { // if DCD off: DCD went DOWN!
624 if (port->gs.tty) 624 if (port->gs.port.tty)
625 tty_hangup (port->gs.tty); 625 tty_hangup (port->gs.port.tty);
626 } 626 }
627 627
628 } // if CD changed for this port 628 } // if CD changed for this port
@@ -655,8 +655,8 @@ static void a2232_init_portstructs(void)
655#ifdef NEW_WRITE_LOCKING 655#ifdef NEW_WRITE_LOCKING
656 mutex_init(&(port->gs.port_write_mutex)); 656 mutex_init(&(port->gs.port_write_mutex));
657#endif 657#endif
658 init_waitqueue_head(&port->gs.open_wait); 658 init_waitqueue_head(&port->gs.port.open_wait);
659 init_waitqueue_head(&port->gs.close_wait); 659 init_waitqueue_head(&port->gs.port.close_wait);
660 } 660 }
661} 661}
662 662
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index 69c5afe97f19..1718b3c481db 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -183,8 +183,8 @@ static void scc_init_portstructs(void)
183#ifdef NEW_WRITE_LOCKING 183#ifdef NEW_WRITE_LOCKING
184 port->gs.port_write_mutex = MUTEX; 184 port->gs.port_write_mutex = MUTEX;
185#endif 185#endif
186 init_waitqueue_head(&port->gs.open_wait); 186 init_waitqueue_head(&port->gs.port.open_wait);
187 init_waitqueue_head(&port->gs.close_wait); 187 init_waitqueue_head(&port->gs.port.close_wait);
188 } 188 }
189} 189}
190 190
@@ -422,7 +422,7 @@ static irqreturn_t scc_rx_int(int irq, void *data)
422{ 422{
423 unsigned char ch; 423 unsigned char ch;
424 struct scc_port *port = data; 424 struct scc_port *port = data;
425 struct tty_struct *tty = port->gs.tty; 425 struct tty_struct *tty = port->gs.port.tty;
426 SCC_ACCESS_INIT(port); 426 SCC_ACCESS_INIT(port);
427 427
428 ch = SCCread_NB(RX_DATA_REG); 428 ch = SCCread_NB(RX_DATA_REG);
@@ -453,7 +453,7 @@ static irqreturn_t scc_rx_int(int irq, void *data)
453static irqreturn_t scc_spcond_int(int irq, void *data) 453static irqreturn_t scc_spcond_int(int irq, void *data)
454{ 454{
455 struct scc_port *port = data; 455 struct scc_port *port = data;
456 struct tty_struct *tty = port->gs.tty; 456 struct tty_struct *tty = port->gs.port.tty;
457 unsigned char stat, ch, err; 457 unsigned char stat, ch, err;
458 int int_pending_mask = port->channel == CHANNEL_A ? 458 int int_pending_mask = port->channel == CHANNEL_A ?
459 IPR_A_RX : IPR_B_RX; 459 IPR_A_RX : IPR_B_RX;
@@ -500,7 +500,7 @@ static irqreturn_t scc_tx_int(int irq, void *data)
500 struct scc_port *port = data; 500 struct scc_port *port = data;
501 SCC_ACCESS_INIT(port); 501 SCC_ACCESS_INIT(port);
502 502
503 if (!port->gs.tty) { 503 if (!port->gs.port.tty) {
504 printk(KERN_WARNING "scc_tx_int with NULL tty!\n"); 504 printk(KERN_WARNING "scc_tx_int with NULL tty!\n");
505 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 505 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0);
506 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET); 506 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET);
@@ -512,8 +512,9 @@ static irqreturn_t scc_tx_int(int irq, void *data)
512 SCCwrite(TX_DATA_REG, port->x_char); 512 SCCwrite(TX_DATA_REG, port->x_char);
513 port->x_char = 0; 513 port->x_char = 0;
514 } 514 }
515 else if ((port->gs.xmit_cnt <= 0) || port->gs.tty->stopped || 515 else if ((port->gs.xmit_cnt <= 0) ||
516 port->gs.tty->hw_stopped) 516 port->gs.port.tty->stopped ||
517 port->gs.port.tty->hw_stopped)
517 break; 518 break;
518 else { 519 else {
519 SCCwrite(TX_DATA_REG, port->gs.xmit_buf[port->gs.xmit_tail++]); 520 SCCwrite(TX_DATA_REG, port->gs.xmit_buf[port->gs.xmit_tail++]);
@@ -522,15 +523,15 @@ static irqreturn_t scc_tx_int(int irq, void *data)
522 break; 523 break;
523 } 524 }
524 } 525 }
525 if ((port->gs.xmit_cnt <= 0) || port->gs.tty->stopped || 526 if ((port->gs.xmit_cnt <= 0) || port->gs.port.tty->stopped ||
526 port->gs.tty->hw_stopped) { 527 port->gs.port.tty->hw_stopped) {
527 /* disable tx interrupts */ 528 /* disable tx interrupts */
528 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 529 SCCmod (INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0);
529 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET); /* disable tx_int on next tx underrun? */ 530 SCCwrite(COMMAND_REG, CR_TX_PENDING_RESET); /* disable tx_int on next tx underrun? */
530 port->gs.flags &= ~GS_TX_INTEN; 531 port->gs.port.flags &= ~GS_TX_INTEN;
531 } 532 }
532 if (port->gs.tty && port->gs.xmit_cnt <= port->gs.wakeup_chars) 533 if (port->gs.port.tty && port->gs.xmit_cnt <= port->gs.wakeup_chars)
533 tty_wakeup(port->gs.tty); 534 tty_wakeup(port->gs.port.tty);
534 535
535 SCCwrite_NB(COMMAND_REG, CR_HIGHEST_IUS_RESET); 536 SCCwrite_NB(COMMAND_REG, CR_HIGHEST_IUS_RESET);
536 return IRQ_HANDLED; 537 return IRQ_HANDLED;
@@ -550,14 +551,14 @@ static irqreturn_t scc_stat_int(int irq, void *data)
550 551
551 if (changed & SR_DCD) { 552 if (changed & SR_DCD) {
552 port->c_dcd = !!(sr & SR_DCD); 553 port->c_dcd = !!(sr & SR_DCD);
553 if (!(port->gs.flags & ASYNC_CHECK_CD)) 554 if (!(port->gs.port.flags & ASYNC_CHECK_CD))
554 ; /* Don't report DCD changes */ 555 ; /* Don't report DCD changes */
555 else if (port->c_dcd) { 556 else if (port->c_dcd) {
556 wake_up_interruptible(&port->gs.open_wait); 557 wake_up_interruptible(&port->gs.port.open_wait);
557 } 558 }
558 else { 559 else {
559 if (port->gs.tty) 560 if (port->gs.port.tty)
560 tty_hangup (port->gs.tty); 561 tty_hangup (port->gs.port.tty);
561 } 562 }
562 } 563 }
563 SCCwrite(COMMAND_REG, CR_EXTSTAT_RESET); 564 SCCwrite(COMMAND_REG, CR_EXTSTAT_RESET);
@@ -578,7 +579,7 @@ static void scc_disable_tx_interrupts(void *ptr)
578 579
579 local_irq_save(flags); 580 local_irq_save(flags);
580 SCCmod(INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0); 581 SCCmod(INT_AND_DMA_REG, ~IDR_TX_INT_ENAB, 0);
581 port->gs.flags &= ~GS_TX_INTEN; 582 port->gs.port.flags &= ~GS_TX_INTEN;
582 local_irq_restore(flags); 583 local_irq_restore(flags);
583} 584}
584 585
@@ -636,8 +637,8 @@ static void scc_shutdown_port(void *ptr)
636{ 637{
637 struct scc_port *port = ptr; 638 struct scc_port *port = ptr;
638 639
639 port->gs.flags &= ~ GS_ACTIVE; 640 port->gs.port.flags &= ~ GS_ACTIVE;
640 if (port->gs.tty && port->gs.tty->termios->c_cflag & HUPCL) { 641 if (port->gs.port.tty && port->gs.port.tty->termios->c_cflag & HUPCL) {
641 scc_setsignals (port, 0, 0); 642 scc_setsignals (port, 0, 0);
642 } 643 }
643} 644}
@@ -652,14 +653,14 @@ static int scc_set_real_termios (void *ptr)
652 struct scc_port *port = ptr; 653 struct scc_port *port = ptr;
653 SCC_ACCESS_INIT(port); 654 SCC_ACCESS_INIT(port);
654 655
655 if (!port->gs.tty || !port->gs.tty->termios) return 0; 656 if (!port->gs.port.tty || !port->gs.port.tty->termios) return 0;
656 657
657 channel = port->channel; 658 channel = port->channel;
658 659
659 if (channel == CHANNEL_A) 660 if (channel == CHANNEL_A)
660 return 0; /* Settings controlled by boot PROM */ 661 return 0; /* Settings controlled by boot PROM */
661 662
662 cflag = port->gs.tty->termios->c_cflag; 663 cflag = port->gs.port.tty->termios->c_cflag;
663 baud = port->gs.baud; 664 baud = port->gs.baud;
664 chsize = (cflag & CSIZE) >> 4; 665 chsize = (cflag & CSIZE) >> 4;
665 666
@@ -678,9 +679,9 @@ static int scc_set_real_termios (void *ptr)
678 } 679 }
679 680
680 if (cflag & CLOCAL) 681 if (cflag & CLOCAL)
681 port->gs.flags &= ~ASYNC_CHECK_CD; 682 port->gs.port.flags &= ~ASYNC_CHECK_CD;
682 else 683 else
683 port->gs.flags |= ASYNC_CHECK_CD; 684 port->gs.port.flags |= ASYNC_CHECK_CD;
684 685
685#ifdef CONFIG_MVME147_SCC 686#ifdef CONFIG_MVME147_SCC
686 if (MACH_IS_MVME147) 687 if (MACH_IS_MVME147)
@@ -856,7 +857,7 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
856 { COMMAND_REG, CR_EXTSTAT_RESET }, 857 { COMMAND_REG, CR_EXTSTAT_RESET },
857 }; 858 };
858#endif 859#endif
859 if (!(port->gs.flags & ASYNC_INITIALIZED)) { 860 if (!(port->gs.port.flags & ASYNC_INITIALIZED)) {
860 local_irq_save(flags); 861 local_irq_save(flags);
861#if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC) 862#if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC)
862 if (MACH_IS_MVME147 || MACH_IS_MVME16x) { 863 if (MACH_IS_MVME147 || MACH_IS_MVME16x) {
@@ -880,18 +881,18 @@ static int scc_open (struct tty_struct * tty, struct file * filp)
880 } 881 }
881 882
882 tty->driver_data = port; 883 tty->driver_data = port;
883 port->gs.tty = tty; 884 port->gs.port.tty = tty;
884 port->gs.count++; 885 port->gs.port.count++;
885 retval = gs_init_port(&port->gs); 886 retval = gs_init_port(&port->gs);
886 if (retval) { 887 if (retval) {
887 port->gs.count--; 888 port->gs.port.count--;
888 return retval; 889 return retval;
889 } 890 }
890 port->gs.flags |= GS_ACTIVE; 891 port->gs.port.flags |= GS_ACTIVE;
891 retval = gs_block_til_ready(port, filp); 892 retval = gs_block_til_ready(port, filp);
892 893
893 if (retval) { 894 if (retval) {
894 port->gs.count--; 895 port->gs.port.count--;
895 return retval; 896 return retval;
896 } 897 }
897 898