• Home
  • Raw
  • Download

Lines Matching refs:up

168 	struct uart_8250_port *up = up_to_u8250p(port);  in __omap8250_set_mctrl()  local
169 struct omap8250_priv *priv = up->port.private_data; in __omap8250_set_mctrl()
174 if (!mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS)) { in __omap8250_set_mctrl()
179 lcr = serial_in(up, UART_LCR); in __omap8250_set_mctrl()
180 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in __omap8250_set_mctrl()
185 serial_out(up, UART_EFR, priv->efr); in __omap8250_set_mctrl()
186 serial_out(up, UART_LCR, lcr); in __omap8250_set_mctrl()
213 static void omap_8250_mdr1_errataset(struct uart_8250_port *up, in omap_8250_mdr1_errataset() argument
216 serial_out(up, UART_OMAP_MDR1, priv->mdr1); in omap_8250_mdr1_errataset()
218 serial_out(up, UART_FCR, up->fcr | UART_FCR_CLEAR_XMIT | in omap_8250_mdr1_errataset()
265 static void omap8250_update_scr(struct uart_8250_port *up, in omap8250_update_scr() argument
270 old_scr = serial_in(up, UART_OMAP_SCR); in omap8250_update_scr()
280 serial_out(up, UART_OMAP_SCR, in omap8250_update_scr()
282 serial_out(up, UART_OMAP_SCR, priv->scr); in omap8250_update_scr()
285 static void omap8250_update_mdr1(struct uart_8250_port *up, in omap8250_update_mdr1() argument
289 omap_8250_mdr1_errataset(up, priv); in omap8250_update_mdr1()
291 serial_out(up, UART_OMAP_MDR1, priv->mdr1); in omap8250_update_mdr1()
294 static void omap8250_restore_regs(struct uart_8250_port *up) in omap8250_restore_regs() argument
296 struct omap8250_priv *priv = up->port.private_data; in omap8250_restore_regs()
297 struct uart_8250_dma *dma = up->dma; in omap8250_restore_regs()
298 u8 mcr = serial8250_in_MCR(up); in omap8250_restore_regs()
311 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
312 serial_out(up, UART_EFR, UART_EFR_ECB); in omap8250_restore_regs()
314 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); in omap8250_restore_regs()
315 serial8250_out_MCR(up, mcr | UART_MCR_TCRTLR); in omap8250_restore_regs()
316 serial_out(up, UART_FCR, up->fcr); in omap8250_restore_regs()
318 omap8250_update_scr(up, priv); in omap8250_restore_regs()
320 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
322 serial_out(up, UART_TI752_TCR, OMAP_UART_TCR_RESTORE(16) | in omap8250_restore_regs()
324 serial_out(up, UART_TI752_TLR, in omap8250_restore_regs()
328 serial_out(up, UART_LCR, 0); in omap8250_restore_regs()
331 serial8250_out_MCR(up, mcr); in omap8250_restore_regs()
333 serial_out(up, UART_IER, up->ier); in omap8250_restore_regs()
335 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
336 serial_dl_write(up, priv->quot); in omap8250_restore_regs()
338 serial_out(up, UART_EFR, priv->efr); in omap8250_restore_regs()
341 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap8250_restore_regs()
342 serial_out(up, UART_XON1, priv->xon); in omap8250_restore_regs()
343 serial_out(up, UART_XOFF1, priv->xoff); in omap8250_restore_regs()
345 serial_out(up, UART_LCR, up->lcr); in omap8250_restore_regs()
347 omap8250_update_mdr1(up, priv); in omap8250_restore_regs()
349 __omap8250_set_mctrl(&up->port, up->port.mctrl); in omap8250_restore_regs()
351 if (up->port.rs485.flags & SER_RS485_ENABLED) in omap8250_restore_regs()
352 serial8250_em485_stop_tx(up); in omap8250_restore_regs()
363 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_set_termios() local
364 struct omap8250_priv *priv = up->port.private_data; in omap_8250_set_termios()
413 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; in omap_8250_set_termios()
415 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; in omap_8250_set_termios()
417 up->port.read_status_mask |= UART_LSR_BI; in omap_8250_set_termios()
422 up->port.ignore_status_mask = 0; in omap_8250_set_termios()
424 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; in omap_8250_set_termios()
426 up->port.ignore_status_mask |= UART_LSR_BI; in omap_8250_set_termios()
432 up->port.ignore_status_mask |= UART_LSR_OE; in omap_8250_set_termios()
439 up->port.ignore_status_mask |= UART_LSR_DR; in omap_8250_set_termios()
444 up->ier &= ~UART_IER_MSI; in omap_8250_set_termios()
445 if (UART_ENABLE_MS(&up->port, termios->c_cflag)) in omap_8250_set_termios()
446 up->ier |= UART_IER_MSI; in omap_8250_set_termios()
448 up->lcr = cval; in omap_8250_set_termios()
468 up->fcr = UART_FCR_ENABLE_FIFO; in omap_8250_set_termios()
469 up->fcr |= TRIGGER_FCR_MASK(priv->tx_trigger) << OMAP_UART_FCR_TX_TRIG; in omap_8250_set_termios()
470 up->fcr |= TRIGGER_FCR_MASK(priv->rx_trigger) << OMAP_UART_FCR_RX_TRIG; in omap_8250_set_termios()
475 if (up->dma) in omap_8250_set_termios()
483 up->port.status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); in omap_8250_set_termios()
485 if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW && in omap_8250_set_termios()
486 !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_RTS) && in omap_8250_set_termios()
487 !mctrl_gpio_to_gpiod(up->gpios, UART_GPIO_CTS)) { in omap_8250_set_termios()
489 up->port.status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; in omap_8250_set_termios()
491 } else if (up->port.flags & UPF_SOFT_FLOW) { in omap_8250_set_termios()
503 up->port.status |= UPSTAT_AUTOXOFF; in omap_8250_set_termios()
507 omap8250_restore_regs(up); in omap_8250_set_termios()
509 spin_unlock_irq(&up->port.lock); in omap_8250_set_termios()
528 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_pm() local
532 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap_8250_pm()
533 efr = serial_in(up, UART_EFR); in omap_8250_pm()
534 serial_out(up, UART_EFR, efr | UART_EFR_ECB); in omap_8250_pm()
535 serial_out(up, UART_LCR, 0); in omap_8250_pm()
537 serial_out(up, UART_IER, (state != 0) ? UART_IERX_SLEEP : 0); in omap_8250_pm()
538 serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B); in omap_8250_pm()
539 serial_out(up, UART_EFR, efr); in omap_8250_pm()
540 serial_out(up, UART_LCR, 0); in omap_8250_pm()
546 static void omap_serial_fill_features_erratas(struct uart_8250_port *up, in omap_serial_fill_features_erratas() argument
577 dev_warn(up->port.dev, in omap_serial_fill_features_erratas()
627 struct uart_8250_port *up = up_to_u8250p(port); in omap8250_irq() local
632 if (up->dma) { in omap8250_irq()
638 serial8250_rpm_get(up); in omap8250_irq()
655 if ((lsr & UART_LSR_OE) && up->overrun_backoff_time_ms > 0) { in omap8250_irq()
660 up->ier = port->serial_in(port, UART_IER); in omap8250_irq()
661 if (up->ier & (UART_IER_RLSI | UART_IER_RDI)) { in omap8250_irq()
667 cancel_delayed_work(&up->overrun_backoff); in omap8250_irq()
671 delay = msecs_to_jiffies(up->overrun_backoff_time_ms); in omap8250_irq()
672 schedule_delayed_work(&up->overrun_backoff, delay); in omap8250_irq()
675 serial8250_rpm_put(up); in omap8250_irq()
682 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_startup() local
694 serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); in omap_8250_startup()
696 serial_out(up, UART_LCR, UART_LCR_WLEN8); in omap_8250_startup()
698 up->lsr_saved_flags = 0; in omap_8250_startup()
699 up->msr_saved_flags = 0; in omap_8250_startup()
703 up->dma = NULL; in omap_8250_startup()
705 if (up->dma) { in omap_8250_startup()
706 ret = serial8250_request_dma(up); in omap_8250_startup()
710 up->dma = NULL; in omap_8250_startup()
719 up->ier = UART_IER_RLSI | UART_IER_RDI; in omap_8250_startup()
720 serial_out(up, UART_IER, up->ier); in omap_8250_startup()
723 up->capabilities |= UART_CAP_RPM; in omap_8250_startup()
730 serial_out(up, UART_OMAP_WER, priv->wer); in omap_8250_startup()
732 if (up->dma && !(priv->habit & UART_HAS_EFR2)) in omap_8250_startup()
733 up->dma->rx_dma(up); in omap_8250_startup()
747 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_shutdown() local
751 if (up->dma) in omap_8250_shutdown()
752 omap_8250_rx_dma_flush(up); in omap_8250_shutdown()
756 serial_out(up, UART_OMAP_WER, 0); in omap_8250_shutdown()
758 serial_out(up, UART_OMAP_EFR2, 0x0); in omap_8250_shutdown()
760 up->ier = 0; in omap_8250_shutdown()
761 serial_out(up, UART_IER, 0); in omap_8250_shutdown()
763 if (up->dma) in omap_8250_shutdown()
764 serial8250_release_dma(up); in omap_8250_shutdown()
769 if (up->lcr & UART_LCR_SBC) in omap_8250_shutdown()
770 serial_out(up, UART_LCR, up->lcr & ~UART_LCR_SBC); in omap_8250_shutdown()
771 serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); in omap_8250_shutdown()
798 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_unthrottle() local
805 if (up->dma) in omap_8250_unthrottle()
806 up->dma->rx_dma(up); in omap_8250_unthrottle()
807 up->ier |= UART_IER_RLSI | UART_IER_RDI; in omap_8250_unthrottle()
809 serial_out(up, UART_IER, up->ier); in omap_8250_unthrottle()
1130 static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir) in handle_rx_dma() argument
1136 omap_8250_rx_dma_flush(up); in handle_rx_dma()
1139 return omap_8250_rx_dma(up); in handle_rx_dma()
1142 static unsigned char omap_8250_handle_rx_dma(struct uart_8250_port *up, in omap_8250_handle_rx_dma() argument
1147 if (handle_rx_dma(up, iir)) { in omap_8250_handle_rx_dma()
1148 status = serial8250_rx_chars(up, status); in omap_8250_handle_rx_dma()
1149 omap_8250_rx_dma(up); in omap_8250_handle_rx_dma()
1156 static void am654_8250_handle_rx_dma(struct uart_8250_port *up, u8 iir, in am654_8250_handle_rx_dma() argument
1163 (up->ier & UART_IER_RDI)) { in am654_8250_handle_rx_dma()
1164 omap_8250_rx_dma(up); in am654_8250_handle_rx_dma()
1165 serial_out(up, UART_OMAP_EFR2, UART_OMAP_EFR2_TIMEOUT_BEHAVE); in am654_8250_handle_rx_dma()
1172 up->ier &= ~(UART_IER_RLSI | UART_IER_RDI); in am654_8250_handle_rx_dma()
1173 serial_out(up, UART_IER, up->ier); in am654_8250_handle_rx_dma()
1174 omap_8250_rx_dma_flush(up); in am654_8250_handle_rx_dma()
1175 serial_in(up, UART_IIR); in am654_8250_handle_rx_dma()
1176 serial_out(up, UART_OMAP_EFR2, 0x0); in am654_8250_handle_rx_dma()
1177 up->ier |= UART_IER_RLSI | UART_IER_RDI; in am654_8250_handle_rx_dma()
1178 serial_out(up, UART_IER, up->ier); in am654_8250_handle_rx_dma()
1189 struct uart_8250_port *up = up_to_u8250p(port); in omap_8250_dma_handle_irq() local
1190 struct omap8250_priv *priv = up->port.private_data; in omap_8250_dma_handle_irq()
1194 serial8250_rpm_get(up); in omap_8250_dma_handle_irq()
1198 serial8250_rpm_put(up); in omap_8250_dma_handle_irq()
1208 am654_8250_handle_rx_dma(up, iir, status); in omap_8250_dma_handle_irq()
1210 status = omap_8250_handle_rx_dma(up, iir, status); in omap_8250_dma_handle_irq()
1213 serial8250_modem_status(up); in omap_8250_dma_handle_irq()
1214 if (status & UART_LSR_THRE && up->dma->tx_err) { in omap_8250_dma_handle_irq()
1215 if (uart_tx_stopped(&up->port) || in omap_8250_dma_handle_irq()
1216 uart_circ_empty(&up->port.state->xmit)) { in omap_8250_dma_handle_irq()
1217 up->dma->tx_err = 0; in omap_8250_dma_handle_irq()
1218 serial8250_tx_chars(up); in omap_8250_dma_handle_irq()
1224 if (omap_8250_tx_dma(up)) in omap_8250_dma_handle_irq()
1225 serial8250_tx_chars(up); in omap_8250_dma_handle_irq()
1231 serial8250_rpm_put(up); in omap_8250_dma_handle_irq()
1300 struct uart_8250_port up; in omap8250_probe() local
1324 memset(&up, 0, sizeof(up)); in omap8250_probe()
1325 up.port.dev = &pdev->dev; in omap8250_probe()
1326 up.port.mapbase = regs->start; in omap8250_probe()
1327 up.port.membase = membase; in omap8250_probe()
1328 up.port.irq = irq; in omap8250_probe()
1337 up.port.type = PORT_8250; in omap8250_probe()
1338 up.port.iotype = UPIO_MEM; in omap8250_probe()
1339 up.port.flags = UPF_FIXED_PORT | UPF_FIXED_TYPE | UPF_SOFT_FLOW | in omap8250_probe()
1341 up.port.private_data = priv; in omap8250_probe()
1343 up.port.regshift = OMAP_UART_REGSHIFT; in omap8250_probe()
1344 up.port.fifosize = 64; in omap8250_probe()
1345 up.tx_loadsz = 64; in omap8250_probe()
1346 up.capabilities = UART_CAP_FIFO; in omap8250_probe()
1354 up.capabilities |= UART_CAP_RPM; in omap8250_probe()
1356 up.port.set_termios = omap_8250_set_termios; in omap8250_probe()
1357 up.port.set_mctrl = omap8250_set_mctrl; in omap8250_probe()
1358 up.port.pm = omap_8250_pm; in omap8250_probe()
1359 up.port.startup = omap_8250_startup; in omap8250_probe()
1360 up.port.shutdown = omap_8250_shutdown; in omap8250_probe()
1361 up.port.throttle = omap_8250_throttle; in omap8250_probe()
1362 up.port.unthrottle = omap_8250_unthrottle; in omap8250_probe()
1363 up.port.rs485_config = serial8250_em485_config; in omap8250_probe()
1364 up.rs485_start_tx = serial8250_em485_start_tx; in omap8250_probe()
1365 up.rs485_stop_tx = serial8250_em485_stop_tx; in omap8250_probe()
1366 up.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); in omap8250_probe()
1373 up.port.line = ret; in omap8250_probe()
1375 if (of_property_read_u32(np, "clock-frequency", &up.port.uartclk)) { in omap8250_probe()
1383 up.port.uartclk = clk_get_rate(clk); in omap8250_probe()
1388 &up.overrun_backoff_time_ms) != 0) in omap8250_probe()
1389 up.overrun_backoff_time_ms = 0; in omap8250_probe()
1397 if (!up.port.uartclk) { in omap8250_probe()
1398 up.port.uartclk = DEFAULT_CLK_SPEED; in omap8250_probe()
1433 omap_serial_fill_features_erratas(&up, priv); in omap8250_probe()
1434 up.port.handle_irq = omap8250_no_handle_irq; in omap8250_probe()
1450 up.dma = &priv->omap8250_dma; in omap8250_probe()
1451 up.dma->fn = the_no_dma_filter_fn; in omap8250_probe()
1452 up.dma->tx_dma = omap_8250_tx_dma; in omap8250_probe()
1453 up.dma->rx_dma = omap_8250_rx_dma; in omap8250_probe()
1458 up.dma->rx_size = dma_params->rx_size; in omap8250_probe()
1459 up.dma->rxconf.src_maxburst = dma_params->rx_trigger; in omap8250_probe()
1460 up.dma->txconf.dst_maxburst = dma_params->tx_trigger; in omap8250_probe()
1464 up.dma->rx_size = RX_TRIGGER; in omap8250_probe()
1465 up.dma->rxconf.src_maxburst = RX_TRIGGER; in omap8250_probe()
1466 up.dma->txconf.dst_maxburst = TX_TRIGGER; in omap8250_probe()
1470 ret = serial8250_register_8250_port(&up); in omap8250_probe()
1531 struct uart_8250_port *up = serial8250_get_port(priv->line); in omap8250_suspend() local
1541 serial_out(up, UART_OMAP_WER, priv->wer); in omap8250_suspend()
1542 if (uart_console(&up->port) && console_suspend_enabled) in omap8250_suspend()
1552 struct uart_8250_port *up = serial8250_get_port(priv->line); in omap8250_resume() local
1555 if (uart_console(&up->port) && console_suspend_enabled) { in omap8250_resume()
1574 static int omap8250_lost_context(struct uart_8250_port *up) in omap8250_lost_context() argument
1578 val = serial_in(up, UART_OMAP_SCR); in omap8250_lost_context()
1638 struct uart_8250_port *up = NULL; in omap8250_runtime_suspend() local
1641 up = serial8250_get_port(priv->line); in omap8250_runtime_suspend()
1650 if (up) { in omap8250_runtime_suspend()
1652 omap8250_update_mdr1(up, priv); in omap8250_runtime_suspend()
1654 serial_out(up, UART_OMAP_WER, priv->wer); in omap8250_runtime_suspend()
1658 if (up && up->dma && up->dma->rxchan) in omap8250_runtime_suspend()
1659 omap_8250_rx_dma_flush(up); in omap8250_runtime_suspend()
1670 struct uart_8250_port *up = NULL; in omap8250_runtime_resume() local
1673 up = serial8250_get_port(priv->line); in omap8250_runtime_resume()
1675 if (up && omap8250_lost_context(up)) in omap8250_runtime_resume()
1676 omap8250_restore_regs(up); in omap8250_runtime_resume()
1678 if (up && up->dma && up->dma->rxchan && !(priv->habit & UART_HAS_EFR2)) in omap8250_runtime_resume()
1679 omap_8250_rx_dma(up); in omap8250_runtime_resume()