Lines Matching refs:ecm
295 static void ecm_do_notify(struct f_ecm *ecm)
297 struct usb_request *req = ecm->notify_req;
299 struct usb_composite_dev *cdev = ecm->port.func.config->cdev;
308 switch (ecm->notify_state) {
314 if (ecm->is_open)
322 ecm->is_open ? "true" : "false");
323 ecm->notify_state = ECM_NOTIFY_SPEED;
338 ecm->notify_state = ECM_NOTIFY_NONE;
342 event->wIndex = cpu_to_le16(ecm->ctrl_id);
344 ecm->notify_req = NULL;
345 status = usb_ep_queue(ecm->notify, req, GFP_ATOMIC);
347 ecm->notify_req = req;
352 static void ecm_notify(struct f_ecm *ecm)
359 ecm->notify_state = ECM_NOTIFY_CONNECT;
360 ecm_do_notify(ecm);
365 struct f_ecm *ecm = req->context;
366 struct usb_composite_dev *cdev = ecm->port.func.config->cdev;
375 ecm->notify_state = ECM_NOTIFY_NONE;
382 ecm->notify_req = req;
383 ecm_do_notify(ecm);
388 struct f_ecm *ecm = func_to_ecm(f);
405 if (w_length != 0 || w_index != ecm->ctrl_id)
412 ecm->port.cdc_filter = w_value;
434 DBG(cdev, "ecm req%02x.%02x v%04x i%04x l%d\n",
441 ERROR(cdev, "ecm req %02x.%02x response err %d\n",
453 struct f_ecm *ecm = func_to_ecm(f);
457 if (intf == ecm->ctrl_id) {
461 if (ecm->notify->driver_data) {
462 VDBG(cdev, "reset ecm control %d\n", intf);
463 usb_ep_disable(ecm->notify);
465 VDBG(cdev, "init ecm ctrl %d\n", intf);
466 ecm->notify_desc = ep_choose(cdev->gadget,
467 ecm->hs.notify,
468 ecm->fs.notify);
470 usb_ep_enable(ecm->notify, ecm->notify_desc);
471 ecm->notify->driver_data = ecm;
474 } else if (intf == ecm->data_id) {
478 if (ecm->port.in_ep->driver_data) {
479 DBG(cdev, "reset ecm\n");
480 gether_disconnect(&ecm->port);
483 if (!ecm->port.in) {
484 DBG(cdev, "init ecm\n");
485 ecm->port.in = ep_choose(cdev->gadget,
486 ecm->hs.in, ecm->fs.in);
487 ecm->port.out = ep_choose(cdev->gadget,
488 ecm->hs.out, ecm->fs.out);
500 ecm->port.is_zlp_ok = !(gadget_is_musbhdrc(cdev->gadget)
502 ecm->port.cdc_filter = DEFAULT_FILTER;
503 DBG(cdev, "activate ecm\n");
504 net = gether_connect(&ecm->port);
515 ecm_notify(ecm);
529 struct f_ecm *ecm = func_to_ecm(f);
531 if (intf == ecm->ctrl_id)
533 return ecm->port.in_ep->driver_data ? 1 : 0;
538 struct f_ecm *ecm = func_to_ecm(f);
541 DBG(cdev, "ecm deactivated\n");
543 if (ecm->port.in_ep->driver_data)
544 gether_disconnect(&ecm->port);
546 if (ecm->notify->driver_data) {
547 usb_ep_disable(ecm->notify);
548 ecm->notify->driver_data = NULL;
549 ecm->notify_desc = NULL;
575 struct f_ecm *ecm = func_to_ecm(&geth->func);
577 DBG(ecm->port.func.config->cdev, "%s\n", __func__);
579 ecm->is_open = true;
580 ecm_notify(ecm);
585 struct f_ecm *ecm = func_to_ecm(&geth->func);
587 DBG(ecm->port.func.config->cdev, "%s\n", __func__);
589 ecm->is_open = false;
590 ecm_notify(ecm);
601 struct f_ecm *ecm = func_to_ecm(f);
609 ecm->ctrl_id = status;
617 ecm->data_id = status;
629 ecm->port.in_ep = ep;
635 ecm->port.out_ep = ep;
645 ecm->notify = ep;
651 ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
652 if (!ecm->notify_req)
654 ecm->notify_req->buf = kmalloc(ECM_STATUS_BYTECOUNT, GFP_KERNEL);
655 if (!ecm->notify_req->buf)
657 ecm->notify_req->context = ecm;
658 ecm->notify_req->complete = ecm_notify_complete;
665 ecm->fs.in = usb_find_endpoint(ecm_fs_function,
667 ecm->fs.out = usb_find_endpoint(ecm_fs_function,
669 ecm->fs.notify = usb_find_endpoint(ecm_fs_function,
689 ecm->hs.in = usb_find_endpoint(ecm_hs_function,
691 ecm->hs.out = usb_find_endpoint(ecm_hs_function,
693 ecm->hs.notify = usb_find_endpoint(ecm_hs_function,
702 ecm->port.open = ecm_open;
703 ecm->port.close = ecm_close;
707 ecm->port.in_ep->name, ecm->port.out_ep->name,
708 ecm->notify->name);
715 if (ecm->notify_req) {
716 kfree(ecm->notify_req->buf);
717 usb_ep_free_request(ecm->notify, ecm->notify_req);
721 if (ecm->notify)
722 ecm->notify->driver_data = NULL;
723 if (ecm->port.out)
724 ecm->port.out_ep->driver_data = NULL;
725 if (ecm->port.in)
726 ecm->port.in_ep->driver_data = NULL;
736 struct f_ecm *ecm = func_to_ecm(f);
738 DBG(c->cdev, "ecm unbind\n");
744 kfree(ecm->notify_req->buf);
745 usb_ep_free_request(ecm->notify, ecm->notify_req);
748 kfree(ecm);
766 struct f_ecm *ecm;
798 ecm = kzalloc(sizeof *ecm, GFP_KERNEL);
799 if (!ecm)
803 snprintf(ecm->ethaddr, sizeof ecm->ethaddr,
807 ecm_string_defs[1].s = ecm->ethaddr;
809 ecm->port.cdc_filter = DEFAULT_FILTER;
811 ecm->port.func.name = "cdc_ethernet";
812 ecm->port.func.strings = ecm_strings;
814 ecm->port.func.bind = ecm_bind;
815 ecm->port.func.unbind = ecm_unbind;
816 ecm->port.func.set_alt = ecm_set_alt;
817 ecm->port.func.get_alt = ecm_get_alt;
818 ecm->port.func.setup = ecm_setup;
819 ecm->port.func.disable = ecm_disable;
821 status = usb_add_function(c, &ecm->port.func);
824 kfree(ecm);