Revert the last 3 commits (high speed SD);
it breaks w/ some SD cards.
Andres Salomon
dilinger at debian.unroutableorg
Fri Nov 10 17:38:19 EST 2006
Commit: 9248ec40a6f4bc85cd8c94c828c6d7f1cea47717
Parent: 8261a94675d6c41af5ed27e8bd315305d4eabf91
commit 9248ec40a6f4bc85cd8c94c828c6d7f1cea47717
Author: Andres Salomon <dilinger at debian.org>
AuthorDate: Fri Nov 10 17:42:17 2006 -0500
Commit: Andres Salomon <dilinger at debian.org>
CommitDate: Fri Nov 10 17:42:17 2006 -0500
Revert the last 3 commits (high speed SD); it breaks w/ some SD cards.
Signed-off-by: Andres Salomon <dilinger at debian.org>
---
drivers/mmc/mmc.c | 121 +-----------------------------------------
drivers/mmc/sdhci.c | 15 -----
drivers/mmc/sdhci.h | 2 -
include/linux/mmc/card.h | 7 --
include/linux/mmc/protocol.h | 22 --------
5 files changed, 4 insertions(+), 163 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index e007a91..82b7643 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1157,116 +1157,6 @@ static void mmc_read_scrs(struct mmc_hos
mmc_deselect_cards(host);
}
-static void mmc_read_switch_caps(struct mmc_host *host)
-{
- int err;
- struct mmc_card *card;
- struct mmc_request mrq;
- struct mmc_command cmd;
- struct mmc_data data;
- unsigned char *status;
- struct scatterlist sg;
-
- status = kmalloc(64, GFP_KERNEL);
- if (!status) {
- printk(KERN_WARNING "%s: Unable to allocate buffer for "
- "reading switch capabilities.\n",
- mmc_hostname(host));
- return;
- }
-
- list_for_each_entry(card, &host->cards, node) {
- if (card->state & (MMC_STATE_DEAD|MMC_STATE_PRESENT))
- continue;
- if (!mmc_card_sd(card))
- continue;
- if (card->scr.sda_vsn < SCR_SPEC_VER_1)
- continue;
-
- err = mmc_select_card(host, card);
- if (err != MMC_ERR_NONE) {
- mmc_card_set_dead(card);
- continue;
- }
-
- memset(&cmd, 0, sizeof(struct mmc_command));
-
- cmd.opcode = SD_SWITCH;
- cmd.arg = 0x00FFFFF1;
- cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
-
- memset(&data, 0, sizeof(struct mmc_data));
-
- mmc_set_data_timeout(&data, card, 0);
-
- data.blksz = 64;
- data.blocks = 1;
- data.flags = MMC_DATA_READ;
- data.sg = &sg;
- data.sg_len = 1;
-
- memset(&mrq, 0, sizeof(struct mmc_request));
-
- mrq.cmd = &cmd;
- mrq.data = &data;
-
- sg_init_one(&sg, status, 64);
-
- mmc_wait_for_req(host, &mrq);
-
- if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) {
- mmc_card_set_dead(card);
- continue;
- }
-
- if (status[13] & 0x02)
- card->sw_caps.hs_max_dtr = 50000000;
-
- memset(&cmd, 0, sizeof(struct mmc_command));
-
- cmd.opcode = SD_SWITCH;
- cmd.arg = 0x80FFFFF1;
- cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
-
- memset(&data, 0, sizeof(struct mmc_data));
-
- mmc_set_data_timeout(&data, card, 0);
-
- data.blksz = 64;
- data.blocks = 1;
- data.flags = MMC_DATA_READ;
- data.sg = &sg;
- data.sg_len = 1;
-
- memset(&mrq, 0, sizeof(struct mmc_request));
-
- mrq.cmd = &cmd;
- mrq.data = &data;
-
- sg_init_one(&sg, status, 64);
-
- mmc_wait_for_req(host, &mrq);
-
- if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE) {
- mmc_card_set_dead(card);
- continue;
- }
-
- if ((status[16] & 0xF) != 1) {
- printk(KERN_WARNING "%s: Problem switching card "
- "into high-speed mode!\n",
- mmc_hostname(host));
- continue;
- }
-
- mmc_card_set_highspeed(card);
- }
-
- kfree(status);
-
- mmc_deselect_cards(host);
-}
-
static unsigned int mmc_calculate_clock(struct mmc_host *host)
{
struct mmc_card *card;
@@ -1275,12 +1165,8 @@ static unsigned int mmc_calculate_clock(
list_for_each_entry(card, &host->cards, node)
if (!mmc_card_dead(card)) {
if (mmc_card_highspeed(card)) {
- if (!mmc_card_sd(card) &&
- (max_dtr > card->ext_csd.hs_max_dtr))
+ if (max_dtr > card->ext_csd.hs_max_dtr)
max_dtr = card->ext_csd.hs_max_dtr;
- if (mmc_card_sd(card) &&
- (max_dtr > card->sw_caps.hs_max_dtr))
- max_dtr = card->sw_caps.hs_max_dtr;
} else if (max_dtr > card->csd.max_dtr) {
max_dtr = card->csd.max_dtr;
}
@@ -1402,10 +1288,9 @@ static void mmc_setup(struct mmc_host *h
mmc_read_csds(host);
- if (host->mode == MMC_MODE_SD) {
+ if (host->mode == MMC_MODE_SD)
mmc_read_scrs(host);
- mmc_read_switch_caps(host);
- } else
+ else
mmc_process_ext_csds(host);
}
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 8ebf9ae..5ad520d 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -633,7 +633,6 @@ static void sdhci_finish_command(struct
static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
{
int div;
- u8 ctrl;
u16 clk;
unsigned long timeout;
@@ -642,13 +641,6 @@ static void sdhci_set_clock(struct sdhci
writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
- ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL);
- if (clock > 25000000)
- ctrl |= SDHCI_CTRL_HISPD;
- else
- ctrl &= ~SDHCI_CTRL_HISPD;
- writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL);
-
if (clock == 0)
goto out;
@@ -1311,13 +1303,6 @@ static int __devinit sdhci_probe_slot(st
else if (caps & SDHCI_CAN_VDD_180)
mmc->ocr_avail |= MMC_VDD_17_18|MMC_VDD_18_19;
- if ((host->max_clk > 25000000) && !(caps & SDHCI_CAN_DO_HISPD)) {
- printk(KERN_ERR "%s: Controller reports > 25 MHz base clock,"
- " but no high speed support.\n",
- host->slot_descr);
- mmc->f_max = 25000000;
- }
-
if (mmc->ocr_avail == 0) {
printk(KERN_ERR "%s: Hardware doesn't report any "
"support voltages.\n", host->slot_descr);
diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/sdhci.h
index f9d1a0a..72a6793 100644
--- a/drivers/mmc/sdhci.h
+++ b/drivers/mmc/sdhci.h
@@ -71,7 +71,6 @@ #define SDHCI_WRITE_PROTECT 0x00080000
#define SDHCI_HOST_CONTROL 0x28
#define SDHCI_CTRL_LED 0x01
#define SDHCI_CTRL_4BITBUS 0x02
-#define SDHCI_CTRL_HISPD 0x04
#define SDHCI_POWER_CONTROL 0x29
#define SDHCI_POWER_ON 0x01
@@ -139,7 +138,6 @@ #define SDHCI_CLOCK_BASE_MASK 0x00003F0
#define SDHCI_CLOCK_BASE_SHIFT 8
#define SDHCI_MAX_BLOCK_MASK 0x00030000
#define SDHCI_MAX_BLOCK_SHIFT 16
-#define SDHCI_CAN_DO_HISPD 0x00200000
#define SDHCI_CAN_DO_DMA 0x00400000
#define SDHCI_CAN_VDD_330 0x01000000
#define SDHCI_CAN_VDD_300 0x02000000
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d0e6a54..ce25256 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -50,10 +50,6 @@ #define SD_SCR_BUS_WIDTH_1 (1<<0)
#define SD_SCR_BUS_WIDTH_4 (1<<2)
};
-struct sd_switch_caps {
- unsigned int hs_max_dtr;
-};
-
struct mmc_host;
/*
@@ -70,7 +66,7 @@ #define MMC_STATE_DEAD (1<<1) /* devic
#define MMC_STATE_BAD (1<<2) /* unrecognised device */
#define MMC_STATE_SDCARD (1<<3) /* is an SD card */
#define MMC_STATE_READONLY (1<<4) /* card is read-only */
-#define MMC_STATE_HIGHSPEED (1<<5) /* card is in high speed mode */
+#define MMC_STATE_HIGHSPEED (1<<5) /* card is in mmc4 highspeed mode */
u32 raw_cid[4]; /* raw card CID */
u32 raw_csd[4]; /* raw card CSD */
u32 raw_scr[2]; /* raw card SCR */
@@ -78,7 +74,6 @@ #define MMC_STATE_HIGHSPEED (1<<5) /* c
struct mmc_csd csd; /* card specific */
struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */
struct sd_scr scr; /* extra SD information */
- struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
};
#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index 2dce60c..45c51fd 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -82,7 +82,6 @@ #define MMC_GEN_CMD 56 /*
/* class 8 */
/* This is basically the same command as for MMC with some quirks. */
#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
-#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
/* Application commands */
#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
@@ -102,19 +101,6 @@ #define SD_APP_SEND_SCR 51 /*
*/
/*
- * SD_SWITCH argument format:
- *
- * [31] Check (0) or switch (1)
- * [30:24] Reserved (0)
- * [23:20] Function group 6
- * [19:16] Function group 5
- * [15:12] Function group 4
- * [11:8] Function group 3
- * [7:4] Function group 2
- * [3:0] Function group 1
- */
-
-/*
MMC status in R1
Type
e : error bit
@@ -299,14 +285,6 @@ #define MMC_SWITCH_MODE_CLEAR_BITS 0x02
#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
/*
- * SCR field definitions
- */
-
-#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */
-#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */
-#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */
-
-/*
* SD bus widths
*/
#define SD_BUS_WIDTH_1 0
More information about the Commits-kernel
mailing list