Lines Matching refs:port

90 #define tx_enabled(port) ((port)->unused[0])  argument
91 #define rx_enabled(port) ((port)->unused[1]) argument
96 static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port) in to_ourport() argument
98 return container_of(port, struct s3c24xx_uart_port, port); in to_ourport()
103 static inline const char *s3c24xx_serial_portname(struct uart_port *port) in s3c24xx_serial_portname() argument
105 return to_platform_device(port->dev)->name; in s3c24xx_serial_portname()
108 static int s3c24xx_serial_txempty_nofifo(struct uart_port *port) in s3c24xx_serial_txempty_nofifo() argument
110 return rd_regl(port, S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE; in s3c24xx_serial_txempty_nofifo()
118 static int s3c24xx_serial_has_interrupt_mask(struct uart_port *port) in s3c24xx_serial_has_interrupt_mask() argument
120 return to_ourport(port)->info->type == PORT_S3C6400; in s3c24xx_serial_has_interrupt_mask()
123 static void s3c24xx_serial_rx_enable(struct uart_port *port) in s3c24xx_serial_rx_enable() argument
129 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_enable()
131 while (--count && !s3c24xx_serial_txempty_nofifo(port)) in s3c24xx_serial_rx_enable()
134 ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_rx_enable()
136 wr_regl(port, S3C2410_UFCON, ufcon); in s3c24xx_serial_rx_enable()
138 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_rx_enable()
140 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_rx_enable()
142 rx_enabled(port) = 1; in s3c24xx_serial_rx_enable()
143 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_enable()
146 static void s3c24xx_serial_rx_disable(struct uart_port *port) in s3c24xx_serial_rx_disable() argument
151 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_disable()
153 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_rx_disable()
155 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_rx_disable()
157 rx_enabled(port) = 0; in s3c24xx_serial_rx_disable()
158 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_disable()
161 static void s3c24xx_serial_stop_tx(struct uart_port *port) in s3c24xx_serial_stop_tx() argument
163 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_stop_tx()
165 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_stop_tx()
169 if (!tx_enabled(port)) in s3c24xx_serial_stop_tx()
172 if (s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_stop_tx()
174 portaddrl(port, S3C64XX_UINTM)); in s3c24xx_serial_stop_tx()
182 dma_sync_single_for_cpu(ourport->port.dev, in s3c24xx_serial_stop_tx()
187 port->icount.tx += count; in s3c24xx_serial_stop_tx()
190 tx_enabled(port) = 0; in s3c24xx_serial_stop_tx()
193 if (port->flags & UPF_CONS_FLOW) in s3c24xx_serial_stop_tx()
194 s3c24xx_serial_rx_enable(port); in s3c24xx_serial_stop_tx()
204 struct uart_port *port = &ourport->port; in s3c24xx_serial_tx_dma_complete() local
205 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_tx_dma_complete()
216 dma_sync_single_for_cpu(ourport->port.dev, dma->tx_transfer_addr, in s3c24xx_serial_tx_dma_complete()
219 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_tx_dma_complete()
222 port->icount.tx += count; in s3c24xx_serial_tx_dma_complete()
226 uart_write_wakeup(port); in s3c24xx_serial_tx_dma_complete()
229 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_tx_dma_complete()
234 struct uart_port *port = &ourport->port; in enable_tx_dma() local
238 if (s3c24xx_serial_has_interrupt_mask(port)) in enable_tx_dma()
240 portaddrl(port, S3C64XX_UINTM)); in enable_tx_dma()
245 ucon = rd_regl(port, S3C2410_UCON); in enable_tx_dma()
250 wr_regl(port, S3C2410_UCON, ucon); in enable_tx_dma()
257 struct uart_port *port = &ourport->port; in enable_tx_pio() local
262 ufcon = rd_regl(port, S3C2410_UFCON); in enable_tx_pio()
263 wr_regl(port, S3C2410_UFCON, ufcon); in enable_tx_pio()
266 ucon = rd_regl(port, S3C2410_UCON); in enable_tx_pio()
269 wr_regl(port, S3C2410_UCON, ucon); in enable_tx_pio()
272 if (s3c24xx_serial_has_interrupt_mask(port)) in enable_tx_pio()
274 portaddrl(port, S3C64XX_UINTM)); in enable_tx_pio()
290 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_tx_dma() local
291 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx_dma()
301 dma_sync_single_for_device(ourport->port.dev, dma->tx_transfer_addr, in s3c24xx_serial_start_tx_dma()
308 dev_err(ourport->port.dev, "Unable to get desc for Tx\n"); in s3c24xx_serial_start_tx_dma()
324 struct uart_port *port = &ourport->port; in s3c24xx_serial_start_next_tx() local
325 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_next_tx()
332 s3c24xx_serial_stop_tx(port); in s3c24xx_serial_start_next_tx()
344 void s3c24xx_serial_start_tx(struct uart_port *port) in s3c24xx_serial_start_tx() argument
346 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_start_tx()
347 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_start_tx()
349 if (!tx_enabled(port)) { in s3c24xx_serial_start_tx()
350 if (port->flags & UPF_CONS_FLOW) in s3c24xx_serial_start_tx()
351 s3c24xx_serial_rx_disable(port); in s3c24xx_serial_start_tx()
353 tx_enabled(port) = 1; in s3c24xx_serial_start_tx()
373 dma_sync_single_for_cpu(ourport->port.dev, dma->rx_addr, in s3c24xx_uart_copy_rx_to_tty()
376 ourport->port.icount.rx += count; in s3c24xx_uart_copy_rx_to_tty()
378 dev_err(ourport->port.dev, "No tty port\n"); in s3c24xx_uart_copy_rx_to_tty()
385 dev_err(ourport->port.dev, "RxData copy to tty layer failed\n"); in s3c24xx_uart_copy_rx_to_tty()
394 struct uart_port *port = &ourport->port; in uart_rx_drain_fifo() local
395 struct tty_port *tty = &port->state->port; in uart_rx_drain_fifo()
399 ufstat = rd_regl(port, S3C2410_UFSTAT); in uart_rx_drain_fifo()
406 ch = rd_regb(port, S3C2410_URXH); in uart_rx_drain_fifo()
408 ourport->port.icount.rx++; in uart_rx_drain_fifo()
415 static void s3c24xx_serial_stop_rx(struct uart_port *port) in s3c24xx_serial_stop_rx() argument
417 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_stop_rx()
419 struct tty_port *t = &port->state->port; in s3c24xx_serial_stop_rx()
424 if (rx_enabled(port)) { in s3c24xx_serial_stop_rx()
425 dbg("s3c24xx_serial_stop_rx: port=%p\n", port); in s3c24xx_serial_stop_rx()
426 if (s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_stop_rx()
428 portaddrl(port, S3C64XX_UINTM)); in s3c24xx_serial_stop_rx()
431 rx_enabled(port) = 0; in s3c24xx_serial_stop_rx()
447 *s3c24xx_port_to_info(struct uart_port *port) in s3c24xx_port_to_info() argument
449 return to_ourport(port)->info; in s3c24xx_port_to_info()
453 *s3c24xx_port_to_cfg(struct uart_port *port) in s3c24xx_port_to_cfg() argument
457 if (port->dev == NULL) in s3c24xx_port_to_cfg()
460 ourport = container_of(port, struct s3c24xx_uart_port, port); in s3c24xx_port_to_cfg()
470 return ourport->port.fifosize; in s3c24xx_serial_rx_fifocnt()
479 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_dma_complete() local
482 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_dma_complete()
483 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_dma_complete()
493 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
505 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_dma_complete()
512 dma_sync_single_for_device(ourport->port.dev, dma->rx_addr, in s3c64xx_start_rx_dma()
519 dev_err(ourport->port.dev, "Unable to get desc for Rx\n"); in s3c64xx_start_rx_dma()
536 struct uart_port *port = &ourport->port; in enable_rx_dma() local
540 ucon = rd_regl(port, S3C2410_UCON); in enable_rx_dma()
552 wr_regl(port, S3C2410_UCON, ucon); in enable_rx_dma()
559 struct uart_port *port = &ourport->port; in enable_rx_pio() local
563 ucon = rd_regl(port, S3C2410_UCON); in enable_rx_pio()
572 wr_regl(port, S3C2410_UCON, ucon); in enable_rx_pio()
581 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_dma() local
583 struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port); in s3c24xx_serial_rx_chars_dma()
584 struct tty_port *t = &port->state->port; in s3c24xx_serial_rx_chars_dma()
588 utrstat = rd_regl(port, S3C2410_UTRSTAT); in s3c24xx_serial_rx_chars_dma()
589 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_rx_chars_dma()
591 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
617 wr_regl(port, S3C2410_UTRSTAT, S3C2410_UTRSTAT_TIMEOUT); in s3c24xx_serial_rx_chars_dma()
620 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_dma()
628 struct uart_port *port = &ourport->port; in s3c24xx_serial_rx_chars_pio() local
631 int max_count = port->fifosize; in s3c24xx_serial_rx_chars_pio()
633 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
636 ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_rx_chars_pio()
637 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_rx_chars_pio()
642 uerstat = rd_regl(port, S3C2410_UERSTAT); in s3c24xx_serial_rx_chars_pio()
643 ch = rd_regb(port, S3C2410_URXH); in s3c24xx_serial_rx_chars_pio()
645 if (port->flags & UPF_CONS_FLOW) { in s3c24xx_serial_rx_chars_pio()
646 int txe = s3c24xx_serial_txempty_nofifo(port); in s3c24xx_serial_rx_chars_pio()
648 if (rx_enabled(port)) { in s3c24xx_serial_rx_chars_pio()
650 rx_enabled(port) = 0; in s3c24xx_serial_rx_chars_pio()
656 wr_regl(port, S3C2410_UFCON, ufcon); in s3c24xx_serial_rx_chars_pio()
657 rx_enabled(port) = 1; in s3c24xx_serial_rx_chars_pio()
658 spin_unlock_irqrestore(&port->lock, in s3c24xx_serial_rx_chars_pio()
669 port->icount.rx++; in s3c24xx_serial_rx_chars_pio()
678 port->icount.brk++; in s3c24xx_serial_rx_chars_pio()
679 if (uart_handle_break(port)) in s3c24xx_serial_rx_chars_pio()
684 port->icount.frame++; in s3c24xx_serial_rx_chars_pio()
686 port->icount.overrun++; in s3c24xx_serial_rx_chars_pio()
688 uerstat &= port->read_status_mask; in s3c24xx_serial_rx_chars_pio()
699 if (uart_handle_sysrq_char(port, ch)) in s3c24xx_serial_rx_chars_pio()
702 uart_insert_char(port, uerstat, S3C2410_UERSTAT_OVERRUN, in s3c24xx_serial_rx_chars_pio()
709 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_rx_chars_pio()
710 tty_flip_buffer_push(&port->state->port); in s3c24xx_serial_rx_chars_pio()
729 struct uart_port *port = &ourport->port; in s3c24xx_serial_tx_chars() local
730 struct circ_buf *xmit = &port->state->xmit; in s3c24xx_serial_tx_chars()
734 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_tx_chars()
748 if (port->x_char) { in s3c24xx_serial_tx_chars()
749 wr_regb(port, S3C2410_UTXH, port->x_char); in s3c24xx_serial_tx_chars()
750 port->icount.tx++; in s3c24xx_serial_tx_chars()
751 port->x_char = 0; in s3c24xx_serial_tx_chars()
759 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { in s3c24xx_serial_tx_chars()
760 s3c24xx_serial_stop_tx(port); in s3c24xx_serial_tx_chars()
766 if (count > port->fifosize) { in s3c24xx_serial_tx_chars()
767 count = port->fifosize; in s3c24xx_serial_tx_chars()
772 if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull) in s3c24xx_serial_tx_chars()
775 wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]); in s3c24xx_serial_tx_chars()
777 port->icount.tx++; in s3c24xx_serial_tx_chars()
787 spin_unlock(&port->lock); in s3c24xx_serial_tx_chars()
788 uart_write_wakeup(port); in s3c24xx_serial_tx_chars()
789 spin_lock(&port->lock); in s3c24xx_serial_tx_chars()
793 s3c24xx_serial_stop_tx(port); in s3c24xx_serial_tx_chars()
796 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_tx_chars()
804 struct uart_port *port = &ourport->port; in s3c64xx_serial_handle_irq() local
805 unsigned int pend = rd_regl(port, S3C64XX_UINTP); in s3c64xx_serial_handle_irq()
810 wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_RXD_MSK); in s3c64xx_serial_handle_irq()
814 wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_TXD_MSK); in s3c64xx_serial_handle_irq()
819 static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port) in s3c24xx_serial_tx_empty() argument
821 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_tx_empty()
822 unsigned long ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_tx_empty()
823 unsigned long ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_tx_empty()
833 return s3c24xx_serial_txempty_nofifo(port); in s3c24xx_serial_tx_empty()
837 static unsigned int s3c24xx_serial_get_mctrl(struct uart_port *port) in s3c24xx_serial_get_mctrl() argument
839 unsigned int umstat = rd_regb(port, S3C2410_UMSTAT); in s3c24xx_serial_get_mctrl()
847 static void s3c24xx_serial_set_mctrl(struct uart_port *port, unsigned int mctrl) in s3c24xx_serial_set_mctrl() argument
849 unsigned int umcon = rd_regl(port, S3C2410_UMCON); in s3c24xx_serial_set_mctrl()
856 wr_regl(port, S3C2410_UMCON, umcon); in s3c24xx_serial_set_mctrl()
859 static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state) in s3c24xx_serial_break_ctl() argument
864 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_break_ctl()
866 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_break_ctl()
873 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_break_ctl()
875 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_break_ctl()
887 dma->rx_conf.src_addr = p->port.mapbase + S3C2410_URXH; in s3c24xx_serial_request_dma()
892 dma->tx_conf.dst_addr = p->port.mapbase + S3C2410_UTXH; in s3c24xx_serial_request_dma()
902 dma->rx_param, p->port.dev, "rx"); in s3c24xx_serial_request_dma()
909 dma->tx_param, p->port.dev, "tx"); in s3c24xx_serial_request_dma()
931 spin_lock_irqsave(&p->port.lock, flags); in s3c24xx_serial_request_dma()
935 p->port.state->xmit.buf, in s3c24xx_serial_request_dma()
938 spin_unlock_irqrestore(&p->port.lock, flags); in s3c24xx_serial_request_dma()
965 static void s3c24xx_serial_shutdown(struct uart_port *port) in s3c24xx_serial_shutdown() argument
967 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_shutdown()
970 if (!s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_shutdown()
972 tx_enabled(port) = 0; in s3c24xx_serial_shutdown()
978 if (!s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_shutdown()
981 rx_enabled(port) = 0; in s3c24xx_serial_shutdown()
985 if (s3c24xx_serial_has_interrupt_mask(port)) { in s3c24xx_serial_shutdown()
986 free_irq(port->irq, ourport); in s3c24xx_serial_shutdown()
988 wr_regl(port, S3C64XX_UINTP, 0xf); in s3c24xx_serial_shutdown()
989 wr_regl(port, S3C64XX_UINTM, 0xf); in s3c24xx_serial_shutdown()
998 static int s3c24xx_serial_startup(struct uart_port *port) in s3c24xx_serial_startup() argument
1000 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_startup()
1004 port, (unsigned long long)port->mapbase, port->membase); in s3c24xx_serial_startup()
1006 rx_enabled(port) = 1; in s3c24xx_serial_startup()
1009 s3c24xx_serial_portname(port), ourport); in s3c24xx_serial_startup()
1012 dev_err(port->dev, "cannot get irq %d\n", ourport->rx_irq); in s3c24xx_serial_startup()
1020 tx_enabled(port) = 1; in s3c24xx_serial_startup()
1023 s3c24xx_serial_portname(port), ourport); in s3c24xx_serial_startup()
1026 dev_err(port->dev, "cannot get irq %d\n", ourport->tx_irq); in s3c24xx_serial_startup()
1040 s3c24xx_serial_shutdown(port); in s3c24xx_serial_startup()
1044 static int s3c64xx_serial_startup(struct uart_port *port) in s3c64xx_serial_startup() argument
1046 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c64xx_serial_startup()
1052 port, (unsigned long long)port->mapbase, port->membase); in s3c64xx_serial_startup()
1054 wr_regl(port, S3C64XX_UINTM, 0xf); in s3c64xx_serial_startup()
1058 dev_warn(port->dev, "DMA request failed\n"); in s3c64xx_serial_startup()
1063 ret = request_irq(port->irq, s3c64xx_serial_handle_irq, IRQF_SHARED, in s3c64xx_serial_startup()
1064 s3c24xx_serial_portname(port), ourport); in s3c64xx_serial_startup()
1066 dev_err(port->dev, "cannot get irq %d\n", port->irq); in s3c64xx_serial_startup()
1071 rx_enabled(port) = 1; in s3c64xx_serial_startup()
1073 tx_enabled(port) = 0; in s3c64xx_serial_startup()
1076 spin_lock_irqsave(&port->lock, flags); in s3c64xx_serial_startup()
1078 ufcon = rd_regl(port, S3C2410_UFCON); in s3c64xx_serial_startup()
1080 if (!uart_console(port)) in s3c64xx_serial_startup()
1082 wr_regl(port, S3C2410_UFCON, ufcon); in s3c64xx_serial_startup()
1086 spin_unlock_irqrestore(&port->lock, flags); in s3c64xx_serial_startup()
1089 __clear_bit(S3C64XX_UINTM_RXD, portaddrl(port, S3C64XX_UINTM)); in s3c64xx_serial_startup()
1097 static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, in s3c24xx_serial_pm() argument
1100 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_pm()
1107 while (--timeout && !s3c24xx_serial_txempty_nofifo(port)) in s3c24xx_serial_pm()
1124 dev_err(port->dev, "s3c24xx_serial: unknown pm %d\n", level); in s3c24xx_serial_pm()
1143 static inline int s3c24xx_serial_getsource(struct uart_port *port) in s3c24xx_serial_getsource() argument
1145 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_getsource()
1151 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_getsource()
1156 static void s3c24xx_serial_setsource(struct uart_port *port, in s3c24xx_serial_setsource() argument
1159 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_setsource()
1165 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_setsource()
1171 wr_regl(port, S3C2410_UCON, ucon); in s3c24xx_serial_setsource()
1192 clk = clk_get(ourport->port.dev, clkname); in s3c24xx_serial_getclk()
1258 static void s3c24xx_serial_set_termios(struct uart_port *port, in s3c24xx_serial_set_termios() argument
1262 struct s3c2410_uartcfg *cfg = s3c24xx_port_to_cfg(port); in s3c24xx_serial_set_termios()
1263 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_set_termios()
1281 baud = uart_get_baud_rate(port, termios, old, 0, 115200*8); in s3c24xx_serial_set_termios()
1283 if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) in s3c24xx_serial_set_termios()
1284 quot = port->custom_divisor; in s3c24xx_serial_set_termios()
1291 s3c24xx_serial_setsource(port, clk_sel); in s3c24xx_serial_set_termios()
1351 spin_lock_irqsave(&port->lock, flags); in s3c24xx_serial_set_termios()
1356 wr_regl(port, S3C2410_ULCON, ulcon); in s3c24xx_serial_set_termios()
1357 wr_regl(port, S3C2410_UBRDIV, quot); in s3c24xx_serial_set_termios()
1359 umcon = rd_regl(port, S3C2410_UMCON); in s3c24xx_serial_set_termios()
1367 wr_regl(port, S3C2410_UMCON, umcon); in s3c24xx_serial_set_termios()
1370 wr_regl(port, S3C2443_DIVSLOT, udivslot); in s3c24xx_serial_set_termios()
1373 rd_regl(port, S3C2410_ULCON), in s3c24xx_serial_set_termios()
1374 rd_regl(port, S3C2410_UCON), in s3c24xx_serial_set_termios()
1375 rd_regl(port, S3C2410_UFCON)); in s3c24xx_serial_set_termios()
1380 uart_update_timeout(port, termios->c_cflag, baud); in s3c24xx_serial_set_termios()
1385 port->read_status_mask = S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1387 port->read_status_mask |= S3C2410_UERSTAT_FRAME | in s3c24xx_serial_set_termios()
1392 port->ignore_status_mask = 0; in s3c24xx_serial_set_termios()
1394 port->ignore_status_mask |= S3C2410_UERSTAT_OVERRUN; in s3c24xx_serial_set_termios()
1396 port->ignore_status_mask |= S3C2410_UERSTAT_FRAME; in s3c24xx_serial_set_termios()
1402 port->ignore_status_mask |= RXSTAT_DUMMY_READ; in s3c24xx_serial_set_termios()
1404 spin_unlock_irqrestore(&port->lock, flags); in s3c24xx_serial_set_termios()
1407 static const char *s3c24xx_serial_type(struct uart_port *port) in s3c24xx_serial_type() argument
1409 switch (port->type) { in s3c24xx_serial_type()
1425 static void s3c24xx_serial_release_port(struct uart_port *port) in s3c24xx_serial_release_port() argument
1427 release_mem_region(port->mapbase, MAP_SIZE); in s3c24xx_serial_release_port()
1430 static int s3c24xx_serial_request_port(struct uart_port *port) in s3c24xx_serial_request_port() argument
1432 const char *name = s3c24xx_serial_portname(port); in s3c24xx_serial_request_port()
1433 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY; in s3c24xx_serial_request_port()
1436 static void s3c24xx_serial_config_port(struct uart_port *port, int flags) in s3c24xx_serial_config_port() argument
1438 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_config_port()
1441 s3c24xx_serial_request_port(port) == 0) in s3c24xx_serial_config_port()
1442 port->type = info->type; in s3c24xx_serial_config_port()
1449 s3c24xx_serial_verify_port(struct uart_port *port, struct serial_struct *ser) in s3c24xx_serial_verify_port() argument
1451 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_verify_port()
1477 static int s3c24xx_serial_get_poll_char(struct uart_port *port);
1478 static void s3c24xx_serial_put_poll_char(struct uart_port *port,
1516 __SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[i].port.lock)
1520 .port = {
1531 .port = {
1544 .port = {
1557 .port = {
1576 static void s3c24xx_serial_resetport(struct uart_port *port, in s3c24xx_serial_resetport() argument
1579 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_resetport()
1580 unsigned long ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_resetport()
1588 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); in s3c24xx_serial_resetport()
1591 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); in s3c24xx_serial_resetport()
1592 wr_regl(port, S3C2410_UFCON, cfg->ufcon); in s3c24xx_serial_resetport()
1604 struct s3c24xx_uart_port *port; in s3c24xx_serial_cpufreq_transition() local
1607 port = container_of(nb, struct s3c24xx_uart_port, freq_transition); in s3c24xx_serial_cpufreq_transition()
1608 uport = &port->port; in s3c24xx_serial_cpufreq_transition()
1612 if (port->pm_level != 0) in s3c24xx_serial_cpufreq_transition()
1620 if (IS_ERR(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1623 if (port->baudclk_rate == clk_get_rate(port->baudclk)) in s3c24xx_serial_cpufreq_transition()
1637 tty = uport->state->port.tty; in s3c24xx_serial_cpufreq_transition()
1657 s3c24xx_serial_cpufreq_register(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_register() argument
1659 port->freq_transition.notifier_call = s3c24xx_serial_cpufreq_transition; in s3c24xx_serial_cpufreq_register()
1661 return cpufreq_register_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_register()
1666 s3c24xx_serial_cpufreq_deregister(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_deregister() argument
1668 cpufreq_unregister_notifier(&port->freq_transition, in s3c24xx_serial_cpufreq_deregister()
1674 s3c24xx_serial_cpufreq_register(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_register() argument
1680 s3c24xx_serial_cpufreq_deregister(struct s3c24xx_uart_port *port) in s3c24xx_serial_cpufreq_deregister() argument
1693 struct uart_port *port = &ourport->port; in s3c24xx_serial_init_port() local
1698 dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev); in s3c24xx_serial_init_port()
1703 if (port->mapbase != 0) in s3c24xx_serial_init_port()
1707 port->dev = &platdev->dev; in s3c24xx_serial_init_port()
1710 if (s3c24xx_serial_has_interrupt_mask(port)) in s3c24xx_serial_init_port()
1713 port->uartclk = 1; in s3c24xx_serial_init_port()
1717 port->flags |= UPF_CONS_FLOW; in s3c24xx_serial_init_port()
1724 dev_err(port->dev, "failed to find memory resource for uart\n"); in s3c24xx_serial_init_port()
1730 port->membase = devm_ioremap(port->dev, res->start, resource_size(res)); in s3c24xx_serial_init_port()
1731 if (!port->membase) { in s3c24xx_serial_init_port()
1732 dev_err(port->dev, "failed to remap controller address\n"); in s3c24xx_serial_init_port()
1736 port->mapbase = res->start; in s3c24xx_serial_init_port()
1739 port->irq = 0; in s3c24xx_serial_init_port()
1741 port->irq = ret; in s3c24xx_serial_init_port()
1755 ourport->dma = devm_kzalloc(port->dev, in s3c24xx_serial_init_port()
1777 if (s3c24xx_serial_has_interrupt_mask(port)) { in s3c24xx_serial_init_port()
1778 wr_regl(port, S3C64XX_UINTM, 0xf); in s3c24xx_serial_init_port()
1779 wr_regl(port, S3C64XX_UINTP, 0xf); in s3c24xx_serial_init_port()
1780 wr_regl(port, S3C64XX_UINTSP, 0xf); in s3c24xx_serial_init_port()
1784 &port->mapbase, port->membase, port->irq, in s3c24xx_serial_init_port()
1785 ourport->rx_irq, ourport->tx_irq, port->uartclk); in s3c24xx_serial_init_port()
1788 s3c24xx_serial_resetport(port, cfg); in s3c24xx_serial_init_port()
1842 "samsung,uart-fifosize", &ourport->port.fifosize); in s3c24xx_serial_probe()
1845 ourport->port.fifosize = ourport->drv_data->fifosize[index]; in s3c24xx_serial_probe()
1847 ourport->port.fifosize = ourport->info->fifosize; in s3c24xx_serial_probe()
1853 ourport->min_dma_size = max_t(int, ourport->port.fifosize, in s3c24xx_serial_probe()
1873 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); in s3c24xx_serial_probe()
1874 platform_set_drvdata(pdev, &ourport->port); in s3c24xx_serial_probe()
1892 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); in s3c24xx_serial_remove() local
1894 if (port) { in s3c24xx_serial_remove()
1895 s3c24xx_serial_cpufreq_deregister(to_ourport(port)); in s3c24xx_serial_remove()
1896 uart_remove_one_port(&s3c24xx_uart_drv, port); in s3c24xx_serial_remove()
1908 struct uart_port *port = s3c24xx_dev_to_port(dev); in s3c24xx_serial_suspend() local
1910 if (port) in s3c24xx_serial_suspend()
1911 uart_suspend_port(&s3c24xx_uart_drv, port); in s3c24xx_serial_suspend()
1918 struct uart_port *port = s3c24xx_dev_to_port(dev); in s3c24xx_serial_resume() local
1919 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_resume()
1921 if (port) { in s3c24xx_serial_resume()
1923 s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port)); in s3c24xx_serial_resume()
1926 uart_resume_port(&s3c24xx_uart_drv, port); in s3c24xx_serial_resume()
1934 struct uart_port *port = s3c24xx_dev_to_port(dev); in s3c24xx_serial_resume_noirq() local
1936 if (port) { in s3c24xx_serial_resume_noirq()
1938 if (s3c24xx_serial_has_interrupt_mask(port)) { in s3c24xx_serial_resume_noirq()
1940 if (tx_enabled(port)) in s3c24xx_serial_resume_noirq()
1942 if (rx_enabled(port)) in s3c24xx_serial_resume_noirq()
1944 wr_regl(port, S3C64XX_UINTM, uintm); in s3c24xx_serial_resume_noirq()
1970 s3c24xx_serial_console_txrdy(struct uart_port *port, unsigned int ufcon) in s3c24xx_serial_console_txrdy() argument
1972 struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port); in s3c24xx_serial_console_txrdy()
1978 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_console_txrdy()
1984 utrstat = rd_regl(port, S3C2410_UTRSTAT); in s3c24xx_serial_console_txrdy()
2001 static int s3c24xx_serial_get_poll_char(struct uart_port *port) in s3c24xx_serial_get_poll_char() argument
2003 struct s3c24xx_uart_port *ourport = to_ourport(port); in s3c24xx_serial_get_poll_char()
2006 ufstat = rd_regl(port, S3C2410_UFSTAT); in s3c24xx_serial_get_poll_char()
2010 return rd_regb(port, S3C2410_URXH); in s3c24xx_serial_get_poll_char()
2013 static void s3c24xx_serial_put_poll_char(struct uart_port *port, in s3c24xx_serial_put_poll_char() argument
2016 unsigned int ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_put_poll_char()
2017 unsigned int ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_put_poll_char()
2023 while (!s3c24xx_serial_console_txrdy(port, ufcon)) in s3c24xx_serial_put_poll_char()
2025 wr_regb(port, S3C2410_UTXH, c); in s3c24xx_serial_put_poll_char()
2031 s3c24xx_serial_console_putchar(struct uart_port *port, int ch) in s3c24xx_serial_console_putchar() argument
2033 unsigned int ufcon = rd_regl(port, S3C2410_UFCON); in s3c24xx_serial_console_putchar()
2035 while (!s3c24xx_serial_console_txrdy(port, ufcon)) in s3c24xx_serial_console_putchar()
2037 wr_regb(port, S3C2410_UTXH, ch); in s3c24xx_serial_console_putchar()
2054 s3c24xx_serial_get_options(struct uart_port *port, int *baud, in s3c24xx_serial_get_options() argument
2065 ulcon = rd_regl(port, S3C2410_ULCON); in s3c24xx_serial_get_options()
2066 ucon = rd_regl(port, S3C2410_UCON); in s3c24xx_serial_get_options()
2067 ubrdiv = rd_regl(port, S3C2410_UBRDIV); in s3c24xx_serial_get_options()
2071 port, ulcon, ucon, ubrdiv); in s3c24xx_serial_get_options()
2106 clk_sel = s3c24xx_serial_getsource(port); in s3c24xx_serial_get_options()
2109 clk = clk_get(port->dev, clk_name); in s3c24xx_serial_get_options()
2124 struct uart_port *port; in s3c24xx_serial_console_setup() local
2138 port = &s3c24xx_serial_ports[co->index].port; in s3c24xx_serial_console_setup()
2142 if (port->mapbase == 0x0) in s3c24xx_serial_console_setup()
2145 cons_uart = port; in s3c24xx_serial_console_setup()
2147 dbg("s3c24xx_serial_console_setup: port=%p (%d)\n", port, co->index); in s3c24xx_serial_console_setup()
2157 s3c24xx_serial_get_options(port, &baud, &parity, &bits); in s3c24xx_serial_console_setup()
2161 return uart_set_options(port, co, baud, parity, bits, flow); in s3c24xx_serial_console_setup()
2425 static void samsung_early_busyuart(struct uart_port *port) in samsung_early_busyuart() argument
2427 while (!(readl(port->membase + S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXFE)) in samsung_early_busyuart()
2431 static void samsung_early_busyuart_fifo(struct uart_port *port) in samsung_early_busyuart_fifo() argument
2433 struct samsung_early_console_data *data = port->private_data; in samsung_early_busyuart_fifo()
2435 while (readl(port->membase + S3C2410_UFSTAT) & data->txfull_mask) in samsung_early_busyuart_fifo()
2439 static void samsung_early_putc(struct uart_port *port, int c) in samsung_early_putc() argument
2441 if (readl(port->membase + S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) in samsung_early_putc()
2442 samsung_early_busyuart_fifo(port); in samsung_early_putc()
2444 samsung_early_busyuart(port); in samsung_early_putc()
2446 writeb(c, port->membase + S3C2410_UTXH); in samsung_early_putc()
2453 uart_console_write(&dev->port, s, n, samsung_early_putc); in samsung_early_write()
2459 if (!device->port.membase) in samsung_early_console_setup()
2474 device->port.private_data = &s3c2410_early_console_data; in s3c2410_early_console_setup()
2489 device->port.private_data = &s3c2440_early_console_data; in s3c2440_early_console_setup()
2510 device->port.private_data = &s5pv210_early_console_data; in s5pv210_early_console_setup()