Lines Matching refs:up
174 struct uart_8250_port *up = up_to_u8250p(port); in __omap8250_set_mctrl() local
175 struct omap8250_priv *priv = up->port.private_data; in __omap8250_set_mctrl()
180 if (!mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS)) { in __omap8250_set_mctrl()
185 lcr = serial_in(up, UART_LCR); in __omap8250_set_mctrl()
186 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in __omap8250_set_mctrl()
191 serial_out(up, UART_EFR, priv->efr); in __omap8250_set_mctrl()
192 serial_out(up, UART_LCR, lcr); in __omap8250_set_mctrl()
219 static void omap_8250_mdr1_errataset(struct uart_8250_port *up, in omap_8250_mdr1_errataset() argument
222 serial_out(up, UART_OMAP_MDR1, priv->mdr1); in omap_8250_mdr1_errataset()
224 serial_out(up, UART_FCR, up->fcr | UART_FCR_CLEAR_XMIT | in omap_8250_mdr1_errataset()
271 static void omap8250_update_scr(struct uart_8250_port *up, in omap8250_update_scr() argument
276 old_scr = serial_in(up, UART_OMAP_SCR); in omap8250_update_scr()
286 serial_out(up, UART_OMAP_SCR, in omap8250_update_scr()
288 serial_out(up, UART_OMAP_SCR, priv->scr); in omap8250_update_scr()
291 static void omap8250_update_mdr1(struct uart_8250_port *up, in omap8250_update_mdr1() argument
295 omap_8250_mdr1_errataset(up, priv); in omap8250_update_mdr1()
297 serial_out(up, UART_OMAP_MDR1, priv->mdr1); in omap8250_update_mdr1()
300 static void omap8250_restore_regs(struct uart_8250_port *up) in omap8250_restore_regs() argument
302 struct omap8250_priv *priv = up->port.private_data; in omap8250_restore_regs()
303 struct uart_8250_dma *dma = up->dma; in omap8250_restore_regs()
304 u8 mcr = serial8250_in_MCR(up); in omap8250_restore_regs()
307 lockdep_assert_held_once(&up->port.lock); in omap8250_restore_regs()
320 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
321 serial_out(up, UART_EFR, UART_EFR_ECB); in omap8250_restore_regs()
323 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); in omap8250_restore_regs()
324 serial8250_out_MCR(up, mcr | UART_MCR_TCRTLR); in omap8250_restore_regs()
325 serial_out(up, UART_FCR, up->fcr); in omap8250_restore_regs()
327 omap8250_update_scr(up, priv); in omap8250_restore_regs()
329 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
331 serial_out(up, UART_TI752_TCR, OMAP_UART_TCR_RESTORE(16) | in omap8250_restore_regs()
333 serial_out(up, UART_TI752_TLR, in omap8250_restore_regs()
337 serial_out(up, UART_LCR, 0); in omap8250_restore_regs()
340 serial8250_out_MCR(up, mcr); in omap8250_restore_regs()
342 serial_out(up, UART_IER, up->ier); in omap8250_restore_regs()
344 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
345 serial_dl_write(up, priv->quot); in omap8250_restore_regs()
347 serial_out(up, UART_EFR, priv->efr); in omap8250_restore_regs()
350 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
351 serial_out(up, UART_XON1, priv->xon); in omap8250_restore_regs()
352 serial_out(up, UART_XOFF1, priv->xoff); in omap8250_restore_regs()
354 serial_out(up, UART_LCR, up->lcr); in omap8250_restore_regs()
356 omap8250_update_mdr1(up, priv); in omap8250_restore_regs()
358 __omap8250_set_mctrl(&up->port, up->port.mctrl); in omap8250_restore_regs()
360 serial_out(up, UART_OMAP_MDR3, priv->mdr3); in omap8250_restore_regs()
362 if (up->port.rs485.flags & SER_RS485_ENABLED && in omap8250_restore_regs()
363 up->port.rs485_config == serial8250_em485_config) in omap8250_restore_regs()
364 serial8250_em485_stop_tx(up); in omap8250_restore_regs()
375 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_set_termios() local
376 struct omap8250_priv *priv = up->port.private_data; in omap_8250_set_termios()
411 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; in omap_8250_set_termios()
413 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; in omap_8250_set_termios()
415 up->port.read_status_mask |= UART_LSR_BI; in omap_8250_set_termios()
420 up->port.ignore_status_mask = 0; in omap_8250_set_termios()
422 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; in omap_8250_set_termios()
424 up->port.ignore_status_mask |= UART_LSR_BI; in omap_8250_set_termios()
430 up->port.ignore_status_mask |= UART_LSR_OE; in omap_8250_set_termios()
437 up->port.ignore_status_mask |= UART_LSR_DR; in omap_8250_set_termios()
442 up->ier &= ~UART_IER_MSI; in omap_8250_set_termios()
443 if (UART_ENABLE_MS(&up->port, termios->c_cflag)) in omap_8250_set_termios()
444 up->ier |= UART_IER_MSI; in omap_8250_set_termios()
446 up->lcr = cval; in omap_8250_set_termios()
466 up->fcr = UART_FCR_ENABLE_FIFO; in omap_8250_set_termios()
467 up->fcr |= TRIGGER_FCR_MASK(priv->tx_trigger) << OMAP_UART_FCR_TX_TRIG; in omap_8250_set_termios()
468 up->fcr |= TRIGGER_FCR_MASK(priv->rx_trigger) << OMAP_UART_FCR_RX_TRIG; in omap_8250_set_termios()
473 if (up->dma) in omap_8250_set_termios()
481 up->port.status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); in omap_8250_set_termios()
483 if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW && in omap_8250_set_termios()
484 !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS) && in omap_8250_set_termios()
485 !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_CTS)) { in omap_8250_set_termios()
487 up->port.status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; in omap_8250_set_termios()
489 } else if (up->port.flags & UPF_SOFT_FLOW) { in omap_8250_set_termios()
501 up->port.status |= UPSTAT_AUTOXOFF; in omap_8250_set_termios()
505 omap8250_restore_regs(up); in omap_8250_set_termios()
507 spin_unlock_irq(&up->port.lock); in omap_8250_set_termios()
526 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_pm() local
534 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap_8250_pm()
535 efr = serial_in(up, UART_EFR); in omap_8250_pm()
536 serial_out(up, UART_EFR, efr | UART_EFR_ECB); in omap_8250_pm()
537 serial_out(up, UART_LCR, 0); in omap_8250_pm()
539 serial_out(up, UART_IER, (state != 0) ? UART_IERX_SLEEP : 0); in omap_8250_pm()
540 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap_8250_pm()
541 serial_out(up, UART_EFR, efr); in omap_8250_pm()
542 serial_out(up, UART_LCR, 0); in omap_8250_pm()
550 static void omap_serial_fill_features_erratas(struct uart_8250_port *up, in omap_serial_fill_features_erratas() argument
581 dev_warn(up->port.dev, in omap_serial_fill_features_erratas()
630 struct uart_8250_port *up = serial8250_get_port(priv->line); in omap8250_irq() local
631 struct uart_port *port = &up->port; in omap8250_irq()
636 if (up->dma) { in omap8250_irq()
642 serial8250_rpm_get(up); in omap8250_irq()
659 if ((lsr & UART_LSR_OE) && up->overrun_backoff_time_ms > 0) { in omap8250_irq()
664 up->ier = port->serial_in(port, UART_IER); in omap8250_irq()
665 if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) { in omap8250_irq()
671 cancel_delayed_work(&up->overrun_backoff); in omap8250_irq()
675 delay = msecs_to_jiffies(up->overrun_backoff_time_ms); in omap8250_irq()
676 schedule_delayed_work(&up->overrun_backoff, delay); in omap8250_irq()
679 serial8250_rpm_put(up); in omap8250_irq()
686 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_startup() local
699 serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); in omap_8250_startup()
701 serial_out(up, UART_LCR, UART_LCR_WLEN8); in omap_8250_startup()
703 up->lsr_saved_flags = 0; in omap_8250_startup()
704 up->msr_saved_flags = 0; in omap_8250_startup()
708 up->dma = &priv->omap8250_dma; in omap_8250_startup()
709 ret = serial8250_request_dma(up); in omap_8250_startup()
713 up->dma = NULL; in omap_8250_startup()
716 up->dma = NULL; in omap_8250_startup()
721 up->ier = UART_IER_RLSI | UART_IER_RDI; in omap_8250_startup()
722 serial_out(up, UART_IER, up->ier); in omap_8250_startup()
726 up->capabilities |= UART_CAP_RPM; in omap_8250_startup()
733 serial_out(up, UART_OMAP_WER, priv->wer); in omap_8250_startup()
735 if (up->dma && !(priv->habit & UART_HAS_EFR2)) { in omap_8250_startup()
737 up->dma->rx_dma(up); in omap_8250_startup()
741 enable_irq(up->port.irq); in omap_8250_startup()
750 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_shutdown() local
754 if (up->dma) in omap_8250_shutdown()
755 omap_8250_rx_dma_flush(up); in omap_8250_shutdown()
759 serial_out(up, UART_OMAP_WER, 0); in omap_8250_shutdown()
761 serial_out(up, UART_OMAP_EFR2, 0x0); in omap_8250_shutdown()
765 up->ier = 0; in omap_8250_shutdown()
766 serial_out(up, UART_IER, 0); in omap_8250_shutdown()
768 disable_irq_nosync(up->port.irq); in omap_8250_shutdown()
771 serial8250_release_dma(up); in omap_8250_shutdown()
772 up->dma = NULL; in omap_8250_shutdown()
777 if (up->lcr & UART_LCR_SBC) in omap_8250_shutdown()
778 serial_out(up, UART_LCR, up->lcr & ~UART_LCR_SBC); in omap_8250_shutdown()
779 serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); in omap_8250_shutdown()
804 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_unthrottle() local
812 if (up->dma) in omap_8250_unthrottle()
813 up->dma->rx_dma(up); in omap_8250_unthrottle()
814 up->ier |= UART_IER_RLSI | UART_IER_RDI; in omap_8250_unthrottle()
816 serial_out(up, UART_IER, up->ier); in omap_8250_unthrottle()
828 struct uart_8250_port *up = up_to_u8250p(port); in omap8250_rs485_config() local
859 mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS) || in omap8250_rs485_config()
863 serial_out(up, UART_OMAP_MDR3, priv->mdr3); in omap8250_rs485_config()
886 serial_out(up, UART_OMAP_MDR3, priv->mdr3); in omap8250_rs485_config()
1207 static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir) in handle_rx_dma() argument
1213 omap_8250_rx_dma_flush(up); in handle_rx_dma()
1216 return omap_8250_rx_dma(up); in handle_rx_dma()
1219 static u16 omap_8250_handle_rx_dma(struct uart_8250_port *up, u8 iir, u16 status) in omap_8250_handle_rx_dma() argument
1223 if (handle_rx_dma(up, iir)) { in omap_8250_handle_rx_dma()
1224 status = serial8250_rx_chars(up, status); in omap_8250_handle_rx_dma()
1225 omap_8250_rx_dma(up); in omap_8250_handle_rx_dma()
1232 static void am654_8250_handle_rx_dma(struct uart_8250_port *up, u8 iir, in am654_8250_handle_rx_dma() argument
1236 lockdep_assert_held_once(&up->port.lock); in am654_8250_handle_rx_dma()
1242 (up->ier & UART_IER_RDI)) { in am654_8250_handle_rx_dma()
1243 omap_8250_rx_dma(up); in am654_8250_handle_rx_dma()
1244 serial_out(up, UART_OMAP_EFR2, UART_OMAP_EFR2_TIMEOUT_BEHAVE); in am654_8250_handle_rx_dma()
1251 up->ier &= ~(UART_IER_RLSI | UART_IER_RDI); in am654_8250_handle_rx_dma()
1252 serial_out(up, UART_IER, up->ier); in am654_8250_handle_rx_dma()
1253 omap_8250_rx_dma_flush(up); in am654_8250_handle_rx_dma()
1254 serial_in(up, UART_IIR); in am654_8250_handle_rx_dma()
1255 serial_out(up, UART_OMAP_EFR2, 0x0); in am654_8250_handle_rx_dma()
1256 up->ier |= UART_IER_RLSI | UART_IER_RDI; in am654_8250_handle_rx_dma()
1257 serial_out(up, UART_IER, up->ier); in am654_8250_handle_rx_dma()
1268 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_dma_handle_irq() local
1269 struct omap8250_priv *priv = up->port.private_data; in omap_8250_dma_handle_irq()
1273 serial8250_rpm_get(up); in omap_8250_dma_handle_irq()
1277 serial8250_rpm_put(up); in omap_8250_dma_handle_irq()
1286 am654_8250_handle_rx_dma(up, iir, status); in omap_8250_dma_handle_irq()
1288 status = omap_8250_handle_rx_dma(up, iir, status); in omap_8250_dma_handle_irq()
1290 serial8250_modem_status(up); in omap_8250_dma_handle_irq()
1291 if (status & UART_LSR_THRE && up->dma->tx_err) { in omap_8250_dma_handle_irq()
1292 if (uart_tx_stopped(&up->port) || in omap_8250_dma_handle_irq()
1293 uart_circ_empty(&up->port.state->xmit)) { in omap_8250_dma_handle_irq()
1294 up->dma->tx_err = 0; in omap_8250_dma_handle_irq()
1295 serial8250_tx_chars(up); in omap_8250_dma_handle_irq()
1301 if (omap_8250_tx_dma(up)) in omap_8250_dma_handle_irq()
1302 serial8250_tx_chars(up); in omap_8250_dma_handle_irq()
1308 serial8250_rpm_put(up); in omap_8250_dma_handle_irq()
1377 struct uart_8250_port up; in omap8250_probe() local
1401 memset(&up, 0, sizeof(up)); in omap8250_probe()
1402 up.port.dev = &pdev->dev; in omap8250_probe()
1403 up.port.mapbase = regs->start; in omap8250_probe()
1404 up.port.membase = membase; in omap8250_probe()
1405 up.port.irq = irq; in omap8250_probe()
1414 up.port.type = PORT_8250; in omap8250_probe()
1415 up.port.iotype = UPIO_MEM; in omap8250_probe()
1416 up.port.flags = UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_SOFT_FLOW | in omap8250_probe()
1418 up.port.private_data = priv; in omap8250_probe()
1420 up.port.regshift = OMAP_UART_REGSHIFT; in omap8250_probe()
1421 up.port.fifosize = 64; in omap8250_probe()
1422 up.tx_loadsz = 64; in omap8250_probe()
1423 up.capabilities = UART_CAP_FIFO; in omap8250_probe()
1431 up.capabilities |= UART_CAP_RPM; in omap8250_probe()
1433 up.port.set_termios = omap_8250_set_termios; in omap8250_probe()
1434 up.port.set_mctrl = omap8250_set_mctrl; in omap8250_probe()
1435 up.port.pm = omap_8250_pm; in omap8250_probe()
1436 up.port.startup = omap_8250_startup; in omap8250_probe()
1437 up.port.shutdown = omap_8250_shutdown; in omap8250_probe()
1438 up.port.throttle = omap_8250_throttle; in omap8250_probe()
1439 up.port.unthrottle = omap_8250_unthrottle; in omap8250_probe()
1440 up.port.rs485_config = omap8250_rs485_config; in omap8250_probe()
1442 up.port.rs485_supported = serial8250_em485_supported; in omap8250_probe()
1443 up.rs485_start_tx = serial8250_em485_start_tx; in omap8250_probe()
1444 up.rs485_stop_tx = serial8250_em485_stop_tx; in omap8250_probe()
1445 up.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); in omap8250_probe()
1452 up.port.line = ret; in omap8250_probe()
1454 if (of_property_read_u32(np, "clock-frequency", &up.port.uartclk)) { in omap8250_probe()
1462 up.port.uartclk = clk_get_rate(clk); in omap8250_probe()
1467 &up.overrun_backoff_time_ms) != 0) in omap8250_probe()
1468 up.overrun_backoff_time_ms = 0; in omap8250_probe()
1474 if (!up.port.uartclk) { in omap8250_probe()
1475 up.port.uartclk = DEFAULT_CLK_SPEED; in omap8250_probe()
1510 omap_serial_fill_features_erratas(&up, priv); in omap8250_probe()
1511 up.port.handle_irq = omap8250_no_handle_irq; in omap8250_probe()
1556 ret = serial8250_register_8250_port(&up); in omap8250_probe()
1577 struct uart_8250_port *up; in omap8250_remove() local
1584 up = serial8250_get_port(priv->line); in omap8250_remove()
1585 omap_8250_shutdown(&up->port); in omap8250_remove()
1619 struct uart_8250_port *up = serial8250_get_port(priv->line); in omap8250_suspend() local
1629 serial_out(up, UART_OMAP_WER, priv->wer); in omap8250_suspend()
1630 if (uart_console(&up->port) && console_suspend_enabled) in omap8250_suspend()
1640 struct uart_8250_port *up = serial8250_get_port(priv->line); in omap8250_resume() local
1643 if (uart_console(&up->port) && console_suspend_enabled) { in omap8250_resume()
1657 static int omap8250_lost_context(struct uart_8250_port *up) in omap8250_lost_context() argument
1661 val = serial_in(up, UART_OMAP_SCR); in omap8250_lost_context()
1721 struct uart_8250_port *up = NULL; in omap8250_runtime_suspend() local
1724 up = serial8250_get_port(priv->line); in omap8250_runtime_suspend()
1733 if (up) { in omap8250_runtime_suspend()
1735 omap8250_update_mdr1(up, priv); in omap8250_runtime_suspend()
1737 serial_out(up, UART_OMAP_WER, priv->wer); in omap8250_runtime_suspend()
1741 if (up && up->dma && up->dma->rxchan) in omap8250_runtime_suspend()
1742 omap_8250_rx_dma_flush(up); in omap8250_runtime_suspend()
1753 struct uart_8250_port *up = NULL; in omap8250_runtime_resume() local
1756 up = serial8250_get_port(priv->line); in omap8250_runtime_resume()
1758 if (up && omap8250_lost_context(up)) { in omap8250_runtime_resume()
1759 spin_lock_irq(&up->port.lock); in omap8250_runtime_resume()
1760 omap8250_restore_regs(up); in omap8250_runtime_resume()
1761 spin_unlock_irq(&up->port.lock); in omap8250_runtime_resume()
1764 if (up && up->dma && up->dma->rxchan && !(priv->habit & UART_HAS_EFR2)) { in omap8250_runtime_resume()
1765 spin_lock_irq(&up->port.lock); in omap8250_runtime_resume()
1766 omap_8250_rx_dma(up); in omap8250_runtime_resume()
1767 spin_unlock_irq(&up->port.lock); in omap8250_runtime_resume()