Lines Matching refs:port

89 #define tx_enabled(port) ((port)->unused[0])  argument
90 #define rx_enabled(port) ((port)->unused[1]) argument
95 static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port) in to_ourport() argument
97 return container_of(port, struct s3c24xx_uart_port, port); in to_ourport()
102 static inline const char *s3c24xx_serial_portname(struct uart_port *port) in s3c24xx_serial_portname() argument
104 return to_platform_device(port->dev)->name; in s3c24xx_serial_portname()
107 static int s3c24xx_serial_txempty_nofifo(struct uart_port *port) in s3c24xx_serial_txempty_nofifo() argument
109 return rd_regl(port, S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE; in s3c24xx_serial_txempty_nofifo()
117 static int s3c24xx_serial_has_interrupt_mask(struct uart_port *port) in s3c24xx_serial_has_interrupt_mask() argument
119 return to_ourport(port)->info->type == PORT_S3C6400; in s3c24xx_serial_has_interrupt_mask()
122 static void s3c24xx_serial_rx_enable(struct uart_port *port) in s3c24xx_serial_rx_enable() argument
128 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_enable()
130 while (--count && !s3c24xx_serial_txempty_nofifo(port)) in s3c24xx_serial_rx_enable()
133 ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_rx_enable()
135 wr_regl(port, S3C2410_UFCON, ufcon); in s3c24xx_serial_rx_enable()
137 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_rx_enable()
139 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_rx_enable()
141 rx_enabled(port) = 1; in s3c24xx_serial_rx_enable()
142 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_enable()
145 static void s3c24xx_serial_rx_disable(struct uart_port *port) in s3c24xx_serial_rx_disable() argument
150 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_disable()
152 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_rx_disable()
154 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_rx_disable()
156 rx_enabled(port) = 0; in s3c24xx_serial_rx_disable()
157 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_disable()
160 static void s3c24xx_serial_stop_tx(struct uart_port *port) in s3c24xx_serial_stop_tx() argument
162 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_stop_tx()
164 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_stop_tx()
168 if (!tx_enabled(port)) in s3c24xx_serial_stop_tx()
171 if (s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_stop_tx()
173 portaddrl(port, S3C64XX_UINTM)); in s3c24xx_serial_stop_tx()
181 dma_sync_single_for_cpu(ourport->port.dev, in s3c24xx_serial_stop_tx()
186 port->icount.tx += count; in s3c24xx_serial_stop_tx()
189 tx_enabled(port) = 0; in s3c24xx_serial_stop_tx()
192 if (port->flags & UPF_CONS_FLOW) in s3c24xx_serial_stop_tx()
193 s3c24xx_serial_rx_enable(port); in s3c24xx_serial_stop_tx()
203 struct uart_port *port = &ourport->port; in s3c24xx_serial_tx_dma_complete() local
204 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_tx_dma_complete()
215 dma_sync_single_for_cpu(ourport->port.dev, dma->tx_transfer_addr, in s3c24xx_serial_tx_dma_complete()
218 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_tx_dma_complete()
221 port->icount.tx += count; in s3c24xx_serial_tx_dma_complete()
225 uart_write_wakeup(port); in s3c24xx_serial_tx_dma_complete()
228 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_tx_dma_complete()
233 struct uart_port *port = &ourport->port; in enable_tx_dma() local
237 if (s3c24xx_serial_has_interrupt_mask(port)) in enable_tx_dma()
239 portaddrl(port, S3C64XX_UINTM)); in enable_tx_dma()
244 ucon = rd_regl(port, S3C2410_UCON); in enable_tx_dma()
249 wr_regl(port, S3C2410_UCON, ucon); in enable_tx_dma()
256 struct uart_port *port = &ourport->port; in enable_tx_pio() local
261 ufcon = rd_regl(port, S3C2410_UFCON); in enable_tx_pio()
262 wr_regl(port, S3C2410_UFCON, ufcon); in enable_tx_pio()
265 ucon = rd_regl(port, S3C2410_UCON); in enable_tx_pio()
268 wr_regl(port, S3C2410_UCON, ucon); in enable_tx_pio()
271 if (s3c24xx_serial_has_interrupt_mask(port)) in enable_tx_pio()
273 portaddrl(port, S3C64XX_UINTM)); in enable_tx_pio()
289 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_tx_dma() local
290 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx_dma()
300 dma_sync_single_for_device(ourport->port.dev, dma->tx_transfer_addr, in s3c24xx_serial_start_tx_dma()
307 dev_err(ourport->port.dev, "Unable to get desc for Tx\n"); in s3c24xx_serial_start_tx_dma()
323 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_next_tx() local
324 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_next_tx()
331 s3c24xx_serial_stop_tx(port); in s3c24xx_serial_start_next_tx()
343 static void s3c24xx_serial_start_tx(struct uart_port *port) in s3c24xx_serial_start_tx() argument
345 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_start_tx()
346 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx()
348 if (!tx_enabled(port)) { in s3c24xx_serial_start_tx()
349 if (port->flags & UPF_CONS_FLOW) in s3c24xx_serial_start_tx()
350 s3c24xx_serial_rx_disable(port); in s3c24xx_serial_start_tx()
352 tx_enabled(port) = 1; in s3c24xx_serial_start_tx()
372 dma_sync_single_for_cpu(ourport->port.dev, dma->rx_addr, in s3c24xx_uart_copy_rx_to_tty()
375 ourport->port.icount.rx += count; in s3c24xx_uart_copy_rx_to_tty()
377 dev_err(ourport->port.dev, "No tty port\n"); in s3c24xx_uart_copy_rx_to_tty()
384 dev_err(ourport->port.dev, "RxData copy to tty layer failed\n"); in s3c24xx_uart_copy_rx_to_tty()
388 static void s3c24xx_serial_stop_rx(struct uart_port *port) in s3c24xx_serial_stop_rx() argument
390 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_stop_rx()
392 struct tty_port *t = &port->state->port; in s3c24xx_serial_stop_rx()
397 if (rx_enabled(port)) { in s3c24xx_serial_stop_rx()
398 dbg("s3c24xx_serial_stop_rx: port=%p\n", port); in s3c24xx_serial_stop_rx()
399 if (s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_stop_rx()
401 portaddrl(port, S3C64XX_UINTM)); in s3c24xx_serial_stop_rx()
404 rx_enabled(port) = 0; in s3c24xx_serial_stop_rx()
420 *s3c24xx_port_to_info(struct uart_port *port) in s3c24xx_port_to_info() argument
422 return to_ourport(port)->info; in s3c24xx_port_to_info()
426 *s3c24xx_port_to_cfg(struct uart_port *port) in s3c24xx_port_to_cfg() argument
430 if (port->dev == NULL) in s3c24xx_port_to_cfg()
433 ourport = container_of(port, struct s3c24xx_uart_port, port); in s3c24xx_port_to_cfg()
443 return ourport->port.fifosize; in s3c24xx_serial_rx_fifocnt()
452 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_dma_complete() local
455 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_dma_complete()
456 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_dma_complete()
466 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
478 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
485 dma_sync_single_for_device(ourport->port.dev, dma->rx_addr, in s3c64xx_start_rx_dma()
492 dev_err(ourport->port.dev, "Unable to get desc for Rx\n"); in s3c64xx_start_rx_dma()
509 struct uart_port *port = &ourport->port; in enable_rx_dma() local
513 ucon = rd_regl(port, S3C2410_UCON); in enable_rx_dma()
525 wr_regl(port, S3C2410_UCON, ucon); in enable_rx_dma()
532 struct uart_port *port = &ourport->port; in enable_rx_pio() local
536 ucon = rd_regl(port, S3C2410_UCON); in enable_rx_pio()
545 wr_regl(port, S3C2410_UCON, ucon); in enable_rx_pio()
556 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_dma() local
558 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_chars_dma()
559 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_chars_dma()
563 utrstat = rd_regl(port, S3C2410_UTRSTAT); in s3c24xx_serial_rx_chars_dma()
564 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_rx_chars_dma()
566 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
592 wr_regl(port, S3C2410_UTRSTAT, S3C2410_UTRSTAT_TIMEOUT); in s3c24xx_serial_rx_chars_dma()
595 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
602 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_drain_fifo() local
604 int max_count = port->fifosize; in s3c24xx_serial_rx_drain_fifo()
607 ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_rx_drain_fifo()
608 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_rx_drain_fifo()
613 uerstat = rd_regl(port, S3C2410_UERSTAT); in s3c24xx_serial_rx_drain_fifo()
614 ch = rd_regb(port, S3C2410_URXH); in s3c24xx_serial_rx_drain_fifo()
616 if (port->flags & UPF_CONS_FLOW) { in s3c24xx_serial_rx_drain_fifo()
617 int txe = s3c24xx_serial_txempty_nofifo(port); in s3c24xx_serial_rx_drain_fifo()
619 if (rx_enabled(port)) { in s3c24xx_serial_rx_drain_fifo()
621 rx_enabled(port) = 0; in s3c24xx_serial_rx_drain_fifo()
627 wr_regl(port, S3C2410_UFCON, ufcon); in s3c24xx_serial_rx_drain_fifo()
628 rx_enabled(port) = 1; in s3c24xx_serial_rx_drain_fifo()
638 port->icount.rx++; in s3c24xx_serial_rx_drain_fifo()
647 port->icount.brk++; in s3c24xx_serial_rx_drain_fifo()
648 if (uart_handle_break(port)) in s3c24xx_serial_rx_drain_fifo()
653 port->icount.frame++; in s3c24xx_serial_rx_drain_fifo()
655 port->icount.overrun++; in s3c24xx_serial_rx_drain_fifo()
657 uerstat &= port->read_status_mask; in s3c24xx_serial_rx_drain_fifo()
668 if (uart_handle_sysrq_char(port, ch)) in s3c24xx_serial_rx_drain_fifo()
671 uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, in s3c24xx_serial_rx_drain_fifo()
675 tty_flip_buffer_push(&port->state->port); in s3c24xx_serial_rx_drain_fifo()
681 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_pio() local
684 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
686 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
704 struct uart_port *port = &ourport->port; in s3c24xx_serial_tx_chars() local
705 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_tx_chars()
709 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_tx_chars()
723 if (port->x_char) { in s3c24xx_serial_tx_chars()
724 wr_regb(port, S3C2410_UTXH, port->x_char); in s3c24xx_serial_tx_chars()
725 port->icount.tx++; in s3c24xx_serial_tx_chars()
726 port->x_char = 0; in s3c24xx_serial_tx_chars()
734 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { in s3c24xx_serial_tx_chars()
735 s3c24xx_serial_stop_tx(port); in s3c24xx_serial_tx_chars()
741 if (count > port->fifosize) { in s3c24xx_serial_tx_chars()
742 count = port->fifosize; in s3c24xx_serial_tx_chars()
747 if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull) in s3c24xx_serial_tx_chars()
750 wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]); in s3c24xx_serial_tx_chars()
752 port->icount.tx++; in s3c24xx_serial_tx_chars()
762 spin_unlock(&port->lock); in s3c24xx_serial_tx_chars()
763 uart_write_wakeup(port); in s3c24xx_serial_tx_chars()
764 spin_lock(&port->lock); in s3c24xx_serial_tx_chars()
768 s3c24xx_serial_stop_tx(port); in s3c24xx_serial_tx_chars()
771 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_tx_chars()
779 struct uart_port *port = &ourport->port; in s3c64xx_serial_handle_irq() local
780 unsigned int pend = rd_regl(port, S3C64XX_UINTP); in s3c64xx_serial_handle_irq()
785 wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_RXD_MSK); in s3c64xx_serial_handle_irq()
789 wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_TXD_MSK); in s3c64xx_serial_handle_irq()
794 static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port) in s3c24xx_serial_tx_empty() argument
796 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_tx_empty()
797 unsigned long ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_tx_empty()
798 unsigned long ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_tx_empty()
808 return s3c24xx_serial_txempty_nofifo(port); in s3c24xx_serial_tx_empty()
812 static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port) in s3c24xx_serial_get_mctrl() argument
814 unsigned int umstat = rd_regb(port, S3C2410_UMSTAT); in s3c24xx_serial_get_mctrl()
822 static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl) in s3c24xx_serial_set_mctrl() argument
824 unsigned int umcon = rd_regl(port, S3C2410_UMCON); in s3c24xx_serial_set_mctrl()
831 wr_regl(port, S3C2410_UMCON, umcon); in s3c24xx_serial_set_mctrl()
834 static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state) in s3c24xx_serial_break_ctl() argument
839 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_break_ctl()
841 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_break_ctl()
848 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_break_ctl()
850 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_break_ctl()
862 dma->rx_conf.src_addr = p->port.mapbase + S3C2410_URXH; in s3c24xx_serial_request_dma()
867 dma->tx_conf.dst_addr = p->port.mapbase + S3C2410_UTXH; in s3c24xx_serial_request_dma()
877 dma->rx_param, p->port.dev, "rx"); in s3c24xx_serial_request_dma()
884 dma->tx_param, p->port.dev, "tx"); in s3c24xx_serial_request_dma()
906 spin_lock_irqsave(&p->port.lock, flags); in s3c24xx_serial_request_dma()
910 p->port.state->xmit.buf, in s3c24xx_serial_request_dma()
913 spin_unlock_irqrestore(&p->port.lock, flags); in s3c24xx_serial_request_dma()
940 static void s3c24xx_serial_shutdown(struct uart_port *port) in s3c24xx_serial_shutdown() argument
942 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_shutdown()
945 if (!s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_shutdown()
947 tx_enabled(port) = 0; in s3c24xx_serial_shutdown()
953 if (!s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_shutdown()
956 rx_enabled(port) = 0; in s3c24xx_serial_shutdown()
960 if (s3c24xx_serial_has_interrupt_mask(port)) { in s3c24xx_serial_shutdown()
961 free_irq(port->irq, ourport); in s3c24xx_serial_shutdown()
963 wr_regl(port, S3C64XX_UINTP, 0xf); in s3c24xx_serial_shutdown()
964 wr_regl(port, S3C64XX_UINTM, 0xf); in s3c24xx_serial_shutdown()
973 static int s3c24xx_serial_startup(struct uart_port *port) in s3c24xx_serial_startup() argument
975 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_startup()
979 port, (unsigned long long)port->mapbase, port->membase); in s3c24xx_serial_startup()
981 rx_enabled(port) = 1; in s3c24xx_serial_startup()
984 s3c24xx_serial_portname(port), ourport); in s3c24xx_serial_startup()
987 dev_err(port->dev, "cannot get irq %d\n", ourport->rx_irq); in s3c24xx_serial_startup()
995 tx_enabled(port) = 1; in s3c24xx_serial_startup()
998 s3c24xx_serial_portname(port), ourport); in s3c24xx_serial_startup()
1001 dev_err(port->dev, "cannot get irq %d\n", ourport->tx_irq); in s3c24xx_serial_startup()
1015 s3c24xx_serial_shutdown(port); in s3c24xx_serial_startup()
1019 static int s3c64xx_serial_startup(struct uart_port *port) in s3c64xx_serial_startup() argument
1021 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c64xx_serial_startup()
1027 port, (unsigned long long)port->mapbase, port->membase); in s3c64xx_serial_startup()
1029 wr_regl(port, S3C64XX_UINTM, 0xf); in s3c64xx_serial_startup()
1033 dev_warn(port->dev, "DMA request failed\n"); in s3c64xx_serial_startup()
1038 ret = request_irq(port->irq, s3c64xx_serial_handle_irq, IRQF_SHARED, in s3c64xx_serial_startup()
1039 s3c24xx_serial_portname(port), ourport); in s3c64xx_serial_startup()
1041 dev_err(port->dev, "cannot get irq %d\n", port->irq); in s3c64xx_serial_startup()
1046 rx_enabled(port) = 1; in s3c64xx_serial_startup()
1048 tx_enabled(port) = 0; in s3c64xx_serial_startup()
1051 spin_lock_irqsave(&port->lock, flags); in s3c64xx_serial_startup()
1053 ufcon = rd_regl(port, S3C2410_UFCON); in s3c64xx_serial_startup()
1055 if (!uart_console(port)) in s3c64xx_serial_startup()
1057 wr_regl(port, S3C2410_UFCON, ufcon); in s3c64xx_serial_startup()
1061 spin_unlock_irqrestore(&port->lock, flags); in s3c64xx_serial_startup()
1064 __clear_bit(S3C64XX_UINTM_RXD, portaddrl(port, S3C64XX_UINTM)); in s3c64xx_serial_startup()
1072 static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, in s3c24xx_serial_pm() argument
1075 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_pm()
1082 while (--timeout && !s3c24xx_serial_txempty_nofifo(port)) in s3c24xx_serial_pm()
1099 dev_err(port->dev, "s3c24xx_serial: unknown pm %d\n", level); in s3c24xx_serial_pm()
1118 static inline int s3c24xx_serial_getsource(struct uart_port *port) in s3c24xx_serial_getsource() argument
1120 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_getsource()
1126 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_getsource()
1131 static void s3c24xx_serial_setsource(struct uart_port *port, in s3c24xx_serial_setsource() argument
1134 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_setsource()
1140 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_setsource()
1146 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_setsource()
1167 clk = clk_get(ourport->port.dev, clkname); in s3c24xx_serial_getclk()
1233 static void s3c24xx_serial_set_termios(struct uart_port *port, in s3c24xx_serial_set_termios() argument
1237 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); in s3c24xx_serial_set_termios()
1238 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_set_termios()
1256 baud = uart_get_baud_rate(port, termios, old, 0, 115200*8); in s3c24xx_serial_set_termios()
1258 if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) in s3c24xx_serial_set_termios()
1259 quot = port->custom_divisor; in s3c24xx_serial_set_termios()
1268 s3c24xx_serial_setsource(port, clk_sel); in s3c24xx_serial_set_termios()
1326 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_set_termios()
1331 wr_regl(port, S3C2410_ULCON, ulcon); in s3c24xx_serial_set_termios()
1332 wr_regl(port, S3C2410_UBRDIV, quot); in s3c24xx_serial_set_termios()
1334 umcon = rd_regl(port, S3C2410_UMCON); in s3c24xx_serial_set_termios()
1342 wr_regl(port, S3C2410_UMCON, umcon); in s3c24xx_serial_set_termios()
1345 wr_regl(port, S3C2443_DIVSLOT, udivslot); in s3c24xx_serial_set_termios()
1348 rd_regl(port, S3C2410_ULCON), in s3c24xx_serial_set_termios()
1349 rd_regl(port, S3C2410_UCON), in s3c24xx_serial_set_termios()
1350 rd_regl(port, S3C2410_UFCON)); in s3c24xx_serial_set_termios()
1355 uart_update_timeout(port, termios->c_cflag, baud); in s3c24xx_serial_set_termios()
1360 port->read_status_mask = S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1362 port->read_status_mask |= S3C2410_UERSTAT_FRAME | in s3c24xx_serial_set_termios()
1367 port->ignore_status_mask = 0; in s3c24xx_serial_set_termios()
1369 port->ignore_status_mask |= S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1371 port->ignore_status_mask |= S3C2410_UERSTAT_FRAME; in s3c24xx_serial_set_termios()
1377 port->ignore_status_mask |= RXSTAT_DUMMY_READ; in s3c24xx_serial_set_termios()
1379 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_set_termios()
1382 static const char *s3c24xx_serial_type(struct uart_port *port) in s3c24xx_serial_type() argument
1384 switch (port->type) { in s3c24xx_serial_type()
1400 static void s3c24xx_serial_release_port(struct uart_port *port) in s3c24xx_serial_release_port() argument
1402 release_mem_region(port->mapbase, MAP_SIZE); in s3c24xx_serial_release_port()
1405 static int s3c24xx_serial_request_port(struct uart_port *port) in s3c24xx_serial_request_port() argument
1407 const char *name = s3c24xx_serial_portname(port); in s3c24xx_serial_request_port()
1408 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY; in s3c24xx_serial_request_port()
1411 static void s3c24xx_serial_config_port(struct uart_port *port, int flags) in s3c24xx_serial_config_port() argument
1413 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_config_port()
1416 s3c24xx_serial_request_port(port) == 0) in s3c24xx_serial_config_port()
1417 port->type = info->type; in s3c24xx_serial_config_port()
1424 s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser) in s3c24xx_serial_verify_port() argument
1426 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_verify_port()
1452 static int s3c24xx_serial_get_poll_char(struct uart_port *port);
1453 static void s3c24xx_serial_put_poll_char(struct uart_port *port,
1491 __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[i].port.lock)
1495 .port = {
1506 .port = {
1519 .port = {
1532 .port = {
1551 static void s3c24xx_serial_resetport(struct uart_port *port, in s3c24xx_serial_resetport() argument
1554 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_resetport()
1555 unsigned long ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_resetport()
1563 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); in s3c24xx_serial_resetport()
1566 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); in s3c24xx_serial_resetport()
1567 wr_regl(port, S3C2410_UFCON, cfg->ufcon); in s3c24xx_serial_resetport()
1579 struct s3c24xx_uart_port *port; in s3c24xx_serial_cpufreq_transition() local
1582 port = container_of(nb, struct s3c24xx_uart_port, freq_transition); in s3c24xx_serial_cpufreq_transition()
1583 uport = &port->port; in s3c24xx_serial_cpufreq_transition()
1587 if (port->pm_level != 0) in s3c24xx_serial_cpufreq_transition()
1595 if (IS_ERR(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1598 if (port->baudclk_rate == clk_get_rate(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1612 tty = uport->state->port.tty; in s3c24xx_serial_cpufreq_transition()
1632 s3c24xx_serial_cpufreq_register(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_register() argument
1634 port->freq_transition.notifier_call = s3c24xx_serial_cpufreq_transition; in s3c24xx_serial_cpufreq_register()
1636 return cpufreq_register_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_register()
1641 s3c24xx_serial_cpufreq_deregister(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_deregister() argument
1643 cpufreq_unregister_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_deregister()
1649 s3c24xx_serial_cpufreq_register(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_register() argument
1655 s3c24xx_serial_cpufreq_deregister(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_deregister() argument
1668 struct uart_port *port = &ourport->port; in s3c24xx_serial_init_port() local
1673 dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev); in s3c24xx_serial_init_port()
1678 if (port->mapbase != 0) in s3c24xx_serial_init_port()
1682 port->dev = &platdev->dev; in s3c24xx_serial_init_port()
1685 if (s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_init_port()
1688 port->uartclk = 1; in s3c24xx_serial_init_port()
1692 port->flags |= UPF_CONS_FLOW; in s3c24xx_serial_init_port()
1699 dev_err(port->dev, "failed to find memory resource for uart\n"); in s3c24xx_serial_init_port()
1705 port->membase = devm_ioremap(port->dev, res->start, resource_size(res)); in s3c24xx_serial_init_port()
1706 if (!port->membase) { in s3c24xx_serial_init_port()
1707 dev_err(port->dev, "failed to remap controller address\n"); in s3c24xx_serial_init_port()
1711 port->mapbase = res->start; in s3c24xx_serial_init_port()
1714 port->irq = 0; in s3c24xx_serial_init_port()
1716 port->irq = ret; in s3c24xx_serial_init_port()
1730 ourport->dma = devm_kzalloc(port->dev, in s3c24xx_serial_init_port()
1752 if (s3c24xx_serial_has_interrupt_mask(port)) { in s3c24xx_serial_init_port()
1753 wr_regl(port, S3C64XX_UINTM, 0xf); in s3c24xx_serial_init_port()
1754 wr_regl(port, S3C64XX_UINTP, 0xf); in s3c24xx_serial_init_port()
1755 wr_regl(port, S3C64XX_UINTSP, 0xf); in s3c24xx_serial_init_port()
1759 &port->mapbase, port->membase, port->irq, in s3c24xx_serial_init_port()
1760 ourport->rx_irq, ourport->tx_irq, port->uartclk); in s3c24xx_serial_init_port()
1763 s3c24xx_serial_resetport(port, cfg); in s3c24xx_serial_init_port()
1817 "samsung,uart-fifosize", &ourport->port.fifosize); in s3c24xx_serial_probe()
1820 ourport->port.fifosize = ourport->drv_data->fifosize[index]; in s3c24xx_serial_probe()
1822 ourport->port.fifosize = ourport->info->fifosize; in s3c24xx_serial_probe()
1828 ourport->min_dma_size = max_t(int, ourport->port.fifosize, in s3c24xx_serial_probe()
1848 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); in s3c24xx_serial_probe()
1849 platform_set_drvdata(pdev, &ourport->port); in s3c24xx_serial_probe()
1867 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); in s3c24xx_serial_remove() local
1869 if (port) { in s3c24xx_serial_remove()
1870 s3c24xx_serial_cpufreq_deregister(to_ourport(port)); in s3c24xx_serial_remove()
1871 uart_remove_one_port(&s3c24xx_uart_drv, port); in s3c24xx_serial_remove()
1883 struct uart_port *port = s3c24xx_dev_to_port(dev); in s3c24xx_serial_suspend() local
1885 if (port) in s3c24xx_serial_suspend()
1886 uart_suspend_port(&s3c24xx_uart_drv, port); in s3c24xx_serial_suspend()
1893 struct uart_port *port = s3c24xx_dev_to_port(dev); in s3c24xx_serial_resume() local
1894 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_resume()
1896 if (port) { in s3c24xx_serial_resume()
1898 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port)); in s3c24xx_serial_resume()
1901 uart_resume_port(&s3c24xx_uart_drv, port); in s3c24xx_serial_resume()
1909 struct uart_port *port = s3c24xx_dev_to_port(dev); in s3c24xx_serial_resume_noirq() local
1911 if (port) { in s3c24xx_serial_resume_noirq()
1913 if (s3c24xx_serial_has_interrupt_mask(port)) { in s3c24xx_serial_resume_noirq()
1915 if (tx_enabled(port)) in s3c24xx_serial_resume_noirq()
1917 if (rx_enabled(port)) in s3c24xx_serial_resume_noirq()
1919 wr_regl(port, S3C64XX_UINTM, uintm); in s3c24xx_serial_resume_noirq()
1945 s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon) in s3c24xx_serial_console_txrdy() argument
1947 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_console_txrdy()
1953 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_console_txrdy()
1959 utrstat = rd_regl(port, S3C2410_UTRSTAT); in s3c24xx_serial_console_txrdy()
1976 static int s3c24xx_serial_get_poll_char(struct uart_port *port) in s3c24xx_serial_get_poll_char() argument
1978 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_get_poll_char()
1981 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_get_poll_char()
1985 return rd_regb(port, S3C2410_URXH); in s3c24xx_serial_get_poll_char()
1988 static void s3c24xx_serial_put_poll_char(struct uart_port *port, in s3c24xx_serial_put_poll_char() argument
1991 unsigned int ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_put_poll_char()
1992 unsigned int ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_put_poll_char()
1998 while (!s3c24xx_serial_console_txrdy(port, ufcon)) in s3c24xx_serial_put_poll_char()
2000 wr_regb(port, S3C2410_UTXH, c); in s3c24xx_serial_put_poll_char()
2006 s3c24xx_serial_console_putchar(struct uart_port *port, int ch) in s3c24xx_serial_console_putchar() argument
2008 unsigned int ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_console_putchar()
2010 while (!s3c24xx_serial_console_txrdy(port, ufcon)) in s3c24xx_serial_console_putchar()
2012 wr_regb(port, S3C2410_UTXH, ch); in s3c24xx_serial_console_putchar()
2029 s3c24xx_serial_get_options(struct uart_port *port, int *baud, in s3c24xx_serial_get_options() argument
2040 ulcon = rd_regl(port, S3C2410_ULCON); in s3c24xx_serial_get_options()
2041 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_get_options()
2042 ubrdiv = rd_regl(port, S3C2410_UBRDIV); in s3c24xx_serial_get_options()
2046 port, ulcon, ucon, ubrdiv); in s3c24xx_serial_get_options()
2081 clk_sel = s3c24xx_serial_getsource(port); in s3c24xx_serial_get_options()
2084 clk = clk_get(port->dev, clk_name); in s3c24xx_serial_get_options()
2099 struct uart_port *port; in s3c24xx_serial_console_setup() local
2113 port = &s3c24xx_serial_ports[co->index].port; in s3c24xx_serial_console_setup()
2117 if (port->mapbase == 0x0) in s3c24xx_serial_console_setup()
2120 cons_uart = port; in s3c24xx_serial_console_setup()
2122 dbg("s3c24xx_serial_console_setup: port=%p (%d)\n", port, co->index); in s3c24xx_serial_console_setup()
2132 s3c24xx_serial_get_options(port, &baud, &parity, &bits); in s3c24xx_serial_console_setup()
2136 return uart_set_options(port, co, baud, parity, bits, flow); in s3c24xx_serial_console_setup()
2400 static void samsung_early_busyuart(struct uart_port *port) in samsung_early_busyuart() argument
2402 while (!(readl(port->membase + S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXFE)) in samsung_early_busyuart()
2406 static void samsung_early_busyuart_fifo(struct uart_port *port) in samsung_early_busyuart_fifo() argument
2408 struct samsung_early_console_data *data = port->private_data; in samsung_early_busyuart_fifo()
2410 while (readl(port->membase + S3C2410_UFSTAT) & data->txfull_mask) in samsung_early_busyuart_fifo()
2414 static void samsung_early_putc(struct uart_port *port, int c) in samsung_early_putc() argument
2416 if (readl(port->membase + S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) in samsung_early_putc()
2417 samsung_early_busyuart_fifo(port); in samsung_early_putc()
2419 samsung_early_busyuart(port); in samsung_early_putc()
2421 writeb(c, port->membase + S3C2410_UTXH); in samsung_early_putc()
2428 uart_console_write(&dev->port, s, n, samsung_early_putc); in samsung_early_write()
2434 if (!device->port.membase) in samsung_early_console_setup()
2449 device->port.private_data = &s3c2410_early_console_data; in s3c2410_early_console_setup()
2464 device->port.private_data = &s3c2440_early_console_data; in s3c2440_early_console_setup()
2485 device->port.private_data = &s5pv210_early_console_data; in s5pv210_early_console_setup()