Lines Matching refs:msm_port

171 struct msm_port {  struct
184 static inline struct msm_port *to_msm_port(struct uart_port *up) in to_msm_port() argument
186 return container_of(up, struct msm_port, uart); in to_msm_port()
227 struct msm_port *msm_port = to_msm_port(port); in msm_serial_set_mnd_regs() local
233 if (msm_port->is_uartdm) in msm_serial_set_mnd_regs()
243 static void msm_start_rx_dma(struct msm_port *msm_port);
271 static void msm_release_dma(struct msm_port *msm_port) in msm_release_dma() argument
275 dma = &msm_port->tx_dma; in msm_release_dma()
277 msm_stop_dma(&msm_port->uart, dma); in msm_release_dma()
283 dma = &msm_port->rx_dma; in msm_release_dma()
285 msm_stop_dma(&msm_port->uart, dma); in msm_release_dma()
293 static void msm_request_tx_dma(struct msm_port *msm_port, resource_size_t base) in msm_request_tx_dma() argument
295 struct device *dev = msm_port->uart.dev; in msm_request_tx_dma()
302 dma = &msm_port->tx_dma; in msm_request_tx_dma()
328 if (msm_port->is_uartdm < UARTDM_1P4) in msm_request_tx_dma()
341 static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base) in msm_request_rx_dma() argument
343 struct device *dev = msm_port->uart.dev; in msm_request_rx_dma()
350 dma = &msm_port->rx_dma; in msm_request_rx_dma()
380 if (msm_port->is_uartdm < UARTDM_1P4) in msm_request_rx_dma()
410 struct msm_port *msm_port = to_msm_port(port); in msm_stop_tx() local
412 msm_port->imr &= ~MSM_UART_IMR_TXLEV; in msm_stop_tx()
413 msm_write(port, msm_port->imr, MSM_UART_IMR); in msm_stop_tx()
418 struct msm_port *msm_port = to_msm_port(port); in msm_start_tx() local
419 struct msm_dma *dma = &msm_port->tx_dma; in msm_start_tx()
425 msm_port->imr |= MSM_UART_IMR_TXLEV; in msm_start_tx()
426 msm_write(port, msm_port->imr, MSM_UART_IMR); in msm_start_tx()
438 struct msm_port *msm_port = args; in msm_complete_tx_dma() local
439 struct uart_port *port = &msm_port->uart; in msm_complete_tx_dma()
441 struct msm_dma *dma = &msm_port->tx_dma; in msm_complete_tx_dma()
461 if (msm_port->is_uartdm > UARTDM_1P3) { in msm_complete_tx_dma()
471 msm_port->imr |= MSM_UART_IMR_TXLEV; in msm_complete_tx_dma()
472 msm_write(port, msm_port->imr, MSM_UART_IMR); in msm_complete_tx_dma()
482 static int msm_handle_tx_dma(struct msm_port *msm_port, unsigned int count) in msm_handle_tx_dma() argument
484 struct circ_buf *xmit = &msm_port->uart.state->xmit; in msm_handle_tx_dma()
485 struct uart_port *port = &msm_port->uart; in msm_handle_tx_dma()
486 struct msm_dma *dma = &msm_port->tx_dma; in msm_handle_tx_dma()
508 dma->desc->callback_param = msm_port; in msm_handle_tx_dma()
519 msm_port->imr &= ~MSM_UART_IMR_TXLEV; in msm_handle_tx_dma()
520 msm_write(port, msm_port->imr, MSM_UART_IMR); in msm_handle_tx_dma()
527 if (msm_port->is_uartdm < UARTDM_1P4) in msm_handle_tx_dma()
532 if (msm_port->is_uartdm > UARTDM_1P3) in msm_handle_tx_dma()
544 struct msm_port *msm_port = args; in msm_complete_rx_dma() local
545 struct uart_port *port = &msm_port->uart; in msm_complete_rx_dma()
547 struct msm_dma *dma = &msm_port->rx_dma; in msm_complete_rx_dma()
579 if (msm_port->break_detected && dma->virt[i] == 0) { in msm_complete_rx_dma()
582 msm_port->break_detected = false; in msm_complete_rx_dma()
597 msm_start_rx_dma(msm_port); in msm_complete_rx_dma()
605 static void msm_start_rx_dma(struct msm_port *msm_port) in msm_start_rx_dma() argument
607 struct msm_dma *dma = &msm_port->rx_dma; in msm_start_rx_dma()
608 struct uart_port *uart = &msm_port->uart; in msm_start_rx_dma()
631 dma->desc->callback_param = msm_port; in msm_start_rx_dma()
641 msm_port->imr &= ~(MSM_UART_IMR_RXLEV | MSM_UART_IMR_RXSTALE); in msm_start_rx_dma()
647 if (msm_port->is_uartdm < UARTDM_1P4) in msm_start_rx_dma()
648 msm_port->imr |= MSM_UART_IMR_RXSTALE; in msm_start_rx_dma()
650 msm_write(uart, msm_port->imr, MSM_UART_IMR); in msm_start_rx_dma()
662 if (msm_port->is_uartdm < UARTDM_1P4) in msm_start_rx_dma()
667 if (msm_port->is_uartdm > UARTDM_1P3) in msm_start_rx_dma()
687 msm_port->imr |= MSM_UART_IMR_RXLEV | MSM_UART_IMR_RXSTALE; in msm_start_rx_dma()
688 msm_write(uart, msm_port->imr, MSM_UART_IMR); in msm_start_rx_dma()
693 struct msm_port *msm_port = to_msm_port(port); in msm_stop_rx() local
694 struct msm_dma *dma = &msm_port->rx_dma; in msm_stop_rx()
696 msm_port->imr &= ~(MSM_UART_IMR_RXLEV | MSM_UART_IMR_RXSTALE); in msm_stop_rx()
697 msm_write(port, msm_port->imr, MSM_UART_IMR); in msm_stop_rx()
705 struct msm_port *msm_port = to_msm_port(port); in msm_enable_ms() local
707 msm_port->imr |= MSM_UART_IMR_DELTA_CTS; in msm_enable_ms()
708 msm_write(port, msm_port->imr, MSM_UART_IMR); in msm_enable_ms()
717 struct msm_port *msm_port = to_msm_port(port); in msm_handle_rx_dm() local
727 msm_port->old_snap_state; in msm_handle_rx_dm()
728 msm_port->old_snap_state = 0; in msm_handle_rx_dm()
731 msm_port->old_snap_state += count; in msm_handle_rx_dm()
744 msm_port->old_snap_state -= count; in msm_handle_rx_dm()
754 if (msm_port->break_detected && buf[i] == 0) { in msm_handle_rx_dm()
757 msm_port->break_detected = false; in msm_handle_rx_dm()
782 msm_start_rx_dma(msm_port); in msm_handle_rx_dm()
840 struct msm_port *msm_port = to_msm_port(port); in msm_handle_tx_pio() local
845 if (msm_port->is_uartdm) in msm_handle_tx_pio()
850 if (tx_count && msm_port->is_uartdm) in msm_handle_tx_pio()
860 if (msm_port->is_uartdm) in msm_handle_tx_pio()
884 struct msm_port *msm_port = to_msm_port(port); in msm_handle_tx() local
885 struct circ_buf *xmit = &msm_port->uart.state->xmit; in msm_handle_tx()
886 struct msm_dma *dma = &msm_port->tx_dma; in msm_handle_tx()
893 if (msm_port->is_uartdm) in msm_handle_tx()
900 if (msm_port->is_uartdm) in msm_handle_tx()
918 if (msm_port->is_uartdm > UARTDM_1P3) { in msm_handle_tx()
932 err = msm_handle_tx_dma(msm_port, dma_count); in msm_handle_tx()
948 struct msm_port *msm_port = to_msm_port(port); in msm_uart_irq() local
949 struct msm_dma *dma = &msm_port->rx_dma; in msm_uart_irq()
959 msm_port->break_detected = true; in msm_uart_irq()
974 } else if (msm_port->is_uartdm) { in msm_uart_irq()
985 msm_write(port, msm_port->imr, MSM_UART_IMR); /* restore interrupt */ in msm_uart_irq()
1003 struct msm_port *msm_port = to_msm_port(port); in msm_reset() local
1018 if (msm_port->is_uartdm) in msm_reset()
1056 struct msm_port *msm_port = to_msm_port(port); in msm_find_best_baud() local
1080 target = clk_round_rate(msm_port->clk, 16 * baud); in msm_find_best_baud()
1101 target = clk_round_rate(msm_port->clk, old + 1); in msm_find_best_baud()
1126 struct msm_port *msm_port = to_msm_port(port); in msm_set_baud_rate() local
1134 clk_set_rate(msm_port->clk, rate); in msm_set_baud_rate()
1146 if (msm_port->is_uartdm) { in msm_set_baud_rate()
1171 msm_port->imr = MSM_UART_IMR_RXLEV | MSM_UART_IMR_RXSTALE | in msm_set_baud_rate()
1174 msm_write(port, msm_port->imr, MSM_UART_IMR); in msm_set_baud_rate()
1176 if (msm_port->is_uartdm) { in msm_set_baud_rate()
1187 struct msm_port *msm_port = to_msm_port(port); in msm_init_clock() local
1189 clk_prepare_enable(msm_port->clk); in msm_init_clock()
1190 clk_prepare_enable(msm_port->pclk); in msm_init_clock()
1196 struct msm_port *msm_port = to_msm_port(port); in msm_startup() local
1200 snprintf(msm_port->name, sizeof(msm_port->name), in msm_startup()
1213 if (msm_port->is_uartdm) in msm_startup()
1224 if (msm_port->is_uartdm) { in msm_startup()
1225 msm_request_tx_dma(msm_port, msm_port->uart.mapbase); in msm_startup()
1226 msm_request_rx_dma(msm_port, msm_port->uart.mapbase); in msm_startup()
1230 msm_port->name, port); in msm_startup()
1237 if (msm_port->is_uartdm) in msm_startup()
1238 msm_release_dma(msm_port); in msm_startup()
1240 clk_disable_unprepare(msm_port->pclk); in msm_startup()
1241 clk_disable_unprepare(msm_port->clk); in msm_startup()
1248 struct msm_port *msm_port = to_msm_port(port); in msm_shutdown() local
1250 msm_port->imr = 0; in msm_shutdown()
1253 if (msm_port->is_uartdm) in msm_shutdown()
1254 msm_release_dma(msm_port); in msm_shutdown()
1256 clk_disable_unprepare(msm_port->clk); in msm_shutdown()
1264 struct msm_port *msm_port = to_msm_port(port); in msm_set_termios() local
1265 struct msm_dma *dma = &msm_port->rx_dma; in msm_set_termios()
1339 msm_start_rx_dma(msm_port); in msm_set_termios()
1418 struct msm_port *msm_port = to_msm_port(port); in msm_power() local
1422 clk_prepare_enable(msm_port->clk); in msm_power()
1423 clk_prepare_enable(msm_port->pclk); in msm_power()
1426 clk_disable_unprepare(msm_port->clk); in msm_power()
1427 clk_disable_unprepare(msm_port->pclk); in msm_power()
1437 struct msm_port *msm_port = to_msm_port(port); in msm_poll_get_char_single() local
1438 unsigned int rf_reg = msm_port->is_uartdm ? UARTDM_RF : MSM_UART_RF; in msm_poll_get_char_single()
1490 struct msm_port *msm_port = to_msm_port(port); in msm_poll_get_char() local
1496 if (msm_port->is_uartdm) in msm_poll_get_char()
1510 struct msm_port *msm_port = to_msm_port(port); in msm_poll_put_char() local
1516 if (msm_port->is_uartdm) in msm_poll_put_char()
1524 msm_write(port, c, msm_port->is_uartdm ? UARTDM_TF : MSM_UART_TF); in msm_poll_put_char()
1559 static struct msm_port msm_uart_ports[] = {
1673 struct msm_port *msm_port; in msm_console_write() local
1678 msm_port = to_msm_port(port); in msm_console_write()
1680 __msm_console_write(port, s, count, msm_port->is_uartdm); in msm_console_write()
1788 struct msm_port *msm_port; in msm_serial_probe() local
1809 msm_port = to_msm_port(port); in msm_serial_probe()
1813 msm_port->is_uartdm = (unsigned long)id->data; in msm_serial_probe()
1815 msm_port->is_uartdm = 0; in msm_serial_probe()
1817 msm_port->clk = devm_clk_get(&pdev->dev, "core"); in msm_serial_probe()
1818 if (IS_ERR(msm_port->clk)) in msm_serial_probe()
1819 return PTR_ERR(msm_port->clk); in msm_serial_probe()
1821 if (msm_port->is_uartdm) { in msm_serial_probe()
1822 msm_port->pclk = devm_clk_get(&pdev->dev, "iface"); in msm_serial_probe()
1823 if (IS_ERR(msm_port->pclk)) in msm_serial_probe()
1824 return PTR_ERR(msm_port->pclk); in msm_serial_probe()
1827 port->uartclk = clk_get_rate(msm_port->clk); in msm_serial_probe()
1864 struct msm_port *port = dev_get_drvdata(dev); in msm_serial_suspend()
1873 struct msm_port *port = dev_get_drvdata(dev); in msm_serial_resume()