Lines Matching +full:subset +full:- +full:of
1 // SPDX-License-Identifier: GPL-2.0+
3 * f_subset.c -- "CDC Subset" Ethernet link function driver
5 * Copyright (C) 2003-2005,2008 David Brownell
20 * This function packages a simple "CDC Subset" Ethernet port with no real
22 * The data transfer model is exactly that of CDC Ethernet, which is
23 * why we call it the "CDC Subset".
27 * so simple (CDC Ethernet). The original versions of this protocol used
29 * SA-1100 "Itsy" board, which could run Linux 2.4 kernels and supported
37 * Subset" in terms of data transfer and lack of control model. This was
42 * descriptors to the CDC Subset code, making this code look like a SAFE
43 * implementation. This lets you use MCCI's host side MS-Windows drivers
45 * drivers to work, since they can use class based binding instead of
60 /*-------------------------------------------------------------------------*/
63 * "Simple" CDC-subset option is a simple vendor-neutral model that most
110 * the submode of "SAFE" which directly matches the CDC Subset.
236 [0].s = "CDC Ethernet Subset/SAFE",
238 { } /* end of list */
242 .language = 0x0409, /* en-us */
251 /*-------------------------------------------------------------------------*/
256 struct usb_composite_dev *cdev = f->config->cdev; in geth_set_alt()
261 if (geth->port.in_ep->enabled) { in geth_set_alt()
262 DBG(cdev, "reset cdc subset\n"); in geth_set_alt()
263 gether_disconnect(&geth->port); in geth_set_alt()
266 DBG(cdev, "init + activate cdc subset\n"); in geth_set_alt()
267 if (config_ep_by_speed(cdev->gadget, f, geth->port.in_ep) || in geth_set_alt()
268 config_ep_by_speed(cdev->gadget, f, geth->port.out_ep)) { in geth_set_alt()
269 geth->port.in_ep->desc = NULL; in geth_set_alt()
270 geth->port.out_ep->desc = NULL; in geth_set_alt()
271 return -EINVAL; in geth_set_alt()
274 net = gether_connect(&geth->port); in geth_set_alt()
281 struct usb_composite_dev *cdev = f->config->cdev; in geth_disable()
284 gether_disconnect(&geth->port); in geth_disable()
287 /*-------------------------------------------------------------------------*/
294 struct usb_composite_dev *cdev = c->cdev; in geth_bind()
302 gether_opts = container_of(f->fi, struct f_gether_opts, func_inst); in geth_bind()
309 * with regard to gether_opts->bound access in geth_bind()
311 if (!gether_opts->bound) { in geth_bind()
312 mutex_lock(&gether_opts->lock); in geth_bind()
313 gether_set_gadget(gether_opts->net, cdev->gadget); in geth_bind()
314 status = gether_register_netdev(gether_opts->net); in geth_bind()
315 mutex_unlock(&gether_opts->lock); in geth_bind()
318 gether_opts->bound = true; in geth_bind()
329 /* allocate instance-specific interface IDs */ in geth_bind()
335 status = -ENODEV; in geth_bind()
337 /* allocate instance-specific endpoints */ in geth_bind()
338 ep = usb_ep_autoconfig(cdev->gadget, &fs_subset_in_desc); in geth_bind()
341 geth->port.in_ep = ep; in geth_bind()
343 ep = usb_ep_autoconfig(cdev->gadget, &fs_subset_out_desc); in geth_bind()
346 geth->port.out_ep = ep; in geth_bind()
349 * hardware is dual speed, all bulk-capable endpoints work at in geth_bind()
370 DBG(cdev, "CDC Subset: IN/%s OUT/%s\n", in geth_bind()
371 geth->port.in_ep->name, geth->port.out_ep->name); in geth_bind()
375 ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); in geth_bind()
420 if (opts->bound) in geth_free_inst()
421 gether_cleanup(netdev_priv(opts->net)); in geth_free_inst()
423 free_netdev(opts->net); in geth_free_inst()
433 return ERR_PTR(-ENOMEM); in geth_alloc_inst()
434 mutex_init(&opts->lock); in geth_alloc_inst()
435 opts->func_inst.free_func_inst = geth_free_inst; in geth_alloc_inst()
436 opts->net = gether_setup_default(); in geth_alloc_inst()
437 if (IS_ERR(opts->net)) { in geth_alloc_inst()
438 struct net_device *net = opts->net; in geth_alloc_inst()
443 config_group_init_type_name(&opts->func_inst.group, "", in geth_alloc_inst()
446 return &opts->func_inst; in geth_alloc_inst()
472 return ERR_PTR(-ENOMEM); in geth_alloc()
476 mutex_lock(&opts->lock); in geth_alloc()
477 opts->refcnt++; in geth_alloc()
479 status = gether_get_host_addr_cdc(opts->net, geth->ethaddr, in geth_alloc()
480 sizeof(geth->ethaddr)); in geth_alloc()
483 mutex_unlock(&opts->lock); in geth_alloc()
484 return ERR_PTR(-EINVAL); in geth_alloc()
486 geth_string_defs[1].s = geth->ethaddr; in geth_alloc()
488 geth->port.ioport = netdev_priv(opts->net); in geth_alloc()
489 mutex_unlock(&opts->lock); in geth_alloc()
490 geth->port.cdc_filter = DEFAULT_FILTER; in geth_alloc()
492 geth->port.func.name = "cdc_subset"; in geth_alloc()
493 geth->port.func.bind = geth_bind; in geth_alloc()
494 geth->port.func.unbind = geth_unbind; in geth_alloc()
495 geth->port.func.set_alt = geth_set_alt; in geth_alloc()
496 geth->port.func.disable = geth_disable; in geth_alloc()
497 geth->port.func.free_func = geth_free; in geth_alloc()
499 return &geth->port.func; in geth_alloc()
503 MODULE_DESCRIPTION("\"CDC Subset\" Ethernet link function driver");