Lines Matching refs:up
158 static inline unsigned int sio_in(struct uart_port *up, int offset) in sio_in() argument
160 switch (up->iotype) { in sio_in()
162 return __raw_readl(up->membase + offset); in sio_in()
164 return inl(up->iobase + offset); in sio_in()
169 sio_out(struct uart_port *up, int offset, int value) in sio_out() argument
171 switch (up->iotype) { in sio_out()
173 __raw_writel(value, up->membase + offset); in sio_out()
176 outl(value, up->iobase + offset); in sio_out()
182 sio_mask(struct uart_port *up, int offset, unsigned int value) in sio_mask() argument
184 sio_out(up, offset, sio_in(up, offset) & ~value); in sio_mask()
187 sio_set(struct uart_port *up, int offset, unsigned int value) in sio_set() argument
189 sio_out(up, offset, sio_in(up, offset) | value); in sio_set()
193 sio_quot_set(struct uart_port *up, int quot) in sio_quot_set() argument
197 sio_out(up, TXX9_SIBGR, quot | TXX9_SIBGR_BCLK_T0); in sio_quot_set()
199 sio_out(up, TXX9_SIBGR, (quot >> 2) | TXX9_SIBGR_BCLK_T2); in sio_quot_set()
201 sio_out(up, TXX9_SIBGR, (quot >> 4) | TXX9_SIBGR_BCLK_T4); in sio_quot_set()
203 sio_out(up, TXX9_SIBGR, (quot >> 6) | TXX9_SIBGR_BCLK_T6); in sio_quot_set()
205 sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6); in sio_quot_set()
208 static void serial_txx9_stop_tx(struct uart_port *up) in serial_txx9_stop_tx() argument
210 sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE); in serial_txx9_stop_tx()
213 static void serial_txx9_start_tx(struct uart_port *up) in serial_txx9_start_tx() argument
215 sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE); in serial_txx9_start_tx()
218 static void serial_txx9_stop_rx(struct uart_port *up) in serial_txx9_stop_rx() argument
220 up->read_status_mask &= ~TXX9_SIDISR_RDIS; in serial_txx9_stop_rx()
223 static void serial_txx9_initialize(struct uart_port *up) in serial_txx9_initialize() argument
227 sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST); in serial_txx9_initialize()
231 while ((sio_in(up, TXX9_SIFCR) & TXX9_SIFCR_SWRST) && --tmout) in serial_txx9_initialize()
234 sio_set(up, TXX9_SIFCR, in serial_txx9_initialize()
237 sio_out(up, TXX9_SILCR, in serial_txx9_initialize()
239 ((up->flags & UPF_TXX9_USE_SCLK) ? in serial_txx9_initialize()
241 sio_quot_set(up, uart_get_divisor(up, 9600)); in serial_txx9_initialize()
242 sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */); in serial_txx9_initialize()
243 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_initialize()
247 receive_chars(struct uart_port *up, unsigned int *status) in receive_chars() argument
255 ch = sio_in(up, TXX9_SIRFIFO); in receive_chars()
257 up->icount.rx++; in receive_chars()
261 up->ignore_status_mask & ~TXX9_SIDISR_RFDN_MASK; in receive_chars()
269 up->icount.brk++; in receive_chars()
276 if (uart_handle_break(up)) in receive_chars()
279 up->icount.parity++; in receive_chars()
281 up->icount.frame++; in receive_chars()
283 up->icount.overrun++; in receive_chars()
297 disr &= up->read_status_mask; in receive_chars()
306 if (uart_handle_sysrq_char(up, ch)) in receive_chars()
309 uart_insert_char(up, disr, TXX9_SIDISR_UOER, ch, flag); in receive_chars()
312 up->ignore_status_mask = next_ignore_status_mask; in receive_chars()
313 disr = sio_in(up, TXX9_SIDISR); in receive_chars()
316 tty_flip_buffer_push(&up->state->port); in receive_chars()
321 static inline void transmit_chars(struct uart_port *up) in transmit_chars() argument
325 uart_port_tx_limited(up, ch, TXX9_SIO_TX_FIFO, in transmit_chars()
327 sio_out(up, TXX9_SITFIFO, ch), in transmit_chars()
334 struct uart_port *up = dev_id; in serial_txx9_interrupt() local
338 spin_lock(&up->lock); in serial_txx9_interrupt()
339 status = sio_in(up, TXX9_SIDISR); in serial_txx9_interrupt()
340 if (!(sio_in(up, TXX9_SIDICR) & TXX9_SIDICR_TIE)) in serial_txx9_interrupt()
344 spin_unlock(&up->lock); in serial_txx9_interrupt()
349 receive_chars(up, &status); in serial_txx9_interrupt()
351 transmit_chars(up); in serial_txx9_interrupt()
353 sio_mask(up, TXX9_SIDISR, in serial_txx9_interrupt()
356 spin_unlock(&up->lock); in serial_txx9_interrupt()
365 static unsigned int serial_txx9_tx_empty(struct uart_port *up) in serial_txx9_tx_empty() argument
370 spin_lock_irqsave(&up->lock, flags); in serial_txx9_tx_empty()
371 ret = (sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS) ? TIOCSER_TEMT : 0; in serial_txx9_tx_empty()
372 spin_unlock_irqrestore(&up->lock, flags); in serial_txx9_tx_empty()
377 static unsigned int serial_txx9_get_mctrl(struct uart_port *up) in serial_txx9_get_mctrl() argument
383 ret |= (sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS; in serial_txx9_get_mctrl()
384 ret |= (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS; in serial_txx9_get_mctrl()
389 static void serial_txx9_set_mctrl(struct uart_port *up, unsigned int mctrl) in serial_txx9_set_mctrl() argument
393 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); in serial_txx9_set_mctrl()
395 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); in serial_txx9_set_mctrl()
398 static void serial_txx9_break_ctl(struct uart_port *up, int break_state) in serial_txx9_break_ctl() argument
402 spin_lock_irqsave(&up->lock, flags); in serial_txx9_break_ctl()
404 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_break_ctl()
406 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_break_ctl()
407 spin_unlock_irqrestore(&up->lock, flags); in serial_txx9_break_ctl()
414 static void wait_for_xmitr(struct uart_port *up) in wait_for_xmitr() argument
420 !(sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS)) in wait_for_xmitr()
424 if (up->flags & UPF_CONS_FLOW) { in wait_for_xmitr()
427 (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS)) in wait_for_xmitr()
439 static int serial_txx9_get_poll_char(struct uart_port *up) in serial_txx9_get_poll_char() argument
447 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_get_poll_char()
448 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_get_poll_char()
450 while (sio_in(up, TXX9_SIDISR) & TXX9_SIDISR_UVALID) in serial_txx9_get_poll_char()
453 c = sio_in(up, TXX9_SIRFIFO); in serial_txx9_get_poll_char()
459 sio_mask(up, TXX9_SIDISR, TXX9_SIDISR_RDIS); in serial_txx9_get_poll_char()
460 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_get_poll_char()
465 static void serial_txx9_put_poll_char(struct uart_port *up, unsigned char c) in serial_txx9_put_poll_char() argument
472 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_put_poll_char()
473 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_put_poll_char()
475 wait_for_xmitr(up); in serial_txx9_put_poll_char()
479 sio_out(up, TXX9_SITFIFO, c); in serial_txx9_put_poll_char()
485 wait_for_xmitr(up); in serial_txx9_put_poll_char()
486 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_put_poll_char()
491 static int serial_txx9_startup(struct uart_port *up) in serial_txx9_startup() argument
500 sio_set(up, TXX9_SIFCR, in serial_txx9_startup()
503 sio_mask(up, TXX9_SIFCR, in serial_txx9_startup()
505 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_startup()
510 sio_out(up, TXX9_SIDISR, 0); in serial_txx9_startup()
512 retval = request_irq(up->irq, serial_txx9_interrupt, in serial_txx9_startup()
513 IRQF_SHARED, "serial_txx9", up); in serial_txx9_startup()
520 spin_lock_irqsave(&up->lock, flags); in serial_txx9_startup()
521 serial_txx9_set_mctrl(up, up->mctrl); in serial_txx9_startup()
522 spin_unlock_irqrestore(&up->lock, flags); in serial_txx9_startup()
525 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); in serial_txx9_startup()
530 sio_set(up, TXX9_SIDICR, TXX9_SIDICR_RIE); in serial_txx9_startup()
535 static void serial_txx9_shutdown(struct uart_port *up) in serial_txx9_shutdown() argument
542 sio_out(up, TXX9_SIDICR, 0); /* disable all intrs */ in serial_txx9_shutdown()
544 spin_lock_irqsave(&up->lock, flags); in serial_txx9_shutdown()
545 serial_txx9_set_mctrl(up, up->mctrl); in serial_txx9_shutdown()
546 spin_unlock_irqrestore(&up->lock, flags); in serial_txx9_shutdown()
551 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_shutdown()
554 if (up->cons && up->line == up->cons->index) { in serial_txx9_shutdown()
555 free_irq(up->irq, up); in serial_txx9_shutdown()
560 sio_set(up, TXX9_SIFCR, in serial_txx9_shutdown()
563 sio_mask(up, TXX9_SIFCR, in serial_txx9_shutdown()
567 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); in serial_txx9_shutdown()
569 free_irq(up->irq, up); in serial_txx9_shutdown()
573 serial_txx9_set_termios(struct uart_port *up, struct ktermios *termios, in serial_txx9_set_termios() argument
586 cval = sio_in(up, TXX9_SILCR); in serial_txx9_set_termios()
617 baud = uart_get_baud_rate(up, termios, old, 0, up->uartclk/16/2); in serial_txx9_set_termios()
618 quot = uart_get_divisor(up, baud); in serial_txx9_set_termios()
628 spin_lock_irqsave(&up->lock, flags); in serial_txx9_set_termios()
633 uart_update_timeout(up, termios->c_cflag, baud); in serial_txx9_set_termios()
635 up->read_status_mask = TXX9_SIDISR_UOER | in serial_txx9_set_termios()
638 up->read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; in serial_txx9_set_termios()
640 up->read_status_mask |= TXX9_SIDISR_UBRK; in serial_txx9_set_termios()
645 up->ignore_status_mask = 0; in serial_txx9_set_termios()
647 up->ignore_status_mask |= TXX9_SIDISR_UPER | TXX9_SIDISR_UFER; in serial_txx9_set_termios()
649 up->ignore_status_mask |= TXX9_SIDISR_UBRK; in serial_txx9_set_termios()
655 up->ignore_status_mask |= TXX9_SIDISR_UOER; in serial_txx9_set_termios()
662 up->ignore_status_mask |= TXX9_SIDISR_RDIS; in serial_txx9_set_termios()
666 (up->flags & UPF_TXX9_HAVE_CTS_LINE)) { in serial_txx9_set_termios()
667 sio_set(up, TXX9_SIFLCR, in serial_txx9_set_termios()
670 sio_mask(up, TXX9_SIFLCR, in serial_txx9_set_termios()
674 sio_out(up, TXX9_SILCR, cval); in serial_txx9_set_termios()
675 sio_quot_set(up, quot); in serial_txx9_set_termios()
676 sio_out(up, TXX9_SIFCR, fcr); in serial_txx9_set_termios()
678 serial_txx9_set_mctrl(up, up->mctrl); in serial_txx9_set_termios()
679 spin_unlock_irqrestore(&up->lock, flags); in serial_txx9_set_termios()
698 static int serial_txx9_request_resource(struct uart_port *up) in serial_txx9_request_resource() argument
703 switch (up->iotype) { in serial_txx9_request_resource()
705 if (!up->mapbase) in serial_txx9_request_resource()
708 if (!request_mem_region(up->mapbase, size, "serial_txx9")) { in serial_txx9_request_resource()
713 if (up->flags & UPF_IOREMAP) { in serial_txx9_request_resource()
714 up->membase = ioremap(up->mapbase, size); in serial_txx9_request_resource()
715 if (!up->membase) { in serial_txx9_request_resource()
716 release_mem_region(up->mapbase, size); in serial_txx9_request_resource()
723 if (!request_region(up->iobase, size, "serial_txx9")) in serial_txx9_request_resource()
730 static void serial_txx9_release_resource(struct uart_port *up) in serial_txx9_release_resource() argument
734 switch (up->iotype) { in serial_txx9_release_resource()
736 if (!up->mapbase) in serial_txx9_release_resource()
739 if (up->flags & UPF_IOREMAP) { in serial_txx9_release_resource()
740 iounmap(up->membase); in serial_txx9_release_resource()
741 up->membase = NULL; in serial_txx9_release_resource()
744 release_mem_region(up->mapbase, size); in serial_txx9_release_resource()
748 release_region(up->iobase, size); in serial_txx9_release_resource()
753 static void serial_txx9_release_port(struct uart_port *up) in serial_txx9_release_port() argument
755 serial_txx9_release_resource(up); in serial_txx9_release_port()
758 static int serial_txx9_request_port(struct uart_port *up) in serial_txx9_request_port() argument
760 return serial_txx9_request_resource(up); in serial_txx9_request_port()
763 static void serial_txx9_config_port(struct uart_port *up, int uflags) in serial_txx9_config_port() argument
771 ret = serial_txx9_request_resource(up); in serial_txx9_config_port()
774 up->type = PORT_TXX9; in serial_txx9_config_port()
775 up->fifosize = TXX9_SIO_TX_FIFO; in serial_txx9_config_port()
778 if (up->line == up->cons->index) in serial_txx9_config_port()
781 serial_txx9_initialize(up); in serial_txx9_config_port()
820 struct uart_port *up = &serial_txx9_ports[i]; in serial_txx9_register_ports() local
822 up->line = i; in serial_txx9_register_ports()
823 up->ops = &serial_txx9_pops; in serial_txx9_register_ports()
824 up->dev = dev; in serial_txx9_register_ports()
825 if (up->iobase || up->mapbase) in serial_txx9_register_ports()
826 uart_add_one_port(drv, up); in serial_txx9_register_ports()
832 static void serial_txx9_console_putchar(struct uart_port *up, unsigned char ch) in serial_txx9_console_putchar() argument
834 wait_for_xmitr(up); in serial_txx9_console_putchar()
835 sio_out(up, TXX9_SITFIFO, ch); in serial_txx9_console_putchar()
847 struct uart_port *up = &serial_txx9_ports[co->index]; in serial_txx9_console_write() local
853 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_console_write()
854 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_console_write()
858 flcr = sio_in(up, TXX9_SIFLCR); in serial_txx9_console_write()
859 if (!(up->flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES)) in serial_txx9_console_write()
860 sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES); in serial_txx9_console_write()
862 uart_console_write(up, s, count, serial_txx9_console_putchar); in serial_txx9_console_write()
868 wait_for_xmitr(up); in serial_txx9_console_write()
869 sio_out(up, TXX9_SIFLCR, flcr); in serial_txx9_console_write()
870 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_console_write()
875 struct uart_port *up; in serial_txx9_console_setup() local
888 up = &serial_txx9_ports[co->index]; in serial_txx9_console_setup()
889 if (!up->ops) in serial_txx9_console_setup()
892 serial_txx9_initialize(up); in serial_txx9_console_setup()
897 return uart_set_options(up, co, baud, parity, bits, flow); in serial_txx9_console_setup()
1060 struct uart_port *up = &serial_txx9_ports[i]; in serial_txx9_remove() local
1062 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()