set_irq_type(dev->irq, IRQT_RISING); 
set_irq_type(dev->irq, SMC_IRQ_TRIGGER_TYPE); 
static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr){	struct smc_local *lp = netdev_priv(dev);	static int version_printed = 0;	int i, retval;	unsigned int val, revision_register;	const char *version_string;	DBG(2, "%s: %s\n", CARDNAME, __FUNCTION__);	/* First, see if the high byte is 0x33 */	val = SMC_CURRENT_BANK();	DBG(2, "%s: bank signature probe returned 0x%04x\n", CARDNAME, val);	if ((val & 0xFF00) != 0x3300) {		if ((val & 0xFF) == 0x33) {			printk(KERN_WARNING				"%s: Detected possible byte-swapped interface"				" at IOADDR %p\n", CARDNAME, ioaddr);		}		retval = -ENODEV;		goto err_out;	}	/*	 * The above MIGHT indicate a device, but I need to write to	 * further test this.	 */	SMC_SELECT_BANK(0);	val = SMC_CURRENT_BANK();	if ((val & 0xFF00) != 0x3300) {		retval = -ENODEV;		goto err_out;	}	/*	 * well, we've already written once, so hopefully another	 * time won't hurt.  This time, I need to switch the bank	 * register to bank 1, so I can access the base address	 * register	 */	SMC_SELECT_BANK(1);	val = SMC_GET_BASE();	val = ((val & 0x1F00) >> 3) << SMC_IO_SHIFT;	if (((unsigned int)ioaddr & (0x3e0 << SMC_IO_SHIFT)) != val) {		printk("%s: IOADDR %p doesn't match configuration (%x).\n",			CARDNAME, ioaddr, val);	}	/*	 * check if the revision register is something that I	 * recognize.  These might need to be added to later,	 * as future revisions could be added.	 */	SMC_SELECT_BANK(3);	revision_register = SMC_GET_REV();	DBG(2, "%s: revision = 0x%04x\n", CARDNAME, revision_register);	version_string = chip_ids[ (revision_register >> 4) & 0xF];	if (!version_string || (revision_register & 0xff00) != 0x3300) {		/* I don't recognize this chip, so... */		printk("%s: IO %p: Unrecognized revision register 0x%04x"			", Contact author.\n", CARDNAME,			ioaddr, revision_register);		retval = -ENODEV;		goto err_out;	}	/* At this point I'll assume that the chip is an SMC91x. */	if (version_printed++ == 0)		printk("%s", version);	/* fill in some of the fields */	dev->base_addr = (unsigned long)ioaddr;	lp->base = ioaddr;	lp->version = revision_register & 0xff;	spin_lock_init(&lp->lock);	/* Get the MAC address */	SMC_SELECT_BANK(1);	SMC_GET_MAC_ADDR(dev->dev_addr);	/* now, reset the chip, and put it into a known state */	smc_reset(dev);	/*	 * If dev->irq is 0, then the device has to be banged on to see	 * what the IRQ is. 	 *	 * This banging doesn't always detect the IRQ, for unknown reasons.	 * a workaround is to reset the chip and try again.	 *	 * Interestingly, the DOS packet driver *SETS* the IRQ on the card to	 * be what is requested on the command line.   I don't do that, mostly	 * because the card that I have uses a non-standard method of accessing	 * the IRQs, and because this _should_ work in most configurations.	 *	 * Specifying an IRQ is done with the assumption that the user knows	 * what (s)he is doing.  No checking is done!!!!	 */	if (dev->irq < 1) {		int trials;		trials = 3;		while (trials--) {			dev->irq = smc_findirq(ioaddr);			if (dev->irq)				break;			/* kick the card and try again */			smc_reset(dev);		}	}	if (dev->irq == 0) {		printk("%s: Couldn't autodetect your IRQ. Use irq=xx.\n",			dev->name);		retval = -ENODEV;		goto err_out;	}	dev->irq = irq_canonicalize(dev->irq);	/* Fill in the fields of the device structure with ethernet values. */	ether_setup(dev);	dev->open = smc_open;	dev->stop = smc_close;	dev->hard_start_xmit = smc_hard_start_xmit;	dev->tx_timeout = smc_timeout;	dev->watchdog_timeo = msecs_to_jiffies(watchdog);	dev->get_stats = smc_query_statistics;	dev->set_multicast_list = smc_set_multicast_list;	dev->ethtool_ops = &smc_ethtool_ops;#ifdef CONFIG_NET_POLL_CONTROLLER	dev->poll_controller = smc_poll_controller;#endif	tasklet_init(&lp->tx_task, smc_hardware_send_pkt, (unsigned long)dev);	INIT_WORK(&lp->phy_configure, smc_phy_configure, dev);	lp->mii.phy_id_mask = 0x1f;	lp->mii.reg_num_mask = 0x1f;	lp->mii.force_media = 0;	lp->mii.full_duplex = 0;	lp->mii.dev = dev;	lp->mii.mdio_read = smc_phy_read;	lp->mii.mdio_write = smc_phy_write;	/*	 * Locate the phy, if any.	 */	if (lp->version >= (CHIP_91100 << 4))		smc_phy_detect(dev);	/* Set default parameters */	lp->msg_enable = NETIF_MSG_LINK;	lp->ctl_rfduplx = 0;	lp->ctl_rspeed = 10;	if (lp->version >= (CHIP_91100 << 4)) {		lp->ctl_rfduplx = 1;		lp->ctl_rspeed = 100;	}	/* Grab the IRQ */      	retval = request_irq(dev->irq, &smc_interrupt, 0, dev->name, dev);      	if (retval)      		goto err_out;	set_irq_type(dev->irq, IRQT_RISING);#ifdef SMC_USE_PXA_DMA	{		int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW,					  smc_pxa_dma_irq, NULL);		if (dma >= 0)			dev->dma = dma;	}#endif	retval = register_netdev(dev);	if (retval == 0) {		/* now, print out the card info, in a short format.. */		printk("%s: %s (rev %d) at %p IRQ %d",			dev->name, version_string, revision_register & 0x0f,			lp->base, dev->irq);		if (dev->dma != (unsigned char)-1)			printk(" DMA %d", dev->dma);		printk("%s%s\n", nowait ? " [nowait]" : "",			THROTTLE_TX_PKTS ? " [throttle_tx]" : "");		if (!is_valid_ether_addr(dev->dev_addr)) {			printk("%s: Invalid ethernet MAC address.  Please "			       "set using ifconfig\n", dev->name);		} else {			/* Print the Ethernet address */			printk("%s: Ethernet addr: ", dev->name);			for (i = 0; i < 5; i++)				printk("%2.2x:", dev->dev_addr[i]);			printk("%2.2x\n", dev->dev_addr[5]);		}		if (lp->phy_type == 0) {			PRINTK("%s: No PHY found\n", dev->name);		} else if ((lp->phy_type & 0xfffffff0) == 0x0016f840) {			PRINTK("%s: PHY LAN83C183 (LAN91C111 Internal)\n", dev->name);		} else if ((lp->phy_type & 0xfffffff0) == 0x02821c50) {			PRINTK("%s: PHY LAN83C180\n", dev->name);		}	}err_out:#ifdef SMC_USE_PXA_DMA	if (retval && dev->dma != (unsigned char)-1)		pxa_free_dma(dev->dma);#endif	return retval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/5f13e7ec5c1d98f4a63a3a79e66b2b121051f5ac/smc91x.c/buggy/drivers/net/smc91x.c