mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [PATCH 0/3] tty: serial: meson: small code improvements
@ 2017-11-17 18:17 Martin Blumenstingl
  2017-11-17 18:17 ` [PATCH 1/3] tty: serial: meson: remove duplicate "clear error" bit definition Martin Blumenstingl
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Martin Blumenstingl @ 2017-11-17 18:17 UTC (permalink / raw)
  To: linus-amlogic

The goal of this series is to make some the pre-processor defines also
useful for humans (like me) who want to compare register dumps.
These patches should not have any functional impact (which is also why
I didn't add a "Fixes" tag).


Martin Blumenstingl (3):
  tty: serial: meson: remove duplicate "clear error" bit definition
  tty: serial: meson: merge the two register sections for
    AML_UART_CONTROL
  tty: serial: meson: fix typo in the "stop bit" register definition

 drivers/tty/serial/meson_uart.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] tty: serial: meson: remove duplicate "clear error" bit definition
  2017-11-17 18:17 [PATCH 0/3] tty: serial: meson: small code improvements Martin Blumenstingl
@ 2017-11-17 18:17 ` Martin Blumenstingl
  2017-11-17 18:18 ` [PATCH 2/3] tty: serial: meson: merge the two register sections for AML_UART_CONTROL Martin Blumenstingl
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Martin Blumenstingl @ 2017-11-17 18:17 UTC (permalink / raw)
  To: linus-amlogic

The "clear error" bit in the AML_UART_CONTROL register is defined twice.
Remove the AML_UART_CLR_ERR definition and replace it with
AML_UART_CLEAR_ERR.
AML_UART_CLEAR_ERR was chosen to be kept since the datasheet's
description for this bit is "Clear Error" (so developer's don't have to
translate this to "CLR_ERR").
No functional changes intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/tty/serial/meson_uart.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index daafe60175da..78b5d2d15a97 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -36,7 +36,6 @@
 #define AML_UART_RX_EN			BIT(13)
 #define AML_UART_TX_RST			BIT(22)
 #define AML_UART_RX_RST			BIT(23)
-#define AML_UART_CLR_ERR		BIT(24)
 #define AML_UART_RX_INT_EN		BIT(27)
 #define AML_UART_TX_INT_EN		BIT(28)
 #define AML_UART_DATA_LEN_MASK		(0x03 << 20)
@@ -263,10 +262,10 @@ static void meson_uart_reset(struct uart_port *port)
 	u32 val;
 
 	val = readl(port->membase + AML_UART_CONTROL);
-	val |= (AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR);
+	val |= (AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLEAR_ERR);
 	writel(val, port->membase + AML_UART_CONTROL);
 
-	val &= ~(AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR);
+	val &= ~(AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLEAR_ERR);
 	writel(val, port->membase + AML_UART_CONTROL);
 }
 
@@ -276,9 +275,9 @@ static int meson_uart_startup(struct uart_port *port)
 	int ret = 0;
 
 	val = readl(port->membase + AML_UART_CONTROL);
-	val |= AML_UART_CLR_ERR;
+	val |= AML_UART_CLEAR_ERR;
 	writel(val, port->membase + AML_UART_CONTROL);
-	val &= ~AML_UART_CLR_ERR;
+	val &= ~AML_UART_CLEAR_ERR;
 	writel(val, port->membase + AML_UART_CONTROL);
 
 	val |= (AML_UART_RX_EN | AML_UART_TX_EN);
-- 
2.15.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] tty: serial: meson: merge the two register sections for AML_UART_CONTROL
  2017-11-17 18:17 [PATCH 0/3] tty: serial: meson: small code improvements Martin Blumenstingl
  2017-11-17 18:17 ` [PATCH 1/3] tty: serial: meson: remove duplicate "clear error" bit definition Martin Blumenstingl
@ 2017-11-17 18:18 ` Martin Blumenstingl
  2017-11-17 18:18 ` [PATCH 3/3] tty: serial: meson: fix typo in the "stop bit" register definition Martin Blumenstingl
  2017-12-07  0:53 ` [PATCH 0/3] tty: serial: meson: small code improvements Kevin Hilman
  3 siblings, 0 replies; 5+ messages in thread
From: Martin Blumenstingl @ 2017-11-17 18:18 UTC (permalink / raw)
  To: linus-amlogic

In the code there are two separate sections which each describe some of
the bits in the AML_UART_CONTROL register.
Merge these into one section to make the code easier to read.
No functional changes intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/tty/serial/meson_uart.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 78b5d2d15a97..72d425579a4d 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -34,8 +34,15 @@
 /* AML_UART_CONTROL bits */
 #define AML_UART_TX_EN			BIT(12)
 #define AML_UART_RX_EN			BIT(13)
+#define AML_UART_TWO_WIRE_EN		BIT(15)
+#define AML_UART_STOP_BIN_LEN_MASK	(0x03 << 16)
+#define AML_UART_STOP_BIN_1SB		(0x00 << 16)
+#define AML_UART_STOP_BIN_2SB		(0x01 << 16)
+#define AML_UART_PARITY_TYPE		BIT(18)
+#define AML_UART_PARITY_EN		BIT(19)
 #define AML_UART_TX_RST			BIT(22)
 #define AML_UART_RX_RST			BIT(23)
+#define AML_UART_CLEAR_ERR		BIT(24)
 #define AML_UART_RX_INT_EN		BIT(27)
 #define AML_UART_TX_INT_EN		BIT(28)
 #define AML_UART_DATA_LEN_MASK		(0x03 << 20)
@@ -56,15 +63,6 @@
 					 AML_UART_FRAME_ERR  | \
 					 AML_UART_TX_FIFO_WERR)
 
-/* AML_UART_CONTROL bits */
-#define AML_UART_TWO_WIRE_EN		BIT(15)
-#define AML_UART_PARITY_TYPE		BIT(18)
-#define AML_UART_PARITY_EN		BIT(19)
-#define AML_UART_CLEAR_ERR		BIT(24)
-#define AML_UART_STOP_BIN_LEN_MASK	(0x03 << 16)
-#define AML_UART_STOP_BIN_1SB		(0x00 << 16)
-#define AML_UART_STOP_BIN_2SB		(0x01 << 16)
-
 /* AML_UART_MISC bits */
 #define AML_UART_XMIT_IRQ(c)		(((c) & 0xff) << 8)
 #define AML_UART_RECV_IRQ(c)		((c) & 0xff)
-- 
2.15.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] tty: serial: meson: fix typo in the "stop bit" register definition
  2017-11-17 18:17 [PATCH 0/3] tty: serial: meson: small code improvements Martin Blumenstingl
  2017-11-17 18:17 ` [PATCH 1/3] tty: serial: meson: remove duplicate "clear error" bit definition Martin Blumenstingl
  2017-11-17 18:18 ` [PATCH 2/3] tty: serial: meson: merge the two register sections for AML_UART_CONTROL Martin Blumenstingl
@ 2017-11-17 18:18 ` Martin Blumenstingl
  2017-12-07  0:53 ` [PATCH 0/3] tty: serial: meson: small code improvements Kevin Hilman
  3 siblings, 0 replies; 5+ messages in thread
From: Martin Blumenstingl @ 2017-11-17 18:18 UTC (permalink / raw)
  To: linus-amlogic

This simply fixes a typo in the preprocessor macros. No functional
changes intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/tty/serial/meson_uart.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 72d425579a4d..8a842591b37c 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -35,9 +35,9 @@
 #define AML_UART_TX_EN			BIT(12)
 #define AML_UART_RX_EN			BIT(13)
 #define AML_UART_TWO_WIRE_EN		BIT(15)
-#define AML_UART_STOP_BIN_LEN_MASK	(0x03 << 16)
-#define AML_UART_STOP_BIN_1SB		(0x00 << 16)
-#define AML_UART_STOP_BIN_2SB		(0x01 << 16)
+#define AML_UART_STOP_BIT_LEN_MASK	(0x03 << 16)
+#define AML_UART_STOP_BIT_1SB		(0x00 << 16)
+#define AML_UART_STOP_BIT_2SB		(0x01 << 16)
 #define AML_UART_PARITY_TYPE		BIT(18)
 #define AML_UART_PARITY_EN		BIT(19)
 #define AML_UART_TX_RST			BIT(22)
@@ -351,11 +351,11 @@ static void meson_uart_set_termios(struct uart_port *port,
 	else
 		val &= ~AML_UART_PARITY_TYPE;
 
-	val &= ~AML_UART_STOP_BIN_LEN_MASK;
+	val &= ~AML_UART_STOP_BIT_LEN_MASK;
 	if (cflags & CSTOPB)
-		val |= AML_UART_STOP_BIN_2SB;
+		val |= AML_UART_STOP_BIT_2SB;
 	else
-		val |= AML_UART_STOP_BIN_1SB;
+		val |= AML_UART_STOP_BIT_1SB;
 
 	if (cflags & CRTSCTS)
 		val &= ~AML_UART_TWO_WIRE_EN;
-- 
2.15.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 0/3] tty: serial: meson: small code improvements
  2017-11-17 18:17 [PATCH 0/3] tty: serial: meson: small code improvements Martin Blumenstingl
                   ` (2 preceding siblings ...)
  2017-11-17 18:18 ` [PATCH 3/3] tty: serial: meson: fix typo in the "stop bit" register definition Martin Blumenstingl
@ 2017-12-07  0:53 ` Kevin Hilman
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2017-12-07  0:53 UTC (permalink / raw)
  To: linus-amlogic

Martin Blumenstingl <martin.blumenstingl@googlemail.com> writes:

> The goal of this series is to make some the pre-processor defines also
> useful for humans (like me) who want to compare register dumps.
> These patches should not have any functional impact (which is also why
> I didn't add a "Fixes" tag).
>
>
> Martin Blumenstingl (3):
>   tty: serial: meson: remove duplicate "clear error" bit definition
>   tty: serial: meson: merge the two register sections for
>     AML_UART_CONTROL
>   tty: serial: meson: fix typo in the "stop bit" register definition
>
>  drivers/tty/serial/meson_uart.c | 31 ++++++++++++++-----------------
>  1 file changed, 14 insertions(+), 17 deletions(-)

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-07  0:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17 18:17 [PATCH 0/3] tty: serial: meson: small code improvements Martin Blumenstingl
2017-11-17 18:17 ` [PATCH 1/3] tty: serial: meson: remove duplicate "clear error" bit definition Martin Blumenstingl
2017-11-17 18:18 ` [PATCH 2/3] tty: serial: meson: merge the two register sections for AML_UART_CONTROL Martin Blumenstingl
2017-11-17 18:18 ` [PATCH 3/3] tty: serial: meson: fix typo in the "stop bit" register definition Martin Blumenstingl
2017-12-07  0:53 ` [PATCH 0/3] tty: serial: meson: small code improvements Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®