All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Panin <pazke@donpac.ru>
To: Chris Bergeron <chris@pcburn.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Syba 8-Port Serial Card Unidentified By Kernel
Date: Sun, 28 Oct 2007 18:42:42 +0300	[thread overview]
Message-ID: <20071028154242.GA13166@pazke.donpac.ru> (raw)
In-Reply-To: <471CDA66.2020004@pcburn.com>


[-- Attachment #1.1: Type: text/plain, Size: 1692 bytes --]

On 295, 10 22, 2007 at 01:14:14 -0400, Chris Bergeron wrote:
> Andrey Panin wrote:
>> On 291, 10 18, 2007 at 01:00:06 -0400, Chris Bergeron wrote:
>>   So the card probably generates screaming interrupt... that's bad.
>> I found some docs for IT887x chips, according to these docs  IT887x
>> have simple interrupt controller inside. Further investigation is needed.
>>
>> Can you post output of lspci -xxx ?
>>
>>   
> Full output at 
> http://pcburn.com/files/Syba_serial_controller/lspci_xxx.out.  The relevant 
> part for the Syba card is probably:
>
> 01:08.0 Serial controller: PLX Technology, Inc. Unknown device 9016 (rev 
> 01)
> 00: b5 10 16 90 07 00 80 02 01 02 00 07 00 00 00 00
> 10: 01 a4 00 00 01 a8 00 00 01 ac 00 00 00 00 00 f5
> 20: 00 10 00 f5 00 20 00 f5 00 00 00 00 4e 54 08 00
> 30: 00 00 00 00 00 00 00 00 00 00 00 00 05 01 00 00
> 40: 3f 3f 08 00 00 8c 20 8b 45 54 55 45 00 00 10 d2
> 50: 01 01 71 03 01 03 00 00 00 00 00 00 00 00 00 00
> 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 70: 00 00 00 00 00 00 00 00 00 03 00 06 f8 03 f8 02
> 80: 78 03 78 07 00 08 00 07 00 01 20 01 40 01 60 01
> 90: 00 00 00 00 00 00 00 00 00 00 00 00 70 43 25 64
> a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Can you test an attached patch against 2.6.24-rc1 ?

-- 
Andrey Panin		| Linux and UNIX system administrator
pazke@donpac.ru		| PGP key: wwwkeys.pgp.net

[-- Attachment #1.2: patch-syba-2 --]
[-- Type: text/plain, Size: 5309 bytes --]

diff -urdpNX dontdiff linux-2.6.24.vanilla/drivers/serial/8250_pci.c linux-2.6.24/drivers/serial/8250_pci.c
--- linux-2.6.24.vanilla/drivers/serial/8250_pci.c	2007-10-28 13:00:14.000000000 +0300
+++ linux-2.6.24/drivers/serial/8250_pci.c	2007-10-28 18:15:12.000000000 +0300
@@ -610,45 +610,49 @@ static int pci_netmos_init(struct pci_de
 /* enable IO_Space bit */
 #define ITE_887x_POSIO_ENABLE		(1 << 31)
 
-static int pci_ite887x_init(struct pci_dev *dev)
+static int pci_ite_887x_allocate_io(struct pci_dev *dev)
 {
-	/* inta_addr are the configuration addresses of the ITE */
-	static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0,
-							0x200, 0x280, 0 };
-	int ret, i, type;
-	struct resource *iobase = NULL;
-	u32 miscr, uartbar, ioport;
+	static const short inta_addr[] = {
+		0x2a0, 0x2c0, 0x220, 0x240, 0x1e0, 0x200, 0x280, 0
+	};
+	int ret, i;
 
-	/* search for the base-ioport */
-	i = 0;
-	while (inta_addr[i] && iobase == NULL) {
-		iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
-								"ite887x");
-		if (iobase != NULL) {
+	for (i = 0; i < ARRAY_SIZE(inta_addr); i++) {
+		int iobase = inta_addr[i];
+
+		if (request_region(iobase, ITE_887x_IOSIZE, "ite887x")) {
 			/* write POSIO0R - speed | size | ioport */
 			pci_write_config_dword(dev, ITE_887x_POSIO0,
 				ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
-				ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
+				ITE_887x_POSIO_IOSIZE_32 | iobase);
+
 			/* write INTCBAR - ioport */
-			pci_write_config_dword(dev, ITE_887x_INTCBAR, inta_addr[i]);
-			ret = inb(inta_addr[i]);
+			pci_write_config_dword(dev, ITE_887x_INTCBAR, iobase);
+			ret = inb(iobase);
 			if (ret != 0xff) {
 				/* ioport connected */
-				break;
+				return iobase;
 			}
-			release_region(iobase->start, ITE_887x_IOSIZE);
-			iobase = NULL;
+			release_region(iobase, ITE_887x_IOSIZE);
 		}
-		i++;
 	}
 
-	if (!inta_addr[i]) {
+	return 0;
+}
+
+static int pci_ite887x_init(struct pci_dev *dev)
+{
+	int i, ret, type, iobase;
+	u32 miscr, uartbar, ioport;
+
+	iobase = pci_ite_887x_allocate_io(dev);
+	if (!iobase) {
 		printk(KERN_ERR "ite887x: could not find iobase\n");
 		return -ENODEV;
 	}
 
 	/* start of undocumented type checking (see parport_pc.c) */
-	type = inb(iobase->start + 0x18) & 0x0f;
+	type = inb(iobase + 0x18) & 0x0f;
 
 	switch (type) {
 	case 0x2:	/* ITE8871 (1P) */
@@ -697,7 +701,7 @@ static int pci_ite887x_init(struct pci_d
 
 	if (ret <= 0) {
 		/* the device has no UARTs if we get here */
-		release_region(iobase->start, ITE_887x_IOSIZE);
+		release_region(iobase, ITE_887x_IOSIZE);
 	}
 
 	return ret;
@@ -712,6 +716,57 @@ static void __devexit pci_ite887x_exit(s
 	release_region(ioport, ITE_887x_IOSIZE);
 }
 
+#define ITE_887x_IRR0	0
+#define ITE_887x_IRR1	1
+#define ITE_887x_IRR2	2
+#define ITE_887x_IMR0	4
+#define ITE_887x_IMR1	5
+#define ITE_887x_IMR2	6
+#define ITE_887x_IER0	8
+#define ITE_887x_IER1	9
+#define ITE_887x_IER2	10
+#define ITE_887x_ITR0	12
+#define ITE_887x_ITR1	13
+#define ITE_887x_ITR2	14
+
+static int pci_syba_ite887x_init(struct pci_dev *dev)
+{
+	int iobase = pci_ite_887x_allocate_io(dev);
+
+	if (!iobase) {
+		printk(KERN_ERR "ite887x: could not find iobase\n");
+		return -ENODEV;
+	}
+
+	/* DEBUG */
+	printk(KERN_INFO "ite887x: io base at %#x\n", iobase);
+	printk(KERN_INFO "ite887x: IRR0=%02x IMR0=%02x IER0=%02x\n", 
+		inb(iobase + ITE_887x_IRR0), inb(iobase + ITE_887x_IMR0), inb(iobase + ITE_887x_IER0));
+	printk(KERN_INFO "ite887x: IRR1=%02x IMR1=%02x IER1=%02x\n", 
+		inb(iobase + ITE_887x_IRR1), inb(iobase + ITE_887x_IMR1), inb(iobase + ITE_887x_IER1));
+	printk(KERN_INFO "ite887x: IRR2=%02x IMR2=%02x IER2=%02x\n", 
+		inb(iobase + ITE_887x_IRR2), inb(iobase + ITE_887x_IMR2), inb(iobase + ITE_887x_IER2));
+
+	/* Clear s/w interrupt genaration register (just in case) */
+	outb(0, iobase + ITE_887x_IER0);
+	outb(0, iobase + ITE_887x_IER1);
+	outb(0, iobase + ITE_887x_IER2);
+
+	/* Clear IRQ latches */
+	outb(0, iobase + ITE_887x_IRR0);
+	outb(0, iobase + ITE_887x_IRR1);
+	outb(0, iobase + ITE_887x_IRR2);
+
+	/* Mask interrupts from on-chip devices (unused on this card) */
+	outb(0xf, iobase + ITE_887x_IMR2);
+
+	/* Set external IRQ mode to level-triggered */
+	outb(0xff, iobase + ITE_887x_IER0);
+	outb(0xff, iobase + ITE_887x_IER1);
+
+	return 8;
+}
+
 static int
 pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
 		  struct uart_port *port, int idx)
@@ -797,6 +852,18 @@ static struct pci_serial_quirk pci_seria
 		.exit		= __devexit_p(pci_ite887x_exit),
 	},
 	/*
+	 * Syba
+	 */
+	{
+		.vendor		= PCI_VENDOR_ID_PLX,
+		.device		= 0x9016,
+		.subvendor	= 0x544e,
+		.subdevice	= 0x0008,
+		.init		= pci_syba_ite887x_init,
+		.setup		= pci_default_setup,
+		.exit		= __devexit_p(pci_ite887x_exit),
+	},
+	/*
 	 * Panacom
 	 */
 	{
@@ -2527,6 +2594,11 @@ static struct pci_device_id serial_pci_t
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b3_8_115200 },
 
+	/* Syba PCI8871-PR8 8-port serial card */
+	{	PCI_VENDOR_ID_PLX, 0x9016,
+		0x544e, 0x0008, 0, 0,
+		pbn_b0_8_115200 },
+
 	/*
 	 * Exar Corp. XR17C15[248] Dual/Quad/Octal UART
 	 */

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-10-28 15:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-05 21:31 Syba 8-Port Serial Card Unidentified By Kernel Chris Bergeron
2007-10-05 22:43 ` Nicholas Miell
2007-10-09 18:14 ` Lennart Sorensen
2007-10-09 19:25   ` Chris Bergeron
2007-10-10  9:54 ` Andrey Panin
2007-10-11 17:02   ` Chris Bergeron
2007-10-11 19:01     ` Lennart Sorensen
2007-10-11 20:48       ` Chris Bergeron
2007-10-12 12:08     ` Andrey Panin
2007-10-16 19:03       ` Chris Bergeron
2007-10-17  6:42         ` Andrey Panin
2007-10-17 22:16           ` Chris Bergeron
2007-10-18  5:57             ` Andrey Panin
2007-10-18 17:00               ` Chris Bergeron
2007-10-22 15:33                 ` Andrey Panin
2007-10-22 16:18                   ` Lennart Sorensen
2007-10-26 11:35                     ` Andrey Panin
2007-10-22 17:14                   ` Chris Bergeron
2007-10-28 15:42                     ` Andrey Panin [this message]
2008-09-04  3:59                       ` Bjorn Helgaas
2008-09-10 19:26                         ` Bjorn Helgaas
     [not found]   ` <200809181512.43523.bjorn.helgaas@hp.com>
     [not found]     ` <48D3EEDD.70403@pcburn.com>
2008-09-20 23:21       ` Bjorn Helgaas
  -- strict thread matches above, loose matches on Subject: below --
2007-10-19 14:17 kyle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071028154242.GA13166@pazke.donpac.ru \
    --to=pazke@donpac.ru \
    --cc=chris@pcburn.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.