diff options
author | Guo-Fu Tseng <cooldavid@cooldavid.org> | 2009-07-06 00:40:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-07-06 16:05:07 -0400 |
commit | d1dfa1d1de855e8db58ec4e403af5939d273f8fe (patch) | |
tree | 1b992906cd438e5e0dc5ad0b1789271c71c9de7e /drivers | |
parent | 47bd10d14b3341004266395014007c120a359c9d (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')
-rw-r--r-- | drivers/net/jme.c | 49 | ||||
-rw-r--r-- | drivers/net/jme.h | 14 |
2 files changed, 4 insertions, 59 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 | ||
325 | static inline void | ||
326 | jme_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 | |||
333 | static inline void | ||
334 | jme_disable_shadow(struct jme_adapter *jme) | ||
335 | { | ||
336 | jwrite32(jme, JME_SHBA_LO, 0x0); | ||
337 | } | ||
338 | |||
339 | static u32 | 325 | static u32 |
340 | jme_linkstat_from_phy(struct jme_adapter *jme) | 326 | jme_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 | ||
2919 | err_out_free_shadow: | ||
2920 | pci_free_consistent(pdev, | ||
2921 | sizeof(u32) * SHADOW_REG_NR, | ||
2922 | jme->shadow_regs, | ||
2923 | jme->shadow_dma); | ||
2924 | err_out_unmap: | 2890 | err_out_unmap: |
2925 | iounmap(jme->regs); | 2891 | iounmap(jme->regs); |
2926 | err_out_free_netdev: | 2892 | err_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 | ||
diff --git a/drivers/net/jme.h b/drivers/net/jme.h index 9d3cedd394a0..db912f6b37a8 100644 --- a/drivers/net/jme.h +++ b/drivers/net/jme.h | |||
@@ -410,13 +410,10 @@ struct jme_ring { | |||
410 | /* | 410 | /* |
411 | * Jmac Adapter Private data | 411 | * Jmac Adapter Private data |
412 | */ | 412 | */ |
413 | #define SHADOW_REG_NR 8 | ||
414 | struct jme_adapter { | 413 | struct jme_adapter { |
415 | struct pci_dev *pdev; | 414 | struct pci_dev *pdev; |
416 | struct net_device *dev; | 415 | struct net_device *dev; |
417 | void __iomem *regs; | 416 | void __iomem *regs; |
418 | dma_addr_t shadow_dma; | ||
419 | u32 *shadow_regs; | ||
420 | struct mii_if_info mii_if; | 417 | struct mii_if_info mii_if; |
421 | struct jme_ring rxring[RX_RING_NR]; | 418 | struct jme_ring rxring[RX_RING_NR]; |
422 | struct jme_ring txring[TX_RING_NR]; | 419 | struct jme_ring txring[TX_RING_NR]; |
@@ -463,10 +460,6 @@ struct jme_adapter { | |||
463 | DECLARE_NET_DEVICE_STATS | 460 | DECLARE_NET_DEVICE_STATS |
464 | }; | 461 | }; |
465 | 462 | ||
466 | enum shadow_reg_val { | ||
467 | SHADOW_IEVE = 0, | ||
468 | }; | ||
469 | |||
470 | enum jme_flags_bits { | 463 | enum jme_flags_bits { |
471 | JME_FLAG_MSI = 1, | 464 | JME_FLAG_MSI = 1, |
472 | JME_FLAG_SSET = 2, | 465 | JME_FLAG_SSET = 2, |
@@ -1103,13 +1096,6 @@ enum jme_chipmode_shifts { | |||
1103 | }; | 1096 | }; |
1104 | 1097 | ||
1105 | /* | 1098 | /* |
1106 | * Shadow base address register bits | ||
1107 | */ | ||
1108 | enum jme_shadow_base_address_bits { | ||
1109 | SHBA_POSTEN = 0x1, | ||
1110 | }; | ||
1111 | |||
1112 | /* | ||
1113 | * Aggressive Power Mode Control | 1099 | * Aggressive Power Mode Control |
1114 | */ | 1100 | */ |
1115 | enum jme_apmc_bits { | 1101 | enum jme_apmc_bits { |