Skip to contentSkip to conversation

serial/aspeed-vuart: Disable host TX discard mode during init

PATCH In review Jeremy Kerr 3 participants 3 messages Feb 9, 2016 – Feb 10, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial/aspeed-vuart: Disable host TX discard mode during init

If host TX discard mode is enabled, we don't see the LSR[RBR} bit getting set on new characters written on the host side. This makes the VUART a little useless.

This change set this bit during VUART initialisation, to disable host TX discard.

---
 drivers/tty/serial/aspeed-vuart.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/tty/serial/aspeed-vuart.c +14 -1
index f1988dd..a56d3a9 100644
@@ -20,7 +20,8 @@
 #include "8250/8250.h"
 
 #define AST_VUART_GCRA		0x20
-#define AST_VUART_GCRA_VUART_EN		0x1
+#define AST_VUART_GCRA_VUART_EN		0x01
+#define AST_VUART_GCRA_HOST_TX_DISCARD	0x20
 #define AST_VUART_GCRB		0x24
 #define AST_VUART_GCRB_HOST_SIRQ_MASK	0xf0
 #define AST_VUART_GCRB_HOST_SIRQ_SHIFT	4
@@ -143,6 +144,17 @@ static ssize_t ast_vuart_set_sirq(struct device *dev,
 static DEVICE_ATTR(sirq, S_IWUSR | S_IRUGO,
 		ast_vuart_show_sirq, ast_vuart_set_sirq);
 
+static void ast_vuart_setup(struct ast_vuart *vuart)
+{
+	u8 reg;
+
+	/* disable TX discard mode */
+	reg = readb(vuart->regs + AST_VUART_GCRA);
+	reg |= AST_VUART_GCRA_HOST_TX_DISCARD;
+	writeb(reg, vuart->regs + AST_VUART_GCRA);
+}
+
+
 /**
  * The device tree parsinc code here is heavily based on that of the of_serial
  * driver, but we have a few core differences, as we need to use our own
@@ -261,6 +273,7 @@ static int ast_vuart_probe(struct platform_device *pdev)
 
 	vuart->line = rc;
 	platform_set_drvdata(pdev, vuart);
+	ast_vuart_setup(vuart);
 
 	/* extra sysfs control */
 	rc = device_create_file(&pdev->dev, &dev_attr_lpc_address);
Signature · 1 line
2.5.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jeremy Kerr

If host TX discard mode is enabled, we don't see the LSR[RBR} bit getting set on new characters written on the host side. This makes the VUART a little useless.

This change set this bit during VUART initialisation, to disable host TX discard.

Thanks! I've pulled it in; I'll push it out once I've given it a spin.

Do you have some notes on how you tested it?

Quoted 2 lines
Quoted 51 lines
---
 drivers/tty/serial/aspeed-vuart.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/tty/serial/aspeed-vuart.c +14 -2
index f1988dd..a56d3a9 100644
@@ -20,7 +20,8 @@
 #include "8250/8250.h"
 
 #define AST_VUART_GCRA         0x20
-#define AST_VUART_GCRA_VUART_EN                0x1
+#define AST_VUART_GCRA_VUART_EN                0x01
+#define AST_VUART_GCRA_HOST_TX_DISCARD 0x20
 #define AST_VUART_GCRB         0x24
 #define AST_VUART_GCRB_HOST_SIRQ_MASK  0xf0
 #define AST_VUART_GCRB_HOST_SIRQ_SHIFT 4
@@ -143,6 +144,17 @@ static ssize_t ast_vuart_set_sirq(struct device *dev,
 static DEVICE_ATTR(sirq, S_IWUSR | S_IRUGO,
                ast_vuart_show_sirq, ast_vuart_set_sirq);
 
+static void ast_vuart_setup(struct ast_vuart *vuart)
+{
+       u8 reg;
+
+       /* disable TX discard mode */
+       reg = readb(vuart->regs + AST_VUART_GCRA);
+       reg |= AST_VUART_GCRA_HOST_TX_DISCARD;
+       writeb(reg, vuart->regs + AST_VUART_GCRA);
+}
+
+
 /**
  * The device tree parsinc code here is heavily based on that of the of_serial
  * driver, but we have a few core differences, as we need to use our own
@@ -261,6 +273,7 @@ static int ast_vuart_probe(struct platform_device *pdev)
 
        vuart->line = rc;
        platform_set_drvdata(pdev, vuart);
+       ast_vuart_setup(vuart);
 
        /* extra sysfs control */
        rc = device_create_file(&pdev->dev, &dev_attr_lpc_address);
--

2.5.0

_______________________________________________
openbmc mailing list
[email protected]
https://lists.ozlabs.org/listinfo/openbmc

Reviewed-by Joel Stanley
#2 lore raw

I've tested it pretty well too. I have powered on/off several times and
made sure boot makes it to petitboot and console behaves normal with the
menu. I would add Tested-by flag if someone could tell me how to do
that.

The only strange thing is that the screen utility hangs for several seconds when exiting (Ctrl-a k) console which it didn't do with regular UART.

Regards,
Norman James
IBM - POWER Systems Architect
Phone: 1-512-286-6807 (T/L: 363-6807)
Internet: [email protected]

From: Joel Stanley <[email protected]>
To: Jeremy Kerr <[email protected]>
Cc: OpenBMC Maillist <[email protected]>
Date: 02/09/2016 11:40 PM
Subject: Re: [PATCH] serial/aspeed-vuart: Disable host TX discard mode
during init
Sent by: "openbmc" <[email protected]>

Quoted 6 lines · Jeremy Kerr

If host TX discard mode is enabled, we don't see the LSR[RBR} bit getting set on new characters written on the host side. This makes the VUART a little useless.

This change set this bit during VUART initialisation, to disable host TX discard.

Thanks! I've pulled it in; I'll push it out once I've given it a spin.

Do you have some notes on how you tested it?

Quoted 2 lines

Review

Quoted 5 lines
---
 drivers/tty/serial/aspeed-vuart.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/tty/serial/aspeed-vuart.c

drivers/tty/serial/aspeed-vuart.c static ssize_t ast_vuart_set_sirq(struct device

Quoted 14 lines

index f1988dd..a56d3a9 100644

drivers/tty/serial/aspeed-vuart.c +2 -1
@@ -20,7 +20,8 @@
 #include "8250/8250.h"
 
 #define AST_VUART_GCRA         0x20
-#define AST_VUART_GCRA_VUART_EN                0x1
+#define AST_VUART_GCRA_VUART_EN                0x01
+#define AST_VUART_GCRA_HOST_TX_DISCARD 0x20
 #define AST_VUART_GCRB         0x24
 #define AST_VUART_GCRB_HOST_SIRQ_MASK  0xf0
 #define AST_VUART_GCRB_HOST_SIRQ_SHIFT 4
@@ -143,6 +144,17 @@ static ssize_t ast_vuart_set_sirq(struct device

*dev,

Quoted 6 lines
drivers/tty/serial/aspeed-vuart.c +3 -0
 static DEVICE_ATTR(sirq, S_IWUSR | S_IRUGO,
                ast_vuart_show_sirq, ast_vuart_set_sirq);
 
+static void ast_vuart_setup(struct ast_vuart *vuart)
+{
+       u8 reg;

drivers/tty/serial/aspeed-vuart.c static ssize_t ast_vuart_set_sirq(struct device *dev,

Quoted 10 lines
drivers/tty/serial/aspeed-vuart.c +8 -0
+
+       /* disable TX discard mode */
+       reg = readb(vuart->regs + AST_VUART_GCRA);
+       reg |= AST_VUART_GCRA_HOST_TX_DISCARD;
+       writeb(reg, vuart->regs + AST_VUART_GCRA);
+}
+
+
 /**
  * The device tree parsinc code here is heavily based on that of the

of_serial

drivers/tty/serial/aspeed-vuart.c static int ast_vuart_probe(struct platform_device

Quoted 2 lines
drivers/tty/serial/aspeed-vuart.c +0 -0
  * driver, but we have a few core differences, as we need to use our own
@@ -261,6 +273,7 @@ static int ast_vuart_probe(struct platform_device

*pdev)

Quoted 10 lines
drivers/tty/serial/aspeed-vuart.c +1 -1
        vuart->line = rc;
        platform_set_drvdata(pdev, vuart);
+       ast_vuart_setup(vuart);
 
        /* extra sysfs control */
        rc = device_create_file(&pdev->dev, &dev_attr_lpc_address);
--

2.5.0

Quoted 4 lines

_______________________________________________
openbmc mailing list
[email protected]
https://lists.ozlabs.org/listinfo/openbmc

_______________________________________________
openbmc mailing list
[email protected]
https://lists.ozlabs.org/listinfo/openbmc