diff options
Diffstat (limited to 'include/linux/mmc')
-rw-r--r-- | include/linux/mmc/card.h | 15 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 30 | ||||
-rw-r--r-- | include/linux/mmc/mmc.h | 2 | ||||
-rw-r--r-- | include/linux/mmc/protocol.h | 7 |
4 files changed, 52 insertions, 2 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index aefedf04b9bb..18fc77f682de 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -33,6 +33,13 @@ struct mmc_csd { | |||
33 | unsigned int capacity; | 33 | unsigned int capacity; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct sd_scr { | ||
37 | unsigned char sda_vsn; | ||
38 | unsigned char bus_widths; | ||
39 | #define SD_SCR_BUS_WIDTH_1 (1<<0) | ||
40 | #define SD_SCR_BUS_WIDTH_4 (1<<2) | ||
41 | }; | ||
42 | |||
36 | struct mmc_host; | 43 | struct mmc_host; |
37 | 44 | ||
38 | /* | 45 | /* |
@@ -47,19 +54,27 @@ struct mmc_card { | |||
47 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ | 54 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ |
48 | #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ | 55 | #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */ |
49 | #define MMC_STATE_BAD (1<<2) /* unrecognised device */ | 56 | #define MMC_STATE_BAD (1<<2) /* unrecognised device */ |
57 | #define MMC_STATE_SDCARD (1<<3) /* is an SD card */ | ||
58 | #define MMC_STATE_READONLY (1<<4) /* card is read-only */ | ||
50 | u32 raw_cid[4]; /* raw card CID */ | 59 | u32 raw_cid[4]; /* raw card CID */ |
51 | u32 raw_csd[4]; /* raw card CSD */ | 60 | u32 raw_csd[4]; /* raw card CSD */ |
61 | u32 raw_scr[2]; /* raw card SCR */ | ||
52 | struct mmc_cid cid; /* card identification */ | 62 | struct mmc_cid cid; /* card identification */ |
53 | struct mmc_csd csd; /* card specific */ | 63 | struct mmc_csd csd; /* card specific */ |
64 | struct sd_scr scr; /* extra SD information */ | ||
54 | }; | 65 | }; |
55 | 66 | ||
56 | #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) | 67 | #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) |
57 | #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) | 68 | #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) |
58 | #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) | 69 | #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) |
70 | #define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) | ||
71 | #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) | ||
59 | 72 | ||
60 | #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) | 73 | #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) |
61 | #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) | 74 | #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) |
62 | #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) | 75 | #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) |
76 | #define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) | ||
77 | #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) | ||
63 | 78 | ||
64 | #define mmc_card_name(c) ((c)->cid.prod_name) | 79 | #define mmc_card_name(c) ((c)->cid.prod_name) |
65 | #define mmc_card_id(c) ((c)->dev.bus_id) | 80 | #define mmc_card_id(c) ((c)->dev.bus_id) |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 9a0893f3249e..c1f021eddffa 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -46,16 +46,28 @@ struct mmc_ios { | |||
46 | #define MMC_BUSMODE_OPENDRAIN 1 | 46 | #define MMC_BUSMODE_OPENDRAIN 1 |
47 | #define MMC_BUSMODE_PUSHPULL 2 | 47 | #define MMC_BUSMODE_PUSHPULL 2 |
48 | 48 | ||
49 | unsigned char chip_select; /* SPI chip select */ | ||
50 | |||
51 | #define MMC_CS_DONTCARE 0 | ||
52 | #define MMC_CS_HIGH 1 | ||
53 | #define MMC_CS_LOW 2 | ||
54 | |||
49 | unsigned char power_mode; /* power supply mode */ | 55 | unsigned char power_mode; /* power supply mode */ |
50 | 56 | ||
51 | #define MMC_POWER_OFF 0 | 57 | #define MMC_POWER_OFF 0 |
52 | #define MMC_POWER_UP 1 | 58 | #define MMC_POWER_UP 1 |
53 | #define MMC_POWER_ON 2 | 59 | #define MMC_POWER_ON 2 |
60 | |||
61 | unsigned char bus_width; /* data bus width */ | ||
62 | |||
63 | #define MMC_BUS_WIDTH_1 0 | ||
64 | #define MMC_BUS_WIDTH_4 2 | ||
54 | }; | 65 | }; |
55 | 66 | ||
56 | struct mmc_host_ops { | 67 | struct mmc_host_ops { |
57 | void (*request)(struct mmc_host *host, struct mmc_request *req); | 68 | void (*request)(struct mmc_host *host, struct mmc_request *req); |
58 | void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); | 69 | void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); |
70 | int (*get_ro)(struct mmc_host *host); | ||
59 | }; | 71 | }; |
60 | 72 | ||
61 | struct mmc_card; | 73 | struct mmc_card; |
@@ -70,6 +82,10 @@ struct mmc_host { | |||
70 | unsigned int f_max; | 82 | unsigned int f_max; |
71 | u32 ocr_avail; | 83 | u32 ocr_avail; |
72 | 84 | ||
85 | unsigned long caps; /* Host capabilities */ | ||
86 | |||
87 | #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ | ||
88 | |||
73 | /* host specific block data */ | 89 | /* host specific block data */ |
74 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ | 90 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ |
75 | unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ | 91 | unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ |
@@ -81,6 +97,10 @@ struct mmc_host { | |||
81 | struct mmc_ios ios; /* current io bus settings */ | 97 | struct mmc_ios ios; /* current io bus settings */ |
82 | u32 ocr; /* the current OCR setting */ | 98 | u32 ocr; /* the current OCR setting */ |
83 | 99 | ||
100 | unsigned int mode; /* current card mode of host */ | ||
101 | #define MMC_MODE_MMC 0 | ||
102 | #define MMC_MODE_SD 1 | ||
103 | |||
84 | struct list_head cards; /* devices attached to this host */ | 104 | struct list_head cards; /* devices attached to this host */ |
85 | 105 | ||
86 | wait_queue_head_t wq; | 106 | wait_queue_head_t wq; |
@@ -89,6 +109,8 @@ struct mmc_host { | |||
89 | struct mmc_card *card_selected; /* the selected MMC card */ | 109 | struct mmc_card *card_selected; /* the selected MMC card */ |
90 | 110 | ||
91 | struct work_struct detect; | 111 | struct work_struct detect; |
112 | |||
113 | unsigned long private[0] ____cacheline_aligned; | ||
92 | }; | 114 | }; |
93 | 115 | ||
94 | extern struct mmc_host *mmc_alloc_host(int extra, struct device *); | 116 | extern struct mmc_host *mmc_alloc_host(int extra, struct device *); |
@@ -96,14 +118,18 @@ extern int mmc_add_host(struct mmc_host *); | |||
96 | extern void mmc_remove_host(struct mmc_host *); | 118 | extern void mmc_remove_host(struct mmc_host *); |
97 | extern void mmc_free_host(struct mmc_host *); | 119 | extern void mmc_free_host(struct mmc_host *); |
98 | 120 | ||
99 | #define mmc_priv(x) ((void *)((x) + 1)) | 121 | static inline void *mmc_priv(struct mmc_host *host) |
122 | { | ||
123 | return (void *)host->private; | ||
124 | } | ||
125 | |||
100 | #define mmc_dev(x) ((x)->dev) | 126 | #define mmc_dev(x) ((x)->dev) |
101 | #define mmc_hostname(x) ((x)->class_dev.class_id) | 127 | #define mmc_hostname(x) ((x)->class_dev.class_id) |
102 | 128 | ||
103 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); | 129 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); |
104 | extern int mmc_resume_host(struct mmc_host *); | 130 | extern int mmc_resume_host(struct mmc_host *); |
105 | 131 | ||
106 | extern void mmc_detect_change(struct mmc_host *); | 132 | extern void mmc_detect_change(struct mmc_host *, unsigned long delay); |
107 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); | 133 | extern void mmc_request_done(struct mmc_host *, struct mmc_request *); |
108 | 134 | ||
109 | #endif | 135 | #endif |
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 | ||
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h index 896342817b97..f819cae92266 100644 --- a/include/linux/mmc/protocol.h +++ b/include/linux/mmc/protocol.h | |||
@@ -236,5 +236,12 @@ struct _mmc_csd { | |||
236 | #define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */ | 236 | #define CSD_SPEC_VER_2 2 /* Implements system specification 2.0 - 2.2 */ |
237 | #define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */ | 237 | #define CSD_SPEC_VER_3 3 /* Implements system specification 3.1 */ |
238 | 238 | ||
239 | |||
240 | /* | ||
241 | * SD bus widths | ||
242 | */ | ||
243 | #define SD_BUS_WIDTH_1 0 | ||
244 | #define SD_BUS_WIDTH_4 2 | ||
245 | |||
239 | #endif /* MMC_MMC_PROTOCOL_H */ | 246 | #endif /* MMC_MMC_PROTOCOL_H */ |
240 | 247 | ||