projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mmc: at91_mci: cleanup: use MCI_ERRORS
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
mmc
/
host
/
at91_mci.c
diff --git
a/drivers/mmc/host/at91_mci.c
b/drivers/mmc/host/at91_mci.c
index bfebd2fa7ada9a50c9359fe463f68565e492adae..7a452c2ad1f9ce2207bc78ba9458b6195796f89d 100644
(file)
--- a/
drivers/mmc/host/at91_mci.c
+++ b/
drivers/mmc/host/at91_mci.c
@@
-328,7
+328,7
@@
static void at91_mci_handle_transmitted(struct at91mci_host *host)
data = cmd->data;
if (!data) return;
data = cmd->data;
if (!data) return;
- if (cmd->data->
flags & MMC_DATA_MULTI
) {
+ if (cmd->data->
blocks > 1
) {
pr_debug("multiple write : wait for BLKE...\n");
at91_mci_write(host, AT91_MCI_IER, AT91_MCI_BLKE);
} else
pr_debug("multiple write : wait for BLKE...\n");
at91_mci_write(host, AT91_MCI_IER, AT91_MCI_BLKE);
} else
@@
-428,6
+428,14
@@
static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
}
if (data) {
}
if (data) {
+
+ if ( data->blksz & 0x3 ) {
+ pr_debug("Unsupported block size\n");
+ cmd->error = -EINVAL;
+ mmc_request_done(host->mmc, host->request);
+ return;
+ }
+
block_length = data->blksz;
blocks = data->blocks;
block_length = data->blksz;
blocks = data->blocks;
@@
-439,7
+447,7
@@
static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command
if (data->flags & MMC_DATA_STREAM)
cmdr |= AT91_MCI_TRTYP_STREAM;
if (data->flags & MMC_DATA_STREAM)
cmdr |= AT91_MCI_TRTYP_STREAM;
- if (data->
flags & MMC_DATA_MULTI
)
+ if (data->
blocks > 1
)
cmdr |= AT91_MCI_TRTYP_MULTIPLE;
}
else {
cmdr |= AT91_MCI_TRTYP_MULTIPLE;
}
else {
@@
-573,28
+581,24
@@
static void at91_mci_completed_command(struct at91mci_host *host)
pr_debug("Status = %08X [%08X %08X %08X %08X]\n",
status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
pr_debug("Status = %08X [%08X %08X %08X %08X]\n",
status, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
- if (status & (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE |
- AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE |
- AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)) {
+ if (status & AT91_MCI_ERRORS) {
if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
if ((status & AT91_MCI_RCRCE) && !(mmc_resp_type(cmd) & MMC_RSP_CRC)) {
- cmd->error =
MMC_ERR_NONE
;
+ cmd->error =
0
;
}
else {
if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE))
}
else {
if (status & (AT91_MCI_RTOE | AT91_MCI_DTOE))
- cmd->error =
MMC_ERR_TIME
OUT;
+ cmd->error =
-ETIMED
OUT;
else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE))
else if (status & (AT91_MCI_RCRCE | AT91_MCI_DCRCE))
- cmd->error = MMC_ERR_BADCRC;
- else if (status & (AT91_MCI_OVRE | AT91_MCI_UNRE))
- cmd->error = MMC_ERR_FIFO;
+ cmd->error = -EILSEQ;
else
else
- cmd->error =
MMC_ERR_FAILED
;
+ cmd->error =
-EIO
;
pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n",
cmd->error, cmd->opcode, cmd->retries);
}
}
else
pr_debug("Error detected and set to %d (cmd = %d, retries = %d)\n",
cmd->error, cmd->opcode, cmd->retries);
}
}
else
- cmd->error =
MMC_ERR_NONE
;
+ cmd->error =
0
;
at91_mci_process_next(host);
}
at91_mci_process_next(host);
}
@@
-836,7
+840,6
@@
static int __init at91_mci_probe(struct platform_device *pdev)
mmc->f_min = 375000;
mmc->f_max = 25000000;
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
mmc->f_min = 375000;
mmc->f_max = 25000000;
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
- mmc->caps = MMC_CAP_BYTEBLOCK;
mmc->max_blk_size = 4095;
mmc->max_blk_count = mmc->max_req_size;
mmc->max_blk_size = 4095;
mmc->max_blk_count = mmc->max_req_size;
@@
-941,7
+944,7
@@
static int __exit at91_mci_remove(struct platform_device *pdev)
host = mmc_priv(mmc);
host = mmc_priv(mmc);
- if (host->
present != -1
) {
+ if (host->
board->det_pin
) {
device_init_wakeup(&pdev->dev, 0);
free_irq(host->board->det_pin, host);
cancel_delayed_work(&host->mmc->detect);
device_init_wakeup(&pdev->dev, 0);
free_irq(host->board->det_pin, host);
cancel_delayed_work(&host->mmc->detect);
@@
-972,7
+975,7
@@
static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state)
struct at91mci_host *host = mmc_priv(mmc);
int ret = 0;
struct at91mci_host *host = mmc_priv(mmc);
int ret = 0;
- if (device_may_wakeup(&pdev->dev))
+ if (
host->board->det_pin &&
device_may_wakeup(&pdev->dev))
enable_irq_wake(host->board->det_pin);
if (mmc)
enable_irq_wake(host->board->det_pin);
if (mmc)
@@
-987,7
+990,7
@@
static int at91_mci_resume(struct platform_device *pdev)
struct at91mci_host *host = mmc_priv(mmc);
int ret = 0;
struct at91mci_host *host = mmc_priv(mmc);
int ret = 0;
- if (device_may_wakeup(&pdev->dev))
+ if (
host->board->det_pin &&
device_may_wakeup(&pdev->dev))
disable_irq_wake(host->board->det_pin);
if (mmc)
disable_irq_wake(host->board->det_pin);
if (mmc)