aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-10-02 17:27:39 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:27 -0400
commit9e81d331f2ec65695e4366ce592e14f9700bae8b (patch)
treecc193c4fbceed81065ead642b7da009d8ffba746 /drivers/net
parent7ddeae2c6ceed7f786344731dda27d4277957780 (diff)
pasemi_mac: clear out old errors on interface open
pasemi_mac: clear out old errors on interface open Clear out any pending errors when an interface is brought up. Since the bits are sticky, they might be from interface shutdown time after firmware has used it, etc. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/pasemi_mac.c57
-rw-r--r--drivers/net/pasemi_mac.h7
2 files changed, 51 insertions, 13 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index ef1ebb4b8af2..967ff8c96b0f 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -903,16 +903,27 @@ static int pasemi_mac_open(struct net_device *dev)
903 903
904 /* enable rx if */ 904 /* enable rx if */
905 write_dma_reg(mac, PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 905 write_dma_reg(mac, PAS_DMA_RXINT_RCMDSTA(mac->dma_if),
906 PAS_DMA_RXINT_RCMDSTA_EN); 906 PAS_DMA_RXINT_RCMDSTA_EN |
907 PAS_DMA_RXINT_RCMDSTA_DROPS_M |
908 PAS_DMA_RXINT_RCMDSTA_BP |
909 PAS_DMA_RXINT_RCMDSTA_OO |
910 PAS_DMA_RXINT_RCMDSTA_BT);
907 911
908 /* enable rx channel */ 912 /* enable rx channel */
909 write_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch), 913 write_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch),
910 PAS_DMA_RXCHAN_CCMDSTA_EN | 914 PAS_DMA_RXCHAN_CCMDSTA_EN |
911 PAS_DMA_RXCHAN_CCMDSTA_DU); 915 PAS_DMA_RXCHAN_CCMDSTA_DU |
916 PAS_DMA_RXCHAN_CCMDSTA_OD |
917 PAS_DMA_RXCHAN_CCMDSTA_FD |
918 PAS_DMA_RXCHAN_CCMDSTA_DT);
912 919
913 /* enable tx channel */ 920 /* enable tx channel */
914 write_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch), 921 write_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch),
915 PAS_DMA_TXCHAN_TCMDSTA_EN); 922 PAS_DMA_TXCHAN_TCMDSTA_EN |
923 PAS_DMA_TXCHAN_TCMDSTA_SZ |
924 PAS_DMA_TXCHAN_TCMDSTA_DB |
925 PAS_DMA_TXCHAN_TCMDSTA_DE |
926 PAS_DMA_TXCHAN_TCMDSTA_DA);
916 927
917 pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE); 928 pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE);
918 929
@@ -987,7 +998,7 @@ out_rx_resources:
987static int pasemi_mac_close(struct net_device *dev) 998static int pasemi_mac_close(struct net_device *dev)
988{ 999{
989 struct pasemi_mac *mac = netdev_priv(dev); 1000 struct pasemi_mac *mac = netdev_priv(dev);
990 unsigned int stat; 1001 unsigned int sta;
991 int retries; 1002 int retries;
992 1003
993 if (mac->phydev) { 1004 if (mac->phydev) {
@@ -998,6 +1009,26 @@ static int pasemi_mac_close(struct net_device *dev)
998 netif_stop_queue(dev); 1009 netif_stop_queue(dev);
999 napi_disable(&mac->napi); 1010 napi_disable(&mac->napi);
1000 1011
1012 sta = read_dma_reg(mac, PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
1013 if (sta & (PAS_DMA_RXINT_RCMDSTA_BP |
1014 PAS_DMA_RXINT_RCMDSTA_OO |
1015 PAS_DMA_RXINT_RCMDSTA_BT))
1016 printk(KERN_DEBUG "pasemi_mac: rcmdsta error: 0x%08x\n", sta);
1017
1018 sta = read_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch));
1019 if (sta & (PAS_DMA_RXCHAN_CCMDSTA_DU |
1020 PAS_DMA_RXCHAN_CCMDSTA_OD |
1021 PAS_DMA_RXCHAN_CCMDSTA_FD |
1022 PAS_DMA_RXCHAN_CCMDSTA_DT))
1023 printk(KERN_DEBUG "pasemi_mac: ccmdsta error: 0x%08x\n", sta);
1024
1025 sta = read_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch));
1026 if (sta & (PAS_DMA_TXCHAN_TCMDSTA_SZ |
1027 PAS_DMA_TXCHAN_TCMDSTA_DB |
1028 PAS_DMA_TXCHAN_TCMDSTA_DE |
1029 PAS_DMA_TXCHAN_TCMDSTA_DA))
1030 printk(KERN_DEBUG "pasemi_mac: tcmdsta error: 0x%08x\n", sta);
1031
1001 /* Clean out any pending buffers */ 1032 /* Clean out any pending buffers */
1002 pasemi_mac_clean_tx(mac); 1033 pasemi_mac_clean_tx(mac);
1003 pasemi_mac_clean_rx(mac, RX_RING_SIZE); 1034 pasemi_mac_clean_rx(mac, RX_RING_SIZE);
@@ -1008,33 +1039,33 @@ static int pasemi_mac_close(struct net_device *dev)
1008 write_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch), PAS_DMA_RXCHAN_CCMDSTA_ST); 1039 write_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch), PAS_DMA_RXCHAN_CCMDSTA_ST);
1009 1040
1010 for (retries = 0; retries < MAX_RETRIES; retries++) { 1041 for (retries = 0; retries < MAX_RETRIES; retries++) {
1011 stat = read_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch)); 1042 sta = read_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch));
1012 if (!(stat & PAS_DMA_TXCHAN_TCMDSTA_ACT)) 1043 if (!(sta & PAS_DMA_TXCHAN_TCMDSTA_ACT))
1013 break; 1044 break;
1014 cond_resched(); 1045 cond_resched();
1015 } 1046 }
1016 1047
1017 if (stat & PAS_DMA_TXCHAN_TCMDSTA_ACT) 1048 if (sta & PAS_DMA_TXCHAN_TCMDSTA_ACT)
1018 dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n"); 1049 dev_err(&mac->dma_pdev->dev, "Failed to stop tx channel\n");
1019 1050
1020 for (retries = 0; retries < MAX_RETRIES; retries++) { 1051 for (retries = 0; retries < MAX_RETRIES; retries++) {
1021 stat = read_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch)); 1052 sta = read_dma_reg(mac, PAS_DMA_RXCHAN_CCMDSTA(mac->dma_rxch));
1022 if (!(stat & PAS_DMA_RXCHAN_CCMDSTA_ACT)) 1053 if (!(sta & PAS_DMA_RXCHAN_CCMDSTA_ACT))
1023 break; 1054 break;
1024 cond_resched(); 1055 cond_resched();
1025 } 1056 }
1026 1057
1027 if (stat & PAS_DMA_RXCHAN_CCMDSTA_ACT) 1058 if (sta & PAS_DMA_RXCHAN_CCMDSTA_ACT)
1028 dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n"); 1059 dev_err(&mac->dma_pdev->dev, "Failed to stop rx channel\n");
1029 1060
1030 for (retries = 0; retries < MAX_RETRIES; retries++) { 1061 for (retries = 0; retries < MAX_RETRIES; retries++) {
1031 stat = read_dma_reg(mac, PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); 1062 sta = read_dma_reg(mac, PAS_DMA_RXINT_RCMDSTA(mac->dma_if));
1032 if (!(stat & PAS_DMA_RXINT_RCMDSTA_ACT)) 1063 if (!(sta & PAS_DMA_RXINT_RCMDSTA_ACT))
1033 break; 1064 break;
1034 cond_resched(); 1065 cond_resched();
1035 } 1066 }
1036 1067
1037 if (stat & PAS_DMA_RXINT_RCMDSTA_ACT) 1068 if (sta & PAS_DMA_RXINT_RCMDSTA_ACT)
1038 dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n"); 1069 dev_err(&mac->dma_pdev->dev, "Failed to stop rx interface\n");
1039 1070
1040 /* Then, disable the channel. This must be done separately from 1071 /* Then, disable the channel. This must be done separately from
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index db3393674ae7..0bb3c487478d 100644
--- a/drivers/net/pasemi_mac.h
+++ b/drivers/net/pasemi_mac.h
@@ -241,6 +241,10 @@ enum {
241#define PAS_DMA_TXCHAN_TCMDSTA_EN 0x00000001 /* Enabled */ 241#define PAS_DMA_TXCHAN_TCMDSTA_EN 0x00000001 /* Enabled */
242#define PAS_DMA_TXCHAN_TCMDSTA_ST 0x00000002 /* Stop interface */ 242#define PAS_DMA_TXCHAN_TCMDSTA_ST 0x00000002 /* Stop interface */
243#define PAS_DMA_TXCHAN_TCMDSTA_ACT 0x00010000 /* Active */ 243#define PAS_DMA_TXCHAN_TCMDSTA_ACT 0x00010000 /* Active */
244#define PAS_DMA_TXCHAN_TCMDSTA_SZ 0x00000800
245#define PAS_DMA_TXCHAN_TCMDSTA_DB 0x00000400
246#define PAS_DMA_TXCHAN_TCMDSTA_DE 0x00000200
247#define PAS_DMA_TXCHAN_TCMDSTA_DA 0x00000100
244#define PAS_DMA_TXCHAN_CFG(c) (0x304+(c)*_PAS_DMA_TXCHAN_STRIDE) 248#define PAS_DMA_TXCHAN_CFG(c) (0x304+(c)*_PAS_DMA_TXCHAN_STRIDE)
245#define PAS_DMA_TXCHAN_CFG_TY_IFACE 0x00000000 /* Type = interface */ 249#define PAS_DMA_TXCHAN_CFG_TY_IFACE 0x00000000 /* Type = interface */
246#define PAS_DMA_TXCHAN_CFG_TATTR_M 0x0000003c 250#define PAS_DMA_TXCHAN_CFG_TATTR_M 0x0000003c
@@ -283,6 +287,9 @@ enum {
283#define PAS_DMA_RXCHAN_CCMDSTA_ST 0x00000002 /* Stop interface */ 287#define PAS_DMA_RXCHAN_CCMDSTA_ST 0x00000002 /* Stop interface */
284#define PAS_DMA_RXCHAN_CCMDSTA_ACT 0x00010000 /* Active */ 288#define PAS_DMA_RXCHAN_CCMDSTA_ACT 0x00010000 /* Active */
285#define PAS_DMA_RXCHAN_CCMDSTA_DU 0x00020000 289#define PAS_DMA_RXCHAN_CCMDSTA_DU 0x00020000
290#define PAS_DMA_RXCHAN_CCMDSTA_OD 0x00002000
291#define PAS_DMA_RXCHAN_CCMDSTA_FD 0x00001000
292#define PAS_DMA_RXCHAN_CCMDSTA_DT 0x00000800
286#define PAS_DMA_RXCHAN_CFG(c) (0x804+(c)*_PAS_DMA_RXCHAN_STRIDE) 293#define PAS_DMA_RXCHAN_CFG(c) (0x804+(c)*_PAS_DMA_RXCHAN_STRIDE)
287#define PAS_DMA_RXCHAN_CFG_HBU_M 0x00000380 294#define PAS_DMA_RXCHAN_CFG_HBU_M 0x00000380
288#define PAS_DMA_RXCHAN_CFG_HBU_S 7 295#define PAS_DMA_RXCHAN_CFG_HBU_S 7