From: Richard B. <rb...@us...> - 2002-05-31 01:26:05
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv28981/drivers/net Modified Files: vaxsgec.c Log Message: Added code to reset csr0 after resetting csr6. Also populate csr0 interupt value correctly. Card is now tramsitting packets. Index: vaxsgec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- vaxsgec.c 30 May 2002 23:26:46 -0000 1.11 +++ vaxsgec.c 31 May 2002 01:26:01 -0000 1.12 @@ -150,6 +150,47 @@ } } +void reset_csr0(struct net_device *dev) +{ + int i; + unsigned long v; + volatile struct sgec_private *lp = (volatile struct sgec_private *)dev->priv; + volatile struct sgec_regs *regs = lp->regs; + +#ifdef VAX_SGEC_DEBUG + printk("writing csr0 interrupt as 0x%x\n",dev->irq); +#endif + /* + * IRQ setup + */ + v = SG_NICSR0_IPL14 | (dev->irq << 2) | SG_NICSR0_MBO; + i = 10; + do + { + if (i-- == 0) + { + printk ("Failing setting CSR0 (0x%08lx)!\n", + regs->sg_nicsr0); + /* further ignore error here XXX CP */ + } + writereg (& regs->sg_nicsr0, v); + } while (v != regs->sg_nicsr0); + if (i <= 0) + { + printk ("SGEC: CSR0 IRQ setup FAILED !\n"); + return -1; + } + + /* check for parity error and clear flags */ + if (regs->sg_nicsr5 & 0x7f) { + printk("reset_csr0 - csr5 value 0x%x\n",regs->sg_nicsr5); + writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); + } +#ifdef VAX_SGEC_DEBUG + printk("csr0 is now 0x%x\n",regs->sg_nicsr0); +#endif +} + static int reset_sgec (struct net_device *dev) { struct sgec_private *lp = (struct sgec_private *) dev->priv; @@ -189,41 +230,12 @@ return -1; } -#ifdef VAX_SGEC_DEBUG - printk("writing csr0 interrupt as 0x%x\n",dev->irq); -#endif - /* - * IRQ setup - */ - v = SG_NICSR0_IPL14 | dev->irq | SG_NICSR0_MBO; - i = 10; - do - { - if (i-- == 0) - { - printk ("Failing setting CSR0 (0x%08lx)!\n", - regs->sg_nicsr0); - /* further ignore error here XXX CP */ - } - writereg (& regs->sg_nicsr0, v); - } while (v != regs->sg_nicsr0); - if (i <= 0) - { - printk ("SGEC: CSR0 IRQ setup FAILED !\n"); - return -1; - } - - /* check for error and clear flags */ - if (regs->sg_nicsr5 & 0x7f) { - printk("init - csr5 value 0x%x\n",regs->sg_nicsr5); - writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); - } + reset_csr0(dev); writereg(®s->sg_nicsr3, virt_to_phys(& lp->rx_ring [0])); writereg(®s->sg_nicsr4, virt_to_phys(& lp->tx_ring [0])); #ifdef VAX_SGEC_DEBUG - printk ("csr0 interrupt is 0x%x\n",regs->sg_nicsr0 & SG_NICSR0_IV_MASK); printk ("%s: done well\n", __FUNCTION__); #endif @@ -248,6 +260,7 @@ printk("after csr6 stop receiving\n"); printk ("csr0 = 0x%x\n",lp->regs->sg_nicsr0); #endif + reset_csr0(dev); /* generate fix CSR6 part */ csr6 = SG_NICSR6_MBO | SG_NICSR6_IE | SG_NICSR6_BL_8 | SG_NICSR6_ST | SG_NICSR6_SR | SG_NICSR6_DC; @@ -977,35 +990,7 @@ } #endif /* VAX_SGEC_AUTOPROBE_IRQ */ -#ifdef VAX_SGEC_DEBUG - printk("writing csr0 interrupt as 0x%x\n",dev->irq); -#endif - /* - * IRQ setup - */ - v = SG_NICSR0_IPL14 | dev->irq | SG_NICSR0_MBO; - i = 10; - do - { - if (i-- == 0) - { - printk ("Failing setting CSR0 (0x%08lx)!\n", - regs->sg_nicsr0); - /* further ignore error here XXX CP */ - } - writereg (& regs->sg_nicsr0, v); - } while (v != regs->sg_nicsr0); - if (i <= 0) - { - printk ("SGEC: CSR0 IRQ setup FAILED !\n"); - return -1; - } - - /* check for error and clear flags */ - if (regs->sg_nicsr5 & 0x7f) { - printk("init - csr5 value 0x%x\n",regs->sg_nicsr5); - writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); - } + reset_csr0(dev); ether_setup(dev); |