ecm
static phys_addr_t lbc_br_to_phys(const void *ecm, unsigned int count, u32 br)
const struct fsl_law *law = ecm + 0xc08;
void *ecm = NULL;
ecm = of_iomap(law_node, 0);
if (!ecm) {
cs0_addr = lbc_br_to_phys(ecm, num_laws, br0);
cs1_addr = lbc_br_to_phys(ecm, num_laws, br1);
if (ecm)
iounmap(ecm);
int ecm;
void ecm(struct s_smc *smc, int event);
ecm(smc,(int)ev->event) ;
ecm(smc,0) ; /* ECM state machine */
static void ecm_do_notify(struct f_ecm *ecm)
struct usb_request *req = ecm->notify_req;
struct usb_composite_dev *cdev = ecm->port.func.config->cdev;
if (atomic_read(&ecm->notify_count))
switch (ecm->notify_state) {
if (ecm->is_open)
DBG(cdev, "notify connect %s\n", str_true_false(ecm->is_open));
ecm->notify_state = ECM_NOTIFY_SPEED;
ecm->notify_state = ECM_NOTIFY_NONE;
event->wIndex = cpu_to_le16(ecm->ctrl_id);
atomic_inc(&ecm->notify_count);
status = usb_ep_queue(ecm->notify, req, GFP_ATOMIC);
atomic_dec(&ecm->notify_count);
static void ecm_notify(struct f_ecm *ecm)
ecm->notify_state = ECM_NOTIFY_CONNECT;
ecm_do_notify(ecm);
struct f_ecm *ecm = req->context;
struct usb_composite_dev *cdev = ecm->port.func.config->cdev;
atomic_dec(&ecm->notify_count);
atomic_set(&ecm->notify_count, 0);
ecm->notify_state = ECM_NOTIFY_NONE;
atomic_dec(&ecm->notify_count);
ecm_do_notify(ecm);
struct f_ecm *ecm = func_to_ecm(f);
if (w_length != 0 || w_index != ecm->ctrl_id)
ecm->port.cdc_filter = w_value;
struct f_ecm *ecm = func_to_ecm(f);
if (intf == ecm->ctrl_id) {
usb_ep_disable(ecm->notify);
if (!(ecm->notify->desc)) {
if (config_ep_by_speed(cdev->gadget, f, ecm->notify))
usb_ep_enable(ecm->notify);
} else if (intf == ecm->data_id) {
if (ecm->port.in_ep->enabled) {
gether_disconnect(&ecm->port);
if (!ecm->port.in_ep->desc ||
!ecm->port.out_ep->desc) {
ecm->port.in_ep) ||
ecm->port.out_ep)) {
ecm->port.in_ep->desc = NULL;
ecm->port.out_ep->desc = NULL;
ecm->port.is_zlp_ok =
ecm->port.cdc_filter = DEFAULT_FILTER;
net = gether_connect(&ecm->port);
ecm_notify(ecm);
struct f_ecm *ecm = func_to_ecm(f);
if (intf == ecm->ctrl_id)
return ecm->port.in_ep->enabled ? 1 : 0;
struct f_ecm *ecm = func_to_ecm(f);
if (ecm->port.in_ep->enabled) {
gether_disconnect(&ecm->port);
ecm->port.in_ep->desc = NULL;
ecm->port.out_ep->desc = NULL;
usb_ep_disable(ecm->notify);
ecm->notify->desc = NULL;
struct f_ecm *ecm = func_to_ecm(&geth->func);
DBG(ecm->port.func.config->cdev, "%s\n", __func__);
ecm->is_open = true;
ecm_notify(ecm);
struct f_ecm *ecm = func_to_ecm(&geth->func);
DBG(ecm->port.func.config->cdev, "%s\n", __func__);
ecm->is_open = false;
ecm_notify(ecm);
struct f_ecm *ecm = func_to_ecm(f);
ecm_string_defs[1].s = ecm->ethaddr;
ecm->ctrl_id = status;
ecm->data_id = status;
ecm->port.in_ep = ep;
ecm->port.out_ep = ep;
ecm->notify = ep;
request->context = ecm;
ecm->port.open = ecm_open;
ecm->port.close = ecm_close;
ecm->notify_req = no_free_ptr(request);
ecm->port.in_ep->name, ecm->port.out_ep->name,
ecm->notify->name);
USB_ETHERNET_CONFIGFS_ITEM(ecm);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_DEV_ADDR(ecm);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_HOST_ADDR(ecm);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(ecm);
USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(ecm);
struct f_ecm *ecm = func_to_ecm(f);
struct usb_composite_dev *cdev = ecm->port.func.config->cdev;
gether_suspend(&ecm->port);
struct f_ecm *ecm = func_to_ecm(f);
struct usb_composite_dev *cdev = ecm->port.func.config->cdev;
gether_resume(&ecm->port);
struct f_ecm *ecm;
ecm = func_to_ecm(f);
kfree(ecm);
struct f_ecm *ecm = func_to_ecm(f);
if (atomic_read(&ecm->notify_count)) {
usb_ep_dequeue(ecm->notify, ecm->notify_req);
atomic_set(&ecm->notify_count, 0);
kfree(ecm->notify_req->buf);
usb_ep_free_request(ecm->notify, ecm->notify_req);
struct f_ecm *ecm;
ecm = kzalloc_obj(*ecm);
if (!ecm)
status = gether_get_host_addr_cdc(opts->net, ecm->ethaddr,
sizeof(ecm->ethaddr));
kfree(ecm);
ecm->port.ioport = netdev_priv(opts->net);
ecm->port.cdc_filter = DEFAULT_FILTER;
ecm->port.func.name = "cdc_ethernet";
ecm->port.func.bind = ecm_bind;
ecm->port.func.unbind = ecm_unbind;
ecm->port.func.set_alt = ecm_set_alt;
ecm->port.func.get_alt = ecm_get_alt;
ecm->port.func.setup = ecm_setup;
ecm->port.func.disable = ecm_disable;
ecm->port.func.free_func = ecm_free;
ecm->port.func.suspend = ecm_suspend;
ecm->port.func.get_status = ecm_get_status;
ecm->port.func.resume = ecm_resume;
return &ecm->port.func;
DECLARE_USB_FUNCTION_INIT(ecm, ecm_alloc_inst, ecm_alloc);