From: ? <uns...@us...> - 2002-05-23 19:12:14
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv594 Modified Files: vaxsgec.c Log Message: Actually tell the SGEC where the buffers are. Also changed the interrupt detection a bit. It's hardcoded to 0x80 for now. It's not quite at the "sending correct packets" point but at least now we have the SGEC sending us interrupts. Index: vaxsgec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- vaxsgec.c 23 May 2002 17:20:08 -0000 1.3 +++ vaxsgec.c 23 May 2002 19:12:08 -0000 1.4 @@ -61,6 +61,8 @@ { volatile struct sgec_regs *regs = lp->regs; + writereg(®s->sg_nicsr3, virt_to_phys(lp->rx_ring)); + writereg(®s->sg_nicsr4, virt_to_phys(lp->tx_ring)); writecsr6(regs, SG_NICSR6_MBO|SG_NICSR6_IE|SG_NICSR6_BL_8|SG_NICSR6_ST|SG_NICSR6_SR|SG_NICSR6_DC); } @@ -97,28 +99,6 @@ memcpy(ib, dev->dev_addr, 6); #endif - /* Setup the initialization block */ - - /* Setup rx descriptor pointer */ - - /* Calculate the physical address of the first receive descriptor */ - leptr = virt_to_phys(lp->rx_ring); - lp->rx_len = (RX_BUFF_SIZE << 13) | (leptr >> 16); - lp->rx_ptr = leptr; - -#ifdef VAX_SGEC_DEBUG - printk("RX ptr: %8.8lx(%p)\n", leptr, lp->rx_ring); -#endif - /* Setup tx descriptor pointer */ - - /* Calculate the physical address of the first transmit descriptor */ - leptr = virt_to_phys(lp->tx_ring); - lp->tx_len = (TX_BUFF_SIZE << 13) | (leptr >> 16); - lp->tx_ptr = leptr; - -#ifdef VAX_SGEC_DEBUG - printk("TX ptr: %8.8lx(%p)\nTX rings:\n", leptr, lp->tx_ring); -#endif /* Setup the Tx ring entries */ for (i = 0; i < TX_RING_SIZE; i++) { leptr = virt_to_phys(lp->card_mem->tx_buf[i]) & 0xffffff; @@ -153,15 +133,15 @@ { volatile struct sgec_regs *regs = lp->regs; int i; -#if 0 - int reg; + int oldvect; + +#ifdef VAX_SGEC_DEBUG + printk("init_restart_sgec\n", i); #endif udelay(100); -#if 0 - reg = regs->sg_nicsr6; -#endif + oldvect = regs->sg_nicsr6; writecsr6(regs, SG_NICSR6_RE); /* reset card */ /* Wait for the sgec to complete initialization */ @@ -380,15 +360,16 @@ struct net_device *last_dev = 0; -static void make_setup_frame(void) +static void make_setup_frame(struct net_device *dev) { -#if 0 - /* create a setup frame and load it into the queue */ - memset(lp->sgec_mem->setup_frame,0xff,sizeof(lp->sgec_mem->setup_frame)); - memcpy(lp->sgec_mem->setup_frame,dev->dev_addr,6); - lp->sgec_mem->rxbuf[0] = NULL; - lp->sgec_mem->rxbuf + struct sgec_private *lp = (struct sgec_private *) dev->priv; + + memset((void *)lp->card_mem->setup_frame,0xff,sizeof(lp->card_mem->setup_frame)); + memcpy((void *)lp->card_mem->setup_frame,dev->dev_addr,6); + /* we should load the rest of the frame with multicast addresses */ + +#if 0 entry = lp->tx_new & TX_RING_MOD_MASK; ib->tx_ring[entry].flags1 = len; cp_to_buf((char *) lp->sgec_mem->tx_buf[entry], skb->data, skblen); @@ -407,8 +388,6 @@ tp->tx_ring[0].status = cpu_to_le32(DescOwned); tp->cur_tx++; - outl(tp->rx_ring_dma, ioaddr + CSR3); - outl(tp->tx_ring_dma, ioaddr + CSR4); #endif } @@ -445,13 +424,14 @@ lp->filter[3] = 0; sgec_init_ring(dev); + /*load_csrs(lp);*/ + make_setup_frame(dev); - load_csrs(lp); - - make_setup_frame(); /* put packet in queue */ + netif_start_queue(dev); + load_csrs(lp); status = init_restart_sgec(lp); /* @@ -717,8 +697,6 @@ return 0; } -static volatile void *base_addr=NULL; - static int __init vax_sgec_init(struct net_device *dev) { static unsigned version_printed = 0; @@ -761,21 +739,27 @@ /* Shouldn't we free dev->priv here if dev was non-NULL on entry? */ return -ENOMEM; } - dev->mem_end = dev->mem_start + 65536; + lp->card_mem = (volatile struct sgec_shared_mem *)(dev->mem_start); - base_addr=ioremap(sgec_phys_addr, 0x8); - if(base_addr == 0) + regs = (struct sgec_regs *) ioremap(sgec_phys_addr, 0x8); + dev->base_addr = (unsigned long) regs; + if(dev->base_addr == 0) printk("vaxsgec.c: memory remap failed\n"); - dev->base_addr=(unsigned long)base_addr; - - lp->card_mem = (volatile struct sgec_shared_mem *)(dev->mem_start); - - /* need something meaningful in here */ - dev->irq = 0; + lp->regs = regs; + lp->name = sgecstr; + lp->dev = dev; - regs = (struct sgec_regs *) base_addr; + /* Fill the dev fields */ + dev->open = &sgec_open; + dev->stop = &sgec_close; + dev->hard_start_xmit = &sgec_start_xmit; + dev->tx_timeout = &sgec_tx_timeout; + dev->watchdog_timeo = 5*HZ; + dev->get_stats = &sgec_get_stats; + dev->set_multicast_list = &sgec_set_multicast; + dev->dma = 0; if(read_esar(dev->dev_addr) != 0) printk("vaxsgec: read_esar failed\n"); @@ -783,20 +767,31 @@ dev->dev_addr[0],dev->dev_addr[1],dev->dev_addr[2], dev->dev_addr[3],dev->dev_addr[4],dev->dev_addr[5]); + sgec_stop(regs); + +#ifndef VAX_SGEC_AUTOPROBE_IRQ + dev->irq=SGECVEC; + printk("Using hardcoded SGEC interrupt vector %d\n", dev->irq); +#endif + #ifdef VAX_SGEC_AUTOPROBE_IRQ -#ifndef CONFIG_VAX_4000HC printk("Autoprobing SGEC interrupt vector..."); autoirq_setup(0); #ifdef CONFIG_VSBUS vsbus_probe_irq_on(); #endif /* CONFIG_VSBUS */ +#endif /* VAX_SGEC_AUTOPROBE_IRQ */ - sgec_stop(regs); - writereg(®s->sg_nicsr6, SG_NICSR6_RE|SG_NICSR6_IE); - writereg(®s->sg_nicsr1,1); /* uh. well this ought to cause an interrupt, right? */ +#if 0 + sgec_init_ring(dev); + load_csrs(lp); + make_setup_frame(dev); + kick_sgec(regs); udelay(1000); +#endif +#ifdef VAX_SGEC_AUTOPROBE_IRQ #ifdef CONFIG_VSBUS lp->vsbus_int=vsbus_probe_irq_report(); #endif /* CONFIG_VSBUS */ @@ -805,37 +800,15 @@ #ifdef CONFIG_VSBUS vsbus_clear_int(lp->vsbus_int); #endif /* CONFIG_VSBUS */ -#else /* CONFIG_VAX_4000HC */ - dev->irq=SGECVEC; - lp->vsbus_int=1; -#endif /* CONFIG_VAX_4000HC */ - if (dev->irq) - printk(" probed IRQ %d, vsbus %d\n", dev->irq, lp->vsbus_int); - else - { - dev->irq=SGECVEC; - printk(" failed to detect IRQ line - assuming 0x%x.\n", dev->irq); - } - -#else /* VAX_SGEC_AUTOPROBE_IRQ */ - dev->irq=SGECVEC; - printk("Using SGEC interrupt vector %d\n", dev->irq); + if (dev->irq) { + printk(" probed IRQ %d, vsbus %d\n", dev->irq, lp->vsbus_int); + } else { + dev->irq=SGECVEC; + dev->irq=0x80; + printk(" failed to detect IRQ line - assuming 0x%x.\n", dev->irq); + } #endif /* VAX_SGEC_AUTOPROBE_IRQ */ - - /* Fill the dev fields */ - dev->open = &sgec_open; - dev->stop = &sgec_close; - dev->hard_start_xmit = &sgec_start_xmit; - dev->tx_timeout = &sgec_tx_timeout; - dev->watchdog_timeo = 5*HZ; - dev->get_stats = &sgec_get_stats; - dev->set_multicast_list = &sgec_set_multicast; - dev->dma = 0; - - lp->regs = regs; - lp->name = sgecstr; - lp->dev = dev; ether_setup(dev); |