aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/jme.c
diff options
context:
space:
mode:
authorGuo-Fu Tseng <cooldavid@cooldavid.org>2009-07-06 00:40:38 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-06 16:05:07 -0400
commitd1dfa1d1de855e8db58ec4e403af5939d273f8fe (patch)
tree1b992906cd438e5e0dc5ad0b1789271c71c9de7e /drivers/net/jme.c
parent47bd10d14b3341004266395014007c120a359c9d (diff)
jme: Remove shadow register support
The hardware failed to update the shadow register in several cases. It's known to be failed at 64bit box with more than 4G RAM. In order to make the device working stable, give up using the shadow register feature. Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/jme.c')
-rw-r--r--drivers/net/jme.c49
1 files changed, 4 insertions, 45 deletions
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index 4a55b055bcb3..29cd5f43eea5 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -322,20 +322,6 @@ jme_stop_irq(struct jme_adapter *jme)
322 jwrite32f(jme, JME_IENC, INTR_ENABLE); 322 jwrite32f(jme, JME_IENC, INTR_ENABLE);
323} 323}
324 324
325static inline void
326jme_enable_shadow(struct jme_adapter *jme)
327{
328 jwrite32(jme,
329 JME_SHBA_LO,
330 ((u32)jme->shadow_dma & ~((u32)0x1F)) | SHBA_POSTEN);
331}
332
333static inline void
334jme_disable_shadow(struct jme_adapter *jme)
335{
336 jwrite32(jme, JME_SHBA_LO, 0x0);
337}
338
339static u32 325static u32
340jme_linkstat_from_phy(struct jme_adapter *jme) 326jme_linkstat_from_phy(struct jme_adapter *jme)
341{ 327{
@@ -1521,12 +1507,7 @@ jme_msi(int irq, void *dev_id)
1521 struct jme_adapter *jme = netdev_priv(netdev); 1507 struct jme_adapter *jme = netdev_priv(netdev);
1522 u32 intrstat; 1508 u32 intrstat;
1523 1509
1524 pci_dma_sync_single_for_cpu(jme->pdev, 1510 intrstat = jread32(jme, JME_IEVE);
1525 jme->shadow_dma,
1526 sizeof(u32) * SHADOW_REG_NR,
1527 PCI_DMA_FROMDEVICE);
1528 intrstat = jme->shadow_regs[SHADOW_IEVE];
1529 jme->shadow_regs[SHADOW_IEVE] = 0;
1530 1511
1531 jme_intr_msi(jme, intrstat); 1512 jme_intr_msi(jme, intrstat);
1532 1513
@@ -1613,7 +1594,6 @@ jme_open(struct net_device *netdev)
1613 if (rc) 1594 if (rc)
1614 goto err_out; 1595 goto err_out;
1615 1596
1616 jme_enable_shadow(jme);
1617 jme_start_irq(jme); 1597 jme_start_irq(jme);
1618 1598
1619 if (test_bit(JME_FLAG_SSET, &jme->flags)) 1599 if (test_bit(JME_FLAG_SSET, &jme->flags))
@@ -1681,7 +1661,6 @@ jme_close(struct net_device *netdev)
1681 netif_carrier_off(netdev); 1661 netif_carrier_off(netdev);
1682 1662
1683 jme_stop_irq(jme); 1663 jme_stop_irq(jme);
1684 jme_disable_shadow(jme);
1685 jme_free_irq(jme); 1664 jme_free_irq(jme);
1686 1665
1687 JME_NAPI_DISABLE(jme); 1666 JME_NAPI_DISABLE(jme);
@@ -2764,14 +2743,6 @@ jme_init_one(struct pci_dev *pdev,
2764 rc = -ENOMEM; 2743 rc = -ENOMEM;
2765 goto err_out_free_netdev; 2744 goto err_out_free_netdev;
2766 } 2745 }
2767 jme->shadow_regs = pci_alloc_consistent(pdev,
2768 sizeof(u32) * SHADOW_REG_NR,
2769 &(jme->shadow_dma));
2770 if (!(jme->shadow_regs)) {
2771 jeprintk(pdev, "Allocating shadow register mapping error.\n");
2772 rc = -ENOMEM;
2773 goto err_out_unmap;
2774 }
2775 2746
2776 if (no_pseudohp) { 2747 if (no_pseudohp) {
2777 apmc = jread32(jme, JME_APMC) & ~JME_APMC_PSEUDO_HP_EN; 2748 apmc = jread32(jme, JME_APMC) & ~JME_APMC_PSEUDO_HP_EN;
@@ -2857,7 +2828,7 @@ jme_init_one(struct pci_dev *pdev,
2857 if (!jme->mii_if.phy_id) { 2828 if (!jme->mii_if.phy_id) {
2858 rc = -EIO; 2829 rc = -EIO;
2859 jeprintk(pdev, "Can not find phy_id.\n"); 2830 jeprintk(pdev, "Can not find phy_id.\n");
2860 goto err_out_free_shadow; 2831 goto err_out_unmap;
2861 } 2832 }
2862 2833
2863 jme->reg_ghc |= GHC_LINK_POLL; 2834 jme->reg_ghc |= GHC_LINK_POLL;
@@ -2886,7 +2857,7 @@ jme_init_one(struct pci_dev *pdev,
2886 if (rc) { 2857 if (rc) {
2887 jeprintk(pdev, 2858 jeprintk(pdev,
2888 "Reload eeprom for reading MAC Address error.\n"); 2859 "Reload eeprom for reading MAC Address error.\n");
2889 goto err_out_free_shadow; 2860 goto err_out_unmap;
2890 } 2861 }
2891 jme_load_macaddr(netdev); 2862 jme_load_macaddr(netdev);
2892 2863
@@ -2902,7 +2873,7 @@ jme_init_one(struct pci_dev *pdev,
2902 rc = register_netdev(netdev); 2873 rc = register_netdev(netdev);
2903 if (rc) { 2874 if (rc) {
2904 jeprintk(pdev, "Cannot register net device.\n"); 2875 jeprintk(pdev, "Cannot register net device.\n");
2905 goto err_out_free_shadow; 2876 goto err_out_unmap;
2906 } 2877 }
2907 2878
2908 msg_probe(jme, "%s%s ver:%x rev:%x macaddr:%pM\n", 2879 msg_probe(jme, "%s%s ver:%x rev:%x macaddr:%pM\n",
@@ -2916,11 +2887,6 @@ jme_init_one(struct pci_dev *pdev,
2916 2887
2917 return 0; 2888 return 0;
2918 2889
2919err_out_free_shadow:
2920 pci_free_consistent(pdev,
2921 sizeof(u32) * SHADOW_REG_NR,
2922 jme->shadow_regs,
2923 jme->shadow_dma);
2924err_out_unmap: 2890err_out_unmap:
2925 iounmap(jme->regs); 2891 iounmap(jme->regs);
2926err_out_free_netdev: 2892err_out_free_netdev:
@@ -2941,10 +2907,6 @@ jme_remove_one(struct pci_dev *pdev)
2941 struct jme_adapter *jme = netdev_priv(netdev); 2907 struct jme_adapter *jme = netdev_priv(netdev);
2942 2908
2943 unregister_netdev(netdev); 2909 unregister_netdev(netdev);
2944 pci_free_consistent(pdev,
2945 sizeof(u32) * SHADOW_REG_NR,
2946 jme->shadow_regs,
2947 jme->shadow_dma);
2948 iounmap(jme->regs); 2910 iounmap(jme->regs);
2949 pci_set_drvdata(pdev, NULL); 2911 pci_set_drvdata(pdev, NULL);
2950 free_netdev(netdev); 2912 free_netdev(netdev);
@@ -2970,8 +2932,6 @@ jme_suspend(struct pci_dev *pdev, pm_message_t state)
2970 tasklet_disable(&jme->rxclean_task); 2932 tasklet_disable(&jme->rxclean_task);
2971 tasklet_disable(&jme->rxempty_task); 2933 tasklet_disable(&jme->rxempty_task);
2972 2934
2973 jme_disable_shadow(jme);
2974
2975 if (netif_carrier_ok(netdev)) { 2935 if (netif_carrier_ok(netdev)) {
2976 if (test_bit(JME_FLAG_POLL, &jme->flags)) 2936 if (test_bit(JME_FLAG_POLL, &jme->flags))
2977 jme_polling_mode(jme); 2937 jme_polling_mode(jme);
@@ -3023,7 +2983,6 @@ jme_resume(struct pci_dev *pdev)
3023 else 2983 else
3024 jme_reset_phy_processor(jme); 2984 jme_reset_phy_processor(jme);
3025 2985
3026 jme_enable_shadow(jme);
3027 jme_start_irq(jme); 2986 jme_start_irq(jme);
3028 netif_device_attach(netdev); 2987 netif_device_attach(netdev);
3029 2988