![Linus Torvalds](/assets/img/avatar_default.png)
Core: * Support for MMC 4.5 Data Tag feature -- we tag REQ_META, so devices that support Data Tag will provide increased throughput for metadata. * Faster detection of card removal on I/O errors. Drivers: * dw_mmc now supports eMMC Power Off Notify, has PCI support, and implements pre_req and post_req for asynchronous requests. * omap_hsmmc now supports device tree. * esdhc now has power management support. * sdhci-tegra now supports Tegra30 devices. * sdhci-spear now supports hibernation. * tmio_mmc now supports using a GPIO for card detection. * Intel PCH now supports 8-bit bus transfers. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJPcejzAAoJEHNBYZ7TNxYM1eEQALs8LAoHcp9vdG2Uttz65HQL ISavfZIVTiLO22ugg5NKXdAOSAv0xdIeuUdpsxRr3W7j27OP41KLq1V7U+Mvnzm0 VG+99J4kdrpgIe+ogvq9IHsnCQZ8ERSzTd2My+O1l9O0jYAAJ2mnsyljlMnaCFS4 lac4/1wlGpogz8UXCEL54V1LJFWW2YWJ6wrjcsu4gaJMyAFk83rbUP1XnlZJOZL2 Z8e8AHh30tJ+dWOGUJRzdRhy6R1pMNabiUP/U+m9pvcTNdGYYbSGDKvmVmSzQOLH VtD7wzfQysj1ReVr2zyhkMif/el/F80JesRrAE7xS2IYJvhj5RmADQY8fE+KKFD9 n+6UkfHbI+ikRZgyeivqlnGC2j2YZ1DqxnptbfBuMPuvAliE6JjQuNunCo0jyl6o +uZ8f84Dq3mZ/6ldb7vKbwvNZXVzUNlB4thH1MqWXDDXb1YUS5jXO7jBRhgvhLXg Wb9Pbi92QMArrq8c0Ch1Yy0ufZZEJ2wTh2Sp2vBqvVEEZ7X3R3GUFGmsCqwS9Ew1 NSSMsc+ANNKY3/qDC7vyyCIuYVqTrZmi0Zr/IcTCGy0YcFJiK5bblJeL9l1kYOyo 3KPno/ZkC+qZSHGCab9RvRWemqdAgTwdxch+BalXLVt4NhRGNIMeBOVNSMsbeP9e aA33LGNp258Jdphmv0NE =T4T+ -----END PGP SIGNATURE----- Merge tag 'mmc-merge-for-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc Pull MMC updates from Chris Ball: Core: * Support for MMC 4.5 Data Tag feature -- we tag REQ_META, so devices that support Data Tag will provide increased throughput for metadata. * Faster detection of card removal on I/O errors. Drivers: * dw_mmc now supports eMMC Power Off Notify, has PCI support, and implements pre_req and post_req for asynchronous requests. * omap_hsmmc now supports device tree. * esdhc now has power management support. * sdhci-tegra now supports Tegra30 devices. * sdhci-spear now supports hibernation. * tmio_mmc now supports using a GPIO for card detection. * Intel PCH now supports 8-bit bus transfers. * tag 'mmc-merge-for-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (53 commits) mmc: sh_mmcif: simplify bitmask macros mmc: sh_mobile_sdhi: support modular mmc-core with non-standard hotplug mmc: sh_mobile_sdhi: add a callback for board specific init code mmc: tmio: cosmetic: prettify the tmio_mmc_set_ios() function mmc: sh_mobile_sdhi: do not manage PM clocks manually mmc: tmio_mmc: remove unused sdio_irq_enabled flag mmc: tmio_mmc: power status flag doesn't have to be exposed in platform data mmc: sh_mobile_sdhi: pass card hotplug GPIO number to TMIO MMC mmc: tmio_mmc: support the generic MMC GPIO card hotplug helper mmc: tmio: calculate the native hotplug condition only once mmc: simplify mmc_cd_gpio_request() by removing two parameters mmc: sdhci-pci: allow 8-bit bus width for Intel PCH mmc: sdhci: check interrupt flags in ISR again mmc: sdhci-pci: Add MSI support mmc: core: warn when card doesn't support HPI mmc: davinci: Poll status for small size transfers mmc: davinci: Eliminate spurious interrupts mmc: omap_hsmmc: Avoid a regulator voltage change with dt mmc: omap_hsmmc: Convert hsmmc driver to use device tree mmc: sdhci-pci: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for Medfield SDIO ...
198 lines
6.8 KiB
C
198 lines
6.8 KiB
C
/*
|
|
* linux/include/linux/mmc/core.h
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#ifndef LINUX_MMC_CORE_H
|
|
#define LINUX_MMC_CORE_H
|
|
|
|
#include <linux/interrupt.h>
|
|
#include <linux/completion.h>
|
|
|
|
struct request;
|
|
struct mmc_data;
|
|
struct mmc_request;
|
|
|
|
struct mmc_command {
|
|
u32 opcode;
|
|
u32 arg;
|
|
u32 resp[4];
|
|
unsigned int flags; /* expected response type */
|
|
#define MMC_RSP_PRESENT (1 << 0)
|
|
#define MMC_RSP_136 (1 << 1) /* 136 bit response */
|
|
#define MMC_RSP_CRC (1 << 2) /* expect valid crc */
|
|
#define MMC_RSP_BUSY (1 << 3) /* card may send busy */
|
|
#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */
|
|
|
|
#define MMC_CMD_MASK (3 << 5) /* non-SPI command type */
|
|
#define MMC_CMD_AC (0 << 5)
|
|
#define MMC_CMD_ADTC (1 << 5)
|
|
#define MMC_CMD_BC (2 << 5)
|
|
#define MMC_CMD_BCR (3 << 5)
|
|
|
|
#define MMC_RSP_SPI_S1 (1 << 7) /* one status byte */
|
|
#define MMC_RSP_SPI_S2 (1 << 8) /* second byte */
|
|
#define MMC_RSP_SPI_B4 (1 << 9) /* four data bytes */
|
|
#define MMC_RSP_SPI_BUSY (1 << 10) /* card may send busy */
|
|
|
|
/*
|
|
* These are the native response types, and correspond to valid bit
|
|
* patterns of the above flags. One additional valid pattern
|
|
* is all zeros, which means we don't expect a response.
|
|
*/
|
|
#define MMC_RSP_NONE (0)
|
|
#define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
|
|
#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
|
|
#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
|
|
#define MMC_RSP_R3 (MMC_RSP_PRESENT)
|
|
#define MMC_RSP_R4 (MMC_RSP_PRESENT)
|
|
#define MMC_RSP_R5 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
|
|
#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
|
|
#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
|
|
|
|
#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
|
|
|
|
/*
|
|
* These are the SPI response types for MMC, SD, and SDIO cards.
|
|
* Commands return R1, with maybe more info. Zero is an error type;
|
|
* callers must always provide the appropriate MMC_RSP_SPI_Rx flags.
|
|
*/
|
|
#define MMC_RSP_SPI_R1 (MMC_RSP_SPI_S1)
|
|
#define MMC_RSP_SPI_R1B (MMC_RSP_SPI_S1|MMC_RSP_SPI_BUSY)
|
|
#define MMC_RSP_SPI_R2 (MMC_RSP_SPI_S1|MMC_RSP_SPI_S2)
|
|
#define MMC_RSP_SPI_R3 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
|
|
#define MMC_RSP_SPI_R4 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
|
|
#define MMC_RSP_SPI_R5 (MMC_RSP_SPI_S1|MMC_RSP_SPI_S2)
|
|
#define MMC_RSP_SPI_R7 (MMC_RSP_SPI_S1|MMC_RSP_SPI_B4)
|
|
|
|
#define mmc_spi_resp_type(cmd) ((cmd)->flags & \
|
|
(MMC_RSP_SPI_S1|MMC_RSP_SPI_BUSY|MMC_RSP_SPI_S2|MMC_RSP_SPI_B4))
|
|
|
|
/*
|
|
* These are the command types.
|
|
*/
|
|
#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
|
|
|
|
unsigned int retries; /* max number of retries */
|
|
unsigned int error; /* command error */
|
|
|
|
/*
|
|
* Standard errno values are used for errors, but some have specific
|
|
* meaning in the MMC layer:
|
|
*
|
|
* ETIMEDOUT Card took too long to respond
|
|
* EILSEQ Basic format problem with the received or sent data
|
|
* (e.g. CRC check failed, incorrect opcode in response
|
|
* or bad end bit)
|
|
* EINVAL Request cannot be performed because of restrictions
|
|
* in hardware and/or the driver
|
|
* ENOMEDIUM Host can determine that the slot is empty and is
|
|
* actively failing requests
|
|
*/
|
|
|
|
unsigned int cmd_timeout_ms; /* in milliseconds */
|
|
|
|
struct mmc_data *data; /* data segment associated with cmd */
|
|
struct mmc_request *mrq; /* associated request */
|
|
};
|
|
|
|
struct mmc_data {
|
|
unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */
|
|
unsigned int timeout_clks; /* data timeout (in clocks) */
|
|
unsigned int blksz; /* data block size */
|
|
unsigned int blocks; /* number of blocks */
|
|
unsigned int error; /* data error */
|
|
unsigned int flags;
|
|
|
|
#define MMC_DATA_WRITE (1 << 8)
|
|
#define MMC_DATA_READ (1 << 9)
|
|
#define MMC_DATA_STREAM (1 << 10)
|
|
|
|
unsigned int bytes_xfered;
|
|
|
|
struct mmc_command *stop; /* stop command */
|
|
struct mmc_request *mrq; /* associated request */
|
|
|
|
unsigned int sg_len; /* size of scatter list */
|
|
struct scatterlist *sg; /* I/O scatter list */
|
|
s32 host_cookie; /* host private data */
|
|
};
|
|
|
|
struct mmc_request {
|
|
struct mmc_command *sbc; /* SET_BLOCK_COUNT for multiblock */
|
|
struct mmc_command *cmd;
|
|
struct mmc_data *data;
|
|
struct mmc_command *stop;
|
|
|
|
struct completion completion;
|
|
void (*done)(struct mmc_request *);/* completion function */
|
|
};
|
|
|
|
struct mmc_host;
|
|
struct mmc_card;
|
|
struct mmc_async_req;
|
|
|
|
extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
|
|
struct mmc_async_req *, int *);
|
|
extern int mmc_interrupt_hpi(struct mmc_card *);
|
|
extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
|
|
extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
|
|
extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
|
|
extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
|
|
struct mmc_command *, int);
|
|
extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
|
|
|
|
#define MMC_ERASE_ARG 0x00000000
|
|
#define MMC_SECURE_ERASE_ARG 0x80000000
|
|
#define MMC_TRIM_ARG 0x00000001
|
|
#define MMC_DISCARD_ARG 0x00000003
|
|
#define MMC_SECURE_TRIM1_ARG 0x80000001
|
|
#define MMC_SECURE_TRIM2_ARG 0x80008000
|
|
|
|
#define MMC_SECURE_ARGS 0x80000000
|
|
#define MMC_TRIM_ARGS 0x00008001
|
|
|
|
extern int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
|
|
unsigned int arg);
|
|
extern int mmc_can_erase(struct mmc_card *card);
|
|
extern int mmc_can_trim(struct mmc_card *card);
|
|
extern int mmc_can_discard(struct mmc_card *card);
|
|
extern int mmc_can_sanitize(struct mmc_card *card);
|
|
extern int mmc_can_secure_erase_trim(struct mmc_card *card);
|
|
extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
|
|
unsigned int nr);
|
|
extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
|
|
|
|
extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
|
|
extern int mmc_hw_reset(struct mmc_host *host);
|
|
extern int mmc_hw_reset_check(struct mmc_host *host);
|
|
extern int mmc_can_reset(struct mmc_card *card);
|
|
|
|
extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
|
|
extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
|
|
|
|
extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
|
|
extern void mmc_release_host(struct mmc_host *host);
|
|
extern int mmc_try_claim_host(struct mmc_host *host);
|
|
|
|
extern int mmc_flush_cache(struct mmc_card *);
|
|
|
|
extern int mmc_detect_card_removed(struct mmc_host *host);
|
|
|
|
/**
|
|
* mmc_claim_host - exclusively claim a host
|
|
* @host: mmc host to claim
|
|
*
|
|
* Claim a host for a set of operations.
|
|
*/
|
|
static inline void mmc_claim_host(struct mmc_host *host)
|
|
{
|
|
__mmc_claim_host(host, NULL);
|
|
}
|
|
|
|
extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
|
|
|
|
#endif /* LINUX_MMC_CORE_H */
|