Skip to contentSkip to conversation

serial: add support for the cell network processor NWP device

PATCH In review Arnd Bergmann 4 participants 4 messages Nov 24, 2008 – Jan 7, 2009 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 serial: add support for the cell network processor NWP device

From: Benjamin Krill <[email protected]>

Add support for the nwp serial device which is connected to a DCR bus. It uses the of_serial device driver to determine necessary properties from the device tree. The supported device is added as serial port number 84.

NWP stands for network processor and it is part of the QPACE - Quantum Chromodynamics Parallel Computing on the Cell Broadband Engine project. The implementation is a lightweight uart implementation with the focus to consume as little resources as possible and it is connected to a DCR bus.

---
 drivers/serial/Kconfig      |   19 ++-
 drivers/serial/Makefile     |    1 +
 drivers/serial/nwpserial.c  |  477 +++++++++++++++++++++++++++++++++++++++++++
 drivers/serial/of_serial.c  |   19 ++
 include/linux/nwpserial.h   |   18 ++
 include/linux/serial_core.h |    3 +
 6 files changed, 536 insertions(+), 1 deletions(-)
 create mode 100644 drivers/serial/nwpserial.c
 create mode 100644 include/linux/nwpserial.h
drivers/serial/Kconfig +18 -1
index 579d63a..e7fcf2f 100644
@@ -1297,13 +1297,30 @@ config SERIAL_NETX_CONSOLE
 config SERIAL_OF_PLATFORM
 	tristate "Serial port on Open Firmware platform bus"
 	depends on PPC_OF
-	depends on SERIAL_8250
+	depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL
 	help
 	  If you have a PowerPC based system that has serial ports
 	  on a platform specific bus, you should enable this option.
 	  Currently, only 8250 compatible ports are supported, but
 	  others can easily be added.
 
+config SERIAL_OF_PLATFORM_NWPSERIAL
+	tristate "NWP serial port driver"
+	depends on PPC_OF && PPC_DCR
+	select SERIAL_OF_PLATFORM
+	select SERIAL_CORE_CONSOLE
+	select SERIAL_CORE
+	help
+	  This driver supports the cell network processor nwp serial
+	  device.
+
+config SERIAL_OF_PLATFORM_NWPSERIAL_CONSOLE
+	bool "Console on NWP serial port"
+	depends on SERIAL_OF_PLATFORM_NWPSERIAL=y
+	select SERIAL_CORE_CONSOLE
+	help
+	  Support for Console on the NWP serial ports.
+
 config SERIAL_QE
 	tristate "Freescale QUICC Engine serial port support"
 	depends on QUICC_ENGINE
drivers/serial/Makefile +1 -0
index 0c17c8d..05da19d 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
 obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
 obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
 obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
+obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
 obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
 obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
 obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
drivers/serial/nwpserial.c new file +477 -0

477 lines not on this page · raw message

drivers/serial/of_serial.c +19 -0
index 8fa0ff5..a821e3a 100644
@@ -14,6 +14,7 @@
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
 #include <linux/of_platform.h>
+#include <linux/nwpserial.h>
 
 #include <asm/prom.h>
 
@@ -99,9 +100,16 @@ static int __devinit of_platform_serial_probe(struct of_device *ofdev,
 		goto out;
 
 	switch (port_type) {
+#ifdef CONFIG_SERIAL_8250
 	case PORT_8250 ... PORT_MAX_8250:
 		ret = serial8250_register_port(&port);
 		break;
+#endif
+#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
+	case PORT_NWPSERIAL:
+		ret = nwpserial_register_port(&port);
+		break;
+#endif
 	default:
 		/* need to add code for these */
 	case PORT_UNKNOWN:
@@ -129,9 +137,16 @@ static int of_platform_serial_remove(struct of_device *ofdev)
 {
 	struct of_serial_info *info = ofdev->dev.driver_data;
 	switch (info->type) {
+#ifdef CONFIG_SERIAL_8250
 	case PORT_8250 ... PORT_MAX_8250:
 		serial8250_unregister_port(info->line);
 		break;
+#endif
+#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
+	case PORT_NWPSERIAL:
+		nwpserial_unregister_port(info->line);
+		break;
+#endif
 	default:
 		/* need to add code for these */
 		break;
@@ -148,6 +163,10 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
 	{ .type = "serial", .compatible = "ns16450",  .data = (void *)PORT_16450, },
 	{ .type = "serial", .compatible = "ns16550",  .data = (void *)PORT_16550, },
 	{ .type = "serial", .compatible = "ns16750",  .data = (void *)PORT_16750, },
+#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
+	{ .type = "serial", .compatible = "ibm,qpace-nwp-serial",
+					.data = (void *)PORT_NWPSERIAL, },
+#endif
 	{ .type = "serial",			      .data = (void *)PORT_UNKNOWN, },
 	{ /* end of list */ },
 };
include/linux/nwpserial.h new file +18 -0
new file mode 100644
index 0000000..9acb215
@@ -0,0 +1,18 @@
+/*
+ *  Serial Port driver for a NWP uart device
+ *
+ *    Copyright (C) 2008 IBM Corp., Benjamin Krill <[email protected]>
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ *
+ */
+#ifndef _NWPSERIAL_H
+#define _NWPSERIAL_H
+
+int nwpserial_register_port(struct uart_port *port);
+void nwpserial_unregister_port(int line);
+
+#endif /* _NWPSERIAL_H */
include/linux/serial_core.h +3 -0
index 4e4f127..4621faf 100644
@@ -158,6 +158,9 @@
 /* SH-SCI */
 #define PORT_SCIFA	83
 
+/* NWPSERIAL */
+#define PORT_NWPSERIAL	84
+
 #ifdef __KERNEL__
 
 #include <linux/compiler.h>
Signature · 4 lines
1.5.6.5


-------------------------------------------------------
#1 lore raw
Quoted 6 lines · Arnd Bergmann

From: Benjamin Krill <[email protected]>

Add support for the nwp serial device which is connected to a DCR bus. It uses the of_serial device driver to determine necessary properties from the device tree. The supported device is added as serial port number 84.

Quoted 8 lines

NWP stands for network processor and it is part of the QPACE - Quantum Chromodynamics Parallel Computing on the Cell Broadband Engine project. The implementation is a lightweight uart implementation with the focus to consume as little resources as possible and it is connected to a DCR bus.

There have been no comment nor objection about this patch.

Andrew, do we have a serial maintainer or should I merge it via the powerpc tree ?

Cheers,
Ben.

#2 lore raw
Quoted 13 lines · On Wed, 07 Jan 2009 14:08:14 +1100 Benjamin Herrenschmidt…
Quoted 12 lines · Arnd Bergmann

From: Benjamin Krill <[email protected]>

Add support for the nwp serial device which is connected to a DCR bus. It uses the of_serial device driver to determine necessary properties from the device tree. The supported device is added as serial port number 84.

NWP stands for network processor and it is part of the QPACE - Quantum Chromodynamics Parallel Computing on the Cell Broadband Engine project. The implementation is a lightweight uart implementation with the focus to consume as little resources as possible and it is connected to a DCR bus.

Quoted 4 lines
Quoted 2 lines

There have been no comment nor objection about this patch.

That doesn't mean anyone looked at it ;)

Quoted 2 lines

Andrew, do we have a serial maintainer or should I merge it via the powerpc tree ?

OK by me. Maybe Alan wants to grab it.

My version is mucked up anyway - PORT_NWPSERIAL has the same value as PORT_S3C6400.

#3 lore raw
Quoted 2 lines

My version is mucked up anyway - PORT_NWPSERIAL has the same value as PORT_S3C6400.

Should I send an updated version against a current tree?

ben