Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

+390 -61
+364 -53
drivers/net/tg3.c
··· 66 66 67 67 #define DRV_MODULE_NAME "tg3" 68 68 #define PFX DRV_MODULE_NAME ": " 69 - #define DRV_MODULE_VERSION "3.33" 70 - #define DRV_MODULE_RELDATE "July 5, 2005" 69 + #define DRV_MODULE_VERSION "3.34" 70 + #define DRV_MODULE_RELDATE "July 25, 2005" 71 71 72 72 #define TG3_DEF_MAC_MODE 0 73 73 #define TG3_DEF_RX_MODE 0 ··· 90 90 /* hardware minimum and maximum for a single frame's data payload */ 91 91 #define TG3_MIN_MTU 60 92 92 #define TG3_MAX_MTU(tp) \ 93 - (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) ? 9000 : 1500) 93 + ((tp->tg3_flags2 & TG3_FLG2_JUMBO_CAPABLE) ? 9000 : 1500) 94 94 95 95 /* These numbers seem to be hard coded in the NIC firmware somehow. 96 96 * You can't change the ring sizes, but you can change where you place ··· 220 220 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5753M, 221 221 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 222 222 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5753F, 223 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 224 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780, 225 + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 226 + { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5780S, 223 227 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 224 228 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5781, 225 229 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, ··· 511 507 { 512 508 u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL); 513 509 u32 orig_clock_ctrl; 510 + 511 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) 512 + return; 514 513 515 514 orig_clock_ctrl = clock_ctrl; 516 515 clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN | ··· 914 907 if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) { 915 908 /* Cannot do read-modify-write on 5401 */ 916 909 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20); 917 - } else if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 910 + } else if (tp->tg3_flags2 & TG3_FLG2_JUMBO_CAPABLE) { 918 911 u32 phy_reg; 919 912 920 913 /* Set bit 14 with read-modify-write to preserve other bits */ ··· 926 919 /* Set phy register 0x10 bit 0 to high fifo elasticity to support 927 920 * jumbo frames transmission. 928 921 */ 929 - if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS)) { 922 + if (tp->tg3_flags2 & TG3_FLG2_JUMBO_CAPABLE) { 930 923 u32 phy_reg; 931 924 932 925 if (!tg3_readphy(tp, MII_TG3_EXT_CTRL, &phy_reg)) ··· 1100 1093 tp->link_config.orig_autoneg = tp->link_config.autoneg; 1101 1094 } 1102 1095 1103 - if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { 1096 + if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) { 1104 1097 tp->link_config.speed = SPEED_10; 1105 1098 tp->link_config.duplex = DUPLEX_HALF; 1106 1099 tp->link_config.autoneg = AUTONEG_ENABLE; ··· 1152 1145 CLOCK_CTRL_ALTCLK | 1153 1146 CLOCK_CTRL_PWRDOWN_PLL133); 1154 1147 udelay(40); 1148 + } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) { 1149 + /* do nothing */ 1155 1150 } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && 1156 1151 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF))) { 1157 1152 u32 newbits1, newbits2; ··· 1247 1238 u32 old_tx_mode = tp->tx_mode; 1248 1239 1249 1240 if (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) { 1241 + 1242 + /* Convert 1000BaseX flow control bits to 1000BaseT 1243 + * bits before resolving flow control. 1244 + */ 1245 + if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 1246 + local_adv &= ~(ADVERTISE_PAUSE_CAP | 1247 + ADVERTISE_PAUSE_ASYM); 1248 + remote_adv &= ~(LPA_PAUSE_CAP | LPA_PAUSE_ASYM); 1249 + 1250 + if (local_adv & ADVERTISE_1000XPAUSE) 1251 + local_adv |= ADVERTISE_PAUSE_CAP; 1252 + if (local_adv & ADVERTISE_1000XPSE_ASYM) 1253 + local_adv |= ADVERTISE_PAUSE_ASYM; 1254 + if (remote_adv & LPA_1000XPAUSE) 1255 + remote_adv |= LPA_PAUSE_CAP; 1256 + if (remote_adv & LPA_1000XPAUSE_ASYM) 1257 + remote_adv |= LPA_PAUSE_ASYM; 1258 + } 1259 + 1250 1260 if (local_adv & ADVERTISE_PAUSE_CAP) { 1251 1261 if (local_adv & ADVERTISE_PAUSE_ASYM) { 1252 1262 if (remote_adv & LPA_PAUSE_CAP) ··· 2526 2498 return 0; 2527 2499 } 2528 2500 2501 + static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset) 2502 + { 2503 + int current_link_up, err = 0; 2504 + u32 bmsr, bmcr; 2505 + u16 current_speed; 2506 + u8 current_duplex; 2507 + 2508 + tp->mac_mode |= MAC_MODE_PORT_MODE_GMII; 2509 + tw32_f(MAC_MODE, tp->mac_mode); 2510 + udelay(40); 2511 + 2512 + tw32(MAC_EVENT, 0); 2513 + 2514 + tw32_f(MAC_STATUS, 2515 + (MAC_STATUS_SYNC_CHANGED | 2516 + MAC_STATUS_CFG_CHANGED | 2517 + MAC_STATUS_MI_COMPLETION | 2518 + MAC_STATUS_LNKSTATE_CHANGED)); 2519 + udelay(40); 2520 + 2521 + if (force_reset) 2522 + tg3_phy_reset(tp); 2523 + 2524 + current_link_up = 0; 2525 + current_speed = SPEED_INVALID; 2526 + current_duplex = DUPLEX_INVALID; 2527 + 2528 + err |= tg3_readphy(tp, MII_BMSR, &bmsr); 2529 + err |= tg3_readphy(tp, MII_BMSR, &bmsr); 2530 + 2531 + err |= tg3_readphy(tp, MII_BMCR, &bmcr); 2532 + 2533 + if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset && 2534 + (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) { 2535 + /* do nothing, just check for link up at the end */ 2536 + } else if (tp->link_config.autoneg == AUTONEG_ENABLE) { 2537 + u32 adv, new_adv; 2538 + 2539 + err |= tg3_readphy(tp, MII_ADVERTISE, &adv); 2540 + new_adv = adv & ~(ADVERTISE_1000XFULL | ADVERTISE_1000XHALF | 2541 + ADVERTISE_1000XPAUSE | 2542 + ADVERTISE_1000XPSE_ASYM | 2543 + ADVERTISE_SLCT); 2544 + 2545 + /* Always advertise symmetric PAUSE just like copper */ 2546 + new_adv |= ADVERTISE_1000XPAUSE; 2547 + 2548 + if (tp->link_config.advertising & ADVERTISED_1000baseT_Half) 2549 + new_adv |= ADVERTISE_1000XHALF; 2550 + if (tp->link_config.advertising & ADVERTISED_1000baseT_Full) 2551 + new_adv |= ADVERTISE_1000XFULL; 2552 + 2553 + if ((new_adv != adv) || !(bmcr & BMCR_ANENABLE)) { 2554 + tg3_writephy(tp, MII_ADVERTISE, new_adv); 2555 + bmcr |= BMCR_ANENABLE | BMCR_ANRESTART; 2556 + tg3_writephy(tp, MII_BMCR, bmcr); 2557 + 2558 + tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED); 2559 + tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED; 2560 + tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 2561 + 2562 + return err; 2563 + } 2564 + } else { 2565 + u32 new_bmcr; 2566 + 2567 + bmcr &= ~BMCR_SPEED1000; 2568 + new_bmcr = bmcr & ~(BMCR_ANENABLE | BMCR_FULLDPLX); 2569 + 2570 + if (tp->link_config.duplex == DUPLEX_FULL) 2571 + new_bmcr |= BMCR_FULLDPLX; 2572 + 2573 + if (new_bmcr != bmcr) { 2574 + /* BMCR_SPEED1000 is a reserved bit that needs 2575 + * to be set on write. 2576 + */ 2577 + new_bmcr |= BMCR_SPEED1000; 2578 + 2579 + /* Force a linkdown */ 2580 + if (netif_carrier_ok(tp->dev)) { 2581 + u32 adv; 2582 + 2583 + err |= tg3_readphy(tp, MII_ADVERTISE, &adv); 2584 + adv &= ~(ADVERTISE_1000XFULL | 2585 + ADVERTISE_1000XHALF | 2586 + ADVERTISE_SLCT); 2587 + tg3_writephy(tp, MII_ADVERTISE, adv); 2588 + tg3_writephy(tp, MII_BMCR, bmcr | 2589 + BMCR_ANRESTART | 2590 + BMCR_ANENABLE); 2591 + udelay(10); 2592 + netif_carrier_off(tp->dev); 2593 + } 2594 + tg3_writephy(tp, MII_BMCR, new_bmcr); 2595 + bmcr = new_bmcr; 2596 + err |= tg3_readphy(tp, MII_BMSR, &bmsr); 2597 + err |= tg3_readphy(tp, MII_BMSR, &bmsr); 2598 + tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 2599 + } 2600 + } 2601 + 2602 + if (bmsr & BMSR_LSTATUS) { 2603 + current_speed = SPEED_1000; 2604 + current_link_up = 1; 2605 + if (bmcr & BMCR_FULLDPLX) 2606 + current_duplex = DUPLEX_FULL; 2607 + else 2608 + current_duplex = DUPLEX_HALF; 2609 + 2610 + if (bmcr & BMCR_ANENABLE) { 2611 + u32 local_adv, remote_adv, common; 2612 + 2613 + err |= tg3_readphy(tp, MII_ADVERTISE, &local_adv); 2614 + err |= tg3_readphy(tp, MII_LPA, &remote_adv); 2615 + common = local_adv & remote_adv; 2616 + if (common & (ADVERTISE_1000XHALF | 2617 + ADVERTISE_1000XFULL)) { 2618 + if (common & ADVERTISE_1000XFULL) 2619 + current_duplex = DUPLEX_FULL; 2620 + else 2621 + current_duplex = DUPLEX_HALF; 2622 + 2623 + tg3_setup_flow_control(tp, local_adv, 2624 + remote_adv); 2625 + } 2626 + else 2627 + current_link_up = 0; 2628 + } 2629 + } 2630 + 2631 + tp->mac_mode &= ~MAC_MODE_HALF_DUPLEX; 2632 + if (tp->link_config.active_duplex == DUPLEX_HALF) 2633 + tp->mac_mode |= MAC_MODE_HALF_DUPLEX; 2634 + 2635 + tw32_f(MAC_MODE, tp->mac_mode); 2636 + udelay(40); 2637 + 2638 + tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED); 2639 + 2640 + tp->link_config.active_speed = current_speed; 2641 + tp->link_config.active_duplex = current_duplex; 2642 + 2643 + if (current_link_up != netif_carrier_ok(tp->dev)) { 2644 + if (current_link_up) 2645 + netif_carrier_on(tp->dev); 2646 + else { 2647 + netif_carrier_off(tp->dev); 2648 + tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 2649 + } 2650 + tg3_link_report(tp); 2651 + } 2652 + return err; 2653 + } 2654 + 2655 + static void tg3_serdes_parallel_detect(struct tg3 *tp) 2656 + { 2657 + if (tp->tg3_flags2 & TG3_FLG2_PHY_JUST_INITTED) { 2658 + /* Give autoneg time to complete. */ 2659 + tp->tg3_flags2 &= ~TG3_FLG2_PHY_JUST_INITTED; 2660 + return; 2661 + } 2662 + if (!netif_carrier_ok(tp->dev) && 2663 + (tp->link_config.autoneg == AUTONEG_ENABLE)) { 2664 + u32 bmcr; 2665 + 2666 + tg3_readphy(tp, MII_BMCR, &bmcr); 2667 + if (bmcr & BMCR_ANENABLE) { 2668 + u32 phy1, phy2; 2669 + 2670 + /* Select shadow register 0x1f */ 2671 + tg3_writephy(tp, 0x1c, 0x7c00); 2672 + tg3_readphy(tp, 0x1c, &phy1); 2673 + 2674 + /* Select expansion interrupt status register */ 2675 + tg3_writephy(tp, 0x17, 0x0f01); 2676 + tg3_readphy(tp, 0x15, &phy2); 2677 + tg3_readphy(tp, 0x15, &phy2); 2678 + 2679 + if ((phy1 & 0x10) && !(phy2 & 0x20)) { 2680 + /* We have signal detect and not receiving 2681 + * config code words, link is up by parallel 2682 + * detection. 2683 + */ 2684 + 2685 + bmcr &= ~BMCR_ANENABLE; 2686 + bmcr |= BMCR_SPEED1000 | BMCR_FULLDPLX; 2687 + tg3_writephy(tp, MII_BMCR, bmcr); 2688 + tp->tg3_flags2 |= TG3_FLG2_PARALLEL_DETECT; 2689 + } 2690 + } 2691 + } 2692 + else if (netif_carrier_ok(tp->dev) && 2693 + (tp->link_config.autoneg == AUTONEG_ENABLE) && 2694 + (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) { 2695 + u32 phy2; 2696 + 2697 + /* Select expansion interrupt status register */ 2698 + tg3_writephy(tp, 0x17, 0x0f01); 2699 + tg3_readphy(tp, 0x15, &phy2); 2700 + if (phy2 & 0x20) { 2701 + u32 bmcr; 2702 + 2703 + /* Config code words received, turn on autoneg. */ 2704 + tg3_readphy(tp, MII_BMCR, &bmcr); 2705 + tg3_writephy(tp, MII_BMCR, bmcr | BMCR_ANENABLE); 2706 + 2707 + tp->tg3_flags2 &= ~TG3_FLG2_PARALLEL_DETECT; 2708 + 2709 + } 2710 + } 2711 + } 2712 + 2529 2713 static int tg3_setup_phy(struct tg3 *tp, int force_reset) 2530 2714 { 2531 2715 int err; 2532 2716 2533 2717 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 2534 2718 err = tg3_setup_fiber_phy(tp, force_reset); 2719 + } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 2720 + err = tg3_setup_fiber_mii_phy(tp, force_reset); 2535 2721 } else { 2536 2722 err = tg3_setup_copper_phy(tp, force_reset); 2537 2723 } ··· 2854 2612 map = &tp->rx_std_buffers[dest_idx]; 2855 2613 if (src_idx >= 0) 2856 2614 src_map = &tp->rx_std_buffers[src_idx]; 2857 - skb_size = RX_PKT_BUF_SZ; 2615 + skb_size = tp->rx_pkt_buf_sz; 2858 2616 break; 2859 2617 2860 2618 case RXD_OPAQUE_RING_JUMBO: ··· 3676 3434 { 3677 3435 dev->mtu = new_mtu; 3678 3436 3679 - if (new_mtu > ETH_DATA_LEN) 3680 - tp->tg3_flags |= TG3_FLAG_JUMBO_ENABLE; 3681 - else 3682 - tp->tg3_flags &= ~TG3_FLAG_JUMBO_ENABLE; 3437 + if (new_mtu > ETH_DATA_LEN) { 3438 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) { 3439 + tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE; 3440 + ethtool_op_set_tso(dev, 0); 3441 + } 3442 + else 3443 + tp->tg3_flags |= TG3_FLAG_JUMBO_RING_ENABLE; 3444 + } else { 3445 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) 3446 + tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE; 3447 + tp->tg3_flags &= ~TG3_FLAG_JUMBO_RING_ENABLE; 3448 + } 3683 3449 } 3684 3450 3685 3451 static int tg3_change_mtu(struct net_device *dev, int new_mtu) ··· 3741 3491 continue; 3742 3492 pci_unmap_single(tp->pdev, 3743 3493 pci_unmap_addr(rxp, mapping), 3744 - RX_PKT_BUF_SZ - tp->rx_offset, 3494 + tp->rx_pkt_buf_sz - tp->rx_offset, 3745 3495 PCI_DMA_FROMDEVICE); 3746 3496 dev_kfree_skb_any(rxp->skb); 3747 3497 rxp->skb = NULL; ··· 3814 3564 memset(tp->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); 3815 3565 memset(tp->tx_ring, 0, TG3_TX_RING_BYTES); 3816 3566 3567 + tp->rx_pkt_buf_sz = RX_PKT_BUF_SZ; 3568 + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) && 3569 + (tp->dev->mtu > ETH_DATA_LEN)) 3570 + tp->rx_pkt_buf_sz = RX_JUMBO_PKT_BUF_SZ; 3571 + 3817 3572 /* Initialize invariants of the rings, we only set this 3818 3573 * stuff once. This works because the card does not 3819 3574 * write into the rx buffer posting rings. ··· 3827 3572 struct tg3_rx_buffer_desc *rxd; 3828 3573 3829 3574 rxd = &tp->rx_std[i]; 3830 - rxd->idx_len = (RX_PKT_BUF_SZ - tp->rx_offset - 64) 3575 + rxd->idx_len = (tp->rx_pkt_buf_sz - tp->rx_offset - 64) 3831 3576 << RXD_LEN_SHIFT; 3832 3577 rxd->type_flags = (RXD_FLAG_END << RXD_FLAGS_SHIFT); 3833 3578 rxd->opaque = (RXD_OPAQUE_RING_STD | 3834 3579 (i << RXD_OPAQUE_INDEX_SHIFT)); 3835 3580 } 3836 3581 3837 - if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) { 3582 + if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) { 3838 3583 for (i = 0; i < TG3_RX_JUMBO_RING_SIZE; i++) { 3839 3584 struct tg3_rx_buffer_desc *rxd; 3840 3585 ··· 3855 3600 break; 3856 3601 } 3857 3602 3858 - if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) { 3603 + if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) { 3859 3604 for (i = 0; i < tp->rx_jumbo_pending; i++) { 3860 3605 if (tg3_alloc_rx_skb(tp, RXD_OPAQUE_RING_JUMBO, 3861 3606 -1, i) < 0) ··· 4311 4056 val &= ~PCIX_CAPS_RELAXED_ORDERING; 4312 4057 pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val); 4313 4058 4314 - tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 4059 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) { 4060 + u32 val; 4061 + 4062 + /* Chip reset on 5780 will reset MSI enable bit, 4063 + * so need to restore it. 4064 + */ 4065 + if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 4066 + u16 ctrl; 4067 + 4068 + pci_read_config_word(tp->pdev, 4069 + tp->msi_cap + PCI_MSI_FLAGS, 4070 + &ctrl); 4071 + pci_write_config_word(tp->pdev, 4072 + tp->msi_cap + PCI_MSI_FLAGS, 4073 + ctrl | PCI_MSI_FLAGS_ENABLE); 4074 + val = tr32(MSGINT_MODE); 4075 + tw32(MSGINT_MODE, val | MSGINT_MODE_ENABLE); 4076 + } 4077 + 4078 + val = tr32(MEMARB_MODE); 4079 + tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); 4080 + 4081 + } else 4082 + tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 4315 4083 4316 4084 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A3) { 4317 4085 tg3_stop_fw(tp); ··· 4359 4081 4360 4082 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 4361 4083 tp->mac_mode = MAC_MODE_PORT_MODE_TBI; 4084 + tw32_f(MAC_MODE, tp->mac_mode); 4085 + } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 4086 + tp->mac_mode = MAC_MODE_PORT_MODE_GMII; 4362 4087 tw32_f(MAC_MODE, tp->mac_mode); 4363 4088 } else 4364 4089 tw32_f(MAC_MODE, 0); ··· 5526 5245 } 5527 5246 #endif 5528 5247 5529 - if (!(tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE)) { 5248 + if (tp->dev->mtu <= ETH_DATA_LEN) { 5530 5249 tw32(BUFMGR_MB_RDMA_LOW_WATER, 5531 5250 tp->bufmgr_config.mbuf_read_dma_low_water); 5532 5251 tw32(BUFMGR_MB_MACRX_LOW_WATER, ··· 5601 5320 /* Setup replenish threshold. */ 5602 5321 tw32(RCVBDI_JUMBO_THRESH, tp->rx_jumbo_pending / 8); 5603 5322 5604 - if (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) { 5323 + if (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) { 5605 5324 tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH, 5606 5325 ((u64) tp->rx_jumbo_mapping >> 32)); 5607 5326 tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW, ··· 5662 5381 tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + TG3_64BIT_REG_LOW, 5663 5382 tp->rx_std_ptr); 5664 5383 5665 - tp->rx_jumbo_ptr = (tp->tg3_flags & TG3_FLAG_JUMBO_ENABLE) ? 5384 + tp->rx_jumbo_ptr = (tp->tg3_flags & TG3_FLAG_JUMBO_RING_ENABLE) ? 5666 5385 tp->rx_jumbo_pending : 0; 5667 5386 tw32_rx_mbox(MAILBOX_RCV_JUMBO_PROD_IDX + TG3_64BIT_REG_LOW, 5668 5387 tp->rx_jumbo_ptr); ··· 5964 5683 tw32(MAC_RCV_RULE_1, 0x86000004 & RCV_RULE_DISABLE_MASK); 5965 5684 tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK); 5966 5685 5967 - if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) 5686 + if ((tp->tg3_flags2 & TG3_FLG2_5705_PLUS) && 5687 + (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5780)) 5968 5688 limit = 8; 5969 5689 else 5970 5690 limit = 16; ··· 6147 5865 udelay(40); 6148 5866 tg3_setup_phy(tp, 0); 6149 5867 } 6150 - } 5868 + } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) 5869 + tg3_serdes_parallel_detect(tp); 6151 5870 6152 5871 tp->timer_counter = tp->timer_multiplier; 6153 5872 } ··· 8852 8569 eeprom_phy_id = 0; 8853 8570 8854 8571 tp->phy_id = eeprom_phy_id; 8855 - if (eeprom_phy_serdes) 8856 - tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; 8572 + if (eeprom_phy_serdes) { 8573 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) 8574 + tp->tg3_flags2 |= TG3_FLG2_MII_SERDES; 8575 + else 8576 + tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; 8577 + } 8857 8578 8858 8579 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) 8859 8580 led_cfg = cfg2 & (NIC_SRAM_DATA_CFG_LED_MODE_MASK | ··· 8992 8705 } 8993 8706 } 8994 8707 8995 - if (!(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) && 8708 + if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) && 8996 8709 !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) { 8997 8710 u32 bmsr, adv_reg, tg3_ctrl; 8998 8711 ··· 9045 8758 err = tg3_init_5401phy_dsp(tp); 9046 8759 } 9047 8760 9048 - if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) 8761 + if (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES) 9049 8762 tp->link_config.advertising = 9050 8763 (ADVERTISED_1000baseT_Half | 9051 8764 ADVERTISED_1000baseT_Full | ··· 9215 8928 if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW) 9216 8929 tp->pci_chip_rev_id = CHIPREV_ID_5752_A0; 9217 8930 8931 + /* Find msi capability. */ 8932 + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) 8933 + tp->msi_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_MSI); 8934 + 9218 8935 /* Initialize misc host control in PCI block. */ 9219 8936 tp->misc_host_ctrl |= (misc_ctrl_reg & 9220 8937 MISC_HOST_CTRL_CHIPREV); ··· 9234 8943 tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff; 9235 8944 9236 8945 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || 9237 - GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752) 8946 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || 8947 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) 9238 8948 tp->tg3_flags2 |= TG3_FLG2_5750_PLUS; 9239 8949 9240 8950 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) || ··· 9244 8952 9245 8953 if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) 9246 8954 tp->tg3_flags2 |= TG3_FLG2_HW_TSO; 8955 + 8956 + if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 && 8957 + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750 && 8958 + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5752) 8959 + tp->tg3_flags2 |= TG3_FLG2_JUMBO_CAPABLE; 9247 8960 9248 8961 if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0) 9249 8962 tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS; ··· 9376 9079 /* Derive initial jumbo mode from MTU assigned in 9377 9080 * ether_setup() via the alloc_etherdev() call 9378 9081 */ 9379 - if (tp->dev->mtu > ETH_DATA_LEN) 9380 - tp->tg3_flags |= TG3_FLAG_JUMBO_ENABLE; 9082 + if (tp->dev->mtu > ETH_DATA_LEN && 9083 + GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5780) 9084 + tp->tg3_flags |= TG3_FLAG_JUMBO_RING_ENABLE; 9381 9085 9382 9086 /* Determine WakeOnLan speed to use. */ 9383 9087 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || ··· 9394 9096 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) || 9395 9097 ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) && 9396 9098 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) && 9397 - (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1))) 9099 + (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) || 9100 + (tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) 9398 9101 tp->tg3_flags2 |= TG3_FLG2_NO_ETH_WIRE_SPEED; 9399 9102 9400 9103 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5703_AX || ··· 9604 9305 #endif 9605 9306 9606 9307 mac_offset = 0x7c; 9607 - if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && 9608 - !(tp->tg3_flags & TG3_FLG2_SUN_570X)) { 9308 + if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && 9309 + !(tp->tg3_flags & TG3_FLG2_SUN_570X)) || 9310 + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) { 9609 9311 if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID) 9610 9312 mac_offset = 0xcc; 9611 9313 if (tg3_nvram_lock(tp)) ··· 9920 9620 9921 9621 /* Set bit 23 to enable PCIX hw bug fix */ 9922 9622 tp->dma_rwctrl |= 0x009f0000; 9623 + } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780) { 9624 + /* 5780 always in PCIX mode */ 9625 + tp->dma_rwctrl |= 0x00144000; 9923 9626 } else { 9924 9627 tp->dma_rwctrl |= 0x001b000f; 9925 9628 } ··· 10076 9773 10077 9774 static void __devinit tg3_init_bufmgr_config(struct tg3 *tp) 10078 9775 { 10079 - tp->bufmgr_config.mbuf_read_dma_low_water = 10080 - DEFAULT_MB_RDMA_LOW_WATER; 10081 - tp->bufmgr_config.mbuf_mac_rx_low_water = 10082 - DEFAULT_MB_MACRX_LOW_WATER; 10083 - tp->bufmgr_config.mbuf_high_water = 10084 - DEFAULT_MB_HIGH_WATER; 9776 + if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { 9777 + tp->bufmgr_config.mbuf_read_dma_low_water = 9778 + DEFAULT_MB_RDMA_LOW_WATER_5705; 9779 + tp->bufmgr_config.mbuf_mac_rx_low_water = 9780 + DEFAULT_MB_MACRX_LOW_WATER_5705; 9781 + tp->bufmgr_config.mbuf_high_water = 9782 + DEFAULT_MB_HIGH_WATER_5705; 10085 9783 10086 - tp->bufmgr_config.mbuf_read_dma_low_water_jumbo = 10087 - DEFAULT_MB_RDMA_LOW_WATER_JUMBO; 10088 - tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo = 10089 - DEFAULT_MB_MACRX_LOW_WATER_JUMBO; 10090 - tp->bufmgr_config.mbuf_high_water_jumbo = 10091 - DEFAULT_MB_HIGH_WATER_JUMBO; 9784 + tp->bufmgr_config.mbuf_read_dma_low_water_jumbo = 9785 + DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780; 9786 + tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo = 9787 + DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780; 9788 + tp->bufmgr_config.mbuf_high_water_jumbo = 9789 + DEFAULT_MB_HIGH_WATER_JUMBO_5780; 9790 + } else { 9791 + tp->bufmgr_config.mbuf_read_dma_low_water = 9792 + DEFAULT_MB_RDMA_LOW_WATER; 9793 + tp->bufmgr_config.mbuf_mac_rx_low_water = 9794 + DEFAULT_MB_MACRX_LOW_WATER; 9795 + tp->bufmgr_config.mbuf_high_water = 9796 + DEFAULT_MB_HIGH_WATER; 9797 + 9798 + tp->bufmgr_config.mbuf_read_dma_low_water_jumbo = 9799 + DEFAULT_MB_RDMA_LOW_WATER_JUMBO; 9800 + tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo = 9801 + DEFAULT_MB_MACRX_LOW_WATER_JUMBO; 9802 + tp->bufmgr_config.mbuf_high_water_jumbo = 9803 + DEFAULT_MB_HIGH_WATER_JUMBO; 9804 + } 10092 9805 10093 9806 tp->bufmgr_config.dma_low_water = DEFAULT_DMA_LOW_WATER; 10094 9807 tp->bufmgr_config.dma_high_water = DEFAULT_DMA_HIGH_WATER; ··· 10122 9803 case PHY_ID_BCM5705: return "5705"; 10123 9804 case PHY_ID_BCM5750: return "5750"; 10124 9805 case PHY_ID_BCM5752: return "5752"; 9806 + case PHY_ID_BCM5780: return "5780"; 10125 9807 case PHY_ID_BCM8002: return "8002/serdes"; 10126 9808 case 0: return "serdes"; 10127 9809 default: return "unknown"; ··· 10318 9998 10319 9999 tg3_init_link_config(tp); 10320 10000 10321 - tg3_init_bufmgr_config(tp); 10322 - 10323 10001 tp->rx_pending = TG3_DEF_RX_RING_PENDING; 10324 10002 tp->rx_jumbo_pending = TG3_DEF_RX_JUMBO_RING_PENDING; 10325 10003 tp->tx_pending = TG3_DEF_TX_RING_PENDING; ··· 10346 10028 goto err_out_iounmap; 10347 10029 } 10348 10030 10349 - if (tp->tg3_flags2 & TG3_FLG2_5705_PLUS) { 10350 - tp->bufmgr_config.mbuf_read_dma_low_water = 10351 - DEFAULT_MB_RDMA_LOW_WATER_5705; 10352 - tp->bufmgr_config.mbuf_mac_rx_low_water = 10353 - DEFAULT_MB_MACRX_LOW_WATER_5705; 10354 - tp->bufmgr_config.mbuf_high_water = 10355 - DEFAULT_MB_HIGH_WATER_5705; 10356 - } 10031 + tg3_init_bufmgr_config(tp); 10357 10032 10358 10033 #if TG3_TSO_SUPPORT != 0 10359 10034 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
+14 -1
drivers/net/tg3.h
··· 136 136 #define ASIC_REV_5705 0x03 137 137 #define ASIC_REV_5750 0x04 138 138 #define ASIC_REV_5752 0x06 139 + #define ASIC_REV_5780 0x08 139 140 #define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) 140 141 #define CHIPREV_5700_AX 0x70 141 142 #define CHIPREV_5700_BX 0x71 ··· 985 984 #define DEFAULT_MB_RDMA_LOW_WATER 0x00000050 986 985 #define DEFAULT_MB_RDMA_LOW_WATER_5705 0x00000000 987 986 #define DEFAULT_MB_RDMA_LOW_WATER_JUMBO 0x00000130 987 + #define DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780 0x00000000 988 988 #define BUFMGR_MB_MACRX_LOW_WATER 0x00004414 989 989 #define DEFAULT_MB_MACRX_LOW_WATER 0x00000020 990 990 #define DEFAULT_MB_MACRX_LOW_WATER_5705 0x00000010 991 991 #define DEFAULT_MB_MACRX_LOW_WATER_JUMBO 0x00000098 992 + #define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780 0x0000004b 992 993 #define BUFMGR_MB_HIGH_WATER 0x00004418 993 994 #define DEFAULT_MB_HIGH_WATER 0x00000060 994 995 #define DEFAULT_MB_HIGH_WATER_5705 0x00000060 995 996 #define DEFAULT_MB_HIGH_WATER_JUMBO 0x0000017c 997 + #define DEFAULT_MB_HIGH_WATER_JUMBO_5780 0x00000096 996 998 #define BUFMGR_RX_MB_ALLOC_REQ 0x0000441c 997 999 #define BUFMGR_MB_ALLOC_BIT 0x10000000 998 1000 #define BUFMGR_RX_MB_ALLOC_RESP 0x00004420 ··· 2091 2087 struct tg3_rx_buffer_desc *rx_rcb; 2092 2088 dma_addr_t rx_rcb_mapping; 2093 2089 2090 + u32 rx_pkt_buf_sz; 2091 + 2094 2092 /* begin "everything else" cacheline(s) section */ 2095 2093 struct net_device_stats net_stats; 2096 2094 struct net_device_stats net_stats_prev; ··· 2130 2124 #define TG3_FLAG_NO_TX_PSEUDO_CSUM 0x00100000 2131 2125 #define TG3_FLAG_NO_RX_PSEUDO_CSUM 0x00200000 2132 2126 #define TG3_FLAG_SERDES_WOL_CAP 0x00400000 2133 - #define TG3_FLAG_JUMBO_ENABLE 0x00800000 2127 + #define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000 2134 2128 #define TG3_FLAG_10_100_ONLY 0x01000000 2135 2129 #define TG3_FLAG_PAUSE_AUTONEG 0x02000000 2136 2130 #define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 ··· 2160 2154 #define TG3_FLG2_5750_PLUS 0x00080000 2161 2155 #define TG3_FLG2_PROTECTED_NVRAM 0x00100000 2162 2156 #define TG3_FLG2_USING_MSI 0x00200000 2157 + #define TG3_FLG2_JUMBO_CAPABLE 0x00400000 2158 + #define TG3_FLG2_MII_SERDES 0x00800000 2159 + #define TG3_FLG2_ANY_SERDES (TG3_FLG2_PHY_SERDES | \ 2160 + TG3_FLG2_MII_SERDES) 2161 + #define TG3_FLG2_PARALLEL_DETECT 0x01000000 2163 2162 2164 2163 u32 split_mode_max_reqs; 2165 2164 #define SPLIT_MODE_5704_MAX_REQ 3 ··· 2198 2187 u8 pci_bist; 2199 2188 2200 2189 int pm_cap; 2190 + int msi_cap; 2201 2191 2202 2192 /* PHY info */ 2203 2193 u32 phy_id; ··· 2212 2200 #define PHY_ID_BCM5705 0x600081a0 2213 2201 #define PHY_ID_BCM5750 0x60008180 2214 2202 #define PHY_ID_BCM5752 0x60008100 2203 + #define PHY_ID_BCM5780 0x60008350 2215 2204 #define PHY_ID_BCM8002 0x60010140 2216 2205 #define PHY_ID_INVALID 0xffffffff 2217 2206 #define PHY_ID_REV_MASK 0x0000000f
+6 -6
drivers/usb/atm/speedtch.c
··· 448 448 case 0: 449 449 atm_dev->signal = ATM_PHY_SIG_LOST; 450 450 if (instance->last_status) 451 - atm_info(usbatm, "%s\n", "ADSL line is down"); 451 + atm_info(usbatm, "ADSL line is down\n"); 452 452 /* It may never resync again unless we ask it to... */ 453 453 ret = speedtch_start_synchro(instance); 454 454 break; 455 455 456 456 case 0x08: 457 457 atm_dev->signal = ATM_PHY_SIG_UNKNOWN; 458 - atm_info(usbatm, "%s\n", "ADSL line is blocked?"); 458 + atm_info(usbatm, "ADSL line is blocked?\n"); 459 459 break; 460 460 461 461 case 0x10: 462 462 atm_dev->signal = ATM_PHY_SIG_LOST; 463 - atm_info(usbatm, "%s\n", "ADSL line is synchronising"); 463 + atm_info(usbatm, "ADSL line is synchronising\n"); 464 464 break; 465 465 466 466 case 0x20: ··· 502 502 if (instance->poll_delay < MAX_POLL_DELAY) 503 503 mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(instance->poll_delay)); 504 504 else 505 - atm_warn(instance->usbatm, "%s\n", "Too many failures - disabling line status polling"); 505 + atm_warn(instance->usbatm, "Too many failures - disabling line status polling\n"); 506 506 } 507 507 508 508 static void speedtch_resubmit_int(unsigned long data) ··· 545 545 546 546 if ((count == 6) && !memcmp(up_int, instance->int_data, 6)) { 547 547 del_timer(&instance->status_checker.timer); 548 - atm_info(usbatm, "%s\n", "DSL line goes up"); 548 + atm_info(usbatm, "DSL line goes up\n"); 549 549 } else if ((count == 6) && !memcmp(down_int, instance->int_data, 6)) { 550 - atm_info(usbatm, "%s\n", "DSL line goes down"); 550 + atm_info(usbatm, "DSL line goes down\n"); 551 551 } else { 552 552 int i; 553 553
+1 -1
include/linux/netfilter_ipv4/ip_conntrack.h
··· 239 239 } 240 240 241 241 /* decrement reference count on a conntrack */ 242 - extern inline void ip_conntrack_put(struct ip_conntrack *ct); 242 + extern void ip_conntrack_put(struct ip_conntrack *ct); 243 243 244 244 /* call to create an explicit dependency on ip_conntrack. */ 245 245 extern void need_ip_conntrack(void);
+2
include/linux/pci_ids.h
··· 2107 2107 #define PCI_DEVICE_ID_TIGON3_5721 0x1659 2108 2108 #define PCI_DEVICE_ID_TIGON3_5705M 0x165d 2109 2109 #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 2110 + #define PCI_DEVICE_ID_TIGON3_5780 0x166a 2111 + #define PCI_DEVICE_ID_TIGON3_5780S 0x166b 2110 2112 #define PCI_DEVICE_ID_TIGON3_5705F 0x166e 2111 2113 #define PCI_DEVICE_ID_TIGON3_5750 0x1676 2112 2114 #define PCI_DEVICE_ID_TIGON3_5751 0x1677
+3
net/xfrm/xfrm_user.c
··· 1350 1350 if (nr > XFRM_MAX_DEPTH) 1351 1351 return NULL; 1352 1352 1353 + if (p->dir > XFRM_POLICY_OUT) 1354 + return NULL; 1355 + 1353 1356 xp = xfrm_policy_alloc(GFP_KERNEL); 1354 1357 if (xp == NULL) { 1355 1358 *dir = -ENOBUFS;