コード例 #1
0
static void eth_reset_config(struct eth_dev *dev)
{
	struct usb_request	*req;
	unsigned long  flags;

	DEBUG(dev, "%s\n", __func__);

	if (!dev)
		return;
	if (!dev->net)
		return;

	if (dev->configured == 0)
		return;
	netif_stop_queue(dev->net);
	netif_carrier_off(dev->net);

	
	if (dev->in_ep) {
		usb_ept_enable(dev->in_ep, 0);
		spin_lock_irqsave(&dev->req_lock, flags);
		while (likely(!list_empty(&dev->tx_reqs))) {
			req = container_of(dev->tx_reqs.next,
						struct usb_request, list);
			list_del(&req->list);
			spin_unlock_irqrestore(&dev->req_lock, flags);
			usb_ept_free_req(dev->in_ep, req);
			spin_lock_irqsave(&dev->req_lock, flags);
		}
		spin_unlock_irqrestore(&dev->req_lock, flags);
	}
コード例 #2
0
static int msm72k_disable(struct usb_ep *_ep)
{
	struct msm_endpoint *ept = to_msm_endpoint(_ep);

	usb_ept_enable(ept, 0, 0);
	return 0;
}
コード例 #3
0
static int
msm72k_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
{
	struct msm_endpoint *ept = to_msm_endpoint(_ep);
	unsigned char ep_type =
			desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;

	_ep->maxpacket = le16_to_cpu(desc->wMaxPacketSize);
	usb_ept_enable(ept, 1, ep_type);
	return 0;
}
コード例 #4
0
static void diag_unbind(void *context)
{

	struct diag_context *ctxt = context;

	if (!ctxt)
		return;
	if (!ctxt->bound)
		return;
	if (ctxt->epin) {
		usb_ept_fifo_flush(ctxt->epin);
		usb_ept_enable(ctxt->epin, 0);
		usb_free_endpoint(ctxt->epin);
		}
	if (ctxt->epout) {
		usb_ept_fifo_flush(ctxt->epout);
		usb_ept_enable(ctxt->epout, 0);
		usb_free_endpoint(ctxt->epout);
		}
	ctxt->bound = 0;
}
コード例 #5
0
static int set_ether_config(struct eth_dev *dev, gfp_t gfp_flags)
{
	int result = 0;

	if (dev->status_ep)
		usb_ept_enable(dev->status_ep, 1);

	result = alloc_requests(dev, qlen , gfp_flags);
	if (result == 0)
		DEBUG(dev, "qlen %d\n", qlen);

	
	return result;
}
コード例 #6
0
static void diag_configure(int configured, void *_ctxt)

{
	struct diag_context *ctxt = _ctxt;

	if (!ctxt)
		return;
	if (configured) {
		if (usb_msm_get_speed() == USB_SPEED_HIGH) {
			usb_configure_endpoint(ctxt->epin, &hs_bulk_in_desc);
			usb_configure_endpoint(ctxt->epout, &hs_bulk_out_desc);
		} else {
			usb_configure_endpoint(ctxt->epin, &fs_bulk_in_desc);
			usb_configure_endpoint(ctxt->epout, &fs_bulk_out_desc);
		}
		usb_ept_enable(ctxt->epin,  1);
		usb_ept_enable(ctxt->epout, 1);
		ctxt->configured = 1;
		queue_work(_context.diag_wq, &(_context.usb_config_work));
	} else {
		/* all pending requests will be canceled */
		ctxt->configured = 0;
		if (ctxt->epin) {
			usb_ept_fifo_flush(ctxt->epin);
			usb_ept_enable(ctxt->epin, 0);
		}
		if (ctxt->epout) {
			usb_ept_fifo_flush(ctxt->epout);
			usb_ept_enable(ctxt->epout, 0);
		}
		if ((ctxt->operations) &&
			(ctxt->operations->diag_disconnect))
				ctxt->operations->diag_disconnect();
	}

}