diff options
author | Ronald Cron <ronald.cron@arm.com> | 2015-04-02 13:49:05 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@Edk2> | 2015-04-02 13:49:05 +0000 |
commit | ac8f1e103d203d46b7a5e12bd6dc2f5c69008f83 (patch) | |
tree | e6f583924a10d79d19c164cee1f87deb1114b139 | |
parent | 88ff5ba79311c54007c75551da321a34ddee947c (diff) | |
download | edk2-ac8f1e103d203d46b7a5e12bd6dc2f5c69008f83.zip edk2-ac8f1e103d203d46b7a5e12bd6dc2f5c69008f83.tar.gz edk2-ac8f1e103d203d46b7a5e12bd6dc2f5c69008f83.tar.bz2 |
EmbeddedPkg/Lan9118Dxe: Fix the reset after a receiver or transmitter error
The Lan9118 driver did not recover after a receiver error as the error
handling code stopped the transmitter but did not restart it. Added the
restart of the transmitter.
Added also the restart of the receiver after a transmitter error and
the reactivation of the LEDs after all resets.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17106 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c index 0503dbc..3b7882d 100644 --- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c +++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c @@ -434,6 +434,12 @@ SnpReset ( MmioWrite32 (LAN9118_PMT_CTRL, PmConf);
gBS->Stall (LAN9118_STALL);
+ // Reactivate the LEDs
+ Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
// Check that a buffer size was specified in SnpInitialize
if (gTxBuffer != 0) {
HwConf = MmioRead32 (LAN9118_HW_CFG); // Read the HW register
@@ -1062,19 +1068,28 @@ SnpGetStatus ( if (Interrupts & INSTS_TXE) {
DEBUG ((EFI_D_ERROR, "LAN9118: Transmitter error. Restarting..."));
- // Initiate a software reset
+ // Software reset, the TXE interrupt is cleared by the reset.
Status = SoftReset (0, Snp);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "\n\tSoft Reset Failed: Hardware Error\n"));
return EFI_DEVICE_ERROR;
}
- // Acknowledge the TXE
- MmioWrite32 (LAN9118_INT_STS, INSTS_TXE);
- gBS->Stall (LAN9118_STALL);
+ // Reactivate the LEDs
+ Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- // Restart the transmitter
+ //
+ // Restart the transmitter and if necessary the receiver.
+ // Do not ask for FIFO reset as it has already been done
+ // by SoftReset().
+ //
StartTx (START_TX_MAC | START_TX_CFG, Snp);
+ if (Snp->Mode->ReceiveFilterSetting != 0) {
+ StartRx (0, Snp);
+ }
}
// Update the media status
@@ -1442,19 +1457,25 @@ SnpReceive ( if (MmioRead32 (LAN9118_INT_STS) & INSTS_RXE) {
DEBUG ((EFI_D_WARN, "Warning: Receiver Error. Restarting...\n"));
- // Initiate a software reset
+ // Software reset, the RXE interrupt is cleared by the reset.
Status = SoftReset (0, Snp);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Error: Soft Reset Failed: Hardware Error.\n"));
return EFI_DEVICE_ERROR;
}
- // Acknowledge the RXE
- MmioWrite32 (LAN9118_INT_STS, INSTS_RXE);
- gBS->Stall (LAN9118_STALL);
+ // Reactivate the LEDs
+ Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- // Restart the rx (and do not clear FIFO)
+ //
+ // Restart the receiver and the transmitter without reseting the FIFOs
+ // as it has been done by SoftReset().
+ //
StartRx (0, Snp);
+ StartTx (START_TX_MAC | START_TX_CFG, Snp);
// Say that command could not be sent
return EFI_DEVICE_ERROR;
|