/* reset device */ A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL waitForCompletion, A_BOOL coldReset) { A_STATUS status = A_OK; A_UINT32 address; A_UINT32 data; do { // Workaround BEGIN // address = RESET_CONTROL_ADDRESS; if (coldReset) { data = RESET_CONTROL_COLD_RST_MASK; } else { data = RESET_CONTROL_MBOX_RST_MASK; } /* Hardcode the address of RESET_CONTROL_ADDRESS based on the target type */ if (TargetType == TARGET_TYPE_AR6001) { address = AR6001_RESET_CONTROL_ADDRESS; } else if (TargetType == TARGET_TYPE_AR6002) { address = AR6002_RESET_CONTROL_ADDRESS; } else if (TargetType == TARGET_TYPE_AR6003) { address = AR6003_RESET_CONTROL_ADDRESS; } else { A_ASSERT(0); } status = ar6000_WriteRegDiag(hifDevice, &address, &data); if (A_FAILED(status)) { break; } if (!waitForCompletion) { break; } #if 0 /* Up to 2 second delay to allow things to settle down */ (void)_delay_until_target_alive(hifDevice, 2000, TargetType); /* * Read back the RESET CAUSE register to ensure that the cold reset * went through. */ // address = RESET_CAUSE_ADDRESS; /* Hardcode the address of RESET_CAUSE_ADDRESS based on the target type */ if (TargetType == TARGET_TYPE_AR6001) { address = 0x0C0000CC; } else if (TargetType == TARGET_TYPE_AR6002) { address = 0x000040C0; } else if (TargetType == TARGET_TYPE_AR6003) { address = 0x000040C0; } else { A_ASSERT(0); } data = 0; status = ar6000_ReadRegDiag(hifDevice, &address, &data); if (A_FAILED(status)) { break; } AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Reset Cause readback: 0x%X \n",data)); data &= RESET_CAUSE_LAST_MASK; if (data != 2) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Unable to cold reset the target \n")); } #endif // Workaroud END } while (FALSE); if (A_FAILED(status)) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Failed to reset target \n")); } return A_OK; }
/* reset device */ A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL waitForCompletion) { A_STATUS status = A_OK; A_UINT32 address; A_UINT32 data; do { data = RESET_CONTROL_COLD_RST_MASK; if (TargetType == TARGET_TYPE_AR6001) { address = AR6001_RESET_CONTROL_ADDRESS; } else if (TargetType == TARGET_TYPE_AR6002) { address = AR6002_RESET_CONTROL_ADDRESS; } else if (TargetType == TARGET_TYPE_AR6003) { address = AR6003_RESET_CONTROL_ADDRESS; } else { A_ASSERT(0); } status = ar6000_WriteRegDiag(hifDevice, &address, &data); if (A_FAILED(status)) { break; } if (!waitForCompletion) { break; } (void)_delay_until_target_alive(hifDevice, 1800, TargetType); if (TargetType == TARGET_TYPE_AR6001) { address = 0x0C0000CC; } else if (TargetType == TARGET_TYPE_AR6002) { address = 0x000040C0; } else if (TargetType == TARGET_TYPE_AR6003) { address = 0x000040C0; } else { A_ASSERT(0); } data = 0; status = ar6000_ReadRegDiag(hifDevice, &address, &data); if (A_FAILED(status)) { break; } AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Reset Cause readback: 0x%X \n",data)); data &= RESET_CAUSE_LAST_MASK; if (data != 2) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Unable to cold reset the target \n")); } } while (FALSE); if (A_FAILED(status)) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Failed to reset target \n")); } return A_OK; }