--- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -483,6 +484,8 @@ static inline int __uart_put_char(struct static int uart_put_char(struct tty_struct *tty, unsigned char ch) { struct uart_state *state = tty->driver_data; + // FIXME KARL - we may need to do something here or rs485 as well + printk(KERN_INFO "KARL - bad put char was called\n"); return __uart_put_char(state->uart_port, &state->xmit, ch); } @@ -531,7 +534,17 @@ static int uart_write(struct tty_struct } spin_unlock_irqrestore(&port->lock, flags); + // FIXME - look at checking driver flags here for rs485, see cris**.c + gpio_set_value(0, 1); // tx enable please! + //mdelay(2); // rts before uart_start(tty); + //FIXME - same here. if (info->rs485.flags & SER_RS485_ENABLED) + uart_wait_until_sent(tty, port->timeout); + + //mdelay(1); // rts after + //udelay(250); + gpio_set_value(0, 0); + return ret; } @@ -1365,7 +1378,9 @@ static void uart_wait_until_sent(struct * we wait. */ while (!port->ops->tx_empty(port)) { - msleep_interruptible(jiffies_to_msecs(char_time)); + // FIXME - try without interruptible? + //msleep_interruptible(jiffies_to_msecs(char_time)); + udelay(50); if (signal_pending(current)) break; if (time_after(jiffies, expire)) @@ -2360,6 +2375,15 @@ int uart_add_one_port(struct uart_driver */ uport->flags &= ~UPF_DEAD; + ret = gpio_request_one(0, GPIOF_OUT_INIT_LOW, "TX-Enable"); + if (ret) { + printk(KERN_ALERT "KARL: couldn't allocate gpio 0, pretending it worked\n"); + //return retval; + } else { + printk(KERN_INFO "Karl: it worked, we grabbed a gpio\n"); + } + + out: mutex_unlock(&port->mutex); mutex_unlock(&port_mutex);