diff options
Diffstat (limited to 'include/linux/mmc')
| -rw-r--r-- | include/linux/mmc/card.h | 14 | ||||
| -rw-r--r-- | include/linux/mmc/core.h | 16 | ||||
| -rw-r--r-- | include/linux/mmc/dw_mmc.h | 6 | ||||
| -rw-r--r-- | include/linux/mmc/host.h | 17 | ||||
| -rw-r--r-- | include/linux/mmc/mmc.h | 17 | ||||
| -rw-r--r-- | include/linux/mmc/slot-gpio.h | 1 |
6 files changed, 48 insertions, 23 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 73fad83acbcb..95d69d498296 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
| @@ -89,6 +89,8 @@ struct mmc_ext_csd { | |||
| 89 | unsigned int boot_ro_lock; /* ro lock support */ | 89 | unsigned int boot_ro_lock; /* ro lock support */ |
| 90 | bool boot_ro_lockable; | 90 | bool boot_ro_lockable; |
| 91 | bool ffu_capable; /* Firmware upgrade support */ | 91 | bool ffu_capable; /* Firmware upgrade support */ |
| 92 | bool cmdq_support; /* Command Queue supported */ | ||
| 93 | unsigned int cmdq_depth; /* Command Queue depth */ | ||
| 92 | #define MMC_FIRMWARE_LEN 8 | 94 | #define MMC_FIRMWARE_LEN 8 |
| 93 | u8 fwrev[MMC_FIRMWARE_LEN]; /* FW version */ | 95 | u8 fwrev[MMC_FIRMWARE_LEN]; /* FW version */ |
| 94 | u8 raw_exception_status; /* 54 */ | 96 | u8 raw_exception_status; /* 54 */ |
| @@ -207,18 +209,6 @@ struct sdio_func_tuple; | |||
| 207 | 209 | ||
| 208 | #define SDIO_MAX_FUNCS 7 | 210 | #define SDIO_MAX_FUNCS 7 |
| 209 | 211 | ||
| 210 | enum mmc_blk_status { | ||
| 211 | MMC_BLK_SUCCESS = 0, | ||
| 212 | MMC_BLK_PARTIAL, | ||
| 213 | MMC_BLK_CMD_ERR, | ||
| 214 | MMC_BLK_RETRY, | ||
| 215 | MMC_BLK_ABORT, | ||
| 216 | MMC_BLK_DATA_ERR, | ||
| 217 | MMC_BLK_ECC_ERR, | ||
| 218 | MMC_BLK_NOMEDIUM, | ||
| 219 | MMC_BLK_NEW_REQUEST, | ||
| 220 | }; | ||
| 221 | |||
| 222 | /* The number of MMC physical partitions. These consist of: | 212 | /* The number of MMC physical partitions. These consist of: |
| 223 | * boot partitions (2), general purpose partitions (4) and | 213 | * boot partitions (2), general purpose partitions (4) and |
| 224 | * RPMB partition (1) in MMC v4.4. | 214 | * RPMB partition (1) in MMC v4.4. |
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 2b953eb8ceae..e33cc748dcfe 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
| @@ -15,6 +15,18 @@ struct request; | |||
| 15 | struct mmc_data; | 15 | struct mmc_data; |
| 16 | struct mmc_request; | 16 | struct mmc_request; |
| 17 | 17 | ||
| 18 | enum mmc_blk_status { | ||
| 19 | MMC_BLK_SUCCESS = 0, | ||
| 20 | MMC_BLK_PARTIAL, | ||
| 21 | MMC_BLK_CMD_ERR, | ||
| 22 | MMC_BLK_RETRY, | ||
| 23 | MMC_BLK_ABORT, | ||
| 24 | MMC_BLK_DATA_ERR, | ||
| 25 | MMC_BLK_ECC_ERR, | ||
| 26 | MMC_BLK_NOMEDIUM, | ||
| 27 | MMC_BLK_NEW_REQUEST, | ||
| 28 | }; | ||
| 29 | |||
| 18 | struct mmc_command { | 30 | struct mmc_command { |
| 19 | u32 opcode; | 31 | u32 opcode; |
| 20 | u32 arg; | 32 | u32 arg; |
| @@ -150,7 +162,8 @@ struct mmc_async_req; | |||
| 150 | extern int mmc_stop_bkops(struct mmc_card *); | 162 | extern int mmc_stop_bkops(struct mmc_card *); |
| 151 | extern int mmc_read_bkops_status(struct mmc_card *); | 163 | extern int mmc_read_bkops_status(struct mmc_card *); |
| 152 | extern struct mmc_async_req *mmc_start_req(struct mmc_host *, | 164 | extern struct mmc_async_req *mmc_start_req(struct mmc_host *, |
| 153 | struct mmc_async_req *, int *); | 165 | struct mmc_async_req *, |
| 166 | enum mmc_blk_status *); | ||
| 154 | extern int mmc_interrupt_hpi(struct mmc_card *); | 167 | extern int mmc_interrupt_hpi(struct mmc_card *); |
| 155 | extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *); | 168 | extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *); |
| 156 | extern void mmc_wait_for_req_done(struct mmc_host *host, | 169 | extern void mmc_wait_for_req_done(struct mmc_host *host, |
| @@ -163,6 +176,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, | |||
| 163 | extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); | 176 | extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); |
| 164 | extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); | 177 | extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); |
| 165 | extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); | 178 | extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); |
| 179 | extern int mmc_abort_tuning(struct mmc_host *host, u32 opcode); | ||
| 166 | extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd); | 180 | extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd); |
| 167 | 181 | ||
| 168 | #define MMC_ERASE_ARG 0x00000000 | 182 | #define MMC_ERASE_ARG 0x00000000 |
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index f5af2bd35e7f..15db6f83f53f 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h | |||
| @@ -39,6 +39,12 @@ enum { | |||
| 39 | EVENT_DATA_ERROR, | 39 | EVENT_DATA_ERROR, |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | enum dw_mci_cookie { | ||
| 43 | COOKIE_UNMAPPED, | ||
| 44 | COOKIE_PRE_MAPPED, /* mapped by pre_req() of dwmmc */ | ||
| 45 | COOKIE_MAPPED, /* mapped by prepare_data() of dwmmc */ | ||
| 46 | }; | ||
| 47 | |||
| 42 | struct mmc_data; | 48 | struct mmc_data; |
| 43 | 49 | ||
| 44 | enum { | 50 | enum { |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 0b2439441cc8..8bc884121465 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -93,8 +93,7 @@ struct mmc_host_ops { | |||
| 93 | */ | 93 | */ |
| 94 | void (*post_req)(struct mmc_host *host, struct mmc_request *req, | 94 | void (*post_req)(struct mmc_host *host, struct mmc_request *req, |
| 95 | int err); | 95 | int err); |
| 96 | void (*pre_req)(struct mmc_host *host, struct mmc_request *req, | 96 | void (*pre_req)(struct mmc_host *host, struct mmc_request *req); |
| 97 | bool is_first_req); | ||
| 98 | void (*request)(struct mmc_host *host, struct mmc_request *req); | 97 | void (*request)(struct mmc_host *host, struct mmc_request *req); |
| 99 | 98 | ||
| 100 | /* | 99 | /* |
| @@ -173,7 +172,7 @@ struct mmc_async_req { | |||
| 173 | * Check error status of completed mmc request. | 172 | * Check error status of completed mmc request. |
| 174 | * Returns 0 if success otherwise non zero. | 173 | * Returns 0 if success otherwise non zero. |
| 175 | */ | 174 | */ |
| 176 | int (*err_check) (struct mmc_card *, struct mmc_async_req *); | 175 | enum mmc_blk_status (*err_check)(struct mmc_card *, struct mmc_async_req *); |
| 177 | }; | 176 | }; |
| 178 | 177 | ||
| 179 | /** | 178 | /** |
| @@ -198,14 +197,12 @@ struct mmc_slot { | |||
| 198 | * @is_new_req wake up reason was new request | 197 | * @is_new_req wake up reason was new request |
| 199 | * @is_waiting_last_req mmc context waiting for single running request | 198 | * @is_waiting_last_req mmc context waiting for single running request |
| 200 | * @wait wait queue | 199 | * @wait wait queue |
| 201 | * @lock lock to protect data fields | ||
| 202 | */ | 200 | */ |
| 203 | struct mmc_context_info { | 201 | struct mmc_context_info { |
| 204 | bool is_done_rcv; | 202 | bool is_done_rcv; |
| 205 | bool is_new_req; | 203 | bool is_new_req; |
| 206 | bool is_waiting_last_req; | 204 | bool is_waiting_last_req; |
| 207 | wait_queue_head_t wait; | 205 | wait_queue_head_t wait; |
| 208 | spinlock_t lock; | ||
| 209 | }; | 206 | }; |
| 210 | 207 | ||
| 211 | struct regulator; | 208 | struct regulator; |
| @@ -495,11 +492,6 @@ static inline int mmc_host_uhs(struct mmc_host *host) | |||
| 495 | MMC_CAP_UHS_DDR50); | 492 | MMC_CAP_UHS_DDR50); |
| 496 | } | 493 | } |
| 497 | 494 | ||
| 498 | static inline int mmc_host_packed_wr(struct mmc_host *host) | ||
| 499 | { | ||
| 500 | return host->caps2 & MMC_CAP2_PACKED_WR; | ||
| 501 | } | ||
| 502 | |||
| 503 | static inline int mmc_card_hs(struct mmc_card *card) | 495 | static inline int mmc_card_hs(struct mmc_card *card) |
| 504 | { | 496 | { |
| 505 | return card->host->ios.timing == MMC_TIMING_SD_HS || | 497 | return card->host->ios.timing == MMC_TIMING_SD_HS || |
| @@ -546,6 +538,11 @@ static inline void mmc_retune_recheck(struct mmc_host *host) | |||
| 546 | host->retune_now = 1; | 538 | host->retune_now = 1; |
| 547 | } | 539 | } |
| 548 | 540 | ||
| 541 | static inline bool mmc_can_retune(struct mmc_host *host) | ||
| 542 | { | ||
| 543 | return host->can_retune == 1; | ||
| 544 | } | ||
| 545 | |||
| 549 | void mmc_retune_pause(struct mmc_host *host); | 546 | void mmc_retune_pause(struct mmc_host *host); |
| 550 | void mmc_retune_unpause(struct mmc_host *host); | 547 | void mmc_retune_unpause(struct mmc_host *host); |
| 551 | 548 | ||
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index c376209c70ef..672730acc705 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
| @@ -84,6 +84,13 @@ | |||
| 84 | #define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */ | 84 | #define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */ |
| 85 | #define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */ | 85 | #define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */ |
| 86 | 86 | ||
| 87 | /* class 11 */ | ||
| 88 | #define MMC_QUE_TASK_PARAMS 44 /* ac [20:16] task id R1 */ | ||
| 89 | #define MMC_QUE_TASK_ADDR 45 /* ac [31:0] data addr R1 */ | ||
| 90 | #define MMC_EXECUTE_READ_TASK 46 /* adtc [20:16] task id R1 */ | ||
| 91 | #define MMC_EXECUTE_WRITE_TASK 47 /* adtc [20:16] task id R1 */ | ||
| 92 | #define MMC_CMDQ_TASK_MGMT 48 /* ac [20:16] task id R1b */ | ||
| 93 | |||
| 87 | static inline bool mmc_op_multi(u32 opcode) | 94 | static inline bool mmc_op_multi(u32 opcode) |
| 88 | { | 95 | { |
| 89 | return opcode == MMC_WRITE_MULTIPLE_BLOCK || | 96 | return opcode == MMC_WRITE_MULTIPLE_BLOCK || |
| @@ -272,6 +279,7 @@ struct _mmc_csd { | |||
| 272 | * EXT_CSD fields | 279 | * EXT_CSD fields |
| 273 | */ | 280 | */ |
| 274 | 281 | ||
| 282 | #define EXT_CSD_CMDQ_MODE_EN 15 /* R/W */ | ||
| 275 | #define EXT_CSD_FLUSH_CACHE 32 /* W */ | 283 | #define EXT_CSD_FLUSH_CACHE 32 /* W */ |
| 276 | #define EXT_CSD_CACHE_CTRL 33 /* R/W */ | 284 | #define EXT_CSD_CACHE_CTRL 33 /* R/W */ |
| 277 | #define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ | 285 | #define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ |
| @@ -331,6 +339,8 @@ struct _mmc_csd { | |||
| 331 | #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ | 339 | #define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ |
| 332 | #define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */ | 340 | #define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */ |
| 333 | #define EXT_CSD_FIRMWARE_VERSION 254 /* RO, 8 bytes */ | 341 | #define EXT_CSD_FIRMWARE_VERSION 254 /* RO, 8 bytes */ |
| 342 | #define EXT_CSD_CMDQ_DEPTH 307 /* RO */ | ||
| 343 | #define EXT_CSD_CMDQ_SUPPORT 308 /* RO */ | ||
| 334 | #define EXT_CSD_SUPPORTED_MODE 493 /* RO */ | 344 | #define EXT_CSD_SUPPORTED_MODE 493 /* RO */ |
| 335 | #define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ | 345 | #define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ |
| 336 | #define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ | 346 | #define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ |
| @@ -438,6 +448,13 @@ struct _mmc_csd { | |||
| 438 | #define EXT_CSD_MANUAL_BKOPS_MASK 0x01 | 448 | #define EXT_CSD_MANUAL_BKOPS_MASK 0x01 |
| 439 | 449 | ||
| 440 | /* | 450 | /* |
| 451 | * Command Queue | ||
| 452 | */ | ||
| 453 | #define EXT_CSD_CMDQ_MODE_ENABLED BIT(0) | ||
| 454 | #define EXT_CSD_CMDQ_DEPTH_MASK GENMASK(4, 0) | ||
| 455 | #define EXT_CSD_CMDQ_SUPPORTED BIT(0) | ||
| 456 | |||
| 457 | /* | ||
| 441 | * MMC_SWITCH access modes | 458 | * MMC_SWITCH access modes |
| 442 | */ | 459 | */ |
| 443 | 460 | ||
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 3945a8c9d3cb..a7972cd3bc14 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h | |||
| @@ -29,5 +29,6 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, | |||
| 29 | void mmc_gpio_set_cd_isr(struct mmc_host *host, | 29 | void mmc_gpio_set_cd_isr(struct mmc_host *host, |
| 30 | irqreturn_t (*isr)(int irq, void *dev_id)); | 30 | irqreturn_t (*isr)(int irq, void *dev_id)); |
| 31 | void mmc_gpiod_request_cd_irq(struct mmc_host *host); | 31 | void mmc_gpiod_request_cd_irq(struct mmc_host *host); |
| 32 | bool mmc_can_gpio_cd(struct mmc_host *host); | ||
| 32 | 33 | ||
| 33 | #endif | 34 | #endif |
