Lines Matching refs:p
71 static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value) in dw8250_modify_msr() argument
73 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_modify_msr()
84 static void dw8250_force_idle(struct uart_port *p) in dw8250_force_idle() argument
86 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_force_idle()
89 (void)p->serial_in(p, UART_RX); in dw8250_force_idle()
92 static void dw8250_check_lcr(struct uart_port *p, int value) in dw8250_check_lcr() argument
94 void __iomem *offset = p->membase + (UART_LCR << p->regshift); in dw8250_check_lcr()
99 unsigned int lcr = p->serial_in(p, UART_LCR); in dw8250_check_lcr()
104 dw8250_force_idle(p); in dw8250_check_lcr()
107 if (p->type == PORT_OCTEON) in dw8250_check_lcr()
111 if (p->iotype == UPIO_MEM32) in dw8250_check_lcr()
113 else if (p->iotype == UPIO_MEM32BE) in dw8250_check_lcr()
125 static void dw8250_tx_wait_empty(struct uart_port *p) in dw8250_tx_wait_empty() argument
127 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_tx_wait_empty()
133 lsr = readb (p->membase + (UART_LSR << p->regshift)); in dw8250_tx_wait_empty()
148 static void dw8250_serial_out38x(struct uart_port *p, int offset, int value) in dw8250_serial_out38x() argument
150 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_out38x()
154 dw8250_tx_wait_empty(p); in dw8250_serial_out38x()
156 writeb(value, p->membase + (offset << p->regshift)); in dw8250_serial_out38x()
159 dw8250_check_lcr(p, value); in dw8250_serial_out38x()
163 static void dw8250_serial_out(struct uart_port *p, int offset, int value) in dw8250_serial_out() argument
165 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_out()
167 writeb(value, p->membase + (offset << p->regshift)); in dw8250_serial_out()
170 dw8250_check_lcr(p, value); in dw8250_serial_out()
173 static unsigned int dw8250_serial_in(struct uart_port *p, int offset) in dw8250_serial_in() argument
175 unsigned int value = readb(p->membase + (offset << p->regshift)); in dw8250_serial_in()
177 return dw8250_modify_msr(p, offset, value); in dw8250_serial_in()
181 static unsigned int dw8250_serial_inq(struct uart_port *p, int offset) in dw8250_serial_inq() argument
185 value = (u8)__raw_readq(p->membase + (offset << p->regshift)); in dw8250_serial_inq()
187 return dw8250_modify_msr(p, offset, value); in dw8250_serial_inq()
190 static void dw8250_serial_outq(struct uart_port *p, int offset, int value) in dw8250_serial_outq() argument
192 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_outq()
195 __raw_writeq(value, p->membase + (offset << p->regshift)); in dw8250_serial_outq()
197 __raw_readq(p->membase + (UART_LCR << p->regshift)); in dw8250_serial_outq()
200 dw8250_check_lcr(p, value); in dw8250_serial_outq()
204 static void dw8250_serial_out32(struct uart_port *p, int offset, int value) in dw8250_serial_out32() argument
206 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_out32()
208 writel(value, p->membase + (offset << p->regshift)); in dw8250_serial_out32()
211 dw8250_check_lcr(p, value); in dw8250_serial_out32()
214 static unsigned int dw8250_serial_in32(struct uart_port *p, int offset) in dw8250_serial_in32() argument
216 unsigned int value = readl(p->membase + (offset << p->regshift)); in dw8250_serial_in32()
218 return dw8250_modify_msr(p, offset, value); in dw8250_serial_in32()
221 static void dw8250_serial_out32be(struct uart_port *p, int offset, int value) in dw8250_serial_out32be() argument
223 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_serial_out32be()
225 iowrite32be(value, p->membase + (offset << p->regshift)); in dw8250_serial_out32be()
228 dw8250_check_lcr(p, value); in dw8250_serial_out32be()
231 static unsigned int dw8250_serial_in32be(struct uart_port *p, int offset) in dw8250_serial_in32be() argument
233 unsigned int value = ioread32be(p->membase + (offset << p->regshift)); in dw8250_serial_in32be()
235 return dw8250_modify_msr(p, offset, value); in dw8250_serial_in32be()
239 static int dw8250_handle_irq(struct uart_port *p) in dw8250_handle_irq() argument
241 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_handle_irq()
242 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_handle_irq()
243 unsigned int iir = p->serial_in(p, UART_IIR); in dw8250_handle_irq()
258 spin_lock_irqsave(&p->lock, flags); in dw8250_handle_irq()
259 status = p->serial_in(p, UART_LSR); in dw8250_handle_irq()
262 (void) p->serial_in(p, UART_RX); in dw8250_handle_irq()
264 spin_unlock_irqrestore(&p->lock, flags); in dw8250_handle_irq()
267 if (serial8250_handle_irq(p, iir)) in dw8250_handle_irq()
272 (void)p->serial_in(p, d->usr_reg); in dw8250_handle_irq()
332 static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, in dw8250_set_termios() argument
336 struct dw8250_data *d = to_dw8250_data(p->private_data); in dw8250_set_termios()
349 swap(p->uartclk, rate); in dw8250_set_termios()
352 swap(p->uartclk, rate); in dw8250_set_termios()
356 p->status &= ~UPSTAT_AUTOCTS; in dw8250_set_termios()
358 p->status |= UPSTAT_AUTOCTS; in dw8250_set_termios()
360 serial8250_do_set_termios(p, termios, old); in dw8250_set_termios()
363 static void dw8250_set_ldisc(struct uart_port *p, struct ktermios *termios) in dw8250_set_ldisc() argument
365 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_set_ldisc()
366 unsigned int mcr = p->serial_in(p, UART_MCR); in dw8250_set_ldisc()
374 p->serial_out(p, UART_MCR, mcr); in dw8250_set_ldisc()
376 serial8250_do_set_ldisc(p, termios); in dw8250_set_ldisc()
397 static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data) in dw8250_quirks() argument
399 if (p->dev->of_node) { in dw8250_quirks()
400 struct device_node *np = p->dev->of_node; in dw8250_quirks()
406 p->line = id; in dw8250_quirks()
409 p->serial_in = dw8250_serial_inq; in dw8250_quirks()
410 p->serial_out = dw8250_serial_outq; in dw8250_quirks()
411 p->flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE; in dw8250_quirks()
412 p->type = PORT_OCTEON; in dw8250_quirks()
417 if (of_device_is_big_endian(p->dev->of_node)) { in dw8250_quirks()
418 p->iotype = UPIO_MEM32BE; in dw8250_quirks()
419 p->serial_in = dw8250_serial_in32be; in dw8250_quirks()
420 p->serial_out = dw8250_serial_out32be; in dw8250_quirks()
423 p->serial_out = dw8250_serial_out38x; in dw8250_quirks()
426 p->iotype = UPIO_MEM32; in dw8250_quirks()
427 p->regshift = 2; in dw8250_quirks()
428 p->serial_in = dw8250_serial_in32; in dw8250_quirks()
433 if (platform_get_resource_byname(to_platform_device(p->dev), in dw8250_quirks()
435 data->data.dma.rx_param = p->dev->parent; in dw8250_quirks()
436 data->data.dma.tx_param = p->dev->parent; in dw8250_quirks()
445 struct uart_port *p = &up->port; in dw8250_probe() local
461 spin_lock_init(&p->lock); in dw8250_probe()
462 p->mapbase = regs->start; in dw8250_probe()
463 p->irq = irq; in dw8250_probe()
464 p->handle_irq = dw8250_handle_irq; in dw8250_probe()
465 p->pm = dw8250_do_pm; in dw8250_probe()
466 p->type = PORT_8250; in dw8250_probe()
467 p->flags = UPF_SHARE_IRQ | UPF_FIXED_PORT; in dw8250_probe()
468 p->dev = dev; in dw8250_probe()
469 p->iotype = UPIO_MEM; in dw8250_probe()
470 p->serial_in = dw8250_serial_in; in dw8250_probe()
471 p->serial_out = dw8250_serial_out; in dw8250_probe()
472 p->set_ldisc = dw8250_set_ldisc; in dw8250_probe()
473 p->set_termios = dw8250_set_termios; in dw8250_probe()
475 p->membase = devm_ioremap(dev, regs->start, resource_size(regs)); in dw8250_probe()
476 if (!p->membase) in dw8250_probe()
485 p->private_data = &data->data; in dw8250_probe()
492 p->regshift = val; in dw8250_probe()
496 p->iotype = UPIO_MEM32; in dw8250_probe()
497 p->serial_in = dw8250_serial_in32; in dw8250_probe()
498 p->serial_out = dw8250_serial_out32; in dw8250_probe()
526 device_property_read_u32(dev, "clock-frequency", &p->uartclk); in dw8250_probe()
543 p->uartclk = clk_get_rate(data->clk); in dw8250_probe()
546 if (!p->uartclk) { in dw8250_probe()
571 dw8250_quirks(p, data); in dw8250_probe()
575 p->handle_irq = NULL; in dw8250_probe()
578 dw8250_setup_port(p); in dw8250_probe()
581 if (p->fifosize) { in dw8250_probe()
582 data->data.dma.rxconf.src_maxburst = p->fifosize / 4; in dw8250_probe()
583 data->data.dma.txconf.dst_maxburst = p->fifosize / 4; in dw8250_probe()
601 dev_warn(p->dev, "Failed to set the clock notifier\n"); in dw8250_probe()