• Home
  • Raw
  • Download

Lines Matching refs:up

59 static int sport_uart_tx_chars(struct sport_uart_port *up);
62 static inline void tx_one_byte(struct sport_uart_port *up, unsigned int value) in tx_one_byte() argument
65 up->txmask1, up->txmask2); in tx_one_byte()
73 : [mask1]"d"(up->txmask1), [mask2]"d"(up->txmask2) in tx_one_byte()
78 SPORT_PUT_TX(up, value); in tx_one_byte()
81 static inline unsigned char rx_one_byte(struct sport_uart_port *up) in rx_one_byte() argument
87 if ((up->csize + up->stopb) > 7) in rx_one_byte()
88 value = SPORT_GET_RX32(up); in rx_one_byte()
90 value = SPORT_GET_RX(up); in rx_one_byte()
93 up->csize, up->rxmask); in rx_one_byte()
111 : [val]"d"(value), [rxmask]"d"(up->rxmask), [lc]"a"(up->csize) in rx_one_byte()
119 static int sport_uart_setup(struct sport_uart_port *up, int size, int baud_rate) in sport_uart_setup() argument
125 SPORT_PUT_TCR1(up, (LATFS | ITFS | TFSR | TLSBIT | ITCLK)); in sport_uart_setup()
126 SPORT_PUT_TCR2(up, size + 1); in sport_uart_setup()
127 pr_debug("%s TCR1:%x, TCR2:%x\n", __func__, SPORT_GET_TCR1(up), SPORT_GET_TCR2(up)); in sport_uart_setup()
130 SPORT_PUT_RCR1(up, (RCKFE | LARFS | LRFS | RFSR | IRCLK)); in sport_uart_setup()
131 SPORT_PUT_RCR2(up, (size + 1) * 2 - 1); in sport_uart_setup()
132 pr_debug("%s RCR1:%x, RCR2:%x\n", __func__, SPORT_GET_RCR1(up), SPORT_GET_RCR2(up)); in sport_uart_setup()
141 SPORT_PUT_TCLKDIV(up, tclkdiv); in sport_uart_setup()
142 SPORT_PUT_RCLKDIV(up, rclkdiv); in sport_uart_setup()
152 struct sport_uart_port *up = dev_id; in sport_uart_rx_irq() local
153 struct tty_port *port = &up->port.state->port; in sport_uart_rx_irq()
156 spin_lock(&up->port.lock); in sport_uart_rx_irq()
158 while (SPORT_GET_STAT(up) & RXNE) { in sport_uart_rx_irq()
159 ch = rx_one_byte(up); in sport_uart_rx_irq()
160 up->port.icount.rx++; in sport_uart_rx_irq()
162 if (!uart_handle_sysrq_char(&up->port, ch)) in sport_uart_rx_irq()
166 spin_unlock(&up->port.lock); in sport_uart_rx_irq()
176 struct sport_uart_port *up = dev_id; in sport_uart_tx_irq() local
178 spin_lock(&up->port.lock); in sport_uart_tx_irq()
179 sport_uart_tx_chars(up); in sport_uart_tx_irq()
180 spin_unlock(&up->port.lock); in sport_uart_tx_irq()
187 struct sport_uart_port *up = dev_id; in sport_uart_err_irq() local
188 unsigned int stat = SPORT_GET_STAT(up); in sport_uart_err_irq()
190 spin_lock(&up->port.lock); in sport_uart_err_irq()
194 up->port.icount.overrun++; in sport_uart_err_irq()
195 tty_insert_flip_char(&up->port.state->port, 0, TTY_OVERRUN); in sport_uart_err_irq()
196 SPORT_PUT_STAT(up, ROVF); /* Clear ROVF bit */ in sport_uart_err_irq()
204 SPORT_PUT_TCR1(up, SPORT_GET_TCR1(up) & ~TSPEN); in sport_uart_err_irq()
205 SPORT_PUT_RCR1(up, SPORT_GET_RCR1(up) & ~RSPEN); in sport_uart_err_irq()
209 spin_unlock(&up->port.lock); in sport_uart_err_irq()
218 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_get_mctrl() local
219 if (up->cts_pin < 0) in sport_get_mctrl()
223 if (SPORT_UART_GET_CTS(up)) in sport_get_mctrl()
231 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_set_mctrl() local
232 if (up->rts_pin < 0) in sport_set_mctrl()
237 SPORT_UART_ENABLE_RTS(up); in sport_set_mctrl()
239 SPORT_UART_DISABLE_RTS(up); in sport_set_mctrl()
247 struct sport_uart_port *up = (struct sport_uart_port *)dev_id; in sport_mctrl_cts_int() local
250 status = sport_get_mctrl(&up->port); in sport_mctrl_cts_int()
251 uart_handle_cts_change(&up->port, status & TIOCM_CTS); in sport_mctrl_cts_int()
271 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_startup() local
275 ret = request_irq(up->port.irq, sport_uart_rx_irq, 0, in sport_startup()
276 "SPORT_UART_RX", up); in sport_startup()
282 ret = request_irq(up->port.irq+1, sport_uart_tx_irq, 0, in sport_startup()
283 "SPORT_UART_TX", up); in sport_startup()
289 ret = request_irq(up->err_irq, sport_uart_err_irq, 0, in sport_startup()
290 "SPORT_UART_STATUS", up); in sport_startup()
297 if (up->cts_pin >= 0) { in sport_startup()
298 if (request_irq(gpio_to_irq(up->cts_pin), in sport_startup()
301 0, "BFIN_SPORT_UART_CTS", up)) { in sport_startup()
302 up->cts_pin = -1; in sport_startup()
306 if (up->rts_pin >= 0) { in sport_startup()
307 if (gpio_request(up->rts_pin, DRV_NAME)) { in sport_startup()
308 dev_info(port->dev, "fail to request RTS PIN at GPIO_%d\n", up->rts_pin); in sport_startup()
309 up->rts_pin = -1; in sport_startup()
311 gpio_direction_output(up->rts_pin, 0); in sport_startup()
317 free_irq(up->port.irq+1, up); in sport_startup()
319 free_irq(up->port.irq, up); in sport_startup()
330 static int sport_uart_tx_chars(struct sport_uart_port *up) in sport_uart_tx_chars() argument
332 struct circ_buf *xmit = &up->port.state->xmit; in sport_uart_tx_chars()
334 if (SPORT_GET_STAT(up) & TXF) in sport_uart_tx_chars()
337 if (up->port.x_char) { in sport_uart_tx_chars()
338 tx_one_byte(up, up->port.x_char); in sport_uart_tx_chars()
339 up->port.icount.tx++; in sport_uart_tx_chars()
340 up->port.x_char = 0; in sport_uart_tx_chars()
344 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { in sport_uart_tx_chars()
350 if (SPORT_GET_STAT(up) & TXHRE) in sport_uart_tx_chars()
351 sport_stop_tx(&up->port); in sport_uart_tx_chars()
355 while(!(SPORT_GET_STAT(up) & TXF) && !uart_circ_empty(xmit)) { in sport_uart_tx_chars()
356 tx_one_byte(up, xmit->buf[xmit->tail]); in sport_uart_tx_chars()
358 up->port.icount.tx++; in sport_uart_tx_chars()
362 uart_write_wakeup(&up->port); in sport_uart_tx_chars()
369 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_tx_empty() local
372 stat = SPORT_GET_STAT(up); in sport_tx_empty()
382 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_stop_tx() local
386 if (!(SPORT_GET_TCR1(up) & TSPEN)) in sport_stop_tx()
394 SPORT_PUT_TX(up, 0xffff); in sport_stop_tx()
395 while (!(SPORT_GET_STAT(up) & TXHRE)) in sport_stop_tx()
398 SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) & ~TSPEN)); in sport_stop_tx()
406 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_start_tx() local
411 if (sport_uart_tx_chars(up)) { in sport_start_tx()
413 SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) | TSPEN)); in sport_start_tx()
422 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_stop_rx() local
426 SPORT_PUT_RCR1(up, (SPORT_GET_RCR1(up) & ~RSPEN)); in sport_stop_rx()
437 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_shutdown() local
442 SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) & ~TSPEN)); in sport_shutdown()
443 SPORT_PUT_RCR1(up, (SPORT_GET_RCR1(up) & ~RSPEN)); in sport_shutdown()
446 free_irq(up->port.irq, up); in sport_shutdown()
447 free_irq(up->port.irq+1, up); in sport_shutdown()
448 free_irq(up->err_irq, up); in sport_shutdown()
450 if (up->cts_pin >= 0) in sport_shutdown()
451 free_irq(gpio_to_irq(up->cts_pin), up); in sport_shutdown()
452 if (up->rts_pin >= 0) in sport_shutdown()
453 gpio_free(up->rts_pin); in sport_shutdown()
459 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_type() local
462 return up->port.type == PORT_BFIN_SPORT ? "BFIN-SPORT-UART" : NULL; in sport_type()
478 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_config_port() local
481 up->port.type = PORT_BFIN_SPORT; in sport_config_port()
493 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_set_termios() local
500 if (old == NULL && up->cts_pin != -1) in sport_set_termios()
502 else if (up->cts_pin == -1) in sport_set_termios()
508 up->csize = 8; in sport_set_termios()
511 up->csize = 7; in sport_set_termios()
514 up->csize = 6; in sport_set_termios()
517 up->csize = 5; in sport_set_termios()
525 up->stopb = 1; in sport_set_termios()
532 spin_lock_irqsave(&up->port.lock, flags); in sport_set_termios()
542 up->rxmask = 0x01 | (((up->csize + up->stopb) * 2 - 1) << 0x8); in sport_set_termios()
547 for (i = 0, up->txmask1 = 0; i < up->csize; i++) in sport_set_termios()
548 up->txmask1 |= (1<<i); in sport_set_termios()
549 up->txmask2 = (1<<i); in sport_set_termios()
550 if (up->stopb) { in sport_set_termios()
552 up->txmask2 |= (1<<i); in sport_set_termios()
554 up->txmask1 <<= 1; in sport_set_termios()
555 up->txmask2 <<= 1; in sport_set_termios()
560 SPORT_PUT_TCR1(up, SPORT_GET_TCR1(up) & ~TSPEN); in sport_set_termios()
561 SPORT_PUT_RCR1(up, SPORT_GET_RCR1(up) & ~RSPEN); in sport_set_termios()
563 sport_uart_setup(up, up->csize + up->stopb, port->uartclk); in sport_set_termios()
568 SPORT_PUT_TX(up, 0xffff); in sport_set_termios()
569 SPORT_PUT_TX(up, 0xffff); in sport_set_termios()
570 SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) | TSPEN)); in sport_set_termios()
572 while (!(SPORT_GET_STAT(up) & TXHRE)) in sport_set_termios()
574 SPORT_PUT_TCR1(up, SPORT_GET_TCR1(up) & ~TSPEN); in sport_set_termios()
581 SPORT_PUT_RCR1(up, SPORT_GET_RCR1(up) | RSPEN); in sport_set_termios()
584 spin_unlock_irqrestore(&up->port.lock, flags); in sport_set_termios()
615 struct sport_uart_port *up; in sport_uart_console_setup() local
629 up = bfin_sport_uart_ports[co->index]; in sport_uart_console_setup()
630 if (!up) in sport_uart_console_setup()
636 return uart_set_options(&up->port, co, baud, parity, bits, flow); in sport_uart_console_setup()
641 struct sport_uart_port *up = (struct sport_uart_port *)port; in sport_uart_console_putchar() local
643 while (SPORT_GET_STAT(up) & TXF) in sport_uart_console_putchar()
646 tx_one_byte(up, ch); in sport_uart_console_putchar()
655 struct sport_uart_port *up = bfin_sport_uart_ports[co->index]; in sport_uart_console_write() local
658 spin_lock_irqsave(&up->port.lock, flags); in sport_uart_console_write()
660 if (SPORT_GET_TCR1(up) & TSPEN) in sport_uart_console_write()
661 uart_console_write(&up->port, s, count, sport_uart_console_putchar); in sport_uart_console_write()
664 while (SPORT_GET_STAT(up) & TXF) in sport_uart_console_write()
666 SPORT_PUT_TX(up, 0xffff); in sport_uart_console_write()
668 SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) | TSPEN)); in sport_uart_console_write()
671 uart_console_write(&up->port, s, count, sport_uart_console_putchar); in sport_uart_console_write()
678 while (SPORT_GET_STAT(up) & TXF) in sport_uart_console_write()
680 SPORT_PUT_TX(up, 0xffff); in sport_uart_console_write()
681 while (!(SPORT_GET_STAT(up) & TXHRE)) in sport_uart_console_write()
685 SPORT_PUT_TCR1(up, (SPORT_GET_TCR1(up) & ~TSPEN)); in sport_uart_console_write()
689 spin_unlock_irqrestore(&up->port.lock, flags); in sport_uart_console_write()