aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 11:34:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-13 11:34:11 -0500
commit5233c331cfb41433bc167fc7c70ea67c1133ffec (patch)
tree1ab0da40a3069c54e41a2aed8a0ada8ddb325e46 /include/linux/mmc
parent58f253d26254b7ec0faa0a67d70912facd6687e4 (diff)
parentff6af28faff53a7389230026b83e543385f7b21d (diff)
Merge tag 'mmc-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC updates from Ulf Hansson: "It's been an busy period for mmc. Quite some changes in the mmc core, two new mmc host drivers, some existing drivers being extended to support new IP versions and lots of other updates. MMC core: - Delete eMMC packed command support - Introduce mmc_abort_tuning() to enable eMMC tuning to fail gracefully - Introduce mmc_can_retune() to see if a host can be retuned - Re-work and improve the sequence when sending a CMD6 for mmc - Enable CDM13 polling when switching to HS and HS DDR mode for mmc - Relax checking for CMD6 errors after switch to HS200 - Re-factoring the code dealing with the mmc block queue - Recognize whether the eMMC card supports CMDQ - Fix 4K native sector check - Don't power off the card when starting the host - Increase MMC_IOC_MAX_BYTES to support bigger firmware binaries - Improve error handling and drop meaningless BUG_ONs() - Lots of clean-ups and changes to improve the quality of the code MMC host: - sdhci: Fix tuning sequence and clean-up the related code - sdhci: Add support to via DT override broken SDHCI cap register bits - sdhci-cadence: Add new driver for Cadence SD4HC SDHCI variant - sdhci-msm: Update clock management - sdhci-msm: Add support for eMMC HS400 mode - sdhci-msm: Deploy runtime/system PM support - sdhci-iproc: Extend driver support to newer IP versions - sdhci-pci: Add support for Intel GLK - sdhci-pci: Add support for Intel NI byt sdio - sdhci-acpi: Add support for 80860F14 UID 2 SDIO bus - sdhci: Lots of various small improvements and clean-ups - tmio: Add support for tuning - sh_mobile_sdhi: Add support for tuning - sh_mobile_sdhi: Extend driver to support SDHI IP on R7S72100 SoC - sh_mobile_sdhi: remove support for sh7372 - davinci: Use mmc_of_parse() to enable generic mmc DT bindings - meson: Add new driver to support GX platforms - dw_mmc: Deploy generic runtime/system PM support - dw_mmc: Lots of various small improvements As a part of the mmc changes this time, I have also pulled in an immutable branch/tag (soc-device-match-tag1) hosted by Geert Uytterhoeven, to share the implementation of the new soc_device_match() interface. This is needed by these mmc related changes: - mmc: sdhci-of-esdhc: Get correct IP version for T4240-R1.0-R2.0 - soc: fsl: add GUTS driver for QorIQ platforms" * tag 'mmc-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (136 commits) mmc: sdhci-cadence: add Cadence SD4HC support mmc: sdhci: export sdhci_execute_tuning() mmc: sdhci: Tidy tuning loop mmc: sdhci: Simplify tuning block size logic mmc: sdhci: Factor out tuning helper functions mmc: sdhci: Use mmc_abort_tuning() mmc: mmc: Introduce mmc_abort_tuning() mmc: sdhci: Always allow tuning to fall back to fixed sampling mmc: sdhci: Fix tuning reset after exhausting the maximum number of loops mmc: sdhci: Fix recovery from tuning timeout Revert "mmc: sdhci: Reset cmd and data circuits after tuning failure" mmc: mmc: Relax checking for switch errors after HS200 switch mmc: sdhci-acpi: support 80860F14 UID 2 SDIO bus mmc: sdhci-of-at91: remove bogus MMC_SDHCI_IO_ACCESSORS select mmc: sdhci-pci: Use ACPI to get max frequency for Intel NI byt sdio mmc: sdhci-pci: Add PCI ID for Intel NI byt sdio mmc: sdhci-s3c: add spin_unlock_irq() before calling clk_round_rate mmc: dw_mmc: display the clock message only one time when card is polling mmc: dw_mmc: add the debug message for polling and non-removable mmc: dw_mmc: check the "present" variable before checking flags ...
Diffstat (limited to 'include/linux/mmc')
-rw-r--r--include/linux/mmc/card.h14
-rw-r--r--include/linux/mmc/core.h16
-rw-r--r--include/linux/mmc/dw_mmc.h6
-rw-r--r--include/linux/mmc/host.h17
-rw-r--r--include/linux/mmc/mmc.h17
-rw-r--r--include/linux/mmc/slot-gpio.h1
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
210enum 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;
15struct mmc_data; 15struct mmc_data;
16struct mmc_request; 16struct mmc_request;
17 17
18enum 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
18struct mmc_command { 30struct mmc_command {
19 u32 opcode; 31 u32 opcode;
20 u32 arg; 32 u32 arg;
@@ -150,7 +162,8 @@ struct mmc_async_req;
150extern int mmc_stop_bkops(struct mmc_card *); 162extern int mmc_stop_bkops(struct mmc_card *);
151extern int mmc_read_bkops_status(struct mmc_card *); 163extern int mmc_read_bkops_status(struct mmc_card *);
152extern struct mmc_async_req *mmc_start_req(struct mmc_host *, 164extern 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 *);
154extern int mmc_interrupt_hpi(struct mmc_card *); 167extern int mmc_interrupt_hpi(struct mmc_card *);
155extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *); 168extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
156extern void mmc_wait_for_req_done(struct mmc_host *host, 169extern 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 *,
163extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); 176extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
164extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 177extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
165extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); 178extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
179extern int mmc_abort_tuning(struct mmc_host *host, u32 opcode);
166extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd); 180extern 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
42enum 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
42struct mmc_data; 48struct mmc_data;
43 49
44enum { 50enum {
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 */
203struct mmc_context_info { 201struct 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
211struct regulator; 208struct 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
498static inline int mmc_host_packed_wr(struct mmc_host *host)
499{
500 return host->caps2 & MMC_CAP2_PACKED_WR;
501}
502
503static inline int mmc_card_hs(struct mmc_card *card) 495static 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
541static inline bool mmc_can_retune(struct mmc_host *host)
542{
543 return host->can_retune == 1;
544}
545
549void mmc_retune_pause(struct mmc_host *host); 546void mmc_retune_pause(struct mmc_host *host);
550void mmc_retune_unpause(struct mmc_host *host); 547void 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
87static inline bool mmc_op_multi(u32 opcode) 94static 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,
29void mmc_gpio_set_cd_isr(struct mmc_host *host, 29void 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));
31void mmc_gpiod_request_cd_irq(struct mmc_host *host); 31void mmc_gpiod_request_cd_irq(struct mmc_host *host);
32bool mmc_can_gpio_cd(struct mmc_host *host);
32 33
33#endif 34#endif