Lines Matching refs:up

189 	struct uart_ma35d1_port *up = to_ma35d1_uart_port(port);  in ma35d1serial_stop_tx()  local
191 __stop_tx(up); in ma35d1serial_stop_tx()
194 static void transmit_chars(struct uart_ma35d1_port *up) in transmit_chars() argument
199 if (uart_tx_stopped(&up->port)) { in transmit_chars()
200 ma35d1serial_stop_tx(&up->port); in transmit_chars()
204 serial_in(up, MA35_FSR_REG)); in transmit_chars()
205 uart_port_tx_limited(&up->port, ch, count, in transmit_chars()
206 !(serial_in(up, MA35_FSR_REG) & MA35_FSR_TX_FULL), in transmit_chars()
207 serial_out(up, MA35_THR_REG, ch), in transmit_chars()
213 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_start_tx() local
216 ier = serial_in(up, MA35_IER_REG); in ma35d1serial_start_tx()
217 serial_out(up, MA35_IER_REG, ier & ~MA35_IER_THRE_IEN); in ma35d1serial_start_tx()
218 transmit_chars(up); in ma35d1serial_start_tx()
219 serial_out(up, MA35_IER_REG, ier | MA35_IER_THRE_IEN); in ma35d1serial_start_tx()
224 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_stop_rx() local
227 ier = serial_in(up, MA35_IER_REG); in ma35d1serial_stop_rx()
229 serial_out(up, MA35_IER_REG, ier); in ma35d1serial_stop_rx()
232 static void receive_chars(struct uart_ma35d1_port *up) in receive_chars() argument
238 fsr = serial_in(up, MA35_FSR_REG); in receive_chars()
241 up->port.icount.rx++; in receive_chars()
246 up->port.icount.brk++; in receive_chars()
247 if (uart_handle_break(&up->port)) in receive_chars()
251 up->port.icount.frame++; in receive_chars()
253 up->port.icount.parity++; in receive_chars()
255 up->port.icount.overrun++; in receive_chars()
257 serial_out(up, MA35_FSR_REG, in receive_chars()
268 ch = serial_in(up, MA35_RBR_REG); in receive_chars()
269 if (uart_handle_sysrq_char(&up->port, ch)) in receive_chars()
272 spin_lock(&up->port.lock); in receive_chars()
273 uart_insert_char(&up->port, fsr, MA35_FSR_RX_OVER_IF, ch, flag); in receive_chars()
274 spin_unlock(&up->port.lock); in receive_chars()
276 fsr = serial_in(up, MA35_FSR_REG); in receive_chars()
279 spin_lock(&up->port.lock); in receive_chars()
280 tty_flip_buffer_push(&up->port.state->port); in receive_chars()
281 spin_unlock(&up->port.lock); in receive_chars()
287 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_interrupt() local
290 isr = serial_in(up, MA35_ISR_REG); in ma35d1serial_interrupt()
291 fsr = serial_in(up, MA35_FSR_REG); in ma35d1serial_interrupt()
297 receive_chars(up); in ma35d1serial_interrupt()
299 transmit_chars(up); in ma35d1serial_interrupt()
301 serial_out(up, MA35_FSR_REG, MA35_FSR_TX_OVER_IF); in ma35d1serial_interrupt()
308 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_tx_empty() local
311 fsr = serial_in(up, MA35_FSR_REG); in ma35d1serial_tx_empty()
320 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_get_mctrl() local
324 status = serial_in(up, MA35_MSR_REG); in ma35d1serial_get_mctrl()
332 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_set_mctrl() local
335 mcr = serial_in(up, MA35_MCR_REG); in ma35d1serial_set_mctrl()
343 if (up->mcr & UART_MCR_AFE) { in ma35d1serial_set_mctrl()
344 ier = serial_in(up, MA35_IER_REG); in ma35d1serial_set_mctrl()
346 serial_out(up, MA35_IER_REG, ier); in ma35d1serial_set_mctrl()
347 up->port.flags |= UPF_HARD_FLOW; in ma35d1serial_set_mctrl()
349 ier = serial_in(up, MA35_IER_REG); in ma35d1serial_set_mctrl()
351 serial_out(up, MA35_IER_REG, ier); in ma35d1serial_set_mctrl()
352 up->port.flags &= ~UPF_HARD_FLOW; in ma35d1serial_set_mctrl()
355 msr = serial_in(up, MA35_MSR_REG); in ma35d1serial_set_mctrl()
357 serial_out(up, MA35_MSR_REG, msr); in ma35d1serial_set_mctrl()
358 serial_out(up, MA35_MCR_REG, mcr); in ma35d1serial_set_mctrl()
363 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_break_ctl() local
367 spin_lock_irqsave(&up->port.lock, flags); in ma35d1serial_break_ctl()
368 lcr = serial_in(up, MA35_LCR_REG); in ma35d1serial_break_ctl()
373 serial_out(up, MA35_LCR_REG, lcr); in ma35d1serial_break_ctl()
374 spin_unlock_irqrestore(&up->port.lock, flags); in ma35d1serial_break_ctl()
379 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_startup() local
384 serial_out(up, MA35_FCR_REG, MA35_FCR_TFR | MA35_FCR_RFR); in ma35d1serial_startup()
387 serial_out(up, MA35_ISR_REG, MA35_ISR_ALL); in ma35d1serial_startup()
392 dev_err(up->port.dev, "request irq failed.\n"); in ma35d1serial_startup()
396 fcr = serial_in(up, MA35_FCR_REG); in ma35d1serial_startup()
398 serial_out(up, MA35_FCR_REG, fcr); in ma35d1serial_startup()
399 serial_out(up, MA35_LCR_REG, MA35_LCR_WLS_8BITS); in ma35d1serial_startup()
400 serial_out(up, MA35_TOR_REG, MA35_UART_RX_TOUT); in ma35d1serial_startup()
401 serial_out(up, MA35_IER_REG, MA35_IER_CONFIG); in ma35d1serial_startup()
407 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_shutdown() local
409 serial_out(up, MA35_IER_REG, 0); in ma35d1serial_shutdown()
417 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_set_termios() local
444 spin_lock_irqsave(&up->port.lock, flags); in ma35d1serial_set_termios()
446 up->port.read_status_mask = MA35_FSR_RX_OVER_IF; in ma35d1serial_set_termios()
448 up->port.read_status_mask |= MA35_FSR_FEF | MA35_FSR_PEF; in ma35d1serial_set_termios()
450 up->port.read_status_mask |= MA35_FSR_BIF; in ma35d1serial_set_termios()
453 up->port.ignore_status_mask = 0; in ma35d1serial_set_termios()
455 up->port.ignore_status_mask |= MA35_FSR_FEF | MA35_FSR_PEF; in ma35d1serial_set_termios()
457 up->port.ignore_status_mask |= MA35_FSR_BIF; in ma35d1serial_set_termios()
463 up->port.ignore_status_mask |= MA35_FSR_RX_OVER_IF; in ma35d1serial_set_termios()
466 up->mcr |= UART_MCR_AFE; in ma35d1serial_set_termios()
468 up->mcr &= ~UART_MCR_AFE; in ma35d1serial_set_termios()
472 ma35d1serial_set_mctrl(&up->port, up->port.mctrl); in ma35d1serial_set_termios()
474 serial_out(up, MA35_BAUD_REG, MA35_BAUD_MODE2 | FIELD_PREP(MA35_BAUD_MASK, quot)); in ma35d1serial_set_termios()
476 serial_out(up, MA35_LCR_REG, lcr); in ma35d1serial_set_termios()
478 spin_unlock_irqrestore(&up->port.lock, flags); in ma35d1serial_set_termios()
530 static void wait_for_xmitr(struct uart_ma35d1_port *up) in wait_for_xmitr() argument
536 up, MA35_FSR_REG); in wait_for_xmitr()
541 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_console_putchar() local
543 wait_for_xmitr(up); in ma35d1serial_console_putchar()
544 serial_out(up, MA35_THR_REG, ch); in ma35d1serial_console_putchar()
555 struct uart_ma35d1_port *up = &ma35d1serial_ports[co->index]; in ma35d1serial_console_write() local
560 if (up->port.sysrq) in ma35d1serial_console_write()
563 locked = spin_trylock_irqsave(&up->port.lock, flags); in ma35d1serial_console_write()
565 spin_lock_irqsave(&up->port.lock, flags); in ma35d1serial_console_write()
570 ier = serial_in(up, MA35_IER_REG); in ma35d1serial_console_write()
571 serial_out(up, MA35_IER_REG, 0); in ma35d1serial_console_write()
573 uart_console_write(&up->port, s, count, ma35d1serial_console_putchar); in ma35d1serial_console_write()
575 wait_for_xmitr(up); in ma35d1serial_console_write()
576 serial_out(up, MA35_IER_REG, ier); in ma35d1serial_console_write()
579 spin_unlock_irqrestore(&up->port.lock, flags); in ma35d1serial_console_write()
680 struct uart_ma35d1_port *up; in ma35d1serial_probe() local
690 up = &ma35d1serial_ports[ret]; in ma35d1serial_probe()
691 up->port.line = ret; in ma35d1serial_probe()
696 up->port.iobase = res_mem->start; in ma35d1serial_probe()
697 up->port.membase = ioremap(up->port.iobase, MA35_UART_REG_SIZE); in ma35d1serial_probe()
698 up->port.ops = &ma35d1serial_ops; in ma35d1serial_probe()
700 spin_lock_init(&up->port.lock); in ma35d1serial_probe()
702 up->clk = of_clk_get(pdev->dev.of_node, 0); in ma35d1serial_probe()
703 if (IS_ERR(up->clk)) { in ma35d1serial_probe()
704 ret = PTR_ERR(up->clk); in ma35d1serial_probe()
709 ret = clk_prepare_enable(up->clk); in ma35d1serial_probe()
713 if (up->port.line != 0) in ma35d1serial_probe()
714 up->port.uartclk = clk_get_rate(up->clk); in ma35d1serial_probe()
720 up->port.irq = ret; in ma35d1serial_probe()
721 up->port.dev = &pdev->dev; in ma35d1serial_probe()
722 up->port.flags = UPF_BOOT_AUTOCONF; in ma35d1serial_probe()
724 platform_set_drvdata(pdev, up); in ma35d1serial_probe()
726 ret = uart_add_one_port(&ma35d1serial_reg, &up->port); in ma35d1serial_probe()
733 free_irq(up->port.irq, &up->port); in ma35d1serial_probe()
736 clk_disable_unprepare(up->clk); in ma35d1serial_probe()
739 iounmap(up->port.membase); in ma35d1serial_probe()
749 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_remove() local
752 clk_disable_unprepare(up->clk); in ma35d1serial_remove()
759 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_suspend() local
761 uart_suspend_port(&ma35d1serial_reg, &up->port); in ma35d1serial_suspend()
762 if (up->port.line == 0) { in ma35d1serial_suspend()
763 up->console_baud_rate = serial_in(up, MA35_BAUD_REG); in ma35d1serial_suspend()
764 up->console_line = serial_in(up, MA35_LCR_REG); in ma35d1serial_suspend()
765 up->console_int = serial_in(up, MA35_IER_REG); in ma35d1serial_suspend()
773 struct uart_ma35d1_port *up = to_ma35d1_uart_port(port); in ma35d1serial_resume() local
775 if (up->port.line == 0) { in ma35d1serial_resume()
776 serial_out(up, MA35_BAUD_REG, up->console_baud_rate); in ma35d1serial_resume()
777 serial_out(up, MA35_LCR_REG, up->console_line); in ma35d1serial_resume()
778 serial_out(up, MA35_IER_REG, up->console_int); in ma35d1serial_resume()
780 uart_resume_port(&ma35d1serial_reg, &up->port); in ma35d1serial_resume()