aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-05-04 13:22:51 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-05-04 13:22:51 -0400
commit920e70c5c603ada05dd480ca0ccc0ae12a5fdc39 (patch)
tree8eb39280a5d5ce881315b9ac774ad41ca9516bc4 /drivers/mmc
parentfe10c6abea8bc83291a13e0580b3e4c355710b09 (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')
-rw-r--r--drivers/mmc/at91_mci.c3
-rw-r--r--drivers/mmc/au1xmmc.c4
-rw-r--r--drivers/mmc/imxmmc.c4
-rw-r--r--drivers/mmc/mmc.c51
-rw-r--r--drivers/mmc/mmci.c3
-rw-r--r--drivers/mmc/pxamci.c4
-rw-r--r--drivers/mmc/sdhci.c4
-rw-r--r--drivers/mmc/wbsd.c4
8 files changed, 34 insertions, 43 deletions
diff --git a/drivers/mmc/at91_mci.c b/drivers/mmc/at91_mci.c
index 6061c2d101a0..88f0eef9cf33 100644
--- a/drivers/mmc/at91_mci.c
+++ b/drivers/mmc/at91_mci.c
@@ -621,9 +621,6 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
621 struct at91mci_host *host = mmc_priv(mmc); 621 struct at91mci_host *host = mmc_priv(mmc);
622 unsigned long at91_master_clock = clk_get_rate(mci_clk); 622 unsigned long at91_master_clock = clk_get_rate(mci_clk);
623 623
624 DBG("Clock %uHz, busmode %u, powermode %u, Vdd %u\n",
625 ios->clock, ios->bus_mode, ios->power_mode, ios->vdd);
626
627 if (host) 624 if (host)
628 host->bus_mode = ios->bus_mode; 625 host->bus_mode = ios->bus_mode;
629 else 626 else
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c
index c0326bbc5f28..914d62b24064 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/au1xmmc.c
@@ -720,10 +720,6 @@ static void au1xmmc_set_ios(struct mmc_host* mmc, struct mmc_ios* ios)
720{ 720{
721 struct au1xmmc_host *host = mmc_priv(mmc); 721 struct au1xmmc_host *host = mmc_priv(mmc);
722 722
723 DBG("set_ios (power=%u, clock=%uHz, vdd=%u, mode=%u)\n",
724 host->id, ios->power_mode, ios->clock, ios->vdd,
725 ios->bus_mode);
726
727 if (ios->power_mode == MMC_POWER_OFF) 723 if (ios->power_mode == MMC_POWER_OFF)
728 au1xmmc_set_power(host, 0); 724 au1xmmc_set_power(host, 0);
729 else if (ios->power_mode == MMC_POWER_ON) { 725 else if (ios->power_mode == MMC_POWER_ON) {
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c
index bc271925099a..79358e223f57 100644
--- a/drivers/mmc/imxmmc.c
+++ b/drivers/mmc/imxmmc.c
@@ -807,10 +807,6 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
807 struct imxmci_host *host = mmc_priv(mmc); 807 struct imxmci_host *host = mmc_priv(mmc);
808 int prescaler; 808 int prescaler;
809 809
810 dev_dbg(mmc_dev(host->mmc), "clock %u power %u vdd %u width %u\n",
811 ios->clock, ios->power_mode, ios->vdd,
812 (ios->bus_width==MMC_BUS_WIDTH_4)?4:1);
813
814 if( ios->bus_width==MMC_BUS_WIDTH_4 ) { 810 if( ios->bus_width==MMC_BUS_WIDTH_4 ) {
815 host->actual_bus_width = MMC_BUS_WIDTH_4; 811 host->actual_bus_width = MMC_BUS_WIDTH_4;
816 imx_gpio_mode(PB11_PF_SD_DAT3); 812 imx_gpio_mode(PB11_PF_SD_DAT3);
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[] = {
69void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) 69void 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);
96void 99void
97mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) 100mmc_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
312EXPORT_SYMBOL(mmc_release_host); 316EXPORT_SYMBOL(mmc_release_host);
313 317
318static 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
314static int mmc_select_card(struct mmc_host *host, struct mmc_card *card) 330static 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
730static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) 746static 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);
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index df7e861e2fc7..da8e4d7339cc 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -402,9 +402,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
402 struct mmci_host *host = mmc_priv(mmc); 402 struct mmci_host *host = mmc_priv(mmc);
403 u32 clk = 0, pwr = 0; 403 u32 clk = 0, pwr = 0;
404 404
405 DBG(host, "clock %uHz busmode %u powermode %u Vdd %u\n",
406 ios->clock, ios->bus_mode, ios->power_mode, ios->vdd);
407
408 if (ios->clock) { 405 if (ios->clock) {
409 if (ios->clock >= host->mclk) { 406 if (ios->clock >= host->mclk) {
410 clk = MCI_CLK_BYPASS; 407 clk = MCI_CLK_BYPASS;
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c
index 40970c4ae3e6..f97b472085cb 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/pxamci.c
@@ -365,10 +365,6 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
365{ 365{
366 struct pxamci_host *host = mmc_priv(mmc); 366 struct pxamci_host *host = mmc_priv(mmc);
367 367
368 pr_debug("PXAMCI: clock %u power %u vdd %u.%02u\n",
369 ios->clock, ios->power_mode, ios->vdd / 100,
370 ios->vdd % 100);
371
372 if (ios->clock) { 368 if (ios->clock) {
373 unsigned int clk = CLOCKRATE / ios->clock; 369 unsigned int clk = CLOCKRATE / ios->clock;
374 if (CLOCKRATE / clk > ios->clock) 370 if (CLOCKRATE / clk > ios->clock)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index bdbfca050029..b0053280ff2d 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -570,10 +570,6 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
570 570
571 spin_lock_irqsave(&host->lock, flags); 571 spin_lock_irqsave(&host->lock, flags);
572 572
573 DBG("clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n",
574 ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select,
575 ios->vdd, ios->bus_width);
576
577 /* 573 /*
578 * Reset the chip on each power off. 574 * Reset the chip on each power off.
579 * Should clear out any weird states. 575 * Should clear out any weird states.
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index 511f7b0b31d2..39b3d97f891e 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -931,10 +931,6 @@ static void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
931 struct wbsd_host *host = mmc_priv(mmc); 931 struct wbsd_host *host = mmc_priv(mmc);
932 u8 clk, setup, pwr; 932 u8 clk, setup, pwr;
933 933
934 DBGF("clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n",
935 ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select,
936 ios->vdd, ios->bus_width);
937
938 spin_lock_bh(&host->lock); 934 spin_lock_bh(&host->lock);
939 935
940 /* 936 /*