/* EMIFF */ omap_set_dma_dest_burst_mode(ep->lch, OMAP_DMA_DATA_BURST_4); omap_set_dma_dest_data_pack(ep->lch, 1); 
static void dma_channel_claim(struct omap_ep *ep, unsigned channel){	u16	reg;	int	status, restart, is_in;	is_in = ep->bEndpointAddress & USB_DIR_IN;	if (is_in)		reg = UDC_TXDMA_CFG_REG;	else		reg = UDC_RXDMA_CFG_REG;	reg |= 1 << 12;		/* "pulse" activated */	ep->dma_channel = 0;	ep->lch = -1;	if (channel == 0 || channel > 3) {		if ((reg & 0x0f00) == 0)			channel = 3;		else if ((reg & 0x00f0) == 0)			channel = 2;		else if ((reg & 0x000f) == 0)	/* preferred for ISO */			channel = 1;		else {			status = -EMLINK;			goto just_restart;		}	}	reg |= (0x0f & ep->bEndpointAddress) << (4 * (channel - 1));	ep->dma_channel = channel;	if (is_in) {		status = omap_request_dma(OMAP_DMA_USB_W2FC_TX0 - 1 + channel,			ep->ep.name, dma_error, ep, &ep->lch);		if (status == 0) {			UDC_TXDMA_CFG_REG = reg;			omap_set_dma_dest_params(ep->lch,				OMAP_DMA_PORT_TIPB,				OMAP_DMA_AMODE_CONSTANT,				(unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG));		}	} else {		status = omap_request_dma(OMAP_DMA_USB_W2FC_RX0 - 1 + channel,			ep->ep.name, dma_error, ep, &ep->lch);		if (status == 0) {			UDC_RXDMA_CFG_REG = reg;			omap_set_dma_src_params(ep->lch,				OMAP_DMA_PORT_TIPB,				OMAP_DMA_AMODE_CONSTANT,				(unsigned long) io_v2p((u32)&UDC_DATA_DMA_REG));		}	}	if (status)		ep->dma_channel = 0;	else {		ep->has_dma = 1;		omap_disable_dma_irq(ep->lch, OMAP_DMA_BLOCK_IRQ);		/* channel type P: hw synch (fifo) */		if (!cpu_is_omap15xx())			omap_writew(2, OMAP_DMA_LCH_CTRL(ep->lch));	}just_restart:	/* restart any queue, even if the claim failed  */	restart = !ep->stopped && !list_empty(&ep->queue);	if (status)		DBG("%s no dma channel: %d%s\n", ep->ep.name, status,			restart ? " (restart)" : "");	else		DBG("%s claimed %cxdma%d lch %d%s\n", ep->ep.name,			is_in ? 't' : 'r',			ep->dma_channel - 1, ep->lch,			restart ? " (restart)" : "");	if (restart) {		struct omap_req	*req;		req = container_of(ep->queue.next, struct omap_req, queue);		if (ep->has_dma)			(is_in ? next_in_dma : next_out_dma)(ep, req);		else {			use_ep(ep, UDC_EP_SEL);			(is_in ? write_fifo : read_fifo)(ep, req);			deselect_ep();			if (!is_in) {				UDC_CTRL_REG = UDC_SET_FIFO_EN;				ep->ackwait = 1 + ep->double_buf;			}			/* IN: 6 wait states before it'll tx */		}	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/65111084c63d7674dc37833e8eb59cfdaa4d0bda/omap_udc.c/clean/drivers/usb/gadget/omap_udc.c