Skip to contentSkip to conversation

serial: 8250: Remove highly customised deprecated interface

PATCH New Andy Shevchenko 1 participant 3 messages Jan 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover serial: 8250: Remove highly customised deprecated interface

The custom divisor interface not only old and deprecated, it's too much driver-dependent. For the user it's not easy to understand what to supply as a value (usually encoded) via that interface. On top of it, there is an existing BOTHER mechanism that allows to do the same and more without any tribal knowledge.

Remove highly customised deprecated interface to set baud rates.

Note, the "standard" custom_divisor that is used as a plain value for "quot" is still left and may be used by the respective drivers including but not limited to 8250.

Andy Shevchenko (2):
serial: 8250_omap: Remove custom deprecated baud setting routine
serial: 8250_pci: Remove custom deprecated baud setting routine

 Documentation/misc-devices/oxsemi-tornado.rst | 26 +-----
 drivers/tty/serial/8250/8250_omap.c           | 16 ----
 drivers/tty/serial/8250/8250_pci.c            | 85 ++++++++-----------
 3 files changed, 38 insertions(+), 89 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH 1/2 serial: 8250_omap: Remove custom deprecated baud setting routine

As comments mentioned this is old (and actually deprecated) interface to set custom baud rates. This interface has limitations as it only allows to set a single opaque value called "custom_divisor". If the HW needs more complex settings (like fractional divisor) it must somehow encode this. This is horrid interface that is very driver specific and not flexible. Meanwhile Linux has established way to set free baud rate settings via BOTHER [1]. With all this being said, remove deprecated interface for good.

---
 drivers/tty/serial/8250/8250_omap.c | 16 ----------------
 1 file changed, 16 deletions(-)
drivers/tty/serial/8250/8250_omap.c +0 -16
index 4496f692b86b..427719c158b7 100644
@@ -243,22 +243,6 @@ static void omap_8250_get_divisor(struct uart_port *port, unsigned int baud,
 	unsigned int div_13, div_16;
 	unsigned int abs_d13, abs_d16;
 
-	/*
-	 * Old custom speed handling.
-	 */
-	if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) {
-		priv->quot = port->custom_divisor & UART_DIV_MAX;
-		/*
-		 * I assume that nobody is using this. But hey, if somebody
-		 * would like to specify the divisor _and_ the mode then the
-		 * driver is ready and waiting for it.
-		 */
-		if (port->custom_divisor & (1 << 16))
-			priv->mdr1 = UART_OMAP_MDR1_13X_MODE;
-		else
-			priv->mdr1 = UART_OMAP_MDR1_16X_MODE;
-		return;
-	}
 	div_13 = DIV_ROUND_CLOSEST(uartclk, 13 * baud);
 	div_16 = DIV_ROUND_CLOSEST(uartclk, 16 * baud);
 
Signature · 1 line
2.50.1
#2 lore raw

PATCH 2/2 serial: 8250_pci: Remove custom deprecated baud setting routine

In reply to Andy Shevchenko

As comments mentioned this is old (and actually deprecated) interface to set custom baud rates. This interface has limitations as it only allows to set a single opaque value called "custom_divisor". If the HW needs more complex settings (like fractional divisor) it must somehow encode this. This is horrid interface that is very driver specific and not flexible. Meanwhile Linux has established way to set free baud rate settings via BOTHER [1]. With all this being said, remove deprecated interface for good.

---
 Documentation/misc-devices/oxsemi-tornado.rst | 26 +-----
 drivers/tty/serial/8250/8250_pci.c            | 85 ++++++++-----------
 2 files changed, 38 insertions(+), 73 deletions(-)
Documentation/misc-devices/oxsemi-tornado.rst +1 -25
index b33351bef6cf..fe2e5f726c2b 100644
@@ -89,31 +89,7 @@ With the baud base set to 15625000 and the unsigned 16-bit UART_DIV_MAX
 limitation imposed by ``serial8250_get_baud_rate`` standard baud rates
 below 300bps become unavailable in the regular way, e.g. the rate of
 200bps requires the baud base to be divided by 78125 and that is beyond
-the unsigned 16-bit range.  The historic spd_cust feature can still be
-used by encoding the values for, the prescaler, the oversampling rate
-and the clock divisor (DLM/DLL) as follows to obtain such rates if so
-required:
-
-::
-
-  31 29 28             20 19   16 15                            0
- +-----+-----------------+-------+-------------------------------+
- |0 0 0|    CPR2:CPR     |  TCR  |            DLM:DLL            |
- +-----+-----------------+-------+-------------------------------+
-
-Use a value such encoded for the ``custom_divisor`` field along with the
-ASYNC_SPD_CUST flag set in the ``flags`` field in ``struct serial_struct``
-passed with the TIOCSSERIAL ioctl(2), such as with the setserial(8)
-utility and its ``divisor`` and ``spd_cust`` parameters, and then select
-the baud rate of 38400bps.  Note that the value of 0 in TCR sets the
-oversampling rate to 16 and prescaler values below 1 in CPR2/CPR are
-clamped by the driver to 1.
-
-For example the value of 0x1f4004e2 will set CPR2/CPR, TCR and DLM/DLL
-respectively to 0x1f4, 0x0 and 0x04e2, choosing the prescaler value,
-the oversampling rate and the clock divisor of 62.500, 16 and 1250
-respectively.  These parameters will set the baud rate for the serial
-port to 62500000 / 62.500 / 1250 / 16 = 50bps.
+the unsigned 16-bit range.
 
 Maciej W. Rozycki  <[email protected]>
 
drivers/tty/serial/8250/8250_pci.c +37 -48

97 lines not on this page · raw message

Signature · 1 line
2.50.1