From 20f130495c07cd01fb423c3dec7f045038118dec Mon Sep 17 00:00:00 2001
From: Russell King <rmk@dyn-67.arm.linux.org.uk>
Date: Sat, 16 Sep 2006 23:04:37 +0100
Subject: [SERIAL] serial_cs: handle Nokia multi->single port bodge via config
 quirk

According to the existing code, Nokia only make single-port cards,
but are detected as multi-port cards.  Handle this in roughly the
same way via the config quirk - forcing it to be a real single port
card (info->multi=0) changes the way we allocate the IO memory,
which might stop the card working.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/serial/serial_cs.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

(limited to 'drivers')

diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 788ba40..7049220 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -132,6 +132,18 @@ static int quirk_post_ibm(struct pcmcia_device *link)
 	return -ENODEV;
 }
 
+/*
+ * Nokia cards are not really multiport cards.  Shouldn't this
+ * be handled by setting the quirk entry .multi = 0 | 1 ?
+ */
+static void quirk_config_nokia(struct pcmcia_device *link)
+{
+	struct serial_info *info = link->priv;
+
+	if (info->multi > 1)
+		info->multi = 1;
+}
+
 static void quirk_wakeup_oxsemi(struct pcmcia_device *link)
 {
 	struct serial_info *info = link->priv;
@@ -193,6 +205,11 @@ static const struct serial_quirk quirks[] = {
 		.prodid	= PRODID_NATINST_QUAD_RS232,
 		.multi	= 4,
 	}, {
+		.manfid	= MANFID_NOKIA,
+		.prodid	= ~0,
+		.multi	= -1,
+		.config	= quirk_config_nokia,
+	}, {
 		.manfid	= MANFID_OMEGA,
 		.prodid	= PRODID_OMEGA_QSP_100,
 		.multi	= 4,
@@ -663,11 +680,6 @@ static int multi_config(struct pcmcia_device * link)
 	}
 
 	setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ);
-	/* The Nokia cards are not really multiport cards */
-	if (info->manfid == MANFID_NOKIA) {
-		rc = 0;
-		goto free_cfg_mem;
-	}
 	for (i = 0; i < info->multi - 1; i++)
 		setup_serial(link, info, base2 + (8 * i),
 				link->irq.AssignedIRQ);
-- 
cgit v1.1