|
@@ -450,6 +450,21 @@ int mmc_spi_set_crc(struct mmc_host *host, int use_crc)
|
|
|
return err;
|
|
|
}
|
|
|
|
|
|
+int mmc_switch_status_error(struct mmc_host *host, u32 status)
|
|
|
+{
|
|
|
+ if (mmc_host_is_spi(host)) {
|
|
|
+ if (status & R1_SPI_ILLEGAL_COMMAND)
|
|
|
+ return -EBADMSG;
|
|
|
+ } else {
|
|
|
+ if (status & 0xFDFFA000)
|
|
|
+ pr_warn("%s: unexpected status %#x after switch\n",
|
|
|
+ mmc_hostname(host), status);
|
|
|
+ if (status & R1_SWITCH_ERROR)
|
|
|
+ return -EBADMSG;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* __mmc_switch - modify EXT_CSD register
|
|
|
* @card: the MMC card associated with the data transfer
|
|
@@ -558,20 +573,7 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
|
|
|
}
|
|
|
} while (R1_CURRENT_STATE(status) == R1_STATE_PRG);
|
|
|
|
|
|
- if (mmc_host_is_spi(host)) {
|
|
|
- if (status & R1_SPI_ILLEGAL_COMMAND) {
|
|
|
- err = -EBADMSG;
|
|
|
- goto out;
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (status & 0xFDFFA000)
|
|
|
- pr_warn("%s: unexpected status %#x after switch\n",
|
|
|
- mmc_hostname(host), status);
|
|
|
- if (status & R1_SWITCH_ERROR) {
|
|
|
- err = -EBADMSG;
|
|
|
- goto out;
|
|
|
- }
|
|
|
- }
|
|
|
+ err = mmc_switch_status_error(host, status);
|
|
|
out:
|
|
|
mmc_retune_release(host);
|
|
|
|