• Home
  • Raw
  • Download

Lines Matching refs:up

59 static inline unsigned int serial_in(struct uart_pxa_port *up, int offset)  in serial_in()  argument
62 return readl(up->port.membase + offset); in serial_in()
65 static inline void serial_out(struct uart_pxa_port *up, int offset, int value) in serial_out() argument
68 writel(value, up->port.membase + offset); in serial_out()
73 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_enable_ms() local
75 up->ier |= UART_IER_MSI; in serial_pxa_enable_ms()
76 serial_out(up, UART_IER, up->ier); in serial_pxa_enable_ms()
81 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_stop_tx() local
83 if (up->ier & UART_IER_THRI) { in serial_pxa_stop_tx()
84 up->ier &= ~UART_IER_THRI; in serial_pxa_stop_tx()
85 serial_out(up, UART_IER, up->ier); in serial_pxa_stop_tx()
91 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_stop_rx() local
93 up->ier &= ~UART_IER_RLSI; in serial_pxa_stop_rx()
94 up->port.read_status_mask &= ~UART_LSR_DR; in serial_pxa_stop_rx()
95 serial_out(up, UART_IER, up->ier); in serial_pxa_stop_rx()
98 static inline void receive_chars(struct uart_pxa_port *up, int *status) in receive_chars() argument
111 up->ier &= ~UART_IER_RTOIE; in receive_chars()
112 serial_out(up, UART_IER, up->ier); in receive_chars()
114 ch = serial_in(up, UART_RX); in receive_chars()
116 up->port.icount.rx++; in receive_chars()
125 up->port.icount.brk++; in receive_chars()
132 if (uart_handle_break(&up->port)) in receive_chars()
135 up->port.icount.parity++; in receive_chars()
137 up->port.icount.frame++; in receive_chars()
139 up->port.icount.overrun++; in receive_chars()
144 *status &= up->port.read_status_mask; in receive_chars()
147 if (up->port.line == up->port.cons->index) { in receive_chars()
149 *status |= up->lsr_break_flag; in receive_chars()
150 up->lsr_break_flag = 0; in receive_chars()
161 if (uart_handle_sysrq_char(&up->port, ch)) in receive_chars()
164 uart_insert_char(&up->port, *status, UART_LSR_OE, ch, flag); in receive_chars()
167 *status = serial_in(up, UART_LSR); in receive_chars()
169 tty_flip_buffer_push(&up->port.state->port); in receive_chars()
178 up->ier |= UART_IER_RTOIE; in receive_chars()
179 serial_out(up, UART_IER, up->ier); in receive_chars()
182 static void transmit_chars(struct uart_pxa_port *up) in transmit_chars() argument
184 struct circ_buf *xmit = &up->port.state->xmit; in transmit_chars()
187 if (up->port.x_char) { in transmit_chars()
188 serial_out(up, UART_TX, up->port.x_char); in transmit_chars()
189 up->port.icount.tx++; in transmit_chars()
190 up->port.x_char = 0; in transmit_chars()
193 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { in transmit_chars()
194 serial_pxa_stop_tx(&up->port); in transmit_chars()
198 count = up->port.fifosize / 2; in transmit_chars()
200 serial_out(up, UART_TX, xmit->buf[xmit->tail]); in transmit_chars()
202 up->port.icount.tx++; in transmit_chars()
208 uart_write_wakeup(&up->port); in transmit_chars()
212 serial_pxa_stop_tx(&up->port); in transmit_chars()
217 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_start_tx() local
219 if (!(up->ier & UART_IER_THRI)) { in serial_pxa_start_tx()
220 up->ier |= UART_IER_THRI; in serial_pxa_start_tx()
221 serial_out(up, UART_IER, up->ier); in serial_pxa_start_tx()
226 static inline void check_modem_status(struct uart_pxa_port *up) in check_modem_status() argument
230 status = serial_in(up, UART_MSR); in check_modem_status()
236 up->port.icount.rng++; in check_modem_status()
238 up->port.icount.dsr++; in check_modem_status()
240 uart_handle_dcd_change(&up->port, status & UART_MSR_DCD); in check_modem_status()
242 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); in check_modem_status()
244 wake_up_interruptible(&up->port.state->port.delta_msr_wait); in check_modem_status()
252 struct uart_pxa_port *up = dev_id; in serial_pxa_irq() local
255 iir = serial_in(up, UART_IIR); in serial_pxa_irq()
258 spin_lock(&up->port.lock); in serial_pxa_irq()
259 lsr = serial_in(up, UART_LSR); in serial_pxa_irq()
261 receive_chars(up, &lsr); in serial_pxa_irq()
262 check_modem_status(up); in serial_pxa_irq()
264 transmit_chars(up); in serial_pxa_irq()
265 spin_unlock(&up->port.lock); in serial_pxa_irq()
271 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_tx_empty() local
275 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_tx_empty()
276 ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0; in serial_pxa_tx_empty()
277 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_tx_empty()
284 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_get_mctrl() local
288 status = serial_in(up, UART_MSR); in serial_pxa_get_mctrl()
304 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_set_mctrl() local
318 mcr |= up->mcr; in serial_pxa_set_mctrl()
320 serial_out(up, UART_MCR, mcr); in serial_pxa_set_mctrl()
325 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_break_ctl() local
328 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_break_ctl()
330 up->lcr |= UART_LCR_SBC; in serial_pxa_break_ctl()
332 up->lcr &= ~UART_LCR_SBC; in serial_pxa_break_ctl()
333 serial_out(up, UART_LCR, up->lcr); in serial_pxa_break_ctl()
334 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_break_ctl()
339 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_startup() local
344 up->mcr |= UART_MCR_AFE; in serial_pxa_startup()
346 up->mcr = 0; in serial_pxa_startup()
348 up->port.uartclk = clk_get_rate(up->clk); in serial_pxa_startup()
353 retval = request_irq(up->port.irq, serial_pxa_irq, 0, up->name, up); in serial_pxa_startup()
361 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); in serial_pxa_startup()
362 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | in serial_pxa_startup()
364 serial_out(up, UART_FCR, 0); in serial_pxa_startup()
369 (void) serial_in(up, UART_LSR); in serial_pxa_startup()
370 (void) serial_in(up, UART_RX); in serial_pxa_startup()
371 (void) serial_in(up, UART_IIR); in serial_pxa_startup()
372 (void) serial_in(up, UART_MSR); in serial_pxa_startup()
377 serial_out(up, UART_LCR, UART_LCR_WLEN8); in serial_pxa_startup()
379 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_startup()
380 up->port.mctrl |= TIOCM_OUT2; in serial_pxa_startup()
381 serial_pxa_set_mctrl(&up->port, up->port.mctrl); in serial_pxa_startup()
382 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_startup()
389 up->ier = UART_IER_RLSI | UART_IER_RDI | UART_IER_RTOIE | UART_IER_UUE; in serial_pxa_startup()
390 serial_out(up, UART_IER, up->ier); in serial_pxa_startup()
395 (void) serial_in(up, UART_LSR); in serial_pxa_startup()
396 (void) serial_in(up, UART_RX); in serial_pxa_startup()
397 (void) serial_in(up, UART_IIR); in serial_pxa_startup()
398 (void) serial_in(up, UART_MSR); in serial_pxa_startup()
405 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_shutdown() local
408 free_irq(up->port.irq, up); in serial_pxa_shutdown()
413 up->ier = 0; in serial_pxa_shutdown()
414 serial_out(up, UART_IER, 0); in serial_pxa_shutdown()
416 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_shutdown()
417 up->port.mctrl &= ~TIOCM_OUT2; in serial_pxa_shutdown()
418 serial_pxa_set_mctrl(&up->port, up->port.mctrl); in serial_pxa_shutdown()
419 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_shutdown()
424 serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC); in serial_pxa_shutdown()
425 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | in serial_pxa_shutdown()
428 serial_out(up, UART_FCR, 0); in serial_pxa_shutdown()
435 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_set_termios() local
470 if ((up->port.uartclk / quot) < (2400 * 16)) in serial_pxa_set_termios()
472 else if ((up->port.uartclk / quot) < (230400 * 16)) in serial_pxa_set_termios()
481 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_set_termios()
487 up->ier |= UART_IER_UUE; in serial_pxa_set_termios()
494 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; in serial_pxa_set_termios()
496 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; in serial_pxa_set_termios()
498 up->port.read_status_mask |= UART_LSR_BI; in serial_pxa_set_termios()
503 up->port.ignore_status_mask = 0; in serial_pxa_set_termios()
505 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; in serial_pxa_set_termios()
507 up->port.ignore_status_mask |= UART_LSR_BI; in serial_pxa_set_termios()
513 up->port.ignore_status_mask |= UART_LSR_OE; in serial_pxa_set_termios()
520 up->port.ignore_status_mask |= UART_LSR_DR; in serial_pxa_set_termios()
525 up->ier &= ~UART_IER_MSI; in serial_pxa_set_termios()
526 if (UART_ENABLE_MS(&up->port, termios->c_cflag)) in serial_pxa_set_termios()
527 up->ier |= UART_IER_MSI; in serial_pxa_set_termios()
529 serial_out(up, UART_IER, up->ier); in serial_pxa_set_termios()
532 up->mcr |= UART_MCR_AFE; in serial_pxa_set_termios()
534 up->mcr &= ~UART_MCR_AFE; in serial_pxa_set_termios()
536 serial_out(up, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */ in serial_pxa_set_termios()
537 serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */ in serial_pxa_set_termios()
543 dll = serial_in(up, UART_DLL); in serial_pxa_set_termios()
546 serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */ in serial_pxa_set_termios()
547 serial_out(up, UART_LCR, cval); /* reset DLAB */ in serial_pxa_set_termios()
548 up->lcr = cval; /* Save LCR */ in serial_pxa_set_termios()
549 serial_pxa_set_mctrl(&up->port, up->port.mctrl); in serial_pxa_set_termios()
550 serial_out(up, UART_FCR, fcr); in serial_pxa_set_termios()
551 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_set_termios()
558 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_pm() local
561 clk_prepare_enable(up->clk); in serial_pxa_pm()
563 clk_disable_unprepare(up->clk); in serial_pxa_pm()
577 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_config_port() local
578 up->port.type = PORT_PXA; in serial_pxa_config_port()
591 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_type() local
592 return up->name; in serial_pxa_type()
605 static void wait_for_xmitr(struct uart_pxa_port *up) in wait_for_xmitr() argument
611 status = serial_in(up, UART_LSR); in wait_for_xmitr()
614 up->lsr_break_flag = UART_LSR_BI; in wait_for_xmitr()
622 if (up->port.flags & UPF_CONS_FLOW) { in wait_for_xmitr()
625 ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0)) in wait_for_xmitr()
632 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_console_putchar() local
634 wait_for_xmitr(up); in serial_pxa_console_putchar()
635 serial_out(up, UART_TX, ch); in serial_pxa_console_putchar()
647 struct uart_pxa_port *up = serial_pxa_ports[co->index]; in serial_pxa_console_write() local
652 clk_enable(up->clk); in serial_pxa_console_write()
654 if (up->port.sysrq) in serial_pxa_console_write()
657 locked = spin_trylock(&up->port.lock); in serial_pxa_console_write()
659 spin_lock(&up->port.lock); in serial_pxa_console_write()
664 ier = serial_in(up, UART_IER); in serial_pxa_console_write()
665 serial_out(up, UART_IER, UART_IER_UUE); in serial_pxa_console_write()
667 uart_console_write(&up->port, s, count, serial_pxa_console_putchar); in serial_pxa_console_write()
673 wait_for_xmitr(up); in serial_pxa_console_write()
674 serial_out(up, UART_IER, ier); in serial_pxa_console_write()
677 spin_unlock(&up->port.lock); in serial_pxa_console_write()
679 clk_disable(up->clk); in serial_pxa_console_write()
691 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_get_poll_char() local
692 unsigned char lsr = serial_in(up, UART_LSR); in serial_pxa_get_poll_char()
695 lsr = serial_in(up, UART_LSR); in serial_pxa_get_poll_char()
697 return serial_in(up, UART_RX); in serial_pxa_get_poll_char()
705 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_put_poll_char() local
710 ier = serial_in(up, UART_IER); in serial_pxa_put_poll_char()
711 serial_out(up, UART_IER, UART_IER_UUE); in serial_pxa_put_poll_char()
713 wait_for_xmitr(up); in serial_pxa_put_poll_char()
717 serial_out(up, UART_TX, c); in serial_pxa_put_poll_char()
723 wait_for_xmitr(up); in serial_pxa_put_poll_char()
724 serial_out(up, UART_IER, ier); in serial_pxa_put_poll_char()
732 struct uart_pxa_port *up; in serial_pxa_console_setup() local
740 up = serial_pxa_ports[co->index]; in serial_pxa_console_setup()
741 if (!up) in serial_pxa_console_setup()
747 return uart_set_options(&up->port, co, baud, parity, bits, flow); in serial_pxa_console_setup()