diff options
-rw-r--r-- | drivers/mmc/mmc.c | 3 | ||||
-rw-r--r-- | include/linux/mmc/card.h | 15 |
2 files changed, 11 insertions, 7 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index f772df93a398..ccd3037da249 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -980,7 +980,7 @@ static void mmc_discover_cards(struct mmc_host *host) | |||
980 | card->state &= ~MMC_STATE_DEAD; | 980 | card->state &= ~MMC_STATE_DEAD; |
981 | 981 | ||
982 | if (host->mode == MMC_MODE_SD) { | 982 | if (host->mode == MMC_MODE_SD) { |
983 | mmc_card_set_sd(card); | 983 | card->type = MMC_TYPE_SD; |
984 | 984 | ||
985 | cmd.opcode = SD_SEND_RELATIVE_ADDR; | 985 | cmd.opcode = SD_SEND_RELATIVE_ADDR; |
986 | cmd.arg = 0; | 986 | cmd.arg = 0; |
@@ -1003,6 +1003,7 @@ static void mmc_discover_cards(struct mmc_host *host) | |||
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | } else { | 1005 | } else { |
1006 | card->type = MMC_TYPE_MMC; | ||
1006 | cmd.opcode = MMC_SET_RELATIVE_ADDR; | 1007 | cmd.opcode = MMC_SET_RELATIVE_ADDR; |
1007 | cmd.arg = card->rca << 16; | 1008 | cmd.arg = card->rca << 16; |
1008 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | 1009 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 5d9896c260a2..1ca50542ce19 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -65,14 +65,16 @@ struct mmc_card { | |||
65 | struct mmc_host *host; /* the host this device belongs to */ | 65 | struct mmc_host *host; /* the host this device belongs to */ |
66 | struct device dev; /* the device */ | 66 | struct device dev; /* the device */ |
67 | unsigned int rca; /* relative card address of device */ | 67 | unsigned int rca; /* relative card address of device */ |
68 | unsigned int type; /* card type */ | ||
69 | #define MMC_TYPE_MMC 0 /* MMC card */ | ||
70 | #define MMC_TYPE_SD 1 /* SD card */ | ||
68 | unsigned int state; /* (our) card state */ | 71 | unsigned int state; /* (our) card state */ |
69 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ | 72 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ |
70 | #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ | 73 | #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ |
71 | #define MMC_STATE_BAD (1<<2) /* unrecognised device */ | 74 | #define MMC_STATE_BAD (1<<2) /* unrecognised device */ |
72 | #define MMC_STATE_SDCARD (1<<3) /* is an SD card */ | 75 | #define MMC_STATE_READONLY (1<<3) /* card is read-only */ |
73 | #define MMC_STATE_READONLY (1<<4) /* card is read-only */ | 76 | #define MMC_STATE_HIGHSPEED (1<<4) /* card is in high speed mode */ |
74 | #define MMC_STATE_HIGHSPEED (1<<5) /* card is in high speed mode */ | 77 | #define MMC_STATE_BLOCKADDR (1<<5) /* card uses block-addressing */ |
75 | #define MMC_STATE_BLOCKADDR (1<<6) /* card uses block-addressing */ | ||
76 | u32 raw_cid[4]; /* raw card CID */ | 78 | u32 raw_cid[4]; /* raw card CID */ |
77 | u32 raw_csd[4]; /* raw card CSD */ | 79 | u32 raw_csd[4]; /* raw card CSD */ |
78 | u32 raw_scr[2]; /* raw card SCR */ | 80 | u32 raw_scr[2]; /* raw card SCR */ |
@@ -83,10 +85,12 @@ struct mmc_card { | |||
83 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ | 85 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ |
84 | }; | 86 | }; |
85 | 87 | ||
88 | #define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) | ||
89 | #define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) | ||
90 | |||
86 | #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) | 91 | #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) |
87 | #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) | 92 | #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) |
88 | #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) | 93 | #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) |
89 | #define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) | ||
90 | #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) | 94 | #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) |
91 | #define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) | 95 | #define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) |
92 | #define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) | 96 | #define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) |
@@ -94,7 +98,6 @@ struct mmc_card { | |||
94 | #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) | 98 | #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) |
95 | #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) | 99 | #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) |
96 | #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) | 100 | #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) |
97 | #define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) | ||
98 | #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) | 101 | #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) |
99 | #define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) | 102 | #define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) |
100 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) | 103 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) |