Skip to contentSkip to conversation

TTY updates for 2.6.29-rc

PATCH In review Alan Cox 3 participants 79 messages Jan 2, 2009 – Jan 5, 2009 Page 2 of 2

Subsystems (12)
lore
Share & tools
lore
author
#70 lore raw

PATCH 69/75 Serial: Allow port type to be specified when calling serial8250_register_port.

In reply to Alan Cox

From: David Daney <[email protected]>

Add flag value UPF_FIXED_TYPE which specifies that the UART type is known and should not be probed. For this case the UARTs properties are just copied out of the uart_config entry.

This allows us to keep SOC specific 8250 probe code out of 8250.c. In this case we know the serial hardware will not be changing as it is on the same silicon as the CPU, and we can specify it with certainty in the board/cpu setup code.

The alternative is to load up 8250.c with a bunch of OCTEON specific special cases in the probing code.

---

 drivers/serial/8250.c        |    9 +++++++++
 drivers/serial/serial_core.c |    7 +++++--
 include/linux/serial_8250.h  |    1 +
 include/linux/serial_core.h  |    2 ++
 4 files changed, 17 insertions(+), 2 deletions(-)
drivers/serial/8250.c +9 -0
index 849af9d..3ae4974 100644
@@ -2903,6 +2903,7 @@ static int __devinit serial8250_probe(struct platform_device *dev)
 		port.mapbase		= p->mapbase;
 		port.hub6		= p->hub6;
 		port.private_data	= p->private_data;
+		port.type		= p->type;
 		port.serial_in		= p->serial_in;
 		port.serial_out		= p->serial_out;
 		port.dev		= &dev->dev;
@@ -3058,6 +3059,14 @@ int serial8250_register_port(struct uart_port *port)
 		uart->port.private_data = port->private_data;
 		if (port->dev)
 			uart->port.dev = port->dev;
+
+		if (port->flags & UPF_FIXED_TYPE) {
+			uart->port.type = port->type;
+			uart->port.fifosize = uart_config[port->type].fifo_size;
+			uart->capabilities = uart_config[port->type].flags;
+			uart->tx_loadsz = uart_config[port->type].tx_loadsz;
+		}
+
 		set_io_from_upio(&uart->port);
 		/* Possibly override default I/O functions.  */
 		if (port->serial_in)
drivers/serial/serial_core.c +5 -2
index 9425ed6..dc68b7e 100644
@@ -2179,11 +2179,14 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
 	 * Now do the auto configuration stuff.  Note that config_port
 	 * is expected to claim the resources and map the port for us.
 	 */
-	flags = UART_CONFIG_TYPE;
+	flags = 0;
 	if (port->flags & UPF_AUTO_IRQ)
 		flags |= UART_CONFIG_IRQ;
 	if (port->flags & UPF_BOOT_AUTOCONF) {
-		port->type = PORT_UNKNOWN;
+		if (!(port->flags & UPF_FIXED_TYPE)) {
+			port->type = PORT_UNKNOWN;
+			flags |= UART_CONFIG_TYPE;
+		}
 		port->ops->config_port(port, flags);
 	}
 
include/linux/serial_8250.h +1 -0
index 77d83d9..d4d2a78 100644
@@ -28,6 +28,7 @@ struct plat_serial8250_port {
 	unsigned char	iotype;		/* UPIO_* */
 	unsigned char	hub6;
 	upf_t		flags;		/* UPF_* flags */
+	unsigned int	type;		/* If UPF_FIXED_TYPE */
 	unsigned int	(*serial_in)(struct uart_port *, int);
 	void		(*serial_out)(struct uart_port *, int, int);
 };
include/linux/serial_core.h +2 -0
index 60061f4..f155252 100644
@@ -295,6 +295,8 @@ struct uart_port {
 #define UPF_MAGIC_MULTIPLIER	((__force upf_t) (1 << 16))
 #define UPF_CONS_FLOW		((__force upf_t) (1 << 23))
 #define UPF_SHARE_IRQ		((__force upf_t) (1 << 24))
+/* The exact UART type is known and should not be probed.  */
+#define UPF_FIXED_TYPE		((__force upf_t) (1 << 27))
 #define UPF_BOOT_AUTOCONF	((__force upf_t) (1 << 28))
 #define UPF_FIXED_PORT		((__force upf_t) (1 << 29))
 #define UPF_DEAD		((__force upf_t) (1 << 30))
author
#71 lore raw

PATCH 70/75 Serial: UART driver changes for Cavium OCTEON.

In reply to Alan Cox

From: David Daney <[email protected]>

Cavium UART implementation is not covered by existing uart_configS. Define a new uart_config (PORT_OCTEON) which is specified by OCTEON platform device registration code.

---

 drivers/serial/8250.c       |    7 +++++++
 include/linux/serial_core.h |    3 ++-
 2 files changed, 9 insertions(+), 1 deletions(-)
drivers/serial/8250.c +7 -0
index 3ae4974..daa0056 100644
@@ -279,6 +279,13 @@ static const struct serial8250_config uart_config[] = {
 		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
 		.flags		= UART_CAP_FIFO,
 	},
+	[PORT_OCTEON] = {
+		.name		= "OCTEON",
+		.fifo_size	= 64,
+		.tx_loadsz	= 64,
+		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
+		.flags		= UART_CAP_FIFO,
+	},
 };
 
 #if defined (CONFIG_SERIAL_8250_AU1X00)
include/linux/serial_core.h +2 -1
index f155252..b419984 100644
@@ -40,7 +40,8 @@
 #define PORT_NS16550A	14
 #define PORT_XSCALE	15
 #define PORT_RM9000	16	/* PMC-Sierra RM9xxx internal UART */
-#define PORT_MAX_8250	16	/* max port ID */
+#define PORT_OCTEON	17	/* Cavium OCTEON internal UART */
+#define PORT_MAX_8250	17	/* max port ID */
 
 /*
  * ARM specific type numbers.  These are not currently guaranteed
author
#72 lore raw

PATCH 71/75 drivers/char/cyclades.c: cy_pci_probe: fix error path

In reply to Alan Cox

From: Andrew Morton <[email protected]>

We forgot to release resources in one case.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=12137

---

 drivers/char/cyclades.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/cyclades.c +1 -1
index 5e5b1dc..6a59f72 100644
@@ -5010,7 +5010,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		if (nchan == 0) {
 			dev_err(&pdev->dev, "Cyclom-Y PCI host card with no "
 					"Serial-Modules\n");
-			return -EIO;
+			goto err_unmap;
 		}
 	} else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Hi) {
 		struct RUNTIME_9060 __iomem *ctl_addr;
author
#73 lore raw

PATCH 72/75 tty: Fix an ircomm warning and note another bug

In reply to Alan Cox

From: Alan Cox <[email protected]>

Roel Kluin noted that line is unsigned so one test is unneccessary. Also add a warning for another flaw I noticed while making this change.

---

 net/irda/ircomm/ircomm_tty.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
net/irda/ircomm/ircomm_tty.c +3 -2
index e4e2cae..086d5ef 100644
@@ -371,9 +371,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
 	IRDA_DEBUG(2, "%s()\n", __func__ );
 
 	line = tty->index;
-	if ((line < 0) || (line >= IRCOMM_TTY_PORTS)) {
+	if (line >= IRCOMM_TTY_PORTS)
 		return -ENODEV;
-	}
 
 	/* Check if instance already exists */
 	self = hashbin_lock_find(ircomm_tty, line, NULL);
@@ -405,6 +404,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
 		 * Force TTY into raw mode by default which is usually what
 		 * we want for IrCOMM and IrLPT. This way applications will
 		 * not have to twiddle with printcap etc.
+		 *
+		 * Note this is completely usafe and doesn't work properly
 		 */
 		tty->termios->c_iflag = 0;
 		tty->termios->c_oflag = 0;
#74 lore raw

Re: [PATCH 72/75] tty: Fix an ircomm warning and note another bug

Hello Alan,

Quoted 28 lines · Alan Cox

From: Alan Cox <[email protected]>

Roel Kluin noted that line is unsigned so one test is unneccessary. Also add a warning for another flaw I noticed while making this change.

---

 net/irda/ircomm/ircomm_tty.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
net/irda/ircomm/ircomm_tty.c +1 -2
index e4e2cae..086d5ef 100644
@@ -371,9 +371,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
 	IRDA_DEBUG(2, "%s()\n", __func__ );
 
 	line = tty->index;
-	if ((line < 0) || (line >= IRCOMM_TTY_PORTS)) {
+	if (line >= IRCOMM_TTY_PORTS)
 		return -ENODEV;
-	}
 
 	/* Check if instance already exists */
 	self = hashbin_lock_find(ircomm_tty, line, NULL);

net/irda/ircomm/ircomm_tty.c static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) · line 408

Quoted 5 lines
net/irda/ircomm/ircomm_tty.c +2 -0
@@ -405,6 +404,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
 		 * Force TTY into raw mode by default which is usually what
 		 * we want for IrCOMM and IrLPT. This way applications will
 		 * not have to twiddle with printcap etc.
+		 *
+		 * Note this is completely usafe and doesn't work properly

Do you mean "unsafe"?

Quoted 8 lines
net/irda/ircomm/ircomm_tty.c +0 -1
 		 */
 		tty->termios->c_iflag = 0;
 		tty->termios->c_oflag = 0;
 
--

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

Kind regards,

Wolfram

Signature · 2 lines
  Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
author
#75 lore raw

Re: [PATCH 72/75] tty: Fix an ircomm warning and note another bug

Quoted 4 lines

net/irda/ircomm/ircomm_tty.c static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) · line 408

Quoted 1 line
net/irda/ircomm/ircomm_tty.c +1 -0
+		 * Note this is completely usafe and doesn't work properly

Do you mean "unsafe"?

Yes - I'll fix that later - well spotted

author
#76 lore raw

PATCH 73/75 hso modem detect fix patch against Alan Cox'es tty tree

In reply to Alan Cox

From: Denis Joseph Barrow <[email protected]>

Fixed incorrect check for the modem port, this prevents crashes caused by issueing a tiocmget_submit_urb on endpoints which don't exist for non modem devices.

---

 drivers/net/usb/hso.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/usb/hso.c +1 -1
index d974d97..148af34 100644
@@ -2663,7 +2663,7 @@ static struct hso_device *hso_create_bulk_serial_device(
 	serial->parent = hso_dev;
 	hso_dev->port_data.dev_serial = serial;
 
-	if (port & HSO_PORT_MODEM) {
+	if ((port & HSO_PORT_MASK) == HSO_PORT_MODEM) {
 		num_urbs = 2;
 		serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget),
 					   GFP_KERNEL);
author
#77 lore raw

PATCH 74/75 hso maintainers update patch

In reply to Alan Cox

From: Denis Joseph Barrow <[email protected]>

Added D.J. Barrow as maintainer of hso driver.

---

 MAINTAINERS           |    6 ++++++
 drivers/net/usb/hso.c |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index ceb32ee..d5fc534 100644
@@ -2049,6 +2049,12 @@ M:	[email protected]
 W:	http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi
 S:	Maintained
 
+HSO	3G Modem Driver (hso.c)
+P:	Denis Joseph Barrow
+M:	[email protected]
+W:	http://www.pharscape.org
+S:	Maintained
+
 HTCPEN TOUCHSCREEN DRIVER
 P:	Pau Oliva Fora
 M:	[email protected]
drivers/net/usb/hso.c +2 -0
index 148af34..c4918b8 100644
@@ -3,6 +3,8 @@
  * Driver for Option High Speed Mobile Devices.
  *
  *  Copyright (C) 2008 Option International
+ *                     Filip Aben <[email protected]>
+ *                     Denis Joseph Barrow <[email protected]>
  *  Copyright (C) 2007 Andrew Bird (Sphere Systems Ltd)
  *  			<[email protected]>
  *  Copyright (C) 2008 Greg Kroah-Hartman <[email protected]>
author
#78 lore raw

PATCH 75/75 serial_8250: support for Sealevel Systems Model 7803 COMM+8

In reply to Alan Cox

From: Flavio Leitner <[email protected]>

Add support for Sealevel Systems Model 7803 COMM+8

---

 drivers/serial/8250_pci.c |    3 +++
 include/linux/pci_ids.h   |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/serial/8250_pci.c +3 -0
index 2a2e1c7..c088146 100644
@@ -2287,6 +2287,9 @@ static struct pci_device_id serial_pci_tbl[] = {
 	{	PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_COMM8,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b2_8_115200 },
+	{	PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_7803,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b2_8_460800 },
 	{	PCI_VENDOR_ID_SEALEVEL, PCI_DEVICE_ID_SEALEVEL_UCOMM8,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b2_8_115200 },
include/linux/pci_ids.h +1 -0
index fa83dfe..218c73b 100644
@@ -1796,6 +1796,7 @@
 #define PCI_DEVICE_ID_SEALEVEL_UCOMM232	0x7202
 #define PCI_DEVICE_ID_SEALEVEL_COMM4	0x7401
 #define PCI_DEVICE_ID_SEALEVEL_COMM8	0x7801
+#define PCI_DEVICE_ID_SEALEVEL_7803	0x7803
 #define PCI_DEVICE_ID_SEALEVEL_UCOMM8	0x7804
 
 #define PCI_VENDOR_ID_HYPERCOPE		0x1365