drivers/tty/serial/8250: Make Aspeed VUART SIRQ polarity configurable
Make the SIRQ polarity for Aspeed AST24xx/25xx VUART configurable via
sysfs. This setting need to be changed on specific host platforms
depending on the selected host interface (LPC / eSPI).
The setting is configurable via sysfs rather than device-tree to stay in
line with other related configurable settings.
On AST2500 the VUART SIRQ polarity can be auto-configured by reading a
bit from a configuration register, e.g. the LPC/eSPI interface
configuration bit.
int tty_sirq_polarity;
int tty_lpc_addr;
speed_t tty_baud;
int tty_fd;
@@ -256,6 +257,8 @@ static int tty_init_io(struct console *console)
{
if (console->tty_sirq)
tty_set_sysfs_attr(console, "sirq", console->tty_sirq);
From 6f21f2dc57bb5b469e370946d998a6efce0c9c93 Mon Sep 17 00:00:00 2001 From: Ainux wangyao@lemote.com Date: Thu, 7 May 2020 14:57:08 +0800 Subject: [PATCH] console-server: Add sirq polarity support
Kernel upstream: commit 8d310c9107a2a3f19dc7bb54dd50f70c65ef5409
drivers/tty/serial/8250: Make Aspeed VUART SIRQ polarity configurable
Make the SIRQ polarity for Aspeed AST24xx/25xx VUART configurable via sysfs. This setting need to be changed on specific host platforms depending on the selected host interface (LPC / eSPI).
The setting is configurable via sysfs rather than device-tree to stay in line with other related configurable settings.
On AST2500 the VUART SIRQ polarity can be auto-configured by reading a bit from a configuration register, e.g. the LPC/eSPI interface configuration bit.
So we need add sirq polarity support.
console-server.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/console-server.c b/console-server.c index d814dff..6e4925f 100644 --- a/console-server.c +++ b/console-server.c @@ -49,6 +49,7 @@ struct console { char tty_sysfs_devnode; char tty_dev; int tty_sirq;
int tty_sirq_polarity; int tty_lpc_addr; speed_t tty_baud; int tty_fd; @@ -256,6 +257,8 @@ static int tty_init_io(struct console *console) { if (console->tty_sirq) tty_set_sysfs_attr(console, "sirq", console->tty_sirq);
if (console->tty_sirq_polarity)
tty_set_sysfs_attr(console, "sirq_polarity", console->tty_sirq_polarity); if (console->tty_lpc_addr) tty_set_sysfs_attr(console, "lpc_address", console->tty_lpc_addr); @@ -301,6 +304,13 @@ static int tty_init(struct console console, struct config config) warn("Invalid sirq: '%s'", val); }
val = config_get_value(config, "sirq-polarity");
if (val) {
console->tty_sirq_polarity = strtoul(val, &endp, 0);
if (endp == optarg)
warn("Invalid sirq polarity: '%s'", val);
}
val = config_get_value(config, "baud"); if (val) { if (config_parse_baud(&console->tty_baud, val)) -- 2.18.1