Lines Matching refs:up
166 static inline unsigned int sio_in(struct uart_txx9_port *up, int offset) in sio_in() argument
168 switch (up->port.iotype) { in sio_in()
170 return __raw_readl(up->port.membase + offset); in sio_in()
172 return inl(up->port.iobase + offset); in sio_in()
177 sio_out(struct uart_txx9_port *up, int offset, int value) in sio_out() argument
179 switch (up->port.iotype) { in sio_out()
181 __raw_writel(value, up->port.membase + offset); in sio_out()
184 outl(value, up->port.iobase + offset); in sio_out()
190 sio_mask(struct uart_txx9_port *up, int offset, unsigned int value) in sio_mask() argument
192 sio_out(up, offset, sio_in(up, offset) & ~value); in sio_mask()
195 sio_set(struct uart_txx9_port *up, int offset, unsigned int value) in sio_set() argument
197 sio_out(up, offset, sio_in(up, offset) | value); in sio_set()
201 sio_quot_set(struct uart_txx9_port *up, int quot) in sio_quot_set() argument
205 sio_out(up, TXX9_SIBGR, quot | TXX9_SIBGR_BCLK_T0); in sio_quot_set()
207 sio_out(up, TXX9_SIBGR, (quot >> 2) | TXX9_SIBGR_BCLK_T2); in sio_quot_set()
209 sio_out(up, TXX9_SIBGR, (quot >> 4) | TXX9_SIBGR_BCLK_T4); in sio_quot_set()
211 sio_out(up, TXX9_SIBGR, (quot >> 6) | TXX9_SIBGR_BCLK_T6); in sio_quot_set()
213 sio_out(up, TXX9_SIBGR, 0xff | TXX9_SIBGR_BCLK_T6); in sio_quot_set()
223 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_stop_tx() local
224 sio_mask(up, TXX9_SIDICR, TXX9_SIDICR_TIE); in serial_txx9_stop_tx()
229 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_start_tx() local
230 sio_set(up, TXX9_SIDICR, TXX9_SIDICR_TIE); in serial_txx9_start_tx()
235 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_stop_rx() local
236 up->port.read_status_mask &= ~TXX9_SIDISR_RDIS; in serial_txx9_stop_rx()
241 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_initialize() local
244 sio_out(up, TXX9_SIFCR, TXX9_SIFCR_SWRST); in serial_txx9_initialize()
248 while ((sio_in(up, TXX9_SIFCR) & TXX9_SIFCR_SWRST) && --tmout) in serial_txx9_initialize()
251 sio_set(up, TXX9_SIFCR, in serial_txx9_initialize()
254 sio_out(up, TXX9_SILCR, in serial_txx9_initialize()
256 ((up->port.flags & UPF_TXX9_USE_SCLK) ? in serial_txx9_initialize()
258 sio_quot_set(up, uart_get_divisor(port, 9600)); in serial_txx9_initialize()
259 sio_out(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSTL_MAX /* 15 */); in serial_txx9_initialize()
260 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_initialize()
264 receive_chars(struct uart_txx9_port *up, unsigned int *status) in receive_chars() argument
273 ch = sio_in(up, TXX9_SIRFIFO); in receive_chars()
275 up->port.icount.rx++; in receive_chars()
279 up->port.ignore_status_mask & ~TXX9_SIDISR_RFDN_MASK; in receive_chars()
287 up->port.icount.brk++; in receive_chars()
294 if (uart_handle_break(&up->port)) in receive_chars()
297 up->port.icount.parity++; in receive_chars()
299 up->port.icount.frame++; in receive_chars()
301 up->port.icount.overrun++; in receive_chars()
315 disr &= up->port.read_status_mask; in receive_chars()
324 if (uart_handle_sysrq_char(&up->port, ch)) in receive_chars()
327 uart_insert_char(&up->port, disr, TXX9_SIDISR_UOER, ch, flag); in receive_chars()
330 up->port.ignore_status_mask = next_ignore_status_mask; in receive_chars()
331 disr = sio_in(up, TXX9_SIDISR); in receive_chars()
334 tty_flip_buffer_push(&up->port.state->port); in receive_chars()
339 static inline void transmit_chars(struct uart_txx9_port *up) in transmit_chars() argument
341 struct circ_buf *xmit = &up->port.state->xmit; in transmit_chars()
344 if (up->port.x_char) { in transmit_chars()
345 sio_out(up, TXX9_SITFIFO, up->port.x_char); in transmit_chars()
346 up->port.icount.tx++; in transmit_chars()
347 up->port.x_char = 0; in transmit_chars()
350 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { in transmit_chars()
351 serial_txx9_stop_tx(&up->port); in transmit_chars()
357 sio_out(up, TXX9_SITFIFO, xmit->buf[xmit->tail]); in transmit_chars()
359 up->port.icount.tx++; in transmit_chars()
365 uart_write_wakeup(&up->port); in transmit_chars()
368 serial_txx9_stop_tx(&up->port); in transmit_chars()
374 struct uart_txx9_port *up = dev_id; in serial_txx9_interrupt() local
378 spin_lock(&up->port.lock); in serial_txx9_interrupt()
379 status = sio_in(up, TXX9_SIDISR); in serial_txx9_interrupt()
380 if (!(sio_in(up, TXX9_SIDICR) & TXX9_SIDICR_TIE)) in serial_txx9_interrupt()
384 spin_unlock(&up->port.lock); in serial_txx9_interrupt()
389 receive_chars(up, &status); in serial_txx9_interrupt()
391 transmit_chars(up); in serial_txx9_interrupt()
393 sio_mask(up, TXX9_SIDISR, in serial_txx9_interrupt()
396 spin_unlock(&up->port.lock); in serial_txx9_interrupt()
407 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_tx_empty() local
411 spin_lock_irqsave(&up->port.lock, flags); in serial_txx9_tx_empty()
412 ret = (sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS) ? TIOCSER_TEMT : 0; in serial_txx9_tx_empty()
413 spin_unlock_irqrestore(&up->port.lock, flags); in serial_txx9_tx_empty()
420 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_get_mctrl() local
425 ret |= (sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS; in serial_txx9_get_mctrl()
426 ret |= (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS; in serial_txx9_get_mctrl()
433 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_set_mctrl() local
436 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); in serial_txx9_set_mctrl()
438 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RTSSC); in serial_txx9_set_mctrl()
443 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_break_ctl() local
446 spin_lock_irqsave(&up->port.lock, flags); in serial_txx9_break_ctl()
448 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_break_ctl()
450 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_break_ctl()
451 spin_unlock_irqrestore(&up->port.lock, flags); in serial_txx9_break_ctl()
458 static void wait_for_xmitr(struct uart_txx9_port *up) in wait_for_xmitr() argument
464 !(sio_in(up, TXX9_SICISR) & TXX9_SICISR_TXALS)) in wait_for_xmitr()
468 if (up->port.flags & UPF_CONS_FLOW) { in wait_for_xmitr()
471 (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS)) in wait_for_xmitr()
487 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_get_poll_char() local
492 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_get_poll_char()
493 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_get_poll_char()
495 while (sio_in(up, TXX9_SIDISR) & TXX9_SIDISR_UVALID) in serial_txx9_get_poll_char()
498 c = sio_in(up, TXX9_SIRFIFO); in serial_txx9_get_poll_char()
504 sio_mask(up, TXX9_SIDISR, TXX9_SIDISR_RDIS); in serial_txx9_get_poll_char()
505 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_get_poll_char()
513 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_put_poll_char() local
518 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_put_poll_char()
519 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_put_poll_char()
521 wait_for_xmitr(up); in serial_txx9_put_poll_char()
525 sio_out(up, TXX9_SITFIFO, c); in serial_txx9_put_poll_char()
531 wait_for_xmitr(up); in serial_txx9_put_poll_char()
532 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_put_poll_char()
539 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_startup() local
547 sio_set(up, TXX9_SIFCR, in serial_txx9_startup()
550 sio_mask(up, TXX9_SIFCR, in serial_txx9_startup()
552 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_startup()
557 sio_out(up, TXX9_SIDISR, 0); in serial_txx9_startup()
559 retval = request_irq(up->port.irq, serial_txx9_interrupt, in serial_txx9_startup()
560 IRQF_SHARED, "serial_txx9", up); in serial_txx9_startup()
567 spin_lock_irqsave(&up->port.lock, flags); in serial_txx9_startup()
568 serial_txx9_set_mctrl(&up->port, up->port.mctrl); in serial_txx9_startup()
569 spin_unlock_irqrestore(&up->port.lock, flags); in serial_txx9_startup()
572 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); in serial_txx9_startup()
577 sio_set(up, TXX9_SIDICR, TXX9_SIDICR_RIE); in serial_txx9_startup()
584 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_shutdown() local
590 sio_out(up, TXX9_SIDICR, 0); /* disable all intrs */ in serial_txx9_shutdown()
592 spin_lock_irqsave(&up->port.lock, flags); in serial_txx9_shutdown()
593 serial_txx9_set_mctrl(&up->port, up->port.mctrl); in serial_txx9_shutdown()
594 spin_unlock_irqrestore(&up->port.lock, flags); in serial_txx9_shutdown()
599 sio_mask(up, TXX9_SIFLCR, TXX9_SIFLCR_TBRK); in serial_txx9_shutdown()
602 if (up->port.cons && up->port.line == up->port.cons->index) { in serial_txx9_shutdown()
603 free_irq(up->port.irq, up); in serial_txx9_shutdown()
608 sio_set(up, TXX9_SIFCR, in serial_txx9_shutdown()
611 sio_mask(up, TXX9_SIFCR, in serial_txx9_shutdown()
615 sio_set(up, TXX9_SIFLCR, TXX9_SIFLCR_RSDE | TXX9_SIFLCR_TSDE); in serial_txx9_shutdown()
617 free_irq(up->port.irq, up); in serial_txx9_shutdown()
624 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_set_termios() local
635 cval = sio_in(up, TXX9_SILCR); in serial_txx9_set_termios()
677 spin_lock_irqsave(&up->port.lock, flags); in serial_txx9_set_termios()
684 up->port.read_status_mask = TXX9_SIDISR_UOER | in serial_txx9_set_termios()
687 up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; in serial_txx9_set_termios()
689 up->port.read_status_mask |= TXX9_SIDISR_UBRK; in serial_txx9_set_termios()
694 up->port.ignore_status_mask = 0; in serial_txx9_set_termios()
696 up->port.ignore_status_mask |= TXX9_SIDISR_UPER | TXX9_SIDISR_UFER; in serial_txx9_set_termios()
698 up->port.ignore_status_mask |= TXX9_SIDISR_UBRK; in serial_txx9_set_termios()
704 up->port.ignore_status_mask |= TXX9_SIDISR_UOER; in serial_txx9_set_termios()
711 up->port.ignore_status_mask |= TXX9_SIDISR_RDIS; in serial_txx9_set_termios()
715 (up->port.flags & UPF_TXX9_HAVE_CTS_LINE)) { in serial_txx9_set_termios()
716 sio_set(up, TXX9_SIFLCR, in serial_txx9_set_termios()
719 sio_mask(up, TXX9_SIFLCR, in serial_txx9_set_termios()
723 sio_out(up, TXX9_SILCR, cval); in serial_txx9_set_termios()
724 sio_quot_set(up, quot); in serial_txx9_set_termios()
725 sio_out(up, TXX9_SIFCR, fcr); in serial_txx9_set_termios()
727 serial_txx9_set_mctrl(&up->port, up->port.mctrl); in serial_txx9_set_termios()
728 spin_unlock_irqrestore(&up->port.lock, flags); in serial_txx9_set_termios()
747 static int serial_txx9_request_resource(struct uart_txx9_port *up) in serial_txx9_request_resource() argument
752 switch (up->port.iotype) { in serial_txx9_request_resource()
754 if (!up->port.mapbase) in serial_txx9_request_resource()
757 if (!request_mem_region(up->port.mapbase, size, "serial_txx9")) { in serial_txx9_request_resource()
762 if (up->port.flags & UPF_IOREMAP) { in serial_txx9_request_resource()
763 up->port.membase = ioremap(up->port.mapbase, size); in serial_txx9_request_resource()
764 if (!up->port.membase) { in serial_txx9_request_resource()
765 release_mem_region(up->port.mapbase, size); in serial_txx9_request_resource()
772 if (!request_region(up->port.iobase, size, "serial_txx9")) in serial_txx9_request_resource()
779 static void serial_txx9_release_resource(struct uart_txx9_port *up) in serial_txx9_release_resource() argument
783 switch (up->port.iotype) { in serial_txx9_release_resource()
785 if (!up->port.mapbase) in serial_txx9_release_resource()
788 if (up->port.flags & UPF_IOREMAP) { in serial_txx9_release_resource()
789 iounmap(up->port.membase); in serial_txx9_release_resource()
790 up->port.membase = NULL; in serial_txx9_release_resource()
793 release_mem_region(up->port.mapbase, size); in serial_txx9_release_resource()
797 release_region(up->port.iobase, size); in serial_txx9_release_resource()
804 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_release_port() local
805 serial_txx9_release_resource(up); in serial_txx9_release_port()
810 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_request_port() local
811 return serial_txx9_request_resource(up); in serial_txx9_request_port()
816 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_config_port() local
823 ret = serial_txx9_request_resource(up); in serial_txx9_config_port()
827 up->port.fifosize = TXX9_SIO_TX_FIFO; in serial_txx9_config_port()
830 if (up->port.line == up->port.cons->index) in serial_txx9_config_port()
872 struct uart_txx9_port *up = &serial_txx9_ports[i]; in serial_txx9_register_ports() local
874 up->port.line = i; in serial_txx9_register_ports()
875 up->port.ops = &serial_txx9_pops; in serial_txx9_register_ports()
876 up->port.dev = dev; in serial_txx9_register_ports()
877 if (up->port.iobase || up->port.mapbase) in serial_txx9_register_ports()
878 uart_add_one_port(drv, &up->port); in serial_txx9_register_ports()
886 struct uart_txx9_port *up = to_uart_txx9_port(port); in serial_txx9_console_putchar() local
888 wait_for_xmitr(up); in serial_txx9_console_putchar()
889 sio_out(up, TXX9_SITFIFO, ch); in serial_txx9_console_putchar()
901 struct uart_txx9_port *up = &serial_txx9_ports[co->index]; in serial_txx9_console_write() local
907 ier = sio_in(up, TXX9_SIDICR); in serial_txx9_console_write()
908 sio_out(up, TXX9_SIDICR, 0); in serial_txx9_console_write()
912 flcr = sio_in(up, TXX9_SIFLCR); in serial_txx9_console_write()
913 if (!(up->port.flags & UPF_CONS_FLOW) && (flcr & TXX9_SIFLCR_TES)) in serial_txx9_console_write()
914 sio_out(up, TXX9_SIFLCR, flcr & ~TXX9_SIFLCR_TES); in serial_txx9_console_write()
916 uart_console_write(&up->port, s, count, serial_txx9_console_putchar); in serial_txx9_console_write()
922 wait_for_xmitr(up); in serial_txx9_console_write()
923 sio_out(up, TXX9_SIFLCR, flcr); in serial_txx9_console_write()
924 sio_out(up, TXX9_SIDICR, ier); in serial_txx9_console_write()
930 struct uart_txx9_port *up; in serial_txx9_console_setup() local
943 up = &serial_txx9_ports[co->index]; in serial_txx9_console_setup()
944 port = &up->port; in serial_txx9_console_setup()
948 serial_txx9_initialize(&up->port); in serial_txx9_console_setup()
1116 struct uart_txx9_port *up = &serial_txx9_ports[i]; in serial_txx9_remove() local
1118 if (up->port.dev == &dev->dev) in serial_txx9_remove()
1130 struct uart_txx9_port *up = &serial_txx9_ports[i]; in serial_txx9_suspend() local
1132 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) in serial_txx9_suspend()
1133 uart_suspend_port(&serial_txx9_reg, &up->port); in serial_txx9_suspend()
1144 struct uart_txx9_port *up = &serial_txx9_ports[i]; in serial_txx9_resume() local
1146 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) in serial_txx9_resume()
1147 uart_resume_port(&serial_txx9_reg, &up->port); in serial_txx9_resume()
1203 struct uart_txx9_port *up = pci_get_drvdata(dev); in pciserial_txx9_remove_one() local
1205 if (up) { in pciserial_txx9_remove_one()
1206 serial_txx9_unregister_port(up->port.line); in pciserial_txx9_remove_one()
1214 struct uart_txx9_port *up = pci_get_drvdata(dev); in pciserial_txx9_suspend_one() local
1216 if (up) in pciserial_txx9_suspend_one()
1217 uart_suspend_port(&serial_txx9_reg, &up->port); in pciserial_txx9_suspend_one()
1225 struct uart_txx9_port *up = pci_get_drvdata(dev); in pciserial_txx9_resume_one() local
1229 if (up) in pciserial_txx9_resume_one()
1230 uart_resume_port(&serial_txx9_reg, &up->port); in pciserial_txx9_resume_one()
1312 struct uart_txx9_port *up = &serial_txx9_ports[i]; in serial_txx9_exit() local
1313 if (up->port.iobase || up->port.mapbase) in serial_txx9_exit()
1314 uart_remove_one_port(&serial_txx9_reg, &up->port); in serial_txx9_exit()