UDC_CTRL_REG = UDC_RESET_EP; 
UDC_CTRL_REG = udc->clr_halt; 
static int omap_ep_enable(struct usb_ep *_ep,		const struct usb_endpoint_descriptor *desc){	struct omap_ep	*ep = container_of(_ep, struct omap_ep, ep);	struct omap_udc	*udc;	unsigned long	flags;	u16		maxp;	/* catch various bogus parameters */	if (!_ep || !desc || ep->desc			|| desc->bDescriptorType != USB_DT_ENDPOINT			|| ep->bEndpointAddress != desc->bEndpointAddress			|| ep->maxpacket < le16_to_cpu						(desc->wMaxPacketSize)) {		DBG("%s, bad ep or descriptor\n", __FUNCTION__);		return -EINVAL;	}	maxp = le16_to_cpu (desc->wMaxPacketSize);	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK				&& maxp != ep->maxpacket)			|| desc->wMaxPacketSize > ep->maxpacket			|| !desc->wMaxPacketSize) {		DBG("%s, bad %s maxpacket\n", __FUNCTION__, _ep->name);		return -ERANGE;	}#ifdef	USE_ISO	if ((desc->bmAttributes == USB_ENDPOINT_XFER_ISOC				&& desc->bInterval != 1)) {		/* hardware wants period = 1; USB allows 2^(Interval-1) */		DBG("%s, unsupported ISO period %dms\n", _ep->name,				1 << (desc->bInterval - 1));		return -EDOM;	}#else	if (desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {		DBG("%s, ISO nyet\n", _ep->name);		return -EDOM;	}#endif	/* xfer types must match, except that interrupt ~= bulk */	if (ep->bmAttributes != desc->bmAttributes			&& ep->bmAttributes != USB_ENDPOINT_XFER_BULK			&& desc->bmAttributes != USB_ENDPOINT_XFER_INT) {		DBG("%s, %s type mismatch\n", __FUNCTION__, _ep->name);		return -EINVAL;	}	udc = ep->udc;	if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) {		DBG("%s, bogus device state\n", __FUNCTION__);		return -ESHUTDOWN;	}	spin_lock_irqsave(&udc->lock, flags);	ep->desc = desc;	ep->irqs = 0;	ep->stopped = 0;	ep->ep.maxpacket = maxp;	/* set endpoint to initial state */	ep->dma_channel = 0;	ep->has_dma = 0;	ep->lch = -1;	use_ep(ep, UDC_EP_SEL);	UDC_CTRL_REG = UDC_RESET_EP;	ep->ackwait = 0;	deselect_ep();	if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC)		list_add(&ep->iso, &udc->iso);	/* maybe assign a DMA channel to this endpoint */	if (use_dma && desc->bmAttributes == USB_ENDPOINT_XFER_BULK)		/* FIXME ISO can dma, but prefers first channel */		dma_channel_claim(ep, 0);	/* PIO OUT may RX packets */	if (desc->bmAttributes != USB_ENDPOINT_XFER_ISOC			&& !ep->has_dma			&& !(ep->bEndpointAddress & USB_DIR_IN)) {		UDC_CTRL_REG = UDC_SET_FIFO_EN;		ep->ackwait = 1 + ep->double_buf;	}	spin_unlock_irqrestore(&udc->lock, flags);	VDBG("%s enabled\n", _ep->name);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/65111084c63d7674dc37833e8eb59cfdaa4d0bda/omap_udc.c/clean/drivers/usb/gadget/omap_udc.c