aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2006-03-21 01:29:32 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:29:32 -0500
commitc4e6575c78b83928c470d81b271909084a2efd37 (patch)
tree387a32bbd915bfb6d72d297bd86597c9e543e201 /drivers/net/tg3.c
parent1820180b0e59cc48019414018b180518059f50d3 (diff)
[TG3]: Add firmware version info
Add fw_version information to ethtool -i. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 602326b78ef9..0a4e7b74c1fc 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7666,6 +7666,7 @@ static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
7666 7666
7667 strcpy(info->driver, DRV_MODULE_NAME); 7667 strcpy(info->driver, DRV_MODULE_NAME);
7668 strcpy(info->version, DRV_MODULE_VERSION); 7668 strcpy(info->version, DRV_MODULE_VERSION);
7669 strcpy(info->fw_version, tp->fw_ver);
7669 strcpy(info->bus_info, pci_name(tp->pdev)); 7670 strcpy(info->bus_info, pci_name(tp->pdev));
7670} 7671}
7671 7672
@@ -9069,6 +9070,20 @@ static u32 tg3_nvram_phys_addr(struct tg3 *tp, u32 addr)
9069 return addr; 9070 return addr;
9070} 9071}
9071 9072
9073static u32 tg3_nvram_logical_addr(struct tg3 *tp, u32 addr)
9074{
9075 if ((tp->tg3_flags & TG3_FLAG_NVRAM) &&
9076 (tp->tg3_flags & TG3_FLAG_NVRAM_BUFFERED) &&
9077 (tp->tg3_flags2 & TG3_FLG2_FLASH) &&
9078 (tp->nvram_jedecnum == JEDEC_ATMEL))
9079
9080 addr = ((addr >> ATMEL_AT45DB0X1B_PAGE_POS) *
9081 tp->nvram_pagesize) +
9082 (addr & ((1 << ATMEL_AT45DB0X1B_PAGE_POS) - 1));
9083
9084 return addr;
9085}
9086
9072static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) 9087static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
9073{ 9088{
9074 int ret; 9089 int ret;
@@ -9780,6 +9795,46 @@ out_not_found:
9780 strcpy(tp->board_part_number, "none"); 9795 strcpy(tp->board_part_number, "none");
9781} 9796}
9782 9797
9798static void __devinit tg3_read_fw_ver(struct tg3 *tp)
9799{
9800 u32 val, offset, start;
9801
9802 if (tg3_nvram_read_swab(tp, 0, &val))
9803 return;
9804
9805 if (val != TG3_EEPROM_MAGIC)
9806 return;
9807
9808 if (tg3_nvram_read_swab(tp, 0xc, &offset) ||
9809 tg3_nvram_read_swab(tp, 0x4, &start))
9810 return;
9811
9812 offset = tg3_nvram_logical_addr(tp, offset);
9813 if (tg3_nvram_read_swab(tp, offset, &val))
9814 return;
9815
9816 if ((val & 0xfc000000) == 0x0c000000) {
9817 u32 ver_offset, addr;
9818 int i;
9819
9820 if (tg3_nvram_read_swab(tp, offset + 4, &val) ||
9821 tg3_nvram_read_swab(tp, offset + 8, &ver_offset))
9822 return;
9823
9824 if (val != 0)
9825 return;
9826
9827 addr = offset + ver_offset - start;
9828 for (i = 0; i < 16; i += 4) {
9829 if (tg3_nvram_read(tp, addr + i, &val))
9830 return;
9831
9832 val = cpu_to_le32(val);
9833 memcpy(tp->fw_ver + i, &val, 4);
9834 }
9835 }
9836}
9837
9783#ifdef CONFIG_SPARC64 9838#ifdef CONFIG_SPARC64
9784static int __devinit tg3_is_sun_570X(struct tg3 *tp) 9839static int __devinit tg3_is_sun_570X(struct tg3 *tp)
9785{ 9840{
@@ -10301,6 +10356,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10301 } 10356 }
10302 10357
10303 tg3_read_partno(tp); 10358 tg3_read_partno(tp);
10359 tg3_read_fw_ver(tp);
10304 10360
10305 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 10361 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
10306 tp->tg3_flags &= ~TG3_FLAG_USE_MI_INTERRUPT; 10362 tp->tg3_flags &= ~TG3_FLAG_USE_MI_INTERRUPT;