Lines Matching refs:sport
160 static inline void linflex_transmit_buffer(struct uart_port *sport) in linflex_transmit_buffer() argument
162 struct circ_buf *xmit = &sport->state->xmit; in linflex_transmit_buffer()
168 writeb(c, sport->membase + BDRL); in linflex_transmit_buffer()
171 while (((status = readl(sport->membase + UARTSR)) & in linflex_transmit_buffer()
177 sport->icount.tx++; in linflex_transmit_buffer()
180 sport->membase + UARTSR); in linflex_transmit_buffer()
184 uart_write_wakeup(sport); in linflex_transmit_buffer()
187 linflex_stop_tx(sport); in linflex_transmit_buffer()
201 struct uart_port *sport = dev_id; in linflex_txint() local
202 struct circ_buf *xmit = &sport->state->xmit; in linflex_txint()
206 spin_lock_irqsave(&sport->lock, flags); in linflex_txint()
208 if (sport->x_char) { in linflex_txint()
209 writeb(sport->x_char, sport->membase + BDRL); in linflex_txint()
212 while (((status = readl(sport->membase + UARTSR)) & in linflex_txint()
217 sport->membase + UARTSR); in linflex_txint()
222 if (uart_circ_empty(xmit) || uart_tx_stopped(sport)) { in linflex_txint()
223 linflex_stop_tx(sport); in linflex_txint()
227 linflex_transmit_buffer(sport); in linflex_txint()
230 uart_write_wakeup(sport); in linflex_txint()
233 spin_unlock_irqrestore(&sport->lock, flags); in linflex_txint()
239 struct uart_port *sport = dev_id; in linflex_rxint() local
241 struct tty_port *port = &sport->state->port; in linflex_rxint()
246 spin_lock_irqsave(&sport->lock, flags); in linflex_rxint()
248 status = readl(sport->membase + UARTSR); in linflex_rxint()
250 rx = readb(sport->membase + BDRM); in linflex_rxint()
253 sport->icount.rx++; in linflex_rxint()
258 sport->icount.overrun++; in linflex_rxint()
262 sport->icount.brk++; in linflex_rxint()
264 sport->icount.frame++; in linflex_rxint()
267 sport->icount.parity++; in linflex_rxint()
270 writel(status, sport->membase + UARTSR); in linflex_rxint()
271 status = readl(sport->membase + UARTSR); in linflex_rxint()
274 uart_handle_break(sport); in linflex_rxint()
276 if (uart_handle_sysrq_char(sport, (unsigned char)rx)) in linflex_rxint()
282 spin_unlock_irqrestore(&sport->lock, flags); in linflex_rxint()
291 struct uart_port *sport = dev_id; in linflex_int() local
294 status = readl(sport->membase + UARTSR); in linflex_int()
327 static void linflex_setup_watermark(struct uart_port *sport) in linflex_setup_watermark() argument
332 ier = readl(sport->membase + LINIER); in linflex_setup_watermark()
334 writel(ier, sport->membase + LINIER); in linflex_setup_watermark()
336 cr = readl(sport->membase + UARTCR); in linflex_setup_watermark()
338 writel(cr, sport->membase + UARTCR); in linflex_setup_watermark()
345 writel(cr1, sport->membase + LINCR1); in linflex_setup_watermark()
348 while ((readl(sport->membase + LINSR) in linflex_setup_watermark()
362 writel(LINFLEXD_UARTCR_UART, sport->membase + UARTCR); in linflex_setup_watermark()
367 writel(cr, sport->membase + UARTCR); in linflex_setup_watermark()
371 writel(cr1, sport->membase + LINCR1); in linflex_setup_watermark()
373 ier = readl(sport->membase + LINIER); in linflex_setup_watermark()
377 writel(ier, sport->membase + LINIER); in linflex_setup_watermark()
635 static void linflex_string_write(struct uart_port *sport, const char *s, in linflex_string_write() argument
640 ier = readl(sport->membase + LINIER); in linflex_string_write()
641 linflex_stop_tx(sport); in linflex_string_write()
643 cr = readl(sport->membase + UARTCR); in linflex_string_write()
645 writel(cr, sport->membase + UARTCR); in linflex_string_write()
647 uart_console_write(sport, s, count, linflex_console_putchar); in linflex_string_write()
649 writel(ier, sport->membase + LINIER); in linflex_string_write()
655 struct uart_port *sport = linflex_ports[co->index]; in linflex_console_write() local
659 if (sport->sysrq) in linflex_console_write()
662 locked = spin_trylock_irqsave(&sport->lock, flags); in linflex_console_write()
664 spin_lock_irqsave(&sport->lock, flags); in linflex_console_write()
666 linflex_string_write(sport, s, count); in linflex_console_write()
669 spin_unlock_irqrestore(&sport->lock, flags); in linflex_console_write()
677 linflex_console_get_options(struct uart_port *sport, int *parity, int *bits) in linflex_console_get_options() argument
681 cr = readl(sport->membase + UARTCR); in linflex_console_get_options()
707 struct uart_port *sport; in linflex_console_setup() local
723 sport = linflex_ports[co->index]; in linflex_console_setup()
724 if (!sport) in linflex_console_setup()
730 linflex_console_get_options(sport, &parity, &bits); in linflex_console_setup()
732 if (earlycon_port && sport->mapbase == earlycon_port->mapbase) { in linflex_console_setup()
746 linflex_setup_watermark(sport); in linflex_console_setup()
748 ret = uart_set_options(sport, co, baud, parity, bits, flow); in linflex_console_setup()
822 struct uart_port *sport; in linflex_probe() local
826 sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); in linflex_probe()
827 if (!sport) in linflex_probe()
841 sport->line = ret; in linflex_probe()
847 sport->mapbase = res->start; in linflex_probe()
848 sport->membase = devm_ioremap_resource(&pdev->dev, res); in linflex_probe()
849 if (IS_ERR(sport->membase)) in linflex_probe()
850 return PTR_ERR(sport->membase); in linflex_probe()
852 sport->dev = &pdev->dev; in linflex_probe()
853 sport->type = PORT_LINFLEXUART; in linflex_probe()
854 sport->iotype = UPIO_MEM; in linflex_probe()
855 sport->irq = platform_get_irq(pdev, 0); in linflex_probe()
856 sport->ops = &linflex_pops; in linflex_probe()
857 sport->flags = UPF_BOOT_AUTOCONF; in linflex_probe()
858 sport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE); in linflex_probe()
860 linflex_ports[sport->line] = sport; in linflex_probe()
862 platform_set_drvdata(pdev, sport); in linflex_probe()
864 return uart_add_one_port(&linflex_reg, sport); in linflex_probe()
869 struct uart_port *sport = platform_get_drvdata(pdev); in linflex_remove() local
871 uart_remove_one_port(&linflex_reg, sport); in linflex_remove()
879 struct uart_port *sport = dev_get_drvdata(dev); in linflex_suspend() local
881 uart_suspend_port(&linflex_reg, sport); in linflex_suspend()
888 struct uart_port *sport = dev_get_drvdata(dev); in linflex_resume() local
890 uart_resume_port(&linflex_reg, sport); in linflex_resume()