Lines Matching refs:uport

100 #define to_sport(uport) container_of(uport, struct sbd_port, port)  argument
232 static unsigned int sbd_tx_empty(struct uart_port *uport) in sbd_tx_empty() argument
234 struct sbd_port *sport = to_sport(uport); in sbd_tx_empty()
239 static unsigned int sbd_get_mctrl(struct uart_port *uport) in sbd_get_mctrl() argument
241 struct sbd_port *sport = to_sport(uport); in sbd_get_mctrl()
245 status >>= (uport->line) % 2; in sbd_get_mctrl()
253 static void sbd_set_mctrl(struct uart_port *uport, unsigned int mctrl) in sbd_set_mctrl() argument
255 struct sbd_port *sport = to_sport(uport); in sbd_set_mctrl()
266 clr <<= (uport->line) % 2; in sbd_set_mctrl()
267 set <<= (uport->line) % 2; in sbd_set_mctrl()
281 static void sbd_stop_tx(struct uart_port *uport) in sbd_stop_tx() argument
283 struct sbd_port *sport = to_sport(uport); in sbd_stop_tx()
289 static void sbd_start_tx(struct uart_port *uport) in sbd_start_tx() argument
291 struct sbd_port *sport = to_sport(uport); in sbd_start_tx()
295 mask = read_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2)); in sbd_start_tx()
297 write_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2), mask); in sbd_start_tx()
304 static void sbd_stop_rx(struct uart_port *uport) in sbd_stop_rx() argument
306 struct sbd_port *sport = to_sport(uport); in sbd_stop_rx()
308 write_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2), 0); in sbd_stop_rx()
311 static void sbd_enable_ms(struct uart_port *uport) in sbd_enable_ms() argument
313 struct sbd_port *sport = to_sport(uport); in sbd_enable_ms()
319 static void sbd_break_ctl(struct uart_port *uport, int break_state) in sbd_break_ctl() argument
321 struct sbd_port *sport = to_sport(uport); in sbd_break_ctl()
332 struct uart_port *uport = &sport->port; in sbd_receive_chars() local
346 icount = &uport->icount; in sbd_receive_chars()
354 if (uart_handle_break(uport)) in sbd_receive_chars()
363 status &= uport->read_status_mask; in sbd_receive_chars()
372 if (uart_handle_sysrq_char(uport, ch)) in sbd_receive_chars()
375 uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag); in sbd_receive_chars()
378 tty_flip_buffer_push(&uport->state->port); in sbd_receive_chars()
383 struct uart_port *uport = &sport->port; in sbd_transmit_chars() local
412 mask = read_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2)); in sbd_transmit_chars()
414 write_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2), mask); in sbd_transmit_chars()
420 struct uart_port *uport = &sport->port; in sbd_status_handle() local
423 delta = read_sbdshr(sport, R_DUART_INCHREG((uport->line) % 2)); in sbd_status_handle()
424 delta >>= (uport->line) % 2; in sbd_status_handle()
427 uart_handle_cts_change(uport, !(delta & M_DUART_IN_PIN0_VAL)); in sbd_status_handle()
430 uport->icount.dsr++; in sbd_status_handle()
434 wake_up_interruptible(&uport->state->port.delta_msr_wait); in sbd_status_handle()
440 struct uart_port *uport = &sport->port; in sbd_interrupt() local
447 R_DUART_ISRREG((uport->line) % 2)); in sbd_interrupt()
449 R_DUART_IMRREG((uport->line) % 2)); in sbd_interrupt()
468 static int sbd_startup(struct uart_port *uport) in sbd_startup() argument
470 struct sbd_port *sport = to_sport(uport); in sbd_startup()
484 read_sbdshr(sport, R_DUART_INCHREG((uport->line) % 2)); in sbd_startup()
496 write_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2), in sbd_startup()
502 static void sbd_shutdown(struct uart_port *uport) in sbd_shutdown() argument
504 struct sbd_port *sport = to_sport(uport); in sbd_shutdown()
514 struct uart_port *uport = &sport->port; in sbd_init_port() local
528 write_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2), 0); in sbd_init_port()
533 static void sbd_set_termios(struct uart_port *uport, struct ktermios *termios, in sbd_set_termios() argument
536 struct sbd_port *sport = to_sport(uport); in sbd_set_termios()
578 baud = uart_get_baud_rate(uport, termios, old_termios, 1200, 5000000); in sbd_set_termios()
584 uart_update_timeout(uport, termios->c_cflag, baud); in sbd_set_termios()
586 uport->read_status_mask = M_DUART_OVRUN_ERR; in sbd_set_termios()
588 uport->read_status_mask |= M_DUART_FRM_ERR | in sbd_set_termios()
591 uport->read_status_mask |= M_DUART_RCVD_BRK; in sbd_set_termios()
593 uport->ignore_status_mask = 0; in sbd_set_termios()
595 uport->ignore_status_mask |= M_DUART_FRM_ERR | in sbd_set_termios()
598 uport->ignore_status_mask |= M_DUART_RCVD_BRK; in sbd_set_termios()
600 uport->ignore_status_mask |= M_DUART_OVRUN_ERR; in sbd_set_termios()
613 spin_lock(&uport->lock); in sbd_set_termios()
635 spin_unlock(&uport->lock); in sbd_set_termios()
639 static const char *sbd_type(struct uart_port *uport) in sbd_type() argument
644 static void sbd_release_port(struct uart_port *uport) in sbd_release_port() argument
646 struct sbd_port *sport = to_sport(uport); in sbd_release_port()
651 iounmap(uport->membase); in sbd_release_port()
652 uport->membase = NULL; in sbd_release_port()
656 release_mem_region(uport->mapbase, DUART_CHANREG_SPACING); in sbd_release_port()
659 static int sbd_map_port(struct uart_port *uport) in sbd_map_port() argument
662 struct sbd_port *sport = to_sport(uport); in sbd_map_port()
665 if (!uport->membase) in sbd_map_port()
666 uport->membase = ioremap(uport->mapbase, in sbd_map_port()
668 if (!uport->membase) { in sbd_map_port()
678 iounmap(uport->membase); in sbd_map_port()
679 uport->membase = NULL; in sbd_map_port()
686 static int sbd_request_port(struct uart_port *uport) in sbd_request_port() argument
689 struct sbd_duart *duart = to_sport(uport)->duart; in sbd_request_port()
692 if (!request_mem_region(uport->mapbase, DUART_CHANREG_SPACING, in sbd_request_port()
707 ret = sbd_map_port(uport); in sbd_request_port()
715 release_mem_region(uport->mapbase, DUART_CHANREG_SPACING); in sbd_request_port()
721 static void sbd_config_port(struct uart_port *uport, int flags) in sbd_config_port() argument
723 struct sbd_port *sport = to_sport(uport); in sbd_config_port()
726 if (sbd_request_port(uport)) in sbd_config_port()
729 uport->type = PORT_SB1250_DUART; in sbd_config_port()
735 static int sbd_verify_port(struct uart_port *uport, struct serial_struct *ser) in sbd_verify_port() argument
741 if (ser->irq != uport->irq) in sbd_verify_port()
743 if (ser->baud_base != uport->uartclk / 16) in sbd_verify_port()
799 struct uart_port *uport = &sport->port; in sbd_probe_duarts() local
803 uport->irq = SBD_INT(line); in sbd_probe_duarts()
804 uport->uartclk = 100000000 / 20 * 16; in sbd_probe_duarts()
805 uport->fifosize = 16; in sbd_probe_duarts()
806 uport->iotype = UPIO_MEM; in sbd_probe_duarts()
807 uport->flags = UPF_BOOT_AUTOCONF; in sbd_probe_duarts()
808 uport->ops = &sbd_ops; in sbd_probe_duarts()
809 uport->line = line; in sbd_probe_duarts()
810 uport->mapbase = SBD_CHANREGS(line); in sbd_probe_duarts()
811 uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SB1250_DUART_CONSOLE); in sbd_probe_duarts()
823 static void sbd_console_putchar(struct uart_port *uport, int ch) in sbd_console_putchar() argument
825 struct sbd_port *sport = to_sport(uport); in sbd_console_putchar()
837 struct uart_port *uport = &sport->port; in sbd_console_write() local
842 spin_lock_irqsave(&uport->lock, flags); in sbd_console_write()
843 mask = read_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2)); in sbd_console_write()
844 write_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2), in sbd_console_write()
847 spin_unlock_irqrestore(&uport->lock, flags); in sbd_console_write()
852 spin_lock_irqsave(&uport->lock, flags); in sbd_console_write()
856 write_sbdshr(sport, R_DUART_IMRREG((uport->line) % 2), mask); in sbd_console_write()
857 spin_unlock_irqrestore(&uport->lock, flags); in sbd_console_write()
865 struct uart_port *uport = &sport->port; in sbd_console_setup() local
875 ret = sbd_map_port(uport); in sbd_console_setup()
883 return uart_set_options(uport, co, baud, parity, bits, flow); in sbd_console_setup()
937 struct uart_port *uport = &sport->port; in sbd_init() local
940 uart_add_one_port(&sbd_reg, uport); in sbd_init()
954 struct uart_port *uport = &sport->port; in sbd_exit() local
957 uart_remove_one_port(&sbd_reg, uport); in sbd_exit()