]> bbs.cooldavid.org Git - jme.git/blobdiff - jme.c
jme: Extract main and sub chip revision
[jme.git] / jme.c
diff --git a/jme.c b/jme.c
index 0c7720817a5c286f9f8dbf27d0173a9be7d68554..992b624bb230530cde6c065a3894fc49505afad4 100644 (file)
--- a/jme.c
+++ b/jme.c
@@ -138,7 +138,7 @@ jme_reset_phy_processor(struct jme_adapter *jme)
 
 static void
 jme_setup_wakeup_frame(struct jme_adapter *jme,
-               u32 *mask, u32 crc, int fnr)
+                      const u32 *mask, u32 crc, int fnr)
 {
        int i;
 
@@ -166,7 +166,7 @@ jme_setup_wakeup_frame(struct jme_adapter *jme,
 static inline void
 jme_reset_mac_processor(struct jme_adapter *jme)
 {
-       u32 mask[WAKEUP_FRAME_MASK_DWNR] = {0, 0, 0, 0};
+       static const u32 mask[WAKEUP_FRAME_MASK_DWNR] = {0, 0, 0, 0};
        u32 crc = 0xCDCDCDCD;
        u32 gpreg0;
        int i;
@@ -2150,21 +2150,13 @@ jme_change_mtu(struct net_device *netdev, int new_mtu)
        }
 
        if (new_mtu > 1900) {
-               netdev->features &= ~(NETIF_F_HW_CSUM |
-                               NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               );
+               netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+                               NETIF_F_TSO | NETIF_F_TSO6);
        } else {
                if (test_bit(JME_FLAG_TXCSUM, &jme->flags))
-                       netdev->features |= NETIF_F_HW_CSUM;
+                       netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
                if (test_bit(JME_FLAG_TSO, &jme->flags))
-                       netdev->features |= NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               ;
+                       netdev->features |= NETIF_F_TSO | NETIF_F_TSO6;
        }
 
        netdev->mtu = new_mtu;
@@ -2613,10 +2605,12 @@ jme_set_tx_csum(struct net_device *netdev, u32 on)
        if (on) {
                set_bit(JME_FLAG_TXCSUM, &jme->flags);
                if (netdev->mtu <= 1900)
-                       netdev->features |= NETIF_F_HW_CSUM;
+                       netdev->features |=
+                               NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
        } else {
                clear_bit(JME_FLAG_TXCSUM, &jme->flags);
-               netdev->features &= ~NETIF_F_HW_CSUM;
+               netdev->features &=
+                               ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
        }
 
        return 0;
@@ -2630,18 +2624,10 @@ jme_set_tso(struct net_device *netdev, u32 on)
        if (on) {
                set_bit(JME_FLAG_TSO, &jme->flags);
                if (netdev->mtu <= 1900)
-                       netdev->features |= NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               ;
+                       netdev->features |= NETIF_F_TSO | NETIF_F_TSO6;
        } else {
                clear_bit(JME_FLAG_TSO, &jme->flags);
-               netdev->features &= ~(NETIF_F_TSO
-#ifdef NETIF_F_TSO6
-                               | NETIF_F_TSO6
-#endif
-                               );
+               netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
        }
 
        return 0;
@@ -2864,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)
@@ -2949,12 +2937,11 @@ jme_init_one(struct pci_dev *pdev,
 #endif
        netdev->ethtool_ops             = &jme_ethtool_ops;
        netdev->watchdog_timeo          = TX_TIMEOUT;
-       netdev->features                =       NETIF_F_HW_CSUM |
+       netdev->features                =       NETIF_F_IP_CSUM |
+                                               NETIF_F_IPV6_CSUM |
                                                NETIF_F_SG |
                                                NETIF_F_TSO |
-#ifdef NETIF_F_TSO6
                                                NETIF_F_TSO6 |
-#endif
                                                NETIF_F_HW_VLAN_TX |
                                                NETIF_F_HW_VLAN_RX;
        if (using_dac)
@@ -3089,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);
@@ -3109,18 +3096,14 @@ jme_init_one(struct pci_dev *pdev,
         * Tell stack that we are not ready to work until open()
         */
        netif_carrier_off(netdev);
-       netif_stop_queue(netdev);
 
-       /*
-        * Register netdev
-        */
        rc = register_netdev(netdev);
        if (rc) {
                pr_err("Cannot register net device\n");
                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" :
@@ -3128,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],