25 #include <linux/module.h>
28 #include <linux/kernel.h>
30 #include <linux/slab.h>
31 #include <linux/types.h>
32 #include <linux/errno.h>
34 #include <linux/device.h>
45 { USB_DEVICE(0x0a5c, 0x2033) },
52 #define BCM203X_ERROR 0
53 #define BCM203X_RESET 1
54 #define BCM203X_LOAD_MINIDRV 2
55 #define BCM203X_SELECT_MEMORY 3
56 #define BCM203X_CHECK_MEMORY 4
57 #define BCM203X_LOAD_FIRMWARE 5
58 #define BCM203X_CHECK_FIRMWARE 6
60 #define BCM203X_IN_EP 0x81
61 #define BCM203X_OUT_EP 0x02
79 static void bcm203x_complete(
struct urb *
urb)
82 struct usb_device *
udev = urb->dev;
85 BT_DBG(
"udev %p urb %p", udev, urb);
88 BT_ERR(
"URB failed with status %d", urb->status);
93 switch (data->
state) {
97 usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev,
BCM203X_OUT_EP),
98 data->
buffer, 1, bcm203x_complete, data);
107 usb_fill_int_urb(urb, udev, usb_rcvintpipe(udev,
BCM203X_IN_EP),
108 data->
buffer, 32, bcm203x_complete, data, 1);
113 BT_ERR(
"Can't submit URB");
117 if (data->
buffer[0] !=
'#') {
118 BT_ERR(
"Memory select failed");
127 usb_fill_int_urb(urb, udev, usb_rcvintpipe(udev,
BCM203X_IN_EP),
128 data->
buffer, 32, bcm203x_complete, data, 1);
134 usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev,
BCM203X_OUT_EP),
141 BT_ERR(
"Can't submit URB");
145 if (data->
buffer[0] !=
'.') {
146 BT_ERR(
"Firmware loading failed");
165 BT_ERR(
"Can't submit URB");
171 struct usb_device *udev = interface_to_usbdev(intf);
175 BT_DBG(
"intf %p id %p", intf,
id);
177 if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
182 BT_ERR(
"Can't allocate memory for data structure");
191 BT_ERR(
"Can't allocate URB");
196 BT_ERR(
"Mini driver request failed");
201 BT_DBG(
"minidrv data %p size %zu", firmware->
data, firmware->
size);
207 BT_ERR(
"Can't allocate memory for mini driver");
216 data->
buffer, firmware->
size, bcm203x_complete, data);
221 BT_ERR(
"Firmware request failed");
227 BT_DBG(
"firmware data %p size %zu", firmware->
data, firmware->
size);
231 BT_ERR(
"Can't allocate memory for firmware image");
245 usb_set_intfdata(intf, data);
264 usb_set_intfdata(intf,
NULL);
271 static struct usb_driver bcm203x_driver = {
273 .probe = bcm203x_probe,
274 .disconnect = bcm203x_disconnect,
275 .id_table = bcm203x_table,
276 .disable_hub_initiated_lpm = 1,