Skip to contentSkip to conversation

tsec: Wait for both RX and TX to stop

PATCH Superseded Andy Fleming 2 participants 2 messages Apr 19, 2010 – Apr 26, 2010 Network drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tsec: Wait for both RX and TX to stop

When gracefully stopping the controller, the driver was continuing if *either* RX or TX had stopped. We need to wait for both, or the controller could get into an invalid state.

---
 drivers/net/tsec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/tsec.c +2 -1
index fd49eff..3e4c3bd 100644
@@ -1082,7 +1082,8 @@ static void tsec_halt(struct eth_device *dev)
 	regs->dmactrl &= ~(DMACTRL_GRS | DMACTRL_GTS);
 	regs->dmactrl |= (DMACTRL_GRS | DMACTRL_GTS);
 
-	while (!(regs->ievent & (IEVENT_GRSC | IEVENT_GTSC))) ;
+	while ((regs->ievent & (IEVENT_GRSC | IEVENT_GTSC))
+		!= (IEVENT_GRSC | IEVENT_GTSC)) ;
 
 	regs->maccfg1 &= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);
 
Signature · 1 line
1.6.5.2.g6ff9a
Applied
#1 lore raw

PATCH 1/1 tsec: Wait for both RX and TX to stop

Andy,

Quoted 15 lines · Andy Fleming

When gracefully stopping the controller, the driver was continuing if *either* RX or TX had stopped. We need to wait for both, or the controller could get into an invalid state.

---
  drivers/net/tsec.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/tsec.c +0 -0
index fd49eff..3e4c3bd 100644

drivers/net/tsec.c static void tsec_halt(struct eth_device *dev) · line 1089

Quoted 9 lines
drivers/net/tsec.c +2 -1
@@ -1082,7 +1082,8 @@ static void tsec_halt(struct eth_device *dev)
  	regs->dmactrl&= ~(DMACTRL_GRS | DMACTRL_GTS);
  	regs->dmactrl |= (DMACTRL_GRS | DMACTRL_GTS);
 
-	while (!(regs->ievent&  (IEVENT_GRSC | IEVENT_GTSC))) ;
+	while ((regs->ievent&  (IEVENT_GRSC | IEVENT_GTSC))
+		!= (IEVENT_GRSC | IEVENT_GTSC)) ;
 
  	regs->maccfg1&= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);
 

Applied to net repo.

thanks,
Ben