The interrupt status of the SD was not being cleared after the
operation was completed which was causing problems for other
applications that were loaded.
{
u32 status;
u16 cmdreg;
+ int result = 0;
#ifdef DEBUG_VERBOSE
printf("pele_sdh_request: cmdidx: %d arg: 0x%x\n",
SD_RST_CMD|SD_RST_DATA);
if (status & (SD_INT_ERR_CTIMEOUT|SD_INT_ERR_DTIMEOUT)) {
- return TIMEOUT;
+ result = TIMEOUT;
+ goto exit;
} else {
- return COMM_ERR;
+ result = COMM_ERR;
+ goto exit;
}
}
if (status & SD_INT_CMD_CMPL) {
memcpy(data->dest, sd_dma_buffer, 512);
}
- return 0;
+exit:
+ /* Clear all pending interrupt status */
+ sd_out32(SD_INT_STAT_R, 0xFFFFFFFF);
+
+ return result;
}
static void pele_sdh_set_ios(struct mmc *mmc)