aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-07 15:24:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-07 15:24:50 -0400
commit15d8ffc96464f6571ecf22043c45fad659f11bdd (patch)
tree7060f5557f370532478f6a652efff7473acbb856 /include/linux
parenta0725ab0c7536076d5477264420ef420ebb64501 (diff)
parentc16a854e4463078aedad601fac76341760a66dd1 (diff)
Merge tag 'mmc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC updates from Ulf Hansson: "MMC core: - Continue to refactor the mmc block code to prepare for blkmq - Move mmc block debugfs into block module - Next step for eMMC CMDQ by adding a new mmc host interface for it - Move Kconfig option MMC_DEBUG from core to host - Some additional minor improvements MMC host: - Declare structs as const when applicable - Explicitly request exclusive reset control when applicable - Improve some error paths and other various cleanups - sdhci: Preparations to support SDHCI OMAP - sdhci: Improve some PM related code - sdhci: Re-factoring and modernizations - sdhci-xenon: Add runtime PM and system sleep support - sdhci-xenon: Add support for eMMC HS400 Enhanced Strobe - sdhci-cadence: Add system sleep support - sdhci-of-at91: Improve system sleep support - dw_mmc: Add support for Hisilicon hi3660 - sunxi: Add support for A83T eMMC - sunxi: Add support for DDR52 mode - meson-gx: Add support for UHS-I SD-cards - meson-gx: Cleanups and improvements - tmio: Fix CMD12 (STOP) handling - tmio: Cleanups and improvements - renesas_sdhi: Add r8a7743/5 support - renesas-sdhi: Add support for R-Car Gen3 SDHI DMAC - renesas_sdhi: Cleanups and improvements" * tag 'mmc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (145 commits) mmc: renesas_sdhi: Add r8a7743/5 support mmc: meson-gx: fix __ffsdi2 undefined on arm32 mmc: sdhci-xenon: add runtime pm support and reimplement standby mmc: core: Move mmc_start_areq() declaration mmc: mmci: stop building qcom dml as module mmc: sunxi: Reset the device at probe time clk: sunxi-ng: Provide a default reset hook mmc: meson-gx: rework tuning function mmc: meson-gx: change default tx phase mmc: meson-gx: implement voltage switch callback mmc: meson-gx: use CCF to handle the clock phases mmc: meson-gx: implement card_busy callback mmc: meson-gx: simplify interrupt handler mmc: meson-gx: work around clk-stop issue mmc: meson-gx: fix dual data rate mode frequencies mmc: meson-gx: rework clock init function mmc: meson-gx: rework clk_set function mmc: meson-gx: rework set_ios function mmc: meson-gx: cfg init overwrite values mmc: meson-gx: initialize sane clk default before clock register ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/clk/sunxi-ng.h35
-rw-r--r--include/linux/mfd/tmio.h5
-rw-r--r--include/linux/mmc/card.h4
-rw-r--r--include/linux/mmc/core.h23
-rw-r--r--include/linux/mmc/host.h60
5 files changed, 112 insertions, 15 deletions
diff --git a/include/linux/clk/sunxi-ng.h b/include/linux/clk/sunxi-ng.h
new file mode 100644
index 000000000000..990f760f70e5
--- /dev/null
+++ b/include/linux/clk/sunxi-ng.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2017 Chen-Yu Tsai. All rights reserved.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _LINUX_CLK_SUNXI_NG_H_
15#define _LINUX_CLK_SUNXI_NG_H_
16
17#include <linux/errno.h>
18
19#ifdef CONFIG_SUNXI_CCU
20int sunxi_ccu_set_mmc_timing_mode(struct clk *clk, bool new_mode);
21int sunxi_ccu_get_mmc_timing_mode(struct clk *clk);
22#else
23static inline int sunxi_ccu_set_mmc_timing_mode(struct clk *clk,
24 bool new_mode)
25{
26 return -ENOTSUPP;
27}
28
29static inline int sunxi_ccu_get_mmc_timing_mode(struct clk *clk)
30{
31 return -ENOTSUPP;
32}
33#endif
34
35#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 26e8f8c0a6db..b572955e6de6 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -107,6 +107,9 @@
107 */ 107 */
108#define TMIO_MMC_CLK_ACTUAL BIT(10) 108#define TMIO_MMC_CLK_ACTUAL BIT(10)
109 109
110/* Some controllers have a CBSY bit */
111#define TMIO_MMC_HAVE_CBSY BIT(11)
112
110int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 113int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
111int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 114int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
112void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 115void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
@@ -128,6 +131,8 @@ struct tmio_mmc_data {
128 unsigned int cd_gpio; 131 unsigned int cd_gpio;
129 int alignment_shift; 132 int alignment_shift;
130 dma_addr_t dma_rx_offset; 133 dma_addr_t dma_rx_offset;
134 unsigned int max_blk_count;
135 unsigned short max_segs;
131 void (*set_pwr)(struct platform_device *host, int state); 136 void (*set_pwr)(struct platform_device *host, int state);
132 void (*set_clk_div)(struct platform_device *host, int state); 137 void (*set_clk_div)(struct platform_device *host, int state);
133}; 138};
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 46c73e97e61f..279b39008a33 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -29,8 +29,8 @@ struct mmc_csd {
29 unsigned char structure; 29 unsigned char structure;
30 unsigned char mmca_vsn; 30 unsigned char mmca_vsn;
31 unsigned short cmdclass; 31 unsigned short cmdclass;
32 unsigned short tacc_clks; 32 unsigned short taac_clks;
33 unsigned int tacc_ns; 33 unsigned int taac_ns;
34 unsigned int c_size; 34 unsigned int c_size;
35 unsigned int r2w_factor; 35 unsigned int r2w_factor;
36 unsigned int max_dtr; 36 unsigned int max_dtr;
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index a0c63ea28796..927519385482 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -122,11 +122,18 @@ struct mmc_data {
122 unsigned int timeout_clks; /* data timeout (in clocks) */ 122 unsigned int timeout_clks; /* data timeout (in clocks) */
123 unsigned int blksz; /* data block size */ 123 unsigned int blksz; /* data block size */
124 unsigned int blocks; /* number of blocks */ 124 unsigned int blocks; /* number of blocks */
125 unsigned int blk_addr; /* block address */
125 int error; /* data error */ 126 int error; /* data error */
126 unsigned int flags; 127 unsigned int flags;
127 128
128#define MMC_DATA_WRITE (1 << 8) 129#define MMC_DATA_WRITE BIT(8)
129#define MMC_DATA_READ (1 << 9) 130#define MMC_DATA_READ BIT(9)
131/* Extra flags used by CQE */
132#define MMC_DATA_QBR BIT(10) /* CQE queue barrier*/
133#define MMC_DATA_PRIO BIT(11) /* CQE high priority */
134#define MMC_DATA_REL_WR BIT(12) /* Reliable write */
135#define MMC_DATA_DAT_TAG BIT(13) /* Tag request */
136#define MMC_DATA_FORCED_PRG BIT(14) /* Forced programming */
130 137
131 unsigned int bytes_xfered; 138 unsigned int bytes_xfered;
132 139
@@ -149,18 +156,22 @@ struct mmc_request {
149 struct completion completion; 156 struct completion completion;
150 struct completion cmd_completion; 157 struct completion cmd_completion;
151 void (*done)(struct mmc_request *);/* completion function */ 158 void (*done)(struct mmc_request *);/* completion function */
159 /*
160 * Notify uppers layers (e.g. mmc block driver) that recovery is needed
161 * due to an error associated with the mmc_request. Currently used only
162 * by CQE.
163 */
164 void (*recovery_notifier)(struct mmc_request *);
152 struct mmc_host *host; 165 struct mmc_host *host;
153 166
154 /* Allow other commands during this ongoing data transfer or busy wait */ 167 /* Allow other commands during this ongoing data transfer or busy wait */
155 bool cap_cmd_during_tfr; 168 bool cap_cmd_during_tfr;
169
170 int tag;
156}; 171};
157 172
158struct mmc_card; 173struct mmc_card;
159struct mmc_async_req;
160 174
161struct mmc_async_req *mmc_start_areq(struct mmc_host *host,
162 struct mmc_async_req *areq,
163 enum mmc_blk_status *ret_stat);
164void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq); 175void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq);
165int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, 176int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd,
166 int retries); 177 int retries);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ebd1cebbef0c..f3f2d07feb2a 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -162,6 +162,50 @@ struct mmc_host_ops {
162 unsigned int direction, int blk_size); 162 unsigned int direction, int blk_size);
163}; 163};
164 164
165struct mmc_cqe_ops {
166 /* Allocate resources, and make the CQE operational */
167 int (*cqe_enable)(struct mmc_host *host, struct mmc_card *card);
168 /* Free resources, and make the CQE non-operational */
169 void (*cqe_disable)(struct mmc_host *host);
170 /*
171 * Issue a read, write or DCMD request to the CQE. Also deal with the
172 * effect of ->cqe_off().
173 */
174 int (*cqe_request)(struct mmc_host *host, struct mmc_request *mrq);
175 /* Free resources (e.g. DMA mapping) associated with the request */
176 void (*cqe_post_req)(struct mmc_host *host, struct mmc_request *mrq);
177 /*
178 * Prepare the CQE and host controller to accept non-CQ commands. There
179 * is no corresponding ->cqe_on(), instead ->cqe_request() is required
180 * to deal with that.
181 */
182 void (*cqe_off)(struct mmc_host *host);
183 /*
184 * Wait for all CQE tasks to complete. Return an error if recovery
185 * becomes necessary.
186 */
187 int (*cqe_wait_for_idle)(struct mmc_host *host);
188 /*
189 * Notify CQE that a request has timed out. Return false if the request
190 * completed or true if a timeout happened in which case indicate if
191 * recovery is needed.
192 */
193 bool (*cqe_timeout)(struct mmc_host *host, struct mmc_request *mrq,
194 bool *recovery_needed);
195 /*
196 * Stop all CQE activity and prepare the CQE and host controller to
197 * accept recovery commands.
198 */
199 void (*cqe_recovery_start)(struct mmc_host *host);
200 /*
201 * Clear the queue and call mmc_cqe_request_done() on all requests.
202 * Requests that errored will have the error set on the mmc_request
203 * (data->error or cmd->error for DCMD). Requests that did not error
204 * will have zero data bytes transferred.
205 */
206 void (*cqe_recovery_finish)(struct mmc_host *host);
207};
208
165struct mmc_async_req { 209struct mmc_async_req {
166 /* active mmc request */ 210 /* active mmc request */
167 struct mmc_request *mrq; 211 struct mmc_request *mrq;
@@ -291,10 +335,6 @@ struct mmc_host {
291 MMC_CAP2_HS200_1_2V_SDR) 335 MMC_CAP2_HS200_1_2V_SDR)
292#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 336#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
293#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 337#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
294#define MMC_CAP2_PACKED_RD (1 << 12) /* Allow packed read */
295#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
296#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
297 MMC_CAP2_PACKED_WR)
298#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 338#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
299#define MMC_CAP2_HS400_1_8V (1 << 15) /* Can support HS400 1.8V */ 339#define MMC_CAP2_HS400_1_8V (1 << 15) /* Can support HS400 1.8V */
300#define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */ 340#define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */
@@ -307,6 +347,8 @@ struct mmc_host {
307#define MMC_CAP2_HS400_ES (1 << 20) /* Host supports enhanced strobe */ 347#define MMC_CAP2_HS400_ES (1 << 20) /* Host supports enhanced strobe */
308#define MMC_CAP2_NO_SD (1 << 21) /* Do not send SD commands during initialization */ 348#define MMC_CAP2_NO_SD (1 << 21) /* Do not send SD commands during initialization */
309#define MMC_CAP2_NO_MMC (1 << 22) /* Do not send (e)MMC commands during initialization */ 349#define MMC_CAP2_NO_MMC (1 << 22) /* Do not send (e)MMC commands during initialization */
350#define MMC_CAP2_CQE (1 << 23) /* Has eMMC command queue engine */
351#define MMC_CAP2_CQE_DCMD (1 << 24) /* CQE can issue a direct command */
310 352
311 mmc_pm_flag_t pm_caps; /* supported pm features */ 353 mmc_pm_flag_t pm_caps; /* supported pm features */
312 354
@@ -328,9 +370,6 @@ struct mmc_host {
328 unsigned int use_spi_crc:1; 370 unsigned int use_spi_crc:1;
329 unsigned int claimed:1; /* host exclusively claimed */ 371 unsigned int claimed:1; /* host exclusively claimed */
330 unsigned int bus_dead:1; /* bus has been released */ 372 unsigned int bus_dead:1; /* bus has been released */
331#ifdef CONFIG_MMC_DEBUG
332 unsigned int removed:1; /* host is being removed */
333#endif
334 unsigned int can_retune:1; /* re-tuning can be used */ 373 unsigned int can_retune:1; /* re-tuning can be used */
335 unsigned int doing_retune:1; /* re-tuning in progress */ 374 unsigned int doing_retune:1; /* re-tuning in progress */
336 unsigned int retune_now:1; /* do re-tuning at next req */ 375 unsigned int retune_now:1; /* do re-tuning at next req */
@@ -393,6 +432,13 @@ struct mmc_host {
393 int dsr_req; /* DSR value is valid */ 432 int dsr_req; /* DSR value is valid */
394 u32 dsr; /* optional driver stage (DSR) value */ 433 u32 dsr; /* optional driver stage (DSR) value */
395 434
435 /* Command Queue Engine (CQE) support */
436 const struct mmc_cqe_ops *cqe_ops;
437 void *cqe_private;
438 int cqe_qdepth;
439 bool cqe_enabled;
440 bool cqe_on;
441
396 unsigned long private[0] ____cacheline_aligned; 442 unsigned long private[0] ____cacheline_aligned;
397}; 443};
398 444