1 // SPDX-License-Identifier: GPL-2.0
3 * Wire Adapter Host Controller Driver
4 * Common items to HWA and DWA based HCDs
6 * Copyright (C) 2005-2006 Intel Corporation
11 #include <linux/slab.h>
12 #include <linux/module.h>
19 * wa->usb_dev and wa->usb_iface initialized and refcounted,
20 * wa->wa_descr initialized.
22 int wa_create(struct wahc *wa, struct usb_interface *iface,
23 kernel_ulong_t quirks)
26 struct device *dev = &iface->dev;
28 if (iface->cur_altsetting->desc.bNumEndpoints < 3)
31 result = wa_rpipes_create(wa);
33 goto error_rpipes_create;
35 /* Fill up Data Transfer EP pointers */
36 wa->dti_epd = &iface->cur_altsetting->endpoint[1].desc;
37 wa->dto_epd = &iface->cur_altsetting->endpoint[2].desc;
38 wa->dti_buf_size = usb_endpoint_maxp(wa->dti_epd);
39 wa->dti_buf = kmalloc(wa->dti_buf_size, GFP_KERNEL);
40 if (wa->dti_buf == NULL) {
42 goto error_dti_buf_alloc;
44 result = wa_nep_create(wa, iface);
46 dev_err(dev, "WA-CDS: can't initialize notif endpoint: %d\n",
48 goto error_nep_create;
55 wa_rpipes_destroy(wa);
59 EXPORT_SYMBOL_GPL(wa_create);
62 void __wa_destroy(struct wahc *wa)
65 usb_kill_urb(wa->dti_urb);
66 usb_put_urb(wa->dti_urb);
70 wa_rpipes_destroy(wa);
72 EXPORT_SYMBOL_GPL(__wa_destroy);
75 * wa_reset_all - reset the WA device
76 * @wa: the WA to be reset
78 * For HWAs the radio controller and all other PALs are also reset.
80 void wa_reset_all(struct wahc *wa)
82 /* FIXME: assuming HWA. */
83 wusbhc_reset_all(wa->wusb);
87 MODULE_DESCRIPTION("Wireless USB Wire Adapter core");
88 MODULE_LICENSE("GPL");