p54usb.c 29.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

/*
 * Linux device driver for USB based Prism54
 *
 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
 *
 * Based on the islsm (softmac prism54) driver, which is:
 * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/init.h>
#include <linux/usb.h>
#include <linux/pci.h>
18
#include <linux/slab.h>
19 20 21 22
#include <linux/firmware.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/crc32.h>
23
#include <linux/module.h>
24 25 26
#include <net/mac80211.h>

#include "p54.h"
27
#include "lmac.h"
28 29 30 31 32 33
#include "p54usb.h"

MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
MODULE_DESCRIPTION("Prism54 USB wireless driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("prism54usb");
34 35
MODULE_FIRMWARE("isl3886usb");
MODULE_FIRMWARE("isl3887usb");
36

C
Christian Lamparter 已提交
37 38 39 40 41 42 43 44
/*
 * Note:
 *
 * Always update our wiki's device list (located at:
 * http://wireless.kernel.org/en/users/Drivers/p54/devices ),
 * whenever you add a new device.
 */

45
static struct usb_device_id p54u_table[] = {
46
	/* Version 1 devices (pci chip + net2280) */
C
Christian Lamparter 已提交
47
	{USB_DEVICE(0x0411, 0x0050)},	/* Buffalo WLI2-USB2-G54 */
C
Christian Lamparter 已提交
48
	{USB_DEVICE(0x045e, 0x00c2)},	/* Microsoft MN-710 */
49
	{USB_DEVICE(0x0506, 0x0a11)},	/* 3COM 3CRWE254G72 */
50
	{USB_DEVICE(0x06b9, 0x0120)},	/* Thomson SpeedTouch 120g */
51
	{USB_DEVICE(0x0707, 0xee06)},	/* SMC 2862W-G */
52
	{USB_DEVICE(0x07aa, 0x001c)},	/* Corega CG-WLUSB2GT */
53 54
	{USB_DEVICE(0x083a, 0x4501)},	/* Accton 802.11g WN4501 USB */
	{USB_DEVICE(0x083a, 0x4502)},	/* Siemens Gigaset USB Adapter */
55
	{USB_DEVICE(0x083a, 0x5501)},	/* Phillips CPWUA054 */
56 57 58
	{USB_DEVICE(0x0846, 0x4200)},	/* Netgear WG121 */
	{USB_DEVICE(0x0846, 0x4210)},	/* Netgear WG121 the second ? */
	{USB_DEVICE(0x0846, 0x4220)},	/* Netgear WG111 */
C
Christian Lamparter 已提交
59
	{USB_DEVICE(0x09aa, 0x1000)},	/* Spinnaker Proto board */
60
	{USB_DEVICE(0x0bf8, 0x1007)},	/* Fujitsu E-5400 USB */
61
	{USB_DEVICE(0x0cde, 0x0006)},	/* Medion 40900, Roper Europe */
C
Christian Lamparter 已提交
62
	{USB_DEVICE(0x0db0, 0x6826)},	/* MSI UB54G (MS-6826) */
C
Christian Lamparter 已提交
63
	{USB_DEVICE(0x107b, 0x55f2)},	/* Gateway WGU-210 (Gemtek) */
64
	{USB_DEVICE(0x124a, 0x4023)},	/* Shuttle PN15, Airvast WM168g, IOGear GWU513 */
C
Christian Lamparter 已提交
65
	{USB_DEVICE(0x1435, 0x0210)},	/* Inventel UR054G */
66
	{USB_DEVICE(0x15a9, 0x0002)},	/* Gemtek WUBI-100GW 802.11g */
C
Christian Lamparter 已提交
67
	{USB_DEVICE(0x1630, 0x0005)},	/* 2Wire 802.11g USB (v1) / Z-Com */
C
Christian Lamparter 已提交
68
	{USB_DEVICE(0x182d, 0x096b)},	/* Sitecom WL-107 */
69 70 71 72
	{USB_DEVICE(0x1915, 0x2234)},	/* Linksys WUSB54G OEM */
	{USB_DEVICE(0x1915, 0x2235)},	/* Linksys WUSB54G Portable OEM */
	{USB_DEVICE(0x2001, 0x3701)},	/* DLink DWL-G120 Spinnaker */
	{USB_DEVICE(0x2001, 0x3703)},	/* DLink DWL-G122 */
73
	{USB_DEVICE(0x2001, 0x3762)},	/* Conceptronic C54U */
74 75 76 77
	{USB_DEVICE(0x5041, 0x2234)},	/* Linksys WUSB54G */
	{USB_DEVICE(0x5041, 0x2235)},	/* Linksys WUSB54G Portable */

	/* Version 2 devices (3887) */
78
	{USB_DEVICE(0x0471, 0x1230)},   /* Philips CPWUA054/00 */
79 80 81
	{USB_DEVICE(0x050d, 0x7050)},	/* Belkin F5D7050 ver 1000 */
	{USB_DEVICE(0x0572, 0x2000)},	/* Cohiba Proto board */
	{USB_DEVICE(0x0572, 0x2002)},	/* Cohiba Proto board */
C
Christian Lamparter 已提交
82
	{USB_DEVICE(0x06a9, 0x000e)},	/* Westell 802.11g USB (A90-211WG-01) */
83
	{USB_DEVICE(0x06b9, 0x0121)},	/* Thomson SpeedTouch 121g */
84 85
	{USB_DEVICE(0x0707, 0xee13)},   /* SMC 2862W-G version 2 */
	{USB_DEVICE(0x083a, 0x4521)},   /* Siemens Gigaset USB Adapter 54 version 2 */
86
	{USB_DEVICE(0x083a, 0xc501)},	/* Zoom Wireless-G 4410 */
87
	{USB_DEVICE(0x083a, 0xf503)},	/* Accton FD7050E ver 1010ec  */
88 89 90 91 92
	{USB_DEVICE(0x0846, 0x4240)},	/* Netgear WG111 (v2) */
	{USB_DEVICE(0x0915, 0x2000)},	/* Cohiba Proto board */
	{USB_DEVICE(0x0915, 0x2002)},	/* Cohiba Proto board */
	{USB_DEVICE(0x0baf, 0x0118)},   /* U.S. Robotics U5 802.11g Adapter*/
	{USB_DEVICE(0x0bf8, 0x1009)},   /* FUJITSU E-5400 USB D1700*/
93 94
	/* {USB_DEVICE(0x0cde, 0x0006)}, * Medion MD40900 already listed above,
					 * just noting it here for clarity */
95
	{USB_DEVICE(0x0cde, 0x0008)},	/* Sagem XG703A */
96
	{USB_DEVICE(0x0cde, 0x0015)},	/* Zcomax XG-705A */
97
	{USB_DEVICE(0x0d8e, 0x3762)},	/* DLink DWL-G120 Cohiba */
98
	{USB_DEVICE(0x124a, 0x4025)},	/* IOGear GWU513 (GW3887IK chip) */
C
Christian Lamparter 已提交
99
	{USB_DEVICE(0x1260, 0xee22)},	/* SMC 2862W-G version 2 */
100
	{USB_DEVICE(0x13b1, 0x000a)},	/* Linksys WUSB54G ver 2 */
101
	{USB_DEVICE(0x13B1, 0x000C)},	/* Linksys WUSB54AG */
102
	{USB_DEVICE(0x1413, 0x5400)},   /* Telsey 802.11g USB2.0 Adapter */
103
	{USB_DEVICE(0x1435, 0x0427)},	/* Inventel UR054G */
C
Christian Lamparter 已提交
104
	{USB_DEVICE(0x1668, 0x1050)},	/* Actiontec 802UIG-1 */
105
	{USB_DEVICE(0x1740, 0x1000)},	/* Senao NUB-350 */
106
	{USB_DEVICE(0x2001, 0x3704)},	/* DLink DWL-G122 rev A2 */
C
Christian Lamparter 已提交
107
	{USB_DEVICE(0x2001, 0x3705)},	/* D-Link DWL-G120 rev C1 */
108
	{USB_DEVICE(0x413c, 0x5513)},	/* Dell WLA3310 USB Wireless Adapter */
109 110 111 112 113 114 115
	{USB_DEVICE(0x413c, 0x8102)},	/* Spinnaker DUT */
	{USB_DEVICE(0x413c, 0x8104)},	/* Cohiba Proto board */
	{}
};

MODULE_DEVICE_TABLE(usb, p54u_table);

116 117 118
static const struct {
	u32 intf;
	enum p54u_hw_type type;
119
	const char *fw;
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
	char hw[20];
} p54u_fwlist[__NUM_P54U_HWTYPES] = {
	{
		.type = P54U_NET2280,
		.intf = FW_LM86,
		.fw = "isl3886usb",
		.hw = "ISL3886 + net2280",
	},
	{
		.type = P54U_3887,
		.intf = FW_LM87,
		.fw = "isl3887usb",
		.hw = "ISL3887",
	},
};

136 137 138 139 140 141 142
static void p54u_rx_cb(struct urb *urb)
{
	struct sk_buff *skb = (struct sk_buff *) urb->context;
	struct p54u_rx_info *info = (struct p54u_rx_info *)skb->cb;
	struct ieee80211_hw *dev = info->dev;
	struct p54u_priv *priv = dev->priv;

143 144
	skb_unlink(skb, &priv->rx_queue);

145
	if (unlikely(urb->status)) {
146
		dev_kfree_skb_irq(skb);
147 148 149 150
		return;
	}

	skb_put(skb, urb->actual_length);
151 152 153 154 155 156 157

	if (priv->hw_type == P54U_NET2280)
		skb_pull(skb, priv->common.tx_hdr_len);
	if (priv->common.fw_interface == FW_LM87) {
		skb_pull(skb, 4);
		skb_put(skb, 4);
	}
158 159

	if (p54_rx(dev, skb)) {
160
		skb = dev_alloc_skb(priv->common.rx_mtu + 32);
161 162 163 164 165 166 167 168 169 170 171
		if (unlikely(!skb)) {
			/* TODO check rx queue length and refill *somewhere* */
			return;
		}

		info = (struct p54u_rx_info *) skb->cb;
		info->urb = urb;
		info->dev = dev;
		urb->transfer_buffer = skb_tail_pointer(skb);
		urb->context = skb;
	} else {
172 173 174 175 176 177
		if (priv->hw_type == P54U_NET2280)
			skb_push(skb, priv->common.tx_hdr_len);
		if (priv->common.fw_interface == FW_LM87) {
			skb_push(skb, 4);
			skb_put(skb, 4);
		}
178
		skb_reset_tail_pointer(skb);
179
		skb_trim(skb, 0);
180
		urb->transfer_buffer = skb_tail_pointer(skb);
181
	}
182 183 184 185 186 187 188
	skb_queue_tail(&priv->rx_queue, skb);
	usb_anchor_urb(urb, &priv->submitted);
	if (usb_submit_urb(urb, GFP_ATOMIC)) {
		skb_unlink(skb, &priv->rx_queue);
		usb_unanchor_urb(urb);
		dev_kfree_skb_irq(skb);
	}
189 190
}

191
static void p54u_tx_cb(struct urb *urb)
C
Christian Lamparter 已提交
192 193
{
	struct sk_buff *skb = urb->context;
194
	struct ieee80211_hw *dev =
C
Christian Lamparter 已提交
195 196
		usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));

197
	p54_free_skb(dev, skb);
198 199 200 201 202 203 204 205
}

static void p54u_tx_dummy_cb(struct urb *urb) { }

static void p54u_free_urbs(struct ieee80211_hw *dev)
{
	struct p54u_priv *priv = dev->priv;
	usb_kill_anchored_urbs(&priv->submitted);
C
Christian Lamparter 已提交
206 207
}

208 209 210 211 212 213 214 215 216 217
static void p54u_stop(struct ieee80211_hw *dev)
{
	/*
	 * TODO: figure out how to reliably stop the 3887 and net2280 so
	 * the hardware is still usable next time we want to start it.
	 * until then, we just stop listening to the hardware..
	 */
	p54u_free_urbs(dev);
}

218 219 220
static int p54u_init_urbs(struct ieee80211_hw *dev)
{
	struct p54u_priv *priv = dev->priv;
221
	struct urb *entry = NULL;
222 223
	struct sk_buff *skb;
	struct p54u_rx_info *info;
224
	int ret = 0;
225 226

	while (skb_queue_len(&priv->rx_queue) < 32) {
227
		skb = __dev_alloc_skb(priv->common.rx_mtu + 32, GFP_KERNEL);
228 229 230 231
		if (!skb) {
			ret = -ENOMEM;
			goto err;
		}
232 233
		entry = usb_alloc_urb(0, GFP_KERNEL);
		if (!entry) {
234 235
			ret = -ENOMEM;
			goto err;
236
		}
237

238 239 240 241
		usb_fill_bulk_urb(entry, priv->udev,
				  usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA),
				  skb_tail_pointer(skb),
				  priv->common.rx_mtu + 32, p54u_rx_cb, skb);
242 243 244 245
		info = (struct p54u_rx_info *) skb->cb;
		info->urb = entry;
		info->dev = dev;
		skb_queue_tail(&priv->rx_queue, skb);
246 247 248 249 250 251 252 253 254 255

		usb_anchor_urb(entry, &priv->submitted);
		ret = usb_submit_urb(entry, GFP_KERNEL);
		if (ret) {
			skb_unlink(skb, &priv->rx_queue);
			usb_unanchor_urb(entry);
			goto err;
		}
		usb_free_urb(entry);
		entry = NULL;
256 257 258 259
	}

	return 0;

260 261 262 263 264
 err:
	usb_free_urb(entry);
	kfree_skb(skb);
	p54u_free_urbs(dev);
	return ret;
265 266
}

267 268 269 270 271 272 273 274 275 276
static int p54u_open(struct ieee80211_hw *dev)
{
	/*
	 * TODO: Because we don't know how to reliably stop the 3887 and
	 * the isl3886+net2280, other than brutally cut off all
	 * communications. We have to reinitialize the urbs on every start.
	 */
	return p54u_init_urbs(dev);
}

J
Johannes Berg 已提交
277
static __le32 p54u_lm87_chksum(const __le32 *data, size_t length)
278
{
L
Larry Finger 已提交
279
	u32 chk = 0;
280 281 282

	length >>= 2;
	while (length--) {
J
Johannes Berg 已提交
283
		chk ^= le32_to_cpu(*data++);
284 285 286
		chk = (chk >> 5) ^ (chk << 3);
	}

L
Larry Finger 已提交
287
	return cpu_to_le32(chk);
288 289
}

290
static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb)
291 292 293
{
	struct p54u_priv *priv = dev->priv;
	struct urb *data_urb;
294
	struct lm87_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr);
295 296

	data_urb = usb_alloc_urb(0, GFP_ATOMIC);
297 298
	if (!data_urb) {
		p54_free_skb(dev, skb);
299
		return;
300
	}
301

302 303
	hdr->chksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len);
	hdr->device_addr = ((struct p54_hdr *)skb->data)->req_id;
304 305

	usb_fill_bulk_urb(data_urb, priv->udev,
C
Christian Lamparter 已提交
306
			  usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
307 308
			  hdr, skb->len + sizeof(*hdr),  FREE_AFTER_TX(skb) ?
			  p54u_tx_cb : p54u_tx_dummy_cb, skb);
309
	data_urb->transfer_flags |= URB_ZERO_PACKET;
310

311 312 313 314 315 316
	usb_anchor_urb(data_urb, &priv->submitted);
	if (usb_submit_urb(data_urb, GFP_ATOMIC)) {
		usb_unanchor_urb(data_urb);
		p54_free_skb(dev, skb);
	}
	usb_free_urb(data_urb);
317 318
}

319
static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb)
320 321
{
	struct p54u_priv *priv = dev->priv;
322
	struct urb *int_urb = NULL, *data_urb = NULL;
323
	struct net2280_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr);
324 325
	struct net2280_reg_write *reg = NULL;
	int err = -ENOMEM;
326 327 328

	reg = kmalloc(sizeof(*reg), GFP_ATOMIC);
	if (!reg)
329
		goto out;
330 331

	int_urb = usb_alloc_urb(0, GFP_ATOMIC);
332 333
	if (!int_urb)
		goto out;
334 335

	data_urb = usb_alloc_urb(0, GFP_ATOMIC);
336 337
	if (!data_urb)
		goto out;
338 339 340 341 342 343

	reg->port = cpu_to_le16(NET2280_DEV_U32);
	reg->addr = cpu_to_le32(P54U_DEV_BASE);
	reg->val = cpu_to_le32(ISL38XX_DEV_INT_DATA);

	memset(hdr, 0, sizeof(*hdr));
344 345
	hdr->len = cpu_to_le16(skb->len);
	hdr->device_addr = ((struct p54_hdr *) skb->data)->req_id;
346 347 348

	usb_fill_bulk_urb(int_urb, priv->udev,
		usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg),
349 350 351
		p54u_tx_dummy_cb, dev);

	/*
352 353 354
	 * URB_FREE_BUFFER triggers a code path in the USB subsystem that will
	 * free what is inside the transfer_buffer after the last reference to
	 * the int_urb is dropped.
355
	 */
356
	int_urb->transfer_flags |= URB_FREE_BUFFER | URB_ZERO_PACKET;
357
	reg = NULL;
358 359

	usb_fill_bulk_urb(data_urb, priv->udev,
C
Christian Lamparter 已提交
360
			  usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA),
361 362
			  hdr, skb->len + sizeof(*hdr), FREE_AFTER_TX(skb) ?
			  p54u_tx_cb : p54u_tx_dummy_cb, skb);
363
	data_urb->transfer_flags |= URB_ZERO_PACKET;
364 365 366 367 368 369 370 371 372 373 374 375 376 377

	usb_anchor_urb(int_urb, &priv->submitted);
	err = usb_submit_urb(int_urb, GFP_ATOMIC);
	if (err) {
		usb_unanchor_urb(int_urb);
		goto out;
	}

	usb_anchor_urb(data_urb, &priv->submitted);
	err = usb_submit_urb(data_urb, GFP_ATOMIC);
	if (err) {
		usb_unanchor_urb(data_urb);
		goto out;
	}
378
out:
379 380 381 382
	usb_free_urb(int_urb);
	usb_free_urb(data_urb);

	if (err) {
383
		kfree(reg);
384 385
		p54_free_skb(dev, skb);
	}
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
}

static int p54u_write(struct p54u_priv *priv,
		      struct net2280_reg_write *buf,
		      enum net2280_op_type type,
		      __le32 addr, __le32 val)
{
	unsigned int ep;
	int alen;

	if (type & 0x0800)
		ep = usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV);
	else
		ep = usb_sndbulkpipe(priv->udev, P54U_PIPE_BRG);

	buf->port = cpu_to_le16(type);
	buf->addr = addr;
	buf->val = val;

	return usb_bulk_msg(priv->udev, ep, buf, sizeof(*buf), &alen, 1000);
}

static int p54u_read(struct p54u_priv *priv, void *buf,
		     enum net2280_op_type type,
		     __le32 addr, __le32 *val)
{
	struct net2280_reg_read *read = buf;
	__le32 *reg = buf;
	unsigned int ep;
	int alen, err;

	if (type & 0x0800)
		ep = P54U_PIPE_DEV;
	else
		ep = P54U_PIPE_BRG;

	read->port = cpu_to_le16(type);
	read->addr = addr;

	err = usb_bulk_msg(priv->udev, usb_sndbulkpipe(priv->udev, ep),
			   read, sizeof(*read), &alen, 1000);
	if (err)
		return err;

	err = usb_bulk_msg(priv->udev, usb_rcvbulkpipe(priv->udev, ep),
			   reg, sizeof(*reg), &alen, 1000);
	if (err)
		return err;

	*val = *reg;
	return 0;
}

static int p54u_bulk_msg(struct p54u_priv *priv, unsigned int ep,
			 void *data, size_t len)
{
	int alen;
	return usb_bulk_msg(priv->udev, usb_sndbulkpipe(priv->udev, ep),
			    data, len, &alen, 2000);
}

447
static int p54u_device_reset(struct ieee80211_hw *dev)
448 449
{
	struct p54u_priv *priv = dev->priv;
450
	int ret, lock = (priv->intf->condition != USB_INTERFACE_BINDING);
451

452 453 454 455
	if (lock) {
		ret = usb_lock_device_for_reset(priv->udev, priv->intf);
		if (ret < 0) {
			dev_err(&priv->udev->dev, "(p54usb) unable to lock "
456
				"device for reset (%d)!\n", ret);
457 458
			return ret;
		}
459 460 461 462 463 464
	}

	ret = usb_reset_device(priv->udev);
	if (lock)
		usb_unlock_device(priv->udev);

465
	if (ret)
466
		dev_err(&priv->udev->dev, "(p54usb) unable to reset "
467 468 469 470 471 472 473 474 475
			"device (%d)!\n", ret);

	return ret;
}

static const char p54u_romboot_3887[] = "~~~~";
static int p54u_firmware_reset_3887(struct ieee80211_hw *dev)
{
	struct p54u_priv *priv = dev->priv;
476
	u8 *buf;
477
	int ret;
478

479
	buf = kmemdup(p54u_romboot_3887, 4, GFP_KERNEL);
480 481
	if (!buf)
		return -ENOMEM;
482
	ret = p54u_bulk_msg(priv, P54U_PIPE_DATA,
483 484
			    buf, 4);
	kfree(buf);
485 486
	if (ret)
		dev_err(&priv->udev->dev, "(p54usb) unable to jump to "
487
			"boot ROM (%d)!\n", ret);
488 489 490 491

	return ret;
}

492
static const char p54u_firmware_upload_3887[] = "<\r";
493 494 495 496 497
static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
{
	struct p54u_priv *priv = dev->priv;
	int err, alen;
	u8 carry = 0;
498 499
	u8 *buf, *tmp;
	const u8 *data;
500 501 502 503
	unsigned int left, remains, block_size;
	struct x2_header *hdr;
	unsigned long timeout;

504 505 506 507
	err = p54u_firmware_reset_3887(dev);
	if (err)
		return err;

508 509
	tmp = buf = kmalloc(P54U_FW_BLOCK, GFP_KERNEL);
	if (!buf) {
C
Christian Lamparter 已提交
510 511
		dev_err(&priv->udev->dev, "(p54usb) cannot allocate firmware"
					  "upload buffer!\n");
512
		return -ENOMEM;
513 514
	}

515
	left = block_size = min((size_t)P54U_FW_BLOCK, priv->fw->size);
516 517 518
	strcpy(buf, p54u_firmware_upload_3887);
	left -= strlen(p54u_firmware_upload_3887);
	tmp += strlen(p54u_firmware_upload_3887);
519

520 521
	data = priv->fw->data;
	remains = priv->fw->size;
522

523
	hdr = (struct x2_header *)(buf + strlen(p54u_firmware_upload_3887));
524 525
	memcpy(hdr->signature, X2_SIGNATURE, X2_SIGNATURE_SIZE);
	hdr->fw_load_addr = cpu_to_le32(ISL38XX_DEV_FIRMWARE_ADDR);
526
	hdr->fw_length = cpu_to_le32(priv->fw->size);
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
	hdr->crc = cpu_to_le32(~crc32_le(~0, (void *)&hdr->fw_load_addr,
					 sizeof(u32)*2));
	left -= sizeof(*hdr);
	tmp += sizeof(*hdr);

	while (remains) {
		while (left--) {
			if (carry) {
				*tmp++ = carry;
				carry = 0;
				remains--;
				continue;
			}
			switch (*data) {
			case '~':
				*tmp++ = '}';
				carry = '^';
				break;
			case '}':
				*tmp++ = '}';
				carry = ']';
				break;
			default:
				*tmp++ = *data;
				remains--;
				break;
			}
			data++;
		}

		err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_size);
		if (err) {
C
Christian Lamparter 已提交
559 560
			dev_err(&priv->udev->dev, "(p54usb) firmware "
						  "upload failed!\n");
561 562 563 564 565 566 567
			goto err_upload_failed;
		}

		tmp = buf;
		left = block_size = min((unsigned int)P54U_FW_BLOCK, remains);
	}

568 569
	*((__le32 *)buf) = cpu_to_le32(~crc32_le(~0, priv->fw->data,
						 priv->fw->size));
570 571
	err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, sizeof(u32));
	if (err) {
C
Christian Lamparter 已提交
572
		dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n");
573 574 575 576 577 578 579 580 581 582 583 584 585 586
		goto err_upload_failed;
	}
	timeout = jiffies + msecs_to_jiffies(1000);
	while (!(err = usb_bulk_msg(priv->udev,
		usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA), buf, 128, &alen, 1000))) {
		if (alen > 2 && !memcmp(buf, "OK", 2))
			break;

		if (alen > 5 && !memcmp(buf, "ERROR", 5)) {
			err = -EINVAL;
			break;
		}

		if (time_after(jiffies, timeout)) {
C
Christian Lamparter 已提交
587 588
			dev_err(&priv->udev->dev, "(p54usb) firmware boot "
						  "timed out!\n");
589 590 591 592
			err = -ETIMEDOUT;
			break;
		}
	}
C
Christian Lamparter 已提交
593 594
	if (err) {
		dev_err(&priv->udev->dev, "(p54usb) firmware upload failed!\n");
595
		goto err_upload_failed;
C
Christian Lamparter 已提交
596
	}
597 598 599 600 601

	buf[0] = 'g';
	buf[1] = '\r';
	err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, 2);
	if (err) {
C
Christian Lamparter 已提交
602
		dev_err(&priv->udev->dev, "(p54usb) firmware boot failed!\n");
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
		goto err_upload_failed;
	}

	timeout = jiffies + msecs_to_jiffies(1000);
	while (!(err = usb_bulk_msg(priv->udev,
		usb_rcvbulkpipe(priv->udev, P54U_PIPE_DATA), buf, 128, &alen, 1000))) {
		if (alen > 0 && buf[0] == 'g')
			break;

		if (time_after(jiffies, timeout)) {
			err = -ETIMEDOUT;
			break;
		}
	}
	if (err)
		goto err_upload_failed;

620
err_upload_failed:
621 622 623 624 625 626 627 628 629 630 631 632
	kfree(buf);
	return err;
}

static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)
{
	struct p54u_priv *priv = dev->priv;
	const struct p54p_csr *devreg = (const struct p54p_csr *) P54U_DEV_BASE;
	int err, alen;
	void *buf;
	__le32 reg;
	unsigned int remains, offset;
633
	const u8 *data;
634 635 636

	buf = kmalloc(512, GFP_KERNEL);
	if (!buf) {
C
Christian Lamparter 已提交
637 638
		dev_err(&priv->udev->dev, "(p54usb) firmware buffer "
					  "alloc failed!\n");
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
		return -ENOMEM;
	}

#define P54U_WRITE(type, addr, data) \
	do {\
		err = p54u_write(priv, buf, type,\
				 cpu_to_le32((u32)(unsigned long)addr), data);\
		if (err) \
			goto fail;\
	} while (0)

#define P54U_READ(type, addr) \
	do {\
		err = p54u_read(priv, buf, type,\
				cpu_to_le32((u32)(unsigned long)addr), &reg);\
		if (err)\
			goto fail;\
	} while (0)

	/* power down net2280 bridge */
	P54U_READ(NET2280_BRG_U32, NET2280_GPIOCTL);
	reg |= cpu_to_le32(P54U_BRG_POWER_DOWN);
	reg &= cpu_to_le32(~P54U_BRG_POWER_UP);
	P54U_WRITE(NET2280_BRG_U32, NET2280_GPIOCTL, reg);

	mdelay(100);

	/* power up bridge */
	reg |= cpu_to_le32(P54U_BRG_POWER_UP);
	reg &= cpu_to_le32(~P54U_BRG_POWER_DOWN);
	P54U_WRITE(NET2280_BRG_U32, NET2280_GPIOCTL, reg);

	mdelay(100);

	P54U_WRITE(NET2280_BRG_U32, NET2280_DEVINIT,
		   cpu_to_le32(NET2280_CLK_30Mhz |
			       NET2280_PCI_ENABLE |
			       NET2280_PCI_SOFT_RESET));

	mdelay(20);

	P54U_WRITE(NET2280_BRG_CFG_U16, PCI_COMMAND,
		   cpu_to_le32(PCI_COMMAND_MEMORY |
			       PCI_COMMAND_MASTER));

	P54U_WRITE(NET2280_BRG_CFG_U32, PCI_BASE_ADDRESS_0,
		   cpu_to_le32(NET2280_BASE));

	P54U_READ(NET2280_BRG_CFG_U16, PCI_STATUS);
	reg |= cpu_to_le32(PCI_STATUS_REC_MASTER_ABORT);
	P54U_WRITE(NET2280_BRG_CFG_U16, PCI_STATUS, reg);

	// TODO: we really need this?
	P54U_READ(NET2280_BRG_U32, NET2280_RELNUM);

	P54U_WRITE(NET2280_BRG_U32, NET2280_EPA_RSP,
		   cpu_to_le32(NET2280_CLEAR_NAK_OUT_PACKETS_MODE));
	P54U_WRITE(NET2280_BRG_U32, NET2280_EPC_RSP,
		   cpu_to_le32(NET2280_CLEAR_NAK_OUT_PACKETS_MODE));

	P54U_WRITE(NET2280_BRG_CFG_U32, PCI_BASE_ADDRESS_2,
		   cpu_to_le32(NET2280_BASE2));

	/* finally done setting up the bridge */

	P54U_WRITE(NET2280_DEV_CFG_U16, 0x10000 | PCI_COMMAND,
		   cpu_to_le32(PCI_COMMAND_MEMORY |
			       PCI_COMMAND_MASTER));

	P54U_WRITE(NET2280_DEV_CFG_U16, 0x10000 | 0x40 /* TRDY timeout */, 0);
	P54U_WRITE(NET2280_DEV_CFG_U32, 0x10000 | PCI_BASE_ADDRESS_0,
		   cpu_to_le32(P54U_DEV_BASE));

	P54U_WRITE(NET2280_BRG_U32, NET2280_USBIRQENB1, 0);
	P54U_WRITE(NET2280_BRG_U32, NET2280_IRQSTAT1,
		   cpu_to_le32(NET2280_PCI_INTA_INTERRUPT));

	/* do romboot */
	P54U_WRITE(NET2280_DEV_U32, &devreg->int_enable, 0);

	P54U_READ(NET2280_DEV_U32, &devreg->ctrl_stat);
	reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET);
	reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RAMBOOT);
	reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_CLKRUN);
	P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg);

	mdelay(20);

	reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET);
	P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg);

	mdelay(20);

	reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET);
	P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg);

	mdelay(100);

	P54U_READ(NET2280_DEV_U32, &devreg->int_ident);
	P54U_WRITE(NET2280_DEV_U32, &devreg->int_ack, reg);

	/* finally, we can upload firmware now! */
741 742
	remains = priv->fw->size;
	data = priv->fw->data;
743 744 745 746 747 748 749 750
	offset = ISL38XX_DEV_FIRMWARE_ADDR;

	while (remains) {
		unsigned int block_len = min(remains, (unsigned int)512);
		memcpy(buf, data, block_len);

		err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, block_len);
		if (err) {
C
Christian Lamparter 已提交
751 752
			dev_err(&priv->udev->dev, "(p54usb) firmware block "
						  "upload failed\n");
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784
			goto fail;
		}

		P54U_WRITE(NET2280_DEV_U32, &devreg->direct_mem_base,
			   cpu_to_le32(0xc0000f00));

		P54U_WRITE(NET2280_DEV_U32,
			   0x0020 | (unsigned long)&devreg->direct_mem_win, 0);
		P54U_WRITE(NET2280_DEV_U32,
			   0x0020 | (unsigned long)&devreg->direct_mem_win,
			   cpu_to_le32(1));

		P54U_WRITE(NET2280_DEV_U32,
			   0x0024 | (unsigned long)&devreg->direct_mem_win,
			   cpu_to_le32(block_len));
		P54U_WRITE(NET2280_DEV_U32,
			   0x0028 | (unsigned long)&devreg->direct_mem_win,
			   cpu_to_le32(offset));

		P54U_WRITE(NET2280_DEV_U32, &devreg->dma_addr,
			   cpu_to_le32(NET2280_EPA_FIFO_PCI_ADDR));
		P54U_WRITE(NET2280_DEV_U32, &devreg->dma_len,
			   cpu_to_le32(block_len >> 2));
		P54U_WRITE(NET2280_DEV_U32, &devreg->dma_ctrl,
			   cpu_to_le32(ISL38XX_DMA_MASTER_CONTROL_TRIGGER));

		mdelay(10);

		P54U_READ(NET2280_DEV_U32,
			  0x002C | (unsigned long)&devreg->direct_mem_win);
		if (!(reg & cpu_to_le32(ISL38XX_DMA_STATUS_DONE)) ||
		    !(reg & cpu_to_le32(ISL38XX_DMA_STATUS_READY))) {
C
Christian Lamparter 已提交
785 786
			dev_err(&priv->udev->dev, "(p54usb) firmware DMA "
						  "transfer failed\n");
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850
			goto fail;
		}

		P54U_WRITE(NET2280_BRG_U32, NET2280_EPA_STAT,
			   cpu_to_le32(NET2280_FIFO_FLUSH));

		remains -= block_len;
		data += block_len;
		offset += block_len;
	}

	/* do ramboot */
	P54U_READ(NET2280_DEV_U32, &devreg->ctrl_stat);
	reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET);
	reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_CLKRUN);
	reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RAMBOOT);
	P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg);

	mdelay(20);

	reg |= cpu_to_le32(ISL38XX_CTRL_STAT_RESET);
	P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg);

	reg &= cpu_to_le32(~ISL38XX_CTRL_STAT_RESET);
	P54U_WRITE(NET2280_DEV_U32, &devreg->ctrl_stat, reg);

	mdelay(100);

	P54U_READ(NET2280_DEV_U32, &devreg->int_ident);
	P54U_WRITE(NET2280_DEV_U32, &devreg->int_ack, reg);

	/* start up the firmware */
	P54U_WRITE(NET2280_DEV_U32, &devreg->int_enable,
		   cpu_to_le32(ISL38XX_INT_IDENT_INIT));

	P54U_WRITE(NET2280_BRG_U32, NET2280_IRQSTAT1,
		   cpu_to_le32(NET2280_PCI_INTA_INTERRUPT));

	P54U_WRITE(NET2280_BRG_U32, NET2280_USBIRQENB1,
		   cpu_to_le32(NET2280_PCI_INTA_INTERRUPT_ENABLE |
			       NET2280_USB_INTERRUPT_ENABLE));

	P54U_WRITE(NET2280_DEV_U32, &devreg->dev_int,
		   cpu_to_le32(ISL38XX_DEV_INT_RESET));

	err = usb_interrupt_msg(priv->udev,
				usb_rcvbulkpipe(priv->udev, P54U_PIPE_INT),
				buf, sizeof(__le32), &alen, 1000);
	if (err || alen != sizeof(__le32))
		goto fail;

	P54U_READ(NET2280_DEV_U32, &devreg->int_ident);
	P54U_WRITE(NET2280_DEV_U32, &devreg->int_ack, reg);

	if (!(reg & cpu_to_le32(ISL38XX_INT_IDENT_INIT)))
		err = -EINVAL;

	P54U_WRITE(NET2280_BRG_U32, NET2280_USBIRQENB1, 0);
	P54U_WRITE(NET2280_BRG_U32, NET2280_IRQSTAT1,
		   cpu_to_le32(NET2280_PCI_INTA_INTERRUPT));

#undef P54U_WRITE
#undef P54U_READ

851
fail:
852 853 854 855
	kfree(buf);
	return err;
}

856
static int p54_find_type(struct p54u_priv *priv)
857
{
858
	int i;
859 860 861 862 863 864 865

	for (i = 0; i < __NUM_P54U_HWTYPES; i++)
		if (p54u_fwlist[i].type == priv->hw_type)
			break;
	if (i == __NUM_P54U_HWTYPES)
		return -EOPNOTSUPP;

866 867
	return i;
}
868

869 870 871 872
static int p54u_start_ops(struct p54u_priv *priv)
{
	struct ieee80211_hw *dev = priv->common.hw;
	int ret;
873

874 875 876 877 878 879 880
	ret = p54_parse_firmware(dev, priv->fw);
	if (ret)
		goto err_out;

	ret = p54_find_type(priv);
	if (ret < 0)
		goto err_out;
881

882
	if (priv->common.fw_interface != p54u_fwlist[ret].intf) {
883 884
		dev_err(&priv->udev->dev, "wrong firmware, please get "
			"a firmware for \"%s\" and try again.\n",
885 886 887
			p54u_fwlist[ret].hw);
		ret = -ENODEV;
		goto err_out;
888 889
	}

890 891 892
	ret = priv->upload_fw(dev);
	if (ret)
		goto err_out;
893

894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918
	ret = p54u_open(dev);
	if (ret)
		goto err_out;

	ret = p54_read_eeprom(dev);
	if (ret)
		goto err_stop;

	p54u_stop(dev);

	ret = p54_register_common(dev, &priv->udev->dev);
	if (ret)
		goto err_stop;

	return 0;

err_stop:
	p54u_stop(dev);

err_out:
	/*
	 * p54u_disconnect will do the rest of the
	 * cleanup
	 */
	return ret;
919 920
}

921 922
static void p54u_load_firmware_cb(const struct firmware *firmware,
				  void *context)
923
{
924 925
	struct p54u_priv *priv = context;
	struct usb_device *udev = priv->udev;
926 927
	int err;

928 929 930 931 932 933 934
	complete(&priv->fw_wait_load);
	if (firmware) {
		priv->fw = firmware;
		err = p54u_start_ops(priv);
	} else {
		err = -ENOENT;
		dev_err(&udev->dev, "Firmware not found.\n");
935 936
	}

937 938
	if (err) {
		struct device *parent = priv->udev->dev.parent;
939

940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
		dev_err(&udev->dev, "failed to initialize device (%d)\n", err);

		if (parent)
			device_lock(parent);

		device_release_driver(&udev->dev);
		/*
		 * At this point p54u_disconnect has already freed
		 * the "priv" context. Do not use it anymore!
		 */
		priv = NULL;

		if (parent)
			device_unlock(parent);
	}

	usb_put_dev(udev);
957 958
}

959 960
static int p54u_load_firmware(struct ieee80211_hw *dev,
			      struct usb_interface *intf)
961
{
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986
	struct usb_device *udev = interface_to_usbdev(intf);
	struct p54u_priv *priv = dev->priv;
	struct device *device = &udev->dev;
	int err, i;

	BUILD_BUG_ON(ARRAY_SIZE(p54u_fwlist) != __NUM_P54U_HWTYPES);

	init_completion(&priv->fw_wait_load);
	i = p54_find_type(priv);
	if (i < 0)
		return i;

	dev_info(&priv->udev->dev, "Loading firmware file %s\n",
	       p54u_fwlist[i].fw);

	usb_get_dev(udev);
	err = request_firmware_nowait(THIS_MODULE, 1, p54u_fwlist[i].fw,
				      device, GFP_KERNEL, priv,
				      p54u_load_firmware_cb);
	if (err) {
		dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s "
					  "(%d)!\n", p54u_fwlist[i].fw, err);
	}

	return err;
987 988
}

B
Bill Pemberton 已提交
989
static int p54u_probe(struct usb_interface *intf,
990 991 992 993 994 995 996 997 998
				const struct usb_device_id *id)
{
	struct usb_device *udev = interface_to_usbdev(intf);
	struct ieee80211_hw *dev;
	struct p54u_priv *priv;
	int err;
	unsigned int i, recognized_pipes;

	dev = p54_init_common(sizeof(*priv));
C
Christian Lamparter 已提交
999

1000
	if (!dev) {
C
Christian Lamparter 已提交
1001
		dev_err(&udev->dev, "(p54usb) ieee80211 alloc failed\n");
1002 1003 1004 1005
		return -ENOMEM;
	}

	priv = dev->priv;
1006
	priv->hw_type = P54U_INVALID_HW;
1007 1008 1009 1010

	SET_IEEE80211_DEV(dev, &intf->dev);
	usb_set_intfdata(intf, dev);
	priv->udev = udev;
1011 1012 1013
	priv->intf = intf;
	skb_queue_head_init(&priv->rx_queue);
	init_usb_anchor(&priv->submitted);
1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035

	usb_get_dev(udev);

	/* really lazy and simple way of figuring out if we're a 3887 */
	/* TODO: should just stick the identification in the device table */
	i = intf->altsetting->desc.bNumEndpoints;
	recognized_pipes = 0;
	while (i--) {
		switch (intf->altsetting->endpoint[i].desc.bEndpointAddress) {
		case P54U_PIPE_DATA:
		case P54U_PIPE_MGMT:
		case P54U_PIPE_BRG:
		case P54U_PIPE_DEV:
		case P54U_PIPE_DATA | USB_DIR_IN:
		case P54U_PIPE_MGMT | USB_DIR_IN:
		case P54U_PIPE_BRG | USB_DIR_IN:
		case P54U_PIPE_DEV | USB_DIR_IN:
		case P54U_PIPE_INT | USB_DIR_IN:
			recognized_pipes++;
		}
	}
	priv->common.open = p54u_open;
1036
	priv->common.stop = p54u_stop;
1037
	if (recognized_pipes < P54U_PIPE_NUMBER) {
1038
#ifdef CONFIG_PM
1039 1040
		/* ISL3887 needs a full reset on resume */
		udev->reset_resume = 1;
1041
#endif /* CONFIG_PM */
1042 1043
		err = p54u_device_reset(dev);

1044
		priv->hw_type = P54U_3887;
1045 1046 1047
		dev->extra_tx_headroom += sizeof(struct lm87_tx_hdr);
		priv->common.tx_hdr_len = sizeof(struct lm87_tx_hdr);
		priv->common.tx = p54u_tx_lm87;
1048
		priv->upload_fw = p54u_upload_firmware_3887;
1049
	} else {
1050
		priv->hw_type = P54U_NET2280;
1051 1052 1053
		dev->extra_tx_headroom += sizeof(struct net2280_tx_hdr);
		priv->common.tx_hdr_len = sizeof(struct net2280_tx_hdr);
		priv->common.tx = p54u_tx_net2280;
1054
		priv->upload_fw = p54u_upload_firmware_net2280;
1055
	}
1056
	err = p54u_load_firmware(dev, intf);
1057 1058 1059
	return err;
}

B
Bill Pemberton 已提交
1060
static void p54u_disconnect(struct usb_interface *intf)
1061 1062 1063 1064 1065 1066 1067
{
	struct ieee80211_hw *dev = usb_get_intfdata(intf);
	struct p54u_priv *priv;

	if (!dev)
		return;

1068 1069
	priv = dev->priv;
	wait_for_completion(&priv->fw_wait_load);
1070
	p54_unregister_common(dev);
1071 1072

	usb_put_dev(interface_to_usbdev(intf));
1073
	release_firmware(priv->fw);
1074 1075 1076
	p54_free_common(dev);
}

1077 1078
static int p54u_pre_reset(struct usb_interface *intf)
{
1079 1080 1081 1082 1083 1084
	struct ieee80211_hw *dev = usb_get_intfdata(intf);

	if (!dev)
		return -ENODEV;

	p54u_stop(dev);
1085 1086 1087
	return 0;
}

1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102
static int p54u_resume(struct usb_interface *intf)
{
	struct ieee80211_hw *dev = usb_get_intfdata(intf);
	struct p54u_priv *priv;

	if (!dev)
		return -ENODEV;

	priv = dev->priv;
	if (unlikely(!(priv->upload_fw && priv->fw)))
		return 0;

	return priv->upload_fw(dev);
}

1103 1104
static int p54u_post_reset(struct usb_interface *intf)
{
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117
	struct ieee80211_hw *dev = usb_get_intfdata(intf);
	struct p54u_priv *priv;
	int err;

	err = p54u_resume(intf);
	if (err)
		return err;

	/* reinitialize old device state */
	priv = dev->priv;
	if (priv->common.mode != NL80211_IFTYPE_UNSPECIFIED)
		ieee80211_restart_hw(dev);

1118 1119 1120
	return 0;
}

1121 1122 1123 1124 1125 1126 1127 1128 1129
#ifdef CONFIG_PM

static int p54u_suspend(struct usb_interface *intf, pm_message_t message)
{
	return p54u_pre_reset(intf);
}

#endif /* CONFIG_PM */

1130
static struct usb_driver p54u_driver = {
1131
	.name	= "p54usb",
1132 1133
	.id_table = p54u_table,
	.probe = p54u_probe,
B
Bill Pemberton 已提交
1134
	.disconnect = p54u_disconnect,
1135 1136
	.pre_reset = p54u_pre_reset,
	.post_reset = p54u_post_reset,
1137 1138 1139 1140 1141
#ifdef CONFIG_PM
	.suspend = p54u_suspend,
	.resume = p54u_resume,
	.reset_resume = p54u_resume,
#endif /* CONFIG_PM */
1142
	.soft_unbind = 1,
1143
	.disable_hub_initiated_lpm = 1,
1144 1145
};

1146
module_usb_driver(p54u_driver);