Lines Matching defs:stm32_port
40 static inline struct stm32_port *to_stm32_port(struct uart_port *port)
42 return container_of(port, struct stm32_port, port);
103 struct stm32_port *stm32_port = to_stm32_port(port);
104 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
105 const struct stm32_usart_config *cfg = &stm32_port->info->cfg;
172 struct stm32_port *stm32_port = to_stm32_port(port);
173 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
179 if (threaded && stm32_port->rx_ch) {
180 status = dmaengine_tx_status(stm32_port->rx_ch,
181 stm32_port->rx_ch->cookie,
196 struct stm32_port *stm32_port = to_stm32_port(port);
197 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
200 if (stm32_port->rx_ch) {
201 c = stm32_port->rx_buf[RX_BUF_L - (*last_res)--];
207 c &= stm32_port->rdr_mask;
216 struct stm32_port *stm32_port = to_stm32_port(port);
217 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
224 while (stm32_usart_pending_rx(port, &sr, &stm32_port->last_res,
244 c = stm32_usart_get_char(port, &sr, &stm32_port->last_res);
287 struct stm32_port *stm32port = to_stm32_port(port);
303 struct stm32_port *stm32_port = to_stm32_port(port);
304 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
310 if (stm32_port->fifoen)
318 struct stm32_port *stm32_port = to_stm32_port(port);
319 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
321 if (stm32_port->fifoen)
329 struct stm32_port *stm32_port = to_stm32_port(port);
330 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
333 if (stm32_port->tx_dma_busy) {
335 stm32_port->tx_dma_busy = false;
356 struct stm32_port *stm32port = to_stm32_port(port);
422 struct stm32_port *stm32_port = to_stm32_port(port);
423 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
429 if (stm32_port->tx_dma_busy)
444 if (stm32_port->tx_dma_busy)
459 if (stm32_port->tx_ch)
475 struct stm32_port *stm32_port = to_stm32_port(port);
476 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
494 if ((sr & USART_SR_RXNE) && !(stm32_port->rx_ch))
497 if ((sr & USART_SR_TXE) && !(stm32_port->tx_ch)) {
503 if (stm32_port->rx_ch)
512 struct stm32_port *stm32_port = to_stm32_port(port);
514 if (stm32_port->rx_ch)
522 struct stm32_port *stm32_port = to_stm32_port(port);
523 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
533 struct stm32_port *stm32_port = to_stm32_port(port);
534 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
541 mctrl_gpio_set(stm32_port->gpios, mctrl);
546 struct stm32_port *stm32_port = to_stm32_port(port);
552 return mctrl_gpio_get(stm32_port->gpios, &ret);
568 struct stm32_port *stm32_port = to_stm32_port(port);
575 mctrl_gpio_set(stm32_port->gpios,
576 stm32_port->port.mctrl & ~TIOCM_RTS);
578 mctrl_gpio_set(stm32_port->gpios,
579 stm32_port->port.mctrl | TIOCM_RTS);
587 struct stm32_port *stm32_port = to_stm32_port(port);
596 mctrl_gpio_set(stm32_port->gpios,
597 stm32_port->port.mctrl | TIOCM_RTS);
599 mctrl_gpio_set(stm32_port->gpios,
600 stm32_port->port.mctrl & ~TIOCM_RTS);
610 struct stm32_port *stm32_port = to_stm32_port(port);
611 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
615 stm32_usart_clr_bits(port, ofs->cr1, stm32_port->cr1_irq);
616 if (stm32_port->cr3_irq)
617 stm32_usart_clr_bits(port, ofs->cr3, stm32_port->cr3_irq);
625 struct stm32_port *stm32_port = to_stm32_port(port);
626 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
630 stm32_usart_set_bits(port, ofs->cr1, stm32_port->cr1_irq);
631 if (stm32_port->cr3_irq)
632 stm32_usart_set_bits(port, ofs->cr3, stm32_port->cr3_irq);
640 struct stm32_port *stm32_port = to_stm32_port(port);
641 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
643 stm32_usart_clr_bits(port, ofs->cr1, stm32_port->cr1_irq);
644 if (stm32_port->cr3_irq)
645 stm32_usart_clr_bits(port, ofs->cr3, stm32_port->cr3_irq);
655 struct stm32_port *stm32_port = to_stm32_port(port);
656 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
657 const struct stm32_usart_config *cfg = &stm32_port->info->cfg;
674 val = stm32_port->cr1_irq | USART_CR1_RE | BIT(cfg->uart_enable_bit);
682 struct stm32_port *stm32_port = to_stm32_port(port);
683 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
684 const struct stm32_usart_config *cfg = &stm32_port->info->cfg;
692 val |= stm32_port->cr1_irq | USART_CR1_RE;
694 if (stm32_port->fifoen)
748 struct stm32_port *stm32_port = to_stm32_port(port);
749 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
750 const struct stm32_usart_config *cfg = &stm32_port->info->cfg;
759 if (!stm32_port->hw_flow_control)
784 if (stm32_port->fifoen)
791 if (stm32_port->fifoen) {
801 stm32_port->rdr_mask = (BIT(bits) - 1);
832 if (ofs->rtor != UNDEF_REG && (stm32_port->rx_ch ||
833 stm32_port->fifoen)) {
840 stm32_port->cr1_irq = USART_CR1_RTOIE;
844 if (!stm32_port->rx_ch)
845 stm32_port->cr3_irq = USART_CR3_RXFTIE;
848 cr1 |= stm32_port->cr1_irq;
849 cr3 |= stm32_port->cr3_irq;
908 if (stm32_port->rx_ch)
930 if (stm32_port->wakeirq > 0) {
979 struct stm32_port *stm32port = container_of(port,
980 struct stm32_port, port);
1020 static int stm32_usart_init_port(struct stm32_port *stm32port,
1099 static struct stm32_port *stm32_usart_of_get_port(struct platform_device *pdev)
1137 static int stm32_usart_of_dma_rx_probe(struct stm32_port *stm32port,
1219 static int stm32_usart_of_dma_tx_probe(struct stm32_port *stm32port,
1272 struct stm32_port *stm32port;
1363 struct stm32_port *stm32_port = to_stm32_port(port);
1364 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
1378 if (stm32_port->rx_ch) {
1379 dmaengine_terminate_async(stm32_port->rx_ch);
1380 dma_release_channel(stm32_port->rx_ch);
1383 if (stm32_port->rx_dma_buf)
1385 RX_BUF_L, stm32_port->rx_buf,
1386 stm32_port->rx_dma_buf);
1390 if (stm32_port->tx_ch) {
1391 dmaengine_terminate_async(stm32_port->tx_ch);
1392 dma_release_channel(stm32_port->tx_ch);
1395 if (stm32_port->tx_dma_buf)
1397 TX_BUF_L, stm32_port->tx_buf,
1398 stm32_port->tx_dma_buf);
1400 if (stm32_port->wakeirq > 0) {
1405 clk_disable_unprepare(stm32_port->clk);
1413 struct stm32_port *stm32_port = to_stm32_port(port);
1414 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
1426 struct stm32_port *stm32_port = to_stm32_port(port);
1427 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
1428 const struct stm32_usart_config *cfg = &stm32_port->info->cfg;
1459 struct stm32_port *stm32port;
1513 struct stm32_port *stm32_port = to_stm32_port(port);
1514 const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
1516 if (stm32_port->wakeirq <= 0)
1574 struct stm32_port *stm32port = container_of(port,
1575 struct stm32_port, port);
1585 struct stm32_port *stm32port = container_of(port,
1586 struct stm32_port, port);