Commit c6383562 authored by Jeff Garzik's avatar Jeff Garzik

Merge http://linux-isdn.bkbits.net/linux-2.5.net-auto_irq

into mandrakesoft.com:/home/jgarzik/repo/net-drivers-2.5
parents 043ae76b d9af4ef3
......@@ -1549,19 +1549,20 @@ sony535_init(void)
#endif
/* now ready to use interrupts, if available */
sony535_irq_used = tmp_irq;
#ifndef MODULE
/* This code is not in MODULEs by default, since the autoirq stuff might
* not be in the module-accessible symbol table.
*/
/* A negative sony535_irq_used will attempt an autoirq. */
if (sony535_irq_used < 0) {
autoirq_setup(0);
unsigned long irq_mask, delay;
irq_mask = probe_irq_on();
enable_interrupts();
outb(0, read_status_reg); /* does a reset? */
sony535_irq_used = autoirq_report(10);
delay = jiffies + HZ/10;
while (time_before(jiffies, delay)) ;
sony535_irq_used = probe_irq_off(irq_mask);
disable_interrupts();
}
#endif
if (sony535_irq_used > 0) {
if (request_irq(sony535_irq_used, cdu535_interrupt,
SA_INTERRUPT, CDU535_HANDLE, NULL)) {
......
......@@ -323,14 +323,18 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
if (dev->irq < 2)
{
autoirq_setup(2);
unsigned long irq_mask, delay;
irq_mask = probe_irq_on();
inb(RX_STATUS); /* Clear pending interrupts. */
inb(TX_STATUS);
outb(AX_LOOP + 1, AX_CMD);
outb(0x00, AX_CMD);
autoirq = autoirq_report(1);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
autoirq = probe_irq_off(irq_mask);
if (autoirq == 0)
{
......
......@@ -39,12 +39,6 @@ extern int ei_debug;
#define ei_debug 1
#endif
#ifndef HAVE_AUTOIRQ
/* From auto_irq.c */
extern void autoirq_setup(int waittime);
extern unsigned long autoirq_report(int waittime);
#endif
extern int ethdev_init(struct net_device *dev);
extern void NS8390_init(struct net_device *dev, int startp);
extern int ei_open(struct net_device *dev);
......
......@@ -221,16 +221,6 @@ subdir-y += ../acorn/net
obj-y += ../acorn/net/acorn-net.o
endif
#
# HIPPI adapters
#
ifneq ($(ARCH),s390)
ifneq ($(ARCH),s390x)
obj-y += auto_irq.o
endif
endif
include $(TOPDIR)/Rules.make
clean:
......
......@@ -1092,15 +1092,18 @@ int __init ltpc_probe(struct net_device *dev)
/* probe for the IRQ line */
if (irq < 2) {
autoirq_setup(2);
unsigned long irq_mask, delay;
irq_mask = probe_irq_on();
/* reset the interrupt line */
inb_p(io+7);
inb_p(io+7);
/* trigger an interrupt (I hope) */
inb_p(io+6);
autoirq = autoirq_report(1);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
autoirq = probe_irq_off(irq_mask);
if (autoirq == 0) {
printk("ltpc: probe at %#x failed to detect IRQ line.\n",
......
......@@ -682,7 +682,9 @@ depca_hw_init(struct net_device *dev, u_long ioaddr, int mca_slot)
if (dev->irq < 2) {
#ifndef MODULE
unsigned char irqnum;
autoirq_setup(0);
unsigned long irq_mask, delay;
irq_mask = probe_irq_on();
/* Assign the correct irq list */
switch (lp->adapter) {
......@@ -706,7 +708,10 @@ depca_hw_init(struct net_device *dev, u_long ioaddr, int mca_slot)
/* Trigger an initialization just for the interrupt. */
outw(INEA | INIT, DEPCA_DATA);
irqnum = autoirq_report(1);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
irqnum = probe_irq_off(irq_mask);
status = -ENXIO;
if (!irqnum) {
printk(" and failed to detect IRQ line.\n");
......
......@@ -896,12 +896,16 @@ static int eepro_grab_irq(struct net_device *dev)
eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */
if (request_irq (*irqp, NULL, SA_SHIRQ, "bogus", dev) != EBUSY) {
unsigned long irq_mask, delay;
/* Twinkle the interrupt, and check if it's seen */
autoirq_setup(0);
irq_mask = probe_irq_on();
eepro_diag(ioaddr); /* RESET the 82595 */
if (*irqp == autoirq_report(2)) /* It's a good IRQ line */
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
if (*irqp == probe_irq_off(irq_mask)) /* It's a good IRQ line */
break;
/* clear all interrupts */
......
......@@ -555,8 +555,10 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
if (dev->irq < 2) {
#ifndef MODULE
u_char irqnum;
unsigned long irq_mask, delay;
autoirq_setup(0);
irq_mask = probe_irq_on();
/*
** Trigger a TNE interrupt.
......@@ -567,7 +569,9 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
irqnum = irq[((icr & IRQ_SEL) >> 4)];
dev->irq = autoirq_report(1);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
dev->irq = probe_irq_off(irq_mask);
if ((dev->irq) && (irqnum == dev->irq)) {
printk(" and uses IRQ%d.\n", dev->irq);
} else {
......
......@@ -202,10 +202,10 @@ static int __init netcard_probe1(struct net_device *dev, int ioaddr)
if (dev->irq == -1)
; /* Do nothing: a user-level program will set it. */
else if (dev->irq < 2) { /* "Auto-IRQ" */
autoirq_setup(0);
unsigned long irq_mask = probe_irq_on();
/* Trigger an interrupt here. */
dev->irq = autoirq_report(0);
dev->irq = probe_irq_off(irq_mask);
if (net_debug >= 2)
printk(" autoirq is %d", dev->irq);
} else if (dev->irq == 2)
......
......@@ -545,15 +545,19 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
if (dev->irq >= 2)
printk(" assigned IRQ %d", dev->irq);
else if (lance_version != 0) { /* 7990 boards need DMA detection first. */
unsigned long irq_mask, delay;
/* To auto-IRQ we enable the initialization-done and DMA error
interrupts. For ISA boards we get a DMA error, but VLB and PCI
boards will work. */
autoirq_setup(0);
irq_mask = probe_irq_on();
/* Trigger an initialization just for the interrupt. */
outw(0x0041, ioaddr+LANCE_DATA);
dev->irq = autoirq_report(2);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
dev->irq = probe_irq_off(irq_mask);
if (dev->irq)
printk(", probed IRQ %d", dev->irq);
else {
......@@ -619,10 +623,14 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
if (lance_version == 0 && dev->irq == 0) {
/* We may auto-IRQ now that we have a DMA channel. */
/* Trigger an initialization just for the interrupt. */
autoirq_setup(0);
unsigned long irq_mask, delay;
irq_mask = probe_irq_on(0);
outw(0x0041, ioaddr+LANCE_DATA);
dev->irq = autoirq_report(4);
delay = jiffies + HZ/25;
while (time_before(jiffies, delay)) ;
dev->irq = probe_irq_off(irq_mask);
if (dev->irq == 0) {
printk(" Failed to detect the 7990 IRQ line.\n");
return -ENODEV;
......
......@@ -254,11 +254,15 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
if (dev->irq == 0xff)
;
else if (dev->irq < 2) {
unsigned long irq_mask, delay;
PRINTK2((KERN_DEBUG "%s: I/O #5 passed!\n", dev->name));
autoirq_setup(0);
irq_mask = probe_irq_on();
trigger_irq(ioaddr);
dev->irq = autoirq_report(2);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
dev->irq = probe_irq_off(irq_mask);
PRINTK2((KERN_DEBUG "%s: I/O #6 passed!\n", dev->name));
......
......@@ -491,10 +491,16 @@ static int __init ni52_probe1(struct net_device *dev,int ioaddr)
if(dev->irq < 2)
{
autoirq_setup(0);
unsigned long irq_mask, delay;
irq_mask = probe_irq_on();
ni_reset586();
ni_attn586();
if(!(dev->irq = autoirq_report(2)))
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
dev->irq = probe_irq_off(irq_mask);
if(!dev->irq)
{
printk("?autoirq, Failed to detect IRQ line!\n");
kfree(dev->priv);
......
......@@ -447,11 +447,15 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
if(dev->irq < 2)
{
unsigned long irq_mask, delay;
ni65_init_lance(p,dev->dev_addr,0,0);
autoirq_setup(0);
irq_mask = probe_irq_on();
writereg(CSR0_INIT|CSR0_INEA,CSR0); /* trigger interrupt */
if(!(dev->irq = autoirq_report(2)))
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
dev->irq = probe_irq_off(irq_mask);
if(!dev->irq)
{
printk("Failed to detect IRQ line!\n");
ni65_free_buffer(p);
......
......@@ -39,12 +39,6 @@ extern int ei_debug;
#define ei_debug 1
#endif
#ifndef HAVE_AUTOIRQ
/* From auto_irq.c */
extern void autoirq_setup(int waittime);
extern unsigned long autoirq_report(int waittime);
#endif
static int ethdev_init(struct net_device *dev);
static void NS8390_init(struct net_device *dev, int startp);
static int ei_open(struct net_device *dev);
......
......@@ -751,15 +751,15 @@ int __init smc_findirq( int ioaddr )
timeout--;
}
/* there is really nothing that I can do here if timeout fails,
as autoirq_report will return a 0 anyway, which is what I
as probe_irq_off will return a 0 anyway, which is what I
want in this case. Plus, the clean up is needed in both
cases. */
/* DELAY HERE!
On a fast machine, the status might change before the interrupt
is given to the processor. This means that the interrupt was
never detected, and autoirq_report fails to report anything.
This should fix autoirq_* problems.
never detected, and probe_irq_off fails to report anything.
This should fix probe_irq_* problems.
*/
SMC_DELAY();
SMC_DELAY();
......
......@@ -330,10 +330,14 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq )
outb( 0, ioaddr + CSR0 );
if( irq < 2 ) {
autoirq_setup( 5 );
unsigned long irq_mask, delay;
irq_mask = probe_irq_on();
outb( EN_INT | TR_REQ, ioaddr + CSR0 );
outb( PR_RES, ioaddr + CSR1 );
irq = autoirq_report( 5 );
delay = jiffies + HZ/20;
while (time_before(jiffies, delay)) ;
irq = probe_irq_off(irq_mask);
outb( 0, ioaddr + CSR0 );
if( !irq ) {
......
......@@ -235,18 +235,23 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
int reg4 = inb(ioaddr+4);
if (ancient || reg1 == 0xff) { /* Ack!! No way to read the IRQ! */
short nic_addr = ioaddr+WD_NIC_OFFSET;
unsigned long irq_mask, delay;
/* We have an old-style ethercard that doesn't report its IRQ
line. Do autoirq to find the IRQ line. Note that this IS NOT
a reliable way to trigger an interrupt. */
outb_p(E8390_NODMA + E8390_STOP, nic_addr);
outb(0x00, nic_addr+EN0_IMR); /* Disable all intrs. */
autoirq_setup(0);
irq_mask = probe_irq_on();
outb_p(0xff, nic_addr + EN0_IMR); /* Enable all interrupts. */
outb_p(0x00, nic_addr + EN0_RCNTLO);
outb_p(0x00, nic_addr + EN0_RCNTHI);
outb(E8390_RREAD+E8390_START, nic_addr); /* Trigger it... */
dev->irq = autoirq_report(2);
delay = jiffies + HZ/50;
while (time_before(jiffies, delay)) ;
dev->irq = probe_irq_off(irq_mask);
outb_p(0x00, nic_addr+EN0_IMR); /* Mask all intrs. again. */
if (ei_debug > 2)
......
......@@ -113,8 +113,4 @@ extern void __release_region(struct resource *, unsigned long, unsigned long);
#define get_ioport_list(buf) get_resource_list(&ioport_resource, buf, PAGE_SIZE)
#define get_mem_list(buf) get_resource_list(&iomem_resource, buf, PAGE_SIZE)
#define HAVE_AUTOIRQ
extern void autoirq_setup(int waittime);
extern int autoirq_report(int waittime);
#endif /* _LINUX_IOPORT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment