diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2010-03-21 02:39:52 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2010-10-23 09:11:20 -0400 |
commit | 7fcc4ce37f0ccec846e32e1f5ff0647ded74fec9 (patch) | |
tree | a9fb854de26e92734effe634a44c9e916a80e716 /drivers/mmc | |
parent | 19d614a45ae4beb4712bb50ba3d816ae3fe0f1f2 (diff) |
mmc: cb710: implement get_cd() callback
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/cb710-mmc.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index ad61c4c11071..7a176b4949e7 100644 --- a/drivers/mmc/host/cb710-mmc.c +++ b/drivers/mmc/host/cb710-mmc.c | |||
@@ -100,12 +100,6 @@ static void cb710_mmc_reset_events(struct cb710_slot *slot) | |||
100 | cb710_write_port_8(slot, CB710_MMC_STATUS2_PORT, 0xFF); | 100 | cb710_write_port_8(slot, CB710_MMC_STATUS2_PORT, 0xFF); |
101 | } | 101 | } |
102 | 102 | ||
103 | static int cb710_mmc_is_card_inserted(struct cb710_slot *slot) | ||
104 | { | ||
105 | return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT) | ||
106 | & CB710_MMC_S3_CARD_DETECTED; | ||
107 | } | ||
108 | |||
109 | static void cb710_mmc_enable_4bit_data(struct cb710_slot *slot, int enable) | 103 | static void cb710_mmc_enable_4bit_data(struct cb710_slot *slot, int enable) |
110 | { | 104 | { |
111 | dev_dbg(cb710_slot_dev(slot), "configuring %d-data-line%s mode\n", | 105 | dev_dbg(cb710_slot_dev(slot), "configuring %d-data-line%s mode\n", |
@@ -499,13 +493,9 @@ static void cb710_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
499 | reader->mrq = mrq; | 493 | reader->mrq = mrq; |
500 | cb710_mmc_enable_irq(slot, CB710_MMC_IE_TEST_MASK, 0); | 494 | cb710_mmc_enable_irq(slot, CB710_MMC_IE_TEST_MASK, 0); |
501 | 495 | ||
502 | if (cb710_mmc_is_card_inserted(slot)) { | 496 | if (!cb710_mmc_command(mmc, mrq->cmd) && mrq->stop) |
503 | if (!cb710_mmc_command(mmc, mrq->cmd) && mrq->stop) | 497 | cb710_mmc_command(mmc, mrq->stop); |
504 | cb710_mmc_command(mmc, mrq->stop); | 498 | mdelay(1); |
505 | mdelay(1); | ||
506 | } else { | ||
507 | mrq->cmd->error = -ENOMEDIUM; | ||
508 | } | ||
509 | 499 | ||
510 | tasklet_schedule(&reader->finish_req_tasklet); | 500 | tasklet_schedule(&reader->finish_req_tasklet); |
511 | } | 501 | } |
@@ -579,12 +569,6 @@ static void cb710_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
579 | 569 | ||
580 | cb710_mmc_select_clock_divider(mmc, ios->clock); | 570 | cb710_mmc_select_clock_divider(mmc, ios->clock); |
581 | 571 | ||
582 | if (!cb710_mmc_is_card_inserted(slot)) { | ||
583 | dev_dbg(cb710_slot_dev(slot), | ||
584 | "no card inserted - ignoring bus powerup request\n"); | ||
585 | ios->power_mode = MMC_POWER_OFF; | ||
586 | } | ||
587 | |||
588 | if (ios->power_mode != reader->last_power_mode) | 572 | if (ios->power_mode != reader->last_power_mode) |
589 | switch (ios->power_mode) { | 573 | switch (ios->power_mode) { |
590 | case MMC_POWER_ON: | 574 | case MMC_POWER_ON: |
@@ -624,6 +608,14 @@ static int cb710_mmc_get_ro(struct mmc_host *mmc) | |||
624 | & CB710_MMC_S3_WRITE_PROTECTED; | 608 | & CB710_MMC_S3_WRITE_PROTECTED; |
625 | } | 609 | } |
626 | 610 | ||
611 | static int cb710_mmc_get_cd(struct mmc_host *mmc) | ||
612 | { | ||
613 | struct cb710_slot *slot = cb710_mmc_to_slot(mmc); | ||
614 | |||
615 | return cb710_read_port_8(slot, CB710_MMC_STATUS3_PORT) | ||
616 | & CB710_MMC_S3_CARD_DETECTED; | ||
617 | } | ||
618 | |||
627 | static int cb710_mmc_irq_handler(struct cb710_slot *slot) | 619 | static int cb710_mmc_irq_handler(struct cb710_slot *slot) |
628 | { | 620 | { |
629 | struct mmc_host *mmc = cb710_slot_to_mmc(slot); | 621 | struct mmc_host *mmc = cb710_slot_to_mmc(slot); |
@@ -669,7 +661,8 @@ static void cb710_mmc_finish_request_tasklet(unsigned long data) | |||
669 | static const struct mmc_host_ops cb710_mmc_host = { | 661 | static const struct mmc_host_ops cb710_mmc_host = { |
670 | .request = cb710_mmc_request, | 662 | .request = cb710_mmc_request, |
671 | .set_ios = cb710_mmc_set_ios, | 663 | .set_ios = cb710_mmc_set_ios, |
672 | .get_ro = cb710_mmc_get_ro | 664 | .get_ro = cb710_mmc_get_ro, |
665 | .get_cd = cb710_mmc_get_cd, | ||
673 | }; | 666 | }; |
674 | 667 | ||
675 | #ifdef CONFIG_PM | 668 | #ifdef CONFIG_PM |