u32			dmacount; 
__le32			dmacount; 
static void handle_stat1_irqs (struct net2280 *dev, u32 stat){	struct net2280_ep	*ep;	u32			tmp, num, mask, scratch;	/* after disconnect there's nothing else to do! */	tmp = (1 << VBUS_INTERRUPT) | (1 << ROOT_PORT_RESET_INTERRUPT);	mask = (1 << HIGH_SPEED) | (1 << FULL_SPEED);	/* VBUS disconnect is indicated by VBUS_PIN and VBUS_INTERRUPT set.	 * Root Port Reset is indicated by ROOT_PORT_RESET_INTERRRUPT set and	 * both HIGH_SPEED and FULL_SPEED clear (as ROOT_PORT_RESET_INTERRUPT 	 * only indicates a change in the reset state).	 */	if (stat & tmp) {		writel (tmp, &dev->regs->irqstat1);		if ((((stat & (1 << ROOT_PORT_RESET_INTERRUPT)) && 				((readl (&dev->usb->usbstat) & mask) == 0))				|| ((readl (&dev->usb->usbctl) & (1 << VBUS_PIN)) == 0) 			    ) && ( dev->gadget.speed != USB_SPEED_UNKNOWN)) {			DEBUG (dev, "disconnect %s\n",					dev->driver->driver.name);			stop_activity (dev, dev->driver);			ep0_start (dev);			return;		}		stat &= ~tmp;		/* vBUS can bounce ... one of many reasons to ignore the		 * notion of hotplug events on bus connect/disconnect!		 */		if (!stat)			return;	}	/* NOTE: chip stays in PCI D0 state for now, but it could	 * enter D1 to save more power	 */	tmp = (1 << SUSPEND_REQUEST_CHANGE_INTERRUPT);	if (stat & tmp) {		writel (tmp, &dev->regs->irqstat1);		if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) {			if (dev->driver->suspend)				dev->driver->suspend (&dev->gadget);			if (!enable_suspend)				stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT);		} else {			if (dev->driver->resume)				dev->driver->resume (&dev->gadget);			/* at high speed, note erratum 0133 */		}		stat &= ~tmp;	}	/* clear any other status/irqs */	if (stat)		writel (stat, &dev->regs->irqstat1);	/* some status we can just ignore */	stat &= ~((1 << CONTROL_STATUS_INTERRUPT)			| (1 << SUSPEND_REQUEST_INTERRUPT)			| (1 << RESUME_INTERRUPT)			| (1 << SOF_INTERRUPT));	if (!stat)		return;	// DEBUG (dev, "irqstat1 %08x\n", stat);	/* DMA status, for ep-{a,b,c,d} */	scratch = stat & DMA_INTERRUPTS;	stat &= ~DMA_INTERRUPTS;	scratch >>= 9;	for (num = 0; scratch; num++) {		struct net2280_dma_regs	__iomem *dma;		tmp = 1 << num;		if ((tmp & scratch) == 0)			continue;		scratch ^= tmp;		ep = &dev->ep [num + 1];		dma = ep->dma;		if (!dma)			continue;		/* clear ep's dma status */		tmp = readl (&dma->dmastat);		writel (tmp, &dma->dmastat);		/* chaining should stop on abort, short OUT from fifo,		 * or (stat0 codepath) short OUT transfer.		 */		if (!use_dma_chaining) {			if ((tmp & (1 << DMA_TRANSACTION_DONE_INTERRUPT))					== 0) {				DEBUG (ep->dev, "%s no xact done? %08x\n",					ep->ep.name, tmp);				continue;			}			stop_dma (ep->dma);		}		/* OUT transfers terminate when the data from the		 * host is in our memory.  Process whatever's done.		 * On this path, we know transfer's last packet wasn't		 * less than req->length. NAK_OUT_PACKETS may be set,		 * or the FIFO may already be holding new packets.		 *		 * IN transfers can linger in the FIFO for a very		 * long time ... we ignore that for now, accounting		 * precisely (like PIO does) needs per-packet irqs		 */		scan_dma_completions (ep);		/* disable dma on inactive queues; else maybe restart */		if (list_empty (&ep->queue)) {			if (use_dma_chaining)				stop_dma (ep->dma);		} else {			tmp = readl (&dma->dmactl);			if (!use_dma_chaining					|| (tmp & (1 << DMA_ENABLE)) == 0)				restart_dma (ep);			else if (ep->is_in && use_dma_chaining) {				struct net2280_request	*req;				u32			dmacount;				/* the descriptor at the head of the chain				 * may still have VALID_BIT clear; that's				 * used to trigger changing DMA_FIFO_VALIDATE				 * (affects automagic zlp writes).				 */				req = list_entry (ep->queue.next,						struct net2280_request, queue);				dmacount = req->td->dmacount;				dmacount &= __constant_cpu_to_le32 (						(1 << VALID_BIT)						| DMA_BYTE_COUNT_MASK);				if (dmacount && (dmacount & valid_bit) == 0)					restart_dma (ep);			}		}		ep->irqs++;	}	/* NOTE:  there are other PCI errors we might usefully notice.	 * if they appear very often, here's where to try recovering.	 */	if (stat & PCI_ERROR_INTERRUPTS) {		ERROR (dev, "pci dma error; stat %08x\n", stat);		stat &= ~PCI_ERROR_INTERRUPTS;		/* these are fatal errors, but "maybe" they won't		 * happen again ...		 */		stop_activity (dev, dev->driver);		ep0_start (dev);		stat = 0;	}	if (stat)		DEBUG (dev, "unhandled irqstat1 %08x\n", stat);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/320f34595c3cf37d180a087a935c050e4ac0e4d5/net2280.c/clean/drivers/usb/gadget/net2280.c