host.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /*
  2. * linux/include/linux/mmc/host.h
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * Host driver specific definitions.
  9. */
  10. #ifndef LINUX_MMC_HOST_H
  11. #define LINUX_MMC_HOST_H
  12. #include <linux/leds.h>
  13. #include <linux/mutex.h>
  14. #include <linux/timer.h>
  15. #include <linux/sched.h>
  16. #include <linux/device.h>
  17. #include <linux/fault-inject.h>
  18. #include <linux/mmc/core.h>
  19. #include <linux/mmc/card.h>
  20. #include <linux/mmc/mmc.h>
  21. #include <linux/mmc/pm.h>
  22. struct mmc_ios {
  23. unsigned int clock; /* clock rate */
  24. unsigned short vdd;
  25. /* vdd stores the bit number of the selected voltage range from below. */
  26. unsigned char bus_mode; /* command output mode */
  27. #define MMC_BUSMODE_OPENDRAIN 1
  28. #define MMC_BUSMODE_PUSHPULL 2
  29. unsigned char chip_select; /* SPI chip select */
  30. #define MMC_CS_DONTCARE 0
  31. #define MMC_CS_HIGH 1
  32. #define MMC_CS_LOW 2
  33. unsigned char power_mode; /* power supply mode */
  34. #define MMC_POWER_OFF 0
  35. #define MMC_POWER_UP 1
  36. #define MMC_POWER_ON 2
  37. #define MMC_POWER_UNDEFINED 3
  38. unsigned char bus_width; /* data bus width */
  39. #define MMC_BUS_WIDTH_1 0
  40. #define MMC_BUS_WIDTH_4 2
  41. #define MMC_BUS_WIDTH_8 3
  42. unsigned char timing; /* timing specification used */
  43. #define MMC_TIMING_LEGACY 0
  44. #define MMC_TIMING_MMC_HS 1
  45. #define MMC_TIMING_SD_HS 2
  46. #define MMC_TIMING_UHS_SDR12 3
  47. #define MMC_TIMING_UHS_SDR25 4
  48. #define MMC_TIMING_UHS_SDR50 5
  49. #define MMC_TIMING_UHS_SDR104 6
  50. #define MMC_TIMING_UHS_DDR50 7
  51. #define MMC_TIMING_MMC_DDR52 8
  52. #define MMC_TIMING_MMC_HS200 9
  53. #define MMC_TIMING_MMC_HS400 10
  54. unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
  55. #define MMC_SIGNAL_VOLTAGE_330 0
  56. #define MMC_SIGNAL_VOLTAGE_180 1
  57. #define MMC_SIGNAL_VOLTAGE_120 2
  58. unsigned char drv_type; /* driver type (A, B, C, D) */
  59. #define MMC_SET_DRIVER_TYPE_B 0
  60. #define MMC_SET_DRIVER_TYPE_A 1
  61. #define MMC_SET_DRIVER_TYPE_C 2
  62. #define MMC_SET_DRIVER_TYPE_D 3
  63. bool enhanced_strobe; /* hs400es selection */
  64. };
  65. struct mmc_host_ops {
  66. /*
  67. * It is optional for the host to implement pre_req and post_req in
  68. * order to support double buffering of requests (prepare one
  69. * request while another request is active).
  70. * pre_req() must always be followed by a post_req().
  71. * To undo a call made to pre_req(), call post_req() with
  72. * a nonzero err condition.
  73. */
  74. void (*post_req)(struct mmc_host *host, struct mmc_request *req,
  75. int err);
  76. void (*pre_req)(struct mmc_host *host, struct mmc_request *req,
  77. bool is_first_req);
  78. void (*request)(struct mmc_host *host, struct mmc_request *req);
  79. /*
  80. * Avoid calling the next three functions too often or in a "fast
  81. * path", since underlaying controller might implement them in an
  82. * expensive and/or slow way. Also note that these functions might
  83. * sleep, so don't call them in the atomic contexts!
  84. */
  85. /*
  86. * Notes to the set_ios callback:
  87. * ios->clock might be 0. For some controllers, setting 0Hz
  88. * as any other frequency works. However, some controllers
  89. * explicitly need to disable the clock. Otherwise e.g. voltage
  90. * switching might fail because the SDCLK is not really quiet.
  91. */
  92. void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
  93. /*
  94. * Return values for the get_ro callback should be:
  95. * 0 for a read/write card
  96. * 1 for a read-only card
  97. * -ENOSYS when not supported (equal to NULL callback)
  98. * or a negative errno value when something bad happened
  99. */
  100. int (*get_ro)(struct mmc_host *host);
  101. /*
  102. * Return values for the get_cd callback should be:
  103. * 0 for a absent card
  104. * 1 for a present card
  105. * -ENOSYS when not supported (equal to NULL callback)
  106. * or a negative errno value when something bad happened
  107. */
  108. int (*get_cd)(struct mmc_host *host);
  109. void (*enable_sdio_irq)(struct mmc_host *host, int enable);
  110. /* optional callback for HC quirks */
  111. void (*init_card)(struct mmc_host *host, struct mmc_card *card);
  112. int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
  113. /* Check if the card is pulling dat[0:3] low */
  114. int (*card_busy)(struct mmc_host *host);
  115. /* The tuning command opcode value is different for SD and eMMC cards */
  116. int (*execute_tuning)(struct mmc_host *host, u32 opcode);
  117. /* Prepare HS400 target operating frequency depending host driver */
  118. int (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
  119. /* Prepare enhanced strobe depending host driver */
  120. void (*hs400_enhanced_strobe)(struct mmc_host *host,
  121. struct mmc_ios *ios);
  122. int (*select_drive_strength)(struct mmc_card *card,
  123. unsigned int max_dtr, int host_drv,
  124. int card_drv, int *drv_type);
  125. void (*hw_reset)(struct mmc_host *host);
  126. void (*card_event)(struct mmc_host *host);
  127. /*
  128. * Optional callback to support controllers with HW issues for multiple
  129. * I/O. Returns the number of supported blocks for the request.
  130. */
  131. int (*multi_io_quirk)(struct mmc_card *card,
  132. unsigned int direction, int blk_size);
  133. };
  134. struct mmc_card;
  135. struct device;
  136. struct mmc_async_req {
  137. /* active mmc request */
  138. struct mmc_request *mrq;
  139. /*
  140. * Check error status of completed mmc request.
  141. * Returns 0 if success otherwise non zero.
  142. */
  143. int (*err_check) (struct mmc_card *, struct mmc_async_req *);
  144. };
  145. /**
  146. * struct mmc_slot - MMC slot functions
  147. *
  148. * @cd_irq: MMC/SD-card slot hotplug detection IRQ or -EINVAL
  149. * @handler_priv: MMC/SD-card slot context
  150. *
  151. * Some MMC/SD host controllers implement slot-functions like card and
  152. * write-protect detection natively. However, a large number of controllers
  153. * leave these functions to the CPU. This struct provides a hook to attach
  154. * such slot-function drivers.
  155. */
  156. struct mmc_slot {
  157. int cd_irq;
  158. void *handler_priv;
  159. };
  160. /**
  161. * mmc_context_info - synchronization details for mmc context
  162. * @is_done_rcv wake up reason was done request
  163. * @is_new_req wake up reason was new request
  164. * @is_waiting_last_req mmc context waiting for single running request
  165. * @wait wait queue
  166. * @lock lock to protect data fields
  167. */
  168. struct mmc_context_info {
  169. bool is_done_rcv;
  170. bool is_new_req;
  171. bool is_waiting_last_req;
  172. wait_queue_head_t wait;
  173. spinlock_t lock;
  174. };
  175. struct regulator;
  176. struct mmc_pwrseq;
  177. struct mmc_supply {
  178. struct regulator *vmmc; /* Card power supply */
  179. struct regulator *vqmmc; /* Optional Vccq supply */
  180. };
  181. struct mmc_host {
  182. struct device *parent;
  183. struct device class_dev;
  184. int index;
  185. const struct mmc_host_ops *ops;
  186. struct mmc_pwrseq *pwrseq;
  187. unsigned int f_min;
  188. unsigned int f_max;
  189. unsigned int f_init;
  190. u32 ocr_avail;
  191. u32 ocr_avail_sdio; /* SDIO-specific OCR */
  192. u32 ocr_avail_sd; /* SD-specific OCR */
  193. u32 ocr_avail_mmc; /* MMC-specific OCR */
  194. #ifdef CONFIG_PM_SLEEP
  195. struct notifier_block pm_notify;
  196. #endif
  197. u32 max_current_330;
  198. u32 max_current_300;
  199. u32 max_current_180;
  200. #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
  201. #define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
  202. #define MMC_VDD_21_22 0x00000200 /* VDD voltage 2.1 ~ 2.2 */
  203. #define MMC_VDD_22_23 0x00000400 /* VDD voltage 2.2 ~ 2.3 */
  204. #define MMC_VDD_23_24 0x00000800 /* VDD voltage 2.3 ~ 2.4 */
  205. #define MMC_VDD_24_25 0x00001000 /* VDD voltage 2.4 ~ 2.5 */
  206. #define MMC_VDD_25_26 0x00002000 /* VDD voltage 2.5 ~ 2.6 */
  207. #define MMC_VDD_26_27 0x00004000 /* VDD voltage 2.6 ~ 2.7 */
  208. #define MMC_VDD_27_28 0x00008000 /* VDD voltage 2.7 ~ 2.8 */
  209. #define MMC_VDD_28_29 0x00010000 /* VDD voltage 2.8 ~ 2.9 */
  210. #define MMC_VDD_29_30 0x00020000 /* VDD voltage 2.9 ~ 3.0 */
  211. #define MMC_VDD_30_31 0x00040000 /* VDD voltage 3.0 ~ 3.1 */
  212. #define MMC_VDD_31_32 0x00080000 /* VDD voltage 3.1 ~ 3.2 */
  213. #define MMC_VDD_32_33 0x00100000 /* VDD voltage 3.2 ~ 3.3 */
  214. #define MMC_VDD_33_34 0x00200000 /* VDD voltage 3.3 ~ 3.4 */
  215. #define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */
  216. #define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */
  217. u32 caps; /* Host capabilities */
  218. #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
  219. #define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
  220. #define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */
  221. #define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */
  222. #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
  223. #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
  224. #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
  225. #define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */
  226. #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
  227. #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
  228. #define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
  229. #define MMC_CAP_1_8V_DDR (1 << 11) /* can support */
  230. /* DDR mode at 1.8V */
  231. #define MMC_CAP_1_2V_DDR (1 << 12) /* can support */
  232. /* DDR mode at 1.2V */
  233. #define MMC_CAP_POWER_OFF_CARD (1 << 13) /* Can power off after boot */
  234. #define MMC_CAP_BUS_WIDTH_TEST (1 << 14) /* CMD14/CMD19 bus width ok */
  235. #define MMC_CAP_UHS_SDR12 (1 << 15) /* Host supports UHS SDR12 mode */
  236. #define MMC_CAP_UHS_SDR25 (1 << 16) /* Host supports UHS SDR25 mode */
  237. #define MMC_CAP_UHS_SDR50 (1 << 17) /* Host supports UHS SDR50 mode */
  238. #define MMC_CAP_UHS_SDR104 (1 << 18) /* Host supports UHS SDR104 mode */
  239. #define MMC_CAP_UHS_DDR50 (1 << 19) /* Host supports UHS DDR50 mode */
  240. #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
  241. #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
  242. #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
  243. #define MMC_CAP_CMD_DURING_TFR (1 << 29) /* Commands during data transfer */
  244. #define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
  245. #define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */
  246. u32 caps2; /* More host capabilities */
  247. #define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
  248. #define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
  249. #define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
  250. #define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
  251. #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
  252. MMC_CAP2_HS200_1_2V_SDR)
  253. #define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
  254. #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
  255. #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
  256. #define MMC_CAP2_PACKED_RD (1 << 12) /* Allow packed read */
  257. #define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
  258. #define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
  259. MMC_CAP2_PACKED_WR)
  260. #define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
  261. #define MMC_CAP2_HS400_1_8V (1 << 15) /* Can support HS400 1.8V */
  262. #define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */
  263. #define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \
  264. MMC_CAP2_HS400_1_2V)
  265. #define MMC_CAP2_HSX00_1_2V (MMC_CAP2_HS200_1_2V_SDR | MMC_CAP2_HS400_1_2V)
  266. #define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
  267. #define MMC_CAP2_NO_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */
  268. #define MMC_CAP2_NO_SDIO (1 << 19) /* Do not send SDIO commands during initialization */
  269. #define MMC_CAP2_HS400_ES (1 << 20) /* Host supports enhanced strobe */
  270. #define MMC_CAP2_NO_SD (1 << 21) /* Do not send SD commands during initialization */
  271. #define MMC_CAP2_NO_MMC (1 << 22) /* Do not send (e)MMC commands during initialization */
  272. mmc_pm_flag_t pm_caps; /* supported pm features */
  273. /* host specific block data */
  274. unsigned int max_seg_size; /* see blk_queue_max_segment_size */
  275. unsigned short max_segs; /* see blk_queue_max_segments */
  276. unsigned short unused;
  277. unsigned int max_req_size; /* maximum number of bytes in one req */
  278. unsigned int max_blk_size; /* maximum size of one mmc block */
  279. unsigned int max_blk_count; /* maximum number of blocks in one req */
  280. unsigned int max_busy_timeout; /* max busy timeout in ms */
  281. /* private data */
  282. spinlock_t lock; /* lock for claim and bus ops */
  283. struct mmc_ios ios; /* current io bus settings */
  284. /* group bitfields together to minimize padding */
  285. unsigned int use_spi_crc:1;
  286. unsigned int claimed:1; /* host exclusively claimed */
  287. unsigned int bus_dead:1; /* bus has been released */
  288. #ifdef CONFIG_MMC_DEBUG
  289. unsigned int removed:1; /* host is being removed */
  290. #endif
  291. unsigned int can_retune:1; /* re-tuning can be used */
  292. unsigned int doing_retune:1; /* re-tuning in progress */
  293. unsigned int retune_now:1; /* do re-tuning at next req */
  294. unsigned int retune_paused:1; /* re-tuning is temporarily disabled */
  295. int rescan_disable; /* disable card detection */
  296. int rescan_entered; /* used with nonremovable devices */
  297. int need_retune; /* re-tuning is needed */
  298. int hold_retune; /* hold off re-tuning */
  299. unsigned int retune_period; /* re-tuning period in secs */
  300. struct timer_list retune_timer; /* for periodic re-tuning */
  301. bool trigger_card_event; /* card_event necessary */
  302. struct mmc_card *card; /* device attached to this host */
  303. wait_queue_head_t wq;
  304. struct task_struct *claimer; /* task that has host claimed */
  305. int claim_cnt; /* "claim" nesting count */
  306. struct delayed_work detect;
  307. int detect_change; /* card detect flag */
  308. struct mmc_slot slot;
  309. const struct mmc_bus_ops *bus_ops; /* current bus driver */
  310. unsigned int bus_refs; /* reference counter */
  311. unsigned int sdio_irqs;
  312. struct task_struct *sdio_irq_thread;
  313. bool sdio_irq_pending;
  314. atomic_t sdio_irq_thread_abort;
  315. mmc_pm_flag_t pm_flags; /* requested pm features */
  316. struct led_trigger *led; /* activity led */
  317. #ifdef CONFIG_REGULATOR
  318. bool regulator_enabled; /* regulator state */
  319. #endif
  320. struct mmc_supply supply;
  321. struct dentry *debugfs_root;
  322. struct mmc_async_req *areq; /* active async req */
  323. struct mmc_context_info context_info; /* async synchronization info */
  324. /* Ongoing data transfer that allows commands during transfer */
  325. struct mmc_request *ongoing_mrq;
  326. #ifdef CONFIG_FAIL_MMC_REQUEST
  327. struct fault_attr fail_mmc_request;
  328. #endif
  329. unsigned int actual_clock; /* Actual HC clock rate */
  330. unsigned int slotno; /* used for sdio acpi binding */
  331. int dsr_req; /* DSR value is valid */
  332. u32 dsr; /* optional driver stage (DSR) value */
  333. unsigned long private[0] ____cacheline_aligned;
  334. };
  335. struct mmc_host *mmc_alloc_host(int extra, struct device *);
  336. int mmc_add_host(struct mmc_host *);
  337. void mmc_remove_host(struct mmc_host *);
  338. void mmc_free_host(struct mmc_host *);
  339. int mmc_of_parse(struct mmc_host *host);
  340. static inline void *mmc_priv(struct mmc_host *host)
  341. {
  342. return (void *)host->private;
  343. }
  344. #define mmc_host_is_spi(host) ((host)->caps & MMC_CAP_SPI)
  345. #define mmc_dev(x) ((x)->parent)
  346. #define mmc_classdev(x) (&(x)->class_dev)
  347. #define mmc_hostname(x) (dev_name(&(x)->class_dev))
  348. int mmc_power_save_host(struct mmc_host *host);
  349. int mmc_power_restore_host(struct mmc_host *host);
  350. void mmc_detect_change(struct mmc_host *, unsigned long delay);
  351. void mmc_request_done(struct mmc_host *, struct mmc_request *);
  352. void mmc_command_done(struct mmc_host *host, struct mmc_request *mrq);
  353. static inline void mmc_signal_sdio_irq(struct mmc_host *host)
  354. {
  355. host->ops->enable_sdio_irq(host, 0);
  356. host->sdio_irq_pending = true;
  357. if (host->sdio_irq_thread)
  358. wake_up_process(host->sdio_irq_thread);
  359. }
  360. void sdio_run_irqs(struct mmc_host *host);
  361. #ifdef CONFIG_REGULATOR
  362. int mmc_regulator_get_ocrmask(struct regulator *supply);
  363. int mmc_regulator_set_ocr(struct mmc_host *mmc,
  364. struct regulator *supply,
  365. unsigned short vdd_bit);
  366. int mmc_regulator_set_vqmmc(struct mmc_host *mmc, struct mmc_ios *ios);
  367. #else
  368. static inline int mmc_regulator_get_ocrmask(struct regulator *supply)
  369. {
  370. return 0;
  371. }
  372. static inline int mmc_regulator_set_ocr(struct mmc_host *mmc,
  373. struct regulator *supply,
  374. unsigned short vdd_bit)
  375. {
  376. return 0;
  377. }
  378. static inline int mmc_regulator_set_vqmmc(struct mmc_host *mmc,
  379. struct mmc_ios *ios)
  380. {
  381. return -EINVAL;
  382. }
  383. #endif
  384. int mmc_regulator_get_supply(struct mmc_host *mmc);
  385. static inline int mmc_card_is_removable(struct mmc_host *host)
  386. {
  387. return !(host->caps & MMC_CAP_NONREMOVABLE);
  388. }
  389. static inline int mmc_card_keep_power(struct mmc_host *host)
  390. {
  391. return host->pm_flags & MMC_PM_KEEP_POWER;
  392. }
  393. static inline int mmc_card_wake_sdio_irq(struct mmc_host *host)
  394. {
  395. return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ;
  396. }
  397. static inline int mmc_host_cmd23(struct mmc_host *host)
  398. {
  399. return host->caps & MMC_CAP_CMD23;
  400. }
  401. static inline int mmc_boot_partition_access(struct mmc_host *host)
  402. {
  403. return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
  404. }
  405. static inline int mmc_host_uhs(struct mmc_host *host)
  406. {
  407. return host->caps &
  408. (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
  409. MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 |
  410. MMC_CAP_UHS_DDR50);
  411. }
  412. static inline int mmc_host_packed_wr(struct mmc_host *host)
  413. {
  414. return host->caps2 & MMC_CAP2_PACKED_WR;
  415. }
  416. static inline int mmc_card_hs(struct mmc_card *card)
  417. {
  418. return card->host->ios.timing == MMC_TIMING_SD_HS ||
  419. card->host->ios.timing == MMC_TIMING_MMC_HS;
  420. }
  421. static inline int mmc_card_uhs(struct mmc_card *card)
  422. {
  423. return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 &&
  424. card->host->ios.timing <= MMC_TIMING_UHS_DDR50;
  425. }
  426. static inline bool mmc_card_hs200(struct mmc_card *card)
  427. {
  428. return card->host->ios.timing == MMC_TIMING_MMC_HS200;
  429. }
  430. static inline bool mmc_card_ddr52(struct mmc_card *card)
  431. {
  432. return card->host->ios.timing == MMC_TIMING_MMC_DDR52;
  433. }
  434. static inline bool mmc_card_hs400(struct mmc_card *card)
  435. {
  436. return card->host->ios.timing == MMC_TIMING_MMC_HS400;
  437. }
  438. static inline bool mmc_card_hs400es(struct mmc_card *card)
  439. {
  440. return card->host->ios.enhanced_strobe;
  441. }
  442. void mmc_retune_timer_stop(struct mmc_host *host);
  443. static inline void mmc_retune_needed(struct mmc_host *host)
  444. {
  445. if (host->can_retune)
  446. host->need_retune = 1;
  447. }
  448. static inline void mmc_retune_recheck(struct mmc_host *host)
  449. {
  450. if (host->hold_retune <= 1)
  451. host->retune_now = 1;
  452. }
  453. void mmc_retune_pause(struct mmc_host *host);
  454. void mmc_retune_unpause(struct mmc_host *host);
  455. #endif /* LINUX_MMC_HOST_H */