Lines Matching refs:com_port

129 	ns16550_writeb(com_port, \
130 (unsigned char *)addr - (unsigned char *)com_port, value)
132 ns16550_readb(com_port, \
133 (unsigned char *)addr - (unsigned char *)com_port)
148 static void NS16550_setbrg(NS16550_t com_port, int baud_divisor) in NS16550_setbrg() argument
150 serial_out(UART_LCR_BKSE | UART_LCRVAL, &com_port->lcr); in NS16550_setbrg()
151 serial_out(baud_divisor & 0xff, &com_port->dll); in NS16550_setbrg()
152 serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm); in NS16550_setbrg()
153 serial_out(UART_LCRVAL, &com_port->lcr); in NS16550_setbrg()
156 void NS16550_init(NS16550_t com_port, int baud_divisor) in NS16550_init() argument
165 if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) in NS16550_init()
168 NS16550_setbrg(com_port, baud_divisor); in NS16550_init()
169 serial_out(0, &com_port->mdr1); in NS16550_init()
173 while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT)) in NS16550_init()
176 serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier); in NS16550_init()
178 serial_out(0x7, &com_port->mdr1); /* mode select reset TL16C750*/ in NS16550_init()
180 serial_out(UART_MCRVAL, &com_port->mcr); in NS16550_init()
181 serial_out(ns16550_getfcr(com_port), &com_port->fcr); in NS16550_init()
183 NS16550_setbrg(com_port, baud_divisor); in NS16550_init()
186 serial_out(0, &com_port->mdr1); in NS16550_init()
189 serial_out(UART_REG_VAL_PWREMU_MGMT_UART_ENABLE, &com_port->regC); in NS16550_init()
194 void NS16550_reinit(NS16550_t com_port, int baud_divisor) in NS16550_reinit() argument
196 serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier); in NS16550_reinit()
197 NS16550_setbrg(com_port, 0); in NS16550_reinit()
198 serial_out(UART_MCRVAL, &com_port->mcr); in NS16550_reinit()
199 serial_out(ns16550_getfcr(com_port), &com_port->fcr); in NS16550_reinit()
200 NS16550_setbrg(com_port, baud_divisor); in NS16550_reinit()
204 void NS16550_putc(NS16550_t com_port, char c) in NS16550_putc() argument
206 while ((serial_in(&com_port->lsr) & UART_LSR_THRE) == 0) in NS16550_putc()
208 serial_out(c, &com_port->thr); in NS16550_putc()
221 char NS16550_getc(NS16550_t com_port) in NS16550_getc() argument
223 while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) { in NS16550_getc()
230 return serial_in(&com_port->rbr); in NS16550_getc()
233 int NS16550_tstc(NS16550_t com_port) in NS16550_tstc() argument
235 return (serial_in(&com_port->lsr) & UART_LSR_DR) != 0; in NS16550_tstc()
246 struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; in _debug_uart_init() local
255 baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK, in _debug_uart_init()
257 serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER); in _debug_uart_init()
258 serial_dout(&com_port->mcr, UART_MCRVAL); in _debug_uart_init()
259 serial_dout(&com_port->fcr, UART_FCR_DEFVAL); in _debug_uart_init()
261 serial_dout(&com_port->lcr, UART_LCR_BKSE | UART_LCRVAL); in _debug_uart_init()
262 serial_dout(&com_port->dll, baud_divisor & 0xff); in _debug_uart_init()
263 serial_dout(&com_port->dlm, (baud_divisor >> 8) & 0xff); in _debug_uart_init()
264 serial_dout(&com_port->lcr, UART_LCRVAL); in _debug_uart_init()
269 struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; in _debug_uart_putc() local
271 while (!(serial_din(&com_port->lsr) & UART_LSR_THRE)) in _debug_uart_putc()
273 serial_dout(&com_port->thr, ch); in _debug_uart_putc()
286 struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; in _debug_uart_init() local
289 baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK, in _debug_uart_init()
291 serial_dout(&com_port->ier, CONFIG_SYS_NS16550_IER); in _debug_uart_init()
292 serial_dout(&com_port->mdr1, 0x7); in _debug_uart_init()
293 serial_dout(&com_port->mcr, UART_MCRVAL); in _debug_uart_init()
294 serial_dout(&com_port->fcr, UART_FCR_DEFVAL); in _debug_uart_init()
296 serial_dout(&com_port->lcr, UART_LCR_BKSE | UART_LCRVAL); in _debug_uart_init()
297 serial_dout(&com_port->dll, baud_divisor & 0xff); in _debug_uart_init()
298 serial_dout(&com_port->dlm, (baud_divisor >> 8) & 0xff); in _debug_uart_init()
299 serial_dout(&com_port->lcr, UART_LCRVAL); in _debug_uart_init()
300 serial_dout(&com_port->mdr1, 0x0); in _debug_uart_init()
305 struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; in _debug_uart_putc() local
307 while (!(serial_din(&com_port->lsr) & UART_LSR_THRE)) in _debug_uart_putc()
309 serial_dout(&com_port->thr, ch); in _debug_uart_putc()
319 struct NS16550 *const com_port = dev_get_priv(dev); in ns16550_serial_putc() local
321 if (!(serial_in(&com_port->lsr) & UART_LSR_THRE)) in ns16550_serial_putc()
323 serial_out(ch, &com_port->thr); in ns16550_serial_putc()
339 struct NS16550 *const com_port = dev_get_priv(dev); in ns16550_serial_pending() local
342 return (serial_in(&com_port->lsr) & UART_LSR_DR) ? 1 : 0; in ns16550_serial_pending()
344 return (serial_in(&com_port->lsr) & UART_LSR_THRE) ? 0 : 1; in ns16550_serial_pending()
349 struct NS16550 *const com_port = dev_get_priv(dev); in ns16550_serial_getc() local
351 if (!(serial_in(&com_port->lsr) & UART_LSR_DR)) in ns16550_serial_getc()
354 return serial_in(&com_port->rbr); in ns16550_serial_getc()
359 struct NS16550 *const com_port = dev_get_priv(dev); in ns16550_serial_setbrg() local
360 struct ns16550_platdata *plat = com_port->plat; in ns16550_serial_setbrg()
363 clock_divisor = ns16550_calc_divisor(com_port, plat->clock, baudrate); in ns16550_serial_setbrg()
365 NS16550_setbrg(com_port, clock_divisor); in ns16550_serial_setbrg()
372 struct NS16550 *const com_port = dev_get_priv(dev); in ns16550_serial_probe() local
374 com_port->plat = dev_get_platdata(dev); in ns16550_serial_probe()
375 NS16550_init(com_port, -1); in ns16550_serial_probe()