aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mmc')
-rw-r--r--include/linux/mmc/card.h3
-rw-r--r--include/linux/mmc/host.h11
-rw-r--r--include/linux/mmc/mmc.h66
3 files changed, 78 insertions, 2 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 9478a6bf1bb1..9f22ba572de0 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -216,6 +216,7 @@ struct mmc_card {
216#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 216#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
217#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 217#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
218#define MMC_CARD_REMOVED (1<<7) /* card has been removed */ 218#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
219#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
219 unsigned int quirks; /* card quirks */ 220 unsigned int quirks; /* card quirks */
220#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 221#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
221#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 222#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -374,6 +375,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
374#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 375#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
375#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 376#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
376#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 377#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
378#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
377#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 379#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
378#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 380#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
379#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 381#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
@@ -384,6 +386,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
384#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 386#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
385#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 387#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
386#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 388#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
389#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
387#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 390#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
388#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) 391#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
389#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 392#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 031d865167a2..dd13e0539092 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -56,10 +56,13 @@ struct mmc_ios {
56#define MMC_TIMING_UHS_SDR50 3 56#define MMC_TIMING_UHS_SDR50 3
57#define MMC_TIMING_UHS_SDR104 4 57#define MMC_TIMING_UHS_SDR104 4
58#define MMC_TIMING_UHS_DDR50 5 58#define MMC_TIMING_UHS_DDR50 5
59#define MMC_TIMING_MMC_HS200 6
59 60
60#define MMC_SDR_MODE 0 61#define MMC_SDR_MODE 0
61#define MMC_1_2V_DDR_MODE 1 62#define MMC_1_2V_DDR_MODE 1
62#define MMC_1_8V_DDR_MODE 2 63#define MMC_1_8V_DDR_MODE 2
64#define MMC_1_2V_SDR_MODE 3
65#define MMC_1_8V_SDR_MODE 4
63 66
64 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 67 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
65 68
@@ -148,7 +151,9 @@ struct mmc_host_ops {
148 void (*init_card)(struct mmc_host *host, struct mmc_card *card); 151 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
149 152
150 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 153 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
151 int (*execute_tuning)(struct mmc_host *host); 154
155 /* The tuning command opcode value is different for SD and eMMC cards */
156 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
152 void (*enable_preset_value)(struct mmc_host *host, bool enable); 157 void (*enable_preset_value)(struct mmc_host *host, bool enable);
153 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 158 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
154 void (*hw_reset)(struct mmc_host *host); 159 void (*hw_reset)(struct mmc_host *host);
@@ -248,6 +253,10 @@ struct mmc_host {
248#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 253#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
249#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 254#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
250#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */ 255#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
256#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
257#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
258#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
259 MMC_CAP2_HS200_1_2V_SDR)
251 260
252 mmc_pm_flag_t pm_caps; /* supported pm features */ 261 mmc_pm_flag_t pm_caps; /* supported pm features */
253 unsigned int power_notify_type; 262 unsigned int power_notify_type;
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 665548e639e8..fb9f6e116e1c 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -51,6 +51,7 @@
51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */ 51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */ 52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
54 55
55 /* class 3 */ 56 /* class 3 */
56#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
@@ -339,13 +340,76 @@ struct _mmc_csd {
339 340
340#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 341#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
341#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 342#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
342#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */ 343#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */
343#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ 344#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
344 /* DDR mode @1.8V or 3V I/O */ 345 /* DDR mode @1.8V or 3V I/O */
345#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ 346#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
346 /* DDR mode @1.2V I/O */ 347 /* DDR mode @1.2V I/O */
347#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ 348#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
348 | EXT_CSD_CARD_TYPE_DDR_1_2V) 349 | EXT_CSD_CARD_TYPE_DDR_1_2V)
350#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */
351#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */
352 /* SDR mode @1.2V I/O */
353
354#define EXT_CSD_CARD_TYPE_SDR_200 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
355 EXT_CSD_CARD_TYPE_SDR_1_2V)
356
357#define EXT_CSD_CARD_TYPE_SDR_ALL (EXT_CSD_CARD_TYPE_SDR_200 | \
358 EXT_CSD_CARD_TYPE_52 | \
359 EXT_CSD_CARD_TYPE_26)
360
361#define EXT_CSD_CARD_TYPE_SDR_1_2V_ALL (EXT_CSD_CARD_TYPE_SDR_1_2V | \
362 EXT_CSD_CARD_TYPE_52 | \
363 EXT_CSD_CARD_TYPE_26)
364
365#define EXT_CSD_CARD_TYPE_SDR_1_8V_ALL (EXT_CSD_CARD_TYPE_SDR_1_8V | \
366 EXT_CSD_CARD_TYPE_52 | \
367 EXT_CSD_CARD_TYPE_26)
368
369#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
370 EXT_CSD_CARD_TYPE_DDR_1_8V | \
371 EXT_CSD_CARD_TYPE_52 | \
372 EXT_CSD_CARD_TYPE_26)
373
374#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
375 EXT_CSD_CARD_TYPE_DDR_1_8V | \
376 EXT_CSD_CARD_TYPE_52 | \
377 EXT_CSD_CARD_TYPE_26)
378
379#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
380 EXT_CSD_CARD_TYPE_DDR_1_2V | \
381 EXT_CSD_CARD_TYPE_52 | \
382 EXT_CSD_CARD_TYPE_26)
383
384#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
385 EXT_CSD_CARD_TYPE_DDR_1_2V | \
386 EXT_CSD_CARD_TYPE_52 | \
387 EXT_CSD_CARD_TYPE_26)
388
389#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_2V | \
390 EXT_CSD_CARD_TYPE_DDR_52 | \
391 EXT_CSD_CARD_TYPE_52 | \
392 EXT_CSD_CARD_TYPE_26)
393
394#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
395 EXT_CSD_CARD_TYPE_DDR_52 | \
396 EXT_CSD_CARD_TYPE_52 | \
397 EXT_CSD_CARD_TYPE_26)
398
399#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_200 | \
400 EXT_CSD_CARD_TYPE_DDR_1_8V | \
401 EXT_CSD_CARD_TYPE_52 | \
402 EXT_CSD_CARD_TYPE_26)
403
404#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_200 | \
405 EXT_CSD_CARD_TYPE_DDR_1_2V | \
406 EXT_CSD_CARD_TYPE_52 | \
407 EXT_CSD_CARD_TYPE_26)
408
409#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52 (EXT_CSD_CARD_TYPE_SDR_200 | \
410 EXT_CSD_CARD_TYPE_DDR_52 | \
411 EXT_CSD_CARD_TYPE_52 | \
412 EXT_CSD_CARD_TYPE_26)
349 413
350#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 414#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
351#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 415#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */