Skip to contentSkip to conversation

serial: New serial driver SCCNXP

PATCH In review Alexander Shiyan 3 participants 8 messages Aug 25, 2012 – Sep 24, 2012

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

PATCH 1/2 serial: New serial driver SCCNXP

This driver is a replacement for a SC26XX driver with a lot of improvements and new features.
The main differences from the SC26XX driver:
- Removed dependency on MIPS. Driver can be used on any platform.
- Added support for SCC2681, SCC2691, SCC2692, SC28L91, SC28L92, SC28L202, SCC68681 and SCC68692 ICs.
- Using devm_-related functions.
- Improved error handling of serial port, improved FIFO handling.
- Ability to load multiple instances of drivers.

To avoid the possibility of regression, driver SC26XX left in the system to confirm the stability of the driver on platforms where it is being used.

---
 drivers/tty/serial/Kconfig           |   18 +
 drivers/tty/serial/Makefile          |    1 +
 drivers/tty/serial/sccnxp.c          |  985 ++++++++++++++++++++++++++++++++++
 include/linux/platform_data/sccnxp.h |   93 ++++
 4 files changed, 1097 insertions(+), 0 deletions(-)
 create mode 100644 drivers/tty/serial/sccnxp.c
 create mode 100644 include/linux/platform_data/sccnxp.h
drivers/tty/serial/Kconfig +18 -0
index 4720b4b..750671d 100644
@@ -1104,6 +1104,24 @@ config SERIAL_SC26XX_CONSOLE
 	help
 	  Support for Console on SC2681/SC2692 serial ports.
 
+config SERIAL_SCCNXP
+	bool "SCCNXP serial port support"
+	depends on !SERIAL_SC26XX
+	select SERIAL_CORE
+	default n
+	help
+	  This selects support for an advanced UART from NXP (Philips).
+	  Supported ICs are SCC2681, SCC2691, SCC2692, SC28L91, SC28L92,
+	  SC28L202, SCC68681 and SCC68692.
+	  Positioned as a replacement for the driver SC26XX.
+
+config SERIAL_SCCNXP_CONSOLE
+	bool "Console on SCCNXP serial port"
+	depends on SERIAL_SCCNXP
+	select SERIAL_CORE_CONSOLE
+	help
+	  Support for console on SCCNXP serial ports.
+
 config SERIAL_BFIN_SPORT
 	tristate "Blackfin SPORT emulate UART"
 	depends on BLACKFIN
drivers/tty/serial/Makefile +1 -0
index 7257c5d..320ac4b 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_SERIAL_MPSC) += mpsc.o
 obj-$(CONFIG_SERIAL_SB1250_DUART) += sb1250-duart.o
 obj-$(CONFIG_ETRAX_SERIAL) += crisv10.o
 obj-$(CONFIG_SERIAL_SC26XX) += sc26xx.o
+obj-$(CONFIG_SERIAL_SCCNXP) += sccnxp.o
 obj-$(CONFIG_SERIAL_JSM) += jsm/
 obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o
 obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
drivers/tty/serial/sccnxp.c new file +985 -0

985 lines not on this page · raw message

include/linux/platform_data/sccnxp.h new file +93 -0

93 lines not on this page · raw message

Signature · 6 lines
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH 2/2 serial: Add note about migration to driver SCCNXP

This patch adds note about migration to driver SCCNXP in the code of driver SC26XX and in MIPS SNI board initialization with example.

---
 arch/mips/sni/a20r.c        |   32 ++++++++++++++++++++++++++++++++
 drivers/tty/serial/sc26xx.c |    3 +++
 2 files changed, 35 insertions(+), 0 deletions(-)
arch/mips/sni/a20r.c +32 -0
index c48194c..b2d4f49 100644
@@ -133,6 +133,38 @@ static struct platform_device sc26xx_pdev = {
 	}
 };
 
+#warning "Please try migrate to use new driver SCCNXP and report the status" \
+	 "in the linux-serial mailing list."
+
+/* The code bellow is a replacement of SC26XX to SCCNXP */
+#if 0
+#include <linux/platform_data/sccnxp.h>
+
+static struct sccnxp_pdata sccnxp_data = {
+	.reg_shift	= 2,
+	.frequency	= 3686400,
+	.mctrl_cfg[0]	= MCTRL_SIG(DTR_OP, LINE_OP7) |
+			  MCTRL_SIG(RTS_OP, LINE_OP3) |
+			  MCTRL_SIG(DSR_IP, LINE_IP5) |
+			  MCTRL_SIG(DCD_IP, LINE_IP6),
+	.mctrl_cfg[1]	= MCTRL_SIG(DTR_OP, LINE_OP2) |
+			  MCTRL_SIG(RTS_OP, LINE_OP1) |
+			  MCTRL_SIG(DSR_IP, LINE_IP0) |
+			  MCTRL_SIG(CTS_IP, LINE_IP1) |
+			  MCTRL_SIG(DCD_IP, LINE_IP2) |
+			  MCTRL_SIG(RNG_IP, LINE_IP3),
+};
+
+static struct platform_device sc2681_pdev = {
+	.name		= "sc2681",
+	.resource	= sc2xxx_rsrc,
+	.num_resources	= ARRAY_SIZE(sc2xxx_rsrc),
+	.dev	= {
+		.platform_data	= &sccnxp_data,
+	},
+};
+#endif
+
 static u32 a20r_ack_hwint(void)
 {
 	u32 status = read_c0_status();
drivers/tty/serial/sc26xx.c +3 -0
index e0b4b0a..72589e4 100644
@@ -21,6 +21,9 @@
 #include <linux/platform_device.h>
 #include <linux/irq.h>
 
+#warning "Please try migrate to use new driver SCCNXP and report the status" \
+	 "in the linux-serial mailing list."
+
 #if defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
 #endif
Signature · 1 line
1.7.8.6
Acked-by on v1 1/2
#2 lore raw
In reply to Alexander Shiyan

drivers/tty/serial/sccnxp.c line 531

Quoted 4 lines
drivers/tty/serial/sccnxp.c new file +3 -0
+	/* Mask termios capabilities we don't support */
+	termios->c_cflag &= ~CMSPAR;
+	termios->c_iflag &= ~(IXON | IXOFF | IXANY);

The kernel will handle IXON/IXOFF/IXANY in software if the hardware doesn't do it so you only need the CMSPAR one.

drivers/tty/serial/sccnxp.c line 590

Quoted 4 lines
drivers/tty/serial/sccnxp.c new file +4 -0
+	baud = uart_get_baud_rate(port, termios, old, 50,
+				  (s->flags & SCCNXP_HAVE_MR0) ?
+				  230400 : 38400);
+	sccnxp_set_baud(port, baud);

You should also write the *actal* baud rate you end up with back into termios unless B0 is requested (see 8250.c for an example). The tty core code will deal with minor variations and the detail for you (eg a user asking for B9600 and getting 9605 will be told they got their baud rate as asked)

Looks good to me barring those trivial bits that can be fixed up with a follow up patch

#3 lore raw

On Wed, 29 Aug 2012 14:46:07 +0100
Alan Cox <[email protected]> wrote:

Thanks for review.

Quoted 9 lines

drivers/tty/serial/sccnxp.c line 590

Quoted 4 lines
drivers/tty/serial/sccnxp.c new file +4 -0
+	baud = uart_get_baud_rate(port, termios, old, 50,
+				  (s->flags & SCCNXP_HAVE_MR0) ?
+				  230400 : 38400);
+	sccnxp_set_baud(port, baud);

You should also write the *actal* baud rate you end up with back into termios unless B0 is requested (see 8250.c for an example). The tty core code will deal with minor variations and the detail for you (eg a user asking for B9600 and getting 9605 will be told they got their baud rate as asked)

And AFAIK uart_get_baud_rate cannot return 0 for us, so check for zero baud is not needed before call tty_termios_encode_baud_rate. Right?

Signature · 1 line
Alexander Shiyan <[email protected]>
#4 lore raw
Quoted 15 lines · On Wed, 29 Aug 2012 22:26:42 +0400 Alexander Shiyan <[email protected]> wrote:

On Wed, 29 Aug 2012 14:46:07 +0100
Alan Cox <[email protected]> wrote:

Thanks for review.

Quoted 9 lines

drivers/tty/serial/sccnxp.c line 590

Quoted 4 lines
drivers/tty/serial/sccnxp.c new file +4 -0
+	baud = uart_get_baud_rate(port, termios, old, 50,
+				  (s->flags & SCCNXP_HAVE_MR0) ?
+				  230400 : 38400);
+	sccnxp_set_baud(port, baud);

You should also write the *actal* baud rate you end up with back into termios unless B0 is requested (see 8250.c for an example). The tty core code will deal with minor variations and the detail for you (eg a user asking for B9600 and getting 9605 will be told they got their baud rate as asked)

Quoted 2 lines

And AFAIK uart_get_baud_rate cannot return 0 for us, so check for zero baud is not needed before call tty_termios_encode_baud_rate. Right?

B0 is a bit weird. A request for 0 baud means "hang up" not "change the speed". So the check is needed really.

#5 lore raw
In reply to Alexander Shiyan
Quoted 33 lines · Alexander Shiyan

This driver is a replacement for a SC26XX driver with a lot of improvements and new features.
The main differences from the SC26XX driver:
- Removed dependency on MIPS. Driver can be used on any platform.
- Added support for SCC2681, SCC2691, SCC2692, SC28L91, SC28L92, SC28L202, SCC68681 and SCC68692 ICs.
- Using devm_-related functions.
- Improved error handling of serial port, improved FIFO handling.
- Ability to load multiple instances of drivers.

To avoid the possibility of regression, driver SC26XX left in the system to confirm the stability of the driver on platforms where it is being used.

---
 drivers/tty/serial/Kconfig           |   18 +
 drivers/tty/serial/Makefile          |    1 +
 drivers/tty/serial/sccnxp.c          |  985 ++++++++++++++++++++++++++++++++++
 include/linux/platform_data/sccnxp.h |   93 ++++
 4 files changed, 1097 insertions(+), 0 deletions(-)
 create mode 100644 drivers/tty/serial/sccnxp.c
 create mode 100644 include/linux/platform_data/sccnxp.h
drivers/tty/serial/Kconfig +0 -0
index 4720b4b..750671d 100644
@@ -1104,6 +1104,24 @@ config SERIAL_SC26XX_CONSOLE
 	help
 	  Support for Console on SC2681/SC2692 serial ports.
 

drivers/tty/serial/Kconfig config SERIAL_SC26XX_CONSOLE · line 1116

Quoted 10 lines
drivers/tty/serial/Kconfig +10 -0
+config SERIAL_SCCNXP
+	bool "SCCNXP serial port support"
+	depends on !SERIAL_SC26XX
+	select SERIAL_CORE
+	default n
+	help
+	  This selects support for an advanced UART from NXP (Philips).
+	  Supported ICs are SCC2681, SCC2691, SCC2692, SC28L91, SC28L92,
+	  SC28L202, SCC68681 and SCC68692.
+	  Positioned as a replacement for the driver SC26XX.

This driver can be built as a module, right? If so, please change this to a tristate variable, not a "bool". I don't feel like always building it into my kernels :)

Care to send a follow-on patch fixing this up?

thanks,

greg k-h

#6 lore raw

On Wed, 5 Sep 2012 13:24:33 -0700
Greg Kroah-Hartman <[email protected]> wrote:
...

Quoted 7 lines
Quoted 7 lines
drivers/tty/serial/Kconfig +7 -0
+config SERIAL_SCCNXP
+	bool "SCCNXP serial port support"
+	depends on !SERIAL_SC26XX
+	select SERIAL_CORE
+	default n
+	help
+	  This selects support for an advanced UART from NXP (Philips).
Quoted 8 lines

drivers/tty/serial/Kconfig config SERIAL_SC26XX_CONSOLE · line 1116

Quoted 3 lines
drivers/tty/serial/Kconfig +3 -0
+	  Supported ICs are SCC2681, SCC2691, SCC2692, SC28L91, SC28L92,
+	  SC28L202, SCC68681 and SCC68692.
+	  Positioned as a replacement for the driver SC26XX.

This driver can be built as a module, right? If so, please change this to a tristate variable, not a "bool". I don't feel like always building it into my kernels :)
Care to send a follow-on patch fixing this up?

I'm not sure whether the driver works as a module, as in the case of the module, we can not setup at least IO-address and IRQ parameters. Or, we are need to create module_param variables.

Signature · 1 line
Alexander Shiyan <[email protected]>
#7 lore raw
Quoted 19 lines · Alexander Shiyan

On Wed, 5 Sep 2012 13:24:33 -0700
Greg Kroah-Hartman <[email protected]> wrote:
...

Quoted 7 lines
Quoted 7 lines
drivers/tty/serial/Kconfig +7 -0
+config SERIAL_SCCNXP
+	bool "SCCNXP serial port support"
+	depends on !SERIAL_SC26XX
+	select SERIAL_CORE
+	default n
+	help
+	  This selects support for an advanced UART from NXP (Philips).
Quoted 8 lines

drivers/tty/serial/Kconfig config SERIAL_SC26XX_CONSOLE · line 1116

Quoted 3 lines
drivers/tty/serial/Kconfig +3 -0
+	  Supported ICs are SCC2681, SCC2691, SCC2692, SC28L91, SC28L92,
+	  SC28L202, SCC68681 and SCC68692.
+	  Positioned as a replacement for the driver SC26XX.

This driver can be built as a module, right? If so, please change this to a tristate variable, not a "bool". I don't feel like always building it into my kernels :)
Care to send a follow-on patch fixing this up?

Quoted 3 lines

I'm not sure whether the driver works as a module, as in the case of the module, we can not setup at least IO-address and IRQ parameters. Or, we are need to create module_param variables.

You should not use module parameters for this type of thing. What about platform data instead?

gre gk-h