diff options
author | Pierre Ossman <drzeus-list@drzeus.cx> | 2005-09-06 18:18:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:50 -0400 |
commit | 335eadf2ef6a1122a720aea98e758e5d431da87d (patch) | |
tree | b20a0c21736cfca40a9df7ab2834b65079469992 /include/linux/mmc | |
parent | 328b9227865026268261a24a97a578907b280415 (diff) |
[PATCH] sd: initialize SD cards
Support for the Secure Digital protocol in the MMC layer.
A summary of the legal issues surrounding SD cards, as understood by yours
truly:
Members of the Secure Digital Association, hereafter SDA, are required to sign
a NDA[1] before given access to any specifications. It has been speculated
that including an SD implementation would forbid these members to redistribute
Linux. This is the basic problem with SD support so it is unclear if it even
is a problem since it has no effect on those of us that aren't members.
The SDA doesn't seem to enforce these rules though since the patches included
here are based on documentation made public by some of the members. The most
complete specs[2] are actually released by Sandisk, one of the founding
companies of the SDA.
Because of this the NDA is considered a non-issue by most involved in the
discussions concerning these patches. It might be that the SDA is only
interested in protecting the so called "secure" bits of SD, which so far
hasn't been found in any public spec. (The card is split into two sections,
one "normal" and one "secure" which has an access scheme similar to TPM:s).
(As a side note, Microsoft is working to make things easier for us since they
want to be able to include the source code for a SD driver in one of their
development kits. HP is making sure that the new NDA will allow a Linux
implementation. So far only the SDIO specs have been opened up[3]. More will
hopefully follow.)
[1] http://www.sdcard.org/membership/images/ippolicy.pdf
[2] http://www.sandisk.com/pdf/oem/ProdManualSDCardv1.9.pdf
[3] http://www.sdcard.org/sdio/Simplified%20SDIO%20Card%20Specification.pdf
This patch contains the central parts of the SD support. If no MMC cards are
found on a bus then the MMC layer proceeds looking for SD cards. Helper
functions are extended to handle the special needs of SD cards.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/mmc')
-rw-r--r-- | include/linux/mmc/card.h | 3 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 4 | ||||
-rw-r--r-- | include/linux/mmc/mmc.h | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index aefedf04b9bb..538e8c86336c 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -47,6 +47,7 @@ struct mmc_card { | |||
47 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ | 47 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ |
48 | #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ | 48 | #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ |
49 | #define MMC_STATE_BAD (1<<2) /* unrecognised device */ | 49 | #define MMC_STATE_BAD (1<<2) /* unrecognised device */ |
50 | #define MMC_STATE_SDCARD (1<<3) /* is an SD card */ | ||
50 | u32 raw_cid[4]; /* raw card CID */ | 51 | u32 raw_cid[4]; /* raw card CID */ |
51 | u32 raw_csd[4]; /* raw card CSD */ | 52 | u32 raw_csd[4]; /* raw card CSD */ |
52 | struct mmc_cid cid; /* card identification */ | 53 | struct mmc_cid cid; /* card identification */ |
@@ -56,10 +57,12 @@ struct mmc_card { | |||
56 | #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) | 57 | #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) |
57 | #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) | 58 | #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) |
58 | #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) | 59 | #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) |
60 | #define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) | ||
59 | 61 | ||
60 | #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) | 62 | #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) |
61 | #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) | 63 | #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) |
62 | #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) | 64 | #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) |
65 | #define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) | ||
63 | 66 | ||
64 | #define mmc_card_name(c) ((c)->cid.prod_name) | 67 | #define mmc_card_name(c) ((c)->cid.prod_name) |
65 | #define mmc_card_id(c) ((c)->dev.bus_id) | 68 | #define mmc_card_id(c) ((c)->dev.bus_id) |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 30f68c0c8c6e..845020d90c60 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -87,6 +87,10 @@ struct mmc_host { | |||
87 | struct mmc_ios ios; /* current io bus settings */ | 87 | struct mmc_ios ios; /* current io bus settings */ |
88 | u32 ocr; /* the current OCR setting */ | 88 | u32 ocr; /* the current OCR setting */ |
89 | 89 | ||
90 | unsigned int mode; /* current card mode of host */ | ||
91 | #define MMC_MODE_MMC 0 | ||
92 | #define MMC_MODE_SD 1 | ||
93 | |||
90 | struct list_head cards; /* devices attached to this host */ | 94 | struct list_head cards; /* devices attached to this host */ |
91 | 95 | ||
92 | wait_queue_head_t wq; | 96 | wait_queue_head_t wq; |
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 0d35d4ffb360..1ab78e8d6c53 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -88,6 +88,8 @@ struct mmc_card; | |||
88 | 88 | ||
89 | extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *); | 89 | extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *); |
90 | extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); | 90 | extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); |
91 | extern int mmc_wait_for_app_cmd(struct mmc_host *, unsigned int, | ||
92 | struct mmc_command *, int); | ||
91 | 93 | ||
92 | extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card); | 94 | extern int __mmc_claim_host(struct mmc_host *host, struct mmc_card *card); |
93 | 95 | ||