tty: serial: meson: small code improvements
Subsystems (2)
Martin Blumenstingl
reviewercover tty: serial: meson: small code improvements
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(-)
Signature · 1 line
2.15.0
Martin Blumenstingl
reviewerPATCH 1/3 tty: serial: meson: remove duplicate "clear error" bit definition
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.
--- drivers/tty/serial/meson_uart.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/tty/serial/meson_uart.c +4 -5
@@ -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 );
Signature · 1 line
2.15.0
Martin Blumenstingl
reviewerPATCH 2/3 tty: serial: meson: merge the two register sections for AML_UART_CONTROL
In reply to Martin BlumenstinglIn 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.
--- drivers/tty/serial/meson_uart.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/tty/serial/meson_uart.c +7 -9
@@ -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)
Signature · 1 line
2.15.0
Martin Blumenstingl
reviewerPATCH 3/3 tty: serial: meson: fix typo in the "stop bit" register definition
In reply to Martin BlumenstinglThis simply fixes a typo in the preprocessor macros. No functional changes intended.
--- drivers/tty/serial/meson_uart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/tty/serial/meson_uart.c +6 -6
@@ -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 ;
Signature · 1 line
2.15.0
Kevin Hilman
maintainercover tty: serial: meson: small code improvements
In reply to Martin BlumenstinglQuoted 6 lines · Martin Blumenstingl
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).
Quoted 8 lines
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 definitiondrivers/tty/serial/meson_uart.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)