From 9dc7a4dc18756e3965d514bdf196644aae8ffadf Mon Sep 17 00:00:00 2001 From: hexkyz Date: Thu, 6 Feb 2020 19:15:13 +0000 Subject: [PATCH] fusee/sept: don't abort on SDMMC DMA transfer failures --- fusee/fusee-primary/src/sdmmc/sdmmc_core.c | 14 +++++--------- fusee/fusee-secondary/src/sdmmc/sdmmc_core.c | 14 +++++--------- sept/sept-secondary/src/sdmmc/sdmmc_core.c | 14 +++++--------- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/fusee/fusee-primary/src/sdmmc/sdmmc_core.c b/fusee/fusee-primary/src/sdmmc/sdmmc_core.c index 8d70676cd..e0805d991 100644 --- a/fusee/fusee-primary/src/sdmmc/sdmmc_core.c +++ b/fusee/fusee-primary/src/sdmmc/sdmmc_core.c @@ -615,7 +615,7 @@ static void sdmmc_autocal_run(sdmmc_t *sdmmc, SdmmcBusVoltage voltage) while ((sdmmc->regs->auto_cal_status & SDMMC_AUTOCAL_ACTIVE)) { /* Ensure we haven't timed out. */ if (get_time_since(timebase) > SDMMC_AUTOCAL_TIMEOUT) { - sdmmc_error(sdmmc, "Auto-calibration timed out!"); + sdmmc_warn(sdmmc, "Auto-calibration timed out!"); /* Force a register read to refresh the clock control value. */ sdmmc_get_sd_clock_control(sdmmc); @@ -1642,11 +1642,9 @@ int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, u is_dma = true; dma_blkcnt = sdmmc_dma_init(sdmmc, req); + /* Warn in case initialization failed. This could indicate hardware failure. */ if (!dma_blkcnt) - { - sdmmc_error(sdmmc, "Failed to initialize the DMA transfer!"); - return 0; - } + sdmmc_warn(sdmmc, "Failed to initialize the DMA transfer!"); /* If this is a SDMA write operation, copy the data into our bounce buffer. */ if (!sdmmc->use_adma && !req->is_read) @@ -1672,11 +1670,9 @@ int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, u /* Process the DMA request. */ if (req) { + /* Warn in case updating failed. This could indicate hardware failure. */ if (!sdmmc_dma_update(sdmmc)) - { - sdmmc_error(sdmmc, "Failed to process the DMA transfer!"); - return 0; - } + sdmmc_warn(sdmmc, "Failed to process the DMA transfer!"); /* If this is a SDMA read operation, copy the data from our bounce buffer. */ if (!sdmmc->use_adma && req->is_read) diff --git a/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c b/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c index 8d70676cd..e0805d991 100644 --- a/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c +++ b/fusee/fusee-secondary/src/sdmmc/sdmmc_core.c @@ -615,7 +615,7 @@ static void sdmmc_autocal_run(sdmmc_t *sdmmc, SdmmcBusVoltage voltage) while ((sdmmc->regs->auto_cal_status & SDMMC_AUTOCAL_ACTIVE)) { /* Ensure we haven't timed out. */ if (get_time_since(timebase) > SDMMC_AUTOCAL_TIMEOUT) { - sdmmc_error(sdmmc, "Auto-calibration timed out!"); + sdmmc_warn(sdmmc, "Auto-calibration timed out!"); /* Force a register read to refresh the clock control value. */ sdmmc_get_sd_clock_control(sdmmc); @@ -1642,11 +1642,9 @@ int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, u is_dma = true; dma_blkcnt = sdmmc_dma_init(sdmmc, req); + /* Warn in case initialization failed. This could indicate hardware failure. */ if (!dma_blkcnt) - { - sdmmc_error(sdmmc, "Failed to initialize the DMA transfer!"); - return 0; - } + sdmmc_warn(sdmmc, "Failed to initialize the DMA transfer!"); /* If this is a SDMA write operation, copy the data into our bounce buffer. */ if (!sdmmc->use_adma && !req->is_read) @@ -1672,11 +1670,9 @@ int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, u /* Process the DMA request. */ if (req) { + /* Warn in case updating failed. This could indicate hardware failure. */ if (!sdmmc_dma_update(sdmmc)) - { - sdmmc_error(sdmmc, "Failed to process the DMA transfer!"); - return 0; - } + sdmmc_warn(sdmmc, "Failed to process the DMA transfer!"); /* If this is a SDMA read operation, copy the data from our bounce buffer. */ if (!sdmmc->use_adma && req->is_read) diff --git a/sept/sept-secondary/src/sdmmc/sdmmc_core.c b/sept/sept-secondary/src/sdmmc/sdmmc_core.c index 8d70676cd..e0805d991 100644 --- a/sept/sept-secondary/src/sdmmc/sdmmc_core.c +++ b/sept/sept-secondary/src/sdmmc/sdmmc_core.c @@ -615,7 +615,7 @@ static void sdmmc_autocal_run(sdmmc_t *sdmmc, SdmmcBusVoltage voltage) while ((sdmmc->regs->auto_cal_status & SDMMC_AUTOCAL_ACTIVE)) { /* Ensure we haven't timed out. */ if (get_time_since(timebase) > SDMMC_AUTOCAL_TIMEOUT) { - sdmmc_error(sdmmc, "Auto-calibration timed out!"); + sdmmc_warn(sdmmc, "Auto-calibration timed out!"); /* Force a register read to refresh the clock control value. */ sdmmc_get_sd_clock_control(sdmmc); @@ -1642,11 +1642,9 @@ int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, u is_dma = true; dma_blkcnt = sdmmc_dma_init(sdmmc, req); + /* Warn in case initialization failed. This could indicate hardware failure. */ if (!dma_blkcnt) - { - sdmmc_error(sdmmc, "Failed to initialize the DMA transfer!"); - return 0; - } + sdmmc_warn(sdmmc, "Failed to initialize the DMA transfer!"); /* If this is a SDMA write operation, copy the data into our bounce buffer. */ if (!sdmmc->use_adma && !req->is_read) @@ -1672,11 +1670,9 @@ int sdmmc_send_cmd(sdmmc_t *sdmmc, sdmmc_command_t *cmd, sdmmc_request_t *req, u /* Process the DMA request. */ if (req) { + /* Warn in case updating failed. This could indicate hardware failure. */ if (!sdmmc_dma_update(sdmmc)) - { - sdmmc_error(sdmmc, "Failed to process the DMA transfer!"); - return 0; - } + sdmmc_warn(sdmmc, "Failed to process the DMA transfer!"); /* If this is a SDMA read operation, copy the data from our bounce buffer. */ if (!sdmmc->use_adma && req->is_read)