jme: Extract main and sub chip revision
authorGuo-Fu Tseng <cooldavid@cooldavid.org>
Tue, 14 Dec 2010 16:49:40 +0000 (00:49 +0800)
committerGuo-Fu Tseng <cooldavid@cooldavid.org>
Sat, 12 Feb 2011 17:57:36 +0000 (01:57 +0800)
Get the main and sub chip revision for later workaround use.

jme.c
jme.h

diff --git a/jme.c b/jme.c
index da6ee29..992b624 100644 (file)
--- a/jme.c
+++ b/jme.c
@@ -2850,6 +2850,8 @@ jme_check_hw_ver(struct jme_adapter *jme)
 
        jme->fpgaver = (chipmode & CM_FPGAVER_MASK) >> CM_FPGAVER_SHIFT;
        jme->chiprev = (chipmode & CM_CHIPREV_MASK) >> CM_CHIPREV_SHIFT;
+       jme->chip_main_rev = jme->chiprev & 0xF;
+       jme->chip_sub_rev = (jme->chiprev >> 4) & 0xF;
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
@@ -3074,7 +3076,7 @@ jme_init_one(struct pci_dev *pdev,
 
        jme_clear_pm(jme);
        jme_set_phyfifoa(jme);
-       pci_read_config_byte(pdev, PCI_REVISION_ID, &jme->rev);
+       pci_read_config_byte(pdev, PCI_REVISION_ID, &jme->pcirev);
        if (!jme->fpgaver)
                jme_phy_init(jme);
        jme_phy_off(jme);
@@ -3101,7 +3103,7 @@ jme_init_one(struct pci_dev *pdev,
                goto err_out_unmap;
        }
 
-       netif_info(jme, probe, jme->dev, "%s%s ver:%x rev:%x "
+       netif_info(jme, probe, jme->dev, "%s%s chipver:%x pcirev:%x "
                   "macaddr: %02x:%02x:%02x:%02x:%02x:%02x\n",
                   (jme->pdev->device == PCI_DEVICE_ID_JMICRON_JMC250) ?
                   "JMC250 Gigabit Ethernet" :
@@ -3109,7 +3111,7 @@ jme_init_one(struct pci_dev *pdev,
                   "JMC260 Fast Ethernet" : "Unknown",
                   (jme->fpgaver != 0) ? " (FPGA)" : "",
                   (jme->fpgaver != 0) ? jme->fpgaver : jme->chiprev,
-                  jme->rev,
+                  jme->pcirev,
                   netdev->dev_addr[0],
                   netdev->dev_addr[1],
                   netdev->dev_addr[2],
diff --git a/jme.h b/jme.h
index 531a1f1..9300dca 100644 (file)
--- a/jme.h
+++ b/jme.h
@@ -532,8 +532,10 @@ struct jme_adapter {
        u32                     rx_ring_mask;
        u8                      mrrs;
        unsigned int            fpgaver;
-       unsigned int            chiprev;
-       u8                      rev;
+       u8                      chiprev;
+       u8                      chip_main_rev;
+       u8                      chip_sub_rev;
+       u8                      pcirev;
        u32                     msg_enable;
        struct ethtool_cmd      old_ecmd;
        unsigned int            old_mtu;
@@ -1324,7 +1326,7 @@ enum jme_phy_reg17_vals {
 /*
  * Workaround
  */
-static inline int is_buggy250(unsigned short device, unsigned int chiprev)
+static inline int is_buggy250(unsigned short device, u8 chiprev)
 {
        return device == PCI_DEVICE_ID_JMICRON_JMC250 && chiprev == 0x11;
 }