All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-serial <linux-serial@vger.kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Vicente Bergas" <vicencb@gmail.com>,
	"Johan Hovold" <johan@kernel.org>,
	heiko@sntech.de, giulio.benetti@micronovasrl.com,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	linux-api@vger.kernel.org,
	"Ivan Kokshaysky" <ink@jurassic.park.msu.ru>,
	"Matt Turner" <mattst88@gmail.com>,
	linux-alpha@vger.kernel.org,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	linux-mips@vger.kernel.org,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Helge Deller" <deller@gmx.de>,
	linux-parisc@vger.kernel.org,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Paul Mackerras" <paulus@samba.org>,
	linuxppc-dev@lists.ozlabs.org,
	"David S. Miller" <davem@davemloft.net>,
	sparclinux@vger.kernel.org, "Arnd Bergmann" <arnd@arndb.de>,
	linux-arch@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v5 05/10] serial: termbits: ADDRB to indicate 9th bit addressing mode
Date: Tue, 26 Apr 2022 16:12:57 +0300 (EEST)	[thread overview]
Message-ID: <b667479-fb27-8712-cec8-938eed179240@linux.intel.com> (raw)
In-Reply-To: <Ymfq+jUXfZcNM/P/@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 7351 bytes --]

On Tue, 26 Apr 2022, Greg KH wrote:

> On Tue, Apr 26, 2022 at 03:24:43PM +0300, Ilpo Järvinen wrote:
> > Add ADDRB to termbits to indicate 9th bit addressing mode. This change
> > is necessary for supporting devices with RS485 multipoint addressing
> > [*]. A later patch in the patch series adds support for Synopsys
> > Designware UART capable for 9th bit addressing mode. In this mode, 9th
> > bit is used to indicate an address (byte) within the communication
> > line. The 9th bit addressing mode is selected using ADDRB introduced by
> > an earlier patch.
> > 
> > [*] Technically, RS485 is just an electronic spec and does not itself
> > specify the 9th bit addressing mode but 9th bit seems at least
> > "semi-standard" way to do addressing with RS485.
> > 
> > Cc: linux-api@vger.kernel.org
> > Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> > Cc: Matt Turner <mattst88@gmail.com>
> > Cc: linux-alpha@vger.kernel.org
> > Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > Cc: linux-mips@vger.kernel.org
> > Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> > Cc: Helge Deller <deller@gmx.de>
> > Cc: linux-parisc@vger.kernel.org
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: sparclinux@vger.kernel.org
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: linux-arch@vger.kernel.org
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> >  arch/alpha/include/uapi/asm/termbits.h   | 1 +
> >  arch/mips/include/uapi/asm/termbits.h    | 1 +
> >  arch/parisc/include/uapi/asm/termbits.h  | 1 +
> >  arch/powerpc/include/uapi/asm/termbits.h | 1 +
> >  arch/sparc/include/uapi/asm/termbits.h   | 1 +
> >  drivers/char/pcmcia/synclink_cs.c        | 2 ++
> >  drivers/ipack/devices/ipoctal.c          | 2 ++
> >  drivers/mmc/core/sdio_uart.c             | 2 ++
> >  drivers/net/usb/hso.c                    | 3 ++-
> >  drivers/s390/char/tty3270.c              | 3 +++
> >  drivers/staging/greybus/uart.c           | 2 ++
> >  drivers/tty/amiserial.c                  | 6 +++++-
> >  drivers/tty/moxa.c                       | 1 +
> >  drivers/tty/mxser.c                      | 1 +
> >  drivers/tty/serial/serial_core.c         | 2 ++
> >  drivers/tty/synclink_gt.c                | 2 ++
> >  drivers/tty/tty_ioctl.c                  | 2 ++
> >  drivers/usb/class/cdc-acm.c              | 2 ++
> >  drivers/usb/serial/usb-serial.c          | 6 ++++--
> >  include/uapi/asm-generic/termbits.h      | 1 +
> >  net/bluetooth/rfcomm/tty.c               | 2 ++
> >  21 files changed, 40 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h
> > index 4575ba34a0ea..0c123e715486 100644
> > --- a/arch/alpha/include/uapi/asm/termbits.h
> > +++ b/arch/alpha/include/uapi/asm/termbits.h
> > @@ -180,6 +180,7 @@ struct ktermios {
> >  #define HUPCL	00040000
> >  
> >  #define CLOCAL	00100000
> > +#define ADDRB	004000000000		/* address bit */
> >  #define CMSPAR	  010000000000		/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000		/* flow control */
> >  
> > diff --git a/arch/mips/include/uapi/asm/termbits.h b/arch/mips/include/uapi/asm/termbits.h
> > index dfeffba729b7..4732d31b0e4e 100644
> > --- a/arch/mips/include/uapi/asm/termbits.h
> > +++ b/arch/mips/include/uapi/asm/termbits.h
> > @@ -182,6 +182,7 @@ struct ktermios {
> >  #define	 B3500000 0010016
> >  #define	 B4000000 0010017
> >  #define CIBAUD	  002003600000	/* input baud rate */
> > +#define ADDRB	  004000000000	/* address bit */
> >  #define CMSPAR	  010000000000	/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000	/* flow control */
> >  
> > diff --git a/arch/parisc/include/uapi/asm/termbits.h b/arch/parisc/include/uapi/asm/termbits.h
> > index 40e920f8d683..d6bbd10d92ba 100644
> > --- a/arch/parisc/include/uapi/asm/termbits.h
> > +++ b/arch/parisc/include/uapi/asm/termbits.h
> > @@ -159,6 +159,7 @@ struct ktermios {
> >  #define  B3500000 0010016
> >  #define  B4000000 0010017
> >  #define CIBAUD    002003600000		/* input baud rate */
> > +#define ADDRB	  004000000000		/* address bit */
> 
> tabs where the rest were not?
> 
> >  #define CMSPAR    010000000000          /* mark or space (stick) parity */
> >  #define CRTSCTS   020000000000          /* flow control */
> >  
> > diff --git a/arch/powerpc/include/uapi/asm/termbits.h b/arch/powerpc/include/uapi/asm/termbits.h
> > index ed18bc61f63d..c6a033732f39 100644
> > --- a/arch/powerpc/include/uapi/asm/termbits.h
> > +++ b/arch/powerpc/include/uapi/asm/termbits.h
> > @@ -171,6 +171,7 @@ struct ktermios {
> >  #define HUPCL	00040000
> >  
> >  #define CLOCAL	00100000
> > +#define ADDRB	004000000000		/* address bit */
> >  #define CMSPAR	  010000000000		/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000		/* flow control */
> >  
> > diff --git a/arch/sparc/include/uapi/asm/termbits.h b/arch/sparc/include/uapi/asm/termbits.h
> > index ce5ad5d0f105..5eb1d547b5c4 100644
> > --- a/arch/sparc/include/uapi/asm/termbits.h
> > +++ b/arch/sparc/include/uapi/asm/termbits.h
> > @@ -201,6 +201,7 @@ struct ktermios {
> >  #define B3500000  0x00001012
> >  #define B4000000  0x00001013  */
> >  #define CIBAUD	  0x100f0000  /* input baud rate (not used) */
> > +#define ADDRB	  0x20000000  /* address bit */
> >  #define CMSPAR	  0x40000000  /* mark or space (stick) parity */
> >  #define CRTSCTS	  0x80000000  /* flow control */
> 
> Why all the different values?  Can't we pick one and use it for all
> arches?  Having these be different in different arches and userspace
> should not be a thing for new fields, right?
> 
> > diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
> > index 78baba55a8b5..d179b9b57a25 100644
> > --- a/drivers/char/pcmcia/synclink_cs.c
> > +++ b/drivers/char/pcmcia/synclink_cs.c
> > @@ -2287,6 +2287,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
> >  		== RELEVANT_IFLAG(old_termios->c_iflag)))
> >  	  return;
> >  
> > +	tty->termios.c_cflag &= ~ADDRB;
> 
> Having to do this for all drivers feels wrong.  It isn't needed for any
> other flag, right?

My understanding is that it would be needed for other flags too, it's just 
that many drivers probably haven't cared enough. Some drivers certainly 
clear a few flags they don't support while others don't clear any but
it's also challenging to determine it which flags which driver supports. 
How bad the impact is per flag varies.

> That makes me really not like this change as it
> feels very ackward and
> yet-another-thing-a-serial-driver-has-to-remember.

It would be nice to have some mask for supported bits per driver. But it
will be challenging to add at this point and I'm far from sure I could get 
them right per driver even if carefully trying to.

> And as you are wanting to pass this bit to userspace, where is that
> documented?

Ah, I probably should add it to driver-api/serial/driver.rst too but ADDRB
is certainly mentioned alongside with other addressing mode documentation
I wrote for the later changes in this series.

-- 
 i.

WARNING: multiple messages have this Message-ID (diff)
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	heiko@sntech.de,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Paul Mackerras" <paulus@samba.org>,
	sparclinux@vger.kernel.org, "Jiri Slaby" <jirislaby@kernel.org>,
	linux-arch@vger.kernel.org, "Helge Deller" <deller@gmx.de>,
	linux-serial <linux-serial@vger.kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Matt Turner" <mattst88@gmail.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Johan Hovold" <johan@kernel.org>,
	"Vicente Bergas" <vicencb@gmail.com>,
	"Ivan Kokshaysky" <ink@jurassic.park.msu.ru>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	linux-parisc@vger.kernel.org, linux-api@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-mips@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	"Lukas Wunner" <lukas@wunner.de>,
	linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	giulio.benetti@micronovasrl.com
Subject: Re: [PATCH v5 05/10] serial: termbits: ADDRB to indicate 9th bit addressing mode
Date: Tue, 26 Apr 2022 16:12:57 +0300 (EEST)	[thread overview]
Message-ID: <b667479-fb27-8712-cec8-938eed179240@linux.intel.com> (raw)
In-Reply-To: <Ymfq+jUXfZcNM/P/@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 7351 bytes --]

On Tue, 26 Apr 2022, Greg KH wrote:

> On Tue, Apr 26, 2022 at 03:24:43PM +0300, Ilpo Järvinen wrote:
> > Add ADDRB to termbits to indicate 9th bit addressing mode. This change
> > is necessary for supporting devices with RS485 multipoint addressing
> > [*]. A later patch in the patch series adds support for Synopsys
> > Designware UART capable for 9th bit addressing mode. In this mode, 9th
> > bit is used to indicate an address (byte) within the communication
> > line. The 9th bit addressing mode is selected using ADDRB introduced by
> > an earlier patch.
> > 
> > [*] Technically, RS485 is just an electronic spec and does not itself
> > specify the 9th bit addressing mode but 9th bit seems at least
> > "semi-standard" way to do addressing with RS485.
> > 
> > Cc: linux-api@vger.kernel.org
> > Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> > Cc: Matt Turner <mattst88@gmail.com>
> > Cc: linux-alpha@vger.kernel.org
> > Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > Cc: linux-mips@vger.kernel.org
> > Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> > Cc: Helge Deller <deller@gmx.de>
> > Cc: linux-parisc@vger.kernel.org
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: sparclinux@vger.kernel.org
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: linux-arch@vger.kernel.org
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> >  arch/alpha/include/uapi/asm/termbits.h   | 1 +
> >  arch/mips/include/uapi/asm/termbits.h    | 1 +
> >  arch/parisc/include/uapi/asm/termbits.h  | 1 +
> >  arch/powerpc/include/uapi/asm/termbits.h | 1 +
> >  arch/sparc/include/uapi/asm/termbits.h   | 1 +
> >  drivers/char/pcmcia/synclink_cs.c        | 2 ++
> >  drivers/ipack/devices/ipoctal.c          | 2 ++
> >  drivers/mmc/core/sdio_uart.c             | 2 ++
> >  drivers/net/usb/hso.c                    | 3 ++-
> >  drivers/s390/char/tty3270.c              | 3 +++
> >  drivers/staging/greybus/uart.c           | 2 ++
> >  drivers/tty/amiserial.c                  | 6 +++++-
> >  drivers/tty/moxa.c                       | 1 +
> >  drivers/tty/mxser.c                      | 1 +
> >  drivers/tty/serial/serial_core.c         | 2 ++
> >  drivers/tty/synclink_gt.c                | 2 ++
> >  drivers/tty/tty_ioctl.c                  | 2 ++
> >  drivers/usb/class/cdc-acm.c              | 2 ++
> >  drivers/usb/serial/usb-serial.c          | 6 ++++--
> >  include/uapi/asm-generic/termbits.h      | 1 +
> >  net/bluetooth/rfcomm/tty.c               | 2 ++
> >  21 files changed, 40 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h
> > index 4575ba34a0ea..0c123e715486 100644
> > --- a/arch/alpha/include/uapi/asm/termbits.h
> > +++ b/arch/alpha/include/uapi/asm/termbits.h
> > @@ -180,6 +180,7 @@ struct ktermios {
> >  #define HUPCL	00040000
> >  
> >  #define CLOCAL	00100000
> > +#define ADDRB	004000000000		/* address bit */
> >  #define CMSPAR	  010000000000		/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000		/* flow control */
> >  
> > diff --git a/arch/mips/include/uapi/asm/termbits.h b/arch/mips/include/uapi/asm/termbits.h
> > index dfeffba729b7..4732d31b0e4e 100644
> > --- a/arch/mips/include/uapi/asm/termbits.h
> > +++ b/arch/mips/include/uapi/asm/termbits.h
> > @@ -182,6 +182,7 @@ struct ktermios {
> >  #define	 B3500000 0010016
> >  #define	 B4000000 0010017
> >  #define CIBAUD	  002003600000	/* input baud rate */
> > +#define ADDRB	  004000000000	/* address bit */
> >  #define CMSPAR	  010000000000	/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000	/* flow control */
> >  
> > diff --git a/arch/parisc/include/uapi/asm/termbits.h b/arch/parisc/include/uapi/asm/termbits.h
> > index 40e920f8d683..d6bbd10d92ba 100644
> > --- a/arch/parisc/include/uapi/asm/termbits.h
> > +++ b/arch/parisc/include/uapi/asm/termbits.h
> > @@ -159,6 +159,7 @@ struct ktermios {
> >  #define  B3500000 0010016
> >  #define  B4000000 0010017
> >  #define CIBAUD    002003600000		/* input baud rate */
> > +#define ADDRB	  004000000000		/* address bit */
> 
> tabs where the rest were not?
> 
> >  #define CMSPAR    010000000000          /* mark or space (stick) parity */
> >  #define CRTSCTS   020000000000          /* flow control */
> >  
> > diff --git a/arch/powerpc/include/uapi/asm/termbits.h b/arch/powerpc/include/uapi/asm/termbits.h
> > index ed18bc61f63d..c6a033732f39 100644
> > --- a/arch/powerpc/include/uapi/asm/termbits.h
> > +++ b/arch/powerpc/include/uapi/asm/termbits.h
> > @@ -171,6 +171,7 @@ struct ktermios {
> >  #define HUPCL	00040000
> >  
> >  #define CLOCAL	00100000
> > +#define ADDRB	004000000000		/* address bit */
> >  #define CMSPAR	  010000000000		/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000		/* flow control */
> >  
> > diff --git a/arch/sparc/include/uapi/asm/termbits.h b/arch/sparc/include/uapi/asm/termbits.h
> > index ce5ad5d0f105..5eb1d547b5c4 100644
> > --- a/arch/sparc/include/uapi/asm/termbits.h
> > +++ b/arch/sparc/include/uapi/asm/termbits.h
> > @@ -201,6 +201,7 @@ struct ktermios {
> >  #define B3500000  0x00001012
> >  #define B4000000  0x00001013  */
> >  #define CIBAUD	  0x100f0000  /* input baud rate (not used) */
> > +#define ADDRB	  0x20000000  /* address bit */
> >  #define CMSPAR	  0x40000000  /* mark or space (stick) parity */
> >  #define CRTSCTS	  0x80000000  /* flow control */
> 
> Why all the different values?  Can't we pick one and use it for all
> arches?  Having these be different in different arches and userspace
> should not be a thing for new fields, right?
> 
> > diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
> > index 78baba55a8b5..d179b9b57a25 100644
> > --- a/drivers/char/pcmcia/synclink_cs.c
> > +++ b/drivers/char/pcmcia/synclink_cs.c
> > @@ -2287,6 +2287,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
> >  		== RELEVANT_IFLAG(old_termios->c_iflag)))
> >  	  return;
> >  
> > +	tty->termios.c_cflag &= ~ADDRB;
> 
> Having to do this for all drivers feels wrong.  It isn't needed for any
> other flag, right?

My understanding is that it would be needed for other flags too, it's just 
that many drivers probably haven't cared enough. Some drivers certainly 
clear a few flags they don't support while others don't clear any but
it's also challenging to determine it which flags which driver supports. 
How bad the impact is per flag varies.

> That makes me really not like this change as it
> feels very ackward and
> yet-another-thing-a-serial-driver-has-to-remember.

It would be nice to have some mask for supported bits per driver. But it
will be challenging to add at this point and I'm far from sure I could get 
them right per driver even if carefully trying to.

> And as you are wanting to pass this bit to userspace, where is that
> documented?

Ah, I probably should add it to driver-api/serial/driver.rst too but ADDRB
is certainly mentioned alongside with other addressing mode documentation
I wrote for the later changes in this series.

-- 
 i.

WARNING: multiple messages have this Message-ID (diff)
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: linux-serial <linux-serial@vger.kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Vicente Bergas" <vicencb@gmail.com>,
	"Johan Hovold" <johan@kernel.org>,
	heiko@sntech.de, giulio.benetti@micronovasrl.com,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	linux-api@vger.kernel.org,
	"Ivan Kokshaysky" <ink@jurassic.park.msu.ru>,
	"Matt Turner" <mattst88@gmail.com>,
	linux-alpha@vger.kernel.org,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	linux-mips@vger.kernel.org,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Helge Deller" <deller@gmx.de>,
	linux-parisc@vger.kernel.org
Subject: Re: [PATCH v5 05/10] serial: termbits: ADDRB to indicate 9th bit addressing mode
Date: Tue, 26 Apr 2022 16:12:57 +0300 (EEST)	[thread overview]
Message-ID: <b667479-fb27-8712-cec8-938eed179240@linux.intel.com> (raw)
In-Reply-To: <Ymfq+jUXfZcNM/P/@kroah.com>

[-- Attachment #1: Type: text/plain, Size: 7511 bytes --]

On Tue, 26 Apr 2022, Greg KH wrote:

> On Tue, Apr 26, 2022 at 03:24:43PM +0300, Ilpo Järvinen wrote:
> > Add ADDRB to termbits to indicate 9th bit addressing mode. This change
> > is necessary for supporting devices with RS485 multipoint addressing
> > [*]. A later patch in the patch series adds support for Synopsys
> > Designware UART capable for 9th bit addressing mode. In this mode, 9th
> > bit is used to indicate an address (byte) within the communication
> > line. The 9th bit addressing mode is selected using ADDRB introduced by
> > an earlier patch.
> > 
> > [*] Technically, RS485 is just an electronic spec and does not itself
> > specify the 9th bit addressing mode but 9th bit seems at least
> > "semi-standard" way to do addressing with RS485.
> > 
> > Cc: linux-api@vger.kernel.org
> > Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> > Cc: Matt Turner <mattst88@gmail.com>
> > Cc: linux-alpha@vger.kernel.org
> > Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > Cc: linux-mips@vger.kernel.org
> > Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> > Cc: Helge Deller <deller@gmx.de>
> > Cc: linux-parisc@vger.kernel.org
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: sparclinux@vger.kernel.org
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: linux-arch@vger.kernel.org
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> >  arch/alpha/include/uapi/asm/termbits.h   | 1 +
> >  arch/mips/include/uapi/asm/termbits.h    | 1 +
> >  arch/parisc/include/uapi/asm/termbits.h  | 1 +
> >  arch/powerpc/include/uapi/asm/termbits.h | 1 +
> >  arch/sparc/include/uapi/asm/termbits.h   | 1 +
> >  drivers/char/pcmcia/synclink_cs.c        | 2 ++
> >  drivers/ipack/devices/ipoctal.c          | 2 ++
> >  drivers/mmc/core/sdio_uart.c             | 2 ++
> >  drivers/net/usb/hso.c                    | 3 ++-
> >  drivers/s390/char/tty3270.c              | 3 +++
> >  drivers/staging/greybus/uart.c           | 2 ++
> >  drivers/tty/amiserial.c                  | 6 +++++-
> >  drivers/tty/moxa.c                       | 1 +
> >  drivers/tty/mxser.c                      | 1 +
> >  drivers/tty/serial/serial_core.c         | 2 ++
> >  drivers/tty/synclink_gt.c                | 2 ++
> >  drivers/tty/tty_ioctl.c                  | 2 ++
> >  drivers/usb/class/cdc-acm.c              | 2 ++
> >  drivers/usb/serial/usb-serial.c          | 6 ++++--
> >  include/uapi/asm-generic/termbits.h      | 1 +
> >  net/bluetooth/rfcomm/tty.c               | 2 ++
> >  21 files changed, 40 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h
> > index 4575ba34a0ea..0c123e715486 100644
> > --- a/arch/alpha/include/uapi/asm/termbits.h
> > +++ b/arch/alpha/include/uapi/asm/termbits.h
> > @@ -180,6 +180,7 @@ struct ktermios {
> >  #define HUPCL	00040000
> >  
> >  #define CLOCAL	00100000
> > +#define ADDRB	004000000000		/* address bit */
> >  #define CMSPAR	  010000000000		/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000		/* flow control */
> >  
> > diff --git a/arch/mips/include/uapi/asm/termbits.h b/arch/mips/include/uapi/asm/termbits.h
> > index dfeffba729b7..4732d31b0e4e 100644
> > --- a/arch/mips/include/uapi/asm/termbits.h
> > +++ b/arch/mips/include/uapi/asm/termbits.h
> > @@ -182,6 +182,7 @@ struct ktermios {
> >  #define	 B3500000 0010016
> >  #define	 B4000000 0010017
> >  #define CIBAUD	  002003600000	/* input baud rate */
> > +#define ADDRB	  004000000000	/* address bit */
> >  #define CMSPAR	  010000000000	/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000	/* flow control */
> >  
> > diff --git a/arch/parisc/include/uapi/asm/termbits.h b/arch/parisc/include/uapi/asm/termbits.h
> > index 40e920f8d683..d6bbd10d92ba 100644
> > --- a/arch/parisc/include/uapi/asm/termbits.h
> > +++ b/arch/parisc/include/uapi/asm/termbits.h
> > @@ -159,6 +159,7 @@ struct ktermios {
> >  #define  B3500000 0010016
> >  #define  B4000000 0010017
> >  #define CIBAUD    002003600000		/* input baud rate */
> > +#define ADDRB	  004000000000		/* address bit */
> 
> tabs where the rest were not?
> 
> >  #define CMSPAR    010000000000          /* mark or space (stick) parity */
> >  #define CRTSCTS   020000000000          /* flow control */
> >  
> > diff --git a/arch/powerpc/include/uapi/asm/termbits.h b/arch/powerpc/include/uapi/asm/termbits.h
> > index ed18bc61f63d..c6a033732f39 100644
> > --- a/arch/powerpc/include/uapi/asm/termbits.h
> > +++ b/arch/powerpc/include/uapi/asm/termbits.h
> > @@ -171,6 +171,7 @@ struct ktermios {
> >  #define HUPCL	00040000
> >  
> >  #define CLOCAL	00100000
> > +#define ADDRB	004000000000		/* address bit */
> >  #define CMSPAR	  010000000000		/* mark or space (stick) parity */
> >  #define CRTSCTS	  020000000000		/* flow control */
> >  
> > diff --git a/arch/sparc/include/uapi/asm/termbits.h b/arch/sparc/include/uapi/asm/termbits.h
> > index ce5ad5d0f105..5eb1d547b5c4 100644
> > --- a/arch/sparc/include/uapi/asm/termbits.h
> > +++ b/arch/sparc/include/uapi/asm/termbits.h
> > @@ -201,6 +201,7 @@ struct ktermios {
> >  #define B3500000  0x00001012
> >  #define B4000000  0x00001013  */
> >  #define CIBAUD	  0x100f0000  /* input baud rate (not used) */
> > +#define ADDRB	  0x20000000  /* address bit */
> >  #define CMSPAR	  0x40000000  /* mark or space (stick) parity */
> >  #define CRTSCTS	  0x80000000  /* flow control */
> 
> Why all the different values?  Can't we pick one and use it for all
> arches?  Having these be different in different arches and userspace
> should not be a thing for new fields, right?
> 
> > diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
> > index 78baba55a8b5..d179b9b57a25 100644
> > --- a/drivers/char/pcmcia/synclink_cs.c
> > +++ b/drivers/char/pcmcia/synclink_cs.c
> > @@ -2287,6 +2287,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
> >  		== RELEVANT_IFLAG(old_termios->c_iflag)))
> >  	  return;
> >  
> > +	tty->termios.c_cflag &= ~ADDRB;
> 
> Having to do this for all drivers feels wrong.  It isn't needed for any
> other flag, right?

My understanding is that it would be needed for other flags too, it's just 
that many drivers probably haven't cared enough. Some drivers certainly 
clear a few flags they don't support while others don't clear any but
it's also challenging to determine it which flags which driver supports. 
How bad the impact is per flag varies.

> That makes me really not like this change as it
> feels very ackward and
> yet-another-thing-a-serial-driver-has-to-remember.

It would be nice to have some mask for supported bits per driver. But it
will be challenging to add at this point and I'm far from sure I could get 
them right per driver even if carefully trying to.

> And as you are wanting to pass this bit to userspace, where is that
> documented?

Ah, I probably should add it to driver-api/serial/driver.rst too but ADDRB
is certainly mentioned alongside with other addressing mode documentation
I wrote for the later changes in this series.

-- 
 i.

  reply	other threads:[~2022-04-26 13:13 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-26 12:24 [PATCH v5 00/10] Add RS485 support to DW UART Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 01/10] serial: 8250_dwlib: RS485 HW half & full duplex support Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 02/10] serial: 8250_dwlib: Implement SW half " Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 03/10] dt_bindings: rs485: Add receiver enable polarity Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 04/10] ACPI / property: Document RS485 _DSD properties Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 05/10] serial: termbits: ADDRB to indicate 9th bit addressing mode Ilpo Järvinen
2022-04-26 12:24   ` Ilpo Järvinen
2022-04-26 12:24   ` Ilpo Järvinen
2022-04-26 12:52   ` Greg KH
2022-04-26 12:52     ` Greg KH
2022-04-26 12:52     ` Greg KH
2022-04-26 13:12     ` Ilpo Järvinen [this message]
2022-04-26 13:12       ` Ilpo Järvinen
2022-04-26 13:12       ` Ilpo Järvinen
2022-04-26 14:01       ` Ilpo Järvinen
2022-04-26 14:01         ` Ilpo Järvinen
2022-04-26 14:01         ` Ilpo Järvinen
2022-04-26 14:10         ` Greg KH
2022-04-26 14:10           ` Greg KH
2022-04-26 14:10           ` Greg KH
2022-04-26 16:29           ` Ilpo Järvinen
2022-04-26 16:29             ` Ilpo Järvinen
2022-04-26 16:29             ` Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 06/10] serial: General support for multipoint addresses Ilpo Järvinen
2022-04-26 12:24   ` Ilpo Järvinen
2022-04-26 12:24   ` Ilpo Järvinen
2022-04-26 12:56   ` Greg KH
2022-04-26 12:56     ` Greg KH
2022-04-26 12:56     ` Greg KH
2022-04-26 13:36     ` Ilpo Järvinen
2022-04-26 13:36       ` Ilpo Järvinen
2022-04-26 13:36       ` Ilpo Järvinen
2022-04-26 13:58       ` Greg KH
2022-04-26 13:58         ` Greg KH
2022-04-26 13:58         ` Greg KH
2022-04-26 12:24 ` [PATCH v5 07/10] serial: 8250: make saved LSR larger Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 08/10] serial: 8250: create lsr_save_mask Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 09/10] serial: 8250_lpss: Use 32-bit reads Ilpo Järvinen
2022-04-26 12:24 ` [PATCH v5 10/10] serial: 8250_dwlib: Support for 9th bit multipoint addressing Ilpo Järvinen
2022-04-26 12:49 ` [PATCH v5 00/10] Add RS485 support to DW UART Greg KH

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=b667479-fb27-8712-cec8-938eed179240@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=giulio.benetti@micronovasrl.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=heiko@sntech.de \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas@wunner.de \
    --cc=mattst88@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vicencb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.