1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef MMC_H
13#define MMC_H
14
15#include <linux/list.h>
16#include <linux/interrupt.h>
17#include <linux/device.h>
18
19struct request;
20struct mmc_data;
21struct mmc_request;
22
23struct mmc_command {
24 u32 opcode;
25 u32 arg;
26 u32 resp[4];
27 unsigned int flags;
28#define MMC_RSP_PRESENT (1 << 0)
29#define MMC_RSP_136 (1 << 1)
30#define MMC_RSP_CRC (1 << 2)
31#define MMC_RSP_BUSY (1 << 3)
32#define MMC_RSP_OPCODE (1 << 4)
33#define MMC_CMD_MASK (3 << 5)
34#define MMC_CMD_AC (0 << 5)
35#define MMC_CMD_ADTC (1 << 5)
36#define MMC_CMD_BC (2 << 5)
37#define MMC_CMD_BCR (3 << 5)
38
39#define MMC_RSP_NONE (0)
40#define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
41#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
42#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
43#define MMC_RSP_R3 (MMC_RSP_PRESENT)
44#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC)
45
46#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
47
48#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
49
50 unsigned int retries;
51 unsigned int error;
52
53#define MMC_ERR_NONE 0
54#define MMC_ERR_TIMEOUT 1
55#define MMC_ERR_BADCRC 2
56#define MMC_ERR_FIFO 3
57#define MMC_ERR_FAILED 4
58#define MMC_ERR_INVALID 5
59
60 struct mmc_data *data;
61 struct mmc_request *mrq;
62};
63
64struct mmc_data {
65 unsigned int timeout_ns;
66 unsigned int timeout_clks;
67 unsigned int blksz_bits;
68 unsigned int blksz;
69 unsigned int blocks;
70 unsigned int error;
71 unsigned int flags;
72
73#define MMC_DATA_WRITE (1 << 8)
74#define MMC_DATA_READ (1 << 9)
75#define MMC_DATA_STREAM (1 << 10)
76#define MMC_DATA_MULTI (1 << 11)
77
78 unsigned int bytes_xfered;
79
80 struct mmc_command *stop;
81 struct mmc_request *mrq;
82
83 unsigned int sg_len;
84 struct scatterlist *sg;
85};
86
87struct mmc_request {
88 struct mmc_command *cmd;
89 struct mmc_data *data;
90 struct mmc_command *stop;
91
92 void *done_data;
93 void (*done)(struct mmc_request *);
94};
95
96struct mmc_host;
97struct mmc_card;
98
99#endif
100