Skip to contentSkip to conversation

serial: sprd: Support 12 uart ports

PATCH In review Wenhua Lin 4 participants 6 messages Aug 7, 2023 – Aug 9, 2023

Subsystems (2)
lore
Share & tools
lore

Wenhua Lin

author
#0 lore raw

PATCH 1/1 serial: sprd: Support 12 uart ports

From: Wenhua Lin <[email protected]>

Support 12 uart ports, which can solve the problem of insufficient uart ports.

---
 drivers/tty/serial/sprd_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sprd_serial.c +1 -1
index b58f51296ace..2774df490899 100644
@@ -22,7 +22,7 @@
 #include <linux/tty_flip.h>
 
 /* device name */
-#define UART_NR_MAX		8
+#define UART_NR_MAX		12
 #define SPRD_TTY_NAME		"ttyS"
 #define SPRD_FIFO_SIZE		128
 #define SPRD_DEF_RATE		26000000
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Wenhua Lin

From: Wenhua Lin <[email protected]>

Support 12 uart ports, which can solve the problem of insufficient uart ports.

This sounds incorrect to me.
If this is a software bug, please add a Fixes tag to backport for stable kernels. If the change of the max ports is only avaliable on the new SPRD serial hardware, you should ensure the change is backward-compatibility with old hardware.

Quoted 18 lines
---
  drivers/tty/serial/sprd_serial.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sprd_serial.c +1 -1
index b58f51296ace..2774df490899 100644
@@ -22,7 +22,7 @@
  #include <linux/tty_flip.h>
 
  /* device name */
-#define UART_NR_MAX		8
+#define UART_NR_MAX		12
  #define SPRD_TTY_NAME		"ttyS"
  #define SPRD_FIFO_SIZE		128
  #define SPRD_DEF_RATE		26000000
#2 lore raw

The change of the max ports is to adapt to an new
SPRD serial hardware,also is backward-compatibility with old hardware.

Quoted 33 lines · Baolin Wang <[email protected]> 于2023年8月7日周一 16:41写道:
Quoted 4 lines · Wenhua Lin

From: Wenhua Lin <[email protected]>

Support 12 uart ports, which can solve the problem of insufficient uart ports.

This sounds incorrect to me.
If this is a software bug, please add a Fixes tag to backport for stable kernels. If the change of the max ports is only avaliable on the new SPRD serial hardware, you should ensure the change is backward-compatibility with old hardware.

Quoted 18 lines
---
  drivers/tty/serial/sprd_serial.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sprd_serial.c +1 -1
index b58f51296ace..2774df490899 100644
@@ -22,7 +22,7 @@
  #include <linux/tty_flip.h>
 
  /* device name */
-#define UART_NR_MAX          8
+#define UART_NR_MAX          12
  #define SPRD_TTY_NAME               "ttyS"
  #define SPRD_FIFO_SIZE              128
  #define SPRD_DEF_RATE               26000000
reviewer
#3 lore raw
Quoted 3 lines · wenhua lin

The change of the max ports is to adapt to an new
SPRD serial hardware,also is backward-compatibility with old hardware.

This change seems not backward-compatible if the serial devices on some old Unisoc SoCs can support 8 ports only.

BTW, please do not top-post your reply.

Thanks,
Chunyan

Quoted 35 lines
Quoted 33 lines · Baolin Wang <[email protected]> 于2023年8月7日周一 16:41写道:
Quoted 4 lines · Wenhua Lin

From: Wenhua Lin <[email protected]>

Support 12 uart ports, which can solve the problem of insufficient uart ports.

This sounds incorrect to me.
If this is a software bug, please add a Fixes tag to backport for stable kernels. If the change of the max ports is only avaliable on the new SPRD serial hardware, you should ensure the change is backward-compatibility with old hardware.

Quoted 18 lines
---
  drivers/tty/serial/sprd_serial.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sprd_serial.c +1 -1
index b58f51296ace..2774df490899 100644
@@ -22,7 +22,7 @@
  #include <linux/tty_flip.h>
 
  /* device name */
-#define UART_NR_MAX          8
+#define UART_NR_MAX          12
  #define SPRD_TTY_NAME               "ttyS"
  #define SPRD_FIFO_SIZE              128
  #define SPRD_DEF_RATE               26000000
#4 lore raw
In reply to wenhua lin
Quoted 2 lines · wenhua lin

The change of the max ports is to adapt to an new
SPRD serial hardware,also is backward-compatibility with old hardware.

Again, DO NOT top-posting! Thanks.

Quoted 4 lines
Quoted 4 lines · Wenhua Lin
Quoted 2 lines

From: Wenhua Lin <[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Support 12 uart ports, which can solve the problem of insufficient uart ports.

This sounds incorrect to me.
If this is a software bug, please add a Fixes tag to backport for stable kernels. If the change of the max ports is only avaliable on the new SPRD serial hardware, you should ensure the change is backward-compatibility with old hardware.

This is not backward-compatibility. Please see 'sprd_uart_driver' structure as below:

static struct uart_driver sprd_uart_driver = {
.owner = THIS_MODULE,
.driver_name = "sprd_serial",
.dev_name = SPRD_TTY_NAME,
.major = 0,
.minor = 0,
.nr = UART_NR_MAX,
.cons = SPRD_CONSOLE,
};

That means you will still register 12 UART ports in the tty for old serial hardwares which actually only support 8 UART ports, and if users want to use another 4 ports which are not supported in the hardware, then system crashes.

So I think you should add a SoC data in 'serial_ids' to change the number of UART port according to different SoC.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
---
   drivers/tty/serial/sprd_serial.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sprd_serial.c +1 -1
index b58f51296ace..2774df490899 100644
@@ -22,7 +22,7 @@
   #include <linux/tty_flip.h>
 
   /* device name */
-#define UART_NR_MAX          8
+#define UART_NR_MAX          12
   #define SPRD_TTY_NAME               "ttyS"
   #define SPRD_FIFO_SIZE              128
   #define SPRD_DEF_RATE               26000000
#5 lore raw
Quoted 8 lines · Baolin Wang
Quoted 2 lines · wenhua lin

The change of the max ports is to adapt to an new
SPRD serial hardware,also is backward-compatibility with old hardware.

Again, DO NOT top-posting! Thanks.

Thank you for your correction.

Quoted 27 lines
Quoted 5 lines
Quoted 5 lines · Wenhua Lin
Quoted 2 lines

From: Wenhua Lin <[email protected]>

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Support 12 uart ports, which can solve the problem of insufficient uart ports.

This sounds incorrect to me.
If this is a software bug, please add a Fixes tag to backport for stable kernels. If the change of the max ports is only avaliable on the new SPRD serial hardware, you should ensure the change is backward-compatibility with old hardware.

This is not backward-compatibility. Please see 'sprd_uart_driver' structure as below:

static struct uart_driver sprd_uart_driver = {
.owner = THIS_MODULE,
.driver_name = "sprd_serial",
.dev_name = SPRD_TTY_NAME,
.major = 0,
.minor = 0,
.nr = UART_NR_MAX,
.cons = SPRD_CONSOLE,
};

Quoted 8 lines

That means you will still register 12 UART ports in the tty for old serial hardwares which actually only support 8 UART ports, and if users want to use another 4 ports which are not supported in the hardware, then system crashes.

So I think you should add a SoC data in 'serial_ids' to change the number of UART port according to different SoC.

Thank you for your valuable comments, we should probably consider how to make changes based on your suggestions.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
---
   drivers/tty/serial/sprd_serial.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sprd_serial.c +1 -1
index b58f51296ace..2774df490899 100644
@@ -22,7 +22,7 @@
   #include <linux/tty_flip.h>
 
   /* device name */
-#define UART_NR_MAX          8
+#define UART_NR_MAX          12
   #define SPRD_TTY_NAME               "ttyS"
   #define SPRD_FIFO_SIZE              128
   #define SPRD_DEF_RATE               26000000