From: Greg KH <gregkh@linuxfoundation.org>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: "jirislaby@kernel.org" <jirislaby@kernel.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>
Subject: Re: [PATCH] tty: serial: fsl_lpuart: increase maximum uart_nr to 12
Date: Tue, 7 Jan 2025 09:43:26 +0100 [thread overview]
Message-ID: <2025010738-uplifting-avenging-63e8@gregkh> (raw)
In-Reply-To: <DB9PR04MB84290597CC2BA6CFA096849B92112@DB9PR04MB8429.eurprd04.prod.outlook.com>
On Tue, Jan 07, 2025 at 08:29:12AM +0000, Sherry Sun wrote:
>
>
> > -----Original Message-----
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Monday, January 6, 2025 9:45 PM
> > To: Sherry Sun <sherry.sun@nxp.com>
> > Cc: jirislaby@kernel.org; linux-serial@vger.kernel.org; linux-
> > kernel@vger.kernel.org; imx@lists.linux.dev
> > Subject: Re: [PATCH] tty: serial: fsl_lpuart: increase maximum uart_nr to 12
> >
> > On Mon, Jan 06, 2025 at 10:24:52AM +0000, Sherry Sun wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Greg KH <gregkh@linuxfoundation.org>
> > > > Sent: Friday, January 3, 2025 5:08 PM
> > > > To: Sherry Sun <sherry.sun@nxp.com>
> > > > Cc: jirislaby@kernel.org; linux-serial@vger.kernel.org; linux-
> > > > kernel@vger.kernel.org; imx@lists.linux.dev
> > > > Subject: Re: [PATCH] tty: serial: fsl_lpuart: increase maximum
> > > > uart_nr to 12
> > > >
> > > > On Fri, Jan 03, 2025 at 03:11:54PM +0800, Sherry Sun wrote:
> > > > > Some SoCs like the i.MX943 have aliases for up to 12 UARTs, need
> > > > > to increase UART_NR from 8 to 12 to support lpuart9-12 to avoid
> > > > > initialization failures.
> > > > >
> > > > > Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> > > > > ---
> > > > > drivers/tty/serial/fsl_lpuart.c | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/tty/serial/fsl_lpuart.c
> > > > > b/drivers/tty/serial/fsl_lpuart.c index 57b0632a3db6..7cb1e36fdaab
> > > > > 100644
> > > > > --- a/drivers/tty/serial/fsl_lpuart.c
> > > > > +++ b/drivers/tty/serial/fsl_lpuart.c
> > > > > @@ -245,7 +245,7 @@
> > > > >
> > > > > #define DRIVER_NAME "fsl-lpuart"
> > > > > #define DEV_NAME "ttyLP"
> > > > > -#define UART_NR 8
> > > > > +#define UART_NR 12
> > > >
> > > > Why not fix this properly and make this dynamic and get rid of the
> > > > static array causing all of this problem? That way when you get a
> > > > system with 13 uarts, you will be ok :)
> > > >
> > >
> > > Hi Greg,
> > >
> > > Thanks for your comment.
> > > But I checked all the uart drivers under drivers/tty/serial/, UART_NR
> > > is widely used, currently almost every uart driver that supports
> > > multiple uart ports defines this macro, this value is needed for the
> > > nr parameter of struct uart_driver, also for console index checking
> > > and setup.
> >
> > Yeah, it's messy, but it can be done (for example see all of the usb-serial
> > devices, we don't limit the number of those ports in the system except to 256
> > I think.)
>
> BTW, it seems that usb-serial devices also have the max ports limit, you can
> check the MAX_NUM_PORTS macro in include/linux/usb/serial.h, it was extended from 8 to 16 now.
>
> /* The maximum number of ports one device can grab at once */
> #define MAX_NUM_PORTS 16
That's different, that is "max devices a single device can use". We
don't know of any single-usb-device that has more than 16 ports on it,
do you? I've seen big ones, but internally they are all split up into
smaller USB devices in order to handle the bandwidth properly. And I
think even the 16 port devices are almost always really just 2 8-port
devices, or 4 4-port ones.
Now you can have a lot of 16-port devices in the system at the same
time, but I think we max out at 256.
Oops, nope, we now support 512 usb-serial ports in the system at one
time:
#define USB_SERIAL_TTY_MINORS 512 /* should be enough for a while */
Well "now" is relative, that change was made in 2013 :)
The commit that bumped the number also gives a hint on how to make this
more dynamic, if you want to read the changelog text for commit
455b4f7e18e7 ("USB: serial: increase the number of devices we support")
for more details.
thanks,
greg k-h
next prev parent reply other threads:[~2025-01-07 8:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 7:11 [PATCH] tty: serial: fsl_lpuart: increase maximum uart_nr to 12 Sherry Sun
2025-01-03 9:08 ` Greg KH
2025-01-06 10:24 ` Sherry Sun
2025-01-06 13:44 ` Greg KH
2025-01-07 8:16 ` Sherry Sun
2025-01-07 8:29 ` Sherry Sun
2025-01-07 8:43 ` Greg KH [this message]
2025-01-07 9:54 ` Sherry Sun
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=2025010738-uplifting-avenging-63e8@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=imx@lists.linux.dev \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sherry.sun@nxp.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