diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-05-04 13:22:51 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-05-04 13:22:51 -0400 |
commit | 920e70c5c603ada05dd480ca0ccc0ae12a5fdc39 (patch) | |
tree | 8eb39280a5d5ce881315b9ac774ad41ca9516bc4 /drivers/mmc/mmc.c | |
parent | fe10c6abea8bc83291a13e0580b3e4c355710b09 (diff) |
[MMC] Move set_ios debugging into mmc.c
Rather than having every driver duplicate the set_ios debugging,
provide a single version in mmc.c which can be expanded as we
add additional functionality.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r-- | drivers/mmc/mmc.c | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 91c6b10dda9a..1ca2c8b9c9b5 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -69,10 +69,13 @@ static const unsigned int tacc_mant[] = { | |||
69 | void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) | 69 | void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) |
70 | { | 70 | { |
71 | struct mmc_command *cmd = mrq->cmd; | 71 | struct mmc_command *cmd = mrq->cmd; |
72 | int err = mrq->cmd->error; | 72 | int err = cmd->error; |
73 | pr_debug("MMC: req done (%02x): %d: %08x %08x %08x %08x\n", | 73 | |
74 | cmd->opcode, err, cmd->resp[0], cmd->resp[1], | 74 | pr_debug("%s: req done (CMD%u): %d/%d/%d: %08x %08x %08x %08x\n", |
75 | cmd->resp[2], cmd->resp[3]); | 75 | mmc_hostname(host), cmd->opcode, err, |
76 | mrq->data ? mrq->data->error : 0, | ||
77 | mrq->stop ? mrq->stop->error : 0, | ||
78 | cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]); | ||
76 | 79 | ||
77 | if (err && cmd->retries) { | 80 | if (err && cmd->retries) { |
78 | cmd->retries--; | 81 | cmd->retries--; |
@@ -96,8 +99,9 @@ EXPORT_SYMBOL(mmc_request_done); | |||
96 | void | 99 | void |
97 | mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) | 100 | mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) |
98 | { | 101 | { |
99 | pr_debug("MMC: starting cmd %02x arg %08x flags %08x\n", | 102 | pr_debug("%s: starting CMD%u arg %08x flags %08x\n", |
100 | mrq->cmd->opcode, mrq->cmd->arg, mrq->cmd->flags); | 103 | mmc_hostname(host), mrq->cmd->opcode, |
104 | mrq->cmd->arg, mrq->cmd->flags); | ||
101 | 105 | ||
102 | WARN_ON(host->card_busy == NULL); | 106 | WARN_ON(host->card_busy == NULL); |
103 | 107 | ||
@@ -311,6 +315,18 @@ void mmc_release_host(struct mmc_host *host) | |||
311 | 315 | ||
312 | EXPORT_SYMBOL(mmc_release_host); | 316 | EXPORT_SYMBOL(mmc_release_host); |
313 | 317 | ||
318 | static inline void mmc_set_ios(struct mmc_host *host) | ||
319 | { | ||
320 | struct mmc_ios *ios = &host->ios; | ||
321 | |||
322 | pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n", | ||
323 | mmc_hostname(host), ios->clock, ios->bus_mode, | ||
324 | ios->power_mode, ios->chip_select, ios->vdd, | ||
325 | ios->bus_width); | ||
326 | |||
327 | host->ops->set_ios(host, ios); | ||
328 | } | ||
329 | |||
314 | static int mmc_select_card(struct mmc_host *host, struct mmc_card *card) | 330 | static int mmc_select_card(struct mmc_host *host, struct mmc_card *card) |
315 | { | 331 | { |
316 | int err; | 332 | int err; |
@@ -363,7 +379,7 @@ static int mmc_select_card(struct mmc_host *host, struct mmc_card *card) | |||
363 | } | 379 | } |
364 | } | 380 | } |
365 | 381 | ||
366 | host->ops->set_ios(host, &host->ios); | 382 | mmc_set_ios(host); |
367 | 383 | ||
368 | return MMC_ERR_NONE; | 384 | return MMC_ERR_NONE; |
369 | } | 385 | } |
@@ -414,7 +430,7 @@ static u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) | |||
414 | ocr = 3 << bit; | 430 | ocr = 3 << bit; |
415 | 431 | ||
416 | host->ios.vdd = bit; | 432 | host->ios.vdd = bit; |
417 | host->ops->set_ios(host, &host->ios); | 433 | mmc_set_ios(host); |
418 | } else { | 434 | } else { |
419 | ocr = 0; | 435 | ocr = 0; |
420 | } | 436 | } |
@@ -667,7 +683,7 @@ static void mmc_idle_cards(struct mmc_host *host) | |||
667 | struct mmc_command cmd; | 683 | struct mmc_command cmd; |
668 | 684 | ||
669 | host->ios.chip_select = MMC_CS_HIGH; | 685 | host->ios.chip_select = MMC_CS_HIGH; |
670 | host->ops->set_ios(host, &host->ios); | 686 | mmc_set_ios(host); |
671 | 687 | ||
672 | mmc_delay(1); | 688 | mmc_delay(1); |
673 | 689 | ||
@@ -680,7 +696,7 @@ static void mmc_idle_cards(struct mmc_host *host) | |||
680 | mmc_delay(1); | 696 | mmc_delay(1); |
681 | 697 | ||
682 | host->ios.chip_select = MMC_CS_DONTCARE; | 698 | host->ios.chip_select = MMC_CS_DONTCARE; |
683 | host->ops->set_ios(host, &host->ios); | 699 | mmc_set_ios(host); |
684 | 700 | ||
685 | mmc_delay(1); | 701 | mmc_delay(1); |
686 | } | 702 | } |
@@ -705,13 +721,13 @@ static void mmc_power_up(struct mmc_host *host) | |||
705 | host->ios.chip_select = MMC_CS_DONTCARE; | 721 | host->ios.chip_select = MMC_CS_DONTCARE; |
706 | host->ios.power_mode = MMC_POWER_UP; | 722 | host->ios.power_mode = MMC_POWER_UP; |
707 | host->ios.bus_width = MMC_BUS_WIDTH_1; | 723 | host->ios.bus_width = MMC_BUS_WIDTH_1; |
708 | host->ops->set_ios(host, &host->ios); | 724 | mmc_set_ios(host); |
709 | 725 | ||
710 | mmc_delay(1); | 726 | mmc_delay(1); |
711 | 727 | ||
712 | host->ios.clock = host->f_min; | 728 | host->ios.clock = host->f_min; |
713 | host->ios.power_mode = MMC_POWER_ON; | 729 | host->ios.power_mode = MMC_POWER_ON; |
714 | host->ops->set_ios(host, &host->ios); | 730 | mmc_set_ios(host); |
715 | 731 | ||
716 | mmc_delay(2); | 732 | mmc_delay(2); |
717 | } | 733 | } |
@@ -724,7 +740,7 @@ static void mmc_power_off(struct mmc_host *host) | |||
724 | host->ios.chip_select = MMC_CS_DONTCARE; | 740 | host->ios.chip_select = MMC_CS_DONTCARE; |
725 | host->ios.power_mode = MMC_POWER_OFF; | 741 | host->ios.power_mode = MMC_POWER_OFF; |
726 | host->ios.bus_width = MMC_BUS_WIDTH_1; | 742 | host->ios.bus_width = MMC_BUS_WIDTH_1; |
727 | host->ops->set_ios(host, &host->ios); | 743 | mmc_set_ios(host); |
728 | } | 744 | } |
729 | 745 | ||
730 | static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) | 746 | static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) |
@@ -972,7 +988,8 @@ static unsigned int mmc_calculate_clock(struct mmc_host *host) | |||
972 | if (!mmc_card_dead(card) && max_dtr > card->csd.max_dtr) | 988 | if (!mmc_card_dead(card) && max_dtr > card->csd.max_dtr) |
973 | max_dtr = card->csd.max_dtr; | 989 | max_dtr = card->csd.max_dtr; |
974 | 990 | ||
975 | pr_debug("MMC: selected %d.%03dMHz transfer rate\n", | 991 | pr_debug("%s: selected %d.%03dMHz transfer rate\n", |
992 | mmc_hostname(host), | ||
976 | max_dtr / 1000000, (max_dtr / 1000) % 1000); | 993 | max_dtr / 1000000, (max_dtr / 1000) % 1000); |
977 | 994 | ||
978 | return max_dtr; | 995 | return max_dtr; |
@@ -1047,7 +1064,7 @@ static void mmc_setup(struct mmc_host *host) | |||
1047 | } else { | 1064 | } else { |
1048 | host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; | 1065 | host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; |
1049 | host->ios.clock = host->f_min; | 1066 | host->ios.clock = host->f_min; |
1050 | host->ops->set_ios(host, &host->ios); | 1067 | mmc_set_ios(host); |
1051 | 1068 | ||
1052 | /* | 1069 | /* |
1053 | * We should remember the OCR mask from the existing | 1070 | * We should remember the OCR mask from the existing |
@@ -1083,7 +1100,7 @@ static void mmc_setup(struct mmc_host *host) | |||
1083 | * Ok, now switch to push-pull mode. | 1100 | * Ok, now switch to push-pull mode. |
1084 | */ | 1101 | */ |
1085 | host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; | 1102 | host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; |
1086 | host->ops->set_ios(host, &host->ios); | 1103 | mmc_set_ios(host); |
1087 | 1104 | ||
1088 | mmc_read_csds(host); | 1105 | mmc_read_csds(host); |
1089 | 1106 | ||
@@ -1129,7 +1146,7 @@ static void mmc_rescan(void *data) | |||
1129 | * attached cards and the host support. | 1146 | * attached cards and the host support. |
1130 | */ | 1147 | */ |
1131 | host->ios.clock = mmc_calculate_clock(host); | 1148 | host->ios.clock = mmc_calculate_clock(host); |
1132 | host->ops->set_ios(host, &host->ios); | 1149 | mmc_set_ios(host); |
1133 | } | 1150 | } |
1134 | 1151 | ||
1135 | mmc_release_host(host); | 1152 | mmc_release_host(host); |