]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
serial: 8250: Allow drivers to deliver capabilities
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Thu, 10 Jan 2013 09:25:05 +0000 (11:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jan 2013 07:02:59 +0000 (23:02 -0800)
Modern UARTs are able to provide information about their
capabilities such as FIFO size. This allows the drivers to
deliver this information to 8250.c when they are registering
ports.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Jamie Iles <jamie@jamieiles.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250.c

index 0d771ec16750072537c7021a9c0117acf0fbfdcd..e2ac25a037ef31ec24e1c965f77758b029666b70 100644 (file)
@@ -1911,9 +1911,12 @@ static int serial8250_startup(struct uart_port *port)
        if (port->type == PORT_8250_CIR)
                return -ENODEV;
 
-       port->fifosize = uart_config[up->port.type].fifo_size;
-       up->tx_loadsz = uart_config[up->port.type].tx_loadsz;
-       up->capabilities = uart_config[up->port.type].flags;
+       if (!port->fifosize)
+               port->fifosize = uart_config[port->type].fifo_size;
+       if (!up->tx_loadsz)
+               up->tx_loadsz = uart_config[port->type].tx_loadsz;
+       if (!up->capabilities)
+               up->capabilities = uart_config[port->type].flags;
        up->mcr = 0;
 
        if (port->iotype != up->cur_iotype)
@@ -2746,9 +2749,12 @@ static void
 serial8250_init_fixed_type_port(struct uart_8250_port *up, unsigned int type)
 {
        up->port.type = type;
-       up->port.fifosize = uart_config[type].fifo_size;
-       up->capabilities = uart_config[type].flags;
-       up->tx_loadsz = uart_config[type].tx_loadsz;
+       if (!up->port.fifosize)
+               up->port.fifosize = uart_config[type].fifo_size;
+       if (!up->tx_loadsz)
+               up->tx_loadsz = uart_config[type].tx_loadsz;
+       if (!up->capabilities)
+               up->capabilities = uart_config[type].flags;
 }
 
 static void __init
@@ -3182,6 +3188,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
                uart->bugs              = up->bugs;
                uart->port.mapbase      = up->port.mapbase;
                uart->port.private_data = up->port.private_data;
+               uart->port.fifosize     = up->port.fifosize;
+               uart->tx_loadsz         = up->tx_loadsz;
+               uart->capabilities      = up->capabilities;
+
                if (up->port.dev)
                        uart->port.dev = up->port.dev;