Hello, I have put together a patch for the AT-2450FTX fiber optic card and the HomePNA card, so that appropriate interface can be selected when the module is loaded. if the parameter "interface=rj45" is passed in, and the card is a PCnet/Home 79C978, the card with use the standard twisted pair port, or else it will default to the 1Mb HomePNA mode. if the parameter "interface=fiber" is passed in, PHY address 1 is disabled and PHY address 2 is enabled. On the AT-2450FTX nic, this will use the fiber optic interface. These changes are for kernel version 2.2.18. Thanks, Stephen H Koh --- drivers/net/pcnet32.c.orig Fri Jan 12 10:08:49 2001 +++ drivers/net/pcnet32.c Fri Jan 19 14:10:46 2001 @@ -52,6 +52,7 @@ static const int max_interrupt_work = 80; static const int rx_copybreak = 200; +static char interface[8]; #define PORT_AUI 0x00 #define PORT_10BT 0x01 @@ -275,7 +276,8 @@ dxsuflo:1, /* disable transmit stop on uflo */ #endif full_duplex:1, /* full duplex possible */ - mii:1; /* mii port available */ + mii:1, /* mii port available */ + fiber:1; /* use fiber port */ #ifdef MODULE struct device *next; #endif @@ -536,7 +538,7 @@ pcnet32_probe1(struct device *dev, unsigned long ioaddr, unsigned char irq_line, int shared, int card_idx) { struct pcnet32_private *lp; - int i,media,fdx = 0, mii = 0; + int i,media,fdx = 0, mii = 0, fiber = 0; #ifdef DO_DXSUFLO int dxsuflo = 0; #endif @@ -605,6 +607,17 @@ /* Set CSR80:XMTSP, Tx start point = 20|64|128|220 bytes or size of frame */ i = a->read_csr(ioaddr, 80) & ~0x0C00; /* Clear bits we are touching */ a->write_csr(ioaddr, 80, i | (tx_start << 10)); + + /* + * option for fiber optic interface + * as found in Allied Telesyn's AT-2450FTX + */ + if (!strcmp(interface, "fiber")) { + if (pcnet32_debug > 2) + printk(KERN_DEBUG "pcnet32: using fiber optic interface\n"); + fiber = 1; + } + fdx = 1; mii = 1; #ifdef DO_DXSUFLO dxsuflo = 1; @@ -621,16 +634,22 @@ /* * This is based on specs published at www.amd.com. This section * assumes that a card with a 79C978 wants to go into 1Mb HomePNA - * mode. The 79C978 can also go into standard ethernet, and there - * probably should be some sort of module option to select the - * mode by which the card should operate + * mode. The 79C978 can also go into standard ethernet. */ - /* switch to home wiring mode */ media = a->read_bcr (ioaddr, 49); - if (pcnet32_debug > 2) - printk("pcnet32: pcnet32 media value %#x.\n", media); - media &= ~3; - media |= 1; + if (!strcmp(interface, "rj45")) { /* use standard ethernet */ + if (pcnet32_debug > 2) { + printk("pcnet32: pcnet32 media value %#x.\n", media); + printk("pcnet32: using rj45 connector.\n"); + } + } else { /* switch to home wiring mode */ + if (pcnet32_debug > 2) { + printk("pcnet32: pcnet32 media value %#x.\n", media); + printk("pcnet32: using homepna connector.\n"); + } + media &= ~3; + media |= 1; + } if (pcnet32_debug > 2) printk("pcnet32: pcnet32 media reset to %#x.\n", media); a->write_bcr (ioaddr, 49, media); @@ -701,6 +720,7 @@ #endif lp->ltint = ltint; lp->mii = mii; + lp->fiber = fiber; if (options[card_idx] > sizeof (options_mapping)) lp->options = PORT_ASEL; else @@ -842,6 +862,20 @@ lp->a.write_bcr (ioaddr, 32, val); } + /* + * set DANAS, clear ASEL, select MII, + * set isolate PHY 1, clear isolate PHY 2 + */ + if (lp->fiber) { + lp->a.write_bcr(ioaddr, 32, lp->a.read_bcr(ioaddr, 32) | 0x80); + lp->a.write_bcr(ioaddr, 2, lp->a.read_bcr(ioaddr, 2) & ~0x2); + lp->a.write_csr(ioaddr, 15, lp->a.read_csr(ioaddr, 15) | 0x180); + lp->a.write_bcr(ioaddr, 33, (lp->a.read_bcr(ioaddr, 33) & ~0x3e0) | 0x1 << 5); + lp->a.write_bcr(ioaddr, 34, lp->a.read_bcr(ioaddr, 34) | 0x400); + lp->a.write_bcr(ioaddr, 33, (lp->a.read_bcr(ioaddr, 33) & ~0x3e0) | 0x2 << 5); + lp->a.write_bcr(ioaddr, 34, lp->a.read_bcr(ioaddr, 34) & ~0x400); + } + #ifdef DO_DXSUFLO if (lp->dxsuflo) { /* Disable transmit stop on underflow */ val = lp->a.read_csr (ioaddr, 3); @@ -1502,6 +1536,7 @@ MODULE_PARM(tx_start_pt, "i"); MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i"); MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i"); +MODULE_PARM(interface, "c8"); /* An additional parameter that may be passed in... */ - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org