• Home
  • Raw
  • Download

Lines Matching refs:port

55 #define siu_read(port, offset)		readb((port)->membase + (offset))  argument
56 #define siu_write(port, offset, value) writeb((value), (port)->membase + (offset)) argument
60 struct uart_port *port; in vr41xx_select_siu_interface() local
64 port = &siu_uart_ports[0]; in vr41xx_select_siu_interface()
66 spin_lock_irqsave(&port->lock, flags); in vr41xx_select_siu_interface()
68 irsel = siu_read(port, SIUIRSEL); in vr41xx_select_siu_interface()
73 siu_write(port, SIUIRSEL, irsel); in vr41xx_select_siu_interface()
75 spin_unlock_irqrestore(&port->lock, flags); in vr41xx_select_siu_interface()
81 struct uart_port *port; in vr41xx_use_irda() local
85 port = &siu_uart_ports[0]; in vr41xx_use_irda()
87 spin_lock_irqsave(&port->lock, flags); in vr41xx_use_irda()
89 irsel = siu_read(port, SIUIRSEL); in vr41xx_use_irda()
94 siu_write(port, SIUIRSEL, irsel); in vr41xx_use_irda()
96 spin_unlock_irqrestore(&port->lock, flags); in vr41xx_use_irda()
102 struct uart_port *port; in vr41xx_select_irda_module() local
106 port = &siu_uart_ports[0]; in vr41xx_select_irda_module()
108 spin_lock_irqsave(&port->lock, flags); in vr41xx_select_irda_module()
110 irsel = siu_read(port, SIUIRSEL); in vr41xx_select_irda_module()
127 siu_write(port, SIUIRSEL, irsel); in vr41xx_select_irda_module()
129 spin_unlock_irqrestore(&port->lock, flags); in vr41xx_select_irda_module()
133 static inline void siu_clear_fifo(struct uart_port *port) in siu_clear_fifo() argument
135 siu_write(port, UART_FCR, UART_FCR_ENABLE_FIFO); in siu_clear_fifo()
136 siu_write(port, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | in siu_clear_fifo()
138 siu_write(port, UART_FCR, 0); in siu_clear_fifo()
141 static inline unsigned long siu_port_size(struct uart_port *port) in siu_port_size() argument
143 switch (port->type) { in siu_port_size()
153 static inline unsigned int siu_check_type(struct uart_port *port) in siu_check_type() argument
155 if (port->line == 0) in siu_check_type()
157 if (port->line == 1 && port->irq) in siu_check_type()
163 static inline const char *siu_type_name(struct uart_port *port) in siu_type_name() argument
165 switch (port->type) { in siu_type_name()
175 static unsigned int siu_tx_empty(struct uart_port *port) in siu_tx_empty() argument
179 lsr = siu_read(port, UART_LSR); in siu_tx_empty()
186 static void siu_set_mctrl(struct uart_port *port, unsigned int mctrl) in siu_set_mctrl() argument
201 siu_write(port, UART_MCR, mcr); in siu_set_mctrl()
204 static unsigned int siu_get_mctrl(struct uart_port *port) in siu_get_mctrl() argument
209 msr = siu_read(port, UART_MSR); in siu_get_mctrl()
222 static void siu_stop_tx(struct uart_port *port) in siu_stop_tx() argument
227 spin_lock_irqsave(&port->lock, flags); in siu_stop_tx()
229 ier = siu_read(port, UART_IER); in siu_stop_tx()
231 siu_write(port, UART_IER, ier); in siu_stop_tx()
233 spin_unlock_irqrestore(&port->lock, flags); in siu_stop_tx()
236 static void siu_start_tx(struct uart_port *port) in siu_start_tx() argument
241 spin_lock_irqsave(&port->lock, flags); in siu_start_tx()
243 ier = siu_read(port, UART_IER); in siu_start_tx()
245 siu_write(port, UART_IER, ier); in siu_start_tx()
247 spin_unlock_irqrestore(&port->lock, flags); in siu_start_tx()
250 static void siu_stop_rx(struct uart_port *port) in siu_stop_rx() argument
255 spin_lock_irqsave(&port->lock, flags); in siu_stop_rx()
257 ier = siu_read(port, UART_IER); in siu_stop_rx()
259 siu_write(port, UART_IER, ier); in siu_stop_rx()
261 port->read_status_mask &= ~UART_LSR_DR; in siu_stop_rx()
263 spin_unlock_irqrestore(&port->lock, flags); in siu_stop_rx()
266 static void siu_enable_ms(struct uart_port *port) in siu_enable_ms() argument
271 spin_lock_irqsave(&port->lock, flags); in siu_enable_ms()
273 ier = siu_read(port, UART_IER); in siu_enable_ms()
275 siu_write(port, UART_IER, ier); in siu_enable_ms()
277 spin_unlock_irqrestore(&port->lock, flags); in siu_enable_ms()
280 static void siu_break_ctl(struct uart_port *port, int ctl) in siu_break_ctl() argument
285 spin_lock_irqsave(&port->lock, flags); in siu_break_ctl()
287 lcr = siu_read(port, UART_LCR); in siu_break_ctl()
292 siu_write(port, UART_LCR, lcr); in siu_break_ctl()
294 spin_unlock_irqrestore(&port->lock, flags); in siu_break_ctl()
297 static inline void receive_chars(struct uart_port *port, uint8_t *status) in receive_chars() argument
306 ch = siu_read(port, UART_RX); in receive_chars()
307 port->icount.rx++; in receive_chars()
311 lsr |= lsr_break_flag[port->line]; in receive_chars()
312 lsr_break_flag[port->line] = 0; in receive_chars()
318 port->icount.brk++; in receive_chars()
320 if (uart_handle_break(port)) in receive_chars()
325 port->icount.frame++; in receive_chars()
327 port->icount.parity++; in receive_chars()
329 port->icount.overrun++; in receive_chars()
331 lsr &= port->read_status_mask; in receive_chars()
340 if (uart_handle_sysrq_char(port, ch)) in receive_chars()
343 uart_insert_char(port, lsr, UART_LSR_OE, ch, flag); in receive_chars()
346 lsr = siu_read(port, UART_LSR); in receive_chars()
349 tty_flip_buffer_push(&port->state->port); in receive_chars()
354 static inline void check_modem_status(struct uart_port *port) in check_modem_status() argument
358 msr = siu_read(port, UART_MSR); in check_modem_status()
362 uart_handle_dcd_change(port, msr & UART_MSR_DCD); in check_modem_status()
364 port->icount.rng++; in check_modem_status()
366 port->icount.dsr++; in check_modem_status()
368 uart_handle_cts_change(port, msr & UART_MSR_CTS); in check_modem_status()
370 wake_up_interruptible(&port->state->port.delta_msr_wait); in check_modem_status()
373 static inline void transmit_chars(struct uart_port *port) in transmit_chars() argument
378 xmit = &port->state->xmit; in transmit_chars()
380 if (port->x_char) { in transmit_chars()
381 siu_write(port, UART_TX, port->x_char); in transmit_chars()
382 port->icount.tx++; in transmit_chars()
383 port->x_char = 0; in transmit_chars()
387 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { in transmit_chars()
388 siu_stop_tx(port); in transmit_chars()
393 siu_write(port, UART_TX, xmit->buf[xmit->tail]); in transmit_chars()
395 port->icount.tx++; in transmit_chars()
401 uart_write_wakeup(port); in transmit_chars()
404 siu_stop_tx(port); in transmit_chars()
409 struct uart_port *port; in siu_interrupt() local
412 port = (struct uart_port *)dev_id; in siu_interrupt()
414 iir = siu_read(port, UART_IIR); in siu_interrupt()
418 lsr = siu_read(port, UART_LSR); in siu_interrupt()
420 receive_chars(port, &lsr); in siu_interrupt()
422 check_modem_status(port); in siu_interrupt()
425 transmit_chars(port); in siu_interrupt()
430 static int siu_startup(struct uart_port *port) in siu_startup() argument
434 if (port->membase == NULL) in siu_startup()
437 siu_clear_fifo(port); in siu_startup()
439 (void)siu_read(port, UART_LSR); in siu_startup()
440 (void)siu_read(port, UART_RX); in siu_startup()
441 (void)siu_read(port, UART_IIR); in siu_startup()
442 (void)siu_read(port, UART_MSR); in siu_startup()
444 if (siu_read(port, UART_LSR) == 0xff) in siu_startup()
447 retval = request_irq(port->irq, siu_interrupt, 0, siu_type_name(port), port); in siu_startup()
451 if (port->type == PORT_VR41XX_DSIU) in siu_startup()
454 siu_write(port, UART_LCR, UART_LCR_WLEN8); in siu_startup()
456 spin_lock_irq(&port->lock); in siu_startup()
457 siu_set_mctrl(port, port->mctrl); in siu_startup()
458 spin_unlock_irq(&port->lock); in siu_startup()
460 siu_write(port, UART_IER, UART_IER_RLSI | UART_IER_RDI); in siu_startup()
462 (void)siu_read(port, UART_LSR); in siu_startup()
463 (void)siu_read(port, UART_RX); in siu_startup()
464 (void)siu_read(port, UART_IIR); in siu_startup()
465 (void)siu_read(port, UART_MSR); in siu_startup()
470 static void siu_shutdown(struct uart_port *port) in siu_shutdown() argument
475 siu_write(port, UART_IER, 0); in siu_shutdown()
477 spin_lock_irqsave(&port->lock, flags); in siu_shutdown()
479 port->mctrl &= ~TIOCM_OUT2; in siu_shutdown()
480 siu_set_mctrl(port, port->mctrl); in siu_shutdown()
482 spin_unlock_irqrestore(&port->lock, flags); in siu_shutdown()
484 lcr = siu_read(port, UART_LCR); in siu_shutdown()
486 siu_write(port, UART_LCR, lcr); in siu_shutdown()
488 siu_clear_fifo(port); in siu_shutdown()
490 (void)siu_read(port, UART_RX); in siu_shutdown()
492 if (port->type == PORT_VR41XX_DSIU) in siu_shutdown()
495 free_irq(port->irq, port); in siu_shutdown()
498 static void siu_set_termios(struct uart_port *port, struct ktermios *new, in siu_set_termios() argument
531 baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16); in siu_set_termios()
532 quot = uart_get_divisor(port, baud); in siu_set_termios()
536 spin_lock_irqsave(&port->lock, flags); in siu_set_termios()
538 uart_update_timeout(port, c_cflag, baud); in siu_set_termios()
542 port->read_status_mask = UART_LSR_THRE | UART_LSR_OE | UART_LSR_DR; in siu_set_termios()
544 port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; in siu_set_termios()
546 port->read_status_mask |= UART_LSR_BI; in siu_set_termios()
548 port->ignore_status_mask = 0; in siu_set_termios()
550 port->ignore_status_mask |= UART_LSR_FE | UART_LSR_PE; in siu_set_termios()
552 port->ignore_status_mask |= UART_LSR_BI; in siu_set_termios()
554 port->ignore_status_mask |= UART_LSR_OE; in siu_set_termios()
558 port->ignore_status_mask |= UART_LSR_DR; in siu_set_termios()
560 ier = siu_read(port, UART_IER); in siu_set_termios()
562 if (UART_ENABLE_MS(port, c_cflag)) in siu_set_termios()
564 siu_write(port, UART_IER, ier); in siu_set_termios()
566 siu_write(port, UART_LCR, lcr | UART_LCR_DLAB); in siu_set_termios()
568 siu_write(port, UART_DLL, (uint8_t)quot); in siu_set_termios()
569 siu_write(port, UART_DLM, (uint8_t)(quot >> 8)); in siu_set_termios()
571 siu_write(port, UART_LCR, lcr); in siu_set_termios()
573 siu_write(port, UART_FCR, fcr); in siu_set_termios()
575 siu_set_mctrl(port, port->mctrl); in siu_set_termios()
577 spin_unlock_irqrestore(&port->lock, flags); in siu_set_termios()
580 static void siu_pm(struct uart_port *port, unsigned int state, unsigned int oldstate) in siu_pm() argument
584 switch (port->type) { in siu_pm()
594 switch (port->type) { in siu_pm()
606 static const char *siu_type(struct uart_port *port) in siu_type() argument
608 return siu_type_name(port); in siu_type()
611 static void siu_release_port(struct uart_port *port) in siu_release_port() argument
615 if (port->flags & UPF_IOREMAP) { in siu_release_port()
616 iounmap(port->membase); in siu_release_port()
617 port->membase = NULL; in siu_release_port()
620 size = siu_port_size(port); in siu_release_port()
621 release_mem_region(port->mapbase, size); in siu_release_port()
624 static int siu_request_port(struct uart_port *port) in siu_request_port() argument
629 size = siu_port_size(port); in siu_request_port()
630 res = request_mem_region(port->mapbase, size, siu_type_name(port)); in siu_request_port()
634 if (port->flags & UPF_IOREMAP) { in siu_request_port()
635 port->membase = ioremap(port->mapbase, size); in siu_request_port()
636 if (port->membase == NULL) { in siu_request_port()
645 static void siu_config_port(struct uart_port *port, int flags) in siu_config_port() argument
648 port->type = siu_check_type(port); in siu_config_port()
649 (void)siu_request_port(port); in siu_config_port()
653 static int siu_verify_port(struct uart_port *port, struct serial_struct *serial) in siu_verify_port() argument
655 if (port->type != PORT_VR41XX_SIU && port->type != PORT_VR41XX_DSIU) in siu_verify_port()
657 if (port->irq != serial->irq) in siu_verify_port()
659 if (port->iotype != serial->io_type) in siu_verify_port()
661 if (port->mapbase != (unsigned long)serial->iomem_base) in siu_verify_port()
689 struct uart_port *port; in siu_init_ports() local
697 port = siu_uart_ports; in siu_init_ports()
699 port->type = type[i]; in siu_init_ports()
700 if (port->type == PORT_UNKNOWN) in siu_init_ports()
702 port->irq = platform_get_irq(pdev, i); in siu_init_ports()
703 port->uartclk = SIU_BAUD_BASE * 16; in siu_init_ports()
704 port->fifosize = 16; in siu_init_ports()
705 port->regshift = 0; in siu_init_ports()
706 port->iotype = UPIO_MEM; in siu_init_ports()
707 port->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; in siu_init_ports()
708 port->line = i; in siu_init_ports()
710 port->mapbase = res->start; in siu_init_ports()
711 port++; in siu_init_ports()
721 static void wait_for_xmitr(struct uart_port *port) in wait_for_xmitr() argument
727 lsr = siu_read(port, UART_LSR); in wait_for_xmitr()
729 lsr_break_flag[port->line] = UART_LSR_BI; in wait_for_xmitr()
735 if (port->flags & UPF_CONS_FLOW) { in wait_for_xmitr()
739 msr = siu_read(port, UART_MSR); in wait_for_xmitr()
746 static void siu_console_putchar(struct uart_port *port, int ch) in siu_console_putchar() argument
748 wait_for_xmitr(port); in siu_console_putchar()
749 siu_write(port, UART_TX, ch); in siu_console_putchar()
754 struct uart_port *port; in siu_console_write() local
757 port = &siu_uart_ports[con->index]; in siu_console_write()
759 ier = siu_read(port, UART_IER); in siu_console_write()
760 siu_write(port, UART_IER, 0); in siu_console_write()
762 uart_console_write(port, s, count, siu_console_putchar); in siu_console_write()
764 wait_for_xmitr(port); in siu_console_write()
765 siu_write(port, UART_IER, ier); in siu_console_write()
770 struct uart_port *port; in siu_console_setup() local
779 port = &siu_uart_ports[con->index]; in siu_console_setup()
780 if (port->membase == NULL) { in siu_console_setup()
781 if (port->mapbase == 0) in siu_console_setup()
783 port->membase = ioremap(port->mapbase, siu_port_size(port)); in siu_console_setup()
786 if (port->type == PORT_VR41XX_SIU) in siu_console_setup()
792 return uart_set_options(port, con, baud, parity, bits, flow); in siu_console_setup()
809 struct uart_port *port; in siu_console_init() local
813 port = &siu_uart_ports[i]; in siu_console_init()
814 port->ops = &siu_uart_ops; in siu_console_init()
824 void __init vr41xx_siu_early_setup(struct uart_port *port) in vr41xx_siu_early_setup() argument
826 if (port->type == PORT_UNKNOWN) in vr41xx_siu_early_setup()
829 siu_uart_ports[port->line].line = port->line; in vr41xx_siu_early_setup()
830 siu_uart_ports[port->line].type = port->type; in vr41xx_siu_early_setup()
831 siu_uart_ports[port->line].uartclk = SIU_BAUD_BASE * 16; in vr41xx_siu_early_setup()
832 siu_uart_ports[port->line].mapbase = port->mapbase; in vr41xx_siu_early_setup()
833 siu_uart_ports[port->line].ops = &siu_uart_ops; in vr41xx_siu_early_setup()
852 struct uart_port *port; in siu_probe() local
865 port = &siu_uart_ports[i]; in siu_probe()
866 port->ops = &siu_uart_ops; in siu_probe()
867 port->dev = &dev->dev; in siu_probe()
868 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_VR41XX_CONSOLE); in siu_probe()
870 retval = uart_add_one_port(&siu_uart_driver, port); in siu_probe()
872 port->dev = NULL; in siu_probe()
887 struct uart_port *port; in siu_remove() local
891 port = &siu_uart_ports[i]; in siu_remove()
892 if (port->dev == &dev->dev) { in siu_remove()
893 uart_remove_one_port(&siu_uart_driver, port); in siu_remove()
894 port->dev = NULL; in siu_remove()
905 struct uart_port *port; in siu_suspend() local
909 port = &siu_uart_ports[i]; in siu_suspend()
910 if ((port->type == PORT_VR41XX_SIU || in siu_suspend()
911 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) in siu_suspend()
912 uart_suspend_port(&siu_uart_driver, port); in siu_suspend()
921 struct uart_port *port; in siu_resume() local
925 port = &siu_uart_ports[i]; in siu_resume()
926 if ((port->type == PORT_VR41XX_SIU || in siu_resume()
927 port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) in siu_resume()
928 uart_resume_port(&siu_uart_driver, port); in siu_resume()