summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThor Thayer <tthayer@opensource.altera.com>2016-09-22 19:56:15 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-27 10:55:49 (GMT)
commitffea043965e4634617485b4d313d6c0099d817f0 (patch)
treeec0b2c3bea4bc880dbbd26c5bf40fca4a460c429
parent51311eaacd2d3558cfa341e97d7ebffb1cc13cd8 (diff)
downloadlinux-ffea043965e4634617485b4d313d6c0099d817f0.tar.xz
serial: 8250: of: Load TX FIFO Threshold from DT
Initialize the tx_loadsz parameter from passed in devicetree tx-threshold parameter. The tx_loadsz is calculated as the number of bytes to fill FIFO when tx-threshold is triggered. Signed-off-by: Thor Thayer <tthayer@opensource.altera.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/8250/8250_of.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index 38963d7..7a8b5fc 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -195,6 +195,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
switch (port_type) {
case PORT_8250 ... PORT_MAX_8250:
{
+ u32 tx_threshold;
struct uart_8250_port port8250;
memset(&port8250, 0, sizeof(port8250));
port8250.port = port;
@@ -202,6 +203,12 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
if (port.fifosize)
port8250.capabilities = UART_CAP_FIFO;
+ /* Check for TX FIFO threshold & set tx_loadsz */
+ if ((of_property_read_u32(ofdev->dev.of_node, "tx-threshold",
+ &tx_threshold) == 0) &&
+ (tx_threshold < port.fifosize))
+ port8250.tx_loadsz = port.fifosize - tx_threshold;
+
if (of_property_read_bool(ofdev->dev.of_node,
"auto-flow-control"))
port8250.capabilities |= UART_CAP_AFE;