diff options
author | Hin-Tak Leung <hintak.leung@gmail.com> | 2008-07-08 07:33:34 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-07-08 14:16:07 -0400 |
commit | f8a08c34265b59710a8fc049911f487477c19fab (patch) | |
tree | f4feb9c34efdae99293a4b9ba8e2afdb89e85e35 /drivers/net/wireless/rtl8187_dev.c | |
parent | e7d414ff21a7e0b00295e838c004ff1de5fba6ce (diff) |
rtl8187: change rtl8187_dev.c to support RTL8187B (part 1)
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtl8187_dev.c')
-rw-r--r-- | drivers/net/wireless/rtl8187_dev.c | 263 |
1 files changed, 234 insertions, 29 deletions
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index bec96d762c6c..b17f237c9e28 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
@@ -27,19 +27,21 @@ | |||
27 | 27 | ||
28 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); | 28 | MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>"); |
29 | MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); | 29 | MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); |
30 | MODULE_DESCRIPTION("RTL8187 USB wireless driver"); | 30 | MODULE_DESCRIPTION("RTL8187/RTL8187B USB wireless driver"); |
31 | MODULE_LICENSE("GPL"); | 31 | MODULE_LICENSE("GPL"); |
32 | 32 | ||
33 | static struct usb_device_id rtl8187_table[] __devinitdata = { | 33 | static struct usb_device_id rtl8187_table[] __devinitdata = { |
34 | /* Realtek */ | 34 | /* Realtek */ |
35 | {USB_DEVICE(0x0bda, 0x8187)}, | 35 | {USB_DEVICE(0x0bda, 0x8187), .driver_info = DEVICE_RTL8187}, |
36 | {USB_DEVICE(0x0bda, 0x8189), .driver_info = DEVICE_RTL8187B}, | ||
37 | {USB_DEVICE(0x0bda, 0x8197), .driver_info = DEVICE_RTL8187B}, | ||
36 | /* Netgear */ | 38 | /* Netgear */ |
37 | {USB_DEVICE(0x0846, 0x6100)}, | 39 | {USB_DEVICE(0x0846, 0x6100), .driver_info = DEVICE_RTL8187}, |
38 | {USB_DEVICE(0x0846, 0x6a00)}, | 40 | {USB_DEVICE(0x0846, 0x6a00), .driver_info = DEVICE_RTL8187}, |
39 | /* HP */ | 41 | /* HP */ |
40 | {USB_DEVICE(0x03f0, 0xca02)}, | 42 | {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187}, |
41 | /* Sitecom */ | 43 | /* Sitecom */ |
42 | {USB_DEVICE(0x0df6, 0x000d)}, | 44 | {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187}, |
43 | {} | 45 | {} |
44 | }; | 46 | }; |
45 | 47 | ||
@@ -318,29 +320,12 @@ static int rtl8187_init_urbs(struct ieee80211_hw *dev) | |||
318 | return 0; | 320 | return 0; |
319 | } | 321 | } |
320 | 322 | ||
321 | static int rtl8187_init_hw(struct ieee80211_hw *dev) | 323 | static int rtl8187_cmd_reset(struct ieee80211_hw *dev) |
322 | { | 324 | { |
323 | struct rtl8187_priv *priv = dev->priv; | 325 | struct rtl8187_priv *priv = dev->priv; |
324 | u8 reg; | 326 | u8 reg; |
325 | int i; | 327 | int i; |
326 | 328 | ||
327 | /* reset */ | ||
328 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); | ||
329 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); | ||
330 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE); | ||
331 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM, RTL8225_ANAPARAM_ON); | ||
332 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_ON); | ||
333 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); | ||
334 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); | ||
335 | |||
336 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); | ||
337 | |||
338 | msleep(200); | ||
339 | rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x10); | ||
340 | rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x11); | ||
341 | rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x00); | ||
342 | msleep(200); | ||
343 | |||
344 | reg = rtl818x_ioread8(priv, &priv->map->CMD); | 329 | reg = rtl818x_ioread8(priv, &priv->map->CMD); |
345 | reg &= (1 << 1); | 330 | reg &= (1 << 1); |
346 | reg |= RTL818X_CMD_RESET; | 331 | reg |= RTL818X_CMD_RESET; |
@@ -376,12 +361,48 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev) | |||
376 | return -ETIMEDOUT; | 361 | return -ETIMEDOUT; |
377 | } | 362 | } |
378 | 363 | ||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | static int rtl8187_init_hw(struct ieee80211_hw *dev) | ||
368 | { | ||
369 | struct rtl8187_priv *priv = dev->priv; | ||
370 | u8 reg; | ||
371 | int res; | ||
372 | |||
373 | /* reset */ | ||
374 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
375 | RTL818X_EEPROM_CMD_CONFIG); | ||
376 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); | ||
377 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | | ||
378 | RTL818X_CONFIG3_ANAPARAM_WRITE); | ||
379 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM, RTL8225_ANAPARAM_ON); | ||
380 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_ON); | ||
381 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & | ||
382 | ~RTL818X_CONFIG3_ANAPARAM_WRITE); | ||
383 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
384 | RTL818X_EEPROM_CMD_NORMAL); | ||
385 | |||
386 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0); | ||
387 | |||
388 | msleep(200); | ||
389 | rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x10); | ||
390 | rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x11); | ||
391 | rtl818x_iowrite8(priv, (u8 *)0xFE18, 0x00); | ||
392 | msleep(200); | ||
393 | |||
394 | res = rtl8187_cmd_reset(dev); | ||
395 | if (res) | ||
396 | return res; | ||
397 | |||
379 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); | 398 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); |
380 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); | 399 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); |
381 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg | RTL818X_CONFIG3_ANAPARAM_WRITE); | 400 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, |
401 | reg | RTL818X_CONFIG3_ANAPARAM_WRITE); | ||
382 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM, RTL8225_ANAPARAM_ON); | 402 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM, RTL8225_ANAPARAM_ON); |
383 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_ON); | 403 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, RTL8225_ANAPARAM2_ON); |
384 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); | 404 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, |
405 | reg & ~RTL818X_CONFIG3_ANAPARAM_WRITE); | ||
385 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); | 406 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); |
386 | 407 | ||
387 | /* setup card */ | 408 | /* setup card */ |
@@ -426,9 +447,11 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev) | |||
426 | rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008); | 447 | rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x000a8008); |
427 | rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF); | 448 | rtl818x_iowrite16(priv, &priv->map->BRSR, 0xFFFF); |
428 | rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044); | 449 | rtl818x_iowrite32(priv, &priv->map->RF_PARA, 0x00100044); |
429 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); | 450 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, |
451 | RTL818X_EEPROM_CMD_CONFIG); | ||
430 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44); | 452 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, 0x44); |
431 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL); | 453 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, |
454 | RTL818X_EEPROM_CMD_NORMAL); | ||
432 | rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FF7); | 455 | rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FF7); |
433 | msleep(100); | 456 | msleep(100); |
434 | 457 | ||
@@ -445,16 +468,198 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev) | |||
445 | return 0; | 468 | return 0; |
446 | } | 469 | } |
447 | 470 | ||
471 | static const u8 rtl8187b_reg_table[][3] = { | ||
472 | {0xF0, 0x32, 0}, {0xF1, 0x32, 0}, {0xF2, 0x00, 0}, {0xF3, 0x00, 0}, | ||
473 | {0xF4, 0x32, 0}, {0xF5, 0x43, 0}, {0xF6, 0x00, 0}, {0xF7, 0x00, 0}, | ||
474 | {0xF8, 0x46, 0}, {0xF9, 0xA4, 0}, {0xFA, 0x00, 0}, {0xFB, 0x00, 0}, | ||
475 | {0xFC, 0x96, 0}, {0xFD, 0xA4, 0}, {0xFE, 0x00, 0}, {0xFF, 0x00, 0}, | ||
476 | |||
477 | {0x58, 0x4B, 1}, {0x59, 0x00, 1}, {0x5A, 0x4B, 1}, {0x5B, 0x00, 1}, | ||
478 | {0x60, 0x4B, 1}, {0x61, 0x09, 1}, {0x62, 0x4B, 1}, {0x63, 0x09, 1}, | ||
479 | {0xCE, 0x0F, 1}, {0xCF, 0x00, 1}, {0xE0, 0xFF, 1}, {0xE1, 0x0F, 1}, | ||
480 | {0xE2, 0x00, 1}, {0xF0, 0x4E, 1}, {0xF1, 0x01, 1}, {0xF2, 0x02, 1}, | ||
481 | {0xF3, 0x03, 1}, {0xF4, 0x04, 1}, {0xF5, 0x05, 1}, {0xF6, 0x06, 1}, | ||
482 | {0xF7, 0x07, 1}, {0xF8, 0x08, 1}, | ||
483 | |||
484 | {0x4E, 0x00, 2}, {0x0C, 0x04, 2}, {0x21, 0x61, 2}, {0x22, 0x68, 2}, | ||
485 | {0x23, 0x6F, 2}, {0x24, 0x76, 2}, {0x25, 0x7D, 2}, {0x26, 0x84, 2}, | ||
486 | {0x27, 0x8D, 2}, {0x4D, 0x08, 2}, {0x50, 0x05, 2}, {0x51, 0xF5, 2}, | ||
487 | {0x52, 0x04, 2}, {0x53, 0xA0, 2}, {0x54, 0x1F, 2}, {0x55, 0x23, 2}, | ||
488 | {0x56, 0x45, 2}, {0x57, 0x67, 2}, {0x58, 0x08, 2}, {0x59, 0x08, 2}, | ||
489 | {0x5A, 0x08, 2}, {0x5B, 0x08, 2}, {0x60, 0x08, 2}, {0x61, 0x08, 2}, | ||
490 | {0x62, 0x08, 2}, {0x63, 0x08, 2}, {0x64, 0xCF, 2}, {0x72, 0x56, 2}, | ||
491 | {0x73, 0x9A, 2}, | ||
492 | |||
493 | {0x34, 0xF0, 0}, {0x35, 0x0F, 0}, {0x5B, 0x40, 0}, {0x84, 0x88, 0}, | ||
494 | {0x85, 0x24, 0}, {0x88, 0x54, 0}, {0x8B, 0xB8, 0}, {0x8C, 0x07, 0}, | ||
495 | {0x8D, 0x00, 0}, {0x94, 0x1B, 0}, {0x95, 0x12, 0}, {0x96, 0x00, 0}, | ||
496 | {0x97, 0x06, 0}, {0x9D, 0x1A, 0}, {0x9F, 0x10, 0}, {0xB4, 0x22, 0}, | ||
497 | {0xBE, 0x80, 0}, {0xDB, 0x00, 0}, {0xEE, 0x00, 0}, {0x91, 0x03, 0}, | ||
498 | |||
499 | {0x4C, 0x00, 2}, {0x9F, 0x00, 3}, {0x8C, 0x01, 0}, {0x8D, 0x10, 0}, | ||
500 | {0x8E, 0x08, 0}, {0x8F, 0x00, 0} | ||
501 | }; | ||
502 | |||
503 | static int rtl8187b_init_hw(struct ieee80211_hw *dev) | ||
504 | { | ||
505 | struct rtl8187_priv *priv = dev->priv; | ||
506 | int res, i; | ||
507 | u8 reg; | ||
508 | |||
509 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
510 | RTL818X_EEPROM_CMD_CONFIG); | ||
511 | |||
512 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); | ||
513 | reg |= RTL818X_CONFIG3_ANAPARAM_WRITE | RTL818X_CONFIG3_GNT_SELECT; | ||
514 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg); | ||
515 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM2, 0x727f3f52); | ||
516 | rtl818x_iowrite32(priv, &priv->map->ANAPARAM, 0x45090658); | ||
517 | rtl818x_iowrite8(priv, &priv->map->ANAPARAM3, 0); | ||
518 | |||
519 | rtl818x_iowrite8(priv, (u8 *)0xFF61, 0x10); | ||
520 | reg = rtl818x_ioread8(priv, (u8 *)0xFF62); | ||
521 | rtl818x_iowrite8(priv, (u8 *)0xFF62, reg & ~(1 << 5)); | ||
522 | rtl818x_iowrite8(priv, (u8 *)0xFF62, reg | (1 << 5)); | ||
523 | |||
524 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); | ||
525 | reg &= ~RTL818X_CONFIG3_ANAPARAM_WRITE; | ||
526 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg); | ||
527 | |||
528 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
529 | RTL818X_EEPROM_CMD_NORMAL); | ||
530 | |||
531 | res = rtl8187_cmd_reset(dev); | ||
532 | if (res) | ||
533 | return res; | ||
534 | |||
535 | rtl818x_iowrite16(priv, (__le16 *)0xFF2D, 0x0FFF); | ||
536 | reg = rtl818x_ioread8(priv, &priv->map->CW_CONF); | ||
537 | reg |= RTL818X_CW_CONF_PERPACKET_RETRY_SHIFT; | ||
538 | rtl818x_iowrite8(priv, &priv->map->CW_CONF, reg); | ||
539 | reg = rtl818x_ioread8(priv, &priv->map->TX_AGC_CTL); | ||
540 | reg |= RTL818X_TX_AGC_CTL_PERPACKET_GAIN_SHIFT | | ||
541 | RTL818X_TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT; | ||
542 | rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg); | ||
543 | |||
544 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFFE0, 0x0FFF, 1); | ||
545 | reg = rtl818x_ioread8(priv, &priv->map->RATE_FALLBACK); | ||
546 | reg |= RTL818X_RATE_FALLBACK_ENABLE; | ||
547 | rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, reg); | ||
548 | |||
549 | rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100); | ||
550 | rtl818x_iowrite16(priv, &priv->map->ATIM_WND, 2); | ||
551 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFFD4, 0xFFFF, 1); | ||
552 | |||
553 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
554 | RTL818X_EEPROM_CMD_CONFIG); | ||
555 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG1); | ||
556 | rtl818x_iowrite8(priv, &priv->map->CONFIG1, (reg & 0x3F) | 0x80); | ||
557 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
558 | RTL818X_EEPROM_CMD_NORMAL); | ||
559 | |||
560 | rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0); | ||
561 | for (i = 0; i < ARRAY_SIZE(rtl8187b_reg_table); i++) { | ||
562 | rtl818x_iowrite8_idx(priv, | ||
563 | (u8 *)(uintptr_t) | ||
564 | (rtl8187b_reg_table[i][0] | 0xFF00), | ||
565 | rtl8187b_reg_table[i][1], | ||
566 | rtl8187b_reg_table[i][2]); | ||
567 | } | ||
568 | |||
569 | rtl818x_iowrite16(priv, &priv->map->TID_AC_MAP, 0xFA50); | ||
570 | rtl818x_iowrite16(priv, &priv->map->INT_MIG, 0); | ||
571 | |||
572 | rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF0, 0, 1); | ||
573 | rtl818x_iowrite32_idx(priv, (__le32 *)0xFFF4, 0, 1); | ||
574 | rtl818x_iowrite8_idx(priv, (u8 *)0xFFF8, 0, 1); | ||
575 | |||
576 | rtl818x_iowrite32(priv, &priv->map->RF_TIMING, 0x00004001); | ||
577 | |||
578 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x569A, 2); | ||
579 | |||
580 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
581 | RTL818X_EEPROM_CMD_CONFIG); | ||
582 | reg = rtl818x_ioread8(priv, &priv->map->CONFIG3); | ||
583 | reg |= RTL818X_CONFIG3_ANAPARAM_WRITE; | ||
584 | rtl818x_iowrite8(priv, &priv->map->CONFIG3, reg); | ||
585 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, | ||
586 | RTL818X_EEPROM_CMD_NORMAL); | ||
587 | |||
588 | rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, 0x0480); | ||
589 | rtl818x_iowrite16(priv, &priv->map->RFPinsSelect, 0x2488); | ||
590 | rtl818x_iowrite16(priv, &priv->map->RFPinsEnable, 0x1FFF); | ||
591 | msleep(1100); | ||
592 | |||
593 | priv->rf->init(dev); | ||
594 | |||
595 | reg = RTL818X_CMD_TX_ENABLE | RTL818X_CMD_RX_ENABLE; | ||
596 | rtl818x_iowrite8(priv, &priv->map->CMD, reg); | ||
597 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); | ||
598 | |||
599 | rtl818x_iowrite8(priv, (u8 *)0xFE41, 0xF4); | ||
600 | rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x00); | ||
601 | rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00); | ||
602 | rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01); | ||
603 | rtl818x_iowrite8(priv, (u8 *)0xFE40, 0x0F); | ||
604 | rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x00); | ||
605 | rtl818x_iowrite8(priv, (u8 *)0xFE42, 0x01); | ||
606 | |||
607 | reg = rtl818x_ioread8(priv, (u8 *)0xFFDB); | ||
608 | rtl818x_iowrite8(priv, (u8 *)0xFFDB, reg | (1 << 2)); | ||
609 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFF72, 0x59FA, 3); | ||
610 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFF74, 0x59D2, 3); | ||
611 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFF76, 0x59D2, 3); | ||
612 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFF78, 0x19FA, 3); | ||
613 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7A, 0x19FA, 3); | ||
614 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFF7C, 0x00D0, 3); | ||
615 | rtl818x_iowrite8(priv, (u8 *)0xFF61, 0); | ||
616 | rtl818x_iowrite8_idx(priv, (u8 *)0xFF80, 0x0F, 1); | ||
617 | rtl818x_iowrite8_idx(priv, (u8 *)0xFF83, 0x03, 1); | ||
618 | rtl818x_iowrite8(priv, (u8 *)0xFFDA, 0x10); | ||
619 | rtl818x_iowrite8_idx(priv, (u8 *)0xFF4D, 0x08, 2); | ||
620 | |||
621 | rtl818x_iowrite32(priv, &priv->map->HSSI_PARA, 0x0600321B); | ||
622 | |||
623 | rtl818x_iowrite16_idx(priv, (__le16 *)0xFFEC, 0x0800, 1); | ||
624 | |||
625 | return 0; | ||
626 | } | ||
627 | |||
448 | static int rtl8187_start(struct ieee80211_hw *dev) | 628 | static int rtl8187_start(struct ieee80211_hw *dev) |
449 | { | 629 | { |
450 | struct rtl8187_priv *priv = dev->priv; | 630 | struct rtl8187_priv *priv = dev->priv; |
451 | u32 reg; | 631 | u32 reg; |
452 | int ret; | 632 | int ret; |
453 | 633 | ||
454 | ret = rtl8187_init_hw(dev); | 634 | ret = (!priv->is_rtl8187b) ? rtl8187_init_hw(dev) : |
635 | rtl8187b_init_hw(dev); | ||
455 | if (ret) | 636 | if (ret) |
456 | return ret; | 637 | return ret; |
457 | 638 | ||
639 | if (priv->is_rtl8187b) { | ||
640 | reg = RTL818X_RX_CONF_MGMT | | ||
641 | RTL818X_RX_CONF_DATA | | ||
642 | RTL818X_RX_CONF_BROADCAST | | ||
643 | RTL818X_RX_CONF_NICMAC | | ||
644 | RTL818X_RX_CONF_BSSID | | ||
645 | (7 << 13 /* RX FIFO threshold NONE */) | | ||
646 | (7 << 10 /* MAX RX DMA */) | | ||
647 | RTL818X_RX_CONF_RX_AUTORESETPHY | | ||
648 | RTL818X_RX_CONF_ONLYERLPKT | | ||
649 | RTL818X_RX_CONF_MULTICAST; | ||
650 | priv->rx_conf = reg; | ||
651 | rtl818x_iowrite32(priv, &priv->map->RX_CONF, reg); | ||
652 | |||
653 | rtl818x_iowrite32(priv, &priv->map->TX_CONF, | ||
654 | RTL818X_TX_CONF_HW_SEQNUM | | ||
655 | RTL818X_TX_CONF_DISREQQSIZE | | ||
656 | (7 << 8 /* short retry limit */) | | ||
657 | (7 << 0 /* long retry limit */) | | ||
658 | (7 << 21 /* MAX TX DMA */)); | ||
659 | rtl8187_init_urbs(dev); | ||
660 | return 0; | ||
661 | } | ||
662 | |||
458 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); | 663 | rtl818x_iowrite16(priv, &priv->map->INT_MASK, 0xFFFF); |
459 | 664 | ||
460 | rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); | 665 | rtl818x_iowrite32(priv, &priv->map->MAR[0], ~0); |