• Home
  • Raw
  • Download

Lines Matching refs:up

51 static inline unsigned int serial_in(struct uart_pxa_port *up, int offset)  in serial_in()  argument
54 return readl(up->port.membase + offset); in serial_in()
57 static inline void serial_out(struct uart_pxa_port *up, int offset, int value) in serial_out() argument
60 writel(value, up->port.membase + offset); in serial_out()
65 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_enable_ms() local
67 up->ier |= UART_IER_MSI; in serial_pxa_enable_ms()
68 serial_out(up, UART_IER, up->ier); in serial_pxa_enable_ms()
73 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_stop_tx() local
75 if (up->ier & UART_IER_THRI) { in serial_pxa_stop_tx()
76 up->ier &= ~UART_IER_THRI; in serial_pxa_stop_tx()
77 serial_out(up, UART_IER, up->ier); in serial_pxa_stop_tx()
83 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_stop_rx() local
85 up->ier &= ~UART_IER_RLSI; in serial_pxa_stop_rx()
86 up->port.read_status_mask &= ~UART_LSR_DR; in serial_pxa_stop_rx()
87 serial_out(up, UART_IER, up->ier); in serial_pxa_stop_rx()
90 static inline void receive_chars(struct uart_pxa_port *up, int *status) in receive_chars() argument
103 up->ier &= ~UART_IER_RTOIE; in receive_chars()
104 serial_out(up, UART_IER, up->ier); in receive_chars()
106 ch = serial_in(up, UART_RX); in receive_chars()
108 up->port.icount.rx++; in receive_chars()
117 up->port.icount.brk++; in receive_chars()
124 if (uart_handle_break(&up->port)) in receive_chars()
127 up->port.icount.parity++; in receive_chars()
129 up->port.icount.frame++; in receive_chars()
131 up->port.icount.overrun++; in receive_chars()
136 *status &= up->port.read_status_mask; in receive_chars()
139 if (up->port.line == up->port.cons->index) { in receive_chars()
141 *status |= up->lsr_break_flag; in receive_chars()
142 up->lsr_break_flag = 0; in receive_chars()
153 if (uart_handle_sysrq_char(&up->port, ch)) in receive_chars()
156 uart_insert_char(&up->port, *status, UART_LSR_OE, ch, flag); in receive_chars()
159 *status = serial_in(up, UART_LSR); in receive_chars()
161 tty_flip_buffer_push(&up->port.state->port); in receive_chars()
170 up->ier |= UART_IER_RTOIE; in receive_chars()
171 serial_out(up, UART_IER, up->ier); in receive_chars()
174 static void transmit_chars(struct uart_pxa_port *up) in transmit_chars() argument
176 struct circ_buf *xmit = &up->port.state->xmit; in transmit_chars()
179 if (up->port.x_char) { in transmit_chars()
180 serial_out(up, UART_TX, up->port.x_char); in transmit_chars()
181 up->port.icount.tx++; in transmit_chars()
182 up->port.x_char = 0; in transmit_chars()
185 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { in transmit_chars()
186 serial_pxa_stop_tx(&up->port); in transmit_chars()
190 count = up->port.fifosize / 2; in transmit_chars()
192 serial_out(up, UART_TX, xmit->buf[xmit->tail]); in transmit_chars()
194 up->port.icount.tx++; in transmit_chars()
200 uart_write_wakeup(&up->port); in transmit_chars()
204 serial_pxa_stop_tx(&up->port); in transmit_chars()
209 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_start_tx() local
211 if (!(up->ier & UART_IER_THRI)) { in serial_pxa_start_tx()
212 up->ier |= UART_IER_THRI; in serial_pxa_start_tx()
213 serial_out(up, UART_IER, up->ier); in serial_pxa_start_tx()
218 static inline void check_modem_status(struct uart_pxa_port *up) in check_modem_status() argument
222 status = serial_in(up, UART_MSR); in check_modem_status()
228 up->port.icount.rng++; in check_modem_status()
230 up->port.icount.dsr++; in check_modem_status()
232 uart_handle_dcd_change(&up->port, status & UART_MSR_DCD); in check_modem_status()
234 uart_handle_cts_change(&up->port, status & UART_MSR_CTS); in check_modem_status()
236 wake_up_interruptible(&up->port.state->port.delta_msr_wait); in check_modem_status()
244 struct uart_pxa_port *up = dev_id; in serial_pxa_irq() local
247 iir = serial_in(up, UART_IIR); in serial_pxa_irq()
250 spin_lock(&up->port.lock); in serial_pxa_irq()
251 lsr = serial_in(up, UART_LSR); in serial_pxa_irq()
253 receive_chars(up, &lsr); in serial_pxa_irq()
254 check_modem_status(up); in serial_pxa_irq()
256 transmit_chars(up); in serial_pxa_irq()
257 spin_unlock(&up->port.lock); in serial_pxa_irq()
263 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_tx_empty() local
267 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_tx_empty()
268 ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0; in serial_pxa_tx_empty()
269 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_tx_empty()
276 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_get_mctrl() local
280 status = serial_in(up, UART_MSR); in serial_pxa_get_mctrl()
296 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_set_mctrl() local
310 mcr |= up->mcr; in serial_pxa_set_mctrl()
312 serial_out(up, UART_MCR, mcr); in serial_pxa_set_mctrl()
317 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_break_ctl() local
320 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_break_ctl()
322 up->lcr |= UART_LCR_SBC; in serial_pxa_break_ctl()
324 up->lcr &= ~UART_LCR_SBC; in serial_pxa_break_ctl()
325 serial_out(up, UART_LCR, up->lcr); in serial_pxa_break_ctl()
326 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_break_ctl()
331 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_startup() local
336 up->mcr |= UART_MCR_AFE; in serial_pxa_startup()
338 up->mcr = 0; in serial_pxa_startup()
340 up->port.uartclk = clk_get_rate(up->clk); in serial_pxa_startup()
345 retval = request_irq(up->port.irq, serial_pxa_irq, 0, up->name, up); in serial_pxa_startup()
353 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); in serial_pxa_startup()
354 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | in serial_pxa_startup()
356 serial_out(up, UART_FCR, 0); in serial_pxa_startup()
361 (void) serial_in(up, UART_LSR); in serial_pxa_startup()
362 (void) serial_in(up, UART_RX); in serial_pxa_startup()
363 (void) serial_in(up, UART_IIR); in serial_pxa_startup()
364 (void) serial_in(up, UART_MSR); in serial_pxa_startup()
369 serial_out(up, UART_LCR, UART_LCR_WLEN8); in serial_pxa_startup()
371 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_startup()
372 up->port.mctrl |= TIOCM_OUT2; in serial_pxa_startup()
373 serial_pxa_set_mctrl(&up->port, up->port.mctrl); in serial_pxa_startup()
374 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_startup()
381 up->ier = UART_IER_RLSI | UART_IER_RDI | UART_IER_RTOIE | UART_IER_UUE; in serial_pxa_startup()
382 serial_out(up, UART_IER, up->ier); in serial_pxa_startup()
387 (void) serial_in(up, UART_LSR); in serial_pxa_startup()
388 (void) serial_in(up, UART_RX); in serial_pxa_startup()
389 (void) serial_in(up, UART_IIR); in serial_pxa_startup()
390 (void) serial_in(up, UART_MSR); in serial_pxa_startup()
397 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_shutdown() local
400 free_irq(up->port.irq, up); in serial_pxa_shutdown()
405 up->ier = 0; in serial_pxa_shutdown()
406 serial_out(up, UART_IER, 0); in serial_pxa_shutdown()
408 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_shutdown()
409 up->port.mctrl &= ~TIOCM_OUT2; in serial_pxa_shutdown()
410 serial_pxa_set_mctrl(&up->port, up->port.mctrl); in serial_pxa_shutdown()
411 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_shutdown()
416 serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC); in serial_pxa_shutdown()
417 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | in serial_pxa_shutdown()
420 serial_out(up, UART_FCR, 0); in serial_pxa_shutdown()
427 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_set_termios() local
462 if ((up->port.uartclk / quot) < (2400 * 16)) in serial_pxa_set_termios()
464 else if ((up->port.uartclk / quot) < (230400 * 16)) in serial_pxa_set_termios()
473 spin_lock_irqsave(&up->port.lock, flags); in serial_pxa_set_termios()
479 up->ier |= UART_IER_UUE; in serial_pxa_set_termios()
486 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; in serial_pxa_set_termios()
488 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; in serial_pxa_set_termios()
490 up->port.read_status_mask |= UART_LSR_BI; in serial_pxa_set_termios()
495 up->port.ignore_status_mask = 0; in serial_pxa_set_termios()
497 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; in serial_pxa_set_termios()
499 up->port.ignore_status_mask |= UART_LSR_BI; in serial_pxa_set_termios()
505 up->port.ignore_status_mask |= UART_LSR_OE; in serial_pxa_set_termios()
512 up->port.ignore_status_mask |= UART_LSR_DR; in serial_pxa_set_termios()
517 up->ier &= ~UART_IER_MSI; in serial_pxa_set_termios()
518 if (UART_ENABLE_MS(&up->port, termios->c_cflag)) in serial_pxa_set_termios()
519 up->ier |= UART_IER_MSI; in serial_pxa_set_termios()
521 serial_out(up, UART_IER, up->ier); in serial_pxa_set_termios()
524 up->mcr |= UART_MCR_AFE; in serial_pxa_set_termios()
526 up->mcr &= ~UART_MCR_AFE; in serial_pxa_set_termios()
528 serial_out(up, UART_LCR, cval | UART_LCR_DLAB); /* set DLAB */ in serial_pxa_set_termios()
529 serial_out(up, UART_DLL, quot & 0xff); /* LS of divisor */ in serial_pxa_set_termios()
535 dll = serial_in(up, UART_DLL); in serial_pxa_set_termios()
538 serial_out(up, UART_DLM, quot >> 8); /* MS of divisor */ in serial_pxa_set_termios()
539 serial_out(up, UART_LCR, cval); /* reset DLAB */ in serial_pxa_set_termios()
540 up->lcr = cval; /* Save LCR */ in serial_pxa_set_termios()
541 serial_pxa_set_mctrl(&up->port, up->port.mctrl); in serial_pxa_set_termios()
542 serial_out(up, UART_FCR, fcr); in serial_pxa_set_termios()
543 spin_unlock_irqrestore(&up->port.lock, flags); in serial_pxa_set_termios()
550 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_pm() local
553 clk_prepare_enable(up->clk); in serial_pxa_pm()
555 clk_disable_unprepare(up->clk); in serial_pxa_pm()
569 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_config_port() local
570 up->port.type = PORT_PXA; in serial_pxa_config_port()
583 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_type() local
584 return up->name; in serial_pxa_type()
597 static void wait_for_xmitr(struct uart_pxa_port *up) in wait_for_xmitr() argument
603 status = serial_in(up, UART_LSR); in wait_for_xmitr()
606 up->lsr_break_flag = UART_LSR_BI; in wait_for_xmitr()
614 if (up->port.flags & UPF_CONS_FLOW) { in wait_for_xmitr()
617 ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0)) in wait_for_xmitr()
624 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_console_putchar() local
626 wait_for_xmitr(up); in serial_pxa_console_putchar()
627 serial_out(up, UART_TX, ch); in serial_pxa_console_putchar()
639 struct uart_pxa_port *up = serial_pxa_ports[co->index]; in serial_pxa_console_write() local
644 clk_enable(up->clk); in serial_pxa_console_write()
646 if (up->port.sysrq) in serial_pxa_console_write()
649 locked = spin_trylock(&up->port.lock); in serial_pxa_console_write()
651 spin_lock(&up->port.lock); in serial_pxa_console_write()
656 ier = serial_in(up, UART_IER); in serial_pxa_console_write()
657 serial_out(up, UART_IER, UART_IER_UUE); in serial_pxa_console_write()
659 uart_console_write(&up->port, s, count, serial_pxa_console_putchar); in serial_pxa_console_write()
665 wait_for_xmitr(up); in serial_pxa_console_write()
666 serial_out(up, UART_IER, ier); in serial_pxa_console_write()
669 spin_unlock(&up->port.lock); in serial_pxa_console_write()
671 clk_disable(up->clk); in serial_pxa_console_write()
683 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_get_poll_char() local
684 unsigned char lsr = serial_in(up, UART_LSR); in serial_pxa_get_poll_char()
687 lsr = serial_in(up, UART_LSR); in serial_pxa_get_poll_char()
689 return serial_in(up, UART_RX); in serial_pxa_get_poll_char()
697 struct uart_pxa_port *up = (struct uart_pxa_port *)port; in serial_pxa_put_poll_char() local
702 ier = serial_in(up, UART_IER); in serial_pxa_put_poll_char()
703 serial_out(up, UART_IER, UART_IER_UUE); in serial_pxa_put_poll_char()
705 wait_for_xmitr(up); in serial_pxa_put_poll_char()
709 serial_out(up, UART_TX, c); in serial_pxa_put_poll_char()
715 wait_for_xmitr(up); in serial_pxa_put_poll_char()
716 serial_out(up, UART_IER, ier); in serial_pxa_put_poll_char()
724 struct uart_pxa_port *up; in serial_pxa_console_setup() local
732 up = serial_pxa_ports[co->index]; in serial_pxa_console_setup()
733 if (!up) in serial_pxa_console_setup()
739 return uart_set_options(&up->port, co, baud, parity, bits, flow); in serial_pxa_console_setup()