diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-07-22 16:18:46 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 02:46:48 -0400 |
commit | 17b0429dde9ab60f9cee8e07ab28c7dc6cfe6efd (patch) | |
tree | 9f87df1ffbeca4c6f828b7979f2e45ef898a3ef0 /drivers/mmc/host/sdhci.c | |
parent | b7e113dc9d52c4a37d2da6fafe77959f3a28eccf (diff) |
mmc: remove custom error codes
Convert the MMC layer to use standard error codes and not its own,
incompatible values.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 20a7d89e01ba..479d6a265dd1 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -481,16 +481,16 @@ static void sdhci_finish_data(struct sdhci_host *host) | |||
481 | * Controller doesn't count down when in single block mode. | 481 | * Controller doesn't count down when in single block mode. |
482 | */ | 482 | */ |
483 | if (data->blocks == 1) | 483 | if (data->blocks == 1) |
484 | blocks = (data->error == MMC_ERR_NONE) ? 0 : 1; | 484 | blocks = (data->error == 0) ? 0 : 1; |
485 | else | 485 | else |
486 | blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); | 486 | blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); |
487 | data->bytes_xfered = data->blksz * (data->blocks - blocks); | 487 | data->bytes_xfered = data->blksz * (data->blocks - blocks); |
488 | 488 | ||
489 | if ((data->error == MMC_ERR_NONE) && blocks) { | 489 | if (!data->error && blocks) { |
490 | printk(KERN_ERR "%s: Controller signalled completion even " | 490 | printk(KERN_ERR "%s: Controller signalled completion even " |
491 | "though there were blocks left.\n", | 491 | "though there were blocks left.\n", |
492 | mmc_hostname(host->mmc)); | 492 | mmc_hostname(host->mmc)); |
493 | data->error = MMC_ERR_FAILED; | 493 | data->error = -EIO; |
494 | } | 494 | } |
495 | 495 | ||
496 | if (data->stop) { | 496 | if (data->stop) { |
@@ -498,7 +498,7 @@ static void sdhci_finish_data(struct sdhci_host *host) | |||
498 | * The controller needs a reset of internal state machines | 498 | * The controller needs a reset of internal state machines |
499 | * upon error conditions. | 499 | * upon error conditions. |
500 | */ | 500 | */ |
501 | if (data->error != MMC_ERR_NONE) { | 501 | if (data->error) { |
502 | sdhci_reset(host, SDHCI_RESET_CMD); | 502 | sdhci_reset(host, SDHCI_RESET_CMD); |
503 | sdhci_reset(host, SDHCI_RESET_DATA); | 503 | sdhci_reset(host, SDHCI_RESET_DATA); |
504 | } | 504 | } |
@@ -533,7 +533,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) | |||
533 | printk(KERN_ERR "%s: Controller never released " | 533 | printk(KERN_ERR "%s: Controller never released " |
534 | "inhibit bit(s).\n", mmc_hostname(host->mmc)); | 534 | "inhibit bit(s).\n", mmc_hostname(host->mmc)); |
535 | sdhci_dumpregs(host); | 535 | sdhci_dumpregs(host); |
536 | cmd->error = MMC_ERR_FAILED; | 536 | cmd->error = -EIO; |
537 | tasklet_schedule(&host->finish_tasklet); | 537 | tasklet_schedule(&host->finish_tasklet); |
538 | return; | 538 | return; |
539 | } | 539 | } |
@@ -554,7 +554,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) | |||
554 | if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { | 554 | if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { |
555 | printk(KERN_ERR "%s: Unsupported response type!\n", | 555 | printk(KERN_ERR "%s: Unsupported response type!\n", |
556 | mmc_hostname(host->mmc)); | 556 | mmc_hostname(host->mmc)); |
557 | cmd->error = MMC_ERR_INVALID; | 557 | cmd->error = -EINVAL; |
558 | tasklet_schedule(&host->finish_tasklet); | 558 | tasklet_schedule(&host->finish_tasklet); |
559 | return; | 559 | return; |
560 | } | 560 | } |
@@ -601,7 +601,7 @@ static void sdhci_finish_command(struct sdhci_host *host) | |||
601 | } | 601 | } |
602 | } | 602 | } |
603 | 603 | ||
604 | host->cmd->error = MMC_ERR_NONE; | 604 | host->cmd->error = 0; |
605 | 605 | ||
606 | if (host->data && host->data_early) | 606 | if (host->data && host->data_early) |
607 | sdhci_finish_data(host); | 607 | sdhci_finish_data(host); |
@@ -722,7 +722,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
722 | host->mrq = mrq; | 722 | host->mrq = mrq; |
723 | 723 | ||
724 | if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) { | 724 | if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) { |
725 | host->mrq->cmd->error = MMC_ERR_TIMEOUT; | 725 | host->mrq->cmd->error = -ENOMEDIUM; |
726 | tasklet_schedule(&host->finish_tasklet); | 726 | tasklet_schedule(&host->finish_tasklet); |
727 | } else | 727 | } else |
728 | sdhci_send_command(host, mrq->cmd); | 728 | sdhci_send_command(host, mrq->cmd); |
@@ -831,7 +831,7 @@ static void sdhci_tasklet_card(unsigned long param) | |||
831 | sdhci_reset(host, SDHCI_RESET_CMD); | 831 | sdhci_reset(host, SDHCI_RESET_CMD); |
832 | sdhci_reset(host, SDHCI_RESET_DATA); | 832 | sdhci_reset(host, SDHCI_RESET_DATA); |
833 | 833 | ||
834 | host->mrq->cmd->error = MMC_ERR_FAILED; | 834 | host->mrq->cmd->error = -ENOMEDIUM; |
835 | tasklet_schedule(&host->finish_tasklet); | 835 | tasklet_schedule(&host->finish_tasklet); |
836 | } | 836 | } |
837 | } | 837 | } |
@@ -859,9 +859,9 @@ static void sdhci_tasklet_finish(unsigned long param) | |||
859 | * The controller needs a reset of internal state machines | 859 | * The controller needs a reset of internal state machines |
860 | * upon error conditions. | 860 | * upon error conditions. |
861 | */ | 861 | */ |
862 | if ((mrq->cmd->error != MMC_ERR_NONE) || | 862 | if (mrq->cmd->error || |
863 | (mrq->data && ((mrq->data->error != MMC_ERR_NONE) || | 863 | (mrq->data && (mrq->data->error || |
864 | (mrq->data->stop && (mrq->data->stop->error != MMC_ERR_NONE))))) { | 864 | (mrq->data->stop && mrq->data->stop->error)))) { |
865 | 865 | ||
866 | /* Some controllers need this kick or reset won't work here */ | 866 | /* Some controllers need this kick or reset won't work here */ |
867 | if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { | 867 | if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { |
@@ -906,13 +906,13 @@ static void sdhci_timeout_timer(unsigned long data) | |||
906 | sdhci_dumpregs(host); | 906 | sdhci_dumpregs(host); |
907 | 907 | ||
908 | if (host->data) { | 908 | if (host->data) { |
909 | host->data->error = MMC_ERR_TIMEOUT; | 909 | host->data->error = -ETIMEDOUT; |
910 | sdhci_finish_data(host); | 910 | sdhci_finish_data(host); |
911 | } else { | 911 | } else { |
912 | if (host->cmd) | 912 | if (host->cmd) |
913 | host->cmd->error = MMC_ERR_TIMEOUT; | 913 | host->cmd->error = -ETIMEDOUT; |
914 | else | 914 | else |
915 | host->mrq->cmd->error = MMC_ERR_TIMEOUT; | 915 | host->mrq->cmd->error = -ETIMEDOUT; |
916 | 916 | ||
917 | tasklet_schedule(&host->finish_tasklet); | 917 | tasklet_schedule(&host->finish_tasklet); |
918 | } | 918 | } |
@@ -941,13 +941,12 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask) | |||
941 | } | 941 | } |
942 | 942 | ||
943 | if (intmask & SDHCI_INT_TIMEOUT) | 943 | if (intmask & SDHCI_INT_TIMEOUT) |
944 | host->cmd->error = MMC_ERR_TIMEOUT; | 944 | host->cmd->error = -ETIMEDOUT; |
945 | else if (intmask & SDHCI_INT_CRC) | 945 | else if (intmask & (SDHCI_INT_CRC | SDHCI_INT_END_BIT | |
946 | host->cmd->error = MMC_ERR_BADCRC; | 946 | SDHCI_INT_INDEX)) |
947 | else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX)) | 947 | host->cmd->error = -EILSEQ; |
948 | host->cmd->error = MMC_ERR_FAILED; | ||
949 | 948 | ||
950 | if (host->cmd->error != MMC_ERR_NONE) | 949 | if (host->cmd->error) |
951 | tasklet_schedule(&host->finish_tasklet); | 950 | tasklet_schedule(&host->finish_tasklet); |
952 | else if (intmask & SDHCI_INT_RESPONSE) | 951 | else if (intmask & SDHCI_INT_RESPONSE) |
953 | sdhci_finish_command(host); | 952 | sdhci_finish_command(host); |
@@ -974,13 +973,11 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) | |||
974 | } | 973 | } |
975 | 974 | ||
976 | if (intmask & SDHCI_INT_DATA_TIMEOUT) | 975 | if (intmask & SDHCI_INT_DATA_TIMEOUT) |
977 | host->data->error = MMC_ERR_TIMEOUT; | 976 | host->data->error = -ETIMEDOUT; |
978 | else if (intmask & SDHCI_INT_DATA_CRC) | 977 | else if (intmask & (SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_END_BIT)) |
979 | host->data->error = MMC_ERR_BADCRC; | 978 | host->data->error = -EILSEQ; |
980 | else if (intmask & SDHCI_INT_DATA_END_BIT) | ||
981 | host->data->error = MMC_ERR_FAILED; | ||
982 | 979 | ||
983 | if (host->data->error != MMC_ERR_NONE) | 980 | if (host->data->error) |
984 | sdhci_finish_data(host); | 981 | sdhci_finish_data(host); |
985 | else { | 982 | else { |
986 | if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) | 983 | if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) |