Lines Matching refs:up

44 static void wait_for_bits(struct nwpserial_port *up, int bits)  in wait_for_bits()  argument
50 status = dcr_read(up->dcr_host, UART_LSR); in wait_for_bits()
61 struct nwpserial_port *up; in nwpserial_console_putchar() local
62 up = container_of(port, struct nwpserial_port, port); in nwpserial_console_putchar()
64 wait_for_bits(up, UART_LSR_THRE); in nwpserial_console_putchar()
65 dcr_write(up->dcr_host, UART_TX, c); in nwpserial_console_putchar()
66 up->port.icount.tx++; in nwpserial_console_putchar()
72 struct nwpserial_port *up = &nwpserial_ports[co->index]; in nwpserial_console_write() local
77 locked = spin_trylock_irqsave(&up->port.lock, flags); in nwpserial_console_write()
79 spin_lock_irqsave(&up->port.lock, flags); in nwpserial_console_write()
82 up->ier = dcr_read(up->dcr_host, UART_IER); in nwpserial_console_write()
83 dcr_write(up->dcr_host, UART_IER, up->ier & ~UART_IER_RDI); in nwpserial_console_write()
85 uart_console_write(&up->port, s, count, nwpserial_console_putchar); in nwpserial_console_write()
88 while ((dcr_read(up->dcr_host, UART_LSR) & UART_LSR_THRE) == 0) in nwpserial_console_write()
92 dcr_write(up->dcr_host, UART_IER, up->ier); in nwpserial_console_write()
95 spin_unlock_irqrestore(&up->port.lock, flags); in nwpserial_console_write()
131 struct nwpserial_port *up = dev_id; in nwpserial_interrupt() local
132 struct tty_port *port = &up->port.state->port; in nwpserial_interrupt()
137 spin_lock(&up->port.lock); in nwpserial_interrupt()
140 iir = dcr_read(up->dcr_host, UART_IIR); in nwpserial_interrupt()
147 up->port.icount.rx++; in nwpserial_interrupt()
148 ch = dcr_read(up->dcr_host, UART_RX); in nwpserial_interrupt()
149 if (up->port.ignore_status_mask != NWPSERIAL_STATUS_RXVALID) in nwpserial_interrupt()
151 } while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR); in nwpserial_interrupt()
153 spin_unlock(&up->port.lock); in nwpserial_interrupt()
155 spin_lock(&up->port.lock); in nwpserial_interrupt()
160 dcr_write(up->dcr_host, UART_IIR, 1); in nwpserial_interrupt()
162 spin_unlock(&up->port.lock); in nwpserial_interrupt()
168 struct nwpserial_port *up; in nwpserial_startup() local
171 up = container_of(port, struct nwpserial_port, port); in nwpserial_startup()
174 up->mcr = dcr_read(up->dcr_host, UART_MCR) & ~UART_MCR_AFE; in nwpserial_startup()
175 dcr_write(up->dcr_host, UART_MCR, up->mcr); in nwpserial_startup()
178 err = request_irq(up->port.irq, nwpserial_interrupt, in nwpserial_startup()
179 IRQF_SHARED, "nwpserial", up); in nwpserial_startup()
184 up->ier = UART_IER_RDI; in nwpserial_startup()
185 dcr_write(up->dcr_host, UART_IER, up->ier); in nwpserial_startup()
188 up->port.ignore_status_mask &= ~NWPSERIAL_STATUS_RXVALID; in nwpserial_startup()
195 struct nwpserial_port *up; in nwpserial_shutdown() local
196 up = container_of(port, struct nwpserial_port, port); in nwpserial_shutdown()
199 up->port.ignore_status_mask |= NWPSERIAL_STATUS_RXVALID; in nwpserial_shutdown()
202 up->ier = 0; in nwpserial_shutdown()
203 dcr_write(up->dcr_host, UART_IER, up->ier); in nwpserial_shutdown()
206 free_irq(up->port.irq, up); in nwpserial_shutdown()
223 struct nwpserial_port *up; in nwpserial_set_termios() local
224 up = container_of(port, struct nwpserial_port, port); in nwpserial_set_termios()
226 up->port.read_status_mask = NWPSERIAL_STATUS_RXVALID in nwpserial_set_termios()
229 up->port.ignore_status_mask = 0; in nwpserial_set_termios()
232 up->port.ignore_status_mask |= NWPSERIAL_STATUS_RXVALID; in nwpserial_set_termios()
246 struct nwpserial_port *up; in nwpserial_stop_rx() local
247 up = container_of(port, struct nwpserial_port, port); in nwpserial_stop_rx()
249 up->port.ignore_status_mask = NWPSERIAL_STATUS_RXVALID; in nwpserial_stop_rx()
252 static void nwpserial_putchar(struct nwpserial_port *up, unsigned char c) in nwpserial_putchar() argument
255 wait_for_bits(up, UART_LSR_THRE); in nwpserial_putchar()
256 dcr_write(up->dcr_host, UART_TX, c); in nwpserial_putchar()
257 up->port.icount.tx++; in nwpserial_putchar()
262 struct nwpserial_port *up; in nwpserial_start_tx() local
264 up = container_of(port, struct nwpserial_port, port); in nwpserial_start_tx()
265 xmit = &up->port.state->xmit; in nwpserial_start_tx()
268 nwpserial_putchar(up, up->port.x_char); in nwpserial_start_tx()
272 while (!(uart_circ_empty(xmit) || uart_tx_stopped(&up->port))) { in nwpserial_start_tx()
273 nwpserial_putchar(up, xmit->buf[xmit->tail]); in nwpserial_start_tx()
295 struct nwpserial_port *up; in nwpserial_tx_empty() local
298 up = container_of(port, struct nwpserial_port, port); in nwpserial_tx_empty()
300 spin_lock_irqsave(&up->port.lock, flags); in nwpserial_tx_empty()
301 ret = dcr_read(up->dcr_host, UART_LSR); in nwpserial_tx_empty()
302 spin_unlock_irqrestore(&up->port.lock, flags); in nwpserial_tx_empty()
337 struct nwpserial_port *up = NULL; in nwpserial_register_port() local
357 up = &nwpserial_ports[i]; in nwpserial_register_port()
362 if (up == NULL) in nwpserial_register_port()
366 up = &nwpserial_ports[i]; in nwpserial_register_port()
370 if (up == NULL) { in nwpserial_register_port()
379 up->port.membase = port->membase; in nwpserial_register_port()
380 up->port.irq = port->irq; in nwpserial_register_port()
381 up->port.uartclk = port->uartclk; in nwpserial_register_port()
382 up->port.fifosize = port->fifosize; in nwpserial_register_port()
383 up->port.regshift = port->regshift; in nwpserial_register_port()
384 up->port.iotype = port->iotype; in nwpserial_register_port()
385 up->port.flags = port->flags; in nwpserial_register_port()
386 up->port.mapbase = port->mapbase; in nwpserial_register_port()
387 up->port.private_data = port->private_data; in nwpserial_register_port()
390 up->port.dev = port->dev; in nwpserial_register_port()
392 if (up->port.iobase != dcr_base) { in nwpserial_register_port()
393 up->port.ops = &nwpserial_pops; in nwpserial_register_port()
394 up->port.fifosize = 16; in nwpserial_register_port()
396 spin_lock_init(&up->port.lock); in nwpserial_register_port()
398 up->port.iobase = dcr_base; in nwpserial_register_port()
401 up->dcr_host = dcr_map(dn, dcr_base, dcr_len); in nwpserial_register_port()
402 if (!DCR_MAP_OK(up->dcr_host)) { in nwpserial_register_port()
408 ret = uart_add_one_port(&nwpserial_reg, &up->port); in nwpserial_register_port()
410 ret = up->port.line; in nwpserial_register_port()
421 struct nwpserial_port *up = &nwpserial_ports[line]; in nwpserial_unregister_port() local
423 uart_remove_one_port(&nwpserial_reg, &up->port); in nwpserial_unregister_port()
425 up->port.type = PORT_UNKNOWN; in nwpserial_unregister_port()
434 struct nwpserial_port *up = NULL; in nwpserial_console_init() local
444 up = &nwpserial_ports[i]; in nwpserial_console_init()
448 if (up == NULL) in nwpserial_console_init()
459 spin_lock_init(&up->port.lock); in nwpserial_console_init()
460 up->port.ops = &nwpserial_pops; in nwpserial_console_init()
461 up->port.type = PORT_NWPSERIAL; in nwpserial_console_init()
462 up->port.fifosize = 16; in nwpserial_console_init()
466 up->port.iobase = dcr_base; in nwpserial_console_init()
468 up->dcr_host = dcr_map(dn, dcr_base, dcr_len); in nwpserial_console_init()
469 if (!DCR_MAP_OK(up->dcr_host)) { in nwpserial_console_init()