Lines Matching refs:sport
160 static void linflex_put_char(struct uart_port *sport, unsigned char c) in linflex_put_char() argument
164 writeb(c, sport->membase + BDRL); in linflex_put_char()
167 while (((status = readl(sport->membase + UARTSR)) & in linflex_put_char()
172 writel(status | LINFLEXD_UARTSR_DTFTFF, sport->membase + UARTSR); in linflex_put_char()
175 static inline void linflex_transmit_buffer(struct uart_port *sport) in linflex_transmit_buffer() argument
177 struct tty_port *tport = &sport->state->port; in linflex_transmit_buffer()
180 while (uart_fifo_get(sport, &c)) { in linflex_transmit_buffer()
181 linflex_put_char(sport, c); in linflex_transmit_buffer()
182 sport->icount.tx++; in linflex_transmit_buffer()
186 uart_write_wakeup(sport); in linflex_transmit_buffer()
189 linflex_stop_tx(sport); in linflex_transmit_buffer()
203 struct uart_port *sport = dev_id; in linflex_txint() local
204 struct tty_port *tport = &sport->state->port; in linflex_txint()
207 uart_port_lock_irqsave(sport, &flags); in linflex_txint()
209 if (sport->x_char) { in linflex_txint()
210 linflex_put_char(sport, sport->x_char); in linflex_txint()
214 if (kfifo_is_empty(&tport->xmit_fifo) || uart_tx_stopped(sport)) { in linflex_txint()
215 linflex_stop_tx(sport); in linflex_txint()
219 linflex_transmit_buffer(sport); in linflex_txint()
221 uart_port_unlock_irqrestore(sport, flags); in linflex_txint()
227 struct uart_port *sport = dev_id; in linflex_rxint() local
229 struct tty_port *port = &sport->state->port; in linflex_rxint()
234 uart_port_lock_irqsave(sport, &flags); in linflex_rxint()
236 status = readl(sport->membase + UARTSR); in linflex_rxint()
238 rx = readb(sport->membase + BDRM); in linflex_rxint()
241 sport->icount.rx++; in linflex_rxint()
246 sport->icount.overrun++; in linflex_rxint()
250 sport->icount.brk++; in linflex_rxint()
252 sport->icount.frame++; in linflex_rxint()
255 sport->icount.parity++; in linflex_rxint()
258 writel(status, sport->membase + UARTSR); in linflex_rxint()
259 status = readl(sport->membase + UARTSR); in linflex_rxint()
262 uart_handle_break(sport); in linflex_rxint()
264 if (uart_handle_sysrq_char(sport, (unsigned char)rx)) in linflex_rxint()
270 uart_port_unlock_irqrestore(sport, flags); in linflex_rxint()
279 struct uart_port *sport = dev_id; in linflex_int() local
282 status = readl(sport->membase + UARTSR); in linflex_int()
315 static void linflex_setup_watermark(struct uart_port *sport) in linflex_setup_watermark() argument
320 ier = readl(sport->membase + LINIER); in linflex_setup_watermark()
322 writel(ier, sport->membase + LINIER); in linflex_setup_watermark()
324 cr = readl(sport->membase + UARTCR); in linflex_setup_watermark()
326 writel(cr, sport->membase + UARTCR); in linflex_setup_watermark()
333 writel(cr1, sport->membase + LINCR1); in linflex_setup_watermark()
336 while ((readl(sport->membase + LINSR) in linflex_setup_watermark()
350 writel(LINFLEXD_UARTCR_UART, sport->membase + UARTCR); in linflex_setup_watermark()
355 writel(cr, sport->membase + UARTCR); in linflex_setup_watermark()
359 writel(cr1, sport->membase + LINCR1); in linflex_setup_watermark()
361 ier = readl(sport->membase + LINIER); in linflex_setup_watermark()
365 writel(ier, sport->membase + LINIER); in linflex_setup_watermark()
623 static void linflex_string_write(struct uart_port *sport, const char *s, in linflex_string_write() argument
628 ier = readl(sport->membase + LINIER); in linflex_string_write()
629 linflex_stop_tx(sport); in linflex_string_write()
631 cr = readl(sport->membase + UARTCR); in linflex_string_write()
633 writel(cr, sport->membase + UARTCR); in linflex_string_write()
635 uart_console_write(sport, s, count, linflex_console_putchar); in linflex_string_write()
637 writel(ier, sport->membase + LINIER); in linflex_string_write()
643 struct uart_port *sport = linflex_ports[co->index]; in linflex_console_write() local
647 if (sport->sysrq) in linflex_console_write()
650 locked = uart_port_trylock_irqsave(sport, &flags); in linflex_console_write()
652 uart_port_lock_irqsave(sport, &flags); in linflex_console_write()
654 linflex_string_write(sport, s, count); in linflex_console_write()
657 uart_port_unlock_irqrestore(sport, flags); in linflex_console_write()
665 linflex_console_get_options(struct uart_port *sport, int *parity, int *bits) in linflex_console_get_options() argument
669 cr = readl(sport->membase + UARTCR); in linflex_console_get_options()
695 struct uart_port *sport; in linflex_console_setup() local
711 sport = linflex_ports[co->index]; in linflex_console_setup()
712 if (!sport) in linflex_console_setup()
718 linflex_console_get_options(sport, &parity, &bits); in linflex_console_setup()
720 if (earlycon_port && sport->mapbase == earlycon_port->mapbase) { in linflex_console_setup()
734 linflex_setup_watermark(sport); in linflex_console_setup()
736 ret = uart_set_options(sport, co, baud, parity, bits, flow); in linflex_console_setup()
810 struct uart_port *sport; in linflex_probe() local
814 sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); in linflex_probe()
815 if (!sport) in linflex_probe()
829 sport->line = ret; in linflex_probe()
831 sport->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in linflex_probe()
832 if (IS_ERR(sport->membase)) in linflex_probe()
833 return PTR_ERR(sport->membase); in linflex_probe()
834 sport->mapbase = res->start; in linflex_probe()
840 sport->dev = &pdev->dev; in linflex_probe()
841 sport->iotype = UPIO_MEM; in linflex_probe()
842 sport->irq = ret; in linflex_probe()
843 sport->ops = &linflex_pops; in linflex_probe()
844 sport->flags = UPF_BOOT_AUTOCONF; in linflex_probe()
845 sport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE); in linflex_probe()
847 linflex_ports[sport->line] = sport; in linflex_probe()
849 platform_set_drvdata(pdev, sport); in linflex_probe()
851 return uart_add_one_port(&linflex_reg, sport); in linflex_probe()
856 struct uart_port *sport = platform_get_drvdata(pdev); in linflex_remove() local
858 uart_remove_one_port(&linflex_reg, sport); in linflex_remove()
864 struct uart_port *sport = dev_get_drvdata(dev); in linflex_suspend() local
866 uart_suspend_port(&linflex_reg, sport); in linflex_suspend()
873 struct uart_port *sport = dev_get_drvdata(dev); in linflex_resume() local
875 uart_resume_port(&linflex_reg, sport); in linflex_resume()