Lines Matching refs:p
97 static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value) in dw8250_modify_msr() argument
99 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_modify_msr()
110 static void dw8250_force_idle(struct uart_port *p) in dw8250_force_idle() argument
112 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_force_idle()
123 lsr = p->serial_in(p, UART_LSR); in dw8250_force_idle()
128 (void)p->serial_in(p, UART_RX); in dw8250_force_idle()
131 static void dw8250_check_lcr(struct uart_port *p, int value) in dw8250_check_lcr() argument
133 void __iomem *offset = p->membase + (UART_LCR << p->regshift); in dw8250_check_lcr()
138 unsigned int lcr = p->serial_in(p, UART_LCR); in dw8250_check_lcr()
143 dw8250_force_idle(p); in dw8250_check_lcr()
146 if (p->type == PORT_OCTEON) in dw8250_check_lcr()
150 if (p->iotype == UPIO_MEM32) in dw8250_check_lcr()
152 else if (p->iotype == UPIO_MEM32BE) in dw8250_check_lcr()
164 static void dw8250_tx_wait_empty(struct uart_port *p) in dw8250_tx_wait_empty() argument
166 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_tx_wait_empty()
172 lsr = readb (p->membase + (UART_LSR << p->regshift)); in dw8250_tx_wait_empty()
187 static void dw8250_serial_out(struct uart_port *p, int offset, int value) in dw8250_serial_out() argument
189 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_out()
191 writeb(value, p->membase + (offset << p->regshift)); in dw8250_serial_out()
194 dw8250_check_lcr(p, value); in dw8250_serial_out()
197 static void dw8250_serial_out38x(struct uart_port *p, int offset, int value) in dw8250_serial_out38x() argument
201 dw8250_tx_wait_empty(p); in dw8250_serial_out38x()
203 dw8250_serial_out(p, offset, value); in dw8250_serial_out38x()
206 static unsigned int dw8250_serial_in(struct uart_port *p, int offset) in dw8250_serial_in() argument
208 unsigned int value = readb(p->membase + (offset << p->regshift)); in dw8250_serial_in()
210 return dw8250_modify_msr(p, offset, value); in dw8250_serial_in()
214 static unsigned int dw8250_serial_inq(struct uart_port *p, int offset) in dw8250_serial_inq() argument
218 value = (u8)__raw_readq(p->membase + (offset << p->regshift)); in dw8250_serial_inq()
220 return dw8250_modify_msr(p, offset, value); in dw8250_serial_inq()
223 static void dw8250_serial_outq(struct uart_port *p, int offset, int value) in dw8250_serial_outq() argument
225 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_outq()
228 __raw_writeq(value, p->membase + (offset << p->regshift)); in dw8250_serial_outq()
230 __raw_readq(p->membase + (UART_LCR << p->regshift)); in dw8250_serial_outq()
233 dw8250_check_lcr(p, value); in dw8250_serial_outq()
237 static void dw8250_serial_out32(struct uart_port *p, int offset, int value) in dw8250_serial_out32() argument
239 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_out32()
241 writel(value, p->membase + (offset << p->regshift)); in dw8250_serial_out32()
244 dw8250_check_lcr(p, value); in dw8250_serial_out32()
247 static unsigned int dw8250_serial_in32(struct uart_port *p, int offset) in dw8250_serial_in32() argument
249 unsigned int value = readl(p->membase + (offset << p->regshift)); in dw8250_serial_in32()
251 return dw8250_modify_msr(p, offset, value); in dw8250_serial_in32()
254 static void dw8250_serial_out32be(struct uart_port *p, int offset, int value) in dw8250_serial_out32be() argument
256 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_out32be()
258 iowrite32be(value, p->membase + (offset << p->regshift)); in dw8250_serial_out32be()
261 dw8250_check_lcr(p, value); in dw8250_serial_out32be()
264 static unsigned int dw8250_serial_in32be(struct uart_port *p, int offset) in dw8250_serial_in32be() argument
266 unsigned int value = ioread32be(p->membase + (offset << p->regshift)); in dw8250_serial_in32be()
268 return dw8250_modify_msr(p, offset, value); in dw8250_serial_in32be()
272 static int dw8250_handle_irq(struct uart_port *p) in dw8250_handle_irq() argument
274 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_handle_irq()
275 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_handle_irq()
276 unsigned int iir = p->serial_in(p, UART_IIR); in dw8250_handle_irq()
293 spin_lock_irqsave(&p->lock, flags); in dw8250_handle_irq()
297 (void) p->serial_in(p, UART_RX); in dw8250_handle_irq()
299 spin_unlock_irqrestore(&p->lock, flags); in dw8250_handle_irq()
304 spin_lock_irqsave(&p->lock, flags); in dw8250_handle_irq()
306 spin_unlock_irqrestore(&p->lock, flags); in dw8250_handle_irq()
309 dw8250_writel_ext(p, RZN1_UART_RDMACR, 0); in dw8250_handle_irq()
310 dw8250_writel_ext(p, DW_UART_DMASA, 1); in dw8250_handle_irq()
314 if (serial8250_handle_irq(p, iir)) in dw8250_handle_irq()
319 (void)p->serial_in(p, d->pdata->usr_reg); in dw8250_handle_irq()
379 static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, in dw8250_set_termios() argument
383 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_set_termios()
396 p->uartclk = rate; in dw8250_set_termios()
400 dw8250_do_set_termios(p, termios, old); in dw8250_set_termios()
403 static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios) in dw8250_set_ldisc() argument
405 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_set_ldisc()
406 unsigned int mcr = p->serial_in(p, UART_MCR); in dw8250_set_ldisc()
414 p->serial_out(p, UART_MCR, mcr); in dw8250_set_ldisc()
416 serial8250_do_set_ldisc(p, termios); in dw8250_set_ldisc()
447 static void dw8250_prepare_tx_dma(struct uart_8250_port *p) in dw8250_prepare_tx_dma() argument
449 struct uart_port *up = &p->port; in dw8250_prepare_tx_dma()
450 struct uart_8250_dma *dma = p->dma; in dw8250_prepare_tx_dma()
460 static void dw8250_prepare_rx_dma(struct uart_8250_port *p) in dw8250_prepare_rx_dma() argument
462 struct uart_port *up = &p->port; in dw8250_prepare_rx_dma()
463 struct uart_8250_dma *dma = p->dma; in dw8250_prepare_rx_dma()
473 static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) in dw8250_quirks() argument
483 p->serial_in = dw8250_serial_inq; in dw8250_quirks()
484 p->serial_out = dw8250_serial_outq; in dw8250_quirks()
485 p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; in dw8250_quirks()
486 p->type = PORT_OCTEON; in dw8250_quirks()
492 p->serial_out = dw8250_serial_out38x; in dw8250_quirks()
494 p->set_termios = dw8250_do_set_termios; in dw8250_quirks()
502 p->iotype = UPIO_MEM32; in dw8250_quirks()
503 p->regshift = 2; in dw8250_quirks()
504 p->serial_in = dw8250_serial_in32; in dw8250_quirks()
509 if (platform_get_resource_byname(to_platform_device(p->dev), in dw8250_quirks()
511 data->data.dma.rx_param = p->dev->parent; in dw8250_quirks()
512 data->data.dma.tx_param = p->dev->parent; in dw8250_quirks()
530 struct uart_port *p = &up->port; in dw8250_probe() local
540 spin_lock_init(&p->lock); in dw8250_probe()
541 p->handle_irq = dw8250_handle_irq; in dw8250_probe()
542 p->pm = dw8250_do_pm; in dw8250_probe()
543 p->type = PORT_8250; in dw8250_probe()
544 p->flags = UPF_FIXED_PORT; in dw8250_probe()
545 p->dev = dev; in dw8250_probe()
546 p->set_ldisc = dw8250_set_ldisc; in dw8250_probe()
547 p->set_termios = dw8250_set_termios; in dw8250_probe()
554 data->pdata = device_get_match_data(p->dev); in dw8250_probe()
555 p->private_data = &data->data; in dw8250_probe()
560 p->mapbase = regs->start; in dw8250_probe()
561 p->mapsize = resource_size(regs); in dw8250_probe()
563 p->membase = devm_ioremap(dev, p->mapbase, p->mapsize); in dw8250_probe()
564 if (!p->membase) in dw8250_probe()
567 err = uart_read_port_properties(p); in dw8250_probe()
574 switch (p->iotype) { in dw8250_probe()
576 p->serial_in = dw8250_serial_in; in dw8250_probe()
577 p->serial_out = dw8250_serial_out; in dw8250_probe()
580 p->serial_in = dw8250_serial_in32; in dw8250_probe()
581 p->serial_out = dw8250_serial_out32; in dw8250_probe()
584 p->serial_in = dw8250_serial_in32be; in dw8250_probe()
585 p->serial_out = dw8250_serial_out32be; in dw8250_probe()
634 p->uartclk = clk_get_rate(data->clk); in dw8250_probe()
637 if (!p->uartclk) in dw8250_probe()
662 dw8250_quirks(p, data); in dw8250_probe()
666 p->handle_irq = NULL; in dw8250_probe()
669 dw8250_setup_port(p); in dw8250_probe()
672 if (p->fifosize) { in dw8250_probe()
673 data->data.dma.rxconf.src_maxburst = p->fifosize / 4; in dw8250_probe()
674 data->data.dma.txconf.dst_maxburst = p->fifosize / 4; in dw8250_probe()