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()
369 ourport->tx_mode = S3C24XX_TX_DMA; in enable_tx_dma()
374 struct uart_port *port = &ourport->port; in enable_tx_pio()
378 ourport->tx_in_progress = S3C24XX_TX_PIO; in enable_tx_pio()
393 enable_irq(ourport->tx_irq); in enable_tx_pio()
395 ourport->tx_mode = S3C24XX_TX_PIO; in enable_tx_pio()
400 if (ourport->tx_mode != S3C24XX_TX_PIO) in s3c24xx_serial_start_tx_pio()
407 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_tx_dma()
408 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx_dma()
409 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_start_tx_dma()
411 if (ourport->tx_mode != S3C24XX_TX_DMA) in s3c24xx_serial_start_tx_dma()
414 dma->tx_size = count & ~(dma_get_cache_alignment() - 1); in s3c24xx_serial_start_tx_dma()
415 dma->tx_transfer_addr = dma->tx_addr + xmit->tail; in s3c24xx_serial_start_tx_dma()
417 dma_sync_single_for_device(ourport->port.dev, dma->tx_transfer_addr, in s3c24xx_serial_start_tx_dma()
418 dma->tx_size, DMA_TO_DEVICE); in s3c24xx_serial_start_tx_dma()
420 dma->tx_desc = dmaengine_prep_slave_single(dma->tx_chan, in s3c24xx_serial_start_tx_dma()
421 dma->tx_transfer_addr, dma->tx_size, in s3c24xx_serial_start_tx_dma()
423 if (!dma->tx_desc) { in s3c24xx_serial_start_tx_dma()
424 dev_err(ourport->port.dev, "Unable to get desc for Tx\n"); in s3c24xx_serial_start_tx_dma()
425 return -EIO; in s3c24xx_serial_start_tx_dma()
428 dma->tx_desc->callback = s3c24xx_serial_tx_dma_complete; in s3c24xx_serial_start_tx_dma()
429 dma->tx_desc->callback_param = ourport; in s3c24xx_serial_start_tx_dma()
430 dma->tx_bytes_requested = dma->tx_size; in s3c24xx_serial_start_tx_dma()
432 ourport->tx_in_progress = S3C24XX_TX_DMA; in s3c24xx_serial_start_tx_dma()
433 dma->tx_cookie = dmaengine_submit(dma->tx_desc); in s3c24xx_serial_start_tx_dma()
434 dma_async_issue_pending(dma->tx_chan); in s3c24xx_serial_start_tx_dma()
440 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_next_tx()
441 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_next_tx()
445 count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); in s3c24xx_serial_start_next_tx()
452 if (!ourport->dma || !ourport->dma->tx_chan || in s3c24xx_serial_start_next_tx()
453 count < ourport->min_dma_size || in s3c24xx_serial_start_next_tx()
454 xmit->tail & (dma_get_cache_alignment() - 1)) in s3c24xx_serial_start_next_tx()
463 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx()
465 if (!ourport->tx_enabled) { in s3c24xx_serial_start_tx()
466 if (port->flags & UPF_CONS_FLOW) in s3c24xx_serial_start_tx()
469 ourport->tx_enabled = 1; in s3c24xx_serial_start_tx()
470 if (!ourport->dma || !ourport->dma->tx_chan) in s3c24xx_serial_start_tx()
474 if (ourport->dma && ourport->dma->tx_chan) { in s3c24xx_serial_start_tx()
475 if (!uart_circ_empty(xmit) && !ourport->tx_in_progress) in s3c24xx_serial_start_tx()
483 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_uart_copy_rx_to_tty()
489 dma_sync_single_for_cpu(ourport->port.dev, dma->rx_addr, in s3c24xx_uart_copy_rx_to_tty()
490 dma->rx_size, DMA_FROM_DEVICE); in s3c24xx_uart_copy_rx_to_tty()
492 ourport->port.icount.rx += count; in s3c24xx_uart_copy_rx_to_tty()
494 dev_err(ourport->port.dev, "No tty port\n"); in s3c24xx_uart_copy_rx_to_tty()
498 ((unsigned char *)(ourport->dma->rx_buf)), count); in s3c24xx_uart_copy_rx_to_tty()
501 dev_err(ourport->port.dev, "RxData copy to tty layer failed\n"); in s3c24xx_uart_copy_rx_to_tty()
508 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_stop_rx()
509 struct tty_port *t = &port->state->port; in s3c24xx_serial_stop_rx()
514 if (ourport->rx_enabled) { in s3c24xx_serial_stop_rx()
515 dev_dbg(port->dev, "stopping rx\n"); in s3c24xx_serial_stop_rx()
520 disable_irq_nosync(ourport->rx_irq); in s3c24xx_serial_stop_rx()
521 ourport->rx_enabled = 0; in s3c24xx_serial_stop_rx()
523 if (dma && dma->rx_chan) { in s3c24xx_serial_stop_rx()
524 dmaengine_pause(dma->tx_chan); in s3c24xx_serial_stop_rx()
525 dma_status = dmaengine_tx_status(dma->rx_chan, in s3c24xx_serial_stop_rx()
526 dma->rx_cookie, &state); in s3c24xx_serial_stop_rx()
529 received = dma->rx_bytes_requested - state.residue; in s3c24xx_serial_stop_rx()
530 dmaengine_terminate_all(dma->rx_chan); in s3c24xx_serial_stop_rx()
539 return to_ourport(port)->info; in s3c24xx_port_to_info()
547 if (port->dev == NULL) in s3c24xx_port_to_cfg()
551 return ourport->cfg; in s3c24xx_port_to_cfg()
557 struct s3c24xx_uart_info *info = ourport->info; in s3c24xx_serial_rx_fifocnt()
559 if (ufstat & info->rx_fifofull) in s3c24xx_serial_rx_fifocnt()
560 return ourport->port.fifosize; in s3c24xx_serial_rx_fifocnt()
562 return (ufstat & info->rx_fifomask) >> info->rx_fifoshift; in s3c24xx_serial_rx_fifocnt()
569 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_dma_complete()
571 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_rx_dma_complete()
572 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_dma_complete()
573 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_dma_complete()
579 dmaengine_tx_status(dma->rx_chan, dma->rx_cookie, &state); in s3c24xx_serial_rx_dma_complete()
580 received = dma->rx_bytes_requested - state.residue; in s3c24xx_serial_rx_dma_complete()
581 async_tx_ack(dma->rx_desc); in s3c24xx_serial_rx_dma_complete()
583 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
595 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
600 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c64xx_start_rx_dma()
602 dma_sync_single_for_device(ourport->port.dev, dma->rx_addr, in s3c64xx_start_rx_dma()
603 dma->rx_size, DMA_FROM_DEVICE); in s3c64xx_start_rx_dma()
605 dma->rx_desc = dmaengine_prep_slave_single(dma->rx_chan, in s3c64xx_start_rx_dma()
606 dma->rx_addr, dma->rx_size, DMA_DEV_TO_MEM, in s3c64xx_start_rx_dma()
608 if (!dma->rx_desc) { in s3c64xx_start_rx_dma()
609 dev_err(ourport->port.dev, "Unable to get desc for Rx\n"); in s3c64xx_start_rx_dma()
613 dma->rx_desc->callback = s3c24xx_serial_rx_dma_complete; in s3c64xx_start_rx_dma()
614 dma->rx_desc->callback_param = ourport; in s3c64xx_start_rx_dma()
615 dma->rx_bytes_requested = dma->rx_size; in s3c64xx_start_rx_dma()
617 dma->rx_cookie = dmaengine_submit(dma->rx_desc); in s3c64xx_start_rx_dma()
618 dma_async_issue_pending(dma->rx_chan); in s3c64xx_start_rx_dma()
621 /* ? - where has parity gone?? */
626 struct uart_port *port = &ourport->port; in enable_rx_dma()
644 ourport->rx_mode = S3C24XX_RX_DMA; in enable_rx_dma()
649 struct uart_port *port = &ourport->port; in enable_rx_pio()
664 ourport->rx_mode = S3C24XX_RX_PIO; in enable_rx_pio()
673 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_dma()
674 struct s3c24xx_uart_dma *dma = ourport->dma; in s3c24xx_serial_rx_chars_dma()
675 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_chars_dma()
676 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_chars_dma()
683 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
687 if (ourport->rx_mode == S3C24XX_RX_PIO) in s3c24xx_serial_rx_chars_dma()
692 if (ourport->rx_mode == S3C24XX_RX_DMA) { in s3c24xx_serial_rx_chars_dma()
693 dmaengine_pause(dma->rx_chan); in s3c24xx_serial_rx_chars_dma()
694 dmaengine_tx_status(dma->rx_chan, dma->rx_cookie, &state); in s3c24xx_serial_rx_chars_dma()
695 dmaengine_terminate_all(dma->rx_chan); in s3c24xx_serial_rx_chars_dma()
696 received = dma->rx_bytes_requested - state.residue; in s3c24xx_serial_rx_chars_dma()
712 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
719 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_drain_fifo()
722 int max_count = port->fifosize; in s3c24xx_serial_rx_drain_fifo()
724 while (max_count-- > 0) { in s3c24xx_serial_rx_drain_fifo()
735 fifocnt--; in s3c24xx_serial_rx_drain_fifo()
740 if (port->flags & UPF_CONS_FLOW) { in s3c24xx_serial_rx_drain_fifo()
743 if (ourport->rx_enabled) { in s3c24xx_serial_rx_drain_fifo()
745 ourport->rx_enabled = 0; in s3c24xx_serial_rx_drain_fifo()
753 ourport->rx_enabled = 1; in s3c24xx_serial_rx_drain_fifo()
763 port->icount.rx++; in s3c24xx_serial_rx_drain_fifo()
766 dev_dbg(port->dev, in s3c24xx_serial_rx_drain_fifo()
772 dev_dbg(port->dev, "break!\n"); in s3c24xx_serial_rx_drain_fifo()
773 port->icount.brk++; in s3c24xx_serial_rx_drain_fifo()
779 port->icount.frame++; in s3c24xx_serial_rx_drain_fifo()
781 port->icount.overrun++; in s3c24xx_serial_rx_drain_fifo()
783 uerstat &= port->read_status_mask; in s3c24xx_serial_rx_drain_fifo()
801 tty_flip_buffer_push(&port->state->port); in s3c24xx_serial_rx_drain_fifo()
807 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_pio()
810 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
812 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
821 if (ourport->dma && ourport->dma->rx_chan) in s3c24xx_serial_rx_chars()
829 struct uart_port *port = &ourport->port; in s3c24xx_serial_tx_chars()
830 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_tx_chars()
834 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_tx_chars()
836 count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); in s3c24xx_serial_tx_chars()
838 if (ourport->dma && ourport->dma->tx_chan && in s3c24xx_serial_tx_chars()
839 count >= ourport->min_dma_size) { in s3c24xx_serial_tx_chars()
840 int align = dma_get_cache_alignment() - in s3c24xx_serial_tx_chars()
841 (xmit->tail & (dma_get_cache_alignment() - 1)); in s3c24xx_serial_tx_chars()
842 if (count - align >= ourport->min_dma_size) { in s3c24xx_serial_tx_chars()
843 dma_count = count - align; in s3c24xx_serial_tx_chars()
848 if (port->x_char) { in s3c24xx_serial_tx_chars()
849 wr_reg(port, S3C2410_UTXH, port->x_char); in s3c24xx_serial_tx_chars()
850 port->icount.tx++; in s3c24xx_serial_tx_chars()
851 port->x_char = 0; in s3c24xx_serial_tx_chars()
855 /* if there isn't anything more to transmit, or the uart is now in s3c24xx_serial_tx_chars()
856 * stopped, disable the uart and exit in s3c24xx_serial_tx_chars()
866 if (count > port->fifosize) { in s3c24xx_serial_tx_chars()
867 count = port->fifosize; in s3c24xx_serial_tx_chars()
872 if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull) in s3c24xx_serial_tx_chars()
875 wr_reg(port, S3C2410_UTXH, xmit->buf[xmit->tail]); in s3c24xx_serial_tx_chars()
876 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); in s3c24xx_serial_tx_chars()
877 port->icount.tx++; in s3c24xx_serial_tx_chars()
878 count--; in s3c24xx_serial_tx_chars()
887 spin_unlock(&port->lock); in s3c24xx_serial_tx_chars()
889 spin_lock(&port->lock); in s3c24xx_serial_tx_chars()
896 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_tx_chars()
904 struct uart_port *port = &ourport->port; in s3c64xx_serial_handle_irq()
926 if ((ufstat & info->tx_fifomask) != 0 || in s3c24xx_serial_tx_empty()
927 (ufstat & info->tx_fifofull)) in s3c24xx_serial_tx_empty()
964 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_break_ctl()
975 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_break_ctl()
980 struct s3c24xx_uart_dma *dma = p->dma; in s3c24xx_serial_request_dma()
986 dma->rx_conf.direction = DMA_DEV_TO_MEM; in s3c24xx_serial_request_dma()
987 dma->rx_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; in s3c24xx_serial_request_dma()
988 dma->rx_conf.src_addr = p->port.mapbase + S3C2410_URXH; in s3c24xx_serial_request_dma()
989 dma->rx_conf.src_maxburst = 1; in s3c24xx_serial_request_dma()
991 dma->tx_conf.direction = DMA_MEM_TO_DEV; in s3c24xx_serial_request_dma()
992 dma->tx_conf.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; in s3c24xx_serial_request_dma()
993 dma->tx_conf.dst_addr = p->port.mapbase + S3C2410_UTXH; in s3c24xx_serial_request_dma()
994 dma->tx_conf.dst_maxburst = 1; in s3c24xx_serial_request_dma()
996 dma->rx_chan = dma_request_chan(p->port.dev, "rx"); in s3c24xx_serial_request_dma()
998 if (IS_ERR(dma->rx_chan)) { in s3c24xx_serial_request_dma()
1000 ret = PTR_ERR(dma->rx_chan); in s3c24xx_serial_request_dma()
1004 ret = dma_get_slave_caps(dma->rx_chan, &dma_caps); in s3c24xx_serial_request_dma()
1008 ret = -EOPNOTSUPP; in s3c24xx_serial_request_dma()
1012 dmaengine_slave_config(dma->rx_chan, &dma->rx_conf); in s3c24xx_serial_request_dma()
1014 dma->tx_chan = dma_request_chan(p->port.dev, "tx"); in s3c24xx_serial_request_dma()
1015 if (IS_ERR(dma->tx_chan)) { in s3c24xx_serial_request_dma()
1017 ret = PTR_ERR(dma->tx_chan); in s3c24xx_serial_request_dma()
1021 ret = dma_get_slave_caps(dma->tx_chan, &dma_caps); in s3c24xx_serial_request_dma()
1025 ret = -EOPNOTSUPP; in s3c24xx_serial_request_dma()
1029 dmaengine_slave_config(dma->tx_chan, &dma->tx_conf); in s3c24xx_serial_request_dma()
1032 dma->rx_size = PAGE_SIZE; in s3c24xx_serial_request_dma()
1034 dma->rx_buf = kmalloc(dma->rx_size, GFP_KERNEL); in s3c24xx_serial_request_dma()
1035 if (!dma->rx_buf) { in s3c24xx_serial_request_dma()
1036 ret = -ENOMEM; in s3c24xx_serial_request_dma()
1040 dma->rx_addr = dma_map_single(p->port.dev, dma->rx_buf, in s3c24xx_serial_request_dma()
1041 dma->rx_size, DMA_FROM_DEVICE); in s3c24xx_serial_request_dma()
1042 if (dma_mapping_error(p->port.dev, dma->rx_addr)) { in s3c24xx_serial_request_dma()
1044 ret = -EIO; in s3c24xx_serial_request_dma()
1049 dma->tx_addr = dma_map_single(p->port.dev, p->port.state->xmit.buf, in s3c24xx_serial_request_dma()
1051 if (dma_mapping_error(p->port.dev, dma->tx_addr)) { in s3c24xx_serial_request_dma()
1053 ret = -EIO; in s3c24xx_serial_request_dma()
1060 dma_unmap_single(p->port.dev, dma->rx_addr, dma->rx_size, in s3c24xx_serial_request_dma()
1063 kfree(dma->rx_buf); in s3c24xx_serial_request_dma()
1065 dma_release_channel(dma->tx_chan); in s3c24xx_serial_request_dma()
1067 dma_release_channel(dma->rx_chan); in s3c24xx_serial_request_dma()
1070 dev_warn(p->port.dev, "%s, DMA will not be used\n", reason); in s3c24xx_serial_request_dma()
1076 struct s3c24xx_uart_dma *dma = p->dma; in s3c24xx_serial_release_dma()
1078 if (dma->rx_chan) { in s3c24xx_serial_release_dma()
1079 dmaengine_terminate_all(dma->rx_chan); in s3c24xx_serial_release_dma()
1080 dma_unmap_single(p->port.dev, dma->rx_addr, in s3c24xx_serial_release_dma()
1081 dma->rx_size, DMA_FROM_DEVICE); in s3c24xx_serial_release_dma()
1082 kfree(dma->rx_buf); in s3c24xx_serial_release_dma()
1083 dma_release_channel(dma->rx_chan); in s3c24xx_serial_release_dma()
1084 dma->rx_chan = NULL; in s3c24xx_serial_release_dma()
1087 if (dma->tx_chan) { in s3c24xx_serial_release_dma()
1088 dmaengine_terminate_all(dma->tx_chan); in s3c24xx_serial_release_dma()
1089 dma_unmap_single(p->port.dev, dma->tx_addr, in s3c24xx_serial_release_dma()
1091 dma_release_channel(dma->tx_chan); in s3c24xx_serial_release_dma()
1092 dma->tx_chan = NULL; in s3c24xx_serial_release_dma()
1100 if (ourport->tx_claimed) { in s3c24xx_serial_shutdown()
1102 free_irq(ourport->tx_irq, ourport); in s3c24xx_serial_shutdown()
1103 ourport->tx_enabled = 0; in s3c24xx_serial_shutdown()
1104 ourport->tx_claimed = 0; in s3c24xx_serial_shutdown()
1105 ourport->tx_mode = 0; in s3c24xx_serial_shutdown()
1108 if (ourport->rx_claimed) { in s3c24xx_serial_shutdown()
1110 free_irq(ourport->rx_irq, ourport); in s3c24xx_serial_shutdown()
1111 ourport->rx_claimed = 0; in s3c24xx_serial_shutdown()
1112 ourport->rx_enabled = 0; in s3c24xx_serial_shutdown()
1117 free_irq(port->irq, ourport); in s3c24xx_serial_shutdown()
1123 if (ourport->dma) in s3c24xx_serial_shutdown()
1126 ourport->tx_in_progress = 0; in s3c24xx_serial_shutdown()
1134 ourport->rx_enabled = 1; in s3c24xx_serial_startup()
1136 ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_chars, 0, in s3c24xx_serial_startup()
1140 dev_err(port->dev, "cannot get irq %d\n", ourport->rx_irq); in s3c24xx_serial_startup()
1144 ourport->rx_claimed = 1; in s3c24xx_serial_startup()
1146 dev_dbg(port->dev, "requesting tx irq...\n"); in s3c24xx_serial_startup()
1148 ourport->tx_enabled = 1; in s3c24xx_serial_startup()
1150 ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_chars, 0, in s3c24xx_serial_startup()
1154 dev_err(port->dev, "cannot get irq %d\n", ourport->tx_irq); in s3c24xx_serial_startup()
1158 ourport->tx_claimed = 1; in s3c24xx_serial_startup()
1179 if (ourport->dma) { in s3c64xx_serial_startup()
1182 devm_kfree(port->dev, ourport->dma); in s3c64xx_serial_startup()
1183 ourport->dma = NULL; in s3c64xx_serial_startup()
1187 ret = request_irq(port->irq, s3c64xx_serial_handle_irq, IRQF_SHARED, in s3c64xx_serial_startup()
1190 dev_err(port->dev, "cannot get irq %d\n", port->irq); in s3c64xx_serial_startup()
1195 ourport->rx_enabled = 1; in s3c64xx_serial_startup()
1196 ourport->rx_claimed = 1; in s3c64xx_serial_startup()
1197 ourport->tx_enabled = 0; in s3c64xx_serial_startup()
1198 ourport->tx_claimed = 1; in s3c64xx_serial_startup()
1200 spin_lock_irqsave(&port->lock, flags); in s3c64xx_serial_startup()
1210 spin_unlock_irqrestore(&port->lock, flags); in s3c64xx_serial_startup()
1226 ourport->pm_level = level; in s3c24xx_serial_pm()
1230 while (--timeout && !s3c24xx_serial_txempty_nofifo(port)) in s3c24xx_serial_pm()
1233 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_pm()
1234 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_pm()
1236 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_pm()
1240 clk_prepare_enable(ourport->clk); in s3c24xx_serial_pm()
1242 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_pm()
1243 clk_prepare_enable(ourport->baudclk); in s3c24xx_serial_pm()
1247 dev_err(port->dev, "s3c24xx_serial: unknown pm %d\n", level); in s3c24xx_serial_pm()
1271 if (info->num_clks == 1) in s3c24xx_serial_getsource()
1275 ucon &= info->clksel_mask; in s3c24xx_serial_getsource()
1276 return ucon >> info->clksel_shift; in s3c24xx_serial_getsource()
1285 if (info->num_clks == 1) in s3c24xx_serial_setsource()
1289 if ((ucon & info->clksel_mask) >> info->clksel_shift == clk_sel) in s3c24xx_serial_setsource()
1292 ucon &= ~info->clksel_mask; in s3c24xx_serial_setsource()
1293 ucon |= clk_sel << info->clksel_shift; in s3c24xx_serial_setsource()
1301 struct s3c24xx_uart_info *info = ourport->info; in s3c24xx_serial_getclk()
1306 int calc_deviation, deviation = (1 << 30) - 1; in s3c24xx_serial_getclk()
1308 for (cnt = 0; cnt < info->num_clks; cnt++) { in s3c24xx_serial_getclk()
1310 if (ourport->cfg->clk_sel && in s3c24xx_serial_getclk()
1311 !(ourport->cfg->clk_sel & (1 << cnt))) in s3c24xx_serial_getclk()
1315 clk = clk_get(ourport->port.dev, clkname); 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()
1387 struct clk *clk = ERR_PTR(-EINVAL); in s3c24xx_serial_set_termios()
1397 termios->c_cflag &= ~(HUPCL | CMSPAR); in s3c24xx_serial_set_termios()
1398 termios->c_cflag |= CLOCAL; in s3c24xx_serial_set_termios()
1406 if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) in s3c24xx_serial_set_termios()
1407 quot = port->custom_divisor; in s3c24xx_serial_set_termios()
1413 if (ourport->baudclk != clk) { in s3c24xx_serial_set_termios()
1418 if (!IS_ERR(ourport->baudclk)) { in s3c24xx_serial_set_termios()
1419 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_set_termios()
1420 ourport->baudclk = ERR_PTR(-EINVAL); in s3c24xx_serial_set_termios()
1423 ourport->baudclk = clk; in s3c24xx_serial_set_termios()
1424 ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0; in s3c24xx_serial_set_termios()
1427 if (ourport->info->has_divslot) { in s3c24xx_serial_set_termios()
1428 unsigned int div = ourport->baudclk_rate / baud; in s3c24xx_serial_set_termios()
1430 if (cfg->has_fracval) { in s3c24xx_serial_set_termios()
1432 dev_dbg(port->dev, "fracval = %04x\n", udivslot); in s3c24xx_serial_set_termios()
1435 dev_dbg(port->dev, "udivslot = %04x (div %d)\n", in s3c24xx_serial_set_termios()
1440 switch (termios->c_cflag & CSIZE) { in s3c24xx_serial_set_termios()
1442 dev_dbg(port->dev, "config: 5bits/char\n"); in s3c24xx_serial_set_termios()
1446 dev_dbg(port->dev, "config: 6bits/char\n"); in s3c24xx_serial_set_termios()
1450 dev_dbg(port->dev, "config: 7bits/char\n"); in s3c24xx_serial_set_termios()
1455 dev_dbg(port->dev, "config: 8bits/char\n"); in s3c24xx_serial_set_termios()
1461 ulcon |= (cfg->ulcon & S3C2410_LCON_IRM); in s3c24xx_serial_set_termios()
1463 if (termios->c_cflag & CSTOPB) in s3c24xx_serial_set_termios()
1466 if (termios->c_cflag & PARENB) { in s3c24xx_serial_set_termios()
1467 if (termios->c_cflag & PARODD) in s3c24xx_serial_set_termios()
1475 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_set_termios()
1477 dev_dbg(port->dev, in s3c24xx_serial_set_termios()
1484 port->status &= ~UPSTAT_AUTOCTS; in s3c24xx_serial_set_termios()
1487 if (termios->c_cflag & CRTSCTS) { in s3c24xx_serial_set_termios()
1491 port->status = UPSTAT_AUTOCTS; in s3c24xx_serial_set_termios()
1497 if (ourport->info->has_divslot) in s3c24xx_serial_set_termios()
1500 dev_dbg(port->dev, in s3c24xx_serial_set_termios()
1501 "uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n", in s3c24xx_serial_set_termios()
1507 * Update the per-port timeout. in s3c24xx_serial_set_termios()
1509 uart_update_timeout(port, termios->c_cflag, baud); in s3c24xx_serial_set_termios()
1514 port->read_status_mask = S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1515 if (termios->c_iflag & INPCK) in s3c24xx_serial_set_termios()
1516 port->read_status_mask |= S3C2410_UERSTAT_FRAME | in s3c24xx_serial_set_termios()
1521 port->ignore_status_mask = 0; in s3c24xx_serial_set_termios()
1522 if (termios->c_iflag & IGNPAR) in s3c24xx_serial_set_termios()
1523 port->ignore_status_mask |= S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1524 if (termios->c_iflag & IGNBRK && termios->c_iflag & IGNPAR) in s3c24xx_serial_set_termios()
1525 port->ignore_status_mask |= S3C2410_UERSTAT_FRAME; in s3c24xx_serial_set_termios()
1530 if ((termios->c_cflag & CREAD) == 0) in s3c24xx_serial_set_termios()
1531 port->ignore_status_mask |= RXSTAT_DUMMY_READ; in s3c24xx_serial_set_termios()
1533 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_set_termios()
1538 switch (port->type) { in s3c24xx_serial_type()
1546 return "S3C6400/10"; in s3c24xx_serial_type()
1556 release_mem_region(port->mapbase, MAP_SIZE); in s3c24xx_serial_release_port()
1563 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY; in s3c24xx_serial_request_port()
1572 port->type = info->type; in s3c24xx_serial_config_port()
1583 if (ser->type != PORT_UNKNOWN && ser->type != info->type) in s3c24xx_serial_verify_port()
1584 return -EINVAL; in s3c24xx_serial_verify_port()
1711 ucon_mask = info->clksel_mask; in s3c24xx_serial_resetport()
1712 if (info->type == PORT_S3C2440) in s3c24xx_serial_resetport()
1716 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); in s3c24xx_serial_resetport()
1719 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); in s3c24xx_serial_resetport()
1720 wr_regl(port, S3C2410_UFCON, cfg->ufcon); in s3c24xx_serial_resetport()
1735 uport = &port->port; in s3c24xx_serial_cpufreq_transition()
1739 if (port->pm_level != 0) in s3c24xx_serial_cpufreq_transition()
1744 * a disturbance in the clock-rate over the change. in s3c24xx_serial_cpufreq_transition()
1747 if (IS_ERR(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1750 if (port->baudclk_rate == clk_get_rate(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1762 if (uport->state == NULL) in s3c24xx_serial_cpufreq_transition()
1765 tty = uport->state->port.tty; in s3c24xx_serial_cpufreq_transition()
1770 termios = &tty->termios; in s3c24xx_serial_cpufreq_transition()
1773 dev_warn(uport->dev, "%s: no termios?\n", __func__); in s3c24xx_serial_cpufreq_transition()
1787 port->freq_transition.notifier_call = s3c24xx_serial_cpufreq_transition; in s3c24xx_serial_cpufreq_register()
1789 return cpufreq_register_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_register()
1796 cpufreq_unregister_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_deregister()
1815 struct device *dev = ourport->port.dev; in s3c24xx_serial_enable_baudclk()
1816 struct s3c24xx_uart_info *info = ourport->info; in s3c24xx_serial_enable_baudclk()
1823 clk_sel = ourport->cfg->clk_sel ? : info->def_clk_sel; in s3c24xx_serial_enable_baudclk()
1824 for (clk_num = 0; clk_num < info->num_clks; clk_num++) { in s3c24xx_serial_enable_baudclk()
1839 ourport->baudclk = clk; in s3c24xx_serial_enable_baudclk()
1840 ourport->baudclk_rate = clk_get_rate(clk); in s3c24xx_serial_enable_baudclk()
1841 s3c24xx_serial_setsource(&ourport->port, clk_num); in s3c24xx_serial_enable_baudclk()
1846 return -EINVAL; in s3c24xx_serial_enable_baudclk()
1857 struct uart_port *port = &ourport->port; in s3c24xx_serial_init_port()
1858 struct s3c2410_uartcfg *cfg = ourport->cfg; in s3c24xx_serial_init_port()
1863 return -ENODEV; in s3c24xx_serial_init_port()
1865 if (port->mapbase != 0) in s3c24xx_serial_init_port()
1866 return -EINVAL; in s3c24xx_serial_init_port()
1869 port->dev = &platdev->dev; in s3c24xx_serial_init_port()
1875 port->uartclk = 1; in s3c24xx_serial_init_port()
1877 if (cfg->uart_flags & UPF_CONS_FLOW) { in s3c24xx_serial_init_port()
1878 dev_dbg(port->dev, "enabling flow control\n"); in s3c24xx_serial_init_port()
1879 port->flags |= UPF_CONS_FLOW; in s3c24xx_serial_init_port()
1882 /* sort our the physical and virtual addresses for each UART */ in s3c24xx_serial_init_port()
1886 dev_err(port->dev, "failed to find memory resource for uart\n"); in s3c24xx_serial_init_port()
1887 return -EINVAL; in s3c24xx_serial_init_port()
1890 dev_dbg(port->dev, "resource %pR)\n", res); in s3c24xx_serial_init_port()
1892 port->membase = devm_ioremap(port->dev, res->start, resource_size(res)); in s3c24xx_serial_init_port()
1893 if (!port->membase) { in s3c24xx_serial_init_port()
1894 dev_err(port->dev, "failed to remap controller address\n"); in s3c24xx_serial_init_port()
1895 return -EBUSY; in s3c24xx_serial_init_port()
1898 port->mapbase = res->start; in s3c24xx_serial_init_port()
1901 port->irq = 0; in s3c24xx_serial_init_port()
1903 port->irq = ret; in s3c24xx_serial_init_port()
1904 ourport->rx_irq = ret; in s3c24xx_serial_init_port()
1905 ourport->tx_irq = ret + 1; in s3c24xx_serial_init_port()
1911 ourport->tx_irq = ret; in s3c24xx_serial_init_port()
1917 if (platdev->dev.of_node && of_find_property(platdev->dev.of_node, in s3c24xx_serial_init_port()
1919 ourport->dma = devm_kzalloc(port->dev, in s3c24xx_serial_init_port()
1920 sizeof(*ourport->dma), in s3c24xx_serial_init_port()
1922 if (!ourport->dma) { in s3c24xx_serial_init_port()
1923 ret = -ENOMEM; in s3c24xx_serial_init_port()
1928 ourport->clk = clk_get(&platdev->dev, "uart"); in s3c24xx_serial_init_port()
1929 if (IS_ERR(ourport->clk)) { in s3c24xx_serial_init_port()
1931 dev_name(&platdev->dev)); in s3c24xx_serial_init_port()
1932 ret = PTR_ERR(ourport->clk); in s3c24xx_serial_init_port()
1936 ret = clk_prepare_enable(ourport->clk); in s3c24xx_serial_init_port()
1938 pr_err("uart: clock failed to prepare+enable: %d\n", ret); in s3c24xx_serial_init_port()
1939 clk_put(ourport->clk); in s3c24xx_serial_init_port()
1945 pr_warn("uart: failed to enable baudclk\n"); in s3c24xx_serial_init_port()
1954 dev_dbg(port->dev, "port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n", in s3c24xx_serial_init_port()
1955 &port->mapbase, port->membase, port->irq, in s3c24xx_serial_init_port()
1956 ourport->rx_irq, ourport->tx_irq, port->uartclk); in s3c24xx_serial_init_port()
1958 /* reset the fifos (and setup the uart) */ in s3c24xx_serial_init_port()
1964 port->mapbase = 0; in s3c24xx_serial_init_port()
1980 if (pdev->dev.of_node) { in s3c24xx_get_driver_data()
1983 match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node); in s3c24xx_get_driver_data()
1984 return (struct s3c24xx_serial_drv_data *)match->data; in s3c24xx_get_driver_data()
1988 platform_get_device_id(pdev)->driver_data; in s3c24xx_get_driver_data()
1993 struct device_node *np = pdev->dev.of_node; in s3c24xx_serial_probe()
2005 dev_err(&pdev->dev, "serial%d out of range\n", index); in s3c24xx_serial_probe()
2006 return -EINVAL; in s3c24xx_serial_probe()
2010 ourport->drv_data = s3c24xx_get_driver_data(pdev); in s3c24xx_serial_probe()
2011 if (!ourport->drv_data) { in s3c24xx_serial_probe()
2012 dev_err(&pdev->dev, "could not find driver data\n"); in s3c24xx_serial_probe()
2013 return -ENODEV; in s3c24xx_serial_probe()
2016 ourport->baudclk = ERR_PTR(-EINVAL); in s3c24xx_serial_probe()
2017 ourport->info = ourport->drv_data->info; in s3c24xx_serial_probe()
2018 ourport->cfg = (dev_get_platdata(&pdev->dev)) ? in s3c24xx_serial_probe()
2019 dev_get_platdata(&pdev->dev) : in s3c24xx_serial_probe()
2020 ourport->drv_data->def_cfg; in s3c24xx_serial_probe()
2024 "samsung,uart-fifosize", &ourport->port.fifosize); in s3c24xx_serial_probe()
2026 if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { in s3c24xx_serial_probe()
2029 ourport->port.iotype = UPIO_MEM; in s3c24xx_serial_probe()
2032 ourport->port.iotype = UPIO_MEM32; in s3c24xx_serial_probe()
2035 dev_warn(&pdev->dev, "unsupported reg-io-width (%d)\n", in s3c24xx_serial_probe()
2037 ret = -EINVAL; in s3c24xx_serial_probe()
2043 if (ourport->drv_data->fifosize[index]) in s3c24xx_serial_probe()
2044 ourport->port.fifosize = ourport->drv_data->fifosize[index]; in s3c24xx_serial_probe()
2045 else if (ourport->info->fifosize) in s3c24xx_serial_probe()
2046 ourport->port.fifosize = ourport->info->fifosize; in s3c24xx_serial_probe()
2047 ourport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SAMSUNG_CONSOLE); in s3c24xx_serial_probe()
2053 ourport->min_dma_size = max_t(int, ourport->port.fifosize, in s3c24xx_serial_probe()
2056 dev_dbg(&pdev->dev, "%s: initialising port %p...\n", __func__, ourport); in s3c24xx_serial_probe()
2065 pr_err("Failed to register Samsung UART driver\n"); in s3c24xx_serial_probe()
2070 dev_dbg(&pdev->dev, "%s: adding port\n", __func__); in s3c24xx_serial_probe()
2071 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); in s3c24xx_serial_probe()
2072 platform_set_drvdata(pdev, &ourport->port); in s3c24xx_serial_probe()
2076 * so that a potential re-enablement through the pm-callback overlaps in s3c24xx_serial_probe()
2079 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_probe()
2080 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_probe()
2081 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_probe()
2085 dev_err(&pdev->dev, "failed to add cpufreq notifier\n"); in s3c24xx_serial_probe()
2094 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); in s3c24xx_serial_remove()
2106 /* UART power management code */
2124 clk_prepare_enable(ourport->clk); in s3c24xx_serial_resume()
2125 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume()
2126 clk_prepare_enable(ourport->baudclk); in s3c24xx_serial_resume()
2128 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume()
2129 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_resume()
2130 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_resume()
2148 if (ourport->tx_enabled) in s3c24xx_serial_resume_noirq()
2150 if (ourport->rx_enabled) in s3c24xx_serial_resume_noirq()
2152 clk_prepare_enable(ourport->clk); in s3c24xx_serial_resume_noirq()
2153 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume_noirq()
2154 clk_prepare_enable(ourport->baudclk); in s3c24xx_serial_resume_noirq()
2156 if (!IS_ERR(ourport->baudclk)) in s3c24xx_serial_resume_noirq()
2157 clk_disable_unprepare(ourport->baudclk); in s3c24xx_serial_resume_noirq()
2158 clk_disable_unprepare(ourport->clk); in s3c24xx_serial_resume_noirq()
2190 /* fifo mode - check amount of data in fifo registers... */ in s3c24xx_serial_console_txrdy()
2193 return (ufstat & info->tx_fifofull) ? 0 : 1; in s3c24xx_serial_console_txrdy()
2196 /* in non-fifo mode, we go and use the tx buffer empty */ in s3c24xx_serial_console_txrdy()
2211 * Console polling routines for writing and reading from the uart while
2319 clk = clk_get(port->dev, clk_name); in s3c24xx_serial_get_options()
2326 dev_dbg(port->dev, "calculated baud %d\n", *baud); in s3c24xx_serial_get_options()
2341 if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS) in s3c24xx_serial_console_setup()
2342 co->index = 0; in s3c24xx_serial_console_setup()
2344 port = &s3c24xx_serial_ports[co->index].port; in s3c24xx_serial_console_setup()
2348 if (port->mapbase == 0x0) in s3c24xx_serial_console_setup()
2349 return -ENODEV; in s3c24xx_serial_console_setup()
2354 * Check whether an invalid uart number has been specified, and in s3c24xx_serial_console_setup()
2363 dev_dbg(port->dev, "baud %d\n", baud); in s3c24xx_serial_console_setup()
2372 .index = -1,
2382 .name = "Samsung S3C2410 UART",
2409 .name = "Samsung S3C2412 UART",
2438 .name = "Samsung S3C2440 UART",
2466 .name = "Samsung S3C6400 UART",
2494 .name = "Samsung S5PV210 UART",
2522 .name = "Samsung Exynos UART", \
2561 .name = "s3c2410-uart",
2564 .name = "s3c2412-uart",
2567 .name = "s3c2440-uart",
2570 .name = "s3c6400-uart",
2573 .name = "s5pv210-uart",
2576 .name = "exynos4210-uart",
2579 .name = "exynos5433-uart",
2588 { .compatible = "samsung,s3c2410-uart",
2590 { .compatible = "samsung,s3c2412-uart",
2592 { .compatible = "samsung,s3c2440-uart",
2594 { .compatible = "samsung,s3c6400-uart",
2596 { .compatible = "samsung,s5pv210-uart",
2598 { .compatible = "samsung,exynos4210-uart",
2600 { .compatible = "samsung,exynos5433-uart",
2612 .name = "samsung-uart",
2627 switch (port->iotype) { in wr_reg_barrier()
2643 while (!(readl(port->membase + S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXFE)) in samsung_early_busyuart()
2649 struct samsung_early_console_data *data = port->private_data; in samsung_early_busyuart_fifo()
2651 while (readl(port->membase + S3C2410_UFSTAT) & data->txfull_mask) in samsung_early_busyuart_fifo()
2657 if (readl(port->membase + S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) in samsung_early_putc()
2668 struct earlycon_device *dev = con->data; in samsung_early_write()
2670 uart_console_write(&dev->port, s, n, samsung_early_putc); in samsung_early_write()
2676 if (!device->port.membase) in samsung_early_console_setup()
2677 return -ENODEV; in samsung_early_console_setup()
2679 device->con->write = samsung_early_write; in samsung_early_console_setup()
2691 device->port.private_data = &s3c2410_early_console_data; in s3c2410_early_console_setup()
2695 OF_EARLYCON_DECLARE(s3c2410, "samsung,s3c2410-uart",
2706 device->port.private_data = &s3c2440_early_console_data; in s3c2440_early_console_setup()
2710 OF_EARLYCON_DECLARE(s3c2412, "samsung,s3c2412-uart",
2712 OF_EARLYCON_DECLARE(s3c2440, "samsung,s3c2440-uart",
2714 OF_EARLYCON_DECLARE(s3c6400, "samsung,s3c6400-uart",
2725 device->port.private_data = &s5pv210_early_console_data; in s5pv210_early_console_setup()
2729 OF_EARLYCON_DECLARE(s5pv210, "samsung,s5pv210-uart",
2731 OF_EARLYCON_DECLARE(exynos4210, "samsung,exynos4210-uart",
2735 MODULE_ALIAS("platform:samsung-uart");