Lines Matching full:up
232 static void rp2_rmw(struct rp2_uart_port *up, int reg, in rp2_rmw() argument
235 u32 tmp = readl(up->base + reg); in rp2_rmw()
238 writel(tmp, up->base + reg); in rp2_rmw()
241 static void rp2_rmw_clr(struct rp2_uart_port *up, int reg, u32 val) in rp2_rmw_clr() argument
243 rp2_rmw(up, reg, val, 0); in rp2_rmw_clr()
246 static void rp2_rmw_set(struct rp2_uart_port *up, int reg, u32 val) in rp2_rmw_set() argument
248 rp2_rmw(up, reg, 0, val); in rp2_rmw_set()
251 static void rp2_mask_ch_irq(struct rp2_uart_port *up, int ch_num, in rp2_mask_ch_irq() argument
256 spin_lock_irqsave(&up->card->card_lock, flags); in rp2_mask_ch_irq()
258 irq_mask = readl(up->asic_base + RP2_CH_IRQ_MASK); in rp2_mask_ch_irq()
263 writel(irq_mask, up->asic_base + RP2_CH_IRQ_MASK); in rp2_mask_ch_irq()
265 spin_unlock_irqrestore(&up->card->card_lock, flags); in rp2_mask_ch_irq()
270 struct rp2_uart_port *up = port_to_up(port); in rp2_uart_tx_empty() local
278 uart_port_lock_irqsave(&up->port, &flags); in rp2_uart_tx_empty()
279 tx_fifo_bytes = readw(up->base + RP2_TX_FIFO_COUNT); in rp2_uart_tx_empty()
280 uart_port_unlock_irqrestore(&up->port, flags); in rp2_uart_tx_empty()
287 struct rp2_uart_port *up = port_to_up(port); in rp2_uart_get_mctrl() local
290 status = readl(up->base + RP2_CHAN_STAT); in rp2_uart_get_mctrl()
336 static void __rp2_uart_set_termios(struct rp2_uart_port *up, in __rp2_uart_set_termios() argument
342 writew(baud_div - 1, up->base + RP2_BAUD); in __rp2_uart_set_termios()
345 rp2_rmw(up, RP2_UART_CTL, in __rp2_uart_set_termios()
354 rp2_rmw(up, RP2_TXRX_CTL, in __rp2_uart_set_termios()
367 up->ucode + RP2_TX_SWFLOW); in __rp2_uart_set_termios()
369 up->ucode + RP2_RX_SWFLOW); in __rp2_uart_set_termios()
375 struct rp2_uart_port *up = port_to_up(port); in rp2_uart_set_termios() local
390 __rp2_uart_set_termios(up, new->c_cflag, new->c_iflag, baud_div); in rp2_uart_set_termios()
396 static void rp2_rx_chars(struct rp2_uart_port *up) in rp2_rx_chars() argument
398 u16 bytes = readw(up->base + RP2_RX_FIFO_COUNT); in rp2_rx_chars()
399 struct tty_port *port = &up->port.state->port; in rp2_rx_chars()
402 u32 byte = readw(up->base + RP2_DATA_BYTE) | RP2_DUMMY_READ; in rp2_rx_chars()
406 if (!uart_handle_sysrq_char(&up->port, ch)) in rp2_rx_chars()
407 uart_insert_char(&up->port, byte, 0, ch, in rp2_rx_chars()
418 uart_insert_char(&up->port, byte, in rp2_rx_chars()
421 up->port.icount.rx++; in rp2_rx_chars()
427 static void rp2_tx_chars(struct rp2_uart_port *up) in rp2_tx_chars() argument
431 uart_port_tx_limited(&up->port, ch, in rp2_tx_chars()
432 FIFO_SIZE - readw(up->base + RP2_TX_FIFO_COUNT), in rp2_tx_chars()
434 writeb(ch, up->base + RP2_DATA_BYTE), in rp2_tx_chars()
438 static void rp2_ch_interrupt(struct rp2_uart_port *up) in rp2_ch_interrupt() argument
442 uart_port_lock(&up->port); in rp2_ch_interrupt()
448 status = readl(up->base + RP2_CHAN_STAT); in rp2_ch_interrupt()
449 writel(status, up->base + RP2_CHAN_STAT); in rp2_ch_interrupt()
452 rp2_rx_chars(up); in rp2_ch_interrupt()
454 rp2_tx_chars(up); in rp2_ch_interrupt()
456 wake_up_interruptible(&up->port.state->port.delta_msr_wait); in rp2_ch_interrupt()
458 uart_port_unlock(&up->port); in rp2_ch_interrupt()
487 static inline void rp2_flush_fifos(struct rp2_uart_port *up) in rp2_flush_fifos() argument
489 rp2_rmw_set(up, RP2_UART_CTL, in rp2_flush_fifos()
491 readl(up->base + RP2_UART_CTL); in rp2_flush_fifos()
493 rp2_rmw_clr(up, RP2_UART_CTL, in rp2_flush_fifos()
499 struct rp2_uart_port *up = port_to_up(port); in rp2_uart_startup() local
501 rp2_flush_fifos(up); in rp2_uart_startup()
502 rp2_rmw(up, RP2_TXRX_CTL, RP2_TXRX_CTL_MSRIRQ_m, RP2_TXRX_CTL_RXIRQ_m); in rp2_uart_startup()
503 rp2_rmw(up, RP2_TXRX_CTL, RP2_TXRX_CTL_RX_TRIG_m, in rp2_uart_startup()
505 rp2_rmw(up, RP2_CHAN_STAT, 0, 0); in rp2_uart_startup()
506 rp2_mask_ch_irq(up, up->idx, 1); in rp2_uart_startup()
513 struct rp2_uart_port *up = port_to_up(port); in rp2_uart_shutdown() local
519 rp2_mask_ch_irq(up, up->idx, 0); in rp2_uart_shutdown()
520 rp2_rmw(up, RP2_CHAN_STAT, 0, 0); in rp2_uart_shutdown()
606 static void rp2_init_port(struct rp2_uart_port *up, const struct firmware *fw) in rp2_init_port() argument
610 writel(RP2_UART_CTL_RESET_CH_m, up->base + RP2_UART_CTL); in rp2_init_port()
611 readl(up->base + RP2_UART_CTL); in rp2_init_port()
614 writel(0, up->base + RP2_TXRX_CTL); in rp2_init_port()
615 writel(0, up->base + RP2_UART_CTL); in rp2_init_port()
616 readl(up->base + RP2_UART_CTL); in rp2_init_port()
619 rp2_flush_fifos(up); in rp2_init_port()
622 writeb(fw->data[i], up->ucode + i); in rp2_init_port()
624 __rp2_uart_set_termios(up, CS8 | CREAD | CLOCAL, 0, DEFAULT_BAUD_DIV); in rp2_init_port()
625 rp2_uart_set_mctrl(&up->port, 0); in rp2_init_port()
627 writeb(RP2_RX_FIFO_ena, up->ucode + RP2_RX_FIFO); in rp2_init_port()
628 rp2_rmw(up, RP2_UART_CTL, RP2_UART_CTL_MODE_m, in rp2_init_port()
630 rp2_rmw_set(up, RP2_TXRX_CTL, in rp2_init_port()