Lines Matching full:up
159 static inline unsigned int sio_in(struct uart_port *up, int offset) in sio_in() argument
161 switch (up->iotype) { in sio_in()
163 return __raw_readl(up->membase + offset); in sio_in()
165 return inl(up->iobase + offset); in sio_in()
170 sio_out(struct uart_port *up, int offset, int value) in sio_out() argument
172 switch (up->iotype) { in sio_out()
174 __raw_writel(value, up->membase + offset); in sio_out()
177 outl(value, up->iobase + offset); in sio_out()
183 sio_mask(struct uart_port *up, int offset, unsigned int value) in sio_mask() argument
185 sio_out(up, offset, sio_in(up, offset) & ~value); in sio_mask()
188 sio_set(struct uart_port *up, int offset, unsigned int value) in sio_set() argument
190 sio_out(up, offset, sio_in(up, offset) | value); in sio_set()
194 sio_quot_set(struct uart_port *up, int quot) in sio_quot_set() argument
198 sio_out(up, TXX9_SIBGR, quot | TXX9_SIBGR_BCLK_T0); in sio_quot_set()
200 sio_out(up, TXX9_SIBGR, (quot >> 2) | TXX9_SIBGR_BCLK_T2); in sio_quot_set()
202 sio_out(up, TXX9_SIBGR, (quot >> 4) | TXX9_SIBGR_BCLK_T4); in sio_quot_set()
204 sio_out(up, TXX9_SIBGR, (quot >> 6) | TXX9_SIBGR_BCLK_T6); in sio_quot_set()
206 sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6); in sio_quot_set()
209 static void serial_txx9_stop_tx(struct uart_port *up) in serial_txx9_stop_tx() argument
211 sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE); in serial_txx9_stop_tx()
214 static void serial_txx9_start_tx(struct uart_port *up) in serial_txx9_start_tx() argument
216 sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE); in serial_txx9_start_tx()
219 static void serial_txx9_stop_rx(struct uart_port *up) in serial_txx9_stop_rx() argument
221 up->read_status_mask &= ~TXX9_SIDISR_RDIS; in serial_txx9_stop_rx()
224 static void serial_txx9_initialize(struct uart_port *up) in serial_txx9_initialize() argument
228 sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST); in serial_txx9_initialize()
232 while ((sio_in(up, TXX9_SIFCR) & TXX9_SIFCR_SWRST) && --tmout) in serial_txx9_initialize()
235 sio_set(up, TXX9_SIFCR, in serial_txx9_initialize()
238 sio_out(up, TXX9_SILCR, in serial_txx9_initialize()
240 ((up->flags & UPF_TXX9_USE_SCLK) ? in serial_txx9_initialize()
242 sio_quot_set(up, uart_get_divisor(up, 9600)); in serial_txx9_initialize()
243 sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */); in serial_txx9_initialize()
244 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_initialize()
248 receive_chars(struct uart_port *up, unsigned int *status) in receive_chars() argument
256 ch = sio_in(up, TXX9_SIRFIFO); in receive_chars()
258 up->icount.rx++; in receive_chars()
262 up->ignore_status_mask & ~TXX9_SIDISR_RFDN_MASK; in receive_chars()
270 up->icount.brk++; in receive_chars()
277 if (uart_handle_break(up)) in receive_chars()
280 up->icount.parity++; in receive_chars()
282 up->icount.frame++; in receive_chars()
284 up->icount.overrun++; in receive_chars()
298 disr &= up->read_status_mask; in receive_chars()
307 if (uart_handle_sysrq_char(up, ch)) in receive_chars()
310 uart_insert_char(up, disr, TXX9_SIDISR_UOER, ch, flag); in receive_chars()
313 up->ignore_status_mask = next_ignore_status_mask; in receive_chars()
314 disr = sio_in(up, TXX9_SIDISR); in receive_chars()
317 tty_flip_buffer_push(&up->state->port); in receive_chars()
322 static inline void transmit_chars(struct uart_port *up) in transmit_chars() argument
326 uart_port_tx_limited(up, ch, TXX9_SIO_TX_FIFO, in transmit_chars()
328 sio_out(up, TXX9_SITFIFO, ch), in transmit_chars()
335 struct uart_port *up = dev_id; in serial_txx9_interrupt() local
339 uart_port_lock(up); in serial_txx9_interrupt()
340 status = sio_in(up, TXX9_SIDISR); in serial_txx9_interrupt()
341 if (!(sio_in(up, TXX9_SIDICR) & TXX9_SIDICR_TIE)) in serial_txx9_interrupt()
345 uart_port_unlock(up); in serial_txx9_interrupt()
350 receive_chars(up, &status); in serial_txx9_interrupt()
352 transmit_chars(up); in serial_txx9_interrupt()
354 sio_mask(up, TXX9_SIDISR, in serial_txx9_interrupt()
357 uart_port_unlock(up); in serial_txx9_interrupt()
366 static unsigned int serial_txx9_tx_empty(struct uart_port *up) in serial_txx9_tx_empty() argument
371 uart_port_lock_irqsave(up, &flags); in serial_txx9_tx_empty()
372 ret = (sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS) ? TIOCSER_TEMT : 0; in serial_txx9_tx_empty()
373 uart_port_unlock_irqrestore(up, flags); in serial_txx9_tx_empty()
378 static unsigned int serial_txx9_get_mctrl(struct uart_port *up) in serial_txx9_get_mctrl() argument
384 ret |= (sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS; in serial_txx9_get_mctrl()
385 ret |= (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS; in serial_txx9_get_mctrl()
390 static void serial_txx9_set_mctrl(struct uart_port *up, unsigned int mctrl) in serial_txx9_set_mctrl() argument
394 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); in serial_txx9_set_mctrl()
396 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); in serial_txx9_set_mctrl()
399 static void serial_txx9_break_ctl(struct uart_port *up, int break_state) in serial_txx9_break_ctl() argument
403 uart_port_lock_irqsave(up, &flags); in serial_txx9_break_ctl()
405 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_break_ctl()
407 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_break_ctl()
408 uart_port_unlock_irqrestore(up, flags); in serial_txx9_break_ctl()
415 static void wait_for_xmitr(struct uart_port *up) in wait_for_xmitr() argument
419 /* Wait up to 10ms for the character(s) to be sent. */ in wait_for_xmitr()
421 !(sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS)) in wait_for_xmitr()
424 /* Wait up to 1s for flow control if necessary */ in wait_for_xmitr()
425 if (up->flags & UPF_CONS_FLOW) { in wait_for_xmitr()
428 (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS)) in wait_for_xmitr()
440 static int serial_txx9_get_poll_char(struct uart_port *up) in serial_txx9_get_poll_char() argument
448 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_get_poll_char()
449 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_get_poll_char()
451 while (sio_in(up, TXX9_SIDISR) & TXX9_SIDISR_UVALID) in serial_txx9_get_poll_char()
454 c = sio_in(up, TXX9_SIRFIFO); in serial_txx9_get_poll_char()
460 sio_mask(up, TXX9_SIDISR, TXX9_SIDISR_RDIS); in serial_txx9_get_poll_char()
461 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_get_poll_char()
466 static void serial_txx9_put_poll_char(struct uart_port *up, unsigned char c) in serial_txx9_put_poll_char() argument
473 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_put_poll_char()
474 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_put_poll_char()
476 wait_for_xmitr(up); in serial_txx9_put_poll_char()
480 sio_out(up, TXX9_SITFIFO, c); in serial_txx9_put_poll_char()
486 wait_for_xmitr(up); in serial_txx9_put_poll_char()
487 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_put_poll_char()
492 static int serial_txx9_startup(struct uart_port *up) in serial_txx9_startup() argument
501 sio_set(up, TXX9_SIFCR, in serial_txx9_startup()
504 sio_mask(up, TXX9_SIFCR, in serial_txx9_startup()
506 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_startup()
511 sio_out(up, TXX9_SIDISR, 0); in serial_txx9_startup()
513 retval = request_irq(up->irq, serial_txx9_interrupt, in serial_txx9_startup()
514 IRQF_SHARED, "serial_txx9", up); in serial_txx9_startup()
521 uart_port_lock_irqsave(up, &flags); in serial_txx9_startup()
522 serial_txx9_set_mctrl(up, up->mctrl); in serial_txx9_startup()
523 uart_port_unlock_irqrestore(up, flags); in serial_txx9_startup()
526 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); in serial_txx9_startup()
531 sio_set(up, TXX9_SIDICR, TXX9_SIDICR_RIE); in serial_txx9_startup()
536 static void serial_txx9_shutdown(struct uart_port *up) in serial_txx9_shutdown() argument
543 sio_out(up, TXX9_SIDICR, 0); /* disable all intrs */ in serial_txx9_shutdown()
545 uart_port_lock_irqsave(up, &flags); in serial_txx9_shutdown()
546 serial_txx9_set_mctrl(up, up->mctrl); in serial_txx9_shutdown()
547 uart_port_unlock_irqrestore(up, flags); in serial_txx9_shutdown()
552 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_shutdown()
555 if (up->cons && up->line == up->cons->index) { in serial_txx9_shutdown()
556 free_irq(up->irq, up); in serial_txx9_shutdown()
561 sio_set(up, TXX9_SIFCR, in serial_txx9_shutdown()
564 sio_mask(up, TXX9_SIFCR, in serial_txx9_shutdown()
568 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); in serial_txx9_shutdown()
570 free_irq(up->irq, up); in serial_txx9_shutdown()
574 serial_txx9_set_termios(struct uart_port *up, struct ktermios *termios, in serial_txx9_set_termios() argument
587 cval = sio_in(up, TXX9_SILCR); in serial_txx9_set_termios()
618 baud = uart_get_baud_rate(up, termios, old, 0, up->uartclk/16/2); in serial_txx9_set_termios()
619 quot = uart_get_divisor(up, baud); in serial_txx9_set_termios()
621 /* Set up FIFOs */ in serial_txx9_set_termios()
629 uart_port_lock_irqsave(up, &flags); in serial_txx9_set_termios()
634 uart_update_timeout(up, termios->c_cflag, baud); in serial_txx9_set_termios()
636 up->read_status_mask = TXX9_SIDISR_UOER | in serial_txx9_set_termios()
639 up->read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; in serial_txx9_set_termios()
641 up->read_status_mask |= TXX9_SIDISR_UBRK; in serial_txx9_set_termios()
646 up->ignore_status_mask = 0; in serial_txx9_set_termios()
648 up->ignore_status_mask |= TXX9_SIDISR_UPER | TXX9_SIDISR_UFER; in serial_txx9_set_termios()
650 up->ignore_status_mask |= TXX9_SIDISR_UBRK; in serial_txx9_set_termios()
656 up->ignore_status_mask |= TXX9_SIDISR_UOER; in serial_txx9_set_termios()
663 up->ignore_status_mask |= TXX9_SIDISR_RDIS; in serial_txx9_set_termios()
667 (up->flags & UPF_TXX9_HAVE_CTS_LINE)) { in serial_txx9_set_termios()
668 sio_set(up, TXX9_SIFLCR, in serial_txx9_set_termios()
671 sio_mask(up, TXX9_SIFLCR, in serial_txx9_set_termios()
675 sio_out(up, TXX9_SILCR, cval); in serial_txx9_set_termios()
676 sio_quot_set(up, quot); in serial_txx9_set_termios()
677 sio_out(up, TXX9_SIFCR, fcr); in serial_txx9_set_termios()
679 serial_txx9_set_mctrl(up, up->mctrl); in serial_txx9_set_termios()
680 uart_port_unlock_irqrestore(up, flags); in serial_txx9_set_termios()
699 static int serial_txx9_request_resource(struct uart_port *up) in serial_txx9_request_resource() argument
704 switch (up->iotype) { in serial_txx9_request_resource()
706 if (!up->mapbase) in serial_txx9_request_resource()
709 if (!request_mem_region(up->mapbase, size, "serial_txx9")) { in serial_txx9_request_resource()
714 if (up->flags & UPF_IOREMAP) { in serial_txx9_request_resource()
715 up->membase = ioremap(up->mapbase, size); in serial_txx9_request_resource()
716 if (!up->membase) { in serial_txx9_request_resource()
717 release_mem_region(up->mapbase, size); in serial_txx9_request_resource()
724 if (!request_region(up->iobase, size, "serial_txx9")) in serial_txx9_request_resource()
731 static void serial_txx9_release_resource(struct uart_port *up) in serial_txx9_release_resource() argument
735 switch (up->iotype) { in serial_txx9_release_resource()
737 if (!up->mapbase) in serial_txx9_release_resource()
740 if (up->flags & UPF_IOREMAP) { in serial_txx9_release_resource()
741 iounmap(up->membase); in serial_txx9_release_resource()
742 up->membase = NULL; in serial_txx9_release_resource()
745 release_mem_region(up->mapbase, size); in serial_txx9_release_resource()
749 release_region(up->iobase, size); in serial_txx9_release_resource()
754 static void serial_txx9_release_port(struct uart_port *up) in serial_txx9_release_port() argument
756 serial_txx9_release_resource(up); in serial_txx9_release_port()
759 static int serial_txx9_request_port(struct uart_port *up) in serial_txx9_request_port() argument
761 return serial_txx9_request_resource(up); in serial_txx9_request_port()
764 static void serial_txx9_config_port(struct uart_port *up, int uflags) in serial_txx9_config_port() argument
772 ret = serial_txx9_request_resource(up); in serial_txx9_config_port()
775 up->type = PORT_TXX9; in serial_txx9_config_port()
776 up->fifosize = TXX9_SIO_TX_FIFO; in serial_txx9_config_port()
779 if (up->line == up->cons->index) in serial_txx9_config_port()
782 serial_txx9_initialize(up); in serial_txx9_config_port()
821 struct uart_port *up = &serial_txx9_ports[i]; in serial_txx9_register_ports() local
823 up->line = i; in serial_txx9_register_ports()
824 up->ops = &serial_txx9_pops; in serial_txx9_register_ports()
825 up->dev = dev; in serial_txx9_register_ports()
826 if (up->iobase || up->mapbase) in serial_txx9_register_ports()
827 uart_add_one_port(drv, up); in serial_txx9_register_ports()
833 static void serial_txx9_console_putchar(struct uart_port *up, unsigned char ch) in serial_txx9_console_putchar() argument
835 wait_for_xmitr(up); in serial_txx9_console_putchar()
836 sio_out(up, TXX9_SITFIFO, ch); in serial_txx9_console_putchar()
848 struct uart_port *up = &serial_txx9_ports[co->index]; in serial_txx9_console_write() local
854 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_console_write()
855 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_console_write()
859 flcr = sio_in(up, TXX9_SIFLCR); in serial_txx9_console_write()
860 if (!(up->flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES)) in serial_txx9_console_write()
861 sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES); in serial_txx9_console_write()
863 uart_console_write(up, s, count, serial_txx9_console_putchar); in serial_txx9_console_write()
869 wait_for_xmitr(up); in serial_txx9_console_write()
870 sio_out(up, TXX9_SIFLCR, flcr); in serial_txx9_console_write()
871 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_console_write()
876 struct uart_port *up; in serial_txx9_console_setup() local
889 up = &serial_txx9_ports[co->index]; in serial_txx9_console_setup()
890 if (!up->ops) in serial_txx9_console_setup()
893 serial_txx9_initialize(up); in serial_txx9_console_setup()
898 return uart_set_options(up, co, baud, parity, bits, flow); in serial_txx9_console_setup()
1061 struct uart_port *up = &serial_txx9_ports[i]; in serial_txx9_remove() local
1063 if (up->dev == &dev->dev) in serial_txx9_remove()
1074 struct uart_port *up = &serial_txx9_ports[i]; in serial_txx9_suspend() local
1076 if (up->type != PORT_UNKNOWN && up->dev == &dev->dev) in serial_txx9_suspend()
1077 uart_suspend_port(&serial_txx9_reg, up); in serial_txx9_suspend()
1088 struct uart_port *up = &serial_txx9_ports[i]; in serial_txx9_resume() local
1090 if (up->type != PORT_UNKNOWN && up->dev == &dev->dev) in serial_txx9_resume()
1091 uart_resume_port(&serial_txx9_reg, up); in serial_txx9_resume()
1147 struct uart_port *up = pci_get_drvdata(dev); in pciserial_txx9_remove_one() local
1149 if (up) { in pciserial_txx9_remove_one()
1150 serial_txx9_unregister_port(up->line); in pciserial_txx9_remove_one()
1158 struct uart_port *up = pci_get_drvdata(dev); in pciserial_txx9_suspend_one() local
1160 if (up) in pciserial_txx9_suspend_one()
1161 uart_suspend_port(&serial_txx9_reg, up); in pciserial_txx9_suspend_one()
1169 struct uart_port *up = pci_get_drvdata(dev); in pciserial_txx9_resume_one() local
1173 if (up) in pciserial_txx9_resume_one()
1174 uart_resume_port(&serial_txx9_reg, up); in pciserial_txx9_resume_one()
1254 struct uart_port *up = &serial_txx9_ports[i]; in serial_txx9_exit() local
1255 if (up->iobase || up->mapbase) in serial_txx9_exit()
1256 uart_remove_one_port(&serial_txx9_reg, up); in serial_txx9_exit()