linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: wenhua lin <wenhua.lin1994@gmail.com>
Cc: Wenhua Lin <Wenhua.Lin@unisoc.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xiongpeng Wu <xiongpeng.wu@unisoc.com>
Subject: Re: [PATCH] serial: sprd: Support 12 uart ports
Date: Wed, 9 Aug 2023 14:26:52 +0800	[thread overview]
Message-ID: <f808a0c7-013d-9999-8c2d-435609f9fde4@linux.alibaba.com> (raw)
In-Reply-To: <CAB9BWhdh8CXuWAQGir=9QqLPdVaN8hgmqii9Da=buSj=9BWJaw@mail.gmail.com>



On 8/9/2023 1:52 PM, wenhua lin wrote:
> 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.

>>
>> On 8/7/2023 4:07 PM, Wenhua Lin wrote:
>>> From: Wenhua Lin <wenhua.lin@unisoc.com>
>>>
>>> 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.

>>> Signed-off-by: Wenhua Lin <wenhua.lin@unisoc.com>
>>> ---
>>>    drivers/tty/serial/sprd_serial.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
>>> index b58f51296ace..2774df490899 100644
>>> --- a/drivers/tty/serial/sprd_serial.c
>>> +++ b/drivers/tty/serial/sprd_serial.c
>>> @@ -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

  parent reply	other threads:[~2023-08-09  6:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07  8:07 [PATCH] serial: sprd: Support 12 uart ports Wenhua Lin
2023-08-07  8:41 ` Baolin Wang
2023-08-09  5:52   ` wenhua lin
2023-08-09  6:23     ` Chunyan Zhang
2023-08-09  6:26     ` Baolin Wang [this message]
2023-08-09 11:27       ` wenhua lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f808a0c7-013d-9999-8c2d-435609f9fde4@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=Wenhua.Lin@unisoc.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=wenhua.lin1994@gmail.com \
    --cc=xiongpeng.wu@unisoc.com \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).