Lines Matching +full:s3c6400 +full:- +full:uart
1 // SPDX-License-Identifier: GPL-2.0
5 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
12 * UERSTAT register in the UART blocks, and keeps marking some of the
21 * BJD, 04-Nov-2004
25 #include <linux/dma-mapping.h>
45 /* UART name and device definitions */
74 /* uart port features */
153 #define portaddr(port, reg) ((port)->membase + (reg))
155 ((unsigned long *)(unsigned long)((port)->membase + (reg)))
159 switch (port->iotype) { in rd_reg()
174 switch (port->iotype) { in wr_reg()
186 /* Byte-order aware bit setting/clearing functions. */
223 return to_platform_device(port->dev)->name; in s3c24xx_serial_portname()
238 return to_ourport(port)->info->type == PORT_S3C6400; in s3c24xx_serial_has_interrupt_mask()
248 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_enable()
250 while (--count && !s3c24xx_serial_txempty_nofifo(port)) in s3c24xx_serial_rx_enable()
261 ourport->rx_enabled = 1; in s3c24xx_serial_rx_enable()
262 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_enable()
271 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_disable()
277 ourport->rx_enabled = 0; in s3c24xx_serial_rx_disable()
278 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_disable()
284 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_stop_tx()
285 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_stop_tx()
289 if (!ourport->tx_enabled) in s3c24xx_serial_stop_tx()
295 disable_irq_nosync(ourport->tx_irq); in s3c24xx_serial_stop_tx()
297 if (dma && dma->tx_chan && ourport->tx_in_progress == S3C24XX_TX_DMA) { in s3c24xx_serial_stop_tx()
298 dmaengine_pause(dma->tx_chan); in s3c24xx_serial_stop_tx()
299 dmaengine_tx_status(dma->tx_chan, dma->tx_cookie, &state); in s3c24xx_serial_stop_tx()
300 dmaengine_terminate_all(dma->tx_chan); in s3c24xx_serial_stop_tx()
301 dma_sync_single_for_cpu(ourport->port.dev, in s3c24xx_serial_stop_tx()
302 dma->tx_transfer_addr, dma->tx_size, DMA_TO_DEVICE); in s3c24xx_serial_stop_tx()
303 async_tx_ack(dma->tx_desc); in s3c24xx_serial_stop_tx()
304 count = dma->tx_bytes_requested - state.residue; in s3c24xx_serial_stop_tx()
305 xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); in s3c24xx_serial_stop_tx()
306 port->icount.tx += count; in s3c24xx_serial_stop_tx()
309 ourport->tx_enabled = 0; in s3c24xx_serial_stop_tx()
310 ourport->tx_in_progress = 0; in s3c24xx_serial_stop_tx()
312 if (port->flags & UPF_CONS_FLOW) in s3c24xx_serial_stop_tx()
315 ourport->tx_mode = 0; in s3c24xx_serial_stop_tx()
323 struct uart_port *port = &ourport->port; in s3c24xx_serial_tx_dma_complete()
324 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_tx_dma_complete()
325 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_tx_dma_complete()
330 dmaengine_tx_status(dma->tx_chan, dma->tx_cookie, &state); in s3c24xx_serial_tx_dma_complete()
331 count = dma->tx_bytes_requested - state.residue; in s3c24xx_serial_tx_dma_complete()
332 async_tx_ack(dma->tx_desc); in s3c24xx_serial_tx_dma_complete()
334 dma_sync_single_for_cpu(ourport->port.dev, dma->tx_transfer_addr, in s3c24xx_serial_tx_dma_complete()
335 dma->tx_size, DMA_TO_DEVICE); in s3c24xx_serial_tx_dma_complete()
337 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_tx_dma_complete()
339 xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1); in s3c24xx_serial_tx_dma_complete()
340 port->icount.tx += count; in s3c24xx_serial_tx_dma_complete()
341 ourport->tx_in_progress = 0; in s3c24xx_serial_tx_dma_complete()
347 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_tx_dma_complete()
352 struct uart_port *port = &ourport->port; in enable_tx_dma()
359 disable_irq_nosync(ourport->tx_irq); in enable_tx_dma()
368 ourport->tx_mode = S3C24XX_TX_DMA; in enable_tx_dma()
373 struct uart_port *port = &ourport->port; in enable_tx_pio()
377 ourport->tx_in_progress = S3C24XX_TX_PIO; in enable_tx_pio()
392 enable_irq(ourport->tx_irq); in enable_tx_pio()
394 ourport->tx_mode = S3C24XX_TX_PIO; in enable_tx_pio()
399 if (ourport->tx_mode != S3C24XX_TX_PIO) in s3c24xx_serial_start_tx_pio()
406 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_tx_dma()
407 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx_dma()
408 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_start_tx_dma()
410 if (ourport->tx_mode != S3C24XX_TX_DMA) in s3c24xx_serial_start_tx_dma()
413 dma->tx_size = count & ~(dma_get_cache_alignment() - 1); in s3c24xx_serial_start_tx_dma()
414 dma->tx_transfer_addr = dma->tx_addr + xmit->tail; in s3c24xx_serial_start_tx_dma()
416 dma_sync_single_for_device(ourport->port.dev, dma->tx_transfer_addr, in s3c24xx_serial_start_tx_dma()
417 dma->tx_size, DMA_TO_DEVICE); in s3c24xx_serial_start_tx_dma()
419 dma->tx_desc = dmaengine_prep_slave_single(dma->tx_chan, in s3c24xx_serial_start_tx_dma()
420 dma->tx_transfer_addr, dma->tx_size, in s3c24xx_serial_start_tx_dma()
422 if (!dma->tx_desc) { in s3c24xx_serial_start_tx_dma()
423 dev_err(ourport->port.dev, "Unable to get desc for Tx\n"); in s3c24xx_serial_start_tx_dma()
424 return -EIO; in s3c24xx_serial_start_tx_dma()
427 dma->tx_desc->callback = s3c24xx_serial_tx_dma_complete; in s3c24xx_serial_start_tx_dma()
428 dma->tx_desc->callback_param = ourport; in s3c24xx_serial_start_tx_dma()
429 dma->tx_bytes_requested = dma->tx_size; in s3c24xx_serial_start_tx_dma()
431 ourport->tx_in_progress = S3C24XX_TX_DMA; in s3c24xx_serial_start_tx_dma()
432 dma->tx_cookie = dmaengine_submit(dma->tx_desc); in s3c24xx_serial_start_tx_dma()
433 dma_async_issue_pending(dma->tx_chan); in s3c24xx_serial_start_tx_dma()
439 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_next_tx()
440 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_next_tx()
444 count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); in s3c24xx_serial_start_next_tx()
451 if (!ourport->dma || !ourport->dma->tx_chan || in s3c24xx_serial_start_next_tx()
452 count < ourport->min_dma_size || in s3c24xx_serial_start_next_tx()
453 xmit->tail & (dma_get_cache_alignment() - 1)) in s3c24xx_serial_start_next_tx()
462 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx()
464 if (!ourport->tx_enabled) { in s3c24xx_serial_start_tx()
465 if (port->flags & UPF_CONS_FLOW) in s3c24xx_serial_start_tx()
468 ourport->tx_enabled = 1; in s3c24xx_serial_start_tx()
469 if (!ourport->dma || !ourport->dma->tx_chan) in s3c24xx_serial_start_tx()
473 if (ourport->dma && ourport->dma->tx_chan) { in s3c24xx_serial_start_tx()
474 if (!uart_circ_empty(xmit) && !ourport->tx_in_progress) in s3c24xx_serial_start_tx()
482 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_uart_copy_rx_to_tty()
488 dma_sync_single_for_cpu(ourport->port.dev, dma->rx_addr, in s3c24xx_uart_copy_rx_to_tty()
489 dma->rx_size, DMA_FROM_DEVICE); in s3c24xx_uart_copy_rx_to_tty()
491 ourport->port.icount.rx += count; in s3c24xx_uart_copy_rx_to_tty()
493 dev_err(ourport->port.dev, "No tty port\n"); in s3c24xx_uart_copy_rx_to_tty()
497 ((unsigned char *)(ourport->dma->rx_buf)), count); in s3c24xx_uart_copy_rx_to_tty()
500 dev_err(ourport->port.dev, "RxData copy to tty layer failed\n"); in s3c24xx_uart_copy_rx_to_tty()
507 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_stop_rx()
508 struct tty_port *t = &port->state->port; in s3c24xx_serial_stop_rx()
513 if (ourport->rx_enabled) { in s3c24xx_serial_stop_rx()
514 dev_dbg(port->dev, "stopping rx\n"); in s3c24xx_serial_stop_rx()
519 disable_irq_nosync(ourport->rx_irq); in s3c24xx_serial_stop_rx()
520 ourport->rx_enabled = 0; in s3c24xx_serial_stop_rx()
522 if (dma && dma->rx_chan) { in s3c24xx_serial_stop_rx()
523 dmaengine_pause(dma->tx_chan); in s3c24xx_serial_stop_rx()
524 dma_status = dmaengine_tx_status(dma->rx_chan, in s3c24xx_serial_stop_rx()
525 dma->rx_cookie, &state); in s3c24xx_serial_stop_rx()
528 received = dma->rx_bytes_requested - state.residue; in s3c24xx_serial_stop_rx()
529 dmaengine_terminate_all(dma->rx_chan); in s3c24xx_serial_stop_rx()
538 return to_ourport(port)->info; in s3c24xx_port_to_info()
546 if (port->dev == NULL) in s3c24xx_port_to_cfg()
550 return ourport->cfg; in s3c24xx_port_to_cfg()
556 struct s3c24xx_uart_info *info = ourport->info; in s3c24xx_serial_rx_fifocnt()
558 if (ufstat & info->rx_fifofull) in s3c24xx_serial_rx_fifocnt()
559 return ourport->port.fifosize; in s3c24xx_serial_rx_fifocnt()
561 return (ufstat & info->rx_fifomask) >> info->rx_fifoshift; in s3c24xx_serial_rx_fifocnt()
568 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_dma_complete()
570 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_rx_dma_complete()
571 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_dma_complete()
572 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_dma_complete()
578 dmaengine_tx_status(dma->rx_chan, dma->rx_cookie, &state); in s3c24xx_serial_rx_dma_complete()
579 received = dma->rx_bytes_requested - state.residue; in s3c24xx_serial_rx_dma_complete()
580 async_tx_ack(dma->rx_desc); in s3c24xx_serial_rx_dma_complete()
582 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
594 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
599 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c64xx_start_rx_dma()
601 dma_sync_single_for_device(ourport->port.dev, dma->rx_addr, in s3c64xx_start_rx_dma()
602 dma->rx_size, DMA_FROM_DEVICE); in s3c64xx_start_rx_dma()
604 dma->rx_desc = dmaengine_prep_slave_single(dma->rx_chan, in s3c64xx_start_rx_dma()
605 dma->rx_addr, dma->rx_size, DMA_DEV_TO_MEM, in s3c64xx_start_rx_dma()
607 if (!dma->rx_desc) { in s3c64xx_start_rx_dma()
608 dev_err(ourport->port.dev, "Unable to get desc for Rx\n"); in s3c64xx_start_rx_dma()
612 dma->rx_desc->callback = s3c24xx_serial_rx_dma_complete; in s3c64xx_start_rx_dma()
613 dma->rx_desc->callback_param = ourport; in s3c64xx_start_rx_dma()
614 dma->rx_bytes_requested = dma->rx_size; in s3c64xx_start_rx_dma()
616 dma->rx_cookie = dmaengine_submit(dma->rx_desc); in s3c64xx_start_rx_dma()
617 dma_async_issue_pending(dma->rx_chan); in s3c64xx_start_rx_dma()
620 /* ? - where has parity gone?? */
625 struct uart_port *port = &ourport->port; in enable_rx_dma()
643 ourport->rx_mode = S3C24XX_RX_DMA; in enable_rx_dma()
648 struct uart_port *port = &ourport->port; in enable_rx_pio()
663 ourport->rx_mode = S3C24XX_RX_PIO; in enable_rx_pio()
672 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_dma()
673 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_rx_chars_dma()
674 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_chars_dma()
675 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_chars_dma()
682 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
686 if (ourport->rx_mode == S3C24XX_RX_PIO) in s3c24xx_serial_rx_chars_dma()
691 if (ourport->rx_mode == S3C24XX_RX_DMA) { in s3c24xx_serial_rx_chars_dma()
692 dmaengine_pause(dma->rx_chan); in s3c24xx_serial_rx_chars_dma()
693 dmaengine_tx_status(dma->rx_chan, dma->rx_cookie, &state); in s3c24xx_serial_rx_chars_dma()
694 dmaengine_terminate_all(dma->rx_chan); in s3c24xx_serial_rx_chars_dma()
695 received = dma->rx_bytes_requested - state.residue; in s3c24xx_serial_rx_chars_dma()
711 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
718 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_drain_fifo()
721 int max_count = port->fifosize; in s3c24xx_serial_rx_drain_fifo()
723 while (max_count-- > 0) { in s3c24xx_serial_rx_drain_fifo()
734 fifocnt--; in s3c24xx_serial_rx_drain_fifo()
739 if (port->flags & UPF_CONS_FLOW) { in s3c24xx_serial_rx_drain_fifo()
742 if (ourport->rx_enabled) { in s3c24xx_serial_rx_drain_fifo()
744 ourport->rx_enabled = 0; in s3c24xx_serial_rx_drain_fifo()
752 ourport->rx_enabled = 1; in s3c24xx_serial_rx_drain_fifo()
762 port->icount.rx++; in s3c24xx_serial_rx_drain_fifo()
765 dev_dbg(port->dev, in s3c24xx_serial_rx_drain_fifo()
771 dev_dbg(port->dev, "break!\n"); in s3c24xx_serial_rx_drain_fifo()
772 port->icount.brk++; in s3c24xx_serial_rx_drain_fifo()
778 port->icount.frame++; in s3c24xx_serial_rx_drain_fifo()
780 port->icount.overrun++; in s3c24xx_serial_rx_drain_fifo()
782 uerstat &= port->read_status_mask; in s3c24xx_serial_rx_drain_fifo()
800 tty_flip_buffer_push(&port->state->port); in s3c24xx_serial_rx_drain_fifo()
806 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_pio()
809 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
811 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
820 if (ourport->dma && ourport->dma->rx_chan) in s3c24xx_serial_rx_chars()
828 struct uart_port *port = &ourport->port; in s3c24xx_serial_tx_chars()
829 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_tx_chars()
833 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_tx_chars()
835 count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); in s3c24xx_serial_tx_chars()
837 if (ourport->dma && ourport->dma->tx_chan && in s3c24xx_serial_tx_chars()
838 count >= ourport->min_dma_size) { in s3c24xx_serial_tx_chars()
839 int align = dma_get_cache_alignment() - in s3c24xx_serial_tx_chars()
840 (xmit->tail & (dma_get_cache_alignment() - 1)); in s3c24xx_serial_tx_chars()
841 if (count - align >= ourport->min_dma_size) { in s3c24xx_serial_tx_chars()
842 dma_count = count - align; in s3c24xx_serial_tx_chars()
847 if (port->x_char) { in s3c24xx_serial_tx_chars()
848 wr_reg(port, S3C2410_UTXH, port->x_char); in s3c24xx_serial_tx_chars()
849 port->icount.tx++; in s3c24xx_serial_tx_chars()
850 port->x_char = 0; in s3c24xx_serial_tx_chars()
854 /* if there isn't anything more to transmit, or the uart is now in s3c24xx_serial_tx_chars()
855 * stopped, disable the uart and exit in s3c24xx_serial_tx_chars()
865 if (count > port->fifosize) { in s3c24xx_serial_tx_chars()
866 count = port->fifosize; in s3c24xx_serial_tx_chars()
871 if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull) in s3c24xx_serial_tx_chars()
874 wr_reg(port, S3C2410_UTXH, xmit->buf[xmit->tail]); in s3c24xx_serial_tx_chars()
875 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); in s3c24xx_serial_tx_chars()
876 port->icount.tx++; in s3c24xx_serial_tx_chars()
877 count--; in s3c24xx_serial_tx_chars()
892 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_tx_chars()
900 struct uart_port *port = &ourport->port; in s3c64xx_serial_handle_irq()
922 if ((ufstat & info->tx_fifomask) != 0 || in s3c24xx_serial_tx_empty()
923 (ufstat & info->tx_fifofull)) in s3c24xx_serial_tx_empty()
960 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_break_ctl()
971 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_break_ctl()
976 struct s3c24xx_uart_dma *dma = p->dma; in s3c24xx_serial_request_dma()
982 dma->rx_conf.direction = DMA_DEV_TO_MEM; in s3c24xx_serial_request_dma()
983 dma->rx_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; in s3c24xx_serial_request_dma()
984 dma->rx_conf.src_addr = p->port.mapbase + S3C2410_URXH; in s3c24xx_serial_request_dma()
985 dma->rx_conf.src_maxburst = 1; in s3c24xx_serial_request_dma()
987 dma->tx_conf.direction = DMA_MEM_TO_DEV; in s3c24xx_serial_request_dma()
988 dma->tx_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; in s3c24xx_serial_request_dma()
989 dma->tx_conf.dst_addr = p->port.mapbase + S3C2410_UTXH; in s3c24xx_serial_request_dma()
990 dma->tx_conf.dst_maxburst = 1; in s3c24xx_serial_request_dma()
992 dma->rx_chan = dma_request_chan(p->port.dev, "rx"); in s3c24xx_serial_request_dma()
994 if (IS_ERR(dma->rx_chan)) { in s3c24xx_serial_request_dma()
996 ret = PTR_ERR(dma->rx_chan); in s3c24xx_serial_request_dma()
1000 ret = dma_get_slave_caps(dma->rx_chan, &dma_caps); in s3c24xx_serial_request_dma()
1004 ret = -EOPNOTSUPP; in s3c24xx_serial_request_dma()
1008 dmaengine_slave_config(dma->rx_chan, &dma->rx_conf); in s3c24xx_serial_request_dma()
1010 dma->tx_chan = dma_request_chan(p->port.dev, "tx"); in s3c24xx_serial_request_dma()
1011 if (IS_ERR(dma->tx_chan)) { in s3c24xx_serial_request_dma()
1013 ret = PTR_ERR(dma->tx_chan); in s3c24xx_serial_request_dma()
1017 ret = dma_get_slave_caps(dma->tx_chan, &dma_caps); in s3c24xx_serial_request_dma()
1021 ret = -EOPNOTSUPP; in s3c24xx_serial_request_dma()
1025 dmaengine_slave_config(dma->tx_chan, &dma->tx_conf); in s3c24xx_serial_request_dma()
1028 dma->rx_size = PAGE_SIZE; in s3c24xx_serial_request_dma()
1030 dma->rx_buf = kmalloc(dma->rx_size, GFP_KERNEL); in s3c24xx_serial_request_dma()
1031 if (!dma->rx_buf) { in s3c24xx_serial_request_dma()
1032 ret = -ENOMEM; in s3c24xx_serial_request_dma()
1036 dma->rx_addr = dma_map_single(p->port.dev, dma->rx_buf, in s3c24xx_serial_request_dma()
1037 dma->rx_size, DMA_FROM_DEVICE); in s3c24xx_serial_request_dma()
1038 if (dma_mapping_error(p->port.dev, dma->rx_addr)) { in s3c24xx_serial_request_dma()
1040 ret = -EIO; in s3c24xx_serial_request_dma()
1045 dma->tx_addr = dma_map_single(p->port.dev, p->port.state->xmit.buf, in s3c24xx_serial_request_dma()
1047 if (dma_mapping_error(p->port.dev, dma->tx_addr)) { in s3c24xx_serial_request_dma()
1049 ret = -EIO; in s3c24xx_serial_request_dma()
1056 dma_unmap_single(p->port.dev, dma->rx_addr, dma->rx_size, in s3c24xx_serial_request_dma()
1059 kfree(dma->rx_buf); in s3c24xx_serial_request_dma()
1061 dma_release_channel(dma->tx_chan); in s3c24xx_serial_request_dma()
1063 dma_release_channel(dma->rx_chan); in s3c24xx_serial_request_dma()
1066 dev_warn(p->port.dev, "%s, DMA will not be used\n", reason); in s3c24xx_serial_request_dma()
1072 struct s3c24xx_uart_dma *dma = p->dma; in s3c24xx_serial_release_dma()
1074 if (dma->rx_chan) { in s3c24xx_serial_release_dma()
1075 dmaengine_terminate_all(dma->rx_chan); in s3c24xx_serial_release_dma()
1076 dma_unmap_single(p->port.dev, dma->rx_addr, in s3c24xx_serial_release_dma()
1077 dma->rx_size, DMA_FROM_DEVICE); in s3c24xx_serial_release_dma()
1078 kfree(dma->rx_buf); in s3c24xx_serial_release_dma()
1079 dma_release_channel(dma->rx_chan); in s3c24xx_serial_release_dma()
1080 dma->rx_chan = NULL; in s3c24xx_serial_release_dma()
1083 if (dma->tx_chan) { in s3c24xx_serial_release_dma()
1084 dmaengine_terminate_all(dma->tx_chan); in s3c24xx_serial_release_dma()
1085 dma_unmap_single(p->port.dev, dma->tx_addr, in s3c24xx_serial_release_dma()
1087 dma_release_channel(dma->tx_chan); in s3c24xx_serial_release_dma()
1088 dma->tx_chan = NULL; in s3c24xx_serial_release_dma()
1096 if (ourport->tx_claimed) { in s3c24xx_serial_shutdown()
1098 free_irq(ourport->tx_irq, ourport); in s3c24xx_serial_shutdown()
1099 ourport->tx_enabled = 0; in s3c24xx_serial_shutdown()
1100 ourport->tx_claimed = 0; in s3c24xx_serial_shutdown()
1101 ourport->tx_mode = 0; in s3c24xx_serial_shutdown()
1104 if (ourport->rx_claimed) { in s3c24xx_serial_shutdown()
1106 free_irq(ourport->rx_irq, ourport); in s3c24xx_serial_shutdown()
1107 ourport->rx_claimed = 0; in s3c24xx_serial_shutdown()
1108 ourport->rx_enabled = 0; in s3c24xx_serial_shutdown()
1113 free_irq(port->irq, ourport); in s3c24xx_serial_shutdown()
1119 if (ourport->dma) in s3c24xx_serial_shutdown()
1122 ourport->tx_in_progress = 0; in s3c24xx_serial_shutdown()
1130 ourport->rx_enabled = 1; in s3c24xx_serial_startup()
1132 ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_chars, 0, in s3c24xx_serial_startup()
1136 dev_err(port->dev, "cannot get irq %d\n", ourport->rx_irq); in s3c24xx_serial_startup()
1140 ourport->rx_claimed = 1; in s3c24xx_serial_startup()
1142 dev_dbg(port->dev, "requesting tx irq...\n"); in s3c24xx_serial_startup()
1144 ourport->tx_enabled = 1; in s3c24xx_serial_startup()
1146 ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_chars, 0, in s3c24xx_serial_startup()
1150 dev_err(port->dev, "cannot get irq %d\n", ourport->tx_irq); in s3c24xx_serial_startup()
1154 ourport->tx_claimed = 1; in s3c24xx_serial_startup()
1175 if (ourport->dma) { in s3c64xx_serial_startup()
1178 devm_kfree(port->dev, ourport->dma); in s3c64xx_serial_startup()
1179 ourport->dma = NULL; in s3c64xx_serial_startup()
1183 ret = request_irq(port->irq, s3c64xx_serial_handle_irq, IRQF_SHARED, in s3c64xx_serial_startup()
1186 dev_err(port->dev, "cannot get irq %d\n", port->irq); in s3c64xx_serial_startup()
1191 ourport->rx_enabled = 1; in s3c64xx_serial_startup()
1192 ourport->rx_claimed = 1; in s3c64xx_serial_startup()
1193 ourport->tx_enabled = 0; in s3c64xx_serial_startup()
1194 ourport->tx_claimed = 1; in s3c64xx_serial_startup()
1196 spin_lock_irqsave(&port->lock, flags); in s3c64xx_serial_startup()
1206 spin_unlock_irqrestore(&port->lock, flags); in s3c64xx_serial_startup()
1222 ourport->pm_level = level; in s3c24xx_serial_pm()
1226 while (--timeout && !s3c24xx_serial_txempty_nofifo(port)) in s3c24xx_serial_pm()
1229 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_pm()
1230 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_pm()
1232 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_pm()
1236 clk_prepare_enable(ourport->clk); in s3c24xx_serial_pm()
1238 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_pm()
1239 clk_prepare_enable(ourport->baudclk); in s3c24xx_serial_pm()
1243 dev_err(port->dev, "s3c24xx_serial: unknown pm %d\n", level); in s3c24xx_serial_pm()
1267 if (info->num_clks == 1) in s3c24xx_serial_getsource()
1271 ucon &= info->clksel_mask; in s3c24xx_serial_getsource()
1272 return ucon >> info->clksel_shift; in s3c24xx_serial_getsource()
1281 if (info->num_clks == 1) in s3c24xx_serial_setsource()
1285 if ((ucon & info->clksel_mask) >> info->clksel_shift == clk_sel) in s3c24xx_serial_setsource()
1288 ucon &= ~info->clksel_mask; in s3c24xx_serial_setsource()
1289 ucon |= clk_sel << info->clksel_shift; in s3c24xx_serial_setsource()
1297 struct s3c24xx_uart_info *info = ourport->info; in s3c24xx_serial_getclk()
1302 int calc_deviation, deviation = (1 << 30) - 1; in s3c24xx_serial_getclk()
1304 for (cnt = 0; cnt < info->num_clks; cnt++) { in s3c24xx_serial_getclk()
1306 if (ourport->cfg->clk_sel && in s3c24xx_serial_getclk()
1307 !(ourport->cfg->clk_sel & (1 << cnt))) in s3c24xx_serial_getclk()
1311 clk = clk_get(ourport->port.dev, clkname); in s3c24xx_serial_getclk()
1317 dev_err(ourport->port.dev, in s3c24xx_serial_getclk()
1323 if (ourport->info->has_divslot) { in s3c24xx_serial_getclk()
1340 quot--; in s3c24xx_serial_getclk()
1342 calc_deviation = req_baud - baud; in s3c24xx_serial_getclk()
1344 calc_deviation = -calc_deviation; in s3c24xx_serial_getclk()
1395 struct clk *clk = ERR_PTR(-EINVAL); in s3c24xx_serial_set_termios()
1405 termios->c_cflag &= ~(HUPCL | CMSPAR); in s3c24xx_serial_set_termios()
1406 termios->c_cflag |= CLOCAL; in s3c24xx_serial_set_termios()
1414 if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) in s3c24xx_serial_set_termios()
1415 quot = port->custom_divisor; in s3c24xx_serial_set_termios()
1421 if (ourport->baudclk != clk) { in s3c24xx_serial_set_termios()
1426 if (!IS_ERR(ourport->baudclk)) { in s3c24xx_serial_set_termios()
1427 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_set_termios()
1428 ourport->baudclk = ERR_PTR(-EINVAL); in s3c24xx_serial_set_termios()
1431 ourport->baudclk = clk; in s3c24xx_serial_set_termios()
1432 ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0; in s3c24xx_serial_set_termios()
1435 if (ourport->info->has_divslot) { in s3c24xx_serial_set_termios()
1436 unsigned int div = ourport->baudclk_rate / baud; in s3c24xx_serial_set_termios()
1438 if (cfg->has_fracval) { in s3c24xx_serial_set_termios()
1440 dev_dbg(port->dev, "fracval = %04x\n", udivslot); in s3c24xx_serial_set_termios()
1443 dev_dbg(port->dev, "udivslot = %04x (div %d)\n", in s3c24xx_serial_set_termios()
1448 switch (termios->c_cflag & CSIZE) { in s3c24xx_serial_set_termios()
1450 dev_dbg(port->dev, "config: 5bits/char\n"); in s3c24xx_serial_set_termios()
1454 dev_dbg(port->dev, "config: 6bits/char\n"); in s3c24xx_serial_set_termios()
1458 dev_dbg(port->dev, "config: 7bits/char\n"); in s3c24xx_serial_set_termios()
1463 dev_dbg(port->dev, "config: 8bits/char\n"); in s3c24xx_serial_set_termios()
1469 ulcon |= (cfg->ulcon & S3C2410_LCON_IRM); in s3c24xx_serial_set_termios()
1471 if (termios->c_cflag & CSTOPB) in s3c24xx_serial_set_termios()
1474 if (termios->c_cflag & PARENB) { in s3c24xx_serial_set_termios()
1475 if (termios->c_cflag & PARODD) in s3c24xx_serial_set_termios()
1483 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_set_termios()
1485 dev_dbg(port->dev, in s3c24xx_serial_set_termios()
1492 port->status &= ~UPSTAT_AUTOCTS; in s3c24xx_serial_set_termios()
1495 if (termios->c_cflag & CRTSCTS) { in s3c24xx_serial_set_termios()
1499 port->status = UPSTAT_AUTOCTS; in s3c24xx_serial_set_termios()
1505 if (ourport->info->has_divslot) in s3c24xx_serial_set_termios()
1508 dev_dbg(port->dev, in s3c24xx_serial_set_termios()
1509 "uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n", in s3c24xx_serial_set_termios()
1515 * Update the per-port timeout. in s3c24xx_serial_set_termios()
1517 uart_update_timeout(port, termios->c_cflag, baud); in s3c24xx_serial_set_termios()
1522 port->read_status_mask = S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1523 if (termios->c_iflag & INPCK) in s3c24xx_serial_set_termios()
1524 port->read_status_mask |= S3C2410_UERSTAT_FRAME | in s3c24xx_serial_set_termios()
1529 port->ignore_status_mask = 0; in s3c24xx_serial_set_termios()
1530 if (termios->c_iflag & IGNPAR) in s3c24xx_serial_set_termios()
1531 port->ignore_status_mask |= S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1532 if (termios->c_iflag & IGNBRK && termios->c_iflag & IGNPAR) in s3c24xx_serial_set_termios()
1533 port->ignore_status_mask |= S3C2410_UERSTAT_FRAME; in s3c24xx_serial_set_termios()
1538 if ((termios->c_cflag & CREAD) == 0) in s3c24xx_serial_set_termios()
1539 port->ignore_status_mask |= RXSTAT_DUMMY_READ; in s3c24xx_serial_set_termios()
1541 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_set_termios()
1546 switch (port->type) { in s3c24xx_serial_type()
1554 return "S3C6400/10"; in s3c24xx_serial_type()
1564 release_mem_region(port->mapbase, MAP_SIZE); in s3c24xx_serial_release_port()
1571 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY; in s3c24xx_serial_request_port()
1580 port->type = info->type; in s3c24xx_serial_config_port()
1591 if (ser->type != PORT_UNKNOWN && ser->type != info->type) in s3c24xx_serial_verify_port()
1592 return -EINVAL; in s3c24xx_serial_verify_port()
1719 ucon_mask = info->clksel_mask; in s3c24xx_serial_resetport()
1720 if (info->type == PORT_S3C2440) in s3c24xx_serial_resetport()
1724 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); in s3c24xx_serial_resetport()
1727 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); in s3c24xx_serial_resetport()
1728 wr_regl(port, S3C2410_UFCON, cfg->ufcon); in s3c24xx_serial_resetport()
1743 uport = &port->port; in s3c24xx_serial_cpufreq_transition()
1747 if (port->pm_level != 0) in s3c24xx_serial_cpufreq_transition()
1752 * a disturbance in the clock-rate over the change. in s3c24xx_serial_cpufreq_transition()
1755 if (IS_ERR(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1758 if (port->baudclk_rate == clk_get_rate(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1770 if (uport->state == NULL) in s3c24xx_serial_cpufreq_transition()
1773 tty = uport->state->port.tty; in s3c24xx_serial_cpufreq_transition()
1778 termios = &tty->termios; in s3c24xx_serial_cpufreq_transition()
1781 dev_warn(uport->dev, "%s: no termios?\n", __func__); in s3c24xx_serial_cpufreq_transition()
1795 port->freq_transition.notifier_call = s3c24xx_serial_cpufreq_transition; in s3c24xx_serial_cpufreq_register()
1797 return cpufreq_register_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_register()
1804 cpufreq_unregister_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_deregister()
1823 struct device *dev = ourport->port.dev; in s3c24xx_serial_enable_baudclk()
1824 struct s3c24xx_uart_info *info = ourport->info; in s3c24xx_serial_enable_baudclk()
1831 clk_sel = ourport->cfg->clk_sel ? : info->def_clk_sel; in s3c24xx_serial_enable_baudclk()
1832 for (clk_num = 0; clk_num < info->num_clks; clk_num++) { in s3c24xx_serial_enable_baudclk()
1847 ourport->baudclk = clk; in s3c24xx_serial_enable_baudclk()
1848 ourport->baudclk_rate = clk_get_rate(clk); in s3c24xx_serial_enable_baudclk()
1849 s3c24xx_serial_setsource(&ourport->port, clk_num); in s3c24xx_serial_enable_baudclk()
1854 return -EINVAL; in s3c24xx_serial_enable_baudclk()
1865 struct uart_port *port = &ourport->port; in s3c24xx_serial_init_port()
1866 struct s3c2410_uartcfg *cfg = ourport->cfg; in s3c24xx_serial_init_port()
1871 return -ENODEV; in s3c24xx_serial_init_port()
1873 if (port->mapbase != 0) in s3c24xx_serial_init_port()
1874 return -EINVAL; in s3c24xx_serial_init_port()
1877 port->dev = &platdev->dev; in s3c24xx_serial_init_port()
1883 port->uartclk = 1; in s3c24xx_serial_init_port()
1885 if (cfg->uart_flags & UPF_CONS_FLOW) { in s3c24xx_serial_init_port()
1886 dev_dbg(port->dev, "enabling flow control\n"); in s3c24xx_serial_init_port()
1887 port->flags |= UPF_CONS_FLOW; in s3c24xx_serial_init_port()
1890 /* sort our the physical and virtual addresses for each UART */ in s3c24xx_serial_init_port()
1894 dev_err(port->dev, "failed to find memory resource for uart\n"); in s3c24xx_serial_init_port()
1895 return -EINVAL; in s3c24xx_serial_init_port()
1898 dev_dbg(port->dev, "resource %pR)\n", res); in s3c24xx_serial_init_port()
1900 port->membase = devm_ioremap(port->dev, res->start, resource_size(res)); in s3c24xx_serial_init_port()
1901 if (!port->membase) { in s3c24xx_serial_init_port()
1902 dev_err(port->dev, "failed to remap controller address\n"); in s3c24xx_serial_init_port()
1903 return -EBUSY; in s3c24xx_serial_init_port()
1906 port->mapbase = res->start; in s3c24xx_serial_init_port()
1909 port->irq = 0; in s3c24xx_serial_init_port()
1911 port->irq = ret; in s3c24xx_serial_init_port()
1912 ourport->rx_irq = ret; in s3c24xx_serial_init_port()
1913 ourport->tx_irq = ret + 1; in s3c24xx_serial_init_port()
1919 ourport->tx_irq = ret; in s3c24xx_serial_init_port()
1925 if (platdev->dev.of_node && of_find_property(platdev->dev.of_node, in s3c24xx_serial_init_port()
1927 ourport->dma = devm_kzalloc(port->dev, in s3c24xx_serial_init_port()
1928 sizeof(*ourport->dma), in s3c24xx_serial_init_port()
1930 if (!ourport->dma) { in s3c24xx_serial_init_port()
1931 ret = -ENOMEM; in s3c24xx_serial_init_port()
1936 ourport->clk = clk_get(&platdev->dev, "uart"); in s3c24xx_serial_init_port()
1937 if (IS_ERR(ourport->clk)) { in s3c24xx_serial_init_port()
1939 dev_name(&platdev->dev)); in s3c24xx_serial_init_port()
1940 ret = PTR_ERR(ourport->clk); in s3c24xx_serial_init_port()
1944 ret = clk_prepare_enable(ourport->clk); in s3c24xx_serial_init_port()
1946 pr_err("uart: clock failed to prepare+enable: %d\n", ret); in s3c24xx_serial_init_port()
1947 clk_put(ourport->clk); in s3c24xx_serial_init_port()
1953 pr_warn("uart: failed to enable baudclk\n"); in s3c24xx_serial_init_port()
1962 dev_dbg(port->dev, "port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n", in s3c24xx_serial_init_port()
1963 &port->mapbase, port->membase, port->irq, in s3c24xx_serial_init_port()
1964 ourport->rx_irq, ourport->tx_irq, port->uartclk); in s3c24xx_serial_init_port()
1966 /* reset the fifos (and setup the uart) */ in s3c24xx_serial_init_port()
1972 port->mapbase = 0; in s3c24xx_serial_init_port()
1988 if (pdev->dev.of_node) { in s3c24xx_get_driver_data()
1991 match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node); in s3c24xx_get_driver_data()
1992 return (struct s3c24xx_serial_drv_data *)match->data; in s3c24xx_get_driver_data()
1996 platform_get_device_id(pdev)->driver_data; in s3c24xx_get_driver_data()
2001 struct device_node *np = pdev->dev.of_node; in s3c24xx_serial_probe()
2013 dev_err(&pdev->dev, "serial%d out of range\n", index); in s3c24xx_serial_probe()
2014 return -EINVAL; in s3c24xx_serial_probe()
2018 ourport->drv_data = s3c24xx_get_driver_data(pdev); in s3c24xx_serial_probe()
2019 if (!ourport->drv_data) { in s3c24xx_serial_probe()
2020 dev_err(&pdev->dev, "could not find driver data\n"); in s3c24xx_serial_probe()
2021 return -ENODEV; in s3c24xx_serial_probe()
2024 ourport->baudclk = ERR_PTR(-EINVAL); in s3c24xx_serial_probe()
2025 ourport->info = ourport->drv_data->info; in s3c24xx_serial_probe()
2026 ourport->cfg = (dev_get_platdata(&pdev->dev)) ? in s3c24xx_serial_probe()
2027 dev_get_platdata(&pdev->dev) : in s3c24xx_serial_probe()
2028 ourport->drv_data->def_cfg; in s3c24xx_serial_probe()
2032 "samsung,uart-fifosize", &ourport->port.fifosize); in s3c24xx_serial_probe()
2034 if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { in s3c24xx_serial_probe()
2037 ourport->port.iotype = UPIO_MEM; in s3c24xx_serial_probe()
2040 ourport->port.iotype = UPIO_MEM32; in s3c24xx_serial_probe()
2043 dev_warn(&pdev->dev, "unsupported reg-io-width (%d)\n", in s3c24xx_serial_probe()
2045 ret = -EINVAL; in s3c24xx_serial_probe()
2051 if (ourport->drv_data->fifosize[index]) in s3c24xx_serial_probe()
2052 ourport->port.fifosize = ourport->drv_data->fifosize[index]; in s3c24xx_serial_probe()
2053 else if (ourport->info->fifosize) in s3c24xx_serial_probe()
2054 ourport->port.fifosize = ourport->info->fifosize; in s3c24xx_serial_probe()
2055 ourport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SAMSUNG_CONSOLE); in s3c24xx_serial_probe()
2061 ourport->min_dma_size = max_t(int, ourport->port.fifosize, in s3c24xx_serial_probe()
2064 dev_dbg(&pdev->dev, "%s: initialising port %p...\n", __func__, ourport); in s3c24xx_serial_probe()
2073 pr_err("Failed to register Samsung UART driver\n"); in s3c24xx_serial_probe()
2078 dev_dbg(&pdev->dev, "%s: adding port\n", __func__); in s3c24xx_serial_probe()
2079 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); in s3c24xx_serial_probe()
2080 platform_set_drvdata(pdev, &ourport->port); in s3c24xx_serial_probe()
2084 * so that a potential re-enablement through the pm-callback overlaps in s3c24xx_serial_probe()
2087 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_probe()
2088 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_probe()
2089 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_probe()
2093 dev_err(&pdev->dev, "failed to add cpufreq notifier\n"); in s3c24xx_serial_probe()
2102 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); in s3c24xx_serial_remove()
2114 /* UART power management code */
2132 clk_prepare_enable(ourport->clk); in s3c24xx_serial_resume()
2133 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume()
2134 clk_prepare_enable(ourport->baudclk); in s3c24xx_serial_resume()
2136 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume()
2137 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_resume()
2138 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_resume()
2156 if (ourport->tx_enabled) in s3c24xx_serial_resume_noirq()
2158 if (ourport->rx_enabled) in s3c24xx_serial_resume_noirq()
2160 clk_prepare_enable(ourport->clk); in s3c24xx_serial_resume_noirq()
2161 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume_noirq()
2162 clk_prepare_enable(ourport->baudclk); in s3c24xx_serial_resume_noirq()
2164 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume_noirq()
2165 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_resume_noirq()
2166 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_resume_noirq()
2198 /* fifo mode - check amount of data in fifo registers... */ in s3c24xx_serial_console_txrdy()
2201 return (ufstat & info->tx_fifofull) ? 0 : 1; in s3c24xx_serial_console_txrdy()
2204 /* in non-fifo mode, we go and use the tx buffer empty */ in s3c24xx_serial_console_txrdy()
2219 * Console polling routines for writing and reading from the uart while
2327 clk = clk_get(port->dev, clk_name); in s3c24xx_serial_get_options()
2334 dev_dbg(port->dev, "calculated baud %d\n", *baud); in s3c24xx_serial_get_options()
2349 if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS) in s3c24xx_serial_console_setup()
2350 co->index = 0; in s3c24xx_serial_console_setup()
2352 port = &s3c24xx_serial_ports[co->index].port; in s3c24xx_serial_console_setup()
2356 if (port->mapbase == 0x0) in s3c24xx_serial_console_setup()
2357 return -ENODEV; in s3c24xx_serial_console_setup()
2362 * Check whether an invalid uart number has been specified, and in s3c24xx_serial_console_setup()
2371 dev_dbg(port->dev, "baud %d\n", baud); in s3c24xx_serial_console_setup()
2380 .index = -1,
2390 .name = "Samsung S3C2410 UART",
2417 .name = "Samsung S3C2412 UART",
2446 .name = "Samsung S3C2440 UART",
2474 .name = "Samsung S3C6400 UART",
2502 .name = "Samsung S5PV210 UART",
2530 .name = "Samsung Exynos UART", \
2569 .name = "s3c2410-uart",
2572 .name = "s3c2412-uart",
2575 .name = "s3c2440-uart",
2578 .name = "s3c6400-uart",
2581 .name = "s5pv210-uart",
2584 .name = "exynos4210-uart",
2587 .name = "exynos5433-uart",
2596 { .compatible = "samsung,s3c2410-uart",
2598 { .compatible = "samsung,s3c2412-uart",
2600 { .compatible = "samsung,s3c2440-uart",
2602 { .compatible = "samsung,s3c6400-uart",
2604 { .compatible = "samsung,s5pv210-uart",
2606 { .compatible = "samsung,exynos4210-uart",
2608 { .compatible = "samsung,exynos5433-uart",
2620 .name = "samsung-uart",
2635 switch (port->iotype) { in wr_reg_barrier()
2651 while (!(readl(port->membase + S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXFE)) in samsung_early_busyuart()
2657 struct samsung_early_console_data *data = port->private_data; in samsung_early_busyuart_fifo()
2659 while (readl(port->membase + S3C2410_UFSTAT) & data->txfull_mask) in samsung_early_busyuart_fifo()
2665 if (readl(port->membase + S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) in samsung_early_putc()
2676 struct earlycon_device *dev = con->data; in samsung_early_write()
2678 uart_console_write(&dev->port, s, n, samsung_early_putc); in samsung_early_write()
2684 if (!device->port.membase) in samsung_early_console_setup()
2685 return -ENODEV; in samsung_early_console_setup()
2687 device->con->write = samsung_early_write; in samsung_early_console_setup()
2699 device->port.private_data = &s3c2410_early_console_data; in s3c2410_early_console_setup()
2703 OF_EARLYCON_DECLARE(s3c2410, "samsung,s3c2410-uart",
2714 device->port.private_data = &s3c2440_early_console_data; in s3c2440_early_console_setup()
2718 OF_EARLYCON_DECLARE(s3c2412, "samsung,s3c2412-uart",
2720 OF_EARLYCON_DECLARE(s3c2440, "samsung,s3c2440-uart",
2722 OF_EARLYCON_DECLARE(s3c6400, "samsung,s3c6400-uart",
2733 device->port.private_data = &s5pv210_early_console_data; in s5pv210_early_console_setup()
2737 OF_EARLYCON_DECLARE(s5pv210, "samsung,s5pv210-uart",
2739 OF_EARLYCON_DECLARE(exynos4210, "samsung,exynos4210-uart",
2743 MODULE_ALIAS("platform:samsung-uart");