diff options
author | Michael Chan <mchan@broadcom.com> | 2005-09-27 15:13:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-27 15:13:10 -0400 |
commit | f9804ddbeec2ea709255830a8822bfb4e7584f6a (patch) | |
tree | 09aad8dd07b795540a718bb48f6f1c1a7f1c496d /drivers/net | |
parent | c94e39418ab6eccf863581f4e0d847da0080b2d3 (diff) |
[TG3]: misc. fixes
Fix interrupt test handler by adding check for IRQ assertion in
PCI_STATE register in addition to the status block updated bit.
Add test for valid ethernet address in tg3_set_mac_addr().
Add tg3_bus_string() to setup the PCI bus speed/width string for all
PCI/PCIX/PCI Express devices. This is used to print the bus type
during init_one().
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/tg3.c | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index ef2f1fdd6f64..0ac8db25a657 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -3389,7 +3389,8 @@ static irqreturn_t tg3_test_isr(int irq, void *dev_id, | |||
3389 | struct tg3 *tp = netdev_priv(dev); | 3389 | struct tg3 *tp = netdev_priv(dev); |
3390 | struct tg3_hw_status *sblk = tp->hw_status; | 3390 | struct tg3_hw_status *sblk = tp->hw_status; |
3391 | 3391 | ||
3392 | if (sblk->status & SD_STATUS_UPDATED) { | 3392 | if ((sblk->status & SD_STATUS_UPDATED) || |
3393 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | ||
3393 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | 3394 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, |
3394 | 0x00000001); | 3395 | 0x00000001); |
3395 | return IRQ_RETVAL(1); | 3396 | return IRQ_RETVAL(1); |
@@ -5395,6 +5396,9 @@ static int tg3_set_mac_addr(struct net_device *dev, void *p) | |||
5395 | struct tg3 *tp = netdev_priv(dev); | 5396 | struct tg3 *tp = netdev_priv(dev); |
5396 | struct sockaddr *addr = p; | 5397 | struct sockaddr *addr = p; |
5397 | 5398 | ||
5399 | if (!is_valid_ether_addr(addr->sa_data)) | ||
5400 | return -EINVAL; | ||
5401 | |||
5398 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | 5402 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); |
5399 | 5403 | ||
5400 | spin_lock_bh(&tp->lock); | 5404 | spin_lock_bh(&tp->lock); |
@@ -10349,6 +10353,44 @@ static char * __devinit tg3_phy_string(struct tg3 *tp) | |||
10349 | }; | 10353 | }; |
10350 | } | 10354 | } |
10351 | 10355 | ||
10356 | static char * __devinit tg3_bus_string(struct tg3 *tp, char *str) | ||
10357 | { | ||
10358 | if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) { | ||
10359 | strcpy(str, "PCI Express"); | ||
10360 | return str; | ||
10361 | } else if (tp->tg3_flags & TG3_FLAG_PCIX_MODE) { | ||
10362 | u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL) & 0x1f; | ||
10363 | |||
10364 | strcpy(str, "PCIX:"); | ||
10365 | |||
10366 | if ((clock_ctrl == 7) || | ||
10367 | ((tr32(GRC_MISC_CFG) & GRC_MISC_CFG_BOARD_ID_MASK) == | ||
10368 | GRC_MISC_CFG_BOARD_ID_5704CIOBE)) | ||
10369 | strcat(str, "133MHz"); | ||
10370 | else if (clock_ctrl == 0) | ||
10371 | strcat(str, "33MHz"); | ||
10372 | else if (clock_ctrl == 2) | ||
10373 | strcat(str, "50MHz"); | ||
10374 | else if (clock_ctrl == 4) | ||
10375 | strcat(str, "66MHz"); | ||
10376 | else if (clock_ctrl == 6) | ||
10377 | strcat(str, "100MHz"); | ||
10378 | else if (clock_ctrl == 7) | ||
10379 | strcat(str, "133MHz"); | ||
10380 | } else { | ||
10381 | strcpy(str, "PCI:"); | ||
10382 | if (tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) | ||
10383 | strcat(str, "66MHz"); | ||
10384 | else | ||
10385 | strcat(str, "33MHz"); | ||
10386 | } | ||
10387 | if (tp->tg3_flags & TG3_FLAG_PCI_32BIT) | ||
10388 | strcat(str, ":32-bit"); | ||
10389 | else | ||
10390 | strcat(str, ":64-bit"); | ||
10391 | return str; | ||
10392 | } | ||
10393 | |||
10352 | static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) | 10394 | static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp) |
10353 | { | 10395 | { |
10354 | struct pci_dev *peer; | 10396 | struct pci_dev *peer; |
@@ -10411,6 +10453,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10411 | struct net_device *dev; | 10453 | struct net_device *dev; |
10412 | struct tg3 *tp; | 10454 | struct tg3 *tp; |
10413 | int i, err, pci_using_dac, pm_cap; | 10455 | int i, err, pci_using_dac, pm_cap; |
10456 | char str[40]; | ||
10414 | 10457 | ||
10415 | if (tg3_version_printed++ == 0) | 10458 | if (tg3_version_printed++ == 0) |
10416 | printk(KERN_INFO "%s", version); | 10459 | printk(KERN_INFO "%s", version); |
@@ -10656,16 +10699,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
10656 | 10699 | ||
10657 | pci_set_drvdata(pdev, dev); | 10700 | pci_set_drvdata(pdev, dev); |
10658 | 10701 | ||
10659 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (PCI%s:%s:%s) %sBaseT Ethernet ", | 10702 | printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %sBaseT Ethernet ", |
10660 | dev->name, | 10703 | dev->name, |
10661 | tp->board_part_number, | 10704 | tp->board_part_number, |
10662 | tp->pci_chip_rev_id, | 10705 | tp->pci_chip_rev_id, |
10663 | tg3_phy_string(tp), | 10706 | tg3_phy_string(tp), |
10664 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "X" : ""), | 10707 | tg3_bus_string(tp, str), |
10665 | ((tp->tg3_flags & TG3_FLAG_PCI_HIGH_SPEED) ? | ||
10666 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "133MHz" : "66MHz") : | ||
10667 | ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) ? "100MHz" : "33MHz")), | ||
10668 | ((tp->tg3_flags & TG3_FLAG_PCI_32BIT) ? "32-bit" : "64-bit"), | ||
10669 | (tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100" : "10/100/1000"); | 10708 | (tp->tg3_flags & TG3_FLAG_10_100_ONLY) ? "10/100" : "10/100/1000"); |
10670 | 10709 | ||
10671 | for (i = 0; i < 6; i++) | 10710 | for (i = 0; i < 6; i++) |