ath3k.c 15.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*
 * Copyright (c) 2008-2009 Atheros Communications Inc.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */


#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/usb.h>
30
#include <asm/unaligned.h>
31 32 33
#include <net/bluetooth/bluetooth.h>

#define VERSION "1.0"
34
#define ATH3K_FIRMWARE	"ath3k-1.fw"
35

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#define ATH3K_DNLOAD				0x01
#define ATH3K_GETSTATE				0x05
#define ATH3K_SET_NORMAL_MODE			0x07
#define ATH3K_GETVERSION			0x09
#define USB_REG_SWITCH_VID_PID			0x0a

#define ATH3K_MODE_MASK				0x3F
#define ATH3K_NORMAL_MODE			0x0E

#define ATH3K_PATCH_UPDATE			0x80
#define ATH3K_SYSCFG_UPDATE			0x40

#define ATH3K_XTAL_FREQ_26M			0x00
#define ATH3K_XTAL_FREQ_40M			0x01
#define ATH3K_XTAL_FREQ_19P2			0x02
#define ATH3K_NAME_LEN				0xFF

struct ath3k_version {
54 55 56 57 58 59
	__le32	rom_version;
	__le32	build_version;
	__le32	ram_version;
	__u8	ref_clock;
	__u8	reserved[7];
} __packed;
60

61
static const struct usb_device_id ath3k_table[] = {
62 63
	/* Atheros AR3011 */
	{ USB_DEVICE(0x0CF3, 0x3000) },
64 65

	/* Atheros AR3011 with sflash firmware*/
66 67
	{ USB_DEVICE(0x0489, 0xE027) },
	{ USB_DEVICE(0x0489, 0xE03D) },
68
	{ USB_DEVICE(0x04F2, 0xAFF1) },
69
	{ USB_DEVICE(0x0930, 0x0215) },
70
	{ USB_DEVICE(0x0CF3, 0x3002) },
71
	{ USB_DEVICE(0x0CF3, 0xE019) },
72
	{ USB_DEVICE(0x13d3, 0x3304) },
73

74 75
	/* Atheros AR9285 Malbec with sflash firmware */
	{ USB_DEVICE(0x03F0, 0x311D) },
76 77

	/* Atheros AR3012 with sflash firmware*/
78 79 80 81 82
	{ USB_DEVICE(0x0489, 0xe04d) },
	{ USB_DEVICE(0x0489, 0xe04e) },
	{ USB_DEVICE(0x0489, 0xe057) },
	{ USB_DEVICE(0x0489, 0xe056) },
	{ USB_DEVICE(0x0489, 0xe05f) },
83
	{ USB_DEVICE(0x0489, 0xe076) },
84
	{ USB_DEVICE(0x0489, 0xe078) },
85 86 87 88
	{ USB_DEVICE(0x04c5, 0x1330) },
	{ USB_DEVICE(0x04CA, 0x3004) },
	{ USB_DEVICE(0x04CA, 0x3005) },
	{ USB_DEVICE(0x04CA, 0x3006) },
89
	{ USB_DEVICE(0x04CA, 0x3007) },
90 91
	{ USB_DEVICE(0x04CA, 0x3008) },
	{ USB_DEVICE(0x04CA, 0x300b) },
92
	{ USB_DEVICE(0x04CA, 0x300d) },
93
	{ USB_DEVICE(0x04CA, 0x300f) },
94
	{ USB_DEVICE(0x04CA, 0x3010) },
95
	{ USB_DEVICE(0x04CA, 0x3014) },
96
	{ USB_DEVICE(0x0930, 0x0219) },
97
	{ USB_DEVICE(0x0930, 0x021c) },
98
	{ USB_DEVICE(0x0930, 0x0220) },
99
	{ USB_DEVICE(0x0930, 0x0227) },
100
	{ USB_DEVICE(0x0b05, 0x17d0) },
101
	{ USB_DEVICE(0x0CF3, 0x0036) },
102
	{ USB_DEVICE(0x0CF3, 0x3004) },
103
	{ USB_DEVICE(0x0CF3, 0x3008) },
104
	{ USB_DEVICE(0x0CF3, 0x311D) },
105
	{ USB_DEVICE(0x0CF3, 0x311E) },
106
	{ USB_DEVICE(0x0CF3, 0x311F) },
107
	{ USB_DEVICE(0x0cf3, 0x3121) },
108
	{ USB_DEVICE(0x0CF3, 0x817a) },
109
	{ USB_DEVICE(0x0CF3, 0x817b) },
110
	{ USB_DEVICE(0x0cf3, 0xe003) },
111
	{ USB_DEVICE(0x0CF3, 0xE004) },
112
	{ USB_DEVICE(0x0CF3, 0xE005) },
113
	{ USB_DEVICE(0x0CF3, 0xE006) },
114 115
	{ USB_DEVICE(0x13d3, 0x3362) },
	{ USB_DEVICE(0x13d3, 0x3375) },
116
	{ USB_DEVICE(0x13d3, 0x3393) },
117
	{ USB_DEVICE(0x13d3, 0x3395) },
118
	{ USB_DEVICE(0x13d3, 0x3402) },
119
	{ USB_DEVICE(0x13d3, 0x3408) },
120
	{ USB_DEVICE(0x13d3, 0x3423) },
121
	{ USB_DEVICE(0x13d3, 0x3432) },
122
	{ USB_DEVICE(0x13d3, 0x3472) },
123
	{ USB_DEVICE(0x13d3, 0x3474) },
124

125 126
	/* Atheros AR5BBU12 with sflash firmware */
	{ USB_DEVICE(0x0489, 0xE02C) },
127

128
	/* Atheros AR5BBU22 with sflash firmware */
129
	{ USB_DEVICE(0x0489, 0xE036) },
130
	{ USB_DEVICE(0x0489, 0xE03C) },
131

132 133 134 135 136
	{ }	/* Terminating entry */
};

MODULE_DEVICE_TABLE(usb, ath3k_table);

137 138 139
#define BTUSB_ATH3012		0x80
/* This table is to load patch and sysconfig files
 * for AR3012 */
140
static const struct usb_device_id ath3k_blist_tbl[] = {
141 142

	/* Atheros AR3012 with sflash firmware*/
143 144 145 146 147
	{ USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 },
148
	{ USB_DEVICE(0x0489, 0xe076), .driver_info = BTUSB_ATH3012 },
149
	{ USB_DEVICE(0x0489, 0xe078), .driver_info = BTUSB_ATH3012 },
150 151 152 153
	{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 },
154
	{ USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
155 156
	{ USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
157
	{ USB_DEVICE(0x04ca, 0x300d), .driver_info = BTUSB_ATH3012 },
158
	{ USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 },
159
	{ USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
160
	{ USB_DEVICE(0x04ca, 0x3014), .driver_info = BTUSB_ATH3012 },
161
	{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
162
	{ USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 },
163
	{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
164
	{ USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
165
	{ USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
166
	{ USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 },
167
	{ USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
168
	{ USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
169
	{ USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
170
	{ USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 },
171
	{ USB_DEVICE(0x0cf3, 0x311F), .driver_info = BTUSB_ATH3012 },
172
	{ USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
173
	{ USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 },
174
	{ USB_DEVICE(0x0CF3, 0x817b), .driver_info = BTUSB_ATH3012 },
175
	{ USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
176
	{ USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
177
	{ USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 },
178 179 180
	{ USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
	{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
181
	{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
182
	{ USB_DEVICE(0x13d3, 0x3395), .driver_info = BTUSB_ATH3012 },
183
	{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
184
	{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
185
	{ USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
186
	{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
187
	{ USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 },
188
	{ USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 },
189

190
	/* Atheros AR5BBU22 with sflash firmware */
191
	{ USB_DEVICE(0x0489, 0xE036), .driver_info = BTUSB_ATH3012 },
192
	{ USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
193

194 195 196
	{ }	/* Terminating entry */
};

197 198
#define USB_REQ_DFU_DNLOAD	1
#define BULK_SIZE		4096
199
#define FW_HDR_SIZE		20
200 201
#define TIMEGAP_USEC_MIN	50
#define TIMEGAP_USEC_MAX	100
202

203 204
static int ath3k_load_firmware(struct usb_device *udev,
				const struct firmware *firmware)
205 206 207
{
	u8 *send_buf;
	int err, pipe, len, size, sent = 0;
208
	int count = firmware->size;
209

210
	BT_DBG("udev %p", udev);
211

212
	pipe = usb_sndctrlpipe(udev, 0);
213

214
	send_buf = kmalloc(BULK_SIZE, GFP_KERNEL);
215 216 217 218 219 220
	if (!send_buf) {
		BT_ERR("Can't allocate memory chunk for firmware");
		return -ENOMEM;
	}

	memcpy(send_buf, firmware->data, 20);
221 222 223
	err = usb_control_msg(udev, pipe, USB_REQ_DFU_DNLOAD, USB_TYPE_VENDOR,
			      0, 0, send_buf, 20, USB_CTRL_SET_TIMEOUT);
	if (err < 0) {
224
		BT_ERR("Can't change to loading configuration err");
225
		goto error;
226 227 228 229
	}
	sent += 20;
	count -= 20;

230 231
	pipe = usb_sndbulkpipe(udev, 0x02);

232
	while (count) {
233 234 235
		/* workaround the compatibility issue with xHCI controller*/
		usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);

236
		size = min_t(uint, count, BULK_SIZE);
237
		memcpy(send_buf, firmware->data + sent, size);
238

239
		err = usb_bulk_msg(udev, pipe, send_buf, size,
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
					&len, 3000);

		if (err || (len != size)) {
			BT_ERR("Error in firmware loading err = %d,"
				"len = %d, size = %d", err, len, size);
			goto error;
		}

		sent  += size;
		count -= size;
	}

error:
	kfree(send_buf);
	return err;
}

257 258
static int ath3k_get_state(struct usb_device *udev, unsigned char *state)
{
259 260 261 262 263 264
	int ret, pipe = 0;
	char *buf;

	buf = kmalloc(sizeof(*buf), GFP_KERNEL);
	if (!buf)
		return -ENOMEM;
265 266

	pipe = usb_rcvctrlpipe(udev, 0);
267 268 269 270 271 272 273 274
	ret = usb_control_msg(udev, pipe, ATH3K_GETSTATE,
			      USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
			      buf, sizeof(*buf), USB_CTRL_SET_TIMEOUT);

	*state = *buf;
	kfree(buf);

	return ret;
275 276 277 278 279
}

static int ath3k_get_version(struct usb_device *udev,
			struct ath3k_version *version)
{
280 281 282 283 284 285 286
	int ret, pipe = 0;
	struct ath3k_version *buf;
	const int size = sizeof(*buf);

	buf = kmalloc(size, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;
287 288

	pipe = usb_rcvctrlpipe(udev, 0);
289 290 291 292 293 294 295 296
	ret = usb_control_msg(udev, pipe, ATH3K_GETVERSION,
			      USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
			      buf, size, USB_CTRL_SET_TIMEOUT);

	memcpy(version, buf, size);
	kfree(buf);

	return ret;
297 298 299 300 301 302 303 304 305 306 307
}

static int ath3k_load_fwfile(struct usb_device *udev,
		const struct firmware *firmware)
{
	u8 *send_buf;
	int err, pipe, len, size, count, sent = 0;
	int ret;

	count = firmware->size;

308
	send_buf = kmalloc(BULK_SIZE, GFP_KERNEL);
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
	if (!send_buf) {
		BT_ERR("Can't allocate memory chunk for firmware");
		return -ENOMEM;
	}

	size = min_t(uint, count, FW_HDR_SIZE);
	memcpy(send_buf, firmware->data, size);

	pipe = usb_sndctrlpipe(udev, 0);
	ret = usb_control_msg(udev, pipe, ATH3K_DNLOAD,
			USB_TYPE_VENDOR, 0, 0, send_buf,
			size, USB_CTRL_SET_TIMEOUT);
	if (ret < 0) {
		BT_ERR("Can't change to loading configuration err");
		kfree(send_buf);
		return ret;
	}

	sent += size;
	count -= size;

330 331
	pipe = usb_sndbulkpipe(udev, 0x02);

332
	while (count) {
333 334 335
		/* workaround the compatibility issue with xHCI controller*/
		usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX);

336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
		size = min_t(uint, count, BULK_SIZE);
		memcpy(send_buf, firmware->data + sent, size);

		err = usb_bulk_msg(udev, pipe, send_buf, size,
					&len, 3000);
		if (err || (len != size)) {
			BT_ERR("Error in firmware loading err = %d,"
				"len = %d, size = %d", err, len, size);
			kfree(send_buf);
			return err;
		}
		sent  += size;
		count -= size;
	}

	kfree(send_buf);
	return 0;
}

static int ath3k_switch_pid(struct usb_device *udev)
{
	int pipe = 0;

	pipe = usb_sndctrlpipe(udev, 0);
	return usb_control_msg(udev, pipe, USB_REG_SWITCH_VID_PID,
			USB_TYPE_VENDOR, 0, 0,
			NULL, 0, USB_CTRL_SET_TIMEOUT);
}

static int ath3k_set_normal_mode(struct usb_device *udev)
{
	unsigned char fw_state;
	int pipe = 0, ret;

	ret = ath3k_get_state(udev, &fw_state);
	if (ret < 0) {
		BT_ERR("Can't get state to change to normal mode err");
		return ret;
	}

	if ((fw_state & ATH3K_MODE_MASK) == ATH3K_NORMAL_MODE) {
		BT_DBG("firmware was already in normal mode");
		return 0;
	}

	pipe = usb_sndctrlpipe(udev, 0);
	return usb_control_msg(udev, pipe, ATH3K_SET_NORMAL_MODE,
			USB_TYPE_VENDOR, 0, 0,
			NULL, 0, USB_CTRL_SET_TIMEOUT);
}

static int ath3k_load_patch(struct usb_device *udev)
{
	unsigned char fw_state;
	char filename[ATH3K_NAME_LEN] = {0};
	const struct firmware *firmware;
392 393
	struct ath3k_version fw_version;
	__u32 pt_rom_version, pt_build_version;
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
	int ret;

	ret = ath3k_get_state(udev, &fw_state);
	if (ret < 0) {
		BT_ERR("Can't get state to change to load ram patch err");
		return ret;
	}

	if (fw_state & ATH3K_PATCH_UPDATE) {
		BT_DBG("Patch was already downloaded");
		return 0;
	}

	ret = ath3k_get_version(udev, &fw_version);
	if (ret < 0) {
		BT_ERR("Can't get version to change to load ram patch err");
		return ret;
	}

	snprintf(filename, ATH3K_NAME_LEN, "ar3k/AthrBT_0x%08x.dfu",
414
		 le32_to_cpu(fw_version.rom_version));
415 416 417 418 419 420 421

	ret = request_firmware(&firmware, filename, &udev->dev);
	if (ret < 0) {
		BT_ERR("Patch file not found %s", filename);
		return ret;
	}

422 423 424 425
	pt_rom_version = get_unaligned_le32(firmware->data +
					    firmware->size - 8);
	pt_build_version = get_unaligned_le32(firmware->data +
					      firmware->size - 4);
426

427 428
	if (pt_rom_version != le32_to_cpu(fw_version.rom_version) ||
	    pt_build_version <= le32_to_cpu(fw_version.build_version)) {
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
		BT_ERR("Patch file version did not match with firmware");
		release_firmware(firmware);
		return -EINVAL;
	}

	ret = ath3k_load_fwfile(udev, firmware);
	release_firmware(firmware);

	return ret;
}

static int ath3k_load_syscfg(struct usb_device *udev)
{
	unsigned char fw_state;
	char filename[ATH3K_NAME_LEN] = {0};
	const struct firmware *firmware;
	struct ath3k_version fw_version;
	int clk_value, ret;

	ret = ath3k_get_state(udev, &fw_state);
	if (ret < 0) {
450
		BT_ERR("Can't get state to change to load configuration err");
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
		return -EBUSY;
	}

	ret = ath3k_get_version(udev, &fw_version);
	if (ret < 0) {
		BT_ERR("Can't get version to change to load ram patch err");
		return ret;
	}

	switch (fw_version.ref_clock) {

	case ATH3K_XTAL_FREQ_26M:
		clk_value = 26;
		break;
	case ATH3K_XTAL_FREQ_40M:
		clk_value = 40;
		break;
	case ATH3K_XTAL_FREQ_19P2:
		clk_value = 19;
		break;
	default:
		clk_value = 0;
		break;
	}

	snprintf(filename, ATH3K_NAME_LEN, "ar3k/ramps_0x%08x_%d%s",
477
		le32_to_cpu(fw_version.rom_version), clk_value, ".dfu");
478 479 480 481 482 483 484 485 486 487 488 489 490

	ret = request_firmware(&firmware, filename, &udev->dev);
	if (ret < 0) {
		BT_ERR("Configuration file not found %s", filename);
		return ret;
	}

	ret = ath3k_load_fwfile(udev, firmware);
	release_firmware(firmware);

	return ret;
}

491 492 493 494 495
static int ath3k_probe(struct usb_interface *intf,
			const struct usb_device_id *id)
{
	const struct firmware *firmware;
	struct usb_device *udev = interface_to_usbdev(intf);
496
	int ret;
497 498 499 500 501 502

	BT_DBG("intf %p id %p", intf, id);

	if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
		return -ENODEV;

503 504 505 506 507 508 509 510 511 512
	/* match device ID in ath3k blacklist table */
	if (!id->driver_info) {
		const struct usb_device_id *match;
		match = usb_match_id(intf, ath3k_blist_tbl);
		if (match)
			id = match;
	}

	/* load patch and sysconfig files for AR3012 */
	if (id->driver_info & BTUSB_ATH3012) {
513 514 515 516 517

		/* New firmware with patch and sysconfig files already loaded */
		if (le16_to_cpu(udev->descriptor.bcdDevice) > 0x0001)
			return -ENODEV;

518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536
		ret = ath3k_load_patch(udev);
		if (ret < 0) {
			BT_ERR("Loading patch file failed");
			return ret;
		}
		ret = ath3k_load_syscfg(udev);
		if (ret < 0) {
			BT_ERR("Loading sysconfig file failed");
			return ret;
		}
		ret = ath3k_set_normal_mode(udev);
		if (ret < 0) {
			BT_ERR("Set normal mode failed");
			return ret;
		}
		ath3k_switch_pid(udev);
		return 0;
	}

537 538 539 540 541 542 543 544 545
	ret = request_firmware(&firmware, ATH3K_FIRMWARE, &udev->dev);
	if (ret < 0) {
		if (ret == -ENOENT)
			BT_ERR("Firmware file \"%s\" not found",
							ATH3K_FIRMWARE);
		else
			BT_ERR("Firmware file \"%s\" request failed (err=%d)",
							ATH3K_FIRMWARE, ret);
		return ret;
546 547
	}

548
	ret = ath3k_load_firmware(udev, firmware);
549
	release_firmware(firmware);
550

551
	return ret;
552 553 554 555 556 557 558 559 560 561 562 563
}

static void ath3k_disconnect(struct usb_interface *intf)
{
	BT_DBG("ath3k_disconnect intf %p", intf);
}

static struct usb_driver ath3k_driver = {
	.name		= "ath3k",
	.probe		= ath3k_probe,
	.disconnect	= ath3k_disconnect,
	.id_table	= ath3k_table,
564
	.disable_hub_initiated_lpm = 1,
565 566
};

567
module_usb_driver(ath3k_driver);
568 569 570 571 572

MODULE_AUTHOR("Atheros Communications");
MODULE_DESCRIPTION("Atheros AR30xx firmware driver");
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
573
MODULE_FIRMWARE(ATH3K_FIRMWARE);