* ngbe_stop_hw - Generic stop Tx/Rx units * @hw: pointer to hardware structure * * Sets the adapter_stopped flag within ngbe_hw struct. Clears interrupts, * disables transmit and receive units. The adapter_stopped flag is used by * the shared code and drivers to determine if the adapter is in a stopped * state and should not touch the hardware. **/
| 340 | * state and should not touch the hardware. |
| 341 | **/ |
| 342 | s32 ngbe_stop_hw(struct ngbe_hw *hw) |
| 343 | { |
| 344 | u16 i; |
| 345 | s32 status = 0; |
| 346 | |
| 347 | /* |
| 348 | * Set the adapter_stopped flag so other driver functions stop touching |
| 349 | * the hardware |
| 350 | */ |
| 351 | hw->adapter_stopped = true; |
| 352 | |
| 353 | /* Disable the receive unit */ |
| 354 | ngbe_disable_rx(hw); |
| 355 | |
| 356 | /* Clear interrupt mask to stop interrupts from being generated */ |
| 357 | wr32(hw, NGBE_IENMISC, 0); |
| 358 | wr32(hw, NGBE_IMS(0), NGBE_IMS_MASK); |
| 359 | |
| 360 | /* Clear any pending interrupts, flush previous writes */ |
| 361 | wr32(hw, NGBE_ICRMISC, NGBE_ICRMISC_MASK); |
| 362 | wr32(hw, NGBE_ICR(0), NGBE_ICR_MASK); |
| 363 | |
| 364 | wr32(hw, NGBE_BMECTL, 0x3); |
| 365 | |
| 366 | /* Disable the receive unit by stopping each queue */ |
| 367 | for (i = 0; i < hw->mac.max_rx_queues; i++) |
| 368 | wr32(hw, NGBE_RXCFG(i), 0); |
| 369 | |
| 370 | /* flush all queues disables */ |
| 371 | ngbe_flush(hw); |
| 372 | msec_delay(2); |
| 373 | |
| 374 | /* |
| 375 | * Prevent the PCI-E bus from hanging by disabling PCI-E master |
| 376 | * access and verify no pending requests |
| 377 | */ |
| 378 | status = ngbe_set_pcie_master(hw, false); |
| 379 | if (status) |
| 380 | return status; |
| 381 | |
| 382 | /* Disable the transmit unit. Each queue must be disabled. */ |
| 383 | for (i = 0; i < hw->mac.max_tx_queues; i++) |
| 384 | wr32(hw, NGBE_TXCFG(i), 0); |
| 385 | |
| 386 | /* flush all queues disables */ |
| 387 | ngbe_flush(hw); |
| 388 | msec_delay(2); |
| 389 | |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | /** |
| 394 | * ngbe_led_on - Turns on the software controllable LEDs. |
no test coverage detected