[3c509] Re: [Fwd: Problem: EISA 3com card detection]

Andrzej Krzysztofowicz ankry@green.mif.pg.gda.pl
Mon, 12 Mar 2001 00:19:16 +0100 (CET)


> >    While trying to run Linux kernel on an EISA boards with two
> > 3c592 EISA adapters I noticed that one of them is detected by both:
> > 3c509 and 3c59x drivers.
> 
> We only check the manufacturer ID, not the device ID so yes,
> the driver will detect 3c590's as well.
> 
> I think that rather than trying to match the "known" 3c509
> device IDs, it's safer to just exclude the known 3c59x IDs.
> 
> You're the only person in the world who has an EISA
> 3c59x, let alone a 3c5x9 as well :)

I'd rather think I am the only trying to use both drivers together with an
EISA 3c59x adapter plugged :)

> Could you please test this patch?

I can't at this moment. But I'll try next week.

As I see the patch is equivalent to mine (from my point of view).

> --- linux-2.4.2-ac18/drivers/net/3c509.c	Sun Mar 11 15:12:38 2001
> +++ linux-ac/drivers/net/3c509.c	Sun Mar 11 23:13:17 2001
[...]
> @@ -223,6 +225,12 @@
>  			if (inw(ioaddr + 0xC80) != 0x6d50)
>  				continue;
>  
> +			/* Avoid conflict with 3c590, 3c592, 3c597, etc */
> +			device_id = (inb(ioaddr + 0xC82)<<8) + inb(ioaddr + 0xC83);
> +			if ((device_id & 0xFF00) == 0x5900) {
> +				continue;
> +			}
> +

But some remarks concerning the driver:
- 3Com did not released any other EISA adapter than 3c579 based on this chip
  (and supported by this driver). So where is the problem with your/my patch ?
  -- if in "unknown" reported by 3c579 device_id - I am promissed to receive
     a 3c579 EISA adapter next week, so will be able to perform tests.
  -- if in "not modifying stable kernel sources" - then no comments.

- Alan suggested me in a private mail that we need an EISA API in the
  kernel, like the MCA API. What is your opinion ?
  IMO using any EISA API here would require well known device_id.

- Do you maintain the 3c509 kernel driver ?  As I see it lacks some __init /
  __initdata. (A patch follows; PCMCIA 3c589 uses a separate driver - so no
  hotplug/__devinit here)

Andrzej

************** __init 3c509 PATCH *************************************
--- linux-2.4.2ac14/drivers/net/3c509.c	Thu Mar  8 21:41:56 2001
+++ linux/drivers/net/3c509.c	Sun Mar 11 23:49:57 2001
@@ -41,7 +41,6 @@
 		v1.16 2/3/98 Different ID port handling to avoid sound cards. -djb
 */
 
-static char *version = "3c509.c:1.16 (2.2) 2/3/98 becker@cesdis.gsfc.nasa.gov.\n";
 /* A few values that may be tweaked. */
 
 /* Time in jiffies before concluding the transmitter is hung. */
@@ -61,6 +60,7 @@
 #include <linux/in.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
@@ -71,6 +71,9 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
+static char *version __initdata =
+	"3c509.c:1.16 (2.2) 2/3/98 becker@cesdis.gsfc.nasa.gov.\n";
+
 #ifdef EL3_DEBUG
 static int el3_debug = EL3_DEBUG;
 #else
@@ -137,7 +140,7 @@
 	struct sk_buff *queue[SKB_QUEUE_SIZE];
 	char mca_slot;
 };
-static int id_port = 0x110;		/* Start with 0x110 to avoid new sound cards.*/
+static int id_port __initdata = 0x110;	/* Start with 0x110 to avoid new sound cards.*/
 static struct net_device *el3_root_dev = NULL;
 
 static ushort id_read_eeprom(int index);
@@ -158,7 +161,7 @@
 	int id;
 };
 
-static struct el3_mca_adapters_struct el3_mca_adapters[] = {
+static struct el3_mca_adapters_struct el3_mca_adapters[] __initdata = {
 	{ "3Com 3c529 EtherLink III (10base2)", 0x627c },
 	{ "3Com 3c529 EtherLink III (10baseT)", 0x627d },
 	{ "3Com 3c529 EtherLink III (test mode)", 0x62db },
@@ -169,7 +172,7 @@
 #endif /* CONFIG_MCA */
 
 #ifdef CONFIG_ISAPNP
-static struct isapnp_device_id el3_isapnp_adapters[] = {
+static struct isapnp_device_id el3_isapnp_adapters[] __initdata = {
 	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
 		ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5090),
 		(long) "3Com Etherlink III (TP)" },
@@ -197,7 +200,7 @@
 static int nopnp;
 #endif /* CONFIG_ISAPNP */
 
-int el3_probe(struct net_device *dev)
+int __init el3_probe(struct net_device *dev)
 {
 	struct el3_private *lp;
 	short lrs_state = 0xff, i;
@@ -502,7 +505,7 @@
 /* Read a word from the EEPROM using the regular EEPROM access register.
    Assume that we are in register window zero.
  */
-static ushort read_eeprom(int ioaddr, int index)
+static ushort __init read_eeprom(int ioaddr, int index)
 {
 	outw(EEPROM_READ + index, ioaddr + 10);
 	/* Pause for at least 162 us. for the read to take place. */
@@ -511,7 +514,7 @@
 }
 
 /* Read a word from the EEPROM when in the ISA ID probe state. */
-static ushort id_read_eeprom(int index)
+static ushort __init id_read_eeprom(int index)
 {
 	int bit, word = 0;
 
-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Technical University of Gdansk