Lines Matching +full:auto +full:- +full:baud
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2014-2016 Ricardo Ribalda, Qtechnology A/S
104 outb(reg, pdata->base_port + ADDR_PORT); in sio_read_reg()
105 return inb(pdata->base_port + DATA_PORT); in sio_read_reg()
110 outb(reg, pdata->base_port + ADDR_PORT); in sio_write_reg()
111 outb(data, pdata->base_port + DATA_PORT); in sio_write_reg()
126 return -EBUSY; in fintek_8250_enter_key()
148 return -ENODEV; in fintek_8250_check_id()
151 return -ENODEV; in fintek_8250_check_id()
165 return -ENODEV; in fintek_8250_check_id()
168 pdata->pid = chip; in fintek_8250_check_id()
175 switch (pdata->pid) { in fintek_8250_get_ldn_range()
191 return -ENODEV; in fintek_8250_get_ldn_range()
198 struct fintek_8250 *pdata = port->private_data; in fintek_8250_rs485_config()
201 return -EINVAL; in fintek_8250_rs485_config()
204 if (!(rs485->flags & SER_RS485_RTS_ON_SEND) == in fintek_8250_rs485_config()
205 !(rs485->flags & SER_RS485_RTS_AFTER_SEND)) in fintek_8250_rs485_config()
206 return -EINVAL; in fintek_8250_rs485_config()
208 if (rs485->flags & SER_RS485_ENABLED) { in fintek_8250_rs485_config()
209 memset(rs485->padding, 0, sizeof(rs485->padding)); in fintek_8250_rs485_config()
215 rs485->flags &= SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | in fintek_8250_rs485_config()
219 if (pdata->index) { in fintek_8250_rs485_config()
220 rs485->delay_rts_before_send = 0; in fintek_8250_rs485_config()
221 rs485->delay_rts_after_send = 0; in fintek_8250_rs485_config()
224 if (rs485->delay_rts_before_send) { in fintek_8250_rs485_config()
225 rs485->delay_rts_before_send = 1; in fintek_8250_rs485_config()
229 if (rs485->delay_rts_after_send) { in fintek_8250_rs485_config()
230 rs485->delay_rts_after_send = 1; in fintek_8250_rs485_config()
234 if (rs485->flags & SER_RS485_RTS_ON_SEND) in fintek_8250_rs485_config()
237 if (fintek_8250_enter_key(pdata->base_port, pdata->key)) in fintek_8250_rs485_config()
238 return -EBUSY; in fintek_8250_rs485_config()
240 sio_write_reg(pdata, LDN, pdata->index); in fintek_8250_rs485_config()
242 fintek_8250_exit_key(pdata->base_port); in fintek_8250_rs485_config()
244 port->rs485 = *rs485; in fintek_8250_rs485_config()
251 sio_write_reg(pdata, LDN, pdata->index); in fintek_8250_set_irq_mode()
253 switch (pdata->pid) { in fintek_8250_set_irq_mode()
279 switch (pdata->pid) { in fintek_8250_set_max_fifo()
296 sio_write_reg(pdata, LDN, pdata->index); in fintek_8250_goto_highspeed()
298 switch (pdata->pid) { in fintek_8250_goto_highspeed()
305 uart->port.uartclk = 921600 * 16; in fintek_8250_goto_highspeed()
316 struct fintek_8250 *pdata = port->private_data; in fintek_8250_set_termios()
317 unsigned int baud = tty_termios_baud_rate(termios); in fintek_8250_set_termios() local
326 * We'll use serial8250_do_set_termios() for baud = 0, otherwise It'll in fintek_8250_set_termios()
327 * crash on baudrate_table[i] % baud with "division by zero". in fintek_8250_set_termios()
329 if (!baud) in fintek_8250_set_termios()
332 switch (pdata->pid) { in fintek_8250_set_termios()
342 dev_warn(port->dev, in fintek_8250_set_termios()
344 __func__, pdata->pid); in fintek_8250_set_termios()
349 if (baud > baudrate_table[i] || baudrate_table[i] % baud != 0) in fintek_8250_set_termios()
352 if (port->uartclk == baudrate_table[i] * 16) in fintek_8250_set_termios()
355 if (fintek_8250_enter_key(pdata->base_port, pdata->key)) in fintek_8250_set_termios()
358 port->uartclk = baudrate_table[i] * 16; in fintek_8250_set_termios()
360 sio_write_reg(pdata, LDN, pdata->index); in fintek_8250_set_termios()
364 fintek_8250_exit_key(pdata->base_port); in fintek_8250_set_termios()
369 baud = tty_termios_baud_rate(old); in fintek_8250_set_termios()
370 tty_termios_encode_baud_rate(termios, baud, baud); in fintek_8250_set_termios()
379 struct fintek_8250 *pdata = uart->port.private_data; in fintek_8250_set_termios_handler()
381 switch (pdata->pid) { in fintek_8250_set_termios_handler()
385 uart->port.set_termios = fintek_8250_set_termios; in fintek_8250_set_termios_handler()
404 pdata->base_port = addr[i]; in probe_setup_port()
405 pdata->key = keys[j]; in probe_setup_port()
421 if (aux != uart->port.iobase) in probe_setup_port()
424 pdata->index = k; in probe_setup_port()
426 irq_data = irq_get_irq_data(uart->port.irq); in probe_setup_port()
444 return -ENODEV; in probe_setup_port()
449 struct fintek_8250 *pdata = uart->port.private_data; in fintek_8250_set_rs485_handler()
451 switch (pdata->pid) { in fintek_8250_set_rs485_handler()
457 uart->port.rs485_config = fintek_8250_rs485_config; in fintek_8250_set_rs485_handler()
460 default: /* No RS485 Auto direction functional */ in fintek_8250_set_rs485_handler()
471 return -ENODEV; in fintek_8250_probe()
473 pdata = devm_kzalloc(uart->port.dev, sizeof(*pdata), GFP_KERNEL); in fintek_8250_probe()
475 return -ENOMEM; in fintek_8250_probe()
478 uart->port.private_data = pdata; in fintek_8250_probe()