diff -ur --exclude-from=/root/torben linux-2.3.99-pre6-1/Documentation/networking/tlan.txt linux/Documentation/networking/tlan.txt --- linux-2.3.99-pre6-1/Documentation/networking/tlan.txt Thu Apr 13 11:54:28 2000 +++ linux/Documentation/networking/tlan.txt Thu Apr 13 13:11:29 2000 @@ -2,7 +2,7 @@ (C) 1998 James Banks (C) 1999-2000 Torben Mathiasen -TLAN driver for Linux, version 1.5 +TLAN driver for Linux, version 1.7 README @@ -69,8 +69,6 @@ and 4th parameters to set aui and debug respectively. For example: -/* kernel-parameters are currently not supported. I will fix this asap. */ - ether=0,0,0x1,0x7,eth0 This sets aui to 0x1 and debug to 0x7, assuming eth0 is a @@ -79,10 +77,10 @@ The bits in the third byte are assigned as follows: 0x01 = aui - 0x04 = use half duplex - 0x08 = use full duplex - 0x10 = use 10BaseT - 0x20 = use 100BaseTx + 0x02 = use half duplex + 0x04 = use full duplex + 0x08 = use 10BaseT + 0x10 = use 100BaseTx III. Things to try if you have problems. diff -ur --exclude-from=/root/torben linux-2.3.99-pre6-1/MAINTAINERS linux/MAINTAINERS --- linux-2.3.99-pre6-1/MAINTAINERS Thu Apr 13 11:56:08 2000 +++ linux/MAINTAINERS Thu Apr 13 11:30:34 2000 @@ -1031,6 +1031,7 @@ M: torben.mathiasen@compaq.com M: tmm@image.dk L: tlan@vuser.vu.union.edu +W: http://tlan.kernel.dk S: Maintained TOKEN-RING NETWORK DRIVER Only in linux/drivers/char: consolemap_deftbl.c diff -ur --exclude-from=/root/torben linux-2.3.99-pre6-1/drivers/net/tlan.c linux/drivers/net/tlan.c --- linux-2.3.99-pre6-1/drivers/net/tlan.c Thu Apr 13 11:54:29 2000 +++ linux/drivers/net/tlan.c Thu Apr 13 13:38:22 2000 @@ -72,6 +72,18 @@ * - TODO: Port completely to new PCI/DMA API * Auto-Neg fallback. * + * v1.6 April 04, 2000 - Fixed driver support for kernel-parameters. Haven't + * tested it though, as the kernel support is currently + * broken (2.3.99p4p3). + * - Updated tlan.txt accordingly. + * - Adjusted minimum/maximum frame length. + * - There is now a TLAN website up at + * http://tlan.kernel.dk + * + * v1.7 April 07, 2000 - Started to implement custom ioctls. Driver now + * reports PHY information when used with Donald + * Beckers userspace MII diagnostics utility. + * *******************************************************************************/ @@ -111,9 +123,14 @@ static int bbuf = 0; static u8 *TLanPadBuffer; static char TLanSignature[] = "TLAN"; -static int TLanVersionMajor = 1; -static int TLanVersionMinor = 5; +static const char *tlan_banner = "ThunderLAN driver v1.7, Torben Mathiasen \n"; +const char *media[] = { + "10BaseT", "10BaseT Full-Duplex","100baseTx", + "100baseTx Full-Duplex", "100baseT4", 0 +}; + +int media_map[] = { 0x0020, 0x0040, 0x0080, 0x0100, 0x0200,}; static TLanAdapterEntry TLanAdapterList[] __initdata = { { PCI_VENDOR_ID_COMPAQ, @@ -211,6 +228,7 @@ static int TLan_Close(struct net_device *); static struct net_device_stats *TLan_GetStats( struct net_device * ); static void TLan_SetMulticastList( struct net_device * ); +static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static u32 TLan_HandleInvalid( struct net_device *, u16 ); static u32 TLan_HandleTxEOF( struct net_device *, u16 ); @@ -371,9 +389,7 @@ u32 io_base, index; int found; - printk(KERN_INFO "ThunderLAN driver v%d.%d\n", - TLanVersionMajor, - TLanVersionMinor); + printk(KERN_INFO "%s", tlan_banner); TLanPadBuffer = (u8 *) kmalloc(TLAN_MIN_FRAME_SIZE, (GFP_KERNEL | GFP_DMA)); @@ -404,17 +420,32 @@ dev->irq = irq; priv->adapter = &TLanAdapterList[index]; priv->adapterRev = rev; - priv->aui = aui; - if ( ( duplex != 1 ) && ( duplex != 2 ) ) - duplex = 0; - priv->duplex = duplex; - - if ( ( speed != 10 ) && ( speed != 100 ) ) - speed = 0; + /* Kernel parameters */ + if (dev->mem_start) { + priv->aui = dev->mem_start & 0x01; + priv->duplex = ((dev->mem_start & 0x06) == 0x06) ? 0 : (dev->mem_start & 0x06) >> 1; + priv->speed = ((dev->mem_start & 0x18) == 0x18) ? 0 : (dev->mem_start & 0x18) >> 3; + + if (priv->speed == 0x1) { + priv->speed = TLAN_SPEED_10; + } else if (priv->speed == 0x2) { + priv->speed = TLAN_SPEED_100; + } + priv->debug = dev->mem_end; + } else { - priv->speed = speed; - priv->debug = debug; + if ( ( duplex != 1 ) && ( duplex != 2 ) ) + duplex = 0; + priv->duplex = duplex; + + if ( ( speed != 10 ) && ( speed != 100 ) ) + speed = 0; + priv->aui = aui; + priv->speed = speed; + priv->debug = debug; + } + spin_lock_init(&priv->lock); if (TLan_Init(dev)) { @@ -611,7 +642,7 @@ dev->stop = &TLan_Close; dev->get_stats = &TLan_GetStats; dev->set_multicast_list = &TLan_SetMulticastList; - + dev->do_ioctl = &TLan_ioctl; return 0; @@ -669,6 +700,49 @@ + /************************************************************** + * TLan_ioctl + * + * Returns: + * 0 on success, error code otherwise + * Params: + * dev structure of device to receive ioctl. + * + * rq ifreq structure to hold userspace data. + * + * cmd ioctl command. + * + * + *************************************************************/ + +static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ + TLanPrivateInfo *priv = (TLanPrivateInfo *) dev->priv; + u16 *data = (u16 *)&rq->ifr_data; + u32 phy = priv->phy[priv->phyNum]; + + if (!priv->phyOnline) + return -EAGAIN; + + switch(cmd) { + case SIOCDEVPRIVATE: + data[0] = phy; + + case SIOCDEVPRIVATE+1: /* Read MII register */ + TLan_MiiReadReg(dev, data[0], data[1], &data[3]); + return 0; + + case SIOCDEVPRIVATE+2: /* Write MII register */ + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + TLan_MiiWriteReg(dev, data[0], data[1], data[2]); + return 0; + default: + return -EOPNOTSUPP; + } +} /* tlan_ioctl */ + + /*************************************************************** * TLan_StartTx @@ -1898,6 +1972,7 @@ u32 phy; u8 sio; u16 status; + u16 partner; u16 tlphy_ctl; phy = priv->phy[priv->phyNum]; @@ -1922,7 +1997,29 @@ udelay( 1000 ); TLan_MiiReadReg( dev, phy, MII_GEN_STS, &status ); if ( status & MII_GS_LINK ) { - printk( "TLAN: %s: Link active.\n", dev->name ); + TLan_MiiReadReg( dev, phy, MII_AN_LPA, &partner ); + TLan_MiiReadReg( dev, phy, MII_GEN_CTL, &tlphy_ctl ); + printk( "TLAN: %s: Link active\n", dev->name ); + + /* + printk( "TLAN: %s: Link active with", dev->name ); + if (tlphy_ctl & 0x1000) { + printk( "10%sMbps %s-duplex\n", + tlphy_ctl & 0x2000 ? "0" : "", + tlphy_ctl & 0x0100 ? "full" : "half"); + printk( "TLAN: Partner capability:"); + for (i = 5; i <=10 ; i++) + if (partner & (1<name, + tlphy_ctl & 0x2000 ? "0" : "", + tlphy_ctl & 0x0100 ? "full" : "half"); + //priv->tlanFullDuplex ? "full" : "half"); + + } */ + TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK ); } } @@ -1946,7 +2043,7 @@ outl( virt_to_bus( priv->rxList ), dev->base_addr + TLAN_CH_PARM ); outl( TLAN_HC_GO | TLAN_HC_RT, dev->base_addr + TLAN_HOST_CMD ); } else { - printk( "TLAN: %s: Link inactive, will retry in 10 secs...\n", dev->name ); + printk( "TLAN: %s: Link inactive, will retry in 10 secs...\n", dev->name ); TLan_SetTimer( dev, (10*HZ), TLAN_TIMER_FINISH_RESET ); return; } @@ -2208,7 +2305,6 @@ ( priv->speed == TLAN_SPEED_DEFAULT ) && ( ! priv->aui ) ) { ability = status >> 11; - if ( priv->speed == TLAN_SPEED_10 ) { ability &= 0x0003; } else if ( priv->speed == TLAN_SPEED_100 ) { @@ -2220,11 +2316,9 @@ } else if ( priv->duplex == TLAN_DUPLEX_HALF ) { ability &= 0x0005; } - - TLan_MiiWriteReg( dev, phy, MII_AN_ADV, ( ability << 5 ) | 1 ); + TLan_MiiWriteReg( dev, phy, MII_AN_ADV, (ability << 5) | 1); TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x1000 ); TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, 0x1200 ); - /* Wait for 4 sec for autonegotiation * to complete. The max spec time is less than this * but the card need additional time to start AN. @@ -2234,18 +2328,17 @@ TLan_SetTimer( dev, (4*HZ), TLAN_TIMER_PHY_FINISH_AN ); return; } - if ( ( priv->aui ) && ( priv->phyNum != 0 ) ) { priv->phyNum = 0; data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN; TLan_DioWrite16( dev->base_addr, TLAN_NET_CONFIG, data ); - TLan_SetTimer( dev, (4*(HZ/1000)), TLAN_TIMER_PHY_PDOWN ); + TLan_SetTimer( dev, (40*HZ/1000), TLAN_TIMER_PHY_PDOWN ); return; - } else if ( priv->phyNum == 0 ) { + } else if ( priv->phyNum == 0 ) { TLan_MiiReadReg( dev, phy, TLAN_TLPHY_CTL, &tctl ); if ( priv->aui ) { tctl |= TLAN_TC_AUISEL; - } else { + } else { tctl &= ~TLAN_TC_AUISEL; control = 0; if ( priv->duplex == TLAN_DUPLEX_FULL ) { @@ -2306,14 +2399,14 @@ priv->phyNum = 0; data = TLAN_NET_CFG_1FRAG | TLAN_NET_CFG_1CHAN | TLAN_NET_CFG_PHY_EN; TLan_DioWrite16( dev->base_addr, TLAN_NET_CONFIG, data ); - TLan_SetTimer( dev, (400*(HZ/1000)), TLAN_TIMER_PHY_PDOWN ); + TLan_SetTimer( dev, (400*HZ/1000), TLAN_TIMER_PHY_PDOWN ); return; } if ( priv->phyNum == 0 ) { if ( ( priv->duplex == TLAN_DUPLEX_FULL ) || ( an_adv & an_lpa & 0x0040 ) ) { TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, MII_GC_AUTOENB | MII_GC_DUPLEX ); - printk( "TLAN: Starting internal PHY with DUPLEX\n" ); + printk( "TLAN: Starting internal PHY with FULL-DUPLEX\n" ); } else { TLan_MiiWriteReg( dev, phy, MII_GEN_CTL, MII_GC_AUTOENB ); printk( "TLAN: Starting internal PHY with HALF-DUPLEX\n" ); diff -ur --exclude-from=/root/torben linux-2.3.99-pre6-1/drivers/net/tlan.h linux/drivers/net/tlan.h --- linux-2.3.99-pre6-1/drivers/net/tlan.h Sat Feb 26 17:34:56 2000 +++ linux/drivers/net/tlan.h Thu Apr 13 11:41:47 2000 @@ -36,8 +36,8 @@ #define FALSE 0 #define TRUE 1 -#define TLAN_MIN_FRAME_SIZE 64 -#define TLAN_MAX_FRAME_SIZE 1600 +#define TLAN_MIN_FRAME_SIZE 60 +#define TLAN_MAX_FRAME_SIZE 1536 #define TLAN_NUM_RX_LISTS 4 #define TLAN_NUM_TX_LISTS 8