2 * Wire Adapter Host Controller Driver
3 * Common items to HWA and DWA based HCDs
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
31 * wa->usb_dev and wa->usb_iface initialized and refcounted,
32 * wa->wa_descr initialized.
34 int wa_create(struct wahc *wa, struct usb_interface *iface)
37 struct device *dev = &iface->dev;
39 result = wa_rpipes_create(wa);
41 goto error_rpipes_create;
42 /* Fill up Data Transfer EP pointers */
43 wa->dti_epd = &iface->cur_altsetting->endpoint[1].desc;
44 wa->dto_epd = &iface->cur_altsetting->endpoint[2].desc;
45 wa->xfer_result_size = le16_to_cpu(wa->dti_epd->wMaxPacketSize);
46 wa->xfer_result = kmalloc(wa->xfer_result_size, GFP_KERNEL);
47 if (wa->xfer_result == NULL)
48 goto error_xfer_result_alloc;
49 result = wa_nep_create(wa, iface);
51 dev_err(dev, "WA-CDS: can't initialize notif endpoint: %d\n",
53 goto error_nep_create;
58 kfree(wa->xfer_result);
59 error_xfer_result_alloc:
60 wa_rpipes_destroy(wa);
64 EXPORT_SYMBOL_GPL(wa_create);
67 void __wa_destroy(struct wahc *wa)
70 usb_kill_urb(wa->dti_urb);
71 usb_put_urb(wa->dti_urb);
72 usb_kill_urb(wa->buf_in_urb);
73 usb_put_urb(wa->buf_in_urb);
75 kfree(wa->xfer_result);
77 wa_rpipes_destroy(wa);
79 EXPORT_SYMBOL_GPL(__wa_destroy);
82 * wa_reset_all - reset the WA device
83 * @wa: the WA to be reset
85 * For HWAs the radio controller and all other PALs are also reset.
87 void wa_reset_all(struct wahc *wa)
89 /* FIXME: assuming HWA. */
90 wusbhc_reset_all(wa->wusb);
93 MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
94 MODULE_DESCRIPTION("Wireless USB Wire Adapter core");
95 MODULE_LICENSE("GPL");