Lines Matching refs:stm32_port
41 static inline struct stm32_port *to_stm32_port(struct uart_port *port) in to_stm32_port()
43 return container_of(port, struct stm32_port, port); in to_stm32_port()
66 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_tx_empty() local
67 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_tx_empty()
77 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_rs485_rts_enable() local
80 if (stm32_port->hw_flow_control || in stm32_usart_rs485_rts_enable()
85 mctrl_gpio_set(stm32_port->gpios, in stm32_usart_rs485_rts_enable()
86 stm32_port->port.mctrl | TIOCM_RTS); in stm32_usart_rs485_rts_enable()
88 mctrl_gpio_set(stm32_port->gpios, in stm32_usart_rs485_rts_enable()
89 stm32_port->port.mctrl & ~TIOCM_RTS); in stm32_usart_rs485_rts_enable()
95 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_rs485_rts_disable() local
98 if (stm32_port->hw_flow_control || in stm32_usart_rs485_rts_disable()
103 mctrl_gpio_set(stm32_port->gpios, in stm32_usart_rs485_rts_disable()
104 stm32_port->port.mctrl & ~TIOCM_RTS); in stm32_usart_rs485_rts_disable()
106 mctrl_gpio_set(stm32_port->gpios, in stm32_usart_rs485_rts_disable()
107 stm32_port->port.mctrl | TIOCM_RTS); in stm32_usart_rs485_rts_disable()
151 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_config_rs485() local
152 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_config_rs485()
153 const struct stm32_usart_config *cfg = &stm32_port->info->cfg; in stm32_usart_config_rs485()
226 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_pending_rx() local
227 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_pending_rx()
233 if (threaded && stm32_port->rx_ch) { in stm32_usart_pending_rx()
234 status = dmaengine_tx_status(stm32_port->rx_ch, in stm32_usart_pending_rx()
235 stm32_port->rx_ch->cookie, in stm32_usart_pending_rx()
250 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_get_char() local
251 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_get_char()
254 if (stm32_port->rx_ch) { in stm32_usart_get_char()
255 c = stm32_port->rx_buf[RX_BUF_L - (*last_res)--]; in stm32_usart_get_char()
261 c &= stm32_port->rdr_mask; in stm32_usart_get_char()
270 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_receive_chars() local
271 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_receive_chars()
281 while (stm32_usart_pending_rx(port, &sr, &stm32_port->last_res, in stm32_usart_receive_chars()
301 c = stm32_usart_get_char(port, &sr, &stm32_port->last_res); in stm32_usart_receive_chars()
347 struct stm32_port *stm32port = to_stm32_port(port); in stm32_usart_tx_dma_complete()
363 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_tx_interrupt_enable() local
364 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_tx_interrupt_enable()
370 if (stm32_port->fifoen && stm32_port->txftcfg >= 0) in stm32_usart_tx_interrupt_enable()
378 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_tc_interrupt_enable() local
379 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_tc_interrupt_enable()
386 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_tx_interrupt_disable() local
387 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_tx_interrupt_disable()
389 if (stm32_port->fifoen && stm32_port->txftcfg >= 0) in stm32_usart_tx_interrupt_disable()
397 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_tc_interrupt_disable() local
398 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_tc_interrupt_disable()
405 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_transmit_chars_pio() local
406 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_transmit_chars_pio()
409 if (stm32_port->tx_dma_busy) { in stm32_usart_transmit_chars_pio()
411 stm32_port->tx_dma_busy = false; in stm32_usart_transmit_chars_pio()
432 struct stm32_port *stm32port = to_stm32_port(port); in stm32_usart_transmit_chars_dma()
498 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_transmit_chars() local
499 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_transmit_chars()
504 if (!stm32_port->hw_flow_control && in stm32_usart_transmit_chars()
513 if (stm32_port->tx_dma_busy) in stm32_usart_transmit_chars()
528 if (stm32_port->tx_dma_busy) in stm32_usart_transmit_chars()
543 if (stm32_port->tx_ch) in stm32_usart_transmit_chars()
553 if (!stm32_port->hw_flow_control && in stm32_usart_transmit_chars()
555 stm32_port->txdone = true; in stm32_usart_transmit_chars()
565 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_interrupt() local
566 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_interrupt()
571 if (!stm32_port->hw_flow_control && in stm32_usart_interrupt()
591 if ((sr & USART_SR_RXNE) && !(stm32_port->rx_ch)) in stm32_usart_interrupt()
594 if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch)) { in stm32_usart_interrupt()
600 if (stm32_port->rx_ch) in stm32_usart_interrupt()
618 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_set_mctrl() local
619 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_set_mctrl()
626 mctrl_gpio_set(stm32_port->gpios, mctrl); in stm32_usart_set_mctrl()
631 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_get_mctrl() local
637 return mctrl_gpio_get(stm32_port->gpios, &ret); in stm32_usart_get_mctrl()
676 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_flush_buffer() local
677 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_flush_buffer()
679 if (stm32_port->tx_ch) { in stm32_usart_flush_buffer()
680 dmaengine_terminate_async(stm32_port->tx_ch); in stm32_usart_flush_buffer()
682 stm32_port->tx_dma_busy = false; in stm32_usart_flush_buffer()
689 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_throttle() local
690 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_throttle()
694 stm32_usart_clr_bits(port, ofs->cr1, stm32_port->cr1_irq); in stm32_usart_throttle()
695 if (stm32_port->cr3_irq) in stm32_usart_throttle()
696 stm32_usart_clr_bits(port, ofs->cr3, stm32_port->cr3_irq); in stm32_usart_throttle()
704 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_unthrottle() local
705 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_unthrottle()
709 stm32_usart_set_bits(port, ofs->cr1, stm32_port->cr1_irq); in stm32_usart_unthrottle()
710 if (stm32_port->cr3_irq) in stm32_usart_unthrottle()
711 stm32_usart_set_bits(port, ofs->cr3, stm32_port->cr3_irq); in stm32_usart_unthrottle()
719 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_stop_rx() local
720 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_stop_rx()
722 stm32_usart_clr_bits(port, ofs->cr1, stm32_port->cr1_irq); in stm32_usart_stop_rx()
723 if (stm32_port->cr3_irq) in stm32_usart_stop_rx()
724 stm32_usart_clr_bits(port, ofs->cr3, stm32_port->cr3_irq); in stm32_usart_stop_rx()
734 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_startup() local
735 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_startup()
736 const struct stm32_usart_config *cfg = &stm32_port->info->cfg; in stm32_usart_startup()
748 if (stm32_port->swap) { in stm32_usart_startup()
759 val = stm32_port->cr1_irq | USART_CR1_RE | BIT(cfg->uart_enable_bit); in stm32_usart_startup()
767 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_shutdown() local
768 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_shutdown()
769 const struct stm32_usart_config *cfg = &stm32_port->info->cfg; in stm32_usart_shutdown()
773 if (stm32_port->tx_dma_busy) { in stm32_usart_shutdown()
774 dmaengine_terminate_async(stm32_port->tx_ch); in stm32_usart_shutdown()
782 val |= stm32_port->cr1_irq | USART_CR1_RE; in stm32_usart_shutdown()
784 if (stm32_port->fifoen) in stm32_usart_shutdown()
809 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_set_termios() local
810 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_set_termios()
811 const struct stm32_usart_config *cfg = &stm32_port->info->cfg; in stm32_usart_set_termios()
820 if (!stm32_port->hw_flow_control) in stm32_usart_set_termios()
845 if (stm32_port->fifoen) in stm32_usart_set_termios()
847 cr2 = stm32_port->swap ? USART_CR2_SWAP : 0; in stm32_usart_set_termios()
852 if (stm32_port->fifoen) { in stm32_usart_set_termios()
853 if (stm32_port->txftcfg >= 0) in stm32_usart_set_termios()
854 cr3 |= stm32_port->txftcfg << USART_CR3_TXFTCFG_SHIFT; in stm32_usart_set_termios()
855 if (stm32_port->rxftcfg >= 0) in stm32_usart_set_termios()
856 cr3 |= stm32_port->rxftcfg << USART_CR3_RXFTCFG_SHIFT; in stm32_usart_set_termios()
863 stm32_port->rdr_mask = (BIT(bits) - 1); in stm32_usart_set_termios()
894 if (ofs->rtor != UNDEF_REG && (stm32_port->rx_ch || in stm32_usart_set_termios()
895 (stm32_port->fifoen && in stm32_usart_set_termios()
896 stm32_port->rxftcfg >= 0))) { in stm32_usart_set_termios()
903 stm32_port->cr1_irq = USART_CR1_RTOIE; in stm32_usart_set_termios()
907 if (!stm32_port->rx_ch) in stm32_usart_set_termios()
908 stm32_port->cr3_irq = USART_CR3_RXFTIE; in stm32_usart_set_termios()
911 cr1 |= stm32_port->cr1_irq; in stm32_usart_set_termios()
912 cr3 |= stm32_port->cr3_irq; in stm32_usart_set_termios()
971 if (stm32_port->rx_ch) in stm32_usart_set_termios()
993 if (stm32_port->wakeup_src) { in stm32_usart_set_termios()
1042 struct stm32_port *stm32port = container_of(port, in stm32_usart_pm()
1043 struct stm32_port, port); in stm32_usart_pm()
1117 static void stm32_usart_deinit_port(struct stm32_port *stm32port) in stm32_usart_deinit_port()
1122 static int stm32_usart_init_port(struct stm32_port *stm32port, in stm32_usart_init_port()
1209 static struct stm32_port *stm32_usart_of_get_port(struct platform_device *pdev) in stm32_usart_of_get_port()
1247 static void stm32_usart_of_dma_rx_remove(struct stm32_port *stm32port, in stm32_usart_of_dma_rx_remove()
1255 static int stm32_usart_of_dma_rx_probe(struct stm32_port *stm32port, in stm32_usart_of_dma_rx_probe()
1319 static void stm32_usart_of_dma_tx_remove(struct stm32_port *stm32port, in stm32_usart_of_dma_tx_remove()
1327 static int stm32_usart_of_dma_tx_probe(struct stm32_port *stm32port, in stm32_usart_of_dma_tx_probe()
1361 struct stm32_port *stm32port; in stm32_usart_serial_probe()
1464 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_serial_remove() local
1465 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_serial_remove()
1479 if (stm32_port->tx_ch) { in stm32_usart_serial_remove()
1480 stm32_usart_of_dma_tx_remove(stm32_port, pdev); in stm32_usart_serial_remove()
1481 dma_release_channel(stm32_port->tx_ch); in stm32_usart_serial_remove()
1484 if (stm32_port->rx_ch) { in stm32_usart_serial_remove()
1485 dmaengine_terminate_async(stm32_port->rx_ch); in stm32_usart_serial_remove()
1486 stm32_usart_of_dma_rx_remove(stm32_port, pdev); in stm32_usart_serial_remove()
1487 dma_release_channel(stm32_port->rx_ch); in stm32_usart_serial_remove()
1492 if (stm32_port->wakeup_src) { in stm32_usart_serial_remove()
1497 stm32_usart_deinit_port(stm32_port); in stm32_usart_serial_remove()
1505 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_console_putchar() local
1506 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_console_putchar()
1518 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_console_write() local
1519 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_console_write()
1520 const struct stm32_usart_config *cfg = &stm32_port->info->cfg; in stm32_usart_console_write()
1547 struct stm32_port *stm32port; in stm32_usart_console_setup()
1601 struct stm32_port *stm32_port = to_stm32_port(port); in stm32_usart_serial_en_wakeup() local
1602 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; in stm32_usart_serial_en_wakeup()
1604 if (!stm32_port->wakeup_src) in stm32_usart_serial_en_wakeup()
1660 struct stm32_port *stm32port = container_of(port, in stm32_usart_runtime_suspend()
1661 struct stm32_port, port); in stm32_usart_runtime_suspend()
1671 struct stm32_port *stm32port = container_of(port, in stm32_usart_runtime_resume()
1672 struct stm32_port, port); in stm32_usart_runtime_resume()