/* set_rx_timeout - Set rx timeout and threshold values. @port: port to use @timeout: timeout value in ticks  */
static int set_rx_timeout(struct ioc3_port *port, int timeout)
/* set_rx_timeout - Set rx timeout and threshold values. @port: port to use @timeout: timeout value in ticks  */
static int set_rx_timeout(struct ioc3_port *port, int timeout)
{
	int threshold;
	port->ip_rx_timeout = timeout;
	threshold = timeout * port->ip_baud / 4000;
	if (threshold == 0)
		threshold = 1;
	if ((unsigned)threshold > (unsigned)SSCR_RX_THRESHOLD)
		return 1;
	port->ip_sscr &= ~SSCR_RX_THRESHOLD;
	port->ip_sscr |= threshold;
	writel(port->ip_sscr, &port->ip_serial_regs->sscr);
	timeout = timeout * SRTR_HZ / 100;
	if (timeout > SRTR_CNT)
		timeout = SRTR_CNT;
	writel(timeout, &port->ip_serial_regs->srtr);
	return 0;
}