Alan Cox | 8 Jul 13:11 2010
Face
Picon

Re: [PATCH] parport/serial: add support for Timedia/SUNIX cards to parport_serial

On Fri, 25 Jun 2010 20:23:43 -0400
Frédéric Brière <fbriere <at> fbriere.net> wrote:

> Timedia/SUNIX PCI cards with both serial and parallel ports are
> currently supported by 8250_pci and parport_pc individually.  Moving
> that support into parport_serial allows using both types of ports at the
> same time.

This seems to have fallen on silence so I'm getting around to looking at
it.  I'm not sure the sunix hack to avoid lots of entries is a good idea
- it'll eventually break horribly somewhere.

> + * Devices with a parallel port can be identified by their subdevice ID
> + * matching xx[7-9]x.  We thus mark them as class OTHER, so that they will be
> + * ignored by 8250_pci, and claimed by parport_serial instead.
> + */
> +static void __devinit quirk_timedia(struct pci_dev *dev)
> +{
> +	/* 0,2,3,5,6: serial only -- 7,8,9: serial + parallel */
> +	if ((dev->subsystem_device & 0x00f0) >= 0x70) {
> +		dev_info(&dev->dev, "Timedia %04x; "
> +			"changing class SERIAL to OTHER (use parport_serial)\n",
> +			dev->subsystem_device);
> +		dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) |
> +		    (dev->class & 0xff);
> +	}
> +}
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TIMEDIA, PCI_DEVICE_ID_TIMEDIA_1889,
> +		quirk_timedia);

(Continue reading)

Frédéric Brière | 12 Jul 17:44 2010
Picon

Re: [PATCH] parport/serial: add support for Timedia/SUNIX cards to parport_serial

On Thu, Jul 08, 2010 at 12:11:22PM +0100, Alan Cox wrote:
> If you did that check in the serial driver and returned -ENODEV to the
> probe the id will be handed on to the next driver that matches (ie
> parport_serial)

Thanks for the suggestion; it does look much cleaner that way.

Instead of sticking a big-ass if() in the function, I took the liberty
of adding a .probe alongside the .init/.setup quirks, in case this could
be useful for other devices.

Note that I did not bother to cache the result of find_quirk(), so it
will be called twice.  I did not find it worth to add extra complexity
just for that; let me know if you disagree.

--

-- 
On the Internet, no one knows you're using Windows NT
		-- Submitted by Ramiro Estrugo, restrugo <at> fateware.com
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Frédéric Brière | 12 Jul 17:49 2010
Picon

[PATCH 1/2] serial: 8250_pci: add .probe member to struct pci_serial_quirk

This function, if present, is called early on by the 8250_pci probe; it
can be used to reject devices meant for parport_serial.  (The .init
function cannot be used for this purpose, as it is also called by
parport_serial.)

Signed-off-by: Frédéric Brière <fbriere <at> fbriere.net>
---
 drivers/serial/8250_pci.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 01c012d..d9b9a63 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
 <at>  <at>  -41,6 +41,7  <at>  <at>  struct pci_serial_quirk {
 	u32	device;
 	u32	subvendor;
 	u32	subdevice;
+	int	(*probe)(struct pci_dev *dev);
 	int	(*init)(struct pci_dev *dev);
 	int	(*setup)(struct serial_private *,
 			 const struct pciserial_board *,
 <at>  <at>  -2470,11 +2471,19  <at>  <at>  EXPORT_SYMBOL_GPL(pciserial_resume_ports);
 static int __devinit
 pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
 {
+	struct pci_serial_quirk *quirk;
 	struct serial_private *priv;
 	const struct pciserial_board *board;
 	struct pciserial_board tmp;
(Continue reading)

Frédéric Brière | 12 Jul 17:49 2010
Picon

[PATCH 2/2] parport/serial: add support for Timedia/SUNIX cards to parport_serial

Timedia/SUNIX PCI cards with both serial and parallel ports are
currently supported by 8250_pci and parport_pc individually.  Moving
that support into parport_serial allows using both types of ports at the
same time.

This was successfully tested with a SUNIX 4079T.

Signed-off-by: Frédéric Brière <fbriere <at> fbriere.net>
---
 drivers/parport/parport_pc.c     |   54 -------------
 drivers/parport/parport_serial.c |  163 ++++++++++++++++++++++++++++++++++++++
 drivers/serial/8250_pci.c        |   23 ++++++
 3 files changed, 186 insertions(+), 54 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 0950fa4..e5d1d2f 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
 <at>  <at>  -2866,24 +2866,6  <at>  <at>  enum parport_pc_pci_cards {
 	lava_parallel_dual_b,
 	boca_ioppar,
 	plx_9050,
-	timedia_4078a,
-	timedia_4079h,
-	timedia_4085h,
-	timedia_4088a,
-	timedia_4089a,
-	timedia_4095a,
-	timedia_4096a,
-	timedia_4078u,
(Continue reading)

Alan Cox | 12 Jul 18:56 2010
Face
Picon

Re: [PATCH] parport/serial: add support for Timedia/SUNIX cards to parport_serial

> Note that I did not bother to cache the result of find_quirk(), so it
> will be called twice.  I did not find it worth to add extra complexity
> just for that; let me know if you disagree.

Without seeing the code its hard to be sure - but it sounds reasonable,
serial port loading isn't usually a hot benchmarking path 8)
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Frédéric Brière | 12 Jul 20:00 2010
Picon

[PATCH] parport_serial: Use the PCI IRQ if offered

Commit 51dcdfe added IRQ support for PCI parallel port devices handled
by parport_pc, but turned it off for parport_serial, despite a printk()
message to the contrary.

Signed-off-by: Frédéric Brière <fbriere <at> fbriere.net>
---
 drivers/parport/parport_serial.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index a64b275..60c191d 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
 <at>  <at>  -505,7 +505,6  <at>  <at>  static int __devinit parport_register (struct pci_dev *dev,
 			dev_dbg(&dev->dev,
 		"PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n",
 				io_lo, io_hi, irq);
-			irq = PARPORT_IRQ_NONE;
 		}
 		port = parport_pc_probe_port (io_lo, io_hi, irq,
 			      PARPORT_DMA_NONE, &dev->dev, IRQF_SHARED);
--

-- 
1.7.1


Gmane