[3c509] [PATCH] EISA 3com + isa-pnp

Andrzej Krzysztofowicz ankry@green.mif.pg.gda.pl
Wed, 11 Apr 2001 23:21:59 +0200 (CEST)


Hi,

> I think that rather than trying to match the "known" 3c509
> device IDs, it's safer to just exclude the known 3c59x IDs.

I've finally the possibility to check the EISA ID of my 3c579 board.
It has ID=0x5093. There's no rev.no. printed on the board, just "3c579".
Patch, that modifies testing follows.

The second patch allows using PnP support for modular isa-pnp support
(3c509 must be also a module then). This is untested, however seems obvious.

Patches are against 2.4.4-pre1 / 2.4.3-ac4.

BTW, wouldn't it be better for drivers supporting ISA PnP to have choice
whether isa-pnp support should be used for them or not (depending on whether
isa-pnp module is loaded or not)? At present, all such drivers just depend on
the isa-pnp module (if isa-pnp is compiled as module).
It needs only slight isapnp infrastructure modification and would allow
removing all the #ifdef's for CONFIG_ISAPNP from drivers init code.

Andrzej

********************** PATCH 1 **********************************
--- drivers/net/3c509.c.old	Wed Apr  4 00:18:17 2001
+++ drivers/net/3c509.c	Wed Apr 11 22:26:45 2001
@@ -231,9 +231,10 @@
 			if (inw(ioaddr + 0xC80) != 0x6d50)
 				continue;
 
-			/* Avoid conflict with 3c590, 3c592, 3c597, etc */
+			/* Check for a product that we support, 3c579 any rev.
+			   My 3c579 has ID = 0x5093 (AMK) */
 			device_id = (inb(ioaddr + 0xC82)<<8) + inb(ioaddr + 0xC83);
-			if ((device_id & 0xFF00) == 0x5900) {
+			if ((device_id & 0xFFF0) != 0x5090) {
 				continue;
 			}
 
********************** PATCH 2 **********************************
--- drivers/net/3c509.c.old	Wed Apr  4 00:18:17 2001
+++ drivers/net/3c509.c	Wed Apr 11 22:26:45 2001
@@ -174,7 +174,7 @@
 };
 #endif /* CONFIG_MCA */
 
-#ifdef CONFIG_ISAPNP
+#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
 static struct isapnp_device_id el3_isapnp_adapters[] __initdata = {
 	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
 		ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5090),
@@ -201,7 +201,7 @@
 
 static u16 el3_isapnp_phys_addr[8][3];
 static int nopnp;
-#endif /* CONFIG_ISAPNP */
+#endif /* CONFIG_ISAPNP || CONFIG_ISAPNP_MODULE */
 
 int __init el3_probe(struct net_device *dev)
 {
@@ -211,9 +211,9 @@
 	u16 phys_addr[3];
 	static int current_tag = 0;
 	int mca_slot = -1;
-#ifdef CONFIG_ISAPNP
+#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
 	static int pnp_cards = 0;
-#endif /* CONFIG_ISAPNP */
+#endif /* CONFIG_ISAPNP || CONFIG_ISAPNP_MODULE */
 
 	if (dev) SET_MODULE_OWNER(dev);
 
@@ -317,7 +318,7 @@
 	}
 #endif /* CONFIG_MCA */
 
-#ifdef CONFIG_ISAPNP
+#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
 	if (nopnp == 1)
 		goto no_pnp;
 
@@ -353,7 +354,7 @@
 		}
 	}
 no_pnp:
-#endif /* CONFIG_ISAPNP */
+#endif /* CONFIG_ISAPNP || CONFIG_ISAPNP_MODULE */
 
 	/* Select an open I/O location at 0x1*0 to do contention select. */
 	for ( ; id_port < 0x200; id_port += 0x10) {
@@ -399,7 +400,7 @@
 		phys_addr[i] = htons(id_read_eeprom(i));
 	}
 
-#ifdef CONFIG_ISAPNP
+#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
 	if (nopnp == 0) {
 		/* The ISA PnP 3c509 cards respond to the ID sequence.
 		   This check is needed in order not to register them twice. */
@@ -419,7 +420,7 @@
 			}
 		}
 	}
-#endif /* CONFIG_ISAPNP */
+#endif /* CONFIG_ISAPNP || CONFIG_ISAPNP_MODULE */
 
 	{
 		unsigned int iobase = id_read_eeprom(8);
@@ -1007,9 +1008,9 @@
 MODULE_PARM(irq,"1-8i");
 MODULE_PARM(xcvr,"1-8i");
 MODULE_PARM(max_interrupt_work, "i");
-#ifdef CONFIG_ISAPNP
+#if defined(CONFIG_ISAPNP) || defined(CONFIG_ISAPNP_MODULE)
 MODULE_PARM(nopnp, "i");
-#endif
+#endif /* CONFIG_ISAPNP || CONFIG_ISAPNP_MODULE */
 
 int
 init_module(void)
*****************************************************************
-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Technical University of Gdansk