From: Jeremy Kerr <jk@ozlabs.org>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH 4/5] serial/aspeed-vuart: Implement rx throttling
Date: Wed, 21 Mar 2018 10:52:40 +0800 [thread overview]
Message-ID: <20180321025241.19785-5-jk@ozlabs.org> (raw)
In-Reply-To: <20180321025241.19785-1-jk@ozlabs.org>
The aspeed VUART runs at LPC bus frequency, rather than being restricted
to a typical UART baud rate. This means that the VUART can receive a lot
of data, which can overrun tty flip buffers, and/or cause a large amount
of interrupt traffic.
This change implements the uart_port->throttle & unthrottle callbacks,
implemented by disabling the receiver line status & received data
available IRQs.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
drivers/tty/serial/8250/8250_aspeed_vuart.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c
index 33a801353114..50c082b4a1ac 100644
--- a/drivers/tty/serial/8250/8250_aspeed_vuart.c
+++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c
@@ -183,6 +183,30 @@ static void aspeed_vuart_shutdown(struct uart_port *uart_port)
serial8250_do_shutdown(uart_port);
}
+static void aspeed_vuart_set_throttle(struct uart_port *port, bool throttle)
+{
+ unsigned char irqs = UART_IER_RLSI | UART_IER_RDI;
+ struct uart_8250_port *up = up_to_u8250p(port);
+ unsigned long flags;
+
+ spin_lock_irqsave(&port->lock, flags);
+ up->ier &= ~irqs;
+ if (!throttle)
+ up->ier |= irqs;
+ serial_out(up, UART_IER, up->ier);
+ spin_unlock_irqrestore(&port->lock, flags);
+}
+
+static void aspeed_vuart_throttle(struct uart_port *port)
+{
+ aspeed_vuart_set_throttle(port, true);
+}
+
+static void aspeed_vuart_unthrottle(struct uart_port *port)
+{
+ aspeed_vuart_set_throttle(port, false);
+}
+
static int aspeed_vuart_probe(struct platform_device *pdev)
{
struct uart_8250_port port;
@@ -212,6 +236,9 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
port.port.mapsize = resource_size(res);
port.port.startup = aspeed_vuart_startup;
port.port.shutdown = aspeed_vuart_shutdown;
+ port.port.throttle = aspeed_vuart_throttle;
+ port.port.unthrottle = aspeed_vuart_unthrottle;
+ port.port.status = UPSTAT_SYNC_FIFO;
port.port.dev = &pdev->dev;
rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
--
2.14.1
next prev parent reply other threads:[~2018-03-21 2:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 2:52 [PATCH 0/5] serial: implement flow control for ASPEED VUART driver Jeremy Kerr
2018-03-21 2:52 ` [PATCH 1/5] serial: Introduce UPSTAT_SYNC_FIFO for synchronised FIFOs Jeremy Kerr
2018-03-23 15:33 ` Greg Kroah-Hartman
2018-03-27 1:38 ` Jeremy Kerr
2018-03-23 15:50 ` Eddie James
2018-03-21 2:52 ` [PATCH 2/5] serial: expose buf_overrun count through proc interface Jeremy Kerr
2018-03-23 15:29 ` Greg Kroah-Hartman
2018-03-27 1:44 ` Jeremy Kerr
2018-03-23 15:50 ` Eddie James
2018-03-21 2:52 ` [PATCH 3/5] serial/8250: export serial8250_read_char Jeremy Kerr
2018-03-23 15:51 ` Eddie James
2018-03-21 2:52 ` Jeremy Kerr [this message]
2018-03-23 15:51 ` [PATCH 4/5] serial/aspeed-vuart: Implement rx throttling Eddie James
2018-03-21 2:52 ` [PATCH 5/5] serial/aspeed-vuart: Implement quick throttle mechanism Jeremy Kerr
2018-03-21 3:26 ` Joel Stanley
2018-03-21 3:32 ` Jeremy Kerr
2018-03-21 3:57 ` Jeremy Kerr
2018-03-21 4:36 ` [PATCH v2 " Jeremy Kerr
2018-03-23 15:51 ` [PATCH " Eddie James
2018-03-23 15:51 ` [PATCH 0/5] serial: implement flow control for ASPEED VUART driver Greg Kroah-Hartman
2018-03-27 3:38 ` Jeremy Kerr
2018-03-27 3:48 ` [PATCH v2 0/4] " Jeremy Kerr
2018-03-27 3:48 ` [PATCH v2 1/4] serial: Introduce UPSTAT_SYNC_FIFO for synchronised FIFOs Jeremy Kerr
2018-03-27 3:48 ` [PATCH v2 2/4] serial/8250: export serial8250_read_char Jeremy Kerr
2018-03-27 3:48 ` [PATCH v2 3/4] serial/aspeed-vuart: Implement rx throttling Jeremy Kerr
2018-03-27 3:48 ` [PATCH v2 4/4] serial/aspeed-vuart: Implement quick throttle mechanism Jeremy Kerr
2018-03-27 6:52 ` [PATCH v2 0/4] serial: implement flow control for ASPEED VUART driver Joel Stanley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180321025241.19785-5-jk@ozlabs.org \
--to=jk@ozlabs.org \
--cc=linux-aspeed@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).