Skip to contentSkip to conversation

serial/8250_pci: add a quirk for the kt serial controller

PATCH Superseded Dan Williams 3 participants 7 messages Oct 23, 2011 – Nov 15, 2011

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial/8250_pci: add a quirk for the kt serial controller

Workaround dropped notifications in the iir register. Prevent reads coincident with new interrupt notifications by reading the iir at most once per interrupt.

---
 drivers/tty/serial/8250.c     |    6 +++++-
 drivers/tty/serial/8250_pci.c |   15 +++++++++++++++
 include/linux/pci_ids.h       |    1 +
 include/linux/serial_core.h   |    1 +
 4 files changed, 22 insertions(+), 1 deletions(-)
drivers/tty/serial/8250.c +5 -1
index 7f50999..513e728 100644
@@ -1652,7 +1652,11 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
 
 		up = list_entry(l, struct uart_8250_port, list);
 
-		iir = serial_in(up, UART_IIR);
+		if (pass_counter && up->port.flags & UPF_IIR_ONCE)
+			iir = UART_IIR_NO_INT;
+		else
+			iir = serial_in(up, UART_IIR);
+
 		if (!(iir & UART_IIR_NO_INT)) {
 			serial8250_handle_port(up);
 
drivers/tty/serial/8250_pci.c +15 -0
index 3abeca2..4ad2fb4 100644
@@ -1092,6 +1092,14 @@ static int skip_tx_en_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }
 
+static int kt_serial_setup(struct serial_private *priv,
+			   const struct pciserial_board *board,
+			   struct uart_port *port, int idx)
+{
+	port->flags |= UPF_IIR_ONCE;
+	return skip_tx_en_setup(priv, board, port, idx);
+}
+
 static int pci_eg20t_init(struct pci_dev *dev)
 {
 #if defined(CONFIG_SERIAL_PCH_UART) || defined(CONFIG_SERIAL_PCH_UART_MODULE)
@@ -1211,6 +1219,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= ce4100_serial_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_PATSBURG_KT,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= kt_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
include/linux/pci_ids.h +1 -0
index ae96bbe..ed80d75 100644
@@ -2492,6 +2492,7 @@
 #define PCI_DEVICE_ID_INTEL_IOAT	0x1a38
 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN	0x1c41
 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX	0x1c5f
+#define PCI_DEVICE_ID_INTEL_PATSBURG_KT	0x1d3d
 #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0	0x1d40
 #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1	0x1d41
 #define PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI	0x1e31
include/linux/serial_core.h +1 -0
index a5c3114..a66484b3 100644
@@ -350,6 +350,7 @@ 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))
+#define UPF_IIR_ONCE		((__force upf_t) (1 << 25))
 /* 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))
#1 lore raw

include/linux/pci_ids.h line 2498

Quoted 10 lines · Dan Williams
include/linux/pci_ids.h +1 -0
@@ -2492,6 +2492,7 @@
 #define PCI_DEVICE_ID_INTEL_IOAT	0x1a38
 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN	0x1c41
 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX	0x1c5f
+#define PCI_DEVICE_ID_INTEL_PATSBURG_KT	0x1d3d
 #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0	0x1d40
 #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1	0x1d41
 #define PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI	0x1e31

Based on the comment at the top of this file, you shouldn't add this entry to it.

Care to redo the patch without that change?

thanks,

greg k-h

#2 lore raw

From: Dan Williams <[email protected]>
Date: Sun, 23 Oct 2011 15:06:24 -0700
Subject: [PATCH v2] serial/8250_pci: add a quirk for the kt serial controller

Workaround dropped notifications in the iir register. Prevent reads coincident with new interrupt notifications by reading the iir at most once per interrupt.

---
On Tue, 2011-10-25 at 04:28 +0200, Greg KH wrote:

Quoted 2 lines · Dan Williams
Quoted 2 lines
include/linux/pci_ids.h +0 -0

[..]

Quoted 4 lines

Based on the comment at the top of this file, you shouldn't add this entry to it.

Care to redo the patch without that change?

Ok, moved it to drivers/tty/serial/8250_pci.c and cleaned up the conflicting "/* This should be in linux/pci_ids.h */" comment.

Thanks,
Dan

 drivers/tty/serial/8250.c     |    6 +++++-
 drivers/tty/serial/8250_pci.c |   17 ++++++++++++++++-
 include/linux/serial_core.h   |    1 +
 3 files changed, 22 insertions(+), 2 deletions(-)
drivers/tty/serial/8250.c +5 -1
index 7f50999..513e728 100644
@@ -1652,7 +1652,11 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
 
 		up = list_entry(l, struct uart_8250_port, list);
 
-		iir = serial_in(up, UART_IIR);
+		if (pass_counter && up->port.flags & UPF_IIR_ONCE)
+			iir = UART_IIR_NO_INT;
+		else
+			iir = serial_in(up, UART_IIR);
+
 		if (!(iir & UART_IIR_NO_INT)) {
 			serial8250_handle_port(up);
 
drivers/tty/serial/8250_pci.c +16 -1
index 3abeca2..d8fd94a 100644
@@ -1092,6 +1092,14 @@ static int skip_tx_en_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }
 
+static int kt_serial_setup(struct serial_private *priv,
+			   const struct pciserial_board *board,
+			   struct uart_port *port, int idx)
+{
+	port->flags |= UPF_IIR_ONCE;
+	return skip_tx_en_setup(priv, board, port, idx);
+}
+
 static int pci_eg20t_init(struct pci_dev *dev)
 {
 #if defined(CONFIG_SERIAL_PCH_UART) || defined(CONFIG_SERIAL_PCH_UART_MODULE)
@@ -1101,7 +1109,6 @@ static int pci_eg20t_init(struct pci_dev *dev)
 #endif
 }
 
-/* This should be in linux/pci_ids.h */
 #define PCI_VENDOR_ID_SBSMODULARIO	0x124B
 #define PCI_SUBVENDOR_ID_SBSMODULARIO	0x124B
 #define PCI_DEVICE_ID_OCTPRO		0x0001
@@ -1127,6 +1134,7 @@ static int pci_eg20t_init(struct pci_dev *dev)
 #define PCI_DEVICE_ID_OXSEMI_16PCI958	0x9538
 #define PCIE_DEVICE_ID_NEO_2_OX_IBM	0x00F6
 #define PCI_DEVICE_ID_PLX_CRONYX_OMEGA	0xc001
+#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d
 
 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584	0x1584
@@ -1211,6 +1219,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= ce4100_serial_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_PATSBURG_KT,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= kt_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
include/linux/serial_core.h +1 -0
index a5c3114..a66484b3 100644
@@ -350,6 +350,7 @@ 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))
+#define UPF_IIR_ONCE		((__force upf_t) (1 << 25))
 /* 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))
Signature · 1 line
1.7.6
#3 lore raw
Quoted 10 lines · Dan Williams

From: Dan Williams <[email protected]>
Date: Sun, 23 Oct 2011 15:06:24 -0700
Subject: [PATCH v2] serial/8250_pci: add a quirk for the kt serial controller

Workaround dropped notifications in the iir register. Prevent reads coincident with new interrupt notifications by reading the iir at most once per interrupt.

Much better.

But.

Do you really think I can apply a patch that looks like this above? I have to edit the text of the email before I apply it.

Now I'm a bit grumpy about this at the moment as Linus yelled at me for patches where I missed this on a few for the 3.2 merge window, so I'm going to push back on people now very hard.

Please send this in a format that I can run 'git am' on the email you send me. I could not do that here, otherwise we would end up with a duplicate header in the changelog message.

Yes, it makes you do a bit more work, but when you are handling thousands of patches like me, you scale better than I do :)

Actually, it's just making you do it properly, along with everyone else, which is a good thing, right?

thanks,

greg k-h

#4 lore raw
Quoted 12 lines · Greg KH
Quoted 10 lines · Dan Williams

From: Dan Williams <[email protected]>
Date: Sun, 23 Oct 2011 15:06:24 -0700
Subject: [PATCH v2] serial/8250_pci: add a quirk for the kt serial controller

Workaround dropped notifications in the iir register.  Prevent reads coincident with new interrupt notifications by reading the iir at most once per interrupt.

Quoted 6 lines

Much better.

But.

Do you really think I can apply a patch that looks like this above?  I have to edit the text of the email before I apply it.

I don't doubt you get busted patches all the time, this isn't one. Double checked before and now triple checked that git am takes the last occurrence of the From: Date: and Subject: headers and that my mailer is not corrupting the patch.

I have no problem resending to fit into your workflow, but I expect "git am" will do the right thing with this mail.

--
Dan
--
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

#5 lore raw
Quoted 13 lines · Dan J
Quoted 12 lines · Greg KH
Quoted 10 lines · Dan Williams

From: Dan Williams <[email protected]>
Date: Sun, 23 Oct 2011 15:06:24 -0700
Subject: [PATCH v2] serial/8250_pci: add a quirk for the kt serial controller

Workaround dropped notifications in the iir register.  Prevent reads coincident with new interrupt notifications by reading the iir at most once per interrupt.

Quoted 8 lines
Quoted 6 lines

Much better.

But.

Do you really think I can apply a patch that looks like this above?  I have to edit the text of the email before I apply it.

I don't doubt you get busted patches all the time, this isn't one.

...except for the fact that it would have collided spectacularly with the contents of tty.git staged for 3.2. Sorry for the noise, will resend.

--
Dan
--
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

#6 lore raw
In reply to Dan Williams
Quoted 17 lines · Dan Williams

From: Dan Williams <[email protected]>
Date: Sun, 23 Oct 2011 15:06:24 -0700
Subject: [PATCH v2] serial/8250_pci: add a quirk for the kt serial controller

Workaround dropped notifications in the iir register. Prevent reads coincident with new interrupt notifications by reading the iir at most once per interrupt.

---
On Tue, 2011-10-25 at 04:28 +0200, Greg KH wrote:

Quoted 2 lines · Dan Williams
Quoted 2 lines
include/linux/pci_ids.h +0 -0

[..]

Quoted 7 lines
Quoted 4 lines

Based on the comment at the top of this file, you shouldn't add this entry to it.

Care to redo the patch without that change?

Ok, moved it to drivers/tty/serial/8250_pci.c and cleaned up the conflicting "/* This should be in linux/pci_ids.h */" comment.

This doesn't apply to the 3.2-rc1 kernel at all:

patching file drivers/tty/serial/8250.c
Hunk #1 FAILED at 1652.
1 out of 1 hunk FAILED -- saving rejects to file drivers/tty/serial/8250.c.rej patching file drivers/tty/serial/8250_pci.c
Hunk #2 succeeded at 1118 with fuzz 1 (offset 9 lines).
Hunk #3 succeeded at 1143 (offset 9 lines).
Hunk #4 succeeded at 1228 (offset 9 lines).
patching file include/linux/serial_core.h
Hunk #1 FAILED at 350.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/serial_core.h.rej patching file drivers/tty/serial/8250.c
Hunk #1 FAILED at 1652.
1 out of 1 hunk FAILED -- saving rejects to file drivers/tty/serial/8250.c.rej patching file drivers/tty/serial/8250_pci.c
Hunk #2 succeeded at 1118 with fuzz 1 (offset 9 lines).
Hunk #3 succeeded at 1143 (offset 9 lines).
Hunk #4 succeeded at 1228 (offset 9 lines).
patching file include/linux/serial_core.h
Hunk #1 FAILED at 350.
1 out of 1 hunk FAILED -- saving rejects to file include/linux/serial_core.h.rej

Care to fix it up and resend it?

thanks,

greg k-h